@ckeditor/ckeditor5-ai 48.1.1 → 48.2.0-alpha.1

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 (205) hide show
  1. package/dist/aiactions/model/aiactionsinteraction.d.ts +3 -0
  2. package/dist/aiactions/model/aiactionsreply.d.ts +7 -0
  3. package/dist/aiballoon/aiballoon.d.ts +2 -5
  4. package/dist/aichat/aichatballoon.d.ts +4 -0
  5. package/dist/aichat/aichatcontroller.d.ts +9 -3
  6. package/dist/aichat/aichatui.d.ts +11 -0
  7. package/dist/aichat/model/aichatcontext.d.ts +29 -62
  8. package/dist/aichat/model/aichatconversation.d.ts +18 -23
  9. package/dist/aichat/model/aichatinteraction.d.ts +0 -9
  10. package/dist/aichat/ui/aichatballoonview.d.ts +4 -0
  11. package/dist/aichat/ui/aichatcontrolsview.d.ts +5 -0
  12. package/dist/aichat/ui/aichatfeedview.d.ts +8 -0
  13. package/dist/aichat/ui/aichatview.d.ts +1 -0
  14. package/dist/aichat/ui/controls/aichatcontextpanelview.d.ts +4 -0
  15. package/dist/aichat/ui/controls/aichatdropzoneview.d.ts +26 -0
  16. package/dist/aichat/ui/controls/resources/aichatresourcesballoonview.d.ts +4 -0
  17. package/dist/aichat/utils/eventnames.d.ts +1 -1
  18. package/dist/aichat/utils/parsesingleurl.d.ts +5 -0
  19. package/dist/aichat/utils/readdatatransferfiles.d.ts +14 -0
  20. package/dist/aichat/utils/resolvepaste.d.ts +71 -0
  21. package/dist/aichatshortcuts/ui/aichatshortcutsview.d.ts +6 -0
  22. package/dist/aiconfig.d.ts +1 -1
  23. package/dist/aicore/aiconnector.d.ts +22 -0
  24. package/dist/aicore/aiediting.d.ts +14 -5
  25. package/dist/aicore/aigateway.d.ts +63 -0
  26. package/dist/aicore/model/aicontext.d.ts +4 -20
  27. package/dist/aicore/model/aiinteraction.d.ts +7 -1
  28. package/dist/aicore/model/aireply.d.ts +20 -17
  29. package/dist/aicore/model/airunresult.d.ts +95 -0
  30. package/dist/aicore/pipeline/airesponseapplier.d.ts +3 -15
  31. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartheaderview.d.ts +4 -0
  32. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentparttoolbarview.d.ts +4 -0
  33. package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartview.d.ts +4 -0
  34. package/dist/aicore/utils/{geteditorfromcontext.d.ts → geteditorsfromcontext.d.ts} +1 -2
  35. package/dist/aicore/utils/getoperationsfromreply.d.ts +6 -4
  36. package/dist/aicore/utils/getsuggestionpartsfromreply.d.ts +6 -3
  37. package/dist/aicore/utils/htmlparser.d.ts +8 -2
  38. package/dist/aiquickactions/aiquickactions.d.ts +4 -4
  39. package/dist/aiquickactions/aiquickactionsui.d.ts +1 -1
  40. package/dist/aiquickactions/ui/aiquickactionsdropdowncontentview.d.ts +2 -2
  41. package/dist/aireviewcore/aireviewcorecheckregistry.d.ts +34 -0
  42. package/dist/aireviewcore/aireviewcorecontroller.d.ts +31 -6
  43. package/dist/aireviewcore/aireviewcoreediting.d.ts +1 -1
  44. package/dist/aireviewcore/model/aireviewcheckrun.d.ts +4 -0
  45. package/dist/aireviewmode/aireviewgateway.d.ts +161 -0
  46. package/dist/aireviewmode/aireviewmode.d.ts +60 -2
  47. package/dist/aireviewmode/aireviewmodecheckregistry.d.ts +39 -0
  48. package/dist/aireviewmode/aireviewmodecontroller.d.ts +7 -2
  49. package/dist/aireviewmode/model/aireviewmodechecklist.d.ts +4 -0
  50. package/dist/aireviewmode/model/aireviewrunresult.d.ts +20 -0
  51. package/dist/aitranslate/aitranslatecheckregistry.d.ts +27 -0
  52. package/dist/aitranslate/aitranslatecontroller.d.ts +2 -2
  53. package/dist/augmentation.d.ts +11 -1
  54. package/dist/index-content.css +1 -1
  55. package/dist/index-editor.css +212 -8
  56. package/dist/index.css +212 -8
  57. package/dist/index.d.ts +7 -3
  58. package/dist/index.js +6 -6
  59. package/dist/translations/af.js +1 -1
  60. package/dist/translations/af.umd.js +1 -1
  61. package/dist/translations/ar.js +1 -1
  62. package/dist/translations/ar.umd.js +1 -1
  63. package/dist/translations/ast.js +1 -1
  64. package/dist/translations/ast.umd.js +1 -1
  65. package/dist/translations/az.js +1 -1
  66. package/dist/translations/az.umd.js +1 -1
  67. package/dist/translations/be.js +1 -1
  68. package/dist/translations/be.umd.js +1 -1
  69. package/dist/translations/bg.js +1 -1
  70. package/dist/translations/bg.umd.js +1 -1
  71. package/dist/translations/bn.js +1 -1
  72. package/dist/translations/bn.umd.js +1 -1
  73. package/dist/translations/bs.js +1 -1
  74. package/dist/translations/bs.umd.js +1 -1
  75. package/dist/translations/ca.js +1 -1
  76. package/dist/translations/ca.umd.js +1 -1
  77. package/dist/translations/cs.js +1 -1
  78. package/dist/translations/cs.umd.js +1 -1
  79. package/dist/translations/da.js +1 -1
  80. package/dist/translations/da.umd.js +1 -1
  81. package/dist/translations/de-ch.js +1 -1
  82. package/dist/translations/de-ch.umd.js +1 -1
  83. package/dist/translations/de.js +1 -1
  84. package/dist/translations/de.umd.js +1 -1
  85. package/dist/translations/el.js +1 -1
  86. package/dist/translations/el.umd.js +1 -1
  87. package/dist/translations/en-au.js +1 -1
  88. package/dist/translations/en-au.umd.js +1 -1
  89. package/dist/translations/en-gb.js +1 -1
  90. package/dist/translations/en-gb.umd.js +1 -1
  91. package/dist/translations/en.js +1 -1
  92. package/dist/translations/en.umd.js +1 -1
  93. package/dist/translations/eo.js +1 -1
  94. package/dist/translations/eo.umd.js +1 -1
  95. package/dist/translations/es-co.js +1 -1
  96. package/dist/translations/es-co.umd.js +1 -1
  97. package/dist/translations/es.js +1 -1
  98. package/dist/translations/es.umd.js +1 -1
  99. package/dist/translations/et.js +1 -1
  100. package/dist/translations/et.umd.js +1 -1
  101. package/dist/translations/eu.js +1 -1
  102. package/dist/translations/eu.umd.js +1 -1
  103. package/dist/translations/fa.js +1 -1
  104. package/dist/translations/fa.umd.js +1 -1
  105. package/dist/translations/fi.js +1 -1
  106. package/dist/translations/fi.umd.js +1 -1
  107. package/dist/translations/fr.js +1 -1
  108. package/dist/translations/fr.umd.js +1 -1
  109. package/dist/translations/gl.js +1 -1
  110. package/dist/translations/gl.umd.js +1 -1
  111. package/dist/translations/gu.js +1 -1
  112. package/dist/translations/gu.umd.js +1 -1
  113. package/dist/translations/he.js +1 -1
  114. package/dist/translations/he.umd.js +1 -1
  115. package/dist/translations/hi.js +1 -1
  116. package/dist/translations/hi.umd.js +1 -1
  117. package/dist/translations/hr.js +1 -1
  118. package/dist/translations/hr.umd.js +1 -1
  119. package/dist/translations/hu.js +1 -1
  120. package/dist/translations/hu.umd.js +1 -1
  121. package/dist/translations/hy.js +1 -1
  122. package/dist/translations/hy.umd.js +1 -1
  123. package/dist/translations/id.js +1 -1
  124. package/dist/translations/id.umd.js +1 -1
  125. package/dist/translations/it.js +1 -1
  126. package/dist/translations/it.umd.js +1 -1
  127. package/dist/translations/ja.js +1 -1
  128. package/dist/translations/ja.umd.js +1 -1
  129. package/dist/translations/jv.js +1 -1
  130. package/dist/translations/jv.umd.js +1 -1
  131. package/dist/translations/kk.js +1 -1
  132. package/dist/translations/kk.umd.js +1 -1
  133. package/dist/translations/km.js +1 -1
  134. package/dist/translations/km.umd.js +1 -1
  135. package/dist/translations/kn.js +1 -1
  136. package/dist/translations/kn.umd.js +1 -1
  137. package/dist/translations/ko.js +1 -1
  138. package/dist/translations/ko.umd.js +1 -1
  139. package/dist/translations/ku.js +1 -1
  140. package/dist/translations/ku.umd.js +1 -1
  141. package/dist/translations/lt.js +1 -1
  142. package/dist/translations/lt.umd.js +1 -1
  143. package/dist/translations/lv.js +1 -1
  144. package/dist/translations/lv.umd.js +1 -1
  145. package/dist/translations/ms.js +1 -1
  146. package/dist/translations/ms.umd.js +1 -1
  147. package/dist/translations/nb.js +1 -1
  148. package/dist/translations/nb.umd.js +1 -1
  149. package/dist/translations/ne.js +1 -1
  150. package/dist/translations/ne.umd.js +1 -1
  151. package/dist/translations/nl.js +1 -1
  152. package/dist/translations/nl.umd.js +1 -1
  153. package/dist/translations/no.js +1 -1
  154. package/dist/translations/no.umd.js +1 -1
  155. package/dist/translations/oc.js +1 -1
  156. package/dist/translations/oc.umd.js +1 -1
  157. package/dist/translations/pl.js +1 -1
  158. package/dist/translations/pl.umd.js +1 -1
  159. package/dist/translations/pt-br.js +1 -1
  160. package/dist/translations/pt-br.umd.js +1 -1
  161. package/dist/translations/pt.js +1 -1
  162. package/dist/translations/pt.umd.js +1 -1
  163. package/dist/translations/ro.js +1 -1
  164. package/dist/translations/ro.umd.js +1 -1
  165. package/dist/translations/ru.js +1 -1
  166. package/dist/translations/ru.umd.js +1 -1
  167. package/dist/translations/si.js +1 -1
  168. package/dist/translations/si.umd.js +1 -1
  169. package/dist/translations/sk.js +1 -1
  170. package/dist/translations/sk.umd.js +1 -1
  171. package/dist/translations/sl.js +1 -1
  172. package/dist/translations/sl.umd.js +1 -1
  173. package/dist/translations/sq.js +1 -1
  174. package/dist/translations/sq.umd.js +1 -1
  175. package/dist/translations/sr-latn.js +1 -1
  176. package/dist/translations/sr-latn.umd.js +1 -1
  177. package/dist/translations/sr.js +1 -1
  178. package/dist/translations/sr.umd.js +1 -1
  179. package/dist/translations/sv.js +1 -1
  180. package/dist/translations/sv.umd.js +1 -1
  181. package/dist/translations/th.js +1 -1
  182. package/dist/translations/th.umd.js +1 -1
  183. package/dist/translations/ti.js +1 -1
  184. package/dist/translations/ti.umd.js +1 -1
  185. package/dist/translations/tk.js +1 -1
  186. package/dist/translations/tk.umd.js +1 -1
  187. package/dist/translations/tr.js +1 -1
  188. package/dist/translations/tr.umd.js +1 -1
  189. package/dist/translations/tt.js +1 -1
  190. package/dist/translations/tt.umd.js +1 -1
  191. package/dist/translations/ug.js +1 -1
  192. package/dist/translations/ug.umd.js +1 -1
  193. package/dist/translations/uk.js +1 -1
  194. package/dist/translations/uk.umd.js +1 -1
  195. package/dist/translations/ur.js +1 -1
  196. package/dist/translations/ur.umd.js +1 -1
  197. package/dist/translations/uz.js +1 -1
  198. package/dist/translations/uz.umd.js +1 -1
  199. package/dist/translations/vi.js +1 -1
  200. package/dist/translations/vi.umd.js +1 -1
  201. package/dist/translations/zh-cn.js +1 -1
  202. package/dist/translations/zh-cn.umd.js +1 -1
  203. package/dist/translations/zh.js +1 -1
  204. package/dist/translations/zh.umd.js +1 -1
  205. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Plugin as _0x5686f0,Command as _0x3a665b,ContextPlugin as _0x23f270,Editor as _0x5ca812}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x16addf,IconCheck as _0x4ab520,IconError as _0x90f260,IconSubmit as _0x177154,IconAIHistory as _0x41655b,IconMagicWand as _0x343811,IconRobotPencil as _0x98106a,IconMaximize as _0x5822e5,IconMinimize as _0x494a35,IconShowChangesOn as _0x135466,IconShowChangesOff as _0x3c0485,IconDocument as _0x448da1,IconBoxWithCross as _0x1dbb45,IconBoxWithCheck as _0x2d73d7,IconBoxWithMarker as _0x3c26bd,IconInfo as _0x11ec0d,IconWeb as _0x271520,IconCancel as _0x5ed072,IconSelection as _0xf81085,IconFileUpload as _0x5249ad,IconLink as _0x1e2b51,IconBulb as _0xeb7c36,IconAI as _0x348d31,IconPreviousArrow as _0x1607c0,IconDocumentOutline as _0x1c299b,IconLoupe as _0x10b46f,IconPaperClip as _0x5718be,IconBrowseFiles as _0x16f379,IconDropdownArrow as _0x4e78fd,IconStop as _0x1b062b,IconPlus as _0x37726c,IconAIChat as _0x2ea593,IconPin as _0x5e7c87,IconThreeHorizontalDots as _0x57c6c8,IconAIReview as _0x2e2f4a,IconAITranslate as _0x4d8ff7,IconAIAskAI as _0xbf82c1,IconThumbUp as _0x25b316,IconThumbDown as _0x42e1bc,IconChevronDown as _0x25b93f,IconChevronUp as _0x19d9ab,IconAIQuickActions as _0x15178f,IconAIChatCommands as _0x4ea6bb,IconAIImproveWriting as _0x3da124,IconAIContinueWriting as _0x382928,IconAIGrammarCheck as _0x2920e7,IconAIAdjustLength as _0x10b01a,IconAIChangeTone as _0x1aa706,IconAIOther as _0x47860a,IconRefresh as tt,IconNextArrow as et,IconOutdated as it,IconEye as st,IconEyeCrossedOut as nt,IconChevronRight as rt}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as ot,CKEditorError as at,ObservableMixin as ht,global as ct,isVisible as lt,Rect as ut,Collection as dt,FocusTracker as _t,KeystrokeHandler as It,first as At,logWarning as gt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as wt,insertToPriorityArray as Tt,scrollAncestorsToShowTarget as ft,ResizeObserver as St,_isMotionReduced as Rt,getConstrainedViewportRect as bt,DomEmitterMixin as Ot}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as vt,View as Nt,SpinnerView as yt,IconView as xt,AutocompleteView as Lt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Pt,ButtonLabelView as Ht,FocusCycler as Mt,createLabeledTextarea as Ut,Dialog as Bt,createDropdown as Gt,addMenuToDropdown as Ft,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Wt,DialogViewPosition as Yt,MenuBarMenuListView as $t,MenuBarMenuListItemView as qt,BodyCollection as Qt,BalloonPanelView as Xt,clickOutsideHandler as zt,addListToDropdown as jt,UIModel as Jt,submitHandler as Zt,LabeledFieldView as te,createLabeledInputText as _0x123337,FormHeaderView as _0x3e7902,HighlightedTextView as _0x2cc319,ViewCollection as _0x184ac3,FileDialogButtonView as _0x4509d1,InputTextView as _0x142293,SearchTextView as _0x1be4c1,ListItemButtonView as _0x1a80af,ButtonLabelWithHighlightView as _0x41ed25,DropdownMenuPanelPositioningFunctions as _0x16a65a,BalloonToolbar as _0x1397b8,FormRowView as _0xee19c6,TextareaView as _0x126012}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x53aae2,ClipboardMarkersUtils as _0x477206}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x5a415e,ViewDataTransfer as _0x352cb4,ViewUpcastWriter as _0x4642be,Matcher as _0x442511,_DetachOperation as _0x43c2ab,_insertIntoModelNodeList as _0x126834,_removeFromModelNodeList as _0x164b6b,ModelRange as _0x1445f3,transformOperationSets as _0x27476f,ViewDowncastWriter as _0x4b9165,ModelDocumentFragment as _0xee8836,ModelPosition as _0x3c2be3,ModelTreeWalker as _0x46a368,MarkerOperation as _0x147dae,InsertOperation as _0x129783}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x58cc9d,escape as _0x19d831,cloneDeep as _0x4c306c,throttle as _0x121c0b,debounce as _0x3c2cd8,escapeRegExp as _0x118ed5}from'es-toolkit/compat';import{createParser as _0x3df424}from'eventsource-parser';import{CloudServices as _0x5dd200}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x56717f}from'htmlparser2';import{isTag as _0x4e8462,findOne as _0x4e94ee,getParent as _0xe83088,findAll as _0x2c9ab8,removeElement as _0x32f2bc,prepend as _0x51f634,prependChild as _0x59f22f,appendChild as _0x4c46bc,append as _0x5a70f4,find as _0x592842,isComment as _0x468d05,replaceElement as _0x118b57,getChildren as _0x55fdbd,textContent as _0x11c8f9}from'domutils';import ti from'dom-serializer';import{Document as _0x34e0db,Element as _0x4d1237,Text as _0x5a8104,cloneNode as _0x118fd9,isDocument as _0x40c3ff,isText as _0x31735e,NodeWithChildren as _0x507edc}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x3ceff7,MarkdownGfmMdToHtml as _0xc438b}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0xec741 from'rehype-sanitize';import{fixElementSuggestionRange as _0x43b9ff,DocumentCompare as _0x53dd97,DATA_ID_MODEL_ATTRIBUTE as _0x4140c8,ConfirmMixin as _0x104e5b,getAllMarkersDomElementsSorted as _0x3b0cbb,SuggestionsConversion as _0x53f39c,DATA_ID_VIEW_ATTRIBUTE as _0x4b3396,getMarkerDomElement as _0x1e5795}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x2d4ba4 from'morphdom';import{diffArrays as _0x3e20ff}from'diff';const wi='_ungrouppedCommands';function Ti(_0x3317c4,_0x2d3608){const _0x3af402=(0x0,_0x2d3608['t'])('Other');return _0x3317c4['length']?'groupId'in _0x3317c4[0x0]?_0x3317c4:[{'groupId':wi,'groupLabel':_0x3af402,'order':0x1/0x0,'commands':_0x3317c4}]:[{'groupId':wi,'groupLabel':_0x3af402,'order':0x1/0x0,'commands':[]}];}const fi=globalThis['DataTransfer'],Si='ai-ui';class AIAssistantEditing extends _0x5686f0{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x2c1201}=this,_0x574fca=['ck-fake-ai-selection'];_0x2c1201['config']['get']('ai.assistant.useTheme')&&_0x574fca['push']('ck-ai-assistant-ui_theme'),_0x2c1201['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Si,'view':{'classes':_0x574fca,'priority':0xc}}),_0x2c1201['conversion']['for']('editingDowncast')['markerToElement']({'model':Si,'view':(_0x17a595,{writer:_0x2a71eb})=>{if(!_0x17a595['markerRange']['isCollapsed'])return null;const _0x33b154=_0x2a71eb['createUIElement']('span');return _0x2a71eb['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x33b154),_0x33b154;}});}['afterInit'](){!async function(_0x3feded){const _0x351f00=_0x3ddba5([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]),_0x588350=0x3dffc4e1,_0x49419c=0x3df84e89^_0x588350,_0x58ec64=window[_0x3ddba5([0x44,0x61,0x74,0x65])][_0x3ddba5([0x6e,0x6f,0x77])](),_0x42f2c7=_0x3feded[_0x3ddba5([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x1148fe=new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x23b63f=>{_0x42f2c7[_0x3ddba5([0x6f,0x6e,0x63,0x65])](_0x3ddba5([0x72,0x65,0x61,0x64,0x79]),_0x23b63f);}),_0x871dc5={[_0x3ddba5([0x6b,0x74,0x79])]:_0x3ddba5([0x45,0x43]),[_0x3ddba5([0x75,0x73,0x65])]:_0x3ddba5([0x73,0x69,0x67]),[_0x3ddba5([0x63,0x72,0x76])]:_0x3ddba5([0x50,0x2d,0x32,0x35,0x36]),[_0x3ddba5([0x78])]:_0x3ddba5([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]),[_0x3ddba5([0x79])]:_0x3ddba5([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]),[_0x3ddba5([0x61,0x6c,0x67])]:_0x3ddba5([0x45,0x53,0x32,0x35,0x36])},_0x1d53c3=_0x42f2c7[_0x3ddba5([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x3ddba5([0x67,0x65,0x74])](_0x3ddba5([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x1c106d(){let _0x4c7d12,_0x322117=null,_0x42b061=null;try{if(_0x1d53c3==_0x3ddba5([0x47,0x50,0x4c]))return _0x3ddba5([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x4c7d12=_0x34a329(),!_0x4c7d12)return _0x3ddba5([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x4c7d12[_0x3ddba5([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x42b061=_0x1abfd1(_0x4c7d12[_0x3ddba5([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x4c7d12[_0x3ddba5([0x6a,0x74,0x69])])),await _0x51dd3f()?_0x3f3b22()?_0x203e3b()?_0x3ddba5([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x1b7486()?(_0x4c7d12[_0x3ddba5([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x3ddba5([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x322117=_0x180ced(_0x3ddba5([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x323b7c()):_0x3ddba5([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x3ddba5([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x3ddba5([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x3ddba5([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x203e3b(){const _0x163066=[_0x3ddba5([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x3ddba5([0x74,0x72,0x69,0x61,0x6c])][_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x4c7d12[_0x3ddba5([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x58ec64/0x3e8:0xe10*_0x49419c;return _0x4c7d12[_0x3ddba5([0x65,0x78,0x70])]<_0x163066;}function _0x3f3b22(){const _0x493a8a=_0x4c7d12[_0x3ddba5([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x493a8a&&(!!_0x493a8a[_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3ddba5([0x2a]))||!!_0x493a8a[_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3ddba5([0x41,0x49])));}function _0x1b7486(){const _0x1796ba=_0x4c7d12[_0x3ddba5([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x1796ba||0x0==_0x1796ba[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x29d94b}=new URL(window[_0x3ddba5([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x1796ba[_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x29d94b))return!0x0;const _0x580092=_0x29d94b[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])](_0x3ddba5([0x2e]));return _0x1796ba[_0x3ddba5([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x4398ef=>_0x4398ef[_0x3ddba5([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x3ddba5([0x2a])))[_0x3ddba5([0x6d,0x61,0x70])](_0x12d367=>_0x12d367[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])](_0x3ddba5([0x2e])))[_0x3ddba5([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x34315f=>_0x34315f[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x580092[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x3ddba5([0x6d,0x61,0x70])](_0x3a98ea=>Array(_0x580092[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x3a98ea[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x3ddba5([0x66,0x69,0x6c,0x6c])](_0x3a98ea[0x0]===_0x3ddba5([0x2a])?_0x3ddba5([0x2a]):'')[_0x3ddba5([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x3a98ea))[_0x3ddba5([0x73,0x6f,0x6d,0x65])](_0x15ccc4=>_0x580092[_0x3ddba5([0x65,0x76,0x65,0x72,0x79])]((_0x4872e5,_0x16e99f)=>_0x15ccc4[_0x16e99f]===_0x4872e5||_0x15ccc4[_0x16e99f]===_0x3ddba5([0x2a])));}function _0x323b7c(){return _0x322117&&_0x42b061?new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x2be1a1,_0x44dd72)=>{_0x322117[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x2be1a1,_0x44dd72),_0x42b061[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x158ec1=>{_0x158ec1!=_0x3ddba5([0x56,0x61,0x6c,0x69,0x64])&&_0x2be1a1(_0x158ec1);},_0x44dd72);}):_0x322117||_0x42b061||_0x3ddba5([0x56,0x61,0x6c,0x69,0x64]);}}function _0x1abfd1(_0x5a97a2,_0x1a92ec){return new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x581f38=>{if(_0x548651())return _0x581f38(_0x3ddba5([0x56,0x61,0x6c,0x69,0x64]));_0x14c2fd(),_0x42f2c7[_0x3ddba5([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x3ddba5([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x4bfb6b=!0x1;const _0xaf908=ot();function _0x4ec93c(_0x238634){return!!_0x238634&&(typeof _0x238634===_0x3ddba5([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x238634===_0x3ddba5([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x238634[_0x3ddba5([0x74,0x68,0x65,0x6e])]===_0x3ddba5([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x238634[_0x3ddba5([0x63,0x61,0x74,0x63,0x68])]===_0x3ddba5([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x57551b(_0xbecf2c){_0x769071(_0xbecf2c)[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x121dc1=>{if(!_0x121dc1||_0x121dc1[_0x3ddba5([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x3ddba5([0x6f,0x6b]))return _0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x4729a5(_0x597cf1(_0xaf908+_0x1a92ec))!=_0x121dc1[_0x3ddba5([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x3ddba5([0x56,0x61,0x6c,0x69,0x64]);})[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x16e1d0=>(_0x1c62d7(),_0x16e1d0),()=>{const _0x111200=_0xe1e591();return null==_0x111200?(_0x1c62d7(),_0x3ddba5([0x56,0x61,0x6c,0x69,0x64])):_0x3ddba5(_0x58ec64-_0x111200>(0x19f340e1^_0x588350)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x581f38)[_0x3ddba5([0x63,0x61,0x74,0x63,0x68])](()=>{_0x581f38(_0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x2bd5e1=0x3dc92a61^_0x588350;function _0x1c62d7(){const _0x42e5a7=_0x3ddba5([0x6c,0x6c,0x63,0x74,0x2d])+_0x4729a5(_0x597cf1(_0x5a97a2)),_0x3abdab=_0x57cdee(_0x4729a5(window[_0x3ddba5([0x4d,0x61,0x74,0x68])][_0x3ddba5([0x63,0x65,0x69,0x6c])](_0x58ec64/_0x2bd5e1)));window[_0x3ddba5([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x3ddba5([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x42e5a7,_0x3abdab);}function _0xe1e591(){const _0x1c3e05=_0x3ddba5([0x6c,0x6c,0x63,0x74,0x2d])+_0x4729a5(_0x597cf1(_0x5a97a2)),_0x395338=window[_0x3ddba5([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x3ddba5([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x1c3e05);return _0x395338?window[_0x3ddba5([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x57cdee(_0x395338),0x10)*_0x2bd5e1:null;}function _0x769071(_0x459ee6){return new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x5cd89e,_0x56d7f6)=>{_0x459ee6[_0x3ddba5([0x74,0x68,0x65,0x6e])](_0x5cd89e,_0x56d7f6),window[_0x3ddba5([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x56d7f6,0x3dfe1021^_0x588350);});}}_0x42f2c7[_0x3ddba5([0x6f,0x6e])](_0x3ddba5([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x210584,_0x13c9c9)=>{if(_0x13c9c9[0x0]!=_0x5a97a2)return _0x581f38(_0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x13c9c9[0x1]={..._0x13c9c9[0x1],[_0x3ddba5([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0xaf908};},{[_0x3ddba5([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x3ddba5([0x68,0x69,0x67,0x68])}),_0x42f2c7[_0x3ddba5([0x6f,0x6e])](_0x3ddba5([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x561916=>{_0x4ec93c(_0x561916[_0x3ddba5([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x4bfb6b=!0x0,_0x57551b(_0x561916[_0x3ddba5([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x3ddba5([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x3ddba5([0x6c,0x6f,0x77])}),_0x1148fe[_0x3ddba5([0x74,0x68,0x65,0x6e])](()=>{_0x4bfb6b||_0x581f38(_0x3ddba5([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x548651(){return _0x42f2c7[_0x3ddba5([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x3ddba5([0x76,0x69,0x65,0x77])][_0x3ddba5([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x3ddba5([0x61,0x75,0x74,0x6f]);}function _0x14c2fd(){_0x42f2c7[_0x3ddba5([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x3ddba5([0x76,0x69,0x65,0x77])][_0x3ddba5([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x3ddba5([0x61,0x75,0x74,0x6f]);}}function _0x180ced(_0x3b3445){const _0x157367=[new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x410c1b=>setTimeout(_0x410c1b,0x3df6fa2d^_0x588350)),_0x1148fe[_0x3ddba5([0x74,0x68,0x65,0x6e])](()=>new window[(_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x4eb100=>{let _0x34d12c=0x0;_0x42f2c7[_0x3ddba5([0x6d,0x6f,0x64,0x65,0x6c])][_0x3ddba5([0x6f,0x6e])](_0x3ddba5([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x4e7695,_0x192f07)=>{_0x192f07[0x0][_0x3ddba5([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x34d12c++,_0x34d12c==(0x3dffc109^_0x588350)&&(_0x4eb100(),_0x4e7695[_0x3ddba5([0x6f,0x66,0x66])]());});}))];return window[_0x3ddba5([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x3ddba5([0x72,0x61,0x63,0x65])](_0x157367)[_0x3ddba5([0x74,0x68,0x65,0x6e])](()=>_0x3b3445);}async function _0x1ca79e(){await _0x1148fe,_0x42f2c7[_0x3ddba5([0x6d,0x6f,0x64,0x65,0x6c])][_0x3ddba5([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x1cbe1d,_0x42f2c7[_0x3ddba5([0x6d,0x6f,0x64,0x65,0x6c])][_0x3ddba5([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x1cbe1d,_0x42f2c7[_0x3ddba5([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x3ddba5([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x6bb18f(_0x28cb0b){const _0x179200=_0x3e484f();_0x42f2c7[_0x179200]=_0x3ddba5([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x28cb0b,_0x28cb0b!=_0x3ddba5([0x56,0x61,0x6c,0x69,0x64])&&_0x1ca79e();}function _0x3e484f(){const _0xc068da=window[_0x3ddba5([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x3ddba5([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x3ddba5([0x6e,0x6f,0x77])]())[_0x3ddba5([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x3ddba5([0x2e]),'');let _0xc28308=_0x3ddba5([0x6e]);for(let _0x419d79=0x0;_0x419d79<_0xc068da[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x419d79+=0x2){let _0x5bd0fe=window[_0x3ddba5([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xc068da[_0x3ddba5([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x419d79,_0x419d79+0x2));_0x5bd0fe>=_0x351f00[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x5bd0fe-=_0x351f00[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0xc28308+=_0x351f00[_0x5bd0fe];}return _0xc28308;}function _0x34a329(){const _0x58a307=_0x1d53c3[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])](_0x3ddba5([0x2e]));if(0x3!=_0x58a307[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x2f985b(_0x58a307[0x1]);function _0x2f985b(_0x55a8f2){const _0x1ed764=_0xda10d9(_0x55a8f2);return _0x1ed764&&_0x53a639()?_0x1ed764:null;function _0x53a639(){const _0x205652=_0x1ed764[_0x3ddba5([0x6a,0x74,0x69])],_0x157702=window[_0x3ddba5([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x205652[_0x3ddba5([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x205652[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x10ba3c={..._0x1ed764,[_0x3ddba5([0x6a,0x74,0x69])]:_0x205652[_0x3ddba5([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x205652[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x10ba3c[_0x3ddba5([0x76,0x63])],_0x597cf1(_0x10ba3c)==_0x157702;}}}async function _0x51dd3f(){let _0x3a2563=!0x0;try{const _0x27bdeb=_0x1d53c3[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])](_0x3ddba5([0x2e])),[_0x3dbff9,_0x360e9d,_0x35d404]=_0x27bdeb;return _0x187685(_0x3dbff9),await _0x6dcf74(_0x3dbff9,_0x360e9d,_0x35d404),_0x3a2563;}catch{return!0x1;}function _0x187685(_0x4496a4){const _0x4b1142=_0xda10d9(_0x4496a4);_0x4b1142&&_0x4b1142[_0x3ddba5([0x61,0x6c,0x67])]==_0x3ddba5([0x45,0x53,0x32,0x35,0x36])||(_0x3a2563=!0x1);}async function _0x6dcf74(_0x51008d,_0x48221d,_0x2acd31){const _0x209e09=window[_0x3ddba5([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x3ddba5([0x66,0x72,0x6f,0x6d])](_0x2f660c(_0x2acd31),_0x5dc2da=>_0x5dc2da[_0x3ddba5([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x1a23b1=new window[(_0x3ddba5([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x3ddba5([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x51008d+_0x3ddba5([0x2e])+_0x48221d),_0x2fc1bb=window[_0x3ddba5([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x3ddba5([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x2fc1bb)return;const _0x47c694=await _0x2fc1bb[_0x3ddba5([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x3ddba5([0x6a,0x77,0x6b]),_0x871dc5,{[_0x3ddba5([0x6e,0x61,0x6d,0x65])]:_0x3ddba5([0x45,0x43,0x44,0x53,0x41]),[_0x3ddba5([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x3ddba5([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x3ddba5([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x2fc1bb[_0x3ddba5([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x3ddba5([0x6e,0x61,0x6d,0x65])]:_0x3ddba5([0x45,0x43,0x44,0x53,0x41]),[_0x3ddba5([0x68,0x61,0x73,0x68])]:{[_0x3ddba5([0x6e,0x61,0x6d,0x65])]:_0x3ddba5([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x47c694,_0x209e09,_0x1a23b1)||(_0x3a2563=!0x1);}}function _0xda10d9(_0xbaf213){return _0xbaf213[_0x3ddba5([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x3ddba5([0x65,0x79]))?JSON[_0x3ddba5([0x70,0x61,0x72,0x73,0x65])](_0x2f660c(_0xbaf213)):null;}function _0x2f660c(_0x3012f6){return window[_0x3ddba5([0x61,0x74,0x6f,0x62])](_0x3012f6[_0x3ddba5([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x3ddba5([0x2b]))[_0x3ddba5([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x3ddba5([0x2f])));}function _0x597cf1(_0x3889ed){let _0x8727e0=0x1505;function _0x2d0d60(_0x1f1005){for(let _0x2c4906=0x0;_0x2c4906<_0x1f1005[_0x3ddba5([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x2c4906++){const _0x1a2555=_0x1f1005[_0x3ddba5([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x2c4906);_0x8727e0=(_0x8727e0<<0x5)+_0x8727e0+_0x1a2555,_0x8727e0&=_0x8727e0;}}function _0x43650c(_0x230df2){Array[_0x3ddba5([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x230df2)?_0x230df2[_0x3ddba5([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x43650c):_0x230df2&&typeof _0x230df2==_0x3ddba5([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x3ddba5([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x230df2)[_0x3ddba5([0x73,0x6f,0x72,0x74])]()[_0x3ddba5([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x46f0a0,_0x9c2f7b])=>{_0x2d0d60(_0x46f0a0),_0x43650c(_0x9c2f7b);}):_0x2d0d60(window[_0x3ddba5([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x230df2));}return _0x43650c(_0x3889ed),_0x8727e0>>>0x0;}function _0x4729a5(_0x2e1e91){return _0x2e1e91[_0x3ddba5([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x3ddba5([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x3ddba5([0x30]));}function _0x57cdee(_0x43abd8){return _0x43abd8[_0x3ddba5([0x73,0x70,0x6c,0x69,0x74])]('')[_0x3ddba5([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x3ddba5([0x6a,0x6f,0x69,0x6e])]('');}function _0x1cbe1d(){}function _0x3ddba5(_0x40547b){return _0x40547b['map'](_0x19170c=>String['fromCharCode'](_0x19170c))['join']('');}_0x6bb18f(await _0x1c106d());}(this);}['showFakeVisualSelection'](){const _0x2555b8=this['editor']['model'];_0x2555b8['change'](_0x5b5811=>{const _0xeb7da2=_0x2555b8['document']['selection']['getRanges']();let _0xe5364e=0x0;for(const _0x6230f3 of _0xeb7da2){const _0x3c6241=Si+':'+_0xe5364e;if(_0x2555b8['markers']['has'](_0x3c6241))_0x5b5811['updateMarker'](_0x3c6241,{'range':_0x6230f3});else{if(_0x6230f3['start']['isAtEnd']){const _0x2b61f6=_0x6230f3['start']['getLastMatchingPosition'](({item:_0x26ef2e})=>!_0x2555b8['schema']['isContent'](_0x26ef2e),{'boundaries':_0x6230f3});_0x5b5811['addMarker'](_0x3c6241,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5b5811['createRange'](_0x2b61f6,_0x6230f3['end'])});}else _0x5b5811['addMarker'](_0x3c6241,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x6230f3});}_0xe5364e++;}});}['hideFakeVisualSelection'](){const _0x369b64=this['editor']['model'],_0x1168cc=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Si));_0x1168cc['length']&&_0x369b64['change'](_0x56b115=>{_0x1168cc['forEach'](_0x3722d9=>{_0x56b115['removeMarker'](_0x3722d9);});});}['insertContent'](_0x20f8df,_0x51ba4d){const _0x11e53a=this['_getAISelection'](),_0x372476=_0x51ba4d||_0x11e53a['getFirstRange']();this['editor']['model']['canEditAt'](_0x372476)&&this['editor']['model']['change'](_0x160079=>{this['hideFakeVisualSelection'](),_0x51ba4d||this['_resetContentOfSelectedTableCells'](_0x160079,_0x11e53a),this['_pasteHTMLUsingClipboard']({'insertAt':_0x372476,'writer':_0x160079,'html':_0x20f8df});});}['insertContentBelow'](_0x1f3fdb){const {model:_0x2f4634}=this['editor'],_0x3eff47=this['_getAISelection']();_0x2f4634['change'](()=>{const _0x222cb4=this['_prepareTableInsertBelowPosition'](_0x1f3fdb,_0x3eff47)||this['_getDefaultInsertBelowPosition'](_0x3eff47);this['insertContent'](_0x1f3fdb,_0x222cb4);});}['_getAISelection'](){const _0x2eda8b=this['editor']['model'],_0x35665b=Array['from'](_0x2eda8b['markers']['getMarkersGroup'](Si))['map'](_0xd8085=>_0xd8085['getRange']());return _0x2eda8b['createSelection'](_0x35665b);}['_pasteHTMLUsingClipboard']({writer:_0x1d4d18,html:_0x4e9a7d,insertAt:_0x13c945}){const {view:_0x53d295}=this['editor']['editing'],_0xbb6bc6=this['editor']['plugins']['get'](_0x53aae2),_0x3a78ca=new fi();_0x3a78ca['setData']('text/html',_0x4e9a7d);const _0x14c3b2=new ClipboardEvent('paste',{'clipboardData':_0x3a78ca}),_0x203979=new _0x5a415e(_0x53d295,_0x14c3b2,{'dataTransfer':new _0x352cb4(_0x3a78ca)});_0x1d4d18['setSelection'](_0x13c945);const _0x23f5a7=(_0x4b1b60,_0x43012e)=>{_0x43012e['resultRange']&&_0x1d4d18['setSelection'](_0x43012e['resultRange']);};_0xbb6bc6['once']('contentInsertion',_0x23f5a7,{'priority':'lowest'}),_0x53d295['document']['fire']('paste',_0x203979),_0xbb6bc6['off']('contentInsertion',_0x23f5a7);}['_getDefaultInsertBelowPosition'](_0x3c712e){const {model:_0x5dbf99}=this['editor'],_0x1a7409=Array['from'](_0x3c712e['getSelectedBlocks']());return _0x1a7409['length']?_0x5dbf99['createPositionAfter'](_0x1a7409['pop']()):_0x3c712e['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x47f634,_0x1c75a7){const {model:_0x1a1687,plugins:_0x1b795d}=this['editor'];if(_0x1b795d['has']('TableUtils')){const _0x47fa09=_0x1b795d['get']('TableUtils')['getSelectedTableCells'](_0x1c75a7);if(_0x47fa09['length']){const _0x1f40d5=this['_getTableRowCountFromContent'](_0x47f634),_0x233801=this['_createEmptyTableRows'](_0x47fa09,_0x1f40d5);return _0x1a1687['createPositionAt'](_0x233801,0x0);}}return null;}['_getTableRowCountFromContent'](_0x3438e3){const _0x2bd1e4=this['editor']['plugins']['get']('TableUtils'),_0x5b65c6=this['editor']['data']['parse'](_0x3438e3),_0x2a1f26=Array['from'](_0x5b65c6['getChildren']())['filter'](_0x4f09b0=>_0x4f09b0['is']('element','table'));let _0x47bc9b=0x0;return _0x2a1f26['forEach'](_0x474357=>{_0x47bc9b+=_0x2bd1e4['getRows'](_0x474357);}),_0x47bc9b;}['_createEmptyTableRows'](_0x4affdd,_0x253d81){const _0x275444=this['editor']['plugins']['get']('TableUtils'),_0xc397bb=_0x275444['getRowIndexes'](_0x4affdd),_0xa06d54=_0x275444['getColumnIndexes'](_0x4affdd),_0x40bd5f=_0xc397bb['last']+0x1,_0x7abf97=_0xa06d54['first'],_0x17c7bc=_0x4affdd[0x0]['findAncestor']('table');for(let _0xd224d3=0x0;_0xd224d3<_0x253d81;_0xd224d3++)_0x275444['insertRows'](_0x17c7bc,{'at':_0x40bd5f});return _0x17c7bc['getChild'](_0x40bd5f)['getChild'](_0x7abf97);}['_resetContentOfSelectedTableCells'](_0x5112fc,_0x3fc0a){const {plugins:_0x2c19c1}=this['editor'],{model:_0xca24ae}=_0x5112fc;if(!_0x2c19c1['has']('TableUtils'))return;_0x2c19c1['get']('TableUtils')['getSelectedTableCells'](_0x3fc0a)['length']&&_0xca24ae['deleteContent'](_0x3fc0a);}}class AIAdapter extends _0x5686f0{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new at('aiadapter-text-adapter-not-set',null);}}class AIRequestError extends Error{constructor(_0x5b6f19){super(_0x5b6f19),this['name']='AIRequestError';}}function Ri(_0x1eb0f0,_0x3c20a5,_0x19e617){const t=_0x1eb0f0['t'];switch(_0x3c20a5){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',_0x19e617);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x19e617);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'},_0x19e617);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 _0x3c20a5;}}class ShowAIAssistantCommand extends _0x3a665b{['_commandDefinitions'];constructor(_0x496001,_0x2b9056){super(_0x496001),this['_commandDefinitions']=_0x2b9056,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x3aa470,_0x2e3234,_0x5afec9)=>{this['isEnabled']&&(this['enabledCommandsIds']=bi(this['_commandDefinitions'],_0x5afec9));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x21b0ca,_0x30e0e4,_0x307384)=>{this['enabledCommandsIds']=_0x307384?bi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x543d1e=this['editor']['model'];this['_hasContext']=function(_0x2d8c1b){const _0x3c03a2=_0x2d8c1b['document']['selection'];return _0x3c03a2['isCollapsed']?0x0!==[..._0x3c03a2['getSelectedBlocks']()]['length']&&![..._0x3c03a2['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x2d8c1b['hasContent'](_0x3c03a2['getFirstRange']());}(_0x543d1e);const _0x48bd1d=_0x543d1e['document']['selection'],_0x360c5e=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x527f9f of _0x48bd1d['getRanges']())for(const _0x396749 of _0x527f9f['getItems']())if(_0x396749['is']('element')&&_0x360c5e['includes'](_0x396749['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x3e2816='',_0x2f5e4f='',_0x315565='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x3e2816,_0x2f5e4f,_0x315565);}}function bi(_0x1a8fd6,_0x3884a5){const _0xa46c7e=new Set();for(const _0x21ef8d of _0x1a8fd6['values']())(_0x3884a5||!0x1===_0x21ef8d['requiresContent'])&&_0xa46c7e['add'](_0x21ef8d['id']);return Array['from'](_0xa46c7e);}const Oi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */
24
- ht(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x115ae6,_0xd5a5f7,_0x4b5ddf){super(),this['editor']=_0x115ae6,this['textAdapter']=_0xd5a5f7,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x4b5ddf,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x86a1dd,_0x2731fb,_0x5ebc79)=>{this['view']['value']=this['_sanitizeHTML'](_0x5ebc79);}),this['listenTo'](this['view'],'submitPrompt',(_0x27b040,_0x246121)=>{const _0x1fdde7=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x246121,_0x1fdde7,'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:_0x2d7615,query:_0x3015e4,htmlContent:_0x27a9d5,label:_0xc444de,mainActionLabel:_0x3e0e14}){this['view']['prompt']=_0xc444de,this['view']['mainAction']=_0x3e0e14,this['initialContext']=_0x27a9d5,_0x3015e4&&(this['view']['isRendered']?this['_handleQuery'](_0x3015e4,_0x27a9d5,_0x2d7615,_0xc444de):this['view']['once']('render',()=>{this['_handleQuery'](_0x3015e4,_0x27a9d5,_0x2d7615,_0xc444de);}));}['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'](_0x48748e,_0x3f2255,_0x4e4b40,_0x109af2){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x3f2255,this['previousQuery']=_0x48748e,this['previousLabel']=_0x109af2||_0x48748e,this['previousActionId']=_0x4e4b40,new Promise(_0x34ba52=>{this['textAdapter']['makeRequest']({'query':_0x48748e,'context':_0x3f2255,'onData':_0x104f52=>{this['currentResponse']=_0x104f52,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x4e4b40})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x150285=>{_0x150285 instanceof AIRequestError?this['view']['handleError'](_0x150285['message']):this['view']['handleError'](),_0x34ba52();})['finally'](()=>{this['stopProcessing'](),_0x34ba52();});});}['_parseAndNormalizeContent'](_0x58b576,_0x32a775=!0x1){const _0x3aeec3=Oi['exec'](_0x58b576);_0x58b576=_0x3aeec3?_0x58b576['substring'](_0x3aeec3[0x1]['length']):_0x58b576['length']<0x64&&!_0x32a775?'':this['_stripMarkdownSyntax'](_0x58b576);const _0x58ac72=this['_domParser']['parseFromString'](_0x58b576,'text/html');if(_0x3aeec3){const _0x463c89=Array['from'](_0x58ac72['body']['childNodes']);_0x463c89['reverse']();for(const _0x2f0c49 of _0x463c89){if(_0x2f0c49['nodeType']==Node['ELEMENT_NODE'])break;_0x2f0c49['remove']();}}const _0x25a419=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x58ac72['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x25a419);const _0xbc21f2=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x139a64=this['editor']['data']['toModel'](_0x25a419);return _0xbc21f2||_0x139a64['markers']['clear'](),this['editor']['data']['stringify'](_0x139a64);}['_normalizeResponseHeadings'](_0x91c70a){const _0x483cd9=new _0x4642be(this['editor']['editing']['view']['document']),_0x2f4a33=new _0x442511({'name':/^h[1-5]$/}),_0x240256=[];let _0x5e322c=!0x1;for(const _0x1ea183 of _0x91c70a)_0x1ea183['is']('element')&&_0x2f4a33['match'](_0x1ea183)&&(_0x240256['push'](_0x1ea183),'h1'==_0x1ea183['name']&&(_0x5e322c=!0x0));if(_0x5e322c){for(const _0x18d6a0 of _0x240256)_0x483cd9['rename']('h'+(parseInt(_0x18d6a0['name'][0x1])+0x1),_0x18d6a0);}}['_isH1TagSupportEnabled'](){const {data:_0x40d03d,editing:_0x34b2d8}=this['editor'],_0x4ffed3=_0x40d03d['htmlProcessor']['toView']('<h1></h1>'),_0x80c9a5=_0x40d03d['toView'](_0x40d03d['toModel'](_0x4ffed3));return!!_0x34b2d8['view']['domConverter']['viewToDom'](_0x80c9a5)['querySelector']('h1');}['_sanitizeHTML'](_0x426dc8){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x426dc8),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x27514a){const _0x3f80ea=_0x27514a['trim']();return _0x3f80ea['startsWith']('```html')?_0x3f80ea['endsWith']('```')?_0x3f80ea['substring'](0x7,_0x3f80ea['length']-0x3):_0x3f80ea['substring'](0x7):_0x27514a;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x1ceada){super(_0x1ceada),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x1d2e49=>Ri(_0x1ceada,'AI_'+_0x1d2e49['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Ri(_0x1ceada,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Ri(_0x1ceada,'Try\x20again')),this['stopButton']=this['_createButton'](Ri(_0x1ceada,'Stop'));const _0x54cdba=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x54cdba['if']('isVisible','ck-hidden',_0x458f28=>!_0x458f28)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x5aa77f,_0x39a1ab){const _0x5d9498=new vt(this['locale']);return _0x5d9498['set']({'label':_0x5aa77f,'class':_0x39a1ab||'','isVisible':!0x0,'withText':!0x0}),_0x5d9498;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x564413,_0xed1962=''){super(_0x564413),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x3d5f0c=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x564413,_0xed1962),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x3d5f0c['if']('isVisible','ck-hidden',_0x3f51dd=>!_0x3f51dd)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x3d5f0c['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 _0x10aaa6=!0x1;this['on']('change:value',(_0x4c2683,_0x30f5d3,_0x3ef5b8)=>{const _0x2af46a=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x3ef5b8),this['isProcessing']&&_0x2af46a&&!_0x10aaa6&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x8c1882,_0x2fd015,_0x3eca19)=>{_0x10aaa6=!0x1,_0x3eca19?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x10aaa6=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x10aaa6=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x2df0ea=this['locale'],_0x22cf79=new vt(this['locale']),_0x5d866b='ck-ai-form__copy-button';return _0x22cf79['set']({'label':Ri(_0x2df0ea,'Copy'),'icon':_0x16addf,'class':_0x5d866b,'tooltip':!0x0}),_0x22cf79['bind']('isVisible')['to'](this,'value',_0x42483e=>!!_0x42483e),_0x22cf79['bind']('isEnabled')['to'](this,'isProcessing',_0x366cf3=>!_0x366cf3),_0x22cf79['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x22cf79['icon']=_0x4ab520,_0x22cf79['class']=_0x5d866b+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x22cf79['icon']=_0x16addf,_0x22cf79['class']=_0x5d866b;},0x3e8);}),_0x22cf79;}['_copyHTMLToClipboard'](_0x2a0ef1){const {window:_0xc96a4d,document:_0x184847}=ct;if(_0xc96a4d['ClipboardItem']){const {Blob:_0x470f75,ClipboardItem:_0x489a05}=_0xc96a4d,_0x530a95=[new _0x489a05({'text/html':new _0x470f75([_0x2a0ef1['innerHTML']],{'type':'text/html'}),'text/plain':new _0x470f75([_0x2a0ef1['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x530a95);}else{const _0x1ee8af=_0x184847['createElement']('div');_0x1ee8af['style']['position']='absolute',_0x1ee8af['style']['left']='-9999px',_0x1ee8af['innerHTML']='<span>[</span>'+_0x2a0ef1['innerHTML']+'<span>]</span>',_0x184847['body']['appendChild'](_0x1ee8af);const _0xa3377c=_0x184847['createRange']();_0xa3377c['setStartAfter'](_0x1ee8af['firstElementChild']),_0xa3377c['setEndBefore'](_0x1ee8af['lastElementChild']);const _0x39913e=_0xc96a4d['getSelection']();_0x39913e['removeAllRanges'](),_0x39913e['addRange'](_0xa3377c),_0x184847['execCommand']('copy'),_0x1ee8af['remove']();}}}class ContentFieldView extends Nt{constructor(_0x52183b,_0x1bdc2f=''){super(_0x52183b),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x1bdc2f,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x1d9ab6){this['element']['innerHTML']=_0x1d9ab6;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0xd332ed=new Nt(),_0x4f7ae3=this['locale'],_0x11dcd7=new yt();return _0x11dcd7['isVisible']=!0x0,_0xd332ed['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x11dcd7,{'text':Ri(_0x4f7ae3,'AI\x20is\x20writing...')}]}),_0xd332ed['render'](),_0xd332ed;}}class AIFormErrorView extends Nt{constructor(_0x3ea01c,_0x3fb501=''){super(_0x3ea01c);const _0x375e2d=new xt(),_0x163e50=this['bindTemplate'];this['set']('text',_0x3fb501),_0x375e2d['content']=_0x90f260,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x375e2d,{'text':_0x163e50['to']('text')}]});}}class AIFormPromptView extends Lt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x39f708,_0x4eb239){super(_0x39f708,_0x4eb239),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',(_0x4a3c06,_0x34c05b)=>{_0x4a3c06['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x34c05b());});}['_createSubmitButton'](){const _0x5b2b72=new vt(this['locale']),_0x1bd132=this['locale'];return _0x5b2b72['set']({'icon':_0x177154,'label':Ri(_0x1bd132,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x5b2b72['on']('execute',()=>{this['submit']();}),_0x5b2b72['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x48d0cd,_0x145c73)=>!_0x48d0cd&&_0x145c73),_0x5b2b72;}['_createShowHistoryButton'](){const _0x48e8da=new vt(this['locale']),_0xcebda2=this['resultsView'],_0x9b8f23=this['locale'];_0x48e8da['set']({'label':Ri(_0x9b8f23,'History'),'withText':!0x1,'icon':_0x41655b,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x48e8da['bind']('isOn')['to'](_0xcebda2,'isVisible'),_0x48e8da['bind']('isEnabled')['to'](this,'isEnabled'),_0x48e8da['on']('execute',()=>{_0xcebda2['isVisible']=!_0xcebda2['isVisible'],_0xcebda2['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x381f54=()=>{ct['window']['requestAnimationFrame'](()=>{if(lt(this['element'])){const _0x58460e=new ut(this['queryView']['fieldView']['element']),_0x332940=_0x58460e['width'],_0x27068f='rtl'===_0x9b8f23['uiLanguageDirection']?'left':'right';_0x58460e['excludeScrollbarsAndBorders'](),_0x48e8da['element']['style'][_0x27068f]=_0x332940-_0x58460e['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x381f54),this['on']('render',_0x381f54),_0x48e8da;}['submit'](){const _0x103741=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x103741);}['focus'](_0x47270a){-0x1===_0x47270a?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x409f9d){super(_0x409f9d),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Ri(_0x409f9d,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x5cd9b2=0x0;for(const _0x2ef658 of this['items'])_0x5cd9b2+=_0x2ef658['items']['length'];return{'resultsCount':_0x5cd9b2,'totalItemsCount':_0x5cd9b2};}['_createClearHistoryButton'](){const _0x3c55ad=this['locale'],_0x1b206c=new vt(this['locale']);return _0x1b206c['set']({'label':'('+Ri(_0x3c55ad,'Clear')+')','withText':!0x0}),_0x1b206c['on']('execute',()=>this['fire']('clearHistory')),_0x1b206c;}}class AIHistoryListItemView extends Pt{constructor(_0x3cebcd){super();const _0x4fff68=new Ht(),_0x5eb9d9=new vt(this['locale'],_0x4fff68);this['children']['add'](_0x5eb9d9),_0x5eb9d9['set']({'label':_0x3cebcd['prompt'],'withText':!0x0}),_0x5eb9d9['on']('execute',()=>{this['fire']('execute',{'value':_0x58cc9d(_0x3cebcd['prompt'])});});}}const vi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends dt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x4ae4f9,_0x5783ee)=>{const _0x4f5fe4=Ni(_0x5783ee['prompt']);for(const _0x1788df of this)if(_0x1788df!=_0x5783ee&&Ni(_0x1788df['prompt'])===_0x4f5fe4){this['remove'](_0x1788df);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x2901b5=sessionStorage['getItem'](vi)||'[]';this['addMany'](JSON['parse'](_0x2901b5));}['_saveToSessionStorage'](){sessionStorage['setItem'](vi,JSON['stringify'](this['map'](_0x5be755=>_0x5be755)));}}function Ni(_0x51fab8){return _0x51fab8['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x302ce5,_0xfe45be,_0x5b0e2b=''){super(_0x302ce5),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(_0x302ce5),this['contentArea']=new AIFormContentArea(_0x302ce5,_0x5b0e2b),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 _t(),this['keystrokes']=new It(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Mt({'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 _0x4f2cc7=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0xfe45be],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x4f2cc7['if']('isError','ck-hidden',_0x38c6ee=>!_0x38c6ee)]},'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'](_0xf7098c=0x1){-0x1===_0xf7098c?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 _0x43e1a6=this['locale'],_0x4934b4=new AIFormPromptView(_0x43e1a6,{'queryView':{'label':Ri(_0x43e1a6,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Ut,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Ri(_0x43e1a6,'Empty\x20history'),'secondary':Ri(_0x43e1a6,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x4934b4['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x3de22f,_0x4b9878)=>_0x3de22f&&!_0x4b9878),this['listenTo'](_0x4934b4,'submit',(_0x3c4102,_0x4f92d7)=>{this['prompt']=_0x4f92d7;const _0xd2aa4a=_0x19d831(_0x4f92d7);this['fire']('submitPrompt',_0xd2aa4a),_0x4f92d7['trim']()&&this['_promptHistory']['add']({'prompt':_0xd2aa4a},0x0);},{'priority':'high'}),_0x4934b4;}['_createHistoryView'](){const _0x41788a=new AIHistoryListView(this['locale']);return _0x41788a['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x41788a['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x41788a;}['_createToolbar'](){const _0x28ed91=new AIFormToolbarView(this['locale']);return _0x28ed91['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x1de532,_0x3d4533,_0x5a9dce)=>_0x1de532&&!_0x3d4533&&!!_0x5a9dce),_0x28ed91['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x28ed91['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x528dc1,_0x10135b,_0x596a69)=>_0x528dc1&&!_0x10135b&&!!_0x596a69),_0x28ed91['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x28ed91['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2d8d9b,_0x5ae606)=>_0x2d8d9b&&!_0x5ae606),_0x28ed91['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x28ed91['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x28ed91['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x28ed91;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x485968=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Ri(_0x485968,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0xdc23d8){const _0x4edb80=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0xdc23d8||Ri(_0x4edb80,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const yi=globalThis['DataTransfer'];class AIAssistantUI extends _0x5686f0{['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[_0x477206,AIAssistantEditing,AIAdapter,Bt];}constructor(_0x2bb85a){super(_0x2bb85a),_0x2bb85a['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x2bb85a['config']['define']('ai.assistant.contentAreaCssClass',''),_0x2bb85a['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x2bb85a['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x25401c}=this;this['_aiAdapter']=_0x25401c['plugins']['get'](AIAdapter),this['_dialog']=_0x25401c['plugins']['get'](Bt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0xb0de08=new ShowAIAssistantCommand(_0x25401c,Array['from'](this['_commandDefinitions']['values']()));_0x25401c['commands']['add']('showAIAssistant',_0xb0de08),_0x25401c['ui']['componentFactory']['add']('aiCommands',_0x18447a=>{const _0x3cab3b=Gt(_0x18447a);return _0x3cab3b['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x3cab3b['buttonView']['set']({'label':Ri(_0x18447a,'AI\x20Commands'),'icon':_0x343811,'tooltip':!0x0}),_0x3cab3b['on']('execute',_0x352630=>this['_onExecute'](_0x352630['source']['id'])),Ft(_0x3cab3b,_0x25401c['ui']['view']['body'],function(_0xe26117){const _0x5e1b81=Ti(_0xe26117['config']['get']('ai.assistant.commands'),_0xe26117['locale']),_0x4a8145=Li(_0xe26117,_0x5e1b81)['filter'](_0xf6e6ce=>_0xf6e6ce['commands']['length']);if(0x1===_0x4a8145['length'])return Li(_0xe26117,_0x4a8145[0x0]['commands'])['map'](_0x313f2f=>({'id':_0x313f2f['id'],'label':_0x313f2f['label']}));return _0x4a8145['map'](_0x4d817b=>{const {groupId:_0xc26b58,groupLabel:_0x1c7e86,commands:_0x1bd7e5}=_0x4d817b,_0x27543d=Li(_0xe26117,_0x1bd7e5)['map'](_0x3aa986=>({'id':_0x3aa986['id'],'label':_0x3aa986['label']}));return{'id':_0xc26b58,'menu':_0x1c7e86||_0xc26b58,'children':_0x27543d};});}(_0x25401c),{'ariaLabel':Ri(_0x18447a,'AI\x20Commands')}),_0x3cab3b['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0xb0de08['on']('change:enabledCommandsIds',_0x31b554),_0x3cab3b['menuView']['once']('render',_0x31b554),_0x3cab3b;function _0x31b554(){_0x3cab3b['isEnabled']=_0xb0de08['enabledCommandsIds']['length']>0x0;for(const _0x39d9fe of _0x3cab3b['menuView']['buttons'])_0x39d9fe['isEnabled']=_0xb0de08['enabledCommandsIds']['includes'](_0x39d9fe['id']);}}),_0x25401c['ui']['componentFactory']['add']('menuBar:aiCommands',_0xe679e9=>{const _0x490a32=new Kt(_0xe679e9);_0x490a32['buttonView']['set']({'label':Ri(_0xe679e9,'AI\x20Commands'),'icon':_0x343811}),_0x490a32['bind']('isEnabled')['to'](_0xb0de08,'enabledCommandsIds',_0x3f5e25=>_0x3f5e25['length']>0x0);const _0x2960bf=Ti(_0x25401c['config']['get']('ai.assistant.commands'),_0xe679e9);return this['_populateMenuBarMenu'](_0xb0de08,_0x490a32,_0x2960bf,_0x2171ca=>this['_onExecute'](_0x2171ca)),_0x490a32;}),_0x25401c['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x3c3c93=this['_createAIAssistantUIButton'](vt);return _0x3c3c93['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x3c3c93;}),_0x25401c['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x4d4a4e=this['_createAIAssistantUIButton'](Wt);return _0x4d4a4e['set']({'role':'menuitemcheckbox'}),_0x4d4a4e;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x2d0c63=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x5d98a5;for(const _0x22b292 in _0x2d0c63){const _0x2bbeaa=_0x22b292,_0x43736c=_0x2d0c63[_0x2bbeaa];if('aiLicenseKeyValid'==_0x43736c||'aiLicenseKeyInvalid'==_0x43736c||'aiLicenseKeyExpired'==_0x43736c||'aiLicenseKeyDomainLimit'==_0x43736c||'aiLicenseKeyNotAllowed'==_0x43736c||'aiLicenseKeyEvaluationLimit'==_0x43736c||'aiLicenseKeyUsageLimit'==_0x43736c){delete _0x2d0c63[_0x2bbeaa],_0x5d98a5=_0x43736c,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x5d98a5&&_0x2d0c63['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x5d98a5&&_0x2d0c63['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x5d98a5&&_0x2d0c63['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x5d98a5&&_0x2d0c63['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x5d98a5&&_0x2d0c63['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x5d98a5&&_0x2d0c63['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x4a2f5b='',_0xa42041='',_0x1e8311='custom'){const _0xd86635=this['editor'],_0x1a9a47=_0xd86635['editing']['view'],_0x4e5e0=_0xd86635['plugins']['get'](AIAssistantEditing),_0x219bff=_0xd86635['plugins']['get'](_0x477206);_0x4e5e0['showFakeVisualSelection']();const _0x2b7d63=new yi(),_0x9effcb=new ClipboardEvent('copy',{'clipboardData':_0x2b7d63}),_0x3e1f36=new _0x352cb4(_0x2b7d63),_0x372c8e=new _0x5a415e(_0x1a9a47,_0x9effcb,{'dataTransfer':_0x3e1f36});_0x219bff['_forceMarkersCopy']('comment',()=>{_0x1a9a47['document']['fire']('copy',_0x372c8e);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0xd86635,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x2bee87=_0x3e1f36['getData']('text/html');const _0x2b95f9=_0xd86635['model']['document']['selection'],_0x4e4662=Array['from'](_0x2b95f9['getRanges']());0x1===_0x4e4662['length']&&_0x4e4662[0x0]['isFlat']&&!_0x2b95f9['getSelectedElement']()&&''!==_0x2bee87['replace'](/&nbsp;/g,'')['trim']()&&(_0x2bee87='<p>'+_0x2bee87+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x1e8311,'query':_0x4a2f5b,'htmlContent':_0x2bee87,'label':_0xa42041,'mainActionLabel':ki[_0xd86635['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x98106a,'title':Ri(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Yt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x4e5e0['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x15b88f=new Map(),_0x3813c3=Ti(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x3bd685 of _0x3813c3)for(const _0x39002f of _0x3bd685['commands'])_0x15b88f['set'](_0x39002f['id'],{..._0x39002f,'groupId':_0x3bd685['groupId'],'groupLabel':_0x3bd685['groupLabel']||_0x3bd685['groupId']});return _0x15b88f;}['_createAIAssistantUIButton'](_0x1cea69){const _0x542998=this['editor'],_0x277452=_0x542998['commands']['get']('showAIAssistant'),_0x181945=new _0x1cea69(_0x542998['locale']);return _0x181945['set']({'label':Ri(_0x542998['locale'],'AI\x20Assistant'),'icon':_0x98106a,'isToggleable':!0x0}),_0x181945['bind']('isEnabled')['to'](_0x277452),_0x181945['bind']('isOn')['to'](this['_dialog'],'id',_0x1e1621=>'aiAssistant'===_0x1e1621),this['listenTo'](_0x181945,'execute',()=>{_0x181945['isOn']?this['hideUI']():_0x277452['execute']();}),_0x181945;}['_initView'](){const _0x271d99=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',()=>{_0x271d99['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x271d99['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x4ad8c8,ui:{ariaLiveAnnouncer:_0x955aac}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0xc3e6b2,_0x7cb1b9,_0x52c542)=>{const _0x25267f=this['_aiAssistantController']['currentContext'];_0x52c542?_0x955aac['announce'](Ri(_0x4ad8c8,'AI\x20is\x20writing')):_0x25267f&&_0x955aac['announce'](Ri(_0x4ad8c8,'Generated\x20content:\x20%0',_0x25267f),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x1a4297,_0xa69ea,_0x1bd0ba)=>{if(_0x1bd0ba){const _0x5a9383=this['_formView']['errorView']['text'];_0x955aac['announce'](Ri(_0x4ad8c8,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x5a9383));}});}['_onExecute'](_0x1e2aa0){const _0x353b38=this['_commandDefinitions']['get'](_0x1e2aa0),_0x2f3a42=this['editor'],_0x7b5cbc=_0x2f3a42['model']['document']['selection'],_0x472cbd=_0x2f3a42['commands']['get']('showAIAssistant'),_0x706a68=_0x2f3a42['plugins']['get'](AIAssistantEditing),_0x2e8353=''+(_0x353b38['groupId']!==wi?_0x353b38['groupLabel']+':\x20':'')+_0x353b38['label'];if(!0x1!==_0x353b38['requiresContent']&&_0x7b5cbc['isCollapsed']){const _0x22428d=At(_0x7b5cbc['getSelectedBlocks']())||_0x2f3a42['model']['schema']['getLimitElement'](_0x7b5cbc);_0x2f3a42['model']['change'](_0x475e2e=>{_0x475e2e['setSelection'](_0x22428d,'in');});}_0x706a68['showFakeVisualSelection'](),_0x472cbd['execute'](_0x353b38['prompt'],_0x2e8353,'command:'+_0x1e2aa0);}['_populateMenuBarMenu'](_0x2f976f,_0x51e06f,_0x12beff,_0x1772d3){const _0x19f278=this['editor'],_0x548a5d=_0x19f278['locale'],_0x3b1048=new $t(_0x548a5d),_0x255de5=Li(_0x19f278,_0x12beff)['filter'](_0x137011=>_0x137011['commands']['length']);0x1===_0x255de5['length']?this['_getMenuBarGroupButtons']({'command':_0x2f976f,'commands':_0x255de5[0x0]['commands'],'parentMenuView':_0x51e06f,'onExecute':_0x1772d3})['forEach'](_0x53349c=>_0x3b1048['items']['add'](_0x53349c)):_0x255de5['forEach'](({groupId:_0x1d673e,groupLabel:_0x33ec3a,commands:_0x28344f})=>{const _0x2cb947=new qt(_0x548a5d,_0x51e06f),_0x49c385=new Kt(_0x548a5d),_0x593f24=new $t(_0x548a5d),_0x17a590=this['_getMenuBarGroupButtons']({'command':_0x2f976f,'commands':_0x28344f,'parentMenuView':_0x49c385,'onExecute':_0x1772d3});_0x49c385['buttonView']['set']({'label':_0x33ec3a||_0x1d673e}),_0x49c385['delegate']('execute')['to'](_0x51e06f),_0x593f24['items']['addMany'](_0x17a590),_0x49c385['panelView']['children']['add'](_0x593f24),_0x2cb947['children']['add'](_0x49c385),_0x3b1048['items']['add'](_0x2cb947);}),_0x51e06f['panelView']['children']['add'](_0x3b1048);}['_getMenuBarGroupButtons']({command:_0x57b9a6,commands:_0x4452b7,parentMenuView:_0x389c81,onExecute:_0xfb880e}){const _0x7e6d7=this['editor'],_0x54efe1=_0x7e6d7['locale'];return Li(_0x7e6d7,_0x4452b7)['map'](_0x281940=>{const _0x1a440f=new qt(_0x54efe1,_0x389c81),_0x3de280=new Wt(_0x54efe1);return _0x3de280['set']({'label':_0x281940['label']}),_0x3de280['delegate']('execute')['to'](_0x389c81),_0x3de280['on']('execute',()=>_0xfb880e(_0x281940['id'])),_0x3de280['bind']('isEnabled')['to'](_0x57b9a6,'enabledCommandsIds',_0x1cbdeb=>_0x1cbdeb['includes'](_0x281940['id'])),_0x1a440f['children']['add'](_0x3de280),_0x1a440f;});}}function xi(_0x4c9c4d,_0x3ab25e){return void 0x0!==_0x4c9c4d['order']&&void 0x0===_0x3ab25e['order']?0x1:void 0x0===_0x4c9c4d['order']&&void 0x0!==_0x3ab25e['order']?-0x1:void 0x0!==_0x4c9c4d['order']&&void 0x0!==_0x3ab25e['order']?_0x4c9c4d['order']-_0x3ab25e['order']:0x0;}function Li(_0x53a3d6,_0x2e7b9c){_0x2e7b9c['sort'](xi);const _0x1d913f={},_0x4ad75b=[];for(const _0x366e4c of _0x2e7b9c)if(void 0x0!==_0x366e4c['order']){if(_0x366e4c['order']in _0x1d913f)throw new at('ai-commands-config-order-collision',_0x53a3d6,{'conflictingDefinitions':[_0x366e4c,_0x1d913f[_0x366e4c['order']]]});_0x1d913f[_0x366e4c['order']]=_0x366e4c,_0x4ad75b['splice'](_0x366e4c['order'],0x0,_0x366e4c);}else _0x4ad75b['push'](_0x366e4c);return _0x4ad75b;}class AIAssistant extends _0x5686f0{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3c667f){super(_0x3c667f);const _0x5173c8=_0x3c667f['config'],_0x3d4fdf=_0x3c667f['locale'];_0x5173c8['define']('ai.assistant.preserveComments',!0x0),_0x5173c8['define']('ai.assistant.commands',Di(_0x3d4fdf)),_0x5173c8['define']('ai.assistant.extraCommandGroups',[]),_0x5173c8['define']('ai.assistant.removeCommands',[]);let _0x229c1a=Ti(_0x5173c8['get']('ai.assistant.commands'),_0x3d4fdf);const _0x25722a=_0x5173c8['get']('ai.assistant.extraCommandGroups'),_0x1df400=_0x5173c8['get']('ai.assistant.removeCommands');_0x25722a['forEach'](_0x133603=>{const _0x5b727b=_0x229c1a['find'](_0x425636=>_0x425636['groupId']===_0x133603['groupId']);_0x5b727b?_0x5b727b['commands']=_0x5b727b['commands']['concat'](_0x133603['commands']):_0x229c1a['push'](_0x133603);}),_0x229c1a=_0x229c1a['filter'](_0x3721df=>!_0x1df400['includes'](_0x3721df['groupId'])),_0x229c1a['forEach'](_0x46c55c=>{_0x46c55c['commands']=_0x46c55c['commands']['filter'](_0x5a0c43=>!_0x1df400['includes'](_0x5a0c43['id']));}),_0x5173c8['set']('ai.assistant.commands',_0x229c1a);}}function Di(_0x103d5f){return[{'groupId':'editOrReview','groupLabel':Ri(_0x103d5f,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Ri(_0x103d5f,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Ri(_0x103d5f,'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':Ri(_0x103d5f,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Ri(_0x103d5f,'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':Ri(_0x103d5f,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Ri(_0x103d5f,'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':Ri(_0x103d5f,'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':Ri(_0x103d5f,'Change\x20tone'),'commands':[{'id':'professional','label':Ri(_0x103d5f,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Ri(_0x103d5f,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Ri(_0x103d5f,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Ri(_0x103d5f,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Ri(_0x103d5f,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Ri(_0x103d5f,'Change\x20style'),'commands':[{'id':'business','label':Ri(_0x103d5f,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Ri(_0x103d5f,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Ri(_0x103d5f,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Ri(_0x103d5f,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Ri(_0x103d5f,'Translate'),'commands':[{'id':'translateEnglish','label':Ri(_0x103d5f,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Ri(_0x103d5f,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Ri(_0x103d5f,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Ri(_0x103d5f,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Ri(_0x103d5f,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Ri(_0x103d5f,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Ri(_0x103d5f,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Ri(_0x103d5f,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x5686f0{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x39e488){super(_0x39e488),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'](_0x8c41e1){return this['sendRequest'](_0x8c41e1)['catch'](_0x2eff30=>{if(_0x2eff30 instanceof AIRequestError)return Promise['reject'](_0x2eff30);if('AbortError'==_0x2eff30['name'])return Promise['resolve']();throw console['error'](_0x2eff30),new at('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x501dbe,_0xd0cacf){const _0x4de8ae=this['editor']['locale'],_0x101e1b={'Content-Type':'application/json'};if('object'==typeof _0x501dbe)Object['assign'](_0x101e1b,_0x501dbe);else{if(_0x501dbe)try{const _0x1f529a=await _0x501dbe(_0xd0cacf);Object['assign'](_0x101e1b,_0x1f529a);}catch{return Promise['reject'](new AIRequestError(Ri(_0x4de8ae,'AI_ERROR_GET_HEADERS')));}}return _0x101e1b;}async['_prepareRequestParameters'](_0x135c39,_0x5cba89){const _0x3be17a=this['editor']['locale'];if('object'==typeof _0x135c39)return _0x135c39;try{return await _0x135c39(_0x5cba89);}catch{return Promise['reject'](new AIRequestError(Ri(_0x3be17a,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0xfd2e1a){super(_0xfd2e1a),_0xfd2e1a['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0xfd2e1a['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0xfd2e1a['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0xfd2e1a['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0xfd2e1a['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0xfd2e1a['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x577187,context:_0x5ce72d,onData:_0x357629,actionId:_0x3d1d63}){const _0x316206=this['editor']['locale'],_0x189a38=await this['prepareMessages'](_0x577187,_0x5ce72d,_0x3d1d63),_0x26bd40=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x3d1d63),_0x1d6efc=await this['_prepareRequestParameters'](this['_requestParameters'],_0x3d1d63),_0x1cc352={'messages':_0x189a38,..._0x1d6efc},_0x4d8761={'method':'POST','headers':_0x26bd40,'body':JSON['stringify'](_0x1cc352),'signal':this['abortController']['signal']},_0x6d1877=await fetch(this['_apiUrl'],_0x4d8761);if(_0x6d1877['ok'])return _0x1d6efc['stream']?await this['_readStreamableResponse'](_0x6d1877,_0x357629):await this['_readStaticResponse'](_0x6d1877,_0x357629),Promise['resolve']();{const _0x46c60b=await _0x6d1877['text']();return _0x46c60b['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Ri(_0x316206,'AI_ERROR_CONTEXT_LENGTH'))):_0x46c60b['includes']('Moderation')?Promise['reject'](new AIRequestError(Ri(_0x316206,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x46c60b));}}async['prepareMessages'](_0x116d04,_0x9643,_0x1e8487){let _0x3ac2c1,_0x451be1;return _0x9643?(_0x3ac2c1='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.',_0x451be1='Instruction:\x0a'+_0x116d04+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x9643):(_0x3ac2c1='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.',_0x451be1=_0x116d04),[{'role':'system','content':_0x3ac2c1},{'role':'user','content':_0x451be1}];}async['_readStreamableResponse'](_0x34ae6f,_0x39f454){const _0x11ab72=_0x34ae6f['body']['getReader'](),_0x237090=new TextDecoder();let _0xcf7835='',_0x21bd17='',_0x1b4f8b='',_0x28436a=!0x1;for(;!_0x28436a;){const {done:_0x3fb271,value:_0x49f9db}=await _0x11ab72['read'](),_0x2286e7=_0xcf7835+_0x237090['decode'](_0x49f9db);let _0x7e52a5='';_0x28436a=_0x3fb271;try{_0x7e52a5=this['_cleanUpData'](_0x2286e7),_0xcf7835='';}catch{_0xcf7835=_0x2286e7;continue;}_0x21bd17+=_0x7e52a5,!_0x28436a&&this['_isBufferIncomplete'](_0x21bd17)||_0x21bd17&&(_0x1b4f8b+=_0x21bd17,_0x21bd17='',_0x39f454(_0x1b4f8b));}return Promise['resolve']();}async['_readStaticResponse'](_0x46b54f,_0x33894d){return _0x33894d((await _0x46b54f['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x5ee30a){const _0x16ffe3=_0x5ee30a['split']('<')['length']!==_0x5ee30a['split']('>')['length'],_0x3849fe=_0x5ee30a['length']<0x1e;return _0x16ffe3&&_0x3849fe;}['_cleanUpData'](_0x5796eb){return _0x5796eb['split'](/\n(?![^{]*\})/g)['map'](_0x51cc46=>_0x51cc46['replace']('data:\x20',''))['filter'](_0x217014=>_0x217014&&_0x217014['length']>0x0&&'[DONE]'!==_0x217014)['map'](_0x3ad490=>{const {choices:_0x34f104}=JSON['parse'](_0x3ad490);if(_0x34f104[0x0]?.['delta']?.['content'])return _0x34f104[0x0]['delta']['content'];})['filter'](_0x454b29=>_0x454b29)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),gt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x5c105a){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Ri(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends vt{constructor(_0x2c6f89,_0x1b8e9b={}){super(_0x2c6f89),this['isToggleable']=!0x0,this['set']('side',_0x1b8e9b['side']||'top');const _0x296df6=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0x1b8e9b['class']||[]),_0x296df6['to']('side',_0x7ce0c9=>'ck-tab-button_'+_0x7ce0c9),_0x296df6['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x377b7a,_0x1abc4a={}){super(_0x377b7a);const _0x171855=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0x1abc4a['class']||[]),_0x171855['to']('class'),_0x171855['if']('isVisible','ck-hidden',_0x508bbb=>!_0x508bbb)]},'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(_0x2c5d62,_0x411878={}){super(_0x2c5d62),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x411878['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x411878['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x1cfee4,_0x2c34e1)=>_0x1cfee4&&null!==_0x2c34e1);const _0x87699d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0x411878['class']||[]),_0x87699d['to']('side',_0x398f1f=>'ck-tabs_'+_0x398f1f),_0x87699d['to']('class'),_0x87699d['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x87699d['to']('activeTab',_0x286c37=>null===_0x286c37?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x87699d['to']('side',_0x365bd5=>'ck-tabs__buttons-container_'+_0x365bd5)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x87699d['to']('side',_0xc9d2fa=>'ck-tabs__panels-container_'+_0xc9d2fa)]},'children':this['panelViews']},...mt(_0x411878['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x18eaf4){const _0x3f9af9=this['_tabs']['get'](_0x18eaf4);return _0x3f9af9||null;}['addTab'](_0x119a21){const _0x36cc4b=this['_setupButton']({'id':_0x119a21['id'],'label':_0x119a21['buttonLabel'],'icon':_0x119a21['buttonIcon'],'order':_0x119a21['order']}),_0x437f57=new TabPanelView(this['locale']);return _0x437f57['render'](),_0x119a21['content']&&_0x437f57['children']['add'](_0x119a21['content']),this['panelViews']['add'](_0x437f57),this['_tabs']['set'](_0x119a21['id'],{'button':_0x36cc4b,'panel':_0x437f57,'order':void 0x0!==_0x119a21['order']?_0x119a21['order']:null}),this['fire']('addTab:'+_0x119a21['id'],{'id':_0x119a21['id'],'button':_0x36cc4b,'panel':_0x437f57}),null===this['activeTab']?this['activateTab'](_0x119a21['id']):this['_hidePanel'](_0x119a21['id']),{'button':_0x36cc4b,'panel':_0x437f57};}['activateTab'](_0x561968){if(null!==_0x561968&&!this['getTab'](_0x561968))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x561968});if(this['activeTab']===_0x561968)return;const _0x2d2e1d=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x561968,_0x561968&&this['_showPanel'](_0x561968),this['fire']('activateTab:'+_0x561968,{'newTab':_0x561968,'oldTab':_0x2d2e1d});}['toggleTabPanel'](_0x3c9bcb){if(!this['getTab'](_0x3c9bcb))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x3c9bcb});this['activeTab']===_0x3c9bcb?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x3c9bcb);}['showTab'](_0x24c0db){if(!this['getTab'](_0x24c0db))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x24c0db});this['_showPanel'](_0x24c0db),this['_showButton'](_0x24c0db),this['fire']('show:'+_0x24c0db,_0x24c0db);}['hideTab'](_0x207d00){if(!this['getTab'](_0x207d00))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x207d00});const _0x2a7129=this['activeTab'];this['_hidePanel'](_0x207d00),this['_hideButton'](_0x207d00);const _0x1c3595=this['getTabIds']();_0x2a7129===_0x207d00&&_0x1c3595['length']>0x1&&this['activateTab'](_0x1c3595['find'](_0x3d5069=>_0x3d5069!==_0x207d00)),this['fire']('hide:'+_0x207d00,_0x207d00);}['_getPanel'](_0x2e2ea8){const _0x5aa033=this['_tabs']['get'](_0x2e2ea8);return _0x5aa033?_0x5aa033['panel']:null;}['_showPanel'](_0x1ed5c0){null!==this['activeTab']&&this['activeTab']!==_0x1ed5c0||this['_getPanel'](_0x1ed5c0)['show']();}['_hidePanel'](_0x2c5b0d){const _0x46bbf8=this['_getPanel'](_0x2c5b0d);_0x46bbf8['isVisible']&&(this['activeTab']===_0x2c5b0d&&(this['activeTab']=null),_0x46bbf8['hide']());}['_getButton'](_0x54b163){const _0xcc377e=this['_tabs']['get'](_0x54b163);return _0xcc377e?_0xcc377e['button']:null;}['_showButton'](_0x175b59){this['_getButton'](_0x175b59)['show']();}['_hideButton'](_0x2c78b6){this['_getButton'](_0x2c78b6)['hide']();}['_setupButton'](_0x3e7e10){const _0x167552=new TabButtonView(this['locale'],{'side':this['side']}),_0x92f697=this['buttonViews'];if(_0x167552['set']({'label':_0x3e7e10['label'],'icon':_0x3e7e10['icon'],'tooltip':!0x0,'withText':!0x0}),_0x167552['bind']('isOn')['to'](this,'activeTab',_0x7c70b1=>_0x7c70b1===_0x3e7e10['id']),_0x167552['bind']('side')['to'](this,'side'),_0x3e7e10['order']){const _0x3b60e6=[...this['_tabs']]['reduce']((_0x3dc489,_0x36d51e)=>{const _0x582cb8=_0x36d51e[0x0],{order:_0x1becfa}=_0x36d51e[0x1];return!_0x1becfa||_0x1becfa>_0x3e7e10['order']?_0x3dc489:_0x1becfa>=_0x3dc489['order']?{'id':_0x582cb8,'order':_0x1becfa}:_0x3dc489;},{'id':'','order':0x0}),_0x5c8ca1=_0x92f697['getIndex'](this['_getButton'](_0x3b60e6['id']));_0x92f697['add'](_0x167552,_0x5c8ca1+0x1);}else _0x92f697['add'](_0x167552);return _0x167552['on']('execute',()=>{this['toggleTabPanel'](_0x3e7e10['id']);}),_0x167552;}}const Vi=['overlay','sidebar','custom'],Pi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0xad84a4,_0x1cb377={}){super(_0xad84a4,_0x1cb377),this['set']('type',_0x1cb377['type']||'sidebar'),this['set']('side',_0x1cb377['side']||'right'),this['set']('isVisible',_0x1cb377['visibleByDefault']??!0x0);const _0x1cbf3d=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x1cbf3d['if']('type','ck-ai-tabs__overlay',_0x14a947=>'overlay'===_0x14a947),_0x1cbf3d['if']('type','ck-ai-tabs__sidebar',_0x227abb=>'sidebar'===_0x227abb),_0x1cbf3d['if']('isVisible','ck-hidden',_0x37013f=>!_0x37013f)]}}),this['buttonViews']['on']('add',(_0x5cb65f,_0x25caa8)=>{_0x25caa8['set']('withText',!0x1);});}}class AITabs extends _0x23f270{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2fc5e0){if(super(_0x2fc5e0),!this['context']['config']['get']('ai.container'))throw new at('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x564094=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x564094['showResizeButton']&&(this['showResizeButton']=_0x564094['showResizeButton']),'sidebar'!==_0x564094['type']&&'overlay'!==_0x564094['type']||_0x564094['side']&&(this['side']=_0x564094['side']),'sidebar'===_0x564094['type']){if(this['container']=_0x564094['element'],this['set']('type','sidebar'),!this['container'])throw new at('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x564094['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':_0x564094['visibleByDefault'],'collapsible':_0x564094['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 _0x5ca812&&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'](_0x5064c9){if(_0x5064c9&&this['type']!==_0x5064c9){if(!Vi['includes'](_0x5064c9))throw new at('ai-tabs-unsupported-ui-type');this['type']=_0x5064c9;}}['switchSide'](_0x3f7e28){if(_0x3f7e28&&this['side']!==_0x3f7e28){if(!Pi['includes'](_0x3f7e28))throw new at('ai-tabs-unsupported-ui-side');this['side']=_0x3f7e28;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0x23f270{['_apiUrl'];['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x5dd200];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x184ff4){super(_0x184ff4),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl'),this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x3fc440=this['context']['plugins']['get'](_0x5dd200);if(!_0x3fc440['token'])throw new at('ai-missing-token',this);this['_token']=_0x3fc440['token'];}['startConversation'](_0x24b8ff,_0x42ad6d){const _0x1cdf1f=this['_sendApiRequest']('/conversations','POST',{'id':_0x24b8ff,'group':_0x42ad6d});return{'getConversation':async()=>(await _0x1cdf1f['request'])['json'](),'abortController':_0x1cdf1f['abortController']};}['queryAssistant']({message:_0x53fd0a,conversationId:_0x3324cf,parts:_0x3f0c06,capabilities:_0x5df35c,model:_0x951755,attributes:_0x1fbe55}){const _0x529a06={'prompt':_0x53fd0a,'content':_0x3f0c06,'model':_0x951755,..._0x5df35c&&{'capabilities':_0x5df35c},..._0x1fbe55&&{'attributes':_0x1fbe55}},_0x4425de=this['_sendApiRequest']('/conversations/'+_0x3324cf+'/messages','POST',_0x529a06);return{'getStream':async()=>{const _0x54ed75=(await _0x4425de['request'])['body'];return this['_getStreamReader'](_0x54ed75);},'abortController':_0x4425de['abortController']};}['executeCustomAction']({content:_0x126897,message:_0x57036f,model:_0x2e95fe,outputFormat:_0x3529b7}){const _0x474510={'content':[{'type':'text','content':_0x126897}],'prompt':_0x57036f,'model':_0x2e95fe,'outputFormat':_0x3529b7},_0x1aabb9=this['_sendApiRequest']('/actions/custom/calls','POST',_0x474510);return{'getStream':async()=>{const _0x5b508d=(await _0x1aabb9['request'])['body'];return this['_getStreamReader'](_0x5b508d);},'abortController':_0x1aabb9['abortController']};}['executeAction']({actionName:_0x4f5a75,content:_0x27144b,args:_0x317c9e}){const _0x6d4656={'content':[{'type':'text','content':_0x27144b}],'args':_0x317c9e},_0x3c68c4=this['_sendApiRequest']('/actions/system/'+_0x4f5a75+'/calls','POST',_0x6d4656);return{'getStream':async()=>{const _0x5a2cde=(await _0x3c68c4['request'])['body'];return this['_getStreamReader'](_0x5a2cde);},'abortController':_0x3c68c4['abortController']};}['uploadFile'](_0x4cdf01,_0x4ba827,_0x56848d){const _0x2f13f7=new FormData();_0x2f13f7['append']('file',_0x4ba827,_0x4ba827['name']),_0x56848d&&_0x2f13f7['append']('attributes',JSON['stringify'](_0x56848d));const _0x43d026=this['_sendApiRequest']('/conversations/'+_0x4cdf01+'/files','POST',_0x2f13f7);return{'getId':async()=>(await _0x43d026['request'])['json'](),'abortController':_0x43d026['abortController']};}['fetchDocument'](_0xb2427f,_0x3b222c){const _0x1cb590=this['_sendApiRequest']('/conversations/'+_0xb2427f+'/documents/'+_0x3b222c,'GET');return{'getDocument':async()=>(await _0x1cb590['request'])['json'](),'abortController':_0x1cb590['abortController']};}['uploadDocument'](_0x4a03fe,_0xc75557,_0xb0c7af){const _0x528cb4={'content':_0xc75557};_0xb0c7af&&(_0x528cb4['attributes']=_0xb0c7af);const _0x3db0dc=this['_sendApiRequest']('/conversations/'+_0x4a03fe+'/documents','POST',_0x528cb4);return{'getId':async()=>(await _0x3db0dc['request'])['json'](),'abortController':_0x3db0dc['abortController']};}['uploadDocuments'](_0x1a94ad,_0x43b2f7){const _0x1f10b8={'documents':_0x43b2f7['map'](_0x59ae40=>({'content':_0x59ae40['content'],'attributes':{'version':_0x59ae40['version'],'sessionId':_0x59ae40['sessionId'],'channelId':_0x59ae40['channelId'],'rootName':_0x59ae40['rootName'],'selections':_0x59ae40['selections']},...void 0x0!==_0x59ae40['name']?{'name':_0x59ae40['name']}:{},...void 0x0!==_0x59ae40['description']?{'description':_0x59ae40['description']}:{}}))},_0x253bdc=this['_sendApiRequest']('/conversations/'+_0x1a94ad+'/documents/batch','POST',_0x1f10b8);return{'getIds':async()=>(await _0x253bdc['request'])['json'](),'abortController':_0x253bdc['abortController']};}['fetchDocuments'](_0x3cc782,_0x5603e9){const _0x411afc=new URLSearchParams();_0x411afc['append']('documentIds',_0x5603e9['join'](','));const _0x519cd2=this['_sendApiRequest']('/conversations/'+_0x3cc782+'/documents/batch?'+_0x411afc['toString'](),'GET');return{'getDocuments':async()=>(await _0x519cd2['request'])['json'](),'abortController':_0x519cd2['abortController']};}['fetchConversations'](_0x19ab47,_0x27ce15={}){const _0x3b8cd9=new URLSearchParams();_0x3b8cd9['append']('group',_0x19ab47),_0x3b8cd9['append']('excludeEmpty',!0x1!==_0x27ce15['excludeEmpty']?'true':'false'),_0x3b8cd9['append']('limit',_0x27ce15['limit']?_0x27ce15['limit']['toString']():'100'),_0x3b8cd9['append']('sortBy',_0x27ce15['sortBy']?_0x27ce15['sortBy']:'createdAt'),_0x3b8cd9['append']('order',_0x27ce15['order']?_0x27ce15['order']:'desc');const _0x393730=this['_sendApiRequest']('/conversations?'+_0x3b8cd9['toString'](),'GET');return{'getConversations':async()=>{const _0x3b6b6b=await _0x393730['request'];return(await _0x3b6b6b['json']())['items'];},'abortController':_0x393730['abortController']};}['deleteConversation'](_0x256de7){const _0xfb4575=this['_sendApiRequest']('/conversations/'+_0x256de7,'DELETE');return{'execute':async()=>{await _0xfb4575['request'];},'abortController':_0xfb4575['abortController']};}['updateConversation'](_0x58c663,_0x3443c){const _0x3b4568=this['_sendApiRequest']('/conversations/'+_0x58c663,'PATCH',_0x3443c);return{'getResult':async()=>(await _0x3b4568['request'],_0x3443c),'abortController':_0x3b4568['abortController']};}['fetchConversation'](_0x318759){const _0x360b28=this['_sendApiRequest']('/conversations/'+_0x318759,'GET');return{'getConversation':async()=>(await _0x360b28['request'])['json'](),'abortController':_0x360b28['abortController']};}['fetchConversationMessages'](_0x4d16bf){const _0x307715=this['_sendApiRequest']('/conversations/'+_0x4d16bf+'/messages','GET');return{'getMessages':async()=>{const _0x507250=await _0x307715['request'];return(await _0x507250['json']())['items'];},'abortController':_0x307715['abortController']};}['uploadUrl'](_0x1fb937,_0x58a80a,_0x15712a){const _0x40697f=this['_sendApiRequest']('/conversations/'+_0x1fb937+'/web-resources','POST',{'url':_0x58a80a,'attributes':_0x15712a});return{'getId':async()=>(await _0x40697f['request'])['json'](),'abortController':_0x40697f['abortController']};}['getModels'](_0x281bc2='en'){const _0x53a0ef=new URLSearchParams();_0x53a0ef['append']('language',_0x281bc2);const _0x83ec9b='/models/1?'+_0x53a0ef['toString'](),_0xcc604a=this['_sendApiRequest'](_0x83ec9b,'GET',void 0x0,!0x0);return{'list':async()=>await(await _0xcc604a['request'])['json'](),'abortController':_0xcc604a['abortController']};}['deleteFile'](_0x3f3ec6,_0x130591){const _0x2f587e=this['_sendApiRequest']('/conversations/'+_0x3f3ec6+'/files/'+_0x130591,'DELETE');return{'execute':async()=>{await _0x2f587e['request'];},'abortController':_0x2f587e['abortController']};}['deleteDocument'](_0x1ad6bc,_0x395675){const _0x5a43fc=this['_sendApiRequest']('/conversations/'+_0x1ad6bc+'/documents/'+_0x395675,'DELETE');return{'execute':async()=>{await _0x5a43fc['request'];},'abortController':_0x5a43fc['abortController']};}['deleteWebResource'](_0x36ce8c,_0x113488){const _0x176a7f=this['_sendApiRequest']('/conversations/'+_0x36ce8c+'/web-resources/'+_0x113488,'DELETE');return{'execute':async()=>{await _0x176a7f['request'];},'abortController':_0x176a7f['abortController']};}['callSystemReview']({reviewName:_0x108e9b,content:_0x12273e,args:_0x42a079}){const _0x2e6872=this['_sendApiRequest']('/reviews/system/'+_0x108e9b+'/calls','POST',{'content':[{'type':'text','content':_0x12273e}],'args':_0x42a079});return{'getStream':async()=>{const _0x455b41=(await _0x2e6872['request'])['body'];return this['_getStreamReader'](_0x455b41);},'abortController':_0x2e6872['abortController']};}['callCustomReview']({content:_0x4c9287,prompt:_0xde200f,model:_0x448d16}){const _0x454dd0=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x4c9287}],'prompt':_0xde200f,'model':_0x448d16});return{'getStream':async()=>{const _0x4e2a90=(await _0x454dd0['request'])['body'];return this['_getStreamReader'](_0x4e2a90);},'abortController':_0x454dd0['abortController']};}['upsertAIChatRating'](_0x25641c,_0x43e16b,_0x27cf76){const _0x4e88f9=this['_sendApiRequest']('/conversations/'+_0x25641c+'/messages/'+_0x43e16b+'/ratings','PUT',{'positiveCount':_0x27cf76['positiveCount'],'totalCount':_0x27cf76['totalCount'],'modificationId':_0x27cf76['modificationId']});return{'execute':async()=>{await _0x4e88f9['request'];},'abortController':_0x4e88f9['abortController']};}['upsertAIActionRating'](_0x1b2f34,_0x2e081a,_0x35d451){const _0x10abc7=this['_sendApiRequest']('/actions/system/'+_0x1b2f34+'/calls/'+_0x2e081a+'/ratings','PUT',{'positiveCount':_0x35d451['positiveCount'],'totalCount':_0x35d451['totalCount']});return{'execute':async()=>{await _0x10abc7['request'];},'abortController':_0x10abc7['abortController']};}['upsertCustomAIActionRating'](_0x27fb4c,_0x3340e3){const _0x47f61b=this['_sendApiRequest']('/actions/custom/calls/'+_0x27fb4c+'/ratings','PUT',{'positiveCount':_0x3340e3['positiveCount'],'totalCount':_0x3340e3['totalCount']});return{'execute':async()=>{await _0x47f61b['request'];},'abortController':_0x47f61b['abortController']};}['upsertAIReviewRating'](_0x252b23,_0x23681d,_0x3a1e47,_0x1e7e79){const _0x23ffa3=this['_sendApiRequest']('/reviews/system/'+_0x252b23+'/calls/'+_0x23681d+'/ratings','PUT',{'positiveCount':_0x3a1e47['positiveCount'],'totalCount':_0x3a1e47['totalCount'],'dataId':_0x1e7e79});return{'execute':async()=>{await _0x23ffa3['request'];},'abortController':_0x23ffa3['abortController']};}['upsertCustomAIReviewRating'](_0x28ba60,_0x70bc3f,_0x2566c8){const _0x3f340c=this['_sendApiRequest']('/reviews/custom/calls/'+_0x28ba60+'/ratings','PUT',{'positiveCount':_0x70bc3f['positiveCount'],'totalCount':_0x70bc3f['totalCount'],'dataId':_0x2566c8});return{'execute':async()=>{await _0x3f340c['request'];},'abortController':_0x3f340c['abortController']};}['_sendApiRequest'](_0x2ef64e,_0x9208e0,_0x1965b3,_0x373ba5=!0x1){const _0x58ad39=new AbortController(),_0x3e6ee4=_0x373ba5?_0x9208e0+':'+_0x2ef64e:null;if(_0x3e6ee4){const _0x445f38=this['_responseCache']['get'](_0x3e6ee4);if(_0x445f38)return{'request':_0x445f38['then'](_0x592cce=>_0x592cce['clone']()),'abortController':_0x58ad39};}const _0x133a7e=_0x1965b3 instanceof FormData,_0x8dbc6a={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0x1965b3&&!_0x133a7e&&(_0x8dbc6a['Content-Type']='application/json');const _0x2f8ca4={'method':_0x9208e0,'headers':_0x8dbc6a,'signal':_0x58ad39['signal']};_0x1965b3&&(_0x2f8ca4['body']=_0x133a7e?_0x1965b3:JSON['stringify'](_0x1965b3));const _0xaa1f5e=fetch(''+this['_apiUrl']+_0x2ef64e,_0x2f8ca4)['catch'](_0x46368e=>{_0x3e6ee4&&this['_responseCache']['delete'](_0x3e6ee4),this['_handleError'](_0x46368e);})['then'](_0x2dfc03=>_0x2dfc03['ok']?_0x2dfc03:_0x2dfc03['json']()['then'](_0x3aa3cb=>{throw _0x3e6ee4&&this['_responseCache']['delete'](_0x3e6ee4),{'url':this['_apiUrl'],'path':_0x2ef64e,'method':_0x9208e0,'body':_0x1965b3,'status':(_0x2dfc03||{})['status'],'statusText':(_0x2dfc03||{})['statusText'],'code':_0x3aa3cb['code'],'message':_0x3aa3cb['message'],'traceId':_0x3aa3cb['traceId']};}));return _0x3e6ee4&&this['_responseCache']['set'](_0x3e6ee4,_0xaa1f5e['then'](_0x5d624c=>_0x5d624c['clone']())),{'request':_0xaa1f5e,'abortController':_0x58ad39};}async*['_getStreamReader'](_0x1c0a3f){const _0x5a6080=[],_0x58c250=_0x1c0a3f['getReader'](),_0x24deb7=_0x3df424({'onError':_0x310629=>{this['_handleError'](_0x310629);},'onEvent':_0x2a3e99=>{_0x2a3e99['data']=JSON['parse'](_0x2a3e99['data']),_0x5a6080['push'](_0x2a3e99);}});try{let _0x32e5b5=!0x1;for(;!_0x32e5b5;){const {done:_0xb0566,value:_0x4e27e7}=await _0x58c250['read']();_0xb0566&&(_0x32e5b5=!0x0),_0x24deb7['feed'](this['_decoder']['decode'](_0x4e27e7,{'stream':!0x0})),yield*_0x5a6080,_0x5a6080['length']=0x0;}}catch(_0x24d9d5){this['_handleError'](_0x24d9d5);}finally{_0x58c250['releaseLock'](),_0x24deb7['reset']();}}['_handleError'](_0x23bb91){if(_0x23bb91 instanceof at)throw _0x23bb91;if(_0x23bb91 instanceof Error&&'AbortError'===_0x23bb91['name'])throw new at('ai-request-aborted',this,{'originalError':_0x23bb91});throw new at('ai-request-failed',this,{'originalError':_0x23bb91});}}function Hi(_0x536c7b,_0x1fd075,_0x5b025e){const t=_0x536c7b['t'];switch(_0x1fd075){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'},_0x5b025e);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.'},_0x5b025e);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.'},_0x5b025e);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_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.'},_0x5b025e);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'},_0x5b025e);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x5b025e);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'},_0x5b025e);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.'},_0x5b025e);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.'},_0x5b025e);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.'},_0x5b025e);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.'},_0x5b025e);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'},_0x5b025e);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.'},_0x5b025e);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 _0x1fd075;}}const Mi='ck-ai-button-primary',Ui='ck-ai-button-secondary',Bi='ck-ai-button-tertiary';function Gi(_0x4b09b8,_0x53e27d){const _0x250f69=new vt(_0x4b09b8),_0x31d70b=Hi(_0x4b09b8,'AI_TABS_LABEL_MINIMIZE'),_0x1da145=Hi(_0x4b09b8,'AI_TABS_LABEL_MAXIMIZE');return _0x250f69['set']({'withText':!0x1,'icon':_0x5822e5,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Bi}),_0x250f69['bind']('label')['to'](_0x53e27d,'isMaximized',_0xb10bb4=>_0xb10bb4?_0x31d70b:_0x1da145),_0x250f69['bind']('icon')['to'](_0x53e27d,'isMaximized',_0x1e6aa0=>_0x1e6aa0?_0x494a35:_0x5822e5),_0x250f69['bind']('isOn')['to'](_0x53e27d,'isMaximized'),_0x250f69['on']('execute',()=>{_0x53e27d['fire']('resizeTabs');}),_0x250f69;}function Fi(_0x564ef5){return _0x56717f(_0x564ef5);}function Ki(_0xfd8e9b){return ti(_0xfd8e9b);}function Wi(_0x1a5165,_0x542291,_0x20cc70){const _0x57cc11=null!==_0x542291?_0x4ba3ec=>_0x4ba3ec['attribs'][_0x1a5165]===_0x542291:_0x369359=>Boolean(_0x369359['attribs'][_0x1a5165]);return _0x4e94ee(_0x35f480=>_0x4e8462(_0x35f480)&&_0x57cc11(_0x35f480),_0x20cc70);}function Yi(_0x5a79c9,_0x3e80fa,_0x260db4){const _0x4f076f=null!==_0x3e80fa?_0x4e7958=>_0x4e7958['attribs'][_0x5a79c9]===_0x3e80fa:_0x5d31fc=>Boolean(_0x5d31fc['attribs'][_0x5a79c9]);return _0x2c9ab8(_0x555007=>_0x4e8462(_0x555007)&&_0x4f076f(_0x555007),_0x260db4);}function $i(_0x167c23,_0x4ff89a){return _0x167c23&&_0x4e8462(_0x167c23)?_0x167c23['attribs'][_0x4ff89a]:null;}function qi(_0x22c39c,_0x3ee3e3,_0x12edeb){_0x4e8462(_0x22c39c)&&(null===_0x12edeb?delete _0x22c39c['attribs'][_0x3ee3e3]:_0x22c39c['attribs'][_0x3ee3e3]=_0x12edeb);}function Qi(_0x451a8e,_0x5a3b36,_0x39639e){const _0x3d0dae=_0x5a3b36['cloneNode'](!0x0);'beforebegin'===_0x39639e?_0x51f634(_0x451a8e,_0x3d0dae):'afterbegin'===_0x39639e?_0x59f22f(_0x451a8e,_0x3d0dae):'beforeend'===_0x39639e?_0x4c46bc(_0x451a8e,_0x3d0dae):'afterend'===_0x39639e&&_0x5a70f4(_0x451a8e,_0x3d0dae);}function Xi(_0x5b6eaf){const _0x148419=[];let _0x399b74=_0x5b6eaf;for(;_0x399b74;)_0x399b74=_0xe83088(_0x399b74),_0x399b74&&_0x148419['push'](_0x399b74);return _0x148419;}function zi(_0x8d33ba){return _0x8d33ba['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ji(_0x480580){let _0x21a646=0x0;for(;_0x480580['parentNode'];)_0x480580=_0x480580['parentNode'],_0x21a646++;return _0x21a646;}function Ji(_0x311b16){const _0x2b227d=[];let _0x3685c3=_0x311b16['nextSibling'];for(;_0x3685c3;)_0x2b227d['push'](_0x3685c3),_0x3685c3=_0x3685c3['nextSibling'];_0x2b227d['forEach'](_0x3fc216=>{_0x32f2bc(_0x3fc216);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
25
- ht(){['_m2html'];constructor(){super();const _0x32ca41=Object['entries'](_0x3ceff7),_0x2f2c38=_0x32ca41['findIndex'](([_0x13b561])=>'rehypeDomRaw'===_0x13b561);if(-0x1===_0x2f2c38)throw new at('ai-response-parser-unable-to-set-up-parser');_0x32ca41['splice'](_0x2f2c38+0x1,0x0,['rehypeSanitize',_0xec741]),this['_m2html']=new _0xc438b({'plugins':Object['fromEntries'](_0x32ca41)});}['convertMarkdownToHTML'](_0x5c0f2b){const _0x192249=this['_m2html']['parse'](_0x5c0f2b);return this['parseAndNormalizeHTML'](_0x192249);}['parseAndNormalizeHTML'](_0x24cbc8){return this['_parseHTML'](_0x24cbc8);}['_parseHTML'](_0x844625){const _0x4dc3f1=Fi('<dummy>'+_0x844625['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/<[^>]*?$/g,'')+'</dummy>');return _0x4dc3f1['children']=_0x4dc3f1['children'][0x0]['children'],_0x4dc3f1;}}class AIResponseApplier extends/* #__PURE__ -- @preserve */
26
- ht(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null};['_existingDataIds']=new Set();constructor(_0x53a25f){super(),this['_generateUid']=_0x53a25f||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x5cceee,_0x30d856,_0x2203fb){this['_uidCounter']=0x0;const _0x2c0227=_0x5cceee['cloneNode'](!0x0),_0x201f0d=_0x2c0227['childNodes'],_0x5e5b67=Array['from'](_0x201f0d)['filter'](_0x2efbb9=>!(0x3===_0x2efbb9['nodeType']&&''===Ki(_0x2efbb9)['trim']())),_0x382308=_0x5e5b67['length'],_0x4bc5b8=new Map();for(const _0x243c67 of _0x5e5b67)_0x243c67&&_0x4e8462(_0x243c67)&&void 0x0===_0x243c67['attribs']['data-id']&&qi(_0x243c67,'data-id','new-element');if(0x0===_0x30d856['childNodes']['length']){const _0x3dd293=[];return Yi('data-id','new-element',_0x2c0227)['forEach'](_0xde7aa6=>{const _0x2111ad=this['_generateUid']();qi(_0xde7aa6,'data-id',_0x2111ad),_0x3dd293['push'](_0x2111ad);}),this['_removeSpecialComments'](_0x2c0227),{'parsedContent':_0x2c0227,'newNodeIds':_0x3dd293,'modifiedNodeIds':[],'removedNodeIds':[],'newAnchorIds':_0x4bc5b8};}_0x2203fb&&_0x2203fb['markUnstableElements']&&this['_markLastTagElementUnstable'](_0x2c0227),this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_existingDataIds']=new Set(Yi('data-id',null,_0x30d856)['map'](_0xaccad5=>$i(_0xaccad5,'data-id'))['filter'](_0x30cf9e=>!!_0x30cf9e));let _0x2ea4a9=-0x1,_0x16fb72=!0x1;for(let _0x3489aa=0x0;_0x3489aa<_0x382308;_0x3489aa++){const _0x2c2560=_0x5e5b67[_0x3489aa],_0x3cce67=_0x5e5b67[_0x3489aa+0x1];if(this['_isNewNode'](_0x2c2560)){if(-0x1===_0x2ea4a9&&(_0x2ea4a9=_0x3489aa),this['_markWrappedElements'](_0x2c2560),!this['_isNewNode'](_0x3cce67)){const [_0x195ab1,_0x37ddda]=this['_findReferenceNode'](_0x2c2560,_0x16fb72,_0x30d856);if(_0x195ab1){const _0x3c9329=Array['from'](_0x5e5b67)['slice'](_0x2ea4a9,_0x3489aa+0x1),_0x1a2a09=$i(_0x195ab1,'data-id');if(this['_insertNodes'](_0x195ab1,_0x3c9329,_0x37ddda),_0x1a2a09)for(const _0x100a7b of _0x3c9329){const _0x22b6a4=$i(_0x100a7b,'data-id');_0x22b6a4&&_0x4bc5b8['set'](_0x22b6a4,_0x1a2a09);}_0x2ea4a9=-0x1;}}}else{if(this['_isExistingContentComment'](_0x2c2560))_0x16fb72=!0x0;else{if(this['_isExistingNode'](_0x2c2560)){const _0x2f1594=$i(_0x2c2560,'data-id');if(_0x2f1594&&this['_existingDataIds']['has'](_0x2f1594)){const _0x4c2d6a=Wi('data-id',_0x2f1594,_0x30d856);this['_replaceNode'](_0x4c2d6a,_0x2c2560);}}else{if(this['_isDelNode'](_0x2c2560)){const _0x361040=this['_getNodeDataId'](_0x2c2560);!!Wi('data-id',_0x361040,_0x2c0227)||this['_touchedNodesState']['removedIds']['push'](_0x361040);}}}}}for(const _0x396577 of this['_touchedNodesState']['removedIds']){const _0x3d76cf=Wi('data-id',_0x396577,_0x30d856);_0x3d76cf&&this['_removeNode'](_0x3d76cf,_0x396577,_0x2203fb);}if(Yi('data-id','new-element',_0x30d856)['forEach'](_0x1b82ac=>{const _0x5869d0=this['_getUid'](_0x1b82ac);qi(_0x1b82ac,'data-id',_0x5869d0),this['_touchedNodesState']['newIds']['push'](_0x5869d0);}),this['_removeSpecialComments'](_0x30d856),_0x2203fb&&_0x2203fb['markUnstableElements']&&this['_markUnstableElements'](_0x30d856,_0x2203fb['markUnstableElementsDepth']||0x0),this['_processWrappedElements'](_0x30d856,_0x2203fb),_0x2203fb&&_0x2203fb['cutAfterLastChange']&&this['_touchedNodesState']['lastTouchedId']){const _0x149204=Yi('data-id',this['_touchedNodesState']['lastTouchedId'],_0x30d856);let _0x34a795=_0x149204[_0x149204['length']-0x1];for(;_0x34a795;)Ji(_0x34a795),_0x34a795=_0x34a795['parentNode'];}return{'parsedContent':_0x30d856,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds'],'newAnchorIds':_0x4bc5b8};}['_insertNodes'](_0x5e3611,_0x30ca33,_0x42a18d){for(const _0xd318ba of _0x30ca33){const _0x29dc97=this['_getUid'](_0xd318ba);qi(_0xd318ba,'data-id',_0x29dc97),this['_touchedNodesState']['newIds']['push'](_0x29dc97),this['_touchedNodesState']['lastTouchedId']=_0x29dc97;}const _0xe97452='afterbegin'===_0x42a18d||'afterend'===_0x42a18d?_0x30ca33['reverse']():_0x30ca33;for(const _0x50245a of _0xe97452)Qi(_0x5e3611,_0x50245a,_0x42a18d);}['_replaceNode'](_0x385bf9,_0x3aed63){if(!_0x385bf9)return;if(_0x26be68=_0x3aed63,zi(Ki(_0x385bf9))===zi(Ki(_0x26be68)))return;var _0x26be68;const _0x482f51=this['_getUid'](_0x385bf9);qi(_0x3aed63,'data-id',_0x482f51),this['_touchedNodesState']['modifiedIds']['push'](_0x482f51),this['_touchedNodesState']['lastTouchedId']=_0x482f51,_0x118b57(_0x385bf9,_0x3aed63['cloneNode'](!0x0));}['_removeNode'](_0x3a17d3,_0x31fb99,_0x3ce3fc){if(_0x3ce3fc&&_0x3ce3fc['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x31fb99;const _0x4d3834=_0x3ce3fc['replaceRemovedWith']['cloneNode'](!0x0);qi(_0x4d3834,'data-id',_0x31fb99),qi(_0x4d3834,'data-removed','true'),_0x118b57(_0x3a17d3,_0x4d3834);}else _0x32f2bc(_0x3a17d3);}['_findReferenceNode'](_0x3d6f8b,_0x36f10e,_0x2c79ec){const _0x53f596=this['_findPrevElementWithDataId'](_0x3d6f8b,!0x1);if(_0x53f596){const _0x146732=this['_getNodeDataId'](_0x53f596),_0x5f1b15=Wi('data-id',_0x146732,_0x2c79ec);if(_0x5f1b15)return[_0x5f1b15,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x146732);}const _0x10ab1c=this['_findNextElementWithDataId'](_0x3d6f8b,!0x1);if(_0x10ab1c){const _0x472807=this['_getNodeDataId'](_0x10ab1c),_0x52dd57=Wi('data-id',_0x472807,_0x2c79ec);if(_0x52dd57)return[_0x52dd57,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x472807);}return _0x36f10e?_0x3d6f8b['nextSibling']?this['_findFallbackReferenceNode'](_0x3d6f8b,_0x2c79ec):[_0x2c79ec['childNodes'][_0x2c79ec['childNodes']['length']-0x1],'afterend']:[_0x2c79ec['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x4b19d5,_0x5af29d){const _0x314a3b=[],_0x1936e0=this['_findPrevElementWithDataId'](_0x4b19d5,!0x0);if(_0x1936e0){const _0x368c15=Wi('data-id',this['_getNodeDataId'](_0x1936e0),_0x5af29d);_0x368c15&&_0x314a3b['push']([_0x368c15,'afterend']);}const _0x15888c=this['_findNextElementWithDataId'](_0x4b19d5,!0x0);if(_0x15888c){const _0xc523fb=Wi('data-id',this['_getNodeDataId'](_0x15888c),_0x5af29d);_0xc523fb&&_0x314a3b['push']([_0xc523fb,'beforebegin']);}if(_0x314a3b['length']>0x1)return ji(_0x314a3b[0x0][0x0])<=ji(_0x314a3b[0x1][0x0])?_0x314a3b[0x0]:_0x314a3b[0x1];return 0x1===_0x314a3b['length']?_0x314a3b[0x0]:[_0x5af29d['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x4fceab,_0x17d1f9){let _0x51c82d=_0x4fceab['nextSibling'],_0xe4b9b4=null,_0x3a3a0d=!0x1;for(;_0x51c82d;){if(_0x468d05(_0x51c82d)){if(this['_isDelNode'](_0x51c82d)&&(_0xe4b9b4=_0x51c82d),this['_isExistingContentComment'](_0x51c82d)&&_0x17d1f9&&!_0x3a3a0d){_0x3a3a0d=!0x0,_0x51c82d=_0x51c82d['nextSibling'];continue;}break;}const _0x25f4df=$i(_0x51c82d,'data-id');if(_0x25f4df&&'new-element'!==_0x25f4df&&this['_existingDataIds']['has'](_0x25f4df)){_0xe4b9b4=_0x51c82d;break;}_0x51c82d=_0x51c82d['nextSibling'];}return _0xe4b9b4;}['_findPrevElementWithDataId'](_0x233bb1,_0x34602a){let _0x1f4dce=_0x233bb1['previousSibling'],_0x5b2a28=null,_0xe91231=!0x1;for(;_0x1f4dce;){if(_0x468d05(_0x1f4dce)){if(this['_isDelNode'](_0x1f4dce)&&(_0x5b2a28=_0x1f4dce),this['_isExistingContentComment'](_0x1f4dce)&&_0x34602a&&!_0xe91231){_0xe91231=!0x0,_0x1f4dce=_0x1f4dce['previousSibling'];continue;}break;}const _0x3d2b98=$i(_0x1f4dce,'data-id');if(_0x3d2b98&&'new-element'!==_0x3d2b98&&this['_existingDataIds']['has'](_0x3d2b98)){_0x5b2a28=_0x1f4dce;break;}_0x1f4dce=_0x1f4dce['previousSibling'];}return _0x5b2a28;}['_markWrappedElements'](_0x186ccf){_0x4e8462(_0x186ccf)&&Yi('data-id',null,_0x186ccf)['forEach'](_0x240bba=>{this['_isExistingNode'](_0x240bba)&&(qi(_0x240bba,'data-wrapped-id',$i(_0x240bba,'data-id')),qi(_0x240bba,'data-id',null));});}['_processWrappedElements'](_0x28ede0,_0x26fa07){Yi('data-wrapped-id',null,_0x28ede0)['forEach'](_0x1b8ce1=>{const _0x1297ac=$i(_0x1b8ce1,'data-wrapped-id');if($i(_0x1b8ce1,'data-unstable')||this['_hasUnstableParent'](_0x1b8ce1))return;const _0x35ac84=Wi('data-id',_0x1297ac,_0x28ede0);qi(_0x1b8ce1,'data-id',_0x1297ac),qi(_0x1b8ce1,'data-wrapped-id',null),_0x35ac84&&(this['_removeNode'](_0x35ac84,_0x1297ac,_0x26fa07),this['_touchedNodesState']['removedIds']['push'](_0x1297ac),this['_touchedNodesState']['lastTouchedId']=_0x1297ac);});}['_hasUnstableParent'](_0x3d5bfd){let _0x343f49=_0x3d5bfd['parentNode'];for(;_0x343f49;){if($i(_0x343f49,'data-unstable'))return!0x0;_0x343f49=_0x343f49['parentNode'];}return!0x1;}['_getNodeDataId'](_0x241548){if(!_0x241548)return null;if(_0x4e8462(_0x241548))return $i(_0x241548,'data-id');if(_0x468d05(_0x241548)){const _0x5a4ce6=Ki(_0x241548)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x5a4ce6&&_0x5a4ce6[0x1])return _0x5a4ce6[0x1];}return null;}['_getUid'](_0x47f491){return this['_isExistingNode'](_0x47f491)?$i(_0x47f491,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x478d4d){(function(_0x30d2e1){return _0x592842(_0x239249=>_0x468d05(_0x239249),_0x30d2e1,!0x0,0x1/0x0);}(_0x478d4d)['filter'](_0xc721ed=>this['_isDelNode'](_0xc721ed)||this['_isExistingContentComment'](_0xc721ed))['forEach'](_0x365098=>{_0x32f2bc(_0x365098);}));}['_markLastTagElementUnstable'](_0x23623f){const _0x51738e=_0x23623f['childNodes'],_0x24cf1b=_0x51738e[_0x51738e['length']-0x1];_0x24cf1b&&_0x4e8462(_0x24cf1b)&&qi(_0x24cf1b,'data-unstable','true');}['_markUnstableElements'](_0x2f991e,_0x2455da){const _0xc1dbc3=Wi('data-unstable','true',_0x2f991e);if(!_0xc1dbc3)return;const _0x13779e=Xi(_0xc1dbc3)['slice'](0x0,-0x1),_0x5c122e=_0x13779e['length'];let _0x50521e=_0xc1dbc3;if(_0x5c122e>_0x2455da){let _0x5dca44=_0x5c122e,_0x49f653=null;for(;_0x5dca44>_0x2455da&&_0x5dca44>=0x0;)_0x5dca44--,_0x49f653=_0x13779e[_0x5dca44];_0x49f653&&(_0x50521e=_0x49f653,qi(_0xc1dbc3,'data-unstable',null),qi(_0x49f653,'data-unstable','true'));}else{if(_0x5c122e<_0x2455da){let _0x4de3bb=_0x5c122e,_0x3a48c5=_0xc1dbc3;for(;_0x4de3bb<_0x2455da;){const _0x418e0a=_0x3a48c5['childNodes']['filter'](_0xdf5d70=>_0x4e8462(_0xdf5d70));if(0x0===_0x418e0a['length'])break;_0x4de3bb++,_0x3a48c5=_0x418e0a[_0x418e0a['length']-0x1];}_0x3a48c5&&(_0x50521e=_0x3a48c5,qi(_0xc1dbc3,'data-unstable',null),qi(_0x3a48c5,'data-unstable','true'));}}let _0x4f953a=_0x50521e;for(;_0x4f953a;){for(;_0x4f953a['nextSibling'];)_0x4f953a=_0x4f953a['nextSibling'],_0x4e8462(_0x4f953a)&&qi(_0x4f953a,'data-unstable','true');_0x4f953a=_0x4f953a['parentNode'];}}['_isNewNode'](_0x1b9842){return Boolean('new-element'===$i(_0x1b9842,'data-id'));}['_isExistingNode'](_0x4227b0){return Boolean(($i(_0x4227b0,'data-id')||'')['length']>0x0&&'new-element'!==$i(_0x4227b0,'data-id'));}['_isDelNode'](_0x7c306f){return!!_0x7c306f&&Boolean(_0x468d05(_0x7c306f)&&Ki(_0x7c306f)['match'](/removed[\s*-]data-id="[^"]+"/));}['_isExistingContentComment'](_0xeca37b){return Boolean(_0x468d05(_0xeca37b)&&Ki(_0xeca37b)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function Zi({editor:_0x3b0330,changeGroups:_0x550dfc,documentContextContent:_0x244be0,showDiff:_0x756c3,trimUnchanged:_0x5eae7e=!0x0}){return _0x550dfc['map'](_0x503d09=>{const _0x5d8e6a=new _0x34e0db([]),_0xd3f683=new _0x34e0db([]),_0x32a964=new Set();for(const _0x51984c of _0x503d09['changes'])'new'==_0x51984c['type']&&Yi('data-id',null,_0x51984c['node'])['forEach'](_0x59a0bb=>{_0x32a964['add']($i(_0x59a0bb,'data-id'));});for(const _0x131e27 of _0x503d09['changes'])if('removed'!=_0x131e27['type']?_0xd3f683['children']['push'](_0x131e27['node']['cloneNode'](!0x0)):_0x756c3||_0x32a964['has'](_0x131e27['id'])||_0xd3f683['children']['push'](_0x131e27['node']['cloneNode'](!0x0)),'new'!=_0x131e27['type']&&(_0x756c3||'removed'!=_0x131e27['type'])){const _0x3d3005=_0x4e94ee(_0x65a64d=>$i(_0x65a64d,'data-id')==_0x131e27['id'],_0x244be0,!0x0);_0x3d3005&&_0x5d8e6a['children']['push'](_0x3d3005['cloneNode'](!0x0));}const {content:_0x1cf58a,hasChanges:_0x3a90b1}=function(_0x2612fb,_0x62082f,_0x459469,_0x15a0f3,_0x40669c=!0x0){const _0x546f85=_0x2612fb['plugins']['get']('DocumentCompare'),_0x598f74=Ki(_0x62082f),_0x18d87c=Ki(_0x459469),_0x5e5d06=_0x2612fb['data']['parse'](_0x598f74,'$root'),_0x3a3c1a=_0x2612fb['model']['createPositionAt'](_0x5e5d06,0x0),_0x39f719=_0x546f85['getDiff'](_0x598f74,_0x18d87c,{'anchor':_0x3a3c1a,'markDeletions':_0x15a0f3,'targetEditor':_0x2612fb}),_0x4a237b=_0x39f719['getOperations']();if(0x0==_0x4a237b['length'])return{'content':_0x62082f['cloneNode'](!0x0),'hasChanges':!0x1};_0x15a0f3?function(_0x2c06eb,_0x3b9ad0,_0x32c114){if(0x0==_0x2c06eb['length'])return;const _0x2b91b3=_0x32c114['plugins']['get']('DocumentCompare'),_0x3f3895=_0x32c114['plugins']['get']('SuggestionsConversion');_0x32c114['model']['change'](_0x4ffe61=>{const _0x13244a=new Set();for(let _0x5a592a=0x0;_0x5a592a<_0x2c06eb['length'];_0x5a592a++){const _0x131bbf=_0x2c06eb[_0x5a592a];if(_0x131bbf['baseVersion']=null,_0x131bbf['isDocumentOperation']=!0x1,_0x2b91b3['isMarkedRemoveOperation'](_0x131bbf)){const _0x9cf1d6=_0x43b9ff(_0x131bbf['newRange'],_0x32c114['model']),_0x230c7a='suggestion:deletion:'+ot()+':$aiSuggestion';_0x3b9ad0['markers']['set'](_0x230c7a,_0x9cf1d6);}else switch(_0x131bbf['type']){case'rename':{if(_0x131bbf['oldName']==_0x131bbf['newName'])break;_0x4ffe61['batch']['addOperation'](_0x131bbf),_0x32c114['model']['applyOperation'](_0x131bbf);const _0x1fccad='$elementName',_0x349c18=_0x131bbf['position'],_0x5e20c6=_0x32c114['model']['createRange'](_0x349c18,_0x32c114['model']['createPositionAt'](_0x349c18['nodeAfter'],'end')),_0x3f5fcc='suggestion:attribute:'+_0x1fccad+':'+ot()+':$aiSuggestion';_0x3b9ad0['markers']['set'](_0x3f5fcc,_0x5e20c6);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x131bbf['oldValue']==_0x131bbf['newValue'])break;_0x4ffe61['batch']['addOperation'](_0x131bbf),_0x32c114['model']['applyOperation'](_0x131bbf);const _0x41bc95=_0x131bbf['key'];if(!_0x3f3895['isRegisteredAttribute'](_0x41bc95))break;const _0x1af45f=_0x43b9ff(_0x131bbf['range'],_0x32c114['model']),_0x49f770='suggestion:attribute:'+_0x41bc95+':'+ot()+':$aiSuggestion';_0x3b9ad0['markers']['set'](_0x49f770,_0x1af45f);break;}case'insert':{_0x4ffe61['batch']['addOperation'](_0x131bbf),_0x32c114['model']['applyOperation'](_0x131bbf);if(_0x2c06eb[_0x5a592a+0x1]&&'move'==_0x2c06eb[_0x5a592a+0x1]['type']){ts(_0x3b9ad0,_0x131bbf);break;}const _0x4c01d0=_0x131bbf['position'],_0x34b2b0=_0x131bbf['howMany'],_0xf03de4=_0x43b9ff(_0x32c114['model']['createRange'](_0x4c01d0,_0x4c01d0['getShiftedBy'](_0x34b2b0)),_0x32c114['model']),_0x321c43='suggestion:insertion:'+ot()+':$aiSuggestion';_0x3b9ad0['markers']['set'](_0x321c43,_0xf03de4);break;}case'split':{_0x4ffe61['batch']['addOperation'](_0x131bbf),_0x32c114['model']['applyOperation'](_0x131bbf);const _0x2650ec=_0x131bbf['splitPosition'],_0x70eaa=_0x131bbf['moveTargetPosition'],_0x1b4e1c=_0x32c114['model']['createRange'](_0x2650ec,_0x70eaa),_0xaaa674='suggestion:insertion:'+ot()+':$aiSuggestion';_0x3b9ad0['markers']['set'](_0xaaa674,_0x1b4e1c);break;}case'move':{_0x4ffe61['batch']['addOperation'](_0x131bbf),_0x32c114['model']['applyOperation'](_0x131bbf),_0x2c06eb[_0x5a592a-0x1]&&'insert'==_0x2c06eb[_0x5a592a-0x1]['type']&&ts(_0x3b9ad0,_0x131bbf);const _0x3623c6=_0x131bbf['getMovedRangeStart'](),_0x455a06=_0x131bbf['howMany'];for(let _0xbe513f=0x0;_0xbe513f<_0x455a06;_0xbe513f++){const _0x203e69=_0x3623c6['getShiftedBy'](_0xbe513f)['nodeAfter'];_0x13244a['add'](_0x203e69);}break;}case'remove':{const _0x226209=_0x131bbf['sourcePosition'],_0x363221=_0x131bbf['howMany'],_0x714d1b=new _0x43c2ab(_0x226209,_0x363221);_0x4ffe61['batch']['addOperation'](_0x714d1b),_0x32c114['model']['applyOperation'](_0x714d1b);break;}}}for(const _0x977640 of _0x13244a){const _0x263224=_0x32c114['model']['createRangeOn'](_0x977640),_0x162564='suggestion:formatBlock:$fakeWrap:'+ot()+':$aiSuggestion';_0x3b9ad0['markers']['set'](_0x162564,_0x43b9ff(_0x263224,_0x32c114['model']));}});}(_0x4a237b,_0x5e5d06,_0x2612fb):_0x2612fb['model']['change'](_0x30fffc=>{for(const _0x389755 of _0x4a237b)if('remove'==_0x389755['type']){const _0x89c3e9=_0x389755['sourcePosition'],_0x1156f3=_0x389755['howMany'],_0x278ee8=new _0x43c2ab(_0x89c3e9,_0x1156f3);_0x30fffc['batch']['addOperation'](_0x278ee8),_0x2612fb['model']['applyOperation'](_0x278ee8);}else{if('marker'==_0x389755['type']){const _0x493d53=_0x389755['name'],_0x2ac920=_0x389755['newRange'];null!==_0x2ac920?_0x5e5d06['markers']['set'](_0x493d53,_0x2ac920):_0x5e5d06['markers']['delete'](_0x493d53);}else _0x389755['baseVersion']=null,_0x389755['isDocumentOperation']=!0x1,_0x30fffc['batch']['addOperation'](_0x389755),_0x2612fb['model']['applyOperation'](_0x389755);}});if(_0x40669c){const _0x1f4b0b=es(_0x2612fb,_0x4a237b,_0x5e5d06);is(_0x2612fb['model'],_0x1f4b0b),function(_0x3c6767,_0xf5201f){const _0xca22cc=_0xf5201f['getFirstRange']()['start'];let _0x2aa91b=_0xf5201f['getFirstRange']()['end'];const _0x5b4c84=_0xca22cc['root'];(_0x2aa91b['textNode']||_0x2aa91b['nodeAfter']&&_0x2aa91b['nodeAfter']['is']('$text'))&&(_0x126834(_0x2aa91b,'...'),_0x2aa91b=_0x2aa91b['getShiftedBy'](0x3)),(_0xca22cc['textNode']||_0xca22cc['nodeBefore']&&_0xca22cc['nodeBefore']['is']('$text'))&&(_0x126834(_0xca22cc,'...'),function(_0x30e219,_0x32a86e,_0x50084b){for(let [_0x4d16ff,_0x1a70b6]of _0x30e219['markers']){const _0x60f8a0=_0x1a70b6['_getTransformedByInsertion'](_0x32a86e,_0x50084b,!0x1);_0x1a70b6=_0x60f8a0[0x0],_0x30e219['markers']['set'](_0x4d16ff,_0x1a70b6);}}(_0x5b4c84,_0xca22cc,0x3),_0xca22cc['parent']==_0x2aa91b['parent']&&(_0x2aa91b=_0x2aa91b['getShiftedBy'](0x3)));const _0x19ddcd=_0x3c6767['createRange'](_0x3c6767['createPositionAt'](_0x5b4c84,0x0),_0xca22cc),_0x34564d=_0x3c6767['createRange'](_0x2aa91b,_0x3c6767['createPositionAt'](_0x5b4c84,'end')),_0x4c28a6=[..._0x19ddcd['getMinimalFlatRanges'](),..._0x34564d['getMinimalFlatRanges']()];_0x4c28a6['reverse']();for(const _0x2a3243 of _0x4c28a6)_0x164b6b(_0x2a3243),ns(_0x5b4c84,_0x2a3243);}(_0x2612fb['model'],_0x1f4b0b);}const _0x39f276=_0x2612fb['data']['stringify'](_0x5e5d06,{'showSuggestionHighlights':!0x0});return{'content':Fi(_0x39f276),'hasChanges':!0x0};}(_0x3b0330,_0x5d8e6a,_0xd3f683,_0x756c3,_0x5eae7e);return{'type':_0x503d09['changes'][0x0]['type'],'index':_0x503d09['index'],'content':_0x1cf58a,'hasChanges':_0x3a90b1};});}function ts(_0x3753d8,_0x3996ae){for(const [_0x42cd61,_0x4f30b7]of _0x3753d8['markers']){const _0x382506=_0x1445f3['_createFromRanges'](_0x4f30b7['getTransformedByOperation'](_0x3996ae));_0x3753d8['markers']['set'](_0x42cd61,_0x382506);}}function es(_0x3d40f0,_0x18e8d0,_0x126c6a){const _0x3e69ef=_0x3d40f0['plugins']['get']('DocumentCompare');let _0x22ea05=_0x3d40f0['model']['createPositionAt'](_0x126c6a,Number['POSITIVE_INFINITY']),_0x280a4d=_0x3d40f0['model']['createPositionAt'](_0x126c6a,0x0);for(const _0x26d5a8 of _0x18e8d0){let _0x13eaa6,_0x447678;if(_0x3e69ef['isMarkedRemoveOperation'](_0x26d5a8))_0x13eaa6=_0x26d5a8['newRange']['start'],_0x447678=_0x26d5a8['newRange']['end'];else switch(_0x22ea05=_0x22ea05['getTransformedByOperation'](_0x26d5a8),_0x280a4d=_0x280a4d['getTransformedByOperation'](_0x26d5a8),_0x26d5a8['type']){case'rename':_0x13eaa6=_0x26d5a8['position'],_0x447678=_0x13eaa6['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x13eaa6=_0x26d5a8['range']['start'],_0x447678=_0x26d5a8['range']['end'];break;case'insert':_0x13eaa6=_0x26d5a8['position'],_0x447678=_0x13eaa6['getShiftedBy'](_0x26d5a8['howMany']);break;case'split':_0x13eaa6=_0x26d5a8['splitPosition'],_0x447678=_0x26d5a8['moveTargetPosition'];break;case'merge':{const _0x5af878=_0x26d5a8['targetPosition']['path']['slice'](0x0,-0x1);_0x13eaa6=_0x3d40f0['model']['createPositionFromPath'](_0x126c6a,_0x5af878),_0x447678=_0x13eaa6['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x4dafba=_0x26d5a8['howMany'],_0x1d3974=_0x26d5a8['sourcePosition']['_getTransformedByInsertion'](_0x26d5a8['targetPosition'],_0x4dafba),_0x43e45b=_0x26d5a8['getMovedRangeStart']();'remove'==_0x26d5a8['type']?(_0x13eaa6=_0x1d3974,_0x447678=_0x1d3974):(_0x13eaa6=_0x43e45b,_0x447678=_0x43e45b['getShiftedBy'](_0x4dafba));break;}}_0x13eaa6&&_0x13eaa6['isBefore'](_0x22ea05)&&(_0x22ea05=_0x13eaa6['clone'](),_0x22ea05['stickiness']='toNone'),_0x447678&&_0x447678['isAfter'](_0x280a4d)&&(_0x280a4d=_0x447678['clone'](),_0x280a4d['stickiness']='toNone');}return _0x3d40f0['model']['createSelection'](_0x3d40f0['model']['createRange'](_0x22ea05,_0x280a4d));}function is(_0x18fb79,_0x16b369){ss(_0x18fb79,_0x16b369,'forward');const _0x5f16ef=_0x16b369['getFirstRange']();_0x16b369['setTo']([]),_0x16b369['setTo'](_0x5f16ef,{'backward':!0x0}),ss(_0x18fb79,_0x16b369,'backward');}function ss(_0x4d9e75,_0x1ac05e,_0x15c0ef){let _0x23f966=0x14;for(;_0x23f966;){_0x4d9e75['modifySelection'](_0x1ac05e,{'unit':'word','direction':_0x15c0ef}),_0x23f966--;const _0x56cbb6=_0x1ac05e['focus']['forward'==_0x15c0ef?'nodeBefore':'nodeAfter'];if(_0x56cbb6&&_0x56cbb6['is']('element')&&_0x4d9e75['schema']['isBlock'](_0x56cbb6)&&_0x4d9e75['schema']['isObject'](_0x56cbb6))break;}}function ns(_0x1e4660,_0x2d9f6b){for(const [_0x4b6bb7,_0x5bc991]of _0x1e4660['markers']){const _0x170e9a=_0x5bc991['_getTransformedByDeletion'](_0x2d9f6b['start'],_0x2d9f6b['end']['offset']-_0x2d9f6b['start']['offset']);null!=_0x170e9a?_0x1e4660['markers']['set'](_0x4b6bb7,_0x170e9a):_0x1e4660['markers']['delete'](_0x4b6bb7);}}class AIReply extends ht(){['id'];['interactionId'];['type'];['sources']=[];['parsedContent']=new _0x34e0db([]);['parsedMergedContent']=new _0x34e0db([]);['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['documentId'];['dataIdDocumentSources'];['newNodeAnchorIds']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x38cc1e,content:_0x1f92f4='',isDone:_0x256041=!0x1,isComplete:_0x43de68,interactionId:_0x2a88ac,areActionsDisabled:_0x3cd630,isFromHistory:_0x29a005=!0x1,documentContextContent:_0xf51ac1,dataIdDocumentSources:_0x354d40,documentId:_0x3e89de,locale:_0x2dea17,id:_0x3ccf49}){super(),this['id']=_0x3ccf49||ot(),this['interactionId']=_0x2a88ac,this['type']=_0x38cc1e,this['areActionsDisabled']=!!_0x3cd630,this['locale']=_0x2dea17,this['dataIdDocumentSources']=_0x354d40,this['documentId']=_0x3e89de,this['isFromHistory']=_0x29a005,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=Fi(_0xf51ac1||''),this['set']('isDone',_0x256041),this['set']('isComplete',_0x43de68??_0x256041),this['on']('change:content',()=>{this['onContentChange']();}),this['set']('content',_0x1f92f4);}['appendContent'](_0x331868){this['set']('content',this['content']+_0x331868);}['done'](_0x2f64e1=!0x0){this['isComplete']=_0x2f64e1,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x1745c3,_0x472c8f){this['changeGroups'][_0x1745c3]['state']=_0x472c8f,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x1745c3,'state':_0x472c8f});}['getContentParts']({showDiff:_0x4e41a0,groupIndex:_0x13dce1,editor:_0x38fbba}){const _0xe60b1a=this['_getCachedContentParts'](_0x4e41a0,_0x13dce1);if(_0xe60b1a)return _0xe60b1a;let _0xf38e6d=[];if(void 0x0===_0x13dce1)_0xf38e6d=this['changeGroups'];else{const _0x1aa9a3=this['changeGroups']['find'](({index:_0x31bc7a})=>_0x31bc7a===_0x13dce1);if(!_0x1aa9a3)throw new at('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x13dce1});_0xf38e6d=[_0x1aa9a3];}const _0x15cf63=Zi({'editor':_0x38fbba,'showDiff':_0x4e41a0,'changeGroups':_0xf38e6d,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x4e41a0,_0x15cf63),_0x15cf63;}['_getCachedContentParts'](_0x1da017,_0x3cde0e){const _0x452300=_0x1da017?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x452300]['length'])return null;const _0x1c3a93=this['cachedSuggestionContentParts'][_0x452300];if(void 0x0===_0x3cde0e)return _0x1c3a93['length']>0x0&&_0x1c3a93['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x1da017,null),null):_0x4c306c(_0x1c3a93);{const _0x4bb6c6=_0x1c3a93['find'](({index:_0x5e1e5a})=>_0x5e1e5a===_0x3cde0e);if(_0x4bb6c6)return[_0x4c306c(_0x4bb6c6)];}return null;}['_setCachedContentParts'](_0x1fef93,_0x24959c){const _0x4fa2d7=_0x1fef93?'withDiff':'withoutDiff';_0x24959c?_0x24959c['forEach'](_0x34b72c=>{const _0x2c48cf=this['cachedSuggestionContentParts'][_0x4fa2d7],_0x597f2f=_0x2c48cf['find'](({index:_0x4207b4})=>_0x4207b4===_0x34b72c['index']);if(_0x597f2f){const _0x5dbf10=_0x2c48cf['indexOf'](_0x597f2f);_0x2c48cf['splice'](_0x5dbf10,0x1,_0x34b72c);}else _0x2c48cf['push'](_0x34b72c);}):this['cachedSuggestionContentParts'][_0x4fa2d7]['length']=0x0;}['onContentChange'](){if('modification'===this['type']){this['parsedContent']=this['aiResponseParser']['parseAndNormalizeHTML'](this['content']);const _0x3a46bc=this['changeGroups'];this['updateChangeGroups']();const _0x69a02=this['_getDifferentChangeGroups'](_0x3a46bc,this['changeGroups']);(_0x69a02['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x69a02),this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0);}else this['parsedContent']=this['aiResponseParser']['convertMarkdownToHTML'](this['content']),this['fire']('replyContentUpdated',this);}['_getDifferentChangeGroups'](_0x2ef1de,_0x2dc734){const _0x2cd5c2=[];for(const _0xb05175 of _0x2dc734){const _0x53b84f=_0x2ef1de[_0xb05175['index']];_0x53b84f?_0x53b84f['changes']['length']!==_0xb05175['changes']['length']?_0x2cd5c2['push'](_0xb05175):_0x53b84f['changes']['forEach']((_0x4ffb76,_0x27376d)=>{const _0x4bc44c=_0xb05175['changes'][_0x27376d];_0x4ffb76['id']!==_0x4bc44c['id']&&_0x2cd5c2['push'](_0xb05175);}):_0x2cd5c2['push'](_0xb05175);}return _0x2cd5c2;}['updateChangeGroups'](){const _0x3fccf9=this['locale']?new _0x4d1237('p',{},[new _0x4d1237('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x5a8104(Hi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]):void 0x0,_0x54f195=this['aiResponseApplier']['merge'](this['parsedContent'],this['documentContextContent']['cloneNode'](!0x0),{'markUnstableElements':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x3fccf9,'cutAfterLastChange':!this['isDone']||!this['isComplete']});if(!_0x54f195['modifiedNodeIds']['length']&&!this['isDone'])return;this['parsedMergedContent']=_0x54f195['parsedContent'],this['newNodeAnchorIds']=_0x54f195['newAnchorIds'];let _0x4bc20d=[];if(_0x2c9ab8(_0x369499=>{const _0x233dc6=$i(_0x369499,'data-id');if(!_0x233dc6||!_0x2d3f90(_0x233dc6))return!0x1;const _0x115e5d=[_0x369499,...Xi(_0x369499)]['at'](-0x2);if(_0x369499!=_0x115e5d){const _0x167138=$i(_0x115e5d,'data-id');_0x2d3f90(_0x167138)||(_0x4bc20d['push']({'node':_0x115e5d,'id':_0x167138,'type':'modified'}),_0x54f195['modifiedNodeIds']['push'](_0x167138));}else _0x54f195['modifiedNodeIds']['includes'](_0x233dc6)?_0x4bc20d['push']({'node':_0x369499,'type':'modified','id':_0x233dc6}):_0x54f195['newNodeIds']['includes'](_0x233dc6)?_0x4bc20d['push']({'node':_0x369499,'type':'new','id':_0x233dc6,'anchorId':$i(_0x369499['previousSibling'],'data-id')}):_0x4bc20d['push']({'node':_0x369499,'type':'removed','id':_0x233dc6});return!0x0;},this['parsedMergedContent']),_0x4bc20d=_0x4bc20d['filter'](({node:_0x403812})=>[...Xi(_0x403812),_0x403812]['every'](_0x1da2a4=>!$i(_0x1da2a4,'data-unstable'))),0x0==_0x4bc20d['length'])return;const _0x5338eb=[[_0x4bc20d[0x0]]];for(let _0x2b339f=0x1;_0x2b339f<_0x4bc20d['length'];_0x2b339f++){const _0x391a84=_0x5338eb[_0x5338eb['length']-0x1],_0x3356b4=_0x391a84[_0x391a84['length']-0x1];_0x4bc20d[_0x2b339f]['node']['previousSibling']==_0x3356b4['node']&&'modified'!=_0x4bc20d[_0x2b339f]['type']&&'modified'!=_0x3356b4['type']&&this['_isSameDocument'](_0x4bc20d[_0x2b339f]['node'],_0x3356b4['node'])?_0x391a84['push'](_0x4bc20d[_0x2b339f]):_0x5338eb['push']([_0x4bc20d[_0x2b339f]]);}for(const _0x4550d7 of _0x5338eb){const _0x520602=_0x4550d7[0x0],_0x2f564b=_0x4550d7[_0x4550d7['length']-0x1],_0x596cc2=_0x40c30b(_0x520602['node']['previousSibling']);_0x596cc2&&this['_isSameDocument'](_0x596cc2['node'],_0x520602['node'])&&_0x4550d7['unshift'](_0x596cc2);const _0x228c4a=_0x40c30b(_0x2f564b['node']['nextSibling']);_0x228c4a&&this['_isSameDocument'](_0x228c4a['node'],_0x2f564b['node'])&&_0x4550d7['push'](_0x228c4a);}function _0x2d3f90(_0x296f97){return _0x54f195['modifiedNodeIds']['includes'](_0x296f97)||_0x54f195['newNodeIds']['includes'](_0x296f97)||_0x54f195['removedNodeIds']['includes'](_0x296f97);}function _0x40c30b(_0x4a0a8a){if(_0x4a0a8a&&$i(_0x4a0a8a,'data-id')&&!$i(_0x4a0a8a,'data-unstable')){const _0x2ff72a=$i(_0x4a0a8a,'data-id');if(!_0x2d3f90(_0x2ff72a))return{'node':_0x4a0a8a,'type':'context','id':_0x2ff72a};}return null;}this['changeGroups']=_0x5338eb['map']((_0x15b8ba,_0xa3b854)=>({'changes':_0x15b8ba,'state':'pending','index':_0xa3b854}));}['_isSameDocument'](_0x179cae,_0x42e68a){if(!this['dataIdDocumentSources']?.['size'])return!0x0;const _0x276996=this['_resolveDocumentSource'](_0x179cae),_0x2c13a7=this['_resolveDocumentSource'](_0x42e68a);return!_0x276996||!_0x2c13a7||_0x276996['editor']===_0x2c13a7['editor']&&_0x276996['rootName']===_0x2c13a7['rootName'];}['_resolveDocumentSource'](_0x3a17f4){if(!_0x3a17f4||!this['dataIdDocumentSources'])return;const _0x354a1c=$i(_0x3a17f4,'data-id');if(_0x354a1c){const _0x13bc61=this['dataIdDocumentSources']['get'](_0x354a1c);if(_0x13bc61)return _0x13bc61;const _0x448b87=this['newNodeAnchorIds']['get'](_0x354a1c),_0x597c56=_0x448b87?this['dataIdDocumentSources']['get'](_0x448b87):void 0x0;if(_0x597c56)return _0x597c56;}for(let _0x5721f9=_0x3a17f4['previousSibling'];_0x5721f9;_0x5721f9=_0x5721f9['previousSibling']){const _0x296cee=$i(_0x5721f9,'data-id'),_0x2f0094=_0x296cee?this['dataIdDocumentSources']['get'](_0x296cee):void 0x0;if(_0x2f0094)return _0x2f0094;}for(let _0x44cc8d=_0x3a17f4['nextSibling'];_0x44cc8d;_0x44cc8d=_0x44cc8d['nextSibling']){const _0x16b3e1=$i(_0x44cc8d,'data-id'),_0x1f5e6f=_0x16b3e1?this['dataIdDocumentSources']['get'](_0x16b3e1):void 0x0;if(_0x1f5e6f)return _0x1f5e6f;}}}const rs=['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;constructor({connector:_0x458ca8,locale:_0x316d24}){super(),this['id']=ot(),this['connector']=_0x458ca8,this['isStopped']=!0x0,this['locale']=_0x316d24;}async['start'](){const _0x51c6b4=[];let _0x3bce26,_0xe2494e,_0x77ac9c,_0x314bef=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x5e14af=await this['currentRequest']['getStream']();for await(const _0x583bd6 of _0x5e14af){if(this['isStopped'])return;if('error'==_0x583bd6['event'])return void this['fire']('error',{'error':new at('ai-chat-interaction-error',this)});switch(_0x583bd6['event']){case'message-metadata':this['messageId']=_0x583bd6['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x583bd6['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x583bd6['data']['conversationTitle'],!0x0);break;case'source':_0x51c6b4['push'](_0x583bd6['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'](),_0x3bce26='modification-delta'==_0x583bd6['event']?'modification':'text',_0xe2494e='modification-delta'==_0x583bd6['event']?_0x583bd6['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x3bce26&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']?'modification-delta'==_0x583bd6['event']&&(this['currentReply']['documentId']=_0x583bd6['data']['documentId']):(this['currentReply']=this['createReply']({'type':_0x3bce26,'interactionId':this['id'],'id':_0xe2494e,...'modification-delta'==_0x583bd6['event']&&{'documentId':_0x583bd6['data']['documentId']}}),'modification'==_0x3bce26&&(this['currentReply']['sources']=_0x51c6b4['splice'](0x0))),this['currentReply']['appendContent'](_0x583bd6['data']['textDelta']);break;case'mcp-tool-result':_0x77ac9c=JSON['parse'](_0x583bd6['data']['result']),this['_handleToolResultData']({'toolName':_0x583bd6['data']['toolName'],'data':_0x77ac9c['data'],'attributes':_0x77ac9c['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x583bd6['data']['toolName'],'data':_0x583bd6['data']['data']});}}_0x314bef=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x51c6b4['length']>0x0&&(this['currentReply']['sources']=_0x51c6b4['splice'](0x0)),this['_finalizeInteraction'](_0x314bef),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x516228){return this['replies']['find'](_0x39d91a=>_0x39d91a['id']===_0x516228);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x31b234=>_0x31b234['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x27f60e){const _0x3d8683=new AIReply({'locale':this['locale'],'documentContextContent':this['getDocumentContext']()?.['content'],'dataIdDocumentSources':this['getDocumentContext']()?.['dataIdDocumentSources'],..._0x27f60e});return this['replies']['push'](_0x3d8683),_0x3d8683['delegate'](...rs)['to'](this),this['fire']('replyCreated',_0x3d8683),_0x3d8683;}['setConversationTitle'](_0x512bc2,_0x41ad34=!0x1){this['fire']('setConversationTitle',_0x512bc2,_0x41ad34);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x574601){this['fire']('toolDataReceived',{'type':'result','toolName':_0x574601['toolName'],'data':structuredClone(_0x574601['data']||{}),'attributes':structuredClone(_0x574601['attributes']||{})},this);}['_handleToolNotificationData'](_0xc74975){this['fire']('toolDataReceived',{'type':'notification','toolName':_0xc74975['toolName'],'data':structuredClone(_0xc74975['data'])},this);}['_finalizeInteraction'](_0x4e6e50=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x4e6e50),this['currentRequest']=this['currentReply']=void 0x0;}}const os=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']]),as=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ht(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x1a715b,config:_0x4c3f12,ownerId:_0x576b61}){super(),this['_connector']=_0x1a715b,this['_config']=_0x4c3f12,this['_ownerId']=_0x576b61;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_documentSources']=new Map(),this['_dataIdToSource']=new Map(),this['_setAddContextOptionsDefaultState']();}['_getDocumentSource'](_0x3b8cad){if(_0x3b8cad)return this['_documentSources']['get'](_0x3b8cad);}['getSourceByDataId'](_0x54190e){if(_0x54190e)return this['_dataIdToSource']['get'](_0x54190e);}['_getDocumentContextSlice'](_0x3a9e21){const _0x1a12cd=this['_getDocumentSource'](_0x3a9e21);if(_0x1a12cd)return{'editor':_0x1a12cd['editor'],'rootName':_0x1a12cd['rootName'],'html':_0x1a12cd['content'],'version':_0x1a12cd['version']};}['getDocumentContextSliceByDataId'](_0xc13a68){const _0x2b6b29=this['getSourceByDataId'](_0xc13a68);return _0x2b6b29?this['_getDocumentContextSlice'](_0x2b6b29['documentId']):void 0x0;}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x1cabea){const _0x4808ec=await this['_createContextItemFromContent'](_0x1cabea);return this['_addToConversationContextItem'](_0x4808ec),'current-document'===_0x4808ec['uiId']&&this['_toggleAddCurrentDocumentOptionVisibility'](),_0x4808ec;}async['populateDocumentsFromMessage'](_0x409cce,_0x3c2c26){const _0x14ecb4=_0x409cce['filter'](_0x521134=>'document'===_0x521134['type']);if(0x0===_0x14ecb4['length'])return{'hasUnmatched':!0x1};if(0x1===_0x14ecb4['length'])return{'contextItem':await this['populateFromMessage'](_0x14ecb4[0x0]),'hasUnmatched':!0x1};const _0x32238f=_0x14ecb4['map'](_0x1309a6=>_0x1309a6['id']),_0x3fb661=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x32238f)['getDocuments'](),_0x4ac5f0=new Map(_0x3fb661['map'](_0x1ab652=>[_0x1ab652['id'],_0x1ab652]));this['_documentSources']['clear'](),this['_dataIdToSource']['clear']();const _0x5e50ef=[];let _0x43a5c3=!0x1;for(const _0x35d815 of _0x14ecb4){const _0x5bdb1e=_0x4ac5f0['get'](_0x35d815['id']);if(!_0x5bdb1e)continue;const _0x1e9c61=this['_matchDocumentToRoot'](_0x5bdb1e,_0x3c2c26),_0x51515f=_0x3c2c26[0x0]&&this['_getFirstRoot'](_0x3c2c26[0x0]);_0x1e9c61||(_0x43a5c3=!0x0);const _0x300225=_0x1e9c61?.['editor']??_0x51515f?.['editor'],_0x10141a=_0x1e9c61?.['rootName']??_0x51515f?.['rootName'];if(_0x300225&&_0x10141a){const _0xec72b9={'editor':_0x300225,'rootName':_0x10141a,'content':_0x5bdb1e['content'],'version':_0x5bdb1e['attributes']?.['version']??0x0,'name':_0x5bdb1e['name'],'description':_0x5bdb1e['description']};this['_documentSources']['set'](_0x5bdb1e['id'],_0xec72b9);const _0x477757=Fi(_0x5bdb1e['content']);for(const _0x12d768 of _0x2c9ab8(_0x183635=>!!$i(_0x183635,'data-id'),_0x477757)){const _0x416652=$i(_0x12d768,'data-id');_0x416652&&this['_dataIdToSource']['set'](_0x416652,{..._0xec72b9,'documentId':_0x5bdb1e['id']});}}_0x5e50ef['push']({'id':_0x5bdb1e['id'],'content':_0x5bdb1e['content'],'version':_0x5bdb1e['attributes']?.['version']??0x0,'sessionId':_0x5bdb1e['attributes']?.['sessionId']??null,'selection':[]});}const _0x48fc54={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x5e50ef,'dataIdDocumentSources':new Map(this['_dataIdToSource'])};return this['_addToConversationContextItem'](_0x48fc54),this['_toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x48fc54,'hasUnmatched':_0x43a5c3};}['_matchDocumentToRoot'](_0x56eaab,_0x22336e){const _0xa32533=_0x56eaab['attributes']?.['channelId'],_0x24526a=_0x56eaab['attributes']?.['rootName'];if(_0xa32533&&_0x24526a){for(const _0x27eb8a of _0x22336e)if(_0x27eb8a['config']['get']('collaboration.channelId')===_0xa32533){for(const _0x5eeb79 of _0x27eb8a['model']['document']['getRoots']())if('$graveyard'!==_0x5eeb79['rootName']&&_0x5eeb79['rootName']===_0x24526a)return{'editor':_0x27eb8a,'rootName':_0x5eeb79['rootName']};}}}['_getFirstRoot'](_0x21cddf){for(const _0x22076d of _0x21cddf['model']['document']['getRoots']())if('$graveyard'!==_0x22076d['rootName'])return{'editor':_0x21cddf,'rootName':_0x22076d['rootName']};}async['_createContextItemFromContent'](_0x3c91f1){if('document'===_0x3c91f1['type']){const _0x580b5d=await this['_connector']['fetchDocument'](this['_ownerId'],_0x3c91f1['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x3c91f1['type'],'content':_0x580b5d['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x580b5d['attributes']?.['version'],'sessionId':_0x580b5d['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x3c91f1['type'])return{'id':_0x3c91f1['id'],'uiId':_0x3c91f1['id'],'label':_0x3c91f1['data']?.['label']||_0x3c91f1['id'],'type':'mcp-tool-context','mcpServerName':_0x3c91f1['mcpServerName'],'toolName':_0x3c91f1['toolName'],'data':_0x3c91f1['data']||{}};return{'id':_0x3c91f1['id'],'uiId':_0x3c91f1['id'],'label':_0x3c91f1['attributes']?.['label']||_0x3c91f1['name']||_0x3c91f1['url']||_0x3c91f1['id'],'type':_0x3c91f1['type'],..._0x3c91f1?.['attributes']?.['resourceId']?{'resourceId':_0x3c91f1['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0xef7f0){const _0x2784d6=this['_pendingContextItems']['get'](_0xef7f0);_0x2784d6?.['isReadOnly']||this['_removeContextItem'](_0xef7f0);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x3a8ebe of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x3a8ebe['uiId']);const _0x142c23=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x142c23&&this['_addContextItem']({..._0x142c23,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x3ea0b4){for(const _0x5c41ca of _0x3ea0b4['values']())this['_addToConversationContextItem'](_0x5c41ca);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'](_0x52b293){return Array['from'](_0x52b293['values']())['flatMap'](_0x9d4d77=>this['_mapContextItemToRequestData'](_0x9d4d77));}async['addFilesToContext'](_0xa5f386,_0x1e7009,_0x2cc46c='file'){const _0xbb7517='files-'+ot();this['_startUploadOperation'](_0xbb7517);try{await Promise['all'](_0xa5f386['map'](async _0x2fea4=>{const _0x4498b1='file-'+ot(),_0x4ef2d2=_0x19d831(_0x2fea4['name']);try{this['_addContextItem']({'type':_0x2cc46c,'label':_0x1e7009?.['label']||_0x4ef2d2,'uiId':_0x4498b1,'resourceId':_0x1e7009?.['resourceId']},!0x0);const _0x4df27b=this['_connector']['uploadFile'](this['_ownerId'],_0x2fea4,_0x1e7009);this['_ongoingUploads']['set'](_0x4498b1,_0x4df27b['abortController']);const {id:_0x24b2e9}=await _0x4df27b['getId']();this['_ongoingUploads']['delete'](_0x4498b1),this['_finishContextItemLoading']({'type':_0x2cc46c,'id':_0x24b2e9,'label':_0x1e7009?.['label']||_0x4ef2d2,'uiId':_0x4498b1,'resourceId':_0x1e7009?.['resourceId']},!0x1);}catch(_0x32f51c){this['_ongoingUploads']['delete'](_0x4498b1);if(!(_0x32f51c instanceof at&&_0x32f51c['message']['startsWith']('ai-request-aborted'))){const _0x1829f4=os['get'](_0x32f51c['code'])||'ai-chat-file-upload-failed',_0x48d8c4=new at(_0x1829f4,null,{'fileName':_0x4ef2d2,..._0x32f51c});_0x48d8c4['stack']=_0x32f51c['stack'],this['fire']('error',{'error':_0x48d8c4});}this['_removeContextItem'](_0x4498b1);}}));}finally{this['_finishUploadOperation'](_0xbb7517);}}['addCurrentDocumentToContext'](_0x2a941b){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x7acfc2={'type':'document','uiId':'current-document','label':_0x2a941b,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x7acfc2);}async['updateCurrentDocument'](_0x1b03b5,_0x11054d,_0x5474a8,_0x11c144,_0x42ace9,_0x29120f){const _0x358d82=this['_pendingContextItems']['get']('current-document');if(_0x358d82&&_0x1b03b5){_0x358d82['selection']=_0x29120f?_0x29120f['map'](_0x996d15=>({'start':_0x996d15['start'],'end':_0x996d15['end']})):[];try{if(_0x358d82['version']===_0x11054d)return;const {id:_0x33ae3e}=await this['_connector']['uploadDocument'](this['_ownerId'],_0x1b03b5,{'version':_0x11054d,'sessionId':_0x5474a8,'channelId':_0x11c144,'rootName':_0x42ace9})['getId']();_0x358d82['id']=_0x33ae3e,_0x358d82['content']=_0x1b03b5,_0x358d82['version']=_0x11054d,_0x358d82['sessionId']=_0x5474a8;}catch(_0x4a804c){const _0x35a2a1=new at('ai-chat-document-upload-failed',null);_0x35a2a1['stack']=_0x4a804c['stack'],this['fire']('error',{'error':_0x35a2a1});}}}async['updateCurrentDocuments'](_0x188673){const _0x12ebdc=this['_pendingContextItems']['get']('current-document');if(!_0x12ebdc||!_0x188673['length']||_0x188673['every'](_0x190a71=>!_0x190a71['content']))return;_0x188673['length']>0x1&&_0x188673['some'](_0x263a1b=>!_0x263a1b['description'])&&gt('ai-chat-documents-missing-description');const _0x28c587=_0xe021fd=>_0xe021fd?_0xe021fd['map'](_0x2f04b3=>({'start':_0x2f04b3['start'],'end':_0x2f04b3['end']})):[],_0x3a3625=_0x12ebdc['documents']??[];if(_0x3a3625['length']===_0x188673['length']&&_0x188673['every']((_0x255100,_0x27f650)=>_0x3a3625[_0x27f650]?.['version']===_0x255100['version']))_0x12ebdc['documents']=_0x3a3625['map']((_0x2bf482,_0x31d50b)=>({..._0x2bf482,'selection':_0x28c587(_0x188673[_0x31d50b]['selections'])}));else try{const _0x2d6f53=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x188673)['getIds']();_0x12ebdc['documents']=_0x188673['map']((_0x1bd50f,_0x17f265)=>({'id':_0x2d6f53[_0x17f265]?.['id'],'content':_0x1bd50f['content'],'version':_0x1bd50f['version'],'sessionId':_0x1bd50f['sessionId'],'selection':_0x28c587(_0x1bd50f['selections'])})),this['_documentSources']['clear'](),this['_dataIdToSource']['clear']();for(let _0x1bc32b=0x0;_0x1bc32b<_0x188673['length'];_0x1bc32b++){const _0x3ba859=_0x2d6f53[_0x1bc32b]?.['id'],_0x41b3d4=_0x188673[_0x1bc32b];if(!_0x3ba859)continue;const _0x3aa64b={'editor':_0x41b3d4['editor'],'rootName':_0x41b3d4['rootName'],'content':_0x41b3d4['content'],'version':_0x41b3d4['version'],'name':_0x41b3d4['name'],'description':_0x41b3d4['description']};this['_documentSources']['set'](_0x3ba859,_0x3aa64b);const _0x21fc1e=Fi(_0x41b3d4['content']);for(const _0x5263d6 of _0x2c9ab8(_0x4db369=>!!$i(_0x4db369,'data-id'),_0x21fc1e)){const _0x359deb=$i(_0x5263d6,'data-id');_0x359deb&&this['_dataIdToSource']['set'](_0x359deb,{..._0x3aa64b,'documentId':_0x3ba859});}}_0x12ebdc['dataIdDocumentSources']=new Map(this['_dataIdToSource']);}catch(_0x92b902){const _0x2ab8ab=new at('ai-chat-document-upload-failed',null);_0x2ab8ab['stack']=_0x92b902['stack'],this['fire']('error',{'error':_0x2ab8ab});}}['addSelectionToContext'](_0x2163ee){this['_addContextItem']({'type':'selection','label':_0x2163ee,'uiId':'selection','content':_0x2163ee});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0xd6f670,_0x2539b3){const _0x2d3ada='url-'+ot();this['_startUploadOperation'](_0x2d3ada);const _0x2ea7fc='url-'+ot();try{this['_addContextItem']({'type':'web-resource','label':_0x2539b3?.['label']||_0xd6f670,'uiId':_0x2ea7fc,'resourceId':_0x2539b3?.['resourceId']},!0x0);const _0x4a0256=this['_connector']['uploadUrl'](this['_ownerId'],_0xd6f670,_0x2539b3);this['_ongoingUploads']['set'](_0x2ea7fc,_0x4a0256['abortController']);const {id:_0x4e0de5}=await _0x4a0256['getId']();this['_ongoingUploads']['delete'](_0x2ea7fc),this['_finishContextItemLoading']({'type':'web-resource','id':_0x4e0de5,'label':_0x2539b3?.['label']||_0xd6f670,'uiId':_0x2ea7fc,'resourceId':_0x2539b3?.['resourceId']},!0x1);}catch(_0x11d073){this['_ongoingUploads']['delete'](_0x2ea7fc),(_0x11d073['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new at('ai-chat-url-upload-failed',this,{'url':_0xd6f670,'originalError':_0x11d073}),'url':_0xd6f670}),this['_removeContextItem'](_0x2ea7fc));}finally{this['_finishUploadOperation'](_0x2d3ada);}}['addToolItemToContext'](_0x2d1827){_0x2d1827['id']=_0x2d1827['id']??ot()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x2d1827['uiId'],_0x2d1827),this['fire']('contextItemAdded',{'contextItem':_0x2d1827,'isLoading':!0x1});}async['loadSourceResources'](_0x376905,_0x4075cd,_0x178686){const _0x41098a=this['_addContextOptionsState']['sources']['find'](_0x2135bf=>_0x2135bf['id']===_0x376905);if(!_0x41098a)return this['fire']('error',{'error':new at('ai-chat-source-not-found',this,{'sourceId':_0x376905}),'sourceId':_0x376905}),[];try{const _0x981d56=(await _0x41098a['getResources'](_0x4075cd))['map'](_0x4d6b55=>{const _0x5ddae7=this['_isResourceInContext'](_0x4d6b55['id']);return{..._0x4d6b55,'isInContext':_0x5ddae7};});return _0x41098a['resources']=_0x981d56,this['fire']('sourceResourcesLoaded',{'sourceId':_0x376905,'source':_0x41098a,'resources':_0x981d56,'uid':_0x178686}),_0x981d56;}catch(_0x172ed7){return this['fire']('error',{'error':new at('ai-chat-source-resources-load-failed',this,{'sourceId':_0x376905,'originalError':_0x172ed7}),'sourceId':_0x376905,'sourceLabel':_0x41098a['label']}),[];}}async['addResourceToContext'](_0x139831,_0x39767f){if(this['_isResourceInContext'](_0x39767f['id']))return;let _0x892678=_0x39767f['data'];if(!_0x892678&&_0x139831['getData'])try{_0x892678=await _0x139831['getData'](_0x39767f['id']);}catch(_0x2522b4){return void this['fire']('error',{'error':new at('ai-chat-resource-load-failed',this,{'resourceId':_0x39767f['id'],'sourceId':_0x139831['id'],'originalError':_0x2522b4}),'resourceId':_0x39767f['id'],'sourceId':_0x139831['id']});}if(_0x892678)switch(_0x39767f['type']){case'web-resource':if('string'!=typeof _0x892678)return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x39767f['id'],'sourceId':_0x139831['id'],'expectedType':'string','actualType':typeof _0x892678}),'resourceId':_0x39767f['id'],'sourceId':_0x139831['id']});await this['addUrlToContext'](_0x892678,{'label':_0x39767f['label'],'resourceId':_0x39767f['id']});break;case'file':if(!(_0x892678 instanceof File))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x39767f['id'],'sourceId':_0x139831['id'],'expectedType':'File','actualType':typeof _0x892678}),'resourceId':_0x39767f['id'],'sourceId':_0x139831['id']});await this['addFilesToContext']([_0x892678],{'label':_0x39767f['label'],'resourceId':_0x39767f['id']});break;case'text':if('object'!=typeof _0x892678||!('content'in _0x892678)||!('type'in _0x892678))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x39767f['id'],'sourceId':_0x139831['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x892678}),'resourceId':_0x39767f['id'],'sourceId':_0x139831['id']});_0x892678=AIChatContext['_convertTextResourceToFile'](_0x892678,_0x39767f['label']),await this['addFilesToContext']([_0x892678],{'label':_0x39767f['label'],'resourceId':_0x39767f['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new at('ai-chat-context-unsupported-type',this,{'resourceId':_0x39767f['id'],'sourceId':_0x139831['id'],'resourceType':_0x39767f['type']}),'resourceId':_0x39767f['id'],'sourceId':_0x139831['id']});}else this['fire']('error',{'error':new at('ai-chat-resource-no-data',this,{'resourceId':_0x39767f['id'],'sourceId':_0x139831['id']}),'resourceId':_0x39767f['id'],'sourceId':_0x139831['id']});}static['_convertTextResourceToFile'](_0x41cfc0,_0x34c8d6){switch(_0x41cfc0['type']){case'markdown':return new File([_0x41cfc0['content']],_0x34c8d6,{'type':'text/markdown'});case'html':return new File([_0x41cfc0['content']],_0x34c8d6,{'type':'text/html'});default:return new File([_0x41cfc0['content']],_0x34c8d6,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x37806b){switch(_0x37806b['type']){case'file':case'text':return[{'type':'file','id':_0x37806b['id']}];case'web-resource':return[{'type':'web-resource','id':_0x37806b['id']}];case'document':return _0x37806b['documents']?.['length']?_0x37806b['documents']['map'](_0x168767=>({'type':'document','id':_0x168767['id'],..._0x168767['selection']?.['length']&&{'selection':_0x168767['selection']}})):[{'type':'document','id':_0x37806b['id'],..._0x37806b['selection']?.['length']&&{'selection':_0x37806b['selection']}}];case'mcp-tool-context':{const _0x118a48=_0x37806b;return[{'type':'mcp-tool-context','mcpServerName':_0x118a48['mcpServerName'],'toolName':_0x118a48['toolName'],'data':{..._0x118a48['data'],'label':_0x118a48['label']||_0x118a48['data']?.['label']||_0x118a48['id']},'id':_0x118a48['id']}];}default:return[];}}['_addContextItem'](_0xd7e547,_0x436f60=!0x1){if(this['_pendingContextItems']['set'](_0xd7e547['uiId'],_0xd7e547),_0xd7e547['hidden']||this['fire']('contextItemAdded',{'contextItem':_0xd7e547,'isLoading':_0x436f60}),'current-document'===_0xd7e547['uiId']&&this['_toggleAddCurrentDocumentOptionVisibility'](),_0xd7e547['resourceId']){const _0x3c1881=this['_findSourceIdsByResourceId'](_0xd7e547['resourceId']);_0x3c1881&&_0x3c1881['forEach'](_0x494322=>{this['_updateResourceInContextState'](_0x494322,_0xd7e547['resourceId'],!0x0);});}}['_removeContextItem'](_0x32d33a){const _0x6efdcd=this['_pendingContextItems']['get'](_0x32d33a),_0x5bb499=this['_ongoingUploads']['get'](_0x32d33a);if(_0x5bb499&&(_0x5bb499['abort'](),this['_ongoingUploads']['delete'](_0x32d33a)),_0x6efdcd?.['resourceId']){const _0x112c38=this['_findSourceIdsByResourceId'](_0x6efdcd['resourceId']);_0x112c38&&_0x112c38['forEach'](_0x4145c4=>{this['_updateResourceInContextState'](_0x4145c4,_0x6efdcd['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x32d33a),this['fire']('contextItemRemoved',{'uiId':_0x32d33a,'type':_0x6efdcd?.['type']}),'current-document'===_0x32d33a&&this['_toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x1fe698,_0x29031c){if(this['_pendingContextItems']['has'](_0x1fe698['uiId'])&&(this['_pendingContextItems']['set'](_0x1fe698['uiId'],_0x1fe698),this['fire']('contextItemLoadingEnded',{'contextItem':_0x1fe698,'isLoading':_0x29031c}),_0x1fe698['resourceId'])){const _0x2ebef0=this['_findSourceIdsByResourceId'](_0x1fe698['resourceId']);_0x2ebef0&&_0x2ebef0['forEach'](_0xeb0d23=>{this['_updateResourceInContextState'](_0xeb0d23,_0x1fe698['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0xeee21f){this['_conversationContextItems']['set'](_0xeee21f['uiId'],_0xeee21f);}['_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'](_0x5a3c3f=>({..._0x5a3c3f,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x2c8302=>({..._0x2c8302,'resources':[]}))??[];}['_toggleAddCurrentDocumentOptionVisibility'](){const _0x11a66e=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x11a66e,this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_isResourceInContext'](_0x3d921a){for(const _0x14c3f3 of this['_pendingContextItems']['values']())if(_0x14c3f3['resourceId']===_0x3d921a)return!0x0;for(const _0xa8597b of this['_conversationContextItems']['values']())if(_0xa8597b['resourceId']===_0x3d921a)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x2c7c06){const _0x58d5d6=[];for(const _0x23565d of this['_addContextOptionsState']['sources']){_0x23565d['resources']['find'](_0x1326ea=>_0x1326ea['id']===_0x2c7c06)&&_0x58d5d6['push'](_0x23565d['id']);}return 0x0===_0x58d5d6['length']?null:_0x58d5d6;}['_updateResourceInContextState'](_0x206121,_0x172542,_0x4a00bc){const _0x20de0f=this['_addContextOptionsState']['sources']['find'](_0x18a387=>_0x18a387['id']===_0x206121);if(!_0x20de0f)return;const _0x2a502=_0x20de0f['resources']['find'](_0x128d0b=>_0x128d0b['id']===_0x172542);_0x2a502&&(_0x2a502['isInContext']=_0x4a00bc,this['fire']('resourceStateChanged',{'sourceId':_0x206121,'resourceId':_0x172542,'isInContext':_0x4a00bc}));}['_startUploadOperation'](_0x37b39c){this['_ongoingUploadOperations']['set'](_0x37b39c,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x102a5e){this['_ongoingUploadOperations']['delete'](_0x102a5e),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const hs=['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'](_0xfbdd3c){const _0x20e29e={};return _0xfbdd3c&&_0xfbdd3c['isWebSearchEnabled']&&(_0x20e29e['webSearch']={}),_0xfbdd3c&&_0xfbdd3c['isReasoningEnabled']&&(_0x20e29e['reasoning']={}),_0x20e29e;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x4e5aa7){_0x4e5aa7!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x4e5aa7,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x3088a1){_0x3088a1!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x3088a1,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x18bb3c){super(_0x18bb3c),this['conversationId']=_0x18bb3c['conversationId'],this['contextItems']=_0x18bb3c['contextItems'],this['capabilities']=_0x18bb3c['capabilities'],this['userMessage']=_0x18bb3c['userMessage'],this['model']=_0x18bb3c['model'],this['attributes']=_0x18bb3c['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');}['createReply'](_0x2c3151){const _0x569b79=this['getDocumentContext']();if(_0x569b79?.['documents']?.['length']){const _0x2342e6=_0x569b79['documents']['map'](_0x1855e3=>_0x1855e3['content']??'')['join']('');if(_0x2342e6)return super['createReply']({'documentContextContent':_0x2342e6,..._0x2c3151});}return super['createReply'](_0x2c3151);}}class AIChatConversation extends Et(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];constructor(_0x5228e0){super(),this['options']=_0x5228e0,this['connector']=_0x5228e0['connector'],this['chatModels']=_0x5228e0['chatModels'],this['id']=_0x5228e0['conversationId'],this['isFromHistory']=_0x5228e0['isFromHistory'];}async['init'](_0x48150f){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x48150f,'ownerId':this['id']}),this['chatContext']['delegate'](...as)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...hs)['to'](this),this['chatCapabilities']['init']();const _0x5332f6=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x5332f6});const _0x53ab1f=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x53ab1f&&await this['setModel'](_0x53ab1f);}catch(_0x559508){const _0x127e99=new at('ai-chat-conversation-init-failed',null,{'message':_0x559508['message']||_0x559508});_0x127e99['stack']=_0x559508['stack'],this['fire']('error',{'error':_0x127e99});}}async['start'](){if(this['isStarted'])throw new at('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new at('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x220d9f}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x220d9f,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x47feb3){const _0x275108=new at('ai-chat-conversation-start-failed',null,{'message':_0x47feb3['message'],'conversationId':this['id']});throw _0x275108['stack']=_0x47feb3['stack'],this['fire']('error',{'error':_0x275108}),_0x275108;}}async['load'](_0x38cf1f,_0x2ac4f7){try{const _0x57fde5=await this['connector']['fetchConversation'](_0x38cf1f)['getConversation'](),_0x48daad=await this['connector']['fetchConversationMessages'](_0x38cf1f)['getMessages'](),_0x5eb791=_0x48daad[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x57fde5['id'],'title'in _0x57fde5?this['fire']('setConversationTitle',_0x57fde5['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x3065f3=(await this['chatModels']['getAll']())['find'](_0x125056=>_0x125056['id']['toLowerCase']()===_0x5eb791['toLowerCase']());return this['selectedModel']=_0x3065f3,this['fire']('modelSelected',{'selectedModel':_0x3065f3,'isDisabled':!0x0}),await this['_processMessagesToInteractions'](_0x48daad,_0x2ac4f7,_0x5eb791),this['currentInteraction']=void 0x0,this;}catch(_0x193fae){const _0x509a8f=new at('ai-chat-conversation-init-from-id-failed',null,{'message':_0x193fae['message'],'conversationId':_0x38cf1f});throw _0x509a8f['stack']=_0x193fae['stack'],this['fire']('error',{'error':_0x509a8f}),_0x509a8f;}}async['_processMessagesToInteractions'](_0x22def9,_0x4024f5,_0x24183d){let _0x172830,_0x299699=!0x1;for(const _0x504e3a of _0x22def9)if('user'===_0x504e3a['role']){const {contextItems:_0x368c59,hasUnmatched:_0xa772b}=await this['_extractContextItems'](_0x504e3a);_0x299699=_0xa772b;const _0x17ca7d={'isReasoningEnabled':Object['hasOwn'](_0x504e3a['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x504e3a['capabilities'],'webSearch')};_0x172830=this['createInteraction']({'userMessage':_0x504e3a['prompt'],'contextItems':_0x368c59,'capabilities':_0x17ca7d,'modelId':_0x24183d,'attributes':_0x504e3a['attributes']}),this['currentInteraction']=_0x172830,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x504e3a['role']&&_0x172830){const _0x32cb0b=[];for(const _0x1b8b88 of _0x504e3a['content'])switch(_0x1b8b88['type']){case'text':case'modification':{const _0x3cbce7=_0x172830['getDocumentContext'](),_0x49193a=(_0x3cbce7?.['documents']?.['length']?_0x3cbce7['documents']['some'](_0x59f3cf=>_0x59f3cf['sessionId']!==_0x4024f5):_0x3cbce7?.['sessionId']!==_0x4024f5)||_0x299699;_0x172830['currentReply']?.['type']!==_0x1b8b88['type']&&(_0x172830['currentReply']=_0x172830['createReply']({'type':_0x1b8b88['type'],'isDone':!0x0,'interactionId':_0x172830['id'],'areActionsDisabled':_0x49193a,'isFromHistory':!0x0}),_0x32cb0b['length']>0x0&&(_0x172830['currentReply']['sources']=_0x32cb0b['splice'](0x0))),_0x172830['currentReply']['appendContent'](_0x1b8b88['content']);break;}case'url':_0x32cb0b['push'](_0x1b8b88);break;case'mcp-tool-result':{const {data:_0x3e343e,attributes:_0x248b7e}=JSON['parse'](_0x1b8b88['content']);_0x172830['_handleToolResultData']({'toolName':_0x1b8b88['toolName'],'data':_0x3e343e,'attributes':_0x248b7e});break;}}}}}async['_extractContextItems'](_0x307ede){const _0x56518a=new Map();if(!_0x307ede['content'])return{'contextItems':_0x56518a,'hasUnmatched':!0x1};const _0x153682=this['_resolveEditors'](),{contextItem:_0x2494a0,hasUnmatched:_0x23cf53}=await this['chatContext']['populateDocumentsFromMessage'](_0x307ede['content'],_0x153682);_0x2494a0&&_0x56518a['set'](_0x2494a0['id'],_0x2494a0);for(const _0x104a54 of _0x307ede['content']){if('document'===_0x104a54['type'])continue;const _0x5101ec=await this['chatContext']['populateFromMessage'](_0x104a54);_0x5101ec&&_0x56518a['set'](_0x5101ec['id'],_0x5101ec);}return{'contextItems':_0x56518a,'hasUnmatched':_0x23cf53};}['_resolveEditors'](){return this['options']['getEditors']?this['options']['getEditors']():this['options']['getEditor']?[this['options']['getEditor']()]:[];}async['handleUserInteraction']({userMessage:_0xf4a5b5,attributes:_0x577f55}){if(!this['isStarted'])throw new at('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new at('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x278391=this['chatContext']['getPendingContextItems'](),_0x562125=this['chatCapabilities']['getCapabilitiesConfig'](),_0x728630=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0xf4a5b5,'contextItems':_0x278391,'capabilities':_0x562125,'modelId':_0x728630,'attributes':_0x577f55}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x5ee95d){if(_0x5ee95d instanceof at)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x5ee95d});else{const _0x1d20f4=os['get'](_0x5ee95d['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new at(_0x1d20f4,null,{'error':_0x5ee95d})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x27f90a,contextItems:_0x2ef20f,capabilities:_0x163798,modelId:_0x3844a9,attributes:_0x27ba2a}){const _0x5852e1=new AIChatInteraction({'userMessage':_0x27f90a,'contextItems':_0x2ef20f,'capabilities':_0x163798,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x3844a9,'attributes':_0x27ba2a});return _0x5852e1['delegate'](...rs)['to'](this),this['interactions']['push'](_0x5852e1),this['fire']('interactionCreated',_0x5852e1),_0x5852e1;}['getInteraction'](_0x794f39){return this['interactions']['find'](_0x204bac=>_0x204bac['id']===_0x794f39);}['removeInteraction'](_0x5a1a9e){const _0x3c9034=this['getInteraction'](_0x5a1a9e);_0x3c9034&&(_0x3c9034['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x3c9034),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['addCurrentDocumentToContext'](_0x28158a){this['chatContext']['addCurrentDocumentToContext'](_0x28158a);}async['updateCurrentDocumentInContext']({content:_0xe9f449,version:_0x35bacc,sessionId:_0x1cab14,channelId:_0x255ceb,rootName:_0x57856f,selections:_0x1dd9f1}){await this['chatContext']['updateCurrentDocument'](_0xe9f449,_0x35bacc,_0x1cab14,_0x255ceb,_0x57856f,_0x1dd9f1);}async['updateCurrentDocumentsInContext'](_0xe598c6){await this['chatContext']['updateCurrentDocuments'](_0xe598c6);}['getSourceByDataId'](_0x3c789f){return this['chatContext']['getSourceByDataId'](_0x3c789f);}['getDocumentContextSliceByDataId'](_0x5c54ea){return this['chatContext']['getDocumentContextSliceByDataId'](_0x5c54ea);}['getCurrentDocumentContext'](){return this['currentInteraction']?.['getDocumentContext']()?.['content']||'';}['addSelectionToContext'](_0x200c75){this['chatContext']['addSelectionToContext'](_0x200c75);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x3eebaf){this['chatContext']['addFilesToContext'](_0x3eebaf);}['addUrlToContext'](_0x8e062c){this['chatContext']['addUrlToContext'](_0x8e062c);}['addToolItemToContext'](_0x4751){this['chatContext']['addToolItemToContext'](_0x4751);}['addResourceToContext'](_0x42083f,_0x4993ec){this['chatContext']['addResourceToContext'](_0x42083f,_0x4993ec);}['loadSourceResources'](_0x1a3c5a,_0x4061f2,_0x40aa86){return this['chatContext']['loadSourceResources'](_0x1a3c5a,_0x4061f2,_0x40aa86);}['removeFromContext'](_0x51223f){this['chatContext']['removeFromContext'](_0x51223f);}['setWebSearch'](_0x57cef7){this['chatCapabilities']['setWebSearch'](_0x57cef7);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x32ddb2){this['chatCapabilities']['setReasoning'](_0x32ddb2);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}async['setModel'](_0x1a7dbe){_0x1a7dbe?!0x1===await this['chatModels']['isAvailable'](_0x1a7dbe)&&(gt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x1a7dbe}),_0x1a7dbe=(await this['chatModels']['getAvailableModels']())[0x0]):(gt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x1a7dbe=(await this['chatModels']['getAvailableModels']())[0x0]),_0x1a7dbe['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x1a7dbe,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x1a7dbe}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x222085,config:_0x34ca6a,locale:_0x92a93a}){super(),this['_connector']=_0x222085,this['_config']=_0x34ca6a,this['_locale']=_0x92a93a;}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 _0x21092f=await this['getAll']();let _0x3bd251;return _0x3bd251=this['_availableModels']?this['_filterModels'](_0x21092f,this['_availableModels']):_0x21092f['filter'](_0xcbfd89=>_0xcbfd89['recommended']),_0x3bd251;}async['getModel'](_0x24a962){const _0x22d043=await this['getAll']();if(!_0x22d043['length'])return null;if(_0x24a962){const _0x5c59bb=this['_getModelById'](_0x22d043,_0x24a962);if(_0x5c59bb)return _0x5c59bb;gt('ai-chat-model-id-unrecognized',{'modelId':_0x24a962,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x180c09=await this['getAvailableModels']();if(!_0x180c09['length'])return null;if(this['_defaultModelId']){const _0x36f5b8=this['_getModelById'](_0x180c09,this['_defaultModelId']);if(_0x36f5b8)return _0x36f5b8;gt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x180c09[0x0]['id']});}return _0x180c09[0x0];}async['isAvailable'](_0x29676d){return(await this['getAvailableModels']())['some'](_0x2018cc=>_0x2018cc['name']===_0x29676d['name']&&_0x2018cc['provider']===_0x29676d['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x210d43=this['_locale']['uiLanguage']||'en',_0x130907=this['_connector']['getModels'](_0x210d43),_0x51524a=await _0x130907['list']();this['_modelList']=_0x51524a['items']['map'](_0x563ec4=>cs(_0x563ec4)?{..._0x563ec4,'name':Hi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x563ec4);}catch(_0x6b7392){throw Ct('ai-models-unable-to-retrieve',{'error':_0x6b7392}),_0x6b7392;}return[...this['_modelList']];}['_filterModels'](_0x195e9d,_0x247781){let _0x9da384;if(_0x247781){_0x9da384=[];const _0x3eb18b=new Set(),_0x382359='string'==typeof _0x247781?[_0x247781['toLocaleLowerCase']()]:_0x247781['map'](_0x15fb7f=>_0x15fb7f['toLocaleLowerCase']());for(const _0x4d8561 of _0x382359)for(const _0x285038 of _0x195e9d)!_0x3eb18b['has'](_0x285038['id'])&&this['_isMatchingFilter'](_0x285038,_0x4d8561)&&(_0x9da384['push'](_0x285038),_0x3eb18b['add'](_0x285038['id']));}else _0x9da384=_0x195e9d;return _0x9da384;}['_isMatchingFilter'](_0x170046,_0x507947){const _0x1bd7b5=_0x170046['id']['toLocaleLowerCase'](),_0x3ec792=_0x170046['name']['toLocaleLowerCase'](),_0x2d277e=_0x170046['provider']['toLocaleLowerCase']();return _0x1bd7b5===_0x507947||_0x3ec792===_0x507947||cs(_0x170046)&&'auto'===_0x507947||_0x2d277e===_0x507947||_0x1bd7b5['startsWith'](_0x507947);}['_getModelById'](_0x2343da,_0x469ab4){return _0x2343da['find'](_0x1e38ac=>cs(_0x1e38ac)&&'auto'===_0x469ab4?_0x1e38ac:_0x1e38ac['id']===_0x469ab4)||null;}}function cs(_0x3b1476){return _0x3b1476['id']['startsWith']('agent');}function ls(_0x1454e1){return _0x1454e1?_0x1454e1 instanceof _0x5ca812?[_0x1454e1]:_0x1454e1['editors']&&0x0!==_0x1454e1['editors']['length']?Array['from'](_0x1454e1['editors']):[]:[];}function us(_0x41ddee){const _0x5727d5=ls(_0x41ddee);if(!_0x5727d5['length'])throw new at('ai-get-editor-from-context-no-editor');if(0x1===_0x5727d5['length'])return _0x5727d5[0x0];const _0x4faa4a=_0x5727d5['find'](_0xd9efbf=>_0xd9efbf['ui']?.['focusTracker']?.['isFocused']);if(_0x4faa4a)return _0x4faa4a;const _0x1a17a3=function(_0x1de914){if(_0x1de914 instanceof _0x5ca812)return;const _0x32c394=_0x1de914;if(!_0x32c394['plugins']||!_0x32c394['plugins']['has']('AIEditing'))return;const _0x368faa=_0x32c394['plugins']['get']('AIEditing');return _0x368faa['getLastContentFocusedEditor']?.();}(_0x41ddee);return _0x1a17a3&&_0x5727d5['includes'](_0x1a17a3)?_0x1a17a3:_0x5727d5[0x0];}function ds(_0x4ab0b2){return us(_0x4ab0b2);}function _s({editor:_0x466a34,interaction:_0x11c9c1,reply:_0x5f0d0b,groups:_0x456bfa,transform:_0x5da98d,documentCompare:_0x348595,documentCompareOptions:_0x106dad,documentContextSlice:_0x8be79}){const _0x4144e9=_0x11c9c1['getDocumentContext']();if(!_0x4144e9)return[];const _0x549ed4=_0x5f0d0b['documentContextContent']['cloneNode'](!0x0);for(const {changes:_0xd8b362}of _0x456bfa){const _0x3fd68d=_0xd8b362['filter'](_0x1b17b9=>'new'!=_0x1b17b9['type'])['map'](_0x1218ee=>Wi('data-id',_0x1218ee['id'],_0x549ed4)),_0x586d48=_0xd8b362['filter'](_0x1e9f5a=>'removed'!=_0x1e9f5a['type'])['map'](_0x4e6a75=>_0x4e6a75['node']['cloneNode'](!0x0));let _0x186c7b=null;if(_0x3fd68d['length']){_0x186c7b=_0x3fd68d[0x0]['previousSibling'];for(let _0x53a175=0x0;_0x53a175<_0x3fd68d['length'];_0x53a175++)_0x32f2bc(_0x3fd68d[_0x53a175]);}if(_0x586d48['length']){_0x186c7b||(_0xd8b362[0x0]['anchorId']?_0x186c7b=Wi('data-id',_0xd8b362[0x0]['anchorId'],_0x549ed4):(_0x186c7b=_0x586d48['shift'](),_0x59f22f(_0x549ed4,_0x186c7b)));for(let _0x124e6a=0x0;_0x124e6a<_0x586d48['length'];_0x124e6a++)_0x5a70f4(_0x186c7b,_0x586d48[_0x124e6a]),_0x186c7b=_0x586d48[_0x124e6a];}}let _0x590a45,_0xb80f4e,_0x399f6c,_0x7cffc2=_0x106dad;if(_0x8be79){_0x590a45=_0x8be79['html'],_0x399f6c=_0x8be79['version'],_0x7cffc2={..._0x106dad,'anchor':_0x8be79['rootName']};const _0x3a9ef3=new _0x34e0db([]),_0x46e9b7=_0x549ed4['children'],_0x1220b3=_0x5f0d0b['dataIdDocumentSources'],_0x20eec8=_0x5f0d0b['newNodeAnchorIds'],_0x211041=_0x8be79['editor'],_0x403f7f=_0x8be79['rootName'],_0x4bf6ff=new Array(_0x46e9b7['length']),_0x3cd1f5=_0x124abf=>_0x124abf?_0x124abf['editor']===_0x211041&&_0x124abf['rootName']===_0x403f7f:void 0x0;for(let _0xa18ac7=0x0;_0xa18ac7<_0x46e9b7['length'];_0xa18ac7++){const _0x1c5b79=$i(_0x46e9b7[_0xa18ac7],'data-id');if(!_0x1c5b79)continue;const _0x3ca368=_0x3cd1f5(_0x1220b3?.['get'](_0x1c5b79));if(void 0x0!==_0x3ca368){_0x4bf6ff[_0xa18ac7]=_0x3ca368;continue;}const _0x46ab95=_0x20eec8['get'](_0x1c5b79),_0x138cb4=_0x46ab95?_0x3cd1f5(_0x1220b3?.['get'](_0x46ab95)):void 0x0;void 0x0!==_0x138cb4&&(_0x4bf6ff[_0xa18ac7]=_0x138cb4);}for(let _0x2c1b01=0x0;_0x2c1b01<_0x46e9b7['length'];_0x2c1b01++)if(void 0x0===_0x4bf6ff[_0x2c1b01]){for(let _0x16cda7=_0x2c1b01-0x1;_0x16cda7>=0x0;_0x16cda7--)if(void 0x0!==_0x4bf6ff[_0x16cda7]){_0x4bf6ff[_0x2c1b01]=_0x4bf6ff[_0x16cda7];break;}if(void 0x0===_0x4bf6ff[_0x2c1b01]){for(let _0x3c6ee3=_0x2c1b01+0x1;_0x3c6ee3<_0x46e9b7['length'];_0x3c6ee3++)if(void 0x0!==_0x4bf6ff[_0x3c6ee3]){_0x4bf6ff[_0x2c1b01]=_0x4bf6ff[_0x3c6ee3];break;}}}for(let _0x397c4d=0x0;_0x397c4d<_0x46e9b7['length'];_0x397c4d++)_0x4bf6ff[_0x397c4d]&&_0x3a9ef3['children']['push'](_0x118fd9(_0x46e9b7[_0x397c4d],!0x0));_0xb80f4e=Ki(_0x3a9ef3);}else _0x590a45=_0x4144e9['content'],_0x399f6c=_0x4144e9['version'],_0xb80f4e=Ki(_0x549ed4);const _0xf20e54=_0x348595['getDiff'](_0x590a45,_0xb80f4e,{..._0x7cffc2,'targetEditor':_0x466a34})['getOperations']();if(_0x5da98d){const _0x453a5e=_0x466a34['model']['document']['history']['getOperations'](_0x399f6c),_0x1e07fc={'document':_0x466a34['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x27476f(_0xf20e54,_0x453a5e,_0x1e07fc)['operationsA'];}return _0xf20e54;}function Is(_0x2a9582,_0x2b8df2){if('marker'!=_0x2b8df2['type'])return;const _0x50e606=_0x2a9582['model']['markers']['get'](_0x2b8df2['name']);_0x50e606&&(_0x2b8df2['oldRange']=_0x50e606['getRange']());}class AIChatController extends _0x23f270{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_aiChatBalloon'];['_activeBalloon'];['_wiredBalloons']=new Set();['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];static get['requires'](){return[AIConnector,_0x53dd97];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_bodyCollection']=new Qt(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 _0xc8d146=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0xdcd1e4,_0x58592a)=>{this['_handleUIUserMessage']({'message':_0x58592a});}),this['listenTo'](_0xc8d146['view'],'change:activeTab',(_0x3fe601,_0x75305c,_0x47c615)=>{'chat'!==_0x47c615&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x1a8bf6,_0x5a9da8)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x5a9da8));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x5807c9,_0xb75ba6)=>{this['activeConversation']?.['addUrlToContext'](_0xb75ba6);}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x65b904,_0x161d1e)=>{_0x161d1e['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x37ba2f,_0x3b4be3)=>{this['activeConversation']?.['addResourceToContext'](_0x3b4be3['source'],_0x3b4be3['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x2da00a,_0x25cc3d)=>{this['_removeFromContext'](_0x25cc3d);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x1662e6,_0x2be99a)=>{this['activeConversation']?.['loadSourceResources'](_0x2be99a['sourceId'],_0x2be99a['query'],_0x2be99a['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x45fea8,_0x9ca6a4)=>{this['activeConversation']?.['setModel'](_0x9ca6a4);}),this['listenTo'](this['_aiChatUi'],'like',(_0x41a574,{replyId:_0x3700a0})=>{console['log']('Liked\x20response',_0x3700a0);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x4b7b8e,{replyId:_0x3b7d6a})=>{console['log']('Disliked\x20response',_0x3b7d6a);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x3d894c,_0x254df5)=>{this['_insertSuggestion'](_0x254df5);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x49e6ee,{replyId:_0x4bf33a,partIndex:_0x4e9a1a})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x4bf33a,_0x4e9a1a);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x557fd4,{replyId:_0x16f7a4,partIndex:_0x26f507})=>{const _0x400657=this['_getDocumentRangeForReplyChanges'](_0x16f7a4,_0x26f507);_0x400657&&'$graveyard'!=_0x400657['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'ranges':[_0x400657['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x5f2636,_0xd12d30)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0xd12d30);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x2219cd,{replyId:_0x4bb893,showDiff:_0x231a56})=>{const {reply:_0x3edbbb}=this['getInteractionAndReplyById'](_0x4bb893),_0x3d3eca=_0x3edbbb['getContentParts']({'showDiff':_0x231a56,'editor':ds(this['context'])});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x3edbbb['id'],'parts':_0x3d3eca});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x51256c,{replyId:_0x340dc1,partIndex:_0x2d9326})=>{this['_rejectSuggestion']({'replyId':_0x340dc1,'partIndex':_0x2d9326}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['context']['plugins']['has']('AIChatBalloon')&&(this['_aiChatBalloon']=this['context']['plugins']['get']('AIChatBalloon')),this['on']('interactionCreated',(_0x573420,_0x1cb3cc)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x1cb3cc);}),this['on']('replyCreated',(_0x11077a,_0x2843a0)=>{this['_addFeedItemReply'](_0x2843a0);});}async['afterInit'](){this['context']instanceof _0x5ca812?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x2de6f4,_0x1efacb)=>{_0x1efacb['on']('ready',()=>{this['_integrateEditor'](_0x1efacb);});});const _0x4bc547=this['context']['config']['get']('ai.chat.initialConversation');let _0x2f858a=_0x4bc547;if('lastCreated'!=_0x4bc547||(_0x2f858a=await this['_getLastCreatedConversationId'](),_0x2f858a))return'new'==_0x2f858a?this['_startConversationSafely']():this['loadConversation'](_0x2f858a);}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x550a02){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null,(this['context']['plugins']['get'](AITabs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0x550a02)['getConversation'](),await this['_startConversationSafely']({'id':_0x550a02}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0x550a02,this['_aiEditing']['sessionId']),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x296655){this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x550a02}),this['_logError'](new at('ai-chat-conversation-not-found',this,{'error':_0x296655}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x1ffe67){let _0x5a6725=null,_0x4f9fd6=null;this['on']('toolDataReceived',(_0x5d2253,_0x5b5cfc,_0x20addd)=>{_0x20addd['id']!==_0x5a6725&&(_0x5a6725=_0x20addd['id'],_0x4f9fd6=this['_getAIChatFeedAPI'](_0x20addd)),_0x1ffe67(_0x5b5cfc,_0x4f9fd6);});}['addCurrentDocumentToChatContext'](){this['activeConversation']?.['addCurrentDocumentToContext'](Hi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](){const _0x53a790=this['_aiEditing']['getSelectionText']();this['activeConversation']?.['addSelectionToContext'](_0x53a790),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x675739){await this['_startConversationSafely']({'modelId':_0x675739?.['modelId']});}async['sendMessage'](_0x52d8e4){await this['_handleUIUserMessage'](_0x52d8e4);}['getGroupId'](){const _0xb47994=this['context']['config']['get']('collaboration.channelId');if(!_0xb47994)throw new at('ai-missing-channel-id',this);return _0xb47994;}['_handleRemovedConversation'](_0x5b4feb){this['activeConversation']['id']===_0x5b4feb&&this['_startConversationSafely']();}['_insertSuggestion'](_0x4a209c){const _0x35d093=this['context']['plugins']['get']('DocumentCompare'),{reply:_0x2e9676,interaction:_0xcf9259}=this['getInteractionAndReplyById'](_0x4a209c['replyId']),_0x2c7f3d=void 0x0!==_0x4a209c['partIndex']?[_0x2e9676['changeGroups'][_0x4a209c['partIndex']]]:_0x2e9676['changeGroups']['filter'](_0x3fd036=>'pending'==_0x3fd036['state']);for(const _0x572e9d of this['_groupChangesByTarget'](_0x2e9676,_0x2c7f3d)){const {target:_0xc06464,groups:_0x3cc461,groupsIndexes:_0x54d0fe,slice:_0x279614}=_0x572e9d;if(!_0xc06464['editor']['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x2f9432=this['_getDocumentRangeForReplyChanges'](_0x4a209c['replyId'],_0x54d0fe[0x0]);if(!_0x2f9432||'$graveyard'==_0x2f9432['range']['root']['rootName']){_0x54d0fe['forEach'](_0x2eda5b=>_0x2e9676['setChangeGroupState'](_0x2eda5b,'outdated'));continue;}_0x54d0fe['forEach'](_0x19bd79=>_0x2e9676['setChangeGroupState'](_0x19bd79,'accepted'));const _0x522aa4=_s({'editor':_0xc06464['editor'],'reply':_0x2e9676,'interaction':_0xcf9259,'groups':_0x3cc461,'transform':!0x0,'documentCompare':_0x35d093,'documentCompareOptions':{'anchor':_0x279614?.['rootName']??'main','markDeletions':!0x0},'documentContextSlice':_0x279614});let _0x2c0cba;this['_scrollToSuggestionRange'](_0x2f9432['range'],!0x1,_0xc06464['editor']),_0xc06464['editor']['model']['change'](_0x34d09b=>{_0x2c0cba=_0x34d09b['batch'],_0xc06464['editor']['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x522aa4),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x2c0cba,{'interactionId':_0xcf9259['id'],'replyId':_0x2e9676['id'],'indexes':_0x54d0fe['slice']()});}this['_updateRatings'](_0x2e9676);}['_applySuggestion'](_0x3f8ecc){const _0x1c1c07=this['context']['plugins']['get'](_0x53dd97),{reply:_0x1c350a,interaction:_0x22fc46}=this['getInteractionAndReplyById'](_0x3f8ecc['replyId']),_0x3c08cf=void 0x0!==_0x3f8ecc['partIndex']?[_0x1c350a['changeGroups'][_0x3f8ecc['partIndex']]]:_0x1c350a['changeGroups']['filter'](_0x5dd279=>'pending'==_0x5dd279['state']);for(const _0x83dbb5 of this['_groupChangesByTarget'](_0x1c350a,_0x3c08cf)){const {target:_0x33dc4f,groups:_0x2ddca9,groupsIndexes:_0x341e10,slice:_0x28f2de}=_0x83dbb5,_0x2d6ff0=this['_getDocumentRangeForReplyChanges'](_0x3f8ecc['replyId'],_0x341e10[0x0]);if(!_0x2d6ff0||'$graveyard'==_0x2d6ff0['range']['root']['rootName']){_0x341e10['forEach'](_0x76a758=>_0x1c350a['setChangeGroupState'](_0x76a758,'outdated'));continue;}_0x341e10['forEach'](_0x4698a0=>_0x1c350a['setChangeGroupState'](_0x4698a0,'accepted'));const _0x52e7cc=_s({'editor':_0x33dc4f['editor'],'reply':_0x1c350a,'interaction':_0x22fc46,'groups':_0x2ddca9,'transform':!0x0,'documentCompare':_0x1c1c07,'documentCompareOptions':{'anchor':_0x28f2de?.['rootName']??'main','markDeletions':!0x1},'documentContextSlice':_0x28f2de});let _0x633f9b;this['_scrollToSuggestionRange'](_0x2d6ff0['range'],!0x1,_0x33dc4f['editor']),_0x33dc4f['editor']['model']['change'](_0x5d2295=>{_0x633f9b=_0x5d2295['batch'];for(const _0x3f6716 of _0x52e7cc)_0x3f6716['baseVersion']=_0x33dc4f['editor']['model']['document']['version'],Is(_0x33dc4f['editor'],_0x3f6716),_0x5d2295['batch']['addOperation'](_0x3f6716),_0x33dc4f['editor']['model']['applyOperation'](_0x3f6716);}),this['_batchToChanges']['set'](_0x633f9b,{'interactionId':_0x22fc46['id'],'replyId':_0x1c350a['id'],'indexes':_0x341e10['slice']()});}this['_updateRatings'](_0x1c350a);}['_rejectSuggestion'](_0x490443){const {reply:_0x47ced9}=this['getInteractionAndReplyById'](_0x490443['replyId']);_0x47ced9['setChangeGroupState'](_0x490443['partIndex'],'rejected');}['_openBalloonFor'](_0x2b385c,_0x318f4b){if(!this['_aiChatBalloon'])return;const {reply:_0x208934}=this['getInteractionAndReplyById'](_0x2b385c),_0x201505=_0x208934['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'editor':ds(this['context'])});let _0x13b558,_0x56e5f6;if(void 0x0!==_0x318f4b?(_0x56e5f6=_0x201505['find'](_0x174f34=>_0x174f34['index']==_0x318f4b),_0x13b558=_0x56e5f6?.['index']):(_0x56e5f6=_0x201505[0x0],_0x13b558=_0x56e5f6['index']),this['_currentPreviewedChangeGroup']?.['replyId']==_0x2b385c&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x13b558)return;const _0xbe245a=this['_getUserPresentableContentPartDocumentRange'](_0x2b385c,_0x208934,_0x56e5f6),_0x356d42=_0x208934['changeGroups']['find'](_0x339e9f=>_0x339e9f['index']==_0x13b558),_0x9283c6=_0x356d42?this['_resolveGroupTarget'](_0x208934,_0x356d42):null,_0x2aa77a=_0x9283c6?.['editor']??ds(this['context']),_0xb74bd5=_0x2aa77a['plugins']['has']('AIChatBalloon')?_0x2aa77a['plugins']['get']('AIChatBalloon'):this['_aiChatBalloon'];if(this['_activeBalloon']&&this['_activeBalloon']!==_0xb74bd5&&this['_activeBalloon']['close'](),!_0xbe245a)return _0xb74bd5['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0xb74bd5,this['_currentPreviewedChangeGroup']={'replyId':_0x2b385c,'partIndex':_0x13b558},this['_scrollToSuggestionRange'](_0xbe245a,!0x0,_0x2aa77a);const _0x46bd7e=this['_getPresentableSiblingContentPartIndex'](_0x2b385c,_0x13b558,'next');_0xb74bd5['updateContent']({'part':_0x56e5f6,'renderingStrategy':'static'}),_0xb74bd5['open']({'index':_0x13b558,'title':Hi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x13b558+0x1)['toString']()),'showRotator':null!==_0x46bd7e,'ranges':[_0xbe245a],'areActionsDisabled':_0x208934['areActionsDisabled'],'targetEditor':_0x2aa77a}),_0xb74bd5['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x2b385c,_0x13b558),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2b385c,'index':_0x13b558,'isActive':!0x0});}['_getPresentableSiblingContentPartIndex'](_0x263b33,_0x595602,_0x556041){const {reply:_0x107b29}=this['getInteractionAndReplyById'](_0x263b33),_0x542022=_0x107b29['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'editor':ds(this['context'])});if(0x1==_0x542022['length'])return null;const _0x43aebd=_0x542022['findIndex'](_0x33ed85=>_0x33ed85['index']==_0x595602),_0x4efecf='next'==_0x556041?0x1:-0x1;let _0x5aed69=_0x542022['at']((_0x43aebd+_0x4efecf)%_0x542022['length'])['index'],_0x40fd2a=_0x542022[_0x5aed69];for(;!this['_getUserPresentableContentPartDocumentRange'](_0x263b33,_0x107b29,_0x40fd2a);){if(_0x5aed69=_0x542022['at']((_0x5aed69+_0x4efecf)%_0x542022['length'])['index'],_0x5aed69===_0x43aebd)return null;_0x40fd2a=_0x542022[_0x5aed69];}return _0x5aed69;}['_getUserPresentableContentPartDocumentRange'](_0x18421f,_0x154f0e,_0x46fef6){const _0x229d0c=_0x154f0e['changeGroups'];if(!_0x46fef6['hasChanges'])return null;const _0x11c18d=_0x229d0c['find'](_0x158b89=>_0x158b89['index']==_0x46fef6['index']);if('pending'!==_0x11c18d?.['state'])return null;const _0x49cf62=this['_getDocumentRangeForReplyChanges'](_0x18421f,_0x46fef6['index']);if(!_0x49cf62)return _0x154f0e['setChangeGroupState'](_0x46fef6['index'],'outdated'),null;const {range:_0x57429e,currentIndex:_0x4edd09}=_0x49cf62;return'$graveyard'==_0x57429e['root']['rootName']?(_0x154f0e['setChangeGroupState'](_0x4edd09,'outdated'),null):_0x49cf62['range'];}['_getDocumentRangeForReplyChanges'](_0x58f9b0,_0x24858f){const {reply:_0xf26436}=this['getInteractionAndReplyById'](_0x58f9b0),_0x1cec26=_0xf26436['changeGroups']['filter'](_0x47c4f3=>'pending'==_0x47c4f3['state']),_0x415fe0=_0x1cec26['map'](_0x3a5275=>_0xf26436['changeGroups']['indexOf'](_0x3a5275));void 0x0===_0x24858f&&(_0x24858f=_0x415fe0[0x0]);const _0x35f20c=_0x415fe0['indexOf'](_0x24858f);if(-0x1==_0x35f20c)return null;const _0x39aa5c=_0x1cec26[_0x35f20c],_0x247028=this['_resolveGroupTarget'](_0xf26436,_0x39aa5c);if(!_0x247028)return null;const {editor:_0x3a7476,root:_0x2a4fb7,parsedDocumentContent:_0x5cec3e,serializedDocumentContent:_0xbd1f0b,version:_0x2ea9a7}=_0x247028,_0x5bcee2=new _0x34e0db([]),_0x14a052=new _0x34e0db([]);for(const _0x4cff96 of _0x39aa5c['changes']){const _0x5ba4c2=this['activeConversation']?.['getSourceByDataId'](_0x4cff96['id']);if((!_0x5ba4c2||_0x5ba4c2['editor']===_0x247028['editor']&&_0x5ba4c2['rootName']===_0x247028['root']['rootName'])&&('removed'!=_0x4cff96['type']&&_0x14a052['children']['push'](_0x4cff96['node']['cloneNode'](!0x0)),'new'!=_0x4cff96['type'])){const _0xbde07e=_0x4e94ee(_0x2dca16=>$i(_0x2dca16,'data-id')==_0x4cff96['id'],_0x5cec3e,!0x0);if(!_0xbde07e)return null;_0x5bcee2['children']['push'](_0xbde07e['cloneNode'](!0x0));}}if(0x0==_0x5bcee2['children']['length']){if(_0x39aa5c['changes'][0x0]['anchorId']){const _0x13e20e=Wi('data-id',_0x39aa5c['changes'][0x0]['anchorId'],_0x5cec3e);_0x5bcee2['children']['unshift'](_0x13e20e['cloneNode'](!0x0)),_0x14a052['children']['unshift'](_0x13e20e['cloneNode'](!0x0)),_0x13e20e['nextSibling']&&(_0x5bcee2['children']['push'](_0x13e20e['nextSibling']['cloneNode'](!0x0)),_0x14a052['children']['push'](_0x13e20e['nextSibling']['cloneNode'](!0x0)));}else{const _0xfca5a0=_0x5cec3e['children'][0x0];if(!_0xfca5a0)return null;_0x5bcee2['children']['push'](_0xfca5a0['cloneNode'](!0x0)),_0x14a052['children']['push'](_0xfca5a0['cloneNode'](!0x0));}}const _0x5177d8=_0x3a7476['data']['parse'](_0xbd1f0b),_0x1e3b12=Ki(_0x5bcee2),_0x25558c=_0x3a7476['data']['parse'](_0x1e3b12),_0x4e449d=_0x3a7476['data']['parse'](_0x1e3b12),_0x74ebd6=_0x3a7476['model']['createPositionAt'](_0x25558c,0x0),_0x527a41=Ki(_0x14a052),_0x1674e8={'targetEditor':_0x3a7476,'anchor':_0x74ebd6,'markDeletions':!0x1},_0x833e46=_0x3a7476['plugins']['get'](_0x53dd97)['getDiff'](_0x1e3b12,_0x527a41,_0x1674e8)['getOperations']();if(!_0x833e46['length'])return null;_0x3a7476['model']['change'](_0xdd47d7=>{for(const _0x6dc74a of _0x833e46)if('remove'==_0x6dc74a['type']){const _0x4a8b08=_0x6dc74a['sourcePosition'],_0x58b2d8=_0x6dc74a['howMany'],_0xa5a88c=new _0x43c2ab(_0x4a8b08,_0x58b2d8);_0xdd47d7['batch']['addOperation'](_0xa5a88c),_0x3a7476['model']['applyOperation'](_0xa5a88c);}else'marker'!==_0x6dc74a['type']&&(_0x6dc74a['baseVersion']=null,_0x6dc74a['isDocumentOperation']=!0x1,_0xdd47d7['batch']['addOperation'](_0x6dc74a),_0x3a7476['model']['applyOperation'](_0x6dc74a));});const _0x48500d=es(_0x3a7476,_0x833e46,_0x25558c);is(_0x3a7476['model'],_0x48500d);const _0x70bf80=_0x48500d['getFirstRange']()['start']['path']['slice'](),_0x36c12d=_0x48500d['getFirstRange']()['end']['path']['slice'](),_0x12bbf8=[];let _0x8e2bc4=_0x25558c,_0x38c1b5=_0x4e449d;for(let _0x1caeb1=0x0;_0x1caeb1<_0x36c12d['length'];_0x1caeb1++){const _0x251bbd=_0x8e2bc4['maxOffset']-_0x36c12d[_0x1caeb1];_0x12bbf8[_0x1caeb1]=_0x38c1b5['maxOffset']-_0x251bbd,_0x8e2bc4=_0x8e2bc4['getChildAtOffset'](_0x36c12d[_0x1caeb1]),_0x38c1b5=_0x38c1b5['getChildAtOffset'](_0x12bbf8[_0x1caeb1]);}const _0x43d949=_0x3a7476['model']['createRange'](_0x3a7476['model']['createPositionFromPath'](_0x4e449d,_0x70bf80),_0x3a7476['model']['createPositionFromPath'](_0x4e449d,_0x12bbf8)),_0x3c9644=_0x4e449d['getChild'](0x0)['getAttribute'](_0x4140c8),_0x3115d3=Array['from'](_0x5177d8['getChildren']())['find'](_0x4e0f22=>_0x4e0f22['getAttribute'](_0x4140c8)==_0x3c9644)['getPath'](),_0xf47489=_0x43d949['start']['path']['slice'](),_0x17d4ea=_0x43d949['end']['path']['slice']();_0xf47489[0x0]=_0x3115d3[0x0]+_0xf47489[0x0],_0x17d4ea[0x0]=_0x3115d3[0x0]+_0x17d4ea[0x0];let _0x110239=_0x3a7476['model']['createRange'](_0x3a7476['model']['createPositionFromPath'](_0x2a4fb7,_0xf47489),_0x3a7476['model']['createPositionFromPath'](_0x2a4fb7,_0x17d4ea));const _0xe58401=_0x3a7476['model']['document']['history']['getOperations'](_0x2ea9a7);for(const _0x401cf8 of _0xe58401)_0x110239=_0x1445f3['_createFromRanges'](_0x110239['getTransformedByOperation'](_0x401cf8));return{'range':_0x110239,'currentIndex':_0x24858f};}['_integrateEditorBalloon'](_0x37258c){if(!_0x37258c['plugins']['has']('AIChatBalloon'))return;const _0x4ba4fa=_0x37258c['plugins']['get']('AIChatBalloon');this['_wiredBalloons']['has'](_0x4ba4fa)||(this['_wiredBalloons']['add'](_0x4ba4fa),this['_aiChatBalloon']||(this['_aiChatBalloon']=_0x4ba4fa),_0x4ba4fa['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x4ba4fa,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x427404,partIndex:_0x6fa1d2}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0xc8820c}=this['getInteractionAndReplyById'](_0x427404),_0xf5327f=_0xc8820c['changeGroups']['find'](_0x197196=>_0x197196['index']===_0x6fa1d2),_0x1c6822=_0xf5327f?this['_resolveGroupTarget'](_0xc8820c,_0xf5327f):null,_0x45a562=_0xc8820c['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x6fa1d2,'editor':_0x1c6822?.['editor']??ds(this['context'])});(this['_activeBalloon']??_0x4ba4fa)['updateContent']({'part':_0x45a562[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x4ba4fa,'applySuggestion',()=>{const {replyId:_0x292654,partIndex:_0x1caeae}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x292654,'partIndex':_0x1caeae}),(this['_activeBalloon']??_0x4ba4fa)['setState']('accepted');}),this['listenTo'](_0x4ba4fa,'insertSuggestion',()=>{const {replyId:_0x3c36c2,partIndex:_0xa688e2}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x3c36c2,'partIndex':_0xa688e2}),(this['_activeBalloon']??_0x4ba4fa)['setState']('accepted');}),this['listenTo'](_0x4ba4fa,'rejectSuggestion',()=>{const {replyId:_0x313382,partIndex:_0x2c58de}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x313382,'partIndex':_0x2c58de}),(this['_activeBalloon']??_0x4ba4fa)['setState']('rejected');}),this['listenTo'](_0x4ba4fa,'showNext',()=>{const {replyId:_0x47af5c,partIndex:_0x55144c}=this['_currentPreviewedChangeGroup'],_0x4b69c5=this['_getPresentableSiblingContentPartIndex'](_0x47af5c,_0x55144c,'next');null!==_0x4b69c5&&this['_openBalloonFor'](_0x47af5c,_0x4b69c5);}),this['listenTo'](_0x4ba4fa,'showPrevious',()=>{const {replyId:_0x4a72ff,partIndex:_0xdd797c}=this['_currentPreviewedChangeGroup'],_0x99333e=this['_getPresentableSiblingContentPartIndex'](_0x4a72ff,_0xdd797c,'previous');null!==_0x99333e&&this['_openBalloonFor'](_0x4a72ff,_0x99333e);}),this['listenTo'](_0x4ba4fa,'dialogClosed',(_0x54fd84,{id:_0x26bcc1})=>{if('aiChatBalloon'!==_0x26bcc1)return;const {replyId:_0x1ef2b7,partIndex:_0x4c3107}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x1ef2b7,'index':_0x4c3107,'isActive':!0x1}),this['_activeBalloon']===_0x4ba4fa&&(this['_activeBalloon']=void 0x0);}));}['_integrateEditor'](_0x5c047b){if(this['_integrateEditorBalloon'](_0x5c047b),_0x5c047b['plugins']['has']('Undo')){const _0x12d922=_0x5c047b['commands']['get']('undo'),_0x5cf2b6=_0x5c047b['commands']['get']('redo');this['listenTo'](_0x12d922,'revert',(_0x4f36bb,_0x595c43,_0xf55d)=>{const _0x31c106=this['_batchToChanges']['get'](_0x595c43);if(!_0x31c106)return;const _0x289ef4=this['activeConversation']['getInteraction'](_0x31c106['interactionId']),_0xb4ce77=_0x289ef4?.['getReply'](_0x31c106['replyId']);this['_batchToChanges']['delete'](_0x595c43),_0x289ef4&&_0xb4ce77&&(_0x31c106['indexes']['forEach'](_0x4f9648=>_0xb4ce77['setChangeGroupState'](_0x4f9648,'pending')),this['_batchToChanges']['set'](_0xf55d,_0x31c106));}),this['listenTo'](_0x5cf2b6,'revert',(_0x1ed3ce,_0xebaa5a,_0x100d8e)=>{const _0x296b8a=this['_batchToChanges']['get'](_0xebaa5a);if(!_0x296b8a)return;const _0x1eca5f=this['activeConversation']['getInteraction'](_0x296b8a['interactionId']),_0x1cd54c=_0x1eca5f?.['getReply'](_0x296b8a['replyId']);this['_batchToChanges']['delete'](_0xebaa5a),_0x1eca5f&&_0x1cd54c&&(_0x296b8a['indexes']['forEach'](_0xff6bb=>_0x1cd54c['setChangeGroupState'](_0xff6bb,'accepted')),this['_batchToChanges']['set'](_0x100d8e,_0x296b8a));});}const _0x447cb3=_0x5c047b['config']['get']('ai.chat.context');_0x447cb3['alwaysAddSelection']&&_0x447cb3['document']['enabled']&&this['listenTo'](_0x5c047b['model']['document']['selection'],'change:range',(_0x32bf28,_0x15c878)=>{if(!_0x15c878['directChange'])return;'chat'===_0x5c047b['plugins']['get']('AITabs')['view']['activeTab']&&(_0x5c047b['model']['hasContent'](_0x5c047b['model']['document']['selection'])?this['addSelectionToChatContext']():this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x3460a1=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x403fc7=await _0x3460a1['getConversations']();return _0x403fc7['length']?_0x403fc7[0x0]['id']:'new';}catch(_0x8f622a){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':ot()}),this['_logError'](new at('ai-chat-conversation-init-failed',this,{'error':_0x8f622a})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x174fa3={}){try{this['_aiChatUi']['enableControls'](),await this['_handleStartConversation'](_0x174fa3);}catch(_0x1cc025){this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x174fa3['id']||ot()}),console['error'](_0x1cc025),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x117334,modelId:_0x419801}={}){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;let _0x256a20=_0x419801;_0x256a20||(_0x117334||!this['activeConversation']?_0x256a20=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x256a20=this['activeConversation']['selectedModel']['id'])),await this['_stopLastInteraction']();const _0x51d660=this['getGroupId'](),_0x81cbe5=_0x117334||ot();let _0x2f7d1e;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x256a20,'conversationId':_0x81cbe5,'group':_0x51d660,'getEditor':()=>ds(this['context']),'getEditors':()=>ls(this['context']),'locale':this['context']['locale'],'isFromHistory':!!_0x117334}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['activeConversation']['on']('conversationInitialized',(_0x2a0874,_0x11e7af)=>{this['_aiChatUi']['createConversation'](_0x11e7af),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x117334||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['activeConversation']['on']('uploadProgressChanged',(_0x4ae6bd,_0x163cb6)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x163cb6['isUploadInProgress']);}),this['activeConversation']['on']('webSearchStarted',()=>{const _0x3fa617=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x3fa617);}),this['activeConversation']['on']('reasoningStarted',()=>{const _0x1574de=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x1574de);}),this['activeConversation']['on']('webSearchFinished',(_0x3ae739,_0x1511b1)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x1511b1,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['activeConversation']['on']('reasoningFinished',(_0x4d8103,_0x3f7606)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3f7606,{'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});}),this['activeConversation']['on']('interactionStarted',()=>{this['_aiChatUi']['startInteraction']();}),this['activeConversation']['on']('interactionFinished',async()=>{this['_updateReplyContentThrottled']['flush'](),await this['_aiChatUi']['finishInteraction']();}),this['activeConversation']['on']('interactionDestroyed',(_0x1557b0,_0x30dea4)=>{this['_aiChatUi']['removeFeedInteraction'](_0x30dea4['id']);}),this['activeConversation']['on']('setConversationTitle',(_0x4be8b7,_0xff3047,_0x37144f)=>{this['_updateConversationTitle'](_0xff3047,_0x37144f);}),this['activeConversation']['on']('replyContentUpdated',async(_0x574321,_0x32c332)=>{void 0x0!==_0x2f7d1e&&_0x2f7d1e!==_0x32c332['id']&&this['_updateReplyContentThrottled']['flush'](),_0x2f7d1e=_0x32c332['id'],_0x32c332['isFromHistory']?await this['_updateReplyContent']({'reply':_0x32c332}):await this['_updateReplyContentThrottled']({'reply':_0x32c332});}),this['activeConversation']['on']('replyChangeGroupStateUpdated',(_0x50a46e,{reply:_0x2edf60,index:_0x6d6eef,state:_0x2e37fd})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x2edf60['id'],'index':_0x6d6eef,'state':_0x2e37fd}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x2edf60['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x6d6eef&&(this['_activeBalloon']??this['_aiChatBalloon'])?.['setState'](_0x2e37fd);}),this['activeConversation']['on']('contextItemAdded',(_0x1f3c31,_0x4c1867)=>{if(this['_aiChatUi']['addContextItem'](_0x4c1867['contextItem'],_0x4c1867['isLoading']),'selection'===_0x4c1867['contextItem']['type']){const _0x1b4f3e=[...ds(this['context'])['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'ranges':_0x1b4f3e,'id':'context','priority':0x1});}}),this['activeConversation']['on']('contextItemRemoved',(_0x1d15a2,_0x595b67)=>{this['_aiChatUi']['removeContextItem'](_0x595b67['uiId']),'current-document'==_0x595b67['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x595b67['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['activeConversation']['on']('contextItemLoadingEnded',(_0x544ee1,_0x2a4c2d)=>{this['_aiChatUi']['setContextItemLoading'](_0x2a4c2d['contextItem']['uiId'],_0x2a4c2d['isLoading']);}),this['activeConversation']['on']('contextSent',(_0x10d636,_0x42f1f9)=>{this['_aiChatUi']['setConversationContext'](_0x42f1f9['contextItems']);}),this['activeConversation']['on']('addContextOptionsChanged',(_0x57d5de,_0x22d082)=>{this['_aiChatUi']['setAddContextOptions'](_0x22d082['options']);}),this['activeConversation']['on']('sourceResourcesLoaded',(_0x3b10b9,_0x9d3bf6)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x9d3bf6['sourceId'],_0x9d3bf6['source'],_0x9d3bf6['resources'],_0x9d3bf6['uid']);}),this['activeConversation']['on']('resourceStateChanged',(_0x3f94af,_0x478fd7)=>{this['_aiChatUi']['updateResourceState'](_0x478fd7['sourceId'],_0x478fd7['resourceId'],_0x478fd7['isInContext']);}),this['activeConversation']['on']('capabilitiesUpdated',(_0x313e84,_0x249963)=>{this['_aiChatUi']['updateCapabilities'](_0x249963);}),this['activeConversation']['on']('modelSelected',async(_0x1145b8,_0x52302f)=>{const _0x27bd55=(await this['_aiChatModels']['getAll']())['find'](_0x4bbf5e=>_0x4bbf5e['id']===_0x52302f['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x27bd55,_0x52302f['isDisabled']);}),this['activeConversation']['on']('error',(_0x18bcd4,{error:_0xe469fc,interactionId:_0x27b965,fileName:_0x544f6a,url:_0x896bb7,sourceId:_0x478e6b,sourceLabel:_0x8b96b3})=>{const _0x52680a=_0x27b965?_0x27b965+':'+ot():ot();_0xe469fc['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Hi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x52680a}):_0xe469fc['message']['startsWith']('ai-chat-conversation-init-failed')||_0xe469fc['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x52680a}),this['_logError'](_0xe469fc)):_0xe469fc['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x544f6a),'id':_0x52680a}):_0xe469fc['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x896bb7),'id':_0x52680a}):_0xe469fc['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x52680a}):_0xe469fc['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x52680a}):_0xe469fc['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x478e6b&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x478e6b),this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x8b96b3||'source'),'id':_0x52680a}),this['_logError'](_0xe469fc)):_0xe469fc['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x52680a}),this['_logError'](_0xe469fc)):_0xe469fc['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x52680a}),this['_logError'](_0xe469fc)):_0xe469fc['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x52680a}),this['_logError'](_0xe469fc)):_0xe469fc['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x52680a}),this['_logError'](_0xe469fc)):_0xe469fc['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x52680a}),this['_logError'](_0xe469fc)):_0xe469fc['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x52680a}),this['_logError'](_0xe469fc)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Hi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x52680a}),this['_logError'](_0xe469fc));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x117334||await this['activeConversation']['start']();}async['_handleUIUserMessage']({message:_0x414270,attributes:_0x1fc60c}){if(!this['activeConversation'])throw new at('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x377a3f=await this['_aiEditing']['getDocumentData']();_0x377a3f['length']>0x1?await this['activeConversation']['updateCurrentDocumentsInContext'](_0x377a3f):await this['activeConversation']['updateCurrentDocumentInContext'](_0x377a3f[0x0]);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x414270,'attributes':_0x1fc60c});}['_logError'](_0x40d687){Ct(_0x40d687['message']);}['_removeFromContext'](_0x5a8fa0){this['activeConversation']?.['removeFromContext'](_0x5a8fa0);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x5a6698){const [_0x503528,_0x17f5f3]=_0x5a6698['split'](':'),_0x24bcda=this['activeConversation']['getInteraction'](_0x503528),_0x27dd64=_0x24bcda['getReply'](_0x17f5f3);return{'interaction':_0x24bcda,'reply':_0x27dd64};}['_resolveGroupTarget'](_0xa50645,_0xe85ff2){const _0x476b1a=[..._0xe85ff2['changes']['filter'](_0x2a71d4=>'context'!==_0x2a71d4['type']),..._0xe85ff2['changes']['filter'](_0xc3e932=>'context'===_0xc3e932['type'])];for(const _0x1ad64e of _0x476b1a){const _0x3f67ff=_0xa50645['newNodeAnchorIds']['get'](_0x1ad64e['id']),_0x5cddcd=this['activeConversation']?.['getSourceByDataId'](_0x1ad64e['id'])||this['activeConversation']?.['getSourceByDataId'](_0x3f67ff)||this['activeConversation']?.['getSourceByDataId'](_0x1ad64e['anchorId']??void 0x0);if(_0x5cddcd){if('destroyed'===_0x5cddcd['editor']['state'])return null;const _0x313426=_0x5cddcd['editor']['model']['document']['getRoot'](_0x5cddcd['rootName']);return _0x313426?{'editor':_0x5cddcd['editor'],'root':_0x313426,'parsedDocumentContent':Fi(_0x5cddcd['content']),'serializedDocumentContent':_0x5cddcd['content'],'version':_0x5cddcd['version']}:null;}}const _0x4922ef=ds(this['context']),_0x593595=this['activeConversation']['getInteraction'](_0xa50645['interactionId']),_0x23abbc=_0x593595?.['getDocumentContext']();return{'editor':_0x4922ef,'root':_0x4922ef['model']['document']['getRoot'](),'parsedDocumentContent':_0xa50645['documentContextContent'],'serializedDocumentContent':_0x23abbc?.['content'],'version':_0x23abbc?.['version']};}['_groupChangesByTarget'](_0x408ac6,_0x460086){const _0xafe110=new Map();for(const _0x2ba45b of _0x460086){const _0x3e6c89=this['_resolveGroupTarget'](_0x408ac6,_0x2ba45b);if(!_0x3e6c89)continue;const _0xce106b=(_0x3e6c89['editor']['id']||'e')+'|'+_0x3e6c89['root']['rootName'];let _0x58b5f7=_0xafe110['get'](_0xce106b);if(!_0x58b5f7){let _0x686b8f;for(const _0x18fd67 of[..._0x2ba45b['changes']['filter'](_0x2c9fc0=>'context'!==_0x2c9fc0['type']),..._0x2ba45b['changes']['filter'](_0xcd360=>'context'===_0xcd360['type'])])if(_0x686b8f=this['activeConversation']?.['getDocumentContextSliceByDataId'](_0x18fd67['id'])||this['activeConversation']?.['getDocumentContextSliceByDataId'](_0x408ac6['newNodeAnchorIds']['get'](_0x18fd67['id'])),_0x686b8f)break;_0x58b5f7={'target':{'editor':_0x3e6c89['editor'],'root':_0x3e6c89['root']},'slice':_0x686b8f,'groups':[],'groupsIndexes':[]},_0xafe110['set'](_0xce106b,_0x58b5f7);}_0x58b5f7['groups']['push'](_0x2ba45b),_0x58b5f7['groupsIndexes']['push'](_0x408ac6['changeGroups']['indexOf'](_0x2ba45b));}return Array['from'](_0xafe110['values']());}['_scrollToSuggestionRange'](_0x111a36,_0x43c2e5=!0x1,_0x43ed31){const _0x5c4ffe={'target':_0x43ed31['editing']['view']['domConverter']['viewRangeToDom'](_0x43ed31['editing']['mapper']['toViewRange'](_0x111a36)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x43c2e5};_0x43c2e5&&(_0x5c4ffe['alignToTop']=!0x0),wt(_0x5c4ffe);}['_updateConversationTitle'](_0x23ba4e,_0x157338=!0x1){this['_aiChatUi']['setConversationTitle'](_0x23ba4e||Hi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x157338);}['_addFeedItemReply'](_0x395fe5){'text'===_0x395fe5['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x395fe5):this['_aiChatUi']['addFeedItemAISuggestion'](_0x395fe5);}async['_updateReplyContent']({reply:_0x10dde5,renderingStrategy:_0x5d6a40}){const {id:_0x276738,interactionId:_0xdd3e1d,isDone:_0x24d046,type:_0x3a8420,parsedContent:_0x5cc0cf}=_0x10dde5,_0x1abdec=_0xdd3e1d+':'+_0x276738;if('modification'===_0x3a8420){const _0x2e56ff=_0x10dde5['getContentParts']({'showDiff':this['_aiChatUi']['showDiff'],'editor':ds(this['context'])});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x1abdec,'parts':_0x2e56ff,'isDone':_0x24d046,'skipLoadingEffects':_0x10dde5['isFromHistory']});}else'text'===_0x3a8420&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x1abdec,'parsedContent':_0x5cc0cf,'renderingStrategy':_0x5d6a40,'isDone':_0x24d046});_0x24d046&&_0x10dde5['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x1abdec,_0x10dde5['sources']);}['_updateReplyContentThrottled']=_0x121c0b(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x15c259=this['activeConversation']?.['lastInteraction'];_0x15c259&&(_0x15c259['stop'](),this['_aiChatUi']['stopInteraction'](_0x15c259)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x254777=this['activeConversation']?.['lastInteraction'];if(_0x254777){for await(const _0x12bab7 of _0x254777['replies'])this['_aiChatUi']['hasFeedItem'](_0x12bab7['id'])||this['_addFeedItemReply'](_0x12bab7),await this['_updateReplyContent']({'reply':_0x12bab7,'renderingStrategy':'static'});}}['_updateRatings'](_0x135739){const _0x18461b={'positiveCount':_0x135739['changeGroups']['filter'](_0x32a473=>'accepted'===_0x32a473['state'])['length'],'totalCount':_0x135739['changeGroups']['length'],'modificationId':_0x135739['id']},_0xcf3b1c=this['activeConversation']['getInteraction'](_0x135739['interactionId'])['messageId'];_0xcf3b1c&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0xcf3b1c,_0x18461b);}['_getAIChatFeedAPI'](_0x453790){const _0x414c18=this['_aiChatUi'],_0x4e532f=()=>{_0x453790['resetWebSearchState'](),_0x453790['resetReasoningState'](),_0x414c18['clearLoadingMessage']();},_0x24fa35=()=>{_0x453790['currentReply']&&(_0x453790['currentReply']['done'](),_0x453790['currentReply']=void 0x0);};return{'insertTextReply':(_0x5a563d,_0x45d9ce)=>{_0x24fa35(),_0x4e532f();const _0xdd8350=_0x453790['currentReply']=_0x453790['createReply']({'type':'text','interactionId':_0x453790['id'],'content':_0x5a563d,'id':_0x45d9ce||ot()});return _0x24fa35(),_0xdd8350;},'insertCustomElement':async(_0x5103c5,_0x3fe8c3)=>(_0x24fa35(),_0x4e532f(),_0x414c18['addFeedItemCustomElement'](_0x5103c5,_0x3fe8c3||ot())),'setLoadingMessage':_0xa161d3=>{_0x414c18['setLoadingMessage'](_0xa161d3);},'clearLoadingMessage':()=>{_0x414c18['clearLoadingMessage']();}};}}const As='ai-selection',gs=['br'];class AIEditing extends _0x23f270{constructor(_0x1710de){super(_0x1710de),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionId'];['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}get['sessionId'](){if(!this['_sessionId']){const _0x35f79c=ls(this['context']),_0x4bb4ef=_0x35f79c['find'](_0x1fa0ce=>_0x1fa0ce['plugins']['has']('RealTimeCollaborationClient'))||_0x35f79c[0x0],_0x2c3939=_0x4bb4ef['plugins']['has']('RealTimeCollaborationClient')&&_0x4bb4ef['plugins']['get']('RealTimeCollaborationClient')['sessionId'];this['_sessionId']=_0x2c3939||ot();}return this['_sessionId'];}async['getDocumentData'](){const _0xefe66b=ls(this['context']);if(!_0xefe66b['length'])throw new at('ai-get-editor-from-context-no-editor');const _0x45f77a=[],_0x299fd7=new Set();for(const _0x2c495d of _0xefe66b){const _0x4feb9d=_0x2c495d['config']['get']('roots')||{};for(const _0x10779f of _0x2c495d['model']['document']['getRoots']()){if('$graveyard'===_0x10779f['rootName'])continue;const _0x37dfb4=await this['_getDocumentDataForEditorRoot'](_0x2c495d,_0x10779f,_0x299fd7),_0x298661=_0x4feb9d[_0x10779f['rootName']];let _0x123748;_0x298661?.['label']?_0x123748=_0x298661['label']:(gt('ai-document-root-missing-label',{'editor':_0x2c495d,'rootConfig':_0x298661}),_0x123748=_0x10779f['rootName']),_0x45f77a['push']({'editor':_0x2c495d,'rootName':_0x10779f['rootName'],'content':_0x37dfb4['content'],'version':_0x37dfb4['version'],'sessionId':this['sessionId'],'channelId':_0x2c495d['config']['get']('collaboration.channelId'),'selections':_0x37dfb4['selections'],'name':_0x123748,'description':_0x298661?.['description']});}}return _0x45f77a;}async['_getDocumentDataForEditorRoot'](_0x13fcf7,_0x2fa661,_0x2ffddb){const _0x2bfc7a=_0x13fcf7['data']['toView'](_0x2fa661,{'convertAiChatSelectionMarker':!0x0}),_0x208fc1=new _0x4b9165(_0x13fcf7['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x2bfc7a,_0x208fc1,_0x2ffddb);let _0x382c6d=await this['_getDocumentDataStringFromView'](_0x2bfc7a,_0x13fcf7);const _0x399a62=this['_getMarkersInDocumentOrder'](_0x13fcf7,_0x2fa661),_0x5bb59b=[];for(const _0x35fc3a of _0x399a62){const _0x4a24cf='<'+_0x35fc3a['name']+':start></'+_0x35fc3a['name']+':start>',_0xd6e017=_0x382c6d['indexOf'](_0x4a24cf);_0x382c6d=_0x382c6d['substring'](0x0,_0xd6e017)+_0x382c6d['substring'](_0xd6e017+_0x4a24cf['length']);const _0x3bcf74='<'+_0x35fc3a['name']+':end></'+_0x35fc3a['name']+':end>',_0x3a651b=_0x382c6d['indexOf'](_0x3bcf74);_0x382c6d=_0x382c6d['substring'](0x0,_0x3a651b)+_0x382c6d['substring'](_0x3a651b+_0x3bcf74['length']),_0x5bb59b['push']({'markerName':_0x35fc3a['name'],'start':_0xd6e017,'end':_0x3a651b,'htmlFragment':_0x382c6d['substring'](_0xd6e017,_0x3a651b)});}return{'content':_0x382c6d,'version':_0x13fcf7['model']['document']['version'],'selections':_0x5bb59b};}async['afterInit'](){this['context']instanceof _0x5ca812?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0xd76274,_0x4c631e)=>{_0x4c631e['on']('ready',()=>{this['_integrateEditor'](_0x4c631e);});});}['_setOutputDataProcessor'](_0x42862f){this['_outputDataProcessor']=_0x42862f;}async['_getDocumentDataStringFromView'](_0x1b7e5c,_0x807a06){let _0x28fa97;if(this['_outputDataProcessor']){const _0x644e03=_0x807a06['data']['processor']['domConverter']['viewToDom'](_0x1b7e5c),_0x556e60=await this['_outputDataProcessor'](_0x644e03);_0x28fa97=_0x807a06['data']['processor']['htmlWriter']['getHtml'](_0x556e60);}else _0x28fa97=_0x807a06['data']['processor']['toData'](_0x1b7e5c);return _0x28fa97;}['_integrateEditor'](_0x5fb0d5){if(!_0x5fb0d5['config']['get']('collaboration.channelId'))throw new at('ai-missing-channel-id',_0x5fb0d5);_0x5fb0d5['ui']['focusTracker']['on']('change:isFocused',(_0x3322f8,_0x193897,_0x23229e)=>{_0x23229e&&(this['_lastContentFocusedEditor']=_0x5fb0d5);}),_0x5fb0d5['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x5fb0d5&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x5fb0d5['conversion']['for']('editingDowncast')['markerToHighlight']({'model':As,'view':({markerName:_0x2c389c})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x2c389c['split'](':')[0x1]],'priority':0xc})}),_0x5fb0d5['conversion']['for']('dataDowncast')['markerToElement']({'model':As+':context','view':(_0xe9606d,{writer:_0x1b7734,options:_0x1b9091})=>_0x1b9091['convertAiChatSelectionMarker']?_0x1b7734['createUIElement'](_0xe9606d['markerName']+':'+(_0xe9606d['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x3fbc93){const _0x683c97=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x3fbc93);const _0x1cad92=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x683c97,_0x1cad92);}['hideFakeVisualSelection'](_0x5546b6){const _0x5341e7=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x5546b6);const _0x2d7d39=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x5341e7,_0x2d7d39);}async['modelToDataWithIds'](_0x4aba89){const _0x41cf73=ds(this['context']),_0x35c8b3=_0x41cf73['data']['toView'](_0x4aba89),_0x53b93a=new _0x4b9165(_0x41cf73['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x35c8b3,_0x53b93a),this['_getDocumentDataStringFromView'](_0x35c8b3,_0x41cf73);}['_setDataIdsOnChildren'](_0x4939ae,_0x435fd4,_0xee2183=new Set()){let _0x47aa30=!0x1;for(const _0x597be6 of _0x4939ae['getChildren']()){if(!_0x597be6['is']('view:element')||gs['includes'](_0x597be6['name']))continue;const _0xebfb84=_0x597be6['is']('view:containerElement'),_0x542c40=_0x597be6['is']('view:emptyElement'),_0x5a34ac=this['_setDataIdsOnChildren'](_0x597be6,_0x435fd4,_0xee2183);if(_0x597be6['hasAttribute']('data-id')){_0x47aa30=!0x0,_0xee2183['add'](_0x597be6['getAttribute']('data-id'));continue;}(_0xebfb84||_0x542c40||_0x5a34ac)&&(_0x435fd4['setAttribute']('data-id',this['_nextDataId'](_0xee2183),_0x597be6),_0x47aa30=!0x0);}return _0x47aa30;}['_nextDataId'](_0x46da66){let _0x24387e;do{_0x24387e='';for(let _0x595571=0x0;_0x595571<0x4;_0x595571++)_0x24387e+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x46da66['has'](_0x24387e));return _0x46da66['add'](_0x24387e),_0x24387e;}['getSelectionText'](){const {model:_0xe8e936}=ds(this['context']),_0x21dae9=_0xe8e936['document']['selection'],_0x41a0b=[],_0x2fa1da=Array['from'](_0x21dae9['getRanges']());_0x2fa1da['sort']((_0xe71621,_0x372bf3)=>_0xe71621['start']['isBefore'](_0x372bf3['start'])?-0x1:0x1);for(const _0x555888 of _0x2fa1da)for(const _0x2f58af of _0x555888['getItems']())_0x2f58af['is']('$textProxy')?_0x41a0b['push'](_0x2f58af['data']):_0x2f58af['is']('element')&&_0x41a0b['length']>0x0&&'\x20'!==_0x41a0b[_0x41a0b['length']-0x1]&&_0x41a0b['push']('\x20');return _0x41a0b['length']?'\x22'+_0x41a0b['join']('')['trim']()+'\x22':Hi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x5b2974){for(let _0xd44fa7=0x0;_0xd44fa7<this['_fakeSelections']['length'];_0xd44fa7++)if(this['_fakeSelections'][_0xd44fa7]['id']==_0x5b2974)return void this['_fakeSelections']['splice'](_0xd44fa7,0x1);}['_addFakeSelection'](_0x413b78){this['_removeFakeSelectionById'](_0x413b78['id']),Tt(this['_fakeSelections'],_0x413b78);}['_refreshFakeSelection'](_0x31aaf8,_0x1262af){if(_0x31aaf8==_0x1262af)return;const _0x1f274d=_0x31aaf8?this['_getEditorForFakeSelection'](_0x31aaf8):null,_0x42b6de=_0x1262af?this['_getEditorForFakeSelection'](_0x1262af):null,_0x54db67=(_0x1c4a90,_0x3be55f)=>{const _0x5966e3=_0x3be55f['model']['markers']['getMarkersGroup'](As);for(const _0x4314ce of _0x5966e3)_0x1c4a90['removeMarker'](_0x4314ce);},_0xe40967=(_0x836a71,_0x3cc333,_0x18eca4)=>{const _0x14b133=_0x3cc333['model'];for(let _0x4afcd7=0x0;_0x4afcd7<_0x18eca4['ranges']['length'];_0x4afcd7++){let _0x2079d4=_0x18eca4['ranges'][_0x4afcd7];const _0x3d3864=As+':'+_0x18eca4['id']+':'+_0x4afcd7;if(_0x2079d4['start']['isAtEnd']){const _0x2cf6d7=_0x2079d4['start']['getLastMatchingPosition'](({item:_0x375b5a})=>!_0x14b133['schema']['isContent'](_0x375b5a),{'boundaries':_0x2079d4});_0x2079d4=_0x836a71['createRange'](_0x2cf6d7,_0x2079d4['end']);}_0x836a71['addMarker'](_0x3d3864,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x2079d4});}};_0x1f274d&&_0x42b6de&&_0x1f274d===_0x42b6de&&_0x1262af?_0x1f274d['model']['change'](_0x45feae=>{_0x54db67(_0x45feae,_0x1f274d),_0xe40967(_0x45feae,_0x42b6de,_0x1262af);}):(_0x1f274d&&_0x1f274d['model']['change'](_0x4b9454=>_0x54db67(_0x4b9454,_0x1f274d)),_0x42b6de&&_0x1262af&&_0x42b6de['model']['change'](_0x587f3a=>_0xe40967(_0x587f3a,_0x42b6de,_0x1262af)));}['_getEditorForFakeSelection'](_0x3fcfda){if(!_0x3fcfda['ranges']['length'])return ds(this['context']);const _0x5840ed=_0x3fcfda['ranges'][0x0]['root']['document'];return ls(this['context'])['find'](_0x116709=>_0x116709['model']['document']===_0x5840ed)??ds(this['context']);}['_getMarkersInDocumentOrder'](_0x57a18e,_0x3f9340){const _0x3a127a=Array['from'](_0x57a18e['model']['markers']['getMarkersGroup'](As+':context'));return(_0x3f9340?_0x3a127a['filter'](_0x216a71=>{const _0x470108=_0x216a71['getRange']();return _0x470108&&_0x470108['root']['rootName']===_0x3f9340['rootName'];}):_0x3a127a)['sort']((_0x2eb91b,_0x3c9b5d)=>_0x2eb91b['getStart']()['isBefore'](_0x3c9b5d['getStart']())?-0x1:_0x2eb91b['getStart']()['isAfter'](_0x3c9b5d['getStart']())?0x1:0x0);}}const Cs=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],ms=[...Cs,'startConversation','sendUserMessage','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function ps(_0x2ead7f){const _0x8e0295=new AbortController();return{'promise':new Promise((_0x204bfd,_0x5af608)=>{const _0x55d0fa=setTimeout(_0x204bfd,_0x2ead7f);_0x8e0295['signal']['addEventListener']('abort',()=>{clearTimeout(_0x55d0fa),_0x5af608();});}),'abortController':_0x8e0295};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x3d9bc4){this['options']={'delay':_0x3d9bc4?.['delay']??0xa,'textNodeStyle':_0x3d9bc4?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x282c8a,targetElement:_0x3d2810,abortSignal:_0x1eaaea}){this['isStreaming']&&this['stop'](),_0x1eaaea?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x118fd9(_0x282c8a,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x4c4053=0x0;_0x4c4053<this['currentIndex'];_0x4c4053++)this['nodesList'][_0x4c4053]['shouldBeStreamed']=!0x0;do{const _0x1f2d91=Date['now'](),_0x574874=this['nodesList'][this['currentIndex']],_0x5f0fb2=_0x1f2d91-this['lastUpdateTime'];if(_0x574874){_0x574874['shouldBeStreamed']=!0x0;let _0x36c16a=_0x574874['parent'];for(;_0x36c16a;)_0x36c16a['shouldBeStreamed']=!0x0,_0x36c16a=_0x36c16a['parent'];}if(_0x5f0fb2<this['options']['delay'])try{const {promise:_0x53ec51,abortController:_0xbe7fc7}=ps(this['options']['delay']-_0x5f0fb2);this['timeoutAbortController']=_0xbe7fc7,await _0x53ec51;}catch(_0x35ae85){return;}_0x2d4ba4(_0x3d2810,'<'+_0x3d2810['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x3d2810['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:_0x4c458e}){Array['from'](_0x4c458e['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x20e9e0=>{_0x20e9e0['replaceWith'](_0x20e9e0['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x5658f1){let _0x325497='';if(function(_0x100c9c){return _0x40c3ff(_0x100c9c);}(_0x5658f1)){for(const _0x148002 of _0x5658f1['children'])_0x325497+=this['renderNode'](_0x148002);}else{if(Ts(_0x5658f1)){if(!_0x5658f1['shouldBeStreamed'])return'';const _0x1d0b2d=_0x5658f1,_0x5bde4b=Object['entries'](_0x1d0b2d['attribs'])['map'](([_0x315a83,_0x2f9479])=>_0x315a83+'=\x22'+_0x2f9479+'\x22')['join']('\x20');_0x325497+='<'+_0x1d0b2d['tagName']+(_0x5bde4b?'\x20'+_0x5bde4b:'')+'>';for(const _0x2c0920 of _0x55fdbd(_0x1d0b2d))_0x325497+=this['renderNode'](_0x2c0920);_0x325497+='</'+_0x1d0b2d['tagName']+'>';}else{if(!ws(_0x5658f1))return'';if(!_0x5658f1['shouldBeStreamed'])return'';!function(_0x5149de){if(!_0x5149de['parent']||!Ts(_0x5149de['parent']))return!0x1;if(!Es['includes'](_0x5149de['parent']['tagName']))return!0x1;return!_0x11c8f9(_0x5149de)['match'](/^\s*[<>]\s*$/);}(_0x5658f1)?_0x325497+=ti(_0x5658f1):_0x325497+=ti(new _0x4d1237('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x5658f1]));}}return _0x325497;}['getParsedDocumentNodeList'](){const _0x155b08=[];return function(_0xf7cc8b,_0x3fed30){const _0x3642d0=_0x5696c0=>{if(_0x3fed30(_0x5696c0),_0x5696c0 instanceof _0x507edc)for(let _0x30cb8a=0x0;_0x30cb8a<_0x5696c0['children']['length'];_0x30cb8a++){const _0x366101=_0x5696c0['children'][_0x30cb8a];_0x3642d0(_0x366101);}};for(let _0x1b47ca=0x0;_0x1b47ca<_0xf7cc8b['children']['length'];_0x1b47ca++)_0x3642d0(_0xf7cc8b['children'][_0x1b47ca]);}(this['document'],_0x350223=>{if(ws(_0x350223)){const _0x43942d=this['splitTextNodeIntoWordNodes'](_0x350223);_0x43942d['length']&&_0x155b08['push'](..._0x43942d);}_0x350223['isWordSplitSource']||_0x350223['isWordSplitResult']||_0x155b08['push'](_0x350223);}),_0x155b08;}['splitTextNodeIntoWordNodes'](_0x2bb35a){if(_0x2bb35a['isWordSplitSource']||_0x2bb35a['isWordSplitResult'])return[];const _0x48ea3b=_0x11c8f9(_0x2bb35a)['match'](/(?:\s*\S+\s*)/g),_0x312b52=[];if(_0x48ea3b&&_0x48ea3b['length']>0x1){for(const _0x1a2c75 of _0x48ea3b){const _0xb45cce=new _0x5a8104(_0x1a2c75);_0xb45cce['isWordSplitResult']=!0x0,_0x51f634(_0x2bb35a,_0xb45cce),_0x312b52['push'](_0xb45cce);}_0x2bb35a['isWordSplitSource']=!0x0,_0x32f2bc(_0x2bb35a);}return _0x312b52;}}const Es=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ws(_0x4ddba6){return _0x31735e(_0x4ddba6);}function Ts(_0x50aa77){return _0x4e8462(_0x50aa77);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x906718){super();const _0xccafee=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x906718,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0xccafee['if']('isDone','ck-ai-chat__feed__item_done'),_0xccafee['if']('isVisible','ck-hidden',_0x20c60c=>!_0x20c60c),'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'](_0xc0e11f=>{_0xc0e11f['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x3873fc,_0x25ff6c,_0x3b99af){await this['htmlStreamer']['stream']({'document':_0x3873fc,'targetElement':_0x25ff6c,'abortSignal':_0x3b99af});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0xae8adf,_0x1cb467){super(_0xae8adf),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0xae8adf),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Bi,'label':Hi(_0xae8adf,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x1cb467['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x3db343=>_0x3db343?_0x135466:_0x3c0485),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x26b8f1=new xt();_0x26b8f1['content']=_0x448da1,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x1cb467['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x26b8f1,{'tag':'span','children':[Hi(_0xae8adf,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends vt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const fs={'accepted':_0x2d73d7,'rejected':_0x1dbb45,'outdated':_0x1dbb45};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x345d0e){super(_0x345d0e);const _0x549134=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',_0x549134['to']('state',_0x24700d=>'ck-ai-suggestion__content-part-state_'+_0x24700d),_0x549134['if']('isVisible','ck-hidden',_0x9e74dd=>!_0x9e74dd)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x549134['to']('state',_0x2e0040=>{switch(_0x2e0040){case'accepted':return Hi(_0x345d0e,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Hi(_0x345d0e,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Hi(_0x345d0e,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x348304){this['state']=_0x348304;}}class StateIconView extends xt{constructor(){super(),this['set']('state','accepted'),this['content']=fs[this['state']],this['on']('change:state',()=>{this['content']=fs[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x29b023,_0x4d4ca2,_0xed1621){super(_0x29b023);const _0x46765d=Boolean(_0xed1621);this['set']('isEnabled',!_0x46765d),this['set']('isVisible',!0x0),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x85ff86=[];if(_0x46765d){const _0x9f1ccc=new vt(_0x29b023);_0x9f1ccc['set']({'label':Hi(_0x29b023,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x11ec0d}),_0x9f1ccc['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x85ff86['push'](_0x9f1ccc);}else{_0x4d4ca2['includes']('applySuggestion')&&(this['_applyButton']=new vt(_0x29b023),this['_applyButton']['set']({'label':Hi(_0x29b023,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2d73d7}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x85ff86['push'](this['_applyButton'])),_0x4d4ca2['includes']('insertSuggestion')&&(this['_suggestButton']=new vt(_0x29b023),this['_suggestButton']['set']({'label':Hi(_0x29b023,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x3c26bd}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x85ff86['push'](this['_suggestButton']));const _0x19d4a2=new vt(_0x29b023);_0x19d4a2['set']({'label':Hi(_0x29b023,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x1dbb45}),_0x19d4a2['bind']('isEnabled')['to'](this),_0x19d4a2['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x85ff86['push'](_0x19d4a2);}this['items']['addMany'](_0x85ff86);const _0x24c9cc=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x24c9cc['if']('isVisible','ck-hidden',_0x4bc2f4=>!_0x4bc2f4)]}});}['setButtonsVisibility']({showApplyButton:_0x1bcbc7,showSuggestButton:_0x6d6ad6}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x1bcbc7),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x6d6ad6);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x15b36a,{part:_0x2f844e,uiIndex:_0x5b9265,availableActions:_0x5686a9,areActionsDisabled:_0x5ab0c7}){super(_0x15b36a),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x15b36a,_0x5686a9,_0x5ab0c7),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x2f844e['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x2f844e['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x2f844e['index']});}),this['toolbarView']['bind']('isEnabled')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x15b36a),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x15b36a,_0x5b9265),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',(_0x36e109,_0x339dd3,_0xe7cd6d,_0x53a471)=>{'pending'===_0x53a471?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0xe7cd6d?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0xe7cd6d),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0x47d97a,_0x21b1a7){super(_0x47d97a),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Hi(_0x47d97a,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x21b1a7['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0x308813){super(_0x308813),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:_0x1f0624,renderingStrategy:_0x1a1d5a,abortSignal:_0x2ae4b9}){'streaming'===_0x1a1d5a?await this['htmlStreamer']['stream']({'document':_0x1f0624['content'],'targetElement':this['element'],'abortSignal':_0x2ae4b9}):_0x2d4ba4(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x1f0624['content'])+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='';}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x530cef,{part:_0x38291b,uiIndex:_0x28cdcc,areActionsDisabled:_0x1d4efb,availableActions:_0x4634a0}){super(_0x530cef);const _0x1dc6d6=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1);const _0x4f9f38=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x1d4efb;};this['on']('change:state',_0x4f9f38),this['on']('change:isDone',_0x4f9f38),_0x4f9f38(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x530cef,{'part':_0x38291b,'uiIndex':_0x28cdcc,'availableActions':_0x4634a0,'areActionsDisabled':_0x1d4efb}),this['_headerView']['bind']('isEnabled','state')['to'](this),this['_headerView']['delegate'](...Cs)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x530cef),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x1dc6d6['to']('state',_0x2cb17=>'ck-ai-suggestion__body__content-part_'+_0x2cb17),_0x1dc6d6['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x1dc6d6['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x1dc6d6['if']('isVisible','ck-hidden',_0x1c62ad=>!_0x1c62ad)]},'children':this['_children'],'on':{'mouseenter':_0x1dc6d6['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x38291b['index']});}),'mouseleave':_0x1dc6d6['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x38291b['index']});}),'click':_0x1dc6d6['to'](_0x231355=>{const _0x4af1cf=_0x231355['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x4af1cf)&&this['fire']('showChangeInText',{'index':_0x38291b['index']});})}});}async['updateContent']({part:_0x342282,showUnchangedParts:_0x4bc293=!0x1,abortSignal:_0x5e79ee}){this['partDefinition']=_0x342282,this['isVisible']=this['partDefinition']['hasChanges']||_0x4bc293,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x342282,'renderingStrategy':'static','abortSignal':_0x5e79ee});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0x321063,_0x4d4416){super(_0x321063),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x3268a7=>!_0x3268a7)]},'children':this['_createSkeletonItems'](_0x4d4416)});}['_createSkeletonItems'](_0x298c5c){const _0x5c1ffa=['ck','ck-ai-skeleton__item'];return _0x298c5c['map'](_0x67c418=>{let _0x1634aa='';switch(_0x67c418['attributes']['align']){case'right':_0x1634aa='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x1634aa='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x1634aa='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x67c418['tag'],'attributes':{'class':[..._0x5c1ffa,_0x67c418['attributes']['class']?_0x67c418['attributes']['class']:''],'style':'width:\x20'+_0x67c418['attributes']['width']+';\x20height:\x20'+_0x67c418['attributes']['height']+';'+_0x1634aa}};});}}const Ss={'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':Rs(0x5,'100%','44px','right'),'aiChatResources':Rs(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 Rs(_0x183ea2,_0x26ca43,_0x4371b8,_0x3613ef){return new Array(_0x183ea2)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x26ca43,'height':_0x4371b8,'align':_0x3613ef}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x3f2d09){const _0x36a02c=this['createTask'](_0x3f2d09);return this['queue']['push'](_0x36a02c),this['_processQueue'](),_0x36a02c['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(_0x4843b9=>{this['once']('_queueEmpty',()=>{_0x4843b9();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x3d06dc=this['queue']['shift']();try{await _0x3d06dc['callback'](this['_abortController']['signal']),_0x3d06dc['resolve']();}catch(_0x15e2aa){_0x3d06dc['reject'](_0x15e2aa);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0xf4871){let _0x400fae,_0x52bec1;const _0x4f220c=new Promise((_0x3d3268,_0x506191)=>{_0x400fae=_0x3d3268,_0x52bec1=_0x506191;});return{'callback':_0xf4871,'resolve':_0x400fae,'reject':_0x52bec1,'completePromise':_0x4f220c};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x10f7fa){super(_0x10f7fa),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x10f7fa['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x3cc0e5){this['element']['innerHTML']=_0x3cc0e5;}}const bs=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x3b10ac,_0x5d0e68=[...bs],_0x185c71){super(_0x3b10ac);const _0x51d80a=this['bindTemplate'],_0x45e0d5=Boolean(_0x185c71);if(this['set']('isEnabled',!_0x45e0d5),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x45e0d5){const _0x3c25af=new vt(_0x3b10ac);_0x3c25af['set']({'label':Hi(_0x3b10ac,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x11ec0d}),_0x3c25af['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x4282c0=new Nt(_0x3b10ac);_0x4282c0['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Hi(_0x3b10ac,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x3c25af]}]}),this['children']['add'](_0x4282c0);}else this['_applyChangesButton']=new vt(_0x3b10ac),this['_applyChangesButton']['set']({'label':Hi(_0x3b10ac,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5d0e68['includes']('applySuggestion'),'class':Mi}),this['_insertSuggestionsButton']=new vt(_0x3b10ac),this['_insertSuggestionsButton']['set']({'label':Hi(_0x3b10ac,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x5d0e68['includes']('insertSuggestion'),'class':Ui}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x4916e2=>{_0x4916e2['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',_0x51d80a['if']('isVisible','ck-hidden',_0x411247=>!_0x411247)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x1c51cf){this['isVisible']=_0x1c51cf;}['_switchButtonLabelsPlurality'](_0x229d87){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x229d87?(this['_applyChangesButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Hi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class AIWebSourcesView extends Nt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0xe41136,_0x2723db){super(_0xe41136),this['bodyCollection']=_0x2723db,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',_0x1fab2d=>!_0x1fab2d)]},'children':this['children']});const _0x35d2f3=new Nt(this['locale']),_0x21010c=new xt();_0x21010c['content']=_0x271520,_0x35d2f3['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x21010c,{'tag':'span','children':[{'text':Hi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x35d2f3),this['_setupBalloonPanel'](_0xe41136);}['addSource'](_0x5ce506){this['children']['add'](new AIWebSourceView(this['locale'],_0x5ce506,this['balloonPanelView']));}['_setupBalloonPanel'](_0x5b7fef){this['balloonPanelView']=new Xt(_0x5b7fef),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends vt{['balloonPanelView'];['source'];constructor(_0x23bc97,_0x387406,_0x446361){super(_0x23bc97),this['source']=_0x387406,this['balloonPanelView']=_0x446361,this['set']({'label':_0x387406['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x1f3048=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x1f3048['to'](()=>{window['open'](_0x387406['url'],'_blank');}),'mouseenter':_0x1f3048['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x1f3048['to'](()=>{this['_hideTooltip']();})}}),_0x387406['favicon']){const _0x3aafcb=new Nt(_0x23bc97);_0x3aafcb['setTemplate']({'tag':'img','attributes':{'src':_0x387406['favicon']||_0x271520,'alt':_0x387406['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x3aafcb);}else this['set']('icon',_0x271520);}['_createTooltipContentView'](_0x5560be,_0x55341d){const _0x3c408a=new Nt(_0x5560be),_0x2b0492=[];let _0x3cbf30;_0x55341d?.['favicon']?(_0x3cbf30=new Nt(_0x5560be),_0x3cbf30['setTemplate']({'tag':'img','attributes':{'src':_0x55341d['favicon'],'alt':_0x55341d['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x3cbf30=new xt(),_0x3cbf30['content']=_0x271520,_0x3cbf30['extendTemplate']({'attributes':{'alt':_0x55341d['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x2b0492['push'](_0x3cbf30);const _0x174115=new Nt(_0x5560be);_0x174115['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x55341d['url']},'children':[{'text':new URL(_0x55341d['url'])?.['hostname']}]}),_0x2b0492['push'](_0x174115);const _0x43b88f=new Nt(_0x5560be);_0x43b88f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x2b0492});const _0x281501=new Nt(_0x5560be);return _0x281501['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x55341d['title']['length']>0x190?_0x55341d['title']['substring'](0x0,0x190)+'...':_0x55341d['title']}]}),_0x3c408a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x43b88f,_0x281501]}),_0x3c408a;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[Xt['defaultPositions']['northArrowSouth'],Xt['defaultPositions']['northArrowSouthWest'],Xt['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 _0x4d3e88=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x4d3e88);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x3c2cd8(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x353ead,_0x39b50b){super(_0x353ead);const {areActionsDisabled:_0x1913ca,showUnchangedParts:_0x5ed599,availableActions:_0x542ef2}=_0x39b50b;this['_areActionsDisabled']=_0x1913ca,this['_showUnchangedParts']=_0x5ed599,this['_availableActions']=_0x542ef2,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x353ead,Ss['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':Hi(_0x353ead,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x353ead,_0x39b50b['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x39b50b['bodyCollection']),_0x39b50b['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Cs)['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'](_0x987948=>_0x987948 instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0x3c4d0c,abortSignal:_0x273e0b,skipLoadingEffects:_0x40dd24}){this['_cachedContentParts']['length']?_0x3c4d0c['forEach'](_0x2f94e1=>{const _0x17a0f6=this['_cachedContentParts']['findIndex'](_0x2d7481=>_0x2d7481['index']==_0x2f94e1['index']);-0x1===_0x17a0f6?this['_cachedContentParts']['push'](_0x2f94e1):this['_cachedContentParts'][_0x17a0f6]=_0x2f94e1;}):this['_cachedContentParts']=_0x3c4d0c;const _0x2d00a6=this['_showUnchangedParts']?_0x3c4d0c:_0x3c4d0c['filter'](_0xc2ff3f=>_0xc2ff3f['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x2d00a6['length']>0x1),_0x40dd24&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x3fe898 of _0x2d00a6)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x111c25=>{let _0x2142bb=this['getPartView'](_0x3fe898['index']);if(!_0x2142bb){if(_0x2142bb=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0x3fe898,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x2142bb['delegate'](...Cs)['to'](this),!_0x40dd24&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x111c25),_0x111c25['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x2142bb,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x40dd24||this['_showSkeletonDebounced']();}await _0x2142bb['updateContent']({'part':_0x3fe898,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x111c25}),_0x2142bb['markAsDone']();});return _0x273e0b?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x51f98e,_0x21e033){const _0x2d7142=this['getPartView'](_0x51f98e);_0x2d7142&&(_0x2d7142['state']=_0x21e033),this['hasPendingParts']='pending'==_0x21e033||this['_contentPartViews']['some'](_0x1ca184=>'pending'==_0x1ca184['state']);}['setPartActive'](_0x239856,_0x3abeaa){if(!0x1===_0x239856){for(const _0x3fe639 of this['_contentPartViews'])_0x3fe639['isActive']=!0x1;}else{const _0x20c15b=this['getPartView'](_0x239856);_0x20c15b&&(_0x20c15b['isActive']=_0x3abeaa);}}['updateSources'](_0x59e24c){_0x59e24c['forEach'](_0x1ac236=>this['_sourcesView']['addSource'](_0x1ac236)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x437333){return this['_contentPartViews']['find'](_0x5dff14=>_0x5dff14['partDefinition']['index']==_0x437333)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x37a79d=!this['_cachedContentParts']['find'](({hasChanges:_0x5e4f84})=>_0x5e4f84),_0x19b6b6=!!this['_cachedContentParts']['find'](({hasChanges:_0x4aaa19})=>!_0x4aaa19);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x19b6b6,_0x37a79d?this['_emptyPartsWarningView']['setContent'](Hi(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Hi(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x15bc25=>_0x15bc25['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x4c92cc){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x5b3120=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x5b3120>0x0){const {promise:_0x465e57,abortController:_0xe7123f}=ps(_0x5b3120);_0x4c92cc?.['addEventListener']('abort',()=>_0xe7123f['abort']()),await _0x465e57['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x3be455=>_0x3be455['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x279cf6,_0x19ea5b,_0xd2ae2d){super(_0x279cf6);const {showDiff:_0x4e08a9,areActionsDisabled:_0x4dbbe0,showUnchangedParts:_0x53f4c6,availableActions:_0x543488}=_0x19ea5b;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x279cf6,{'showDiff':_0x4e08a9}),this['headerView']['on']('toggleShowChanges',(_0x55f2b6,_0x2a9d4b)=>{this['areChangesVisible']=_0x2a9d4b['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x2a9d4b['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x279cf6,{'areActionsDisabled':_0x4dbbe0,'showUnchangedParts':!!_0x53f4c6,'availableActions':_0x543488,'bodyCollection':_0xd2ae2d}),this['bodyView']['delegate'](...Cs)['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'](_0x49dd09){await this['bodyView']['updateContentParts'](_0x49dd09);}['updateSources'](_0xc94903){this['bodyView']['updateSources'](_0xc94903);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x22345f,_0x563297,_0x13f28b){super(_0x563297),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x22345f,{'showDiff':_0x563297['showDiff'],'areActionsDisabled':_0x563297['areActionsDisabled'],'availableActions':_0x563297['availableActions']},_0x13f28b),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x3467e8,_0x4a9dae)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x4a9dae['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',(_0x22d732,{index:_0x1a54b8})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x1a54b8});}),this['containerView']['on']('applySuggestion',(_0x3f81e8,{index:_0x411791}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x411791});}),this['containerView']['on']('insertSuggestion',(_0x4de0a9,{index:_0x3e7638}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3e7638});}),this['containerView']['on']('rejectSuggestion',(_0x55dcdf,{index:_0x31efd7})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x31efd7});}),this['containerView']['on']('mouseOverSuggestion',(_0x208b83,{index:_0x1cdaa2})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1cdaa2});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x1729b5,{index:_0x3fdcc5})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3fdcc5});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x431799){await this['containerView']['updateContent'](_0x431799);}['updatePartState'](_0x39c8ce,_0x2d1528){this['containerView']['bodyView']['updatePartState'](_0x39c8ce,_0x2d1528);}['setPartActive'](_0x4d153c,_0x3cebbb){!0x1===_0x4d153c?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x4d153c,_0x3cebbb);}['updateSources'](_0x45278a){this['containerView']['updateSources'](_0x45278a);}['getPartView'](_0x40de1b){return this['containerView']['bodyView']['getPartView'](_0x40de1b);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0x5986a2,_0x2d9550,_0x168bb7){super(_0x2d9550),this['_bodyCollection']=_0x168bb7,this['locale']=_0x5986a2,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']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Fi(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x30c303,renderingStrategy:_0x1878e8,abortSignal:_0x5164fe}){'streaming'===_0x1878e8?await this['streamIntoElement'](_0x30c303,this['replyContainer']['element'],_0x5164fe):this['replyContainer']['element']['innerHTML']=ti(_0x30c303);}['updateSources'](_0x36af6b){const _0x18f46e=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x18f46e['children']['addMany'](_0x36af6b['map'](_0x32c83e=>new AIWebSourceView(this['locale'],_0x32c83e,_0x18f46e['balloonPanelView']))),_0x18f46e['isVisible']=!0x0,this['children']['add'](_0x18f46e);}}class AISpinnerView extends yt{constructor(_0x505c44=void 0x0){super();const _0x185470=_0x505c44?'ck-ai-spinner_'+_0x505c44:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x185470]}});}}const Os={'file':_0x5249ad,'document':_0x448da1,'web-resource':_0x1e2b51,'text':_0x5249ad,'selection':_0xf81085,'mcp-tool-context':_0x448da1},ks='ck-ai-chat-context-chip',vs='ck-ai-chat-context-chip_wide',Ns='ck-ai-chat-context-chip_document',ys='ck-ai-chat-context-chip__label',xs='ck-ai-chat-context-chip__type-icon',Ls='ck-ai-chat-context-controls__chip-tooltip',Ds='n';class AIChatContextItemButtonView extends vt{constructor(_0x950098,_0x34a45d,_0x2d0a07,_0x182d12,_0x29b113=!0x1){super(_0x950098),this['_isAnimationOnEnterEnabled']=_0x182d12,this['_initializeProperties'](_0x34a45d,_0x2d0a07,_0x29b113),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'](_0x1e4cb8,_0x355e72,_0x2c6b74){this['set']('label',_0x1e4cb8['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x1e4cb8['type']),this['set']('id',_0x1e4cb8['uiId']),this['set']('readonly',_0x355e72),this['set']('isLoading',_0x2c6b74);}['_setupTemplate'](){const _0xe52a7=this['_createIconView'](),_0x28335a=this['_createRemoveButton'](),_0x54af32=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x54af32),'children':this['_createTemplateChildren'](_0xe52a7,_0x28335a,_0x54af32)});}['_createTemplateAttributes'](_0x9e786d){return{'class':[ks,_0x9e786d['if']('itemType',Ns,_0x3c5e35=>'document'==_0x3c5e35),_0x9e786d['if']('itemType',vs,_0x31f6f0=>'selection'==_0x31f6f0)],'data-cke-tooltip-text':_0x9e786d['to']('label',Vs),'data-cke-tooltip-position':Ds,'data-cke-tooltip-class':Ls};}['_createTemplateChildren'](_0x4c8710,_0x519cd5,_0x18d21a){const _0x25b2ae=this['_createLabelElement'](_0x18d21a),_0x2e9778=this['_createLoaderIcon']();return this['readonly']?[_0x4c8710,_0x25b2ae]:[_0x4c8710,_0x2e9778,_0x25b2ae,_0x519cd5];}['_createLabelElement'](_0x571003){return{'tag':'span','attributes':{'class':ys},'children':[{'text':_0x571003['to']('label')}]};}['_createRemoveButton'](){const _0x296d43=new vt(this['locale']);return _0x296d43['set']({'label':Hi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x5ed072}),this['_setupRemoveButtonEvent'](_0x296d43),_0x296d43;}['_setupRemoveButtonEvent'](_0x4e800c){_0x4e800c['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x4e5c3e=this['bindTemplate'],_0x7a09d0=new xt();return _0x7a09d0['content']=Os[this['itemType']],_0x7a09d0['extendTemplate']({'attributes':{'class':[xs,_0x4e5c3e['if']('isLoading','ck-hidden',_0x1b3d62=>_0x1b3d62)]}}),_0x7a09d0;}['_handleAnimationEndOnce'](_0x2661eb,_0x472c57){if(!_0x2661eb)return;const _0x3c92d6=()=>{_0x472c57(),_0x2661eb['removeEventListener']('animationend',_0x3c92d6),_0x2661eb['removeEventListener']('webkitAnimationEnd',_0x3c92d6);};_0x2661eb['addEventListener']('animationend',_0x3c92d6),_0x2661eb['addEventListener']('webkitAnimationEnd',_0x3c92d6);}['_createLoaderIcon'](){const _0x27693f=new AISpinnerView('small');return _0x27693f['bind']('isVisible')['to'](this,'isLoading',_0xbfc1c4=>_0xbfc1c4),_0x27693f;}}function Vs(_0x25ed73){if(!_0x25ed73)return _0x25ed73;if(_0x25ed73['length']<=0x78)return _0x25ed73;const _0x4dce8f=_0x25ed73['slice'](0x0,0x78),_0x13d56f=_0x4dce8f['lastIndexOf']('\x20');return(_0x13d56f>0x0?_0x4dce8f['slice'](0x0,_0x13d56f):_0x4dce8f)+'…';}const Ps={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Hs='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x61d290,_0x478941,_0x254c90,_0x194a51,_0x5828ef){this['_locale']=_0x61d290,this['_visibleChips']=_0x478941,this['_config']={...Ps,..._0x254c90,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x254c90['cssClasses']}},this['_overflowChips']=new dt(),this['_bodyCollection']=_0x194a51,this['_parentView']=_0x5828ef||null;}['setContainerElement'](_0x181dae){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x181dae,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 _0xd01583=[...this['_visibleChips'],...this['_overflowChips']],_0x37499f=this['_createCalculationContainer'](),_0x445ba6=this['_calculateOverflowInContainer'](_0x37499f,_0xd01583),_0x47572c=_0x37499f['_ancestorsToRestore'];_0x47572c&&this['_restoreAncestorVisibility'](_0x47572c),_0x37499f['remove'](),this['_applyOverflowResults'](_0xd01583,_0x445ba6);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),zt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x35e406=new vt(this['_locale']);_0x35e406['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0xa8652=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0xa8652['push'](this['_config']['cssClasses']['controlsButton']),_0x35e406['extendTemplate']({'attributes':{'class':_0xa8652}}),_0x35e406;}['_createShowMoreBalloonPanelView'](){const _0x4a989d=new Xt(this['_locale']);return _0x4a989d['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x4a989d),_0x4a989d;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x5ea2a5=>{_0x5ea2a5['disableAnimationOnEnter']();});const _0x2646cf=new Nt(this['_locale']);_0x2646cf['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x2646cf);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x276197=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x276197?'':'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'](_0x5e1351){const _0x5e3d3a=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x1e09ea=this['_containerElement']?.['classList'];if(_0x1e09ea){const _0x1a85a0=_0x1e09ea[0x0]||'',_0x3f94ec=_0x5e1351['querySelector']('.'+_0x1a85a0),_0x3e15c9=_0x5e1351['querySelector'](_0x5e3d3a);return _0x3f94ec||_0x3e15c9||_0x5e1351;}return _0x5e1351['querySelector'](_0x5e3d3a)||_0x5e1351;}['_calculateContainerWidth'](){const _0x3cbe3f=this['_parentView']?.['element']||this['_containerElement'];if(!_0x3cbe3f)return Hs;const _0x5900b3=window['getComputedStyle'](_0x3cbe3f)['width'];if('auto'===_0x5900b3||'0px'===_0x5900b3||!_0x5900b3){const _0x23aa2c=_0x3cbe3f['parentElement'];if(_0x23aa2c){const _0x32fe71=window['getComputedStyle'](_0x23aa2c);return'auto'!==_0x32fe71['width']?_0x32fe71['width']:Hs;}return Hs;}return _0x5900b3;}['_applyCalculationStyles'](_0x4ef190,_0x59ff93){this['_config']['cssClasses']['calculationContainer']&&_0x4ef190['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x4ef190['style']['width']=_0x59ff93,_0x4ef190['style']['position']='absolute',_0x4ef190['style']['top']='-9999px',_0x4ef190['style']['left']='-9999px',_0x4ef190['style']['opacity']='0',_0x4ef190['style']['pointerEvents']='none',_0x4ef190['style']['zIndex']='-1',_0x4ef190['style']['visibility']='visible\x20!important',_0x4ef190['style']['display']='block\x20!important',_0x4ef190['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x1e3c8c){_0x1e3c8c['forEach'](({element:_0x3caf6b,originalDisplay:_0x217ff3,originalVisibility:_0x571cda})=>{_0x3caf6b['style']['display']=_0x217ff3,_0x3caf6b['style']['visibility']=_0x571cda;});}['_makeAncestorsVisible'](_0x56745e){const _0x3dfce7=[];let _0x38dbe9=_0x56745e;for(;_0x38dbe9&&_0x38dbe9!==document['body'];){const _0x59b38c=window['getComputedStyle'](_0x38dbe9);'none'!==_0x59b38c['display']&&'hidden'!==_0x59b38c['visibility']||(_0x3dfce7['push']({'element':_0x38dbe9,'originalDisplay':_0x38dbe9['style']['display'],'originalVisibility':_0x38dbe9['style']['visibility']}),_0x38dbe9['style']['display']='block',_0x38dbe9['style']['visibility']='visible'),_0x38dbe9=_0x38dbe9['parentElement'];}return _0x3dfce7;}['_createContainerElements'](){let _0x58d3c5,_0xfe29db;return this['_parentView']?.['element']?(_0x58d3c5=this['_parentView']['element']['cloneNode'](!0x0),_0xfe29db=this['_findTargetContainer'](_0x58d3c5)):(_0x58d3c5=document['createElement']('div'),_0xfe29db=_0x58d3c5),{'calculationContainer':_0x58d3c5,'targetContainer':_0xfe29db};}['_createCalculationContainer'](){const {calculationContainer:_0x323a8,targetContainer:_0x42db4e}=this['_createContainerElements'](),_0x28eb34=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x323a8,_0x28eb34);const _0x34d509=this['_parentView']?.['element']||this['_containerElement'],_0x1d2692=_0x34d509?.['parentElement'];_0x1d2692?_0x1d2692['appendChild'](_0x323a8):document['body']['appendChild'](_0x323a8),_0x323a8['_targetContainer']=_0x42db4e;const _0x46ceec=this['_makeAncestorsVisible'](_0x1d2692||null);return _0x323a8['offsetWidth'],_0x323a8['_ancestorsToRestore']=_0x46ceec,_0x323a8;}['_calculateOverflowInContainer'](_0xde5d57,_0x5b57a6){const _0x21aba7=_0xde5d57['_targetContainer']||_0xde5d57,_0x35a385=[],{rowCount:_0xb2fce7}=this['_renderChipsAndCountRows'](_0x21aba7,_0x5b57a6);if(_0xb2fce7<=this['_config']['maxVisibleRows'])return _0x35a385;const _0x171ea5=_0x5b57a6['slice']();for(;_0x171ea5['length']>0x0;){if(this['_testButtonFit'](_0xde5d57,_0x21aba7,_0x171ea5)){const _0x2e0094=_0x5b57a6['filter'](_0x510c65=>!_0x171ea5['includes'](_0x510c65));_0x35a385['push'](..._0x2e0094);break;}if(!_0x171ea5['pop']())break;}return _0x35a385;}['_renderChipsAndCountRows'](_0xf380b9,_0x1ac2ba){_0xf380b9['innerHTML']='',_0x1ac2ba['forEach'](_0x10afdc=>{if(_0x10afdc['element']){const _0x54fe02=_0x10afdc['element']['cloneNode'](!0x0);_0xf380b9['appendChild'](_0x54fe02);}}),_0xf380b9['offsetWidth'];const _0x4083d7=_0xf380b9['children'],_0x197a62=[];return Array['from'](_0x4083d7)['forEach'](_0x5c339c=>{const _0x2ea8a9=_0x5c339c['getBoundingClientRect']()['top'];_0x197a62['some'](_0xe5ae13=>Math['abs'](_0xe5ae13-_0x2ea8a9)<this['_config']['rowDetectionTolerance'])||_0x197a62['push'](_0x2ea8a9);}),{'rowCount':_0x197a62['length']};}['_createMockButton'](){const _0x4f3a46=document['createElement']('button');return _0x4f3a46['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x4f3a46['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x4f3a46['textContent']='+\x201',_0x4f3a46;}['_testButtonFit'](_0x4ccb08,_0x116da7,_0x3da7cb){this['_renderChipsAndCountRows'](_0x116da7,_0x3da7cb);const _0x5a65ef=this['_createMockButton']();_0x4ccb08['appendChild'](_0x5a65ef),_0x4ccb08['offsetWidth'];const _0x24b028=[..._0x116da7['children'],_0x5a65ef],_0x3425e6=[];_0x24b028['forEach'](_0xb05ca2=>{const _0x23a943=_0xb05ca2['getBoundingClientRect']()['top'];_0x3425e6['some'](_0x33c210=>Math['abs'](_0x33c210-_0x23a943)<this['_config']['rowDetectionTolerance'])||_0x3425e6['push'](_0x23a943);});const _0x2180eb=_0x3425e6['length'];return _0x5a65ef['remove'](),_0x2180eb<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x465f74,_0x1ff7f2){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x465f74['forEach'](_0x57dfb6=>{_0x1ff7f2['includes'](_0x57dfb6)?this['_overflowChips']['add'](_0x57dfb6):this['_visibleChips']['add'](_0x57dfb6);});}['_updateOverflowUI'](_0x4cd324){if(_0x4cd324>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x4cd324>0x0&&this['_showMoreButtonView']){const _0x1cca50=''+this['_config']['showMoreLabelPrefix']+(_0x4cd324<0x63?_0x4cd324:'99');this['_showMoreButtonView']['label']=_0x1cca50;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x2f1411,_0x21055f){this['_distributeChips'](_0x2f1411,_0x21055f),this['_updateOverflowUI'](_0x21055f['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x4524c7=>{_0x4524c7[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 _0x12e695=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x12e695['width']||0x0===_0x12e695['height'])return!0x1;const _0x21a9c2=window['innerHeight']||document['documentElement']['clientHeight'],_0x22a19f=window['innerWidth']||document['documentElement']['clientWidth'],_0x52c5fa=0xc8;return _0x12e695['bottom']>=-0xc8&&_0x12e695['top']<=_0x21a9c2+_0x52c5fa&&_0x12e695['right']>=-0xc8&&_0x12e695['left']<=_0x22a19f+_0x52c5fa;}}const Ms='ck-ai-chat__feed__context-chips',Us='ck-ai-chat-context-chips-wrapper',Bs='ck-ai-chat-context-chips-wrapper-balloon',Gs='ck-ai-chat-controls-button',Fs='ck-ai-chat-controls_context_show-more-button',Ks='ck-ai-chat-context-controls__show-more-balloon-panel';class AIChatFeedContextChipsView extends Nt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x2d0532,_0x3cc2db,_0x5bb0d2){super(_0x2d0532),this['_bodyCollection']=_0x5bb0d2,this['_createContextChips'](_0x3cc2db);const _0x17f9a1={'cssClasses':{'showMoreButton':Fs+'\x20'+Bi,'showMoreBalloon':Ks,'overflowContainer':Bs,'controlsButton':Gs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x2d0532,this['_contextChips'],_0x17f9a1,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[Ms,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Us},'children':this['_contextChips']}]});}['render'](){super['render']();const _0xe525cf=this['element']['querySelector']('.'+Us);_0xe525cf&&(this['_overflowManager']['setContainerElement'](_0xe525cf),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x9806d4){for(const _0x5689cf of _0x9806d4){const _0x2ffe12=new AIChatContextItemButtonView(this['locale'],_0x5689cf,!0x0,!0x1);this['_contextChips']['add'](_0x2ffe12);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x3412b7,_0x1826fb,_0x97cf7){super(_0x1826fb),this['_locale']=_0x3412b7,this['_bodyCollection']=_0x97cf7,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'](_0x3a1f89=>!_0x3a1f89['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-ai-chat__feed__message-content'}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}}class AIChatFeedInteractionHeaderView extends AIChatFeedItemView{['capabilities'];constructor(_0x18f1ea,_0x55f1cb){super(_0x55f1cb);const {isWebSearchEnabled:_0x243dee,isReasoningEnabled:_0x588d3f}=_0x55f1cb['capabilities'],_0x14593c=[];let _0x37e22c='';_0x243dee&&_0x588d3f?(_0x37e22c=Hi(_0x18f1ea,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x14593c['push'](Ws(_0x271520)),_0x14593c['push'](Ws(_0xeb7c36))):_0x243dee?(_0x37e22c=Hi(_0x18f1ea,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x14593c['push'](Ws(_0x271520))):_0x588d3f&&(_0x37e22c=Hi(_0x18f1ea,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x14593c['push'](Ws(_0xeb7c36))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x37e22c?'':'ck-hidden']}});const _0x2a3b6a=new Nt();_0x2a3b6a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x14593c,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x37e22c]}]}),this['children']['add'](_0x2a3b6a),this['capabilities']=_0x55f1cb['capabilities'];}}function Ws(_0x40efa3){const _0x3e13fc=new xt();return _0x3e13fc['content']=_0x40efa3,_0x3e13fc;}const Ys=['wheel','touchstart','pointerdown','keydown'],$s=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0xf99596){this['element']=_0xf99596,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x5a0400 of Ys){const _0x3659a9='keydown'!==_0x5a0400;this['element']['addEventListener'](_0x5a0400,this['_onUserEvent']['bind'](this),{'passive':_0x3659a9,'signal':this['abortController']['signal']});}}['start']({smooth:_0x3c2b9e=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x3c2b9e?'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'](_0x566d2a){if(this['isRunning']){if('keydown'===_0x566d2a['type']){const _0x56726a=_0x566d2a['key'];if(!$s['includes'](_0x56726a))return;}_0x566d2a instanceof WheelEvent?_0x566d2a['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0xc422b8,scrollHeight:_0x2275bf,clientHeight:_0x3579fe}=this['element'];return _0x2275bf-_0xc422b8-_0x3579fe<=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(_0x5527e0){super(_0x5527e0),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(_0x2afa80,_0xc6c807){super(_0x2afa80),this['_bodyCollection']=_0xc6c807,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...ms)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x376c69,_0x227711){let _0x1845c3;return'ai-reply'===_0x376c69?_0x1845c3=new AIChatFeedReplyItemView(this['locale'],_0x227711,this['_bodyCollection']):'ai-suggestion-reply'===_0x376c69?(_0x1845c3=new AIChatFeedSuggestionItemView(this['locale'],_0x227711,this['_bodyCollection']),_0x1845c3['bind']('isTrackChangesOn')['to'](this)):_0x1845c3='user-message'===_0x376c69?new AIChatFeedUserMessageItemView(this['locale'],_0x227711,this['_bodyCollection']):'interaction-header'===_0x376c69?new AIChatFeedInteractionHeaderView(this['locale'],_0x227711):'custom-element'===_0x376c69?new AIChatFeedCustomElementView(_0x227711):new AIChatFeedErrorItemView(_0x227711),this['children']['add'](_0x1845c3),_0x1845c3;}async['updateReplyItem']({id:_0x30091a,parsedContent:_0x3c8366,renderingStrategy:_0x18d0a2,abortSignal:_0x25f36c}){const _0x2e17a5=this['getItemById'](_0x30091a);if(!(_0x2e17a5 instanceof AIChatFeedReplyItemView))throw new at('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x2e17a5,'id':_0x30091a,'parsedContent':_0x3c8366});await _0x2e17a5['updateContent']({'parsedContent':_0x3c8366,'renderingStrategy':_0x18d0a2,'abortSignal':_0x25f36c});}async['updateWebSources'](_0x19ee7f,_0x4ecf8c){const _0x29691a=this['getItemById'](_0x19ee7f);if(_0x29691a instanceof AIChatFeedSuggestionItemView)_0x29691a['updateSources'](_0x4ecf8c);else{if(!(_0x29691a instanceof AIChatFeedReplyItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x29691a,'id':_0x19ee7f,'sources':_0x4ecf8c});_0x29691a['updateSources'](_0x4ecf8c);}}async['updateSuggestionItem']({id:_0x2e95c,parts:_0xd4175f,abortSignal:_0xd5e0cd,skipLoadingEffects:_0x12e5fe}){const _0x3951de=this['getItemById'](_0x2e95c);if(!(_0x3951de instanceof AIChatFeedSuggestionItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x3951de,'id':_0x2e95c,'parts':_0xd4175f});await _0x3951de['updateContent']({'parts':_0xd4175f,'abortSignal':_0xd5e0cd,'skipLoadingEffects':_0x12e5fe});}['updateSuggestionPartState']({id:_0x19852f,index:_0x235cc2,state:_0x2553fc}){const _0x50fec9=this['getItemById'](_0x19852f);if(!(_0x50fec9 instanceof AIChatFeedSuggestionItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x19852f});_0x50fec9['updatePartState'](_0x235cc2,_0x2553fc);}['setSuggestionPartActive']({id:_0x39ba6b,index:_0xb8b960,isActive:_0x31db54}){const _0x26153e=this['getItemById'](_0x39ba6b);if(!(_0x26153e instanceof AIChatFeedSuggestionItemView))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x39ba6b});this['children']['filter'](_0xb1b53f=>_0xb1b53f instanceof AIChatFeedSuggestionItemView)['forEach'](_0x41de41=>{_0x41de41['setPartActive'](!0x1);}),_0x26153e['setPartActive'](_0xb8b960,_0x31db54);}['markItemAsDone'](_0x1ab930){this['getItemById'](_0x1ab930)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x5ebdaa=>_0x5ebdaa['options']['id']);}['removeItem'](_0x40de3b){this['children']['remove'](this['getItemById'](_0x40de3b));}['hasItem'](_0x3215b2){return!!this['children']['find'](_0x4b22e0=>_0x4b22e0['options']['id']['includes'](_0x3215b2));}['scrollToSuggestion'](_0x7125f7,_0x293d97){const _0xc1f2c3=this['getItemById'](_0x7125f7);if(!(_0xc1f2c3 instanceof AIChatFeedSuggestionItemView))return void gt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x7125f7,'partIndex':_0x293d97});const _0x301308=_0xc1f2c3['getPartView'](_0x293d97);_0x301308?ft(_0x301308['element'],0x14,this['element']['parentElement'],!0x0,!0x0):gt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x7125f7,'partIndex':_0x293d97});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x2bd63f=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x2bd63f,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x69ccdc=new AISkeletonView(this['locale'],Ss['aiFeed']);return _0x69ccdc['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x69ccdc;}['_createFeedItems'](){const _0x4e35e1=new Nt(this['locale']);return _0x4e35e1['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x4e35e1;}['_createFeedLoader'](){const _0x41cc03=new Nt(this['locale']);return _0x41cc03['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x34c4d3=>!_0x34c4d3)]},'children':this['_createLoaderChildren']()}),_0x41cc03;}['_createLoaderChildren'](){const _0x34a7b1=new AISpinnerView();return _0x34a7b1['isVisible']=!0x0,[_0x34a7b1,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x4f6667){const _0x18021c=this['children']['find'](_0x15ca9a=>_0x15ca9a['options']['id']['includes'](_0x4f6667));if(!_0x18021c)throw new at('ai-chat-feed-view-item-not-found',this,{'id':_0x4f6667});return _0x18021c;}['setLoadingMessage'](_0x1274aa){this['set']('loadingMessage',_0x1274aa);}['toggleLoadingSkeleton'](_0xbaaa45){this['set']('isLoadingSkeletonVisible',_0xbaaa45);}['startAutoScroll'](_0x9bf273={}){this['scrollManager']['start'](_0x9bf273);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0x1451a7=0x0;for(const _0x3052a0 of this['items'])_0x1451a7+=_0x3052a0['items']['length'];return{'resultsCount':_0x1451a7,'totalItemsCount':_0x1451a7};}}const qs='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Lt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x27d929,_0x25930e){super(_0x27d929,{'queryView':{'label':'','creator':Ut,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x27d929),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x25930e,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',(_0x1a2f4b,_0x51c585)=>!_0x1a2f4b&&!_0x51c585),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x2f46ff,_0x543a1b)=>{this['isUploadInProgress']||this['isEmpty']||_0x2f46ff['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x543a1b());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();});}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x4dc563=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x4dc563)return this['queryView']['errorText']=Hi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x48c3fb=_0x19d831(_0x4dc563);this['fire']('sendUserMessage',_0x48c3fb),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0xb9f7cb){this['queryView']['fieldView']['set']('placeholder',_0xb9f7cb);}['focus'](_0x2c3636=!0x1){super['focus'](),_0x2c3636&&(this['element']['classList']['contains'](qs)||(this['element']['classList']['add'](qs),setTimeout(()=>{this['element']['classList']['remove'](qs);},0x320)));}['_createSubmitButton'](){const _0x2dc748=new vt(this['locale']);return _0x2dc748['set']({'icon':_0x177154,'label':Hi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Mi,'isEnabled':!0x1}),_0x2dc748['on']('execute',()=>{this['submit']();}),_0x2dc748;}['setIsUploadInProgress'](_0x505026){this['isUploadInProgress']=_0x505026;}['_setUpAddContextButtonPositioning'](){const _0x21745d=this['locale'],_0x178e37=()=>{ct['window']['requestAnimationFrame'](()=>{if(lt(this['element'])){const _0x590ef7=new ut(this['queryView']['fieldView']['element']),_0x4d57a1=new ut(this['_addContextButtonView']['element']),_0x291517=_0x590ef7['width'],_0x2ae9f4='rtl'===_0x21745d['uiLanguageDirection']?'right':'left';_0x590ef7['excludeScrollbarsAndBorders']();const _0x4adb82=_0x291517-_0x590ef7['width']+0x1;this['_addContextButtonView']['element']['style'][_0x2ae9f4]='calc('+(_0x291517-_0x4d57a1['width']-_0x4adb82)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x178e37),this['on']('render',()=>{_0x178e37(),this['_queryViewResizeObserver']=new St(this['queryView']['fieldView']['element'],()=>{_0x178e37();});});}}const Qs='ck-ai-chat__prompt-capabilities',Xs='ck-ai-chat-controls-button',zs='ck-ai-chat-controls-button--commands',js='ck-ai-chat-controls__model-selection',Js='ck-ai-chat-controls__model-selection__item-name',Zs='ck-ai-chat-controls__model-selection__item-description',tn='ck-ai-chat-controls__model-selection__item-capabilities',en='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x234556){super(_0x234556),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',_0x5b3003=>'selector'===_0x5b3003),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x53032f=>_0x53032f?this['_modelSelectionDropdown']['buttonView']['label']:Hi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x40354b=>_0x40354b),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x5995cb=>_0x5995cb),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x3d1ea1=>Hi(this['locale'],_0x3d1ea1?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x103d57=>_0x103d57),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x5caa03=>Hi(this['locale'],_0x5caa03?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Qs]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new dt(),jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x4601fe,_0x4a0ac7){if(_0x4a0ac7)this['set']('modelDisplayMode','hidden');else{const _0x3c1bb8=0x1===_0x4601fe['length'];this['set']('modelDisplayMode',_0x3c1bb8?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x4601fe?.['length'])for(const _0x3e9b21 of _0x4601fe){const _0xb83cfe=new Jt({'label':_0x3e9b21['name'],'withText':!0x0,'role':'menuitemradio','id':_0x3e9b21['id'],'model':_0x3e9b21});_0xb83cfe['bind']('isOn')['to'](this,'activeModelId',_0x58572d=>_0x58572d===_0x3e9b21['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0xb83cfe,'labelView':new sn(this['locale'],_0x3e9b21)});}}['setWebSearch'](_0xac9b7e){this['set']('webSearchActive',_0xac9b7e);}['setReasoning'](_0x139934){this['set']('reasoningActive',_0x139934);}['setModel'](_0x1810e4){if(!_0x1810e4)return;this['activeModelId']=_0x1810e4['id'],this['activeModelName']=_0x1810e4['name']||_0x1810e4['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x1810e4['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x1810e4['name']);const _0x29612f=_0x1810e4['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x29612f),this['_webSearchButton']['set']('isVisible',_0x29612f);const _0x1572ba=_0x1810e4['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x1572ba),this['_reasoningButton']['set']('isVisible',_0x1572ba);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x228784){this['set']('modelSelectorEnabled',!0x1),_0x228784&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x56ac48=new vt();return _0x56ac48['set']({'label':Hi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x271520,'class':Xs+'\x20'+Bi,'isToggleable':!0x0,'tooltipPosition':en}),_0x56ac48['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x56ac48;}['_createReasoningButton'](){const _0x489d90=new vt();return _0x489d90['set']({'label':Hi(this['locale'],'AI_CHAT_REASONING'),'icon':_0xeb7c36,'class':Xs+'\x20'+Bi,'isToggleable':!0x0,'tooltipPosition':en}),_0x489d90['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x489d90;}['_createCommandsButton'](){const _0x4258da=new vt();return _0x4258da['set']({'label':Hi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x348d31,'withText':!0x0,'class':Xs+'\x20'+Bi,'isToggleable':!0x0,'tooltip':Hi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':en}),_0x4258da['extendTemplate']({'attributes':{'class':[zs]}}),_0x4258da['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x4258da;}['_createModelSelectionDropdown'](){const _0x4fedd7=Gt(this['locale']);return _0x4fedd7['set']({'panelPosition':'ne','class':[js]}),_0x4fedd7['buttonView']['set']({'label':Hi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':en,'class':Bi}),this['listenTo'](_0x4fedd7,'execute',_0x13ff32=>{this['fire']('selectModel',_0x13ff32['source']['model']);}),_0x4fedd7;}['_createModelNameView'](){const _0x4636a2=new nn(this['locale']);return _0x4636a2['bind']('text')['to'](this,'activeModelName',_0x205f15=>_0x205f15??''),_0x4636a2['bind']('isVisible')['to'](this,'modelDisplayMode',_0x156edf=>'name'===_0x156edf),_0x4636a2;}}let sn=class ModelButtonLabelView extends Ht{constructor(_0x2ced18,_0x444985){super();const _0x3cf6a0=this['bindTemplate'],_0x4a8d04=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x3cf6a0['to']('style'),'id':_0x3cf6a0['to']('id')},'children':[{'tag':'div','attributes':{'class':[Js]},'children':[{'text':_0x3cf6a0['to']('text')}]},{'tag':'div','attributes':{'class':[Zs]},'children':[{'tag':'span','children':[{'text':_0x444985['description']}]}]},{'tag':'div','attributes':{'class':[tn]},'children':_0x4a8d04}]}),_0x4a8d04['addMany'](this['_getCapabilityParts'](_0x2ced18,_0x271520,'AI_CHAT_SEARCH_WEB',_0x444985['capabilities']['webSearch']?.['enabled']??!0x1)),_0x4a8d04['addMany'](this['_getCapabilityParts'](_0x2ced18,_0xeb7c36,'AI_CHAT_REASONING',_0x444985['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x47df0c,_0x5cc783,_0x39d830,_0x52478a){const _0xb65507=new xt();_0xb65507['content']=_0x5cc783;const _0x5cff76=new Nt(_0x47df0c);_0x5cff76['setTemplate']({'tag':'span','children':[{'text':Hi(_0x47df0c,_0x39d830)+':\x20'}]});const _0x5e2476=new Nt(_0x47df0c);return _0x5e2476['setTemplate']({'tag':'span','children':[{'text':Hi(_0x47df0c,_0x52478a?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0xb65507,_0x5cff76,_0x5e2476];}},nn=class ModelNameView extends Nt{constructor(_0x37eff4){super(_0x37eff4),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x1a55e4=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x1a55e4['if']('isVisible','ck-hidden',_0x25001e=>!_0x25001e)]},'children':[{'text':_0x1a55e4['to']('text')}]});}};const rn='ck-ai-chat-context-controls__url-form',on='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x1399ed){super(_0x1399ed),this['focusTracker']=new _t(),this['keystrokes']=new It(),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 Mt({'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'](_0x2af54e=>{this['focusTracker']['add'](_0x2af54e['element']),this['keystrokes']['listenTo'](_0x2af54e['element']);}),Zt({'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'](_0x43639e){this['urlInputField']['errorText']=_0x43639e,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x29c362=new vt(this['locale']);return _0x29c362['set']({'icon':_0x1607c0,'tooltip':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x5c86fa,_0x2ed63f,_0x1f27e6)=>{_0x29c362['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x1f27e6?'':'\x20ck-hidden')]});}),_0x29c362;}['_createUrlInputField'](){const _0x321dd5=new te(this['locale'],_0x123337);return _0x321dd5['set']({'label':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x321dd5['fieldView']['set']({'placeholder':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x321dd5;}['_createConfirmButton'](){const _0x32cc17=new vt(this['locale']);return _0x32cc17['set']({'icon':_0x4ab520,'tooltip':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x32cc17;}['_setupTemplate'](){const _0x450790=new _0x3e7902(this['locale'],{'label':Hi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x450790['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':rn,'tabindex':'-1'},'children':[_0x450790,{'tag':'div','attributes':{'class':on},'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',_0x31b84c=>{_0x31b84c['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x145135,_0xa7f302)=>{this['clear'](),this['fire']('cancel'),_0xa7f302();});}['_handleSubmit'](){const _0x4b9a42=this['getValue']()['trim']();_0x4b9a42?this['_isValidUrl'](_0x4b9a42)?(this['clearError'](),this['fire']('submitUrl',_0x4b9a42)):this['setError'](Hi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Hi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x4deef0=this['getValue']()['trim'](),_0x519137=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x4deef0['length']>0x0&&!_0x519137;}['_isValidUrl'](_0x32cc01){try{return!!new URL(_0x32cc01);}catch{return!0x1;}}}const an='ck-ai-chat-resources__item',hn='ck-ai-chat-resources__item--in-context',cn='ck-ai-chat-resources__item-title',ln='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Pt{['resource'];['_titleView'];['_iconView'];constructor(_0x40116e,_0x25927e){super(_0x40116e),this['resource']=_0x25927e,this['set']('isInContext',!!_0x25927e['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x47630a){if(_0x47630a['isInContext'])return _0x4ab520;switch(_0x47630a['type']){case'document':return _0x448da1;case'web-resource':return _0x1e2b51;case'file':case'text':return _0x5249ad;default:return _0x1c299b;}}['highlightText'](_0x212bfe){if(!_0x212bfe||''===_0x212bfe['trim']())return void this['_titleView']['highlightText'](null);const _0x25e130=new RegExp(_0x118ed5(_0x212bfe),'gi');this['_titleView']['highlightText'](_0x25e130);}['updateResourceState'](_0x1a32c2){this['resource']['isInContext']=_0x1a32c2,this['isInContext']=_0x1a32c2,this['_updateIcon']();}['_createTitleView'](){const _0x462032=new _0x2cc319();return _0x462032['text']=this['resource']['label'],_0x462032['extendTemplate']({'tag':'span','attributes':{'class':[cn]}}),_0x462032;}['_createIconView'](){const _0x2feaab=new xt();return _0x2feaab['content']=this['getResourceIcon'](this['resource']),_0x2feaab;}['_setupTemplate'](){const _0x53c4be=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[an,_0x53c4be['if']('isVisible','ck-hidden',_0x4c06a0=>!_0x4c06a0),_0x53c4be['if']('isInContext',hn)]},'children':[{'tag':'div','attributes':{'class':[ln]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x53c4be['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const un='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0xe05a9a,_0x2cf4bd){super(_0xe05a9a),this['_source']=_0x2cf4bd,this['extendTemplate']({'attributes':{'class':[un]}});}['setResources'](_0x5c6cb7,_0x5ca2b2){this['items']['clear']();let _0x47bb7d=_0x5c6cb7;if(this['_source']['useDefaultFiltering']&&_0x5ca2b2&&''!==_0x5ca2b2['trim']()){const _0xbb90ea=new RegExp(_0x5ca2b2['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x47bb7d=_0x5c6cb7['filter'](_0x120934=>_0xbb90ea['test'](_0x120934['label']));}for(const _0x1819b4 of _0x47bb7d){const _0xb0f898=new AIChatResourceListItemView(this['locale'],_0x1819b4);_0xb0f898['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x1819b4);}),this['items']['add'](_0xb0f898);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x5ca2b2);}['highlightText'](_0x286d02){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x4d51d9=>{_0x4d51d9['highlightText'](_0x286d02);});}['updateResourceState'](_0x1ed831,_0x143924){for(const _0x449fc5 of this['items']){const _0x135279=_0x449fc5;_0x135279['resource']['id']===_0x1ed831&&_0x135279['updateResourceState'](_0x143924);}}['_handleResourceSelection'](_0x2606b4,_0x30eeee){this['fire']('addResourceToContext',{'source':_0x2606b4,'resource':_0x30eeee});}}class AIChatContextResourcesSearchInputView extends te{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x43d107){const t=_0x43d107['t'],_0x3a0c41={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x123337,'label':Hi(_0x43d107,'AI_CHAT_SEARCH_RESOURCES')};super(_0x43d107,_0x3a0c41['creator']),this['label']=_0x3a0c41['label'],this['_viewConfig']=_0x3a0c41,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x43d107,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x44d659){this['fire']('search',_0x44d659);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new xt(),this['iconView']['content']=_0x10b46f,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x5c9425,t){this['resetButtonView']=new vt(_0x5c9425),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x5ed072,'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',_0x74915b=>!_0x74915b),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(_0x17788e,_0x21a9f8){super(_0x17788e),this['_source']=_0x21a9f8['source'],this['_searchInputVisibleFrom']=_0x21a9f8['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 _0x184ac3([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 _0x2e91e2=new Nt(this['locale']);return _0x2e91e2['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x378408,_0x56ff96)=>{this['loadResources'](_0x56ff96),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x56ff96);}),_0x2e91e2;}['_createResourcesListView'](){const _0x56a728=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x56a728['delegate']('addResourceToContext')['to'](this),_0x56a728['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x56a728;}['_createSkeletonView'](){const _0x13b7fd=new AISkeletonView(this['locale'],Ss['aiChatResources']);return _0x13b7fd['bind']('isVisible')['to'](this,'isLoading'),_0x13b7fd;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x391fa){const _0x472736=ot();this['_latestLoadResourcesUid']=_0x472736,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x391fa,'uid':_0x472736}),this['isLoading']=!0x0;}['setResources'](_0x4ae5cf,_0x56f455){if(_0x56f455&&_0x56f455!==this['_latestLoadResourcesUid'])return;const _0x5a8155=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x4ae5cf,_0x5a8155),_0x4ae5cf['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x557d59,_0x3cd384){this['_resourcesListView']['updateResourceState'](_0x557d59,_0x3cd384);}}const dn='ck-ai-chat-context-controls__source-balloon-panel',_n='ck-button-icon\x20ck-button-back',In='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x3b95f6,_0x5da052,_0x3fc6e4){this['_locale']=_0x3b95f6,this['_bodyCollection']=_0x5da052,this['_config']=_0x3fc6e4;}['showSourceResourcesBalloon']({source:_0x3a98d0,withBackButton:_0x36006e}){let _0x1acb8d=this['_sourceResourceBalloons']['get'](_0x3a98d0['id']);_0x1acb8d||(_0x1acb8d=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x3a98d0['id'],_0x1acb8d),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x1acb8d)),this['_addSourceResourceContent']({'balloonPanel':_0x1acb8d,'source':_0x3a98d0,'withBackButton':_0x36006e}),_0x1acb8d['show']();const _0x1ab6ba=this['_config']['getTargetElement']();_0x1ab6ba&&_0x1acb8d['pin']({'target':_0x1ab6ba,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x5a4874,_0x16cab6,_0x2deed9){const _0x4b14e2=this['_sourceResourceBalloons']['get'](_0x5a4874);if(!_0x4b14e2)return;const _0x51c74a=this['_getResourcesViewFromBalloon'](_0x4b14e2);_0x51c74a&&(_0x51c74a['setResources'](_0x16cab6,_0x2deed9),_0x51c74a['once']('change:isLoading',()=>{_0x4b14e2['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x316e06){const _0x13e7d3=this['_sourceResourceBalloons']['get'](_0x316e06);_0x13e7d3&&requestAnimationFrame(()=>{_0x13e7d3['hide'](),this['_sourceResourceBalloons']['delete'](_0x316e06),this['_config']['onBalloonClosed']();});}['isAnyResourceBalloonVisible'](){for(const _0x4d6ca6 of this['_sourceResourceBalloons']['values']())if(_0x4d6ca6['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0xa14c87,_0x184609,_0x18a24f){const _0x1dc962=this['_sourceResourceBalloons']['get'](_0xa14c87);if(!_0x1dc962||!_0x1dc962['isVisible'])return;const _0x190fcf=this['_config']['getTargetElement']();if(!_0x190fcf)return;_0x1dc962['pin']({'target':_0x190fcf,'limiter':this['_config']['getLimiterElement']()});const _0x2edf9a=this['_getResourcesViewFromBalloon'](_0x1dc962);_0x2edf9a&&_0x2edf9a['updateResourceState'](_0x184609,_0x18a24f);}['destroy'](){for(const _0x401d75 of this['_sourceResourceBalloons']['values']())_0x401d75['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0xbd530=new Xt(this['_locale']);return _0xbd530['extendTemplate']({'attributes':{'class':dn}}),this['_bodyCollection']['add'](_0xbd530),_0xbd530;}['_addSourceResourceContent']({balloonPanel:_0xaf94fb,source:_0x414212,withBackButton:_0x2943f1}){_0xaf94fb['content']['clear']();const _0x2eef26=this['_createBalloonHeader']({'balloonPanel':_0xaf94fb,'source':_0x414212,'withBackButton':_0x2943f1});_0xaf94fb['content']['add'](_0x2eef26);const _0xe6e3ec=this['_createBalloonResourcesView'](_0x414212);_0xaf94fb['content']['add'](_0xe6e3ec);}['_createBalloonHeader']({balloonPanel:_0xb9dca0,source:_0x2f7f56,withBackButton:_0x4e1cbd}){const _0x1c8da6=new _0x3e7902(this['_locale'],{'label':_0x2f7f56['label'],'class':In});return _0x4e1cbd&&_0x1c8da6['children']['add'](this['_createBackButton'](_0xb9dca0),0x0),_0x1c8da6;}['_createBackButton'](_0x1d1d2a){const _0x33af41=new vt(this['_locale']);return _0x33af41['set']({'icon':_0x1607c0,'tooltip':Hi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':_n}),_0x33af41['on']('execute',()=>{_0x1d1d2a['hide'](),this['_config']['onBackToContext']();}),_0x33af41;}['_createBalloonResourcesView'](_0xda9a7a){const _0xf21f95=new AIChatContextResourcesView(this['_locale'],{'source':_0xda9a7a,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0xf21f95['on']('loadSourceResources',(_0x5aa97a,_0x5d38f3)=>{this['_config']['onLoadSourceResources'](_0x5d38f3);}),_0xf21f95['on']('addResourceToContext',(_0xac9b54,_0xd72f6e)=>{this['_config']['onResourceSelected'](_0xd72f6e['source'],_0xd72f6e['resource']),this['closeSourceResourceBalloon'](_0xda9a7a['id']);}),_0xf21f95;}['_getResourcesViewFromBalloon'](_0x5720d2){const _0x86392a=_0x5720d2['content']['get'](0x1);return _0x86392a instanceof AIChatContextResourcesView?_0x86392a:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x3fd579){zt({'emitter':_0x3fd579,'contextElements':[_0x3fd579['element']],'callback':()=>{_0x3fd579['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x3fd579['isVisible']});}}const An=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],gn='ck-ai-chat-context-controls',Cn='ck-ai-chat-context-controls__pending-contexts',mn='ck-ai-chat-context-controls__add-context-balloon-panel',pn='ck-ai-chat-context-controls__add-context-button',En='ck-ai-chat-context-controls__url-balloon-panel',wn='ck-ai-chat-context-controls__balloon-button',Tn='ck-ai-chat-context-controls__balloon-button-source',fn='ck-ai-chat-controls-button',Sn='ck-ai-chat-context-chips-wrapper-balloon',Rn='ck-ai-chat-controls_context_show-more-button',bn='ck-ai-chat-context-controls__show-more-balloon-panel',On='ck-ai-chat',kn=[Xt['defaultPositions']['northArrowSouthWest'],Xt['defaultPositions']['northArrowSouth'],Xt['defaultPositions']['northArrowSouthEast'],Xt['defaultPositions']['southArrowNorthWest'],Xt['defaultPositions']['southArrowNorth'],Xt['defaultPositions']['southArrowNorthEast']];class AIChatContextPanelView extends Nt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x1cb278,_0x2ba44d){super(_0x1cb278),this['bodyCollection']=_0x2ba44d['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x1cb278),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x1cb278),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x1cb278),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x1cb278,_0x2ba44d);const _0x59c13d={'cssClasses':{'showMoreButton':Rn+'\x20'+Bi,'showMoreBalloon':bn,'overflowContainer':Sn,'controlsButton':fn}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x1cb278,this['_currentContextsChips'],_0x59c13d,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'](_0xffaeb7,_0x3faa1e){const _0x44669e=this['_createContextButton'](_0xffaeb7,'current',!0x0,_0x3faa1e);this['_addContextToCollection'](_0x44669e,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x196b10){this['_removeContextFromCollection'](_0x196b10,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x196b10,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x4677cc,_0x200d4b){let _0x487e1b=this['_currentContextsChips']['find'](_0x5c884d=>_0x5c884d['id']===_0x4677cc);_0x487e1b||(_0x487e1b=this['_overflowManager']['overflowChips']['find'](_0x517d54=>_0x517d54['id']===_0x4677cc)),_0x487e1b&&(_0x487e1b['isLoading']=_0x200d4b);}['setConversationContext'](_0x26f000){this['_conversationContextsChips']['clear']();for(const _0x32a51d of _0x26f000){const _0x5a5caa=this['_createContextButton'](_0x32a51d,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x5a5caa,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x343f2b,_0x42bf97,_0x5ccac3){this['_resourcesBalloonView']['updateResourceState'](_0x343f2b,_0x42bf97,_0x5ccac3);}['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;}['_showSourceResourcesBalloon']({source:_0x5467e4,withBackButton:_0x245a01}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x5467e4,'withBackButton':_0x245a01}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x356d9e,_0x3acd7f,_0x44c7bc,_0x4fdd1c){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x356d9e,_0x44c7bc,_0x4fdd1c);}['closeSourceResourceBalloon'](_0x142438){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x142438),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x461b3d){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x461b3d),this['_setAddContextButtonEnabled'](_0x461b3d);}['_setAddContextButtonEnabled'](_0x32b3e8){const _0x3f66ba=!_0x32b3e8['document']['isHidden']&&_0x32b3e8['document']['enabled'],_0x332472=_0x32b3e8['urls']['enabled'],_0x29b656=_0x32b3e8['files']['enabled'],_0x1ea182=_0x32b3e8['sources']['length']>0x0,_0x541f88=_0x32b3e8['customItems']&&_0x32b3e8['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x3f66ba||_0x332472||_0x29b656||_0x1ea182||_0x541f88;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[gn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Cn},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x5ebb03){const _0x520618=new vt(_0x5ebb03);return _0x520618['set']({'label':Hi(_0x5ebb03,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':fn+'\x20'+pn+'\x20'+Bi,'icon':_0x5718be,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x520618;}['_createAddContextBalloonPanelView'](_0x185d83){return this['_createBaseBalloonPanel'](_0x185d83,mn);}['_createUrlBalloonPanelView'](_0x49a7fb){const _0x3e9248=this['_createBaseBalloonPanel'](_0x49a7fb,En);return this['_addUrlContent'](_0x3e9248,_0x49a7fb),_0x3e9248;}['_createResourcesBalloonView'](_0x4e2487,_0x1e7d9d){const _0x5d440f={'searchInputVisibleFrom':_0x1e7d9d['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn});},'onResourceSelected':(_0x41fa7e,_0xa20132)=>{this['fire']('addResourceToContext',{'source':_0x41fa7e,'resource':_0xa20132});},'onLoadSourceResources':_0x1d25a3=>{this['fire']('loadSourceResources',_0x1d25a3);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0x4e2487,_0x1e7d9d['bodyCollection'],_0x5d440f);}['_getLimiterElement'](){return this['element']?.['closest']('.'+On)||document['body'];}['_createBaseBalloonPanel'](_0xc3fbb0,_0x1b9d76){const _0xd356c2=new Xt(_0xc3fbb0);return _0xd356c2['extendTemplate']({'attributes':{'class':_0x1b9d76}}),this['bodyCollection']['add'](_0xd356c2),_0xd356c2;}['_setBalloonPanelContent'](_0x2fc140,_0x463fb1,_0x2cce21){if(_0x2fc140['content']['clear'](),!_0x2cce21['document']['isHidden']&&_0x2cce21['document']['enabled']){const _0x344f48=this['_createBalloonButton'](_0x463fb1,{'label':Hi(_0x463fb1,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x448da1});_0x344f48['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x2fc140['content']['add'](_0x344f48);}if(_0x2cce21['urls']['enabled']){const _0x29593c=this['_createBalloonButton'](_0x463fb1,{'label':Hi(_0x463fb1,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x1e2b51});_0x29593c['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn}),this['_urlInputView']['focus']();}),_0x2fc140['content']['add'](_0x29593c);}if(_0x2cce21['files']['enabled']){const _0x22e10b=new _0x4509d1(_0x463fb1);_0x22e10b['set']({'label':Hi(_0x463fb1,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x16f379,'withText':!0x0,'tooltip':!0x0,'class':wn,'allowMultipleFiles':!0x0}),_0x22e10b['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x22e10b['on']('done',(_0x520bd2,_0x1e9d22)=>{this['fire']('addFileToContext',_0x1e9d22);}),_0x22e10b['tooltip']=!0x0,_0x2fc140['content']['add'](_0x22e10b);}for(const _0x158926 of _0x2cce21['sources']){const _0x2d7119=this['_createBalloonButton'](_0x463fb1,{'label':_0x158926['label'],'icon':_0x158926['icon']||_0x1c299b,'type':'source'});_0x2fc140['content']['add'](_0x2d7119),_0x2d7119['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x158926,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x2e7b14 of _0x2cce21['customItems']||[]){const _0x599af3=this['_createBalloonButton'](_0x463fb1,{'label':_0x2e7b14['label'],'icon':_0x2e7b14['icon']||_0x1c299b,'type':'customItem'});_0x2fc140['content']['add'](_0x599af3),_0x599af3['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x2e7b14);});}this['_hasExactlyOneSource']=0x1===_0x2fc140['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x10ad27,_0x5e7b72){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x5e7b72),this['_urlInputView']['on']('submitUrl',(_0x3e4320,_0x1b5ac3)=>{this['_handleUrlSubmit'](_0x1b5ac3);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn});}),_0x10ad27['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x368514,_0x4a309a){const _0x17a4f6='source'===_0x4a309a['type']?new SourcesBalloonButtonView(_0x368514):new vt(_0x368514);return _0x17a4f6['set']({'label':_0x4a309a['label'],'icon':_0x4a309a['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':wn}),_0x17a4f6;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){zt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x57daa5){const _0x4b69d1=this['_addContextBalloonConfig'];_0x4b69d1['buttonView']['isOn']=_0x57daa5,_0x57daa5?_0x4b69d1['balloonView']['show']():_0x4b69d1['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x2fae7b,buttonView:_0x285ad8,hideMethod:_0x46cdd1}=this['_addContextBalloonConfig'];zt({'emitter':_0x2fae7b,'contextElements':[_0x2fae7b['element'],_0x285ad8['element']],'callback':()=>{_0x46cdd1();},'activator':()=>_0x285ad8['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x1c9768,_0x369a6d,_0x26af15=!0x1,_0x2bdb53=!0x1){const _0x2fa173='conversation'===_0x369a6d||!0x0===_0x1c9768['isReadOnly'],_0x4dc83f=new AIChatContextItemButtonView(this['locale'],_0x1c9768,_0x2fa173,_0x26af15,_0x2bdb53);return _0x2fa173||_0x4dc83f['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x4dc83f['id']);}),_0x4dc83f;}['_addContextToCollection'](_0x285089,_0x2ec60e){_0x2ec60e['add'](_0x285089,0x0);}['_removeContextFromCollection'](_0x18f80b,_0x1fb5cd){const _0x2d98cb=_0x1fb5cd['find'](_0x4c9e73=>_0x4c9e73['id']===_0x18f80b);_0x2d98cb&&_0x1fb5cd['remove'](_0x2d98cb);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':kn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x21a0a6){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x21a0a6);}}class SourcesBalloonButtonView extends vt{['arrowView'];constructor(_0x36b8dd){super(_0x36b8dd),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Tn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x248275=new xt();return _0x248275['content']=_0x4e78fd,_0x248275['extendTemplate']({'attributes':{'class':Tn+'__arrow'}}),_0x248275;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0x424e6d){super(_0x424e6d),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 _0x5e2c1b=new vt(this['locale']);return _0x5e2c1b['set']({'label':Hi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Ui+'\x20ck-ai-button-stop-generating','icon':_0x1b062b}),_0x5e2c1b['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x5e2c1b;}['_createLoaderView'](){const _0x457e93=new Nt(this['locale']);return _0x457e93['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':Hi(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x457e93;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];constructor(_0x22a47c,_0x56ea02){super(_0x22a47c),this['_contextPanelView']=this['_createContextPanelView'](_0x22a47c,{'bodyCollection':_0x56ea02['bodyCollection'],'searchInputVisibleFrom':_0x56ea02['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x22a47c),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x22a47c),this['_loaderView']=this['_createLoaderView'](_0x22a47c),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x22a47c),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage')['to'](this),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'](...An)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x76c960=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x76c960['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x76c960['if']('isLoading','ck-hidden',_0x4238ce=>_0x4238ce||!this['isModelAvailable']),_0x76c960['if']('isModelAvailable','ck-hidden',_0x112e20=>!_0x112e20||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x76c960['if']('isLoading','ck-hidden',_0x5e20e2=>!_0x5e20e2)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x76c960['if']('isModelAvailable','ck-hidden',_0x2003cc=>_0x2003cc)]},'children':[this['_modelUnavailableMessageView']]}]}),zt({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['_createContextPanelView'](_0x322a6d,_0x4273f5){return new AIChatContextPanelView(_0x322a6d,_0x4273f5);}['_createPromptInputView'](_0x6bc6b1){return new AIChatPromptInputView(_0x6bc6b1,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x4d4e66){return new AIChatPromptCapabilitiesView(_0x4d4e66);}['_createLoaderView'](_0x1dad9b){return new AIChatControlsLoaderView(_0x1dad9b);}['_createModelUnavailableMessageView'](_0x39f6fe){const _0x38140c=new AIChatModelUnavailableMessageView(_0x39f6fe);return _0x38140c['delegate']('startConversation')['to'](this),_0x38140c;}['_handlePromptInputFocus'](_0x11b29e,_0x49e8c2,_0x1e7e06){_0x1e7e06?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x27ed4c,_0x3e8ad7){this['_contextPanelView']['addContextItem'](_0x27ed4c,_0x3e8ad7);}['removeContextItem'](_0x23ebf3){this['_contextPanelView']['removeContextItem'](_0x23ebf3);}['setContextItemLoading'](_0x55b4fd,_0x11b798){this['_contextPanelView']['setContextItemLoading'](_0x55b4fd,_0x11b798);}['setIsUploadInProgress'](_0x1b2787){this['_promptInputView']['setIsUploadInProgress'](_0x1b2787);}['setConversationContext'](_0x286024){this['_contextPanelView']['setConversationContext'](_0x286024);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x5ecbe8,_0x44ee0f,_0x219733){this['_contextPanelView']['updateResourceState'](_0x5ecbe8,_0x44ee0f,_0x219733);}['setWebSearch'](_0x4a2def){this['_promptCapabilitiesView']['setWebSearch'](_0x4a2def);}['setReasoning'](_0x5ef077){this['_promptCapabilitiesView']['setReasoning'](_0x5ef077);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x3b76c9){this['_contextPanelView']['setAddContextOptions'](_0x3b76c9);}['setInputPlaceholder'](_0x332bce){this['_promptInputView']['setPlaceholderText'](_0x332bce);}['setModelList'](_0x127ce3,_0x4457c7){this['_promptCapabilitiesView']['setModelList'](_0x127ce3,_0x4457c7);}['setModel'](_0x2bfba0){_0x2bfba0?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x2bfba0)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x497751){this['_promptCapabilitiesView']['disableModelSelector'](_0x497751);}['populateSourceResourceBalloon'](_0x752bd2,_0xf989f4,_0x198c61,_0x5090ab){this['_contextPanelView']['populateSourceResourceBalloon'](_0x752bd2,_0xf989f4,_0x198c61,_0x5090ab);}['closeSourceResourceBalloon'](_0x42abc7){this['_contextPanelView']['closeSourceResourceBalloon'](_0x42abc7);}['focusPromptInput'](_0xfd323f=!0x1){this['_promptInputView']['focus'](_0xfd323f);}['setPromptInputValue'](_0x5aacfc){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x5aacfc;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0x29e53d){super(_0x29e53d);const _0x44082e=new vt(_0x29e53d);_0x44082e['set']({'label':Hi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x44082e['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Hi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x44082e]}]});}}class AIHeaderView extends _0x3e7902{['resizeButton'];constructor(_0xb600a8,_0x4cb618){super(_0xb600a8,{'label':_0x4cb618['label'],'class':'ck-ai-header\x20'+_0x4cb618['class'],'icon':_0x4cb618['icon']}),this['set']('isMaximized',!0x1),_0x4cb618['content']&&this['children']['add'](_0x4cb618['content']),_0x4cb618['showResizeButton']&&(this['resizeButton']=Gi(_0xb600a8,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x4d22be){super(_0x4d22be),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Hi(_0x4d22be,'AI_DISCLAIMER_TEXT')}]}]});}}function vn(_0x1dff23,_0x57be2b){const _0x4659ee=new vt(_0x1dff23);return _0x4659ee['set']({'label':Hi(_0x1dff23,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x37726c,'class':'ck-ai-chat__start-conversation\x20'+Ui}),_0x4659ee['on']('execute',()=>{_0x57be2b['fire']('startConversation');}),_0x4659ee;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x1396f0,_0x4a6889){super(_0x1396f0),this['_bodyCollection']=new Qt(_0x1396f0),this['_bodyCollection']['attachToDom']();const _0x137e38=vn(_0x1396f0,this);this['chatHeader']=new AIHeaderView(_0x1396f0,{'label':Hi(_0x1396f0,'AI_CHAT_HEADING'),'icon':_0x2ea593,'class':'ck-ai-header_chat','content':_0x137e38,'showResizeButton':_0x4a6889['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0x1396f0,this['_bodyCollection']),this['chatFeed']['delegate'](...ms)['to'](this),this['chatControls']=new AIChatControlsView(_0x1396f0,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x4a6889['contextResourcesSearchInputVisibleFrom']}),this['chatControls']['delegate'](...ms)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0x1396f0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x1396f0['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x2a7998,_0x1ff50b,_0xf5062,_0x530fc8){this['chatControls']['populateSourceResourceBalloon'](_0x2a7998,_0x1ff50b,_0xf5062,_0x530fc8);}['closeSourceResourceBalloon'](_0x948496){this['chatControls']['closeSourceResourceBalloon'](_0x948496);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0x23f270{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(_0x240339){super(_0x240339);const _0x318c4d=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x318c4d['showResizeButton'],'contextResourcesSearchInputVisibleFrom':this['context']['config']['get']('ai.chat.context.searchInputVisibleFrom')}),this['_view']['delegate']('resizeTabs')['to'](_0x318c4d),this['_view']['delegate'](...ms)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x2e82c2,{showDiff:_0x131e22})=>{this['showDiff']=_0x131e22;}),_0x318c4d['view']['addTab']({'id':'chat','buttonLabel':Hi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x2ea593,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x318c4d['view'],'isMaximized',_0x252bab=>_0x252bab),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x9a5bf6=>_0x9a5bf6),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x4b1ab4){const _0x4d4fc8=this['context']['config']['get']('ai.chat.welcomeMessage')??Hi(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x4b1ab4['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x4d4fc8}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x2c5e92,staticMessage:_0x5825dc}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x2c5e92,'initialContent':'<p>'+_0x5825dc+'</p>'});});}async['addFeedItemUserMessage'](_0x39508c){const _0x3e3490=_0x39508c['attributes']?.['displayedPrompt']||_0x39508c['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x39508c['contextItems']['values']()),'initialContent':'<p>'+_0x3e3490+'</p>','id':_0x39508c['id']});});}async['addFeedItemError']({errorMessage:_0x4ed352,id:_0x54be1f}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x4ed352+'</p>','id':_0x54be1f});});}async['addFeedItemAIReply'](_0x207998){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x207998['interactionId']+':'+_0x207998['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x2124ed){const _0x11141=ds(this['context']);let _0x219a97=_0x11141['config']['get']('ai.availableReplyActions')||[...bs];if(_0x11141['plugins']['has']('TrackChanges')){if(!this['_isTrackChangesCommandValueBound']){this['_isTrackChangesCommandValueBound']=!0x0;const _0x2dfbcc=_0x11141['commands']['get']('trackChanges');this['_view']['chatFeed']['bind']('isTrackChangesOn')['to'](_0x2dfbcc,'value');}}else _0x219a97=_0x219a97['filter'](_0x2bb4c5=>'insertSuggestion'!=_0x2bb4c5);return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x2124ed['interactionId']+':'+_0x2124ed['id'],'areActionsDisabled':_0x2124ed['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x219a97}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x54790e,_0x29f179){return this['_promiseQueue']['enqueue'](async()=>{const _0x53b216=this['_view']['chatFeed']['children']['last'];if(_0x53b216 instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x53b216),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x54790e['id'],'capabilities':{'isWebSearchEnabled':_0x53b216['capabilities']['isWebSearchEnabled']||_0x29f179['isWebSearchEnabled'],'isReasoningEnabled':_0x53b216['capabilities']['isReasoningEnabled']||_0x29f179['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x54790e['id'],'capabilities':_0x29f179});});}async['addFeedItemCustomElement'](_0x489987,_0xafb73c){let _0x406417;return await this['_promiseQueue']['enqueue'](async()=>{_0x406417=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x489987,'id':_0xafb73c});}),_0x406417;}['removeFeedItem'](_0xb98ce7){this['_view']['chatFeed']['removeItem'](_0xb98ce7);}['hasFeedItem'](_0xd49f00){return this['_view']['chatFeed']['hasItem'](_0xd49f00);}['updateFeedInteractionHeader'](_0x401466){const _0x34affc=this['_view']['chatFeed']['children']['find'](_0x5a3531=>_0x5a3531['options']['id']==_0x401466['id']&&_0x5a3531 instanceof AIChatFeedInteractionHeaderView);_0x34affc&&_0x34affc['set']('isVisible',_0x401466['isVisible']);}async['updateFeedItemAIReplyContent'](_0x44af0c){const _0x30632b=_0x44af0c['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x6e6cef=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x44af0c,'abortSignal':_0x6e6cef,'renderingStrategy':_0x30632b}),_0x44af0c['isDone']&&this['markFeedItemAsDone'](_0x44af0c['id']);});}['updateFeedItemAIReplySources'](_0x206773,_0x1f426b){this['_view']['chatFeed']['updateWebSources'](_0x206773,_0x1f426b);}async['updateFeedItemAIReplySuggestionContent'](_0x2e751c){return this['_promiseQueue']['enqueue'](async _0x3fc8bb=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x2e751c,'abortSignal':_0x3fc8bb}),_0x2e751c['isDone']&&this['markFeedItemAsDone'](_0x2e751c['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x1f7d69){this['_view']['chatFeed']['updateSuggestionPartState'](_0x1f7d69);}['setFeedItemAIReplySuggestionPartActive'](_0x892ec){this['_view']['chatFeed']['setSuggestionPartActive'](_0x892ec);}['markFeedItemAsDone'](_0x3fe749){this['_view']['chatFeed']['markItemAsDone'](_0x3fe749);}['removeFeedInteraction'](_0x62e76d){this['_view']['chatFeed']['getItemIds']()['filter'](_0x1260b0=>_0x1260b0['startsWith'](_0x62e76d))['forEach'](_0xfdff1f=>this['_view']['chatFeed']['removeItem'](_0xfdff1f));}['startInteraction'](){const _0x1dd44d=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x1dd44d),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x314abe){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x48e757=>_0x48e757['startsWith'](_0x314abe['id']))['forEach'](_0x2f65f6=>this['markFeedItemAsDone'](_0x2f65f6)),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'](_0x433ca9,_0x116c0d){this['_view']['chatControls']['addContextItem'](_0x433ca9,_0x116c0d);}['removeContextItem'](_0x2cfc52){this['_view']['chatControls']['removeContextItem'](_0x2cfc52);}['setContextItemLoading'](_0xa99ef0,_0xd2f6af){this['_view']['chatControls']['setContextItemLoading'](_0xa99ef0,_0xd2f6af);}['setIsUploadInProgress'](_0x41e131){this['_view']['chatControls']['setIsUploadInProgress'](_0x41e131);}['setConversationContext'](_0x55c2ea){this['_view']['chatControls']['setConversationContext'](_0x55c2ea);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x58b145,_0x105f70,_0x39b471){this['_view']['chatControls']['updateResourceState'](_0x58b145,_0x105f70,_0x39b471);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x1934b6){this['_view']['chatControls']['setAddContextOptions'](_0x1934b6);}['updateCapabilities'](_0x118f3c){this['_view']['chatControls']['setWebSearch'](_0x118f3c['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x118f3c['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x118f3c));}['setSelectedModel'](_0x3e0d9c,_0x54bd55){this['_view']['chatControls']['setModel'](_0x3e0d9c),_0x54bd55&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x47e80b){this['feedItemRenderingStrategy']=_0x47e80b;}['toggleLoadingSkeleton'](_0x1fa1e1){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x1fa1e1);}['resetConversationTitle'](){this['setConversationTitle'](Hi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x27342f,_0x142e1a=!0x1){if(_0x142e1a&&!Rt()&&_0x27342f['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x27342f);this['_view']['chatHeader']['label']=_0x27342f;}['setLoadingMessage'](_0x2c62ed){this['_view']['chatFeed']['setLoadingMessage'](_0x2c62ed);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x2db7ba){let _0x1a307f=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x2db7ba[_0x1a307f],_0x1a307f++,_0x1a307f===_0x2db7ba['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x2c63d6){return _0x2c63d6['isWebSearchEnabled']&&_0x2c63d6['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x2c63d6['isWebSearchEnabled']?Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x2c63d6['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Hi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x2a0eb2){return _0x2a0eb2?_0x2a0eb2['isWebSearchEnabled']&&_0x2a0eb2['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x2a0eb2['isWebSearchEnabled']?Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x2a0eb2['isReasoningEnabled']?Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Hi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x2741ef,_0x44220a,_0x3067e3,_0x5f4012){this['_view']['populateSourceResourceBalloon'](_0x2741ef,_0x44220a,_0x3067e3,_0x5f4012);}['closeSourceResourceBalloon'](_0x47878c){this['_view']['closeSourceResourceBalloon'](_0x47878c);}['setPromptInputValue'](_0x5282d7){this['_view']['chatControls']['setPromptInputValue'](_0x5282d7);}['focusPromptInput'](_0x263c96=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x263c96);}['scrollFeedToSuggestion'](_0x5e89cd,_0x416846){this['_view']['chatFeed']['scrollToSuggestion'](_0x5e89cd,_0x416846);}['startAutoScroll'](_0x3c3fc7={}){this['_view']['chatFeed']['startAutoScroll'](_0x3c3fc7);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0xc09c9a,_0x4649c7){super(_0xc09c9a),this['sections']=_0x4649c7,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x15e2d3){let _0x2abd22=0x0,_0xb7a9c7=0x0;for(const _0x543a69 of this['sections']){const {resultsCount:_0x197f23,totalItemsCount:_0x41c013}=_0x543a69['filter'](_0x15e2d3);_0x2abd22+=_0x197f23,_0xb7a9c7+=_0x41c013;}return{'resultsCount':_0x2abd22,'totalItemsCount':_0xb7a9c7};}}class AIChatHistoryListView extends Pt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x1be180,{title:_0xd9b032,items:_0x1eb41a}){super(_0x1be180);const _0x24760d=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0xd9b032,this['itemsViews']=_0x1eb41a;const _0x30c53b=new Nt(_0x1be180);_0x30c53b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x1be180),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x24760d['if']('isVisible','ck-hidden',_0x48d13d=>!_0x48d13d)]},'children':[_0x30c53b,this['_itemsListView']]});}['filter'](_0x9e6a0e){const _0x1680ea=this['itemsViews']['length'];let _0x53be0f=0x0;for(const _0x4062c0 of this['itemsViews']){if(_0x9e6a0e){const _0x1839fe=_0x4062c0['isMatching'](_0x9e6a0e);_0x4062c0['isVisible']=!!_0x1839fe,_0x4062c0['highlightText'](_0x9e6a0e);}else _0x4062c0['isVisible']=!0x0,_0x4062c0['highlightText'](null);_0x4062c0['isVisible']&&_0x53be0f++;}return this['isVisible']=_0x53be0f>0x0,{'resultsCount':_0x53be0f,'totalItemsCount':_0x1680ea};}['getItem'](_0x1fac15){return this['itemsViews']['find'](_0x10a500=>_0x10a500['id']===_0x1fac15);}['removeItem'](_0x37d4dd){const _0x3840cb=this['itemsViews']['indexOf'](_0x37d4dd);-0x1!==_0x3840cb&&(this['itemsViews']['splice'](_0x3840cb,0x1),this['_itemsListView']['items']['remove'](_0x37d4dd));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
27
- _0x104e5b(Pt){['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(_0x2b4f2c,_0x57c02e){super(_0x2b4f2c);const _0x5917fa=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x57c02e['pinned']),this['set']('loadingState',null),this['set']('title',_0x57c02e['title']),this['id']=_0x57c02e['id'];const {createdAt:_0x383b67,active:_0x33726f=!0x1}=_0x57c02e;this['_titleView']=new _0x2cc319(),this['_titleView']['bind']('text')['to'](this,'title',t=>_0x19d831(t||'')),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x4dadd7=this['_createCheckView'](),_0x50df65=this['_createPinButtonView'](_0x2b4f2c),_0x4622cc=this['_createMenuDropdownView'](),_0x3dc689=this['_createEditInputView'](_0x2b4f2c),_0x486d17=this['_createAcceptEditButtonView'](_0x2b4f2c,_0x3dc689),_0x32cd90=this['_createCancelEditButtonView'](_0x2b4f2c);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x50df65),this['actions']['add'](_0x4622cc),this['on']('change:isEdit',(_0x337fcb,_0x364018,_0x2c6737)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x2c6737?(this['actions']['add'](_0x486d17),this['actions']['add'](_0x32cd90),this['mainContent']['add'](_0x3dc689),_0x3dc689['element']['value']=this['title']||'',_0x3dc689['element']['focus']()):(this['actions']['add'](_0x50df65),this['actions']['add'](_0x4622cc),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x33726f?'ck-ai-chat-history__item--active':'',_0x5917fa['if']('isVisible','ck-hidden',_0x358eec=>!_0x358eec),_0x5917fa['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',_0x5917fa['if']('loadingState','ck-hidden',_0x54768e=>!!_0x54768e)]},'children':_0x33726f?[_0x4dadd7]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x5917fa['if']('loadingState','ck-hidden',_0x166045=>!_0x166045)]},'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',_0x5917fa['if']('loadingState','ck-hidden',_0x208883=>!!_0x208883)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x5917fa['if']('loadingState','ck-hidden',_0x329f0b=>!_0x329f0b)]},'children':[{'text':_0x5917fa['to']('loadingState',_0x563d67=>_0x563d67?Hi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x563d67]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x383b67]}]},{'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'](_0xd29cb9){this['set']('title',_0xd29cb9);}['updateLoadingState'](_0x331ff7,_0x3b8002){this['set']('loadingState',_0x3b8002?_0x331ff7:null);}['_createCheckView'](){const _0x295737=new xt();return _0x295737['set']({'content':_0x4ab520}),_0x295737;}['_createPinButtonView'](_0x175592){const _0x10cc42=new vt(_0x175592);return _0x10cc42['set']({'label':Hi(_0x175592,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x5e7c87,'withText':!0x1,'tooltip':!0x0}),_0x10cc42['bind']('isOn')['to'](this,'pinned'),_0x10cc42['on']('execute',()=>{const _0x4bbbb8=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x4bbbb8});}),_0x10cc42;}['_createMenuDropdownView'](){const _0x59c59a=Gt(this['locale']),_0x4c4d8d=_0x59c59a['panelView']['children'];_0x59c59a['buttonView']['set']({'label':Hi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x57c6c8}),_0x59c59a['panelPosition']='sw';const _0x4d2db0=new vt(this['locale']);_0x4d2db0['label']=Hi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x4d2db0['withText']=!0x0,_0x4d2db0['on']('execute',()=>{this['isEdit']=!0x0;});const _0x146857=new vt(this['locale']);_0x146857['label']=Hi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x146857['withText']=!0x0,_0x146857['on']('execute',()=>{this['showConfirm'](Hi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x3b558d=new Dt(this['locale']),_0x14aeae=new Pt(this['locale']);_0x14aeae['children']['add'](_0x4d2db0);const _0x4e6890=new Pt(this['locale']);return _0x4e6890['children']['add'](_0x146857),_0x3b558d['items']['addMany']([_0x14aeae,_0x4e6890]),_0x4c4d8d['add'](_0x3b558d),_0x59c59a;}['_createEditInputView'](_0x30b890){const _0x47340d=new _0x142293(_0x30b890),_0x4ee838=_0x47340d['bindTemplate'];return _0x47340d['extendTemplate']({'on':{'keydown':_0x4ee838['to'](_0x4ebfd6=>{'Enter'==_0x4ebfd6['key']&&this['_commitEditInputValue'](_0x47340d);})}}),_0x47340d;}['_createAcceptEditButtonView'](_0x514f30,_0x215945){const _0x5ca316=new vt(_0x514f30);return _0x5ca316['set']({'icon':_0x4ab520,'withText':!0x1,'tooltip':Hi(_0x514f30,'AI_CHAT_HISTORY_ACCEPT')}),_0x5ca316['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x5ca316['on']('execute',()=>{this['_commitEditInputValue'](_0x215945);}),_0x5ca316;}['_commitEditInputValue'](_0x3883cb){const _0x2f9f40=_0x3883cb['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x2f9f40});}['_createCancelEditButtonView'](_0x2aff26){const _0x17d434=new vt(_0x2aff26);return _0x17d434['set']({'icon':_0x5ed072,'withText':!0x1,'tooltip':Hi(_0x2aff26,'AI_CHAT_HISTORY_CANCEL')}),_0x17d434['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x17d434['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x17d434;}['_createSpinnerView'](){const _0x4c57db=new AISpinnerView('tiny');return _0x4c57db['isVisible']=!0x0,_0x4c57db;}['isMatching'](_0x369d30){return'string'==typeof this['title']&&this['title']['match'](_0x369d30)?{'title':!0x0}:null;}['highlightText'](_0x536635){this['_titleView']['highlightText'](_0x536635);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x5b625d,_0x314ecc){super(_0x5b625d),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x2322fb=vn(_0x5b625d,this);this['headerView']=new AIHeaderView(_0x5b625d,{'label':Hi(_0x5b625d,'AI_CHAT_HISTORY_HEADING'),'icon':_0x41655b,'class':'ck-ai-header_history','content':_0x2322fb,'showResizeButton':_0x314ecc}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0x5b625d,[]),this['sectionsView']['delegate'](...Nn)['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',_0x5bd72d=>!_0x5bd72d)]}}),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 _0x5755d6=new _0x1be4c1(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Hi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x5baac5=>Hi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x5baac5),'secondary':Hi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x4fec59=this['_createErrorView']();return _0x4fec59['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x9c198b=>!_0x9c198b)]}}),_0x5755d6['on']('render',()=>{_0x5755d6['children']['add'](_0x4fec59,0x1);}),_0x5755d6['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x57acfd=>!_0x57acfd)]}}),_0x5755d6;}['_createSkeletonView'](){const _0x484149=new AISkeletonView(this['locale'],Ss['aiHistory']);return _0x484149['bind']('isVisible')['to'](this,'isLoading'),_0x484149;}['_createErrorView'](){const _0x2c8aff=new Nt(this['locale']),_0x4ae134=new vt(this['locale']);_0x4ae134['set']({'withText':!0x1,'icon':_0x5ed072,'class':'ck-ai-notification_error__dismiss-button'}),_0x4ae134['bind']('isVisible')['to'](this,'hasItems',_0x43c2ae=>!!_0x43c2ae),_0x4ae134['on']('execute',()=>{this['errorMessage']='';});const _0x2bb15d=this['bindTemplate'];return _0x2c8aff['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x2bb15d['to']('errorMessage')}]},_0x4ae134]}),_0x2c8aff;}['_createEmptyStateView'](){const _0x1f7ec5=new Nt(this['locale']);return _0x1f7ec5['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x1462a3=>!_0x1462a3)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Hi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x1f7ec5;}['_createListItemViews'](_0x32495a,_0x12d35c){const _0x13d181=[];for(const _0x9691da of _0x32495a){const _0x1bba99=new AIChatHistoryListItemView(_0x12d35c,_0x9691da);_0x1bba99['delegate'](...Nn)['to'](this),_0x13d181['push'](_0x1bba99);}return _0x13d181;}['updateHistoryItemsWithCategories'](_0x1b65f0){const _0x5056b2=this['locale']||'en',_0x5cdf33=[];for(const _0x558764 of _0x1b65f0){const _0x3559bd=this['_createListItemViews'](_0x558764['items'],_0x5056b2);_0x5cdf33['push'](new AIChatHistoryListView(_0x5056b2,{'title':_0x558764['title'],'items':_0x3559bd}));}this['sectionsView']['sections']=_0x5cdf33,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x5cdf33),this['hasItems']=_0x1b65f0['some'](_0x23d61c=>_0x23d61c['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x406888){for(const _0x3cefff of this['sectionsView']['sections']){const _0x3edb29=_0x3cefff['getItem'](_0x406888);if(_0x3edb29){if(_0x3cefff['removeItem'](_0x3edb29),0x0===_0x3cefff['itemsViews']['length']){const _0x4c8e7d=this['sectionsView']['sections']['indexOf'](_0x3cefff);-0x1!==_0x4c8e7d&&(this['sectionsView']['sections']['splice'](_0x4c8e7d,0x1),this['sectionsView']['items']['remove'](_0x3cefff));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x20d71c,_0xb65951){for(const _0x15acd1 of this['sectionsView']['sections']){const _0x378b8a=_0x15acd1['getItem'](_0x20d71c);if(_0x378b8a){_0x378b8a['updateTitle'](_0xb65951);break;}}}['updateItemLoadingState'](_0x4738cc,_0x2f9533,_0x4c10e8){for(const _0x16d378 of this['sectionsView']['sections']){const _0x15f44e=_0x16d378['getItem'](_0x4738cc);if(_0x15f44e){_0x15f44e['updateLoadingState'](_0x2f9533,_0x4c10e8);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x21217a=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x21217a);}}}const Nn=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0x23f270{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1ad4fb){super(_0x1ad4fb);const _0x2c15a4=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0x2c15a4['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x2c15a4),this['_historyView']['delegate'](...Nn)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x2c15a4['view'],'isMaximized',_0x1e9d01=>_0x1e9d01),_0x2c15a4['view']['addTab']({'id':'history','buttonLabel':Hi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x41655b,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x10d7f5){this['_historyView']['removeHistoryItem'](_0x10d7f5);}['updateItems'](_0x458a90){this['_historyView']['updateHistoryItemsWithCategories'](_0x458a90);}['updateItemTitle'](_0x45678e,_0x5e0770){this['_historyView']['updateItemTitle'](_0x45678e,_0x5e0770);}['updateItemLoadingState'](_0x36e5c3,_0x537cee,_0x52f184){this['_historyView']['updateItemLoadingState'](_0x36e5c3,_0x537cee,_0x52f184);}['setLoadingSkeleton'](_0x354311){this['_historyView']['isLoading']=_0x354311;}['showError'](_0x3a15de){this['_historyView']['errorMessage']=_0x3a15de;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ht(){['id'];['createdAt'];constructor({id:_0x2f9038,title:_0x3ea617,createdAt:_0x17056e,updatedAt:_0x4ae6d7,pinned:_0x121d15}){super(),this['id']=_0x2f9038,this['createdAt']=new Date(_0x17056e),this['set']('title',_0x3ea617),this['set']('updatedAt',_0x4ae6d7?new Date(_0x4ae6d7):null),this['set']('pinned',_0x121d15||!0x1);}['updateTitle'](_0x1643e4){this['set']('title',_0x1643e4),this['updatedAt']=new Date();}['updatePinned'](_0x407fcf){this['set']('pinned',_0x407fcf),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x56100e,group:_0x45a976}){super(),this['connector']=_0x56100e,this['group']=_0x45a976;}async['init'](){try{const _0x448337=this['connector']['fetchConversations'](this['group']),_0x1b4e1f=await _0x448337['getConversations']();this['loadItems'](_0x1b4e1f);}catch(_0x2b4d53){this['fire']('error',{'error':_0x2b4d53,'operation':'init'});}}['addItem'](_0x25d6eb){this['items']['push'](_0x25d6eb);}async['removeItem'](_0x4e3ca5){const _0x497996=this['items']['findIndex'](_0x3c7d07=>_0x3c7d07['id']===_0x4e3ca5);if(-0x1===_0x497996)return!0x1;try{return await this['connector']['deleteConversation'](_0x4e3ca5)['execute'](),this['items']['splice'](_0x497996,0x1),this['fire']('itemRemoved',{'itemId':_0x4e3ca5}),!0x0;}catch(_0x288674){return this['fire']('error',{'error':_0x288674,'operation':'removeItem','itemId':_0x4e3ca5}),!0x1;}}['getItem'](_0x45084a){return this['items']['find'](_0x28522f=>_0x28522f['id']===_0x45084a);}async['updateItemTitle'](_0x485c6e,_0x57c244){const _0x5ac402=this['getItem'](_0x485c6e);if(!_0x5ac402)return!0x1;try{return await this['connector']['updateConversation'](_0x485c6e,{'title':_0x57c244})['getResult'](),_0x5ac402['updateTitle'](_0x57c244),this['fire']('itemUpdated',{'itemId':_0x485c6e,'updates':{'title':_0x57c244}}),!0x0;}catch(_0x4b0a73){return this['fire']('error',{'error':_0x4b0a73,'operation':'updateItemTitle','itemId':_0x485c6e}),!0x1;}}async['updateItemPinned'](_0x1364ce,_0x426dcb){const _0x342025=this['getItem'](_0x1364ce);if(!_0x342025)return!0x1;try{return await this['connector']['updateConversation'](_0x1364ce,{'pinned':_0x426dcb})['getResult'](),_0x342025['updatePinned'](_0x426dcb),this['fire']('itemUpdated',{'itemId':_0x1364ce,'updates':{'pinned':_0x426dcb}}),!0x0;}catch(_0x1cd891){return this['fire']('error',{'error':_0x1cd891,'operation':'updateItemPinned','itemId':_0x1364ce}),!0x1;}}['loadItems'](_0x107c2d){try{this['items']=[],_0x107c2d['map'](_0x2542f2=>{this['addItem'](new AIChatHistoryItem(_0x2542f2));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x67b595){this['fire']('error',{'error':_0x67b595,'operation':'loadItems'});}}['getItems'](_0x33ef24={}){const _0x164700=void 0x0!==_0x33ef24['pinned']&&_0x33ef24['pinned'],_0x4255c9=_0x33ef24['from']?new Date(_0x33ef24['from']['getFullYear'](),_0x33ef24['from']['getMonth'](),_0x33ef24['from']['getDate']()):null,_0x52c075=_0x33ef24['to']?new Date(_0x33ef24['to']['getFullYear'](),_0x33ef24['to']['getMonth'](),_0x33ef24['to']['getDate']()):null;return this['items']['filter'](_0x4cdb2d=>{if(_0x4cdb2d['pinned']!==_0x164700)return!0x1;if(_0x52c075){const _0x163d42=new Date(_0x4cdb2d['createdAt']['getFullYear'](),_0x4cdb2d['createdAt']['getMonth'](),_0x4cdb2d['createdAt']['getDate']());return _0x4255c9?_0x4255c9['getTime']()===_0x52c075['getTime']()?_0x163d42['getTime']()===_0x4255c9['getTime']():_0x163d42<_0x52c075&&_0x163d42>=_0x4255c9:_0x163d42<_0x52c075;}return!0x0;});}}class AIChatHistoryController extends _0x23f270{['_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 _0x4fec01=this['context']['plugins']['get'](AITabs);try{const _0x449776=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x449776}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x9a0cbc,_0x4148bf)=>{this['_setItemLoading'](_0x4148bf['id'],'remove'),this['_handleRemove'](_0x4148bf['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x50e7f0,_0x4deb30)=>{this['_setItemLoading'](_0x4deb30['id'],'rename'),this['_handleEditTitle'](_0x4deb30['id'],_0x4deb30['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x2bfba,_0x4ef1f0)=>{void 0x0!==_0x4ef1f0['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x4ef1f0['itemId'],_0x4ef1f0['updates']['title']),void 0x0!==_0x4ef1f0['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x4ef1f0['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x148335,_0x11f2b9)=>{this['_aiChatController']['_handleRemovedConversation'](_0x11f2b9['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x11f2b9['itemId']),this['_clearItemLoading'](_0x11f2b9['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x4191e7,_0x492d7b)=>{this['_handleHistoryErrorUI'](_0x492d7b['error'],_0x492d7b['operation'],_0x492d7b['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x5733a8,_0x4be143)=>{this['_handleSelectConversation'](_0x4be143['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x9840c6,_0x4b5a53)=>{const _0x361ef7=_0x4b5a53['pinned']?'pin':'unpin';this['_setItemLoading'](_0x4b5a53['id'],_0x361ef7),this['_handleTogglePin'](_0x4b5a53['id'],_0x4b5a53['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x4fec01['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x4fec01['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0xcb7c82){this['_handleHistoryErrorUI'](_0xcb7c82,'init');}}async['_handleEditTitle'](_0x1f6ac2,_0x39a67e){await this['history']['updateItemTitle'](_0x1f6ac2,_0x39a67e);}async['_handleTogglePin'](_0x55a54e,_0x46e6bd){await this['history']['updateItemPinned'](_0x55a54e,_0x46e6bd);}async['_handleRemove'](_0x1925f3){await this['history']['removeItem'](_0x1925f3);}async['_handleSelectConversation'](_0x45b1e4){await this['_aiChatController']['loadConversation'](_0x45b1e4);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x56318d=this['_aiChatController']['activeConversation']?.['id'],_0x2cfd72=this['_getCategorizedItems']()['map'](_0x11e929=>({'title':_0x11e929['title'],'items':_0x11e929['items']['map'](_0xa654f5=>({'id':_0xa654f5['id'],'title':_0xa654f5['title']||Hi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0xa654f5['createdAt'])['toLocaleDateString'](),'active':_0xa654f5['id']===_0x56318d,'pinned':_0xa654f5['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x2cfd72);}['_setItemLoading'](_0x140b26,_0x20bc68){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x140b26,_0x20bc68,!0x0);}['_clearItemLoading'](_0x58c544){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x58c544,null,!0x1);}['_handleHistoryErrorUI'](_0x529db0,_0x31e88e,_0x2b376e){const _0x22f4de=this['_generateErrorMessage'](_0x31e88e,_0x2b376e);this['_aiChatHistoryUi']['showError'](_0x22f4de),_0x2b376e&&this['_clearItemLoading'](_0x2b376e),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x432b03,_0x1c7547){const _0x426a41=_0x1c7547?this['history']['getItem'](_0x1c7547):null,_0x1d5d10=_0x426a41?.['title']||Hi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x432b03){case'updateItemTitle':return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x1d5d10);case'updateItemPinned':{const _0x3f6700=Hi(this['context']['locale'],_0x426a41?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x3f6700,_0x1d5d10]);}case'removeItem':return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x1d5d10);case'init':case'loadItems':return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Hi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0xcaeeb=new Date(),_0x2ab12a=new Date(_0xcaeeb['getFullYear'](),_0xcaeeb['getMonth'](),_0xcaeeb['getDate']()),_0x2c620c=new Date(_0x2ab12a);_0x2c620c['setDate'](_0x2c620c['getDate']()-0x1);const _0x917089=new Date(_0x2ab12a);_0x917089['setDate'](_0x917089['getDate']()-0xe);const _0x42bb1d=this['history']['getItems']({'pinned':!0x0}),_0x4bbb21=this['history']['getItems']({'from':_0x2ab12a,'to':_0x2ab12a}),_0x41a7d3=this['history']['getItems']({'from':_0x2c620c,'to':_0x2c620c}),_0x51f6d6=this['history']['getItems']({'from':_0x917089,'to':_0x2c620c}),_0x59bb7c=this['history']['getItems']({'to':_0x917089}),_0x465533=[];return _0x42bb1d['length']>0x0&&_0x465533['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x42bb1d}),_0x4bbb21['length']>0x0&&_0x465533['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x4bbb21}),_0x41a7d3['length']>0x0&&_0x465533['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x41a7d3}),_0x51f6d6['length']>0x0&&_0x465533['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x51f6d6}),_0x59bb7c['length']>0x0&&_0x465533['push']({'title':Hi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x59bb7c}),_0x465533;}}class AIChatHistory extends _0x23f270{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0x23f270{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2c5533){super(_0x2c5533),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1}),this['context']['config']['define']('ai.chat.initialConversation','new');}}class AIChatShortcutView extends vt{['id'];constructor(_0x2711fe,_0x15fb10){super(_0x2711fe);const {id:_0xf0e69b,type:_0x45a204,icon:_0x397394}=_0x15fb10;this['id']=_0xf0e69b,this['set']({'label':_0x15fb10['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x15fb10['id']}}),_0x397394?this['icon']=_0x397394:'chat'===_0x45a204?this['icon']=_0x2ea593:'review'===_0x45a204?this['icon']=_0x2e2f4a:'translate'===_0x45a204&&(this['icon']=_0x4d8ff7);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x2622e5,_0x4620dd){super(_0x2622e5);const _0x3e7f89=_0x4620dd['map'](_0x2145d2=>{const _0x25f225=new Pt(this['locale']),_0x3066ae=new AIChatShortcutView(this['locale'],_0x2145d2);return _0x25f225['children']['add'](_0x3066ae),_0x3066ae['delegate']('execute')['to'](this),_0x25f225;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0x3e7f89),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const yn='chat-shortcuts';class AIChatShortcuts extends _0x23f270{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];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 _0x5d3c4c=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{_0x5d3c4c['activeConversation']['isFromHistory']||this['_injectShortcuts']();}),this['listenTo'](_0x5d3c4c,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x83933b=['chat','review','translate'];this['_shortcuts']['forEach'](_0x4e70f8=>{let _0x5912e9=!0x0;if(_0x4e70f8['id']&&_0x4e70f8['label']&&_0x83933b['includes'](_0x4e70f8['type'])?'chat'===_0x4e70f8['type']&&(_0x5912e9='string'==typeof _0x4e70f8['prompt']):_0x5912e9=!0x1,!_0x5912e9)throw new at('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x4e70f8});});}['_injectShortcuts'](){const _0x246d3c=this['context']['plugins']['get'](AIChatUI);this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),_0x246d3c['addFeedItemCustomElement'](this['_shortcutsView']['element'],yn),this['_shortcutsView']['on']('execute',_0x35c6ee=>{const _0xde0882=_0x35c6ee['source']['id'];this['_executeShortcut'](_0xde0882);});}['_removeShortcuts'](){const _0x4c5741=this['context']['plugins']['get'](AIChatUI);_0x4c5741['hasFeedItem'](yn)&&_0x4c5741['removeFeedItem'](yn),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x574bcd){const _0x1654dc=this['_shortcuts']['find'](_0x1cf48d=>_0x1cf48d['id']===_0x574bcd),_0x4541b9=_0x1654dc['type'];'chat'===_0x4541b9?this['_runChatShortcut'](_0x1654dc):'review'===_0x4541b9?_0x1654dc['commandId']?this['_runReviewShortcut'](_0x1654dc):this['_switchTab']('reviewMode'):'translate'===_0x4541b9&&(_0x1654dc['language']?this['_runTranslateShortcut'](_0x1654dc):this['_switchTab']('translate'));}['_switchTab'](_0xb26941){if(!this['context']['plugins']['has']('AITabs'))throw new at('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0xb26941});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0xb26941);}async['_runChatShortcut']({prompt:_0x5055fa,draftMode:_0x27bdb7,useWebSearch:_0x549c86=!0x1,useReasoning:_0x6269e6=!0x1,model:_0x87937}){const _0x4a36d2=this['context']['plugins']['get']('AIChatController'),_0x1a6daf=_0x4a36d2['activeConversation'];let _0x2b5edb;_0x2b5edb=_0x87937?await _0x1a6daf['chatModels']['getModel'](_0x87937):await _0x1a6daf['chatModels']['getDefault'](),_0x2b5edb&&await _0x1a6daf['setModel'](_0x2b5edb),_0x1a6daf['setWebSearch'](_0x549c86),_0x1a6daf['setReasoning'](_0x6269e6),_0x4a36d2['addCurrentDocumentToChatContext'](),_0x27bdb7?(this['_aiChatUI']['setPromptInputValue'](_0x5055fa),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x4a36d2['sendMessage']({'message':_0x5055fa});}['_runReviewShortcut']({commandId:_0x5408d1,model:_0x426f31,prompt:_0x46bdaa,params:_0x2be2d0}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new at('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x56cc67={'id':_0x5408d1,'isCustom':'custom'===_0x5408d1};_0x426f31&&_0x46bdaa&&(_0x56cc67['args']={'model':_0x426f31,'prompt':_0x46bdaa}),_0x2be2d0&&(_0x56cc67['params']=_0x2be2d0),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x56cc67);}['_runTranslateShortcut']({language:_0x263d7c}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new at('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x263d7c,'args':{'language':_0x263d7c}});}}class ToggleAICommand extends _0x3a665b{constructor(_0x4d13a7){super(_0x4d13a7);const _0x1a5623=_0x4d13a7['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x1a5623,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x2537f3=this['editor']['plugins']['get']('AITabs')['view'];_0x2537f3['isVisible']=!_0x2537f3['isVisible'];}}class AIToggleButtonUI extends _0x5686f0{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1f2a54=this['editor'];_0x1f2a54['commands']['add']('toggleAi',new ToggleAICommand(_0x1f2a54)),_0x1f2a54['ui']['componentFactory']['add']('toggleAi',()=>{const _0x4f80c5=this['_createAIUIButton'](vt);return _0x4f80c5['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x4f80c5;}),_0x1f2a54['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x37d726=this['_createAIUIButton'](Wt);return _0x37d726['set']({'role':'menuitemcheckbox'}),_0x37d726;});}['_createAIUIButton'](_0x508b2c){const _0x15b47d=this['editor'],_0x3d0f0e=_0x15b47d['commands']['get']('toggleAi'),_0x5b9c74=new _0x508b2c(_0x15b47d['locale']);return _0x5b9c74['set']({'label':Hi(_0x15b47d['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0xbf82c1,'isToggleable':!0x0}),_0x5b9c74['bind']('isEnabled')['to'](_0x3d0f0e),_0x5b9c74['bind']('isOn')['to'](_0x3d0f0e,'value',_0x1b4cb1=>!!_0x1b4cb1),this['listenTo'](_0x5b9c74,'execute',()=>{_0x3d0f0e['execute']();}),_0x5b9c74;}}const xn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0x296f50){super(_0x296f50),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x567bdd){this['showError'](_0x567bdd);}['showError'](_0x24e780){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x24e780,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0xbf0097=new Nt(this['locale']),_0x511b9d=new Nt(this['locale']);return _0x511b9d['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0xbf0097['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x540cfd=>!_0x540cfd)]},'children':[_0x511b9d]}),_0xbf0097;}}const Ln=0xa;class AIBalloon extends _0x23f270{static get['requires'](){return[AIEditing];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_getTargetEditor'](){return this['_currentConfig']?.['targetEditor']??ds(this['context']);}['_isUpdatingMarkers']=!0x1;['open'](_0x2b133c){const {id:_0x3a7543}=this['_currentConfig']??{};this['_currentConfig']=_0x2b133c;const {id:_0x10d086}=this['_currentConfig'];this['isOpen']&&_0x3a7543===_0x10d086?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x540982=this['_getTargetEditor']()['plugins']['get']('Dialog');_0x540982['isOpen']&&this['_currentConfig']&&_0x540982['id']===this['_currentConfig']['id']&&_0x540982['hide']();}['_updateDialog'](){const _0x3e44af=this['_getTargetEditor']()['plugins']['get']('Dialog'),{icon:_0x59c888,title:_0x47c6fc}=this['_currentConfig'];_0x3e44af['view']?.['headerView']&&(_0x3e44af['view']['headerView']['label']=_0x47c6fc,_0x3e44af['view']['headerView']['iconView']&&_0x59c888&&(_0x3e44af['view']['headerView']['iconView']['content']=_0x59c888)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x3e44af['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['showFakeVisualSelection']({'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x23b3e6=this['_getTargetEditor']()['plugins']['get']('Dialog'),{id:_0x425e23,title:_0x427434,icon:_0x136daa,class:_0x1d715a,mainView:_0x1e2a67}=this['_currentConfig'];_0x1e2a67['delegate'](...xn)['to'](this),_0x23b3e6['show']({'title':_0x427434,'icon':_0x136daa,'hasCloseButton':!0x0,'id':_0x425e23,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x1d715a||''),'content':_0x1e2a67,'onShow':_0x4d59f7=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x4d59f7['view']?.['updatePosition']();const _0x58980f=this['_getSelectionElements']();_0x58980f&&_0x58980f[0x0]&&wt({'target':_0x58980f[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x4d59f7['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x425e23});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x425e23}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0xbc5d5f,_0x388e6e){if(!_0x388e6e){const _0x5ece34=this['_getTargetRootDomRect']();if(!_0x5ece34)return null;_0x388e6e=_0x5ece34;}const _0x40b5dc=this['_getSelectionElements']();if(!_0x40b5dc||0x0===_0x40b5dc['length'])return{'left':Math['round'](_0x388e6e['left']+_0x388e6e['width']/0x2-_0xbc5d5f['width']/0x2),'top':Math['round'](_0x388e6e['top']+_0x388e6e['height']/0x2-_0xbc5d5f['height']/0x2)};const _0xe924c2=Math['round'](_0x388e6e['left']+_0x388e6e['width']/0x2-_0xbc5d5f['width']/0x2),_0x510764=_0x40b5dc['map'](_0x465e8f=>new ut(_0x465e8f)),_0xa4b7c=_0xbc5d5f['height'];return{'left':_0xe924c2,'top':this['_calculateOptimalTopPosition'](_0x510764,_0xa4b7c,_0x388e6e)};}['_calculateOptimalTopPosition'](_0x2c2017,_0x6f408,_0x142b93){const _0x3f82f1=new ut(ct['window']),_0x1858cd=_0x2c2017['map'](_0x2c3316=>_0x2c3316['getVisible']())['filter'](_0x10921c=>_0x10921c),_0x1931be=ut['getBoundingRect'](_0x1858cd);if(!_0x1931be)return Math['round'](_0x142b93['top']+_0x142b93['height']/0x2);const _0x239ef6=_0x3f82f1['getIntersection'](_0x1931be);if(!_0x239ef6)return Math['round'](_0x142b93['top']+_0x142b93['height']/0x2);const _0x7c22cc=_0x142b93['getVisible'](),_0x2b9176=_0x7c22cc&&_0x1931be['height']>_0x7c22cc['height'],_0x36d8cd=_0x239ef6['top'],_0x109091=_0x239ef6['bottom'];if(_0x2b9176){const _0x32c288=(_0x7c22cc||_0x3f82f1)['height']/0x2-_0x6f408/0x2,_0x239056=_0x36d8cd-Ln-_0x142b93['top'],_0x2baf86=_0x142b93['bottom']-_0x109091-Ln;return _0x239056>=_0x6f408?Math['max'](Ln,_0x36d8cd-_0x6f408-Ln):_0x2baf86>=_0x6f408?_0x109091+Ln:Math['max'](Ln,_0x32c288);}const _0x1c6e58=_0x36d8cd-_0x6f408,_0x1d64fd=_0x142b93['bottom']-_0x109091-Ln,_0x585332=_0x36d8cd-Ln-_0x142b93['top'];let _0x1722eb;if(_0x1d64fd>=_0x6f408)_0x1722eb=_0x109091+Ln;else{if(_0x585332>=_0x6f408)_0x1722eb=_0x1c6e58-Ln;else _0x1722eb=_0x36d8cd+_0x1931be['height']/0x2-_0x6f408/0x2;}return _0x1722eb;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x5b097f=this['_getTargetEditor']();this['listenTo'](_0x5b097f['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x5ca8ac,data:{newRange:_0xacae63}}of _0x5b097f['model']['document']['differ']['getChangedMarkers']())if(_0x5ca8ac['startsWith'](As+':')&&(_0xacae63&&(_0xacae63['start']['isEqual'](_0xacae63['end'])||'$graveyard'==_0xacae63['root']['rootName'])||null==_0xacae63)){const _0xe4153=Hi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0xe4153),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x3bcfbd=this['_getTargetEditor']();this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x3bcfbd['model']['document']);}['_getSelectionElements'](){const _0x148cf8=this['_getTargetEditor']();return _0x3b0cbb(_0x148cf8['editing'],[..._0x148cf8['model']['markers']['getMarkersGroup']('ai-selection'),..._0x148cf8['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0x332f6b=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0x332f6b)return null;const _0x9dc8f8=this['_getTargetEditor'](),_0x29e5d4=_0x9dc8f8['editing']['view']['document']['getRoot'](_0x332f6b['rootName']);if(!_0x29e5d4)return null;const _0xce1652=_0x9dc8f8['editing']['view']['domConverter']['mapViewToDom'](_0x29e5d4);return _0xce1652&&_0xce1652 instanceof HTMLElement?new ut(_0xce1652):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x1b7d93,_0x2a69e7={}){super(_0x1b7d93),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x2a69e7};const _0x11f434=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x11f434?'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'](_0x3f314e){this['showChangesButton']['isEnabled']=_0x3f314e;}['_setupRatingButtons'](){this['likeButton']=new vt(this['locale']),this['likeButton']['set']({'icon':_0x25b316,'label':Hi(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Bi,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new vt(this['locale']),this['dislikeButton']['set']({'icon':_0x42e1bc,'label':Hi(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Bi,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new vt(this['locale']),this['copyButton']['set']({'icon':_0x16addf,'label':Hi(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Bi,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x4a6945=new xt();_0x4a6945['set']({'content':_0x4ab520}),_0x4a6945['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'+Bi,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Bi;},0x7d0);}),this['copyButton']['children']['add'](_0x4a6945);}['_setupShowChangesButton'](){this['showChangesButton']=new vt(this['locale']),this['showChangesButton']['set']({'icon':_0x3c0485,'label':Hi(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Bi}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0xcdf3ab=>_0xcdf3ab?_0x135466:_0x3c0485),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(_0x5d8fca,_0x41ae1e){super(_0x5d8fca);const _0x54f688=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new _t(),this['_keystrokes']=new It(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x41ae1e,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x5d8fca),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x5d8fca,_0x41ae1e['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x41ae1e),this['_stateView']=new AISuggestionContentPartStateView(_0x5d8fca),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x5d8fca,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x5d8fca,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x14a45b,_0x2c5c11,_0x58c87e,_0x2ff0fa)=>{let _0x448002,_0x4ff88b;'pending'===_0x2ff0fa?(_0x448002=this['_partToolbarView'],_0x4ff88b=this['_stateView']):(_0x448002=this['_stateView'],_0x4ff88b=this['_partToolbarView']),this['_stateView']['setState'](_0x58c87e),_0x448002['isVisible']=!0x1,_0x4ff88b['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x54f688['to']('_state',_0x1e2c10=>'ck-ai-chat-balloon-main_state_'+_0x1e2c10)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x41ae1e);});}['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'](_0xcf4188){_0xcf4188?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0xcf4188);}['setState'](_0xe7da){this['_state']=_0xe7da;}['showError'](_0x48601c){super['showError'](_0x48601c),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x5bf953){super['showBlockingError'](_0x5bf953),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x1f4baa){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x1f4baa;}['togglePartToolbarEnabled'](_0x1eb07b){this['_partToolbarView']['isEnabled']=_0x1eb07b;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x396920,showSuggestButton:_0x30d010}){_0x396920=_0x396920&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x30d010=_0x30d010&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x396920,'showSuggestButton':_0x30d010});}['_createNextButtonView'](){const _0x382a71=new vt(this['locale']);return _0x382a71['set']({'icon':_0x25b93f,'label':Hi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x382a71['on']('execute',()=>{this['fire']('showNext');}),_0x382a71;}['_createPreviousButtonView'](){const _0x5f5d29=new vt(this['locale']);return _0x5f5d29['set']({'icon':_0x19d9ab,'label':Hi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x5f5d29['on']('execute',()=>{this['fire']('showPrevious');}),_0x5f5d29;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0x3a5291,_0xc310f6){super(_0x3a5291),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0xc310f6});}}class AIChatBalloon extends _0x5686f0{static get['requires'](){return[Bt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x359371){super(_0x359371),this['set']('showDiff',!0x1);}['open'](_0x4428a8){const _0x13bcd6=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x13bcd6['plugins']['get']('AIBalloon')['open']({..._0x4428a8,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x4428a8['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x4428a8['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x886269){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x886269);}['setState'](_0x595c01){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x595c01);}['_createChatBalloonView'](){const _0x4eba95=this['editor'],_0x16ee36=_0x4eba95['plugins']['get']('AIBalloon'),_0xc6dd5=_0x4eba95['commands']['get']('trackChanges');let _0x3e2c34=_0x4eba95['config']['get']('ai.availableReplyActions')||[...bs];_0x4eba95['plugins']['has']('TrackChanges')||(_0x3e2c34=_0x3e2c34['filter'](_0x1ade39=>'insertSuggestion'!=_0x1ade39));const _0x531fc0=new AIChatBalloonView(_0x4eba95['locale'],{'availableActions':_0x3e2c34,'showApplyButton':!0x0,'showSuggestButton':!!_0xc6dd5});return _0x531fc0['bind']('showDiff')['to'](this),_0x531fc0['delegate'](...Cs)['to'](this),_0x531fc0['delegate']('showPrevious','showNext')['to'](this),_0x16ee36['delegate']('dialogClosed')['to'](this),_0x531fc0['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x531fc0['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x531fc0['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0xc6dd5&&_0x531fc0['bind']('isTrackChangesOn')['to'](_0xc6dd5,'value'),_0x531fc0['render'](),_0x531fc0;}['_toggleRotatorButtonsInDialogHeader'](_0x54011d){const _0x2400cf=this['editor'],_0x2c53db=_0x2400cf['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x54011d),_0x2c53db['has'](this['_chatBalloonView']['previousButtonView'])||(_0x2c53db['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x2400cf['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x2c53db['remove'](this['_chatBalloonView']['previousButtonView']),_0x2c53db['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x5686f0{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0x53f39c];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Dn(_0x5740b3){const {editor:_0x30f874,action:_0x528cdb,withText:_0x44b376=!0x1,withIcon:_0x342346=!0x0,isInDropdown:_0x5dae9d=!0x0,shouldPreventFocus:_0x2eecc6=!0x1}=_0x5740b3;return()=>{const _0x3370e7=_0x30f874['locale'],_0x1c254e=new vt(_0x3370e7),_0x4a35ed=_0x1c254e['bindTemplate'];_0x5dae9d&&_0x1c254e['extendTemplate']({'on':{'mouseenter':_0x4a35ed['to'](()=>{_0x2eecc6&&_0x2eecc6()||_0x1c254e['focus']();})}});const _0x14d377=_0x528cdb['icon']??_0x528cdb['parent']?.['icon'];return _0x1c254e['set']({'label':_0x528cdb['label'],'withText':_0x44b376,'role':'menuitem','icon':_0x342346?_0x14d377??_0x15178f:void 0x0,'tooltip':!_0x44b376,'class':'ck-ai-quick-actions-button','isEnabled':_0x528cdb['isEnabled']}),_0x1c254e['on']('execute',()=>{_0x30f874['editing']['view']['focus'](),_0x30f874['commands']['execute']('aiQuickAction',_0x528cdb);}),_0x1c254e;};}class DropdownMenuButtonWithHighlightView extends _0x1a80af{['arrowView'];constructor(_0x44ac96,_0x1d10b8){super(_0x44ac96,_0x1d10b8);const _0x2a79cc=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',_0x21df78=>String(_0x21df78)),'data-cke-tooltip-disabled':_0x2a79cc['to']('isOn')},'on':{'mouseenter':_0x2a79cc['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x493fc9=new xt();return _0x493fc9['content']=_0x4e78fd,_0x493fc9['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x493fc9;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x307844,_0x3d461b,_0x575ab5){super(_0x307844),this['_allListItems']=_0x3d461b,this['_allSearchableItems']=_0x575ab5;}['filter'](_0x4323e1){if(!_0x4323e1)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x47a32e=_0x4323e1['source']['toLowerCase']()['trim'](),_0x5edc3e=this['_allSearchableItems']['filter'](_0x466400=>(_0x466400['groupLabel']?_0x466400['label']+'\x20('+_0x466400['groupLabel']+')':_0x466400['label'])['toLowerCase']()['includes'](_0x47a32e));return this['items']['clear'](),this['items']['addMany'](_0x5edc3e['sort']((_0xfd0f7,_0x4ba55e)=>{const _0x192982=_0xfd0f7['groupLabel'],_0x511a20=_0x4ba55e['groupLabel'];return _0x192982||_0x511a20?_0x192982?0x1:-0x1:0x0;})['map'](_0x12acc6=>_0x12acc6['item'])),this['_highlightQuery'](_0x47a32e,_0x5edc3e),{'resultsCount':_0x5edc3e['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x50f829,_0x15cf78){if(!_0x50f829)return;const _0x1d0583=new RegExp(_0x118ed5(_0x50f829),'gi');_0x15cf78['forEach'](_0x520732=>{_0x520732['highlightViews']&&_0x520732['highlightViews']['forEach'](_0x48a4ac=>{'function'==typeof _0x48a4ac['highlightText']&&_0x48a4ac['highlightText'](_0x1d0583);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x30c63f=>{_0x30c63f['highlightViews']&&_0x30c63f['highlightViews']['forEach'](_0x718807=>{'function'==typeof _0x718807['highlightText']&&_0x718807['highlightText'](null);});});}}const Vn='menu',Pn='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];constructor(_0xe34866,_0x1e7b69,_0x30c6d7,_0x2e1121,_0x191738=!0x1){const _0x519fc6=_0xe34866['locale'];super(_0x519fc6),this['_bodyCollection']=_0x2e1121,this['_hasSearch']=_0x191738;const _0x40a10=this['_createListItems'](_0xe34866,_0x1e7b69,_0x30c6d7);this['optionsListView']=new AIQuickActionsFilteredListView(_0x519fc6,_0x40a10,this['_allSearchableItems']),this['optionsListView']['role']=Vn,this['optionsListView']['items']['addMany'](_0x40a10),this['focusTracker']=new _t(),this['keystrokes']=new It(),_0x191738&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x40a10,this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x191738&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x33d883=_0x191738&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x184ac3(_0x33d883),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x519fc6['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x1be4c1(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Hi(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Hi(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x3967ca=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x3967ca);}['_createListItems'](_0x18d7ca,_0x80db2e,_0xd2604a){const _0x78a576=new _0x184ac3();return _0x80db2e['forEach'](_0x1b5ca2=>{if('actions'in _0x1b5ca2){const {listItem:_0x5018e7}=this['_createActionGroupButton'](_0x18d7ca,_0x1b5ca2,_0xd2604a);_0x78a576['add'](_0x5018e7),_0x1b5ca2['actions']['forEach'](_0x34b3e0=>{this['_createActionButton'](_0x18d7ca,_0x34b3e0,_0x1b5ca2['label'],_0x1b5ca2['icon']);const {listItem:_0x56b90c,highlightViews:_0x229503}=this['_createSearchResultActionButton'](_0x18d7ca,_0x34b3e0,_0x1b5ca2['label'],_0x1b5ca2['icon']);this['_allSearchableItems']['push']({'item':_0x56b90c,'label':_0x34b3e0['label'],'groupLabel':_0x1b5ca2['label'],'highlightViews':_0x229503});});}else{const {listItem:_0x1bfaa6}=this['_createActionButton'](_0x18d7ca,_0x1b5ca2);_0x78a576['add'](_0x1bfaa6);const _0x173792=_0x1bfaa6['children']['first'];if(_0x173792){const {listItem:_0x303359,highlightViews:_0x4cacfe}=this['_createSearchResultActionButton'](_0x18d7ca,_0x1b5ca2);this['_allSearchableItems']['push']({'item':_0x303359,'label':_0x173792['label']||'','highlightViews':_0x4cacfe});}}}),_0x78a576;}['_createActionButton'](_0x58bbd1,_0x42e8d2,_0x1f4c60,_0x5089be){const _0x167e88=new Pt(this['locale']);if(_0x1f4c60&&_0x5089be){const _0x3a4234=new vt(this['locale']),_0x4562fe=_0x3a4234['bindTemplate'],_0x2e955b=new _0x2cc319();_0x2e955b['text']=_0x42e8d2['label'];const _0x2f6be8=new _0x2cc319();_0x2f6be8['text']=_0x1f4c60;const _0x2e7b1e=new xt();_0x2e7b1e['content']=_0x5089be,_0x2e7b1e['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x32cef2=new Nt(this['locale']);_0x32cef2['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x14a07c=new Nt(this['locale']);return _0x14a07c['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x3a4234['set']({'label':_0x42e8d2['label']+'\x20('+_0x1f4c60+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1}),_0x3a4234['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group'],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x2e955b,_0x32cef2,_0x2e7b1e,_0x2f6be8,_0x14a07c],'on':{'mouseenter':_0x4562fe['to'](()=>{this['_isSearchFocused']()||_0x3a4234['focus']();}),'click':_0x4562fe['to'](()=>{_0x3a4234['fire']('execute');})}}),_0x3a4234['on']('execute',()=>{_0x58bbd1['editing']['view']['focus'](),_0x58bbd1['commands']['execute']('aiQuickAction',_0x42e8d2);}),_0x167e88['children']['add'](_0x3a4234),{'listItem':_0x167e88,'highlightViews':[_0x2e955b,_0x2f6be8]};}{const _0x520aa0=new _0x41ed25(),_0x392424=new vt(this['locale'],_0x520aa0),_0x1b2491=_0x392424['bindTemplate'],_0x17a501=_0x42e8d2['icon']??_0x42e8d2['parent']?.['icon'],_0x47bf85=void 0x0!==_0x42e8d2['icon'];return _0x392424['set']({'label':_0x42e8d2['label'],'withText':!0x0,'role':'menuitem','icon':_0x47bf85?_0x17a501??_0x15178f:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button'}),_0x392424['extendTemplate']({'on':{'mouseenter':_0x1b2491['to'](()=>{this['_isSearchFocused']()||_0x392424['focus']();})}}),_0x392424['on']('execute',()=>{_0x58bbd1['editing']['view']['focus'](),_0x58bbd1['commands']['execute']('aiQuickAction',_0x42e8d2);}),_0x167e88['children']['add'](_0x392424),{'listItem':_0x167e88,'highlightViews':[_0x520aa0]};}}['_createSearchResultActionButton'](_0x28a962,_0x17345a,_0x261af5,_0x4c2754){return _0x261af5&&_0x4c2754?this['_createSearchResultGroupedActionButton'](_0x28a962,_0x17345a,_0x261af5,_0x4c2754):this['_createSearchResultIndividualActionButton'](_0x28a962,_0x17345a);}['_createSearchResultGroupedActionButton'](_0xdc7895,_0x45986f,_0x164249,_0x3fdb1d){const _0x216ec8=new Pt(this['locale']),_0x10fd92=new vt(this['locale']),_0x1bcf97=_0x10fd92['bindTemplate'],{view:_0x384190,highlightView:_0x3f3c7f}=this['_createSearchResultGroupRow'](_0x164249,_0x3fdb1d),{view:_0x765f27,highlightView:_0x5f06e7}=this['_createSearchResultActionRow'](_0x45986f['label']),_0x178c6c=this['_createSearchResultContentView'](_0x384190,_0x765f27);return _0x10fd92['set']({'label':_0x45986f['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}),_0x10fd92['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'],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x178c6c],'on':{'mouseenter':_0x1bcf97['to'](()=>{this['_isSearchFocused']()||_0x10fd92['focus']();}),'click':_0x1bcf97['to'](()=>{this['_handleSearchResultButtonClick'](_0x10fd92);})}}),this['_setupActionButtonExecution'](_0x10fd92,_0xdc7895,_0x45986f),_0x216ec8['children']['add'](_0x10fd92),{'listItem':_0x216ec8,'highlightViews':[_0x3f3c7f,_0x5f06e7]};}['_createSearchResultIndividualActionButton'](_0x8267fc,_0x273684){const _0x4bd528=new Pt(this['locale']),_0x5f38ee=new _0x41ed25(),_0x3c3393=new vt(this['locale'],_0x5f38ee),_0x41fc99=_0x3c3393['bindTemplate'];return _0x3c3393['set']({'label':_0x273684['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button'}),_0x3c3393['extendTemplate']({'on':{'mouseenter':_0x41fc99['to'](()=>{this['_isSearchFocused']()||_0x3c3393['focus']();})}}),this['_setupActionButtonExecution'](_0x3c3393,_0x8267fc,_0x273684),_0x4bd528['children']['add'](_0x3c3393),{'listItem':_0x4bd528,'highlightViews':[_0x5f38ee]};}['_createSearchResultGroupRow'](_0xbcb694,_0x23c909){const _0x2bff3a=new Nt(this['locale']),_0x5701a2=new xt();_0x5701a2['content']=_0x23c909,_0x5701a2['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x3445ca=new _0x2cc319();return _0x3445ca['text']=_0xbcb694,_0x2bff3a['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x5701a2,_0x3445ca]}),{'view':_0x2bff3a,'highlightView':_0x3445ca};}['_createSearchResultActionRow'](_0x5a2a36){const _0x23d42f=new Nt(this['locale']),_0x3be05d=new _0x2cc319();return _0x3be05d['text']=_0x5a2a36,_0x23d42f['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x3be05d]}),{'view':_0x23d42f,'highlightView':_0x3be05d};}['_createSearchResultContentView'](_0x3f8b9b,_0x1d9971){const _0x463cac=new Nt(this['locale']);return _0x463cac['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x3f8b9b,_0x1d9971]}),_0x463cac;}['_setupActionButtonExecution'](_0x1ff7db,_0x589f1b,_0x570b3b){_0x1ff7db['on']('execute',()=>{_0x589f1b['editing']['view']['focus'](),_0x589f1b['commands']['execute']('aiQuickAction',_0x570b3b);});}['_createActionGroupButton'](_0x9c83ec,_0x463129,_0x5435c1){const _0x19345f=new Pt(this['locale']),_0x2dcf3b=new _0x41ed25(),_0x2c001e=new DropdownMenuButtonWithHighlightView(this['locale'],_0x2dcf3b),_0x3af358=_0x2c001e['bindTemplate'],_0x5d57a9=this['_getPanelKeystroke'](_0x5435c1),_0x31680b=this['_createGroupActionsList'](_0x9c83ec,_0x463129['actions'],_0x5435c1);_0x2c001e['set']({'label':_0x463129['label'],'withText':!0x0,'role':Pn,'icon':_0x463129['icon']??_0x15178f,'isEnabled':_0x463129['actions']['some'](_0x446916=>_0x446916['isEnabled'])}),_0x2c001e['extendTemplate']({'on':{'mouseenter':_0x3af358['to'](()=>{this['_isSearchFocused']()||_0x2c001e['focus']();})}});const _0x195084=new Xt(this['locale']);return _0x195084['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x3af358['to'](_0x2f9350=>{this['_handlePanelKeydown'](_0x2f9350,_0x5d57a9,_0x2c001e,_0x195084);})}}),_0x2c001e['bind']('isOn')['to'](_0x195084,'isVisible'),this['_bodyCollection']['add'](_0x195084),_0x195084['content']['add'](_0x31680b),this['_setupGroupMenuBehavior'](_0x2c001e,_0x195084),_0x19345f['children']['add'](_0x2c001e),{'listItem':_0x19345f,'highlightView':_0x2dcf3b};}['_createGroupActionsList'](_0x4ce50c,_0x58e611,_0x5d1d13){const _0xeee480=new Dt(this['locale']);return _0xeee480['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x58e611['forEach'](_0x1b11a0=>{const _0x128ce4=new Pt(this['locale']),_0x15c177=Dn({'editor':_0x4ce50c,'action':_0x1b11a0,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused']()})();_0x128ce4['children']['add'](_0x15c177),_0x5d1d13['focusTracker']['add'](_0x15c177),_0xeee480['items']['add'](_0x128ce4);}),_0xeee480;}['_setupGroupMenuBehavior'](_0x2f8d83,_0x2ad09d){const _0x34c50d=_0x2f8d83['bindTemplate'],_0x43bca3=this['_getButtonKeystroke'](_0x2f8d83);_0x2f8d83['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x34c50d['to'](()=>{this['_showNestedPanel'](_0x2ad09d,_0x2f8d83);}),'mouseleave':_0x34c50d['to'](_0x40e17c=>{const _0x2c38d7=_0x40e17c['relatedTarget'];this['_isMovingToNestedMenu'](_0x2c38d7,_0x2ad09d)||this['_hideNestedPanel'](_0x2ad09d);}),'keydown':_0x34c50d['to'](_0x40b213=>{_0x40b213['key']==_0x43bca3&&(this['_showNestedPanel'](_0x2ad09d,_0x2f8d83),_0x2ad09d['content']['get'](0x0)['focus']());})}}),_0x2ad09d['on']('render',()=>{_0x2ad09d['element']?.['addEventListener']('mouseleave',_0x4a3fa5=>{const _0x54e563=_0x4a3fa5['relatedTarget'];_0x2f8d83['element']?.['contains'](_0x54e563)||this['_isMovingToNestedMenu'](_0x54e563,_0x2ad09d)||this['_hideNestedPanel'](_0x2ad09d);});});}['_showNestedPanel'](_0x21ce17,_0x53b444){this['_openNestedPanels']['forEach'](_0x5508d1=>{_0x5508d1!==_0x21ce17&&_0x5508d1['isVisible']&&_0x5508d1['hide']();}),_0x21ce17['show'](),_0x21ce17['pin']({'positions':[_0x16a65a['eastSouth']],'target':_0x53b444['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x21ce17);}['_hideNestedPanel'](_0x3e0619){_0x3e0619['hide'](),this['_openNestedPanels']['delete'](_0x3e0619);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0xef818e=>_0xef818e['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x237360,_0x24ac57){if(!_0x237360)return!0x1;if(_0x24ac57['element']?.['contains'](_0x237360))return!0x0;const _0x3b49b1=_0x237360;return _0x3b49b1['closest']&&(null!==_0x3b49b1['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x3b49b1['closest']('.ck-ai-quick-actions-group-list')||null!==_0x3b49b1['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'](_0x7b1c19){return'rtl'===_0x7b1c19['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x2f8450){return'rtl'===_0x2f8450['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x56e64f,_0x3904b5,_0x10e987,_0x1227f8){_0x56e64f['key']==_0x3904b5&&(_0x10e987['focus'](),this['_hideNestedPanel'](_0x1227f8));}['_handleSearchResultButtonClick'](_0x2b7639){_0x2b7639['fire']('execute');}}function Hn(_0x4feb05){const {editor:_0x70d6f9,content:_0x9bc839,buttonDefinition:_0x43b155,bodyCollection:_0x4f6ade,hasSearch:_0x6db618=!0x1}=_0x4feb05;return()=>{const _0x2a4fad=_0x70d6f9['locale'],_0x42763c=_0x70d6f9['commands']['get']('aiQuickAction'),_0x3b78fc=Gt(_0x2a4fad);_0x3b78fc['bind']('isEnabled')['to'](_0x42763c),_0x3b78fc['buttonView']['set']({'icon':_0x43b155['icon']??_0x15178f,'label':_0x43b155['label'],'tooltip':!0x0}),_0x3b78fc['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x41199c=new AIQuickActionsDropdownContentView(_0x70d6f9,_0x9bc839,_0x3b78fc,_0x4f6ade,_0x6db618);return _0x3b78fc['panelView']['children']['add'](_0x41199c),_0x6db618&&_0x3b78fc['on']('change:isOpen',(_0x1db5a6,_0x221523,_0x34ccac)=>{if(_0x34ccac){if(_0x70d6f9['plugins']['has']('AIEditing')){const _0x53d3ce=_0x70d6f9['plugins']['get'](AIEditing),_0x3398a6=_0x70d6f9['model']['document']['selection'],_0x45fa35=Array['from'](_0x3398a6['getRanges']());_0x45fa35['length']>0x0&&_0x53d3ce['showFakeVisualSelection']({'ranges':_0x45fa35,'id':'quick-action','priority':0x14});}}else _0x70d6f9['plugins']['has']('AIEditing')&&_0x70d6f9['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0x41199c['resetSearch']();}),_0x3b78fc;};}const Mn='<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>',Un='<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>',Bn='<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>',Gn=/* #__PURE__ -- @preserve */
28
- ((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x5686f0{static get['requires'](){return[_0x1397b8,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['init'](){const _0x57c520=await this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x57c520),this['_initializeQuickActionsComponentsAndCommands']();}static['getDefaultQuickActions'](_0x262bed){return function(_0x4c0222){const _0x112528=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x4c0222['uiLanguage']),_0x56c781=_0x112528||'English',_0x23e73f=[{'id':'ask-ai','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x4ea6bb},{'id':'chat-commands','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x4ea6bb,'actions':[{'id':'explain','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Hi(_0x4c0222,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Mn['replace']('%0',_0x56c781),'type':'chat'},{'id':'summarize','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Hi(_0x4c0222,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Un['replace']('%0',_0x56c781),'type':'chat'},{'id':'highlight-key-points','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Hi(_0x4c0222,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Bn['replace']('%0',_0x56c781),'type':'chat'}]},{'id':'improve-writing','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x3da124},{'id':'continue','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x382928},{'id':'fix-grammar','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x2920e7},{'id':'adjust-length','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x10b01a,'actions':[{'id':'make-shorter','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x1aa706,'actions':[{'id':'make-tone-casual','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x4d8ff7,'actions':[{'id':'translate-to-english','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Hi(_0x4c0222,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x47860a,'actions':[]}];return _0x23e73f;}(_0x262bed);}async['_getDefaultAndCustomActions'](){const _0x22802c=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x30ed0a=this['editor']['config']['get']('ai.quickActions.extraCommands')||[];let _0x36c501,_0x549fd8=[];try{const _0x2b8c2e=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']});_0x549fd8=await _0x2b8c2e['getAll'](),_0x36c501=(await _0x2b8c2e['getDefault']())?.['id'];}catch(_0xb44da0){const _0x536518=new at('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0xb44da0});Ct(_0x536518['message']);}finally{const _0x415f8b=_0x30ed0a['map'](_0x593df9=>({..._0x593df9,'type':'chat'===_0x593df9['type']?'chat':'action','model':'chat'!==_0x593df9['type']?_0x593df9['model']||_0x36c501:_0x593df9['model'],'icon':void 0x0}));_0x22802c['find'](_0x39297b=>'other'===_0x39297b['id'])['actions']['push'](..._0x415f8b),_0x22802c['forEach'](_0x9ee46c=>{if('actions'in _0x9ee46c)_0x9ee46c['actions']['forEach'](_0x168339=>{if(_0x168339['isEnabled']=!!_0x549fd8['find'](_0x478435=>_0x478435['id']===_0x168339['model'])||void 0x0===_0x168339['model'],!_0x168339['isEnabled']){const _0x3e6fa3=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x168339['id'],'modelId':_0x168339['model']});Ct(_0x3e6fa3['message']);}});else{if(_0x9ee46c['isEnabled']=!!_0x549fd8['find'](_0x31c0ae=>_0x31c0ae['id']===_0x9ee46c['model'])||void 0x0===_0x9ee46c['model'],!_0x9ee46c['isEnabled']){const _0x23c8cb=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x9ee46c['id'],'modelId':_0x9ee46c['model']});Ct(_0x23c8cb['message']);}}});}return _0x22802c;}['_initializeQuickActionsComponentsAndCommands'](){const _0x46d16a=new Qt(this['editor']['locale']);_0x46d16a['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x46d16a),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x46d16a);}['_initializeQuickActionsDropdown'](_0x4a283c){const _0x1e8ee6=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Hn({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x15178f,'label':Hi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x4a283c,'hasSearch':_0x1e8ee6}));}['_prepareQuickActionsDefinition'](_0x5ab370){this['_quickActionsDefinition']=_0x5ab370['map'](_0x45a965=>{if('actions'in _0x45a965){const _0x486e6f=_0x45a965;return{..._0x486e6f,'actions':_0x486e6f['actions']['map'](_0x1083b0=>{const {actions:_0x464160,..._0x1144d4}=_0x486e6f;return{..._0x1083b0,'parent':_0x1144d4};})['filter'](_0x250202=>this['_shouldIncludeAction'](_0x250202))};}return _0x45a965;})['filter'](_0x588df8=>'actions'in _0x588df8?_0x588df8['actions']['length']>0x0:this['_shouldIncludeAction'](_0x588df8));}['_shouldIncludeAction'](_0x273eb1){const _0x442d4d=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Gn[_0x273eb1['type']])&&!_0x442d4d['includes'](_0x273eb1['id'])&&!('chat'===_0x273eb1['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x13cdfc){this['_quickActionsDefinition']['forEach'](_0x5d3514=>{if('actions'in _0x5d3514){const _0xdd2cc4=Hn({'editor':this['editor'],'content':_0x5d3514['actions'],'buttonDefinition':_0x5d3514,'bodyCollection':_0x13cdfc});this['editor']['ui']['componentFactory']['add'](_0x5d3514['id'],_0xdd2cc4),_0x5d3514['actions']['forEach'](_0x50b04f=>{const _0x35f205=Dn({'editor':this['editor'],'action':_0x50b04f});this['editor']['ui']['componentFactory']['add'](_0x50b04f['id'],_0x35f205);});}else{const _0x25d970=Dn({'editor':this['editor'],'action':_0x5d3514,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1});this['editor']['ui']['componentFactory']['add'](_0x5d3514['id'],_0x25d970);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x5c3939=>{const _0xb3a897=this['editor']['commands']['get']('aiQuickAction'),_0x142d68=new Kt(_0x5c3939),_0x28991f=Hi(_0x5c3939,'AI_QUICK_ACTIONS_HEADING');_0x142d68['buttonView']['set']({'label':_0x28991f,'icon':_0x15178f});const _0x27b855=new $t(_0x5c3939);return _0x27b855['set']({'ariaLabel':_0x28991f,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x42b42a=>{if('actions'in _0x42b42a){const _0x220b39=_0x42b42a,_0x4da48e=new qt(_0x5c3939,_0x142d68),_0x55d867=new Kt(_0x5c3939),_0x47ebea=new $t(_0x5c3939);_0x55d867['buttonView']['set']({'label':_0x220b39['label'],'icon':_0x220b39['icon']}),_0x220b39['actions']['forEach'](_0x4be1ed=>{const _0x3b3dee=new qt(_0x5c3939,_0x55d867),_0x6adb2=new Wt(_0x5c3939);_0x6adb2['set']({'label':_0x4be1ed['label'],'icon':_0x4be1ed['icon'],'role':'menuitem','isEnabled':_0x4be1ed['isEnabled']}),_0x6adb2['on']('execute',()=>{this['_executeQuickAction'](_0x4be1ed);}),_0x6adb2['delegate']('execute')['to'](_0x55d867),_0x3b3dee['children']['add'](_0x6adb2),_0x47ebea['items']['add'](_0x3b3dee);}),_0x55d867['panelView']['children']['add'](_0x47ebea),_0x4da48e['children']['add'](_0x55d867),_0x27b855['items']['add'](_0x4da48e);}else{const _0x3435a3=_0x42b42a,_0x1bec63=new qt(_0x5c3939,_0x142d68),_0xb50041=new Wt(_0x5c3939);_0xb50041['set']({'label':_0x3435a3['label'],'icon':_0x3435a3['icon'],'role':'menuitem','isEnabled':_0x3435a3['isEnabled']}),_0xb50041['on']('execute',()=>{this['_executeQuickAction'](_0x3435a3);}),_0xb50041['delegate']('execute')['to'](_0x142d68),_0x1bec63['children']['add'](_0xb50041),_0x27b855['items']['add'](_0x1bec63);}}),(Object['values'](Gn)['some'](_0x57a7f2=>this['editor']['plugins']['has'](_0x57a7f2))?_0x142d68['bind']('isEnabled')['to'](_0xb3a897):_0x142d68['set']({'isEnabled':!0x1}),_0x142d68['panelView']['children']['add'](_0x27b855),_0x142d68);});}['_executeQuickAction'](_0x326a83){const _0x1009be=this['editor'];_0x1009be['editing']['view']['focus'](),_0x1009be['commands']['execute']('aiQuickAction',_0x326a83);const _0x9a0ea9=_0x1009be['ui']['view']['menuBarView'];_0x9a0ea9&&_0x9a0ea9['close']&&_0x9a0ea9['close']();}}class AIQuickActionsCommand extends _0x3a665b{['execute'](_0x34ea70){switch(this['_expandSelectionIfCollapsed'](),_0x34ea70['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x5c2611=Hi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x5c2611});}this['_handleAIChatAction'](_0x34ea70);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0xe070b4=Hi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0xe070b4});}this['_handleAIActionsAction'](_0x34ea70);}}async['_handleAIChatAction'](_0x52fda5){const _0x21d8ab=this['editor']['plugins']['get']('AIChatController'),_0x202cfd=this['editor']['plugins']['get']('AITabs')['view'];if(_0x202cfd['isVisible']||(_0x202cfd['isVisible']=!0x0),'chat'!==_0x202cfd['activeTab']&&_0x202cfd['activateTab']('chat'),'ask-ai'===_0x52fda5['id'])_0x21d8ab['removeSelectionFromChatContext'](),_0x21d8ab['addSelectionToChatContext'](),_0x21d8ab['focusPromptInput']();else await _0x21d8ab['startConversation']({'modelId':_0x52fda5['model']}),_0x21d8ab['removeSelectionFromChatContext'](),_0x21d8ab['addSelectionToChatContext'](),_0x21d8ab['focusPromptInput'](),await _0x21d8ab['sendMessage']({'message':_0x52fda5['prompt']||_0x52fda5['displayedPrompt']||_0x52fda5['label'],'attributes':{'quickActionData':{'id':_0x52fda5['id']},'displayedPrompt':_0x52fda5['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x29c2a9=this['editor'],_0x133dba=_0x29c2a9['model']['document']['selection'];if(!_0x133dba['isCollapsed'])return;const _0xf9c67a=At(_0x133dba['getSelectedBlocks']())||_0x29c2a9['model']['schema']['getLimitElement'](_0x133dba);_0x29c2a9['model']['change'](_0xb61017=>{_0xb61017['setSelection'](_0xf9c67a,'in');});}['_handleAIActionsActionLabel'](_0x28d9f3){return _0x28d9f3['parent']?.['label']&&'other'!==_0x28d9f3['parent']?.['id']?_0x28d9f3['parent']['label']+':\x20'+_0x28d9f3['label']:_0x28d9f3['label'];}async['_handleAIActionsAction'](_0x3c4381){const _0x371034=this['editor']['plugins']['get']('AIActions'),_0x47ae19=_0x3c4381['prompt']?{'userMessage':_0x3c4381['prompt'],'model':_0x3c4381['model']}:{'actionName':_0x3c4381['actionName']||_0x3c4381['id'],'args':_0x3c4381['args']},_0x3e4a50=this['_handleAIActionsActionLabel'](_0x3c4381);await _0x371034['executeAction'](_0x47ae19,_0x3e4a50,_0x3c4381['icon']);}}class AIQuickActionsEditing extends _0x5686f0{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3b3469=this['editor'],_0xec171a=new AIQuickActionsCommand(this['editor']);if(_0x3b3469['commands']['add']('aiQuickAction',_0xec171a),_0x3b3469['plugins']['has']('AIChat')){const _0x547d2c=this['editor']['plugins']['get']('AIChatController');_0x3b3469['model']['document']['selection']['on']('change:range',(_0x51f44f,_0x4e26eb)=>{_0x4e26eb['directChange']&&_0x547d2c['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['updateChangeGroups'](){if(this['parsedMergedContent']=this['parsedContent']['cloneNode'](!0x0),0x0==this['parsedMergedContent']['childNodes']['length'])return void(this['changeGroups']=[]);const _0x4cfe1d=this['documentContextContent']['children']['map'](_0x129576=>({'node':_0x129576,'id':$i(_0x129576,'data-id')})),_0x198c7b=this['parsedMergedContent']['children']['map'](_0x45521d=>({'node':_0x45521d,'id':$i(_0x45521d,'data-id')||ot()})),_0x392da4=_0x3e20ff(_0x4cfe1d,_0x198c7b,{'comparator':(_0x13528a,_0x4db7c8)=>_0x13528a['id']==_0x4db7c8['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x392da4['length']&&_0x392da4[_0x392da4['length']-0x1]['removed'];)_0x392da4['pop']();}const _0x2623df=_0x392da4['map'](_0x1b57c4=>{const _0x4c4a59=_0x1b57c4['added']?'new':_0x1b57c4['removed']?'removed':'modified';return{'node':_0x1b57c4['value'][0x0]['node'],'type':_0x4c4a59,'id':_0x1b57c4['value'][0x0]['id']};});this['changeGroups']=[{'changes':_0x2623df,'state':'pending','index':0x0}];}['_getDifferentChangeGroups'](_0x3a609f,_0x55f00d){return _0x55f00d;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x5abbd7){super(_0x5abbd7),this['content']=_0x5abbd7['content'],this['version']=_0x5abbd7['version'],this['actionName']=_0x5abbd7['actionName'],this['args']=_0x5abbd7['args'],this['userMessage']=_0x5abbd7['userMessage'],this['model']=_0x5abbd7['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':'text','content':this['content'],'version':this['version'],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x289a67){const _0x2e1e14=new AIActionsReply({'locale':this['locale'],'documentContextContent':this['content'],..._0x289a67});return this['replies']['push'](_0x2e1e14),_0x2e1e14['delegate'](...rs)['to'](this),this['fire']('replyCreated',_0x2e1e14),_0x2e1e14;}}class AIActionsBalloonToolbarView extends kt{constructor(_0x2baaf6,_0x515fa2=!0x0,_0x5f213f=!0x0){super(_0x2baaf6),this['set']('isEnabled',!0x1),_0x515fa2&&(this['applyButton']=this['_createButton'](Hi(_0x2baaf6,'AI_BALLOON_APPLY_BUTTON'),Mi),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x5f213f&&(this['suggestButton']=this['_createButton'](Hi(_0x2baaf6,'AI_BALLOON_SUGGEST_BUTTON'),_0x515fa2?Ui:Mi),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x515fa2,'showSuggestButton':_0x5f213f}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x368168,showSuggestButton:_0x4f8161}){this['applyButton']&&(this['applyButton']['isVisible']=_0x368168),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x4f8161);}['_createButton'](_0x187e12,_0xc64a21){const _0x542250=new vt(this['locale']);return _0x542250['set']({'label':_0x187e12,'class':_0xc64a21,'isVisible':!0x0,'withText':!0x0}),_0x542250;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0x5bfa3d){super(_0x5bfa3d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Hi(_0x5bfa3d,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0x26219f){super(_0x26219f),this['set']('isVisible',!0x0);const _0x1d343f=new AISpinnerView('small');_0x1d343f['isVisible']=!0x0;const _0x1e8cb2=new Nt(this['locale']);_0x1e8cb2['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Hi(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x24a33b=>!_0x24a33b)]},'children':[_0x1d343f,_0x1e8cb2]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x1686bc,_0x8d9730){super(_0x1686bc),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x8d9730,this['_focusTracker']=new _t(),this['_keystrokes']=new It(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Mt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x184ac3(),this['_addContentWrapper'](_0x8d9730),this['_addDisclaimerView'](),this['_addToolbar'](_0x8d9730),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'](_0x8d9730);});}['render'](){super['render']();for(const _0xc7d7b1 of this['_focusables'])this['_focusTracker']['add'](_0xc7d7b1['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0xbe5acf){-0x1===_0xbe5acf?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x9dbb5e){this['_isLoading']=_0x9dbb5e;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x57b6a7){super['showError'](_0x57b6a7),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x1f0392){super['showBlockingError'](_0x1f0392),this['setErrorState']();}['addMiniToolbarItem'](_0x260d7e){this['_miniToolbarView']['items']['has'](_0x260d7e)||this['_miniToolbarView']['items']['add'](_0x260d7e);}['removeMiniToolbarItem'](_0x1649e9){this['_miniToolbarView']['items']['has'](_0x1649e9)&&this['_miniToolbarView']['items']['remove'](_0x1649e9);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x1e6fab,showSuggestButton:_0x2acea1}){_0x1e6fab=_0x1e6fab&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x2acea1=_0x2acea1&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x1e6fab,'showSuggestButton':_0x2acea1});}async['updateContent'](_0x3abfde){await this['_streamableContentView']['update'](_0x3abfde);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x29bc75){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'](_0x29bc75['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x3e3e39,showSuggestButton:_0x4714d9}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x3e3e39,_0x4714d9),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',(_0x41063a,_0x550ab5,_0x2afe1a)=>!(_0x41063a||_0x550ab5||_0x2afe1a)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x3e3e39,'showSuggestButton':_0x4714d9}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0xbd35df){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0xbd35df),this['_miniToolbarView']['delegate'](...Cs)['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',(_0x42ba7a,_0x3e7e38)=>!(_0x42ba7a||_0x3e7e38)),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 _0x3487cd=new vt(this['locale']),_0x2e7bb6=new vt(this['locale']),_0x5c7a94=new AIActionsBalloonNavigationCounterView(this['locale']),_0x279209=new vt(this['locale']);_0x3487cd['set']({'icon':tt,'label':Hi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Bi}),_0x2e7bb6['set']({'icon':_0x1607c0,'tooltip':Hi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Bi}),_0x279209['set']({'icon':et,'tooltip':Hi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Bi}),_0x3487cd['bind']('isEnabled')['to'](this,'isBusy',_0x5d81b2=>!_0x5d81b2),_0x3487cd['on']('execute',()=>{this['fire']('tryAgain');}),_0x2e7bb6['bind']('isEnabled')['to'](this,'isBusy',_0x9c04eb=>!_0x9c04eb),_0x2e7bb6['on']('execute',()=>{this['fire']('showPrevious');}),_0x279209['bind']('isEnabled')['to'](this,'isBusy',_0xf2ca2a=>!_0xf2ca2a),_0x279209['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x2e7bb6,this['_navigationCounter']=_0x5c7a94,this['_navigationNextButton']=_0x279209,this['_navigationTryAgainButton']=_0x3487cd;}['updateMiniToolbarButtons'](_0x37123e,_0x92f639){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x25b2ee=_0x37123e>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x25b2ee){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x19aa5a=_0x37123e-_0x92f639;this['_navigationCounter']['setInteractionCount'](_0x19aa5a+'/'+_0x37123e),this['_navigationPreviousButton']['isEnabled']=_0x92f639<_0x37123e-0x1,this['_navigationNextButton']['isEnabled']=_0x92f639>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'](_0x402e5c){this['_isLoading']=_0x402e5c;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x16a791=this['_getScrollableElement']();_0x16a791&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x16a791));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x54710d){super(_0x54710d);const _0x3d5e83=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x3d5e83['to']('interactionCount')}]});}['setInteractionCount'](_0x21a953){this['set']('interactionCount',_0x21a953);}}class AIActions extends _0x5686f0{static get['requires'](){return[AIConnector,Bt,AIEditing,AIBalloon,_0x53dd97];}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(_0x53190e){super(_0x53190e),this['_bodyCollection']=new Qt(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'](_0x3f2efb,_0x176b30,_0x26a68e){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x27f200,anchorData:_0x301c46,root:_0x4f3a72}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x3f2efb,_0x27f200,_0x301c46,_0x4f3a72,_0x176b30,_0x26a68e);}}const {modelFragment:_0x3dd295,anchorData:_0x304d69,root:_0x36f77a}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x3f2efb,_0x3dd295,_0x304d69,_0x36f77a,_0x176b30,_0x26a68e);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x1ebd58=this['editor']['plugins']['has']('TrackChanges');let _0xd5ae9=this['editor']['config']['get']('ai.availableReplyActions')||[...bs];_0x1ebd58||(_0xd5ae9=_0xd5ae9['filter'](_0x4479b6=>'insertSuggestion'!=_0x4479b6));const _0x577a5=this['editor']['commands']['get']('trackChanges'),_0x569a14=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x1ebd58,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0xd5ae9});return _0x569a14['bind']('isBusy')['to'](this),_0x577a5&&_0x569a14['bind']('isTrackChangesOn')['to'](_0x577a5,'value'),_0x569a14['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x569a14['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x569a14['on']('showNext',()=>{this['_navigateToNext']();}),_0x569a14;}['_getExecuteDataRegular'](){const _0x334009=this['editor']['model']['document']['selection'],_0xf1f12=_0x334009['getFirstRange']()['start']['root'];if(_0x334009['isCollapsed']){const _0x3878f8=At(_0x334009['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x334009);this['editor']['model']['change'](_0x14f3d0=>{_0x14f3d0['setSelection'](_0x3878f8,'in');});}const _0x2464e2=_0x334009['getFirstRange'](),_0x548571=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x334009),_0x2464e2['start'],_0x2464e2['end']);this['_copyMarkersToFragment'](_0x548571,_0x334009,{'isTableSelection':!0x1});const _0x176a69=_0x334009['getFirstRange']()['start'],_0x51781c=new Map();let _0x317fe6=_0x548571;for(let _0x272e33=0x0;_0x272e33<_0x176a69['path']['length'];_0x272e33++)_0x51781c['set'](_0x317fe6,_0x176a69['path'][_0x272e33]),_0x317fe6=_0x317fe6['getChild'](0x0);return{'modelFragment':_0x548571,'anchorData':_0x51781c,'root':_0xf1f12};}['_getExecuteDataInTable'](){const _0x174311=this['editor']['model']['document']['selection'],_0xdf6a54=this['editor']['plugins']['get']('TableSelection'),_0x278689=_0x174311['getFirstRange']()['start']['root'],_0x636b54=_0xdf6a54['getSelectionAsFragment'](),_0x183498=_0x174311['getFirstRange']()['start']['parent']['parent'],_0x20ae3e=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x183498),this['editor']['model']['createPositionAfter'](_0x183498)),_0x393242=this['_wrapWithCommonAncestors'](_0x636b54,_0x20ae3e['start'],_0x20ae3e['end']);this['_copyMarkersToFragment'](_0x393242,_0x174311,{'isTableSelection':!0x0});const _0x26bd5d=_0x174311['getFirstRange']()['start'],_0x5cb474=new Map();let _0x5ed694=_0x393242;for(let _0x116abb=0x0;_0x116abb<_0x26bd5d['path']['length'];_0x116abb++)if(_0x5cb474['set'](_0x5ed694,_0x26bd5d['path'][_0x116abb]),_0x116abb<_0x26bd5d['path']['length']-0x1)_0x5ed694=_0x5ed694['getChild'](0x0);else{let _0x1a6229=_0x5ed694['nextSibling'];for(;_0x1a6229;)_0x5cb474['set'](_0x1a6229,_0x26bd5d['path'][_0x116abb]),_0x1a6229=_0x1a6229['nextSibling'];}return{'modelFragment':_0x393242,'anchorData':_0x5cb474,'root':_0x278689};}async['_executeAction'](_0x2d1f2b,_0x43a026,_0x1dcd1f,_0x4290ac,_0x28b23e,_0x1638fb){const _0x368054=this['editor']['plugins']['get'](AIEditing),_0x485aff=this['editor']['plugins']['get'](AIBalloon),_0xdd777c=this['editor']['model']['document']['selection'],_0x4e4ef9=await _0x368054['modelToDataWithIds'](_0x43a026),_0x442f26=this['editor']['model']['document']['version'],_0x5a2ccb=[..._0xdd777c['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x485aff['open']({'index':0x3e8*Math['random']()%0x3e8,'title':_0x28b23e,'icon':_0x1638fb||_0x15178f,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x5a2ccb,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x485aff),this['_interactionParams']={'action':_0x2d1f2b,'content':_0x4e4ef9,'version':_0x442f26,'aiBalloon':_0x485aff,'modelFragment':_0x43a026,'anchorData':_0x1dcd1f,'root':_0x4290ac},this['_setupApplyListeners'](),this['listenTo'](_0x485aff,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x485aff,'dialogClosed',(_0x30789e,{id:_0x2401bf})=>{if('aiActionsBalloon'===_0x2401bf){for(const _0x198e37 of this['_interactions']){if(0x0===_0x198e37['replies']['length']||_0x198e37['stoppedExplicitly'])continue;const _0x3a85e9=_0x198e37['replies'][_0x198e37['replies']['length']-0x1],_0x2b7147=_0x3a85e9['changeGroups'][0x0];_0x2b7147&&'pending'===_0x2b7147['state']&&_0x3a85e9['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x485aff);}}),this['_createInteraction'](_0x4e4ef9,_0x442f26,_0x485aff,_0x2d1f2b);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x4990de,anchorData:_0x11b1eb,root:_0x30e342}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x4990de,_0x11b1eb,_0x30e342,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x4990de,_0x11b1eb,_0x30e342,!0x0);});}['_wrapWithCommonAncestors'](_0x12c28a,_0xdcfd25,_0x2203f2){const _0x297377=this['editor']['model']['createRange'](_0xdcfd25,_0x2203f2)['getCommonAncestor'](),_0x39c89e=_0x297377['is']('documentFragment')?[]:_0x297377['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x39c89e['length']){const _0x2fc92c=_0x39c89e['map'](_0x2878e2=>_0x2878e2['_clone'](!0x1));for(let _0x227ede=0x1;_0x227ede<_0x2fc92c['length'];_0x227ede++)_0x2fc92c[_0x227ede-0x1]['_appendChild'](_0x2fc92c[_0x227ede]);return _0x2fc92c[_0x2fc92c['length']-0x1]['_appendChild'](_0x12c28a),new _0xee8836(_0x2fc92c[0x0]);}return _0x12c28a;}['_copyMarkersToFragment'](_0x4e4068,_0x45e3c3,_0x359f6a={'isTableSelection':!0x1}){const _0x21d067=this['editor']['model'],_0x45773f=Array['from'](_0x45e3c3['getRanges']()),_0x54d6c1=_0x45e3c3['getFirstRange']()['start'];for(const _0x36617d of _0x21d067['markers']){if(_0x36617d['name']['startsWith'](As)||!_0x36617d['affectsData'])continue;const _0x3c0551=_0x36617d['getRange']();if(!_0x45773f['some'](_0x59595a=>_0x59595a['containsRange'](_0x3c0551,!0x0)))continue;const _0x1c4b78=this['_regularCalculateMarkerPath'](_0x3c0551['start'],_0x54d6c1,_0x359f6a['isTableSelection']),_0x11330a=this['_regularCalculateMarkerPath'](_0x3c0551['end'],_0x54d6c1,_0x359f6a['isTableSelection']),_0x3ee5a2=_0x21d067['createPositionFromPath'](_0x4e4068,_0x1c4b78),_0xcb6237=_0x21d067['createPositionFromPath'](_0x4e4068,_0x11330a);if(!_0x3ee5a2['isEqual'](_0xcb6237)){const _0x5b5c7e=_0x21d067['createRange'](_0x3ee5a2,_0xcb6237);_0x4e4068['markers']['set'](_0x36617d['name'],_0x5b5c7e);}}}['_regularCalculateMarkerPath'](_0x3cc812,_0x5c8b7f,_0x1e55c8=!0x1){const _0x4e20e9=[..._0x3cc812['path']['slice']()];for(let _0x204819=0x0;_0x204819<Math['max'](_0x5c8b7f['path']['length'],_0x3cc812['path']['length']);_0x204819++){const _0x1d611a=_0x5c8b7f['path'][_0x204819]||0x0,_0x40d29f=(_0x3cc812['path'][_0x204819]||0x0)-_0x1d611a;if(_0x4e20e9[_0x204819]=_0x40d29f,0x0!==_0x40d29f&&!_0x1e55c8)break;}return _0x4e20e9;}async['_createInteraction'](_0x159c4e,_0x35fb78,_0x41f6,_0x277369){const _0x354e0f=this['editor'];this['_interactionParams']||(this['_interactionParams']={'action':_0x277369,'content':_0x159c4e,'version':_0x35fb78,'aiBalloon':_0x41f6,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':this['editor']['model']['document']['selection']['getFirstRange']()['start']['root']});const _0x3ba002=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0x354e0f['locale'],'content':_0x159c4e,'version':_0x35fb78,..._0x277369});this['_interactions']['push'](_0x3ba002);const _0x3a416b=(_0x520e42,_0xba7740=!0x1,_0x24791a='streaming')=>this['_promiseQueue']['enqueue'](async _0x1a702c=>{try{const _0x437a1b=Zi({'editor':_0x354e0f,'changeGroups':_0x520e42['changeGroups'],'documentContextContent':_0x520e42['documentContextContent'],'showDiff':_0xba7740,'trimUnchanged':!0x1});_0x437a1b['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x437a1b[0x0],'renderingStrategy':_0x24791a,'abortSignal':_0x1a702c});}catch(_0x4f21c4){if(this['_isAbortError'](_0x4f21c4))return;throw _0x4f21c4;}});_0x3ba002['on']('replyCreated',(_0x386970,_0x2de0fc)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x3a416b(_0x2de0fc)['catch'](_0x1e5a24=>{this['_isAbortError'](_0x1e5a24)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x1e5a24),this['_setErrorState'](_0x3ba002));});}),_0x3ba002['on']('replyContentUpdated',(_0x55d5f6,_0x333d75)=>{_0x3a416b(_0x333d75)['catch'](_0x7b2a1f=>{this['_isAbortError'](_0x7b2a1f)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x7b2a1f),this['_setErrorState'](_0x3ba002));});}),_0x3ba002['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x536943){this['_isAbortError'](_0x536943)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x536943),this['_setErrorState'](_0x3ba002));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x33b772,{showDiff:_0x936de6})=>{try{this['_balloonShowDiff']=_0x936de6;const _0x554a2e=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x554a2e&&await _0x3a416b(_0x554a2e,_0x936de6,'static');}catch(_0x5de353){this['_isAbortError'](_0x5de353)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x5de353),this['_setErrorState'](_0x3ba002));}}),_0x3ba002['on']('replyChangeGroupStateUpdated',()=>{const _0x12ecbb={'positiveCount':_0x3ba002['replies']['reduce']((_0x2d440f,_0x346a66)=>_0x2d440f+_0x346a66['changeGroups']['filter'](_0x50e773=>'accepted'===_0x50e773['state'])['length'],0x0),'totalCount':_0x3ba002['replies']['reduce']((_0x358ca5,_0x494bc7)=>_0x358ca5+_0x494bc7['changeGroups']['length'],0x0)},_0x5656dd=_0x3ba002['actionCallId'],_0x3dff1a=_0x3ba002['actionName'];_0x3dff1a?this['_aiConnector']['upsertAIActionRating'](_0x3dff1a,_0x5656dd,_0x12ecbb):this['_aiConnector']['upsertCustomAIActionRating'](_0x5656dd,_0x12ecbb);}),this['_setLoadingState']();try{const _0x1d90ef=await _0x3ba002['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x1d90ef;}catch(_0x437876){if(this['_isAbortError'](_0x437876))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x3ba002);}}['_applyChanges'](_0x46177f,_0x39dae9,_0x3f8b11,_0x52c4e1){const _0x26930a=this['editor'];if(_0x52c4e1&&!_0x26930a['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x239e48=this['editor']['plugins']['get'](_0x53dd97),_0x2c86f7=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x2c86f7||!_0x2c86f7['replies']['length'])return;const _0x328354=_0x2c86f7['replies'][_0x2c86f7['replies']['length']-0x1],_0x48893d=_0x328354['changeGroups'];_0x328354['setChangeGroupState'](0x0,'accepted');let _0x4366c2=_s({'editor':_0x26930a,'reply':_0x328354,'interaction':_0x2c86f7,'groups':_0x48893d,'transform':!0x1,'documentCompare':_0x239e48,'documentCompareOptions':{'anchor':_0x26930a['model']['createPositionAt'](_0x46177f,0x0),'markDeletions':_0x52c4e1}});_0x4366c2=this['_filterOperationsOutsideRange'](_0x4366c2,_0x39dae9);for(const _0x3636cd of _0x4366c2)this['_anchorOperation'](_0x39dae9,_0x3636cd,_0x3f8b11);const _0x544532=_0x2c86f7['getDocumentContext']()['version'],_0x25b30c=_0x26930a['model']['document']['history']['getOperations'](_0x544532),_0x41c53a={'document':_0x26930a['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x411ab9=_0x27476f(_0x4366c2,_0x25b30c,_0x41c53a)['operationsA'];_0x26930a['model']['change'](_0x1f5c83=>{if(_0x1f5c83['setSelection'](_0x26930a['model']['document']['selection']['focus']),_0x52c4e1)_0x26930a['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x411ab9);else{for(const _0x69bf50 of _0x411ab9)_0x69bf50['baseVersion']=_0x26930a['model']['document']['version'],Is(_0x26930a,_0x69bf50),_0x1f5c83['batch']['addOperation'](_0x69bf50),_0x26930a['model']['applyOperation'](_0x69bf50);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0xfef603,_0x330438){return _0xfef603['filter'](_0x1f468b=>{if('rename'==_0x1f468b['type']){const _0x22df6d=_0x1f468b['position']['nodeAfter'];return!_0x330438['has'](_0x22df6d);}if(_0x1f468b['type']['indexOf']('Attribute')>-0x1){const _0x1b5c57=_0x1f468b['range']['start']['nodeAfter'];return!_0x330438['has'](_0x1b5c57);}return!0x0;});}['_anchorOperation'](_0x9b2706,_0x46ad09,_0x28a6f6){const _0x326f7f=_0x46ad09['clone']();for(const _0x3fac9e in _0x46ad09){const _0x50d982=_0x46ad09[_0x3fac9e];_0x50d982 instanceof _0x1445f3?_0x46ad09[_0x3fac9e]=new _0x1445f3(_0x8d3448(_0x50d982['start']),_0x8d3448(_0x50d982['end'])):_0x50d982 instanceof _0x3c2be3&&(_0x46ad09[_0x3fac9e]=_0x8d3448(_0x50d982));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x326f7f['type'])){if(_0x326f7f['isDocumentOperation']=!0x1,_0x326f7f['baseVersion']=null,'remove'==_0x326f7f['type']){const _0x297cdd=_0x326f7f['sourcePosition'],_0x28a891=_0x326f7f['howMany'];new _0x43c2ab(_0x297cdd,_0x28a891)['_execute']();}else _0x326f7f['_execute']();}function _0x8d3448(_0x4ad28d){if('$graveyard'==_0x4ad28d['root']['rootName'])return _0x4ad28d;const _0x7c8f86=[];let _0x121cb8=_0x4ad28d['root'];for(let _0x1032b8=0x0;_0x1032b8<_0x4ad28d['path']['length'];_0x1032b8++){const _0x147e62=_0x9b2706['get'](_0x121cb8)||0x0;_0x7c8f86[_0x1032b8]=_0x4ad28d['path'][_0x1032b8]+_0x147e62,_0x121cb8=_0x121cb8['getChildAtOffset'](_0x4ad28d['path'][_0x1032b8]);}return new _0x3c2be3(_0x28a6f6,_0x7c8f86,_0x4ad28d['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x3548c4,content:_0x2a0767,version:_0x3e36af,aiBalloon:_0x55051c}=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'](_0x2a0767,_0x3e36af,_0x55051c,_0x3548c4)['catch'](_0x42846f=>{this['_isAbortError'](_0x42846f)||console['error']('Error\x20refreshing\x20interaction:',_0x42846f);});}['_isAbortError'](_0x534059){return!!_0x534059['message']&&_0x534059['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 _0x5e2b8a=this['_interactions']['length'];this['_currentInteractionIndex']<_0x5e2b8a-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x5a4aa5){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x5a4aa5;const _0x13f409=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x13f409)return;if(_0x13f409['hasError'])return this['_setErrorState'](_0x13f409),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x13f409['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x1134d7=_0x13f409['replies'][_0x13f409['replies']['length']-0x1];if(_0x1134d7){const _0x51df0c=this['editor'];try{const _0x483a69=Zi({'editor':_0x51df0c,'changeGroups':_0x1134d7['changeGroups'],'documentContextContent':_0x1134d7['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0xb25f23=>setTimeout(_0xb25f23,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x483a69[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x279898){this['_isAbortError'](_0x279898)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x279898);}}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0xd984f2){const _0x2d1ccc=Hi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x2d1ccc),_0xd984f2['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 _0x5686f0{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x41246a){super(_0x41246a),_0x41246a['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x2b44af,_0x4ed7b8){super(_0x2b44af),this['id']=_0x4ed7b8,this['set']('status','pending'),this['set']('changeId',_0x4ed7b8),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',(_0x33e94d,_0x3ca0f0)=>{_0x3ca0f0&&_0x3ca0f0['target']&&'A'===_0x3ca0f0['target']['tagName']&&_0x3ca0f0['preventDefault'](),this['fire']('activateChange',{'id':_0x4ed7b8,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x4ed7b8,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x4ed7b8,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x5359ad=new Nt(this['locale']);return _0x5359ad['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',_0x53237a=>!_0x53237a)]}}),_0x5359ad;}['_createAcceptButtonView'](){const _0x5843=new vt(this['locale']);return _0x5843['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x5843['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1947ef=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x1947ef['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x2c0f4e=>'pending'!==_0x2c0f4e&&'accepted'!==_0x2c0f4e),this['bindTemplate']['if']('status',Ui,_0x4238c4=>'pending'===_0x4238c4),this['bindTemplate']['if']('status',Bi,_0x35bf6b=>'pending'!==_0x35bf6b),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x469a47=>'accepted'===_0x469a47)]}}),this['on']('change:status',(_0x396e3a,_0x364db6,_0x32e09e)=>{_0x5843['isEnabled']='pending'===_0x32e09e,'accepted'===_0x32e09e&&(_0x5843['label']=Hi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x5843['icon']=_0x4ab520);}),_0x5843;}['_createDismissButtonView'](){const _0x2552f8=new vt(this['locale']);return _0x2552f8['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x2552f8['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x5d4672=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x5d4672['stopPropagation']();})},'attributes':{'class':[Bi,this['bindTemplate']['if']('status','ck-hidden',_0x283c89=>'pending'!==_0x283c89&&'rejected'!==_0x283c89),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x2f0933=>'pending'===_0x2f0933),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x2e0d2a=>'rejected'===_0x2e0d2a)]}}),this['on']('change:status',(_0x4a8e77,_0x291545,_0x5d7476)=>{_0x2552f8['isEnabled']='pending'===_0x5d7476,'rejected'===_0x5d7476&&(_0x2552f8['label']=Hi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x2552f8['icon']=_0x5ed072);}),_0x2552f8;}['_createInfoButtonView'](){const _0x3e85d1=new vt(this['locale']);return _0x3e85d1['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x11ec0d,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Bi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x3e85d1['bind']('isOn')['to'](this,'isInfoToggleOn',_0x3b014b=>_0x3b014b),_0x3e85d1['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x3e85d1;}['_createOutdatedButtonView'](){const _0xf2b4da=new vt(this['locale']);return _0xf2b4da['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':it,'withText':!0x0,'isEnabled':!0x1}),_0xf2b4da['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x2106fd=>'outdated'!==_0x2106fd)],'disabled':'disabled'}}),_0xf2b4da;}}class AIReviewCoreBalloonSuggestionItemView extends Xt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x36fdc5,_0x154eb5){super(_0x36fdc5),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']()),_0x154eb5['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x5766aa){this['resultItemView']['changeId']=_0x5766aa['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x5766aa['contentDiffed'];}['showBalloon'](_0x2dcff1,_0x3a2a34,_0x264eb1,_0x5b98ee,_0x49eb68,_0x259f5e){const _0x393416=_0x3a2a34();if(!_0x393416)return;this['updateContent'](_0x2dcff1),this['show']();const _0x14c1ea=Array['from'](_0x393416['getClientRects']())['reverse'](),_0x2fb3d1=this['_getPointedRectIndexFromEvent'](_0x264eb1,_0x14c1ea),_0x37b541=_0x14c1ea[_0x2fb3d1??0x0];'click'===_0x5b98ee?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x3a2a34(),_0x2fb3d1,_0x2dcff1['id'],_0x49eb68,_0x259f5e)||_0x37b541})):'hover'===_0x5b98ee&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x3a2a34(),_0x2fb3d1,_0x2dcff1['id'])||_0x37b541}));}['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'](){zt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x1a5ed2=[this['element']];return this['_pinnedTargetElement']&&_0x1a5ed2['push'](this['_pinnedTargetElement']),_0x1a5ed2;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x4cc092=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x4cc092['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']]}]}),_0x4cc092;}['_getBestRectPositionOnClick'](_0x3d66ea,_0x1bf38f,_0x447751,_0x29f30e,_0x1deea6){if(!_0x3d66ea)return null;const _0x5cc594=this['position']['replace']('arrow_',''),_0xca405b=Array['from'](_0x3d66ea['getClientRects']());let _0x48f63d,_0x211ec3=_0xca405b['reverse']();return void 0x0!==_0x1bf38f&&this['_isPinnedRectVisible'](_0x211ec3[_0x1bf38f],_0x29f30e,_0x1deea6)?(_0x48f63d=_0x211ec3[_0x1bf38f],this['_pinnedRectIndex']=_0x1bf38f):this['_isPinnedRectVisible'](_0x211ec3[0x0],_0x29f30e,_0x1deea6)&&void 0x0===_0x1bf38f?_0x48f63d=_0x211ec3[0x0]:(_0x211ec3='s'==_0x5cc594[0x0]?[..._0xca405b]['reverse']():_0xca405b,_0x211ec3['forEach'](_0x495f55=>{this['_isPinnedRectVisible'](_0x495f55,_0x29f30e,_0x1deea6)&&(_0x48f63d=_0x495f55);})),this['_pinnedTargetChangeId']=_0x447751,this['_pinnedTargetElement']=_0x3d66ea,_0x48f63d||_0x3d66ea['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x53f3de,_0x3ba30b,_0x3c6686){if(!_0x53f3de)return null;const _0x591a1d=Array['from'](_0x53f3de['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x3ba30b&&this['_pinnedTargetChangeId']!==_0x3c6686)return this['_pinnedRectIndex']=_0x3ba30b,this['_pinnedTargetElement']=_0x53f3de,this['_pinnedTargetChangeId']=_0x3c6686,_0x591a1d[_0x3ba30b];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x3c6686){if(_0x53f3de!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x591a1d[this['_pinnedRectIndex']];}return void 0x0!==_0x3ba30b&&this['_pinnedTargetChangeId']!==_0x3c6686?(this['_pinnedRectIndex']=_0x3ba30b,this['_pinnedTargetElement']=_0x53f3de,this['_pinnedTargetChangeId']=_0x3c6686,_0x591a1d[_0x3ba30b]):_0x53f3de['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x15593e,_0x1934bc){if(_0x15593e)for(let _0x49178f=0x0;_0x49178f<_0x1934bc['length'];_0x49178f++){const _0x3549c2=_0x1934bc[_0x49178f];if(_0x15593e['clientX']>=_0x3549c2['left']-0x3&&_0x15593e['clientX']<=_0x3549c2['right']+0x3&&_0x15593e['clientY']>=_0x3549c2['top']-0x3&&_0x15593e['clientY']<=_0x3549c2['bottom']+0x3)return _0x49178f;}}['_isPinnedRectVisible'](_0x45b0c7,_0x3b714d,_0x2e20c7){const _0xce4e8c=new ut(_0x45b0c7),_0x418578=_0x3b714d||document['documentElement'],_0x328867=_0xce4e8c['getIntersection'](bt(_0x2e20c7)),_0x5d9ff5=new ut(_0x418578)['getIntersection'](_0xce4e8c);return!!(_0x328867&&_0x5d9ff5&&_0xce4e8c['width']>0x0);}}const Fn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0x23f270{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1eebb8){super(_0x1eebb8),this['_bodyCollection']=new Qt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Fn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x215e81=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x215e81);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x37eed6){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x4d7878=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x37eed6,_0x4d7878);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x5184a5){_0x5184a5&&('error-general'!==_0x5184a5['status']?'error-chunk'!==_0x5184a5['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x19234a){this['_mainView']['addCheckRunResult'](_0x19234a);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x2571b2){this['_mainView']['showGeneralReviewCoreErrorView'](_0x2571b2??Hi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x52f385,_0x33c926){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x52f385,_0x33c926);}['setActiveStateInResults'](_0x48822d){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x3849de=>{_0x3849de['id']===_0x48822d&&_0x3849de['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x49ec0c=>_0x49ec0c['setItemAsInactive']());}['updateChangeState'](_0x3f8b99,_0x437ee4){'accepted'===_0x437ee4||'rejected'===_0x437ee4||'outdated'===_0x437ee4?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x3f8b99,_0x437ee4):this['_mainView']['reviewCheckResultsView']['showResult'](_0x3f8b99,_0x437ee4);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x1e7b17,_0x2ef5e4,_0x477700,_0x25a8f8,_0x4c9454,_0x297ab6){this['_balloonSuggestionView']['showBalloon'](_0x1e7b17,_0x2ef5e4,_0x477700,_0x25a8f8,_0x4c9454,_0x297ab6);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x5f3e2f){const _0x1742d5=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x42d901=>_0x42d901['id']===_0x5f3e2f);return _0x1742d5?_0x1742d5['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x3ab633){super(_0x3ab633),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x20d26c=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x20d26c['if']('isVisible','ck-hidden',_0x40f3a0=>!_0x40f3a0)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x20d26c['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x47bde9,_0x28a7d0){super(_0x47bde9),this['reviewCoreHeader']=_0x28a7d0['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x47bde9),this['reviewCheckListView']=_0x28a7d0['list'],this['reviewCheckListView']['delegate'](...Fn)['to'](this),this['reviewCheckResultsView']=_0x28a7d0['results'],this['reviewCheckResultsView']['delegate'](...Fn)['to'](this),this['reviewCompletedView']=_0x28a7d0['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'](_0x308528){this['reviewCheckResultsView']['addResult'](_0x308528),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'](_0x936679){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x936679;}['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 vt{constructor(_0x5a66a8,_0x3a0b2){super(_0x3a0b2),this['set']({'label':_0x5a66a8,'withText':!0x0,'class':Mi}),this['on']('execute',()=>{this['fire']('finishReview');});}}class AIReviewCoreUICheckResultsView extends Pt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x589f25,_0x21cdf4){super(_0x589f25),this['_contents']=_0x21cdf4,this['_resultViews']=new _0x184ac3(),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(_0x589f25),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 _0x7593da=this['_createCombinedSkeletonLoader'](),_0x42e474=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x42e474['if']('isLoading','ck-ai_review__check-run_loading',_0x4a821c=>_0x4a821c),_0x42e474['if']('isResultReady','ck-ai_review__check-run_ready',_0x5a5dcf=>_0x5a5dcf),_0x42e474['if']('isVisible','ck-hidden',_0x1c7e8c=>!_0x1c7e8c)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x7593da,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0xe839de){const _0x2150a5=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0xe839de['id']);_0x2150a5['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x2150a5),_0x2150a5['resultResponseView']['element']['innerHTML']=_0xe839de['contentDiffed'];}['hideResult'](_0x3ff8b7,_0x11eafd){if('pending'===_0x11eafd)return;const _0x4d0459=this['_resultViews']['find'](_0x18bf21=>_0x18bf21['id']===_0x3ff8b7);_0x4d0459&&(_0x4d0459['status']=_0x11eafd,_0x4d0459['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x3dceaa,_0x519437){if('pending'!==_0x519437)return;const _0x54bf95=this['_resultViews']['find'](_0x8ce40f=>_0x8ce40f['id']===_0x3dceaa);_0x54bf95&&(_0x54bf95['status']=_0x519437,_0x54bf95['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x80326f,_0x2147d3){this['headerTitle']=_0x80326f,this['headerSubtitle']=_0x2147d3||'';}['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'],Ss['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x312b29=new Nt(this['locale']),_0x56549a=[];for(let _0x25f7b4=0x0;_0x25f7b4<0x10;_0x25f7b4++){const _0x53b081=this['_createSkeletonLoader']();_0x53b081['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x56549a['push'](_0x53b081);}return _0x312b29['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x3ba449=>!_0x3ba449)]},'children':_0x56549a}),_0x312b29;}['_createResultsBodyView'](){const _0x13bbdc=new Nt(this['locale']);return _0x13bbdc['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x295500=>_0x295500)]},'children':this['_resultViews']}),_0x13bbdc;}['_createErrorView'](){const _0x6ff4db=new Nt(this['locale']),_0x2cb189=new vt(this['locale']),t=this['locale']['t'];return _0x6ff4db['delegate']('retryReview')['to'](this),_0x2cb189['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Ui+'\x20ck-ai_review__check-run-error-retry-button'}),_0x2cb189['on']('execute',()=>{this['fire']('retryReview');}),_0x6ff4db['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x528717=>!_0x528717),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0xd3457=>'chunk'===_0xd3457)]},'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',_0xe9215e=>'chunk'===_0xe9215e)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x3c6c67=>'general'!==_0x3c6c67)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x67e17b=>'chunk'!==_0x67e17b)]},'children':[{'text':Hi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x2cb189]}),_0x6ff4db;}['_createCancelButtonView'](){const _0x5b7655=new vt(this['locale']);return _0x5b7655['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Ui+'\x20ck-ai-button-stop-generating'],'icon':_0x1b062b}),_0x5b7655['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x33af23=>_0x33af23),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x330e79=>_0x330e79)]}}),_0x5b7655['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x5b7655;}['_createToggleDiffButtonView'](){const _0x27395a=new vt(this['locale']);_0x27395a['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x27395a['bind']('isEnabled')['to'](this,'isError',_0x287af7=>!_0x287af7),_0x27395a['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3f499b=>!_0x3f499b),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4b3edf=>_0x4b3edf)]}});const _0x13f493=Hi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x11adbb=Hi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x27395a['bind']('isOn')['to'](this,'isToggleDiffOn',_0x53fb5a=>_0x53fb5a),_0x27395a['bind']('icon')['to'](this,'isToggleDiffOn',_0x5e44d9=>_0x5e44d9?st:nt),_0x27395a['bind']('label')['to'](this,'isToggleDiffOn',_0x156a4e=>_0x156a4e?_0x13f493:_0x11adbb),_0x27395a['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x27395a;}['_createAcceptAllButtonView'](){const _0x1cdcb9=new vt(this['locale']);return _0x1cdcb9['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x1cdcb9['bind']('isEnabled')['to'](this,'isError',_0x2de6ba=>!_0x2de6ba),_0x1cdcb9['extendTemplate']({'attributes':{'class':[Mi,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x56b048=>!_0x56b048),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x54a5dc=>_0x54a5dc)]}}),_0x1cdcb9['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x1cdcb9;}['_createExitReviewButtonView'](){const _0x1ab011=new vt(this['locale']);return _0x1ab011['set']({'label':Hi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x1ab011['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x20eff0=>!_0x20eff0),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5a4600=>_0x5a4600)]}}),_0x1ab011['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x1ab011;}['_createResultHeaderView'](){const _0x3e89ad=new Nt(this['locale']),_0x3d7da5=this['_createTitleView']();return _0x3e89ad['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x4623e2=>_0x4623e2)]},'children':[_0x3d7da5,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x3e89ad;}['_createTitleView'](){const _0x3e1669=new Nt(this['locale']),_0xa91514=new AISpinnerView();return _0xa91514['bind']('isVisible')['to'](this,'isResultReady',_0x34e08a=>!_0x34e08a),_0x3e1669['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper']},'children':[_0xa91514,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x112b16=>_0x112b16)]},'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')}]}]},{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3151e7=>!_0x3151e7)]},'children':[{'text':Hi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]}]}),_0x3e1669;}['_createFinishReviewButtonView'](){const _0x17d5f8=new AIReviewCoreFinishReviewButtonView(Hi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x17d5f8['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x35bc31=>!_0x35bc31)]}}),_0x17d5f8['delegate']('finishReview')['to'](this),_0x17d5f8;}}class AIReviewCoreReviewCompletedView extends Pt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x476894,_0x98e982){super(_0x476894),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x98e982['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x98e982['headerText']);const _0x48f046=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x48f046['if']('isVisible','ck-hidden',_0x354970=>!_0x354970)]},'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':_0x98e982['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x519c0c){const _0x3507cb=new AIReviewCoreFinishReviewButtonView(_0x519c0c,this['locale']);return _0x3507cb['delegate']('finishReview')['to'](this),_0x3507cb;}['_createResultHeaderView'](_0x14b900){const _0x216277=new Nt(this['locale']);return _0x216277['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title']},'children':[{'text':_0x14b900}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x216277;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x2dfa6a,_0x1a9bb7){super(_0x2dfa6a),this['_defaultValue']=_0x1a9bb7['default']||(_0x1a9bb7['data']['length']>0x0?_0x1a9bb7['data'][0x0]['id']:''),this['_defaultLabel']=_0x1a9bb7['data']['find'](_0xa18ba6=>_0xa18ba6['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Gt(this['locale']);const _0x59adbc=this['_prepareListOptions'](_0x1a9bb7['data']);jt(this['_dropdownView'],_0x59adbc,{'role':'menu','ariaLabel':_0x1a9bb7['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x39888e=>{_0x39888e['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x482664=>{this['formValue']=_0x482664['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x482664['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'](_0x4c1bc0=[]){const _0xa8816b=new dt();this['resetToDefault']();for(const _0x55047e of _0x4c1bc0){const _0x60d265=new Jt({'label':_0x55047e['label'],'withText':!0x0,'role':'menuitemradio','id':_0x55047e['id'],'model':_0x55047e});_0x60d265['bind']('isOn')['to'](this,'formValue',_0x4eb20f=>_0x4eb20f===_0x60d265['id']);const _0x35fad7={'type':'button','model':_0x60d265};_0xa8816b['add'](_0x35fad7);}return _0xa8816b;}}class AIReviewCoreFormManagerView extends Pt{['_formItem']=null;constructor(_0x383f02,_0x173820,_0x2cf849){super(_0x383f02),this['argsKey']=_0x173820?.['argsKey'];if('dropdown'===_0x173820['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x173820);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x228643=new _0xee19c6(this['locale'],{'children':[this['_formItem']],'class':[_0x2cf849?'ck-form__row_with-submit':'']});_0x2cf849&&_0x228643['children']['add'](_0x2cf849),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x228643]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x126012{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x3a1bb3){super(_0x3a1bb3),this['set']('isEmpty',!0x0),this['keystrokes']=new It(),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 _t();['keystrokes']=new It();['focusCycler'];['_focusables']=new _0x184ac3();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x248027,_0x87c60f,_0x32e1c3=!0x1){super(_0x248027),this['_check']=_0x87c60f,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x87c60f['defaultModel']?_0x87c60f['defaultModel']['id']:'',this['_defaultLabel']=_0x87c60f['defaultModel']?_0x87c60f['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new te(this['locale'],()=>new AIReviewCorePromptInputView(_0x248027)),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 dt(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x32e1c3),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 _0xee19c6(this['locale'],{'children':[this['promptInputView']]}),new _0xee19c6(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x41fdf4,_0x414968)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x414968()):_0x414968();}),this['focusCycler']=new Mt({'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'](_0x37ce82=>{this['_focusables']['add'](_0x37ce82),this['focusTracker']['add'](_0x37ce82['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 _0x14d3d4 of this['_getFormValidators']()){const _0x297f8c=_0x14d3d4();if(_0x297f8c)return this['promptInputView']['errorText']=_0x297f8c,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Hi(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x179ccb=new vt(this['locale']),t=this['locale']['t'];return _0x179ccb['set']({'label':t('Submit'),'withText':!0x0,'class':Mi}),_0x179ccb['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x179ccb;}['_createCancelButtonView'](){const _0x4735bf=new vt(this['locale']),t=this['locale']['t'];return _0x4735bf['set']({'label':t('Cancel'),'withText':!0x0,'class':Bi}),_0x4735bf['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x469266=>{_0x469266['stopPropagation']();})}}),_0x4735bf['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x4735bf;}['_setModelList'](_0x30d182){this['_modelSelectionDropdownItems']['clear']();const _0x7c1ef1=this['_check']['models'];if(_0x30d182)this['set']('modelDisplayMode','hidden');else{const _0x1bbeab=0x1===_0x7c1ef1['length'];this['set']('modelDisplayMode',_0x1bbeab?'name':'selector');}if(this['resetToDefault'](),_0x7c1ef1?.['length']){0x1===_0x7c1ef1['length']&&this['set']('activeModelName',_0x7c1ef1[0x0]['name']||_0x7c1ef1[0x0]['id']);for(const _0x2c6726 of _0x7c1ef1){const _0x520a53=new Jt({'label':_0x2c6726['name'],'withText':!0x0,'role':'menuitemradio','id':_0x2c6726['id'],'model':_0x2c6726});_0x520a53['bind']('isOn')['to'](this,'modelId',_0x48d6bd=>_0x48d6bd===_0x2c6726['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x520a53,'labelView':new ModelButtonLabelView(this['locale'],_0x2c6726)});}}}['_createModelSelectionDropdown'](){const _0x30f528=Gt(this['locale']);return _0x30f528['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x30f528['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Bi}),_0x30f528['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1e8175=>'selector'===_0x1e8175),this['listenTo'](_0x30f528,'execute',_0x284c75=>{this['modelId']=_0x284c75['source']['model']['id'],_0x30f528['buttonView']['label']=_0x284c75['source']['label'];}),_0x30f528;}['_createModelNameView'](){const _0x4aecb8=new ModelNameView(this['locale']);return _0x4aecb8['bind']('text')['to'](this,'activeModelName',_0x4dc505=>_0x4dc505??''),_0x4aecb8['bind']('isVisible')['to'](this,'modelDisplayMode',_0xd57a57=>'name'===_0xd57a57),_0x4aecb8;}['_createActionsFooterView'](){const _0x2499b5=new Nt(this['locale']);return _0x2499b5['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']]}]}),_0x2499b5;}}class ModelNameView extends Nt{constructor(_0x5e833e){super(_0x5e833e),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x5a0daf=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x5a0daf['if']('isVisible','ck-hidden',_0xfb6846=>!_0xfb6846)]},'children':[{'text':_0x5a0daf['to']('text')}]});}}class ModelButtonLabelView extends Ht{constructor(_0x520c1e,_0x257db9){super();const _0x544924=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x544924['to']('style'),'id':_0x544924['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x544924['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x257db9['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Pt{['_formItemsCollection']=new _0x184ac3();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x56509c,_0x37ac5e,_0x30302e,_0x27c605=!0x1){super(_0x56509c),this['_hideModels']=_0x27c605,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x37ac5e['isParameterized']);const _0x456ce3=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',_0x75637d=>_0x75637d),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x265f3e=>_0x265f3e)],'style':{'--ck-ai-review-check-list-item-index':_0x30302e}},'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':_0x37ac5e['title']}]},_0x456ce3]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x37ac5e['description']?[{'text':_0x37ac5e['description']}]:[]}]}]},..._0x37ac5e['isParameterized']?[this['_createParameterizedView'](_0x37ac5e)]:[],...'custom'===_0x37ac5e['id']?[this['_createCustomView'](_0x37ac5e,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x37ac5e['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x37ac5e['id'],'args':_0x37ac5e['useArgs']?_0x37ac5e['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&zt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x2a2215=>{_0x2a2215['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x4be1b0=new xt();return _0x4be1b0['content']=rt,_0x4be1b0['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x4be1b0;}['_createParameterizedView'](_0x2b73af){const _0x42a317=new Nt(),_0x18acf1=this['_createFormView'](_0x2b73af);return _0x42a317['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x50ac90=>!_0x50ac90)]},'children':[_0x18acf1]}),_0x42a317;}['_createFormView'](_0x1c0e31){const _0x3d1bc2=new Nt(),_0x295ba6=Array['isArray'](_0x1c0e31['options'])?_0x1c0e31['options']:[],_0x7755b9=new vt(this['locale']),t=this['locale']['t'];_0x7755b9['set']({'label':t('Submit'),'withText':!0x0,'class':Mi}),_0x7755b9['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2a21ae=>{_0x2a21ae['stopPropagation']();})}}),_0x7755b9['on']('execute',()=>{const _0x17f0ae=[],_0x247e1b={};this['_formItemsCollection']['forEach'](_0x38421c=>{_0x17f0ae['push'](_0x38421c['value']),_0x1c0e31['useArgs']&&_0x1c0e31['options']&&(_0x247e1b[_0x38421c['argsKey']]=_0x38421c['value']);}),this['fire']('runReviewCheck',{'id':_0x1c0e31['id'],'params':_0x17f0ae['length']?_0x17f0ae:void 0x0,'args':Object['keys'](_0x247e1b)['length']?_0x247e1b:void 0x0});});const _0x44152d=_0x295ba6['length'];return _0x295ba6['forEach']((_0x52ed5e,_0x27215b)=>{const _0x3e4e68=_0x27215b===_0x44152d-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x52ed5e,_0x3e4e68?_0x7755b9:null));}),_0x3d1bc2['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x3d1bc2;}['_createCustomView'](_0x29b1c8,_0x2e696c=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x29b1c8,_0x2e696c),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',_0x4dde6f=>!_0x4dde6f)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x16650b,_0x41f8d5,_0x3a5e12)=>{_0x3a5e12||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Pt{['_checkViews'];constructor(_0x379c90){super(_0x379c90),this['_checkViews']=new _0x184ac3(),this['_setupTemplate']();}['setChecks'](_0x527712,_0x1395cf=!0x1){this['_checkViews']['clear']();for(const [_0x23d2b9,_0x44a371]of _0x527712['entries']()){const _0x3547cc=new AIReviewCoreReviewCommandListItemView(this['locale'],_0x44a371,_0x23d2b9,_0x1395cf);_0x3547cc['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x3547cc);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x104af1 of this['_checkViews'])_0x104af1 instanceof AIReviewCoreReviewCommandListItemView&&_0x104af1['resetToDefault']();}['_setupTemplate'](){const _0x2acb56=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x2acb56['if']('isVisible','ck-hidden',_0x4046f9=>!_0x4046f9)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x98f6bb=this['context']['plugins']['get']('AITabs'),_0x1a754b=this['context']['locale'],_0x5ae508=new AIHeaderView(_0x1a754b,{'label':Hi(_0x1a754b,'AI_REVIEW_MODE'),'icon':_0x2e2f4a,'class':'ck-ai-header_review','showResizeButton':_0x98f6bb['showResizeButton']});return _0x5ae508['delegate']('resizeTabs')['to'](_0x98f6bb),_0x5ae508['bind']('isMaximized')['to'](_0x98f6bb['view'],'isMaximized',_0x178f5d=>_0x178f5d),new AIReviewCoreView(this['context']['locale'],{'header':_0x5ae508,'list':new AIReviewCoreReviewCheckListView(_0x1a754b),'results':new AIReviewCoreUICheckResultsView(_0x1a754b,{'generalErrorText':Hi(_0x1a754b,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x1a754b,{'headerText':Hi(_0x1a754b,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Hi(_0x1a754b,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Hi(_0x1a754b,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x268741=this['context']['plugins']['get']('AITabs');_0x268741['view']['on']('activateTab',(_0x51989f,{newTab:_0x44449b,oldTab:_0x3a7146})=>{'reviewMode'===_0x44449b?this['fire']('getReviewCheckList'):'reviewMode'===_0x3a7146&&this['fire']('leaveReview');}),_0x268741['view']['addTab']({'id':'reviewMode','buttonLabel':Hi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x2e2f4a,'order':0x0,'content':this['_mainView']});}}const Kn='review-',Wn=['softBreak'];class AIReviewCoreEditing extends _0x23f270{static get['requires'](){return[_0x53dd97,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(_0x517344){super(_0x517344),this['_domEmitter']=new(Ot())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x46fea7=_0x252e66=>this['_scheduleAttachReviewEditingToEditor'](_0x252e66);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x5ca812)return void _0x46fea7(this['context']);const _0x3838eb=this['context'];for(const _0x2d1097 of _0x3838eb['editors'])_0x46fea7(_0x2d1097);this['listenTo'](_0x3838eb['editors'],'add',(_0x123f62,_0xe00bf5)=>{_0x46fea7(_0xe00bf5);}),this['listenTo'](_0x3838eb['editors'],'remove',(_0x357195,_0x1cd03a)=>{for(const [_0x16178e,_0x550989]of this['_markers'])_0x550989['editor']===_0x1cd03a&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x16178e,'changeId':_0x550989['groupId']}),this['_markers']['delete'](_0x16178e));});}['_scheduleAttachReviewEditingToEditor'](_0x575280){const _0x5df2bf=()=>{'destroyed'!==_0x575280['state']&&_0x575280['conversion']&&this['_attachReviewEditingToEditor'](_0x575280);};if('ready'===_0x575280['state'])return void _0x5df2bf();const _0x11a555=()=>{this['stopListening'](_0x575280,'ready',_0x11a555),_0x5df2bf();};this['listenTo'](_0x575280,'ready',_0x11a555);}['_attachReviewEditingToEditor'](_0x158a04){this['_reviewEditingAttachedEditors']['has'](_0x158a04)||(_0x158a04['conversion']['for']('editingDowncast')['markerToElement']({'model':Kn+'insert','view':(_0x4aa32a,{writer:_0x4b24ac})=>{const _0xbdf745=this['_markers']['get'](_0x4aa32a['markerName']),_0x3067ca={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0xbdf745?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x4aa32a['markerName']};return _0x4b24ac['createUIElement']('span',_0x3067ca,function(_0x5afa6e){const _0x487f4a=this['toDomElement'](_0x5afa6e);return _0x487f4a['innerHTML']=_0xbdf745?.['content']?.['asString']||'',_0x487f4a;});}}),_0x158a04['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Kn+'remove-only','view':_0x13b17e=>{const _0x151b79=this['_markers']['get'](_0x13b17e['markerName']),_0x47d422=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x151b79?.['id']||'')&&_0x47d422['push']('ck-ai_review__change_active'),{'classes':_0x47d422,'attributes':{'data-marker-id':_0x13b17e['markerName']}};}}),_0x158a04['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Kn+'remove-context','view':_0x2c37c2=>{const _0x27afca=this['_markers']['get'](_0x2c37c2['markerName']),_0x21666a=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x27afca?.['id']||'')&&_0x21666a['push']('ck-ai_review__change_active'),{'classes':_0x21666a,'attributes':{'data-marker-id':_0x2c37c2['markerName']}};}}),_0x158a04['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Kn+'remove-text','view':_0xc394b3=>{const _0x334771=this['_markers']['get'](_0xc394b3['markerName']),_0x5d7da2=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x334771?.['id']||'')&&_0x5d7da2['push']('ck-ai_review__change_active'),{'classes':_0x5d7da2,'attributes':{'data-marker-id':_0xc394b3['markerName']}};}}),_0x158a04['conversion']['for']('dataDowncast')['markerToElement']({'model':Kn+'suggestion-context','view':(_0x45587f,{writer:_0x31195b})=>_0x31195b['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x45587f['isOpening']?'start':'end')})}),_0x158a04['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x4140c8,'view':_0x4b3396}),this['_updateMouseMarkerInteractionListeners'](_0x158a04),this['listenTo'](_0x158a04,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x158a04),{'priority':'lowest'}),this['listenTo'](_0x158a04,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x158a04),{'priority':'lowest'}),_0x158a04['model']['document']['registerPostFixer'](_0x1e43c4=>this['_validateMarkers'](_0x158a04,_0x1e43c4)),_0x158a04['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x158a04)),this['_reviewEditingAttachedEditors']['add'](_0x158a04));}['_updateMouseMarkerInteractionListeners'](_0x57751c){let _0xeb7cb3=this['_boundEditables']['get'](_0x57751c);_0xeb7cb3||(_0xeb7cb3=new Map(),this['_boundEditables']['set'](_0x57751c,_0xeb7cb3));const _0x110560=new Set(_0x57751c['ui']['getEditableElementsNames']());for(const _0xf9e7e of _0x110560){if(_0xeb7cb3['has'](_0xf9e7e))continue;const _0x2943bd=_0x57751c['ui']['getEditableElement'](_0xf9e7e);_0xeb7cb3['set'](_0xf9e7e,_0x2943bd),this['_attachMouseMarkerInteractionListeners'](_0x2943bd);}for(const [_0x1441f9,_0x41e099]of _0xeb7cb3)_0x110560['has'](_0x1441f9)||(_0xeb7cb3['delete'](_0x1441f9),this['_domEmitter']['stopListening'](_0x41e099));}['_attachMouseMarkerInteractionListeners'](_0x2a36de){this['_domEmitter']['listenTo'](_0x2a36de,'mouseup',(_0x2738dc,_0x172ed1)=>{const _0x81db44=_0x172ed1['target'],_0x1f269f=this['_findMarkerElement'](_0x81db44);if(!_0x1f269f)return;const _0x3dc26a=_0x1f269f['getAttribute']('data-marker-id'),_0x16c38c=_0x3dc26a['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x3dc26a,'changeId':_0x16c38c,'markerElement':()=>this['_findMarkerElementById'](_0x3dc26a),'domEvent':_0x172ed1});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x2a36de,'mouseover',(_0x4d31e4,_0x197a45)=>{const _0x499f8b=_0x197a45['target'],_0x8996d7=_0x197a45['relatedTarget'];let _0x541bb4=this['_findMarkerElement'](_0x499f8b);if(!_0x541bb4&&_0x8996d7&&(_0x541bb4=this['_findMarkerElement'](_0x8996d7)),!_0x541bb4)return;const _0x388136=_0x541bb4['getAttribute']('data-marker-id'),_0x5bf9a1=_0x388136['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x5bf9a1,'markerElement':()=>this['_findMarkerElementById'](_0x388136),'domEvent':_0x197a45});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x3c2cd8((_0x6008ca,_0x1727bb)=>{const _0x2d78c9=_0x1727bb['target'];if(this['_findMarkerElement'](_0x2d78c9))return;_0x2d78c9['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x38b677=this['context']['plugins']['get']('AIEditing'),_0xab6fa=ls(this['context']);if(!_0xab6fa['length'])throw new at('ai-get-editor-from-context-no-editor',this);const _0x1d35e6=new Set(),_0x1b2c1b=[],_0x475611=new Map();for(const _0x5ef90e of _0xab6fa)for(const _0x51ee1e of _0x5ef90e['model']['document']['getRoots']()){if('$graveyard'===_0x51ee1e['rootName'])continue;const _0x100ee0=this['_buildDocumentDataSliceForRoot'](_0x5ef90e,_0x51ee1e,_0x38b677,_0x1d35e6);_0x1b2c1b['push'](_0x100ee0['content']);for(const [_0x4d1f26,_0x340a76]of _0x100ee0['elements'])_0x475611['set'](_0x4d1f26,_0x340a76);}return{'elements':_0x475611,'content':_0x1b2c1b['join']('')};}['_buildDocumentDataSliceForRoot'](_0x749158,_0x1beb20,_0x2dc597,_0x3c5be9){const _0x2428f7=_0x749158['model'],_0x1d93b5=new _0xee8836();for(const _0x59d6ac of _0x1beb20['getChildren']())_0x1d93b5['_appendChild'](_0x59d6ac['_clone'](!0x0));for(const _0x1ee21d of _0x2428f7['markers']){const _0x403e56=_0x1ee21d['getRange']();_0x403e56&&_0x403e56['root']['rootName']===_0x1beb20['rootName']&&_0x1d93b5['markers']['set'](_0x1ee21d['name'],this['_changeRangeOwnerDocument'](_0x403e56['clone'](),_0x1d93b5));}const _0x4c5c27=new Map(),_0x2927ec=_0x2428f7['document']['version'],_0x462ce0=new _0x46a368({'ignoreElementEnd':!0x0,'startPosition':_0x2428f7['createPositionAt'](_0x1d93b5,0x0)});for(const {item:_0x5828bc}of _0x462ce0){if(!_0x5828bc['is']('$textProxy'))continue;const _0x32da60=_0x5828bc['parent'];if(!_0x32da60||!_0x32da60['is']('element'))continue;const _0x7259c7=this['_upsertDataId'](_0x32da60,()=>_0x2dc597['_nextDataId'](_0x3c5be9));_0x3c5be9['add'](_0x7259c7);for(const _0x3b093 of _0x32da60['getChildren']())_0x3b093['is']('element')&&(_0x3b093['name']&&Wn['includes'](_0x3b093['name'])||_0x3c5be9['add'](this['_upsertDataId'](_0x3b093,()=>_0x2dc597['_nextDataId'](_0x3c5be9))));let _0x5bdb12=_0x32da60;for(;_0x5bdb12['parent']&&!_0x5bdb12['parent']['is']('documentFragment');)_0x5bdb12=_0x5bdb12['parent'],_0x5bdb12['hasAttribute'](_0x4140c8)&&_0x5bdb12['_removeAttribute'](_0x4140c8);_0x4c5c27['set'](_0x7259c7,{'editor':_0x749158,'rootName':_0x1beb20['rootName'],'path':_0x32da60['getPath'](),'documentVersion':_0x2927ec,'getContent':this['_createGetContentUsingDataIdFn'](_0x5bdb12['_clone'](!0x0),_0x7259c7,_0x749158['data'])}),_0x462ce0['jumpTo'](_0x2428f7['createPositionAfter'](_0x32da60));}return{'content':_0x749158['data']['processor']['toData'](_0x749158['data']['toView'](_0x1d93b5)),'elements':_0x4c5c27};}['diffContent'](_0xb9c2fd,_0x9860dc,_0x1d8d2c,_0x3f630c=!0x1){const _0x56663a=[],_0x192c3a=_0xb9c2fd['data']['parse'](_0x1d8d2c,'$documentFragment'),_0x102b03=_0xb9c2fd['data']['parse'](_0x9860dc,'$documentFragment'),_0x3d54b3=_0xb9c2fd['model']['createPositionAt'](_0x102b03,0x0);if(this['_haveSingleTopLevelElement'](_0x192c3a)){if(!this['_hasSameTopLevelElement'](_0x102b03,_0x192c3a))return _0x56663a;}else{const _0x504618=_0xb9c2fd['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x102b03,_0x504618)||!this['_haveOnlyInlineContent'](_0x192c3a,_0x504618))return _0x56663a;}const _0x5e4cfe=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x9860dc,_0x1d8d2c,{'targetEditor':_0xb9c2fd,'anchor':_0x3d54b3,'markDeletions':!0x0})['getOperations']()['filter'](_0x1fdb49=>'insert'===_0x1fdb49['type']||'marker'===_0x1fdb49['type']&&_0x1fdb49['name']['startsWith']('$markedRemove')),_0x234f70=this['_groupAdjacentOperations'](_0x5e4cfe),_0x36bf44=[];if(_0x3f630c){if(_0x234f70['length']){const _0x1904cb=_0x234f70[0x0]['operations'][0x0],_0x2c4dc7='insert'===_0x1904cb['type']?_0x1904cb['position']:_0x1904cb['newRange']['start'],_0x33ee35=this['_getPositionLimitingRange'](_0x2c4dc7,_0xb9c2fd,'inside'),_0xd7a96c=_0x33ee35?_0x192c3a['getChild'](0x0)['getChildren']():_0x192c3a['getChildren'](),_0x1080e9=_0x33ee35||_0xb9c2fd['model']['createRangeIn'](_0x102b03),_0x304064=[new _0x147dae('$markedRemove:synthetic'+ot(),null,_0x1080e9,_0xb9c2fd['model']['document']['model']['markers'],!0x0,_0xb9c2fd['model']['document']['version']+0x1),new _0x129783(_0x1080e9['end'],_0xd7a96c,_0xb9c2fd['model']['document']['version']+0x2)];_0x36bf44['push']({'operations':_0x304064,'operationsIsolated':_0x304064,'groupOffset':0x0});}}else _0x36bf44['push'](..._0x234f70);let _0x15d71d=0x0;return _0xb9c2fd['model']['change'](_0x5c6f20=>{for(let _0x17861d=0x0;_0x17861d<_0x36bf44['length'];_0x17861d++){const _0x5c1077=_0x36bf44[_0x17861d],_0x22d810=_0x5c6f20['createDocumentFragment']();for(const _0x35e74a of _0x102b03['getChildren']())_0x5c6f20['append'](_0x35e74a['_clone'](!0x0),_0x22d810);for(const _0x3c1818 of _0x5c1077['operationsIsolated'])if('insert'===_0x3c1818['type']){const _0x13e23a=_0x3c1818;_0x13e23a['baseVersion']=null,_0x13e23a['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x13e23a,_0x22d810),_0x5c6f20['batch']['addOperation'](_0x3c1818),_0xb9c2fd['model']['applyOperation'](_0x3c1818);const _0x491268='suggestion:insertion:id:authorId:'+_0x15d71d++,_0x5084d7=_0xb9c2fd['model']['createRange'](_0x13e23a['position'],_0x13e23a['position']['getShiftedBy'](_0x13e23a['howMany']));_0x22d810['markers']['set'](_0x491268,_0x5084d7);}else{if('marker'===_0x3c1818['type']&&_0x3c1818['name']['startsWith']('$markedRemove')){const _0x54f5b5=_0x3c1818,_0x4b223f='suggestion:deletion:id:authorId:'+_0x15d71d++;this['_changeOperationOwnerDocument'](_0x54f5b5,_0x22d810),_0x22d810['markers']['set'](_0x4b223f,_0x54f5b5['newRange']);}}if(_0x3f630c)_0x56663a['push']({..._0x5c1077,'context':this['_createGetContentFn'](_0x102b03,_0xb9c2fd['data']),'content':this['_createGetContentFn'](_0x102b03,_0xb9c2fd['data'])});else{const _0x47eb0a=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x5c1077['operationsIsolated'][0x0]),_0x22d810),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x5c1077['operationsIsolated'][_0x5c1077['operationsIsolated']['length']-0x1]),_0x22d810),_0xb9c2fd);_0x22d810['markers']['set'](Kn+'suggestion-context',new _0x1445f3(_0x47eb0a['start'],_0x47eb0a['end'])),_0x56663a['push']({..._0x5c1077,'context':this['_createGetContextFn'](_0x22d810,_0xb9c2fd['data'],{'ellipsisBefore':_0x47eb0a['hasContentBefore'],'ellipsisAfter':_0x47eb0a['hasContentAfter']}),'content':this['_createGetContentFn'](_0x22d810,_0xb9c2fd['data'])});}}}),_0x56663a;}['markChangePositionInEditorContent'](_0x56d91e,_0x3dba08){if(!_0x56d91e['length'])return;const _0x32d413=_0x56d91e[0x0]['parent']['id'],_0x14adb7=_0x3dba08['elements']['get'](_0x32d413);if(!_0x14adb7)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x32d413);const _0x27e2b4=_0x14adb7['path'],_0x4af0ba=_0x14adb7['editor'],_0x2b527b=_0x4af0ba['model']['document']['getRoot'](_0x14adb7['rootName']);if(!_0x2b527b)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x14adb7['rootName']);const _0x6da33f=_0x4af0ba['model']['document']['history']['getOperations'](_0x14adb7['documentVersion']),_0x136acf=[];for(const _0x408f0d of _0x56d91e){const _0x1c8be0=_0x408f0d['operationsIsolated']['map'](_0x5f228c=>this['_translateOperationToEditorContent'](_0x5f228c,_0x27e2b4,_0x2b527b));if(!_0x1c8be0||!_0x1c8be0['length'])continue;const _0xf50451=_0x1c8be0['every'](_0x1a9fd3=>'marker'===_0x1a9fd3['type']&&_0x1a9fd3['name']['startsWith']('$markedRemove')),_0x52cab6={'document':_0x4af0ba['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x19cb12=_0x27476f(_0x1c8be0,_0x6da33f,_0x52cab6)['operationsA'];for(const _0xbfefa5 of _0x19cb12)if('insert'===_0xbfefa5['type']){const _0x21dfe3=_0xbfefa5,_0x43a07f=_0x21dfe3['nodes'];_0x4af0ba['model']['change'](_0x3a539a=>{const _0x11a557=_0x3a539a['createDocumentFragment']();for(const _0x7c3724 of _0x43a07f)_0x3a539a['append'](_0x7c3724['_clone'](!0x0),_0x11a557);_0x136acf['push']({'start':_0x21dfe3['position'],'end':_0x21dfe3['position'],'type':'insert','groupId':_0x408f0d['id'],'content':{'asString':this['_createGetContentFn'](_0x11a557,_0x4af0ba['data'])(),'asFragment':_0x11a557}});});}else{if('marker'===_0xbfefa5['type']&&_0xbfefa5['name']['startsWith']('$markedRemove')){const _0x49ac45=_0xbfefa5;let _0x4e648e='remove-text';if(_0xf50451){const _0x4fa6d2=this['_findAdjacentContextDistance'](_0x49ac45['newRange']['start'],'backward',_0x4af0ba['model']['schema']),_0x3a5782=this['_findAdjacentContextDistance'](_0x49ac45['newRange']['end'],'forward',_0x4af0ba['model']['schema']);if(_0x4fa6d2||_0x3a5782){const _0x326e1b=_0x49ac45['newRange']['start']['getShiftedBy'](-_0x4fa6d2),_0x291b13=_0x49ac45['newRange']['end']['getShiftedBy'](_0x3a5782);_0x136acf['push']({'start':_0x326e1b,'end':_0x291b13,'groupId':_0x408f0d['id'],'type':'remove-context'});}else _0x4e648e='remove-only';}_0x136acf['push']({'start':_0x49ac45['newRange']['start'],'end':_0x49ac45['newRange']['end'],'groupId':_0x408f0d['id'],'type':_0x4e648e});}}}this['_insertMarkers'](_0x136acf,_0x4af0ba);}['clearAllMarkers'](){const _0x266418=new Map();for(const _0x204429 of this['_markers']['keys']()){const _0x10d0d5=this['_markers']['get'](_0x204429);_0x10d0d5?.['editor']&&(_0x266418['has'](_0x10d0d5['editor'])||_0x266418['set'](_0x10d0d5['editor'],[]),_0x266418['get'](_0x10d0d5['editor'])['push'](_0x204429));}for(const [_0x35231f,_0x32c695]of _0x266418)_0x35231f['model']['change'](_0x32537a=>{for(const _0x36062c of _0x32c695)_0x35231f['model']['markers']['get'](_0x36062c)&&_0x32537a['removeMarker'](_0x36062c);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x11f546 of ls(this['context']))_0x11f546['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x13b50c of ls(this['context']))_0x13b50c['disableReadOnlyMode']('ai-review');}['applyChange'](_0xc095fb){const _0x5d5419=_0xc095fb['map'](_0x4209cd=>this['_getMarkersDataForGroup'](_0x4209cd))['flat'](),_0x542e36=new Map();for(const _0x577834 of _0x5d5419)_0x542e36['has'](_0x577834['editor'])||_0x542e36['set'](_0x577834['editor'],[]),_0x542e36['get'](_0x577834['editor'])['push'](_0x577834);for(const [_0x16ac6c,_0x2f0de5]of _0x542e36){const _0x329551=_0x16ac6c['model'];_0x329551['change'](_0xf16ea5=>{for(const _0x193995 of _0x2f0de5){const _0x2ead8c=_0x16ac6c['model']['markers']['get'](_0x193995['id']);if(_0x2ead8c){if('insert'===_0x193995['type']){if(!_0x193995['content'])continue;_0x329551['insertContent'](_0x193995['content']['asFragment']||null,_0x2ead8c['getRange']()['start']);}else'remove-text'!==_0x193995['type']&&'remove-only'!==_0x193995['type']||_0x329551['deleteContent'](_0x329551['createSelection'](_0x2ead8c['getRange']()));_0xf16ea5['removeMarker'](_0x193995['id']),this['_markers']['delete'](_0x193995['id']);}}});}}['rejectChange'](_0x191f14){const _0x179dc2=this['_getMarkersDataForGroup'](_0x191f14),_0x2d4dcf=new Map();for(const _0x575516 of _0x179dc2)_0x2d4dcf['has'](_0x575516['editor'])||_0x2d4dcf['set'](_0x575516['editor'],[]),_0x2d4dcf['get'](_0x575516['editor'])['push'](_0x575516);for(const [_0x2937a6,_0x2f424d]of _0x2d4dcf)_0x2937a6['model']['change'](_0x260fa5=>{for(const _0x379f36 of _0x2f424d)_0x260fa5['removeMarker'](_0x379f36['id']),this['_markers']['delete'](_0x379f36['id']);});}['getEditor'](){return ds(this['context']);}['getEditors'](){return ls(this['context']);}['getEditorForChange'](_0x576c73){const _0x25d419=this['_getMarkersDataForGroup'](_0x576c73);return _0x25d419[0x0]?.['editor'];}['getMarkerElementForChange'](_0x5791a6){const _0x47c70f=Array['from'](this['_markers']['values']())['filter'](_0x19f50e=>_0x19f50e['groupId']===_0x5791a6);if(!_0x47c70f['length'])return null;const _0x58fa30=0x1===_0x47c70f['length']?_0x47c70f[0x0]:this['_sortMarkers'](_0x47c70f)[0x0],_0xf0abf7=_0x58fa30['editor']['model']['markers']['get'](_0x58fa30['id']);if(!_0xf0abf7)return null;return{'modelRange':_0xf0abf7['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x58fa30['id'])};}['getContentElementForChange'](_0x2fe5f3){const _0x34451b=Array['from'](this['_markers']['values']())['filter'](_0x1e96d1=>_0x1e96d1['groupId']===_0x2fe5f3);if(!_0x34451b['length'])return null;const _0x1227e4=0x1===_0x34451b['length']?_0x34451b[0x0]:this['_sortMarkers'](_0x34451b)[0x0],_0xab70b5=_0x1227e4['editor'],_0x4d5ff1=_0xab70b5['model']['markers']['get'](_0x1227e4['id']);if(!_0x4d5ff1)return null;const _0x11c468=_0x4d5ff1['getRange'](),_0x5794bc=_0xab70b5['editing']['view']['getDomRoot'](_0x11c468['root']['rootName'])||_0xab70b5['editing']['view']['getDomRoot']();if(!_0x5794bc||!_0x11c468)return null;let _0x266818=_0x11c468['start']['parent'];for(;_0x266818['parent']&&'$root'!==_0x266818['parent']['name'];)_0x266818=_0x266818['parent'];if(!_0x266818||!_0x266818['name'])return null;const _0x4834c1=_0x5794bc['querySelector']('[data-marker-id=\x22'+_0x1227e4['id']+'\x22]');if(!_0x4834c1)return null;let _0x53e006=null;_0xab70b5['model']['change'](_0x43e4d2=>{_0x53e006=_0x43e4d2['createDocumentFragment'](),_0x43e4d2['append'](_0x266818['_clone'](!0x0),_0x53e006);});const _0x49af2a=_0xab70b5['data']['toView'](_0x53e006)['getChild'](0x0);return _0x4834c1['closest'](_0x49af2a['name']);}['reactivateMarkers'](_0x4b7d45){const _0x39531c=this['_getMarkersDataForGroup'](_0x4b7d45);if(!_0x39531c['length'])return;const _0x2015dd=Array['from'](this['_activeMarkers'])['sort'](),_0x141030=Array['from'](new Set(_0x39531c['map'](_0x543b4e=>_0x543b4e['id'])))['sort']();_0x2015dd['join']('|')!==_0x141030['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x4b7d45));}['setMarkersInElementAsActive'](_0x14b7eb){const _0x13815d=this['_getMarkersDataForGroup'](_0x14b7eb);if(!_0x13815d['length'])return;const _0x35b8b8=_0x13815d[0x0]['editor'],_0x2accac=new Set(_0x13815d['map'](_0x3baca0=>_0x3baca0['id'])),_0x3381c6=Array['from'](_0x2accac['values']())['map'](_0x139f4e=>_0x35b8b8['model']['markers']['get'](_0x139f4e))['filter'](_0x41c65f=>!!_0x41c65f);_0x2accac['forEach'](_0x1bc47b=>{this['_activeMarkers']['add'](_0x1bc47b);}),_0x35b8b8['model']['change'](()=>{_0x3381c6['forEach'](_0x44f8e5=>{_0x35b8b8['editing']['reconvertMarker'](_0x44f8e5);});});}['setAllMarkersAsInactive'](){const _0x3b49c8=Array['from'](this['_activeMarkers']);if(!_0x3b49c8['length'])return;this['_activeMarkers']['clear']();const _0x349f2e=new Map();for(const _0x276d4b of _0x3b49c8){const _0x2345ed=this['_markers']['get'](_0x276d4b);if(!_0x2345ed)continue;const _0x5838f3=_0x2345ed['editor'],_0x4ba6fa=_0x5838f3['model']['markers']['get'](_0x276d4b);_0x4ba6fa&&(_0x349f2e['has'](_0x5838f3)||_0x349f2e['set'](_0x5838f3,[]),_0x349f2e['get'](_0x5838f3)['push'](_0x4ba6fa));}for(const [_0x3ec137,_0x29ebfb]of _0x349f2e)_0x3ec137['model']['change'](()=>{_0x29ebfb['forEach'](_0x4619cd=>{_0x3ec137['editing']['reconvertMarker'](_0x4619cd);});});}['_getPositionLimitingRange'](_0x55011e,_0x2f30d5,_0x593dfd='outside'){if(!_0x55011e)return null;let _0x453956=_0x55011e['parent'];for(;_0x453956&&_0x453956['parent']&&'$root'!==_0x453956['parent']['name']&&!_0x2f30d5['model']['schema']['isLimit'](_0x453956)&&!_0x2f30d5['model']['schema']['isBlock'](_0x453956);)_0x453956=_0x453956['parent'];if(!_0x453956||!_0x453956['name']||'$root'===_0x453956['name'])return null;let _0x14eb04=null;return _0x2f30d5['model']['change'](_0x451361=>{_0x14eb04='inside'===_0x593dfd?_0x451361['createRangeIn'](_0x453956):_0x451361['createRangeOn'](_0x453956);}),_0x14eb04;}['_validateMarkers'](_0x23b755,_0x2df971){const _0x416f3b=Array['from'](this['_markers']['keys']()),_0x1591b3=new Map();for(const _0x2452ce of _0x416f3b){const _0x1d0b6a=_0x23b755['model']['markers']['get'](_0x2452ce);if(!_0x1d0b6a)continue;const _0x447d64=_0x1d0b6a['getStart']()['root']['rootName']+':'+_0x1d0b6a['getStart']()['path'][0x0];_0x1591b3['has'](_0x447d64)||_0x1591b3['set'](_0x447d64,[]),_0x1591b3['get'](_0x447d64)['push'](_0x1d0b6a);}const _0x4950f5=new Set();for(const _0x54588a of _0x23b755['model']['document']['differ']['getChanges']()){let _0x448543='',_0x3fe320=null;if('insert'===_0x54588a['type'])_0x3fe320=new _0x1445f3(_0x54588a['position'],_0x54588a['position']['getShiftedBy'](_0x54588a['length'])),_0x448543=_0x54588a['position']['root']['rootName']+':'+_0x54588a['position']['path'][0x0];else{if('remove'!==_0x54588a['type'])continue;_0x3fe320=new _0x1445f3(_0x54588a['position']),_0x448543=_0x54588a['position']['root']['rootName']+':'+_0x54588a['position']['path'][0x0];}const _0x494545=_0x1591b3['get'](_0x448543)||[];if(_0x494545['length']){for(const _0x4f0e1f of _0x494545)if(_0x3fe320['root']['rootName']===_0x4f0e1f['getRange']()['root']['rootName']&&('insert'!==_0x54588a['type']||!_0x3fe320['containsRange'](_0x4f0e1f['getRange']()))&&(_0x3fe320['isIntersecting'](_0x4f0e1f['getRange']())||_0x3fe320['start']['isTouching'](_0x4f0e1f['getRange']()['end'])||_0x3fe320['end']['isTouching'](_0x4f0e1f['getRange']()['start']))){const _0x51c85a=this['_parseMarkerName'](_0x4f0e1f['name']);Array['from'](this['_markers']['values']())['filter'](_0x8988f9=>_0x8988f9['groupId']===_0x51c85a['groupId'])['forEach'](_0x33df6c=>_0x4950f5['add'](_0x33df6c['id']));}}}if(_0x4950f5['size']){for(const _0xacbb1b of _0x4950f5)_0x2df971['removeMarker'](_0xacbb1b);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x362c7a){for(const {name:_0x25e787,data:_0x5c5961}of _0x362c7a['model']['document']['differ']['getChangedMarkers']()){if(!_0x25e787['startsWith'](Kn))continue;const _0x197c47=_0x5c5961['oldRange'],_0x4e4b99=_0x5c5961['newRange'],_0x253fb4=_0x197c47&&'$graveyard'===_0x197c47['root']['rootName'],_0x48a8c2=_0x4e4b99&&'$graveyard'===_0x4e4b99['root']['rootName'];if(_0x253fb4&&_0x48a8c2)continue;const _0x25d16f=this['_parseMarkerName'](_0x25e787);this['_markers']['get'](_0x25e787)&&(_0x48a8c2||!_0x4e4b99?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x25e787,'changeId':_0x25d16f['groupId']}):_0x253fb4&&_0x4e4b99&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x25e787,'changeId':_0x25d16f['groupId']}));}}['_parseMarkerName'](_0x53fa70){const _0x1a9e61=_0x53fa70['split'](':'),_0x414200=(_0x1a9e61[0x1]||'')['split']('_');return{'prefix':_0x1a9e61[0x0],'groupId':_0x414200[0x0],'suffix':_0x414200[0x1]};}['_translateOperationToEditorContent'](_0x301c10,_0xc30c80,_0x393822){if('insert'===_0x301c10['type']){const _0x7c78b=_0x301c10;return new _0x129783(this['_changePosition'](_0xc30c80['concat'](_0x7c78b['position']['offset']),_0x393822),_0x7c78b['nodes'],_0x7c78b['baseVersion']);}if('marker'===_0x301c10['type']&&_0x301c10['name']['startsWith']('$markedRemove')){const _0x37f26e=_0x301c10;return new _0x147dae(_0x37f26e['name'],_0x37f26e['oldRange'],this['_changeRange'](_0x37f26e['newRange'],_0xc30c80['concat'](_0x37f26e['newRange']['start']['offset']),_0xc30c80['concat'](_0x37f26e['newRange']['end']['offset']),_0x393822),_0x37f26e['_markers'],_0x37f26e['affectsData'],_0x37f26e['baseVersion']);}return _0x301c10;}['_groupAdjacentOperations'](_0xeada83){if(!_0xeada83['length'])return[];const _0x57da89=[];let _0x5e9be9=0x0,_0x878815=0x0,_0x5d7028=[];for(let _0x19432c=0x0;_0x19432c<=_0xeada83['length'];_0x19432c++){const _0x2f2c43=_0xeada83[_0x19432c],_0x2cdf8f=_0xeada83[_0x19432c-0x1];!_0x2f2c43||_0x2cdf8f&&!this['_getOperationEnd'](_0x2cdf8f)['isTouching'](this['_getOperationStart'](_0x2f2c43))?(_0x57da89['push']({'operations':_0x5d7028,'operationsIsolated':_0x5d7028['map'](_0x1030d0=>this['_shiftOperation'](_0x1030d0['clone'](),-_0x878815)),'groupOffset':_0x5e9be9}),_0x5d7028=_0x2f2c43?[_0x2f2c43]:[],_0x878815+=_0x5e9be9,_0x5e9be9=0x0):_0x5d7028['push'](_0x2f2c43),_0x2f2c43&&'insert'===_0x2f2c43['type']&&(_0x5e9be9+=_0x2f2c43['howMany']);}return _0x57da89;}['_findAdjacentContextDistance'](_0x4df32a,_0x23bd9e,_0x992e5c,_0x12dd31=0x1){const _0x4bf6bd=new _0x46a368({'startPosition':_0x4df32a,'direction':_0x23bd9e});let _0x3289bc=0x0;for(let _0x3eaa79=0x0;_0x3eaa79<_0x12dd31;_0x3eaa79++){let _0x140bab=0x0,_0x43a7b7=!0x1,_0x3acd76='forward'===_0x23bd9e?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x3a3659}of _0x4bf6bd)if(_0x3a3659['is']('$textProxy')){const _0x287334=_0x3acd76['exec'](_0x3a3659['data']);if(_0x287334&&_0x287334['length']){if(_0x140bab+='forward'===_0x23bd9e?_0x287334['index']+_0x287334[0x0]['length']:_0x3a3659['data']['length']-_0x287334['index'],_0x287334[0x0]['length']!==_0x3a3659['data']['length'])break;_0x43a7b7=!0x0,_0x3acd76='forward'===_0x23bd9e?/^\w+/:/\w+$/;}else{if(_0x43a7b7)break;_0x140bab+=_0x3a3659['offsetSize'];}}else{if(_0x3a3659['is']('element')){_0x992e5c['isInline'](_0x3a3659)&&!_0x43a7b7&&(_0x140bab+=0x1);break;}}_0x3289bc+=_0x140bab,_0x4bf6bd['jumpTo'](_0x4df32a['getShiftedBy']('forward'===_0x23bd9e?_0x3289bc:-_0x3289bc));}return _0x3289bc;}['_getChangeContext'](_0x2dd8be,_0x21f195,_0x47ba5b){const _0x22e590=_0x47ba5b['model']['schema'],_0x37c79b=this['_findAdjacentContextDistance'](_0x2dd8be,'backward',_0x22e590,0x6),_0x944789=this['_findAdjacentContextDistance'](_0x21f195,'forward',_0x22e590,0x6),_0x2a54ac=_0x2dd8be['getShiftedBy'](-_0x37c79b),_0x3c04b7=_0x21f195['getShiftedBy'](_0x944789);return{'start':_0x2a54ac,'end':_0x3c04b7,'hasContentBefore':!_0x2a54ac['isAtStart'],'hasContentAfter':!_0x3c04b7['isAtEnd']};}['_insertMarkers'](_0x4c7f79,_0x3730e6){const _0x3010cb=this['context']['plugins']['get']('AIEditing'),_0x1d18ca=new Set();_0x3730e6['model']['change'](_0x29e056=>{for(const _0xa9ba2c of _0x4c7f79){const _0x5afc51=''+Kn+_0xa9ba2c['type']+':'+_0xa9ba2c['groupId']+'_'+_0x3010cb['_nextDataId'](_0x1d18ca);this['_markers']['set'](_0x5afc51,{'id':_0x5afc51,'groupId':_0xa9ba2c['groupId'],'type':_0xa9ba2c['type'],'content':_0xa9ba2c['content'],'editor':_0x3730e6}),_0x29e056['addMarker'](_0x5afc51,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x29e056['createRange'](_0xa9ba2c['start'],_0xa9ba2c['end'])});}});}['_createGetContextFn'](_0x12ff5d,_0x1d34ef,_0x2cd5d5){let _0x598eda='';return()=>{if(!_0x598eda){const _0x16a045=_0x1d34ef['toView'](_0x12ff5d,{'showSuggestionHighlights':!0x0});let _0x39cf86=_0x16a045['getChild'](0x0);if(_0x39cf86['is']('containerElement')||(_0x39cf86=_0x16a045),!_0x39cf86)return'';let _0x568ec1=!0x1;const _0x7284b7=[];for(const _0x11b990 of _0x39cf86['getChildren']())_0x11b990['is']('element','span')&&_0x11b990['hasClass']('ck-ai_review-marker_context-end')&&(_0x568ec1=!0x1),_0x568ec1&&_0x7284b7['push'](_0x11b990),_0x11b990['is']('element','span')&&_0x11b990['hasClass']('ck-ai_review-marker_context-start')&&(_0x568ec1=!0x0);_0x39cf86['_removeChildren'](0x0,_0x39cf86['childCount']),_0x2cd5d5?.['ellipsisBefore']&&_0x39cf86['_appendChild']('…'),_0x39cf86['_appendChild'](_0x7284b7),_0x2cd5d5?.['ellipsisAfter']&&_0x39cf86['_appendChild']('…');const _0x2e5b89=_0x1d34ef['htmlProcessor']['domConverter']['viewToDom'](_0x16a045),_0x5b091e=_0x1d34ef['htmlProcessor']['htmlWriter']['getHtml'](_0x2e5b89);_0x598eda=_0x5b091e;}return _0x598eda;};}['_createGetContentFn'](_0x1b5872,_0x33853a){let _0x552594='';return()=>(_0x552594||(_0x552594=_0x33853a['stringify'](_0x1b5872,{'showSuggestionHighlights':!0x0})),_0x552594);}['_createGetContentUsingDataIdFn'](_0x109bb7,_0x9f7c0e,_0x20fd50){let _0x326263='';return()=>{if(!_0x326263){const _0x4b085e=_0x20fd50['toView'](new _0xee8836(_0x109bb7)),_0x530736=_0x20fd50['htmlProcessor']['domConverter']['viewToDom'](_0x4b085e)['querySelector']('[data-id=\x22'+_0x9f7c0e+'\x22]');_0x326263=_0x530736?.['outerHTML']||'';}return _0x326263;};}['_findMarkerElement'](_0x24ede8,_0x2061a1=0x5){let _0x3782c6=_0x24ede8,_0x5e9366=null;for(let _0x81160c=0x0;_0x81160c<_0x2061a1&&_0x3782c6;_0x81160c++){if(!_0x3782c6['className']){_0x3782c6=_0x3782c6['parentElement'];continue;}if(!(''+_0x3782c6['className'])['includes']('ck-ai_review-marker_')){_0x3782c6=_0x3782c6['parentElement'];continue;}if(!_0x3782c6['getAttribute']('data-marker-id'))break;_0x5e9366=_0x3782c6;break;}return _0x5e9366;}['_findMarkerElementById'](_0x5b6d08){const _0x1775d8=this['_markers']['get'](_0x5b6d08),_0x392bce=_0x1775d8?.['editor']??ds(this['context']),_0x4eef91=_0x392bce['model']['markers']['get'](_0x5b6d08);return _0x4eef91?_0x1e5795(_0x392bce['editing'],_0x4eef91):null;}['_getMarkersDataForGroup'](_0x2233e7){return Array['from'](this['_markers']['values']())['filter'](_0x19006c=>_0x19006c['groupId']===_0x2233e7);}['_getOperationStart'](_0x562820){return'insert'===_0x562820['type']?_0x562820['position']:_0x562820['newRange']['start'];}['_getOperationEnd'](_0x49daf2,_0x3a8b13=!0x1){return'insert'===_0x49daf2['type']?_0x3a8b13?_0x49daf2['position']:_0x49daf2['position']['getShiftedBy'](_0x49daf2['howMany']):_0x49daf2['newRange']['end'];}['_shiftOperation'](_0x1494fc,_0x59e656){return'insert'===_0x1494fc['type']?_0x1494fc['position']=_0x1494fc['position']['getShiftedBy'](_0x59e656):'marker'===_0x1494fc['type']&&_0x1494fc['newRange']&&(_0x1494fc['newRange']=new _0x1445f3(_0x1494fc['newRange']['start']['getShiftedBy'](_0x59e656),_0x1494fc['newRange']['end']['getShiftedBy'](_0x59e656))),_0x1494fc;}['_changeOperationOwnerDocument'](_0x1ea808,_0x556bf2){'insert'===_0x1ea808['type']?_0x1ea808['position']=this['_changePositionOwnerDocument'](_0x1ea808['position'],_0x556bf2):'marker'===_0x1ea808['type']&&_0x1ea808['newRange']&&(_0x1ea808['newRange']=this['_changeRangeOwnerDocument'](_0x1ea808['newRange'],_0x556bf2));}['_changePositionOwnerDocument'](_0x147c46,_0x35b4b6){return new _0x3c2be3(_0x35b4b6,_0x147c46['path']);}['_changeRangeOwnerDocument'](_0x14bf4d,_0x1094f0){return new _0x1445f3(this['_changePositionOwnerDocument'](_0x14bf4d['start'],_0x1094f0),this['_changePositionOwnerDocument'](_0x14bf4d['end'],_0x1094f0));}['_changePosition'](_0x14856d,_0x3134f4){return new _0x3c2be3(_0x3134f4,[..._0x14856d]);}['_changeRange'](_0x465078,_0x161c92,_0x40ef13,_0x3f37a0){return new _0x1445f3(this['_changePosition'](_0x161c92,_0x3f37a0),this['_changePosition'](_0x40ef13,_0x3f37a0));}['_sortMarkers'](_0x48dd7c){const _0x1cd173=_0x59732f=>{switch(_0x59732f){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x48dd7c['sort']((_0x45395a,_0x148789)=>_0x1cd173(_0x45395a['type'])-_0x1cd173(_0x148789['type']));}['_hasSameTopLevelElement'](_0x24af52,_0x39d3f2){const _0x468176=_0x24af52['getChild'](0x0),_0xb59a14=_0x39d3f2['getChild'](0x0);return!(!_0x468176||!_0xb59a14)&&((!_0x468176['is']('element')||!_0xb59a14['is']('element')||_0x468176['name']===_0xb59a14['name'])&&!(_0x468176['is']('element')&&!_0xb59a14['is']('element')||!_0x468176['is']('element')&&_0xb59a14['is']('element')));}['_haveSingleTopLevelElement'](_0x5379b3){return 0x1===_0x5379b3['childCount'];}['_haveOnlyInlineContent'](_0x46e8d5,_0x535a18){for(const _0x14ec8e of _0x46e8d5['getChildren']())if(_0x14ec8e['is']('element')&&!_0x535a18['isInline'](_0x14ec8e))return!0x1;return!0x0;}['_upsertDataId'](_0x2de0d0,_0x2bc6c0){let _0xad42db=_0x2de0d0['getAttribute'](_0x4140c8);return _0xad42db||(_0xad42db=_0x2bc6c0(),_0x2de0d0['_setAttribute'](_0x4140c8,_0xad42db)),_0xad42db;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x5d5821,contentNew:_0x4ffd1f,contentInitial:_0x41e1e6,documentVersion:_0x2d1258}){super(),this['id']=_0x5d5821,this['contentNew']=_0x4ffd1f,this['contentInitial']=_0x41e1e6,this['documentVersion']=_0x2d1258;}}class AIReviewCheckResultChange extends ht(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x2d3708,_0x4d3c25,_0x34846c){super(),this['id']=_0x2d3708,this['parent']=_0x34846c,this['_data']=_0x4d3c25,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 ht(){['id']=ot();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x5b2293,_0x27ef11,_0x1918c4,_0x51936a,_0x5e064a){super(),this['_sourceCheck']=_0x27ef11,this['_documentData']=_0x5b2293,this['_aiConnector']=_0x1918c4,this['_reviewParams']=_0x51936a,this['_reviewArgs']=_0x5e064a,this['on']('change:status',(_0x34c77c,_0x1557b6,_0x53afae)=>{'aborted'==_0x53afae&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x53afae,'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'](_0x287a61=>'pending'===_0x287a61['status']);}get['currentError'](){return this['_currentError'];}['updateDocumentData'](_0x493caf){this['_documentData']=_0x493caf;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0xaa7e0b=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x1df10c of _0xaa7e0b)'unmodified'!==_0x1df10c['data']['operation']&&('error'!==_0x1df10c['data']['operation']?'review-metadata'!==_0x1df10c['event']?this['_addReviewCheckResult'](_0x1df10c['data']['dataId'],_0x1df10c['data']['textDelta']):this['callId']=_0x1df10c['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(_0x29d0ef){this['_currentError']=_0x29d0ef,_0x29d0ef instanceof Error&&_0x29d0ef['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'](_0x2c7e8c,_0x4afcb5){const _0x5a903e=this['_results']['get'](_0x2c7e8c);if(!_0x5a903e)return;if(0x0===_0x4afcb5['length'])return;const _0xca95e3=[];_0x4afcb5['forEach']((_0x39347c,_0xeac9cd)=>{const _0x37037f=new AIReviewCheckResultChange(_0x5a903e['id']+'-'+_0xeac9cd,_0x39347c,_0x5a903e);_0x37037f['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x37037f,'status':_0x37037f['status']});}),_0x37037f['on']('change:isActivated',()=>{_0x37037f['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x37037f}):this['fire']('reviewCheckResultDeactivated',{'change':_0x37037f});}),this['_changes']['push'](_0x37037f),_0xca95e3['push'](_0x37037f);}),this['fire']('reviewCheckResultReady',{'changes':_0xca95e3,'result':_0x5a903e,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x42da3d){const _0x4dae9d=this['_changes']['find'](_0x45a184=>_0x45a184['id']===_0x42da3d);return!(!_0x4dae9d||'pending'!==_0x4dae9d['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x2ad88f=>!0x0===_0x2ad88f['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x364ffe=>'pending'===_0x364ffe['status']);}['getChangeById'](_0xdab352){return this['_changes']['find'](_0x36be8c=>_0x36be8c['id']===_0xdab352);}['markAllChangesAsAccepted'](){for(const _0x547a63 of this['_changes'])'pending'===_0x547a63['status']&&(_0x547a63['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x14ccbe){const _0x2cee04=this['_changes']['find'](_0x3025cd=>_0x3025cd['id']===_0x14ccbe);_0x2cee04&&'pending'===_0x2cee04['status']&&(_0x2cee04['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x1940bf){const _0x13b6cd=this['_changes']['find'](_0x1a7252=>_0x1a7252['id']===_0x1940bf);_0x13b6cd&&'pending'===_0x13b6cd['status']&&(_0x13b6cd['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x45f19e){const _0x28aac3=this['_changes']['find'](_0x4fb47c=>_0x4fb47c['id']===_0x45f19e);_0x28aac3&&'pending'===_0x28aac3['status']&&(_0x28aac3['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x3fbbb3){const _0x4630f8=this['_changes']['find'](_0x40c554=>_0x40c554['id']===_0x3fbbb3);_0x4630f8&&'outdated'===_0x4630f8['status']&&(_0x4630f8['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x149556){this['_changes']['filter'](_0x3ba350=>_0x3ba350['isActivated']&&_0x3ba350['id']!==_0x149556)['forEach'](_0x22cdb5=>{_0x22cdb5['isActivated']=!0x1;});const _0x3db267=this['_changes']['find'](_0x208e23=>_0x208e23['id']===_0x149556);_0x3db267&&'pending'===_0x3db267['status']&&(_0x3db267['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x352e81=>_0x352e81['isActivated'])['forEach'](_0x16a5ac=>{_0x16a5ac['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x54c548){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0xaf1be7;if(_0x54c548){const _0x3a8fd3=this['_changes']['find'](_0x33456c=>_0x33456c['id']===_0x54c548);if(_0x3a8fd3&&_0x3a8fd3['isRated'])return;_0x3a8fd3&&(_0xaf1be7=_0x3a8fd3['parent']['id'],_0x3a8fd3['isRated']=!0x0);}const _0x3d535a={'positiveCount':this['_changes']['filter'](_0x401c0b=>'accepted'===_0x401c0b['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x3d535a,this['callId'],_0xaf1be7);}['_addReviewCheckResult'](_0x54c50b,_0x57d01c){const _0x1f14f6=this['_documentData']['elements']['get'](_0x54c50b);if(!_0x1f14f6)return;const _0x220c11=_0x1f14f6['getContent']();if(_0x220c11===_0x57d01c)return;const _0x323073=new AIReviewCheckResult({'id':_0x54c50b,'contentInitial':_0x220c11,'contentNew':_0x57d01c,'documentVersion':_0x1f14f6['documentVersion']});this['_results']['set'](_0x323073['id'],_0x323073),this['fire']('reviewCheckResultAdded',{'result':_0x323073,'source':this,'editor':_0x1f14f6['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0x400ee6=>'pending'===_0x400ee6['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x5a87e0=>'pending'===_0x5a87e0['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x139db1=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x30c355=0x0;_0x30c355<this['_reviewParams']['length'];_0x30c355++){if(!this['_reviewParams'][_0x30c355]||!this['_sourceCheck']['options'][_0x30c355])continue;const _0x42827b=this['_sourceCheck']['options'][_0x30c355],_0x2d68a6=_0x42827b['data']?.['find'](_0x50a740=>_0x50a740['id']===this['_reviewParams'][_0x30c355]);_0x2d68a6&&_0x139db1['push'](_0x2d68a6['label']);}return _0x139db1['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x2adb88,_0x1544d3,_0xc7e362){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x1544d3,_0x2adb88,_0xc7e362);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0x23f270{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_aiReviewCheckList'];['_currentReviewCheckRun'];['_changeActivationSource']=null;static get['requires'](){return[AIConnector];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['init'](){this['_initRequiredPlugins'](),this['_aiReviewCheckList']=await this['_getChecksList'](),this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_aiReviewCoreUi']['setAvailableChecks'](this['_aiReviewCheckList']['checks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',async(_0x29cd0e,_0x5a23d6)=>{const _0x14b4b5=this['_aiReviewCheckList']['getCheckById'](_0x5a23d6['id']);if(_0x14b4b5){this['_onReviewCheckRun'](_0x5a23d6),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x5a23d6,_0x14b4b5),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x12f15e,_0x3b2846)=>{switch(_0x3b2846['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x3b2846);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new at('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new at('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x3b2846['status']&&'error-chunk'!==_0x3b2846['status']&&'error-general'!==_0x3b2846['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x46583c,_0x33464a)=>{if(!this['_currentReviewCheckRun'])throw new at('ai-review-mode-no-current-check-run',this);const _0x45bb81=this['_diffContent'](_0x33464a['editor'],_0x33464a['result']['contentInitial'],_0x33464a['result']['contentNew']);_0x33464a['source']['addResultChanges'](_0x33464a['result']['id'],_0x45bb81);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0xd3fdf2,_0x2df2b6)=>{for(const _0xffba12 of _0x2df2b6['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0xffba12);this['_markChangePositionInEditorContent'](_0x2df2b6['changes'],_0x2df2b6['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x422f02,_0x2c5c52)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x2c5c52['change']['id'],_0x2c5c52['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x59d9c0,_0x1f790e)=>{this['_onReviewCheckResultActivated'](_0x1f790e);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x49142a){_0x49142a instanceof Error&&_0x49142a['message']['includes']('ai-request-aborted')||(_0x49142a instanceof at?this['_logError'](_0x49142a):this['_logError'](new at('ai-review-mode-check-run-failed',this,void 0x0,_0x49142a)));}}else this['_logError'](new at('ai-review-mode-source-check-not-found',this,{'checkId':_0x5a23d6['id']}));}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReview',()=>{this['_onReviewRunLeave']();}),this['listenTo'](this['_aiReviewCoreUi'],'leaveReviewCoreResultList',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'abortReviewStream',()=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}),this['listenTo'](this['_aiReviewCoreUi'],'finishReview',()=>{this['_onReviewRunLeave'](!0x0);}),this['listenTo'](this['_aiReviewCoreUi'],'acceptAllChanges',()=>{if(!this['_currentReviewCheckRun'])return;const _0x3a89f5=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x3a89f5['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x3a89f5['map'](_0x5b6cc8=>_0x5b6cc8['id']));const _0x478dff=this['_currentReviewCheckRun'];_0x478dff['markAllChangesAsAccepted'](),_0x478dff['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x1a2870,_0x4221c4)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4221c4['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x4221c4['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x4221c4['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4221c4['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x33efbd,_0x5481d7)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5481d7['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x5481d7['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x5481d7['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5481d7['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',(_0x51b56e,_0x1af9e7)=>{this['_onActivateChange'](_0x1af9e7);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x3ecd0,_0x56e059)=>{this['_onDeactivateChange'](_0x56e059);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0xb7b3a4,_0x429b03)=>{this['_onChangeMarkerClicked'](_0xb7b3a4,_0x429b03);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x24f417,_0x1f6cf0)=>{this['_onChangeMarkerHovered'](_0x24f417,_0x1f6cf0);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x406aaa,_0x3ef153)=>{this['_onChangeMarkerRemoved'](_0x406aaa,_0x3ef153);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x5eb6ff,_0x54c4f8)=>{this['_onChangeMarkerRestored'](_0x5eb6ff,_0x54c4f8);});}['_createReviewCheckRun'](_0x3340a4,_0x5da09b){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x5da09b,this['_aiConnector'],_0x3340a4['params'],_0x3340a4['args']);}['_onChangeMarkerRemoved'](_0x3c6003,_0x30d36f){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x30d36f['changeId']);}['_onChangeMarkerRestored'](_0x21cfd5,_0x406b10){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x406b10['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0x227e4b=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x227e4b&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x1915c6 of this['_aiReviewCoreEditing']['getEditors']())_0x1915c6['editing']['view']['change'](_0x2a18e8=>{for(const _0x1187a8 of _0x1915c6['editing']['view']['document']['getRoots']())_0x2a18e8['removeClass']('ck-ai_review-diff',_0x1187a8),_0x2a18e8['removeClass']('ck-ai_review-highlights',_0x1187a8),_0x2a18e8['removeClass']('ck-ai-translate-mode-content',_0x1187a8);});}['_getTranslationWithDefault'](_0x4d74fe,_0x322fd8){const _0x4c2937=Hi(this['context']['locale'],_0x4d74fe);return _0x4c2937===_0x4d74fe?_0x322fd8:_0x4c2937;}['_logError'](_0x144ebb,_0x51bb3c=!0x1){Ct(_0x144ebb['message']),_0x51bb3c||(_0x144ebb['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x168c12){if('content'===this['_changeActivationSource']){const _0x4aff6f=this['_aiReviewCoreUi']['getChangeElement'](_0x168c12);_0x4aff6f&&ft(_0x4aff6f['closest']('.ck-ai_review__check-run-result')||_0x4aff6f);}else{if('panel'===this['_changeActivationSource']){const _0x2fee05=this['_getChangeContentElement'](_0x168c12);if(!_0x2fee05)return;wt({'target':_0x2fee05,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}const Yn=[{'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 AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x446d31){this['id']=_0x446d31['id'],this['commandId']=_0x446d31['commandId'],this['title']=_0x446d31['title'],this['description']=_0x446d31['description'],this['isParameterized']=_0x446d31['isParameterized'],this['useArgs']=_0x446d31['useArgs'],this['options']=_0x446d31['options'],this['args']=_0x446d31['args'];}}class AIReviewCheckList extends ht(){['_checks']=[];['setupChecks'](_0x785555){this['_checks']=_0x785555['map'](_0x423cb0=>new AIReviewCheck(_0x423cb0));}get['checks'](){return this['_checks'];}['getCheckById'](_0x4cf1f1){return this['checks']['find'](_0x493a36=>_0x493a36['id']===_0x4cf1f1);}['removeCheckById'](_0x20a256){this['_checks']=this['_checks']['filter'](_0x3a7fb5=>_0x3a7fb5['id']!==_0x20a256);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0xbd46d9,_0x2e3265,_0x4516e0){super(_0xbd46d9),this['_models']=_0x2e3265,this['_defaultModel']=_0x4516e0;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x40e2b0,_0xcb477b,_0x120d55){super(_0x40e2b0),this['prompt']=_0x40e2b0['prompt'],this['model']=_0x40e2b0['model'],this['model']?this['_defaultModel']=_0xcb477b['find'](_0x1a948d=>_0x1a948d['id']===this['model'])||null:this['_defaultModel']=_0x120d55;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x3b12ef,_0x283319,_0x4a65d2){super(),this['_allModels']=_0x3b12ef,this['_recommendedModels']=_0x283319,this['_defaultModel']=_0x4a65d2;}['setupChecks'](_0x10e6ac){this['_checks']=_0x10e6ac['map'](_0x3300e9=>!0x0===_0x3300e9['isExtra']?new AIReviewCheckExtra(_0x3300e9,this['_allModels'],this['_defaultModel']):'custom'===_0x3300e9['id']?new AIReviewCheckCustom(_0x3300e9,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x3300e9));}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0xf91911,_0x3246ef,_0x1ea23d,_0x2f8b90,_0x10ec05){super(_0x1ea23d,_0x2f8b90,_0x10ec05),this['_prompt']=_0xf91911,this['_model']=_0x3246ef;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x190032,_0x4408ad,_0x5352cf){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x4408ad,_0x190032,_0x5352cf);}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0x74dd98){this['_prompt']=_0x74dd98;}set['model'](_0x2724b4){this['_model']=_0x2724b4;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}['_isDiffOn']=!0x1;['_hasDefaultAvailableCommands']=!0x1;constructor(_0x294271){super(_0x294271),this['_hasDefaultAvailableCommands']=!this['context']['config']['get']('ai.review.availableCommands'),this['context']['config']['define']('ai.review.availableCommands',Yn['map'](_0x5af8e0=>_0x5af8e0['id'])),this['context']['config']['define']('ai.review.extraCommands',[]);}async['init'](){await super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x4450b9,_0xfa0ecb)=>{this['_isDiffOn']=_0xfa0ecb['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x17053a,_0x521631){return _0x17053a['isCustom']?new AIReviewCustomCheckRun(_0x17053a['args']['prompt'],_0x17053a['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x521631,this['_aiConnector']):_0x521631['isExtra']?new AIReviewExtraCheckRun(_0x521631['prompt'],_0x521631['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x521631,this['_aiConnector']):new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x521631,this['_aiConnector'],_0x17053a['params'],_0x17053a['args']);}['_onReviewCheckResultActivated'](_0x2e92b1){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x2e92b1['change']['id']),this['_scrollToChange'](_0x2e92b1['change']['id']);const _0x4c706c=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x2e92b1['change']['id']);if(!_0x4c706c)return;const _0x107541=this['_aiReviewCoreEditing']['getEditorForChange'](_0x2e92b1['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x2e92b1['change'],()=>_0x4c706c['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x107541,_0x4c706c['modelRange']['root']['rootName']),_0x107541?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x2e92b1['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x14eeec){this['_currentReviewCheckRun']&&'click'===_0x14eeec['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x14eeec['id']));}['_onDeactivateChange'](_0x3795fe){this['_currentReviewCheckRun']&&'balloon'===_0x3795fe['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x1cf85f,_0x16f4f7){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x16f4f7['changeId']);const _0x5b732b=this['_currentReviewCheckRun']['getChangeById'](_0x16f4f7['changeId']);if(!_0x5b732b)return;const _0x63d29=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x16f4f7['changeId']),_0x2fcbd3=this['_aiReviewCoreEditing']['getEditorForChange'](_0x16f4f7['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x5b732b,_0x16f4f7['markerElement'],_0x16f4f7['domEvent'],'click',this['_getBalloonDomRoot'](_0x2fcbd3,_0x63d29?.['modelRange']['root']['rootName']),_0x2fcbd3?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x546a42,_0x1cede2){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x3f9aec=this['_currentReviewCheckRun']['getChangeById'](_0x1cede2['changeId']);if(!_0x3f9aec)return;const _0x5ce6e8=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1cede2['changeId']),_0x301b09=this['_aiReviewCoreEditing']['getEditorForChange'](_0x1cede2['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x3f9aec,_0x1cede2['markerElement'],_0x1cede2['domEvent'],'hover',this['_getBalloonDomRoot'](_0x301b09,_0x5ce6e8?.['modelRange']['root']['rootName']),_0x301b09?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0x1ca405){const _0x52237f=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x1ca405);return _0x52237f?_0x52237f['getElement']():null;}['_markChangePositionInEditorContent'](_0x378bd0,_0x225865){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x378bd0,_0x225865);}['_diffContent'](_0xf337f5,_0x4c0241,_0xf4df14){return this['_aiReviewCoreEditing']['diffContent'](_0xf337f5,_0x4c0241,_0xf4df14,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x2ece81){_0x2ece81?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x3d4c1a of this['_aiReviewCoreEditing']['getEditors']())_0x3d4c1a['editing']['view']['change'](_0x1b4b3a=>{for(const _0x4212b0 of _0x3d4c1a['editing']['view']['document']['getRoots']()){for(const _0x34ca35 of _0x4212b0['getClassNames']())_0x34ca35['startsWith']('ck-ai_review-')&&_0x1b4b3a['removeClass'](_0x34ca35,_0x4212b0);_0x1b4b3a['addClass'](_0x2ece81?'ck-ai_review-diff':'ck-ai_review-highlights',_0x4212b0);}});}['_getBalloonDomRoot'](_0xf7f3a,_0x51d1ba){const _0x4d8ae4=_0xf7f3a['editing']['view'];if(_0x51d1ba){const _0x481ae9=_0x4d8ae4['getDomRoot'](_0x51d1ba);if(_0x481ae9)return _0x481ae9;}return _0x4d8ae4['getDomRoot']()??void 0x0;}async['_getChecksList'](){const _0x9bea96=[...Yn,...this['_getExtraChecks']()],_0x57b875=this['context']['config']['get']('ai.review.availableCommands')||[];this['_logErrorForNonExistentChecks'](_0x57b875,_0x9bea96);let _0x58da03=_0x9bea96;this['_hasDefaultAvailableCommands']||(_0x58da03=_0x57b875['map'](_0x12bf67=>_0x9bea96['find'](_0xab7a8e=>_0xab7a8e['id']===_0x12bf67))['filter'](_0x44116b=>!!_0x44116b)),_0x58da03=_0x58da03['map'](_0x363e29=>_0x363e29['isExtra']?_0x363e29:this['_translateReviewCheck'](_0x363e29));const _0x18bc2e=_0x58da03['some'](_0x4ee66e=>_0x4ee66e['isExtra']||'custom'===_0x4ee66e['id']);let _0x238998=[],_0x43028d=[],_0x3cb7d9=null;if(_0x18bc2e){const _0x33986f=await this['_getModels']();_0x238998=_0x33986f['all'],_0x43028d=_0x33986f['recommended'],_0x3cb7d9=_0x33986f['default'];}const _0x579bce=new AIReviewModeCheckList(_0x238998,_0x43028d,_0x3cb7d9);return _0x579bce['setupChecks'](_0x58da03),_0x18bc2e&&this['_filterChecksWithMissingModel'](_0x579bce),_0x579bce;}['_getExtraChecks'](){return(this['context']['config']['get']('ai.review.extraCommands')||[])['map'](_0x1d5173=>({'id':_0x1d5173['id'],'commandId':_0x1d5173['id'],'title':_0x1d5173['label'],'description':_0x1d5173['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x1d5173['prompt'],'model':_0x1d5173['model']}));}['_logErrorForNonExistentChecks'](_0x3ee5df,_0x3b9a19){const _0x42248e=_0x3ee5df['filter'](_0x11bc1b=>!_0x3b9a19['some'](_0x465271=>_0x465271['id']===_0x11bc1b));_0x42248e['length']&&this['_logError'](new at('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0x42248e['join'](',\x20')}),!0x0);}async['_getModels'](){try{const _0x5b9c4e=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});return{'all':await _0x5b9c4e['getAll'](),'recommended':await _0x5b9c4e['getAvailableModels'](),'default':await _0x5b9c4e['getDefault']()};}catch(_0xcdc25){return this['_logError'](new at('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0xcdc25)),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x13915e){const _0x236e0e='AI_REVIEW_CHECK_'+_0x13915e['id']['toUpperCase']()['replaceAll']('-','_'),_0xb2a458={..._0x13915e,'title':this['_getTranslationWithDefault'](_0x236e0e+'_TITLE',_0x13915e['title']),'description':this['_getTranslationWithDefault'](_0x236e0e+'_DESCRIPTION',_0x13915e['description'])};return _0x13915e['options']&&(_0xb2a458['options']=_0x13915e['options']['map'](_0x118b8e=>({..._0x118b8e,'label':this['_getTranslationWithDefault'](_0x236e0e+'_OPTIONS_LABEL',_0x118b8e['label']||''),'data':_0x118b8e['data']?_0x118b8e['data']['map'](_0x3ec516=>({..._0x3ec516,'label':this['_getTranslationWithDefault'](_0x236e0e+'_OPTIONS_DATA_'+_0x3ec516['id']['toUpperCase'](),_0x3ec516['label'])})):void 0x0}))),_0xb2a458;}['_filterChecksWithMissingModel'](_0x291d13){const _0x216869=[];_0x291d13['checks']['forEach'](_0xd5061b=>{(_0xd5061b instanceof AIReviewCheckExtra&&!_0xd5061b['defaultModel']||_0xd5061b instanceof AIReviewCheckCustom&&!_0xd5061b['models']['length'])&&_0x216869['push'](_0xd5061b['id']);}),_0x216869['length']&&_0x216869['forEach'](_0x23c8f7=>{_0x291d13['removeCheckById'](_0x23c8f7),this['_logError'](new at('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x23c8f7}),!0x0);});}}class AIReviewMode extends _0x23f270{static get['requires'](){return[AIReviewModeController,AIReviewModeUI,AIReviewCoreEditing];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x3cde84){this['_checks']=_0x3cde84['map'](_0x42fd63=>new AITranslateCheck(_0x42fd63));}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0x524e97,_0x5211df,_0x57b83b,_0x22c7e2,_0x5dc6f7,_0x108307){super(_0x524e97,_0x5211df,_0x57b83b,_0x5dc6f7,_0x108307),this['_title']=_0x22c7e2;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateController extends AIReviewCoreController{static get['pluginName'](){return'AITranslateController';}constructor(_0x1d103e){super(_0x1d103e),this['context']['config']['define']('ai.translate.languages',[{'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'}]);}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x358b9a,_0x320878){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x320878,this['_aiConnector'],Hi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x358b9a['params'],_0x358b9a['args']);}['_onReviewCheckResultActivated'](_0x44a472){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x44a472['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x44a472['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x15dbeb){this['_currentReviewCheckRun']&&('hover'===_0x15dbeb['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x15dbeb['id'])),'click'===_0x15dbeb['uiInteraction']&&this['_scrollToChange'](_0x15dbeb['id']));}['_onDeactivateChange'](_0x16892c){this['_currentReviewCheckRun']&&'panel'===_0x16892c['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x1351ac,_0x4d54a2){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x4d54a2['changeId']),this['_scrollToChange'](_0x4d54a2['changeId']));}['_onChangeMarkerHovered'](_0xb7c6f3,_0x495596){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x495596['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x495596['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x5d8468){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x5d8468);}['_markChangePositionInEditorContent'](_0x1c9ad4,_0x28f1e2){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x1c9ad4,_0x28f1e2);}['_diffContent'](_0x4fd0fe,_0x4d815b,_0x1a4b08){return this['_aiReviewCoreEditing']['diffContent'](_0x4fd0fe,_0x4d815b,_0x1a4b08,!0x0);}['_onReviewCheckRun'](){for(const _0x1ab74e of this['_aiReviewCoreEditing']['getEditors']())_0x1ab74e['editing']['view']['change'](_0x48a1e3=>{for(const _0x241bd6 of _0x1ab74e['editing']['view']['document']['getRoots']())_0x48a1e3['addClass']('ck-ai-translate-mode-content',_0x241bd6);});}async['_getChecksList'](){const _0x313174=[],_0xf14732=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x506828 of _0xf14732)_0x313174['push']({'title':_0x506828['label'],'id':_0x506828['id'],'commandId':_0x506828['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x506828['id']}});const _0x219c82=new AITranslateCheckList();return _0x219c82['setupChecks'](this['_translateChecks'](_0x313174)),_0x219c82;}['_translateChecks'](_0x3cbbf9){return _0x3cbbf9['map'](_0x2188cb=>{const _0x1f0f43='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x2188cb['title']['toUpperCase']()['replaceAll']('-','_');return{..._0x2188cb,'title':this['_getTranslationWithDefault'](_0x1f0f43,_0x2188cb['title'])};});}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x7062e1,_0x203893){super(_0x7062e1,_0x203893),this['on']('set:isLoading',(_0x445591,_0x339065,_0x1ee1f7)=>{_0x1ee1f7&&(this['headerTitle']=Hi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x3b2cf7,_0x2eb352,_0x55675b)=>{_0x55675b&&(this['headerTitle']=Hi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x42f17a=super['_createAcceptAllButtonView']();return _0x42f17a['set']('label',Hi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x42f17a;}['_createExitReviewButtonView'](){const _0x29fe96=super['_createExitReviewButtonView']();return _0x29fe96['set']('label',Hi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x29fe96;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0x2adc9d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x2adc9d['if']('isVisible','ck-hidden',_0x469a80=>!_0x469a80)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Hi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Hi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x2adc9d['if']('isVisible','ck-hidden',_0x53e016=>!_0x53e016)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x69ec37=this['context']['plugins']['get']('AITabs'),_0x3b5a23=this['context']['locale'],_0x559ba8=new AIHeaderView(_0x3b5a23,{'label':Hi(_0x3b5a23,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x4d8ff7,'class':'ck-ai-header_review-translate','showResizeButton':_0x69ec37['showResizeButton']});_0x559ba8['delegate']('resizeTabs')['to'](_0x69ec37),_0x559ba8['bind']('isMaximized')['to'](_0x69ec37['view'],'isMaximized',_0x5e3d2d=>_0x5e3d2d);const _0x2070f8=new AIReviewCoreView(_0x3b5a23,{'header':_0x559ba8,'list':new AITranslateCheckListView(_0x3b5a23),'results':new AITranslateCheckResultsView(_0x3b5a23,{'generalErrorText':Hi(_0x3b5a23,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x3b5a23,{'headerText':Hi(_0x3b5a23,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Hi(_0x3b5a23,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Hi(_0x3b5a23,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x2070f8['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x2070f8;}['registerTab'](){const _0xe659dd=this['context']['plugins']['get']('AITabs');_0xe659dd['view']['on']('activateTab',(_0x3760f7,{newTab:_0x293dc3,oldTab:_0x135738})=>{'translate'===_0x293dc3?this['fire']('getReviewCheckList'):'translate'===_0x135738&&this['fire']('leaveReview');}),_0xe659dd['view']['addTab']({'id':'translate','buttonLabel':Hi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x4d8ff7,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0x23f270{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,AIInteraction,AIQuickActions,AIQuickActionsUI,AIReply,AIRequestError,AIReviewCheck,AIReviewCheckResult,AIReviewCheckResultChange,AIReviewCheckRun,AIReviewMode,AIReviewCoreController as AIReviewModeController,AIReviewCoreEditing as AIReviewModeEditing,AIReviewModeUI,AITabs,AITabsMainView,AITabsView,AITextAdapter,AIToggleButtonUI,AITranslate,AITranslateController,AITranslateUI,AWSTextAdapter,OpenAITextAdapter,ShowAIAssistantCommand,ToggleAICommand,Gi as createResizeButton,Di as getDefaultAICommands};
23
+ import{Plugin as _0x3453ad,Command as _0x2d0571,ContextPlugin as _0x4338bf,Editor as _0x1ca247}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x3dadf9,IconCheck as _0x5d25a9,IconError as _0x298b06,IconSubmit as _0x8099f0,IconAIHistory as _0x22e6d9,IconMagicWand as _0xdeb544,IconRobotPencil as _0x4712a7,IconMaximize as _0x113583,IconMinimize as _0x120075,IconShowChangesOn as _0x25bd6e,IconShowChangesOff as _0x5387a4,IconDocument as _0x19e64b,IconBoxWithCross as _0x17306,IconBoxWithCheck as _0x330195,IconBoxWithMarker as _0x18ea5d,IconInfo as _0x26a454,IconWeb as _0x3dea76,IconCancel as _0x17f7a6,IconSelection as _0x1dcf67,IconFileUpload as _0x1b56c8,IconLink as _0x128991,IconImage as _0x52daf1,IconBulb as _0x252fc0,IconAI as _0x3d7a38,IconPreviousArrow as _0x342eda,IconDocumentOutline as _0x59bdff,IconLoupe as _0x33a0b4,IconPaperClip as _0x2e6a1b,IconBrowseFiles as _0x64c3c0,IconDropdownArrow as _0x121964,IconStop as _0x592ee4,IconPlus as _0x1d96d8,IconAIChat as _0x25d15b,IconPin as _0x5d31ba,IconThreeHorizontalDots as _0x1abd54,IconAIReview as _0x51b0f9,IconAITranslate as _0x154751,IconAIAskAI as _0x5a4803,IconThumbUp as _0x1579df,IconThumbDown as _0x2b60d4,IconChevronDown as _0x13be7f,IconChevronUp as _0x127f23,IconAIQuickActions as _0x3bef17,IconAIChatCommands as _0x2613d0,IconAIImproveWriting as _0x9d7277,IconAIContinueWriting as _0x5bdd29,IconAIGrammarCheck as _0x431f46,IconAIAdjustLength as _0x16079a,IconAIChangeTone as _0x4b0037,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 _0x110af7,createLabeledInputText as _0x598327,FormHeaderView as _0x571522,HighlightedTextView as _0x5e90d9,ViewCollection as _0x3d0d1a,FileDialogButtonView as _0x124852,InputTextView as _0x580520,SearchTextView as _0x31f0b4,ListItemButtonView as _0x443aff,ButtonLabelWithHighlightView as _0x21ad8d,DropdownMenuPanelPositioningFunctions as _0x194033,BalloonToolbar as _0x48beb7,FormRowView as _0x3f1406,TextareaView as _0x3e0b00}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x4b2300,ClipboardMarkersUtils as _0x1086e0}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x2abc63,ViewDataTransfer as _0x45ec09,ViewUpcastWriter as _0x5ea91d,Matcher as _0x570dea,_DetachOperation as _0x62ec40,_insertIntoModelNodeList as _0xc730dd,_removeFromModelNodeList as _0x129b18,ModelRange as _0x5c7233,transformOperationSets as _0x1dcb0f,ViewDowncastWriter as _0x16ba99,ModelDocumentFragment as _0x3d8d81,ModelPosition as _0x5399e8,ModelTreeWalker as _0xd22b47,MarkerOperation as _0x36fc26,InsertOperation as _0x519e41}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x3b754d,escape as _0x39c4f6,cloneDeep as _0x442b5e,throttle as _0x5cb28a,debounce as _0x35b1c0,escapeRegExp as _0x70d63}from'es-toolkit/compat';import{createParser as _0x186cf8}from'eventsource-parser';import{CloudServices as _0x128c11}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x3b39c1}from'htmlparser2';import{isTag as _0x5b8d32,findOne as _0x358753,getParent as _0x2e8947,findAll as _0x2a5945,removeElement as _0x2cc5d2,prepend as _0x4f5ae8,prependChild as _0x22b9c2,appendChild as _0x587f40,append as _0x23bff4,find as _0x2530a3,isComment as _0x58d07d,replaceElement as _0x40ab49,getChildren as _0x4ec021,textContent as ti}from'domutils';import _0x2f5a10 from'dom-serializer';import{cloneNode as _0x1e46dd,Document as _0x5346ad,Element as _0x303c52,Text as _0x20e1cd,isDocument as _0x49314d,isText as _0x2d6a0b,NodeWithChildren as _0x10fc81}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x2966c3,MarkdownGfmMdToHtml as _0x190544}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0x2dcd3c from'rehype-sanitize';import{fixElementSuggestionRange as _0x47170f,DocumentCompare as _0x4ea419,DATA_ID_MODEL_ATTRIBUTE as _0x18f6e1,ConfirmMixin as _0x365aa7,getAllMarkersDomElementsSorted as _0x443fc1,SuggestionsConversion as _0x287c7d,DATA_ID_VIEW_ATTRIBUTE as _0x4dd8ed,getMarkerDomElement as _0x11057a}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x7659e8 from'morphdom';import{diffArrays as _0x511901}from'diff';const Ti='_ungrouppedCommands';function fi(_0x4a51b0,_0x4697d9){const _0x1de066=(0x0,_0x4697d9['t'])('Other');return _0x4a51b0['length']?'groupId'in _0x4a51b0[0x0]?_0x4a51b0:[{'groupId':Ti,'groupLabel':_0x1de066,'order':0x1/0x0,'commands':_0x4a51b0}]:[{'groupId':Ti,'groupLabel':_0x1de066,'order':0x1/0x0,'commands':[]}];}const Ri=globalThis['DataTransfer'],bi='ai-ui';class AIAssistantEditing extends _0x3453ad{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x10d4f9}=this,_0x129257=['ck-fake-ai-selection'];_0x10d4f9['config']['get']('ai.assistant.useTheme')&&_0x129257['push']('ck-ai-assistant-ui_theme'),_0x10d4f9['conversion']['for']('editingDowncast')['markerToHighlight']({'model':bi,'view':{'classes':_0x129257,'priority':0xc}}),_0x10d4f9['conversion']['for']('editingDowncast')['markerToElement']({'model':bi,'view':(_0x422208,{writer:_0xb539e4})=>{if(!_0x422208['markerRange']['isCollapsed'])return null;const _0x246af1=_0xb539e4['createUIElement']('span');return _0xb539e4['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x246af1),_0x246af1;}});}['afterInit'](){!async function(_0x1e8c63){const _0x1150e7=_0x4dff45([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]),_0xbf9e50=0x3dffc4e1,_0x174aa3=0x3df84fb9^_0xbf9e50,_0x138afe=window[_0x4dff45([0x44,0x61,0x74,0x65])][_0x4dff45([0x6e,0x6f,0x77])](),_0x38e175=_0x1e8c63[_0x4dff45([0x65,0x64,0x69,0x74,0x6f,0x72])],_0xa2a0cc=new window[(_0x4dff45([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x204a8b=>{_0x38e175[_0x4dff45([0x6f,0x6e,0x63,0x65])](_0x4dff45([0x72,0x65,0x61,0x64,0x79]),_0x204a8b);}),_0x3f1091={[_0x4dff45([0x6b,0x74,0x79])]:_0x4dff45([0x45,0x43]),[_0x4dff45([0x75,0x73,0x65])]:_0x4dff45([0x73,0x69,0x67]),[_0x4dff45([0x63,0x72,0x76])]:_0x4dff45([0x50,0x2d,0x32,0x35,0x36]),[_0x4dff45([0x78])]:_0x4dff45([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]),[_0x4dff45([0x79])]:_0x4dff45([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]),[_0x4dff45([0x61,0x6c,0x67])]:_0x4dff45([0x45,0x53,0x32,0x35,0x36])},_0x490804=_0x38e175[_0x4dff45([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x4dff45([0x67,0x65,0x74])](_0x4dff45([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x30ed96(){let _0x54fa28,_0x44bac3=null,_0x4d597e=null;try{if(_0x490804==_0x4dff45([0x47,0x50,0x4c]))return _0x4dff45([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x54fa28=_0x2a8302(),!_0x54fa28)return _0x4dff45([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x54fa28[_0x4dff45([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x4d597e=_0x35a7ba(_0x54fa28[_0x4dff45([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x54fa28[_0x4dff45([0x6a,0x74,0x69])])),await _0x1e1ed6()?_0x50b18d()?_0x1f8076()?_0x4dff45([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x1a64fe()?(_0x54fa28[_0x4dff45([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x4dff45([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x44bac3=_0x5505f5(_0x4dff45([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x5c7c8c()):_0x4dff45([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x4dff45([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x4dff45([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x4dff45([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x1f8076(){const _0x2b25b4=[_0x4dff45([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x4dff45([0x74,0x72,0x69,0x61,0x6c])][_0x4dff45([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x54fa28[_0x4dff45([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x138afe/0x3e8:0xe10*_0x174aa3;return _0x54fa28[_0x4dff45([0x65,0x78,0x70])]<_0x2b25b4;}function _0x50b18d(){const _0x1a0e75=_0x54fa28[_0x4dff45([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x1a0e75&&(!!_0x1a0e75[_0x4dff45([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x4dff45([0x2a]))||!!_0x1a0e75[_0x4dff45([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x4dff45([0x41,0x49])));}function _0x1a64fe(){const _0x5bdf2b=_0x54fa28[_0x4dff45([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x5bdf2b||0x0==_0x5bdf2b[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x47fffe}=new URL(window[_0x4dff45([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x5bdf2b[_0x4dff45([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x47fffe))return!0x0;const _0x364204=_0x47fffe[_0x4dff45([0x73,0x70,0x6c,0x69,0x74])](_0x4dff45([0x2e]));return _0x5bdf2b[_0x4dff45([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x107e1c=>_0x107e1c[_0x4dff45([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x4dff45([0x2a])))[_0x4dff45([0x6d,0x61,0x70])](_0x119033=>_0x119033[_0x4dff45([0x73,0x70,0x6c,0x69,0x74])](_0x4dff45([0x2e])))[_0x4dff45([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x51941c=>_0x51941c[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x364204[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x4dff45([0x6d,0x61,0x70])](_0x3c37ac=>Array(_0x364204[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x3c37ac[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x4dff45([0x66,0x69,0x6c,0x6c])](_0x3c37ac[0x0]===_0x4dff45([0x2a])?_0x4dff45([0x2a]):'')[_0x4dff45([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x3c37ac))[_0x4dff45([0x73,0x6f,0x6d,0x65])](_0x44f36e=>_0x364204[_0x4dff45([0x65,0x76,0x65,0x72,0x79])]((_0x3725b9,_0x13d884)=>_0x44f36e[_0x13d884]===_0x3725b9||_0x44f36e[_0x13d884]===_0x4dff45([0x2a])));}function _0x5c7c8c(){return _0x44bac3&&_0x4d597e?new window[(_0x4dff45([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x10fcd2,_0x2b81bb)=>{_0x44bac3[_0x4dff45([0x74,0x68,0x65,0x6e])](_0x10fcd2,_0x2b81bb),_0x4d597e[_0x4dff45([0x74,0x68,0x65,0x6e])](_0xbb7ac2=>{_0xbb7ac2!=_0x4dff45([0x56,0x61,0x6c,0x69,0x64])&&_0x10fcd2(_0xbb7ac2);},_0x2b81bb);}):_0x44bac3||_0x4d597e||_0x4dff45([0x56,0x61,0x6c,0x69,0x64]);}}function _0x35a7ba(_0x215db2,_0x5482ba){return new window[(_0x4dff45([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x56739d=>{if(_0x21e563())return _0x56739d(_0x4dff45([0x56,0x61,0x6c,0x69,0x64]));_0x448eec(),_0x38e175[_0x4dff45([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x4dff45([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x9ebe50=!0x1;const _0x462658=at();function _0x23edd4(_0x338f5f){return!!_0x338f5f&&(typeof _0x338f5f===_0x4dff45([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0x338f5f===_0x4dff45([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0x338f5f[_0x4dff45([0x74,0x68,0x65,0x6e])]===_0x4dff45([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0x338f5f[_0x4dff45([0x63,0x61,0x74,0x63,0x68])]===_0x4dff45([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x506908(_0x5780be){_0x404a3f(_0x5780be)[_0x4dff45([0x74,0x68,0x65,0x6e])](_0x3bb015=>{if(!_0x3bb015||_0x3bb015[_0x4dff45([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x4dff45([0x6f,0x6b]))return _0x4dff45([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x3f42d0(_0x10e83a(_0x462658+_0x5482ba))!=_0x3bb015[_0x4dff45([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x4dff45([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x4dff45([0x56,0x61,0x6c,0x69,0x64]);})[_0x4dff45([0x74,0x68,0x65,0x6e])](_0x3725b7=>(_0x5a2b66(),_0x3725b7),()=>{const _0x361bc8=_0x4015e0();return null==_0x361bc8?(_0x5a2b66(),_0x4dff45([0x56,0x61,0x6c,0x69,0x64])):_0x4dff45(_0x138afe-_0x361bc8>(0x19f340e1^_0xbf9e50)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x4dff45([0x74,0x68,0x65,0x6e])](_0x56739d)[_0x4dff45([0x63,0x61,0x74,0x63,0x68])](()=>{_0x56739d(_0x4dff45([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x5ed8bc=0x3dc92a61^_0xbf9e50;function _0x5a2b66(){const _0xe6234a=_0x4dff45([0x6c,0x6c,0x63,0x74,0x2d])+_0x3f42d0(_0x10e83a(_0x215db2)),_0x4a569a=_0x4554ed(_0x3f42d0(window[_0x4dff45([0x4d,0x61,0x74,0x68])][_0x4dff45([0x63,0x65,0x69,0x6c])](_0x138afe/_0x5ed8bc)));window[_0x4dff45([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x4dff45([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0xe6234a,_0x4a569a);}function _0x4015e0(){const _0x431a2e=_0x4dff45([0x6c,0x6c,0x63,0x74,0x2d])+_0x3f42d0(_0x10e83a(_0x215db2)),_0x31c9e6=window[_0x4dff45([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x4dff45([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x431a2e);return _0x31c9e6?window[_0x4dff45([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x4554ed(_0x31c9e6),0x10)*_0x5ed8bc:null;}function _0x404a3f(_0x13c557){return new window[(_0x4dff45([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x40105b,_0x258576)=>{_0x13c557[_0x4dff45([0x74,0x68,0x65,0x6e])](_0x40105b,_0x258576),window[_0x4dff45([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x258576,0x3dfe1021^_0xbf9e50);});}}_0x38e175[_0x4dff45([0x6f,0x6e])](_0x4dff45([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x391ccb,_0x33ba61)=>{if(_0x33ba61[0x0]!=_0x215db2)return _0x56739d(_0x4dff45([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x33ba61[0x1]={..._0x33ba61[0x1],[_0x4dff45([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x462658};},{[_0x4dff45([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x4dff45([0x68,0x69,0x67,0x68])}),_0x38e175[_0x4dff45([0x6f,0x6e])](_0x4dff45([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x150802=>{_0x23edd4(_0x150802[_0x4dff45([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x9ebe50=!0x0,_0x506908(_0x150802[_0x4dff45([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x4dff45([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x4dff45([0x6c,0x6f,0x77])}),_0xa2a0cc[_0x4dff45([0x74,0x68,0x65,0x6e])](()=>{_0x9ebe50||_0x56739d(_0x4dff45([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x21e563(){return _0x38e175[_0x4dff45([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x4dff45([0x76,0x69,0x65,0x77])][_0x4dff45([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x4dff45([0x61,0x75,0x74,0x6f]);}function _0x448eec(){_0x38e175[_0x4dff45([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x4dff45([0x76,0x69,0x65,0x77])][_0x4dff45([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x4dff45([0x61,0x75,0x74,0x6f]);}}function _0x5505f5(_0x3f53a4){const _0x46731f=[new window[(_0x4dff45([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x385987=>setTimeout(_0x385987,0x3df6fa2d^_0xbf9e50)),_0xa2a0cc[_0x4dff45([0x74,0x68,0x65,0x6e])](()=>new window[(_0x4dff45([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x20e737=>{let _0x543766=0x0;_0x38e175[_0x4dff45([0x6d,0x6f,0x64,0x65,0x6c])][_0x4dff45([0x6f,0x6e])](_0x4dff45([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x48da6d,_0x4e7e14)=>{_0x4e7e14[0x0][_0x4dff45([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x543766++,_0x543766==(0x3dffc109^_0xbf9e50)&&(_0x20e737(),_0x48da6d[_0x4dff45([0x6f,0x66,0x66])]());});}))];return window[_0x4dff45([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x4dff45([0x72,0x61,0x63,0x65])](_0x46731f)[_0x4dff45([0x74,0x68,0x65,0x6e])](()=>_0x3f53a4);}async function _0x1ec418(){await _0xa2a0cc,_0x38e175[_0x4dff45([0x6d,0x6f,0x64,0x65,0x6c])][_0x4dff45([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x63c640,_0x38e175[_0x4dff45([0x6d,0x6f,0x64,0x65,0x6c])][_0x4dff45([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x63c640,_0x38e175[_0x4dff45([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x4dff45([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x30159e(_0x5521f4){const _0xa8075c=_0x529826();_0x38e175[_0xa8075c]=_0x4dff45([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x5521f4,_0x5521f4!=_0x4dff45([0x56,0x61,0x6c,0x69,0x64])&&_0x1ec418();}function _0x529826(){const _0x3bea91=window[_0x4dff45([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x4dff45([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x4dff45([0x6e,0x6f,0x77])]())[_0x4dff45([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x4dff45([0x2e]),'');let _0x38c674=_0x4dff45([0x6e]);for(let _0x4c634f=0x0;_0x4c634f<_0x3bea91[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x4c634f+=0x2){let _0x8c37e4=window[_0x4dff45([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x3bea91[_0x4dff45([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x4c634f,_0x4c634f+0x2));_0x8c37e4>=_0x1150e7[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0x8c37e4-=_0x1150e7[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x38c674+=_0x1150e7[_0x8c37e4];}return _0x38c674;}function _0x2a8302(){const _0x2f18ba=_0x490804[_0x4dff45([0x73,0x70,0x6c,0x69,0x74])](_0x4dff45([0x2e]));if(0x3!=_0x2f18ba[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x1d0e53(_0x2f18ba[0x1]);function _0x1d0e53(_0x2da668){const _0x2d1e6b=_0x32541c(_0x2da668);return _0x2d1e6b&&_0x16bc67()?_0x2d1e6b:null;function _0x16bc67(){const _0x23605f=_0x2d1e6b[_0x4dff45([0x6a,0x74,0x69])],_0x44bb5a=window[_0x4dff45([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x23605f[_0x4dff45([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x23605f[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x5ba2ad={..._0x2d1e6b,[_0x4dff45([0x6a,0x74,0x69])]:_0x23605f[_0x4dff45([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x23605f[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x5ba2ad[_0x4dff45([0x76,0x63])],_0x10e83a(_0x5ba2ad)==_0x44bb5a;}}}async function _0x1e1ed6(){let _0x2f1d5a=!0x0;try{const _0x126c3b=_0x490804[_0x4dff45([0x73,0x70,0x6c,0x69,0x74])](_0x4dff45([0x2e])),[_0x5773e0,_0x137a64,_0x5a3da1]=_0x126c3b;return _0x4b715c(_0x5773e0),await _0x86b7c6(_0x5773e0,_0x137a64,_0x5a3da1),_0x2f1d5a;}catch{return!0x1;}function _0x4b715c(_0xfe7b40){const _0x470023=_0x32541c(_0xfe7b40);_0x470023&&_0x470023[_0x4dff45([0x61,0x6c,0x67])]==_0x4dff45([0x45,0x53,0x32,0x35,0x36])||(_0x2f1d5a=!0x1);}async function _0x86b7c6(_0x58b443,_0x3fbcad,_0x5d5e2b){const _0x407992=window[_0x4dff45([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x4dff45([0x66,0x72,0x6f,0x6d])](_0x2d84ed(_0x5d5e2b),_0x16ad41=>_0x16ad41[_0x4dff45([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x59d498=new window[(_0x4dff45([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x4dff45([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x58b443+_0x4dff45([0x2e])+_0x3fbcad),_0x2cd6d4=window[_0x4dff45([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x4dff45([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x2cd6d4)return;const _0x17b32a=await _0x2cd6d4[_0x4dff45([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x4dff45([0x6a,0x77,0x6b]),_0x3f1091,{[_0x4dff45([0x6e,0x61,0x6d,0x65])]:_0x4dff45([0x45,0x43,0x44,0x53,0x41]),[_0x4dff45([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x4dff45([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x4dff45([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x2cd6d4[_0x4dff45([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x4dff45([0x6e,0x61,0x6d,0x65])]:_0x4dff45([0x45,0x43,0x44,0x53,0x41]),[_0x4dff45([0x68,0x61,0x73,0x68])]:{[_0x4dff45([0x6e,0x61,0x6d,0x65])]:_0x4dff45([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x17b32a,_0x407992,_0x59d498)||(_0x2f1d5a=!0x1);}}function _0x32541c(_0x3d7b6d){return _0x3d7b6d[_0x4dff45([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x4dff45([0x65,0x79]))?JSON[_0x4dff45([0x70,0x61,0x72,0x73,0x65])](_0x2d84ed(_0x3d7b6d)):null;}function _0x2d84ed(_0x4a4d6f){return window[_0x4dff45([0x61,0x74,0x6f,0x62])](_0x4a4d6f[_0x4dff45([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x4dff45([0x2b]))[_0x4dff45([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x4dff45([0x2f])));}function _0x10e83a(_0x4d0d32){let _0x5b4903=0x1505;function _0xe1b06a(_0x1a318f){for(let _0x40d8be=0x0;_0x40d8be<_0x1a318f[_0x4dff45([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x40d8be++){const _0x3fdb7f=_0x1a318f[_0x4dff45([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x40d8be);_0x5b4903=(_0x5b4903<<0x5)+_0x5b4903+_0x3fdb7f,_0x5b4903&=_0x5b4903;}}function _0x473271(_0x73b43a){Array[_0x4dff45([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x73b43a)?_0x73b43a[_0x4dff45([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x473271):_0x73b43a&&typeof _0x73b43a==_0x4dff45([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x4dff45([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x73b43a)[_0x4dff45([0x73,0x6f,0x72,0x74])]()[_0x4dff45([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x5a7fc2,_0x4ecc7d])=>{_0xe1b06a(_0x5a7fc2),_0x473271(_0x4ecc7d);}):_0xe1b06a(window[_0x4dff45([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x73b43a));}return _0x473271(_0x4d0d32),_0x5b4903>>>0x0;}function _0x3f42d0(_0x592e92){return _0x592e92[_0x4dff45([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x4dff45([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x4dff45([0x30]));}function _0x4554ed(_0x48b469){return _0x48b469[_0x4dff45([0x73,0x70,0x6c,0x69,0x74])]('')[_0x4dff45([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x4dff45([0x6a,0x6f,0x69,0x6e])]('');}function _0x63c640(){}function _0x4dff45(_0x556103){return _0x556103['map'](_0x188526=>String['fromCharCode'](_0x188526))['join']('');}_0x30159e(await _0x30ed96());}(this);}['showFakeVisualSelection'](){const _0x4bd3b9=this['editor']['model'];_0x4bd3b9['change'](_0x57c473=>{const _0x5017a6=_0x4bd3b9['document']['selection']['getRanges']();let _0x213a13=0x0;for(const _0x5abbf9 of _0x5017a6){const _0xf40fb2=bi+':'+_0x213a13;if(_0x4bd3b9['markers']['has'](_0xf40fb2))_0x57c473['updateMarker'](_0xf40fb2,{'range':_0x5abbf9});else{if(_0x5abbf9['start']['isAtEnd']){const _0x14358d=_0x5abbf9['start']['getLastMatchingPosition'](({item:_0xafb2b5})=>!_0x4bd3b9['schema']['isContent'](_0xafb2b5),{'boundaries':_0x5abbf9});_0x57c473['addMarker'](_0xf40fb2,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x57c473['createRange'](_0x14358d,_0x5abbf9['end'])});}else _0x57c473['addMarker'](_0xf40fb2,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5abbf9});}_0x213a13++;}});}['hideFakeVisualSelection'](){const _0x404969=this['editor']['model'],_0x350c4a=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](bi));_0x350c4a['length']&&_0x404969['change'](_0x2cca92=>{_0x350c4a['forEach'](_0x4bd9a8=>{_0x2cca92['removeMarker'](_0x4bd9a8);});});}['insertContent'](_0x33cb95,_0x275384){const _0x67bee4=this['_getAISelection'](),_0x5ce60e=_0x275384||_0x67bee4['getFirstRange']();this['editor']['model']['canEditAt'](_0x5ce60e)&&this['editor']['model']['change'](_0x572d32=>{this['hideFakeVisualSelection'](),_0x275384||this['_resetContentOfSelectedTableCells'](_0x572d32,_0x67bee4),this['_pasteHTMLUsingClipboard']({'insertAt':_0x5ce60e,'writer':_0x572d32,'html':_0x33cb95});});}['insertContentBelow'](_0x118b31){const {model:_0x3b40f9}=this['editor'],_0x142427=this['_getAISelection']();_0x3b40f9['change'](()=>{const _0x2f39d8=this['_prepareTableInsertBelowPosition'](_0x118b31,_0x142427)||this['_getDefaultInsertBelowPosition'](_0x142427);this['insertContent'](_0x118b31,_0x2f39d8);});}['_getAISelection'](){const _0x47f126=this['editor']['model'],_0x42e86a=Array['from'](_0x47f126['markers']['getMarkersGroup'](bi))['map'](_0x1ae472=>_0x1ae472['getRange']());return _0x47f126['createSelection'](_0x42e86a);}['_pasteHTMLUsingClipboard']({writer:_0x23949d,html:_0xc18c7a,insertAt:_0x4d2c71}){const {view:_0x14e6d3}=this['editor']['editing'],_0x2a8be0=this['editor']['plugins']['get'](_0x4b2300),_0x18ce48=new Ri();_0x18ce48['setData']('text/html',_0xc18c7a);const _0x173871=new ClipboardEvent('paste',{'clipboardData':_0x18ce48}),_0x5bc257=new _0x2abc63(_0x14e6d3,_0x173871,{'dataTransfer':new _0x45ec09(_0x18ce48)});_0x23949d['setSelection'](_0x4d2c71);const _0x2643c9=(_0x2600bb,_0x5af4dd)=>{_0x5af4dd['resultRange']&&_0x23949d['setSelection'](_0x5af4dd['resultRange']);};_0x2a8be0['once']('contentInsertion',_0x2643c9,{'priority':'lowest'}),_0x14e6d3['document']['fire']('paste',_0x5bc257),_0x2a8be0['off']('contentInsertion',_0x2643c9);}['_getDefaultInsertBelowPosition'](_0x72934c){const {model:_0x18fc87}=this['editor'],_0x239d9f=Array['from'](_0x72934c['getSelectedBlocks']());return _0x239d9f['length']?_0x18fc87['createPositionAfter'](_0x239d9f['pop']()):_0x72934c['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x52d5a4,_0x182763){const {model:_0x31a340,plugins:_0x38047e}=this['editor'];if(_0x38047e['has']('TableUtils')){const _0x27d3af=_0x38047e['get']('TableUtils')['getSelectedTableCells'](_0x182763);if(_0x27d3af['length']){const _0x2cb4e3=this['_getTableRowCountFromContent'](_0x52d5a4),_0x2ae8b7=this['_createEmptyTableRows'](_0x27d3af,_0x2cb4e3);return _0x31a340['createPositionAt'](_0x2ae8b7,0x0);}}return null;}['_getTableRowCountFromContent'](_0x5e2a8d){const _0x2c95b8=this['editor']['plugins']['get']('TableUtils'),_0x429ee9=this['editor']['data']['parse'](_0x5e2a8d,'$documentFragment'),_0x2bc170=Array['from'](_0x429ee9['getChildren']())['filter'](_0x1ed956=>_0x1ed956['is']('element','table'));let _0xd8abad=0x0;return _0x2bc170['forEach'](_0x36eafc=>{_0xd8abad+=_0x2c95b8['getRows'](_0x36eafc);}),_0xd8abad;}['_createEmptyTableRows'](_0x79f82d,_0x376243){const _0x1c610e=this['editor']['plugins']['get']('TableUtils'),_0x500ec4=_0x1c610e['getRowIndexes'](_0x79f82d),_0x5b3d46=_0x1c610e['getColumnIndexes'](_0x79f82d),_0x107e9d=_0x500ec4['last']+0x1,_0x18e1ed=_0x5b3d46['first'],_0x3da809=_0x79f82d[0x0]['findAncestor']('table');for(let _0x386f47=0x0;_0x386f47<_0x376243;_0x386f47++)_0x1c610e['insertRows'](_0x3da809,{'at':_0x107e9d});return _0x3da809['getChild'](_0x107e9d)['getChild'](_0x18e1ed);}['_resetContentOfSelectedTableCells'](_0x1ba198,_0x50bb60){const {plugins:_0x583977}=this['editor'],{model:_0x3e8eb5}=_0x1ba198;if(!_0x583977['has']('TableUtils'))return;_0x583977['get']('TableUtils')['getSelectedTableCells'](_0x50bb60)['length']&&_0x3e8eb5['deleteContent'](_0x50bb60);}}class AIAdapter extends _0x3453ad{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(_0x3ee75a){super(_0x3ee75a),this['name']='AIRequestError';}}function Si(_0x3ec6e6,_0xf56bd2,_0x151658){const t=_0x3ec6e6['t'];switch(_0xf56bd2){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',_0x151658);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x151658);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'},_0x151658);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 _0xf56bd2;}}class ShowAIAssistantCommand extends _0x2d0571{['_commandDefinitions'];constructor(_0x301e43,_0x328b85){super(_0x301e43),this['_commandDefinitions']=_0x328b85,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0xfc47bb,_0x339e63,_0x477000)=>{this['isEnabled']&&(this['enabledCommandsIds']=Oi(this['_commandDefinitions'],_0x477000));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x400e8a,_0xbbfb8a,_0xe42c98)=>{this['enabledCommandsIds']=_0xe42c98?Oi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x2bf757=this['editor']['model'];this['_hasContext']=function(_0x522a47){const _0x4a0e6b=_0x522a47['document']['selection'];return _0x4a0e6b['isCollapsed']?0x0!==[..._0x4a0e6b['getSelectedBlocks']()]['length']&&![..._0x4a0e6b['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x522a47['hasContent'](_0x4a0e6b['getFirstRange']());}(_0x2bf757);const _0x34c055=_0x2bf757['document']['selection'],_0x4a926c=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x2ca8d8 of _0x34c055['getRanges']())for(const _0x237e88 of _0x2ca8d8['getItems']())if(_0x237e88['is']('element')&&_0x4a926c['includes'](_0x237e88['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x5e401a='',_0x586792='',_0x21ae6d='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0x5e401a,_0x586792,_0x21ae6d);}}function Oi(_0x1cbfbb,_0x39c93a){const _0x51a8d6=new Set();for(const _0x594972 of _0x1cbfbb['values']())(_0x39c93a||!0x1===_0x594972['requiresContent'])&&_0x51a8d6['add'](_0x594972['id']);return Array['from'](_0x51a8d6);}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(_0x1e0fde,_0x549eb7,_0x2bc69c){super(),this['editor']=_0x1e0fde,this['textAdapter']=_0x549eb7,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x2bc69c,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x4b85f2,_0x59fe92,_0x83dcf7)=>{this['view']['value']=this['_sanitizeHTML'](_0x83dcf7);}),this['listenTo'](this['view'],'submitPrompt',(_0x221169,_0x45cd27)=>{const _0x21bb3f=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x45cd27,_0x21bb3f,'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:_0x41cb26,query:_0x2bc957,htmlContent:_0x558283,label:_0x13fe26,mainActionLabel:_0x1b8949}){this['view']['prompt']=_0x13fe26,this['view']['mainAction']=_0x1b8949,this['initialContext']=_0x558283,_0x2bc957&&(this['view']['isRendered']?this['_handleQuery'](_0x2bc957,_0x558283,_0x41cb26,_0x13fe26):this['view']['once']('render',()=>{this['_handleQuery'](_0x2bc957,_0x558283,_0x41cb26,_0x13fe26);}));}['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'](_0xf31f6c,_0x28c7be,_0x40ecad,_0x3bd22c){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x28c7be,this['previousQuery']=_0xf31f6c,this['previousLabel']=_0x3bd22c||_0xf31f6c,this['previousActionId']=_0x40ecad,new Promise(_0x667d64=>{this['textAdapter']['makeRequest']({'query':_0xf31f6c,'context':_0x28c7be,'onData':_0x74d60=>{this['currentResponse']=_0x74d60,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x40ecad})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x3b2cfb=>{_0x3b2cfb instanceof AIRequestError?this['view']['handleError'](_0x3b2cfb['message']):this['view']['handleError'](),_0x667d64();})['finally'](()=>{this['stopProcessing'](),_0x667d64();});});}['_parseAndNormalizeContent'](_0x1c2f88,_0x41e120=!0x1){const _0x632782=vi['exec'](_0x1c2f88);_0x1c2f88=_0x632782?_0x1c2f88['substring'](_0x632782[0x1]['length']):_0x1c2f88['length']<0x64&&!_0x41e120?'':this['_stripMarkdownSyntax'](_0x1c2f88);const _0x300978=this['_domParser']['parseFromString'](_0x1c2f88,'text/html');if(_0x632782){const _0x11266d=Array['from'](_0x300978['body']['childNodes']);_0x11266d['reverse']();for(const _0x5ccac9 of _0x11266d){if(_0x5ccac9['nodeType']==Node['ELEMENT_NODE'])break;_0x5ccac9['remove']();}}const _0x18bef9=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x300978['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x18bef9);const _0x4853d5=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x139503=this['editor']['data']['toModel'](_0x18bef9);return _0x4853d5||_0x139503['markers']['clear'](),this['editor']['data']['stringify'](_0x139503);}['_normalizeResponseHeadings'](_0x3ef110){const _0x26f22c=new _0x5ea91d(this['editor']['editing']['view']['document']),_0x412e59=new _0x570dea({'name':/^h[1-5]$/}),_0x20d9cb=[];let _0x112d17=!0x1;for(const _0x1577ad of _0x3ef110)_0x1577ad['is']('element')&&_0x412e59['match'](_0x1577ad)&&(_0x20d9cb['push'](_0x1577ad),'h1'==_0x1577ad['name']&&(_0x112d17=!0x0));if(_0x112d17){for(const _0x593533 of _0x20d9cb)_0x26f22c['rename']('h'+(parseInt(_0x593533['name'][0x1])+0x1),_0x593533);}}['_isH1TagSupportEnabled'](){const {data:_0x2a4d78,editing:_0x5ccf1e}=this['editor'],_0x38fbbb=_0x2a4d78['htmlProcessor']['toView']('<h1></h1>'),_0x1af013=_0x2a4d78['toView'](_0x2a4d78['toModel'](_0x38fbbb));return!!_0x5ccf1e['view']['domConverter']['viewToDom'](_0x1af013)['querySelector']('h1');}['_sanitizeHTML'](_0x5b1f4d){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x5b1f4d),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x6fde40){const _0x3cc480=_0x6fde40['trim']();return _0x3cc480['startsWith']('```html')?_0x3cc480['endsWith']('```')?_0x3cc480['substring'](0x7,_0x3cc480['length']-0x3):_0x3cc480['substring'](0x7):_0x6fde40;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x36db64){super(_0x36db64),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x12059e=>Si(_0x36db64,'AI_'+_0x12059e['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Si(_0x36db64,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Si(_0x36db64,'Try\x20again')),this['stopButton']=this['_createButton'](Si(_0x36db64,'Stop'));const _0x254f7f=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x254f7f['if']('isVisible','ck-hidden',_0x28e6c2=>!_0x28e6c2)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x3abac0,_0x5a928b){const _0xa3a99f=new yt(this['locale']);return _0xa3a99f['set']({'label':_0x3abac0,'class':_0x5a928b||'','isVisible':!0x0,'withText':!0x0}),_0xa3a99f;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x23cbaf,_0x5a34f9=''){super(_0x23cbaf),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x7ec6cd=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x23cbaf,_0x5a34f9),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x7ec6cd['if']('isVisible','ck-hidden',_0x539e66=>!_0x539e66)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x7ec6cd['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 _0x47b7dd=!0x1;this['on']('change:value',(_0x346753,_0x4b6372,_0x37d6a8)=>{const _0x59f2b8=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x37d6a8),this['isProcessing']&&_0x59f2b8&&!_0x47b7dd&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x4f0895,_0x170b67,_0x75cbec)=>{_0x47b7dd=!0x1,_0x75cbec?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x47b7dd=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x47b7dd=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x27eb28=this['locale'],_0x45b782=new yt(this['locale']),_0x12d98b='ck-ai-form__copy-button';return _0x45b782['set']({'label':Si(_0x27eb28,'Copy'),'icon':_0x3dadf9,'class':_0x12d98b,'tooltip':!0x0}),_0x45b782['bind']('isVisible')['to'](this,'value',_0x16c47e=>!!_0x16c47e),_0x45b782['bind']('isEnabled')['to'](this,'isProcessing',_0x35bab0=>!_0x35bab0),_0x45b782['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x45b782['icon']=_0x5d25a9,_0x45b782['class']=_0x12d98b+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x45b782['icon']=_0x3dadf9,_0x45b782['class']=_0x12d98b;},0x3e8);}),_0x45b782;}['_copyHTMLToClipboard'](_0x1b8e9){const {window:_0x45f703,document:_0x253c63}=lt;if(_0x45f703['ClipboardItem']){const {Blob:_0x53a4bc,ClipboardItem:_0x928048}=_0x45f703,_0xa3bccf=[new _0x928048({'text/html':new _0x53a4bc([_0x1b8e9['innerHTML']],{'type':'text/html'}),'text/plain':new _0x53a4bc([_0x1b8e9['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0xa3bccf);}else{const _0x5a4185=_0x253c63['createElement']('div');_0x5a4185['style']['position']='absolute',_0x5a4185['style']['left']='-9999px',_0x5a4185['innerHTML']='<span>[</span>'+_0x1b8e9['innerHTML']+'<span>]</span>',_0x253c63['body']['appendChild'](_0x5a4185);const _0x148e18=_0x253c63['createRange']();_0x148e18['setStartAfter'](_0x5a4185['firstElementChild']),_0x148e18['setEndBefore'](_0x5a4185['lastElementChild']);const _0xbf15af=_0x45f703['getSelection']();_0xbf15af['removeAllRanges'](),_0xbf15af['addRange'](_0x148e18),_0x253c63['execCommand']('copy'),_0x5a4185['remove']();}}}class ContentFieldView extends Nt{constructor(_0x1f82ac,_0x35a948=''){super(_0x1f82ac),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x35a948,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x4c5796){this['element']['innerHTML']=_0x4c5796;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x323a79=new Nt(),_0x33b367=this['locale'],_0x54662e=new xt();return _0x54662e['isVisible']=!0x0,_0x323a79['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x54662e,{'text':Si(_0x33b367,'AI\x20is\x20writing...')}]}),_0x323a79['render'](),_0x323a79;}}class AIFormErrorView extends Nt{constructor(_0x106cb4,_0x178ffc=''){super(_0x106cb4);const _0x10113e=new Lt(),_0xc2da1e=this['bindTemplate'];this['set']('text',_0x178ffc),_0x10113e['content']=_0x298b06,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x10113e,{'text':_0xc2da1e['to']('text')}]});}}class AIFormPromptView extends Pt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x5cabd2,_0x2ad965){super(_0x5cabd2,_0x2ad965),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',(_0x2a3aff,_0x3324ff)=>{_0x2a3aff['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x3324ff());});}['_createSubmitButton'](){const _0x1bd241=new yt(this['locale']),_0x1f1bd8=this['locale'];return _0x1bd241['set']({'icon':_0x8099f0,'label':Si(_0x1f1bd8,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x1bd241['on']('execute',()=>{this['submit']();}),_0x1bd241['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x482754,_0x53d535)=>!_0x482754&&_0x53d535),_0x1bd241;}['_createShowHistoryButton'](){const _0x27b2c4=new yt(this['locale']),_0x59b619=this['resultsView'],_0x370398=this['locale'];_0x27b2c4['set']({'label':Si(_0x370398,'History'),'withText':!0x1,'icon':_0x22e6d9,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x27b2c4['bind']('isOn')['to'](_0x59b619,'isVisible'),_0x27b2c4['bind']('isEnabled')['to'](this,'isEnabled'),_0x27b2c4['on']('execute',()=>{_0x59b619['isVisible']=!_0x59b619['isVisible'],_0x59b619['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x4ea7e6=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x284605=new dt(this['queryView']['fieldView']['element']),_0x1c5370=_0x284605['width'],_0x13896b='rtl'===_0x370398['uiLanguageDirection']?'left':'right';_0x284605['excludeScrollbarsAndBorders'](),_0x27b2c4['element']['style'][_0x13896b]=_0x1c5370-_0x284605['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x4ea7e6),this['on']('render',_0x4ea7e6),_0x27b2c4;}['submit'](){const _0x1de976=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x1de976);}['focus'](_0x23902f){-0x1===_0x23902f?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x12df6d){super(_0x12df6d),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Si(_0x12df6d,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x52acbe=0x0;for(const _0x21b3cd of this['items'])_0x52acbe+=_0x21b3cd['items']['length'];return{'resultsCount':_0x52acbe,'totalItemsCount':_0x52acbe};}['_createClearHistoryButton'](){const _0x2516f9=this['locale'],_0xb144c5=new yt(this['locale']);return _0xb144c5['set']({'label':'('+Si(_0x2516f9,'Clear')+')','withText':!0x0}),_0xb144c5['on']('execute',()=>this['fire']('clearHistory')),_0xb144c5;}}class AIHistoryListItemView extends Ht{constructor(_0xe6bf6c){super();const _0x14c73b=new Mt(),_0x3dd413=new yt(this['locale'],_0x14c73b);this['children']['add'](_0x3dd413),_0x3dd413['set']({'label':_0xe6bf6c['prompt'],'withText':!0x0}),_0x3dd413['on']('execute',()=>{this['fire']('execute',{'value':_0x3b754d(_0xe6bf6c['prompt'])});});}}const yi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends _t{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x59b91f,_0x3493f7)=>{const _0x2e884a=Ni(_0x3493f7['prompt']);for(const _0xea7ba4 of this)if(_0xea7ba4!=_0x3493f7&&Ni(_0xea7ba4['prompt'])===_0x2e884a){this['remove'](_0xea7ba4);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x3ee057=sessionStorage['getItem'](yi)||'[]';this['addMany'](JSON['parse'](_0x3ee057));}['_saveToSessionStorage'](){sessionStorage['setItem'](yi,JSON['stringify'](this['map'](_0x2e7c5a=>_0x2e7c5a)));}}function Ni(_0x2c5785){return _0x2c5785['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x424718,_0x16e708,_0x1c6d7f=''){super(_0x424718),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(_0x424718),this['contentArea']=new AIFormContentArea(_0x424718,_0x1c6d7f),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 _0x52062f=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x16e708],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x52062f['if']('isError','ck-hidden',_0x1e45d6=>!_0x1e45d6)]},'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'](_0x1aaece=0x1){-0x1===_0x1aaece?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 _0x550392=this['locale'],_0x16a92a=new AIFormPromptView(_0x550392,{'queryView':{'label':Si(_0x550392,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Si(_0x550392,'Empty\x20history'),'secondary':Si(_0x550392,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x16a92a['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x498751,_0x473e15)=>_0x498751&&!_0x473e15),this['listenTo'](_0x16a92a,'submit',(_0x3709dd,_0x394222)=>{this['prompt']=_0x394222;const _0x5ef773=_0x39c4f6(_0x394222);this['fire']('submitPrompt',_0x5ef773),_0x394222['trim']()&&this['_promptHistory']['add']({'prompt':_0x5ef773},0x0);},{'priority':'high'}),_0x16a92a;}['_createHistoryView'](){const _0x279304=new AIHistoryListView(this['locale']);return _0x279304['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x279304['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x279304;}['_createToolbar'](){const _0x93edad=new AIFormToolbarView(this['locale']);return _0x93edad['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x45a1f2,_0x22ba8b,_0x549597)=>_0x45a1f2&&!_0x22ba8b&&!!_0x549597),_0x93edad['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x93edad['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0xfc00a4,_0x30e953,_0x4acf9b)=>_0xfc00a4&&!_0x30e953&&!!_0x4acf9b),_0x93edad['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x93edad['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x1b0f3d,_0x23803f)=>_0x1b0f3d&&!_0x23803f),_0x93edad['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x93edad['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x93edad['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x93edad;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x1c885b=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Si(_0x1c885b,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x2ff822){const _0x35853a=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x2ff822||Si(_0x35853a,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const xi=globalThis['DataTransfer'];class AIAssistantUI extends _0x3453ad{['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[_0x1086e0,AIAssistantEditing,AIAdapter,Gt];}constructor(_0x142bef){super(_0x142bef),_0x142bef['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x142bef['config']['define']('ai.assistant.contentAreaCssClass',''),_0x142bef['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x142bef['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x35c0b8}=this;this['_aiAdapter']=_0x35c0b8['plugins']['get'](AIAdapter),this['_dialog']=_0x35c0b8['plugins']['get'](Gt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0xf2a25a=new ShowAIAssistantCommand(_0x35c0b8,Array['from'](this['_commandDefinitions']['values']()));_0x35c0b8['commands']['add']('showAIAssistant',_0xf2a25a),_0x35c0b8['ui']['componentFactory']['add']('aiCommands',_0x59de19=>{const _0x44879e=Ft(_0x59de19);return _0x44879e['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x44879e['buttonView']['set']({'label':Si(_0x59de19,'AI\x20Commands'),'icon':_0xdeb544,'tooltip':!0x0}),_0x44879e['on']('execute',_0x5ebcba=>this['_onExecute'](_0x5ebcba['source']['id'])),Wt(_0x44879e,_0x35c0b8['ui']['view']['body'],function(_0x3f43df){const _0x26751e=fi(_0x3f43df['config']['get']('ai.assistant.commands'),_0x3f43df['locale']),_0x4efba4=Pi(_0x3f43df,_0x26751e)['filter'](_0x28b682=>_0x28b682['commands']['length']);if(0x1===_0x4efba4['length'])return Pi(_0x3f43df,_0x4efba4[0x0]['commands'])['map'](_0x5ede86=>({'id':_0x5ede86['id'],'label':_0x5ede86['label']}));return _0x4efba4['map'](_0x35cecd=>{const {groupId:_0x31e6d6,groupLabel:_0x1925ae,commands:_0x4ff734}=_0x35cecd,_0x22a5a1=Pi(_0x3f43df,_0x4ff734)['map'](_0x341f93=>({'id':_0x341f93['id'],'label':_0x341f93['label']}));return{'id':_0x31e6d6,'menu':_0x1925ae||_0x31e6d6,'children':_0x22a5a1};});}(_0x35c0b8),{'ariaLabel':Si(_0x59de19,'AI\x20Commands')}),_0x44879e['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0xf2a25a['on']('change:enabledCommandsIds',_0x3d569a),_0x44879e['menuView']['once']('render',_0x3d569a),_0x44879e;function _0x3d569a(){_0x44879e['isEnabled']=_0xf2a25a['enabledCommandsIds']['length']>0x0;for(const _0x4f2d9f of _0x44879e['menuView']['buttons'])_0x4f2d9f['isEnabled']=_0xf2a25a['enabledCommandsIds']['includes'](_0x4f2d9f['id']);}}),_0x35c0b8['ui']['componentFactory']['add']('menuBar:aiCommands',_0x1429c3=>{const _0x2849e4=new Kt(_0x1429c3);_0x2849e4['buttonView']['set']({'label':Si(_0x1429c3,'AI\x20Commands'),'icon':_0xdeb544}),_0x2849e4['bind']('isEnabled')['to'](_0xf2a25a,'enabledCommandsIds',_0xf9f84c=>_0xf9f84c['length']>0x0);const _0x5081a5=fi(_0x35c0b8['config']['get']('ai.assistant.commands'),_0x1429c3);return this['_populateMenuBarMenu'](_0xf2a25a,_0x2849e4,_0x5081a5,_0x5ecfa3=>this['_onExecute'](_0x5ecfa3)),_0x2849e4;}),_0x35c0b8['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x125fb2=this['_createAIAssistantUIButton'](yt);return _0x125fb2['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x125fb2;}),_0x35c0b8['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x159cc6=this['_createAIAssistantUIButton'](Yt);return _0x159cc6['set']({'role':'menuitemcheckbox'}),_0x159cc6;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x2549cc=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x2a9fab;for(const _0x26d2ba in _0x2549cc){const _0x53a3c2=_0x26d2ba,_0x552c2c=_0x2549cc[_0x53a3c2];if('aiLicenseKeyValid'==_0x552c2c||'aiLicenseKeyInvalid'==_0x552c2c||'aiLicenseKeyExpired'==_0x552c2c||'aiLicenseKeyDomainLimit'==_0x552c2c||'aiLicenseKeyNotAllowed'==_0x552c2c||'aiLicenseKeyEvaluationLimit'==_0x552c2c||'aiLicenseKeyUsageLimit'==_0x552c2c){delete _0x2549cc[_0x53a3c2],_0x2a9fab=_0x552c2c,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x2a9fab&&_0x2549cc['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x2a9fab&&_0x2549cc['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x2a9fab&&_0x2549cc['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x2a9fab&&_0x2549cc['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x2a9fab&&_0x2549cc['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x2a9fab&&_0x2549cc['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x39fd94='',_0x526136='',_0x10369d='custom'){const _0x560704=this['editor'],_0x1f26cc=_0x560704['editing']['view'],_0x3db7fd=_0x560704['plugins']['get'](AIAssistantEditing),_0x2ecd3c=_0x560704['plugins']['get'](_0x1086e0);_0x3db7fd['showFakeVisualSelection']();const _0x56ecef=new xi(),_0x5f149c=new ClipboardEvent('copy',{'clipboardData':_0x56ecef}),_0x4a0d42=new _0x45ec09(_0x56ecef),_0x37352b=new _0x2abc63(_0x1f26cc,_0x5f149c,{'dataTransfer':_0x4a0d42});_0x2ecd3c['_forceMarkersCopy']('comment',()=>{_0x1f26cc['document']['fire']('copy',_0x37352b);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0x560704,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x2181f6=_0x4a0d42['getData']('text/html');const _0x288cab=_0x560704['model']['document']['selection'],_0x4bf1b4=Array['from'](_0x288cab['getRanges']());0x1===_0x4bf1b4['length']&&_0x4bf1b4[0x0]['isFlat']&&!_0x288cab['getSelectedElement']()&&''!==_0x2181f6['replace'](/&nbsp;/g,'')['trim']()&&(_0x2181f6='<p>'+_0x2181f6+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x10369d,'query':_0x39fd94,'htmlContent':_0x2181f6,'label':_0x526136,'mainActionLabel':ki[_0x560704['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x4712a7,'title':Si(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':$t['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x3db7fd['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x1cf8fa=new Map(),_0x1d5d3a=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x8c1a50 of _0x1d5d3a)for(const _0x4d3f26 of _0x8c1a50['commands'])_0x1cf8fa['set'](_0x4d3f26['id'],{..._0x4d3f26,'groupId':_0x8c1a50['groupId'],'groupLabel':_0x8c1a50['groupLabel']||_0x8c1a50['groupId']});return _0x1cf8fa;}['_createAIAssistantUIButton'](_0x3d8b90){const _0x563d10=this['editor'],_0x240ac6=_0x563d10['commands']['get']('showAIAssistant'),_0x273469=new _0x3d8b90(_0x563d10['locale']);return _0x273469['set']({'label':Si(_0x563d10['locale'],'AI\x20Assistant'),'icon':_0x4712a7,'isToggleable':!0x0}),_0x273469['bind']('isEnabled')['to'](_0x240ac6),_0x273469['bind']('isOn')['to'](this['_dialog'],'id',_0x3cb63c=>'aiAssistant'===_0x3cb63c),this['listenTo'](_0x273469,'execute',()=>{_0x273469['isOn']?this['hideUI']():_0x240ac6['execute']();}),_0x273469;}['_initView'](){const _0xc579db=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',()=>{_0xc579db['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0xc579db['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x229f2e,ui:{ariaLiveAnnouncer:_0x4cf415}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0xcd5386,_0x2b7bf6,_0x312c8a)=>{const _0x2e2e08=this['_aiAssistantController']['currentContext'];_0x312c8a?_0x4cf415['announce'](Si(_0x229f2e,'AI\x20is\x20writing')):_0x2e2e08&&_0x4cf415['announce'](Si(_0x229f2e,'Generated\x20content:\x20%0',_0x2e2e08),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x2201b3,_0x382af5,_0x353808)=>{if(_0x353808){const _0x5de4ed=this['_formView']['errorView']['text'];_0x4cf415['announce'](Si(_0x229f2e,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x5de4ed));}});}['_onExecute'](_0x1b962f){const _0x43d1a1=this['_commandDefinitions']['get'](_0x1b962f),_0x4b7954=this['editor'],_0x4b458b=_0x4b7954['model']['document']['selection'],_0x5d3b95=_0x4b7954['commands']['get']('showAIAssistant'),_0x11e68f=_0x4b7954['plugins']['get'](AIAssistantEditing),_0x47e1a5=''+(_0x43d1a1['groupId']!==Ti?_0x43d1a1['groupLabel']+':\x20':'')+_0x43d1a1['label'];if(!0x1!==_0x43d1a1['requiresContent']&&_0x4b458b['isCollapsed']){const _0x2bdf44=gt(_0x4b458b['getSelectedBlocks']())||_0x4b7954['model']['schema']['getLimitElement'](_0x4b458b);_0x4b7954['model']['change'](_0x54eaee=>{_0x54eaee['setSelection'](_0x2bdf44,'in');});}_0x11e68f['showFakeVisualSelection'](),_0x5d3b95['execute'](_0x43d1a1['prompt'],_0x47e1a5,'command:'+_0x1b962f);}['_populateMenuBarMenu'](_0x5c9552,_0x548b93,_0x11c6ae,_0x2d4efe){const _0x5b42ae=this['editor'],_0x1ef9fc=_0x5b42ae['locale'],_0x343298=new qt(_0x1ef9fc),_0x3ee516=Pi(_0x5b42ae,_0x11c6ae)['filter'](_0x3d9f67=>_0x3d9f67['commands']['length']);0x1===_0x3ee516['length']?this['_getMenuBarGroupButtons']({'command':_0x5c9552,'commands':_0x3ee516[0x0]['commands'],'parentMenuView':_0x548b93,'onExecute':_0x2d4efe})['forEach'](_0x12061f=>_0x343298['items']['add'](_0x12061f)):_0x3ee516['forEach'](({groupId:_0x48fab0,groupLabel:_0xa30090,commands:_0x561e9e})=>{const _0x3f2f99=new Qt(_0x1ef9fc,_0x548b93),_0x3cf225=new Kt(_0x1ef9fc),_0x188189=new qt(_0x1ef9fc),_0x1d8b2d=this['_getMenuBarGroupButtons']({'command':_0x5c9552,'commands':_0x561e9e,'parentMenuView':_0x3cf225,'onExecute':_0x2d4efe});_0x3cf225['buttonView']['set']({'label':_0xa30090||_0x48fab0}),_0x3cf225['delegate']('execute')['to'](_0x548b93),_0x188189['items']['addMany'](_0x1d8b2d),_0x3cf225['panelView']['children']['add'](_0x188189),_0x3f2f99['children']['add'](_0x3cf225),_0x343298['items']['add'](_0x3f2f99);}),_0x548b93['panelView']['children']['add'](_0x343298);}['_getMenuBarGroupButtons']({command:_0x160b9b,commands:_0x407a60,parentMenuView:_0x499dbe,onExecute:_0x8e7a29}){const _0x866c52=this['editor'],_0x349fe4=_0x866c52['locale'];return Pi(_0x866c52,_0x407a60)['map'](_0x4895d7=>{const _0x4bb2a7=new Qt(_0x349fe4,_0x499dbe),_0x56da0b=new Yt(_0x349fe4);return _0x56da0b['set']({'label':_0x4895d7['label']}),_0x56da0b['delegate']('execute')['to'](_0x499dbe),_0x56da0b['on']('execute',()=>_0x8e7a29(_0x4895d7['id'])),_0x56da0b['bind']('isEnabled')['to'](_0x160b9b,'enabledCommandsIds',_0x17c4e0=>_0x17c4e0['includes'](_0x4895d7['id'])),_0x4bb2a7['children']['add'](_0x56da0b),_0x4bb2a7;});}}function Li(_0x1b262e,_0x36496e){return void 0x0!==_0x1b262e['order']&&void 0x0===_0x36496e['order']?0x1:void 0x0===_0x1b262e['order']&&void 0x0!==_0x36496e['order']?-0x1:void 0x0!==_0x1b262e['order']&&void 0x0!==_0x36496e['order']?_0x1b262e['order']-_0x36496e['order']:0x0;}function Pi(_0x2c89ab,_0x780520){_0x780520['sort'](Li);const _0x5270cd={},_0x680195=[];for(const _0x3a5e1f of _0x780520)if(void 0x0!==_0x3a5e1f['order']){if(_0x3a5e1f['order']in _0x5270cd)throw new ht('ai-commands-config-order-collision',_0x2c89ab,{'conflictingDefinitions':[_0x3a5e1f,_0x5270cd[_0x3a5e1f['order']]]});_0x5270cd[_0x3a5e1f['order']]=_0x3a5e1f,_0x680195['splice'](_0x3a5e1f['order'],0x0,_0x3a5e1f);}else _0x680195['push'](_0x3a5e1f);return _0x680195;}class AIAssistant extends _0x3453ad{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x390f24){super(_0x390f24);const _0x5e186f=_0x390f24['config'],_0x38343b=_0x390f24['locale'];_0x5e186f['define']('ai.assistant.preserveComments',!0x0),_0x5e186f['define']('ai.assistant.commands',Di(_0x38343b)),_0x5e186f['define']('ai.assistant.extraCommandGroups',[]),_0x5e186f['define']('ai.assistant.removeCommands',[]);let _0x4a26b1=fi(_0x5e186f['get']('ai.assistant.commands'),_0x38343b);const _0x31642d=_0x5e186f['get']('ai.assistant.extraCommandGroups'),_0x5d7193=_0x5e186f['get']('ai.assistant.removeCommands');_0x31642d['forEach'](_0x2dd7c8=>{const _0xae2c67=_0x4a26b1['find'](_0x1615e7=>_0x1615e7['groupId']===_0x2dd7c8['groupId']);_0xae2c67?_0xae2c67['commands']=_0xae2c67['commands']['concat'](_0x2dd7c8['commands']):_0x4a26b1['push'](_0x2dd7c8);}),_0x4a26b1=_0x4a26b1['filter'](_0x231398=>!_0x5d7193['includes'](_0x231398['groupId'])),_0x4a26b1['forEach'](_0x57ae8f=>{_0x57ae8f['commands']=_0x57ae8f['commands']['filter'](_0x386578=>!_0x5d7193['includes'](_0x386578['id']));}),_0x5e186f['set']('ai.assistant.commands',_0x4a26b1);}}function Di(_0x391e2b){return[{'groupId':'editOrReview','groupLabel':Si(_0x391e2b,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Si(_0x391e2b,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Si(_0x391e2b,'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(_0x391e2b,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Si(_0x391e2b,'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(_0x391e2b,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Si(_0x391e2b,'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(_0x391e2b,'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(_0x391e2b,'Change\x20tone'),'commands':[{'id':'professional','label':Si(_0x391e2b,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Si(_0x391e2b,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Si(_0x391e2b,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Si(_0x391e2b,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Si(_0x391e2b,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Si(_0x391e2b,'Change\x20style'),'commands':[{'id':'business','label':Si(_0x391e2b,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Si(_0x391e2b,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Si(_0x391e2b,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Si(_0x391e2b,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Si(_0x391e2b,'Translate'),'commands':[{'id':'translateEnglish','label':Si(_0x391e2b,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Si(_0x391e2b,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Si(_0x391e2b,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Si(_0x391e2b,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Si(_0x391e2b,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Si(_0x391e2b,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Si(_0x391e2b,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Si(_0x391e2b,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x3453ad{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x351d7b){super(_0x351d7b),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'](_0x5e6232){return this['sendRequest'](_0x5e6232)['catch'](_0x1e2cb0=>{if(_0x1e2cb0 instanceof AIRequestError)return Promise['reject'](_0x1e2cb0);if('AbortError'==_0x1e2cb0['name'])return Promise['resolve']();throw console['error'](_0x1e2cb0),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x5d675e,_0x172d8d){const _0x5edbbf=this['editor']['locale'],_0x3fbd69={'Content-Type':'application/json'};if('object'==typeof _0x5d675e)Object['assign'](_0x3fbd69,_0x5d675e);else{if(_0x5d675e)try{const _0xdf4aa5=await _0x5d675e(_0x172d8d);Object['assign'](_0x3fbd69,_0xdf4aa5);}catch{return Promise['reject'](new AIRequestError(Si(_0x5edbbf,'AI_ERROR_GET_HEADERS')));}}return _0x3fbd69;}async['_prepareRequestParameters'](_0x403770,_0x529af9){const _0x2df33e=this['editor']['locale'];if('object'==typeof _0x403770)return _0x403770;try{return await _0x403770(_0x529af9);}catch{return Promise['reject'](new AIRequestError(Si(_0x2df33e,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x2cc269){super(_0x2cc269),_0x2cc269['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x2cc269['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x2cc269['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x2cc269['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x2cc269['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x2cc269['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x13cebf,context:_0xf4b274,onData:_0x4a40b3,actionId:_0x18601a}){const _0x3e6235=this['editor']['locale'],_0x841879=await this['prepareMessages'](_0x13cebf,_0xf4b274,_0x18601a),_0xe08b8e=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x18601a),_0x4568c8=await this['_prepareRequestParameters'](this['_requestParameters'],_0x18601a),_0x27ff28={'messages':_0x841879,..._0x4568c8},_0x59a1ef={'method':'POST','headers':_0xe08b8e,'body':JSON['stringify'](_0x27ff28),'signal':this['abortController']['signal']},_0x278d10=await fetch(this['_apiUrl'],_0x59a1ef);if(_0x278d10['ok'])return _0x4568c8['stream']?await this['_readStreamableResponse'](_0x278d10,_0x4a40b3):await this['_readStaticResponse'](_0x278d10,_0x4a40b3),Promise['resolve']();{const _0x2773ea=await _0x278d10['text']();return _0x2773ea['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Si(_0x3e6235,'AI_ERROR_CONTEXT_LENGTH'))):_0x2773ea['includes']('Moderation')?Promise['reject'](new AIRequestError(Si(_0x3e6235,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x2773ea));}}async['prepareMessages'](_0x3d759d,_0xdff243,_0xc61492){let _0x54c435,_0x267a95;return _0xdff243?(_0x54c435='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.',_0x267a95='Instruction:\x0a'+_0x3d759d+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0xdff243):(_0x54c435='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.',_0x267a95=_0x3d759d),[{'role':'system','content':_0x54c435},{'role':'user','content':_0x267a95}];}async['_readStreamableResponse'](_0x3ae43b,_0x32ae3c){const _0x4ebcef=_0x3ae43b['body']['getReader'](),_0x312bc2=new TextDecoder();let _0x5f29c4='',_0x5be648='',_0x56e458='',_0x356491=!0x1;for(;!_0x356491;){const {done:_0x1d4765,value:_0x35d315}=await _0x4ebcef['read'](),_0x41a4f3=_0x5f29c4+_0x312bc2['decode'](_0x35d315);let _0x1e2d21='';_0x356491=_0x1d4765;try{_0x1e2d21=this['_cleanUpData'](_0x41a4f3),_0x5f29c4='';}catch{_0x5f29c4=_0x41a4f3;continue;}_0x5be648+=_0x1e2d21,!_0x356491&&this['_isBufferIncomplete'](_0x5be648)||_0x5be648&&(_0x56e458+=_0x5be648,_0x5be648='',_0x32ae3c(_0x56e458));}return Promise['resolve']();}async['_readStaticResponse'](_0x27c128,_0x574660){return _0x574660((await _0x27c128['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x1a45db){const _0x2fc94a=_0x1a45db['split']('<')['length']!==_0x1a45db['split']('>')['length'],_0x5846f5=_0x1a45db['length']<0x1e;return _0x2fc94a&&_0x5846f5;}['_cleanUpData'](_0x374a55){return _0x374a55['split'](/\n(?![^{]*\})/g)['map'](_0x23ebe7=>_0x23ebe7['replace']('data:\x20',''))['filter'](_0x4fbdd7=>_0x4fbdd7&&_0x4fbdd7['length']>0x0&&'[DONE]'!==_0x4fbdd7)['map'](_0x2d2627=>{const {choices:_0x2ea4b6}=JSON['parse'](_0x2d2627);if(_0x2ea4b6[0x0]?.['delta']?.['content'])return _0x2ea4b6[0x0]['delta']['content'];})['filter'](_0x2fa792=>_0x2fa792)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),wt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x41f9aa){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Si(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends yt{constructor(_0x268d88,_0x1ec6c9={}){super(_0x268d88),this['isToggleable']=!0x0,this['set']('side',_0x1ec6c9['side']||'top');const _0x1392f9=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0x1ec6c9['class']||[]),_0x1392f9['to']('side',_0x2169aa=>'ck-tab-button_'+_0x2169aa),_0x1392f9['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x4a5787,_0xc21df3={}){super(_0x4a5787);const _0xf62386=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0xc21df3['class']||[]),_0xf62386['to']('class'),_0xf62386['if']('isVisible','ck-hidden',_0x4c3f27=>!_0x4c3f27)]},'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(_0x384cbb,_0x2ea713={}){super(_0x384cbb),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x2ea713['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x2ea713['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x50d3e8,_0x497c91)=>_0x50d3e8&&null!==_0x497c91);const _0x4dfa9d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0x2ea713['class']||[]),_0x4dfa9d['to']('side',_0x262b58=>'ck-tabs_'+_0x262b58),_0x4dfa9d['to']('class'),_0x4dfa9d['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x4dfa9d['to']('activeTab',_0x1b98f4=>null===_0x1b98f4?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x4dfa9d['to']('side',_0x558416=>'ck-tabs__buttons-container_'+_0x558416)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x4dfa9d['to']('side',_0x47ce62=>'ck-tabs__panels-container_'+_0x47ce62)]},'children':this['panelViews']},...mt(_0x2ea713['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x4cd808){const _0x3fc051=this['_tabs']['get'](_0x4cd808);return _0x3fc051||null;}['addTab'](_0x172237){const _0x3f9c19=this['_setupButton']({'id':_0x172237['id'],'label':_0x172237['buttonLabel'],'icon':_0x172237['buttonIcon'],'order':_0x172237['order']}),_0x938451=new TabPanelView(this['locale']);return _0x938451['render'](),_0x172237['content']&&_0x938451['children']['add'](_0x172237['content']),this['panelViews']['add'](_0x938451),this['_tabs']['set'](_0x172237['id'],{'button':_0x3f9c19,'panel':_0x938451,'order':void 0x0!==_0x172237['order']?_0x172237['order']:null}),this['fire']('addTab:'+_0x172237['id'],{'id':_0x172237['id'],'button':_0x3f9c19,'panel':_0x938451}),null===this['activeTab']?this['activateTab'](_0x172237['id']):this['_hidePanel'](_0x172237['id']),{'button':_0x3f9c19,'panel':_0x938451};}['activateTab'](_0x11ce3d){if(null!==_0x11ce3d&&!this['getTab'](_0x11ce3d))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x11ce3d});if(this['activeTab']===_0x11ce3d)return;const _0x1478bf=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x11ce3d,_0x11ce3d&&this['_showPanel'](_0x11ce3d),this['fire']('activateTab:'+_0x11ce3d,{'newTab':_0x11ce3d,'oldTab':_0x1478bf});}['toggleTabPanel'](_0x477061){if(!this['getTab'](_0x477061))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x477061});this['activeTab']===_0x477061?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x477061);}['showTab'](_0x5763b4){if(!this['getTab'](_0x5763b4))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5763b4});this['_showPanel'](_0x5763b4),this['_showButton'](_0x5763b4),this['fire']('show:'+_0x5763b4,_0x5763b4);}['hideTab'](_0xcaa52d){if(!this['getTab'](_0xcaa52d))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0xcaa52d});const _0xc2575b=this['activeTab'];this['_hidePanel'](_0xcaa52d),this['_hideButton'](_0xcaa52d);const _0x36dc84=this['getTabIds']();_0xc2575b===_0xcaa52d&&_0x36dc84['length']>0x1&&this['activateTab'](_0x36dc84['find'](_0x294156=>_0x294156!==_0xcaa52d)),this['fire']('hide:'+_0xcaa52d,_0xcaa52d);}['_getPanel'](_0x1acf69){const _0x52eff1=this['_tabs']['get'](_0x1acf69);return _0x52eff1?_0x52eff1['panel']:null;}['_showPanel'](_0x2fa327){null!==this['activeTab']&&this['activeTab']!==_0x2fa327||this['_getPanel'](_0x2fa327)['show']();}['_hidePanel'](_0x764f3b){const _0x4ad24f=this['_getPanel'](_0x764f3b);_0x4ad24f['isVisible']&&(this['activeTab']===_0x764f3b&&(this['activeTab']=null),_0x4ad24f['hide']());}['_getButton'](_0x33bf8e){const _0x49b4bc=this['_tabs']['get'](_0x33bf8e);return _0x49b4bc?_0x49b4bc['button']:null;}['_showButton'](_0x2fd679){this['_getButton'](_0x2fd679)['show']();}['_hideButton'](_0x35a9bb){this['_getButton'](_0x35a9bb)['hide']();}['_setupButton'](_0x427204){const _0x59701d=new TabButtonView(this['locale'],{'side':this['side']}),_0x37bd65=this['buttonViews'];if(_0x59701d['set']({'label':_0x427204['label'],'icon':_0x427204['icon'],'tooltip':!0x0,'withText':!0x0}),_0x59701d['bind']('isOn')['to'](this,'activeTab',_0x2d4a13=>_0x2d4a13===_0x427204['id']),_0x59701d['bind']('side')['to'](this,'side'),_0x427204['order']){const _0x233a3b=[...this['_tabs']]['reduce']((_0x123e2e,_0x44ab5e)=>{const _0x53ec84=_0x44ab5e[0x0],{order:_0x126684}=_0x44ab5e[0x1];return!_0x126684||_0x126684>_0x427204['order']?_0x123e2e:_0x126684>=_0x123e2e['order']?{'id':_0x53ec84,'order':_0x126684}:_0x123e2e;},{'id':'','order':0x0}),_0x14743e=_0x37bd65['getIndex'](this['_getButton'](_0x233a3b['id']));_0x37bd65['add'](_0x59701d,_0x14743e+0x1);}else _0x37bd65['add'](_0x59701d);return _0x59701d['on']('execute',()=>{this['toggleTabPanel'](_0x427204['id']);}),_0x59701d;}}const Vi=['overlay','sidebar','custom'],Hi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0x1cbe50,_0x2a2102={}){super(_0x1cbe50,_0x2a2102),this['set']('type',_0x2a2102['type']||'sidebar'),this['set']('side',_0x2a2102['side']||'right'),this['set']('isVisible',_0x2a2102['visibleByDefault']??!0x0);const _0x274e98=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x274e98['if']('type','ck-ai-tabs__overlay',_0x22f753=>'overlay'===_0x22f753),_0x274e98['if']('type','ck-ai-tabs__sidebar',_0x85442c=>'sidebar'===_0x85442c),_0x274e98['if']('isVisible','ck-hidden',_0x48916a=>!_0x48916a)]}}),this['buttonViews']['on']('add',(_0x49ea06,_0x38cc11)=>{_0x38cc11['set']('withText',!0x1);});}}class AITabs extends _0x4338bf{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x534684){if(super(_0x534684),!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 _0x32c361=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x32c361['showResizeButton']&&(this['showResizeButton']=_0x32c361['showResizeButton']),'sidebar'!==_0x32c361['type']&&'overlay'!==_0x32c361['type']||_0x32c361['side']&&(this['side']=_0x32c361['side']),'sidebar'===_0x32c361['type']){if(this['container']=_0x32c361['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x32c361['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':_0x32c361['visibleByDefault'],'collapsible':_0x32c361['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 _0x1ca247&&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'](_0x57ce0f){if(_0x57ce0f&&this['type']!==_0x57ce0f){if(!Vi['includes'](_0x57ce0f))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x57ce0f;}}['switchSide'](_0x4c132a){if(_0x4c132a&&this['side']!==_0x4c132a){if(!Hi['includes'](_0x4c132a))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x4c132a;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0x4338bf{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x128c11];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x491d39){if(super(_0x491d39),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 _0x304707=this['context']['plugins']['get'](_0x128c11);if(!_0x304707['token'])throw new ht('ai-missing-token',this);this['_token']=_0x304707['token'];}['startConversation'](_0x17f5a5,_0x1c1788){const _0x424374=this['_sendApiRequest']('/conversations','POST',{'id':_0x17f5a5,'group':_0x1c1788});return{'getConversation':async()=>(await _0x424374['request'])['json'](),'abortController':_0x424374['abortController']};}['queryAssistant']({message:_0x21af94,conversationId:_0x629950,parts:_0x476565,capabilities:_0x523032,model:_0x59ab0d,attributes:_0x266222}){const _0x34b4c3={'prompt':_0x21af94,'content':_0x476565,'model':_0x59ab0d,..._0x523032&&{'capabilities':_0x523032},..._0x266222&&{'attributes':_0x266222}},_0x4fdbc8=this['_sendApiRequest']('/conversations/'+_0x629950+'/messages','POST',_0x34b4c3,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x15663d=(await _0x4fdbc8['request'])['body'];return this['_getStreamReader'](_0x15663d);},'abortController':_0x4fdbc8['abortController']};}['executeCustomAction']({content:_0xb63958,message:_0x192540,model:_0x413eda,outputFormat:_0x5817cc}){const _0x543d02={'content':[{'type':'text','content':_0xb63958}],'prompt':_0x192540,'model':_0x413eda,'outputFormat':_0x5817cc},_0x1b9099=this['_sendApiRequest']('/actions/custom/calls','POST',_0x543d02);return{'getStream':async()=>{const _0x2141dd=(await _0x1b9099['request'])['body'];return this['_getStreamReader'](_0x2141dd);},'abortController':_0x1b9099['abortController']};}['executeAction']({actionName:_0x390b4c,content:_0x2c83f,args:_0x231878}){const _0x59b302={'content':[{'type':'text','content':_0x2c83f}],'args':_0x231878},_0x1026cc=this['_sendApiRequest']('/actions/system/'+_0x390b4c+'/calls','POST',_0x59b302);return{'getStream':async()=>{const _0x2c3513=(await _0x1026cc['request'])['body'];return this['_getStreamReader'](_0x2c3513);},'abortController':_0x1026cc['abortController']};}['uploadFile'](_0x276385,_0x402660,_0xdc2184){const _0x5d5b03=new FormData();_0x5d5b03['append']('file',_0x402660,_0x402660['name']),_0xdc2184&&_0x5d5b03['append']('attributes',JSON['stringify'](_0xdc2184));const _0x3b66f1=this['_sendApiRequest']('/conversations/'+_0x276385+'/files','POST',_0x5d5b03);return{'getId':async()=>(await _0x3b66f1['request'])['json'](),'abortController':_0x3b66f1['abortController']};}['fetchDocument'](_0x21cc34,_0x124809){const _0x4eb86c=this['_sendApiRequest']('/conversations/'+_0x21cc34+'/documents/'+_0x124809,'GET');return{'getDocument':async()=>(await _0x4eb86c['request'])['json'](),'abortController':_0x4eb86c['abortController']};}['uploadDocument'](_0x240faa,_0x517989,_0x1b631f){const _0x17b76f={'content':_0x517989};_0x1b631f&&(_0x17b76f['attributes']=_0x1b631f);const _0x11e7b4=this['_sendApiRequest']('/conversations/'+_0x240faa+'/documents','POST',_0x17b76f);return{'getId':async()=>(await _0x11e7b4['request'])['json'](),'abortController':_0x11e7b4['abortController']};}['uploadDocuments'](_0x3c2705,_0x1b894a){const _0xbcf44c={'documents':_0x1b894a['map'](_0x17437c=>({'content':_0x17437c['content'],'attributes':{'version':_0x17437c['version'],'sessionId':_0x17437c['sessionId'],'channelId':_0x17437c['channelId'],'rootName':_0x17437c['rootName'],'selections':_0x17437c['selections']},...void 0x0!==_0x17437c['name']?{'name':_0x17437c['name']}:{},...void 0x0!==_0x17437c['description']?{'description':_0x17437c['description']}:{}}))},_0x5a51a3=this['_sendApiRequest']('/conversations/'+_0x3c2705+'/documents/batch','POST',_0xbcf44c);return{'getIds':async()=>(await _0x5a51a3['request'])['json'](),'abortController':_0x5a51a3['abortController']};}['fetchDocuments'](_0x32bbc7,_0x14f5cd){const _0x484e5f=new URLSearchParams();_0x484e5f['append']('documentIds',_0x14f5cd['join'](','));const _0x4b3512=this['_sendApiRequest']('/conversations/'+_0x32bbc7+'/documents/batch?'+_0x484e5f['toString'](),'GET');return{'getDocuments':async()=>(await _0x4b3512['request'])['json'](),'abortController':_0x4b3512['abortController']};}['fetchConversations'](_0x29457f,_0x105b1a={}){const _0x28a349=new URLSearchParams();_0x28a349['append']('group',_0x29457f),_0x28a349['append']('excludeEmpty',!0x1!==_0x105b1a['excludeEmpty']?'true':'false'),_0x28a349['append']('limit',_0x105b1a['limit']?_0x105b1a['limit']['toString']():'100'),_0x28a349['append']('sortBy',_0x105b1a['sortBy']?_0x105b1a['sortBy']:'createdAt'),_0x28a349['append']('order',_0x105b1a['order']?_0x105b1a['order']:'desc');const _0x3134fa=this['_sendApiRequest']('/conversations?'+_0x28a349['toString'](),'GET');return{'getConversations':async()=>{const _0x5a3c71=await _0x3134fa['request'];return(await _0x5a3c71['json']())['items'];},'abortController':_0x3134fa['abortController']};}['deleteConversation'](_0x16b9fa){const _0x3a584f=this['_sendApiRequest']('/conversations/'+_0x16b9fa,'DELETE');return{'execute':async()=>{await _0x3a584f['request'];},'abortController':_0x3a584f['abortController']};}['updateConversation'](_0x669fa9,_0x3442a7){const _0x59b036=this['_sendApiRequest']('/conversations/'+_0x669fa9,'PATCH',_0x3442a7);return{'getResult':async()=>(await _0x59b036['request'],_0x3442a7),'abortController':_0x59b036['abortController']};}['fetchConversation'](_0x2205d8){const _0x2fc3e8=this['_sendApiRequest']('/conversations/'+_0x2205d8,'GET');return{'getConversation':async()=>(await _0x2fc3e8['request'])['json'](),'abortController':_0x2fc3e8['abortController']};}['fetchConversationMessages'](_0x31072e){const _0x2e10f6=this['_sendApiRequest']('/conversations/'+_0x31072e+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>{const _0x453cc5=await _0x2e10f6['request'];return(await _0x453cc5['json']())['items'];},'abortController':_0x2e10f6['abortController']};}['uploadUrl'](_0x435ad2,_0x94dc46,_0x36710b){const _0x43edbf=this['_sendApiRequest']('/conversations/'+_0x435ad2+'/web-resources','POST',{'url':_0x94dc46,'attributes':_0x36710b});return{'getId':async()=>(await _0x43edbf['request'])['json'](),'abortController':_0x43edbf['abortController']};}['getModels'](_0x31bb67='en'){const _0x583cf3=new URLSearchParams();_0x583cf3['append']('language',_0x31bb67);const _0x547d49='/models/1?'+_0x583cf3['toString'](),_0x47c22d=this['_sendApiRequest'](_0x547d49,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x47c22d['request'])['json'](),'abortController':_0x47c22d['abortController']};}['deleteFile'](_0x3e13dd,_0x387da8){const _0x4d105e=this['_sendApiRequest']('/conversations/'+_0x3e13dd+'/files/'+_0x387da8,'DELETE');return{'execute':async()=>{await _0x4d105e['request'];},'abortController':_0x4d105e['abortController']};}['deleteDocument'](_0x5b9b2c,_0x44ad0d){const _0x3961b5=this['_sendApiRequest']('/conversations/'+_0x5b9b2c+'/documents/'+_0x44ad0d,'DELETE');return{'execute':async()=>{await _0x3961b5['request'];},'abortController':_0x3961b5['abortController']};}['deleteWebResource'](_0x5531bd,_0x309aa9){const _0x33ed3d=this['_sendApiRequest']('/conversations/'+_0x5531bd+'/web-resources/'+_0x309aa9,'DELETE');return{'execute':async()=>{await _0x33ed3d['request'];},'abortController':_0x33ed3d['abortController']};}['cancelStream'](_0x1d7406,_0x4d4421){const _0x1db746=this['_sendApiRequest']('/conversations/'+_0x1d7406+'/messages/'+_0x4d4421+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x1db746['request'];},'abortController':_0x1db746['abortController']};}['resumeStream'](_0x4149fc,_0x551017,_0x22f305='0-0'){const _0x4d1f28=new URLSearchParams({'lastEventId':_0x22f305}),_0x4bf817=this['_sendApiRequest']('/conversations/'+_0x4149fc+'/messages/'+_0x551017+'/stream?'+_0x4d1f28['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x5c55d9=await _0x4bf817['request'];return this['_getStreamReader'](_0x5c55d9['body']);},'abortController':_0x4bf817['abortController']};}['callSystemReview']({reviewName:_0x12b6d7,content:_0x16472a,args:_0x347c1b}){const _0x41a3a7=this['_sendApiRequest']('/reviews/system/'+_0x12b6d7+'/calls','POST',{'content':[{'type':'text','content':_0x16472a}],'args':_0x347c1b});return{'getStream':async()=>{const _0x2ef9e7=(await _0x41a3a7['request'])['body'];return this['_getStreamReader'](_0x2ef9e7);},'abortController':_0x41a3a7['abortController']};}['callCustomReview']({content:_0x15db2a,prompt:_0xde07d4,model:_0x4a7f32}){const _0x2d2c5b=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x15db2a}],'prompt':_0xde07d4,'model':_0x4a7f32});return{'getStream':async()=>{const _0x139252=(await _0x2d2c5b['request'])['body'];return this['_getStreamReader'](_0x139252);},'abortController':_0x2d2c5b['abortController']};}['upsertAIChatRating'](_0x18f930,_0x248a32,_0x3a4023){const _0x30164a=this['_sendApiRequest']('/conversations/'+_0x18f930+'/messages/'+_0x248a32+'/ratings','PUT',{'positiveCount':_0x3a4023['positiveCount'],'totalCount':_0x3a4023['totalCount'],'modificationId':_0x3a4023['modificationId']});return{'execute':async()=>{await _0x30164a['request'];},'abortController':_0x30164a['abortController']};}['upsertAIActionRating'](_0x34b895,_0x4f1555,_0x39ab67){const _0x5bff7a=this['_sendApiRequest']('/actions/system/'+_0x34b895+'/calls/'+_0x4f1555+'/ratings','PUT',{'positiveCount':_0x39ab67['positiveCount'],'totalCount':_0x39ab67['totalCount']});return{'execute':async()=>{await _0x5bff7a['request'];},'abortController':_0x5bff7a['abortController']};}['upsertCustomAIActionRating'](_0x3a17d4,_0x17940b){const _0x3c38d3=this['_sendApiRequest']('/actions/custom/calls/'+_0x3a17d4+'/ratings','PUT',{'positiveCount':_0x17940b['positiveCount'],'totalCount':_0x17940b['totalCount']});return{'execute':async()=>{await _0x3c38d3['request'];},'abortController':_0x3c38d3['abortController']};}['upsertAIReviewRating'](_0x55e3dd,_0x451d6b,_0x250f47,_0x2bb2dc){const _0x4599db=this['_sendApiRequest']('/reviews/system/'+_0x55e3dd+'/calls/'+_0x451d6b+'/ratings','PUT',{'positiveCount':_0x250f47['positiveCount'],'totalCount':_0x250f47['totalCount'],'dataId':_0x2bb2dc});return{'execute':async()=>{await _0x4599db['request'];},'abortController':_0x4599db['abortController']};}['upsertCustomAIReviewRating'](_0x40211b,_0x35ed50,_0x420803){const _0x4d9fce=this['_sendApiRequest']('/reviews/custom/calls/'+_0x40211b+'/ratings','PUT',{'positiveCount':_0x35ed50['positiveCount'],'totalCount':_0x35ed50['totalCount'],'dataId':_0x420803});return{'execute':async()=>{await _0x4d9fce['request'];},'abortController':_0x4d9fce['abortController']};}['_sendApiRequest'](_0x25ed64,_0x441852,_0x30fbb2,_0x149b25={}){const {useCache:_0x4f0089=!0x1,apiUrl:_0x5e76b4=this['_apiUrl']}=_0x149b25,_0x58406b=new AbortController(),_0x6ddc82=_0x4f0089?_0x441852+':'+_0x25ed64:null;if(_0x6ddc82){const _0x133e23=this['_responseCache']['get'](_0x6ddc82);if(_0x133e23)return{'request':_0x133e23['then'](_0x1b7bcc=>_0x1b7bcc['clone']()),'abortController':_0x58406b};}const _0x222d6a=_0x30fbb2 instanceof FormData,_0x45f5cc={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0x30fbb2&&!_0x222d6a&&(_0x45f5cc['Content-Type']='application/json');const _0x4f77c8={'method':_0x441852,'headers':_0x45f5cc,'signal':_0x58406b['signal']};_0x30fbb2&&(_0x4f77c8['body']=_0x222d6a?_0x30fbb2:JSON['stringify'](_0x30fbb2));const _0x1a8517=fetch(''+_0x5e76b4+_0x25ed64,_0x4f77c8)['catch'](_0x15b8d7=>{_0x6ddc82&&this['_responseCache']['delete'](_0x6ddc82),this['_handleError'](_0x15b8d7);})['then'](_0x44b6a9=>_0x44b6a9['ok']?_0x44b6a9:_0x44b6a9['json']()['then'](_0x4fbddf=>{throw _0x6ddc82&&this['_responseCache']['delete'](_0x6ddc82),{'url':_0x5e76b4,'path':_0x25ed64,'method':_0x441852,'body':_0x30fbb2,'status':(_0x44b6a9||{})['status'],'statusText':(_0x44b6a9||{})['statusText'],'code':_0x4fbddf['code'],'message':_0x4fbddf['message'],'traceId':_0x4fbddf['traceId']};}));return _0x6ddc82&&this['_responseCache']['set'](_0x6ddc82,_0x1a8517['then'](_0x9e2d27=>_0x9e2d27['clone']())),{'request':_0x1a8517,'abortController':_0x58406b};}async*['_getStreamReader'](_0x474066){const _0x34de8b=[],_0x5a2723=_0x474066['getReader'](),_0x93a0f8=_0x186cf8({'onError':_0x141499=>{this['_handleError'](_0x141499);},'onEvent':_0x20102b=>{_0x20102b['data']=JSON['parse'](_0x20102b['data']),_0x34de8b['push'](_0x20102b);}});try{let _0x4d013b=!0x1;for(;!_0x4d013b;){const {done:_0x10d4a9,value:_0x145263}=await _0x5a2723['read']();_0x10d4a9&&(_0x4d013b=!0x0),_0x93a0f8['feed'](this['_decoder']['decode'](_0x145263,{'stream':!0x0})),yield*_0x34de8b,_0x34de8b['length']=0x0;}}catch(_0x183587){this['_handleError'](_0x183587);}finally{_0x5a2723['releaseLock'](),_0x93a0f8['reset']();}}['_handleError'](_0x52b9c8){if(_0x52b9c8 instanceof ht)throw _0x52b9c8;if(_0x52b9c8 instanceof Error&&'AbortError'===_0x52b9c8['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x52b9c8});throw new ht('ai-request-failed',this,{'originalError':_0x52b9c8});}}function Mi(_0x4a5d41,_0x10da57,_0x2064f7){const t=_0x4a5d41['t'];switch(_0x10da57){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'},_0x2064f7);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.'},_0x2064f7);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.'},_0x2064f7);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.'},_0x2064f7);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'},_0x2064f7);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x2064f7);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'},_0x2064f7);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.'},_0x2064f7);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.'},_0x2064f7);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.'},_0x2064f7);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.'},_0x2064f7);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'},_0x2064f7);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.'},_0x2064f7);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 _0x10da57;}}const Ui='ck-ai-button-primary',Bi='ck-ai-button-secondary',Gi='ck-ai-button-tertiary';function Fi(_0x2284a5,_0xa3331e){const _0x11992f=new yt(_0x2284a5),_0x3fa0c3=Mi(_0x2284a5,'AI_TABS_LABEL_MINIMIZE'),_0x241efe=Mi(_0x2284a5,'AI_TABS_LABEL_MAXIMIZE');return _0x11992f['set']({'withText':!0x1,'icon':_0x113583,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Gi}),_0x11992f['bind']('label')['to'](_0xa3331e,'isMaximized',_0x431844=>_0x431844?_0x3fa0c3:_0x241efe),_0x11992f['bind']('icon')['to'](_0xa3331e,'isMaximized',_0x23a8ce=>_0x23a8ce?_0x120075:_0x113583),_0x11992f['bind']('isOn')['to'](_0xa3331e,'isMaximized'),_0x11992f['on']('execute',()=>{_0xa3331e['fire']('resizeTabs');}),_0x11992f;}function Wi(_0x5e1a6f,_0x131202){return _0x3b39c1(_0x5e1a6f,_0x131202);}function Ki(_0x415fb5,_0x5a06ad){return _0x2f5a10(_0x415fb5,_0x5a06ad);}function Yi(_0x20cde9,_0x21390f,_0x3213ec){const _0x171aab=null!==_0x21390f?_0x41a4d1=>_0x41a4d1['attribs'][_0x20cde9]===_0x21390f:_0x50330d=>Boolean(_0x50330d['attribs'][_0x20cde9]);return _0x358753(_0x3adf39=>_0x5b8d32(_0x3adf39)&&_0x171aab(_0x3adf39),_0x3213ec);}function $i(_0x596d11,_0x4d999d,_0x537d62){const _0x160fad=null!==_0x4d999d?_0x25b28f=>_0x25b28f['attribs'][_0x596d11]===_0x4d999d:_0x278113=>Boolean(_0x278113['attribs'][_0x596d11]);return _0x2a5945(_0x2bcefc=>_0x5b8d32(_0x2bcefc)&&_0x160fad(_0x2bcefc),_0x537d62);}function qi(_0x6f4de1){return _0x2a5945(_0x480bb2=>_0x5b8d32(_0x480bb2)&&function(_0x100f8d){const _0x35050f=_0x100f8d['toLowerCase']();return'script'===_0x35050f||'style'===_0x35050f||_0x35050f['includes']('-');}(_0x480bb2['name']),_0x6f4de1);}function Qi(_0x267aee){return _0x2530a3(_0x4b152e=>_0x58d07d(_0x4b152e),_0x267aee,!0x0,0x1/0x0);}function Xi(_0x1d439f,_0x1b33e1){return _0x1d439f&&_0x5b8d32(_0x1d439f)?_0x1d439f['attribs'][_0x1b33e1]:null;}function zi(_0x1dd172,_0x23732c,_0x4e5500){_0x5b8d32(_0x1dd172)&&(null===_0x4e5500?delete _0x1dd172['attribs'][_0x23732c]:_0x1dd172['attribs'][_0x23732c]=_0x4e5500);}function ji(_0x4cac36,_0x25d7e4,_0x3db505){const _0x4200d1=_0x25d7e4['cloneNode'](!0x0);'beforebegin'===_0x3db505?_0x4f5ae8(_0x4cac36,_0x4200d1):'afterbegin'===_0x3db505?_0x22b9c2(_0x4cac36,_0x4200d1):'beforeend'===_0x3db505?_0x587f40(_0x4cac36,_0x4200d1):'afterend'===_0x3db505&&_0x23bff4(_0x4cac36,_0x4200d1);}function Ji(_0x404027){const _0x81c7e=[];let _0x4f4ab9=_0x404027;for(;_0x4f4ab9;)_0x4f4ab9=_0x2e8947(_0x4f4ab9),_0x4f4ab9&&_0x81c7e['push'](_0x4f4ab9);return _0x81c7e;}function Zi(_0x490ebf){return _0x490ebf['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ts(_0x33e53c){let _0x13f6fe=0x0;for(;_0x33e53c['parentNode'];)_0x33e53c=_0x33e53c['parentNode'],_0x13f6fe++;return _0x13f6fe;}function es(_0x39dd8c){const _0x39b561=[];let _0x4d44c2=_0x39dd8c['nextSibling'];for(;_0x4d44c2;)_0x39b561['push'](_0x4d44c2),_0x4d44c2=_0x4d44c2['nextSibling'];_0x39b561['forEach'](_0x38c8e5=>{_0x2cc5d2(_0x38c8e5);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
25
+ ct(){['_m2html'];constructor(){super();const _0x1687b7=Object['entries'](_0x2966c3),_0xc1e86d=_0x1687b7['findIndex'](([_0x254362])=>'rehypeDomRaw'===_0x254362);if(-0x1===_0xc1e86d)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x1687b7['splice'](_0xc1e86d+0x1,0x0,['rehypeSanitize',_0x2dcd3c]),this['_m2html']=new _0x190544({'plugins':Object['fromEntries'](_0x1687b7)});}['convertMarkdownToHTML'](_0x39f575){const _0x1f3d88=this['_m2html']['parse'](_0x39f575);return this['parseAndNormalizeHTML'](_0x1f3d88);}['parseAndNormalizeHTML'](_0x3ea586){return this['_parseHTML'](_0x3ea586);}['_parseHTML'](_0x3cb415){const _0x5c3400=Wi('<dummy>'+_0x3cb415['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/<[^>]*?$/g,'')+'</dummy>');return _0x5c3400['children']=_0x5c3400['children'][0x0]['children'],_0x5c3400;}}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(_0x43d7d8){super(),this['_generateUid']=_0x43d7d8||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x580ec8,_0xc1748b,_0x39264c){this['_uidCounter']=0x0;const _0x260cc6=_0x580ec8['cloneNode'](!0x0);ns(_0xc1748b,_0x260cc6);const _0x952c3f=_0x260cc6['childNodes'],_0x21da7e=Array['from'](_0x952c3f)['filter'](_0x1146ca=>!(0x3===_0x1146ca['nodeType']&&''===Ki(_0x1146ca)['trim']())),_0x5d44d0=_0x21da7e['length'];for(const _0x3dd3f3 of _0x21da7e)_0x3dd3f3&&_0x5b8d32(_0x3dd3f3)&&void 0x0===_0x3dd3f3['attribs']['data-id']&&zi(_0x3dd3f3,'data-id','new-element');if(0x0===_0xc1748b['childNodes']['length']){const _0x2c6dc8=[];return $i('data-id','new-element',_0x260cc6)['forEach'](_0x3a9f84=>{const _0x2c0ac3=this['_generateUid']();zi(_0x3a9f84,'data-id',_0x2c0ac3),_0x2c6dc8['push'](_0x2c0ac3);}),this['_removeSpecialComments'](_0x260cc6),{'parsedContent':_0x260cc6,'newNodeIds':_0x2c6dc8,'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,_0xc1748b)['map'](_0x30d435=>Xi(_0x30d435,'data-id'))['filter'](_0xeeb415=>!!_0xeeb415));let _0x21ce31=-0x1,_0x11d023=!0x1;for(let _0x364923=0x0;_0x364923<_0x5d44d0;_0x364923++){const _0x5a5576=_0x21da7e[_0x364923],_0x45a679=_0x21da7e[_0x364923+0x1];if(this['_isNewNode'](_0x5a5576)){if(-0x1===_0x21ce31&&(_0x21ce31=_0x364923),this['_markWrappedElements'](_0x5a5576),!this['_isNewNode'](_0x45a679)){const [_0x36e90e,_0x589563]=this['_findReferenceNode'](_0x5a5576,_0x11d023,_0xc1748b);if(_0x36e90e){const _0x30f1c9=Array['from'](_0x21da7e)['slice'](_0x21ce31,_0x364923+0x1);this['_insertNodes'](_0x36e90e,_0x30f1c9,_0x589563),_0x21ce31=-0x1;}}}else{if(this['_isExistingContentComment'](_0x5a5576))_0x11d023=!0x0;else{if(this['_isExistingNode'](_0x5a5576)){const _0x447200=Xi(_0x5a5576,'data-id');if(_0x447200&&this['_existingDataIds']['has'](_0x447200)){this['_referencedExistingIds']['add'](_0x447200);const _0x14c234=Yi('data-id',_0x447200,_0xc1748b);this['_replaceNode'](_0x14c234,_0x5a5576);}}else{if(is(_0x5a5576)){const _0x14683a=ss(_0x5a5576);!!Yi('data-id',_0x14683a,_0x260cc6)||this['_touchedNodesState']['removedIds']['push'](_0x14683a);}}}}}for(const _0x19b860 of this['_touchedNodesState']['removedIds']){const _0xf61c95=Yi('data-id',_0x19b860,_0xc1748b);_0xf61c95&&(this['_rescueUnwrappedElements'](_0xf61c95),this['_removeNode'](_0xf61c95,_0x19b860,_0x39264c));}if($i('data-id','new-element',_0xc1748b)['forEach'](_0x354fc5=>{const _0x1c4ff6=this['_getUid'](_0x354fc5);zi(_0x354fc5,'data-id',_0x1c4ff6),this['_touchedNodesState']['newIds']['push'](_0x1c4ff6);}),this['_removeSpecialComments'](_0xc1748b),_0x39264c&&_0x39264c['cutAfterUnstable']){const _0x24a782=this['_findLastConfirmationPoint'](_0x21da7e),_0x5cf310=this['_getLastStableElement'](_0xc1748b,_0x24a782);this['_markUnstableElements'](_0xc1748b,_0x5cf310);}if(this['_processWrappedElements'](_0xc1748b,_0x39264c),_0x39264c&&_0x39264c['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x4a60bc=$i('data-id',this['_touchedNodesState']['lastTouchedId'],_0xc1748b);let _0x31b5e2=_0x4a60bc[_0x4a60bc['length']-0x1];for(;_0x31b5e2;)es(_0x31b5e2),_0x31b5e2=_0x31b5e2['parentNode'];}return{'parsedContent':_0xc1748b,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x1ab33c,_0x52578e,_0x3cf62b){for(const _0x314dd1 of _0x52578e){const _0x364dd2=this['_getUid'](_0x314dd1);zi(_0x314dd1,'data-id',_0x364dd2),this['_touchedNodesState']['newIds']['push'](_0x364dd2),this['_touchedNodesState']['lastTouchedId']=_0x364dd2;}const _0x387ed0='afterbegin'===_0x3cf62b||'afterend'===_0x3cf62b?_0x52578e['reverse']():_0x52578e;for(const _0x3f7eb7 of _0x387ed0)ji(_0x1ab33c,_0x3f7eb7,_0x3cf62b);}['_replaceNode'](_0x21f1f7,_0x50fdf3){if(!_0x21f1f7)return;if(_0x9bbd6a=_0x50fdf3,Zi(Ki(_0x21f1f7))===Zi(Ki(_0x9bbd6a)))return;var _0x9bbd6a;const _0x15efbd=Xi(_0x21f1f7,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x15efbd),this['_touchedNodesState']['lastTouchedId']=_0x15efbd,_0x40ab49(_0x21f1f7,_0x50fdf3['cloneNode'](!0x0));}['_removeNode'](_0x5058bc,_0x319567,_0x539cf0){if(_0x539cf0&&_0x539cf0['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x319567;const _0x53016c=_0x539cf0['replaceRemovedWith']['cloneNode'](!0x0);zi(_0x53016c,'data-id',_0x319567),zi(_0x53016c,'data-removed','true'),_0x40ab49(_0x5058bc,_0x53016c);}else _0x2cc5d2(_0x5058bc);}['_findReferenceNode'](_0x276eaa,_0x2db344,_0x4a52c6){const _0x1d5a1e=this['_findPrevElementWithDataId'](_0x276eaa,!0x1);if(_0x1d5a1e){const _0x41e8cc=ss(_0x1d5a1e),_0x1a71f7=Yi('data-id',_0x41e8cc,_0x4a52c6);if(_0x1a71f7)return[_0x1a71f7,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x41e8cc);}const _0x13163a=this['_findNextElementWithDataId'](_0x276eaa,!0x1);if(_0x13163a){const _0x1067f1=ss(_0x13163a),_0x36e770=Yi('data-id',_0x1067f1,_0x4a52c6);if(_0x36e770)return[_0x36e770,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x1067f1);}return _0x2db344?_0x276eaa['nextSibling']?this['_findFallbackReferenceNode'](_0x276eaa,_0x4a52c6):[_0x4a52c6['childNodes'][_0x4a52c6['childNodes']['length']-0x1],'afterend']:[_0x4a52c6['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x2e27be,_0x2fbdab){const _0x23beb2=[],_0x305df7=this['_findPrevElementWithDataId'](_0x2e27be,!0x0);if(_0x305df7){const _0x3a32d6=Yi('data-id',ss(_0x305df7),_0x2fbdab);_0x3a32d6&&_0x23beb2['push']([_0x3a32d6,'afterend']);}const _0x8b9f89=this['_findNextElementWithDataId'](_0x2e27be,!0x0);if(_0x8b9f89){const _0x42e327=Yi('data-id',ss(_0x8b9f89),_0x2fbdab);_0x42e327&&_0x23beb2['push']([_0x42e327,'beforebegin']);}if(_0x23beb2['length']>0x1)return ts(_0x23beb2[0x0][0x0])<=ts(_0x23beb2[0x1][0x0])?_0x23beb2[0x0]:_0x23beb2[0x1];return 0x1===_0x23beb2['length']?_0x23beb2[0x0]:[_0x2fbdab['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x49b075,_0x2c3c83){let _0x598062=_0x49b075['nextSibling'],_0x39da66=null,_0x15c912=!0x1;for(;_0x598062;){if(_0x58d07d(_0x598062)){if(is(_0x598062)&&(_0x39da66=_0x598062),this['_isExistingContentComment'](_0x598062)&&_0x2c3c83&&!_0x15c912){_0x15c912=!0x0,_0x598062=_0x598062['nextSibling'];continue;}break;}const _0x2be2c5=Xi(_0x598062,'data-id');if(_0x2be2c5&&'new-element'!==_0x2be2c5&&this['_existingDataIds']['has'](_0x2be2c5)){_0x39da66=_0x598062;break;}_0x598062=_0x598062['nextSibling'];}return _0x39da66;}['_findPrevElementWithDataId'](_0x38d313,_0x578a4c){let _0x5ba35b=_0x38d313['previousSibling'],_0x2a7f07=null,_0x2bad7b=!0x1;for(;_0x5ba35b;){if(_0x58d07d(_0x5ba35b)){if(is(_0x5ba35b)&&(_0x2a7f07=_0x5ba35b),this['_isExistingContentComment'](_0x5ba35b)&&_0x578a4c&&!_0x2bad7b){_0x2bad7b=!0x0,_0x5ba35b=_0x5ba35b['previousSibling'];continue;}break;}const _0x3a17af=Xi(_0x5ba35b,'data-id');if(_0x3a17af&&'new-element'!==_0x3a17af&&this['_existingDataIds']['has'](_0x3a17af)){_0x2a7f07=_0x5ba35b;break;}_0x5ba35b=_0x5ba35b['previousSibling'];}return _0x2a7f07;}['_markWrappedElements'](_0x433beb){_0x5b8d32(_0x433beb)&&$i('data-id',null,_0x433beb)['forEach'](_0x3f4008=>{this['_isExistingNode'](_0x3f4008)&&(zi(_0x3f4008,'data-wrapped-id',Xi(_0x3f4008,'data-id')),zi(_0x3f4008,'data-id',null));});}['_processWrappedElements'](_0x24826d,_0xde914b){$i('data-wrapped-id',null,_0x24826d)['forEach'](_0x4bdb5d=>{const _0x4b00e4=Xi(_0x4bdb5d,'data-wrapped-id');if(this['_hasUnstableParent'](_0x4bdb5d))return;const _0x262f0b=Yi('data-id',_0x4b00e4,_0x24826d);zi(_0x4bdb5d,'data-id',_0x4b00e4),_0x262f0b&&(this['_removeNode'](_0x262f0b,_0x4b00e4,_0xde914b),this['_touchedNodesState']['removedIds']['push'](_0x4b00e4),this['_touchedNodesState']['lastTouchedId']=_0x4b00e4);});}['_hasUnstableParent'](_0x48a760){let _0x3b84f8=_0x48a760['parentNode'];for(;_0x3b84f8;){if(Xi(_0x3b84f8,'data-unstable'))return!0x0;_0x3b84f8=_0x3b84f8['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0xbe474b){const _0x2defb6=new Set(this['_touchedNodesState']['removedIds']),_0x566e39=new Set(this['_touchedNodesState']['newIds']);$i('data-id',null,_0xbe474b)['forEach'](_0x103bd5=>{const _0x4d50ab=Xi(_0x103bd5,'data-id'),_0x46a501=!!_0x4d50ab&&this['_referencedExistingIds']['has'](_0x4d50ab),_0xe63462=!!_0x4d50ab&&_0x566e39['has'](_0x4d50ab);if(!_0x4d50ab||!_0x46a501&&!_0xe63462)return;if(_0x2defb6['has'](_0x4d50ab))return;let _0x1c2484=_0x103bd5['parentNode'],_0x4c11e2=!0x1;for(;_0x1c2484;){if(_0x1c2484===_0xbe474b){_0x4c11e2=!0x0;break;}const _0x1b7820=Xi(_0x1c2484,'data-id');if(_0x1b7820&&(this['_referencedExistingIds']['has'](_0x1b7820)||_0x566e39['has'](_0x1b7820)))return;_0x1c2484=_0x1c2484['parentNode'];}if(_0x4c11e2){if(_0x4f5ae8(_0xbe474b,_0x103bd5),_0x46a501){const _0x53c409=this['_generateUid'](),_0x3fc7ad=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x4d50ab);-0x1!==_0x3fc7ad&&this['_touchedNodesState']['modifiedIds']['splice'](_0x3fc7ad,0x1),zi(_0x103bd5,'data-unwrapped-id',_0x4d50ab),zi(_0x103bd5,'data-id',_0x53c409),this['_touchedNodesState']['newIds']['push'](_0x53c409),this['_touchedNodesState']['rescuedNewIds']['add'](_0x53c409),this['_touchedNodesState']['lastTouchedId']=_0x53c409;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x4d50ab),this['_touchedNodesState']['lastTouchedId']=_0x4d50ab;}});}['_getUid'](_0x52bb29){return this['_isExistingNode'](_0x52bb29)?Xi(_0x52bb29,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x3d048d){Qi(_0x3d048d)['filter'](_0x48b177=>is(_0x48b177)||this['_isExistingContentComment'](_0x48b177))['forEach'](_0x300c8d=>{_0x2cc5d2(_0x300c8d);});}['_findLastConfirmationPoint'](_0x51be70){let _0x4cd3aa=null,_0xf2dbf7=null,_0x359815=null,_0xb6d0bd=null;const _0x209215=_0xf671f6=>{_0xf671f6&&(_0x4cd3aa=_0xf671f6),_0x359815=null,_0xb6d0bd=null;};for(let _0x503b8f=0x0;_0x503b8f<_0x51be70['length'];_0x503b8f++){const _0x5e8463=_0x51be70[_0x503b8f];if(this['_isExistingContentComment'](_0x5e8463)){_0x209215(_0xf2dbf7);continue;}if(_0x5b8d32(_0x5e8463)){const _0x466c39=Xi(_0x5e8463,'data-id'),_0x294e3d=_0x503b8f===_0x51be70['length']-0x1;if(_0x466c39&&'new-element'!==_0x466c39&&this['_touchedNodesState']['modifiedIds']['includes'](_0x466c39)&&!_0x294e3d){_0x209215(_0x466c39),_0xf2dbf7=_0x466c39;continue;}}let _0x260c1c=null;const _0x2f7b17=ss(_0x5e8463);if(_0x2f7b17&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x2f7b17))_0xf2dbf7=_0x2f7b17;else{if(_0x2f7b17&&this['_touchedNodesState']['newIds']['includes'](_0x2f7b17))_0x260c1c='N';else{if(!is(_0x5e8463))continue;_0x260c1c='R';}_0x260c1c===_0xb6d0bd||null===_0xb6d0bd?_0xb6d0bd=_0x260c1c:null!==_0x359815?(_0x209215(_0xf2dbf7),_0xb6d0bd=_0x260c1c):(_0x359815=_0xb6d0bd,_0xb6d0bd=_0x260c1c),_0xf2dbf7=_0x2f7b17;}}const _0x4eac7d=_0x51be70[_0x51be70['length']-0x1];return _0x4eac7d&&!_0x5b8d32(_0x4eac7d)&&!is(_0x4eac7d)&&_0xf2dbf7&&_0x209215(_0xf2dbf7),_0x4cd3aa;}['_getLastStableElement'](_0x4ff1dc,_0x2dde44){if(!_0x2dde44)return null;const _0x5d2d1f=Yi('data-id',_0x2dde44,_0x4ff1dc);if(!_0x5d2d1f)return null;const _0x385a01=[_0x5d2d1f,...Ji(_0x5d2d1f)]['at'](-0x2);if(_0x385a01===_0x5d2d1f)return _0x5d2d1f;let _0x5a362b=_0x385a01['previousSibling'];for(;_0x5a362b&&!_0x5b8d32(_0x5a362b);)_0x5a362b=_0x5a362b['previousSibling'];return _0x5a362b;}['_markUnstableElements'](_0x417735,_0x45b370){const _0xb43ec0=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x5065d4=_0x45b370?_0x45b370['nextSibling']:_0x417735['firstChild'];for(;_0x5065d4;){_0x5b8d32(_0x5065d4)&&((_0xb43ec0['has'](Xi(_0x5065d4,'data-id'))||$i('data-id',null,_0x5065d4)['some'](_0x49d4e9=>_0xb43ec0['has'](Xi(_0x49d4e9,'data-id'))))&&zi(_0x5065d4,'data-unstable','true')),_0x5065d4=_0x5065d4['nextSibling'];}}['_isNewNode'](_0x4f1da3){return Boolean('new-element'===Xi(_0x4f1da3,'data-id'));}['_isExistingNode'](_0xbd02bf){return Boolean((Xi(_0xbd02bf,'data-id')||'')['length']>0x0&&'new-element'!==Xi(_0xbd02bf,'data-id'));}['_isExistingContentComment'](_0x2a3820){return Boolean(_0x58d07d(_0x2a3820)&&Ki(_0x2a3820)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function is(_0x10d77b){return!!_0x10d77b&&Boolean(_0x58d07d(_0x10d77b)&&Ki(_0x10d77b)['match'](/removed[\s*-]data-id="[^"]+"/));}function ss(_0x4bdc56){if(!_0x4bdc56)return null;if(_0x5b8d32(_0x4bdc56))return Xi(_0x4bdc56,'data-id')??null;if(_0x58d07d(_0x4bdc56)){const _0x174bf0=Ki(_0x4bdc56)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x174bf0&&_0x174bf0[0x1])return _0x174bf0[0x1];}return null;}function ns(_0x385745,_0x4f4054){const _0x2c4a71=new Map();for(const _0x4cd7a6 of qi(_0x385745))_0x2c4a71['set'](Xi(_0x4cd7a6,'data-id'),_0x4cd7a6);const _0x4305b3=new Set();for(const _0x25d3e1 of qi(_0x4f4054)){const _0x2893f8=Xi(_0x25d3e1,'data-id'),_0x3f5c3c=_0x2893f8?_0x2c4a71['get'](_0x2893f8):void 0x0;_0x3f5c3c?(_0x40ab49(_0x25d3e1,_0x1e46dd(_0x3f5c3c,!0x0)),_0x4305b3['add'](_0x2893f8)):_0x2cc5d2(_0x25d3e1);}for(const _0xefd503 of Qi(_0x4f4054))is(_0xefd503)&&_0x2c4a71['has'](ss(_0xefd503))&&_0x2cc5d2(_0xefd503);const _0xc53131=new Set($i('data-id',null,_0x4f4054)['map'](_0x5da0fe=>Xi(_0x5da0fe,'data-id')));for(const [_0x20f7b3,_0x1a1ed5]of _0x2c4a71){if(_0x4305b3['has'](_0x20f7b3))continue;let _0x93f8fa=_0x1a1ed5['parent'],_0x384e7f=null;for(;_0x93f8fa&&_0x5b8d32(_0x93f8fa);){const _0x36f666=Xi(_0x93f8fa,'data-id');if(_0x36f666&&_0xc53131['has'](_0x36f666)){_0x384e7f=_0x36f666;break;}_0x93f8fa=_0x93f8fa['parent'];}if(!_0x384e7f)continue;const _0x4e5af4=Yi('data-id',_0x384e7f,_0x4f4054);_0x4e5af4&&_0x587f40(_0x4e5af4,_0x1e46dd(_0x1a1ed5,!0x0));}}function rs({changeGroups:_0x557db6,documentContextContent:_0xa6b923,showDiff:_0x3d0b89,trimUnchanged:_0x1b3578=!0x0}){return _0x557db6['map'](_0x57f472=>{if('destroyed'===_0x57f472['editor']['state'])return null;const _0x519517=new _0x5346ad([]),_0x3df408=new _0x5346ad([]),_0x36c25a=new Set();for(const _0x216268 of _0x57f472['changes'])'new'==_0x216268['type']&&$i('data-id',null,_0x216268['node'])['forEach'](_0x390176=>{_0x36c25a['add'](Xi(_0x390176,'data-id'));});for(const _0xf6dbf4 of _0x57f472['changes'])if('removed'!=_0xf6dbf4['type']?_0x3df408['children']['push'](_0xf6dbf4['node']['cloneNode'](!0x0)):_0x3d0b89||_0x36c25a['has'](_0xf6dbf4['id'])||_0x3df408['children']['push'](_0xf6dbf4['node']['cloneNode'](!0x0)),'new'!=_0xf6dbf4['type']&&(_0x3d0b89||'removed'!=_0xf6dbf4['type'])){const _0x2b282f=_0x358753(_0x916197=>Xi(_0x916197,'data-id')==_0xf6dbf4['id'],_0xa6b923['get'](_0x57f472['documentId']),!0x0);_0x2b282f&&_0x519517['children']['push'](_0x2b282f['cloneNode'](!0x0));}const {content:_0x4a9d2b,hasChanges:_0x959a3c}=os(_0x57f472['editor'],_0x519517,_0x3df408,_0x3d0b89,_0x1b3578);return{'type':_0x57f472['changes'][0x0]['type'],'index':_0x57f472['index'],'content':_0x4a9d2b,'hasChanges':_0x959a3c};})['filter'](_0x52261b=>null!==_0x52261b);}function os(_0x234dfa,_0x47d98e,_0x59d11d,_0x185160,_0x3b9076=!0x0){const _0x6dfaa8=_0x234dfa['plugins']['get']('DocumentCompare'),_0x26862a=Ki(_0x47d98e),_0x37361a=Ki(_0x59d11d),_0x2c83a2=_0x234dfa['data']['parse'](_0x26862a,'$root'),_0x8fe94=_0x234dfa['model']['createPositionAt'](_0x2c83a2,0x0),_0x5d90c3=_0x6dfaa8['getDiff'](_0x26862a,_0x37361a,{'anchor':_0x8fe94,'markDeletions':_0x185160,'targetEditor':_0x234dfa})['getOperations']();if(0x0==_0x5d90c3['length'])return{'content':_0x47d98e['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x185160?function(_0x291928,_0x2b7c0f,_0x5b6280){if(0x0==_0x291928['length'])return;const _0x5e92d2=_0x5b6280['plugins']['get']('DocumentCompare'),_0x421e79=_0x5b6280['plugins']['get']('SuggestionsConversion');_0x5b6280['model']['change'](_0x37945a=>{const _0x76ae93=new Set();for(let _0x4d2c5c=0x0;_0x4d2c5c<_0x291928['length'];_0x4d2c5c++){const _0x1150b7=_0x291928[_0x4d2c5c];if(_0x1150b7['baseVersion']=null,_0x1150b7['isDocumentOperation']=!0x1,_0x5e92d2['isMarkedRemoveOperation'](_0x1150b7)){const _0x291737=_0x47170f(_0x1150b7['newRange'],_0x5b6280['model']),_0x320df8='suggestion:deletion:'+at()+':$aiSuggestion';_0x2b7c0f['markers']['set'](_0x320df8,_0x291737);}else switch(_0x1150b7['type']){case'rename':{if(_0x1150b7['oldName']==_0x1150b7['newName'])break;_0x37945a['batch']['addOperation'](_0x1150b7),_0x5b6280['model']['applyOperation'](_0x1150b7);const _0x3ed568='$elementName',_0x466488=_0x1150b7['position'],_0x496849=_0x5b6280['model']['createRange'](_0x466488,_0x5b6280['model']['createPositionAt'](_0x466488['nodeAfter'],'end')),_0x457336='suggestion:attribute:'+_0x3ed568+':'+at()+':$aiSuggestion';_0x2b7c0f['markers']['set'](_0x457336,_0x496849);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x1150b7['oldValue']==_0x1150b7['newValue'])break;_0x37945a['batch']['addOperation'](_0x1150b7),_0x5b6280['model']['applyOperation'](_0x1150b7);const _0x35dcf2=_0x1150b7['key'];if(!_0x421e79['isRegisteredAttribute'](_0x35dcf2))break;const _0x2e1362=_0x47170f(_0x1150b7['range'],_0x5b6280['model']),_0x51ff60='suggestion:attribute:'+_0x35dcf2+':'+at()+':$aiSuggestion';_0x2b7c0f['markers']['set'](_0x51ff60,_0x2e1362);break;}case'insert':{_0x37945a['batch']['addOperation'](_0x1150b7),_0x5b6280['model']['applyOperation'](_0x1150b7);if(_0x291928[_0x4d2c5c+0x1]&&'move'==_0x291928[_0x4d2c5c+0x1]['type']){as(_0x2b7c0f,_0x1150b7);break;}const _0x4bc0a3=_0x1150b7['position'],_0x417aa2=_0x1150b7['howMany'],_0x585613=_0x47170f(_0x5b6280['model']['createRange'](_0x4bc0a3,_0x4bc0a3['getShiftedBy'](_0x417aa2)),_0x5b6280['model']),_0x5408f8='suggestion:insertion:'+at()+':$aiSuggestion';_0x2b7c0f['markers']['set'](_0x5408f8,_0x585613);break;}case'split':{_0x37945a['batch']['addOperation'](_0x1150b7),_0x5b6280['model']['applyOperation'](_0x1150b7);const _0x3fba76=_0x1150b7['splitPosition'],_0x352384=_0x1150b7['moveTargetPosition'],_0x12e31c=_0x5b6280['model']['createRange'](_0x3fba76,_0x352384),_0x4fc26c='suggestion:insertion:'+at()+':$aiSuggestion';_0x2b7c0f['markers']['set'](_0x4fc26c,_0x12e31c);break;}case'move':{_0x37945a['batch']['addOperation'](_0x1150b7),_0x5b6280['model']['applyOperation'](_0x1150b7),_0x291928[_0x4d2c5c-0x1]&&'insert'==_0x291928[_0x4d2c5c-0x1]['type']&&as(_0x2b7c0f,_0x1150b7);const _0x460907=_0x1150b7['getMovedRangeStart'](),_0x4a8b4c=_0x1150b7['howMany'];for(let _0x4cbb7f=0x0;_0x4cbb7f<_0x4a8b4c;_0x4cbb7f++){const _0x4481cd=_0x460907['getShiftedBy'](_0x4cbb7f)['nodeAfter'];_0x76ae93['add'](_0x4481cd);}break;}case'remove':{const _0x42a7e7=_0x1150b7['sourcePosition'],_0x178229=_0x1150b7['howMany'],_0x182d40=new _0x62ec40(_0x42a7e7,_0x178229);_0x37945a['batch']['addOperation'](_0x182d40),_0x5b6280['model']['applyOperation'](_0x182d40);break;}}}for(const _0xeeb746 of _0x76ae93){const _0x4e5893=_0x5b6280['model']['createRangeOn'](_0xeeb746),_0x3ca370='suggestion:formatBlock:$fakeWrap:'+at()+':$aiSuggestion';_0x2b7c0f['markers']['set'](_0x3ca370,_0x47170f(_0x4e5893,_0x5b6280['model']));}});}(_0x5d90c3,_0x2c83a2,_0x234dfa):_0x234dfa['model']['change'](_0x519cb1=>{for(const _0x54f850 of _0x5d90c3)if('remove'==_0x54f850['type']){const _0x259642=_0x54f850['sourcePosition'],_0x2eccf1=_0x54f850['howMany'],_0x8e4379=new _0x62ec40(_0x259642,_0x2eccf1);_0x519cb1['batch']['addOperation'](_0x8e4379),_0x234dfa['model']['applyOperation'](_0x8e4379);}else{if('marker'==_0x54f850['type']){const _0x33aaf3=_0x54f850['name'],_0x2daeef=_0x54f850['newRange'];null!==_0x2daeef?_0x2c83a2['markers']['set'](_0x33aaf3,_0x2daeef):_0x2c83a2['markers']['delete'](_0x33aaf3);}else _0x54f850['baseVersion']=null,_0x54f850['isDocumentOperation']=!0x1,_0x519cb1['batch']['addOperation'](_0x54f850),_0x234dfa['model']['applyOperation'](_0x54f850);}}),_0x3b9076){const _0x4dcbdb=hs(_0x234dfa,_0x5d90c3,_0x2c83a2);ls(_0x234dfa['model'],_0x4dcbdb),function(_0x58bd1f,_0x3f8e1f){const _0x37bd54=_0x3f8e1f['getFirstRange']()['start'];let _0x1723ac=_0x3f8e1f['getFirstRange']()['end'];const _0x4c8a44=_0x37bd54['root'];(_0x1723ac['textNode']||_0x1723ac['nodeAfter']&&_0x1723ac['nodeAfter']['is']('$text'))&&(_0xc730dd(_0x1723ac,'...'),_0x1723ac=_0x1723ac['getShiftedBy'](0x3)),(_0x37bd54['textNode']||_0x37bd54['nodeBefore']&&_0x37bd54['nodeBefore']['is']('$text'))&&(_0xc730dd(_0x37bd54,'...'),function(_0x275f58,_0x3ebac0,_0x3a80fd){for(let [_0x5d2740,_0x4c1b5f]of _0x275f58['markers']){const _0x506566=_0x4c1b5f['_getTransformedByInsertion'](_0x3ebac0,_0x3a80fd,!0x1);_0x4c1b5f=_0x506566[0x0],_0x275f58['markers']['set'](_0x5d2740,_0x4c1b5f);}}(_0x4c8a44,_0x37bd54,0x3),_0x37bd54['parent']==_0x1723ac['parent']&&(_0x1723ac=_0x1723ac['getShiftedBy'](0x3)));const _0x3594f7=_0x58bd1f['createRange'](_0x58bd1f['createPositionAt'](_0x4c8a44,0x0),_0x37bd54),_0x544135=_0x58bd1f['createRange'](_0x1723ac,_0x58bd1f['createPositionAt'](_0x4c8a44,'end')),_0x39b2ee=[..._0x3594f7['getMinimalFlatRanges'](),..._0x544135['getMinimalFlatRanges']()];_0x39b2ee['reverse']();for(const _0x4a1a40 of _0x39b2ee)_0x129b18(_0x4a1a40),ds(_0x4c8a44,_0x4a1a40);}(_0x234dfa['model'],_0x4dcbdb);}return{'content':Wi(_0x234dfa['data']['stringify'](_0x2c83a2,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function as(_0x5aaf60,_0x1fdeae){for(const [_0x4c515c,_0x2caf37]of _0x5aaf60['markers']){const _0x436a77=_0x5c7233['_createFromRanges'](_0x2caf37['getTransformedByOperation'](_0x1fdeae));_0x5aaf60['markers']['set'](_0x4c515c,_0x436a77);}}function hs(_0x1dd95f,_0xa6169,_0x11ad0f){const _0x3106ac=_0x1dd95f['plugins']['get']('DocumentCompare');let _0x19924c=_0x1dd95f['model']['createPositionAt'](_0x11ad0f,Number['POSITIVE_INFINITY']),_0x1e7087=_0x1dd95f['model']['createPositionAt'](_0x11ad0f,0x0);for(const _0x6cee6a of _0xa6169){let _0x32e0bd,_0x309746;if(_0x3106ac['isMarkedRemoveOperation'](_0x6cee6a))_0x32e0bd=_0x6cee6a['newRange']['start'],_0x309746=_0x6cee6a['newRange']['end'];else switch(_0x19924c=cs(_0x19924c,_0x6cee6a),_0x1e7087=cs(_0x1e7087,_0x6cee6a),_0x6cee6a['type']){case'rename':_0x32e0bd=_0x6cee6a['position'],_0x309746=_0x32e0bd['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x32e0bd=_0x6cee6a['range']['start'],_0x309746=_0x6cee6a['range']['end'];break;case'insert':_0x32e0bd=_0x6cee6a['position'],_0x309746=_0x32e0bd['getShiftedBy'](_0x6cee6a['howMany']);break;case'split':_0x32e0bd=_0x6cee6a['splitPosition'],_0x309746=_0x6cee6a['moveTargetPosition'];break;case'merge':{const _0x56455b=_0x6cee6a['targetPosition']['path']['slice'](0x0,-0x1);_0x32e0bd=_0x1dd95f['model']['createPositionFromPath'](_0x11ad0f,_0x56455b),_0x309746=_0x32e0bd['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x46e4f5=_0x6cee6a['howMany'],_0x27eb25=_0x6cee6a['sourcePosition']['_getTransformedByInsertion'](_0x6cee6a['targetPosition'],_0x46e4f5),_0x35d4ec=_0x6cee6a['getMovedRangeStart']();'remove'==_0x6cee6a['type']?(_0x32e0bd=_0x27eb25,_0x309746=_0x27eb25):(_0x32e0bd=_0x35d4ec,_0x309746=_0x35d4ec['getShiftedBy'](_0x46e4f5));break;}}_0x32e0bd&&_0x32e0bd['isBefore'](_0x19924c)&&(_0x19924c=_0x32e0bd['clone'](),_0x19924c['stickiness']='toNone'),_0x309746&&_0x309746['isAfter'](_0x1e7087)&&(_0x1e7087=_0x309746['clone'](),_0x1e7087['stickiness']='toNone');}return _0x1dd95f['model']['createSelection'](_0x1dd95f['model']['createRange'](_0x19924c,_0x1e7087));}function cs(_0x23d74b,_0x13a97e){return'move'!=_0x13a97e['type']&&'remove'!=_0x13a97e['type']||_0x13a97e['sourceRange']['containsPosition'](_0x23d74b)&&((_0x23d74b=_0x13a97e['sourcePosition']['clone']())['stickiness']='toNone'),_0x23d74b['getTransformedByOperation'](_0x13a97e);}function ls(_0x417d91,_0x1b15f9){us(_0x417d91,_0x1b15f9,'forward');const _0x845439=_0x1b15f9['getFirstRange']();_0x1b15f9['setTo']([]),_0x1b15f9['setTo'](_0x845439,{'backward':!0x0}),us(_0x417d91,_0x1b15f9,'backward');}function us(_0x2e1501,_0x46e7a8,_0x1ddb98){let _0x1561e2=0x14;for(;_0x1561e2;){_0x2e1501['modifySelection'](_0x46e7a8,{'unit':'word','direction':_0x1ddb98}),_0x1561e2--;const _0x45fe0e=_0x46e7a8['focus']['forward'==_0x1ddb98?'nodeBefore':'nodeAfter'];if(_0x45fe0e&&_0x45fe0e['is']('element')&&_0x2e1501['schema']['isBlock'](_0x45fe0e)&&_0x2e1501['schema']['isObject'](_0x45fe0e))break;}}function ds(_0x37b749,_0x572e9d){for(const [_0x18e67f,_0x3b9c0e]of _0x37b749['markers']){const _0x279f08=_0x3b9c0e['_getTransformedByDeletion'](_0x572e9d['start'],_0x572e9d['end']['offset']-_0x572e9d['start']['offset']);null!=_0x279f08?_0x37b749['markers']['set'](_0x18e67f,_0x279f08):_0x37b749['markers']['delete'](_0x18e67f);}}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:_0x20ae10,isDone:_0x2a1fb7=!0x1,isComplete:_0x3138a4,interactionId:_0xfa828c,areActionsDisabled:_0x4dbbc8,isFromHistory:_0x53ef18=!0x1,documentContextContent:_0x12c736,locale:_0x367820,id:_0x1d55de,channelsToEditors:_0x130c28}){super(),this['id']=_0x1d55de||at(),this['interactionId']=_0xfa828c,this['type']=_0x20ae10,this['areActionsDisabled']=!!_0x4dbbc8,this['isFromHistory']=_0x53ef18,this['locale']=_0x367820,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=new Map(_0x12c736?.['map'](_0x3e8048=>[_0x3e8048['id'],Wi(_0x3e8048['content'])])||[]),this['_documentIdToSource']=new Map(_0x12c736?.['map'](_0x370207=>[_0x370207['id'],{'editor':_0x130c28['get'](_0x370207['channelId']),'rootName':_0x370207['rootName']}])||[]),this['set']('isDone',_0x2a1fb7),this['set']('isComplete',_0x3138a4??_0x2a1fb7),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x451762,_0x53336a){const _0x2bd1c3='text'===this['type']?'text':_0x53336a;this['content']['has'](_0x2bd1c3)||this['content']['set'](_0x2bd1c3,''),this['content']['set'](_0x2bd1c3,this['content']['get'](_0x2bd1c3)+_0x451762),this['onContentChange'](_0x2bd1c3);}['done'](_0x47a217=!0x0){this['isComplete']=_0x47a217,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x1cf667,_0x4a70e5){this['changeGroups'][_0x1cf667]['state']=_0x4a70e5,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x1cf667,'state':_0x4a70e5});}['getContentParts']({showDiff:_0x10f02e,groupIndex:_0x53426d}){const _0x91f679=this['_getCachedContentParts'](_0x10f02e,_0x53426d);if(_0x91f679)return _0x91f679;let _0x5db06d=[];if(void 0x0===_0x53426d)_0x5db06d=this['changeGroups'];else{const _0x1b64db=this['changeGroups']['find'](({index:_0x361fe4})=>_0x361fe4===_0x53426d);if(!_0x1b64db)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x53426d});_0x5db06d=[_0x1b64db];}const _0x4b3e2e=rs({'showDiff':_0x10f02e,'changeGroups':_0x5db06d,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x10f02e,_0x4b3e2e),_0x4b3e2e;}['_getCachedContentParts'](_0x3f6ab5,_0x1da7e8){const _0xcae078=_0x3f6ab5?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0xcae078]['length'])return null;const _0x447b58=this['cachedSuggestionContentParts'][_0xcae078];if(void 0x0===_0x1da7e8)return _0x447b58['length']>0x0&&_0x447b58['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x3f6ab5,null),null):_0x442b5e(_0x447b58);{const _0x17695f=_0x447b58['find'](({index:_0x17443a})=>_0x17443a===_0x1da7e8);if(_0x17695f)return[_0x442b5e(_0x17695f)];}return null;}['_setCachedContentParts'](_0x16b0a6,_0x5c3759){const _0x251ae0=_0x16b0a6?'withDiff':'withoutDiff';_0x5c3759?_0x5c3759['forEach'](_0x2806d9=>{const _0x4504c9=this['cachedSuggestionContentParts'][_0x251ae0],_0x13f70b=_0x4504c9['find'](({index:_0x4b07aa})=>_0x4b07aa===_0x2806d9['index']);if(_0x13f70b){const _0x3680ae=_0x4504c9['indexOf'](_0x13f70b);_0x4504c9['splice'](_0x3680ae,0x1,_0x2806d9);}else _0x4504c9['push'](_0x2806d9);}):this['cachedSuggestionContentParts'][_0x251ae0]['length']=0x0;}['onContentChange'](_0x484d3b){if('modification'===this['type']){if(_0x484d3b)this['parsedContent']['set'](_0x484d3b,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x484d3b)));else{for(const [_0x1d21ea,_0x41d953]of this['content'])this['parsedContent']['set'](_0x1d21ea,this['aiResponseParser']['parseAndNormalizeHTML'](_0x41d953));}const _0xfcb16b=this['changeGroups'];for(const _0x4ae273 of this['content']['keys']())this['updateChangeGroups'](_0x4ae273);const _0x38968d=this['_getDifferentChangeGroups'](_0xfcb16b,this['changeGroups']);(_0x38968d['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x38968d),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'](_0x4e8200,_0x266b11){const _0x138a61=[];for(const _0x1cebe8 of _0x266b11){const _0x11b1a7=_0x4e8200[_0x1cebe8['index']];_0x11b1a7?_0x11b1a7['changes']['length']!==_0x1cebe8['changes']['length']?_0x138a61['push'](_0x1cebe8):_0x11b1a7['changes']['forEach']((_0x26e8b4,_0x85ca33)=>{const _0x12b7d0=_0x1cebe8['changes'][_0x85ca33];_0x26e8b4['id']!==_0x12b7d0['id']&&_0x138a61['push'](_0x1cebe8);}):_0x138a61['push'](_0x1cebe8);}return _0x138a61;}['updateChangeGroups'](_0x3fc94a){const _0x4c9218=this['documentContextContent']['get'](_0x3fc94a),_0x20070e=this['parsedContent']['get'](_0x3fc94a);if(!_0x4c9218||!_0x20070e)return;const _0x438dd7=new _0x303c52('p',{},[new _0x303c52('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x20e1cd(Mi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x45554a=this['aiResponseApplier']['merge'](_0x20070e,_0x4c9218['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x438dd7});this['parsedMergedContent']['set'](_0x3fc94a,_0x45554a['parsedContent']);let _0x161787=[];if(_0x2a5945(_0x45b3a3=>{const _0x3a1557=Xi(_0x45b3a3,'data-id');if(!_0x3a1557||!_0x1faf65(_0x3a1557))return!0x1;const _0x23f779=[_0x45b3a3,...Ji(_0x45b3a3)]['at'](-0x2);if(_0x45b3a3!=_0x23f779){const _0xda9522=Xi(_0x23f779,'data-id');_0x1faf65(_0xda9522)||(_0x161787['push']({'node':_0x23f779,'id':_0xda9522,'type':'modified'}),_0x45554a['modifiedNodeIds']['push'](_0xda9522));}else _0x45554a['modifiedNodeIds']['includes'](_0x3a1557)?_0x161787['push']({'node':_0x45b3a3,'type':'modified','id':_0x3a1557}):_0x45554a['newNodeIds']['includes'](_0x3a1557)?_0x161787['push']({'node':_0x45b3a3,'type':'new','id':_0x3a1557,'anchorId':Xi(_0x45b3a3['previousSibling'],'data-id')}):_0x161787['push']({'node':_0x45b3a3,'type':'removed','id':_0x3a1557});return!0x0;},this['parsedMergedContent']['get'](_0x3fc94a)),_0x161787=_0x161787['filter'](({node:_0x5136ee})=>[...Ji(_0x5136ee),_0x5136ee]['every'](_0x2e2eba=>!Xi(_0x2e2eba,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0xe634a2=>_0xe634a2['documentId']!==_0x3fc94a),0x0==_0x161787['length'])return;const _0x58d74f=[[_0x161787[0x0]]];for(let _0x5c60b2=0x1;_0x5c60b2<_0x161787['length'];_0x5c60b2++){const _0x1c78e8=_0x58d74f[_0x58d74f['length']-0x1],_0x1d48c9=_0x1c78e8[_0x1c78e8['length']-0x1];_0x161787[_0x5c60b2]['node']['previousSibling']==_0x1d48c9['node']&&'modified'!=_0x161787[_0x5c60b2]['type']&&'modified'!=_0x1d48c9['type']?_0x1c78e8['push'](_0x161787[_0x5c60b2]):_0x58d74f['push']([_0x161787[_0x5c60b2]]);}for(const _0x157d24 of _0x58d74f){const _0x40fb7b=_0x157d24[0x0],_0x2cb6a9=_0x157d24[_0x157d24['length']-0x1],_0x26df54=_0x1b37dd(_0x40fb7b['node']['previousSibling']);_0x26df54&&_0x157d24['unshift'](_0x26df54);const _0x4868cf=_0x1b37dd(_0x2cb6a9['node']['nextSibling']);_0x4868cf&&_0x157d24['push'](_0x4868cf);}$i('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x3fc94a))['forEach'](_0x3dd812=>{zi(_0x3dd812,'data-wrapped-id',null);});const _0x23c68d=new Map();$i('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x3fc94a))['forEach'](_0x161b09=>{const _0xd9f188=Xi(_0x161b09,'data-unwrapped-id'),_0x3702d8=Xi(_0x161b09,'data-id');_0x23c68d['set'](_0x3702d8,_0xd9f188),zi(_0x161b09,'data-id',_0xd9f188),zi(_0x161b09,'data-unwrapped-id',null);});for(const _0x1eeee5 of _0x161787){const _0x594b9b=_0x23c68d['get'](_0x1eeee5['id']);_0x594b9b&&(_0x1eeee5['id']=_0x594b9b);}this['changeGroups']['push'](..._0x58d74f['map']((_0x59c6ea,_0x3ee3f4)=>({'changes':_0x59c6ea,'state':'pending','index':_0x3ee3f4,'editor':this['_documentIdToSource']['get'](_0x3fc94a)['editor'],'rootName':this['_documentIdToSource']['get'](_0x3fc94a)['rootName'],'documentId':_0x3fc94a})));const _0x4859b4=Array['from'](this['documentContextContent']['keys']());function _0x1faf65(_0x47cb79){return _0x45554a['modifiedNodeIds']['includes'](_0x47cb79)||_0x45554a['newNodeIds']['includes'](_0x47cb79)||_0x45554a['removedNodeIds']['includes'](_0x47cb79);}function _0x1b37dd(_0x583183){if(_0x583183&&Xi(_0x583183,'data-id')&&!Xi(_0x583183,'data-unstable')){const _0x4305c6=Xi(_0x583183,'data-id');if(!_0x1faf65(_0x4305c6))return{'node':_0x583183,'type':'context','id':_0x4305c6};}return null;}this['changeGroups']['sort']((_0x3fc320,_0xb6d380)=>_0x4859b4['indexOf'](_0x3fc320['documentId'])-_0x4859b4['indexOf'](_0xb6d380['documentId'])),this['changeGroups']['forEach']((_0x10ffdb,_0x2d4cbe)=>{_0x10ffdb['index']=_0x2d4cbe;});}}const _s=['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:_0x7da02e,locale:_0x4dd4f2,channelsToEditors:_0xe2e3c3}){super(),this['id']=at(),this['connector']=_0x7da02e,this['isStopped']=!0x0,this['locale']=_0x4dd4f2,this['_channelsToEditors']=_0xe2e3c3||new Map();}async['start'](){await this['_run']();}async['resume'](_0x139382){await this['_run'](_0x139382);}async['_run'](_0x421a7e){const _0x6181a3=[];let _0x3f72da,_0x5a1847,_0xb2e831,_0x390fb1=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x421a7e||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x1f82d6=await this['currentRequest']['getStream']();for await(const _0x4e86bc of _0x1f82d6){if(this['isStopped'])return;if('error'==_0x4e86bc['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x4e86bc['event']){case'message-metadata':this['messageId']=_0x4e86bc['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x4e86bc['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x4e86bc['data']['conversationTitle'],!0x0);break;case'source':_0x6181a3['push'](_0x4e86bc['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'](),_0x3f72da='modification-delta'==_0x4e86bc['event']?'modification':'text',_0x5a1847='modification-delta'==_0x4e86bc['event']?_0x4e86bc['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x3f72da&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x3f72da,'interactionId':this['id'],'id':_0x5a1847,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x4e86bc['event']&&{'documentId':_0x4e86bc['data']['documentId']}}),'modification'==_0x3f72da&&(this['currentReply']['sources']=_0x6181a3['splice'](0x0))),this['currentReply']['appendContent'](_0x4e86bc['data']['textDelta'],_0x4e86bc['data']['documentId']);break;case'mcp-tool-result':_0xb2e831=JSON['parse'](_0x4e86bc['data']['result']),this['_handleToolResultData']({'toolName':_0x4e86bc['data']['toolName'],'data':_0xb2e831['data'],'attributes':_0xb2e831['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x4e86bc['data']['toolName'],'data':_0x4e86bc['data']['data']});}}_0x390fb1=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x6181a3['length']>0x0&&(this['currentReply']['sources']=_0x6181a3['splice'](0x0)),this['_finalizeInteraction'](_0x390fb1),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x452c55){return this['replies']['find'](_0x38d435=>_0x38d435['id']===_0x452c55);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x326ca8=>_0x326ca8['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0xef0332){const _0x38f5dc=this['getDocumentContext'](),_0x38bd03=new AIReply({'locale':this['locale'],'documentContextContent':_0x38f5dc?.['documents'],..._0xef0332});return this['replies']['push'](_0x38bd03),_0x38bd03['delegate'](..._s)['to'](this),this['fire']('replyCreated',_0x38bd03),_0x38bd03;}['setConversationTitle'](_0x127059,_0x19333e=!0x1){this['fire']('setConversationTitle',_0x127059,_0x19333e);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x417511){this['fire']('toolDataReceived',{'type':'result','toolName':_0x417511['toolName'],'data':structuredClone(_0x417511['data']||{}),'attributes':structuredClone(_0x417511['attributes']||{})},this);}['_handleToolNotificationData'](_0x1f44e1){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x1f44e1['toolName'],'data':structuredClone(_0x1f44e1['data'])},this);}['_finalizeInteraction'](_0x5dba7f=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x5dba7f),this['currentRequest']=this['currentReply']=void 0x0;}}const Is=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']]),As=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ct(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x36d52b,config:_0x1d77d7,ownerId:_0x151193}){super(),this['_connector']=_0x36d52b,this['_config']=_0x1d77d7,this['_ownerId']=_0x151193;}['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'](_0x17413d){const _0x28b627=await this['_createContextItemFromContent'](_0x17413d);return this['_addToConversationContextItem'](_0x28b627),'current-document'===_0x28b627['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x28b627;}async['populateDocumentsFromMessage'](_0x5f39a7,_0x2cc293){const _0x5382e8=_0x5f39a7['filter'](_0x27d4d2=>'document'===_0x27d4d2['type']);if(0x0===_0x5382e8['length'])return{'hasUnmatched':!0x1};const _0x5e7337=_0x5382e8['map'](_0x480603=>_0x480603['id']),_0x371625=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x5e7337)['getDocuments'](),_0x1d7cc9=new Map(_0x371625['map'](_0x9a26d4=>[_0x9a26d4['id'],_0x9a26d4])),_0x1659c6=[];let _0x5ed240=!0x1;for(const _0x56a7dd of _0x5382e8){const _0x16c760=_0x1d7cc9['get'](_0x56a7dd['id']);_0x16c760&&(this['_matchDocumentToRoot'](_0x16c760,_0x2cc293)||(_0x5ed240=!0x0),_0x1659c6['push']({'id':_0x16c760['id'],'content':_0x16c760['content'],'version':_0x16c760['attributes']?.['version']??0x0,'sessionId':_0x16c760['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x16c760['attributes']?.['channelId']??_0x2cc293[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x16c760['attributes']?.['rootName']??_0x2cc293[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x1111c8={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x1659c6};return this['_addToConversationContextItem'](_0x1111c8),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x1111c8,'hasUnmatched':_0x5ed240};}['_matchDocumentToRoot'](_0x437530,_0x592fbe){const _0x55bc4f=_0x437530['attributes']?.['channelId'],_0x1a5d24=_0x437530['attributes']?.['rootName'];if(_0x55bc4f&&_0x1a5d24){for(const _0x371633 of _0x592fbe)if(_0x371633['config']['get']('collaboration.channelId')===_0x55bc4f){for(const _0x26a9bb of _0x371633['model']['document']['getRoots']())if('$graveyard'!==_0x26a9bb['rootName']&&_0x26a9bb['rootName']===_0x1a5d24)return{'editor':_0x371633,'rootName':_0x26a9bb['rootName']};}}}async['_createContextItemFromContent'](_0x25cdec){if('document'===_0x25cdec['type']){const _0x50b57d=await this['_connector']['fetchDocument'](this['_ownerId'],_0x25cdec['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x25cdec['type'],'content':_0x50b57d['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x50b57d['attributes']?.['version'],'sessionId':_0x50b57d['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x25cdec['type'])return{'id':_0x25cdec['id'],'uiId':_0x25cdec['id'],'label':_0x25cdec['data']?.['label']||_0x25cdec['id'],'type':'mcp-tool-context','mcpServerName':_0x25cdec['mcpServerName'],'toolName':_0x25cdec['toolName'],'data':_0x25cdec['data']||{}};return{'id':_0x25cdec['id'],'uiId':_0x25cdec['id'],'label':_0x25cdec['attributes']?.['label']||_0x25cdec['name']||_0x25cdec['url']||_0x25cdec['id'],'type':_0x25cdec['type'],..._0x25cdec?.['attributes']?.['resourceId']?{'resourceId':_0x25cdec['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x28c0cc){const _0x5c6368=this['_pendingContextItems']['get'](_0x28c0cc);_0x5c6368?.['isReadOnly']||this['_removeContextItem'](_0x28c0cc);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x113cd8 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x113cd8['uiId']);const _0x267646=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x267646&&this['_addContextItem']({..._0x267646,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x28f0f3){for(const _0x215a91 of _0x28f0f3['values']())this['_addToConversationContextItem'](_0x215a91);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'](_0x8ee05a){return Array['from'](_0x8ee05a['values']())['flatMap'](_0x3679f9=>this['_mapContextItemToRequestData'](_0x3679f9));}async['addFilesToContext'](_0x138bea,_0x59ec84,_0x2d55e1='file'){const _0x28f380='files-'+at();this['_startUploadOperation'](_0x28f380);try{await Promise['all'](_0x138bea['map'](async _0x4f3e40=>{const _0x360478='file-'+at(),_0x294899=_0x39c4f6(_0x4f3e40['name']),_0x2173e4='file'===_0x2d55e1&&_0x4f3e40['type']['startsWith']('image/')?'image':_0x2d55e1;try{this['_addContextItem']({'type':_0x2173e4,'label':_0x59ec84?.['label']||_0x294899,'uiId':_0x360478,'resourceId':_0x59ec84?.['resourceId']},!0x0);const _0x24b523=this['_connector']['uploadFile'](this['_ownerId'],_0x4f3e40,_0x59ec84);this['_ongoingUploads']['set'](_0x360478,_0x24b523['abortController']);const {id:_0x4293f9}=await _0x24b523['getId']();this['_ongoingUploads']['delete'](_0x360478),this['_finishContextItemLoading']({'type':_0x2173e4,'id':_0x4293f9,'label':_0x59ec84?.['label']||_0x294899,'uiId':_0x360478,'resourceId':_0x59ec84?.['resourceId']},!0x1);}catch(_0x1648a1){this['_ongoingUploads']['delete'](_0x360478);if(!(_0x1648a1 instanceof ht&&_0x1648a1['message']['startsWith']('ai-request-aborted'))){const _0x40f75c=Is['get'](_0x1648a1['code'])||'ai-chat-file-upload-failed',_0x3a35c2=new ht(_0x40f75c,null,{'fileName':_0x294899,..._0x1648a1});_0x3a35c2['stack']=_0x1648a1['stack'],this['fire']('error',{'error':_0x3a35c2});}this['_removeContextItem'](_0x360478);}}));}finally{this['_finishUploadOperation'](_0x28f380);}}['addCurrentDocumentToContext'](_0x5a1155){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0xc5ba5e={'type':'document','uiId':'current-document','label':_0x5a1155,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0xc5ba5e);}async['updateCurrentDocuments'](_0x29f397){const _0x253192=this['_pendingContextItems']['get']('current-document');if(!_0x253192||!_0x29f397['length']||_0x29f397['every'](_0x4d1c36=>!_0x4d1c36['content']))return;_0x29f397['length']>0x1&&_0x29f397['some'](_0xa1456=>!_0xa1456['description'])&&wt('ai-chat-documents-missing-description');try{const _0x32a285=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x29f397)['getIds']();if(_0x32a285['length']!==_0x29f397['length']||_0x32a285['some'](_0x4972d6=>!_0x4972d6?.['id'])){const _0x2aca79=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x2aca79});}_0x253192['documents']=_0x29f397['map']((_0x57f4a1,_0x30e8df)=>{return{'id':_0x32a285[_0x30e8df]['id'],'content':_0x57f4a1['content'],'version':_0x57f4a1['version'],'sessionId':_0x57f4a1['sessionId'],'selection':(_0xa2a353=_0x57f4a1['selections'],_0xa2a353?_0xa2a353['map'](_0x1383e2=>({'start':_0x1383e2['start'],'end':_0x1383e2['end']})):[]),'channelId':_0x57f4a1['channelId'],'rootName':_0x57f4a1['rootName']};var _0xa2a353;});}catch(_0x264b24){const _0x2fdf1a=new ht('ai-chat-document-upload-failed',null);_0x2fdf1a['stack']=_0x264b24['stack'],this['fire']('error',{'error':_0x2fdf1a});}}['addSelectionToContext'](_0x164a4c){this['_addContextItem']({'type':'selection','label':_0x164a4c,'uiId':'selection','content':_0x164a4c});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x8c4310,_0x1b6ffc){const _0x1feb82='url-'+at();this['_startUploadOperation'](_0x1feb82);const _0xa74359='url-'+at();try{this['_addContextItem']({'type':'web-resource','label':_0x1b6ffc?.['label']||_0x8c4310,'uiId':_0xa74359,'resourceId':_0x1b6ffc?.['resourceId']},!0x0);const _0x3366f3=this['_connector']['uploadUrl'](this['_ownerId'],_0x8c4310,_0x1b6ffc);this['_ongoingUploads']['set'](_0xa74359,_0x3366f3['abortController']);const {id:_0x522004}=await _0x3366f3['getId']();this['_ongoingUploads']['delete'](_0xa74359),this['_finishContextItemLoading']({'type':'web-resource','id':_0x522004,'label':_0x1b6ffc?.['label']||_0x8c4310,'uiId':_0xa74359,'resourceId':_0x1b6ffc?.['resourceId']},!0x1);}catch(_0x3515dd){this['_ongoingUploads']['delete'](_0xa74359),(_0x3515dd['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x8c4310,'originalError':_0x3515dd}),'url':_0x8c4310}),this['_removeContextItem'](_0xa74359));}finally{this['_finishUploadOperation'](_0x1feb82);}}['addToolItemToContext'](_0x57a830){_0x57a830['id']=_0x57a830['id']??at()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x57a830['uiId'],_0x57a830),this['fire']('contextItemAdded',{'contextItem':_0x57a830,'isLoading':!0x1});}async['loadSourceResources'](_0x327391,_0x2315d9,_0x2b1a78){const _0x5cc92b=this['_addContextOptionsState']['sources']['find'](_0x3049ca=>_0x3049ca['id']===_0x327391);if(!_0x5cc92b)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x327391}),'sourceId':_0x327391}),[];try{const _0x1347a4=(await _0x5cc92b['getResources'](_0x2315d9))['map'](_0x3579cb=>{const _0x193ff2=this['_isResourceInContext'](_0x3579cb['id']);return{..._0x3579cb,'isInContext':_0x193ff2};});return _0x5cc92b['resources']=_0x1347a4,this['fire']('sourceResourcesLoaded',{'sourceId':_0x327391,'source':_0x5cc92b,'resources':_0x1347a4,'uid':_0x2b1a78}),_0x1347a4;}catch(_0x322283){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x327391,'originalError':_0x322283}),'sourceId':_0x327391,'sourceLabel':_0x5cc92b['label']}),[];}}async['addResourceToContext'](_0x563bd0,_0x58dc57){if(this['_isResourceInContext'](_0x58dc57['id']))return;let _0x27330d=_0x58dc57['data'];if(!_0x27330d&&_0x563bd0['getData'])try{_0x27330d=await _0x563bd0['getData'](_0x58dc57['id']);}catch(_0x25ea07){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id'],'originalError':_0x25ea07}),'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id']});}if(_0x27330d)switch(_0x58dc57['type']){case'web-resource':if('string'!=typeof _0x27330d)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id'],'expectedType':'string','actualType':typeof _0x27330d}),'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id']});await this['addUrlToContext'](_0x27330d,{'label':_0x58dc57['label'],'resourceId':_0x58dc57['id']});break;case'file':if(!(_0x27330d instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id'],'expectedType':'File','actualType':typeof _0x27330d}),'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id']});await this['addFilesToContext']([_0x27330d],{'label':_0x58dc57['label'],'resourceId':_0x58dc57['id']});break;case'text':if('object'!=typeof _0x27330d||!('content'in _0x27330d)||!('type'in _0x27330d))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x27330d}),'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id']});_0x27330d=AIChatContext['_convertTextResourceToFile'](_0x27330d,_0x58dc57['label']),await this['addFilesToContext']([_0x27330d],{'label':_0x58dc57['label'],'resourceId':_0x58dc57['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id'],'resourceType':_0x58dc57['type']}),'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id']}),'resourceId':_0x58dc57['id'],'sourceId':_0x563bd0['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x3615de){if(void 0x0!==_0x3615de)this['_addContextOptionsState']['document']['isHidden']=!_0x3615de;else{const _0x1b715f=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x1b715f;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x5b0aab,_0x2d6d63){switch(_0x5b0aab['type']){case'markdown':return new File([_0x5b0aab['content']],_0x2d6d63,{'type':'text/markdown'});case'html':return new File([_0x5b0aab['content']],_0x2d6d63,{'type':'text/html'});default:return new File([_0x5b0aab['content']],_0x2d6d63,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x391423){switch(_0x391423['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x391423['id']}];case'web-resource':return[{'type':'web-resource','id':_0x391423['id']}];case'document':return _0x391423['documents']?.['length']?_0x391423['documents']['map'](_0x1e29e6=>({'type':'document','id':_0x1e29e6['id'],..._0x1e29e6['selection']?.['length']&&{'selection':_0x1e29e6['selection']}})):[{'type':'document','id':_0x391423['id'],..._0x391423['selection']?.['length']&&{'selection':_0x391423['selection']}}];case'mcp-tool-context':{const _0xe12a23=_0x391423;return[{'type':'mcp-tool-context','mcpServerName':_0xe12a23['mcpServerName'],'toolName':_0xe12a23['toolName'],'data':{..._0xe12a23['data'],'label':_0xe12a23['label']||_0xe12a23['data']?.['label']||_0xe12a23['id']},'id':_0xe12a23['id']}];}default:return[];}}['_addContextItem'](_0x135a1d,_0x1b2169=!0x1){if(this['_pendingContextItems']['set'](_0x135a1d['uiId'],_0x135a1d),_0x135a1d['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x135a1d,'isLoading':_0x1b2169}),'current-document'===_0x135a1d['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x135a1d['resourceId']){const _0x53cfd3=this['_findSourceIdsByResourceId'](_0x135a1d['resourceId']);_0x53cfd3&&_0x53cfd3['forEach'](_0x2a4520=>{this['_updateResourceInContextState'](_0x2a4520,_0x135a1d['resourceId'],!0x0);});}}['_removeContextItem'](_0x492ec8){const _0x571fd4=this['_pendingContextItems']['get'](_0x492ec8),_0x20ded1=this['_ongoingUploads']['get'](_0x492ec8);if(_0x20ded1&&(_0x20ded1['abort'](),this['_ongoingUploads']['delete'](_0x492ec8)),_0x571fd4?.['resourceId']){const _0x2c2546=this['_findSourceIdsByResourceId'](_0x571fd4['resourceId']);_0x2c2546&&_0x2c2546['forEach'](_0x266015=>{this['_updateResourceInContextState'](_0x266015,_0x571fd4['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x492ec8),this['fire']('contextItemRemoved',{'uiId':_0x492ec8,'type':_0x571fd4?.['type']}),'current-document'===_0x492ec8&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x4f3f63,_0x58aa3b){if(this['_pendingContextItems']['has'](_0x4f3f63['uiId'])&&(this['_pendingContextItems']['set'](_0x4f3f63['uiId'],_0x4f3f63),this['fire']('contextItemLoadingEnded',{'contextItem':_0x4f3f63,'isLoading':_0x58aa3b}),_0x4f3f63['resourceId'])){const _0x4d1125=this['_findSourceIdsByResourceId'](_0x4f3f63['resourceId']);_0x4d1125&&_0x4d1125['forEach'](_0x5e82fe=>{this['_updateResourceInContextState'](_0x5e82fe,_0x4f3f63['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x31951c){this['_conversationContextItems']['set'](_0x31951c['uiId'],_0x31951c);}['_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'](_0x9a1026=>({..._0x9a1026,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x443f87=>({..._0x443f87,'resources':[]}))??[];}['_isResourceInContext'](_0x12a980){for(const _0x1f2f04 of this['_pendingContextItems']['values']())if(_0x1f2f04['resourceId']===_0x12a980)return!0x0;for(const _0x1339e3 of this['_conversationContextItems']['values']())if(_0x1339e3['resourceId']===_0x12a980)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x4959b7){const _0x3c02b8=[];for(const _0x2e2737 of this['_addContextOptionsState']['sources']){_0x2e2737['resources']['find'](_0x4f82f1=>_0x4f82f1['id']===_0x4959b7)&&_0x3c02b8['push'](_0x2e2737['id']);}return 0x0===_0x3c02b8['length']?null:_0x3c02b8;}['_updateResourceInContextState'](_0x3077c8,_0x517a4f,_0xbee7e8){const _0x150260=this['_addContextOptionsState']['sources']['find'](_0x4fe847=>_0x4fe847['id']===_0x3077c8);if(!_0x150260)return;const _0x334a6d=_0x150260['resources']['find'](_0x19b835=>_0x19b835['id']===_0x517a4f);_0x334a6d&&(_0x334a6d['isInContext']=_0xbee7e8,this['fire']('resourceStateChanged',{'sourceId':_0x3077c8,'resourceId':_0x517a4f,'isInContext':_0xbee7e8}));}['_startUploadOperation'](_0x53a4ed){this['_ongoingUploadOperations']['set'](_0x53a4ed,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x340da2){this['_ongoingUploadOperations']['delete'](_0x340da2),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const gs=['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'](_0x33bd71){const _0x362ca9={};return _0x33bd71&&_0x33bd71['isWebSearchEnabled']&&(_0x362ca9['webSearch']={}),_0x33bd71&&_0x33bd71['isReasoningEnabled']&&(_0x362ca9['reasoning']={}),_0x362ca9;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x5603aa){_0x5603aa!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x5603aa,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x270fe5){_0x270fe5!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x270fe5,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x2d2517){super(_0x2d2517),this['conversationId']=_0x2d2517['conversationId'],this['contextItems']=_0x2d2517['contextItems'],this['capabilities']=_0x2d2517['capabilities'],this['userMessage']=_0x2d2517['userMessage'],this['model']=_0x2d2517['model'],this['attributes']=_0x2d2517['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(_0x51ae6b){super(),this['options']=_0x51ae6b,this['connector']=_0x51ae6b['connector'],this['chatModels']=_0x51ae6b['chatModels'],this['id']=_0x51ae6b['conversationId'],this['isFromHistory']=_0x51ae6b['isFromHistory'],this['_channelsToEditors']=_0x51ae6b['channelsToEditors'],this['_getSessionId']=_0x51ae6b['getSessionId'];}async['init'](_0x1a2401){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x1a2401,'ownerId':this['id']}),this['chatContext']['delegate'](...As)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...gs)['to'](this),this['chatCapabilities']['init']();const _0x5d7d4b=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x5d7d4b});const _0x19665f=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x19665f&&await this['setModel'](_0x19665f);}catch(_0x4afaff){const _0x2bee74=new ht('ai-chat-conversation-init-failed',null,{'message':_0x4afaff['message']||_0x4afaff});_0x2bee74['stack']=_0x4afaff['stack'],this['fire']('error',{'error':_0x2bee74});}}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:_0x19ea51}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x19ea51,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x921fd2){const _0x129322=new ht('ai-chat-conversation-start-failed',null,{'message':_0x921fd2['message'],'conversationId':this['id']});throw _0x129322['stack']=_0x921fd2['stack'],this['fire']('error',{'error':_0x129322}),_0x129322;}}async['load'](_0x4526f0){try{const _0x321d28=await this['connector']['fetchConversation'](_0x4526f0)['getConversation'](),_0x1c00a0=await this['connector']['fetchConversationMessages'](_0x4526f0)['getMessages'](),_0x3b1e8b=_0x1c00a0[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x321d28['id'],'title'in _0x321d28?this['fire']('setConversationTitle',_0x321d28['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0xfecefa=(await this['chatModels']['getAll']())['find'](_0x518bff=>_0x518bff['id']['toLowerCase']()===_0x3b1e8b['toLowerCase']());this['selectedModel']=_0xfecefa,this['fire']('modelSelected',{'selectedModel':_0xfecefa,'isDisabled':!0x0});const {streamingMessageId:_0x2f99f2}=await this['_processMessagesToInteractions'](_0x1c00a0,_0x3b1e8b);return _0x2f99f2&&this['currentInteraction']?this['_resumeStream'](_0x2f99f2):this['currentInteraction']=void 0x0,this;}catch(_0xad70bb){const _0x39f65f=new ht('ai-chat-conversation-init-from-id-failed',null,{'message':_0xad70bb['message'],'conversationId':_0x4526f0});throw _0x39f65f['stack']=_0xad70bb['stack'],this['fire']('error',{'error':_0x39f65f}),_0x39f65f;}}async['_processMessagesToInteractions'](_0x50b651,_0x3aba5f){let _0x16c9bc,_0x1e520a,_0x88701d=!0x1;for(const _0x2b253f of _0x50b651)if('user'===_0x2b253f['role']){const {contextItems:_0x56dc5f,hasUnmatched:_0xae2f21}=await this['_extractContextItems'](_0x2b253f);_0x88701d=_0xae2f21;const _0x10c3d0={'isReasoningEnabled':Object['hasOwn'](_0x2b253f['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x2b253f['capabilities'],'webSearch')};_0x16c9bc=this['createInteraction']({'userMessage':_0x2b253f['prompt'],'contextItems':_0x56dc5f,'capabilities':_0x10c3d0,'modelId':_0x3aba5f,'attributes':_0x2b253f['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x16c9bc,_0x1e520a=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x2b253f['role']&&_0x16c9bc){if('streaming'===_0x2b253f['status']){_0x1e520a=_0x2b253f['id'];continue;}if('error'===_0x2b253f['status'])continue;const _0x3b821e=[];for(const _0x4d8d23 of _0x2b253f['content'])switch(_0x4d8d23['type']){case'text':case'modification':{const _0x3b6733=_0x16c9bc['getDocumentContext'](),_0x358bce=this['_hasSessionMismatch'](_0x3b6733)||_0x88701d;_0x16c9bc['currentReply']?.['type']!==_0x4d8d23['type']&&(_0x16c9bc['currentReply']=_0x16c9bc['createReply']({'type':_0x4d8d23['type'],'isDone':!0x0,'interactionId':_0x16c9bc['id'],'areActionsDisabled':_0x358bce,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x3b821e['length']>0x0&&(_0x16c9bc['currentReply']['sources']=_0x3b821e['splice'](0x0))),_0x16c9bc['currentReply']['appendContent'](_0x4d8d23['content'],_0x4d8d23['documentId']);break;}case'url':_0x3b821e['push'](_0x4d8d23);break;case'mcp-tool-result':{const {data:_0x57380d,attributes:_0x331ce5}=JSON['parse'](_0x4d8d23['content']);_0x16c9bc['_handleToolResultData']({'toolName':_0x4d8d23['toolName'],'data':_0x57380d,'attributes':_0x331ce5});break;}}'cancelled'===_0x2b253f['status']&&this['fire']('error',{'interactionId':_0x16c9bc['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x1e520a};}async['_resumeStream'](_0x1b55f4){if(this['currentInteraction'])try{const _0x2e2fe0=this['connector']['resumeStream'](this['id'],_0x1b55f4);await this['currentInteraction']['resume'](_0x2e2fe0);}catch(_0x296cda){_0x296cda instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x296cda});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x5e4557){const _0x5b5154=new Map();if(!_0x5e4557['content'])return{'contextItems':_0x5b5154,'hasUnmatched':!0x1};const {contextItem:_0x3c04ef,hasUnmatched:_0x40d321}=await this['chatContext']['populateDocumentsFromMessage'](_0x5e4557['content'],Array['from'](this['_channelsToEditors']['values']()));_0x3c04ef&&_0x5b5154['set'](_0x3c04ef['id'],_0x3c04ef);for(const _0x11cf0f of _0x5e4557['content']){if('document'===_0x11cf0f['type'])continue;const _0x1426be=await this['chatContext']['populateFromMessage'](_0x11cf0f);_0x1426be&&_0x5b5154['set'](_0x1426be['id'],_0x1426be);}return{'contextItems':_0x5b5154,'hasUnmatched':_0x40d321};}async['handleUserInteraction']({userMessage:_0x3f3a1a,attributes:_0x30b1f2}){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 _0x2c4a60=this['chatContext']['getPendingContextItems'](),_0x3c4d72=this['chatCapabilities']['getCapabilitiesConfig'](),_0x10f666=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x3f3a1a,'contextItems':_0x2c4a60,'capabilities':_0x3c4d72,'modelId':_0x10f666,'attributes':_0x30b1f2,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x33ea90){if(_0x33ea90 instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x33ea90});else{const _0x43a2ca=Is['get'](_0x33ea90['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x43a2ca,null,{'error':_0x33ea90})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x1ea465,contextItems:_0x262c5a,capabilities:_0x5a7164,modelId:_0x35d779,attributes:_0x349fbc,channelsToEditors:_0x1615fe}){const _0x445024=new AIChatInteraction({'userMessage':_0x1ea465,'contextItems':_0x262c5a,'capabilities':_0x5a7164,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x35d779,'attributes':_0x349fbc,'channelsToEditors':_0x1615fe});return _0x445024['delegate'](..._s)['to'](this),this['interactions']['push'](_0x445024),this['fire']('interactionCreated',_0x445024),_0x445024;}['getInteraction'](_0x25a1e2){return this['interactions']['find'](_0x362f55=>_0x362f55['id']===_0x25a1e2);}['removeInteraction'](_0x155577){const _0x3cf1f0=this['getInteraction'](_0x155577);_0x3cf1f0&&(_0x3cf1f0['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x3cf1f0),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x462000=this['lastInteraction'];_0x462000?.['conversationId']&&_0x462000['messageId']&&this['connector']['cancelStream'](_0x462000['conversationId'],_0x462000['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x5b5289){this['chatContext']['addCurrentDocumentToContext'](_0x5b5289);}async['updateCurrentDocumentsInContext'](_0x3f6784){await this['chatContext']['updateCurrentDocuments'](_0x3f6784);}['toggleAddCurrentDocumentOptionVisibility'](_0x486013){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x486013);}['_hasSessionMismatch'](_0x3128a8){return!!_0x3128a8&&_0x3128a8['documents']['some'](_0x3a2749=>{const _0x4da287=this['_channelsToEditors']['get'](_0x3a2749['channelId']);return!_0x4da287||_0x3a2749['sessionId']!==this['_getSessionId'](_0x4da287);});}['addSelectionToContext'](_0x520bcb){this['chatContext']['addSelectionToContext'](_0x520bcb);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x2cbb5e){this['chatContext']['addFilesToContext'](_0x2cbb5e);}['addUrlToContext'](_0x183e77){this['chatContext']['addUrlToContext'](_0x183e77);}['addToolItemToContext'](_0x58bc86){this['chatContext']['addToolItemToContext'](_0x58bc86);}['addResourceToContext'](_0x1d75ee,_0xebdb8){this['chatContext']['addResourceToContext'](_0x1d75ee,_0xebdb8);}['loadSourceResources'](_0x3b532b,_0x54bea2,_0x606ab3){return this['chatContext']['loadSourceResources'](_0x3b532b,_0x54bea2,_0x606ab3);}['removeFromContext'](_0x39e5b2){this['chatContext']['removeFromContext'](_0x39e5b2);}['setWebSearch'](_0x5b1213){this['chatCapabilities']['setWebSearch'](_0x5b1213);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x6320b0){this['chatCapabilities']['setReasoning'](_0x6320b0);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}async['setModel'](_0xf81890){_0xf81890?!0x1===await this['chatModels']['isAvailable'](_0xf81890)&&(wt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0xf81890}),_0xf81890=(await this['chatModels']['getAvailableModels']())[0x0]):(wt('ai-chat-conversation-set-model-null',{'conversation':this}),_0xf81890=(await this['chatModels']['getAvailableModels']())[0x0]),_0xf81890['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0xf81890,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0xf81890}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x338169,config:_0x4ac295,locale:_0x49905c}){super(),this['_connector']=_0x338169,this['_config']=_0x4ac295,this['_locale']=_0x49905c;}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 _0x65e539=await this['getAll']();let _0x207758;return _0x207758=this['_availableModels']?this['_filterModels'](_0x65e539,this['_availableModels']):_0x65e539['filter'](_0x6d380b=>_0x6d380b['recommended']),_0x207758;}async['getModel'](_0x4d0126){const _0x831e27=await this['getAll']();if(!_0x831e27['length'])return null;if(_0x4d0126){const _0x28a577=this['_getModelById'](_0x831e27,_0x4d0126);if(_0x28a577)return _0x28a577;wt('ai-chat-model-id-unrecognized',{'modelId':_0x4d0126,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x25c3dd=await this['getAvailableModels']();if(!_0x25c3dd['length'])return null;if(this['_defaultModelId']){const _0x426db5=this['_getModelById'](_0x25c3dd,this['_defaultModelId']);if(_0x426db5)return _0x426db5;wt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x25c3dd[0x0]['id']});}return _0x25c3dd[0x0];}async['isAvailable'](_0x45dd9a){return(await this['getAvailableModels']())['some'](_0x3796e0=>_0x3796e0['name']===_0x45dd9a['name']&&_0x3796e0['provider']===_0x45dd9a['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x22e5c3=this['_locale']['uiLanguage']||'en',_0x4f4be3=this['_connector']['getModels'](_0x22e5c3),_0xf7c666=await _0x4f4be3['list']();this['_modelList']=_0xf7c666['items']['map'](_0x3040bb=>ws(_0x3040bb)?{..._0x3040bb,'name':Mi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x3040bb);}catch(_0x34cefc){throw Ct('ai-models-unable-to-retrieve',{'error':_0x34cefc}),_0x34cefc;}return[...this['_modelList']];}['_filterModels'](_0x197998,_0x46b898){let _0x4a2c61;if(_0x46b898){_0x4a2c61=[];const _0x10d712=new Set(),_0x20784c='string'==typeof _0x46b898?[_0x46b898['toLocaleLowerCase']()]:_0x46b898['map'](_0x11589c=>_0x11589c['toLocaleLowerCase']());for(const _0x3081a6 of _0x20784c)for(const _0x5d021e of _0x197998)!_0x10d712['has'](_0x5d021e['id'])&&this['_isMatchingFilter'](_0x5d021e,_0x3081a6)&&(_0x4a2c61['push'](_0x5d021e),_0x10d712['add'](_0x5d021e['id']));}else _0x4a2c61=_0x197998;return _0x4a2c61;}['_isMatchingFilter'](_0x4418f6,_0xe4cb11){const _0x4a6457=_0x4418f6['id']['toLocaleLowerCase'](),_0x113ebe=_0x4418f6['name']['toLocaleLowerCase'](),_0x4e9d59=_0x4418f6['provider']['toLocaleLowerCase']();return _0x4a6457===_0xe4cb11||_0x113ebe===_0xe4cb11||ws(_0x4418f6)&&'auto'===_0xe4cb11||_0x4e9d59===_0xe4cb11||_0x4a6457['startsWith'](_0xe4cb11);}['_getModelById'](_0x5153da,_0x25c4e7){return _0x5153da['find'](_0x44e8df=>ws(_0x44e8df)&&'auto'===_0x25c4e7?_0x44e8df:_0x44e8df['id']===_0x25c4e7)||null;}}function ws(_0x478603){return _0x478603['id']['startsWith']('agent');}function Cs(_0x21d26e){return _0x21d26e?_0x21d26e instanceof _0x1ca247?[_0x21d26e]:_0x21d26e['editors']&&0x0!==_0x21d26e['editors']['length']?Array['from'](_0x21d26e['editors']):[]:[];}function ms(_0x470d94){const _0x52b659=Cs(_0x470d94);if(!_0x52b659['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x52b659['length'])return _0x52b659[0x0];const _0x4a4e32=_0x52b659['find'](_0x65bd7b=>_0x65bd7b['ui']?.['focusTracker']?.['isFocused']);if(_0x4a4e32)return _0x4a4e32;const _0x59dce7=function(_0x5aede6){if(_0x5aede6 instanceof _0x1ca247)return;const _0x1e8828=_0x5aede6;if(!_0x1e8828['plugins']||!_0x1e8828['plugins']['has']('AIEditing'))return;const _0x222528=_0x1e8828['plugins']['get']('AIEditing');return _0x222528['getLastContentFocusedEditor']?.();}(_0x470d94);return _0x59dce7&&_0x52b659['includes'](_0x59dce7)?_0x59dce7:_0x52b659[0x0];}function ps({interaction:_0x582ea6,reply:_0xd5fc5,groups:_0xada72a,transform:_0x2f390e,documentCompare:_0x58f97e,documentCompareOptions:_0x14c6e7}){const _0x3a967a=_0x582ea6['getDocumentContext']()['documents']['find'](_0x20ba77=>_0x20ba77['id']==_0xada72a[0x0]['documentId']),_0x651d4d=_0xada72a[0x0]['editor'];if(!_0x3a967a)return[];const _0xcb73f5=_0x3a967a['content'],_0x2b688f=_0x3a967a['version'],_0x3922e2=_0xd5fc5['documentContextContent']['get'](_0xada72a[0x0]['documentId'])['cloneNode'](!0x0);for(const {changes:_0x2c18ca}of _0xada72a){const _0x3681f5=_0x2c18ca['filter'](_0x20ae46=>'new'!=_0x20ae46['type'])['map'](_0x29e534=>Yi('data-id',_0x29e534['id'],_0x3922e2)),_0x964952=_0x2c18ca['filter'](_0x5742b9=>'removed'!=_0x5742b9['type'])['map'](_0x4e2cb8=>_0x4e2cb8['node']['cloneNode'](!0x0));let _0x511e47=null;if(_0x3681f5['length']){_0x511e47=_0x3681f5[0x0]['previousSibling'];for(let _0xdfc7aa=0x0;_0xdfc7aa<_0x3681f5['length'];_0xdfc7aa++)_0x2cc5d2(_0x3681f5[_0xdfc7aa]);}if(_0x964952['length']){_0x511e47||(_0x2c18ca[0x0]['anchorId']?_0x511e47=Yi('data-id',_0x2c18ca[0x0]['anchorId'],_0x3922e2):(_0x511e47=_0x964952['shift'](),_0x22b9c2(_0x3922e2,_0x511e47)));for(let _0x4672bb=0x0;_0x4672bb<_0x964952['length'];_0x4672bb++)_0x23bff4(_0x511e47,_0x964952[_0x4672bb]),_0x511e47=_0x964952[_0x4672bb];}}const _0x238f0e=Ki(_0x3922e2),_0x4379f1=_0x58f97e['getDiff'](_0xcb73f5,_0x238f0e,{'targetEditor':_0x651d4d,..._0x14c6e7})['getOperations']();if(_0x2f390e){const _0x21a6ba=_0x651d4d['model']['document']['history']['getOperations'](_0x2b688f),_0x5c041b={'document':_0x651d4d['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x1dcb0f(_0x4379f1,_0x21a6ba,_0x5c041b)['operationsA'];}return _0x4379f1;}function Es(_0x455894,_0x592d2e){if('marker'!=_0x592d2e['type'])return;const _0x2fd7d0=_0x455894['model']['markers']['get'](_0x592d2e['name']);_0x2fd7d0&&(_0x592d2e['oldRange']=_0x2fd7d0['getRange']());}function Ts(_0x2b55ce,_0x169bd8){if(_0x2b55ce['files']['length']>0x0&&_0x169bd8['filesEnabled']){const _0x282ee5=_0x2b55ce['files']['filter'](_0x1074ef=>_0x1074ef['name']);return _0x282ee5['length']>0x0?{'type':'file','files':_0x282ee5}:null;}if(_0x169bd8['urlsEnabled']){const _0x2507d1=function(_0x21aa8e){const _0x4a6c16=_0x21aa8e['trim']();if(/\s/['test'](_0x4a6c16))return null;try{const _0x4c4b62=new URL(_0x4a6c16);return'http:'!==_0x4c4b62['protocol']&&'https:'!==_0x4c4b62['protocol']?null:_0x4c4b62['toString']();}catch{return null;}}(_0x2b55ce['plainText']);if(_0x2507d1)return{'type':'url','url':_0x2507d1};}const _0x1d766b=_0x2b55ce['forceTextAttachment']?0x1:_0x169bd8['longTextThreshold']??0x1/0x0;if(_0x2b55ce['plainText']['length']>=Math['max'](_0x1d766b,0x1)&&_0x169bd8['filesEnabled']){const _0x325a6d=_0x169bd8['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x2b55ce['plainText']],_0x325a6d,{'type':'text/plain'})]};}return null;}class AIChatController extends _0x4338bf{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[AIConnector,_0x4ea419];}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 _0x1a10df=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x2fac61,_0xea1a8b)=>{this['_handleUIUserMessage']({'message':_0xea1a8b});}),this['listenTo'](_0x1a10df['view'],'change:activeTab',(_0x5789e5,_0x3b20ca,_0x472fc6)=>{'chat'!==_0x472fc6&&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',(_0x5f2d16,_0x1b2e97)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x1b2e97));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x2aaabd,_0x5898ee)=>{this['activeConversation']?.['addUrlToContext'](_0x5898ee);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x57d3e3,_0x4d3f8d)=>{const _0x1dd14a=this['activeConversation'];if(!_0x1dd14a)return;_0x4d3f8d['hasDirectory']&&(_0x4d3f8d['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+at()}));const _0x56ccae=Ts(_0x4d3f8d,{'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')});_0x56ccae&&(_0x4d3f8d['preventDefault'](),'url'===_0x56ccae['type']?_0x1dd14a['addUrlToContext'](_0x56ccae['url']):_0x1dd14a['chatContext']['addFilesToContext'](_0x56ccae['files'],void 0x0,_0x56ccae['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x5f0b87,_0x103243)=>{_0x103243['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x1f73a1,_0x108c1e)=>{this['activeConversation']?.['addResourceToContext'](_0x108c1e['source'],_0x108c1e['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x25b877,_0xd31a95)=>{this['_removeFromContext'](_0xd31a95);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x16e3c0,_0x6adc7c)=>{this['activeConversation']?.['loadSourceResources'](_0x6adc7c['sourceId'],_0x6adc7c['query'],_0x6adc7c['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x48870c,_0x25e50d)=>{this['activeConversation']?.['setModel'](_0x25e50d);}),this['listenTo'](this['_aiChatUi'],'like',(_0x4686ac,{replyId:_0x10c55c})=>{console['log']('Liked\x20response',_0x10c55c);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x1429e4,{replyId:_0x200df4})=>{console['log']('Disliked\x20response',_0x200df4);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x311109,_0x59be3a)=>{this['_insertSuggestion'](_0x59be3a);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x3458d2,{replyId:_0x33cc56,partIndex:_0x35ebac})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x33cc56,_0x35ebac);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x127509,{replyId:_0xab7fdf,partIndex:_0x571c47})=>{const _0x313358=this['_getDocumentRangeForReplyChanges'](_0xab7fdf,_0x571c47);if(!_0x313358)return;const {reply:_0x260e58}=this['getInteractionAndReplyById'](_0xab7fdf);'$graveyard'!=_0x313358['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x260e58['changeGroups'][_0x571c47]['editor'],'ranges':[_0x313358['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x43547a,_0x4db787)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x4db787);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x268b98,{replyId:_0x2f5339,showDiff:_0x46f88f})=>{const {interaction:_0x4dd92e,reply:_0x19880f}=this['getInteractionAndReplyById'](_0x2f5339),_0xb12e2d=_0x19880f['getContentParts']({'showDiff':_0x46f88f});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x4dd92e['id']+':'+_0x19880f['id'],'parts':_0xb12e2d});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0xeda588,{replyId:_0x2430f8,partIndex:_0x4a39dd})=>{this['_rejectSuggestion']({'replyId':_0x2430f8,'partIndex':_0x4a39dd}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x45f17f,_0x49dd60)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x49dd60);}),this['on']('replyCreated',(_0x1ead42,_0x2c176a)=>{this['_addFeedItemReply'](_0x2c176a);});}['afterInit'](){this['context']instanceof _0x1ca247?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x86e8ca,_0x38a224)=>{_0x38a224['on']('ready',()=>{this['_integrateEditor'](_0x38a224);});}),this['_initConversation']();}async['_initConversation'](){const _0x5e85b2=this['context']['config']['get']('ai.chat.initialConversation');let _0x31f872=_0x5e85b2;('lastCreated'!=_0x5e85b2||(_0x31f872=await this['_getLastCreatedConversationId'](),_0x31f872))&&('new'==_0x31f872?await this['_startConversationSafely']():await this['loadConversation'](_0x31f872));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x28d425){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'](_0x28d425)['getConversation'](),await this['_startConversationSafely']({'id':_0x28d425}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0x28d425),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x2a8458){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x28d425}),this['_logError'](new ht('ai-chat-conversation-not-found',this,{'error':_0x2a8458}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x44e966){let _0x4cc0b2=null,_0x477a98=null;this['on']('toolDataReceived',(_0x2a4730,_0x1fce7a,_0x4172fd)=>{_0x4172fd['id']!==_0x4cc0b2&&(_0x4cc0b2=_0x4172fd['id'],_0x477a98=this['_getAIChatFeedAPI'](_0x4172fd)),_0x44e966(_0x1fce7a,_0x477a98);});}['addCurrentDocumentToChatContext'](){Cs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Mi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0xfd3691){const _0x566b08=this['_aiEditing']['getSelectionText'](_0xfd3691);this['activeConversation']?.['addSelectionToContext'](_0x566b08),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x5d41fc){await this['_startConversationSafely']({'modelId':_0x5d41fc?.['modelId']});}async['sendMessage'](_0x4cd3de){await this['_handleUIUserMessage'](_0x4cd3de);}['getGroupId'](){const _0x43892b=this['context']['config']['get']('collaboration.channelId');if(!_0x43892b)throw new ht('ai-missing-channel-id',this);return _0x43892b;}['_handleRemovedConversation'](_0x1c59f1){this['activeConversation']['id']===_0x1c59f1&&this['_startConversationSafely']();}['_insertSuggestion'](_0x1583b5){const _0x26a873=this['context']['plugins']['get'](_0x4ea419),{reply:_0x4046ec,interaction:_0x301dd2}=this['getInteractionAndReplyById'](_0x1583b5['replyId']),_0x3524b6=void 0x0!==_0x1583b5['partIndex']?[_0x4046ec['changeGroups'][_0x1583b5['partIndex']]]:_0x4046ec['changeGroups']['filter'](_0x117c5d=>'pending'==_0x117c5d['state']);_0x3524b6['map'](_0x5eb14a=>_0x4046ec['changeGroups']['indexOf'](_0x5eb14a))['forEach'](_0x386e24=>{const _0x17ee64=this['_getDocumentRangeForReplyChanges'](_0x1583b5['replyId'],_0x386e24);_0x17ee64&&'$graveyard'!=_0x17ee64['range']['root']['rootName']?(_0x4046ec['setChangeGroupState'](_0x386e24,'accepted'),void 0x0!==_0x1583b5['partIndex']&&this['_scrollToSuggestionRange'](_0x17ee64['range'],!0x1,_0x17ee64['targetEditor'])):_0x4046ec['setChangeGroupState'](_0x386e24,'outdated');});const _0x5eb66f={},_0x27ad2d=_0x3524b6['reduce']((_0x68e654,_0xd41cf3)=>('outdated'===_0xd41cf3['state']||(_0x68e654[_0xd41cf3['documentId']]=[..._0x68e654[_0xd41cf3['documentId']]||[],_0xd41cf3],_0x5eb66f[_0xd41cf3['documentId']]=[..._0x5eb66f[_0xd41cf3['documentId']]||[],_0x4046ec['changeGroups']['indexOf'](_0xd41cf3)]),_0x68e654),{});for(const [_0xa9f914,_0x2c14d0]of Object['entries'](_0x27ad2d)){const _0x195ef9=_0x2c14d0[0x0]['editor'];if(!_0x195ef9['plugins']['has']('TrackChanges')){wt('ai-no-track-changes',{'editor':_0x195ef9});continue;}const _0x55c457=ps({'reply':_0x4046ec,'interaction':_0x301dd2,'groups':_0x2c14d0,'transform':!0x0,'documentCompare':_0x26a873,'documentCompareOptions':{'anchor':_0x2c14d0[0x0]['rootName'],'markDeletions':!0x0}});let _0xca5dea;_0x195ef9['model']['change'](_0x1b7aa0=>{_0xca5dea=_0x1b7aa0['batch'],_0x195ef9['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x55c457),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0xca5dea,{'interactionId':_0x301dd2['id'],'replyId':_0x4046ec['id'],'indexes':_0x5eb66f[_0xa9f914]});}this['_updateRatings'](_0x4046ec);}['_applySuggestion'](_0x586940){const _0x4a03ee=this['context']['plugins']['get'](_0x4ea419),{reply:_0x2c691a,interaction:_0xf4d9eb}=this['getInteractionAndReplyById'](_0x586940['replyId']),_0x332e14=void 0x0!==_0x586940['partIndex']?[_0x2c691a['changeGroups'][_0x586940['partIndex']]]:_0x2c691a['changeGroups']['filter'](_0x5688f8=>'pending'==_0x5688f8['state']);_0x332e14['map'](_0xdfa7b5=>_0x2c691a['changeGroups']['indexOf'](_0xdfa7b5))['forEach'](_0x1ec933=>{const _0x11b51b=this['_getDocumentRangeForReplyChanges'](_0x586940['replyId'],_0x1ec933);_0x11b51b&&'$graveyard'!=_0x11b51b['range']['root']['rootName']?(_0x2c691a['setChangeGroupState'](_0x1ec933,'accepted'),void 0x0!==_0x586940['partIndex']&&this['_scrollToSuggestionRange'](_0x11b51b['range'],!0x1,_0x11b51b['targetEditor'])):_0x2c691a['setChangeGroupState'](_0x1ec933,'outdated');});const _0x282edf={},_0x534d1d=_0x332e14['reduce']((_0x4ca266,_0x239922)=>('outdated'===_0x239922['state']||(_0x4ca266[_0x239922['documentId']]=[..._0x4ca266[_0x239922['documentId']]||[],_0x239922],_0x282edf[_0x239922['documentId']]=[..._0x282edf[_0x239922['documentId']]||[],_0x2c691a['changeGroups']['indexOf'](_0x239922)]),_0x4ca266),{});for(const [_0x543a3e,_0xf0fd8b]of Object['entries'](_0x534d1d)){const _0x46856a=ps({'reply':_0x2c691a,'interaction':_0xf4d9eb,'groups':_0xf0fd8b,'transform':!0x0,'documentCompare':_0x4a03ee,'documentCompareOptions':{'anchor':_0xf0fd8b[0x0]['rootName'],'markDeletions':!0x1}});let _0xe02194;const _0x3ab15d=_0xf0fd8b[0x0]['editor'];_0x3ab15d['model']['change'](_0x5412a9=>{_0xe02194=_0x5412a9['batch'];for(const _0x35fc15 of _0x46856a)_0x35fc15['baseVersion']=_0x3ab15d['model']['document']['version'],Es(_0x3ab15d,_0x35fc15),_0x5412a9['batch']['addOperation'](_0x35fc15),_0x3ab15d['model']['applyOperation'](_0x35fc15);}),this['_batchToChanges']['set'](_0xe02194,{'interactionId':_0xf4d9eb['id'],'replyId':_0x2c691a['id'],'indexes':_0x282edf[_0x543a3e]});}this['_updateRatings'](_0x2c691a);}['_rejectSuggestion'](_0x36fab5){const {reply:_0x39d0e0}=this['getInteractionAndReplyById'](_0x36fab5['replyId']);_0x39d0e0['setChangeGroupState'](_0x36fab5['partIndex'],'rejected');}['_openBalloonFor'](_0x2bf989,_0x402a51){if(!this['_hasAIChatBalloon'])return;const {reply:_0x2efce3}=this['getInteractionAndReplyById'](_0x2bf989),_0x2a9380=_0x2efce3['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x2a9380['length'])return;let _0x46328c,_0x52472d;if(void 0x0!==_0x402a51?(_0x52472d=_0x2a9380['find'](_0x415b56=>_0x415b56['index']==_0x402a51),_0x46328c=_0x52472d?.['index']):(_0x52472d=_0x2a9380[0x0],_0x46328c=_0x52472d['index']),!_0x52472d)return void _0x2efce3['setChangeGroupState'](_0x402a51??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x2bf989&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x46328c)return;const _0x26ccb2=this['_getUserPresentableContentPartDocumentRange'](_0x2bf989,_0x2efce3,_0x52472d),_0x348c18=_0x2efce3['changeGroups']['find'](_0x53ac25=>_0x53ac25['index']==_0x46328c)['editor'],_0x3d438f=_0x348c18['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x3d438f&&this['_activeBalloon']['close'](),!_0x26ccb2)return _0x3d438f['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x3d438f,this['_currentPreviewedChangeGroup']={'replyId':_0x2bf989,'partIndex':_0x46328c},this['_scrollToSuggestionRange'](_0x26ccb2,!0x0,_0x348c18);const _0x594c88=this['_getPresentableSiblingContentPartIndex'](_0x2bf989,_0x46328c,'next');_0x3d438f['clearContent'](),_0x3d438f['updateContent']({'part':_0x52472d,'renderingStrategy':'static'}),_0x3d438f['open']({'index':_0x46328c,'title':Mi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x46328c+0x1)['toString']()),'showRotator':null!==_0x594c88,'ranges':[_0x26ccb2],'areActionsDisabled':_0x2efce3['areActionsDisabled'],'targetEditor':_0x348c18}),_0x3d438f['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x2bf989,_0x46328c),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x2bf989,'index':_0x46328c,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x544d4f,_0x4bb01a,_0x19176a){const {reply:_0x249977}=this['getInteractionAndReplyById'](_0x544d4f),_0x2074e4=_0x249977['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x2074e4['length'])return null;const _0x1efa22='next'==_0x19176a?0x1:-0x1;function _0x4adff8(_0x44f62f){const _0x26f8f3=(_0x44f62f+_0x1efa22+_0x2074e4['length'])%_0x2074e4['length'];return{'siblingIndex':_0x26f8f3,'siblingPart':_0x2074e4[_0x26f8f3]};}const _0x28f81a=_0x2074e4['findIndex'](_0x3ab37b=>_0x3ab37b['index']==_0x4bb01a);let {siblingIndex:_0x5e0786,siblingPart:_0x2fe12d}=_0x4adff8(_0x28f81a);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x544d4f,_0x249977,_0x2fe12d);)if({siblingIndex:_0x5e0786,siblingPart:_0x2fe12d}=_0x4adff8(_0x5e0786),_0x5e0786===_0x28f81a)return null;return _0x2fe12d['index'];}['_getUserPresentableContentPartDocumentRange'](_0x2eaa22,_0x5e8e62,_0x143fa2){const _0x515557=_0x5e8e62['changeGroups'];if(!_0x143fa2['hasChanges'])return null;const _0x1333e0=_0x515557['find'](_0x19c8b2=>_0x19c8b2['index']==_0x143fa2['index']);if('pending'!==_0x1333e0?.['state'])return null;if('destroyed'===_0x1333e0?.['editor']['state'])return _0x5e8e62['setChangeGroupState'](_0x143fa2['index'],'outdated'),null;const _0x4668eb=this['_getDocumentRangeForReplyChanges'](_0x2eaa22,_0x143fa2['index']);if(!_0x4668eb)return _0x5e8e62['setChangeGroupState'](_0x143fa2['index'],'outdated'),null;const {range:_0x2a957b,currentIndex:_0x312680}=_0x4668eb;return'$graveyard'==_0x2a957b['root']['rootName']?(_0x5e8e62['setChangeGroupState'](_0x312680,'outdated'),null):_0x4668eb['range'];}['_getDocumentRangeForReplyChanges'](_0x4f02be,_0x402893){const {reply:_0x3155e5,interaction:_0x3cc621}=this['getInteractionAndReplyById'](_0x4f02be),_0x5230a7=_0x3155e5['changeGroups']['filter'](_0x5eb0f0=>'pending'==_0x5eb0f0['state']),_0x43d0b7=_0x5230a7['map'](_0x502dca=>_0x3155e5['changeGroups']['indexOf'](_0x502dca));void 0x0===_0x402893&&(_0x402893=_0x43d0b7[0x0]);const _0xd0d4bf=_0x43d0b7['indexOf'](_0x402893);if(-0x1==_0xd0d4bf)return null;const _0x2b9f5e=_0x5230a7[_0xd0d4bf],_0x2195dd=_0x2b9f5e['editor'];if('destroyed'===_0x2195dd['state'])return null;const _0x31b7c7=_0x3155e5['documentContextContent']['get'](_0x2b9f5e['documentId']),_0x4bff2a=new _0x5346ad([]),_0x1592bb=new _0x5346ad([]);for(const _0xb36166 of _0x2b9f5e['changes'])if('removed'!=_0xb36166['type']&&_0x1592bb['children']['push'](_0xb36166['node']['cloneNode'](!0x0)),'new'!=_0xb36166['type']){const _0x2b3719=_0x358753(_0x3ddd50=>Xi(_0x3ddd50,'data-id')==_0xb36166['id'],_0x31b7c7,!0x0);_0x4bff2a['children']['push'](_0x2b3719['cloneNode'](!0x0));}if(0x0==_0x4bff2a['children']['length']){if(_0x2b9f5e['changes'][0x0]['anchorId']){const _0x3ea61e=Yi('data-id',_0x2b9f5e['changes'][0x0]['anchorId'],_0x31b7c7);_0x4bff2a['children']['unshift'](_0x3ea61e['cloneNode'](!0x0)),_0x1592bb['children']['unshift'](_0x3ea61e['cloneNode'](!0x0)),_0x3ea61e['nextSibling']&&(_0x4bff2a['children']['push'](_0x3ea61e['nextSibling']['cloneNode'](!0x0)),_0x1592bb['children']['push'](_0x3ea61e['nextSibling']['cloneNode'](!0x0)));}else{const _0x40f540=_0x31b7c7['children'][0x0];if(!_0x40f540)return null;_0x4bff2a['children']['push'](_0x40f540['cloneNode'](!0x0)),_0x1592bb['children']['push'](_0x40f540['cloneNode'](!0x0));}}const _0x357ed8=_0x3cc621['getDocumentContext'](),_0x3d0753=_0x357ed8['content']||_0x357ed8['documents']['find'](_0x1ac7bf=>_0x1ac7bf['id']==_0x2b9f5e['documentId'])['content'],_0x357a1d=_0x2195dd['model']['document']['getRoot'](_0x2b9f5e['rootName']),_0x5bc288=_0x2195dd['data']['parse'](_0x3d0753,_0x357a1d),_0x40e260=Ki(_0x4bff2a),_0x2a203f=_0x2195dd['data']['parse'](_0x40e260,_0x357a1d),_0x2d8368=_0x2195dd['data']['parse'](_0x40e260,_0x357a1d),_0xad459a=_0x2195dd['model']['createPositionAt'](_0x2a203f,0x0),_0x4cdec4=Ki(_0x1592bb),_0x5ec81a={'targetEditor':_0x2195dd,'anchor':_0xad459a,'markDeletions':!0x1},_0x464cb1=_0x2195dd['plugins']['get'](_0x4ea419)['getDiff'](_0x40e260,_0x4cdec4,_0x5ec81a)['getOperations']();if(!_0x464cb1['length'])return null;_0x2195dd['model']['change'](_0x3c92b6=>{for(const _0x3df33d of _0x464cb1)if('remove'==_0x3df33d['type']){const _0x3fa5c6=_0x3df33d['sourcePosition'],_0x133c6b=_0x3df33d['howMany'],_0x487b21=new _0x62ec40(_0x3fa5c6,_0x133c6b);_0x3c92b6['batch']['addOperation'](_0x487b21),_0x2195dd['model']['applyOperation'](_0x487b21);}else'marker'!==_0x3df33d['type']&&(_0x3df33d['baseVersion']=null,_0x3df33d['isDocumentOperation']=!0x1,_0x3c92b6['batch']['addOperation'](_0x3df33d),_0x2195dd['model']['applyOperation'](_0x3df33d));});const _0x14dc4d=hs(_0x2195dd,_0x464cb1,_0x2a203f);ls(_0x2195dd['model'],_0x14dc4d);const _0x333afc=_0x14dc4d['getFirstRange']()['start']['path']['slice'](),_0x71dfc2=_0x14dc4d['getFirstRange']()['end']['path']['slice'](),_0x5b8baf=[];let _0xdf2d53=_0x2a203f,_0x51c4c1=_0x2d8368;for(let _0x51f3a9=0x0;_0x51f3a9<_0x71dfc2['length'];_0x51f3a9++){const _0x273bf9=_0xdf2d53['maxOffset']-_0x71dfc2[_0x51f3a9];_0x5b8baf[_0x51f3a9]=_0x51c4c1['maxOffset']-_0x273bf9,_0xdf2d53=_0xdf2d53['getChildAtOffset'](_0x71dfc2[_0x51f3a9]),_0x51c4c1=_0x51c4c1['getChildAtOffset'](_0x5b8baf[_0x51f3a9]);}const _0x1d72af=_0x2195dd['model']['createRange'](_0x2195dd['model']['createPositionFromPath'](_0x2d8368,_0x333afc),_0x2195dd['model']['createPositionFromPath'](_0x2d8368,_0x5b8baf)),_0x591ae3=_0x2d8368['getChild'](0x0)['getAttribute'](_0x18f6e1),_0x29e776=Array['from'](_0x5bc288['getChildren']())['find'](_0x410082=>_0x410082['getAttribute'](_0x18f6e1)==_0x591ae3)['getPath'](),_0x4cb8d5=_0x1d72af['start']['path']['slice'](),_0x2d1881=_0x1d72af['end']['path']['slice']();_0x4cb8d5[0x0]=_0x29e776[0x0]+_0x4cb8d5[0x0],_0x2d1881[0x0]=_0x29e776[0x0]+_0x2d1881[0x0];let _0x1abca8=_0x2195dd['model']['createRange'](_0x2195dd['model']['createPositionFromPath'](_0x2195dd['model']['document']['getRoot'](_0x2b9f5e['rootName']),_0x4cb8d5),_0x2195dd['model']['createPositionFromPath'](_0x2195dd['model']['document']['getRoot'](_0x2b9f5e['rootName']),_0x2d1881));const _0x366a0d=_0x357ed8['documents']['find'](_0x95702=>_0x95702['id']==_0x2b9f5e['documentId'])['version'],_0x50ea6c=_0x2195dd['model']['document']['history']['getOperations'](_0x366a0d);for(const _0x54dbcc of _0x50ea6c)_0x1abca8=_0x5c7233['_createFromRanges'](_0x1abca8['getTransformedByOperation'](_0x54dbcc));return{'range':_0x1abca8,'currentIndex':_0x402893,'targetEditor':_0x2195dd};}['_integrateEditorBalloon'](_0x58df4f){if(!_0x58df4f['plugins']['has']('AIChatBalloon'))return;const _0x17c473=_0x58df4f['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x17c473['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x17c473,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x260acb,partIndex:_0x825d49}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x1f0453}=this['getInteractionAndReplyById'](_0x260acb),_0x56e492=_0x1f0453['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x825d49});_0x17c473['updateContent']({'part':_0x56e492[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x17c473,'applySuggestion',()=>{const {replyId:_0x18abd3,partIndex:_0x2f806f}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x18abd3,'partIndex':_0x2f806f}),_0x17c473['setState']('accepted');}),this['listenTo'](_0x17c473,'insertSuggestion',()=>{const {replyId:_0x45ad80,partIndex:_0x37a149}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x45ad80,'partIndex':_0x37a149}),_0x17c473['setState']('accepted');}),this['listenTo'](_0x17c473,'rejectSuggestion',()=>{const {replyId:_0x41710a,partIndex:_0x5cd341}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x41710a,'partIndex':_0x5cd341}),_0x17c473['setState']('rejected');}),this['listenTo'](_0x17c473,'showNext',()=>{const {replyId:_0x1accd0,partIndex:_0x469946}=this['_currentPreviewedChangeGroup'],_0x3348c7=this['_getPresentableSiblingContentPartIndex'](_0x1accd0,_0x469946,'next');null!==_0x3348c7&&this['_openBalloonFor'](_0x1accd0,_0x3348c7);}),this['listenTo'](_0x17c473,'showPrevious',()=>{const {replyId:_0x55c857,partIndex:_0x4ab507}=this['_currentPreviewedChangeGroup'],_0x269d5d=this['_getPresentableSiblingContentPartIndex'](_0x55c857,_0x4ab507,'previous');null!==_0x269d5d&&this['_openBalloonFor'](_0x55c857,_0x269d5d);}),this['listenTo'](_0x17c473,'dialogClosed',(_0x5a507f,{id:_0x113b13})=>{if('aiChatBalloon'!==_0x113b13)return;const {replyId:_0x17cf8c,partIndex:_0x33b8f6}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x17cf8c,'index':_0x33b8f6,'isActive':!0x1}),this['_activeBalloon']===_0x17c473&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0xd54003){if(this['_channelsToEditors']['set'](_0xd54003['config']['get']('collaboration.channelId'),_0xd54003),this['_integrateEditorBalloon'](_0xd54003),this['addCurrentDocumentToChatContext'](),_0xd54003['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0xd54003['plugins']['has']('Undo')){const _0x4695d1=_0xd54003['commands']['get']('undo'),_0x176868=_0xd54003['commands']['get']('redo');this['listenTo'](_0x4695d1,'revert',(_0x3f227b,_0x3f4c40,_0xeaf1de)=>{const _0x18b470=this['_batchToChanges']['get'](_0x3f4c40);if(!_0x18b470)return;const _0xe2d5d0=this['activeConversation']['getInteraction'](_0x18b470['interactionId']),_0x9c94d8=_0xe2d5d0?.['getReply'](_0x18b470['replyId']);this['_batchToChanges']['delete'](_0x3f4c40),_0xe2d5d0&&_0x9c94d8&&(_0x18b470['indexes']['forEach'](_0x5157eb=>_0x9c94d8['setChangeGroupState'](_0x5157eb,'pending')),this['_batchToChanges']['set'](_0xeaf1de,_0x18b470));}),this['listenTo'](_0x176868,'revert',(_0x4ad7ea,_0x15fc92,_0x26f1e6)=>{const _0x50cb1b=this['_batchToChanges']['get'](_0x15fc92);if(!_0x50cb1b)return;const _0x60027=this['activeConversation']['getInteraction'](_0x50cb1b['interactionId']),_0x5b3a69=_0x60027?.['getReply'](_0x50cb1b['replyId']);this['_batchToChanges']['delete'](_0x15fc92),_0x60027&&_0x5b3a69&&(_0x50cb1b['indexes']['forEach'](_0x2b844a=>_0x5b3a69['setChangeGroupState'](_0x2b844a,'accepted')),this['_batchToChanges']['set'](_0x26f1e6,_0x50cb1b));});}const _0x3088e6=_0xd54003['config']['get']('ai.chat.context');_0x3088e6['alwaysAddSelection']&&_0x3088e6['document']['enabled']&&this['listenTo'](_0xd54003['model']['document']['selection'],'change:range',(_0x29e09d,_0x117985)=>{if(!_0x117985['directChange'])return;'chat'===_0xd54003['plugins']['get']('AITabs')['view']['activeTab']&&(_0xd54003['model']['hasContent'](_0xd54003['model']['document']['selection'])?this['addSelectionToChatContext'](_0xd54003):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x32b793=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x51c0e0=await _0x32b793['getConversations']();return _0x51c0e0['length']?_0x51c0e0[0x0]['id']:'new';}catch(_0x3c90ac){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':_0x3c90ac})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x913134={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x913134);}catch(_0xe23e3b){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x913134['id']||at()}),console['error'](_0xe23e3b),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x3e43d0,modelId:_0x12090b}={}){this['_closeActiveBalloon']();let _0x4bc1f4=_0x12090b;_0x4bc1f4||(_0x3e43d0||!this['activeConversation']?_0x4bc1f4=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x4bc1f4=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x15d3e9=this['getGroupId'](),_0x34cfd5=_0x3e43d0||at();let _0x5c139d;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x4bc1f4,'conversationId':_0x34cfd5,'group':_0x15d3e9,'locale':this['context']['locale'],'isFromHistory':!!_0x3e43d0,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x4c383c=>this['_aiEditing']['getSessionId'](_0x4c383c)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x2b2ea7,_0x549209)=>{this['_aiChatUi']['createConversation'](_0x549209),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x3e43d0||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x355e21,_0x522460)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x522460['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x3d32aa=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x3d32aa);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0xf5d637=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0xf5d637);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x3925bb,_0x563570)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x563570,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x3a33ce,_0xd0a3b2)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0xd0a3b2,{'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',(_0x22bf4d,_0x31e547)=>{this['_aiChatUi']['removeFeedInteraction'](_0x31e547['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x333158,_0x1d554d,_0x4be2a6)=>{this['_updateConversationTitle'](_0x1d554d,_0x4be2a6);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x221288,_0x314905)=>{void 0x0!==_0x5c139d&&_0x5c139d!==_0x314905['id']&&this['_updateReplyContentThrottled']['flush'](),_0x5c139d=_0x314905['id'],_0x314905['isFromHistory']?await this['_updateReplyContent']({'reply':_0x314905}):await this['_updateReplyContentThrottled']({'reply':_0x314905});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x3c40b3,{reply:_0x50b3bd,index:_0x4708e2,state:_0x517b33})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x50b3bd['id'],'index':_0x4708e2,'state':_0x517b33}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x50b3bd['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x4708e2&&this['_activeBalloon']?.['setState'](_0x517b33);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x22346f,_0x414a04)=>{if(this['_aiChatUi']['addContextItem'](_0x414a04['contextItem'],_0x414a04['isLoading']),'selection'===_0x414a04['contextItem']['type']){const _0x189f77=ms(this['context']),_0x44f57c=[..._0x189f77['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x189f77,'ranges':_0x44f57c,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x546737,_0xcab412)=>{this['_aiChatUi']['removeContextItem'](_0xcab412['uiId']),'current-document'==_0xcab412['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0xcab412['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x43282b,_0x1563eb)=>{this['_aiChatUi']['setContextItemLoading'](_0x1563eb['contextItem']['uiId'],_0x1563eb['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x47c6af,_0x3304db)=>{this['_aiChatUi']['setConversationContext'](_0x3304db['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x2ed057,_0x940919)=>{this['_aiChatUi']['setAddContextOptions'](_0x940919['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x1d75c3,_0x59caa0)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x59caa0['sourceId'],_0x59caa0['source'],_0x59caa0['resources'],_0x59caa0['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x3d8071,_0x4e7712)=>{this['_aiChatUi']['updateResourceState'](_0x4e7712['sourceId'],_0x4e7712['resourceId'],_0x4e7712['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x294a08,_0x5084b2)=>{this['_aiChatUi']['updateCapabilities'](_0x5084b2);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x3c8f7a,_0x26e3bc)=>{const _0x5d01fd=(await this['_aiChatModels']['getAll']())['find'](_0x172c22=>_0x172c22['id']===_0x26e3bc['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x5d01fd,_0x26e3bc['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',(_0x4cbf97,{error:_0x503646,interactionId:_0x5d249f,fileName:_0x2248b9,url:_0x20b460,sourceId:_0x5e3654,sourceLabel:_0x1ee764})=>{const _0x2ded03=_0x5d249f?_0x5d249f+':'+at():at();_0x503646['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Mi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x2ded03}):_0x503646['message']['startsWith']('ai-chat-conversation-init-failed')||_0x503646['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x2ded03}),this['_logError'](_0x503646)):_0x503646['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x2248b9),'id':_0x2ded03}):_0x503646['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x20b460),'id':_0x2ded03}):_0x503646['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x2ded03}):_0x503646['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x2ded03}):_0x503646['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x5e3654&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x5e3654),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x1ee764||'source'),'id':_0x2ded03}),this['_logError'](_0x503646)):_0x503646['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x2ded03}),this['_logError'](_0x503646)):_0x503646['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x2ded03}),this['_logError'](_0x503646)):_0x503646['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x2ded03}),this['_logError'](_0x503646)):_0x503646['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x2ded03}),this['_logError'](_0x503646)):_0x503646['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':_0x2ded03}),this['_logError'](_0x503646)):_0x503646['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':_0x2ded03}),this['_logError'](_0x503646)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x2ded03}),this['_logError'](_0x503646));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x3e43d0||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x50dc3f,attributes:_0x5e6dbe}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x4ef808=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x4ef808);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x50dc3f,'attributes':_0x5e6dbe});}['_logError'](_0x1f329d){Ct(_0x1f329d['message'],_0x1f329d['data']);}['_removeFromContext'](_0x4d3f24){this['activeConversation']?.['removeFromContext'](_0x4d3f24);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x2d22d){const [_0x33e71b,_0x18bf2f]=_0x2d22d['split'](':'),_0x5f22ea=this['activeConversation']['getInteraction'](_0x33e71b),_0x3ab2c3=_0x5f22ea['getReply'](_0x18bf2f);return{'interaction':_0x5f22ea,'reply':_0x3ab2c3};}['_scrollToSuggestionRange'](_0x4ca45e,_0x42e7c5=!0x1,_0x3a1b93){const _0x41eeeb={'target':_0x3a1b93['editing']['view']['domConverter']['viewRangeToDom'](_0x3a1b93['editing']['mapper']['toViewRange'](_0x4ca45e)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x42e7c5};_0x42e7c5&&(_0x41eeeb['alignToTop']=!0x0),Tt(_0x41eeeb);}['_updateConversationTitle'](_0x313956,_0x4dcb51=!0x1){this['_aiChatUi']['setConversationTitle'](_0x313956||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x4dcb51);}['_addFeedItemReply'](_0x5e9472){'text'===_0x5e9472['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x5e9472):this['_aiChatUi']['addFeedItemAISuggestion'](_0x5e9472);}async['_updateReplyContent']({reply:_0x9a95c3,renderingStrategy:_0x5c533}){const {id:_0x37a443,interactionId:_0x107109,isDone:_0x19702a,type:_0x4e81f3,parsedContent:_0x313c00}=_0x9a95c3,_0x11ef63=_0x107109+':'+_0x37a443;if('modification'===_0x4e81f3){const _0x25e5e1=_0x9a95c3['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x11ef63,'parts':_0x25e5e1,'isDone':_0x19702a,'skipLoadingEffects':_0x9a95c3['isFromHistory']});}else'text'===_0x4e81f3&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x11ef63,'parsedContent':_0x313c00['get']('text'),'renderingStrategy':_0x5c533,'isDone':_0x19702a});_0x19702a&&_0x9a95c3['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x11ef63,_0x9a95c3['sources']);}['_updateReplyContentThrottled']=_0x5cb28a(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x2ba7f1=this['activeConversation']?.['lastInteraction'];_0x2ba7f1&&(_0x2ba7f1['stop'](),this['_aiChatUi']['stopInteraction'](_0x2ba7f1)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x4c556e=this['activeConversation']?.['lastInteraction'];if(_0x4c556e){for await(const _0x419f7d of _0x4c556e['replies'])this['_aiChatUi']['hasFeedItem'](_0x419f7d['id'])||this['_addFeedItemReply'](_0x419f7d),await this['_updateReplyContent']({'reply':_0x419f7d,'renderingStrategy':'static'});}}['_updateRatings'](_0x5900bd){const _0x5df4a2={'positiveCount':_0x5900bd['changeGroups']['filter'](_0x10a0f8=>'accepted'===_0x10a0f8['state'])['length'],'totalCount':_0x5900bd['changeGroups']['length'],'modificationId':_0x5900bd['id']},_0x43dca5=this['activeConversation']['getInteraction'](_0x5900bd['interactionId'])['messageId'];_0x43dca5&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x43dca5,_0x5df4a2);}['_getAIChatFeedAPI'](_0x4ff967){const _0x5972c9=this['_aiChatUi'],_0x5a8e69=()=>{_0x4ff967['resetWebSearchState'](),_0x4ff967['resetReasoningState'](),_0x5972c9['clearLoadingMessage']();},_0x586f63=()=>{_0x4ff967['currentReply']&&(_0x4ff967['currentReply']['done'](),_0x4ff967['currentReply']=void 0x0);};return{'insertTextReply':(_0xfdfa97,_0x4edad2)=>{_0x586f63(),_0x5a8e69();const _0x47307a=_0x4ff967['currentReply']=_0x4ff967['createReply']({'type':'text','interactionId':_0x4ff967['id'],'id':_0x4edad2||at(),'channelsToEditors':this['_channelsToEditors']});return _0x47307a['appendContent'](_0xfdfa97),_0x586f63(),_0x47307a;},'insertCustomElement':async(_0x22df93,_0x5c909a)=>(_0x586f63(),_0x5a8e69(),_0x5972c9['addFeedItemCustomElement'](_0x22df93,_0x5c909a||at())),'setLoadingMessage':_0x186572=>{_0x5972c9['setLoadingMessage'](_0x186572);},'clearLoadingMessage':()=>{_0x5972c9['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){Cs(this['context'])['find'](_0x553fcc=>'destroyed'!==_0x553fcc['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}}const fs='ai-selection',Rs=['br'];class AIEditing extends _0x4338bf{constructor(_0x5ae934){super(_0x5ae934),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'](_0x2b8a9f){let _0x4260e3=this['_sessionIdByEditor']['get'](_0x2b8a9f);return!_0x4260e3&&(_0x4260e3=_0x2b8a9f['plugins']['has']('RealTimeCollaborationClient')&&_0x2b8a9f['plugins']['get']('RealTimeCollaborationClient')['sessionId']||at(),this['_sessionIdByEditor']['set'](_0x2b8a9f,_0x4260e3)),_0x4260e3;}async['getDocumentData'](){const _0x15d68c=Cs(this['context']);if(!_0x15d68c['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x479ddb=[],_0x3753cc=new Set();for(const _0x2440e4 of _0x15d68c){const _0x1a9e08=_0x2440e4['config']['get']('roots')||{};for(const _0x549622 of _0x2440e4['model']['document']['getRoots']()){if('$graveyard'===_0x549622['rootName'])continue;const _0x5b9b88=await this['_getDocumentDataForEditorRoot'](_0x2440e4,_0x549622,_0x3753cc),_0x165777=_0x1a9e08[_0x549622['rootName']];let _0x26a04c;_0x165777?.['label']?_0x26a04c=_0x165777['label']:(wt('ai-document-root-missing-label',{'editor':_0x2440e4,'rootConfig':_0x165777}),_0x26a04c=_0x549622['rootName']),_0x479ddb['push']({'editor':_0x2440e4,'rootName':_0x549622['rootName'],'content':_0x5b9b88['content'],'version':_0x5b9b88['version'],'sessionId':this['getSessionId'](_0x2440e4),'channelId':_0x2440e4['config']['get']('collaboration.channelId'),'selections':_0x5b9b88['selections'],'name':_0x26a04c,'description':_0x165777?.['description']});}}return _0x479ddb;}async['_getDocumentDataForEditorRoot'](_0x915b3d,_0x1437a6,_0x210dc7){const _0x4535e6=_0x915b3d['data']['toView'](_0x1437a6,{'convertAiChatSelectionMarker':!0x0}),_0x2277f4=new _0x16ba99(_0x915b3d['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x4535e6,_0x2277f4,_0x210dc7);let _0x400f83=await this['_getDocumentDataStringFromView'](_0x4535e6,_0x915b3d);const _0x1aff97=this['_getMarkersInDocumentOrder'](_0x915b3d,_0x1437a6),_0x175efa=[];for(const _0x9e99c8 of _0x1aff97){const _0x62d999='<'+_0x9e99c8['name']+':start></'+_0x9e99c8['name']+':start>',_0x6d8ddb=_0x400f83['indexOf'](_0x62d999);_0x400f83=_0x400f83['substring'](0x0,_0x6d8ddb)+_0x400f83['substring'](_0x6d8ddb+_0x62d999['length']);const _0xf9c1e6='<'+_0x9e99c8['name']+':end></'+_0x9e99c8['name']+':end>',_0x16af5c=_0x400f83['indexOf'](_0xf9c1e6);_0x400f83=_0x400f83['substring'](0x0,_0x16af5c)+_0x400f83['substring'](_0x16af5c+_0xf9c1e6['length']),_0x175efa['push']({'markerName':_0x9e99c8['name'],'start':_0x6d8ddb,'end':_0x16af5c,'htmlFragment':_0x400f83['substring'](_0x6d8ddb,_0x16af5c)});}return{'content':_0x400f83,'version':_0x915b3d['model']['document']['version'],'selections':_0x175efa};}['afterInit'](){this['context']instanceof _0x1ca247?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0xed89f9,_0x1bf7ad)=>{_0x1bf7ad['on']('ready',()=>{this['_integrateEditor'](_0x1bf7ad);});});}['_setOutputDataProcessor'](_0x4ede9f){this['_outputDataProcessor']=_0x4ede9f;}async['_getDocumentDataStringFromView'](_0x41dca7,_0x1b4c6a){let _0x3749d6;if(this['_outputDataProcessor']){const _0x2a50c8=_0x1b4c6a['data']['processor']['domConverter']['viewToDom'](_0x41dca7),_0x40225a=await this['_outputDataProcessor'](_0x2a50c8);_0x3749d6=_0x1b4c6a['data']['processor']['htmlWriter']['getHtml'](_0x40225a);}else _0x3749d6=_0x1b4c6a['data']['processor']['toData'](_0x41dca7);return _0x3749d6;}['_integrateEditor'](_0x3db1fa){if(!_0x3db1fa['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x3db1fa);_0x3db1fa['ui']['focusTracker']['on']('change:isFocused',(_0x54e7da,_0x2b97f3,_0x493279)=>{_0x493279&&(this['_lastContentFocusedEditor']=_0x3db1fa);}),_0x3db1fa['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x3db1fa&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x3db1fa['conversion']['for']('editingDowncast')['markerToHighlight']({'model':fs,'view':({markerName:_0x1b59aa})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x1b59aa['split'](':')[0x1]],'priority':0xc})}),_0x3db1fa['conversion']['for']('dataDowncast')['markerToElement']({'model':fs+':context','view':(_0x1b1682,{writer:_0x217562,options:_0x9d1987})=>_0x9d1987['convertAiChatSelectionMarker']?_0x217562['createUIElement'](_0x1b1682['markerName']+':'+(_0x1b1682['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x5bd4df){const _0x8f4cfe=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x5bd4df);const _0x1ed010=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x8f4cfe,_0x1ed010);}['hideFakeVisualSelection'](_0xb03f6){const _0x4b2d4e=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0xb03f6);const _0x49f7f0=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x4b2d4e,_0x49f7f0);}async['modelToDataWithIds'](_0x191722,_0x5be1d7){const _0x5a527d=_0x5be1d7['data']['toView'](_0x191722),_0x377edb=new _0x16ba99(_0x5be1d7['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x5a527d,_0x377edb),this['_getDocumentDataStringFromView'](_0x5a527d,_0x5be1d7);}['_setDataIdsOnChildren'](_0x232f31,_0x39749d,_0x4a4ed9=new Set()){let _0x57a374=!0x1;for(const _0x411908 of _0x232f31['getChildren']()){if(!_0x411908['is']('view:element')||Rs['includes'](_0x411908['name']))continue;const _0x1125e7=_0x411908['is']('view:containerElement'),_0x566eea=_0x411908['is']('view:emptyElement'),_0x9f4667=_0x411908['is']('view:rawElement'),_0x29d4cc=this['_setDataIdsOnChildren'](_0x411908,_0x39749d,_0x4a4ed9);if(_0x411908['hasAttribute']('data-id')){_0x57a374=!0x0,_0x4a4ed9['add'](_0x411908['getAttribute']('data-id'));continue;}(_0x1125e7||_0x566eea||_0x9f4667||_0x29d4cc)&&(_0x39749d['setAttribute']('data-id',this['_nextDataId'](_0x4a4ed9),_0x411908),_0x57a374=!0x0);}return _0x57a374;}['_nextDataId'](_0xbe6ded){let _0x3655c5;do{_0x3655c5='';for(let _0xfc6982=0x0;_0xfc6982<0x4;_0xfc6982++)_0x3655c5+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0xbe6ded['has'](_0x3655c5));return _0xbe6ded['add'](_0x3655c5),_0x3655c5;}['getSelectionText'](_0x21676a){const _0x401814=(_0x21676a?_0x21676a['model']:ms(this['context'])['model'])['document']['selection'],_0xd31bb2=[],_0x59a5de=Array['from'](_0x401814['getRanges']());_0x59a5de['sort']((_0x417861,_0x505d6f)=>_0x417861['start']['isBefore'](_0x505d6f['start'])?-0x1:0x1);for(const _0x3646a0 of _0x59a5de)for(const _0x261ae5 of _0x3646a0['getItems']())_0x261ae5['is']('$textProxy')?_0xd31bb2['push'](_0x261ae5['data']):_0x261ae5['is']('element')&&_0xd31bb2['length']>0x0&&'\x20'!==_0xd31bb2[_0xd31bb2['length']-0x1]&&_0xd31bb2['push']('\x20');return _0xd31bb2['length']?'\x22'+_0xd31bb2['join']('')['trim']()+'\x22':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x42f977){for(let _0x55ed96=0x0;_0x55ed96<this['_fakeSelections']['length'];_0x55ed96++)if(this['_fakeSelections'][_0x55ed96]['id']==_0x42f977)return void this['_fakeSelections']['splice'](_0x55ed96,0x1);}['_addFakeSelection'](_0x3885d7){this['_removeFakeSelectionById'](_0x3885d7['id']),ft(this['_fakeSelections'],_0x3885d7);}['_refreshFakeSelection'](_0x1e637a,_0x2d16af){if(_0x1e637a==_0x2d16af)return;const _0x12556d=_0x1e637a?_0x1e637a['editor']:null,_0x4c0831=_0x2d16af?_0x2d16af['editor']:null,_0x32d512=(_0x4bec60,_0x32fdc0)=>{const _0xbee917=_0x32fdc0['model']['markers']['getMarkersGroup'](fs);for(const _0x22d2dd of _0xbee917)_0x4bec60['removeMarker'](_0x22d2dd);},_0x4602b9=(_0x4daff1,_0x491ca4,_0x1d84d0)=>{const _0x5e7d5d=_0x491ca4['model'];for(let _0x56d5f7=0x0;_0x56d5f7<_0x1d84d0['ranges']['length'];_0x56d5f7++){let _0x1359e4=_0x1d84d0['ranges'][_0x56d5f7];const _0x40e650=fs+':'+_0x1d84d0['id']+':'+_0x56d5f7;if(_0x1359e4['start']['isAtEnd']){const _0x2a2266=_0x1359e4['start']['getLastMatchingPosition'](({item:_0x3177b3})=>!_0x5e7d5d['schema']['isContent'](_0x3177b3),{'boundaries':_0x1359e4});_0x1359e4=_0x4daff1['createRange'](_0x2a2266,_0x1359e4['end']);}_0x4daff1['addMarker'](_0x40e650,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1359e4});}};_0x12556d&&_0x4c0831&&_0x12556d===_0x4c0831&&_0x2d16af?_0x12556d['model']['change'](_0x4e673f=>{_0x32d512(_0x4e673f,_0x12556d),_0x4602b9(_0x4e673f,_0x4c0831,_0x2d16af);}):(_0x12556d&&_0x12556d['model']['change'](_0x51971c=>_0x32d512(_0x51971c,_0x12556d)),_0x4c0831&&_0x2d16af&&_0x4c0831['model']['change'](_0x3c41b1=>_0x4602b9(_0x3c41b1,_0x4c0831,_0x2d16af)));}['_getMarkersInDocumentOrder'](_0x1b4856,_0x24b2b1){const _0x3ea99d=Array['from'](_0x1b4856['model']['markers']['getMarkersGroup'](fs+':context'));return(_0x24b2b1?_0x3ea99d['filter'](_0xce3a2e=>{const _0x25bb68=_0xce3a2e['getRange']();return _0x25bb68&&_0x25bb68['root']['rootName']===_0x24b2b1['rootName'];}):_0x3ea99d)['sort']((_0x133954,_0x208f27)=>_0x133954['getStart']()['isBefore'](_0x208f27['getStart']())?-0x1:_0x133954['getStart']()['isAfter'](_0x208f27['getStart']())?0x1:0x0);}}const bs=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],Ss=[...bs,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function Os(_0x2a3cd1){const _0x1e5648=new AbortController();return{'promise':new Promise((_0x4e026a,_0xa07adc)=>{const _0x3deef8=setTimeout(_0x4e026a,_0x2a3cd1);_0x1e5648['signal']['addEventListener']('abort',()=>{clearTimeout(_0x3deef8),_0xa07adc();});}),'abortController':_0x1e5648};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x18883d){this['options']={'delay':_0x18883d?.['delay']??0xa,'textNodeStyle':_0x18883d?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x490da2,targetElement:_0x28e1f7,abortSignal:_0x205871}){this['isStreaming']&&this['stop'](),_0x205871?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x1e46dd(_0x490da2,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x4b0c33=0x0;_0x4b0c33<this['currentIndex'];_0x4b0c33++)this['nodesList'][_0x4b0c33]['shouldBeStreamed']=!0x0;do{const _0x5342c9=Date['now'](),_0x469273=this['nodesList'][this['currentIndex']],_0x48b914=_0x5342c9-this['lastUpdateTime'];if(_0x469273){_0x469273['shouldBeStreamed']=!0x0;let _0x3122e1=_0x469273['parent'];for(;_0x3122e1;)_0x3122e1['shouldBeStreamed']=!0x0,_0x3122e1=_0x3122e1['parent'];}if(_0x48b914<this['options']['delay'])try{const {promise:_0x171d8b,abortController:_0x4f39aa}=Os(this['options']['delay']-_0x48b914);this['timeoutAbortController']=_0x4f39aa,await _0x171d8b;}catch(_0x72139f){return;}_0x7659e8(_0x28e1f7,'<'+_0x28e1f7['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x28e1f7['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:_0x8857dd}){Array['from'](_0x8857dd['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x1b8396=>{_0x1b8396['replaceWith'](_0x1b8396['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x28f9f6){let _0x409b1e='';if(function(_0xd1395){return _0x49314d(_0xd1395);}(_0x28f9f6)){for(const _0xa04b7c of _0x28f9f6['children'])_0x409b1e+=this['renderNode'](_0xa04b7c);}else{if(ys(_0x28f9f6)){if(!_0x28f9f6['shouldBeStreamed'])return'';const _0x48991a=_0x28f9f6,_0x350bac=Object['entries'](_0x48991a['attribs'])['map'](([_0x1876fc,_0x37961d])=>_0x1876fc+'=\x22'+_0x37961d+'\x22')['join']('\x20');_0x409b1e+='<'+_0x48991a['tagName']+(_0x350bac?'\x20'+_0x350bac:'')+'>';for(const _0xf913ac of _0x4ec021(_0x48991a))_0x409b1e+=this['renderNode'](_0xf913ac);_0x409b1e+='</'+_0x48991a['tagName']+'>';}else{if(!ks(_0x28f9f6))return'';if(!_0x28f9f6['shouldBeStreamed'])return'';!function(_0x107775){if(!_0x107775['parent']||!ys(_0x107775['parent']))return!0x1;if(!vs['includes'](_0x107775['parent']['tagName']))return!0x1;return!ti(_0x107775)['match'](/^\s*[<>]\s*$/);}(_0x28f9f6)?_0x409b1e+=_0x2f5a10(_0x28f9f6):_0x409b1e+=_0x2f5a10(new _0x303c52('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x28f9f6]));}}return _0x409b1e;}['getParsedDocumentNodeList'](){const _0x3766f9=[];return function(_0x5c4b0d,_0x2f404c){const _0x163960=_0x6ec947=>{if(_0x2f404c(_0x6ec947),_0x6ec947 instanceof _0x10fc81)for(let _0x3b1d62=0x0;_0x3b1d62<_0x6ec947['children']['length'];_0x3b1d62++){const _0x35d26a=_0x6ec947['children'][_0x3b1d62];_0x163960(_0x35d26a);}};for(let _0x5a0790=0x0;_0x5a0790<_0x5c4b0d['children']['length'];_0x5a0790++)_0x163960(_0x5c4b0d['children'][_0x5a0790]);}(this['document'],_0x7dffb4=>{if(ks(_0x7dffb4)){const _0x528d9a=this['splitTextNodeIntoWordNodes'](_0x7dffb4);_0x528d9a['length']&&_0x3766f9['push'](..._0x528d9a);}_0x7dffb4['isWordSplitSource']||_0x7dffb4['isWordSplitResult']||_0x3766f9['push'](_0x7dffb4);}),_0x3766f9;}['splitTextNodeIntoWordNodes'](_0x12bc28){if(_0x12bc28['isWordSplitSource']||_0x12bc28['isWordSplitResult'])return[];const _0x59eeb8=ti(_0x12bc28)['match'](/(?:\s*\S+\s*)/g),_0x569727=[];if(_0x59eeb8&&_0x59eeb8['length']>0x1){for(const _0x39e037 of _0x59eeb8){const _0x18b1f9=new _0x20e1cd(_0x39e037);_0x18b1f9['isWordSplitResult']=!0x0,_0x4f5ae8(_0x12bc28,_0x18b1f9),_0x569727['push'](_0x18b1f9);}_0x12bc28['isWordSplitSource']=!0x0,_0x2cc5d2(_0x12bc28);}return _0x569727;}}const vs=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ks(_0x5db3c3){return _0x2d6a0b(_0x5db3c3);}function ys(_0x321629){return _0x5b8d32(_0x321629);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x1694f8){super();const _0x19f2c3=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x1694f8,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x19f2c3['if']('isDone','ck-ai-chat__feed__item_done'),_0x19f2c3['if']('isVisible','ck-hidden',_0x25a441=>!_0x25a441),'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'](_0x243a7e=>{_0x243a7e['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x5a0009,_0x31f264,_0x345e1b){await this['htmlStreamer']['stream']({'document':_0x5a0009,'targetElement':_0x31f264,'abortSignal':_0x345e1b});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0x41d3ab,_0x4646b6){super(_0x41d3ab),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0x41d3ab),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Gi,'label':Mi(_0x41d3ab,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x4646b6['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x3dfbec=>_0x3dfbec?_0x25bd6e:_0x5387a4),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x313a2e=new Lt();_0x313a2e['content']=_0x19e64b,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x4646b6['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x313a2e,{'tag':'span','children':[Mi(_0x41d3ab,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends yt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const Ns={'accepted':_0x330195,'rejected':_0x17306,'outdated':_0x17306};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x287f81){super(_0x287f81);const _0x3efd08=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',_0x3efd08['to']('state',_0x128b00=>'ck-ai-suggestion__content-part-state_'+_0x128b00),_0x3efd08['if']('isVisible','ck-hidden',_0x20d79e=>!_0x20d79e)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x3efd08['to']('state',_0x158e62=>{switch(_0x158e62){case'accepted':return Mi(_0x287f81,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Mi(_0x287f81,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Mi(_0x287f81,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x5087fd){this['state']=_0x5087fd;}}class StateIconView extends Lt{constructor(){super(),this['set']('state','accepted'),this['content']=Ns[this['state']],this['on']('change:state',()=>{this['content']=Ns[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x138120,_0x283926,_0x3b22f8){super(_0x138120);const _0x12fbdd=Boolean(_0x3b22f8);this['set']('isEnabled',!_0x12fbdd),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x4fb993=[];if(_0x12fbdd){const _0x589239=new yt(_0x138120);_0x589239['set']({'label':Mi(_0x138120,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x26a454}),_0x589239['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x4fb993['push'](_0x589239);}else{_0x283926['includes']('applySuggestion')&&(this['_applyButton']=new yt(_0x138120),this['_applyButton']['set']({'label':Mi(_0x138120,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x330195}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x37c4ae=>!_0x37c4ae),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x4fb993['push'](this['_applyButton'])),_0x283926['includes']('insertSuggestion')&&(this['_suggestButton']=new yt(_0x138120),this['_suggestButton']['set']({'label':Mi(_0x138120,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x18ea5d}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x4fb993['push'](this['_suggestButton']));const _0xcc7ab3=new yt(_0x138120);_0xcc7ab3['set']({'label':Mi(_0x138120,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x17306}),_0xcc7ab3['bind']('isEnabled')['to'](this),_0xcc7ab3['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x4fb993['push'](_0xcc7ab3);}this['items']['addMany'](_0x4fb993);const _0x1b8d19=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x1b8d19['if']('isVisible','ck-hidden',_0x3600db=>!_0x3600db)]}});}['setButtonsVisibility']({showApplyButton:_0x4a3093,showSuggestButton:_0xf40dd7}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x4a3093),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0xf40dd7);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x4617e7,{part:_0x18370c,uiIndex:_0x1d1d30,availableActions:_0x2072ba,areActionsDisabled:_0x30ba50}){super(_0x4617e7),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x4617e7,_0x2072ba,_0x30ba50),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x18370c['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x18370c['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x18370c['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x4617e7),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x4617e7,_0x1d1d30),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',(_0x282f3f,_0x1f6655,_0x342e1d,_0xc25a9c)=>{'pending'===_0xc25a9c?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x342e1d?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x342e1d),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0x237890,_0x5b7732){super(_0x237890),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Mi(_0x237890,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x5b7732['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0x2b0a66){super(_0x2b0a66),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:_0x51dde2,renderingStrategy:_0x55aa03,abortSignal:_0x3512ed}){const _0x50f6ec=_0x1e46dd(_0x51dde2['content'],!0x0);for(const _0x3b7fce of qi(_0x50f6ec))_0x2cc5d2(_0x3b7fce);'streaming'===_0x55aa03?await this['htmlStreamer']['stream']({'document':_0x50f6ec,'targetElement':this['element'],'abortSignal':_0x3512ed}):_0x7659e8(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x50f6ec)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x1b9c00,{part:_0x88ea4f,uiIndex:_0x183d93,areActionsDisabled:_0x3c03d4,availableActions:_0x16c73b}){super(_0x1b9c00);const _0x4337c9=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 _0x4bb11e=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x3c03d4;};this['on']('change:state',_0x4bb11e),this['on']('change:isDone',_0x4bb11e),_0x4bb11e(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x1b9c00,{'part':_0x88ea4f,'uiIndex':_0x183d93,'availableActions':_0x16c73b,'areActionsDisabled':_0x3c03d4}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...bs)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x1b9c00),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x4337c9['to']('state',_0x5d5ce8=>'ck-ai-suggestion__body__content-part_'+_0x5d5ce8),_0x4337c9['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x4337c9['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x4337c9['if']('isVisible','ck-hidden',_0x287270=>!_0x287270)]},'children':this['_children'],'on':{'mouseenter':_0x4337c9['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x88ea4f['index']});}),'mouseleave':_0x4337c9['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x88ea4f['index']});}),'click':_0x4337c9['to'](_0x31a399=>{const _0x46241e=_0x31a399['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x46241e)&&this['fire']('showChangeInText',{'index':_0x88ea4f['index']});})}});}async['updateContent']({part:_0x5e2053,showUnchangedParts:_0x5829d9=!0x1,abortSignal:_0x1a06d6}){this['partDefinition']=_0x5e2053,this['isVisible']=this['partDefinition']['hasChanges']||_0x5829d9,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x5e2053,'renderingStrategy':'static','abortSignal':_0x1a06d6});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0x14da03,_0x4093dc){super(_0x14da03),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x4606f1=>!_0x4606f1)]},'children':this['_createSkeletonItems'](_0x4093dc)});}['_createSkeletonItems'](_0x4b707d){const _0xd9c48=['ck','ck-ai-skeleton__item'];return _0x4b707d['map'](_0x5c0dd0=>{let _0x5cb9f1='';switch(_0x5c0dd0['attributes']['align']){case'right':_0x5cb9f1='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x5cb9f1='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x5cb9f1='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x5c0dd0['tag'],'attributes':{'class':[..._0xd9c48,_0x5c0dd0['attributes']['class']?_0x5c0dd0['attributes']['class']:''],'style':'width:\x20'+_0x5c0dd0['attributes']['width']+';\x20height:\x20'+_0x5c0dd0['attributes']['height']+';'+_0x5cb9f1}};});}}const xs={'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':Ls(0x5,'100%','44px','right'),'aiChatResources':Ls(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 Ls(_0x25ad58,_0x18f724,_0x2bfdfb,_0x4a8e79){return new Array(_0x25ad58)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x18f724,'height':_0x2bfdfb,'align':_0x4a8e79}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0xbbcdec){const _0x2076f7=this['createTask'](_0xbbcdec);return this['queue']['push'](_0x2076f7),this['_processQueue'](),_0x2076f7['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(_0x5376db=>{this['once']('_queueEmpty',()=>{_0x5376db();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x1a3490=this['queue']['shift']();try{await _0x1a3490['callback'](this['_abortController']['signal']),_0x1a3490['resolve']();}catch(_0x119f81){_0x1a3490['reject'](_0x119f81);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x4ae519){let _0xfb678c,_0x2fad5d;const _0x3ec032=new Promise((_0x123112,_0x515859)=>{_0xfb678c=_0x123112,_0x2fad5d=_0x515859;});return{'callback':_0x4ae519,'resolve':_0xfb678c,'reject':_0x2fad5d,'completePromise':_0x3ec032};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x1f76ba){super(_0x1f76ba),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x1f76ba['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x32755b){this['element']['innerHTML']=_0x32755b;}}const Ps=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x29bc01,_0x238e1d=[...Ps],_0x5cc0dd){super(_0x29bc01);const _0x500db1=this['bindTemplate'],_0x41cb50=Boolean(_0x5cc0dd);if(this['set']('isEnabled',!_0x41cb50),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x41cb50){const _0x5b3cf2=new yt(_0x29bc01);_0x5b3cf2['set']({'label':Mi(_0x29bc01,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x26a454}),_0x5b3cf2['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x1c9021=new Nt(_0x29bc01);_0x1c9021['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Mi(_0x29bc01,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x5b3cf2]}]}),this['children']['add'](_0x1c9021);}else this['_applyChangesButton']=new yt(_0x29bc01),this['_applyChangesButton']['set']({'label':Mi(_0x29bc01,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x238e1d['includes']('applySuggestion'),'class':Ui}),this['_insertSuggestionsButton']=new yt(_0x29bc01),this['_insertSuggestionsButton']['set']({'label':Mi(_0x29bc01,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x238e1d['includes']('insertSuggestion'),'class':Bi}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x2ce11d=>{_0x2ce11d['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',_0x500db1['if']('isVisible','ck-hidden',_0x9a0ba5=>!_0x9a0ba5)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0xa3a630){this['isVisible']=_0xa3a630;}['_switchButtonLabelsPlurality'](_0x77cb09){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x77cb09?(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(_0x5936f7,_0x353ef9){super(_0x5936f7),this['bodyCollection']=_0x353ef9,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',_0x55e5ec=>!_0x55e5ec)]},'children':this['children']});const _0x20eb1f=new Nt(this['locale']),_0x3570c5=new Lt();_0x3570c5['content']=_0x3dea76,_0x20eb1f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x3570c5,{'tag':'span','children':[{'text':Mi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x20eb1f),this['_setupBalloonPanel'](_0x5936f7);}['addSource'](_0x4dd4f8){this['children']['add'](new AIWebSourceView(this['locale'],_0x4dd4f8,this['balloonPanelView']));}['_setupBalloonPanel'](_0x5cb786){this['balloonPanelView']=new zt(_0x5cb786),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends yt{['balloonPanelView'];['source'];constructor(_0x290f51,_0x4a15c1,_0x29c378){super(_0x290f51),this['source']=_0x4a15c1,this['balloonPanelView']=_0x29c378,this['set']({'label':_0x4a15c1['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x3d4932=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x3d4932['to'](()=>{window['open'](_0x4a15c1['url'],'_blank');}),'mouseenter':_0x3d4932['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x3d4932['to'](()=>{this['_hideTooltip']();})}}),_0x4a15c1['favicon']){const _0x4fd4ec=new Nt(_0x290f51);_0x4fd4ec['setTemplate']({'tag':'img','attributes':{'src':_0x4a15c1['favicon']||_0x3dea76,'alt':_0x4a15c1['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x4fd4ec);}else this['set']('icon',_0x3dea76);}['_createTooltipContentView'](_0x589e55,_0x165623){const _0x43b116=new Nt(_0x589e55),_0xb15df6=[];let _0x426433;_0x165623?.['favicon']?(_0x426433=new Nt(_0x589e55),_0x426433['setTemplate']({'tag':'img','attributes':{'src':_0x165623['favicon'],'alt':_0x165623['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x426433=new Lt(),_0x426433['content']=_0x3dea76,_0x426433['extendTemplate']({'attributes':{'alt':_0x165623['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0xb15df6['push'](_0x426433);const _0x1c0b04=new Nt(_0x589e55);_0x1c0b04['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x165623['url']},'children':[{'text':new URL(_0x165623['url'])?.['hostname']}]}),_0xb15df6['push'](_0x1c0b04);const _0x4f94d7=new Nt(_0x589e55);_0x4f94d7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0xb15df6});const _0x3f5aa8=new Nt(_0x589e55);return _0x3f5aa8['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x165623['title']['length']>0x190?_0x165623['title']['substring'](0x0,0x190)+'...':_0x165623['title']}]}),_0x43b116['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x4f94d7,_0x3f5aa8]}),_0x43b116;}['_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 _0x12db4e=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x12db4e);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x35b1c0(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x25abe9,_0x5381b3){super(_0x25abe9);const {areActionsDisabled:_0xc2220c,showUnchangedParts:_0x131976,availableActions:_0x166e4e}=_0x5381b3;this['_areActionsDisabled']=_0xc2220c,this['_showUnchangedParts']=_0x131976,this['_availableActions']=_0x166e4e,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x25abe9,xs['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(_0x25abe9,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x25abe9,_0x5381b3['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x5381b3['bodyCollection']),_0x5381b3['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...bs)['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'](_0x4dca3c=>_0x4dca3c instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0x22925e,abortSignal:_0x39cbb1,skipLoadingEffects:_0x3f2023}){this['_cachedContentParts']['length']?_0x22925e['forEach'](_0x2a3669=>{const _0x4ecefd=this['_cachedContentParts']['findIndex'](_0x4bee3f=>_0x4bee3f['index']==_0x2a3669['index']);-0x1===_0x4ecefd?this['_cachedContentParts']['push'](_0x2a3669):this['_cachedContentParts'][_0x4ecefd]=_0x2a3669;}):this['_cachedContentParts']=_0x22925e;const _0xa75ced=this['_showUnchangedParts']?_0x22925e:_0x22925e['filter'](_0xd1bb9e=>_0xd1bb9e['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0xa75ced['length']>0x1),_0x3f2023&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x466913 of _0xa75ced)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x32f822=>{let _0x4880d3=this['getPartView'](_0x466913['index']);if(!_0x4880d3){if(_0x4880d3=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0x466913,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x4880d3['delegate'](...bs)['to'](this),_0x4880d3['bind']('isTrackChangesOn')['to'](this),!_0x3f2023&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x32f822),_0x32f822['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x4880d3,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x3f2023||this['_showSkeletonDebounced']();}await _0x4880d3['updateContent']({'part':_0x466913,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x32f822}),_0x4880d3['markAsDone']();});return _0x39cbb1?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x3472ba,_0xc9d889){const _0x4c709e=this['getPartView'](_0x3472ba);_0x4c709e&&(_0x4c709e['state']=_0xc9d889),this['hasPendingParts']='pending'==_0xc9d889||this['_contentPartViews']['some'](_0x420110=>'pending'==_0x420110['state']);}['setPartActive'](_0x23d634,_0x345576){if(!0x1===_0x23d634){for(const _0x36af03 of this['_contentPartViews'])_0x36af03['isActive']=!0x1;}else{const _0x2a9daf=this['getPartView'](_0x23d634);_0x2a9daf&&(_0x2a9daf['isActive']=_0x345576);}}['updateSources'](_0x56fc85){_0x56fc85['forEach'](_0x5e6387=>this['_sourcesView']['addSource'](_0x5e6387)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x1683e9){return this['_contentPartViews']['find'](_0x405680=>_0x405680['partDefinition']['index']==_0x1683e9)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x3bf023=!this['_cachedContentParts']['find'](({hasChanges:_0x2c2ecf})=>_0x2c2ecf),_0x4880d1=!!this['_cachedContentParts']['find'](({hasChanges:_0x395f89})=>!_0x395f89);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x4880d1,_0x3bf023?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'](_0x1f71e2=>_0x1f71e2['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x22af15){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x33bd9d=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x33bd9d>0x0){const {promise:_0xf2ac53,abortController:_0x442453}=Os(_0x33bd9d);_0x22af15?.['addEventListener']('abort',()=>_0x442453['abort']()),await _0xf2ac53['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x5ab9d3=>_0x5ab9d3['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x36ff48,_0x190946,_0x5d2ba0){super(_0x36ff48);const {showDiff:_0x5b209b,areActionsDisabled:_0x37da5e,showUnchangedParts:_0x18b661,availableActions:_0x6ce29a}=_0x190946;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x36ff48,{'showDiff':_0x5b209b}),this['headerView']['on']('toggleShowChanges',(_0x16db4f,_0x4473f7)=>{this['areChangesVisible']=_0x4473f7['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x4473f7['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x36ff48,{'areActionsDisabled':_0x37da5e,'showUnchangedParts':!!_0x18b661,'availableActions':_0x6ce29a,'bodyCollection':_0x5d2ba0}),this['bodyView']['delegate'](...bs)['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'](_0x1c2990){await this['bodyView']['updateContentParts'](_0x1c2990);}['updateSources'](_0x2a7f3f){this['bodyView']['updateSources'](_0x2a7f3f);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x341d9f,_0x30b332,_0x4f8372){super(_0x30b332),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x341d9f,{'showDiff':_0x30b332['showDiff'],'areActionsDisabled':_0x30b332['areActionsDisabled'],'availableActions':_0x30b332['availableActions']},_0x4f8372),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x521b42,_0x79d974)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x79d974['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',(_0x1e0555,{index:_0x583730})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x583730});}),this['containerView']['on']('applySuggestion',(_0x264a8e,{index:_0x4cc224}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x4cc224});}),this['containerView']['on']('insertSuggestion',(_0x5c8967,{index:_0x172a59}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x172a59});}),this['containerView']['on']('rejectSuggestion',(_0x44b1ad,{index:_0x10fe10})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x10fe10});}),this['containerView']['on']('mouseOverSuggestion',(_0x1c1b42,{index:_0x33c0a4})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x33c0a4});}),this['containerView']['on']('mouseLeaveSuggestion',(_0xd5dd16,{index:_0x442d3f})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x442d3f});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x3ed3d6){await this['containerView']['updateContent'](_0x3ed3d6);}['updatePartState'](_0x4252d1,_0x1648e5){this['containerView']['bodyView']['updatePartState'](_0x4252d1,_0x1648e5);}['setPartActive'](_0x38a365,_0x387424){!0x1===_0x38a365?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x38a365,_0x387424);}['updateSources'](_0x149a6a){this['containerView']['updateSources'](_0x149a6a);}['getPartView'](_0x2838ca){return this['containerView']['bodyView']['getPartView'](_0x2838ca);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0x54278a,_0x2bcb34,_0x4eb0ee){super(_0x2bcb34),this['_bodyCollection']=_0x4eb0ee,this['locale']=_0x54278a,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:_0x4e6058,renderingStrategy:_0x3718f7,abortSignal:_0x139194}){'streaming'===_0x3718f7?await this['streamIntoElement'](_0x4e6058,this['replyContainer']['element'],_0x139194):this['replyContainer']['element']['innerHTML']=_0x2f5a10(_0x4e6058);}['updateSources'](_0x27186d){const _0x13e72b=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x13e72b['children']['addMany'](_0x27186d['map'](_0x5d8883=>new AIWebSourceView(this['locale'],_0x5d8883,_0x13e72b['balloonPanelView']))),_0x13e72b['isVisible']=!0x0,this['children']['add'](_0x13e72b);}}class AISpinnerView extends xt{constructor(_0x345685=void 0x0){super();const _0x226784=_0x345685?'ck-ai-spinner_'+_0x345685:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x226784]}});}}const Ds={'file':_0x1b56c8,'image':_0x52daf1,'document':_0x19e64b,'web-resource':_0x128991,'text':_0x1b56c8,'selection':_0x1dcf67,'mcp-tool-context':_0x19e64b},Vs='ck-ai-chat-context-chip',Hs='ck-ai-chat-context-chip_wide',Ms='ck-ai-chat-context-chip_document',Us='ck-ai-chat-context-chip__label',Bs='ck-ai-chat-context-chip__type-icon',Gs='ck-ai-chat-context-controls__chip-tooltip',Fs='n';class AIChatContextItemButtonView extends yt{constructor(_0x40e7d7,_0x397967,_0xfcf7db,_0x13ebe5,_0x1feb11=!0x1){super(_0x40e7d7),this['_isAnimationOnEnterEnabled']=_0x13ebe5,this['_initializeProperties'](_0x397967,_0xfcf7db,_0x1feb11),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'](_0x3499cb,_0x49b67f,_0x34dee2){this['set']('label',_0x3499cb['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x3499cb['type']),this['set']('id',_0x3499cb['uiId']),this['set']('readonly',_0x49b67f),this['set']('isLoading',_0x34dee2);}['_setupTemplate'](){const _0x4df24a=this['_createIconView'](),_0x535b1f=this['_createRemoveButton'](),_0x4ee2ff=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x4ee2ff),'children':this['_createTemplateChildren'](_0x4df24a,_0x535b1f,_0x4ee2ff)});}['_createTemplateAttributes'](_0x1e32b7){return{'class':[Vs,_0x1e32b7['if']('itemType',Ms,_0x299644=>'document'==_0x299644),_0x1e32b7['if']('itemType',Hs,_0x475704=>'selection'==_0x475704)],'data-cke-tooltip-text':_0x1e32b7['to']('label',Ws),'data-cke-tooltip-position':Fs,'data-cke-tooltip-class':Gs};}['_createTemplateChildren'](_0x141f34,_0x550c94,_0x3f11e1){const _0x5084a0=this['_createLabelElement'](_0x3f11e1),_0x10e699=this['_createLoaderIcon']();return this['readonly']?[_0x141f34,_0x5084a0]:[_0x141f34,_0x10e699,_0x5084a0,_0x550c94];}['_createLabelElement'](_0x1031c6){return{'tag':'span','attributes':{'class':Us},'children':[{'text':_0x1031c6['to']('label')}]};}['_createRemoveButton'](){const _0x4943d1=new yt(this['locale']);return _0x4943d1['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x17f7a6}),this['_setupRemoveButtonEvent'](_0x4943d1),_0x4943d1;}['_setupRemoveButtonEvent'](_0x140c89){_0x140c89['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x36e302=this['bindTemplate'],_0x808fa9=new Lt();return _0x808fa9['content']=Ds[this['itemType']],_0x808fa9['extendTemplate']({'attributes':{'class':[Bs,_0x36e302['if']('isLoading','ck-hidden',_0x236f1f=>_0x236f1f)]}}),_0x808fa9;}['_handleAnimationEndOnce'](_0x7ad9c7,_0x4d6a1a){if(!_0x7ad9c7)return;const _0x5168d9=()=>{_0x4d6a1a(),_0x7ad9c7['removeEventListener']('animationend',_0x5168d9),_0x7ad9c7['removeEventListener']('webkitAnimationEnd',_0x5168d9);};_0x7ad9c7['addEventListener']('animationend',_0x5168d9),_0x7ad9c7['addEventListener']('webkitAnimationEnd',_0x5168d9);}['_createLoaderIcon'](){const _0x6fe014=new AISpinnerView('small');return _0x6fe014['bind']('isVisible')['to'](this,'isLoading',_0x4e0fd2=>_0x4e0fd2),_0x6fe014;}}function Ws(_0x10b344){if(!_0x10b344)return _0x10b344;if(_0x10b344['length']<=0x78)return _0x10b344;const _0x48512c=_0x10b344['slice'](0x0,0x78),_0x312458=_0x48512c['lastIndexOf']('\x20');return(_0x312458>0x0?_0x48512c['slice'](0x0,_0x312458):_0x48512c)+'…';}const Ks={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Ys='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0x38eb1f,_0x258812,_0x1418ba,_0x4ab7a3,_0x3b809e){this['_locale']=_0x38eb1f,this['_visibleChips']=_0x258812,this['_config']={...Ks,..._0x1418ba,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x1418ba['cssClasses']}},this['_overflowChips']=new _t(),this['_bodyCollection']=_0x4ab7a3,this['_parentView']=_0x3b809e||null;}['setContainerElement'](_0x510834){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x510834,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 _0x4db2a7=[...this['_visibleChips'],...this['_overflowChips']],_0x19fc26=this['_createCalculationContainer'](),_0x5d2c25=this['_calculateOverflowInContainer'](_0x19fc26,_0x4db2a7),_0x107f59=_0x19fc26['_ancestorsToRestore'];_0x107f59&&this['_restoreAncestorVisibility'](_0x107f59),_0x19fc26['remove'](),this['_applyOverflowResults'](_0x4db2a7,_0x5d2c25);}['_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 _0x349e40=new yt(this['_locale']);_0x349e40['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x30cf1b=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x30cf1b['push'](this['_config']['cssClasses']['controlsButton']),_0x349e40['extendTemplate']({'attributes':{'class':_0x30cf1b}}),_0x349e40;}['_createShowMoreBalloonPanelView'](){const _0xe858ef=new zt(this['_locale']);return _0xe858ef['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0xe858ef),_0xe858ef;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x5da6bc=>{_0x5da6bc['disableAnimationOnEnter']();});const _0x2b9ad7=new Nt(this['_locale']);_0x2b9ad7['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x2b9ad7);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x5a793c=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x5a793c?'':'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'](_0x4c795e){const _0x26231e=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x46f66a=this['_containerElement']?.['classList'];if(_0x46f66a){const _0x4233cb=_0x46f66a[0x0]||'',_0x4d52a2=_0x4c795e['querySelector']('.'+_0x4233cb),_0x50ca55=_0x4c795e['querySelector'](_0x26231e);return _0x4d52a2||_0x50ca55||_0x4c795e;}return _0x4c795e['querySelector'](_0x26231e)||_0x4c795e;}['_calculateContainerWidth'](){const _0x29cfdb=this['_parentView']?.['element']||this['_containerElement'];if(!_0x29cfdb)return Ys;const _0x33cb6b=window['getComputedStyle'](_0x29cfdb)['width'];if('auto'===_0x33cb6b||'0px'===_0x33cb6b||!_0x33cb6b){const _0x5a8bd0=_0x29cfdb['parentElement'];if(_0x5a8bd0){const _0x8f5559=window['getComputedStyle'](_0x5a8bd0);return'auto'!==_0x8f5559['width']?_0x8f5559['width']:Ys;}return Ys;}return _0x33cb6b;}['_applyCalculationStyles'](_0x321d60,_0x46ea11){this['_config']['cssClasses']['calculationContainer']&&_0x321d60['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x321d60['style']['width']=_0x46ea11,_0x321d60['style']['position']='absolute',_0x321d60['style']['top']='-9999px',_0x321d60['style']['left']='-9999px',_0x321d60['style']['opacity']='0',_0x321d60['style']['pointerEvents']='none',_0x321d60['style']['zIndex']='-1',_0x321d60['style']['visibility']='visible\x20!important',_0x321d60['style']['display']='block\x20!important',_0x321d60['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x2a0d81){_0x2a0d81['forEach'](({element:_0x4cbdf0,originalDisplay:_0x4dab24,originalVisibility:_0x4387bd})=>{_0x4cbdf0['style']['display']=_0x4dab24,_0x4cbdf0['style']['visibility']=_0x4387bd;});}['_makeAncestorsVisible'](_0x23962b){const _0x2ae6e7=[];let _0x5a6c0e=_0x23962b;for(;_0x5a6c0e&&_0x5a6c0e!==document['body'];){const _0xc24c9d=window['getComputedStyle'](_0x5a6c0e);'none'!==_0xc24c9d['display']&&'hidden'!==_0xc24c9d['visibility']||(_0x2ae6e7['push']({'element':_0x5a6c0e,'originalDisplay':_0x5a6c0e['style']['display'],'originalVisibility':_0x5a6c0e['style']['visibility']}),_0x5a6c0e['style']['display']='block',_0x5a6c0e['style']['visibility']='visible'),_0x5a6c0e=_0x5a6c0e['parentElement'];}return _0x2ae6e7;}['_createContainerElements'](){let _0x2f8f4c,_0xb2598f;return this['_parentView']?.['element']?(_0x2f8f4c=this['_parentView']['element']['cloneNode'](!0x0),_0xb2598f=this['_findTargetContainer'](_0x2f8f4c)):(_0x2f8f4c=document['createElement']('div'),_0xb2598f=_0x2f8f4c),{'calculationContainer':_0x2f8f4c,'targetContainer':_0xb2598f};}['_createCalculationContainer'](){const {calculationContainer:_0x14bbc6,targetContainer:_0x1a2299}=this['_createContainerElements'](),_0x1bf996=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x14bbc6,_0x1bf996);const _0x47127f=this['_parentView']?.['element']||this['_containerElement'],_0x3864ad=_0x47127f?.['parentElement'];_0x3864ad?_0x3864ad['appendChild'](_0x14bbc6):document['body']['appendChild'](_0x14bbc6),_0x14bbc6['_targetContainer']=_0x1a2299;const _0x1e5823=this['_makeAncestorsVisible'](_0x3864ad||null);return _0x14bbc6['offsetWidth'],_0x14bbc6['_ancestorsToRestore']=_0x1e5823,_0x14bbc6;}['_calculateOverflowInContainer'](_0x3d1337,_0x5bcd26){const _0x1e0250=_0x3d1337['_targetContainer']||_0x3d1337,_0x4d658d=[],{rowCount:_0x159ba5}=this['_renderChipsAndCountRows'](_0x1e0250,_0x5bcd26);if(_0x159ba5<=this['_config']['maxVisibleRows'])return _0x4d658d;const _0x5e3a56=_0x5bcd26['slice']();for(;_0x5e3a56['length']>0x0;){if(this['_testButtonFit'](_0x3d1337,_0x1e0250,_0x5e3a56)){const _0x24ed0f=_0x5bcd26['filter'](_0x2cb73e=>!_0x5e3a56['includes'](_0x2cb73e));_0x4d658d['push'](..._0x24ed0f);break;}if(!_0x5e3a56['pop']())break;}return _0x4d658d;}['_renderChipsAndCountRows'](_0x448268,_0x24bd53){_0x448268['innerHTML']='',_0x24bd53['forEach'](_0x2ea5bd=>{if(_0x2ea5bd['element']){const _0x3d6c44=_0x2ea5bd['element']['cloneNode'](!0x0);_0x448268['appendChild'](_0x3d6c44);}}),_0x448268['offsetWidth'];const _0x45d33a=_0x448268['children'],_0x2e9c3b=[];return Array['from'](_0x45d33a)['forEach'](_0x10e7f4=>{const _0x1f15b8=_0x10e7f4['getBoundingClientRect']()['top'];_0x2e9c3b['some'](_0x5f1d66=>Math['abs'](_0x5f1d66-_0x1f15b8)<this['_config']['rowDetectionTolerance'])||_0x2e9c3b['push'](_0x1f15b8);}),{'rowCount':_0x2e9c3b['length']};}['_createMockButton'](){const _0x3c5793=document['createElement']('button');return _0x3c5793['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x3c5793['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x3c5793['textContent']='+\x201',_0x3c5793;}['_testButtonFit'](_0x27617b,_0x1ee95a,_0x320796){this['_renderChipsAndCountRows'](_0x1ee95a,_0x320796);const _0x40af57=this['_createMockButton']();_0x27617b['appendChild'](_0x40af57),_0x27617b['offsetWidth'];const _0x310c7d=[..._0x1ee95a['children'],_0x40af57],_0x51e934=[];_0x310c7d['forEach'](_0xd61035=>{const _0x612582=_0xd61035['getBoundingClientRect']()['top'];_0x51e934['some'](_0x446ff2=>Math['abs'](_0x446ff2-_0x612582)<this['_config']['rowDetectionTolerance'])||_0x51e934['push'](_0x612582);});const _0x4dd839=_0x51e934['length'];return _0x40af57['remove'](),_0x4dd839<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x43e3f6,_0x4374e3){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x43e3f6['forEach'](_0x4596ba=>{_0x4374e3['includes'](_0x4596ba)?this['_overflowChips']['add'](_0x4596ba):this['_visibleChips']['add'](_0x4596ba);});}['_updateOverflowUI'](_0x104aba){if(_0x104aba>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x104aba>0x0&&this['_showMoreButtonView']){const _0x4137bc=''+this['_config']['showMoreLabelPrefix']+(_0x104aba<0x63?_0x104aba:'99');this['_showMoreButtonView']['label']=_0x4137bc;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x175f8c,_0x19fe2c){this['_distributeChips'](_0x175f8c,_0x19fe2c),this['_updateOverflowUI'](_0x19fe2c['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x5dd00c=>{_0x5dd00c[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 _0x3af3fa=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x3af3fa['width']||0x0===_0x3af3fa['height'])return!0x1;const _0x5add1f=window['innerHeight']||document['documentElement']['clientHeight'],_0x4db8d8=window['innerWidth']||document['documentElement']['clientWidth'],_0x3a76e5=0xc8;return _0x3af3fa['bottom']>=-0xc8&&_0x3af3fa['top']<=_0x5add1f+_0x3a76e5&&_0x3af3fa['right']>=-0xc8&&_0x3af3fa['left']<=_0x4db8d8+_0x3a76e5;}}const $s='ck-ai-chat__feed__context-chips',qs='ck-ai-chat-context-chips-wrapper',Qs='ck-ai-chat-context-chips-wrapper-balloon',Xs='ck-ai-chat-controls-button',zs='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(_0x24f75d,_0x4a1ace,_0x491784){super(_0x24f75d),this['_bodyCollection']=_0x491784,this['_createContextChips'](_0x4a1ace);const _0x3bd2de={'cssClasses':{'showMoreButton':zs+'\x20'+Gi,'showMoreBalloon':js,'overflowContainer':Qs,'controlsButton':Xs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x24f75d,this['_contextChips'],_0x3bd2de,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[$s,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':qs},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x8f4cb7=this['element']['querySelector']('.'+qs);_0x8f4cb7&&(this['_overflowManager']['setContainerElement'](_0x8f4cb7),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x34a0eb){for(const _0x564b70 of _0x34a0eb){const _0x467b1b=new AIChatContextItemButtonView(this['locale'],_0x564b70,!0x0,!0x1);this['_contextChips']['add'](_0x467b1b);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x254794,_0x4dad50,_0x59afaf){super(_0x4dad50),this['_locale']=_0x254794,this['_bodyCollection']=_0x59afaf,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'](_0x25aff2=>!_0x25aff2['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(_0x4b215a,_0x4bd575){super(_0x4bd575);const {isWebSearchEnabled:_0x1edc58,isReasoningEnabled:_0x1eba53}=_0x4bd575['capabilities'],_0x1ce2e4=[];let _0x204c9b='';_0x1edc58&&_0x1eba53?(_0x204c9b=Mi(_0x4b215a,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x1ce2e4['push'](Js(_0x3dea76)),_0x1ce2e4['push'](Js(_0x252fc0))):_0x1edc58?(_0x204c9b=Mi(_0x4b215a,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x1ce2e4['push'](Js(_0x3dea76))):_0x1eba53&&(_0x204c9b=Mi(_0x4b215a,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x1ce2e4['push'](Js(_0x252fc0))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x204c9b?'':'ck-hidden']}});const _0x15ca36=new Nt();_0x15ca36['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x1ce2e4,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x204c9b]}]}),this['children']['add'](_0x15ca36),this['capabilities']=_0x4bd575['capabilities'];}}function Js(_0x42e374){const _0x519013=new Lt();return _0x519013['content']=_0x42e374,_0x519013;}const Zs=['wheel','touchstart','pointerdown','keydown'],tn=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x54faea){this['element']=_0x54faea,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x371234 of Zs){const _0x1b46c8='keydown'!==_0x371234;this['element']['addEventListener'](_0x371234,this['_onUserEvent']['bind'](this),{'passive':_0x1b46c8,'signal':this['abortController']['signal']});}}['start']({smooth:_0x2b37dc=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x2b37dc?'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'](_0x3e2c89){if(this['isRunning']){if('keydown'===_0x3e2c89['type']){const _0x368190=_0x3e2c89['key'];if(!tn['includes'](_0x368190))return;}_0x3e2c89 instanceof WheelEvent?_0x3e2c89['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x291f14,scrollHeight:_0x2bb4ad,clientHeight:_0x5bc577}=this['element'];return _0x2bb4ad-_0x291f14-_0x5bc577<=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(_0x1d8f35){super(_0x1d8f35),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(_0x5330de,_0x249ba2){super(_0x5330de),this['_bodyCollection']=_0x249ba2,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...Ss)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x30ce11,_0x126a18){let _0x4c314a;return'ai-reply'===_0x30ce11?_0x4c314a=new AIChatFeedReplyItemView(this['locale'],_0x126a18,this['_bodyCollection']):'ai-suggestion-reply'===_0x30ce11?(_0x4c314a=new AIChatFeedSuggestionItemView(this['locale'],_0x126a18,this['_bodyCollection']),_0x4c314a['bind']('isTrackChangesOn')['to'](this)):_0x4c314a='user-message'===_0x30ce11?new AIChatFeedUserMessageItemView(this['locale'],_0x126a18,this['_bodyCollection']):'interaction-header'===_0x30ce11?new AIChatFeedInteractionHeaderView(this['locale'],_0x126a18):'custom-element'===_0x30ce11?new AIChatFeedCustomElementView(_0x126a18):new AIChatFeedErrorItemView(_0x126a18),this['children']['add'](_0x4c314a),_0x4c314a;}async['updateReplyItem']({id:_0x4b90bd,parsedContent:_0x1820d5,renderingStrategy:_0x2b2dab,abortSignal:_0x42b0f6}){const _0x222710=this['getItemById'](_0x4b90bd);if(!(_0x222710 instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x222710,'id':_0x4b90bd,'parsedContent':_0x1820d5});await _0x222710['updateContent']({'parsedContent':_0x1820d5,'renderingStrategy':_0x2b2dab,'abortSignal':_0x42b0f6});}async['updateWebSources'](_0x42f0eb,_0x555963){const _0x16129a=this['getItemById'](_0x42f0eb);if(_0x16129a instanceof AIChatFeedSuggestionItemView)_0x16129a['updateSources'](_0x555963);else{if(!(_0x16129a instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x16129a,'id':_0x42f0eb,'sources':_0x555963});_0x16129a['updateSources'](_0x555963);}}async['updateSuggestionItem']({id:_0x2ffd6b,parts:_0x228856,abortSignal:_0x19b80d,skipLoadingEffects:_0x57047b}){const _0x32d272=this['getItemById'](_0x2ffd6b);if(!(_0x32d272 instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x32d272,'id':_0x2ffd6b,'parts':_0x228856});await _0x32d272['updateContent']({'parts':_0x228856,'abortSignal':_0x19b80d,'skipLoadingEffects':_0x57047b});}['updateSuggestionPartState']({id:_0x2d0143,index:_0x1b83db,state:_0x2e1f9e}){const _0x2a54d5=this['getItemById'](_0x2d0143);if(!(_0x2a54d5 instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x2d0143});_0x2a54d5['updatePartState'](_0x1b83db,_0x2e1f9e);}['setSuggestionPartActive']({id:_0x1981e8,index:_0x41b6c2,isActive:_0x228d0a}){const _0x14f52c=this['getItemById'](_0x1981e8);if(!(_0x14f52c instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1981e8});this['children']['filter'](_0x2d9f55=>_0x2d9f55 instanceof AIChatFeedSuggestionItemView)['forEach'](_0x57a55d=>{_0x57a55d['setPartActive'](!0x1);}),_0x14f52c['setPartActive'](_0x41b6c2,_0x228d0a);}['markItemAsDone'](_0x51075d){this['getItemById'](_0x51075d)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x3eab5d=>_0x3eab5d['options']['id']);}['removeItem'](_0xdc232){this['children']['remove'](this['getItemById'](_0xdc232));}['hasItem'](_0x32f721){return!!this['children']['find'](_0x12aea2=>_0x12aea2['options']['id']['includes'](_0x32f721));}['scrollToSuggestion'](_0x2f693f,_0x378109){const _0x15132d=this['getItemById'](_0x2f693f);if(!(_0x15132d instanceof AIChatFeedSuggestionItemView))return void wt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x2f693f,'partIndex':_0x378109});const _0x42cec2=_0x15132d['getPartView'](_0x378109);_0x42cec2?Rt(_0x42cec2['element'],0x14,this['element']['parentElement'],!0x0,!0x0):wt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x2f693f,'partIndex':_0x378109});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x146604=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x146604,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x409e94=new AISkeletonView(this['locale'],xs['aiFeed']);return _0x409e94['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x409e94;}['_createFeedItems'](){const _0x595538=new Nt(this['locale']);return _0x595538['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x595538;}['_createFeedLoader'](){const _0x46ed9c=new Nt(this['locale']);return _0x46ed9c['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0xa0f008=>!_0xa0f008)]},'children':this['_createLoaderChildren']()}),_0x46ed9c;}['_createLoaderChildren'](){const _0x17161a=new AISpinnerView();return _0x17161a['isVisible']=!0x0,[_0x17161a,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x84b880){const _0x3e3dea=this['children']['find'](_0x196a9b=>_0x196a9b['options']['id']['includes'](_0x84b880));if(!_0x3e3dea)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x84b880});return _0x3e3dea;}['setLoadingMessage'](_0x23f92f){this['set']('loadingMessage',_0x23f92f);}['toggleLoadingSkeleton'](_0x1c6eab){this['set']('isLoadingSkeletonVisible',_0x1c6eab);}['startAutoScroll'](_0x23a5fa={}){this['scrollManager']['start'](_0x23a5fa);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0x24182e=0x0;for(const _0xaa5a36 of this['items'])_0x24182e+=_0xaa5a36['items']['length'];return{'resultsCount':_0x24182e,'totalItemsCount':_0x24182e};}}function en(_0x16ebc6){const _0x19a80d=[];let _0x5181de=!0x1;for(const _0x5376c0 of Array['from'](_0x16ebc6['items'])){if('file'!==_0x5376c0['kind'])continue;const _0x1ba7fa=_0x5376c0['webkitGetAsEntry']();if(_0x1ba7fa?.['isDirectory']){_0x5181de=!0x0;continue;}const _0x48cae8=_0x5376c0['getAsFile']();_0x48cae8&&_0x19a80d['push'](_0x48cae8);}return{'files':_0x19a80d,'hasDirectory':_0x5181de};}const sn='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Pt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x14ab5f,_0x49e067){super(_0x14ab5f,{'queryView':{'label':'','creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x14ab5f),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x49e067,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',(_0x51420c,_0x3ff780)=>!_0x51420c&&!_0x3ff780),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x3c98cd,_0x1108c7)=>{this['isUploadInProgress']||this['isEmpty']||_0x3c98cd['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x1108c7());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x4ad529=>this['_handlePaste'](_0x4ad529)),this['element']['addEventListener']('drop',_0x3e2de6=>this['_handleDrop'](_0x3e2de6));}['_handlePaste'](_0x3df369){const _0x396338=_0x3df369['clipboardData'];if(!_0x396338)return;const {files:_0x177523,hasDirectory:_0x17926c}=en(_0x396338),_0x1ba14a={'files':_0x177523,'plainText':_0x396338['getData']('text/plain'),'hasDirectory':_0x17926c,'forceTextAttachment':!0x1,'preventDefault':()=>_0x3df369['preventDefault']()};this['fire']('promptInputPaste',_0x1ba14a);}['_handleDrop'](_0x8e5a70){const _0x382996=_0x8e5a70['dataTransfer'];if(!_0x382996)return;const _0x3fbcdb={'files':[],'plainText':_0x382996['getData']('text/uri-list')||_0x382996['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x8e5a70['preventDefault']()};this['fire']('promptInputPaste',_0x3fbcdb);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x96c343=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x96c343)return this['queryView']['errorText']=Mi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x46ec3b=_0x39c4f6(_0x96c343);this['fire']('sendUserMessage',_0x46ec3b),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x31cadc){this['queryView']['fieldView']['set']('placeholder',_0x31cadc);}['focus'](_0x472cad=!0x1){super['focus'](),_0x472cad&&(this['element']['classList']['contains'](sn)||(this['element']['classList']['add'](sn),setTimeout(()=>{this['element']['classList']['remove'](sn);},0x320)));}['_createSubmitButton'](){const _0x11a8bf=new yt(this['locale']);return _0x11a8bf['set']({'icon':_0x8099f0,'label':Mi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ui,'isEnabled':!0x1}),_0x11a8bf['on']('execute',()=>{this['submit']();}),_0x11a8bf;}['setIsUploadInProgress'](_0x4b2102){this['isUploadInProgress']=_0x4b2102;}['_setUpAddContextButtonPositioning'](){const _0x3fd102=this['locale'],_0x1df83b=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x3b87d1=new dt(this['queryView']['fieldView']['element']),_0x5755c7=new dt(this['_addContextButtonView']['element']),_0x36543b=_0x3b87d1['width'],_0x5a1982='rtl'===_0x3fd102['uiLanguageDirection']?'right':'left';_0x3b87d1['excludeScrollbarsAndBorders']();const _0x2accd4=_0x36543b-_0x3b87d1['width']+0x1;this['_addContextButtonView']['element']['style'][_0x5a1982]='calc('+(_0x36543b-_0x5755c7['width']-_0x2accd4)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x1df83b),this['on']('render',()=>{_0x1df83b(),this['_queryViewResizeObserver']=new bt(this['queryView']['fieldView']['element'],()=>{_0x1df83b();});});}}class AIChatDropZoneView extends Nt{constructor(_0x50885c){super(_0x50885c);const _0x942210=new Lt();_0x942210['content']=_0x1b56c8,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x942210,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Mi(_0x50885c,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x38cbc2){let _0x2beb9f=0x0;_0x38cbc2['addEventListener']('dragenter',_0x5925f7=>{_0x5925f7['dataTransfer']&&(_0x2beb9f++,0x1===_0x2beb9f&&this['fire']('dragEnter'),_0x38cbc2['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x38cbc2['addEventListener']('dragover',_0x37f818=>{_0x37f818['dataTransfer']&&_0x37f818['preventDefault']();}),_0x38cbc2['addEventListener']('dragleave',()=>{--_0x2beb9f<=0x0&&(_0x2beb9f=0x0,_0x38cbc2['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x38cbc2['addEventListener']('drop',_0x1b1ea9=>{_0x1b1ea9['preventDefault'](),_0x2beb9f=0x0,_0x38cbc2['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x1b1ea9);});}['_handleDrop'](_0x5c5c02){const _0x2a06f5=_0x5c5c02['dataTransfer'];if(!_0x2a06f5)return;const {files:_0x2ab482,hasDirectory:_0x29b21e}=en(_0x2a06f5),_0x584582={'files':_0x2ab482,'plainText':_0x2a06f5['getData']('text/uri-list')||_0x2a06f5['getData']('text/plain'),'hasDirectory':_0x29b21e,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x584582);}}const nn='ck-ai-chat__prompt-capabilities',rn='ck-ai-chat-controls-button',on='ck-ai-chat-controls-button--commands',an='ck-ai-chat-controls__model-selection',hn='ck-ai-chat-controls__model-selection__item-name',cn='ck-ai-chat-controls__model-selection__item-description',ln='ck-ai-chat-controls__model-selection__item-capabilities',un='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x3ef435){super(_0x3ef435),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',_0x5c3cef=>'selector'===_0x5c3cef),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x1dba0f=>_0x1dba0f?this['_modelSelectionDropdown']['buttonView']['label']:Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x2121d6=>_0x2121d6),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x4e4de6=>_0x4e4de6),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x230c95=>Mi(this['locale'],_0x230c95?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x593307=>_0x593307),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x5d08a1=>Mi(this['locale'],_0x5d08a1?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[nn]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new _t(),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0xf18acd,_0x316a8c){if(_0x316a8c)this['set']('modelDisplayMode','hidden');else{const _0x51ceb2=0x1===_0xf18acd['length'];this['set']('modelDisplayMode',_0x51ceb2?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0xf18acd?.['length'])for(const _0x185367 of _0xf18acd){const _0x56b08f=new Zt({'label':_0x185367['name'],'withText':!0x0,'role':'menuitemradio','id':_0x185367['id'],'model':_0x185367});_0x56b08f['bind']('isOn')['to'](this,'activeModelId',_0x16f418=>_0x16f418===_0x185367['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x56b08f,'labelView':new dn(this['locale'],_0x185367)});}}['setWebSearch'](_0x3e9f6c){this['set']('webSearchActive',_0x3e9f6c);}['setReasoning'](_0x13cdc7){this['set']('reasoningActive',_0x13cdc7);}['setModel'](_0x368d20){if(!_0x368d20)return;this['activeModelId']=_0x368d20['id'],this['activeModelName']=_0x368d20['name']||_0x368d20['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x368d20['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x368d20['name']);const _0x127e20=_0x368d20['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x127e20),this['_webSearchButton']['set']('isVisible',_0x127e20);const _0x1a6462=_0x368d20['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x1a6462),this['_reasoningButton']['set']('isVisible',_0x1a6462);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x3c554c){this['set']('modelSelectorEnabled',!0x1),_0x3c554c&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x3eb04f=new yt();return _0x3eb04f['set']({'label':Mi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x3dea76,'class':rn+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':un}),_0x3eb04f['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x3eb04f;}['_createReasoningButton'](){const _0x3008b3=new yt();return _0x3008b3['set']({'label':Mi(this['locale'],'AI_CHAT_REASONING'),'icon':_0x252fc0,'class':rn+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':un}),_0x3008b3['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x3008b3;}['_createCommandsButton'](){const _0x53aaa9=new yt();return _0x53aaa9['set']({'label':Mi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x3d7a38,'withText':!0x0,'class':rn+'\x20'+Gi,'isToggleable':!0x0,'tooltip':Mi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':un}),_0x53aaa9['extendTemplate']({'attributes':{'class':[on]}}),_0x53aaa9['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x53aaa9;}['_createModelSelectionDropdown'](){const _0x341a3f=Ft(this['locale']);return _0x341a3f['set']({'panelPosition':'ne','class':[an]}),_0x341a3f['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':un,'class':Gi}),this['listenTo'](_0x341a3f,'execute',_0x592620=>{this['fire']('selectModel',_0x592620['source']['model']);}),_0x341a3f;}['_createModelNameView'](){const _0x421ed2=new _n(this['locale']);return _0x421ed2['bind']('text')['to'](this,'activeModelName',_0x38c184=>_0x38c184??''),_0x421ed2['bind']('isVisible')['to'](this,'modelDisplayMode',_0x293ae2=>'name'===_0x293ae2),_0x421ed2;}}let dn=class ModelButtonLabelView extends Mt{constructor(_0x283beb,_0x1bc94f){super();const _0x17e513=this['bindTemplate'],_0x13878b=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x17e513['to']('style'),'id':_0x17e513['to']('id')},'children':[{'tag':'div','attributes':{'class':[hn]},'children':[{'text':_0x17e513['to']('text')}]},{'tag':'div','attributes':{'class':[cn]},'children':[{'tag':'span','children':[{'text':_0x1bc94f['description']}]}]},{'tag':'div','attributes':{'class':[ln]},'children':_0x13878b}]}),_0x13878b['addMany'](this['_getCapabilityParts'](_0x283beb,_0x3dea76,'AI_CHAT_SEARCH_WEB',_0x1bc94f['capabilities']['webSearch']?.['enabled']??!0x1)),_0x13878b['addMany'](this['_getCapabilityParts'](_0x283beb,_0x252fc0,'AI_CHAT_REASONING',_0x1bc94f['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x47a986,_0x33c1a5,_0x2e53c7,_0x54040c){const _0xeef065=new Lt();_0xeef065['content']=_0x33c1a5;const _0x3764f0=new Nt(_0x47a986);_0x3764f0['setTemplate']({'tag':'span','children':[{'text':Mi(_0x47a986,_0x2e53c7)+':\x20'}]});const _0x1d344d=new Nt(_0x47a986);return _0x1d344d['setTemplate']({'tag':'span','children':[{'text':Mi(_0x47a986,_0x54040c?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0xeef065,_0x3764f0,_0x1d344d];}},_n=class ModelNameView extends Nt{constructor(_0x10ccc0){super(_0x10ccc0),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x12b62f=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x12b62f['if']('isVisible','ck-hidden',_0x4ccb15=>!_0x4ccb15)]},'children':[{'text':_0x12b62f['to']('text')}]});}};const In='ck-ai-chat-context-controls__url-form',An='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x561212){super(_0x561212),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'](_0x443727=>{this['focusTracker']['add'](_0x443727['element']),this['keystrokes']['listenTo'](_0x443727['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'](_0x47804a){this['urlInputField']['errorText']=_0x47804a,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x5a5c5d=new yt(this['locale']);return _0x5a5c5d['set']({'icon':_0x342eda,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x564b02,_0x511172,_0x1de4f0)=>{_0x5a5c5d['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x1de4f0?'':'\x20ck-hidden')]});}),_0x5a5c5d;}['_createUrlInputField'](){const _0x178916=new _0x110af7(this['locale'],_0x598327);return _0x178916['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x178916['fieldView']['set']({'placeholder':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x178916;}['_createConfirmButton'](){const _0x4a06b0=new yt(this['locale']);return _0x4a06b0['set']({'icon':_0x5d25a9,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x4a06b0;}['_setupTemplate'](){const _0x7febff=new _0x571522(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'});_0x7febff['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':In,'tabindex':'-1'},'children':[_0x7febff,{'tag':'div','attributes':{'class':An},'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',_0x38e9ce=>{_0x38e9ce['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x57764a,_0x5d5edf)=>{this['clear'](),this['fire']('cancel'),_0x5d5edf();});}['_handleSubmit'](){const _0x1643a2=this['getValue']()['trim']();_0x1643a2?this['_isValidUrl'](_0x1643a2)?(this['clearError'](),this['fire']('submitUrl',_0x1643a2)):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x18177e=this['getValue']()['trim'](),_0x5c7299=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x18177e['length']>0x0&&!_0x5c7299;}['_isValidUrl'](_0x4dc2b2){try{return!!new URL(_0x4dc2b2);}catch{return!0x1;}}}const gn='ck-ai-chat-resources__item',wn='ck-ai-chat-resources__item--in-context',Cn='ck-ai-chat-resources__item-title',mn='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Ht{['resource'];['_titleView'];['_iconView'];constructor(_0x1ec248,_0x376669){super(_0x1ec248),this['resource']=_0x376669,this['set']('isInContext',!!_0x376669['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x1a8059){if(_0x1a8059['isInContext'])return _0x5d25a9;switch(_0x1a8059['type']){case'document':return _0x19e64b;case'web-resource':return _0x128991;case'file':case'text':return _0x1b56c8;default:return _0x59bdff;}}['highlightText'](_0x5411e5){if(!_0x5411e5||''===_0x5411e5['trim']())return void this['_titleView']['highlightText'](null);const _0x3e3c21=new RegExp(_0x70d63(_0x5411e5),'gi');this['_titleView']['highlightText'](_0x3e3c21);}['updateResourceState'](_0x52c367){this['resource']['isInContext']=_0x52c367,this['isInContext']=_0x52c367,this['_updateIcon']();}['_createTitleView'](){const _0x3f864f=new _0x5e90d9();return _0x3f864f['text']=this['resource']['label'],_0x3f864f['extendTemplate']({'tag':'span','attributes':{'class':[Cn]}}),_0x3f864f;}['_createIconView'](){const _0x100657=new Lt();return _0x100657['content']=this['getResourceIcon'](this['resource']),_0x100657;}['_setupTemplate'](){const _0x38c631=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[gn,_0x38c631['if']('isVisible','ck-hidden',_0xd85581=>!_0xd85581),_0x38c631['if']('isInContext',wn)]},'children':[{'tag':'div','attributes':{'class':[mn]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x38c631['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const pn='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0x25072c,_0x5ebe98){super(_0x25072c),this['_source']=_0x5ebe98,this['extendTemplate']({'attributes':{'class':[pn]}});}['setResources'](_0x48d20e,_0x1f0cc8){this['items']['clear']();let _0x112c3a=_0x48d20e;if(this['_source']['useDefaultFiltering']&&_0x1f0cc8&&''!==_0x1f0cc8['trim']()){const _0x423312=new RegExp(_0x1f0cc8['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x112c3a=_0x48d20e['filter'](_0x8e4e45=>_0x423312['test'](_0x8e4e45['label']));}for(const _0x13484f of _0x112c3a){const _0x2650c2=new AIChatResourceListItemView(this['locale'],_0x13484f);_0x2650c2['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x13484f);}),this['items']['add'](_0x2650c2);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x1f0cc8);}['highlightText'](_0x498a2a){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x2e9d94=>{_0x2e9d94['highlightText'](_0x498a2a);});}['updateResourceState'](_0x463f8b,_0x256795){for(const _0x29e448 of this['items']){const _0x2c88d9=_0x29e448;_0x2c88d9['resource']['id']===_0x463f8b&&_0x2c88d9['updateResourceState'](_0x256795);}}['_handleResourceSelection'](_0x2fee7b,_0x22f25f){this['fire']('addResourceToContext',{'source':_0x2fee7b,'resource':_0x22f25f});}}class AIChatContextResourcesSearchInputView extends _0x110af7{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x17767c){const t=_0x17767c['t'],_0x355303={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x598327,'label':Mi(_0x17767c,'AI_CHAT_SEARCH_RESOURCES')};super(_0x17767c,_0x355303['creator']),this['label']=_0x355303['label'],this['_viewConfig']=_0x355303,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x17767c,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x2d7e02){this['fire']('search',_0x2d7e02);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Lt(),this['iconView']['content']=_0x33a0b4,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x2ca3b0,t){this['resetButtonView']=new yt(_0x2ca3b0),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x17f7a6,'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',_0x31b022=>!_0x31b022),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(_0x7e8b26,_0xd870be){super(_0x7e8b26),this['_source']=_0xd870be['source'],this['_searchInputVisibleFrom']=_0xd870be['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 _0x3d0d1a([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 _0x31d77e=new Nt(this['locale']);return _0x31d77e['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x550991,_0x470010)=>{this['loadResources'](_0x470010),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x470010);}),_0x31d77e;}['_createResourcesListView'](){const _0x3d0cdc=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x3d0cdc['delegate']('addResourceToContext')['to'](this),_0x3d0cdc['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x3d0cdc;}['_createSkeletonView'](){const _0x37de99=new AISkeletonView(this['locale'],xs['aiChatResources']);return _0x37de99['bind']('isVisible')['to'](this,'isLoading'),_0x37de99;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x4c6d23){const _0xd5b096=at();this['_latestLoadResourcesUid']=_0xd5b096,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x4c6d23,'uid':_0xd5b096}),this['isLoading']=!0x0;}['setResources'](_0x53495a,_0x22643d){if(_0x22643d&&_0x22643d!==this['_latestLoadResourcesUid'])return;const _0x5db520=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x53495a,_0x5db520),_0x53495a['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x55f080,_0x55d36c){this['_resourcesListView']['updateResourceState'](_0x55f080,_0x55d36c);}}const En='ck-ai-chat-context-controls__source-balloon-panel',Tn='ck-button-icon\x20ck-button-back',fn='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x3d1bd9,_0x8d936,_0x365866){this['_locale']=_0x3d1bd9,this['_bodyCollection']=_0x8d936,this['_config']=_0x365866;}['showSourceResourcesBalloon']({source:_0x21d2d2,withBackButton:_0x2429b9}){let _0x470d0a=this['_sourceResourceBalloons']['get'](_0x21d2d2['id']);_0x470d0a||(_0x470d0a=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x21d2d2['id'],_0x470d0a),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x470d0a)),this['_addSourceResourceContent']({'balloonPanel':_0x470d0a,'source':_0x21d2d2,'withBackButton':_0x2429b9}),_0x470d0a['show']();const _0x55b4f2=this['_config']['getTargetElement']();_0x55b4f2&&_0x470d0a['pin']({'target':_0x55b4f2,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x12ca14,_0x530786,_0x5eca74){const _0x4bb549=this['_sourceResourceBalloons']['get'](_0x12ca14);if(!_0x4bb549)return;const _0x132668=this['_getResourcesViewFromBalloon'](_0x4bb549);_0x132668&&(_0x132668['setResources'](_0x530786,_0x5eca74),_0x132668['once']('change:isLoading',()=>{_0x4bb549['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x2e317b){const _0x1a2570=this['_sourceResourceBalloons']['get'](_0x2e317b);_0x1a2570&&requestAnimationFrame(()=>{_0x1a2570['hide'](),this['_sourceResourceBalloons']['delete'](_0x2e317b),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x20efc8 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x20efc8);}['isAnyResourceBalloonVisible'](){for(const _0x48b7bc of this['_sourceResourceBalloons']['values']())if(_0x48b7bc['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x25e334,_0x249b40,_0x2b65b2){const _0x3ebf79=this['_sourceResourceBalloons']['get'](_0x25e334);if(!_0x3ebf79||!_0x3ebf79['isVisible'])return;const _0xf179cb=this['_config']['getTargetElement']();if(!_0xf179cb)return;_0x3ebf79['pin']({'target':_0xf179cb,'limiter':this['_config']['getLimiterElement']()});const _0x3e9787=this['_getResourcesViewFromBalloon'](_0x3ebf79);_0x3e9787&&_0x3e9787['updateResourceState'](_0x249b40,_0x2b65b2);}['destroy'](){for(const _0x81d54c of this['_sourceResourceBalloons']['values']())_0x81d54c['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x42a1cc=new zt(this['_locale']);return _0x42a1cc['extendTemplate']({'attributes':{'class':En}}),this['_bodyCollection']['add'](_0x42a1cc),_0x42a1cc;}['_addSourceResourceContent']({balloonPanel:_0x212d9c,source:_0x3a44dd,withBackButton:_0x4725b8}){_0x212d9c['content']['clear']();const _0x134bfd=this['_createBalloonHeader']({'balloonPanel':_0x212d9c,'source':_0x3a44dd,'withBackButton':_0x4725b8});_0x212d9c['content']['add'](_0x134bfd);const _0x45c798=this['_createBalloonResourcesView'](_0x3a44dd);_0x212d9c['content']['add'](_0x45c798);}['_createBalloonHeader']({balloonPanel:_0x163da3,source:_0x15fa4a,withBackButton:_0x94e5ba}){const _0x286e4b=new _0x571522(this['_locale'],{'label':_0x15fa4a['label'],'class':fn});return _0x94e5ba&&_0x286e4b['children']['add'](this['_createBackButton'](_0x163da3),0x0),_0x286e4b;}['_createBackButton'](_0x5bfe58){const _0x1897be=new yt(this['_locale']);return _0x1897be['set']({'icon':_0x342eda,'tooltip':Mi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Tn}),_0x1897be['on']('execute',()=>{_0x5bfe58['hide'](),this['_config']['onBackToContext']();}),_0x1897be;}['_createBalloonResourcesView'](_0x27b879){const _0x4cbe99=new AIChatContextResourcesView(this['_locale'],{'source':_0x27b879,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x4cbe99['on']('loadSourceResources',(_0x32f4a2,_0xbcba51)=>{this['_config']['onLoadSourceResources'](_0xbcba51);}),_0x4cbe99['on']('addResourceToContext',(_0x264e81,_0x40c627)=>{this['_config']['onResourceSelected'](_0x40c627['source'],_0x40c627['resource']),this['closeSourceResourceBalloon'](_0x27b879['id']);}),_0x4cbe99;}['_getResourcesViewFromBalloon'](_0x4cd570){const _0x4f7422=_0x4cd570['content']['get'](0x1);return _0x4f7422 instanceof AIChatContextResourcesView?_0x4f7422:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x28844e){jt({'emitter':_0x28844e,'contextElements':[_0x28844e['element']],'callback':()=>{_0x28844e['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x28844e['isVisible']});}}const Rn=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],bn='ck-ai-chat-context-controls',Sn='ck-ai-chat-context-controls__pending-contexts',On='ck-ai-chat-context-controls__add-context-balloon-panel',vn='ck-ai-chat-context-controls__add-context-button',kn='ck-ai-chat-context-controls__url-balloon-panel',yn='ck-ai-chat-context-controls__balloon-button',Nn='ck-ai-chat-context-controls__balloon-button-source',xn='ck-ai-chat-controls-button',Ln='ck-ai-chat-context-chips-wrapper-balloon',Pn='ck-ai-chat-controls_context_show-more-button',Dn='ck-ai-chat-context-controls__show-more-balloon-panel',Vn='ck-ai-chat',Hn=[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(_0x416db9,_0xf7045c){super(_0x416db9),this['bodyCollection']=_0xf7045c['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x416db9),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x416db9),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x416db9),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x416db9,_0xf7045c);const _0x3e29c5={'cssClasses':{'showMoreButton':Pn+'\x20'+Gi,'showMoreBalloon':Dn,'overflowContainer':Ln,'controlsButton':xn}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x416db9,this['_currentContextsChips'],_0x3e29c5,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'](_0x41b8ad,_0x4b6674){const _0x5c71c4=this['_createContextButton'](_0x41b8ad,'current',!0x0,_0x4b6674);this['_addContextToCollection'](_0x5c71c4,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x37f5ba){this['_removeContextFromCollection'](_0x37f5ba,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x37f5ba,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x3821d9,_0x255409){let _0x57d184=this['_currentContextsChips']['find'](_0x206500=>_0x206500['id']===_0x3821d9);_0x57d184||(_0x57d184=this['_overflowManager']['overflowChips']['find'](_0x3cec67=>_0x3cec67['id']===_0x3821d9)),_0x57d184&&(_0x57d184['isLoading']=_0x255409);}['setConversationContext'](_0xc4a5c8){this['_conversationContextsChips']['clear']();for(const _0x397944 of _0xc4a5c8){const _0x1c42c1=this['_createContextButton'](_0x397944,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x1c42c1,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x558c39,_0xcfcc56,_0x3155ec){this['_resourcesBalloonView']['updateResourceState'](_0x558c39,_0xcfcc56,_0x3155ec);}['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:_0x1e0678,withBackButton:_0x501406}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x1e0678,'withBackButton':_0x501406}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x458b0c,_0x4ab94d,_0x183331,_0x3381a0){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x458b0c,_0x183331,_0x3381a0);}['closeSourceResourceBalloon'](_0x439854){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x439854),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x5336c8){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x5336c8),this['_setAddContextButtonEnabled'](_0x5336c8);}['_setAddContextButtonEnabled'](_0x1e7620){const _0x31cc79=!_0x1e7620['document']['isHidden']&&_0x1e7620['document']['enabled'],_0x3f9673=_0x1e7620['urls']['enabled'],_0x2059e4=_0x1e7620['files']['enabled'],_0x4a7b66=_0x1e7620['sources']['length']>0x0,_0x5262a8=_0x1e7620['customItems']&&_0x1e7620['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x31cc79||_0x3f9673||_0x2059e4||_0x4a7b66||_0x5262a8;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[bn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Sn},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x2dc313){const _0x48b9b9=new yt(_0x2dc313);return _0x48b9b9['set']({'label':Mi(_0x2dc313,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':xn+'\x20'+vn+'\x20'+Gi,'icon':_0x2e6a1b,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x48b9b9;}['_createAddContextBalloonPanelView'](_0x2dba1f){return this['_createBaseBalloonPanel'](_0x2dba1f,On);}['_createUrlBalloonPanelView'](_0x2824ae){const _0x58407a=this['_createBaseBalloonPanel'](_0x2824ae,kn);return this['_addUrlContent'](_0x58407a,_0x2824ae),_0x58407a;}['_createResourcesBalloonView'](_0xb2ec8e,_0x2b7a5f){const _0x3e5824={'searchInputVisibleFrom':_0x2b7a5f['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn});},'onResourceSelected':(_0x2cb22e,_0x3f7570)=>{this['fire']('addResourceToContext',{'source':_0x2cb22e,'resource':_0x3f7570});},'onLoadSourceResources':_0x31cea2=>{this['fire']('loadSourceResources',_0x31cea2);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0xb2ec8e,_0x2b7a5f['bodyCollection'],_0x3e5824);}['_getLimiterElement'](){return this['element']?.['closest']('.'+Vn)||document['body'];}['_createBaseBalloonPanel'](_0x29a893,_0x1cdb57){const _0x309d90=new zt(_0x29a893);return _0x309d90['extendTemplate']({'attributes':{'class':_0x1cdb57}}),this['bodyCollection']['add'](_0x309d90),_0x309d90;}['_setBalloonPanelContent'](_0x4810e6,_0x4f80b1,_0x4c5200){if(_0x4810e6['content']['clear'](),!_0x4c5200['document']['isHidden']&&_0x4c5200['document']['enabled']){const _0x34e0f2=this['_createBalloonButton'](_0x4f80b1,{'label':Mi(_0x4f80b1,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x19e64b});_0x34e0f2['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x4810e6['content']['add'](_0x34e0f2);}if(_0x4c5200['urls']['enabled']){const _0x556f40=this['_createBalloonButton'](_0x4f80b1,{'label':Mi(_0x4f80b1,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x128991});_0x556f40['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn}),this['_urlInputView']['focus']();}),_0x4810e6['content']['add'](_0x556f40);}if(_0x4c5200['files']['enabled']){const _0x162bce=new _0x124852(_0x4f80b1);_0x162bce['set']({'label':Mi(_0x4f80b1,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x64c3c0,'withText':!0x0,'tooltip':!0x0,'class':yn,'allowMultipleFiles':!0x0}),_0x162bce['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x162bce['on']('done',(_0x430630,_0x17854d)=>{this['fire']('addFileToContext',_0x17854d);}),_0x162bce['tooltip']=!0x0,_0x4810e6['content']['add'](_0x162bce);}for(const _0x56c135 of _0x4c5200['sources']){const _0x2b2142=this['_createBalloonButton'](_0x4f80b1,{'label':_0x56c135['label'],'icon':_0x56c135['icon']||_0x59bdff,'type':'source'});_0x4810e6['content']['add'](_0x2b2142),_0x2b2142['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x56c135,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x38a066 of _0x4c5200['customItems']||[]){const _0x255079=this['_createBalloonButton'](_0x4f80b1,{'label':_0x38a066['label'],'icon':_0x38a066['icon']||_0x59bdff,'type':'customItem'});_0x4810e6['content']['add'](_0x255079),_0x255079['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x38a066);});}this['_hasExactlyOneSource']=0x1===_0x4810e6['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x3fee3a,_0x2477fb){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x2477fb),this['_urlInputView']['on']('submitUrl',(_0x39e72d,_0xb92eae)=>{this['_handleUrlSubmit'](_0xb92eae);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn});}),_0x3fee3a['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x55aaf7,_0x2bc396){const _0x50d660='source'===_0x2bc396['type']?new SourcesBalloonButtonView(_0x55aaf7):new yt(_0x55aaf7);return _0x50d660['set']({'label':_0x2bc396['label'],'icon':_0x2bc396['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':yn}),_0x50d660;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){jt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x57c38a){const _0x24f935=this['_addContextBalloonConfig'];_0x24f935['buttonView']['isOn']=_0x57c38a,_0x57c38a?_0x24f935['balloonView']['show']():_0x24f935['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x2fb679,buttonView:_0x5bdc70,hideMethod:_0x1b8556}=this['_addContextBalloonConfig'];jt({'emitter':_0x2fb679,'contextElements':[_0x2fb679['element'],_0x5bdc70['element']],'callback':()=>{_0x1b8556();},'activator':()=>_0x5bdc70['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x5711ca,_0x1e0b84,_0x197140=!0x1,_0x50d753=!0x1){const _0xd65b57='conversation'===_0x1e0b84||!0x0===_0x5711ca['isReadOnly'],_0x1af32f=new AIChatContextItemButtonView(this['locale'],_0x5711ca,_0xd65b57,_0x197140,_0x50d753);return _0xd65b57||_0x1af32f['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x1af32f['id']);}),_0x1af32f;}['_addContextToCollection'](_0x59ed60,_0xbced37){_0xbced37['add'](_0x59ed60,0x0);}['_removeContextFromCollection'](_0x13f57a,_0x2db0b3){const _0xa32c6f=_0x2db0b3['find'](_0x58bd50=>_0x58bd50['id']===_0x13f57a);_0xa32c6f&&_0x2db0b3['remove'](_0xa32c6f);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Hn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x418e2a){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x418e2a);}}class SourcesBalloonButtonView extends yt{['arrowView'];constructor(_0x2711fc){super(_0x2711fc),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[Nn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x5a190f=new Lt();return _0x5a190f['content']=_0x121964,_0x5a190f['extendTemplate']({'attributes':{'class':Nn+'__arrow'}}),_0x5a190f;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0xd547da){super(_0xd547da),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 _0x2eb336=new yt(this['locale']);return _0x2eb336['set']({'label':Mi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Bi+'\x20ck-ai-button-stop-generating','icon':_0x592ee4}),_0x2eb336['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x2eb336;}['_createLoaderView'](){const _0x108479=new Nt(this['locale']);return _0x108479['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')}]}),_0x108479;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x290ba9,_0x170743){super(_0x290ba9),this['_filesEnabled']=_0x170743['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x290ba9,{'bodyCollection':_0x170743['bodyCollection'],'searchInputVisibleFrom':_0x170743['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x290ba9),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x290ba9),this['_loaderView']=this['_createLoaderView'](_0x290ba9),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x290ba9),this['_dropZoneView']=new AIChatDropZoneView(_0x290ba9),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'](...Rn)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x36ddef=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x36ddef['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x36ddef['if']('isLoading','ck-hidden',_0x2eee62=>_0x2eee62||!this['isModelAvailable']),_0x36ddef['if']('isModelAvailable','ck-hidden',_0x5e9bb7=>!_0x5e9bb7||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x36ddef['if']('isLoading','ck-hidden',_0x168ca7=>!_0x168ca7)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x36ddef['if']('isModelAvailable','ck-hidden',_0x502f79=>_0x502f79)]},'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'](_0x2b59f5,_0x172a9b){return new AIChatContextPanelView(_0x2b59f5,_0x172a9b);}['_createPromptInputView'](_0x1020af){return new AIChatPromptInputView(_0x1020af,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x1ff2f3){return new AIChatPromptCapabilitiesView(_0x1ff2f3);}['_createLoaderView'](_0x4fd4d4){return new AIChatControlsLoaderView(_0x4fd4d4);}['_createModelUnavailableMessageView'](_0x3fd8fc){const _0x5d4567=new AIChatModelUnavailableMessageView(_0x3fd8fc);return _0x5d4567['delegate']('startConversation')['to'](this),_0x5d4567;}['_handlePromptInputFocus'](_0x3e5c3e,_0x233820,_0x662741){_0x662741?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x4a17a6,_0x3a4c44){this['_contextPanelView']['addContextItem'](_0x4a17a6,_0x3a4c44);}['removeContextItem'](_0x414d60){this['_contextPanelView']['removeContextItem'](_0x414d60);}['setContextItemLoading'](_0x519f64,_0x59d19d){this['_contextPanelView']['setContextItemLoading'](_0x519f64,_0x59d19d);}['setIsUploadInProgress'](_0x54cced){this['_promptInputView']['setIsUploadInProgress'](_0x54cced);}['setConversationContext'](_0x35bfcc){this['_contextPanelView']['setConversationContext'](_0x35bfcc);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x4a1e30,_0x19c5be,_0x16b629){this['_contextPanelView']['updateResourceState'](_0x4a1e30,_0x19c5be,_0x16b629);}['setWebSearch'](_0x547900){this['_promptCapabilitiesView']['setWebSearch'](_0x547900);}['setReasoning'](_0x534196){this['_promptCapabilitiesView']['setReasoning'](_0x534196);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x35dc2c){this['_contextPanelView']['setAddContextOptions'](_0x35dc2c);}['setInputPlaceholder'](_0x319cb7){this['_promptInputView']['setPlaceholderText'](_0x319cb7);}['setModelList'](_0x556480,_0x28d221){this['_promptCapabilitiesView']['setModelList'](_0x556480,_0x28d221);}['setModel'](_0x58262f){_0x58262f?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x58262f)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x3a1425){this['_promptCapabilitiesView']['disableModelSelector'](_0x3a1425);}['populateSourceResourceBalloon'](_0x3e9beb,_0x678dd8,_0x188a36,_0x49ef95){this['_contextPanelView']['populateSourceResourceBalloon'](_0x3e9beb,_0x678dd8,_0x188a36,_0x49ef95);}['closeSourceResourceBalloon'](_0x2872af){this['_contextPanelView']['closeSourceResourceBalloon'](_0x2872af);}['focusPromptInput'](_0xa5a527=!0x1){this['_promptInputView']['focus'](_0xa5a527);}['setPromptInputValue'](_0x438067){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x438067;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0x2475e1){super(_0x2475e1);const _0xe882fb=new yt(_0x2475e1);_0xe882fb['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0xe882fb['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'},_0xe882fb]}]});}}class AIHeaderView extends _0x571522{['resizeButton'];constructor(_0x4035ca,_0x1d79a0){super(_0x4035ca,{'label':_0x1d79a0['label'],'class':'ck-ai-header\x20'+_0x1d79a0['class'],'icon':_0x1d79a0['icon']}),this['set']('isMaximized',!0x1),_0x1d79a0['content']&&this['children']['add'](_0x1d79a0['content']),_0x1d79a0['showResizeButton']&&(this['resizeButton']=Fi(_0x4035ca,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x3340d8){super(_0x3340d8),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Mi(_0x3340d8,'AI_DISCLAIMER_TEXT')}]}]});}}function Mn(_0x2f5cb9,_0x3f220a){const _0x31dda4=new yt(_0x2f5cb9);return _0x31dda4['set']({'label':Mi(_0x2f5cb9,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x1d96d8,'class':'ck-ai-chat__start-conversation\x20'+Bi}),_0x31dda4['on']('execute',()=>{_0x3f220a['fire']('startConversation');}),_0x31dda4;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x15cf98,_0x59aede){super(_0x15cf98),this['_bodyCollection']=new Xt(_0x15cf98),this['_bodyCollection']['attachToDom']();const _0x118621=Mn(_0x15cf98,this);this['chatHeader']=new AIHeaderView(_0x15cf98,{'label':Mi(_0x15cf98,'AI_CHAT_HEADING'),'icon':_0x25d15b,'class':'ck-ai-header_chat','content':_0x118621,'showResizeButton':_0x59aede['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0x15cf98,this['_bodyCollection']),this['chatFeed']['delegate'](...Ss)['to'](this),this['chatControls']=new AIChatControlsView(_0x15cf98,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x59aede['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x59aede['filesEnabled']}),this['chatControls']['delegate'](...Ss)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0x15cf98),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x15cf98['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x6d67f6,_0x2ef280,_0x4b25e4,_0x2841ce){this['chatControls']['populateSourceResourceBalloon'](_0x6d67f6,_0x2ef280,_0x4b25e4,_0x2841ce);}['closeSourceResourceBalloon'](_0x1e312f){this['chatControls']['closeSourceResourceBalloon'](_0x1e312f);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0x4338bf{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(_0x3ecb5d){super(_0x3ecb5d);const _0x3a3d65=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x3a3d65['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'](_0x3a3d65),this['_view']['delegate'](...Ss)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x22674d,{showDiff:_0x178b6c})=>{this['showDiff']=_0x178b6c;}),this['disableControls'](),_0x3a3d65['view']['addTab']({'id':'chat','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x25d15b,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x3a3d65['view'],'isMaximized',_0xb7333=>_0xb7333),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x5596b5=>_0x5596b5),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x5971a3){const _0x3a3d3c=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'](_0x5971a3['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x3a3d3c}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x2e5f66,staticMessage:_0x4e8744}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x2e5f66,'initialContent':'<p>'+_0x4e8744+'</p>'});});}async['addFeedItemUserMessage'](_0x569ebe){const _0x1c3a30=_0x569ebe['attributes']?.['displayedPrompt']||_0x569ebe['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x569ebe['contextItems']['values']()),'initialContent':'<p>'+_0x1c3a30+'</p>','id':_0x569ebe['id']});});}async['addFeedItemError']({errorMessage:_0x30a6c0,id:_0x53aa7c}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x30a6c0+'</p>','id':_0x53aa7c});});}async['addFeedItemAIReply'](_0x4f71b0){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x4f71b0['interactionId']+':'+_0x4f71b0['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x1e9f69){const _0x549662=Cs(this['context']),_0x2a6326=_0x549662['map'](_0x192191=>_0x192191['config']['get']('ai.availableReplyActions')||[...Ps]);let _0x2523c3=_0x2a6326['reduce']((_0x556a4d,_0x5b339a)=>_0x556a4d['filter'](_0x4c2f67=>_0x5b339a['includes'](_0x4c2f67)),_0x2a6326[0x0]||[...Ps]);const _0x5bd531=_0x549662['every'](_0x3575d7=>_0x3575d7['plugins']['has']('TrackChanges')),_0x477cdb=_0x549662['map'](_0x5c1e06=>_0x5c1e06['commands']['get']('trackChanges'));return _0x5bd531?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x477cdb,'value',(..._0x33b741)=>_0x33b741['some'](_0x278283=>_0x278283))):_0x2523c3=_0x2523c3['filter'](_0x5a2b63=>'insertSuggestion'!=_0x5a2b63),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x1e9f69['interactionId']+':'+_0x1e9f69['id'],'areActionsDisabled':_0x1e9f69['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x2523c3}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x488514,_0x4f6a67){return this['_promiseQueue']['enqueue'](async()=>{const _0x3dd781=this['_view']['chatFeed']['children']['last'];if(_0x3dd781 instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x3dd781),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x488514['id'],'capabilities':{'isWebSearchEnabled':_0x3dd781['capabilities']['isWebSearchEnabled']||_0x4f6a67['isWebSearchEnabled'],'isReasoningEnabled':_0x3dd781['capabilities']['isReasoningEnabled']||_0x4f6a67['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x488514['id'],'capabilities':_0x4f6a67});});}async['addFeedItemCustomElement'](_0x366036,_0x39196f){let _0x4992f7;return await this['_promiseQueue']['enqueue'](async()=>{_0x4992f7=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x366036,'id':_0x39196f});}),_0x4992f7;}['removeFeedItem'](_0x54b7c8){this['_view']['chatFeed']['removeItem'](_0x54b7c8);}['hasFeedItem'](_0x31e6e1){return this['_view']['chatFeed']['hasItem'](_0x31e6e1);}['updateFeedInteractionHeader'](_0x43cf24){const _0x5bc57c=this['_view']['chatFeed']['children']['find'](_0x2a8de9=>_0x2a8de9['options']['id']==_0x43cf24['id']&&_0x2a8de9 instanceof AIChatFeedInteractionHeaderView);_0x5bc57c&&_0x5bc57c['set']('isVisible',_0x43cf24['isVisible']);}async['updateFeedItemAIReplyContent'](_0x3f1dd3){const _0x512d70=_0x3f1dd3['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x42ba87=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x3f1dd3,'abortSignal':_0x42ba87,'renderingStrategy':_0x512d70}),_0x3f1dd3['isDone']&&this['markFeedItemAsDone'](_0x3f1dd3['id']);});}['updateFeedItemAIReplySources'](_0x2846bb,_0x3ceaa4){this['_view']['chatFeed']['updateWebSources'](_0x2846bb,_0x3ceaa4);}async['updateFeedItemAIReplySuggestionContent'](_0x4e3c30){return this['_promiseQueue']['enqueue'](async _0x15e0a5=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x4e3c30,'abortSignal':_0x15e0a5}),_0x4e3c30['isDone']&&this['markFeedItemAsDone'](_0x4e3c30['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x4dde17){this['_view']['chatFeed']['updateSuggestionPartState'](_0x4dde17);}['setFeedItemAIReplySuggestionPartActive'](_0x27fe8d){this['_view']['chatFeed']['setSuggestionPartActive'](_0x27fe8d);}['markFeedItemAsDone'](_0x2a8e49){this['_view']['chatFeed']['markItemAsDone'](_0x2a8e49);}['removeFeedInteraction'](_0x38657b){this['_view']['chatFeed']['getItemIds']()['filter'](_0x21f817=>_0x21f817['startsWith'](_0x38657b))['forEach'](_0x5acd32=>this['_view']['chatFeed']['removeItem'](_0x5acd32));}['startInteraction'](){const _0x167721=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x167721),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x4f8558){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x5f74b3=>_0x5f74b3['startsWith'](_0x4f8558['id']))['forEach'](_0x234d79=>this['markFeedItemAsDone'](_0x234d79)),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'](_0x594b5e,_0x4d8cee){this['_view']['chatControls']['addContextItem'](_0x594b5e,_0x4d8cee);}['removeContextItem'](_0x280170){this['_view']['chatControls']['removeContextItem'](_0x280170);}['setContextItemLoading'](_0x154743,_0x54d454){this['_view']['chatControls']['setContextItemLoading'](_0x154743,_0x54d454);}['setIsUploadInProgress'](_0x5157c6){this['_view']['chatControls']['setIsUploadInProgress'](_0x5157c6);}['setConversationContext'](_0x59901a){this['_view']['chatControls']['setConversationContext'](_0x59901a);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x262a0f,_0x268f89,_0x5a165e){this['_view']['chatControls']['updateResourceState'](_0x262a0f,_0x268f89,_0x5a165e);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x4dd873){this['_view']['chatControls']['setAddContextOptions'](_0x4dd873);}['updateCapabilities'](_0xe33f8d){this['_view']['chatControls']['setWebSearch'](_0xe33f8d['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0xe33f8d['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0xe33f8d));}['setSelectedModel'](_0x1bf09d,_0x2bdd0a){this['_view']['chatControls']['setModel'](_0x1bf09d),_0x2bdd0a&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x26cdb3){this['feedItemRenderingStrategy']=_0x26cdb3;}['toggleLoadingSkeleton'](_0x547625){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x547625);}['resetConversationTitle'](){this['setConversationTitle'](Mi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x49895a,_0x5879cc=!0x1){if(_0x5879cc&&!St()&&_0x49895a['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x49895a);this['_view']['chatHeader']['label']=_0x49895a;}['setLoadingMessage'](_0x1ede89){this['_view']['chatFeed']['setLoadingMessage'](_0x1ede89);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x232e4d){let _0xdbe71a=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x232e4d[_0xdbe71a],_0xdbe71a++,_0xdbe71a===_0x232e4d['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x5030ea){return _0x5030ea['isWebSearchEnabled']&&_0x5030ea['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x5030ea['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x5030ea['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x566a2a){return _0x566a2a?_0x566a2a['isWebSearchEnabled']&&_0x566a2a['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x566a2a['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x566a2a['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'](_0x28fbbc,_0x36dc33,_0x2ec9cf,_0x3a6064){this['_view']['populateSourceResourceBalloon'](_0x28fbbc,_0x36dc33,_0x2ec9cf,_0x3a6064);}['closeSourceResourceBalloon'](_0x2aa1cd){this['_view']['closeSourceResourceBalloon'](_0x2aa1cd);}['setPromptInputValue'](_0x4e0438){this['_view']['chatControls']['setPromptInputValue'](_0x4e0438);}['focusPromptInput'](_0xf32187=!0x1){this['_view']['chatControls']['focusPromptInput'](_0xf32187);}['scrollFeedToSuggestion'](_0x5915f4,_0x125e64){this['_view']['chatFeed']['scrollToSuggestion'](_0x5915f4,_0x125e64);}['startAutoScroll'](_0x121771={}){this['_view']['chatFeed']['startAutoScroll'](_0x121771);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0x38536d,_0x27b67b){super(_0x38536d),this['sections']=_0x27b67b,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x3aadcd){let _0x30df81=0x0,_0xdc64df=0x0;for(const _0x5711d7 of this['sections']){const {resultsCount:_0x319a61,totalItemsCount:_0x3bf651}=_0x5711d7['filter'](_0x3aadcd);_0x30df81+=_0x319a61,_0xdc64df+=_0x3bf651;}return{'resultsCount':_0x30df81,'totalItemsCount':_0xdc64df};}}class AIChatHistoryListView extends Ht{['title'];['itemsViews'];['_itemsListView'];constructor(_0x15e76e,{title:_0x1742f4,items:_0x1b7584}){super(_0x15e76e);const _0x12b8b1=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x1742f4,this['itemsViews']=_0x1b7584;const _0x44cfb0=new Nt(_0x15e76e);_0x44cfb0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x15e76e),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x12b8b1['if']('isVisible','ck-hidden',_0x28684f=>!_0x28684f)]},'children':[_0x44cfb0,this['_itemsListView']]});}['filter'](_0x4b2d8f){const _0x26478a=this['itemsViews']['length'];let _0x4cb6b3=0x0;for(const _0x3e9fc8 of this['itemsViews']){if(_0x4b2d8f){const _0x3a1252=_0x3e9fc8['isMatching'](_0x4b2d8f);_0x3e9fc8['isVisible']=!!_0x3a1252,_0x3e9fc8['highlightText'](_0x4b2d8f);}else _0x3e9fc8['isVisible']=!0x0,_0x3e9fc8['highlightText'](null);_0x3e9fc8['isVisible']&&_0x4cb6b3++;}return this['isVisible']=_0x4cb6b3>0x0,{'resultsCount':_0x4cb6b3,'totalItemsCount':_0x26478a};}['getItem'](_0x12bdfd){return this['itemsViews']['find'](_0x466ee0=>_0x466ee0['id']===_0x12bdfd);}['removeItem'](_0x2b2604){const _0x58aad9=this['itemsViews']['indexOf'](_0x2b2604);-0x1!==_0x58aad9&&(this['itemsViews']['splice'](_0x58aad9,0x1),this['_itemsListView']['items']['remove'](_0x2b2604));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
27
+ _0x365aa7(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(_0x2318c3,_0x1356f3){super(_0x2318c3);const _0x5ca184=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x1356f3['pinned']),this['set']('loadingState',null),this['set']('title',_0x1356f3['title']),this['id']=_0x1356f3['id'];const {createdAt:_0xee9f4d,active:_0x2c02a1=!0x1}=_0x1356f3;this['_titleView']=new _0x5e90d9(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x414a6c=this['_createCheckView'](),_0x3ddeec=this['_createPinButtonView'](_0x2318c3),_0x508b16=this['_createMenuDropdownView'](),_0x4a1d1d=this['_createEditInputView'](_0x2318c3),_0x33389c=this['_createAcceptEditButtonView'](_0x2318c3,_0x4a1d1d),_0x2b26fc=this['_createCancelEditButtonView'](_0x2318c3);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x3ddeec),this['actions']['add'](_0x508b16),this['on']('change:isEdit',(_0x1d1ea7,_0x397833,_0x432850)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x432850?(this['actions']['add'](_0x33389c),this['actions']['add'](_0x2b26fc),this['mainContent']['add'](_0x4a1d1d),_0x4a1d1d['element']['value']=this['title']||'',_0x4a1d1d['element']['focus']()):(this['actions']['add'](_0x3ddeec),this['actions']['add'](_0x508b16),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x2c02a1?'ck-ai-chat-history__item--active':'',_0x5ca184['if']('isVisible','ck-hidden',_0x40beb9=>!_0x40beb9),_0x5ca184['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',_0x5ca184['if']('loadingState','ck-hidden',_0x184008=>!!_0x184008)]},'children':_0x2c02a1?[_0x414a6c]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x5ca184['if']('loadingState','ck-hidden',_0x1dda6a=>!_0x1dda6a)]},'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',_0x5ca184['if']('loadingState','ck-hidden',_0x214c26=>!!_0x214c26)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x5ca184['if']('loadingState','ck-hidden',_0x52b602=>!_0x52b602)]},'children':[{'text':_0x5ca184['to']('loadingState',_0x57a969=>_0x57a969?Mi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x57a969]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0xee9f4d]}]},{'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'](_0x33634b){this['set']('title',_0x33634b);}['updateLoadingState'](_0xdfb703,_0x48d2d4){this['set']('loadingState',_0x48d2d4?_0xdfb703:null);}['_createCheckView'](){const _0x23a17b=new Lt();return _0x23a17b['set']({'content':_0x5d25a9}),_0x23a17b;}['_createPinButtonView'](_0xb63cc){const _0x5c7c91=new yt(_0xb63cc);return _0x5c7c91['set']({'label':Mi(_0xb63cc,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x5d31ba,'withText':!0x1,'tooltip':!0x0}),_0x5c7c91['bind']('isOn')['to'](this,'pinned'),_0x5c7c91['on']('execute',()=>{const _0x4a34ad=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x4a34ad});}),_0x5c7c91;}['_createMenuDropdownView'](){const _0x926b13=Ft(this['locale']),_0x4b3cee=_0x926b13['panelView']['children'];_0x926b13['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x1abd54}),_0x926b13['panelPosition']='sw';const _0xd64cbe=new yt(this['locale']);_0xd64cbe['label']=Mi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0xd64cbe['withText']=!0x0,_0xd64cbe['on']('execute',()=>{this['isEdit']=!0x0;});const _0x474492=new yt(this['locale']);_0x474492['label']=Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x474492['withText']=!0x0,_0x474492['on']('execute',()=>{this['showConfirm'](Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x3e84d4=new Dt(this['locale']),_0x329102=new Ht(this['locale']);_0x329102['children']['add'](_0xd64cbe);const _0x1ea9e9=new Ht(this['locale']);return _0x1ea9e9['children']['add'](_0x474492),_0x3e84d4['items']['addMany']([_0x329102,_0x1ea9e9]),_0x4b3cee['add'](_0x3e84d4),_0x926b13;}['_createEditInputView'](_0x2ac194){const _0x13135f=new _0x580520(_0x2ac194),_0x8bb37e=_0x13135f['bindTemplate'];return _0x13135f['extendTemplate']({'on':{'keydown':_0x8bb37e['to'](_0x23544c=>{'Enter'==_0x23544c['key']&&this['_commitEditInputValue'](_0x13135f);})}}),_0x13135f;}['_createAcceptEditButtonView'](_0xc0e2e4,_0x4f791e){const _0x25a52f=new yt(_0xc0e2e4);return _0x25a52f['set']({'icon':_0x5d25a9,'withText':!0x1,'tooltip':Mi(_0xc0e2e4,'AI_CHAT_HISTORY_ACCEPT')}),_0x25a52f['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x25a52f['on']('execute',()=>{this['_commitEditInputValue'](_0x4f791e);}),_0x25a52f;}['_commitEditInputValue'](_0x165f9e){const _0x4260bf=_0x165f9e['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x4260bf});}['_createCancelEditButtonView'](_0x124494){const _0xff5cf2=new yt(_0x124494);return _0xff5cf2['set']({'icon':_0x17f7a6,'withText':!0x1,'tooltip':Mi(_0x124494,'AI_CHAT_HISTORY_CANCEL')}),_0xff5cf2['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0xff5cf2['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0xff5cf2;}['_createSpinnerView'](){const _0x87f14b=new AISpinnerView('tiny');return _0x87f14b['isVisible']=!0x0,_0x87f14b;}['isMatching'](_0x10a26a){return'string'==typeof this['title']&&this['title']['match'](_0x10a26a)?{'title':!0x0}:null;}['highlightText'](_0x14f1bd){this['_titleView']['highlightText'](_0x14f1bd);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0xf35e00,_0x45b5b3){super(_0xf35e00),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x4c5b35=Mn(_0xf35e00,this);this['headerView']=new AIHeaderView(_0xf35e00,{'label':Mi(_0xf35e00,'AI_CHAT_HISTORY_HEADING'),'icon':_0x22e6d9,'class':'ck-ai-header_history','content':_0x4c5b35,'showResizeButton':_0x45b5b3}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0xf35e00,[]),this['sectionsView']['delegate'](...Un)['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',_0x2336d8=>!_0x2336d8)]}}),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 _0x3c641b=new _0x31f0b4(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x2eff0b=>Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x2eff0b),'secondary':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x32b397=this['_createErrorView']();return _0x32b397['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x227dc9=>!_0x227dc9)]}}),_0x3c641b['on']('render',()=>{_0x3c641b['children']['add'](_0x32b397,0x1);}),_0x3c641b['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x58177a=>!_0x58177a)]}}),_0x3c641b;}['_createSkeletonView'](){const _0x2399bc=new AISkeletonView(this['locale'],xs['aiHistory']);return _0x2399bc['bind']('isVisible')['to'](this,'isLoading'),_0x2399bc;}['_createErrorView'](){const _0x5e59b3=new Nt(this['locale']),_0x400cdc=new yt(this['locale']);_0x400cdc['set']({'withText':!0x1,'icon':_0x17f7a6,'class':'ck-ai-notification_error__dismiss-button'}),_0x400cdc['bind']('isVisible')['to'](this,'hasItems',_0x5b9143=>!!_0x5b9143),_0x400cdc['on']('execute',()=>{this['errorMessage']='';});const _0x5560d1=this['bindTemplate'];return _0x5e59b3['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x5560d1['to']('errorMessage')}]},_0x400cdc]}),_0x5e59b3;}['_createEmptyStateView'](){const _0x564c7b=new Nt(this['locale']);return _0x564c7b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x382e9c=>!_0x382e9c)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Mi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x564c7b;}['_createListItemViews'](_0x1a6f4e,_0x18c800){const _0x245f7a=[];for(const _0x4f5123 of _0x1a6f4e){const _0x5c09c3=new AIChatHistoryListItemView(_0x18c800,_0x4f5123);_0x5c09c3['delegate'](...Un)['to'](this),_0x245f7a['push'](_0x5c09c3);}return _0x245f7a;}['updateHistoryItemsWithCategories'](_0x3e46b6){const _0x2ece5c=this['locale']||'en',_0x519241=[];for(const _0x563a91 of _0x3e46b6){const _0x56ddab=this['_createListItemViews'](_0x563a91['items'],_0x2ece5c);_0x519241['push'](new AIChatHistoryListView(_0x2ece5c,{'title':_0x563a91['title'],'items':_0x56ddab}));}this['sectionsView']['sections']=_0x519241,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x519241),this['hasItems']=_0x3e46b6['some'](_0x2a882a=>_0x2a882a['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x23736d){for(const _0x9aacfc of this['sectionsView']['sections']){const _0xbb05ff=_0x9aacfc['getItem'](_0x23736d);if(_0xbb05ff){if(_0x9aacfc['removeItem'](_0xbb05ff),0x0===_0x9aacfc['itemsViews']['length']){const _0x3e2e46=this['sectionsView']['sections']['indexOf'](_0x9aacfc);-0x1!==_0x3e2e46&&(this['sectionsView']['sections']['splice'](_0x3e2e46,0x1),this['sectionsView']['items']['remove'](_0x9aacfc));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x35d1fd,_0x5a2a2b){for(const _0x7e9eb6 of this['sectionsView']['sections']){const _0x3de69=_0x7e9eb6['getItem'](_0x35d1fd);if(_0x3de69){_0x3de69['updateTitle'](_0x5a2a2b);break;}}}['updateItemLoadingState'](_0x322baa,_0x183360,_0xab8800){for(const _0x4e8d76 of this['sectionsView']['sections']){const _0x3366d0=_0x4e8d76['getItem'](_0x322baa);if(_0x3366d0){_0x3366d0['updateLoadingState'](_0x183360,_0xab8800);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x3f78e6=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x3f78e6);}}}const Un=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0x4338bf{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x82782b){super(_0x82782b);const _0x2d3937=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0x2d3937['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x2d3937),this['_historyView']['delegate'](...Un)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x2d3937['view'],'isMaximized',_0x200c48=>_0x200c48),_0x2d3937['view']['addTab']({'id':'history','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x22e6d9,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x5120fb){this['_historyView']['removeHistoryItem'](_0x5120fb);}['updateItems'](_0x3c9832){this['_historyView']['updateHistoryItemsWithCategories'](_0x3c9832);}['updateItemTitle'](_0x23b18e,_0x2a2234){this['_historyView']['updateItemTitle'](_0x23b18e,_0x2a2234);}['updateItemLoadingState'](_0x2a49ac,_0x3d2377,_0x498ae2){this['_historyView']['updateItemLoadingState'](_0x2a49ac,_0x3d2377,_0x498ae2);}['setLoadingSkeleton'](_0x5d276d){this['_historyView']['isLoading']=_0x5d276d;}['showError'](_0x4521cb){this['_historyView']['errorMessage']=_0x4521cb;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ct(){['id'];['createdAt'];constructor({id:_0x2c637a,title:_0xfba017,createdAt:_0x53b885,updatedAt:_0x3bb275,pinned:_0x2d156a}){super(),this['id']=_0x2c637a,this['createdAt']=new Date(_0x53b885),this['set']('title',_0xfba017),this['set']('updatedAt',_0x3bb275?new Date(_0x3bb275):null),this['set']('pinned',_0x2d156a||!0x1);}['updateTitle'](_0x19102e){this['set']('title',_0x19102e),this['updatedAt']=new Date();}['updatePinned'](_0x3fe1e4){this['set']('pinned',_0x3fe1e4),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x18ce69,group:_0x7cee84}){super(),this['connector']=_0x18ce69,this['group']=_0x7cee84;}async['init'](){try{const _0x251209=this['connector']['fetchConversations'](this['group']),_0x244ebb=await _0x251209['getConversations']();this['loadItems'](_0x244ebb);}catch(_0x590c49){this['fire']('error',{'error':_0x590c49,'operation':'init'});}}['addItem'](_0x23e3bb){this['items']['push'](_0x23e3bb);}async['removeItem'](_0x4ea070){const _0x3803b9=this['items']['findIndex'](_0x335bf2=>_0x335bf2['id']===_0x4ea070);if(-0x1===_0x3803b9)return!0x1;try{return await this['connector']['deleteConversation'](_0x4ea070)['execute'](),this['items']['splice'](_0x3803b9,0x1),this['fire']('itemRemoved',{'itemId':_0x4ea070}),!0x0;}catch(_0x45b0f8){return this['fire']('error',{'error':_0x45b0f8,'operation':'removeItem','itemId':_0x4ea070}),!0x1;}}['getItem'](_0x21fae6){return this['items']['find'](_0x811535=>_0x811535['id']===_0x21fae6);}async['updateItemTitle'](_0x3f0e19,_0x52505a){const _0x301de=this['getItem'](_0x3f0e19);if(!_0x301de)return!0x1;try{return await this['connector']['updateConversation'](_0x3f0e19,{'title':_0x52505a})['getResult'](),_0x301de['updateTitle'](_0x52505a),this['fire']('itemUpdated',{'itemId':_0x3f0e19,'updates':{'title':_0x52505a}}),!0x0;}catch(_0x2c7d25){return this['fire']('error',{'error':_0x2c7d25,'operation':'updateItemTitle','itemId':_0x3f0e19}),!0x1;}}async['updateItemPinned'](_0x1753dc,_0x4375d5){const _0x1bc750=this['getItem'](_0x1753dc);if(!_0x1bc750)return!0x1;try{return await this['connector']['updateConversation'](_0x1753dc,{'pinned':_0x4375d5})['getResult'](),_0x1bc750['updatePinned'](_0x4375d5),this['fire']('itemUpdated',{'itemId':_0x1753dc,'updates':{'pinned':_0x4375d5}}),!0x0;}catch(_0x1c926b){return this['fire']('error',{'error':_0x1c926b,'operation':'updateItemPinned','itemId':_0x1753dc}),!0x1;}}['loadItems'](_0x895e13){try{this['items']=[],_0x895e13['map'](_0x57c123=>{this['addItem'](new AIChatHistoryItem(_0x57c123));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x1672f9){this['fire']('error',{'error':_0x1672f9,'operation':'loadItems'});}}['getItems'](_0x470673={}){const _0x1115df=void 0x0!==_0x470673['pinned']&&_0x470673['pinned'],_0x540e37=_0x470673['from']?new Date(_0x470673['from']['getFullYear'](),_0x470673['from']['getMonth'](),_0x470673['from']['getDate']()):null,_0x18f39b=_0x470673['to']?new Date(_0x470673['to']['getFullYear'](),_0x470673['to']['getMonth'](),_0x470673['to']['getDate']()):null;return this['items']['filter'](_0x243226=>{if(_0x243226['pinned']!==_0x1115df)return!0x1;if(_0x18f39b){const _0x11aa1f=new Date(_0x243226['createdAt']['getFullYear'](),_0x243226['createdAt']['getMonth'](),_0x243226['createdAt']['getDate']());return _0x540e37?_0x540e37['getTime']()===_0x18f39b['getTime']()?_0x11aa1f['getTime']()===_0x540e37['getTime']():_0x11aa1f<_0x18f39b&&_0x11aa1f>=_0x540e37:_0x11aa1f<_0x18f39b;}return!0x0;});}}class AIChatHistoryController extends _0x4338bf{['_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 _0x4740cc=this['context']['plugins']['get'](AITabs);try{const _0x162926=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x162926}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x3cdb68,_0x1f5d49)=>{this['_setItemLoading'](_0x1f5d49['id'],'remove'),this['_handleRemove'](_0x1f5d49['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x4fb179,_0x402c29)=>{this['_setItemLoading'](_0x402c29['id'],'rename'),this['_handleEditTitle'](_0x402c29['id'],_0x402c29['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x3ac4c3,_0xaa044d)=>{void 0x0!==_0xaa044d['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0xaa044d['itemId'],_0xaa044d['updates']['title']),void 0x0!==_0xaa044d['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0xaa044d['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x44bc22,_0x17fe4f)=>{this['_aiChatController']['_handleRemovedConversation'](_0x17fe4f['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x17fe4f['itemId']),this['_clearItemLoading'](_0x17fe4f['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x1125de,_0x42a1e5)=>{this['_handleHistoryErrorUI'](_0x42a1e5['error'],_0x42a1e5['operation'],_0x42a1e5['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x344b27,_0x1ebd55)=>{this['_handleSelectConversation'](_0x1ebd55['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x2dcd2d,_0x16ff57)=>{const _0x1cb604=_0x16ff57['pinned']?'pin':'unpin';this['_setItemLoading'](_0x16ff57['id'],_0x1cb604),this['_handleTogglePin'](_0x16ff57['id'],_0x16ff57['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x4740cc['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x4740cc['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x1cd752){this['_handleHistoryErrorUI'](_0x1cd752,'init');}}async['_handleEditTitle'](_0x5d12a5,_0x4af1a4){await this['history']['updateItemTitle'](_0x5d12a5,_0x4af1a4);}async['_handleTogglePin'](_0x112fdb,_0x2aec80){await this['history']['updateItemPinned'](_0x112fdb,_0x2aec80);}async['_handleRemove'](_0x41f445){await this['history']['removeItem'](_0x41f445);}async['_handleSelectConversation'](_0x46c3c7){await this['_aiChatController']['loadConversation'](_0x46c3c7);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x4a6e8c=this['_aiChatController']['activeConversation']?.['id'],_0x281f24=this['_getCategorizedItems']()['map'](_0x25b76a=>({'title':_0x25b76a['title'],'items':_0x25b76a['items']['map'](_0x4ec20a=>({'id':_0x4ec20a['id'],'title':_0x4ec20a['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x4ec20a['createdAt'])['toLocaleDateString'](),'active':_0x4ec20a['id']===_0x4a6e8c,'pinned':_0x4ec20a['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x281f24);}['_setItemLoading'](_0x3b6dbb,_0x32ffe6){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x3b6dbb,_0x32ffe6,!0x0);}['_clearItemLoading'](_0x508a7e){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x508a7e,null,!0x1);}['_handleHistoryErrorUI'](_0x311acc,_0x5a5b9c,_0xe3e393){const _0x368030=this['_generateErrorMessage'](_0x5a5b9c,_0xe3e393);this['_aiChatHistoryUi']['showError'](_0x368030),_0xe3e393&&this['_clearItemLoading'](_0xe3e393),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x226492,_0x513b47){const _0x5d0e32=_0x513b47?this['history']['getItem'](_0x513b47):null,_0x280619=_0x5d0e32?.['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x226492){case'updateItemTitle':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x280619);case'updateItemPinned':{const _0x303cf7=Mi(this['context']['locale'],_0x5d0e32?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x303cf7,_0x280619]);}case'removeItem':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x280619);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 _0x511de7=new Date(),_0xf3fa8b=new Date(_0x511de7['getFullYear'](),_0x511de7['getMonth'](),_0x511de7['getDate']()),_0x31929e=new Date(_0xf3fa8b);_0x31929e['setDate'](_0x31929e['getDate']()-0x1);const _0x28f4c7=new Date(_0xf3fa8b);_0x28f4c7['setDate'](_0x28f4c7['getDate']()-0xe);const _0x206cc2=this['history']['getItems']({'pinned':!0x0}),_0x2ba5f4=this['history']['getItems']({'from':_0xf3fa8b,'to':_0xf3fa8b}),_0x99a6c5=this['history']['getItems']({'from':_0x31929e,'to':_0x31929e}),_0x4d8b4b=this['history']['getItems']({'from':_0x28f4c7,'to':_0x31929e}),_0x362523=this['history']['getItems']({'to':_0x28f4c7}),_0x5bbf4a=[];return _0x206cc2['length']>0x0&&_0x5bbf4a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x206cc2}),_0x2ba5f4['length']>0x0&&_0x5bbf4a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x2ba5f4}),_0x99a6c5['length']>0x0&&_0x5bbf4a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x99a6c5}),_0x4d8b4b['length']>0x0&&_0x5bbf4a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x4d8b4b}),_0x362523['length']>0x0&&_0x5bbf4a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x362523}),_0x5bbf4a;}}class AIChatHistory extends _0x4338bf{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0x4338bf{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3e360e){super(_0x3e360e),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(_0x3269a8,_0x58c352){super(_0x3269a8);const {id:_0x1865c4,type:_0x51880b,icon:_0x1603e2}=_0x58c352;this['id']=_0x1865c4,this['set']({'label':_0x58c352['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x58c352['id']}}),_0x1603e2?this['icon']=_0x1603e2:'chat'===_0x51880b?this['icon']=_0x25d15b:'review'===_0x51880b?this['icon']=_0x51b0f9:'translate'===_0x51880b&&(this['icon']=_0x154751);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x2c8cf7,_0x30b177){super(_0x2c8cf7),this['set']('isEnabled',!0x0);const _0x461010=_0x30b177['map'](_0x3c1a5f=>{const _0x2aa5fb=new Ht(this['locale']),_0x1e4d2d=new AIChatShortcutView(this['locale'],_0x3c1a5f);return _0x1e4d2d['bind']('isEnabled')['to'](this),_0x2aa5fb['children']['add'](_0x1e4d2d),_0x1e4d2d['delegate']('execute')['to'](this),_0x2aa5fb;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0x461010),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const Bn='chat-shortcuts';class AIChatShortcuts extends _0x4338bf{['_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 _0x2f82d5=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x21c50e=_0x2f82d5['activeConversation'];_0x21c50e['isFromHistory']||this['_injectShortcuts'](_0x21c50e);}),this['listenTo'](_0x2f82d5,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x53836e=['chat','review','translate'];this['_shortcuts']['forEach'](_0x3c3c4c=>{let _0x587490=!0x0;if(_0x3c3c4c['id']&&_0x3c3c4c['label']&&_0x53836e['includes'](_0x3c3c4c['type'])?'chat'===_0x3c3c4c['type']&&(_0x587490='string'==typeof _0x3c3c4c['prompt']):_0x587490=!0x1,!_0x587490)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x3c3c4c});});}['_injectShortcuts'](_0x3fe0c1){this['_removeShortcuts'](),this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],Bn),this['_shortcutsView']['on']('execute',_0x103cd6=>{const _0x153f5e=_0x103cd6['source']['id'];this['_executeShortcut'](_0x153f5e);}),this['_listenedConversation']=_0x3fe0c1,this['listenTo'](_0x3fe0c1,'uploadProgressChanged',(_0x3f3786,_0x2f1355)=>{this['_shortcutsView']['isEnabled']=!_0x2f1355['isUploadInProgress'];});}['_removeShortcuts'](){const _0x404998=this['context']['plugins']['get'](AIChatUI);_0x404998['hasFeedItem'](Bn)&&_0x404998['removeFeedItem'](Bn),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x52c507){const _0x5f7e8e=this['_shortcuts']['find'](_0x277495=>_0x277495['id']===_0x52c507),_0x2736b6=_0x5f7e8e['type'];'chat'===_0x2736b6?this['_runChatShortcut'](_0x5f7e8e):'review'===_0x2736b6?_0x5f7e8e['commandId']?this['_runReviewShortcut'](_0x5f7e8e):this['_switchTab']('reviewMode'):'translate'===_0x2736b6&&(_0x5f7e8e['language']?this['_runTranslateShortcut'](_0x5f7e8e):this['_switchTab']('translate'));}['_switchTab'](_0x5c48ed){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x5c48ed});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x5c48ed);}async['_runChatShortcut']({prompt:_0x286c44,draftMode:_0x55ecb2,useWebSearch:_0x56d5db=!0x1,useReasoning:_0x22669b=!0x1,model:_0x1f69ca}){const _0xa5e52f=this['context']['plugins']['get']('AIChatController'),_0x900e03=_0xa5e52f['activeConversation'];let _0x31c8de;_0x31c8de=_0x1f69ca?await _0x900e03['chatModels']['getModel'](_0x1f69ca):await _0x900e03['chatModels']['getDefault'](),_0x31c8de&&await _0x900e03['setModel'](_0x31c8de),_0x900e03['setWebSearch'](_0x56d5db),_0x900e03['setReasoning'](_0x22669b),_0xa5e52f['addCurrentDocumentToChatContext'](),_0x55ecb2?(this['_aiChatUI']['setPromptInputValue'](_0x286c44),this['_aiChatUI']['focusPromptInput'](!0x0)):_0xa5e52f['sendMessage']({'message':_0x286c44});}['_runReviewShortcut']({commandId:_0x4c3039,model:_0x4b2d49,prompt:_0x53fae4,params:_0x30f885}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x57f305={'id':_0x4c3039,'isCustom':'custom'===_0x4c3039};_0x4b2d49&&_0x53fae4&&(_0x57f305['args']={'model':_0x4b2d49,'prompt':_0x53fae4}),_0x30f885&&(_0x57f305['params']=_0x30f885),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x57f305);}['_runTranslateShortcut']({language:_0x55e3e8}){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':_0x55e3e8,'args':{'language':_0x55e3e8}});}}class ToggleAICommand extends _0x2d0571{constructor(_0x387acc){super(_0x387acc);const _0x2d56a0=_0x387acc['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x2d56a0,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x444d76=this['editor']['plugins']['get']('AITabs')['view'];_0x444d76['isVisible']=!_0x444d76['isVisible'];}}class AIToggleButtonUI extends _0x3453ad{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3e7aea=this['editor'];_0x3e7aea['commands']['add']('toggleAi',new ToggleAICommand(_0x3e7aea)),_0x3e7aea['ui']['componentFactory']['add']('toggleAi',()=>{const _0x5913b8=this['_createAIUIButton'](yt);return _0x5913b8['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x5913b8;}),_0x3e7aea['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x472835=this['_createAIUIButton'](Yt);return _0x472835['set']({'role':'menuitemcheckbox'}),_0x472835;});}['_createAIUIButton'](_0x44cc4e){const _0x1c8eed=this['editor'],_0x4c656e=_0x1c8eed['commands']['get']('toggleAi'),_0x2d7355=new _0x44cc4e(_0x1c8eed['locale']);return _0x2d7355['set']({'label':Mi(_0x1c8eed['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x5a4803,'isToggleable':!0x0}),_0x2d7355['bind']('isEnabled')['to'](_0x4c656e),_0x2d7355['bind']('isOn')['to'](_0x4c656e,'value',_0x1da81a=>!!_0x1da81a),this['listenTo'](_0x2d7355,'execute',()=>{_0x4c656e['execute']();}),_0x2d7355;}}const Gn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0xc97ff6){super(_0xc97ff6),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x2bb645){this['showError'](_0x2bb645);}['showError'](_0x4f9349){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x4f9349,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x4a2074=new Nt(this['locale']),_0x235e4e=new Nt(this['locale']);return _0x235e4e['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x4a2074['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x483d4e=>!_0x483d4e)]},'children':[_0x235e4e]}),_0x4a2074;}}const Fn=0xa;class AIBalloon extends _0x4338bf{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'](_0x2c7989){const {id:_0x10e702}=this['_currentConfig']??{};this['_currentConfig']=_0x2c7989,this['_editor']=_0x2c7989['targetEditor'];const {id:_0x3de3d9}=this['_currentConfig'];this['isOpen']&&_0x10e702===_0x3de3d9?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x547f17=this['_editor'];if(!_0x547f17)return;const _0x5aceb1=_0x547f17['plugins']['get']('Dialog');_0x5aceb1['isOpen']&&this['_currentConfig']&&_0x5aceb1['id']===this['_currentConfig']['id']&&_0x5aceb1['hide']();}['_updateDialog'](){const _0x264e9f=this['_editor']['plugins']['get']('Dialog'),{icon:_0x2b826a,title:_0x2d6a9c}=this['_currentConfig'];_0x264e9f['view']?.['headerView']&&(_0x264e9f['view']['headerView']['label']=_0x2d6a9c,_0x264e9f['view']['headerView']['iconView']&&_0x2b826a&&(_0x264e9f['view']['headerView']['iconView']['content']=_0x2b826a)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x264e9f['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 _0x4c18a0=this['_editor']['plugins']['get']('Dialog'),{id:_0x469729,title:_0x336086,icon:_0x5de9c9,class:_0x3e1921,mainView:_0x32c354}=this['_currentConfig'];_0x32c354['delegate'](...Gn)['to'](this),_0x4c18a0['show']({'title':_0x336086,'icon':_0x5de9c9,'hasCloseButton':!0x0,'id':_0x469729,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x3e1921||''),'content':_0x32c354,'onShow':_0x4caa0a=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x4caa0a['view']?.['updatePosition']();const _0x3f3400=this['_getSelectionElements']();_0x3f3400&&_0x3f3400[0x0]&&Tt({'target':_0x3f3400[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x4caa0a['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x469729});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x469729}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x31acf2,_0x2eace6){if(!_0x2eace6){const _0x59b11f=this['_getTargetRootDomRect']();if(!_0x59b11f)return null;_0x2eace6=_0x59b11f;}const _0x3e33be=this['_getSelectionElements']();if(!_0x3e33be||0x0===_0x3e33be['length'])return{'left':Math['round'](_0x2eace6['left']+_0x2eace6['width']/0x2-_0x31acf2['width']/0x2),'top':Math['round'](_0x2eace6['top']+_0x2eace6['height']/0x2-_0x31acf2['height']/0x2)};const _0x2c14e6=Math['round'](_0x2eace6['left']+_0x2eace6['width']/0x2-_0x31acf2['width']/0x2),_0x45f894=_0x3e33be['map'](_0x39a66a=>new dt(_0x39a66a)),_0x112847=_0x31acf2['height'];return{'left':_0x2c14e6,'top':this['_calculateOptimalTopPosition'](_0x45f894,_0x112847,_0x2eace6)};}['_calculateOptimalTopPosition'](_0x225d39,_0x377c06,_0x3388dd){const _0x5a4db7=new dt(lt['window']),_0x7804ed=_0x225d39['map'](_0x4605c1=>_0x4605c1['getVisible']())['filter'](_0x3adca0=>_0x3adca0),_0x3b197c=dt['getBoundingRect'](_0x7804ed);if(!_0x3b197c)return Math['round'](_0x3388dd['top']+_0x3388dd['height']/0x2);const _0x54b8de=_0x5a4db7['getIntersection'](_0x3b197c);if(!_0x54b8de)return Math['round'](_0x3388dd['top']+_0x3388dd['height']/0x2);const _0x209434=_0x3388dd['getVisible'](),_0x3c4cae=_0x209434&&_0x3b197c['height']>_0x209434['height'],_0x1055c6=_0x54b8de['top'],_0xc5dc54=_0x54b8de['bottom'];if(_0x3c4cae){const _0x4ed168=(_0x209434||_0x5a4db7)['height']/0x2-_0x377c06/0x2,_0x3fb096=_0x1055c6-Fn-_0x3388dd['top'],_0x550c48=_0x3388dd['bottom']-_0xc5dc54-Fn;return _0x3fb096>=_0x377c06?Math['max'](Fn,_0x1055c6-_0x377c06-Fn):_0x550c48>=_0x377c06?_0xc5dc54+Fn:Math['max'](Fn,_0x4ed168);}const _0x1d3dd3=_0x1055c6-_0x377c06,_0x2497b1=_0x3388dd['bottom']-_0xc5dc54-Fn,_0xc90762=_0x1055c6-Fn-_0x3388dd['top'];let _0x594de1;if(_0x2497b1>=_0x377c06)_0x594de1=_0xc5dc54+Fn;else{if(_0xc90762>=_0x377c06)_0x594de1=_0x1d3dd3-Fn;else _0x594de1=_0x1055c6+_0x3b197c['height']/0x2-_0x377c06/0x2;}return _0x594de1;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x338fb5=this['_editor'];this['listenTo'](_0x338fb5['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x45aedc,data:{newRange:_0xa694a}}of _0x338fb5['model']['document']['differ']['getChangedMarkers']())if(_0x45aedc['startsWith'](fs+':')&&(_0xa694a&&(_0xa694a['start']['isEqual'](_0xa694a['end'])||'$graveyard'==_0xa694a['root']['rootName'])||null==_0xa694a)){const _0x2926fc=Mi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x2926fc),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x28548f=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x28548f['model']['document']);}['_getSelectionElements'](){const _0x4af5f9=this['_editor'];return _0x443fc1(_0x4af5f9['editing'],[..._0x4af5f9['model']['markers']['getMarkersGroup']('ai-selection'),..._0x4af5f9['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0x221d57=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0x221d57)return null;const _0x423179=this['_editor'],_0x1c4b76=_0x423179['editing']['view']['document']['getRoot'](_0x221d57['rootName']);if(!_0x1c4b76)return null;const _0x518be2=_0x423179['editing']['view']['domConverter']['mapViewToDom'](_0x1c4b76);return _0x518be2&&_0x518be2 instanceof HTMLElement?new dt(_0x518be2):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x5770e2,_0x44fd3f={}){super(_0x5770e2),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x44fd3f};const _0x5ba469=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x5ba469?'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'](_0x32c4dc){this['showChangesButton']['isEnabled']=_0x32c4dc;}['_setupRatingButtons'](){this['likeButton']=new yt(this['locale']),this['likeButton']['set']({'icon':_0x1579df,'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':_0x2b60d4,'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':_0x3dadf9,'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 _0x2a2210=new Lt();_0x2a2210['set']({'content':_0x5d25a9}),_0x2a2210['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'](_0x2a2210);}['_setupShowChangesButton'](){this['showChangesButton']=new yt(this['locale']),this['showChangesButton']['set']({'icon':_0x5387a4,'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',_0x5037b3=>_0x5037b3?_0x25bd6e:_0x5387a4),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(_0x9f8eac,_0x3bc906){super(_0x9f8eac);const _0x2e5cea=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']=_0x3bc906,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x9f8eac),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x9f8eac,_0x3bc906['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x3bc906),this['_stateView']=new AISuggestionContentPartStateView(_0x9f8eac),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x9f8eac,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x9f8eac,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x52d257,_0x36cd4f,_0x59a601,_0x2bb805)=>{let _0x335279,_0x315e58;'pending'===_0x2bb805?(_0x335279=this['_partToolbarView'],_0x315e58=this['_stateView']):(_0x335279=this['_stateView'],_0x315e58=this['_partToolbarView']),this['_stateView']['setState'](_0x59a601),_0x335279['isVisible']=!0x1,_0x315e58['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x2e5cea['to']('_state',_0x402178=>'ck-ai-chat-balloon-main_state_'+_0x402178)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x3bc906);});}['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'](_0xe9abd){_0xe9abd?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0xe9abd);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x11dada){this['_state']=_0x11dada;}['showError'](_0x38badb){super['showError'](_0x38badb),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x468b98){super['showBlockingError'](_0x468b98),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x45f512){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x45f512;}['togglePartToolbarEnabled'](_0xd72547){this['_partToolbarView']['isEnabled']=_0xd72547;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x1ccf5b,showSuggestButton:_0xa8c42e}){_0x1ccf5b=_0x1ccf5b&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0xa8c42e=_0xa8c42e&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x1ccf5b,'showSuggestButton':_0xa8c42e});}['_createNextButtonView'](){const _0x4b2dd7=new yt(this['locale']);return _0x4b2dd7['set']({'icon':_0x13be7f,'label':Mi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x4b2dd7['on']('execute',()=>{this['fire']('showNext');}),_0x4b2dd7;}['_createPreviousButtonView'](){const _0x5175dc=new yt(this['locale']);return _0x5175dc['set']({'icon':_0x127f23,'label':Mi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x5175dc['on']('execute',()=>{this['fire']('showPrevious');}),_0x5175dc;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0x6ea564,_0x164193){super(_0x6ea564),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x164193});}}class AIChatBalloon extends _0x3453ad{static get['requires'](){return[Gt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x2d8cba){super(_0x2d8cba),this['set']('showDiff',!0x1);}['open'](_0x5592ba){const _0x18f74f=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x18f74f['plugins']['get']('AIBalloon')['open']({..._0x5592ba,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x5592ba['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x5592ba['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x318539){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x318539);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x7288c3){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x7288c3);}['_createChatBalloonView'](){const _0x11eaf7=this['editor'],_0x36250e=_0x11eaf7['plugins']['get']('AIBalloon'),_0x153805=_0x11eaf7['commands']['get']('trackChanges');let _0x706f1f=_0x11eaf7['config']['get']('ai.availableReplyActions')||[...Ps];_0x11eaf7['plugins']['has']('TrackChanges')||(_0x706f1f=_0x706f1f['filter'](_0x32b576=>'insertSuggestion'!=_0x32b576));const _0x5d1737=new AIChatBalloonView(_0x11eaf7['locale'],{'availableActions':_0x706f1f,'showApplyButton':!0x0,'showSuggestButton':!!_0x153805});return _0x5d1737['bind']('showDiff')['to'](this),_0x5d1737['delegate'](...bs)['to'](this),_0x5d1737['delegate']('showPrevious','showNext')['to'](this),_0x36250e['delegate']('dialogClosed')['to'](this),_0x5d1737['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5d1737['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x5d1737['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x153805&&_0x5d1737['bind']('isTrackChangesOn')['to'](_0x153805,'value'),_0x5d1737['render'](),_0x5d1737;}['_toggleRotatorButtonsInDialogHeader'](_0x7f6820){const _0x2b52b1=this['editor'],_0x2c0db9=_0x2b52b1['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x7f6820),_0x2c0db9['has'](this['_chatBalloonView']['previousButtonView'])||(_0x2c0db9['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x2b52b1['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x2c0db9['remove'](this['_chatBalloonView']['previousButtonView']),_0x2c0db9['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x3453ad{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0x287c7d];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Wn(_0xa9211b){const {editor:_0x2ebc9f,action:_0xdf168c,withText:_0x290953=!0x1,withIcon:_0x1f3019=!0x0,isInDropdown:_0x3d18e7=!0x0,shouldPreventFocus:_0x3ba7ca=!0x1,actionButtons:_0x3c1410}=_0xa9211b;return()=>{const _0x90a11b=_0x2ebc9f['locale'],_0x47063d=new yt(_0x90a11b),_0x4f4d8b=_0x47063d['bindTemplate'];_0x3d18e7&&_0x47063d['extendTemplate']({'on':{'mouseenter':_0x4f4d8b['to'](()=>{_0x3ba7ca&&_0x3ba7ca()||_0x47063d['focus']();})}}),_0x3c1410['push']({'buttonView':_0x47063d,'action':_0xdf168c});const _0x415a91=_0xdf168c['icon']??_0xdf168c['parent']?.['icon'];return _0x47063d['set']({'label':_0xdf168c['label'],'withText':_0x290953,'role':'menuitem','icon':_0x1f3019?_0x415a91??_0x3bef17:void 0x0,'tooltip':!_0x290953,'class':'ck-ai-quick-actions-button','isEnabled':_0xdf168c['isEnabled']}),_0x47063d['on']('execute',()=>{_0x2ebc9f['editing']['view']['focus'](),_0x2ebc9f['commands']['execute']('aiQuickAction',_0xdf168c);}),_0x47063d;};}class DropdownMenuButtonWithHighlightView extends _0x443aff{['arrowView'];constructor(_0x4bf3e1,_0x15019e){super(_0x4bf3e1,_0x15019e);const _0x4190d7=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',_0x5c001d=>String(_0x5c001d)),'data-cke-tooltip-disabled':_0x4190d7['to']('isOn')},'on':{'mouseenter':_0x4190d7['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x1a31c9=new Lt();return _0x1a31c9['content']=_0x121964,_0x1a31c9['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x1a31c9;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x222bcd,_0x11f923,_0x49bdcc){super(_0x222bcd),this['_allListItems']=_0x11f923,this['_allSearchableItems']=_0x49bdcc;}['filter'](_0x3c3673){if(!_0x3c3673)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x65c8c8=_0x3c3673['source']['toLowerCase']()['trim'](),_0x60aef=this['_allSearchableItems']['filter'](_0x3b0a50=>(_0x3b0a50['groupLabel']?_0x3b0a50['label']+'\x20('+_0x3b0a50['groupLabel']+')':_0x3b0a50['label'])['toLowerCase']()['includes'](_0x65c8c8));return this['items']['clear'](),this['items']['addMany'](_0x60aef['sort']((_0x437cae,_0x53a227)=>{const _0x3142ba=_0x437cae['groupLabel'],_0x16a744=_0x53a227['groupLabel'];return _0x3142ba||_0x16a744?_0x3142ba?0x1:-0x1:0x0;})['map'](_0x17a358=>_0x17a358['item'])),this['_highlightQuery'](_0x65c8c8,_0x60aef),{'resultsCount':_0x60aef['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x44bc0b,_0x2ee5fb){if(!_0x44bc0b)return;const _0x3fc666=new RegExp(_0x70d63(_0x44bc0b),'gi');_0x2ee5fb['forEach'](_0x1680d1=>{_0x1680d1['highlightViews']&&_0x1680d1['highlightViews']['forEach'](_0x3fe031=>{'function'==typeof _0x3fe031['highlightText']&&_0x3fe031['highlightText'](_0x3fc666);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0xdc0721=>{_0xdc0721['highlightViews']&&_0xdc0721['highlightViews']['forEach'](_0x54c9de=>{'function'==typeof _0x54c9de['highlightText']&&_0x54c9de['highlightText'](null);});});}}const Kn='menu',Yn='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x2b189b,_0x213382,_0x44b436,_0x31d331,_0x371785=!0x1,_0x4e9ca1=[]){const _0x49fa05=_0x2b189b['locale'];super(_0x49fa05),this['_bodyCollection']=_0x31d331,this['_hasSearch']=_0x371785,this['_actionButtons']=_0x4e9ca1;const _0x1744e9=this['_createListItems'](_0x2b189b,_0x213382,_0x44b436);this['optionsListView']=new AIQuickActionsFilteredListView(_0x49fa05,_0x1744e9,this['_allSearchableItems']),this['optionsListView']['role']=Kn,this['optionsListView']['items']['addMany'](_0x1744e9),this['focusTracker']=new It(),this['keystrokes']=new At(),_0x371785&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x1744e9,this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x371785&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x2b80cc=_0x371785&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x3d0d1a(_0x2b80cc),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x49fa05['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x31f0b4(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 _0x29b16b=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x29b16b);}['_createListItems'](_0x24e738,_0x48a4f1,_0x3c6ede){const _0x4dcf15=new _0x3d0d1a();return _0x48a4f1['forEach'](_0x5e5fbd=>{if('actions'in _0x5e5fbd){const {listItem:_0x477936}=this['_createActionGroupButton'](_0x24e738,_0x5e5fbd,_0x3c6ede);_0x4dcf15['add'](_0x477936),_0x5e5fbd['actions']['forEach'](_0x10751f=>{const {listItem:_0xb7b3c1,highlightViews:_0x60d686}=this['_createSearchResultActionButton'](_0x24e738,_0x10751f,_0x5e5fbd['label'],_0x5e5fbd['icon']);this['_allSearchableItems']['push']({'item':_0xb7b3c1,'label':_0x10751f['label'],'groupLabel':_0x5e5fbd['label'],'highlightViews':_0x60d686});});}else{const {listItem:_0x37c8c5}=this['_createActionButton'](_0x24e738,_0x5e5fbd);_0x4dcf15['add'](_0x37c8c5);const _0x16d220=_0x37c8c5['children']['first'];if(_0x16d220){const {listItem:_0x5f024f,highlightViews:_0x321bf8}=this['_createSearchResultActionButton'](_0x24e738,_0x5e5fbd);this['_allSearchableItems']['push']({'item':_0x5f024f,'label':_0x16d220['label']||'','highlightViews':_0x321bf8});}}}),_0x4dcf15;}['_createActionButton'](_0x16779c,_0x3d1d2a,_0x224564,_0x5f49e3){const _0x3ca3c9=new Ht(this['locale']);if(_0x224564&&_0x5f49e3){const _0x1ea798=new yt(this['locale']),_0x38d882=_0x1ea798['bindTemplate'],_0x5176e0=new _0x5e90d9();_0x5176e0['text']=_0x3d1d2a['label'];const _0x5b2620=new _0x5e90d9();_0x5b2620['text']=_0x224564;const _0x1dc2b4=new Lt();_0x1dc2b4['content']=_0x5f49e3,_0x1dc2b4['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x123426=new Nt(this['locale']);_0x123426['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x5232e0=new Nt(this['locale']);return _0x5232e0['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x1ea798['set']({'label':_0x3d1d2a['label']+'\x20('+_0x224564+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x3d1d2a['isEnabled']}),_0x1ea798['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x38d882['if']('isEnabled','ck-disabled',_0x2b20fd=>!_0x2b20fd)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x5176e0,_0x123426,_0x1dc2b4,_0x5b2620,_0x5232e0],'on':{'mouseenter':_0x38d882['to'](()=>{this['_isSearchFocused']()||_0x1ea798['focus']();}),'click':_0x38d882['to'](()=>{_0x1ea798['fire']('execute');})}}),_0x1ea798['on']('execute',()=>{_0x1ea798['isEnabled']&&(_0x16779c['editing']['view']['focus'](),_0x16779c['commands']['execute']('aiQuickAction',_0x3d1d2a));}),_0x3ca3c9['children']['add'](_0x1ea798),this['_actionButtons']['push']({'buttonView':_0x1ea798,'action':_0x3d1d2a}),{'listItem':_0x3ca3c9,'highlightViews':[_0x5176e0,_0x5b2620]};}{const _0x2fd425=new _0x21ad8d(),_0x313bb9=new yt(this['locale'],_0x2fd425),_0x5721aa=_0x313bb9['bindTemplate'],_0x2ca1b0=_0x3d1d2a['icon']??_0x3d1d2a['parent']?.['icon'],_0x4666aa=void 0x0!==_0x3d1d2a['icon'];return _0x313bb9['set']({'label':_0x3d1d2a['label'],'withText':!0x0,'role':'menuitem','icon':_0x4666aa?_0x2ca1b0??_0x3bef17:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x3d1d2a['isEnabled']}),_0x313bb9['extendTemplate']({'on':{'mouseenter':_0x5721aa['to'](()=>{this['_isSearchFocused']()||_0x313bb9['focus']();})}}),_0x313bb9['on']('execute',()=>{_0x16779c['editing']['view']['focus'](),_0x16779c['commands']['execute']('aiQuickAction',_0x3d1d2a);}),_0x3ca3c9['children']['add'](_0x313bb9),this['_actionButtons']['push']({'buttonView':_0x313bb9,'action':_0x3d1d2a}),{'listItem':_0x3ca3c9,'highlightViews':[_0x2fd425]};}}['_createSearchResultActionButton'](_0x1721a4,_0x4d2277,_0x39969f,_0x33e0ac){return _0x39969f&&_0x33e0ac?this['_createSearchResultGroupedActionButton'](_0x1721a4,_0x4d2277,_0x39969f,_0x33e0ac):this['_createSearchResultIndividualActionButton'](_0x1721a4,_0x4d2277);}['_createSearchResultGroupedActionButton'](_0x55e2e9,_0x5aadcf,_0x345461,_0x3ae0f8){const _0x35d211=new Ht(this['locale']),_0x552240=new yt(this['locale']),_0x137fa8=_0x552240['bindTemplate'],{view:_0x3aa7ed,highlightView:_0x53e181}=this['_createSearchResultGroupRow'](_0x345461,_0x3ae0f8),{view:_0x20b27f,highlightView:_0x3d4bb9}=this['_createSearchResultActionRow'](_0x5aadcf['label']),_0x2779e6=this['_createSearchResultContentView'](_0x3aa7ed,_0x20b27f);return _0x552240['set']({'label':_0x5aadcf['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':_0x5aadcf['isEnabled']}),_0x552240['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',_0x137fa8['if']('isEnabled','ck-disabled',_0x57a4ce=>!_0x57a4ce)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x2779e6],'on':{'mouseenter':_0x137fa8['to'](()=>{this['_isSearchFocused']()||_0x552240['focus']();}),'click':_0x137fa8['to'](()=>{this['_handleSearchResultButtonClick'](_0x552240);})}}),this['_setupActionButtonExecution'](_0x552240,_0x55e2e9,_0x5aadcf),_0x35d211['children']['add'](_0x552240),this['_actionButtons']['push']({'buttonView':_0x552240,'action':_0x5aadcf}),{'listItem':_0x35d211,'highlightViews':[_0x53e181,_0x3d4bb9]};}['_createSearchResultIndividualActionButton'](_0x556141,_0xb5ab0c){const _0x2b18c4=new Ht(this['locale']),_0x503e87=new _0x21ad8d(),_0x3c3901=new yt(this['locale'],_0x503e87),_0x2bd72c=_0x3c3901['bindTemplate'];return _0x3c3901['set']({'label':_0xb5ab0c['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0xb5ab0c['isEnabled']}),_0x3c3901['extendTemplate']({'on':{'mouseenter':_0x2bd72c['to'](()=>{this['_isSearchFocused']()||_0x3c3901['focus']();})}}),this['_setupActionButtonExecution'](_0x3c3901,_0x556141,_0xb5ab0c),_0x2b18c4['children']['add'](_0x3c3901),this['_actionButtons']['push']({'buttonView':_0x3c3901,'action':_0xb5ab0c}),{'listItem':_0x2b18c4,'highlightViews':[_0x503e87]};}['_createSearchResultGroupRow'](_0x1df52f,_0x4505b5){const _0x2eb5a5=new Nt(this['locale']),_0x57e94d=new Lt();_0x57e94d['content']=_0x4505b5,_0x57e94d['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x4e0e1b=new _0x5e90d9();return _0x4e0e1b['text']=_0x1df52f,_0x2eb5a5['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x57e94d,_0x4e0e1b]}),{'view':_0x2eb5a5,'highlightView':_0x4e0e1b};}['_createSearchResultActionRow'](_0x3f4fd1){const _0x1f7fc6=new Nt(this['locale']),_0x23dbd4=new _0x5e90d9();return _0x23dbd4['text']=_0x3f4fd1,_0x1f7fc6['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x23dbd4]}),{'view':_0x1f7fc6,'highlightView':_0x23dbd4};}['_createSearchResultContentView'](_0x60c52,_0x21d63c){const _0xc5d66f=new Nt(this['locale']);return _0xc5d66f['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x60c52,_0x21d63c]}),_0xc5d66f;}['_setupActionButtonExecution'](_0x403cfe,_0x23356b,_0x1c6090){_0x403cfe['on']('execute',()=>{_0x403cfe['isEnabled']&&(_0x23356b['editing']['view']['focus'](),_0x23356b['commands']['execute']('aiQuickAction',_0x1c6090));});}['_createActionGroupButton'](_0x201c34,_0x11da4b,_0x554d64){const _0xa52715=new Ht(this['locale']),_0x2b9d90=new _0x21ad8d(),_0x2ef162=new DropdownMenuButtonWithHighlightView(this['locale'],_0x2b9d90),_0x2cf71e=_0x2ef162['bindTemplate'],_0x39468a=this['_getPanelKeystroke'](_0x554d64),_0x6b9c1e=this['_createGroupActionsList'](_0x201c34,_0x11da4b['actions'],_0x554d64);_0x2ef162['set']({'label':_0x11da4b['label'],'withText':!0x0,'role':Yn,'icon':_0x11da4b['icon']??_0x3bef17,'isEnabled':_0x11da4b['actions']['some'](_0x169fa1=>_0x169fa1['isEnabled'])}),_0x2ef162['extendTemplate']({'on':{'mouseenter':_0x2cf71e['to'](()=>{this['_isSearchFocused']()||_0x2ef162['focus']();})}});const _0x107504=new zt(this['locale']);return _0x107504['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x2cf71e['to'](_0x274990=>{this['_handlePanelKeydown'](_0x274990,_0x39468a,_0x2ef162,_0x107504);})}}),_0x2ef162['bind']('isOn')['to'](_0x107504,'isVisible'),this['_bodyCollection']['add'](_0x107504),_0x107504['content']['add'](_0x6b9c1e),this['_setupGroupMenuBehavior'](_0x2ef162,_0x107504),_0xa52715['children']['add'](_0x2ef162),this['_actionButtons']['push']({'buttonView':_0x2ef162,'action':_0x11da4b}),{'listItem':_0xa52715,'highlightView':_0x2b9d90};}['_createGroupActionsList'](_0x17267c,_0x4013fd,_0x54e32f){const _0xd3ca47=new Dt(this['locale']);return _0xd3ca47['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x4013fd['forEach'](_0x59de5a=>{const _0x5deca6=new Ht(this['locale']),_0x3c6f12=Wn({'editor':_0x17267c,'action':_0x59de5a,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x5deca6['children']['add'](_0x3c6f12),_0x54e32f['focusTracker']['add'](_0x3c6f12),_0xd3ca47['items']['add'](_0x5deca6);}),_0xd3ca47;}['_setupGroupMenuBehavior'](_0xb7c9fd,_0x4578ba){const _0x38203f=_0xb7c9fd['bindTemplate'],_0x1ddab0=this['_getButtonKeystroke'](_0xb7c9fd);_0xb7c9fd['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x38203f['to'](()=>{this['_showNestedPanel'](_0x4578ba,_0xb7c9fd);}),'mouseleave':_0x38203f['to'](_0xc9110b=>{const _0x1d7a51=_0xc9110b['relatedTarget'];this['_isMovingToNestedMenu'](_0x1d7a51,_0x4578ba)||this['_hideNestedPanel'](_0x4578ba);}),'keydown':_0x38203f['to'](_0x56151d=>{_0x56151d['key']==_0x1ddab0&&(this['_showNestedPanel'](_0x4578ba,_0xb7c9fd),_0x4578ba['content']['get'](0x0)['focus']());})}}),_0x4578ba['on']('render',()=>{_0x4578ba['element']?.['addEventListener']('mouseleave',_0x55e2cd=>{const _0x19b9af=_0x55e2cd['relatedTarget'];_0xb7c9fd['element']?.['contains'](_0x19b9af)||this['_isMovingToNestedMenu'](_0x19b9af,_0x4578ba)||this['_hideNestedPanel'](_0x4578ba);});});}['_showNestedPanel'](_0xe59d6e,_0x1661ec){this['_openNestedPanels']['forEach'](_0x442965=>{_0x442965!==_0xe59d6e&&_0x442965['isVisible']&&_0x442965['hide']();}),_0xe59d6e['show'](),_0xe59d6e['pin']({'positions':[_0x194033['eastSouth']],'target':_0x1661ec['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0xe59d6e);}['_hideNestedPanel'](_0x3581bc){_0x3581bc['hide'](),this['_openNestedPanels']['delete'](_0x3581bc);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x1c6a06=>_0x1c6a06['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0xe95d5e,_0x4704c9){if(!_0xe95d5e)return!0x1;if(_0x4704c9['element']?.['contains'](_0xe95d5e))return!0x0;const _0xe28b67=_0xe95d5e;return _0xe28b67['closest']&&(null!==_0xe28b67['closest']('.ck-ai-quick-actions-group-panel')||null!==_0xe28b67['closest']('.ck-ai-quick-actions-group-list')||null!==_0xe28b67['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'](_0x2f3280){return'rtl'===_0x2f3280['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x273a69){return'rtl'===_0x273a69['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x3a2f6b,_0xed545e,_0x2ae5f2,_0x20089a){_0x3a2f6b['key']==_0xed545e&&(_0x2ae5f2['focus'](),this['_hideNestedPanel'](_0x20089a));}['_handleSearchResultButtonClick'](_0x4d5b27){_0x4d5b27['fire']('execute');}}function $n(_0x627348){const {editor:_0x48b295,content:_0x3f32d3,buttonDefinition:_0x44a869,bodyCollection:_0x288d5b,hasSearch:_0x549b0c=!0x1,actionButtons:_0xbe0cf1}=_0x627348;return()=>{const _0x221544=_0x48b295['locale'],_0x1bc015=_0x48b295['commands']['get']('aiQuickAction'),_0x5b8ef6=Ft(_0x221544);_0x5b8ef6['bind']('isEnabled')['to'](_0x1bc015),_0x5b8ef6['buttonView']['set']({'icon':_0x44a869['icon']??_0x3bef17,'label':_0x44a869['label'],'tooltip':!0x0}),_0x5b8ef6['set']({'class':'ck-ai-quick-actions-dropdown'});const _0xdf81e2=new AIQuickActionsDropdownContentView(_0x48b295,_0x3f32d3,_0x5b8ef6,_0x288d5b,_0x549b0c,_0xbe0cf1);return _0x5b8ef6['panelView']['children']['add'](_0xdf81e2),_0x549b0c&&_0x5b8ef6['on']('change:isOpen',(_0x4a7c98,_0x4ea533,_0x47a83c)=>{if(_0x47a83c){if(_0x48b295['plugins']['has']('AIEditing')){const _0x5bead1=_0x48b295['plugins']['get'](AIEditing),_0xdc7f82=_0x48b295['model']['document']['selection'],_0x3040f4=Array['from'](_0xdc7f82['getRanges']());_0x3040f4['length']>0x0&&_0x5bead1['showFakeVisualSelection']({'editor':_0x48b295,'ranges':_0x3040f4,'id':'quick-action','priority':0x14});}}else _0x48b295['plugins']['has']('AIEditing')&&_0x48b295['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0xdf81e2['resetSearch']();}),_0x5b8ef6;};}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>',Qn='<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>',Xn='<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>',zn=/* #__PURE__ -- @preserve */
28
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x3453ad{['_actionButtons']=[];['_menuBarGroupViews']=[];static get['requires'](){return[_0x48beb7,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4257ea=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x4257ea),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x5b54ba){return function(_0x3632d1){const _0x2f80e3=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x3632d1['uiLanguage']),_0x5977fc=_0x2f80e3||'English',_0x1967a3=[{'id':'ask-ai','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x2613d0},{'id':'chat-commands','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x2613d0,'actions':[{'id':'explain','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Mi(_0x3632d1,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':qn['replace']('%0',_0x5977fc),'type':'chat'},{'id':'summarize','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Mi(_0x3632d1,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Qn['replace']('%0',_0x5977fc),'type':'chat'},{'id':'highlight-key-points','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Mi(_0x3632d1,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Xn['replace']('%0',_0x5977fc),'type':'chat'}]},{'id':'improve-writing','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x9d7277},{'id':'continue','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x5bdd29},{'id':'fix-grammar','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x431f46},{'id':'adjust-length','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x16079a,'actions':[{'id':'make-shorter','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x4b0037,'actions':[{'id':'make-tone-casual','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x154751,'actions':[{'id':'translate-to-english','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Mi(_0x3632d1,'AI_QUICK_ACTIONS_OTHER'),'icon':tt,'actions':[]}];return _0x1967a3;}(_0x5b54ba);}['_getDefaultAndCustomActions'](){const _0x404abb=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x464524=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x1ec274=>({..._0x1ec274,'type':'chat'===_0x1ec274['type']?'chat':'action','icon':void 0x0}));return _0x404abb['find'](_0x3e9d65=>'other'===_0x3e9d65['id'])['actions']['push'](..._0x464524),_0x404abb;}async['_initActionTypeQuickActions'](){try{const _0x26b512=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x1c87d0=await _0x26b512['getAll'](),_0x4861bb=(await _0x26b512['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x4861bb),this['_enableButtonsByType']('action',_0x397089=>!!_0x1c87d0['find'](_0x4995db=>_0x4995db['id']===_0x397089['model'])||void 0x0===_0x397089['model']);}catch(_0x21de3f){const _0x982b3c=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x21de3f});Ct(_0x982b3c['message']);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x61d3ed=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x61d3ed,'change:isConversationReady',(_0x55fb3e,_0x17b34e,_0x3f3306)=>{_0x3f3306&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x61d3ed['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x5385f1,_0x3d3b16){this['_quickActionsDefinition']['forEach'](_0x405040=>{'actions'in _0x405040?_0x405040['actions']['forEach'](_0x183f34=>{_0x183f34['type']===_0x5385f1&&(_0x183f34['isEnabled']=_0x3d3b16(_0x183f34));}):_0x405040['type']===_0x5385f1&&(_0x405040['isEnabled']=_0x3d3b16(_0x405040));}),this['_actionButtons']['forEach'](_0x52ddcd=>{if(jn(_0x52ddcd['action']))return;if(_0x52ddcd['action']['type']!==_0x5385f1)return;const _0x447cde=_0x3d3b16(_0x52ddcd['action']);if(_0x52ddcd['action']['isEnabled']=_0x447cde,_0x52ddcd['buttonView']['isEnabled']=_0x447cde,!_0x447cde&&_0x52ddcd['action']['model']){const _0x364d72=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x52ddcd['action']['id'],'modelId':_0x52ddcd['action']['model']});Ct(_0x364d72['message']);}}),this['_actionButtons']['filter'](_0x5dbbc4=>jn(_0x5dbbc4['action']))['forEach'](_0x4e43f7=>{_0x4e43f7['buttonView']['isEnabled']=_0x4e43f7['action']['actions']['some'](_0x588b8a=>_0x588b8a['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x3e64a9,group:_0x544c0f})=>{_0x3e64a9['isEnabled']=_0x544c0f['actions']['some'](_0x2cb1f9=>_0x2cb1f9['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x314ad3){this['_actionButtons']['forEach'](_0x262aae=>{jn(_0x262aae['action'])||'action'===_0x262aae['action']['type']&&(_0x262aae['action']['model']||(_0x262aae['action']['model']=_0x314ad3));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x1d0731=new Xt(this['editor']['locale']);_0x1d0731['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x1d0731),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x1d0731);}['_initializeQuickActionsDropdown'](_0x17b771){const _0x160fb4=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',$n({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x3bef17,'label':Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x17b771,'hasSearch':_0x160fb4,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x5324b9){this['_quickActionsDefinition']=_0x5324b9['map'](_0x3581ab=>{if('actions'in _0x3581ab){const _0xb9216d=_0x3581ab;return{..._0xb9216d,'actions':_0xb9216d['actions']['map'](_0x4360ff=>{const {actions:_0x2fb9be,..._0x343c50}=_0xb9216d;return{..._0x4360ff,'isEnabled':!0x1,'parent':_0x343c50};})['filter'](_0x45ca98=>this['_shouldIncludeAction'](_0x45ca98))};}return{..._0x3581ab,'isEnabled':!0x1};})['filter'](_0x555189=>'actions'in _0x555189?_0x555189['actions']['length']>0x0:this['_shouldIncludeAction'](_0x555189));}['_shouldIncludeAction'](_0x24d5e5){const _0x23e80c=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](zn[_0x24d5e5['type']])&&!_0x23e80c['includes'](_0x24d5e5['id'])&&!('chat'===_0x24d5e5['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x2d3f90){this['_quickActionsDefinition']['forEach'](_0x79018c=>{if('actions'in _0x79018c){const _0x49e07c=$n({'editor':this['editor'],'content':_0x79018c['actions'],'buttonDefinition':_0x79018c,'bodyCollection':_0x2d3f90,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x79018c['id'],_0x49e07c),_0x79018c['actions']['forEach'](_0x575be3=>{const _0x181f0a=Wn({'editor':this['editor'],'action':_0x575be3,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x575be3['id'],_0x181f0a);});}else{const _0x4366ec=Wn({'editor':this['editor'],'action':_0x79018c,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x79018c['id'],_0x4366ec);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x48a124=>{const _0x2c2fab=this['editor']['commands']['get']('aiQuickAction'),_0x202c35=new Kt(_0x48a124),_0x2d71b2=Mi(_0x48a124,'AI_QUICK_ACTIONS_HEADING');_0x202c35['buttonView']['set']({'label':_0x2d71b2,'icon':_0x3bef17});const _0x555ab7=new qt(_0x48a124);return _0x555ab7['set']({'ariaLabel':_0x2d71b2,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x5e3849=>{if('actions'in _0x5e3849){const _0x53b043=_0x5e3849,_0x1d0a35=new Qt(_0x48a124,_0x202c35),_0xfa4865=new Kt(_0x48a124),_0x382ebf=new qt(_0x48a124);_0xfa4865['buttonView']['set']({'label':_0x53b043['label'],'icon':_0x53b043['icon']}),_0x53b043['actions']['forEach'](_0x27400d=>{const _0xd6bcda=new Qt(_0x48a124,_0xfa4865),_0x23d68e=new Yt(_0x48a124);_0x23d68e['set']({'label':_0x27400d['label'],'icon':_0x27400d['icon'],'role':'menuitem','isEnabled':_0x27400d['isEnabled']}),_0x23d68e['on']('execute',()=>{this['_executeQuickAction'](_0x27400d);}),this['_actionButtons']['push']({'buttonView':_0x23d68e,'action':_0x27400d}),_0x23d68e['delegate']('execute')['to'](_0xfa4865),_0xd6bcda['children']['add'](_0x23d68e),_0x382ebf['items']['add'](_0xd6bcda);}),_0xfa4865['isEnabled']=_0x53b043['actions']['some'](_0x511aac=>_0x511aac['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0xfa4865,'group':_0x53b043}),_0xfa4865['panelView']['children']['add'](_0x382ebf),_0x1d0a35['children']['add'](_0xfa4865),_0x555ab7['items']['add'](_0x1d0a35);}else{const _0x3cf751=_0x5e3849,_0x3433e5=new Qt(_0x48a124,_0x202c35),_0x4e1252=new Yt(_0x48a124);_0x4e1252['set']({'label':_0x3cf751['label'],'icon':_0x3cf751['icon'],'role':'menuitem','isEnabled':_0x3cf751['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x4e1252,'action':_0x3cf751}),_0x4e1252['on']('execute',()=>{this['_executeQuickAction'](_0x3cf751);}),_0x4e1252['delegate']('execute')['to'](_0x202c35),_0x3433e5['children']['add'](_0x4e1252),_0x555ab7['items']['add'](_0x3433e5);}}),(Object['values'](zn)['some'](_0x422cf0=>this['editor']['plugins']['has'](_0x422cf0))?_0x202c35['bind']('isEnabled')['to'](_0x2c2fab):_0x202c35['set']({'isEnabled':!0x1}),_0x202c35['panelView']['children']['add'](_0x555ab7),_0x202c35);});}['_executeQuickAction'](_0x5a41c9){const _0x53ddb8=this['editor'];_0x53ddb8['editing']['view']['focus'](),_0x53ddb8['commands']['execute']('aiQuickAction',_0x5a41c9);const _0x28b03b=_0x53ddb8['ui']['view']['menuBarView'];_0x28b03b&&_0x28b03b['close']&&_0x28b03b['close']();}}function jn(_0x5d222b){return'actions'in _0x5d222b;}class AIQuickActionsCommand extends _0x2d0571{['execute'](_0x3a3ecc){switch(this['_expandSelectionIfCollapsed'](),_0x3a3ecc['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x3252c3=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3252c3});}this['_handleAIChatAction'](_0x3a3ecc);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x4a042a=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x4a042a});}this['_handleAIActionsAction'](_0x3a3ecc);}}async['_handleAIChatAction'](_0x2ba986){const _0x3ac335=this['editor']['plugins']['get']('AIChatController'),_0x4f7c80=this['editor']['plugins']['get']('AITabs')['view'];if(_0x4f7c80['isVisible']||(_0x4f7c80['isVisible']=!0x0),'chat'!==_0x4f7c80['activeTab']&&_0x4f7c80['activateTab']('chat'),'ask-ai'===_0x2ba986['id'])_0x3ac335['removeSelectionFromChatContext'](),_0x3ac335['addSelectionToChatContext'](this['editor']),_0x3ac335['focusPromptInput']();else await _0x3ac335['startConversation']({'modelId':_0x2ba986['model']}),_0x3ac335['removeSelectionFromChatContext'](),_0x3ac335['addSelectionToChatContext'](this['editor']),_0x3ac335['focusPromptInput'](),await _0x3ac335['sendMessage']({'message':_0x2ba986['prompt']||_0x2ba986['displayedPrompt']||_0x2ba986['label'],'attributes':{'quickActionData':{'id':_0x2ba986['id']},'displayedPrompt':_0x2ba986['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x2af924=this['editor'],_0x59ec45=_0x2af924['model']['document']['selection'];if(!_0x59ec45['isCollapsed'])return;const _0x44e2c8=gt(_0x59ec45['getSelectedBlocks']())||_0x2af924['model']['schema']['getLimitElement'](_0x59ec45);_0x2af924['model']['change'](_0x36eed4=>{_0x36eed4['setSelection'](_0x44e2c8,'in');});}['_handleAIActionsActionLabel'](_0x3b29a9){return _0x3b29a9['parent']?.['label']&&'other'!==_0x3b29a9['parent']?.['id']?_0x3b29a9['parent']['label']+':\x20'+_0x3b29a9['label']:_0x3b29a9['label'];}async['_handleAIActionsAction'](_0x222093){const _0x1752c7=this['editor']['plugins']['get']('AIActions'),_0x3baeab=_0x222093['prompt']?{'userMessage':_0x222093['prompt'],'model':_0x222093['model']}:{'actionName':_0x222093['actionName']||_0x222093['id'],'args':_0x222093['args']},_0x563f7c=this['_handleAIActionsActionLabel'](_0x222093);await _0x1752c7['executeAction'](_0x3baeab,_0x563f7c,_0x222093['icon']);}}class AIQuickActionsEditing extends _0x3453ad{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x2b1a93=this['editor'],_0x157ced=new AIQuickActionsCommand(this['editor']);if(_0x2b1a93['commands']['add']('aiQuickAction',_0x157ced),_0x2b1a93['plugins']['has']('AIChat')){const _0xbedfce=this['editor']['plugins']['get']('AIChatController');_0x2b1a93['model']['document']['selection']['on']('change:range',(_0x112ae8,_0x4b568c)=>{_0x4b568c['directChange']&&_0xbedfce['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['appendContent'](_0x50dd79,_0x514a7d='text'){'modification'===this['type']&&'text'===_0x514a7d&&(_0x514a7d=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x50dd79,_0x514a7d);}['updateChangeGroups'](_0x3cf776){const _0x5d6f5c=this['parsedContent']['get'](_0x3cf776)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x3cf776,_0x5d6f5c),this['changeGroups']=[],0x0==_0x5d6f5c['childNodes']['length'])return;ns(this['documentContextContent']['get'](_0x3cf776),this['parsedMergedContent']['get'](_0x3cf776));const _0x3f352f=this['documentContextContent']['get'](_0x3cf776)['children']['map'](_0x45f188=>({'node':_0x45f188,'id':Xi(_0x45f188,'data-id')})),_0x502866=_0x5d6f5c['children']['map'](_0x3c6930=>({'node':_0x3c6930,'id':Xi(_0x3c6930,'data-id')||at()})),_0x5eb9a7=_0x511901(_0x3f352f,_0x502866,{'comparator':(_0x20e6b1,_0xc663a2)=>_0x20e6b1['id']==_0xc663a2['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x5eb9a7['length']&&_0x5eb9a7[_0x5eb9a7['length']-0x1]['removed'];)_0x5eb9a7['pop']();}const _0x5b9433=_0x5eb9a7['map'](_0x384463=>{const _0xb63810=_0x384463['added']?'new':_0x384463['removed']?'removed':'modified';return{'node':_0x384463['value'][0x0]['node'],'type':_0xb63810,'id':_0x384463['value'][0x0]['id']};}),_0x3ca143=this['_documentIdToSource']['get'](_0x3cf776);this['changeGroups']['push']({'changes':_0x5b9433,'state':'pending','index':this['changeGroups']['length'],'editor':_0x3ca143['editor'],'rootName':_0x3ca143['rootName'],'documentId':_0x3cf776});}['_getDifferentChangeGroups'](_0x58c36b,_0x1e73cc){return _0x1e73cc;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x4c1bc4){super(_0x4c1bc4),this['content']=_0x4c1bc4['content'],this['version']=_0x4c1bc4['version'],this['editor']=_0x4c1bc4['editor'],this['rootName']=_0x4c1bc4['rootName'],this['actionName']=_0x4c1bc4['actionName'],this['args']=_0x4c1bc4['args'],this['userMessage']=_0x4c1bc4['userMessage'],this['model']=_0x4c1bc4['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'](_0x219fad){const _0x3c08bf=this['editor']['config']['get']('collaboration.channelId'),_0x9addd7=new AIActionsReply({..._0x219fad,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x3c08bf,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x3c08bf,this['editor']]])});return this['replies']['push'](_0x9addd7),_0x9addd7['delegate'](..._s)['to'](this),this['fire']('replyCreated',_0x9addd7),_0x9addd7;}}class AIActionsBalloonToolbarView extends kt{constructor(_0x59baa2,_0x1959ac=!0x0,_0x4f7cba=!0x0){super(_0x59baa2),this['set']('isEnabled',!0x1),_0x1959ac&&(this['applyButton']=this['_createButton'](Mi(_0x59baa2,'AI_BALLOON_APPLY_BUTTON'),Ui),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x4f7cba&&(this['suggestButton']=this['_createButton'](Mi(_0x59baa2,'AI_BALLOON_SUGGEST_BUTTON'),_0x1959ac?Bi:Ui),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x1959ac,'showSuggestButton':_0x4f7cba}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x5c3fa8,showSuggestButton:_0xaeca45}){this['applyButton']&&(this['applyButton']['isVisible']=_0x5c3fa8),this['suggestButton']&&(this['suggestButton']['isVisible']=_0xaeca45);}['_createButton'](_0x5ce14f,_0x37c1af){const _0x464200=new yt(this['locale']);return _0x464200['set']({'label':_0x5ce14f,'class':_0x37c1af,'isVisible':!0x0,'withText':!0x0}),_0x464200;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0x1598fb){super(_0x1598fb),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(_0x1598fb,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0x3b23b8){super(_0x3b23b8),this['set']('isVisible',!0x0);const _0x2ece41=new AISpinnerView('small');_0x2ece41['isVisible']=!0x0;const _0x4762fd=new Nt(this['locale']);_0x4762fd['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',_0x1d87e8=>!_0x1d87e8)]},'children':[_0x2ece41,_0x4762fd]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x30be2e,_0xcf4d15){super(_0x30be2e),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0xcf4d15,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 _0x3d0d1a(),this['_addContentWrapper'](_0xcf4d15),this['_addDisclaimerView'](),this['_addToolbar'](_0xcf4d15),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'](_0xcf4d15);});}['render'](){super['render']();for(const _0x1fa310 of this['_focusables'])this['_focusTracker']['add'](_0x1fa310['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0x15575a){-0x1===_0x15575a?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x4ef1ce){this['_isLoading']=_0x4ef1ce;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0xe5bc2c){super['showError'](_0xe5bc2c),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x49b34f){super['showBlockingError'](_0x49b34f),this['setErrorState']();}['addMiniToolbarItem'](_0x587d6d){this['_miniToolbarView']['items']['has'](_0x587d6d)||this['_miniToolbarView']['items']['add'](_0x587d6d);}['removeMiniToolbarItem'](_0x3076ea){this['_miniToolbarView']['items']['has'](_0x3076ea)&&this['_miniToolbarView']['items']['remove'](_0x3076ea);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x5a3f46,showSuggestButton:_0x49a9ec}){_0x5a3f46=_0x5a3f46&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x49a9ec=_0x49a9ec&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x5a3f46,'showSuggestButton':_0x49a9ec});}async['updateContent'](_0x4e41b3){await this['_streamableContentView']['update'](_0x4e41b3);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x191a4d){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'](_0x191a4d['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x5c8569,showSuggestButton:_0x448481}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x5c8569,_0x448481),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',(_0xc110b,_0x445939,_0x3d2bed)=>!(_0xc110b||_0x445939||_0x3d2bed)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x5c8569,'showSuggestButton':_0x448481}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x2f8e08){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0x2f8e08),this['_miniToolbarView']['delegate'](...bs)['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',(_0x456b4f,_0x570152)=>!(_0x456b4f||_0x570152)),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 _0x271b4e=new yt(this['locale']),_0x1cbff5=new yt(this['locale']),_0x73c2cd=new AIActionsBalloonNavigationCounterView(this['locale']),_0x14606d=new yt(this['locale']);_0x271b4e['set']({'icon':et,'label':Mi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Gi}),_0x1cbff5['set']({'icon':_0x342eda,'tooltip':Mi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Gi}),_0x14606d['set']({'icon':it,'tooltip':Mi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Gi}),_0x271b4e['bind']('isEnabled')['to'](this,'isBusy',_0x2f9d82=>!_0x2f9d82),_0x271b4e['on']('execute',()=>{this['fire']('tryAgain');}),_0x1cbff5['bind']('isEnabled')['to'](this,'isBusy',_0x149571=>!_0x149571),_0x1cbff5['on']('execute',()=>{this['fire']('showPrevious');}),_0x14606d['bind']('isEnabled')['to'](this,'isBusy',_0x133de=>!_0x133de),_0x14606d['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x1cbff5,this['_navigationCounter']=_0x73c2cd,this['_navigationNextButton']=_0x14606d,this['_navigationTryAgainButton']=_0x271b4e;}['updateMiniToolbarButtons'](_0x9e7ddc,_0x2edb11){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x2a3d48=_0x9e7ddc>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x2a3d48){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x55e042=_0x9e7ddc-_0x2edb11;this['_navigationCounter']['setInteractionCount'](_0x55e042+'/'+_0x9e7ddc),this['_navigationPreviousButton']['isEnabled']=_0x2edb11<_0x9e7ddc-0x1,this['_navigationNextButton']['isEnabled']=_0x2edb11>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'](_0x37a18a){this['_isLoading']=_0x37a18a;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x4c4cfc=this['_getScrollableElement']();_0x4c4cfc&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x4c4cfc));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x3ba32d){super(_0x3ba32d);const _0x5d3e1e=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x5d3e1e['to']('interactionCount')}]});}['setInteractionCount'](_0x2511c1){this['set']('interactionCount',_0x2511c1);}}class AIActions extends _0x3453ad{static get['requires'](){return[AIConnector,Gt,AIEditing,AIBalloon,_0x4ea419];}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(_0x485935){super(_0x485935),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'](_0x160feb,_0x23b1c3,_0x2a7e7a){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x3bf2d5,anchorData:_0x1d8e37,root:_0x4792be}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x160feb,_0x3bf2d5,_0x1d8e37,_0x4792be,_0x23b1c3,_0x2a7e7a);}}const {modelFragment:_0x7af446,anchorData:_0x3eccc4,root:_0x198656}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x160feb,_0x7af446,_0x3eccc4,_0x198656,_0x23b1c3,_0x2a7e7a);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0xf7f0c0=this['editor']['plugins']['has']('TrackChanges');let _0x1ce075=this['editor']['config']['get']('ai.availableReplyActions')||[...Ps];_0xf7f0c0||(_0x1ce075=_0x1ce075['filter'](_0x2625d3=>'insertSuggestion'!=_0x2625d3));const _0x3f9b94=this['editor']['commands']['get']('trackChanges'),_0xf6a92e=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0xf7f0c0,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x1ce075});return _0xf6a92e['bind']('isBusy')['to'](this),_0x3f9b94&&_0xf6a92e['bind']('isTrackChangesOn')['to'](_0x3f9b94,'value'),_0xf6a92e['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0xf6a92e['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0xf6a92e['on']('showNext',()=>{this['_navigateToNext']();}),_0xf6a92e;}['_normalizeSelectionStart'](){const _0x413407=this['editor']['model'],_0x3566cd=_0x413407['document']['selection'],_0x166b4b=_0x3566cd['getFirstRange']();if(!_0x166b4b||_0x166b4b['isCollapsed'])return;const _0x43d0cf=gt(_0x3566cd['getSelectedBlocks']());if(!_0x43d0cf)return;const _0x50c5e6=_0x413407['createPositionAt'](_0x43d0cf,0x0);_0x50c5e6['isAfter'](_0x166b4b['start'])&&_0x413407['change'](_0x420c9e=>{_0x420c9e['setSelection'](_0x420c9e['createRange'](_0x50c5e6,_0x166b4b['end']));});}['_getExecuteDataRegular'](){const _0xacc0f9=this['editor']['model']['document']['selection'],_0x42e103=_0xacc0f9['getFirstRange']()['start']['root'];if(_0xacc0f9['isCollapsed']){const _0x1d3c50=gt(_0xacc0f9['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0xacc0f9);this['editor']['model']['change'](_0x465dab=>{_0x465dab['setSelection'](_0x1d3c50,'in');});}this['_normalizeSelectionStart']();const _0x25dc81=_0xacc0f9['getFirstRange'](),_0x3afe8e=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0xacc0f9),_0x25dc81['start'],_0x25dc81['end']);this['_copyMarkersToFragment'](_0x3afe8e,_0xacc0f9,{'isTableSelection':!0x1});const _0x504b59=_0xacc0f9['getFirstRange']()['start'],_0xc93095=new Map();let _0x37f571=_0x3afe8e;for(let _0xa8f782=0x0;_0xa8f782<_0x504b59['path']['length'];_0xa8f782++)_0xc93095['set'](_0x37f571,_0x504b59['path'][_0xa8f782]),_0x37f571=_0x37f571['getChild'](0x0);return{'modelFragment':_0x3afe8e,'anchorData':_0xc93095,'root':_0x42e103};}['_getExecuteDataInTable'](){const _0x2a6e02=this['editor']['model']['document']['selection'],_0x15779e=this['editor']['plugins']['get']('TableSelection'),_0x3495b8=_0x2a6e02['getFirstRange']()['start']['root'],_0x59ed24=_0x15779e['getSelectionAsFragment'](),_0x5f1464=_0x2a6e02['getFirstRange']()['start']['parent']['parent'],_0x49eb60=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x5f1464),this['editor']['model']['createPositionAfter'](_0x5f1464)),_0x2e7cb6=this['_wrapWithCommonAncestors'](_0x59ed24,_0x49eb60['start'],_0x49eb60['end']);this['_copyMarkersToFragment'](_0x2e7cb6,_0x2a6e02,{'isTableSelection':!0x0});const _0x56693a=_0x2a6e02['getFirstRange']()['start'],_0x40a4ea=new Map();let _0x13b79a=_0x2e7cb6;for(let _0x2f6f3d=0x0;_0x2f6f3d<_0x56693a['path']['length'];_0x2f6f3d++)if(_0x40a4ea['set'](_0x13b79a,_0x56693a['path'][_0x2f6f3d]),_0x2f6f3d<_0x56693a['path']['length']-0x1)_0x13b79a=_0x13b79a['getChild'](0x0);else{let _0x339c1d=_0x13b79a['nextSibling'];for(;_0x339c1d;)_0x40a4ea['set'](_0x339c1d,_0x56693a['path'][_0x2f6f3d]),_0x339c1d=_0x339c1d['nextSibling'];}return{'modelFragment':_0x2e7cb6,'anchorData':_0x40a4ea,'root':_0x3495b8};}async['_executeAction'](_0x47ebe9,_0x8cc545,_0x453d1f,_0x3730ac,_0x10aaab,_0x59e36b){const _0x2d8773=this['editor']['plugins']['get'](AIEditing),_0x1fad82=this['editor']['plugins']['get'](AIBalloon),_0x584f1c=this['editor']['model']['document']['selection'],_0x1abcd9=await _0x2d8773['modelToDataWithIds'](_0x8cc545,this['editor']),_0x1b2763=this['editor']['model']['document']['version'],_0x55c738=[..._0x584f1c['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x1fad82['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x10aaab,'icon':_0x59e36b||_0x3bef17,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x55c738,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x1fad82),this['_interactionParams']={'action':_0x47ebe9,'content':_0x1abcd9,'version':_0x1b2763,'aiBalloon':_0x1fad82,'modelFragment':_0x8cc545,'anchorData':_0x453d1f,'root':_0x3730ac},this['_setupApplyListeners'](),this['listenTo'](_0x1fad82,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x1fad82,'dialogClosed',(_0x2877b4,{id:_0x46eeb3})=>{if('aiActionsBalloon'===_0x46eeb3){for(const _0x356b4b of this['_interactions']){if(0x0===_0x356b4b['replies']['length']||_0x356b4b['stoppedExplicitly'])continue;const _0x47fe4a=_0x356b4b['replies'][_0x356b4b['replies']['length']-0x1],_0x42b2e1=_0x47fe4a['changeGroups'][0x0];_0x42b2e1&&'pending'===_0x42b2e1['state']&&_0x47fe4a['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x1fad82);}}),this['_createInteraction'](_0x1abcd9,_0x1b2763,_0x1fad82,_0x47ebe9);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x6ef905,anchorData:_0x226dab,root:_0x59751a}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x6ef905,_0x226dab,_0x59751a,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x6ef905,_0x226dab,_0x59751a,!0x0);});}['_wrapWithCommonAncestors'](_0x27bce7,_0x5b5263,_0x4693a9){const _0x37330c=this['editor']['model']['createRange'](_0x5b5263,_0x4693a9)['getCommonAncestor'](),_0x292162=_0x37330c['is']('documentFragment')?[]:_0x37330c['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x292162['length']){const _0x21e1be=_0x292162['map'](_0x52f460=>_0x52f460['_clone'](!0x1));for(let _0x53425b=0x1;_0x53425b<_0x21e1be['length'];_0x53425b++)_0x21e1be[_0x53425b-0x1]['_appendChild'](_0x21e1be[_0x53425b]);return _0x21e1be[_0x21e1be['length']-0x1]['_appendChild'](_0x27bce7),new _0x3d8d81(_0x21e1be[0x0]);}return _0x27bce7;}['_copyMarkersToFragment'](_0x3753bb,_0x3610c3,_0x35e86e={'isTableSelection':!0x1}){const _0x33ab02=this['editor']['model'],_0x2df1b2=Array['from'](_0x3610c3['getRanges']()),_0x558a36=_0x3610c3['getFirstRange']()['start'];for(const _0x3b1cb7 of _0x33ab02['markers']){if(_0x3b1cb7['name']['startsWith'](fs)||!_0x3b1cb7['affectsData'])continue;const _0x359e09=_0x3b1cb7['getRange']();if(!_0x2df1b2['some'](_0x4ccd3d=>_0x4ccd3d['containsRange'](_0x359e09,!0x0)))continue;const _0x18f092=this['_regularCalculateMarkerPath'](_0x359e09['start'],_0x558a36,_0x35e86e['isTableSelection']),_0x2b4460=this['_regularCalculateMarkerPath'](_0x359e09['end'],_0x558a36,_0x35e86e['isTableSelection']),_0x28e2a7=_0x33ab02['createPositionFromPath'](_0x3753bb,_0x18f092),_0x5b2ead=_0x33ab02['createPositionFromPath'](_0x3753bb,_0x2b4460);if(!_0x28e2a7['isEqual'](_0x5b2ead)){const _0x57259e=_0x33ab02['createRange'](_0x28e2a7,_0x5b2ead);_0x3753bb['markers']['set'](_0x3b1cb7['name'],_0x57259e);}}}['_regularCalculateMarkerPath'](_0xa527da,_0x39c9f5,_0x4dbd0f=!0x1){const _0xbfe0ff=[..._0xa527da['path']['slice']()];for(let _0x435ba9=0x0;_0x435ba9<Math['max'](_0x39c9f5['path']['length'],_0xa527da['path']['length']);_0x435ba9++){const _0x322180=_0x39c9f5['path'][_0x435ba9]||0x0,_0xdc6f7d=(_0xa527da['path'][_0x435ba9]||0x0)-_0x322180;if(_0xbfe0ff[_0x435ba9]=_0xdc6f7d,0x0!==_0xdc6f7d&&!_0x4dbd0f)break;}return _0xbfe0ff;}async['_createInteraction'](_0x5716d2,_0x354198,_0x5cd4c4,_0x3d2a4a){const _0x1ecdf2=this['editor'],_0x192688=_0x1ecdf2['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x3d2a4a,'content':_0x5716d2,'version':_0x354198,'aiBalloon':_0x5cd4c4,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x192688});const _0x262c57=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0x1ecdf2['locale'],'content':_0x5716d2,'version':_0x354198,'editor':_0x1ecdf2,'rootName':_0x192688['rootName'],..._0x3d2a4a});this['_interactions']['push'](_0x262c57);const _0x247112=(_0x4b7cec,_0x18db9c=!0x1,_0x1d5ae4='streaming')=>this['_promiseQueue']['enqueue'](async _0x43fc74=>{try{const _0x476e85=rs({'changeGroups':_0x4b7cec['changeGroups'],'documentContextContent':_0x4b7cec['documentContextContent'],'showDiff':_0x18db9c,'trimUnchanged':!0x1});_0x476e85['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x476e85[0x0],'renderingStrategy':_0x1d5ae4,'abortSignal':_0x43fc74});}catch(_0x3a0da6){if(this['_isAbortError'](_0x3a0da6))return;throw _0x3a0da6;}});_0x262c57['on']('replyCreated',(_0x283124,_0x97679b)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x247112(_0x97679b)['catch'](_0x56e213=>{this['_isAbortError'](_0x56e213)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x56e213),this['_setErrorState'](_0x262c57));});}),_0x262c57['on']('replyContentUpdated',(_0x343cf0,_0x51cf02)=>{_0x247112(_0x51cf02)['catch'](_0x81a7f5=>{this['_isAbortError'](_0x81a7f5)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x81a7f5),this['_setErrorState'](_0x262c57));});}),_0x262c57['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x484412){this['_isAbortError'](_0x484412)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x484412),this['_setErrorState'](_0x262c57));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x30e82a,{showDiff:_0x49115b})=>{try{this['_balloonShowDiff']=_0x49115b;const _0x29c40=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x29c40&&await _0x247112(_0x29c40,_0x49115b,'static');}catch(_0x3d4d49){this['_isAbortError'](_0x3d4d49)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x3d4d49),this['_setErrorState'](_0x262c57));}}),_0x262c57['on']('replyChangeGroupStateUpdated',()=>{const _0xc94c91={'positiveCount':_0x262c57['replies']['reduce']((_0x5a062d,_0x1c6c25)=>_0x5a062d+_0x1c6c25['changeGroups']['filter'](_0x4cba8f=>'accepted'===_0x4cba8f['state'])['length'],0x0),'totalCount':_0x262c57['replies']['reduce']((_0x4ebf50,_0x32aa7c)=>_0x4ebf50+_0x32aa7c['changeGroups']['length'],0x0)},_0x966fa1=_0x262c57['actionCallId'],_0x54215b=_0x262c57['actionName'];_0x54215b?this['_aiConnector']['upsertAIActionRating'](_0x54215b,_0x966fa1,_0xc94c91):this['_aiConnector']['upsertCustomAIActionRating'](_0x966fa1,_0xc94c91);}),this['_setLoadingState']();try{const _0x2ebcc3=await _0x262c57['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x2ebcc3;}catch(_0x57d9b3){if(this['_isAbortError'](_0x57d9b3))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x262c57);}}['_applyChanges'](_0x3e7588,_0x1fc4de,_0x6550fb,_0x44a457){const _0x1fec40=this['editor'];if(_0x44a457&&!_0x1fec40['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x7fe313=this['editor']['plugins']['get'](_0x4ea419),_0x4f6a7b=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x4f6a7b||!_0x4f6a7b['replies']['length'])return;const _0x140cc6=_0x4f6a7b['replies'][_0x4f6a7b['replies']['length']-0x1],_0x39c865=_0x140cc6['changeGroups'];_0x140cc6['setChangeGroupState'](0x0,'accepted');let _0x237998=ps({'reply':_0x140cc6,'interaction':_0x4f6a7b,'groups':_0x39c865,'transform':!0x1,'documentCompare':_0x7fe313,'documentCompareOptions':{'anchor':_0x1fec40['model']['createPositionAt'](_0x3e7588,0x0),'markDeletions':_0x44a457}});_0x237998=this['_filterOperationsOutsideRange'](_0x237998,_0x1fc4de);for(const _0x199c4e of _0x237998)this['_anchorOperation'](_0x1fc4de,_0x199c4e,_0x6550fb);const _0xb51c70=_0x4f6a7b['getDocumentContext']()['documents'][0x0]['version'],_0x553334=_0x1fec40['model']['document']['history']['getOperations'](_0xb51c70),_0x3e72ad={'document':_0x1fec40['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x3ac52b=_0x1dcb0f(_0x237998,_0x553334,_0x3e72ad)['operationsA'];_0x1fec40['model']['change'](_0x1c0fc6=>{if(_0x1c0fc6['setSelection'](_0x1fec40['model']['document']['selection']['focus']),_0x44a457)_0x1fec40['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x3ac52b);else{for(const _0x137648 of _0x3ac52b)_0x137648['baseVersion']=_0x1fec40['model']['document']['version'],Es(_0x1fec40,_0x137648),_0x1c0fc6['batch']['addOperation'](_0x137648),_0x1fec40['model']['applyOperation'](_0x137648);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x9f6253,_0x12f00d){return _0x9f6253['filter'](_0x3fd603=>{if('rename'==_0x3fd603['type']){const _0x15dd4d=_0x3fd603['position']['nodeAfter'];return!_0x12f00d['has'](_0x15dd4d);}if(_0x3fd603['type']['indexOf']('Attribute')>-0x1){const _0x35d24e=_0x3fd603['range']['start']['nodeAfter'];return!_0x12f00d['has'](_0x35d24e);}return!0x0;});}['_anchorOperation'](_0x16217f,_0x32447e,_0x5c202e){const _0x139a91=_0x32447e['clone']();for(const _0x5d178a in _0x32447e){const _0x4ba8c4=_0x32447e[_0x5d178a];_0x4ba8c4 instanceof _0x5c7233?_0x32447e[_0x5d178a]=new _0x5c7233(_0x4b5268(_0x4ba8c4['start']),_0x4b5268(_0x4ba8c4['end'])):_0x4ba8c4 instanceof _0x5399e8&&(_0x32447e[_0x5d178a]=_0x4b5268(_0x4ba8c4));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x139a91['type'])){if(_0x139a91['isDocumentOperation']=!0x1,_0x139a91['baseVersion']=null,'remove'==_0x139a91['type']){const _0x153c69=_0x139a91['sourcePosition'],_0x2283d9=_0x139a91['howMany'];new _0x62ec40(_0x153c69,_0x2283d9)['_execute']();}else _0x139a91['_execute']();}function _0x4b5268(_0x61dbff){if('$graveyard'==_0x61dbff['root']['rootName'])return _0x61dbff;const _0x11604a=[];let _0x56a35e=_0x61dbff['root'];for(let _0x3db640=0x0;_0x3db640<_0x61dbff['path']['length'];_0x3db640++){const _0x227489=_0x16217f['get'](_0x56a35e)||0x0;_0x11604a[_0x3db640]=_0x61dbff['path'][_0x3db640]+_0x227489,_0x56a35e=_0x56a35e['getChildAtOffset'](_0x61dbff['path'][_0x3db640]);}return new _0x5399e8(_0x5c202e,_0x11604a,_0x61dbff['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x161ef0,content:_0x3302c1,version:_0x2a47e,aiBalloon:_0x397665}=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'](_0x3302c1,_0x2a47e,_0x397665,_0x161ef0)['catch'](_0x4a25ab=>{this['_isAbortError'](_0x4a25ab)||console['error']('Error\x20refreshing\x20interaction:',_0x4a25ab);});}['_isAbortError'](_0x1da417){return!!_0x1da417['message']&&_0x1da417['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 _0x173289=this['_interactions']['length'];this['_currentInteractionIndex']<_0x173289-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x1084cd){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x1084cd;const _0x4714ed=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x4714ed)return;if(_0x4714ed['hasError'])return this['_setErrorState'](_0x4714ed),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x4714ed['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x306d99=_0x4714ed['replies'][_0x4714ed['replies']['length']-0x1];if(_0x306d99)try{const _0x2c4064=rs({'changeGroups':_0x306d99['changeGroups'],'documentContextContent':_0x306d99['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x19b33b=>setTimeout(_0x19b33b,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x2c4064[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x2a4f7c){this['_isAbortError'](_0x2a4f7c)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x2a4f7c);}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x59ebf4){const _0x2fe6e5=Mi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x2fe6e5),_0x59ebf4['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 _0x3453ad{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2e3d6a){super(_0x2e3d6a),_0x2e3d6a['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x4ecd08,_0xe0ddef){super(_0x4ecd08),this['id']=_0xe0ddef,this['set']('status','pending'),this['set']('changeId',_0xe0ddef),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',(_0x27ff43,_0x19f8a1)=>{_0x19f8a1&&_0x19f8a1['target']&&'A'===_0x19f8a1['target']['tagName']&&_0x19f8a1['preventDefault'](),this['fire']('activateChange',{'id':_0xe0ddef,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0xe0ddef,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0xe0ddef,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x2a7a5d=new Nt(this['locale']);return _0x2a7a5d['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',_0x47d688=>!_0x47d688)]}}),_0x2a7a5d;}['_createAcceptButtonView'](){const _0x488dda=new yt(this['locale']);return _0x488dda['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x488dda['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x45ae34=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x45ae34['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x3928af=>'pending'!==_0x3928af&&'accepted'!==_0x3928af),this['bindTemplate']['if']('status',Bi,_0x26f192=>'pending'===_0x26f192),this['bindTemplate']['if']('status',Gi,_0x36c354=>'pending'!==_0x36c354),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x43b0d9=>'accepted'===_0x43b0d9)]}}),this['on']('change:status',(_0x4d0fa0,_0x25958c,_0xf0831)=>{_0x488dda['isEnabled']='pending'===_0xf0831,'accepted'===_0xf0831&&(_0x488dda['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x488dda['icon']=_0x5d25a9);}),_0x488dda;}['_createDismissButtonView'](){const _0xb2d434=new yt(this['locale']);return _0xb2d434['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0xb2d434['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x26e39a=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x26e39a['stopPropagation']();})},'attributes':{'class':[Gi,this['bindTemplate']['if']('status','ck-hidden',_0x1e6f45=>'pending'!==_0x1e6f45&&'rejected'!==_0x1e6f45),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x465c93=>'pending'===_0x465c93),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x41704c=>'rejected'===_0x41704c)]}}),this['on']('change:status',(_0x54d0f0,_0x28e3e5,_0x145f71)=>{_0xb2d434['isEnabled']='pending'===_0x145f71,'rejected'===_0x145f71&&(_0xb2d434['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0xb2d434['icon']=_0x17f7a6);}),_0xb2d434;}['_createInfoButtonView'](){const _0x1ca5b2=new yt(this['locale']);return _0x1ca5b2['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x26a454,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Gi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x1ca5b2['bind']('isOn')['to'](this,'isInfoToggleOn',_0x4273fe=>_0x4273fe),_0x1ca5b2['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x1ca5b2;}['_createOutdatedButtonView'](){const _0x25fa3b=new yt(this['locale']);return _0x25fa3b['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':st,'withText':!0x0,'isEnabled':!0x1}),_0x25fa3b['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x57a791=>'outdated'!==_0x57a791)],'disabled':'disabled'}}),_0x25fa3b;}}class AIReviewCoreBalloonSuggestionItemView extends zt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x5c4a2f,_0x2e7c74){super(_0x5c4a2f),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']()),_0x2e7c74['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x3eecd1){this['resultItemView']['changeId']=_0x3eecd1['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x3eecd1['contentDiffed'];}['showBalloon'](_0x288b33,_0x385f99,_0x52443f,_0x3c0864,_0x19ca23,_0x5d4232){const _0x214176=_0x385f99();if(!_0x214176)return;this['updateContent'](_0x288b33),this['show']();const _0x154bc3=Array['from'](_0x214176['getClientRects']())['reverse'](),_0x98d424=this['_getPointedRectIndexFromEvent'](_0x52443f,_0x154bc3),_0x466b17=_0x154bc3[_0x98d424??0x0];'click'===_0x3c0864?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x385f99(),_0x98d424,_0x288b33['id'],_0x19ca23,_0x5d4232)||_0x466b17})):'hover'===_0x3c0864&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x385f99(),_0x98d424,_0x288b33['id'])||_0x466b17}));}['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 _0x7531c6=[this['element']];return this['_pinnedTargetElement']&&_0x7531c6['push'](this['_pinnedTargetElement']),_0x7531c6;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x3a8298=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x3a8298['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']]}]}),_0x3a8298;}['_getBestRectPositionOnClick'](_0x4893d1,_0x3f0646,_0xba5aba,_0x3785ee,_0x4a92e1){if(!_0x4893d1)return null;const _0x49f384=this['position']['replace']('arrow_',''),_0x35a5f0=Array['from'](_0x4893d1['getClientRects']());let _0x1185bc,_0x59c129=_0x35a5f0['reverse']();return void 0x0!==_0x3f0646&&this['_isPinnedRectVisible'](_0x59c129[_0x3f0646],_0x3785ee,_0x4a92e1)?(_0x1185bc=_0x59c129[_0x3f0646],this['_pinnedRectIndex']=_0x3f0646):this['_isPinnedRectVisible'](_0x59c129[0x0],_0x3785ee,_0x4a92e1)&&void 0x0===_0x3f0646?_0x1185bc=_0x59c129[0x0]:(_0x59c129='s'==_0x49f384[0x0]?[..._0x35a5f0]['reverse']():_0x35a5f0,_0x59c129['forEach'](_0x56f8a6=>{this['_isPinnedRectVisible'](_0x56f8a6,_0x3785ee,_0x4a92e1)&&(_0x1185bc=_0x56f8a6);})),this['_pinnedTargetChangeId']=_0xba5aba,this['_pinnedTargetElement']=_0x4893d1,_0x1185bc||_0x4893d1['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x14517c,_0x465cb4,_0x303a7e){if(!_0x14517c)return null;const _0x2366ce=Array['from'](_0x14517c['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x465cb4&&this['_pinnedTargetChangeId']!==_0x303a7e)return this['_pinnedRectIndex']=_0x465cb4,this['_pinnedTargetElement']=_0x14517c,this['_pinnedTargetChangeId']=_0x303a7e,_0x2366ce[_0x465cb4];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x303a7e){if(_0x14517c!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x2366ce[this['_pinnedRectIndex']];}return void 0x0!==_0x465cb4&&this['_pinnedTargetChangeId']!==_0x303a7e?(this['_pinnedRectIndex']=_0x465cb4,this['_pinnedTargetElement']=_0x14517c,this['_pinnedTargetChangeId']=_0x303a7e,_0x2366ce[_0x465cb4]):_0x14517c['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x41febf,_0x4a2d16){if(_0x41febf)for(let _0x18b905=0x0;_0x18b905<_0x4a2d16['length'];_0x18b905++){const _0x700abb=_0x4a2d16[_0x18b905];if(_0x41febf['clientX']>=_0x700abb['left']-0x3&&_0x41febf['clientX']<=_0x700abb['right']+0x3&&_0x41febf['clientY']>=_0x700abb['top']-0x3&&_0x41febf['clientY']<=_0x700abb['bottom']+0x3)return _0x18b905;}}['_isPinnedRectVisible'](_0x4f9281,_0x57b1fb,_0x18a1ae){const _0x548a47=new dt(_0x4f9281),_0x11bf84=_0x57b1fb||document['documentElement'],_0x3978d3=_0x548a47['getIntersection'](Ot(_0x18a1ae)),_0x343342=new dt(_0x11bf84)['getIntersection'](_0x548a47);return!!(_0x3978d3&&_0x343342&&_0x548a47['width']>0x0);}}const Jn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0x4338bf{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x41a456){super(_0x41a456),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Jn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x5ab0aa=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x5ab0aa);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x50b196){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0xd2f9f=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x50b196,_0xd2f9f);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x12600d){_0x12600d&&('error-general'!==_0x12600d['status']?'error-chunk'!==_0x12600d['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x4984ed){this['_mainView']['addCheckRunResult'](_0x4984ed);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x5bd0e0){this['_mainView']['showGeneralReviewCoreErrorView'](_0x5bd0e0??Mi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x406df5,_0x790c8b){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x406df5,_0x790c8b);}['setActiveStateInResults'](_0x22268a){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x21fa51=>{_0x21fa51['id']===_0x22268a&&_0x21fa51['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x1cd8cf=>_0x1cd8cf['setItemAsInactive']());}['updateChangeState'](_0x820bfd,_0x4937da){'accepted'===_0x4937da||'rejected'===_0x4937da||'outdated'===_0x4937da?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x820bfd,_0x4937da):this['_mainView']['reviewCheckResultsView']['showResult'](_0x820bfd,_0x4937da);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x4f56dd,_0x846779,_0x4e0221,_0x41ad3c,_0x5f0752,_0x5454b1){this['_balloonSuggestionView']['showBalloon'](_0x4f56dd,_0x846779,_0x4e0221,_0x41ad3c,_0x5f0752,_0x5454b1);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x576fb7){const _0x2d6f76=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x34b913=>_0x34b913['id']===_0x576fb7);return _0x2d6f76?_0x2d6f76['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x3784bb){super(_0x3784bb),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x28293b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x28293b['if']('isVisible','ck-hidden',_0x993aaf=>!_0x993aaf)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x28293b['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x12e8bb,_0x5f4540){super(_0x12e8bb),this['reviewCoreHeader']=_0x5f4540['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x12e8bb),this['reviewCheckListView']=_0x5f4540['list'],this['reviewCheckListView']['delegate'](...Jn)['to'](this),this['reviewCheckResultsView']=_0x5f4540['results'],this['reviewCheckResultsView']['delegate'](...Jn)['to'](this),this['reviewCompletedView']=_0x5f4540['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'](_0x4117e9){this['reviewCheckResultsView']['addResult'](_0x4117e9),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'](_0x7b09d6){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x7b09d6;}['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(_0x158e2e,_0x3dba6a){super(_0x3dba6a),this['set']({'label':_0x158e2e,'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(_0xd0bda2,_0x153a88){super(_0xd0bda2),this['_contents']=_0x153a88,this['_resultViews']=new _0x3d0d1a(),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(_0xd0bda2),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 _0x4d1731=this['_createCombinedSkeletonLoader'](),_0x30a431=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x30a431['if']('isLoading','ck-ai_review__check-run_loading',_0x5ae1d8=>_0x5ae1d8),_0x30a431['if']('isResultReady','ck-ai_review__check-run_ready',_0x276850=>_0x276850),_0x30a431['if']('isVisible','ck-hidden',_0xd345a9=>!_0xd345a9)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x4d1731,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x48ae50){const _0x5521f5=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0x48ae50['id']);_0x5521f5['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x5521f5),_0x5521f5['resultResponseView']['element']['innerHTML']=_0x48ae50['contentDiffed'];}['hideResult'](_0x28f540,_0x4e3f1a){if('pending'===_0x4e3f1a)return;const _0x26070d=this['_resultViews']['find'](_0x4874c1=>_0x4874c1['id']===_0x28f540);_0x26070d&&(_0x26070d['status']=_0x4e3f1a,_0x26070d['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x45d0b1,_0xd9f2c1){if('pending'!==_0xd9f2c1)return;const _0x1089f4=this['_resultViews']['find'](_0x45d4f0=>_0x45d4f0['id']===_0x45d0b1);_0x1089f4&&(_0x1089f4['status']=_0xd9f2c1,_0x1089f4['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x32f8fd,_0x542ce8){this['headerTitle']=_0x32f8fd,this['headerSubtitle']=_0x542ce8||'';}['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'],xs['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x492e6a=new Nt(this['locale']),_0x3c9118=[];for(let _0x399221=0x0;_0x399221<0x10;_0x399221++){const _0x497d88=this['_createSkeletonLoader']();_0x497d88['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x3c9118['push'](_0x497d88);}return _0x492e6a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x4ce064=>!_0x4ce064)]},'children':_0x3c9118}),_0x492e6a;}['_createResultsBodyView'](){const _0xffa081=new Nt(this['locale']);return _0xffa081['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x63a8d6=>_0x63a8d6)]},'children':this['_resultViews']}),_0xffa081;}['_createErrorView'](){const _0xc0e54d=new Nt(this['locale']),_0x24379e=new yt(this['locale']),t=this['locale']['t'];return _0xc0e54d['delegate']('retryReview')['to'](this),_0x24379e['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Bi+'\x20ck-ai_review__check-run-error-retry-button'}),_0x24379e['on']('execute',()=>{this['fire']('retryReview');}),_0xc0e54d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x482195=>!_0x482195),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x3e9810=>'chunk'===_0x3e9810)]},'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',_0x3b0189=>'chunk'===_0x3b0189)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x34676c=>'general'!==_0x34676c)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x358d63=>'chunk'!==_0x358d63)]},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x24379e]}),_0xc0e54d;}['_createCancelButtonView'](){const _0x14b50c=new yt(this['locale']);return _0x14b50c['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Bi+'\x20ck-ai-button-stop-generating'],'icon':_0x592ee4}),_0x14b50c['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x421285=>_0x421285),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x217dde=>_0x217dde)]}}),_0x14b50c['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x14b50c;}['_createToggleDiffButtonView'](){const _0xeb8848=new yt(this['locale']);_0xeb8848['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0xeb8848['bind']('isEnabled')['to'](this,'isError',_0x45e201=>!_0x45e201),_0xeb8848['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0xddd7c5=>!_0xddd7c5),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5778d2=>_0x5778d2)]}});const _0x18d2db=Mi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0xc9d5ad=Mi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0xeb8848['bind']('isOn')['to'](this,'isToggleDiffOn',_0x471a1c=>_0x471a1c),_0xeb8848['bind']('icon')['to'](this,'isToggleDiffOn',_0x142815=>_0x142815?nt:rt),_0xeb8848['bind']('label')['to'](this,'isToggleDiffOn',_0x3af9ec=>_0x3af9ec?_0x18d2db:_0xc9d5ad),_0xeb8848['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0xeb8848;}['_createAcceptAllButtonView'](){const _0x2b8b02=new yt(this['locale']);return _0x2b8b02['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x2b8b02['bind']('isEnabled')['to'](this,'isError',_0x37e2ba=>!_0x37e2ba),_0x2b8b02['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x44bdde=>!_0x44bdde),this['bindTemplate']['if']('isCompleted','ck-hidden',_0xcf8e5e=>_0xcf8e5e)]}}),_0x2b8b02['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x2b8b02;}['_createExitReviewButtonView'](){const _0x533865=new yt(this['locale']);return _0x533865['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x533865['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x3b19be=>!_0x3b19be),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2015c0=>_0x2015c0)]}}),_0x533865['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x533865;}['_createResultHeaderView'](){const _0x322631=new Nt(this['locale']),_0xe59ffa=this['_createTitleView']();return _0x322631['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x110a7b=>_0x110a7b)]},'children':[_0xe59ffa,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x322631;}['_createTitleView'](){const _0x3cfd87=new Nt(this['locale']),_0xe2c244=new AISpinnerView();return _0xe2c244['bind']('isVisible')['to'](this,'isResultReady',_0x201007=>!_0x201007),_0x3cfd87['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper']},'children':[_0xe2c244,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2fe6a2=>_0x2fe6a2)]},'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')}]}]},{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x146963=>!_0x146963)]},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]}]}),_0x3cfd87;}['_createFinishReviewButtonView'](){const _0x2296e6=new AIReviewCoreFinishReviewButtonView(Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x2296e6['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2fb6e5=>!_0x2fb6e5)]}}),_0x2296e6['delegate']('finishReview')['to'](this),_0x2296e6;}}class AIReviewCoreReviewCompletedView extends Ht{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x27ec77,_0x5a0363){super(_0x27ec77),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x5a0363['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x5a0363['headerText']);const _0x328b25=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x328b25['if']('isVisible','ck-hidden',_0x505660=>!_0x505660)]},'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':_0x5a0363['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x4095a0){const _0x48b39d=new AIReviewCoreFinishReviewButtonView(_0x4095a0,this['locale']);return _0x48b39d['delegate']('finishReview')['to'](this),_0x48b39d;}['_createResultHeaderView'](_0x2720e2){const _0x5da097=new Nt(this['locale']);return _0x5da097['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title']},'children':[{'text':_0x2720e2}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x5da097;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x3331a3,_0x23debc){super(_0x3331a3),this['_defaultValue']=_0x23debc['default']||(_0x23debc['data']['length']>0x0?_0x23debc['data'][0x0]['id']:''),this['_defaultLabel']=_0x23debc['data']['find'](_0x3e0140=>_0x3e0140['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Ft(this['locale']);const _0x2568ec=this['_prepareListOptions'](_0x23debc['data']);Jt(this['_dropdownView'],_0x2568ec,{'role':'menu','ariaLabel':_0x23debc['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1ad7b8=>{_0x1ad7b8['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x2961ac=>{this['formValue']=_0x2961ac['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x2961ac['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'](_0x475976=[]){const _0x32d4b5=new _t();this['resetToDefault']();for(const _0x2cdd0b of _0x475976){const _0x595a26=new Zt({'label':_0x2cdd0b['label'],'withText':!0x0,'role':'menuitemradio','id':_0x2cdd0b['id'],'model':_0x2cdd0b});_0x595a26['bind']('isOn')['to'](this,'formValue',_0x42e537=>_0x42e537===_0x595a26['id']);const _0xdfd82a={'type':'button','model':_0x595a26};_0x32d4b5['add'](_0xdfd82a);}return _0x32d4b5;}}class AIReviewCoreFormManagerView extends Ht{['_formItem']=null;constructor(_0x343e54,_0x2e5c2b,_0x170555){super(_0x343e54),this['argsKey']=_0x2e5c2b?.['argsKey'];if('dropdown'===_0x2e5c2b['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x2e5c2b);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x4635dc=new _0x3f1406(this['locale'],{'children':[this['_formItem']],'class':[_0x170555?'ck-form__row_with-submit':'']});_0x170555&&_0x4635dc['children']['add'](_0x170555),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x4635dc]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x3e0b00{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0xecae42){super(_0xecae42),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 _0x3d0d1a();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x2b2a62,_0xc61a27,_0x3e7c6d=!0x1){super(_0x2b2a62),this['_check']=_0xc61a27,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0xc61a27['defaultModel']?_0xc61a27['defaultModel']['id']:'',this['_defaultLabel']=_0xc61a27['defaultModel']?_0xc61a27['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new _0x110af7(this['locale'],()=>new AIReviewCorePromptInputView(_0x2b2a62)),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'](_0x3e7c6d),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 _0x3f1406(this['locale'],{'children':[this['promptInputView']]}),new _0x3f1406(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x7ded5,_0x490362)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x490362()):_0x490362();}),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'](_0x47fa6c=>{this['_focusables']['add'](_0x47fa6c),this['focusTracker']['add'](_0x47fa6c['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 _0x5da62d of this['_getFormValidators']()){const _0x376e1b=_0x5da62d();if(_0x376e1b)return this['promptInputView']['errorText']=_0x376e1b,!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 _0x2d7427=new yt(this['locale']),t=this['locale']['t'];return _0x2d7427['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x2d7427['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x2d7427;}['_createCancelButtonView'](){const _0x1d3317=new yt(this['locale']),t=this['locale']['t'];return _0x1d3317['set']({'label':t('Cancel'),'withText':!0x0,'class':Gi}),_0x1d3317['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x147649=>{_0x147649['stopPropagation']();})}}),_0x1d3317['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x1d3317;}['_setModelList'](_0x1af56a){this['_modelSelectionDropdownItems']['clear']();const _0x454a95=this['_check']['models'];if(_0x1af56a)this['set']('modelDisplayMode','hidden');else{const _0x2ab405=0x1===_0x454a95['length'];this['set']('modelDisplayMode',_0x2ab405?'name':'selector');}if(this['resetToDefault'](),_0x454a95?.['length']){0x1===_0x454a95['length']&&this['set']('activeModelName',_0x454a95[0x0]['name']||_0x454a95[0x0]['id']);for(const _0x12ad3a of _0x454a95){const _0x229f47=new Zt({'label':_0x12ad3a['name'],'withText':!0x0,'role':'menuitemradio','id':_0x12ad3a['id'],'model':_0x12ad3a});_0x229f47['bind']('isOn')['to'](this,'modelId',_0x179b9c=>_0x179b9c===_0x12ad3a['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x229f47,'labelView':new ModelButtonLabelView(this['locale'],_0x12ad3a)});}}}['_createModelSelectionDropdown'](){const _0x20786c=Ft(this['locale']);return _0x20786c['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x20786c['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Gi}),_0x20786c['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x57215c=>'selector'===_0x57215c),this['listenTo'](_0x20786c,'execute',_0x7f70a2=>{this['modelId']=_0x7f70a2['source']['model']['id'],_0x20786c['buttonView']['label']=_0x7f70a2['source']['label'];}),_0x20786c;}['_createModelNameView'](){const _0x411f16=new ModelNameView(this['locale']);return _0x411f16['bind']('text')['to'](this,'activeModelName',_0x38b354=>_0x38b354??''),_0x411f16['bind']('isVisible')['to'](this,'modelDisplayMode',_0x26a38f=>'name'===_0x26a38f),_0x411f16;}['_createActionsFooterView'](){const _0x879489=new Nt(this['locale']);return _0x879489['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']]}]}),_0x879489;}}class ModelNameView extends Nt{constructor(_0xf29a68){super(_0xf29a68),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x349ab6=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x349ab6['if']('isVisible','ck-hidden',_0x14c79d=>!_0x14c79d)]},'children':[{'text':_0x349ab6['to']('text')}]});}}class ModelButtonLabelView extends Mt{constructor(_0x254f51,_0x31b6ce){super();const _0x4ba62a=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x4ba62a['to']('style'),'id':_0x4ba62a['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x4ba62a['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x31b6ce['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Ht{['_formItemsCollection']=new _0x3d0d1a();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x1c4a3d,_0x1a31cd,_0x16d9af,_0x5218a5=!0x1){super(_0x1c4a3d),this['_hideModels']=_0x5218a5,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x1a31cd['isParameterized']);const _0x15c81c=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',_0x53dc00=>_0x53dc00),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x5a6fb1=>_0x5a6fb1)],'style':{'--ck-ai-review-check-list-item-index':_0x16d9af}},'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':_0x1a31cd['title']}]},_0x15c81c]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x1a31cd['description']?[{'text':_0x1a31cd['description']}]:[]}]}]},..._0x1a31cd['isParameterized']?[this['_createParameterizedView'](_0x1a31cd)]:[],...'custom'===_0x1a31cd['id']?[this['_createCustomView'](_0x1a31cd,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x1a31cd['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x1a31cd['id'],'args':_0x1a31cd['useArgs']?_0x1a31cd['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'](_0x54e057=>{_0x54e057['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x16252e=new Lt();return _0x16252e['content']=ot,_0x16252e['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x16252e;}['_createParameterizedView'](_0x110ce6){const _0x473f27=new Nt(),_0x1ad70d=this['_createFormView'](_0x110ce6);return _0x473f27['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x28ded1=>!_0x28ded1)]},'children':[_0x1ad70d]}),_0x473f27;}['_createFormView'](_0x1bc6c5){const _0x3d6c0a=new Nt(),_0x19fe44=Array['isArray'](_0x1bc6c5['options'])?_0x1bc6c5['options']:[],_0x4107f2=new yt(this['locale']),t=this['locale']['t'];_0x4107f2['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x4107f2['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x348e4d=>{_0x348e4d['stopPropagation']();})}}),_0x4107f2['on']('execute',()=>{const _0x1e8b54=[],_0x579ef3={};this['_formItemsCollection']['forEach'](_0xbdd191=>{_0x1e8b54['push'](_0xbdd191['value']),_0x1bc6c5['useArgs']&&_0x1bc6c5['options']&&(_0x579ef3[_0xbdd191['argsKey']]=_0xbdd191['value']);}),this['fire']('runReviewCheck',{'id':_0x1bc6c5['id'],'params':_0x1e8b54['length']?_0x1e8b54:void 0x0,'args':Object['keys'](_0x579ef3)['length']?_0x579ef3:void 0x0});});const _0x317c74=_0x19fe44['length'];return _0x19fe44['forEach']((_0x24634d,_0x5545b1)=>{const _0x274b55=_0x5545b1===_0x317c74-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x24634d,_0x274b55?_0x4107f2:null));}),_0x3d6c0a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x3d6c0a;}['_createCustomView'](_0x3f4a0c,_0x27208e=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x3f4a0c,_0x27208e),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',_0x3ec839=>!_0x3ec839)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x3cde92,_0x1131e0,_0x33952d)=>{_0x33952d||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Ht{['_checkViews'];constructor(_0x18bdb1){super(_0x18bdb1),this['_checkViews']=new _0x3d0d1a(),this['_setupTemplate']();}['setChecks'](_0x54c904,_0x3d1f37=!0x1){this['_checkViews']['clear']();for(const [_0x142d1c,_0x38e825]of _0x54c904['entries']()){const _0x2cb4aa=new AIReviewCoreReviewCommandListItemView(this['locale'],_0x38e825,_0x142d1c,_0x3d1f37);_0x2cb4aa['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x2cb4aa);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x115dd3 of this['_checkViews'])_0x115dd3 instanceof AIReviewCoreReviewCommandListItemView&&_0x115dd3['resetToDefault']();}['_setupTemplate'](){const _0x405847=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x405847['if']('isVisible','ck-hidden',_0xda7d3a=>!_0xda7d3a)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x2499b9=this['context']['plugins']['get']('AITabs'),_0x10c422=this['context']['locale'],_0x2eb4d0=new AIHeaderView(_0x10c422,{'label':Mi(_0x10c422,'AI_REVIEW_MODE'),'icon':_0x51b0f9,'class':'ck-ai-header_review','showResizeButton':_0x2499b9['showResizeButton']});return _0x2eb4d0['delegate']('resizeTabs')['to'](_0x2499b9),_0x2eb4d0['bind']('isMaximized')['to'](_0x2499b9['view'],'isMaximized',_0x3362b6=>_0x3362b6),new AIReviewCoreView(this['context']['locale'],{'header':_0x2eb4d0,'list':new AIReviewCoreReviewCheckListView(_0x10c422),'results':new AIReviewCoreUICheckResultsView(_0x10c422,{'generalErrorText':Mi(_0x10c422,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x10c422,{'headerText':Mi(_0x10c422,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Mi(_0x10c422,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x10c422,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x4de534=this['context']['plugins']['get']('AITabs');_0x4de534['view']['on']('activateTab',(_0x35b0d5,{newTab:_0x55ab14,oldTab:_0x1ab145})=>{'reviewMode'===_0x55ab14?this['fire']('getReviewCheckList'):'reviewMode'===_0x1ab145&&this['fire']('leaveReview');}),_0x4de534['view']['addTab']({'id':'reviewMode','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x51b0f9,'order':0x0,'content':this['_mainView']});}}const Zn='review-',tr=['softBreak'],er=['htmlScript','htmlStyle','htmlCustomElement'];class AIReviewCoreEditing extends _0x4338bf{static get['requires'](){return[_0x4ea419,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(_0x293078){super(_0x293078),this['_domEmitter']=new(vt())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x32d437=_0x52bda3=>this['_scheduleAttachReviewEditingToEditor'](_0x52bda3);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x1ca247)return void _0x32d437(this['context']);const _0x1a8603=this['context'];for(const _0x597fe5 of _0x1a8603['editors'])_0x32d437(_0x597fe5);this['listenTo'](_0x1a8603['editors'],'add',(_0xb4a3f6,_0x41669b)=>{_0x32d437(_0x41669b);}),this['listenTo'](_0x1a8603['editors'],'remove',(_0x3ee948,_0x3a02ac)=>{for(const [_0x4d8824,_0x17bcc5]of this['_markers'])_0x17bcc5['editor']===_0x3a02ac&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x4d8824,'changeId':_0x17bcc5['groupId']}),this['_markers']['delete'](_0x4d8824));});}['_scheduleAttachReviewEditingToEditor'](_0x53522d){const _0x59573c=()=>{'destroyed'!==_0x53522d['state']&&_0x53522d['conversion']&&this['_attachReviewEditingToEditor'](_0x53522d);};if('ready'===_0x53522d['state'])return void _0x59573c();const _0x448463=()=>{this['stopListening'](_0x53522d,'ready',_0x448463),_0x59573c();};this['listenTo'](_0x53522d,'ready',_0x448463);}['_attachReviewEditingToEditor'](_0x1f4f69){this['_reviewEditingAttachedEditors']['has'](_0x1f4f69)||(_0x1f4f69['conversion']['for']('editingDowncast')['markerToElement']({'model':Zn+'insert','view':(_0x4d962e,{writer:_0x37b3e2})=>{const _0x19605f=this['_markers']['get'](_0x4d962e['markerName']),_0x3c350a={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x19605f?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x4d962e['markerName']};return _0x37b3e2['createUIElement']('span',_0x3c350a,function(_0x572ce3){const _0x1794f4=this['toDomElement'](_0x572ce3);return _0x1794f4['innerHTML']=_0x19605f?.['content']?.['asString']||'',_0x1794f4;});}}),_0x1f4f69['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Zn+'remove-only','view':_0x42f3b1=>{const _0x5bdbf1=this['_markers']['get'](_0x42f3b1['markerName']),_0x1fb51e=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x5bdbf1?.['id']||'')&&_0x1fb51e['push']('ck-ai_review__change_active'),{'classes':_0x1fb51e,'attributes':{'data-marker-id':_0x42f3b1['markerName']}};}}),_0x1f4f69['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Zn+'remove-context','view':_0x187f49=>{const _0x33190e=this['_markers']['get'](_0x187f49['markerName']),_0x10747f=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x33190e?.['id']||'')&&_0x10747f['push']('ck-ai_review__change_active'),{'classes':_0x10747f,'attributes':{'data-marker-id':_0x187f49['markerName']}};}}),_0x1f4f69['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Zn+'remove-text','view':_0x53d82d=>{const _0x377afc=this['_markers']['get'](_0x53d82d['markerName']),_0x8664a4=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x377afc?.['id']||'')&&_0x8664a4['push']('ck-ai_review__change_active'),{'classes':_0x8664a4,'attributes':{'data-marker-id':_0x53d82d['markerName']}};}}),_0x1f4f69['conversion']['for']('dataDowncast')['markerToElement']({'model':Zn+'suggestion-context','view':(_0x4a2396,{writer:_0x49479c})=>_0x49479c['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x4a2396['isOpening']?'start':'end')})}),_0x1f4f69['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x18f6e1,'view':_0x4dd8ed}),this['_updateMouseMarkerInteractionListeners'](_0x1f4f69),this['listenTo'](_0x1f4f69,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x1f4f69),{'priority':'lowest'}),this['listenTo'](_0x1f4f69,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x1f4f69),{'priority':'lowest'}),_0x1f4f69['model']['document']['registerPostFixer'](_0x112f00=>this['_validateMarkers'](_0x1f4f69,_0x112f00)),_0x1f4f69['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x1f4f69)),this['_reviewEditingAttachedEditors']['add'](_0x1f4f69));}['_updateMouseMarkerInteractionListeners'](_0x350b5c){let _0x54c21f=this['_boundEditables']['get'](_0x350b5c);_0x54c21f||(_0x54c21f=new Map(),this['_boundEditables']['set'](_0x350b5c,_0x54c21f));const _0x4dd0a7=new Set(_0x350b5c['ui']['getEditableElementsNames']());for(const _0x2a4296 of _0x4dd0a7){if(_0x54c21f['has'](_0x2a4296))continue;const _0x5d1c95=_0x350b5c['ui']['getEditableElement'](_0x2a4296);_0x54c21f['set'](_0x2a4296,_0x5d1c95),this['_attachMouseMarkerInteractionListeners'](_0x5d1c95);}for(const [_0x51b0d8,_0x3359a5]of _0x54c21f)_0x4dd0a7['has'](_0x51b0d8)||(_0x54c21f['delete'](_0x51b0d8),this['_domEmitter']['stopListening'](_0x3359a5));}['_attachMouseMarkerInteractionListeners'](_0x135090){this['_domEmitter']['listenTo'](_0x135090,'mouseup',(_0x3ce761,_0x4cea92)=>{const _0x2ab460=_0x4cea92['target'],_0x19a403=this['_findMarkerElement'](_0x2ab460);if(!_0x19a403)return;const _0xfc738=_0x19a403['getAttribute']('data-marker-id'),_0x5e26b0=_0xfc738['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0xfc738,'changeId':_0x5e26b0,'markerElement':()=>this['_findMarkerElementById'](_0xfc738),'domEvent':_0x4cea92});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x135090,'mouseover',(_0x3dcc76,_0x3d7067)=>{const _0x267ed9=_0x3d7067['target'],_0xc96cb=_0x3d7067['relatedTarget'];let _0x4df42f=this['_findMarkerElement'](_0x267ed9);if(!_0x4df42f&&_0xc96cb&&(_0x4df42f=this['_findMarkerElement'](_0xc96cb)),!_0x4df42f)return;const _0x193745=_0x4df42f['getAttribute']('data-marker-id'),_0xdf90a5=_0x193745['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0xdf90a5,'markerElement':()=>this['_findMarkerElementById'](_0x193745),'domEvent':_0x3d7067});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x35b1c0((_0x2f55df,_0x29ca4d)=>{const _0x4ed92e=_0x29ca4d['target'];if(this['_findMarkerElement'](_0x4ed92e))return;_0x4ed92e['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x22afa7=this['context']['plugins']['get']('AIEditing'),_0x1228d6=Cs(this['context']);if(!_0x1228d6['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x4bd180=new Set(),_0x1ba943=[],_0x591dfb=new Map();for(const _0x350e8e of _0x1228d6)for(const _0x7a131a of _0x350e8e['model']['document']['getRoots']()){if('$graveyard'===_0x7a131a['rootName'])continue;const _0x34f2e=this['_buildDocumentDataSliceForRoot'](_0x350e8e,_0x7a131a,_0x22afa7,_0x4bd180);_0x1ba943['push'](_0x34f2e['content']);for(const [_0x5b11c0,_0x15da05]of _0x34f2e['elements'])_0x591dfb['set'](_0x5b11c0,_0x15da05);}return{'elements':_0x591dfb,'content':_0x1ba943['join']('')};}['_buildDocumentDataSliceForRoot'](_0x4ffa55,_0x2aece7,_0x226a7c,_0x410eb5){const _0x42d857=_0x4ffa55['model'],_0x181c17=new _0x3d8d81();for(const _0x1fd6c6 of _0x2aece7['getChildren']())_0x181c17['_appendChild'](_0x1fd6c6['_clone'](!0x0));for(const _0x121cb0 of _0x42d857['markers']){const _0x36731c=_0x121cb0['getRange']();_0x36731c&&_0x36731c['root']['rootName']===_0x2aece7['rootName']&&_0x181c17['markers']['set'](_0x121cb0['name'],this['_changeRangeOwnerDocument'](_0x36731c['clone'](),_0x181c17));}const _0x172f25=new Map(),_0x44c5fa=_0x42d857['document']['version'],_0x35a221=new _0xd22b47({'ignoreElementEnd':!0x0,'startPosition':_0x42d857['createPositionAt'](_0x181c17,0x0)});for(const {item:_0x51a294}of _0x35a221){if(_0x51a294['is']('element')&&_0x51a294['name']&&er['includes'](_0x51a294['name'])){const _0x8d44f9=this['_upsertDataId'](_0x51a294,()=>_0x226a7c['_nextDataId'](_0x410eb5));_0x410eb5['add'](_0x8d44f9);}if(!_0x51a294['is']('$textProxy'))continue;const _0xd12551=_0x51a294['parent'];if(!_0xd12551||!_0xd12551['is']('element'))continue;const _0x214b5e=this['_upsertDataId'](_0xd12551,()=>_0x226a7c['_nextDataId'](_0x410eb5));_0x410eb5['add'](_0x214b5e);for(const _0xf91468 of _0xd12551['getChildren']())_0xf91468['is']('element')&&(_0xf91468['name']&&tr['includes'](_0xf91468['name'])||_0x410eb5['add'](this['_upsertDataId'](_0xf91468,()=>_0x226a7c['_nextDataId'](_0x410eb5))));let _0x5213eb=_0xd12551;for(;_0x5213eb['parent']&&!_0x5213eb['parent']['is']('documentFragment');)_0x5213eb=_0x5213eb['parent'],_0x5213eb['hasAttribute'](_0x18f6e1)&&_0x5213eb['_removeAttribute'](_0x18f6e1);_0x172f25['set'](_0x214b5e,{'editor':_0x4ffa55,'rootName':_0x2aece7['rootName'],'path':_0xd12551['getPath'](),'documentVersion':_0x44c5fa,'getContent':this['_createGetContentUsingDataIdFn'](_0x5213eb['_clone'](!0x0),_0x214b5e,_0x4ffa55['data'])}),_0x35a221['jumpTo'](_0x42d857['createPositionAfter'](_0xd12551));}return{'content':_0x4ffa55['data']['processor']['toData'](_0x4ffa55['data']['toView'](_0x181c17)),'elements':_0x172f25};}['diffContent'](_0x1283cc,_0x2a2189,_0x587317,_0x282283=!0x1){const _0x493e3b=[],_0x5b278d=_0x1283cc['data']['parse'](_0x587317,'$documentFragment'),_0x398e7a=_0x1283cc['data']['parse'](_0x2a2189,'$documentFragment'),_0x28bfc7=_0x1283cc['model']['createPositionAt'](_0x398e7a,0x0);if(this['_haveSingleTopLevelElement'](_0x5b278d)){if(!this['_hasSameTopLevelElement'](_0x398e7a,_0x5b278d))return _0x493e3b;}else{const _0x48071d=_0x1283cc['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x398e7a,_0x48071d)||!this['_haveOnlyInlineContent'](_0x5b278d,_0x48071d))return _0x493e3b;}const _0x265137=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x2a2189,_0x587317,{'targetEditor':_0x1283cc,'anchor':_0x28bfc7,'markDeletions':!0x0})['getOperations']()['filter'](_0x5e62af=>'insert'===_0x5e62af['type']||'marker'===_0x5e62af['type']&&_0x5e62af['name']['startsWith']('$markedRemove')),_0x419e21=this['_groupAdjacentOperations'](_0x265137),_0x450232=[];if(_0x282283){if(_0x419e21['length']){const _0x95d0f1=_0x419e21[0x0]['operations'][0x0],_0x553edf='insert'===_0x95d0f1['type']?_0x95d0f1['position']:_0x95d0f1['newRange']['start'],_0x249634=this['_getPositionLimitingRange'](_0x553edf,_0x1283cc,'inside'),_0x31b770=_0x249634?_0x5b278d['getChild'](0x0)['getChildren']():_0x5b278d['getChildren'](),_0x23ca37=_0x249634||_0x1283cc['model']['createRangeIn'](_0x398e7a),_0x1185a5=[new _0x36fc26('$markedRemove:synthetic'+at(),null,_0x23ca37,_0x1283cc['model']['document']['model']['markers'],!0x0,_0x1283cc['model']['document']['version']+0x1),new _0x519e41(_0x23ca37['end'],_0x31b770,_0x1283cc['model']['document']['version']+0x2)];_0x450232['push']({'operations':_0x1185a5,'operationsIsolated':_0x1185a5,'groupOffset':0x0});}}else _0x450232['push'](..._0x419e21);let _0x4c9d11=0x0;return _0x1283cc['model']['change'](_0x48c4fb=>{for(let _0x141405=0x0;_0x141405<_0x450232['length'];_0x141405++){const _0x4a5c9d=_0x450232[_0x141405],_0x2b1836=_0x48c4fb['createDocumentFragment']();for(const _0x4d4cb8 of _0x398e7a['getChildren']())_0x48c4fb['append'](_0x4d4cb8['_clone'](!0x0),_0x2b1836);for(const _0x54fdc9 of _0x4a5c9d['operationsIsolated'])if('insert'===_0x54fdc9['type']){const _0x416c3c=_0x54fdc9;_0x416c3c['baseVersion']=null,_0x416c3c['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x416c3c,_0x2b1836),_0x48c4fb['batch']['addOperation'](_0x54fdc9),_0x1283cc['model']['applyOperation'](_0x54fdc9);const _0x1bb86f='suggestion:insertion:id:authorId:'+_0x4c9d11++,_0x3f5340=_0x1283cc['model']['createRange'](_0x416c3c['position'],_0x416c3c['position']['getShiftedBy'](_0x416c3c['howMany']));_0x2b1836['markers']['set'](_0x1bb86f,_0x3f5340);}else{if('marker'===_0x54fdc9['type']&&_0x54fdc9['name']['startsWith']('$markedRemove')){const _0x38dcdc=_0x54fdc9,_0x521999='suggestion:deletion:id:authorId:'+_0x4c9d11++;this['_changeOperationOwnerDocument'](_0x38dcdc,_0x2b1836),_0x2b1836['markers']['set'](_0x521999,_0x38dcdc['newRange']);}}if(_0x282283)_0x493e3b['push']({..._0x4a5c9d,'context':this['_createGetContentFn'](_0x398e7a,_0x1283cc['data']),'content':this['_createGetContentFn'](_0x398e7a,_0x1283cc['data'])});else{const _0x53274=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x4a5c9d['operationsIsolated'][0x0]),_0x2b1836),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x4a5c9d['operationsIsolated'][_0x4a5c9d['operationsIsolated']['length']-0x1]),_0x2b1836),_0x1283cc);_0x2b1836['markers']['set'](Zn+'suggestion-context',new _0x5c7233(_0x53274['start'],_0x53274['end'])),_0x493e3b['push']({..._0x4a5c9d,'context':this['_createGetContextFn'](_0x2b1836,_0x1283cc['data'],{'ellipsisBefore':_0x53274['hasContentBefore'],'ellipsisAfter':_0x53274['hasContentAfter']}),'content':this['_createGetContentFn'](_0x2b1836,_0x1283cc['data'])});}}}),_0x493e3b;}['markChangePositionInEditorContent'](_0x3054f6,_0x455515){if(!_0x3054f6['length'])return;const _0xd01a88=_0x3054f6[0x0]['parent']['id'],_0x35dd5d=_0x455515['elements']['get'](_0xd01a88);if(!_0x35dd5d)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0xd01a88);const _0x4d8447=_0x35dd5d['path'],_0x15b4eb=_0x35dd5d['editor'],_0x115e4f=_0x15b4eb['model']['document']['getRoot'](_0x35dd5d['rootName']);if(!_0x115e4f)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x35dd5d['rootName']);const _0x268f68=_0x15b4eb['model']['document']['history']['getOperations'](_0x35dd5d['documentVersion']),_0x10b306=[];for(const _0x35a37d of _0x3054f6){const _0x551fef=_0x35a37d['operationsIsolated']['map'](_0x3dd04d=>this['_translateOperationToEditorContent'](_0x3dd04d,_0x4d8447,_0x115e4f));if(!_0x551fef||!_0x551fef['length'])continue;const _0x4793f2=_0x551fef['every'](_0x13561f=>'marker'===_0x13561f['type']&&_0x13561f['name']['startsWith']('$markedRemove')),_0x5369d7={'document':_0x15b4eb['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x487cf9=_0x1dcb0f(_0x551fef,_0x268f68,_0x5369d7)['operationsA'];for(const _0x11355e of _0x487cf9)if('insert'===_0x11355e['type']){const _0x2a939f=_0x11355e,_0x157acc=_0x2a939f['nodes'];_0x15b4eb['model']['change'](_0x275594=>{const _0x251eca=_0x275594['createDocumentFragment']();for(const _0x4aab88 of _0x157acc)_0x275594['append'](_0x4aab88['_clone'](!0x0),_0x251eca);_0x10b306['push']({'start':_0x2a939f['position'],'end':_0x2a939f['position'],'type':'insert','groupId':_0x35a37d['id'],'content':{'asString':this['_createGetContentFn'](_0x251eca,_0x15b4eb['data'])(),'asFragment':_0x251eca}});});}else{if('marker'===_0x11355e['type']&&_0x11355e['name']['startsWith']('$markedRemove')){const _0x206dba=_0x11355e;let _0x54c458='remove-text';if(_0x4793f2){const _0x5a5600=this['_findAdjacentContextDistance'](_0x206dba['newRange']['start'],'backward',_0x15b4eb['model']['schema']),_0x4a181b=this['_findAdjacentContextDistance'](_0x206dba['newRange']['end'],'forward',_0x15b4eb['model']['schema']);if(_0x5a5600||_0x4a181b){const _0x2af594=_0x206dba['newRange']['start']['getShiftedBy'](-_0x5a5600),_0x2baa3f=_0x206dba['newRange']['end']['getShiftedBy'](_0x4a181b);_0x10b306['push']({'start':_0x2af594,'end':_0x2baa3f,'groupId':_0x35a37d['id'],'type':'remove-context'});}else _0x54c458='remove-only';}_0x10b306['push']({'start':_0x206dba['newRange']['start'],'end':_0x206dba['newRange']['end'],'groupId':_0x35a37d['id'],'type':_0x54c458});}}}this['_insertMarkers'](_0x10b306,_0x15b4eb);}['clearAllMarkers'](){const _0x5060cd=new Map();for(const _0x122499 of this['_markers']['keys']()){const _0x48ccd0=this['_markers']['get'](_0x122499);_0x48ccd0?.['editor']&&(_0x5060cd['has'](_0x48ccd0['editor'])||_0x5060cd['set'](_0x48ccd0['editor'],[]),_0x5060cd['get'](_0x48ccd0['editor'])['push'](_0x122499));}for(const [_0x4f8fb0,_0x1da89c]of _0x5060cd)_0x4f8fb0['model']['change'](_0x3a4239=>{for(const _0x9ab0e7 of _0x1da89c)_0x4f8fb0['model']['markers']['get'](_0x9ab0e7)&&_0x3a4239['removeMarker'](_0x9ab0e7);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0xf6edf8 of Cs(this['context']))_0xf6edf8['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x14c779 of Cs(this['context']))_0x14c779['disableReadOnlyMode']('ai-review');}['applyChange'](_0x558df1){const _0x342647=_0x558df1['map'](_0x8e3262=>this['_getMarkersDataForGroup'](_0x8e3262))['flat'](),_0x1d693d=new Map();for(const _0xb55c1a of _0x342647)_0x1d693d['has'](_0xb55c1a['editor'])||_0x1d693d['set'](_0xb55c1a['editor'],[]),_0x1d693d['get'](_0xb55c1a['editor'])['push'](_0xb55c1a);for(const [_0x5b0c03,_0x3c82fc]of _0x1d693d){const _0x14da7a=_0x5b0c03['model'];_0x14da7a['change'](_0x10d5d6=>{for(const _0x1ddd4f of _0x3c82fc){const _0x155680=_0x5b0c03['model']['markers']['get'](_0x1ddd4f['id']);if(_0x155680){if('insert'===_0x1ddd4f['type']){if(!_0x1ddd4f['content'])continue;_0x14da7a['insertContent'](_0x1ddd4f['content']['asFragment']||null,_0x155680['getRange']()['start']);}else'remove-text'!==_0x1ddd4f['type']&&'remove-only'!==_0x1ddd4f['type']||_0x14da7a['deleteContent'](_0x14da7a['createSelection'](_0x155680['getRange']()));_0x10d5d6['removeMarker'](_0x1ddd4f['id']),this['_markers']['delete'](_0x1ddd4f['id']);}}});}}['rejectChange'](_0x495e78){const _0x148694=this['_getMarkersDataForGroup'](_0x495e78),_0x4d7235=new Map();for(const _0xe7dacd of _0x148694)_0x4d7235['has'](_0xe7dacd['editor'])||_0x4d7235['set'](_0xe7dacd['editor'],[]),_0x4d7235['get'](_0xe7dacd['editor'])['push'](_0xe7dacd);for(const [_0x4861db,_0x27c3f9]of _0x4d7235)_0x4861db['model']['change'](_0xed9202=>{for(const _0x35e356 of _0x27c3f9)_0xed9202['removeMarker'](_0x35e356['id']),this['_markers']['delete'](_0x35e356['id']);});}['getEditor'](){return ms(this['context']);}['getEditors'](){return Cs(this['context']);}['getEditorForChange'](_0x4bb97d){const _0x10cca9=this['_getMarkersDataForGroup'](_0x4bb97d);return _0x10cca9[0x0]?.['editor'];}['getMarkerElementForChange'](_0x3de339){const _0x593f4b=Array['from'](this['_markers']['values']())['filter'](_0x356a39=>_0x356a39['groupId']===_0x3de339);if(!_0x593f4b['length'])return null;const _0x3e4167=0x1===_0x593f4b['length']?_0x593f4b[0x0]:this['_sortMarkers'](_0x593f4b)[0x0],_0x366fab=_0x3e4167['editor']['model']['markers']['get'](_0x3e4167['id']);if(!_0x366fab)return null;return{'modelRange':_0x366fab['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x3e4167['id'])};}['getContentElementForChange'](_0x34b1a1){const _0x25ff6f=Array['from'](this['_markers']['values']())['filter'](_0x3ee584=>_0x3ee584['groupId']===_0x34b1a1);if(!_0x25ff6f['length'])return null;const _0x3c62ea=0x1===_0x25ff6f['length']?_0x25ff6f[0x0]:this['_sortMarkers'](_0x25ff6f)[0x0],_0x765479=_0x3c62ea['editor'],_0x30dacd=_0x765479['model']['markers']['get'](_0x3c62ea['id']);if(!_0x30dacd)return null;const _0x4b034e=_0x30dacd['getRange'](),_0x1595ae=_0x765479['editing']['view']['getDomRoot'](_0x4b034e['root']['rootName'])||_0x765479['editing']['view']['getDomRoot']();if(!_0x1595ae||!_0x4b034e)return null;let _0x3ecb3a=_0x4b034e['start']['parent'];for(;_0x3ecb3a['parent']&&!_0x3ecb3a['parent']['is']('rootElement');)_0x3ecb3a=_0x3ecb3a['parent'];if(!_0x3ecb3a||!_0x3ecb3a['name'])return null;const _0x359640=_0x1595ae['querySelector']('[data-marker-id=\x22'+_0x3c62ea['id']+'\x22]');if(!_0x359640)return null;let _0x2144b1=null;_0x765479['model']['change'](_0x12025e=>{_0x2144b1=_0x12025e['createDocumentFragment'](),_0x12025e['append'](_0x3ecb3a['_clone'](!0x0),_0x2144b1);});const _0x51049c=_0x765479['data']['toView'](_0x2144b1)['getChild'](0x0);return _0x359640['closest'](_0x51049c['name']);}['reactivateMarkers'](_0x52443c){const _0x17823c=this['_getMarkersDataForGroup'](_0x52443c);if(!_0x17823c['length'])return;const _0x488ca6=Array['from'](this['_activeMarkers'])['sort'](),_0x966d76=Array['from'](new Set(_0x17823c['map'](_0x5c76da=>_0x5c76da['id'])))['sort']();_0x488ca6['join']('|')!==_0x966d76['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x52443c));}['setMarkersInElementAsActive'](_0x35aec9){const _0x387eae=this['_getMarkersDataForGroup'](_0x35aec9);if(!_0x387eae['length'])return;const _0x1f230e=_0x387eae[0x0]['editor'],_0x4c3b6c=new Set(_0x387eae['map'](_0x3773aa=>_0x3773aa['id'])),_0x4b6173=Array['from'](_0x4c3b6c['values']())['map'](_0x1615d8=>_0x1f230e['model']['markers']['get'](_0x1615d8))['filter'](_0x204c91=>!!_0x204c91);_0x4c3b6c['forEach'](_0x2884ec=>{this['_activeMarkers']['add'](_0x2884ec);}),_0x1f230e['model']['change'](()=>{_0x4b6173['forEach'](_0x3e32c4=>{_0x1f230e['editing']['reconvertMarker'](_0x3e32c4);});});}['setAllMarkersAsInactive'](){const _0x49a2d7=Array['from'](this['_activeMarkers']);if(!_0x49a2d7['length'])return;this['_activeMarkers']['clear']();const _0x4ff761=new Map();for(const _0x5af350 of _0x49a2d7){const _0x131c5e=this['_markers']['get'](_0x5af350);if(!_0x131c5e)continue;const _0x41d73a=_0x131c5e['editor'],_0x679521=_0x41d73a['model']['markers']['get'](_0x5af350);_0x679521&&(_0x4ff761['has'](_0x41d73a)||_0x4ff761['set'](_0x41d73a,[]),_0x4ff761['get'](_0x41d73a)['push'](_0x679521));}for(const [_0x4e7258,_0xa7e21e]of _0x4ff761)_0x4e7258['model']['change'](()=>{_0xa7e21e['forEach'](_0x4b577c=>{_0x4e7258['editing']['reconvertMarker'](_0x4b577c);});});}['_getPositionLimitingRange'](_0x14dc72,_0x2277ff,_0x1087c9='outside'){if(!_0x14dc72)return null;let _0x17ad14=_0x14dc72['parent'];for(;_0x17ad14&&_0x17ad14['parent']&&!_0x17ad14['parent']['is']('rootElement')&&!_0x2277ff['model']['schema']['isLimit'](_0x17ad14)&&!_0x2277ff['model']['schema']['isBlock'](_0x17ad14);)_0x17ad14=_0x17ad14['parent'];if(!_0x17ad14||!_0x17ad14['name']||_0x17ad14['is']('rootElement'))return null;let _0x7be56a=null;return _0x2277ff['model']['change'](_0x28c264=>{_0x7be56a='inside'===_0x1087c9?_0x28c264['createRangeIn'](_0x17ad14):_0x28c264['createRangeOn'](_0x17ad14);}),_0x7be56a;}['_validateMarkers'](_0x562f4d,_0x555197){const _0x138817=Array['from'](this['_markers']['keys']()),_0x1f1f33=new Map();for(const _0x53825b of _0x138817){const _0x47d417=_0x562f4d['model']['markers']['get'](_0x53825b);if(!_0x47d417)continue;const _0x4d8620=_0x47d417['getStart']()['root']['rootName']+':'+_0x47d417['getStart']()['path'][0x0];_0x1f1f33['has'](_0x4d8620)||_0x1f1f33['set'](_0x4d8620,[]),_0x1f1f33['get'](_0x4d8620)['push'](_0x47d417);}const _0x596ee8=new Set();for(const _0x5f0b1f of _0x562f4d['model']['document']['differ']['getChanges']()){let _0x351144='',_0x48f674=null;if('insert'===_0x5f0b1f['type'])_0x48f674=new _0x5c7233(_0x5f0b1f['position'],_0x5f0b1f['position']['getShiftedBy'](_0x5f0b1f['length'])),_0x351144=_0x5f0b1f['position']['root']['rootName']+':'+_0x5f0b1f['position']['path'][0x0];else{if('remove'!==_0x5f0b1f['type'])continue;_0x48f674=new _0x5c7233(_0x5f0b1f['position']),_0x351144=_0x5f0b1f['position']['root']['rootName']+':'+_0x5f0b1f['position']['path'][0x0];}const _0x564343=_0x1f1f33['get'](_0x351144)||[];if(_0x564343['length']){for(const _0x26925f of _0x564343)if(_0x48f674['root']['rootName']===_0x26925f['getRange']()['root']['rootName']&&('insert'!==_0x5f0b1f['type']||!_0x48f674['containsRange'](_0x26925f['getRange']()))&&(_0x48f674['isIntersecting'](_0x26925f['getRange']())||_0x48f674['start']['isTouching'](_0x26925f['getRange']()['end'])||_0x48f674['end']['isTouching'](_0x26925f['getRange']()['start']))){const _0x322ac7=this['_parseMarkerName'](_0x26925f['name']);Array['from'](this['_markers']['values']())['filter'](_0x1970b9=>_0x1970b9['groupId']===_0x322ac7['groupId'])['forEach'](_0x50cb2c=>_0x596ee8['add'](_0x50cb2c['id']));}}}if(_0x596ee8['size']){for(const _0x5ba93b of _0x596ee8)_0x555197['removeMarker'](_0x5ba93b);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x1fafdc){for(const {name:_0x5cee87,data:_0x29ced1}of _0x1fafdc['model']['document']['differ']['getChangedMarkers']()){if(!_0x5cee87['startsWith'](Zn))continue;const _0x21c4f5=_0x29ced1['oldRange'],_0x2a4c11=_0x29ced1['newRange'],_0x109b45=_0x21c4f5&&'$graveyard'===_0x21c4f5['root']['rootName'],_0x4e77f4=_0x2a4c11&&'$graveyard'===_0x2a4c11['root']['rootName'];if(_0x109b45&&_0x4e77f4)continue;const _0xaa2fd3=this['_parseMarkerName'](_0x5cee87);this['_markers']['get'](_0x5cee87)&&(_0x4e77f4||!_0x2a4c11?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x5cee87,'changeId':_0xaa2fd3['groupId']}):_0x109b45&&_0x2a4c11&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x5cee87,'changeId':_0xaa2fd3['groupId']}));}}['_parseMarkerName'](_0x1ed8ac){const _0x5c51ba=_0x1ed8ac['split'](':'),_0x3d0ed8=(_0x5c51ba[0x1]||'')['split']('_');return{'prefix':_0x5c51ba[0x0],'groupId':_0x3d0ed8[0x0],'suffix':_0x3d0ed8[0x1]};}['_translateOperationToEditorContent'](_0x539857,_0x52cb78,_0x19eb0e){if('insert'===_0x539857['type']){const _0x18c117=_0x539857;return new _0x519e41(this['_changePosition'](_0x52cb78['concat'](_0x18c117['position']['offset']),_0x19eb0e),_0x18c117['nodes'],_0x18c117['baseVersion']);}if('marker'===_0x539857['type']&&_0x539857['name']['startsWith']('$markedRemove')){const _0x21304b=_0x539857;return new _0x36fc26(_0x21304b['name'],_0x21304b['oldRange'],this['_changeRange'](_0x21304b['newRange'],_0x52cb78['concat'](_0x21304b['newRange']['start']['offset']),_0x52cb78['concat'](_0x21304b['newRange']['end']['offset']),_0x19eb0e),_0x21304b['_markers'],_0x21304b['affectsData'],_0x21304b['baseVersion']);}return _0x539857;}['_groupAdjacentOperations'](_0x40f076){if(!_0x40f076['length'])return[];const _0x36251d=[];let _0x182409=0x0,_0x1ee344=0x0,_0x11731f=[];for(let _0x32a942=0x0;_0x32a942<=_0x40f076['length'];_0x32a942++){const _0x224cfd=_0x40f076[_0x32a942],_0x333cb9=_0x40f076[_0x32a942-0x1];!_0x224cfd||_0x333cb9&&!this['_getOperationEnd'](_0x333cb9)['isTouching'](this['_getOperationStart'](_0x224cfd))?(_0x36251d['push']({'operations':_0x11731f,'operationsIsolated':_0x11731f['map'](_0x1cd4d0=>this['_shiftOperation'](_0x1cd4d0['clone'](),-_0x1ee344)),'groupOffset':_0x182409}),_0x11731f=_0x224cfd?[_0x224cfd]:[],_0x1ee344+=_0x182409,_0x182409=0x0):_0x11731f['push'](_0x224cfd),_0x224cfd&&'insert'===_0x224cfd['type']&&(_0x182409+=_0x224cfd['howMany']);}return _0x36251d;}['_findAdjacentContextDistance'](_0x48857d,_0x4ea6a1,_0x10aecf,_0x26c08d=0x1){const _0x2bf938=new _0xd22b47({'startPosition':_0x48857d,'direction':_0x4ea6a1});let _0xcacb0=0x0;for(let _0x34d78e=0x0;_0x34d78e<_0x26c08d;_0x34d78e++){let _0x130118=0x0,_0x71696e=!0x1,_0x426471='forward'===_0x4ea6a1?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x219d8f}of _0x2bf938)if(_0x219d8f['is']('$textProxy')){const _0x39aec9=_0x426471['exec'](_0x219d8f['data']);if(_0x39aec9&&_0x39aec9['length']){if(_0x130118+='forward'===_0x4ea6a1?_0x39aec9['index']+_0x39aec9[0x0]['length']:_0x219d8f['data']['length']-_0x39aec9['index'],_0x39aec9[0x0]['length']!==_0x219d8f['data']['length'])break;_0x71696e=!0x0,_0x426471='forward'===_0x4ea6a1?/^\w+/:/\w+$/;}else{if(_0x71696e)break;_0x130118+=_0x219d8f['offsetSize'];}}else{if(_0x219d8f['is']('element')){_0x10aecf['isInline'](_0x219d8f)&&!_0x71696e&&(_0x130118+=0x1);break;}}_0xcacb0+=_0x130118,_0x2bf938['jumpTo'](_0x48857d['getShiftedBy']('forward'===_0x4ea6a1?_0xcacb0:-_0xcacb0));}return _0xcacb0;}['_getChangeContext'](_0xc86847,_0x4354cb,_0x19aa45){const _0x234f07=_0x19aa45['model']['schema'],_0x1f9778=this['_findAdjacentContextDistance'](_0xc86847,'backward',_0x234f07,0x6),_0x414cfb=this['_findAdjacentContextDistance'](_0x4354cb,'forward',_0x234f07,0x6),_0x4bf79b=_0xc86847['getShiftedBy'](-_0x1f9778),_0x2cbc70=_0x4354cb['getShiftedBy'](_0x414cfb);return{'start':_0x4bf79b,'end':_0x2cbc70,'hasContentBefore':!_0x4bf79b['isAtStart'],'hasContentAfter':!_0x2cbc70['isAtEnd']};}['_insertMarkers'](_0x55df57,_0x5d2e7c){const _0x246556=this['context']['plugins']['get']('AIEditing'),_0x38c3aa=new Set();_0x5d2e7c['model']['change'](_0x1fe7eb=>{for(const _0x4b4c4f of _0x55df57){const _0xc49b72=''+Zn+_0x4b4c4f['type']+':'+_0x4b4c4f['groupId']+'_'+_0x246556['_nextDataId'](_0x38c3aa);this['_markers']['set'](_0xc49b72,{'id':_0xc49b72,'groupId':_0x4b4c4f['groupId'],'type':_0x4b4c4f['type'],'content':_0x4b4c4f['content'],'editor':_0x5d2e7c}),_0x1fe7eb['addMarker'](_0xc49b72,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x1fe7eb['createRange'](_0x4b4c4f['start'],_0x4b4c4f['end'])});}});}['_createGetContextFn'](_0x5cd561,_0x5ef8ee,_0x1a9b43){let _0x517a27='';return()=>{if(!_0x517a27){const _0x52f551=_0x5ef8ee['toView'](_0x5cd561,{'showSuggestionHighlights':!0x0});let _0x1f3bbd=_0x52f551['getChild'](0x0);if(_0x1f3bbd['is']('containerElement')||(_0x1f3bbd=_0x52f551),!_0x1f3bbd)return'';let _0x11103b=!0x1;const _0x341e78=[];for(const _0x4c3516 of _0x1f3bbd['getChildren']())_0x4c3516['is']('element','span')&&_0x4c3516['hasClass']('ck-ai_review-marker_context-end')&&(_0x11103b=!0x1),_0x11103b&&_0x341e78['push'](_0x4c3516),_0x4c3516['is']('element','span')&&_0x4c3516['hasClass']('ck-ai_review-marker_context-start')&&(_0x11103b=!0x0);_0x1f3bbd['_removeChildren'](0x0,_0x1f3bbd['childCount']),_0x1a9b43?.['ellipsisBefore']&&_0x1f3bbd['_appendChild']('…'),_0x1f3bbd['_appendChild'](_0x341e78),_0x1a9b43?.['ellipsisAfter']&&_0x1f3bbd['_appendChild']('…');const _0x295d3d=_0x5ef8ee['htmlProcessor']['domConverter']['viewToDom'](_0x52f551),_0x42ef67=_0x5ef8ee['htmlProcessor']['htmlWriter']['getHtml'](_0x295d3d);_0x517a27=this['_removeUnsupportedElements'](_0x42ef67);}return _0x517a27;};}['_createGetContentFn'](_0x4f6ade,_0x58584e){let _0x339c76='';return()=>(_0x339c76||(_0x339c76=this['_removeUnsupportedElements'](_0x58584e['stringify'](_0x4f6ade,{'showSuggestionHighlights':!0x0}))),_0x339c76);}['_createGetContentUsingDataIdFn'](_0x14b4f8,_0x148462,_0x18dfab){let _0x58e5f2='';return()=>{if(!_0x58e5f2){const _0x3dc7ac=_0x18dfab['toView'](new _0x3d8d81(_0x14b4f8)),_0x3d38e4=_0x18dfab['htmlProcessor']['domConverter']['viewToDom'](_0x3dc7ac)['querySelector']('[data-id=\x22'+_0x148462+'\x22]');_0x58e5f2=this['_removeUnsupportedElements'](_0x3d38e4?.['outerHTML']||'');}return _0x58e5f2;};}['_removeUnsupportedElements'](_0x526474){if(!_0x526474)return'';const _0x4e83f1=Wi(_0x526474,{'decodeEntities':!0x1}),_0x19e955=qi(_0x4e83f1);if(!_0x19e955['length'])return _0x526474;for(const _0x5b0e0d of _0x19e955)_0x2cc5d2(_0x5b0e0d);return Ki(_0x4e83f1,{'encodeEntities':!0x1});}['_findMarkerElement'](_0x462986,_0x3bca13=0x5){let _0x1efac6=_0x462986,_0xa22634=null;for(let _0x332cbe=0x0;_0x332cbe<_0x3bca13&&_0x1efac6;_0x332cbe++){if(!_0x1efac6['className']){_0x1efac6=_0x1efac6['parentElement'];continue;}if(!(''+_0x1efac6['className'])['includes']('ck-ai_review-marker_')){_0x1efac6=_0x1efac6['parentElement'];continue;}if(!_0x1efac6['getAttribute']('data-marker-id'))break;_0xa22634=_0x1efac6;break;}return _0xa22634;}['_findMarkerElementById'](_0x29972f){const _0x44b79b=this['_markers']['get'](_0x29972f);if(!_0x44b79b)return null;const _0x252e12=_0x44b79b['editor']['model']['markers']['get'](_0x29972f);return _0x252e12?_0x11057a(_0x44b79b['editor']['editing'],_0x252e12):null;}['_getMarkersDataForGroup'](_0xa9aeb1){return Array['from'](this['_markers']['values']())['filter'](_0x103e4e=>_0x103e4e['groupId']===_0xa9aeb1);}['_getOperationStart'](_0x1d8f52){return'insert'===_0x1d8f52['type']?_0x1d8f52['position']:_0x1d8f52['newRange']['start'];}['_getOperationEnd'](_0x324cf9,_0xe291f9=!0x1){return'insert'===_0x324cf9['type']?_0xe291f9?_0x324cf9['position']:_0x324cf9['position']['getShiftedBy'](_0x324cf9['howMany']):_0x324cf9['newRange']['end'];}['_shiftOperation'](_0x506bc2,_0x2108a2){return'insert'===_0x506bc2['type']?_0x506bc2['position']=_0x506bc2['position']['getShiftedBy'](_0x2108a2):'marker'===_0x506bc2['type']&&_0x506bc2['newRange']&&(_0x506bc2['newRange']=new _0x5c7233(_0x506bc2['newRange']['start']['getShiftedBy'](_0x2108a2),_0x506bc2['newRange']['end']['getShiftedBy'](_0x2108a2))),_0x506bc2;}['_changeOperationOwnerDocument'](_0x32c4dd,_0x1ec9d2){'insert'===_0x32c4dd['type']?_0x32c4dd['position']=this['_changePositionOwnerDocument'](_0x32c4dd['position'],_0x1ec9d2):'marker'===_0x32c4dd['type']&&_0x32c4dd['newRange']&&(_0x32c4dd['newRange']=this['_changeRangeOwnerDocument'](_0x32c4dd['newRange'],_0x1ec9d2));}['_changePositionOwnerDocument'](_0x5aa238,_0x2b2f09){return new _0x5399e8(_0x2b2f09,_0x5aa238['path']);}['_changeRangeOwnerDocument'](_0x10831b,_0x1070f8){return new _0x5c7233(this['_changePositionOwnerDocument'](_0x10831b['start'],_0x1070f8),this['_changePositionOwnerDocument'](_0x10831b['end'],_0x1070f8));}['_changePosition'](_0x5ea84c,_0x1cbf06){return new _0x5399e8(_0x1cbf06,[..._0x5ea84c]);}['_changeRange'](_0x5c2fb4,_0xa41735,_0x218ba0,_0x15f91f){return new _0x5c7233(this['_changePosition'](_0xa41735,_0x15f91f),this['_changePosition'](_0x218ba0,_0x15f91f));}['_sortMarkers'](_0x3af1cc){const _0xf51c89=_0x13f2e0=>{switch(_0x13f2e0){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x3af1cc['sort']((_0x40844d,_0x2690c9)=>_0xf51c89(_0x40844d['type'])-_0xf51c89(_0x2690c9['type']));}['_hasSameTopLevelElement'](_0x2caf49,_0x39571e){const _0x41ad02=_0x2caf49['getChild'](0x0),_0xa13e6c=_0x39571e['getChild'](0x0);return!(!_0x41ad02||!_0xa13e6c)&&((!_0x41ad02['is']('element')||!_0xa13e6c['is']('element')||_0x41ad02['name']===_0xa13e6c['name'])&&!(_0x41ad02['is']('element')&&!_0xa13e6c['is']('element')||!_0x41ad02['is']('element')&&_0xa13e6c['is']('element')));}['_haveSingleTopLevelElement'](_0x44378c){return 0x1===_0x44378c['childCount'];}['_haveOnlyInlineContent'](_0xcc3008,_0x4bc972){for(const _0x185e08 of _0xcc3008['getChildren']())if(_0x185e08['is']('element')&&!_0x4bc972['isInline'](_0x185e08))return!0x1;return!0x0;}['_upsertDataId'](_0x1d8db3,_0x157713){let _0x538c12=_0x1d8db3['getAttribute'](_0x18f6e1);return _0x538c12||(_0x538c12=_0x157713(),_0x1d8db3['_setAttribute'](_0x18f6e1,_0x538c12)),_0x538c12;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x401e29,contentNew:_0x1d1112,contentInitial:_0x497c26,documentVersion:_0x3eb46e}){super(),this['id']=_0x401e29,this['contentNew']=_0x1d1112,this['contentInitial']=_0x497c26,this['documentVersion']=_0x3eb46e;}}class AIReviewCheckResultChange extends ct(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x114a61,_0x538bc9,_0x2aba32){super(),this['id']=_0x114a61,this['parent']=_0x2aba32,this['_data']=_0x538bc9,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(_0x17d937,_0x11e3fc,_0x587c95,_0x1d2429,_0x1cf5b0){super(),this['_sourceCheck']=_0x11e3fc,this['_documentData']=_0x17d937,this['_aiConnector']=_0x587c95,this['_reviewParams']=_0x1d2429,this['_reviewArgs']=_0x1cf5b0,this['on']('change:status',(_0x743c0b,_0x3aa230,_0x411224)=>{'aborted'==_0x411224&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x411224,'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'](_0x10aed2=>'pending'===_0x10aed2['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x841ab1){this['_documentData']=_0x841ab1;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x364377=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x42a79b of _0x364377)'unmodified'!==_0x42a79b['data']['operation']&&('error'!==_0x42a79b['data']['operation']?'review-metadata'!==_0x42a79b['event']?this['_addReviewCheckResult'](_0x42a79b['data']['dataId'],_0x42a79b['data']['textDelta']):this['callId']=_0x42a79b['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(_0x72a711){this['_currentError']=_0x72a711,_0x72a711 instanceof Error&&_0x72a711['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'](_0x3e2cd1,_0x59a430){const _0x48a1ff=this['_results']['get'](_0x3e2cd1);if(!_0x48a1ff)return;if(0x0===_0x59a430['length'])return;const _0x5a0476=[];_0x59a430['forEach']((_0x33d828,_0x13942b)=>{const _0x4597f4=new AIReviewCheckResultChange(_0x48a1ff['id']+'-'+_0x13942b,_0x33d828,_0x48a1ff);_0x4597f4['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x4597f4,'status':_0x4597f4['status']});}),_0x4597f4['on']('change:isActivated',()=>{_0x4597f4['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x4597f4}):this['fire']('reviewCheckResultDeactivated',{'change':_0x4597f4});}),this['_changes']['push'](_0x4597f4),_0x5a0476['push'](_0x4597f4);}),this['fire']('reviewCheckResultReady',{'changes':_0x5a0476,'result':_0x48a1ff,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x4a9abe){const _0x3e4b76=this['_changes']['find'](_0x522cb9=>_0x522cb9['id']===_0x4a9abe);return!(!_0x3e4b76||'pending'!==_0x3e4b76['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x1d9879=>!0x0===_0x1d9879['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x59abd2=>'pending'===_0x59abd2['status']);}['getChangeById'](_0x578299){return this['_changes']['find'](_0x153ca6=>_0x153ca6['id']===_0x578299);}['markAllChangesAsAccepted'](){for(const _0x2c9711 of this['_changes'])'pending'===_0x2c9711['status']&&(_0x2c9711['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x37eb95){const _0x19da8e=this['_changes']['find'](_0x502164=>_0x502164['id']===_0x37eb95);_0x19da8e&&'pending'===_0x19da8e['status']&&(_0x19da8e['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x2f5ec9){const _0x50c9d0=this['_changes']['find'](_0x4fd025=>_0x4fd025['id']===_0x2f5ec9);_0x50c9d0&&'pending'===_0x50c9d0['status']&&(_0x50c9d0['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x4ebd5c){const _0x24b144=this['_changes']['find'](_0x454b2b=>_0x454b2b['id']===_0x4ebd5c);_0x24b144&&'pending'===_0x24b144['status']&&(_0x24b144['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x48d715){const _0x5c9acd=this['_changes']['find'](_0x50a2cd=>_0x50a2cd['id']===_0x48d715);_0x5c9acd&&'outdated'===_0x5c9acd['status']&&(_0x5c9acd['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x5aef1b){this['_changes']['filter'](_0x4f7d0e=>_0x4f7d0e['isActivated']&&_0x4f7d0e['id']!==_0x5aef1b)['forEach'](_0x15bfe7=>{_0x15bfe7['isActivated']=!0x1;});const _0x5e3c7a=this['_changes']['find'](_0x27449f=>_0x27449f['id']===_0x5aef1b);_0x5e3c7a&&'pending'===_0x5e3c7a['status']&&(_0x5e3c7a['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x7defae=>_0x7defae['isActivated'])['forEach'](_0x11b702=>{_0x11b702['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x22a242){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x498233;if(_0x22a242){const _0x70deda=this['_changes']['find'](_0x21e826=>_0x21e826['id']===_0x22a242);if(_0x70deda&&_0x70deda['isRated'])return;_0x70deda&&(_0x498233=_0x70deda['parent']['id'],_0x70deda['isRated']=!0x0);}const _0x16e79f={'positiveCount':this['_changes']['filter'](_0x190fdd=>'accepted'===_0x190fdd['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x16e79f,this['callId'],_0x498233);}['_addReviewCheckResult'](_0x34fe17,_0xb2c2c1){const _0x531934=this['_documentData']['elements']['get'](_0x34fe17);if(!_0x531934)return;const _0x4520df=_0x531934['getContent']();if(_0x4520df===_0xb2c2c1)return;const _0x2f714c=new AIReviewCheckResult({'id':_0x34fe17,'contentInitial':_0x4520df,'contentNew':_0xb2c2c1,'documentVersion':_0x531934['documentVersion']});this['_results']['set'](_0x2f714c['id'],_0x2f714c),this['fire']('reviewCheckResultAdded',{'result':_0x2f714c,'source':this,'editor':_0x531934['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0x20ea49=>'pending'===_0x20ea49['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x2f6bf3=>'pending'===_0x2f6bf3['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x5b415e=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x53aa4d=0x0;_0x53aa4d<this['_reviewParams']['length'];_0x53aa4d++){if(!this['_reviewParams'][_0x53aa4d]||!this['_sourceCheck']['options'][_0x53aa4d])continue;const _0x4f6b19=this['_sourceCheck']['options'][_0x53aa4d],_0x2d33a8=_0x4f6b19['data']?.['find'](_0x5cdebd=>_0x5cdebd['id']===this['_reviewParams'][_0x53aa4d]);_0x2d33a8&&_0x5b415e['push'](_0x2d33a8['label']);}return _0x5b415e['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0xd7b77b,_0x210653,_0x3649ad){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x210653,_0xd7b77b,_0x3649ad);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0x4338bf{['_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',(_0x5142f5,_0x3928b5)=>this['runCheck'](_0x3928b5)),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 _0x47c8be=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x47c8be['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x47c8be['map'](_0x2f7c27=>_0x2f7c27['id']));const _0x12151f=this['_currentReviewCheckRun'];_0x12151f['markAllChangesAsAccepted'](),_0x12151f['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x170e46,_0x5ec765)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5ec765['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x5ec765['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x5ec765['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5ec765['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x167de9,_0x440359)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x440359['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x440359['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x440359['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x440359['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',(_0x27e564,_0x188e6c)=>{this['_onActivateChange'](_0x188e6c);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x2e5f1d,_0x3431c1)=>{this['_onDeactivateChange'](_0x3431c1);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x1ad696,_0x593142)=>{this['_onChangeMarkerClicked'](_0x1ad696,_0x593142);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x55e543,_0x33a6dd)=>{this['_onChangeMarkerHovered'](_0x55e543,_0x33a6dd);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x57ca17,_0x2b55a0)=>{this['_onChangeMarkerRemoved'](_0x57ca17,_0x2b55a0);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x27ac29,_0x50257c)=>{this['_onChangeMarkerRestored'](_0x27ac29,_0x50257c);});}async['runCheck'](_0x1cd9cd){if(!this['_availableReviewChecks'])return;const _0x49523d=this['_availableReviewChecks']['find'](_0x3ae52f=>_0x3ae52f['id']===_0x1cd9cd['id']);if(_0x49523d){this['_onReviewCheckRun'](_0x1cd9cd),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x1cd9cd,_0x49523d),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x4cd56e,_0x94f27e)=>{switch(_0x94f27e['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x94f27e);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'!==_0x94f27e['status']&&'error-chunk'!==_0x94f27e['status']&&'error-general'!==_0x94f27e['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x1d9323,_0x2d2b73)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x36920f=this['_diffContent'](_0x2d2b73['editor'],_0x2d2b73['result']['contentInitial'],_0x2d2b73['result']['contentNew']);_0x2d2b73['source']['addResultChanges'](_0x2d2b73['result']['id'],_0x36920f);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x45191a,_0x184a96)=>{for(const _0x41dc1b of _0x184a96['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x41dc1b);this['_markChangePositionInEditorContent'](_0x184a96['changes'],_0x184a96['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x231cbc,_0x2f0f2b)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x2f0f2b['change']['id'],_0x2f0f2b['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x27ec33,_0x4005df)=>{this['_onReviewCheckResultActivated'](_0x4005df);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x582bce){_0x582bce instanceof Error&&_0x582bce['message']['includes']('ai-request-aborted')||(_0x582bce instanceof ht?this['_logError'](_0x582bce):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x582bce)));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x1cd9cd['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return this['_availableReviewChecks']??[];}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x395500,_0x3b4742){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x3b4742,this['_aiConnector'],_0x395500['params'],_0x395500['args']);}['_onChangeMarkerRemoved'](_0x9c60eb,_0x9a2bdd){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x9a2bdd['changeId']);}['_onChangeMarkerRestored'](_0x152cac,_0x37f17f){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x37f17f['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0x165c85=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x165c85&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x370a44 of this['_aiReviewCoreEditing']['getEditors']())_0x370a44['editing']['view']['change'](_0x5afe74=>{for(const _0x4e5b4b of _0x370a44['editing']['view']['document']['getRoots']())_0x5afe74['removeClass']('ck-ai_review-diff',_0x4e5b4b),_0x5afe74['removeClass']('ck-ai_review-highlights',_0x4e5b4b),_0x5afe74['removeClass']('ck-ai-translate-mode-content',_0x4e5b4b);});}['_logError'](_0xd0df3b,_0x56fb85=!0x1){Ct(_0xd0df3b['message']),_0x56fb85||(_0xd0df3b['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x525462){if('content'===this['_changeActivationSource']){const _0x4b58b9=this['_aiReviewCoreUi']['getChangeElement'](_0x525462);_0x4b58b9&&Rt(_0x4b58b9['closest']('.ck-ai_review__check-run-result')||_0x4b58b9);}else{if('panel'===this['_changeActivationSource']){const _0x1d5e64=this['_getChangeContentElement'](_0x525462);if(!_0x1d5e64)return;Tt({'target':_0x1d5e64,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0x2f9daf,_0x150e47,_0x29f789,_0x43c95c,_0x537c73){super(_0x29f789,_0x43c95c,_0x537c73),this['_prompt']=_0x2f9daf,this['_model']=_0x150e47;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x5d00cc,_0x25bd48,_0x1c164f){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x25bd48,_0x5d00cc,_0x1c164f);}}class AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x28b229){this['id']=_0x28b229['id'],this['commandId']=_0x28b229['commandId'],this['title']=_0x28b229['title'],this['description']=_0x28b229['description'],this['isParameterized']=_0x28b229['isParameterized'],this['useArgs']=_0x28b229['useArgs'],this['options']=_0x28b229['options'],this['args']=_0x28b229['args'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x4010c6,_0x30ef7c,_0x192b02){super(_0x4010c6),this['prompt']=_0x4010c6['prompt'],this['model']=_0x4010c6['model'],this['model']?this['_defaultModel']=_0x30ef7c['find'](_0xfe04e1=>_0xfe04e1['id']===this['model'])||null:this['_defaultModel']=_0x192b02;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0x4a4a2b){this['_prompt']=_0x4a4a2b;}set['model'](_0x140ea9){this['_model']=_0x140ea9;}}class AIReviewCoreCheckRegistry extends _0x4338bf{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 ir=[{'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'](_0x1b0c17){this['_checks']=_0x1b0c17['map'](_0x403f65=>new AIReviewCheck(_0x403f65));}get['checks'](){return this['_checks'];}['getCheckById'](_0x2f1905){return this['checks']['find'](_0x554644=>_0x554644['id']===_0x2f1905);}['removeCheckById'](_0x16698b){this['_checks']=this['_checks']['filter'](_0x1732a9=>_0x1732a9['id']!==_0x16698b);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0x11bbd,_0x393f55,_0x326342){super(_0x11bbd),this['_models']=_0x393f55,this['_defaultModel']=_0x326342;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x4f5c13,_0x130d1b,_0x3a1a2d){super(),this['_allModels']=_0x4f5c13,this['_recommendedModels']=_0x130d1b,this['_defaultModel']=_0x3a1a2d;}get['allModels'](){return this['_allModels'];}['setupChecks'](_0x56d6c2){this['_checks']=_0x56d6c2['map'](_0x53403f=>!0x0===_0x53403f['isExtra']?new AIReviewCheckExtra(_0x53403f,this['_allModels'],this['_defaultModel']):'custom'===_0x53403f['id']?new AIReviewCheckCustom(_0x53403f,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x53403f));}}class AIReviewModeCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x298666){super(_0x298666),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x217f4c=>({'id':_0x217f4c['id'],'commandId':_0x217f4c['id'],'title':_0x217f4c['label'],'description':_0x217f4c['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x217f4c['prompt'],'model':_0x217f4c['model']}));}async['_loadChecksList'](){const _0xcd0c5=[...ir,...this['getExtraChecks']()]['map'](_0x5463f1=>_0x5463f1['isExtra']?_0x5463f1:this['_translateReviewCheck'](_0x5463f1)),_0x3fe8ca=await this['_getModels'](),_0x50fd8a=new AIReviewModeCheckList(_0x3fe8ca['all'],_0x3fe8ca['recommended'],_0x3fe8ca['default']);return _0x50fd8a['setupChecks'](_0xcd0c5),_0x50fd8a;}async['_getModels'](){const _0x1456ed=this['context']['plugins']['get']('AIConnector');try{const _0x1f9386=new AIModels({'connector':_0x1456ed,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x366bcf={'all':await _0x1f9386['getAll'](),'recommended':await _0x1f9386['getAvailableModels'](),'default':await _0x1f9386['getDefault']()};return this['_modelsLoadError']=null,_0x366bcf;}catch(_0x15beab){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x15beab),Ct(this['_modelsLoadError']['message']),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x130fe1){const _0x2f2a13='AI_REVIEW_CHECK_'+_0x130fe1['id']['toUpperCase']()['replaceAll']('-','_'),_0x2afd4a={..._0x130fe1,'title':this['_translate'](_0x2f2a13+'_TITLE',_0x130fe1['title']),'description':this['_translate'](_0x2f2a13+'_DESCRIPTION',_0x130fe1['description'])};return _0x130fe1['options']&&(_0x2afd4a['options']=_0x130fe1['options']['map'](_0x3fb9ed=>({..._0x3fb9ed,'label':this['_translate'](_0x2f2a13+'_OPTIONS_LABEL',_0x3fb9ed['label']||''),'data':_0x3fb9ed['data']?_0x3fb9ed['data']['map'](_0x361ddb=>({..._0x361ddb,'label':this['_translate'](_0x2f2a13+'_OPTIONS_DATA_'+_0x361ddb['id']['toUpperCase'](),_0x361ddb['label'])})):void 0x0}))),_0x2afd4a;}['_translate'](_0x25f975,_0x3c4a1d){const _0x4c3436=Mi(this['context']['locale'],_0x25f975);return _0x4c3436===_0x25f975?_0x3c4a1d:_0x4c3436;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[AIReviewModeCheckRegistry];}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x1287db){super(_0x1287db),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',ir['map'](_0x5686d2=>_0x5686d2['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x879b45,_0x5eb87d)=>{this['_isDiffOn']=_0x5eb87d['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x30fb84,_0x357573){if(_0x30fb84['isCustom'])return new AIReviewCustomCheckRun(_0x30fb84['args']['prompt'],_0x30fb84['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x357573,this['_aiConnector']);if(_0x357573['isExtra']){const _0x279d69=_0x357573;return new AIReviewExtraCheckRun(_0x30fb84['args']?.['prompt']??_0x279d69['prompt'],_0x30fb84['args']?.['model']??_0x279d69['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x357573,this['_aiConnector']);}return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x357573,this['_aiConnector'],_0x30fb84['params'],_0x30fb84['args']);}['_onReviewCheckResultActivated'](_0x500776){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x500776['change']['id']),this['_scrollToChange'](_0x500776['change']['id']);const _0x7804a2=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x500776['change']['id']);if(!_0x7804a2)return;const _0x1ead2a=this['_aiReviewCoreEditing']['getEditorForChange'](_0x500776['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x500776['change'],()=>_0x7804a2['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x1ead2a,_0x7804a2['modelRange']['root']['rootName']),_0x1ead2a?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x500776['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x421843){this['_currentReviewCheckRun']&&'click'===_0x421843['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x421843['id']));}['_onDeactivateChange'](_0x3b60d3){this['_currentReviewCheckRun']&&'balloon'===_0x3b60d3['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x44fda4,_0x46a4a5){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x46a4a5['changeId']);const _0x4f661c=this['_currentReviewCheckRun']['getChangeById'](_0x46a4a5['changeId']);if(!_0x4f661c)return;const _0x8f22ed=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x46a4a5['changeId']),_0x37e43e=this['_aiReviewCoreEditing']['getEditorForChange'](_0x46a4a5['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x4f661c,_0x46a4a5['markerElement'],_0x46a4a5['domEvent'],'click',this['_getBalloonDomRoot'](_0x37e43e,_0x8f22ed?.['modelRange']['root']['rootName']),_0x37e43e?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x311924,_0x531701){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x29deb8=this['_currentReviewCheckRun']['getChangeById'](_0x531701['changeId']);if(!_0x29deb8)return;const _0x452ac5=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x531701['changeId']),_0x492a11=this['_aiReviewCoreEditing']['getEditorForChange'](_0x531701['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x29deb8,_0x531701['markerElement'],_0x531701['domEvent'],'hover',this['_getBalloonDomRoot'](_0x492a11,_0x452ac5?.['modelRange']['root']['rootName']),_0x492a11?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0x36438b){const _0x4594f2=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x36438b);return _0x4594f2?_0x4594f2['getElement']():null;}['_markChangePositionInEditorContent'](_0x3d1410,_0x23d9a8){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x3d1410,_0x23d9a8);}['_diffContent'](_0x2236ec,_0x391a20,_0x29ffe6){return this['_aiReviewCoreEditing']['diffContent'](_0x2236ec,_0x391a20,_0x29ffe6,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x2eaff2){_0x2eaff2?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x523313 of this['_aiReviewCoreEditing']['getEditors']())_0x523313['editing']['view']['change'](_0xb02fe6=>{for(const _0x19b695 of _0x523313['editing']['view']['document']['getRoots']()){for(const _0x65b09a of _0x19b695['getClassNames']())_0x65b09a['startsWith']('ck-ai_review-')&&_0xb02fe6['removeClass'](_0x65b09a,_0x19b695);_0xb02fe6['addClass'](_0x2eaff2?'ck-ai_review-diff':'ck-ai_review-highlights',_0x19b695);}});}['_getBalloonDomRoot'](_0x5dc754,_0x9bd15c){const _0x2b43d9=_0x5dc754['editing']['view'];if(_0x9bd15c){const _0x2f5300=_0x2b43d9['getDomRoot'](_0x9bd15c);if(_0x2f5300)return _0x2f5300;}return _0x2b43d9['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x137208=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x412378=await _0x137208['getChecksList']();_0x137208['modelsLoadError']&&this['_logError'](_0x137208['modelsLoadError']);let _0x588cb9=_0x412378['checks'];const _0x591568=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x591568,_0x588cb9),this['_usesAvailableCommandsConfig']&&(_0x588cb9=_0x591568['map'](_0x457ef4=>_0x588cb9['find'](_0x1ee859=>_0x1ee859['id']===_0x457ef4))['filter'](_0x5cac87=>!!_0x5cac87)),this['_filterChecksWithMissingModel'](_0x588cb9);}['_logWarningForNonExistentChecks'](_0x35deb3,_0x5981c8){const _0xd8b642=_0x35deb3['filter'](_0x17702e=>!_0x5981c8['some'](_0x2611d5=>_0x2611d5['id']===_0x17702e));if(_0xd8b642['length']){const _0x5bf5cb=new ht('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0xd8b642['join'](',\x20')});wt(_0x5bf5cb['message']);}}['_filterChecksWithMissingModel'](_0x5a596f){const _0x32ff96=[];return _0x5a596f['forEach'](_0x57f3a6=>{(_0x57f3a6 instanceof AIReviewCheckExtra&&!_0x57f3a6['defaultModel']||_0x57f3a6 instanceof AIReviewCheckCustom&&!_0x57f3a6['models']['length'])&&_0x32ff96['push'](_0x57f3a6['id']);}),_0x32ff96['length']&&_0x32ff96['forEach'](_0x593f84=>{_0x5a596f=_0x5a596f['filter'](_0x5936bd=>_0x5936bd['id']!==_0x593f84);const _0x2cb0ba=new ht('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x593f84});Ct(_0x2cb0ba['message']);}),_0x5a596f;}}class AIRunResult{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x5c25a3){this['_editor']=_0x5c25a3['editor'],this['_rootName']=_0x5c25a3['rootName'],this['_channelId']=_0x5c25a3['channelId'],this['_sessionId']=_0x5c25a3['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'](_0x1f5f94){this['_documentVersion']=_0x1f5f94;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x2d3753){this['_contentRawOld']=_0x2d3753;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0xb19e96){this['_contentRawNew']=_0xb19e96;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x5838c4){this['_error']=_0x5838c4;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x58d029){return _0x58d029['replace'](/ data-id="[a-z0-9]+"/g,'');}}class AIReviewRunResult extends AIRunResult{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x4fd5a3){this['_affectedBlocks']=_0x4fd5a3;}}class AIGateway extends _0x4338bf{static get['pluginName'](){return'AIGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x9b9235,_0x343bd1){if('completed'!==_0x9b9235['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x9b9235['status']});const _0x1881ea=_0x9b9235['editor'];if('suggest'===_0x343bd1&&!_0x1881ea['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x20f27b='suggest'===_0x343bd1,_0x18041e=this['context']['plugins']['get'](_0x4ea419),_0x261ecd=_0x1881ea['model']['createPositionAt'](_0x1881ea['model']['document']['getRoot'](),0x0),_0x360d72=_0x18041e['getDiff'](_0x9b9235['contentRawOld'],_0x9b9235['contentRawNew'],{'anchor':_0x261ecd,'markDeletions':_0x20f27b,'targetEditor':_0x1881ea}),_0x569abe=_0x1881ea['model']['document']['history']['getOperations'](_0x9b9235['documentVersion']),_0x4c1585={'document':_0x1881ea['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x474ea3=_0x1dcb0f(_0x360d72['getOperations'](),_0x569abe,_0x4c1585)['operationsA'];_0x1881ea['model']['change'](_0xdc9e2=>{if(_0x20f27b)_0x1881ea['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x474ea3);else{for(const _0x17fb30 of _0x474ea3)_0x17fb30['baseVersion']=_0x1881ea['model']['document']['version'],Es(_0x1881ea,_0x17fb30),_0xdc9e2['batch']['addOperation'](_0x17fb30),_0x1881ea['model']['applyOperation'](_0x17fb30);}});}['mergeChangesIntoContent'](_0xc17e81,_0x2faafc,_0xd40f4a){const _0xb38928=new AIResponseParser(),_0x249037=new AIResponseApplier();let _0x2bc2dc=_0xb38928['parseAndNormalizeHTML'](_0x2faafc);for(const _0x36a47b of _0xc17e81)try{const _0x494a98=_0xb38928['parseAndNormalizeHTML'](_0x36a47b['content']);_0x2bc2dc=_0x249037['merge'](_0x494a98,_0x2bc2dc,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x50d1cd){throw new ht('ai-gateway-merge-failed',this,{..._0x36a47b},_0x50d1cd);}return os(_0xd40f4a,_0xb38928['parseAndNormalizeHTML'](_0x2faafc),_0x2bc2dc,!0x1,!0x1)['content'];}}class AIReviewGateway extends _0x4338bf{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 _0x4895ae=this['context']['plugins']['get']('AIReviewModeCheckRegistry');return(await _0x4895ae['getChecksList']())['checks']['map'](_0x550f9c=>{const _0x3dc4ee={'id':_0x550f9c['id'],'title':_0x550f9c['title'],'description':_0x550f9c['description']};return'custom'!==_0x550f9c['id']&&_0x550f9c['options']?.['length']&&(_0x3dc4ee['parameters']=_0x550f9c['options'][0x0]['data']['map'](_0x4417ff=>({..._0x4417ff}))),_0x3dc4ee;});}async['getAvailableModels'](){const _0x36e21c=this['context']['plugins']['get']('AIConnector');return new AIModels({'connector':_0x36e21c,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}async['runReview'](_0x4c91a6,_0xfc5a08){return await this['_runReviewCheck'](_0x4c91a6,()=>this['_createReviewCheckRun'](_0x4c91a6,_0xfc5a08?.['parameterId']),_0xfc5a08?.['signal']);}async['runCustomReview'](_0x406d1e,_0x506e68){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x406d1e,_0x506e68?.['model']),_0x506e68?.['signal']);}['applyReview'](_0x2df4e5,_0x224b07){this['context']['plugins']['get']('AIGateway')['apply'](_0x2df4e5,_0x224b07);}async['_runReviewCheck'](_0x122047,_0x5398eb,_0x51ec07){const _0x591963=ms(this['context']),_0x1fce6e=new AIReviewRunResult({'editor':_0x591963,'rootName':_0x591963['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x591963['plugins']['get']('AIEditing')['getSessionId'](_0x591963)});let _0x36dc07,_0x467b52;if(_0x51ec07){if(_0x51ec07['aborted'])return _0x1fce6e['abort'](),_0x1fce6e;const _0x3ad713=()=>{_0x1fce6e['error']||(_0x1fce6e['abort'](),_0x36dc07&&_0x36dc07['abort']());};_0x51ec07['addEventListener']('abort',_0x3ad713),_0x467b52=()=>_0x51ec07['removeEventListener']('abort',_0x3ad713);}try{_0x36dc07=await _0x5398eb(),_0x1fce6e['contentRawOld']=_0x36dc07['documentData']['content'],_0x1fce6e['documentVersion']=Array['from'](_0x36dc07['documentData']['elements'])['find'](([,_0x3ed5a3])=>_0x3ed5a3['rootName']===_0x1fce6e['rootName'])?.[0x1]['documentVersion']??0x1,_0x36dc07['on']('reviewCheckRunUpdated',(_0x1913af,_0x2271e5)=>{'aborted'===_0x2271e5['status']?_0x1fce6e['abort']():'error-general'!==_0x2271e5['status']&&'error-chunk'!==_0x2271e5['status']||(_0x1fce6e['error']=this['_normalizeError'](_0x2271e5['error'],'ai-reviewgateway-review-command-run-failed',{'checkId':_0x122047}));}),'aborted'!==_0x1fce6e['status']&&await _0x36dc07['start']();}catch(_0x592e01){_0x1fce6e['error']=this['_normalizeError'](_0x592e01,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x122047});}finally{_0x467b52&&_0x467b52();}if(!_0x36dc07||'aborted'===_0x1fce6e['status']||'error'===_0x1fce6e['status'])return _0x1fce6e;_0x1fce6e['affectedBlocks']=_0x36dc07['results']['map'](_0x4a2834=>({'id':_0x4a2834['id'],'content':_0x4a2834['contentNew']}));try{_0x1fce6e['contentRawNew']=Ki(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x1fce6e['affectedBlocks'],_0x1fce6e['contentRawOld'],_0x1fce6e['editor']));}catch(_0x144b42){_0x1fce6e['error']=this['_normalizeError'](_0x144b42,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x122047});}return _0x1fce6e;}async['_createReviewCheckRun'](_0x49cd99,_0x4e745c){const _0x44f06e=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x349e65=>_0x349e65['id']===_0x49cd99);if(!_0x44f06e)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x49cd99});if(_0x44f06e instanceof AIReviewCheckCustom)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x49cd99});const _0x13eab4=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x379ebb=this['context']['plugins']['get']('AIConnector');if(_0x44f06e instanceof AIReviewCheckExtra){if(!_0x44f06e['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x49cd99});return new AIReviewExtraCheckRun(_0x44f06e['prompt'],_0x44f06e['defaultModel']['id'],_0x13eab4,_0x44f06e,_0x379ebb);}return new AIReviewSystemCheckRun(_0x13eab4,_0x44f06e,_0x379ebb,_0x4e745c?[_0x4e745c]:void 0x0);}async['_createCustomReviewCheckRun'](_0x57d6f7,_0x5341e4,_0x53cafa){const _0x2a8ee8=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x54e460=>_0x54e460['id']===_0x57d6f7);if(!_0x2a8ee8)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x57d6f7});if(!(_0x2a8ee8 instanceof AIReviewCheckCustom))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x57d6f7});const _0x729c7d=_0x53cafa??_0x2a8ee8['defaultModel']?.['id'];if(!_0x5341e4)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x57d6f7});if(!_0x729c7d)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x57d6f7});return new AIReviewCustomCheckRun(_0x5341e4,_0x729c7d,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x2a8ee8,this['context']['plugins']['get']('AIConnector'));}['_normalizeError'](_0x548a5a,_0x2c6107,_0x3d714c){let _0x2d9737=_0x548a5a;return _0x548a5a instanceof ht||(_0x2d9737=new ht(_0x2c6107,this,_0x3d714c,_0x548a5a)),_0x2d9737;}}class AIReviewMode extends _0x4338bf{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'](_0x31831e,_0x68252a){if(this['assertStartReviewPreconditions'](_0x31831e)instanceof AIReviewCheckCustom)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x31831e});const _0x318d1d=this['context']['plugins']['get']('AIReviewModeController');await _0x318d1d['runCheck']({'id':_0x31831e,'params':_0x68252a?.['parameterId']?[_0x68252a['parameterId']]:void 0x0});}async['startCustomReview'](_0x437e67,_0x28f4f3){if(!_0x437e67)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x4057bb=ir['find'](_0x1450ee=>'custom'===_0x1450ee['commandId'])['id'],_0x5b2a49=this['assertStartReviewPreconditions'](_0x4057bb),_0x426bef=_0x28f4f3?.['model']??_0x5b2a49['defaultModel']?.['id'];if(!_0x426bef)throw new ht('ai-reviewmode-missing-custom-command-model',this);const _0x2e6c48=this['context']['plugins']['get']('AIReviewModeController');await _0x2e6c48['runCheck']({'id':_0x4057bb,'isCustom':!0x0,'args':{'prompt':_0x437e67,'model':_0x426bef}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x4d9207=>{const _0x96b573={'id':_0x4d9207['id'],'title':_0x4d9207['title'],'description':_0x4d9207['description']};return'custom'!==_0x4d9207['id']&&_0x4d9207['options']?.['length']&&(_0x96b573['parameters']=_0x4d9207['options'][0x0]['data']['map'](_0x48f64e=>({..._0x48f64e}))),_0x96b573;});}['assertStartReviewPreconditions'](_0xfd1d4c){const _0x4fdbb5=this['context']['plugins']['get']('AIReviewModeController');if(_0x4fdbb5['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x5ac0a9=_0x4fdbb5['getAvailableChecks']()['find'](_0x49bd92=>_0x49bd92['id']===_0xfd1d4c);if(!_0x5ac0a9)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0xfd1d4c});const _0x57e9e2=this['context']['plugins']['get']('AITabs')['view'];return _0x57e9e2['isVisible']=!0x0,_0x57e9e2['activateTab']('reviewMode'),_0x5ac0a9;}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0x1138be,_0x252f40,_0x3d8a26,_0x1c1790,_0x1c457d,_0x39c06f){super(_0x1138be,_0x252f40,_0x3d8a26,_0x1c457d,_0x39c06f),this['_title']=_0x1c1790;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x41e2b3){this['_checks']=_0x41e2b3['map'](_0x29df98=>new AITranslateCheck(_0x29df98));}}const sr=[{'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(_0x4f704d){super(_0x4f704d),this['context']['config']['define']('ai.translate.languages',sr);}async['_loadChecksList'](){const _0x288a60=[],_0x1bfc23=this['context']['config']['get']('ai.translate.languages')||[];for(const _0xd81359 of _0x1bfc23)_0x288a60['push']({'title':_0xd81359['label'],'id':_0xd81359['id'],'commandId':_0xd81359['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0xd81359['id']}});const _0x2807c6=new AITranslateCheckList();return _0x2807c6['setupChecks'](this['_translateChecks'](_0x288a60)),_0x2807c6;}['_translateChecks'](_0x1b3128){const _0xd970c1=this['context']['locale'];return _0x1b3128['map'](_0x97f449=>{const _0x1f6027='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x97f449['title']['toUpperCase']()['replaceAll']('-','_'),_0x43806b=Mi(_0xd970c1,_0x1f6027);return{..._0x97f449,'title':_0x43806b===_0x1f6027?_0x97f449['title']:_0x43806b};});}}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'](_0x14405b,_0x1b5e58){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x1b5e58,this['_aiConnector'],Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x14405b['params'],_0x14405b['args']);}['_onReviewCheckResultActivated'](_0x5d391c){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x5d391c['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x5d391c['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x30a6c8){this['_currentReviewCheckRun']&&('hover'===_0x30a6c8['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x30a6c8['id'])),'click'===_0x30a6c8['uiInteraction']&&this['_scrollToChange'](_0x30a6c8['id']));}['_onDeactivateChange'](_0x4fffd5){this['_currentReviewCheckRun']&&'panel'===_0x4fffd5['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x1c25e5,_0x181b67){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x181b67['changeId']),this['_scrollToChange'](_0x181b67['changeId']));}['_onChangeMarkerHovered'](_0x2926b3,_0x549a0a){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x549a0a['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x549a0a['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x32a737){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x32a737);}['_markChangePositionInEditorContent'](_0x790ef1,_0x11771f){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x790ef1,_0x11771f);}['_diffContent'](_0x5ab556,_0x4f7488,_0x3d237f){return this['_aiReviewCoreEditing']['diffContent'](_0x5ab556,_0x4f7488,_0x3d237f,!0x0);}['_onReviewCheckRun'](){for(const _0x289c71 of this['_aiReviewCoreEditing']['getEditors']())_0x289c71['editing']['view']['change'](_0x231a84=>{for(const _0x485f5d of _0x289c71['editing']['view']['document']['getRoots']())_0x231a84['addClass']('ck-ai-translate-mode-content',_0x485f5d);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x3f5cfa,_0x13f4d5){super(_0x3f5cfa,_0x13f4d5),this['on']('set:isLoading',(_0x3e7627,_0x1abb82,_0xa7e24d)=>{_0xa7e24d&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x3d5564,_0x193d3d,_0x1db4e6)=>{_0x1db4e6&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x259226=super['_createAcceptAllButtonView']();return _0x259226['set']('label',Mi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x259226;}['_createExitReviewButtonView'](){const _0x42a07f=super['_createExitReviewButtonView']();return _0x42a07f['set']('label',Mi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x42a07f;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0xbebef0=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0xbebef0['if']('isVisible','ck-hidden',_0x575b9a=>!_0x575b9a)]},'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',_0xbebef0['if']('isVisible','ck-hidden',_0x2f6161=>!_0x2f6161)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x73b4e2=this['context']['plugins']['get']('AITabs'),_0x111dc7=this['context']['locale'],_0x1cbafb=new AIHeaderView(_0x111dc7,{'label':Mi(_0x111dc7,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x154751,'class':'ck-ai-header_review-translate','showResizeButton':_0x73b4e2['showResizeButton']});_0x1cbafb['delegate']('resizeTabs')['to'](_0x73b4e2),_0x1cbafb['bind']('isMaximized')['to'](_0x73b4e2['view'],'isMaximized',_0x2109d8=>_0x2109d8);const _0x80205=new AIReviewCoreView(_0x111dc7,{'header':_0x1cbafb,'list':new AITranslateCheckListView(_0x111dc7),'results':new AITranslateCheckResultsView(_0x111dc7,{'generalErrorText':Mi(_0x111dc7,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x111dc7,{'headerText':Mi(_0x111dc7,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Mi(_0x111dc7,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x111dc7,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x80205['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x80205;}['registerTab'](){const _0x19a4a4=this['context']['plugins']['get']('AITabs');_0x19a4a4['view']['on']('activateTab',(_0x1c8468,{newTab:_0x15ca79,oldTab:_0x54806c})=>{'translate'===_0x15ca79?this['fire']('getReviewCheckList'):'translate'===_0x54806c&&this['fire']('leaveReview');}),_0x19a4a4['view']['addTab']({'id':'translate','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x154751,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0x4338bf{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};