@ckeditor/ckeditor5-ai 48.4.0 → 48.5.0-alpha.0

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 (173) hide show
  1. package/dist/aiactions/aiactions.d.ts +2 -2
  2. package/dist/aiactions/model/aiactionsinteraction.d.ts +3 -4
  3. package/dist/aichat/aichatcontroller.d.ts +2 -2
  4. package/dist/aichat/model/aichatcontext.d.ts +9 -8
  5. package/dist/aicore/aiconnector.d.ts +6 -6
  6. package/dist/aicore/aierrorreporter.d.ts +29 -1
  7. package/dist/aicore/aigateway.d.ts +2 -2
  8. package/dist/aicore/model/aicontextref.d.ts +2 -1
  9. package/dist/aicore/utils/geteditorconfig.d.ts +2 -0
  10. package/dist/aicore/utils/getoperationsfordocumentsuggestions.d.ts +4 -4
  11. package/dist/aicore/utils/markoperationsasai.d.ts +2 -4
  12. package/dist/aireviewcore/aireviewcoreediting.d.ts +2 -2
  13. package/dist/aireviewcore/model/aireviewcheckrun.d.ts +2 -2
  14. package/dist/aireviewmode/model/aireviewcustomcheckrun.d.ts +2 -2
  15. package/dist/aisdk/dataidassigner.d.ts +20 -0
  16. package/dist/aisdk/documentchanges.d.ts +165 -0
  17. package/dist/aisdk/documentchangesutils.d.ts +15 -0
  18. package/dist/aisdk/documentcompare.d.ts +171 -0
  19. package/dist/aisdk/documentcompareutils.d.ts +16 -0
  20. package/dist/aisdk/documentsnapshot.d.ts +48 -0
  21. package/dist/aisdk/extractselectionfromhtml.d.ts +27 -0
  22. package/dist/aisdk/validateoperations.d.ts +43 -0
  23. package/dist/aitranslate/model/aitranslatecheckrun.d.ts +2 -2
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.js +19 -19
  26. package/dist/translations/af.js +1 -1
  27. package/dist/translations/af.umd.js +1 -1
  28. package/dist/translations/ar.js +1 -1
  29. package/dist/translations/ar.umd.js +1 -1
  30. package/dist/translations/ast.js +1 -1
  31. package/dist/translations/ast.umd.js +1 -1
  32. package/dist/translations/az.js +1 -1
  33. package/dist/translations/az.umd.js +1 -1
  34. package/dist/translations/be.js +1 -1
  35. package/dist/translations/be.umd.js +1 -1
  36. package/dist/translations/bg.js +1 -1
  37. package/dist/translations/bg.umd.js +1 -1
  38. package/dist/translations/bn.js +1 -1
  39. package/dist/translations/bn.umd.js +1 -1
  40. package/dist/translations/bs.js +1 -1
  41. package/dist/translations/bs.umd.js +1 -1
  42. package/dist/translations/ca.js +1 -1
  43. package/dist/translations/ca.umd.js +1 -1
  44. package/dist/translations/cs.js +1 -1
  45. package/dist/translations/cs.umd.js +1 -1
  46. package/dist/translations/da.js +1 -1
  47. package/dist/translations/da.umd.js +1 -1
  48. package/dist/translations/de-ch.js +1 -1
  49. package/dist/translations/de-ch.umd.js +1 -1
  50. package/dist/translations/de.js +1 -1
  51. package/dist/translations/de.umd.js +1 -1
  52. package/dist/translations/el.js +1 -1
  53. package/dist/translations/el.umd.js +1 -1
  54. package/dist/translations/en-au.js +1 -1
  55. package/dist/translations/en-au.umd.js +1 -1
  56. package/dist/translations/en-gb.js +1 -1
  57. package/dist/translations/en-gb.umd.js +1 -1
  58. package/dist/translations/en.js +1 -1
  59. package/dist/translations/en.umd.js +1 -1
  60. package/dist/translations/eo.js +1 -1
  61. package/dist/translations/eo.umd.js +1 -1
  62. package/dist/translations/es-co.js +1 -1
  63. package/dist/translations/es-co.umd.js +1 -1
  64. package/dist/translations/es.js +1 -1
  65. package/dist/translations/es.umd.js +1 -1
  66. package/dist/translations/et.js +1 -1
  67. package/dist/translations/et.umd.js +1 -1
  68. package/dist/translations/eu.js +1 -1
  69. package/dist/translations/eu.umd.js +1 -1
  70. package/dist/translations/fa.js +1 -1
  71. package/dist/translations/fa.umd.js +1 -1
  72. package/dist/translations/fi.js +1 -1
  73. package/dist/translations/fi.umd.js +1 -1
  74. package/dist/translations/fr.js +1 -1
  75. package/dist/translations/fr.umd.js +1 -1
  76. package/dist/translations/gl.js +1 -1
  77. package/dist/translations/gl.umd.js +1 -1
  78. package/dist/translations/gu.js +1 -1
  79. package/dist/translations/gu.umd.js +1 -1
  80. package/dist/translations/he.js +1 -1
  81. package/dist/translations/he.umd.js +1 -1
  82. package/dist/translations/hi.js +1 -1
  83. package/dist/translations/hi.umd.js +1 -1
  84. package/dist/translations/hr.js +1 -1
  85. package/dist/translations/hr.umd.js +1 -1
  86. package/dist/translations/hu.js +1 -1
  87. package/dist/translations/hu.umd.js +1 -1
  88. package/dist/translations/hy.js +1 -1
  89. package/dist/translations/hy.umd.js +1 -1
  90. package/dist/translations/id.js +1 -1
  91. package/dist/translations/id.umd.js +1 -1
  92. package/dist/translations/it.js +1 -1
  93. package/dist/translations/it.umd.js +1 -1
  94. package/dist/translations/ja.js +1 -1
  95. package/dist/translations/ja.umd.js +1 -1
  96. package/dist/translations/jv.js +1 -1
  97. package/dist/translations/jv.umd.js +1 -1
  98. package/dist/translations/kk.js +1 -1
  99. package/dist/translations/kk.umd.js +1 -1
  100. package/dist/translations/km.js +1 -1
  101. package/dist/translations/km.umd.js +1 -1
  102. package/dist/translations/kn.js +1 -1
  103. package/dist/translations/kn.umd.js +1 -1
  104. package/dist/translations/ko.js +1 -1
  105. package/dist/translations/ko.umd.js +1 -1
  106. package/dist/translations/ku.js +1 -1
  107. package/dist/translations/ku.umd.js +1 -1
  108. package/dist/translations/lt.js +1 -1
  109. package/dist/translations/lt.umd.js +1 -1
  110. package/dist/translations/lv.js +1 -1
  111. package/dist/translations/lv.umd.js +1 -1
  112. package/dist/translations/ms.js +1 -1
  113. package/dist/translations/ms.umd.js +1 -1
  114. package/dist/translations/nb.js +1 -1
  115. package/dist/translations/nb.umd.js +1 -1
  116. package/dist/translations/ne.js +1 -1
  117. package/dist/translations/ne.umd.js +1 -1
  118. package/dist/translations/nl.js +1 -1
  119. package/dist/translations/nl.umd.js +1 -1
  120. package/dist/translations/no.js +1 -1
  121. package/dist/translations/no.umd.js +1 -1
  122. package/dist/translations/oc.js +1 -1
  123. package/dist/translations/oc.umd.js +1 -1
  124. package/dist/translations/pl.js +1 -1
  125. package/dist/translations/pl.umd.js +1 -1
  126. package/dist/translations/pt-br.js +1 -1
  127. package/dist/translations/pt-br.umd.js +1 -1
  128. package/dist/translations/pt.js +1 -1
  129. package/dist/translations/pt.umd.js +1 -1
  130. package/dist/translations/ro.js +1 -1
  131. package/dist/translations/ro.umd.js +1 -1
  132. package/dist/translations/ru.js +1 -1
  133. package/dist/translations/ru.umd.js +1 -1
  134. package/dist/translations/si.js +1 -1
  135. package/dist/translations/si.umd.js +1 -1
  136. package/dist/translations/sk.js +1 -1
  137. package/dist/translations/sk.umd.js +1 -1
  138. package/dist/translations/sl.js +1 -1
  139. package/dist/translations/sl.umd.js +1 -1
  140. package/dist/translations/sq.js +1 -1
  141. package/dist/translations/sq.umd.js +1 -1
  142. package/dist/translations/sr-latn.js +1 -1
  143. package/dist/translations/sr-latn.umd.js +1 -1
  144. package/dist/translations/sr.js +1 -1
  145. package/dist/translations/sr.umd.js +1 -1
  146. package/dist/translations/sv.js +1 -1
  147. package/dist/translations/sv.umd.js +1 -1
  148. package/dist/translations/th.js +1 -1
  149. package/dist/translations/th.umd.js +1 -1
  150. package/dist/translations/ti.js +1 -1
  151. package/dist/translations/ti.umd.js +1 -1
  152. package/dist/translations/tk.js +1 -1
  153. package/dist/translations/tk.umd.js +1 -1
  154. package/dist/translations/tr.js +1 -1
  155. package/dist/translations/tr.umd.js +1 -1
  156. package/dist/translations/tt.js +1 -1
  157. package/dist/translations/tt.umd.js +1 -1
  158. package/dist/translations/ug.js +1 -1
  159. package/dist/translations/ug.umd.js +1 -1
  160. package/dist/translations/uk.js +1 -1
  161. package/dist/translations/uk.umd.js +1 -1
  162. package/dist/translations/ur.js +1 -1
  163. package/dist/translations/ur.umd.js +1 -1
  164. package/dist/translations/uz.js +1 -1
  165. package/dist/translations/uz.umd.js +1 -1
  166. package/dist/translations/vi.js +1 -1
  167. package/dist/translations/vi.umd.js +1 -1
  168. package/dist/translations/zh-cn.js +1 -1
  169. package/dist/translations/zh-cn.umd.js +1 -1
  170. package/dist/translations/zh.js +1 -1
  171. package/dist/translations/zh.umd.js +1 -1
  172. package/package.json +30 -29
  173. package/dist/aicore/utils/tocontextrefrequestdata.d.ts +0 -1
package/dist/index.js CHANGED
@@ -20,22 +20,22 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Command as _0x426681,ContextPlugin as _0x45fe7d,Editor as _0x5c73d5,Plugin as _0x31535a,rootAcceptsBlocks as _0x1d1635}from'@ckeditor/ckeditor5-core';import{IconAI as _0x5aedd4,IconAIAdjustLength as _0x50c465,IconAIAskAI as _0x100f7b,IconAIChangeTone as _0x3bd80d,IconAIChat as _0x55e1ac,IconAIChatCommands as _0x5a9a65,IconAIContinueWriting as _0x2fa747,IconAIGrammarCheck as _0x2cf474,IconAIHistory as _0x156574,IconAIImproveWriting as _0x5ba3cf,IconAIOther as _0x55d41e,IconAIQuickActions as _0x3c7204,IconAIReview as _0x308ecc,IconAITranslate as _0x616488,IconBoxWithCheck as _0x46d8d6,IconBoxWithCross as _0x5a5da8,IconBoxWithMarker as _0x141a3c,IconBrowseFiles as _0x12e5f0,IconBulb as _0x5eeff8,IconCancel as _0x591646,IconCheck as _0x11611b,IconChevronDown as _0x474bea,IconChevronRight as _0x1c3a57,IconChevronUp as _0x577615,IconCopy as _0x356e25,IconDocument as _0x36b436,IconDocumentOutline as _0x5133a4,IconDropdownArrow as _0x630c7e,IconError as _0x1d62af,IconEye as _0x3eec7b,IconEyeCrossedOut as _0x4b0353,IconFileUpload as _0x118543,IconImage as _0x3b675d,IconInfo as _0x20e75b,IconLink as _0x305afd,IconLoupe as _0x3cc163,IconMagicWand as _0x4c3ba0,IconMaximize as _0x13f65e,IconMinimize as _0x5e937b,IconNextArrow as _0x5aa540,IconOutdated as _0xe7e212,IconPaperClip as _0x52ed99,IconPin as _0x185fef,IconPlus as _0xd49c1e,IconPreviousArrow as _0x406e30,IconRefresh as _0x3a355c,IconRevisionHistory as _0x431939,IconRobotPencil as _0x79e364,IconSelection as tt,IconShowChangesOff as et,IconShowChangesOn as it,IconStop as st,IconSubmit as nt,IconThreeHorizontalDots as rt,IconThumbDown as ot,IconThumbUp as at,IconWeb as ht}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ct,Collection as lt,DomEmitterMixin as ut,EmitterMixin as dt,FocusTracker as _t,KeystrokeHandler as gt,ObservableMixin as At,Rect as It,ResizeObserver as pt,_isMotionReduced as Et,decodeLicenseKey as mt,first as Tt,getConstrainedViewportRect as wt,global as Ct,insertToPriorityArray as ft,isFeatureBlockedByLicenseKey as bt,isVisible as St,logError as Rt,logWarning as Ot,scrollAncestorsToShowTarget as vt,scrollViewportToShowTarget as kt,toArray as yt,uid as Nt,version as xt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Lt,BalloonPanelView as Pt,BalloonToolbar as Dt,BodyCollection as Ht,ButtonLabelView as Mt,ButtonLabelWithHighlightView as Ut,ButtonView as Vt,Dialog as Bt,DialogViewPosition as Gt,DropdownMenuPanelPositioningFunctions as Ft,FileDialogButtonView as Kt,FocusCycler as Wt,FormHeaderView as Yt,FormRowView as $t,HighlightedTextView as qt,IconView as Qt,InputTextView as Xt,LabeledFieldView as zt,ListItemButtonView as jt,ListItemGroupView as Jt,ListItemView as Zt,ListView as te,MenuBarMenuListItemButtonView as _0xe556ab,MenuBarMenuListItemView as _0x589943,MenuBarMenuListView as _0x25f0ce,MenuBarMenuView as _0x45d7de,SearchTextView as _0x2cb476,SpinnerView as _0x1224fa,Template as _0x120a21,TextareaView as _0x572ca5,ToolbarView as _0x4a1d9b,UIModel as _0x50627c,View as _0x4f75f8,ViewCollection as _0x340edf,addListToDropdown as _0x5ccc98,addMenuToDropdown as _0x1c4dd7,clickOutsideHandler as _0x1a4c41,createDropdown as _0x5c62d3,createLabeledInputText as _0x3e888c,createLabeledTextarea as _0x11a29a,submitHandler as _0x510cd9}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x5ad979,ClipboardPipeline as _0x228c48}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0xb0469,MarkerOperation as _0x1122b4,Matcher as _0x31e73c,ModelDocumentFragment as _0x58f66a,ModelPosition as _0x159a64,ModelRange as _0x2be128,ModelTreeWalker as _0x362d3b,ViewDataTransfer as _0x1a05c3,ViewDocumentDomEventData as _0x26c07d,ViewDowncastWriter as _0x353d59,ViewUpcastWriter as _0x51111b,_DetachOperation as _0x4374a5,_insertIntoModelNodeList as _0x10acb9,_removeFromModelNodeList as _0x46a587,transformOperationSets as _0x400478}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x4f5d65,debounce as _0xce404c,escape as _0x34b9ac,escapeRegExp as _0x922d45,omit as _0x50b2c9,throttle as _0x38ba6d,unescape as _0x541c83}from'es-toolkit/compat';import{createParser as _0xeb522d}from'eventsource-parser';import{CloudServices as _0x2c3df2}from'@ckeditor/ckeditor5-cloud-services';import{parseDocument as _0x4aaf38}from'htmlparser2';import{append as _0x633a95,appendChild as _0x30ab63,find as _0x3cf4b1,findAll as _0x1b7e15,findOne as _0x11f9ef,getChildren as _0x59f4e5,getParent as _0x1e8dd2,isComment as ti,isTag as _0x3b00a1,prepend as _0x200678,prependChild as _0xbccd04,removeElement as _0x147247,replaceElement as _0x54b98e,textContent as _0x317deb}from'domutils';import _0x3395d0 from'dom-serializer';import{Document as _0x59229a,Element as _0x484959,NodeWithChildren as _0x4a0076,Text as _0x1ced06,cloneNode as _0x3717a9,isDocument as _0x450ec6,isText as _0x3ed223}from'domhandler';import{ConfirmMixin as _0x1a5634,DATA_ID_MODEL_ATTRIBUTE as _0x4eb302,DATA_ID_VIEW_ATTRIBUTE as _0x35bb41,DocumentCompare as _0x4eecd6,PillView as _0x5b131e,SuggestionsConversion as _0xb43a06,fixElementSuggestionRange as _0x2ae50f,getAllMarkersDomElementsSorted as _0x5bfa90,getMarkerDomElement as _0x53cb27,isInvalidAttributeOperation as _0xb8d6ce}from'@ckeditor/ckeditor5-collaboration-core';import{MarkdownGfmMdToHtml as _0xc30a1d,MarkdownGfmMdToHtmlDefaultPlugins as _0x46113c}from'@ckeditor/ckeditor5-markdown-gfm';import _0x3212e6 from'rehype-sanitize';import _0x4b13e9 from'morphdom';import{diffArrays as _0x4a1d6a}from'diff';const yi='_ungrouppedCommands';function Ni(_0x30c37a,_0x3a18d7){const _0x1c579d=(0x0,_0x3a18d7['t'])('Other');return _0x30c37a['length']?'groupId'in _0x30c37a[0x0]?_0x30c37a:[{'groupId':yi,'groupLabel':_0x1c579d,'order':0x1/0x0,'commands':_0x30c37a}]:[{'groupId':yi,'groupLabel':_0x1c579d,'order':0x1/0x0,'commands':[]}];}const xi=globalThis['DataTransfer'],Li='ai-ui';var Pi=class extends _0x31535a{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x43b1b3}=this,_0x38b0f7=['ck-fake-ai-selection'];_0x43b1b3['config']['get']('ai.assistant.useTheme')&&_0x38b0f7['push']('ck-ai-assistant-ui_theme'),_0x43b1b3['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Li,'view':{'classes':_0x38b0f7,'priority':0xc}}),_0x43b1b3['conversion']['for']('editingDowncast')['markerToElement']({'model':Li,'view':(_0x4f7338,{writer:_0x531d4a})=>{if(!_0x4f7338['markerRange']['isCollapsed'])return null;const _0x52d525=_0x531d4a['createUIElement']('span');return _0x531d4a['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x52d525),_0x52d525;}});}afterInit(){this['_blockIfRemovedByLicenseKey'](),async function(_0x4e115d){const _0x21dbf6='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x50b45b=0x791d0,_0x25d38f=window['Date']['now'](),_0x3f8e47=_0x4e115d['editor'],_0x24a757=new window['Promise'](_0x40d018=>{_0x3f8e47['once']('ready',_0x40d018);}),_0x5ee452={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x175904=_0x3f8e47['config']['get']('licenseKey');async function _0x7614eb(){let _0x2934bf,_0x326bff=null,_0x49d238=null;try{return'GPL'==_0x175904?'NotAllowed':(_0x2934bf=_0x39e4cc(),_0x2934bf?(_0x2934bf['usageEndpoint']&&(_0x49d238=_0x20c876(_0x2934bf['usageEndpoint'],_0x2934bf['jti'])),await _0x238161()?_0x6207f6()?_0x12b6c1()?'Expired':_0x3335dd()?('evaluation'==_0x2934bf['licenseType']&&(_0x326bff=_0x4a5bed('EvaluationLimit')),await _0x2f80e2()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x12b6c1(){const _0x519a0c=['evaluation','trial']['includes'](_0x2934bf['licenseType'])?_0x25d38f/0x3e8:0xe10*_0x50b45b;return _0x2934bf['exp']<_0x519a0c;}function _0x6207f6(){const _0x1a81ad=_0x2934bf['features'];return!!_0x1a81ad&&(!!_0x1a81ad['includes']('*')||!!_0x1a81ad['includes']('AI'));}function _0x3335dd(){const _0x266840=_0x2934bf['licensedHosts'];if(!_0x266840||0x0==_0x266840['length'])return!0x0;const {hostname:_0x1df5fb}=new URL(window['location']['href']);if(_0x266840['includes'](_0x1df5fb))return!0x0;const _0x3a8310=_0x1df5fb['split']('.');return _0x266840['filter'](_0x5d99d1=>_0x5d99d1['includes']('*'))['map'](_0x23adfa=>_0x23adfa['split']('.'))['filter'](_0x3d5eaf=>_0x3d5eaf['length']<=_0x3a8310['length'])['map'](_0x5aa53e=>Array(_0x3a8310['length']-_0x5aa53e['length'])['fill']('*'===_0x5aa53e[0x0]?'*':'')['concat'](_0x5aa53e))['some'](_0x5f4a23=>_0x3a8310['every']((_0x3254d3,_0x2c864d)=>_0x5f4a23[_0x2c864d]===_0x3254d3||'*'===_0x5f4a23[_0x2c864d]));}function _0x2f80e2(){return _0x326bff&&_0x49d238?new window['Promise']((_0x4e2931,_0xcd137f)=>{_0x326bff['then'](_0x4e2931,_0xcd137f),_0x49d238['then'](_0x29565e=>{'Valid'!=_0x29565e&&_0x4e2931(_0x29565e);},_0xcd137f);}):_0x326bff||_0x49d238||'Valid';}}function _0x20c876(_0x2ce097,_0x3731cc){return new window['Promise'](_0x3c8615=>{if(_0x3328a9())return _0x3c8615('Valid');_0x35c8d3(),_0x3f8e47['decorate']('_sendUsageRequest');let _0x157d4e=!0x1;const _0x3a4ce0=Nt();function _0x533079(_0x34849b){return!!_0x34849b&&('object'==typeof _0x34849b||'function'==typeof _0x34849b)&&'function'==typeof _0x34849b['then']&&'function'==typeof _0x34849b['catch'];}function _0x25b1dd(_0x4ba5eb){_0x346b44(_0x4ba5eb)['then'](_0x39ea61=>_0x39ea61&&'ok'==_0x39ea61['status']?_0x4ab84d(_0x397d87(_0x3a4ce0+_0x3731cc))!=_0x39ea61['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x129648=>(_0x838168(),_0x129648),()=>{const _0x32ca66=_0x191ffc();return null==_0x32ca66?(_0x838168(),'Valid'):_0x25d38f-_0x32ca66>0x240c8400?'UsageLimit':'Valid';})['then'](_0x3c8615)['catch'](()=>{_0x3c8615('UsageLimit');});const _0x3a787f=0x36ee80;function _0x838168(){const _0x2c54cc='llct-'+_0x4ab84d(_0x397d87(_0x2ce097)),_0x53e11d=_0x4349ef(_0x4ab84d(window['Math']['ceil'](_0x25d38f/_0x3a787f)));window['localStorage']['setItem'](_0x2c54cc,_0x53e11d);}function _0x191ffc(){const _0x10250f='llct-'+_0x4ab84d(_0x397d87(_0x2ce097)),_0x236f4a=window['localStorage']['getItem'](_0x10250f);return _0x236f4a?window['parseInt'](_0x4349ef(_0x236f4a),0x10)*_0x3a787f:null;}function _0x346b44(_0x1d295f){return new window['Promise']((_0x2753c3,_0x51d6c6)=>{_0x1d295f['then'](_0x2753c3,_0x51d6c6),window['setTimeout'](_0x51d6c6,0x1d4c0);});}}_0x3f8e47['on']('_sendUsageRequest',(_0x2ab00d,_0x509e2a)=>{if(_0x509e2a[0x0]!=_0x2ce097)return _0x3c8615('UsageLimit');_0x509e2a[0x1]={..._0x509e2a[0x1],'requestId':_0x3a4ce0};},{'priority':'high'}),_0x3f8e47['on']('_sendUsageRequest',_0x14db2f=>{_0x533079(_0x14db2f['return'])&&(_0x157d4e=!0x0,_0x25b1dd(_0x14db2f['return']));},{'priority':'low'}),_0x24a757['then'](()=>{_0x157d4e||_0x3c8615('UsageLimit');});});function _0x3328a9(){return'auto'==_0x3f8e47['editing']['view']['_overlayModeHint'];}function _0x35c8d3(){_0x3f8e47['editing']['view']['_overlayModeHint']='auto';}}function _0x4a5bed(_0x338172){const _0x426b67=[new window['Promise'](_0x3ed517=>setTimeout(_0x3ed517,0x93ecc)),_0x24a757['then'](()=>new window['Promise'](_0x150a4e=>{let _0x373206=0x0;_0x3f8e47['model']['on']('applyOperation',(_0x541c0d,_0x4bad3e)=>{_0x4bad3e[0x0]['isDocumentOperation']&&_0x373206++,0x5e8==_0x373206&&(_0x150a4e(),_0x541c0d['off']());});}))];return window['Promise']['race'](_0x426b67)['then'](()=>_0x338172);}async function _0x6fe5dd(){await _0x24a757,_0x3f8e47['model']['change']=_0x2db523,_0x3f8e47['model']['enqueueChange']=_0x2db523,_0x3f8e47['enableReadOnlyMode']('model');}function _0x66f6b0(_0x22827d){const _0x551f5c=_0x2af5f3();_0x3f8e47[_0x551f5c]='aiLicenseKey'+_0x22827d,'Valid'!=_0x22827d&&_0x6fe5dd();}function _0x2af5f3(){const _0x11e965=window['String'](window['performance']['now']())['replace']('.','');let _0x5e55bd='n';for(let _0x17ee17=0x0;_0x17ee17<_0x11e965['length'];_0x17ee17+=0x2){let _0x3323f6=window['parseInt'](_0x11e965['substring'](_0x17ee17,_0x17ee17+0x2));_0x3323f6>=0x3e&&(_0x3323f6-=0x3e),_0x5e55bd+=_0x21dbf6[_0x3323f6];}return _0x5e55bd;}function _0x39e4cc(){const _0x4c9f89=_0x175904['split']('.');if(0x3!=_0x4c9f89['length'])return null;return _0x4e7a51(_0x4c9f89[0x1]);function _0x4e7a51(_0x4261cf){const _0x46c9b7=_0x40c8cb(_0x4261cf);return _0x46c9b7&&_0x426192()?_0x46c9b7:null;function _0x426192(){const _0x227122=_0x46c9b7['jti'],_0x477f8c=window['parseInt'](_0x227122['substring'](_0x227122['length']-0x8),0x10),_0x5ac218={..._0x46c9b7,'jti':_0x227122['substring'](0x0,_0x227122['length']-0x8)};return delete _0x5ac218['vc'],_0x397d87(_0x5ac218)==_0x477f8c;}}}async function _0x238161(){let _0x17aa34=!0x0;try{const [_0x46527b,_0x36791b,_0xc4dd89]=_0x175904['split']('.');return _0x3f9d57(_0x46527b),await _0x18f7d9(_0x46527b,_0x36791b,_0xc4dd89),_0x17aa34;}catch{return!0x1;}function _0x3f9d57(_0x33021b){const _0x40b691=_0x40c8cb(_0x33021b);_0x40b691&&'ES256'==_0x40b691['alg']||(_0x17aa34=!0x1);}async function _0x18f7d9(_0x3b8fca,_0x2e8763,_0x46a3c6){const _0x3de109=window['Uint8Array']['from'](_0x5c2d01(_0x46a3c6),_0x26366a=>_0x26366a['charCodeAt'](0x0)),_0x3a6112=new window['TextEncoder']()['encode'](_0x3b8fca+'.'+_0x2e8763),_0x212577=window['crypto']['subtle'];if(!_0x212577)return;const _0x59d389=await _0x212577['importKey']('jwk',_0x5ee452,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x212577['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x59d389,_0x3de109,_0x3a6112)||(_0x17aa34=!0x1);}}function _0x40c8cb(_0x15b3a6){return _0x15b3a6['startsWith']('ey')?JSON['parse'](_0x5c2d01(_0x15b3a6)):null;}function _0x5c2d01(_0x386eb3){return window['atob'](_0x386eb3['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x397d87(_0x27e7a5){let _0x6f30e3=0x1505;function _0x3ac395(_0x29d07e){for(let _0xe30d68=0x0;_0xe30d68<_0x29d07e['length'];_0xe30d68++){const _0x38f677=_0x29d07e['charCodeAt'](_0xe30d68);_0x6f30e3=(_0x6f30e3<<0x5)+_0x6f30e3+_0x38f677,_0x6f30e3&=_0x6f30e3;}}function _0x34aaaf(_0x5a3771){Array['isArray'](_0x5a3771)?_0x5a3771['forEach'](_0x34aaaf):_0x5a3771&&'object'==typeof _0x5a3771?Object['entries'](_0x5a3771)['sort']()['forEach'](([_0x21f0aa,_0x4ecbb5])=>{_0x3ac395(_0x21f0aa),_0x34aaaf(_0x4ecbb5);}):_0x3ac395(window['String'](_0x5a3771));}return _0x34aaaf(_0x27e7a5),_0x6f30e3>>>0x0;}function _0x4ab84d(_0x5c3481){return _0x5c3481['toString'](0x10)['padStart'](0x8,'0');}function _0x4349ef(_0x4c0482){return _0x4c0482['split']('')['reverse']()['join']('');}function _0x2db523(){}_0x66f6b0(await _0x7614eb());}(this);}['_blockIfRemovedByLicenseKey'](){const _0x42315b=this['editor'],_0x1f0583=mt(_0x42315b['config']['get']('licenseKey'));_0x1f0583&&bt(_0x1f0583,'AI')&&(_0x42315b['enableReadOnlyMode'](Symbol('invalidLicense')),_0x42315b['_showLicenseError']('featureNotAllowed','AIAssistant'));}showFakeVisualSelection(){const _0x17576c=this['editor']['model'];_0x17576c['change'](_0x8f6c19=>{const _0x1b95c7=_0x17576c['document']['selection']['getRanges']();let _0x52abed=0x0;for(const _0x3af1cb of _0x1b95c7){const _0x1775fb=Li+':'+_0x52abed;if(_0x17576c['markers']['has'](_0x1775fb))_0x8f6c19['updateMarker'](_0x1775fb,{'range':_0x3af1cb});else{if(_0x3af1cb['start']['isAtEnd']){const _0x39b1da=_0x3af1cb['start']['getLastMatchingPosition'](({item:_0x34f62a})=>!_0x17576c['schema']['isContent'](_0x34f62a),{'boundaries':_0x3af1cb});_0x8f6c19['addMarker'](_0x1775fb,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x8f6c19['createRange'](_0x39b1da,_0x3af1cb['end'])});}else _0x8f6c19['addMarker'](_0x1775fb,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3af1cb});}_0x52abed++;}});}hideFakeVisualSelection(){const _0x1ae44a=this['editor']['model'],_0x4990d9=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Li));_0x4990d9['length']&&_0x1ae44a['change'](_0x5ec0dc=>{_0x4990d9['forEach'](_0x3aba34=>{_0x5ec0dc['removeMarker'](_0x3aba34);});});}insertContent(_0x1907c7,_0x4648c5){const _0x1c3409=this['_getAISelection'](),_0x2d1d13=_0x4648c5||_0x1c3409['getFirstRange']();this['editor']['model']['canEditAt'](_0x2d1d13)&&this['editor']['model']['change'](_0x477dc6=>{this['hideFakeVisualSelection'](),_0x4648c5||this['_resetContentOfSelectedTableCells'](_0x477dc6,_0x1c3409),this['_pasteHTMLUsingClipboard']({'insertAt':_0x2d1d13,'writer':_0x477dc6,'html':_0x1907c7});});}insertContentBelow(_0xd2faa9){const {model:_0x4d9d1e}=this['editor'],_0x2df58f=this['_getAISelection']();_0x4d9d1e['change'](()=>{const _0x3992df=this['_prepareTableInsertBelowPosition'](_0xd2faa9,_0x2df58f)||this['_getDefaultInsertBelowPosition'](_0x2df58f);this['insertContent'](_0xd2faa9,_0x3992df);});}_getAISelection(){const _0x495b53=this['editor']['model'],_0x3cfee5=Array['from'](_0x495b53['markers']['getMarkersGroup'](Li))['map'](_0x16452e=>_0x16452e['getRange']());return _0x495b53['createSelection'](_0x3cfee5);}_pasteHTMLUsingClipboard({writer:_0xc57a6c,html:_0x1e4a45,insertAt:_0x59e408}){const {view:_0x526989}=this['editor']['editing'],_0x5430f8=this['editor']['plugins']['get'](_0x228c48),_0x50ab70=new xi();_0x50ab70['setData']('text/html',_0x1e4a45);const _0x1f8d81=new _0x26c07d(_0x526989,new ClipboardEvent('paste',{'clipboardData':_0x50ab70}),{'dataTransfer':new _0x1a05c3(_0x50ab70)});_0xc57a6c['setSelection'](_0x59e408);const _0x7e84fb=(_0x17bd57,_0x58a13d)=>{_0x58a13d['resultRange']&&_0xc57a6c['setSelection'](_0x58a13d['resultRange']);};_0x5430f8['once']('contentInsertion',_0x7e84fb,{'priority':'lowest'}),_0x526989['document']['fire']('paste',_0x1f8d81),_0x5430f8['off']('contentInsertion',_0x7e84fb);}_getDefaultInsertBelowPosition(_0x2c4f04){const {model:_0x558849}=this['editor'],_0x5c23dd=Array['from'](_0x2c4f04['getSelectedBlocks']());return _0x5c23dd['length']?_0x558849['createPositionAfter'](_0x5c23dd['pop']()):_0x2c4f04['getLastPosition']();}_prepareTableInsertBelowPosition(_0x33989f,_0x36127f){const {model:_0x2afbf5,plugins:_0x3bcf33}=this['editor'];if(_0x3bcf33['has']('TableUtils')){const _0xa447a6=_0x3bcf33['get']('TableUtils')['getSelectedTableCells'](_0x36127f);if(_0xa447a6['length']){const _0x598c91=this['_getTableRowCountFromContent'](_0x33989f),_0x34782d=this['_createEmptyTableRows'](_0xa447a6,_0x598c91);return _0x2afbf5['createPositionAt'](_0x34782d,0x0);}}return null;}_getTableRowCountFromContent(_0x22d439){const _0x579d4d=this['editor']['plugins']['get']('TableUtils'),_0x423913=this['editor']['data']['parse'](_0x22d439,'$documentFragment'),_0x2fb90b=Array['from'](_0x423913['getChildren']())['filter'](_0x413ea4=>_0x413ea4['is']('element','table'));let _0x34a0ca=0x0;return _0x2fb90b['forEach'](_0x1f87b9=>{_0x34a0ca+=_0x579d4d['getRows'](_0x1f87b9);}),_0x34a0ca;}_createEmptyTableRows(_0x16bf43,_0x1e7534){const _0x5dc759=this['editor']['plugins']['get']('TableUtils'),_0x216756=_0x5dc759['getRowIndexes'](_0x16bf43),_0x55a136=_0x5dc759['getColumnIndexes'](_0x16bf43),_0x4cfc36=_0x216756['last']+0x1,_0x324bd4=_0x55a136['first'],_0x240b34=_0x16bf43[0x0]['findAncestor']('table');for(let _0x5bf00a=0x0;_0x5bf00a<_0x1e7534;_0x5bf00a++)_0x5dc759['insertRows'](_0x240b34,{'at':_0x4cfc36});return _0x240b34['getChild'](_0x4cfc36)['getChild'](_0x324bd4);}_resetContentOfSelectedTableCells(_0x1fdafd,_0x44c8e8){const {plugins:_0x5b3255}=this['editor'],{model:_0x738706}=_0x1fdafd;_0x5b3255['has']('TableUtils')&&_0x5b3255['get']('TableUtils')['getSelectedTableCells'](_0x44c8e8)['length']&&_0x738706['deleteContent'](_0x44c8e8);}},Di=class extends _0x31535a{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}afterInit(){if(!this['textAdapter'])throw new ct('aiadapter-text-adapter-not-set',null);}},Hi=class extends Error{constructor(_0xe49673){super(_0xe49673),this['name']='AIRequestError';}};function Mi(_0x1876bd,_0xe25c0,_0x50caff){const t=_0x1876bd['t'];switch(_0xe25c0){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',_0x50caff);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x50caff);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'},_0x50caff);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 _0xe25c0;}}var Ui=class extends _0x426681{_commandDefinitions;constructor(_0x39ff14,_0x1b30ce){super(_0x39ff14),this['_commandDefinitions']=_0x1b30ce,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0xa72cba,_0x1e1716,_0x255b95)=>{this['isEnabled']&&(this['enabledCommandsIds']=Vi(this['_commandDefinitions'],_0x255b95));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x3f3438,_0x15529c,_0x10f049)=>{this['enabledCommandsIds']=_0x10f049?Vi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x411647=this['editor']['model'];this['_hasContext']=function(_0x2ea159){const _0x182918=_0x2ea159['document']['selection'];return _0x182918['isCollapsed']?0x0!==[..._0x182918['getSelectedBlocks']()]['length']&&![..._0x182918['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x2ea159['hasContent'](_0x182918['getFirstRange']());}(_0x411647);const _0x2f6c28=_0x411647['document']['selection'],_0x23ecb8=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x1569e6 of _0x2f6c28['getRanges']())for(const _0x19e439 of _0x1569e6['getItems']())if(_0x19e439['is']('element')&&_0x23ecb8['includes'](_0x19e439['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}execute(_0x4ae00c='',_0x136bde='',_0x3ea76c='custom'){this['editor']['plugins']['get'](is)['showUI'](_0x4ae00c,_0x136bde,_0x3ea76c);}};function Vi(_0xa94431,_0x4b328e){const _0xbd7a70=new Set();for(const _0x5a81ff of _0xa94431['values']())(_0x4b328e||!0x1===_0x5a81ff['requiresContent'])&&_0xbd7a70['add'](_0x5a81ff['id']);return Array['from'](_0xbd7a70);}const Bi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Gi=/* #__PURE__ -- @preserve */
24
- At();var Fi=class extends Gi{editor;textAdapter;['view'];_sanitizationContainer;['_domParser'];['_xmlSerializer'];constructor(_0x3741c1,_0x3bab81,_0x3c226b){super(),this['editor']=_0x3741c1,this['textAdapter']=_0x3bab81,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x3c226b,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x5c0b4f,_0x2f9236,_0x47871c)=>{this['view']['value']=this['_sanitizeHTML'](_0x47871c);}),this['listenTo'](this['view'],'submitPrompt',(_0x591b39,_0x22bca3)=>{const _0x341f0b=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x22bca3,_0x341f0b,'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:_0x8b61ef,query:_0x8f32ca,htmlContent:_0x36b5e8,label:_0xd7b296,mainActionLabel:_0x1dc641}){this['view']['prompt']=_0xd7b296,this['view']['mainAction']=_0x1dc641,this['initialContext']=_0x36b5e8,_0x8f32ca&&(this['view']['isRendered']?this['_handleQuery'](_0x8f32ca,_0x36b5e8,_0x8b61ef,_0xd7b296):this['view']['once']('render',()=>{this['_handleQuery'](_0x8f32ca,_0x36b5e8,_0x8b61ef,_0xd7b296);}));}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'](_0x46aea0,_0x7710c9,_0x7e77ec,_0x4a3b09){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x7710c9,this['previousQuery']=_0x46aea0,this['previousLabel']=_0x4a3b09||_0x46aea0,this['previousActionId']=_0x7e77ec,new Promise(_0x6c2061=>{this['textAdapter']['makeRequest']({'query':_0x46aea0,'context':_0x7710c9,'onData':_0x115a95=>{this['currentResponse']=_0x115a95,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x7e77ec})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x451799=>{_0x451799 instanceof Hi?this['view']['handleError'](_0x451799['message']):this['view']['handleError'](),_0x6c2061();})['finally'](()=>{this['stopProcessing'](),_0x6c2061();});});}_parseAndNormalizeContent(_0x2eddad,_0x31bcdc=!0x1){const _0x485421=Bi['exec'](_0x2eddad);_0x2eddad=_0x485421?_0x2eddad['substring'](_0x485421[0x1]['length']):_0x2eddad['length']<0x64&&!_0x31bcdc?'':this['_stripMarkdownSyntax'](_0x2eddad);const _0x227d01=this['_domParser']['parseFromString'](_0x2eddad,'text/html');if(_0x485421){const _0x373c82=Array['from'](_0x227d01['body']['childNodes']);_0x373c82['reverse']();for(const _0x4a1237 of _0x373c82){if(_0x4a1237['nodeType']==Node['ELEMENT_NODE'])break;_0x4a1237['remove']();}}const _0x50c8bb=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x227d01['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x50c8bb);const _0x305911=this['editor']['config']['get']('ai.assistant.preserveComments'),_0xe9022a=this['editor']['data']['toModel'](_0x50c8bb);return _0x305911||_0xe9022a['markers']['clear'](),this['editor']['data']['stringify'](_0xe9022a);}['_normalizeResponseHeadings'](_0x60b7a8){const _0x4ba0f1=new _0x51111b(this['editor']['editing']['view']['document']),_0x59debd=new _0x31e73c({'name':/^h[1-5]$/}),_0x21bdb4=[];let _0x47096f=!0x1;for(const _0x1b06e4 of _0x60b7a8)_0x1b06e4['is']('element')&&_0x59debd['match'](_0x1b06e4)&&(_0x21bdb4['push'](_0x1b06e4),'h1'==_0x1b06e4['name']&&(_0x47096f=!0x0));if(_0x47096f){for(const _0x1afa95 of _0x21bdb4)_0x4ba0f1['rename']('h'+(parseInt(_0x1afa95['name'][0x1])+0x1),_0x1afa95);}}_isH1TagSupportEnabled(){const {data:_0x1e20b4,editing:_0x1865e0}=this['editor'],_0x3d9f77=_0x1e20b4['htmlProcessor']['toView']('<h1></h1>'),_0x78c5a4=_0x1e20b4['toView'](_0x1e20b4['toModel'](_0x3d9f77));return!!_0x1865e0['view']['domConverter']['viewToDom'](_0x78c5a4)['querySelector']('h1');}_sanitizeHTML(_0x266ada){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x266ada),this['_sanitizationContainer']['innerHTML'];}_stripMarkdownSyntax(_0x610fe5){const _0x11fc0d=_0x610fe5['trim']();return _0x11fc0d['startsWith']('```html')?_0x11fc0d['endsWith']('```')?_0x11fc0d['substring'](0x7,_0x11fc0d['length']-0x3):_0x11fc0d['substring'](0x7):_0x610fe5;}};const Ki={'REPLACE':'replace','INSERT':'insert'};var Wi=class extends _0x4a1d9b{constructor(_0x1256e6){super(_0x1256e6),this['set']('isVisible',!0x1),this['set']('mainAction',Ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x377b46=>Mi(_0x1256e6,'AI_'+_0x377b46['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Mi(_0x1256e6,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Mi(_0x1256e6,'Try\x20again')),this['stopButton']=this['_createButton'](Mi(_0x1256e6,'Stop'));const _0x94dc33=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x94dc33['if']('isVisible','ck-hidden',_0x2223e3=>!_0x2223e3)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}_createButton(_0x1bb000,_0x4542bd){const _0x1a4258=new Vt(this['locale']);return _0x1a4258['set']({'label':_0x1bb000,'class':_0x4542bd||'','isVisible':!0x0,'withText':!0x0}),_0x1a4258;}},Yi=class extends _0x4f75f8{contentFieldView;copyButtonView;constructor(_0x189035,_0x2c2e7c=''){super(_0x189035),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x1da34c=this['bindTemplate'];this['contentFieldView']=new $i(_0x189035,_0x2c2e7c),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x1da34c['if']('isVisible','ck-hidden',_0x2416e0=>!_0x2416e0)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x1da34c['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 _0x5543ef=!0x1;this['on']('change:value',(_0x41a6a1,_0x45e6df,_0x3262f6)=>{const _0x4dce47=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x3262f6),this['isProcessing']&&_0x4dce47&&!_0x5543ef&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0xdc5b5c,_0x34f4ff,_0x75cf65)=>{_0x5543ef=!0x1,_0x75cf65?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x5543ef=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x5543ef=!0x0;});}['focus'](){this['element']['focus']();}_createCopyButton(){const _0x51b9da=this['locale'],_0x2f9920=new Vt(this['locale']),_0x37ed1c='ck-ai-form__copy-button';return _0x2f9920['set']({'label':Mi(_0x51b9da,'Copy'),'icon':_0x356e25,'class':_0x37ed1c,'tooltip':!0x0}),_0x2f9920['bind']('isVisible')['to'](this,'value',_0x5490f1=>!!_0x5490f1),_0x2f9920['bind']('isEnabled')['to'](this,'isProcessing',_0x1e361a=>!_0x1e361a),_0x2f9920['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x2f9920['icon']=_0x11611b,_0x2f9920['class']=_0x37ed1c+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x2f9920['icon']=_0x356e25,_0x2f9920['class']=_0x37ed1c;},0x3e8);}),_0x2f9920;}['_copyHTMLToClipboard'](_0x8698e3){const {window:_0x4aae2e,document:_0x170071}=Ct;if(_0x4aae2e['ClipboardItem']){const {Blob:_0xcd44b9,ClipboardItem:_0x273714}=_0x4aae2e,_0x21412d=[new _0x273714({'text/html':new _0xcd44b9([_0x8698e3['innerHTML']],{'type':'text/html'}),'text/plain':new _0xcd44b9([_0x8698e3['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x21412d);}else{const _0x5b3888=_0x170071['createElement']('div');_0x5b3888['style']['position']='absolute',_0x5b3888['style']['left']='-9999px',_0x5b3888['innerHTML']='<span>[</span>'+_0x8698e3['innerHTML']+'<span>]</span>',_0x170071['body']['appendChild'](_0x5b3888);const _0x5c0040=_0x170071['createRange']();_0x5c0040['setStartAfter'](_0x5b3888['firstElementChild']),_0x5c0040['setEndBefore'](_0x5b3888['lastElementChild']);const _0x26f9dc=_0x4aae2e['getSelection']();_0x26f9dc['removeAllRanges'](),_0x26f9dc['addRange'](_0x5c0040),_0x170071['execCommand']('copy'),_0x5b3888['remove']();}}},$i=class extends _0x4f75f8{constructor(_0x130d49,_0x2331ea=''){super(_0x130d49),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x2331ea,'ck-reset_all-excluded','ck-ai-form__content-field']}});}setContent(_0x524416){this['element']['innerHTML']=_0x524416;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}_createLoader(){const _0x345928=new _0x4f75f8(),_0x36814f=this['locale'],_0x58d44e=new _0x1224fa();return _0x58d44e['isVisible']=!0x0,_0x345928['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x58d44e,{'text':Mi(_0x36814f,'AI\x20is\x20writing...')}]}),_0x345928['render'](),_0x345928;}},qi=class extends _0x4f75f8{constructor(_0xd2fd72,_0x47e46a=''){super(_0xd2fd72);const _0x1b152a=new Qt(),_0x2c10eb=this['bindTemplate'];this['set']('text',_0x47e46a),_0x1b152a['content']=_0x1d62af,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x1b152a,{'text':_0x2c10eb['to']('text')}]});}},Qi=class extends Lt{submitButtonView;showHistoryButtonView;constructor(_0x38d074,_0x18a3a1){super(_0x38d074,_0x18a3a1),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',(_0x2bc4be,_0x3e74d9)=>{_0x2bc4be['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x3e74d9());});}_createSubmitButton(){const _0xcdda62=new Vt(this['locale']),_0x396181=this['locale'];return _0xcdda62['set']({'icon':nt,'label':Mi(_0x396181,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0xcdda62['on']('execute',()=>{this['submit']();}),_0xcdda62['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x5560c6,_0x47dc76)=>!_0x5560c6&&_0x47dc76),_0xcdda62;}_createShowHistoryButton(){const _0x1a0e73=new Vt(this['locale']),_0x52bb5e=this['resultsView'],_0x19af08=this['locale'];_0x1a0e73['set']({'label':Mi(_0x19af08,'History'),'withText':!0x1,'icon':_0x156574,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x1a0e73['bind']('isOn')['to'](_0x52bb5e,'isVisible'),_0x1a0e73['bind']('isEnabled')['to'](this,'isEnabled'),_0x1a0e73['on']('execute',()=>{_0x52bb5e['isVisible']=!_0x52bb5e['isVisible'],_0x52bb5e['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x18ae3f=()=>{Ct['window']['requestAnimationFrame'](()=>{if(St(this['element'])){const _0x287398=new It(this['queryView']['fieldView']['element']),_0x22a988=_0x287398['width'],_0x57b11a='rtl'===_0x19af08['uiLanguageDirection']?'left':'right';_0x287398['excludeScrollbarsAndBorders'](),_0x1a0e73['element']['style'][_0x57b11a]=_0x22a988-_0x287398['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x18ae3f),this['on']('render',_0x18ae3f),_0x1a0e73;}submit(){const _0x630883=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x630883);}['focus'](_0xcdb424){-0x1===_0xcdb424?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Xi=class extends te{historyGroupView;clearHistoryButton;constructor(_0x549f1e){super(_0x549f1e),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Jt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Mi(_0x549f1e,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}filter(){let _0x877929=0x0;for(const _0x44bfca of this['items'])_0x877929+=_0x44bfca['items']['length'];return{'resultsCount':_0x877929,'totalItemsCount':_0x877929};}_createClearHistoryButton(){const _0x428f56=this['locale'],_0x40ca1c=new Vt(this['locale']);return _0x40ca1c['set']({'label':'('+Mi(_0x428f56,'Clear')+')','withText':!0x0}),_0x40ca1c['on']('execute',()=>this['fire']('clearHistory')),_0x40ca1c;}},zi=class extends Zt{constructor(_0x467610){super();const _0x55d8eb=new Mt(),_0x257892=new Vt(this['locale'],_0x55d8eb);this['children']['add'](_0x257892),_0x257892['set']({'label':_0x467610['prompt'],'withText':!0x0}),_0x257892['on']('execute',()=>{this['fire']('execute',{'value':_0x541c83(_0x467610['prompt'])});});}};const ji='CKEditor/AIFormView/PromptHistory';var Ji=class extends lt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x24e22a,_0xc9c8cd)=>{const _0x37d0da=Zi(_0xc9c8cd['prompt']);for(const _0x103af7 of this)if(_0x103af7!=_0xc9c8cd&&Zi(_0x103af7['prompt'])===_0x37d0da){this['remove'](_0x103af7);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}_loadFromSessionStorage(){const _0xf7c92d=sessionStorage['getItem'](ji)||'[]';this['addMany'](JSON['parse'](_0xf7c92d));}_saveToSessionStorage(){sessionStorage['setItem'](ji,JSON['stringify'](this['map'](_0x433690=>_0x433690)));}};function Zi(_0x27d9b1){return _0x27d9b1['toLowerCase']()['trim']();}var ts=class extends _0x4f75f8{['focusTracker'];keystrokes;contentArea;toolbar;promptView;['errorView'];['_focusables'];['focusCycler'];_promptHistory;constructor(_0x191172,_0x2bd61b,_0xd20765=''){super(_0x191172),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 Ji(),this['errorView']=new qi(_0x191172),this['contentArea']=new Yi(_0x191172,_0xd20765),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 gt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Wt({'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 _0x6a15ef=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x2bd61b],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x6a15ef['if']('isError','ck-hidden',_0x59baf7=>!_0x59baf7)]},'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'](_0x3fdf72=0x1){-0x1===_0x3fdf72?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 _0x56925e=this['locale'],_0x72a2ba=new Qi(_0x56925e,{'queryView':{'label':Mi(_0x56925e,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x11a29a,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Mi(_0x56925e,'Empty\x20history'),'secondary':Mi(_0x56925e,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x72a2ba['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x17ca16,_0x40ff2d)=>_0x17ca16&&!_0x40ff2d),this['listenTo'](_0x72a2ba,'submit',(_0x5bbe88,_0x418052)=>{this['prompt']=_0x418052;const _0x1d9024=_0x34b9ac(_0x418052);this['fire']('submitPrompt',_0x1d9024),_0x418052['trim']()&&this['_promptHistory']['add']({'prompt':_0x1d9024},0x0);},{'priority':'high'}),_0x72a2ba;}_createHistoryView(){const _0x3be572=new Xi(this['locale']);return _0x3be572['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](zi),_0x3be572['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x3be572;}_createToolbar(){const _0x4f36af=new Wi(this['locale']);return _0x4f36af['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2f171e,_0x3d13b1,_0x27c152)=>_0x2f171e&&!_0x3d13b1&&!!_0x27c152),_0x4f36af['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x4f36af['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x34c7bf,_0x8764b,_0x5e133c)=>_0x34c7bf&&!_0x8764b&&!!_0x5e133c),_0x4f36af['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x4f36af['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x7fa889,_0x1323ea)=>_0x7fa889&&!_0x1323ea),_0x4f36af['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x4f36af['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x4f36af['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x4f36af;}startProcessing(){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x508333=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Mi(_0x508333,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x56398b){const _0x321727=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x56398b||Mi(_0x321727,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const es=globalThis['DataTransfer'];var is=class extends _0x31535a{['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[_0x5ad979,Pi,Di,Bt];}constructor(_0x34b1a6){super(_0x34b1a6),_0x34b1a6['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x34b1a6['config']['define']('ai.assistant.contentAreaCssClass',''),_0x34b1a6['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x34b1a6['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}init(){const {editor:_0x2c8aec}=this;this['_aiAdapter']=_0x2c8aec['plugins']['get'](Di),this['_dialog']=_0x2c8aec['plugins']['get'](Bt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x125045=new Ui(_0x2c8aec,Array['from'](this['_commandDefinitions']['values']()));_0x2c8aec['commands']['add']('showAIAssistant',_0x125045),_0x2c8aec['ui']['componentFactory']['add']('aiCommands',_0x9b6e27=>{const _0x1e56de=_0x5c62d3(_0x9b6e27);return _0x1e56de['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x1e56de['buttonView']['set']({'label':Mi(_0x9b6e27,'AI\x20Commands'),'icon':_0x4c3ba0,'tooltip':!0x0}),_0x1e56de['on']('execute',_0x5c3713=>this['_onExecute'](_0x5c3713['source']['id'])),_0x1c4dd7(_0x1e56de,_0x2c8aec['ui']['view']['body'],function(_0x5e3ca2){const _0x10f333=ns(_0x5e3ca2,Ni(_0x5e3ca2['config']['get']('ai.assistant.commands'),_0x5e3ca2['locale']))['filter'](_0xafd1bb=>_0xafd1bb['commands']['length']);return 0x1===_0x10f333['length']?ns(_0x5e3ca2,_0x10f333[0x0]['commands'])['map'](_0x24e97f=>({'id':_0x24e97f['id'],'label':_0x24e97f['label']})):_0x10f333['map'](_0x4d5fb7=>{const {groupId:_0x528482,groupLabel:_0x27d54e,commands:_0x28842e}=_0x4d5fb7,_0x76ae7b=ns(_0x5e3ca2,_0x28842e)['map'](_0x4ae476=>({'id':_0x4ae476['id'],'label':_0x4ae476['label']}));return{'id':_0x528482,'menu':_0x27d54e||_0x528482,'children':_0x76ae7b};});}(_0x2c8aec),{'ariaLabel':Mi(_0x9b6e27,'AI\x20Commands')}),_0x1e56de['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x125045['on']('change:enabledCommandsIds',_0x33e910),_0x1e56de['menuView']['once']('render',_0x33e910),_0x1e56de;function _0x33e910(){_0x1e56de['isEnabled']=_0x125045['enabledCommandsIds']['length']>0x0;for(const _0x5062bc of _0x1e56de['menuView']['buttons'])_0x5062bc['isEnabled']=_0x125045['enabledCommandsIds']['includes'](_0x5062bc['id']);}}),_0x2c8aec['ui']['componentFactory']['add']('menuBar:aiCommands',_0x53b754=>{const _0x325856=new _0x45d7de(_0x53b754);_0x325856['buttonView']['set']({'label':Mi(_0x53b754,'AI\x20Commands'),'icon':_0x4c3ba0}),_0x325856['bind']('isEnabled')['to'](_0x125045,'enabledCommandsIds',_0x16206f=>_0x16206f['length']>0x0);const _0x5a2ba1=Ni(_0x2c8aec['config']['get']('ai.assistant.commands'),_0x53b754);return this['_populateMenuBarMenu'](_0x125045,_0x325856,_0x5a2ba1,_0x477576=>this['_onExecute'](_0x477576)),_0x325856;}),_0x2c8aec['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x253f0d=this['_createAIAssistantUIButton'](Vt);return _0x253f0d['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x253f0d;}),_0x2c8aec['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x369824=this['_createAIAssistantUIButton'](_0xe556ab);return _0x369824['set']({'role':'menuitemcheckbox'}),_0x369824;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x1c2886=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x1fa281;for(const _0x5b442d in _0x1c2886){const _0x3d9531=_0x5b442d,_0x15713e=_0x1c2886[_0x3d9531];if('aiLicenseKeyValid'==_0x15713e||'aiLicenseKeyInvalid'==_0x15713e||'aiLicenseKeyExpired'==_0x15713e||'aiLicenseKeyDomainLimit'==_0x15713e||'aiLicenseKeyNotAllowed'==_0x15713e||'aiLicenseKeyEvaluationLimit'==_0x15713e||'aiLicenseKeyUsageLimit'==_0x15713e){delete _0x1c2886[_0x3d9531],_0x1fa281=_0x15713e,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x1fa281&&_0x1c2886['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x1fa281&&_0x1c2886['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x1fa281&&_0x1c2886['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x1fa281&&_0x1c2886['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x1fa281&&_0x1c2886['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x1fa281&&_0x1c2886['_showLicenseError']('usageLimit');},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x2dc744='',_0x24701f='',_0x5ad670='custom'){const _0x1cb0ef=this['editor'],_0x46ff21=_0x1cb0ef['editing']['view'],_0x18fa8b=_0x1cb0ef['plugins']['get'](Pi),_0x1f628b=_0x1cb0ef['plugins']['get'](_0x5ad979);_0x18fa8b['showFakeVisualSelection']();const _0x717509=new es(),_0x2b4005=new ClipboardEvent('copy',{'clipboardData':_0x717509}),_0x58e90b=new _0x1a05c3(_0x717509),_0x5e9161=new _0x26c07d(_0x46ff21,_0x2b4005,{'dataTransfer':_0x58e90b});_0x1f628b['_forceMarkersCopy']('comment',()=>{_0x46ff21['document']['fire']('copy',_0x5e9161);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Fi(_0x1cb0ef,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x30d016=_0x58e90b['getData']('text/html');const _0x1d3d17=_0x1cb0ef['model']['document']['selection'],_0x58df42=Array['from'](_0x1d3d17['getRanges']());0x1===_0x58df42['length']&&_0x58df42[0x0]['isFlat']&&!_0x1d3d17['getSelectedElement']()&&''!==_0x30d016['replace'](/&nbsp;/g,'')['trim']()&&(_0x30d016='<p>'+_0x30d016+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x5ad670,'query':_0x2dc744,'htmlContent':_0x30d016,'label':_0x24701f,'mainActionLabel':Ki[_0x1cb0ef['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x79e364,'title':Mi(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Gt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x18fa8b['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}_getResolvedCommandsDefinitions(){const _0xdbb5bb=new Map(),_0x362b12=Ni(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x18bd13 of _0x362b12)for(const _0x219919 of _0x18bd13['commands'])_0xdbb5bb['set'](_0x219919['id'],{..._0x219919,'groupId':_0x18bd13['groupId'],'groupLabel':_0x18bd13['groupLabel']||_0x18bd13['groupId']});return _0xdbb5bb;}_createAIAssistantUIButton(_0x1eb8d8){const _0x1de04e=this['editor'],_0x466fef=_0x1de04e['commands']['get']('showAIAssistant'),_0x13a630=new _0x1eb8d8(_0x1de04e['locale']);return _0x13a630['set']({'label':Mi(_0x1de04e['locale'],'AI\x20Assistant'),'icon':_0x79e364,'isToggleable':!0x0}),_0x13a630['bind']('isEnabled')['to'](_0x466fef),_0x13a630['bind']('isOn')['to'](this['_dialog'],'id',_0x22a4b3=>'aiAssistant'===_0x22a4b3),this['listenTo'](_0x13a630,'execute',()=>{_0x13a630['isOn']?this['hideUI']():_0x466fef['execute']();}),_0x13a630;}_initView(){const _0x368797=this['editor']['plugins']['get'](Pi);this['_formView']=new ts(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',()=>{_0x368797['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x368797['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}_initAriaAiStatusChangeAnnouncements(){const {locale:_0x5b33c5,ui:{ariaLiveAnnouncer:_0x1e0066}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x34cf46,_0x1a844c,_0x39f6ee)=>{const _0x10c9a6=this['_aiAssistantController']['currentContext'];_0x39f6ee?_0x1e0066['announce'](Mi(_0x5b33c5,'AI\x20is\x20writing')):_0x10c9a6&&_0x1e0066['announce'](Mi(_0x5b33c5,'Generated\x20content:\x20%0',_0x10c9a6),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0xf95aab,_0x39b2da,_0x54e31c)=>{if(_0x54e31c){const _0x5ae7fd=this['_formView']['errorView']['text'];_0x1e0066['announce'](Mi(_0x5b33c5,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x5ae7fd));}});}_onExecute(_0x140f27){const _0x1b015b=this['_commandDefinitions']['get'](_0x140f27),_0xbc1dcf=this['editor'],_0x588bc6=_0xbc1dcf['model']['document']['selection'],_0xcc1c3c=_0xbc1dcf['commands']['get']('showAIAssistant'),_0x5036ab=_0xbc1dcf['plugins']['get'](Pi),_0x13b66c=''+('_ungrouppedCommands'!==_0x1b015b['groupId']?_0x1b015b['groupLabel']+':\x20':'')+_0x1b015b['label'];if(!0x1!==_0x1b015b['requiresContent']&&_0x588bc6['isCollapsed']){const _0x1a69ca=Tt(_0x588bc6['getSelectedBlocks']())||_0xbc1dcf['model']['schema']['getLimitElement'](_0x588bc6);_0xbc1dcf['model']['change'](_0x578eef=>{_0x578eef['setSelection'](_0x1a69ca,'in');});}_0x5036ab['showFakeVisualSelection'](),_0xcc1c3c['execute'](_0x1b015b['prompt'],_0x13b66c,'command:'+_0x140f27);}_populateMenuBarMenu(_0x2911d5,_0x206be9,_0x44cb6c,_0x3ea471){const _0x5ad9c2=this['editor'],_0x428106=_0x5ad9c2['locale'],_0x5a6c15=new _0x25f0ce(_0x428106),_0x52c384=ns(_0x5ad9c2,_0x44cb6c)['filter'](_0x265708=>_0x265708['commands']['length']);0x1===_0x52c384['length']?this['_getMenuBarGroupButtons']({'command':_0x2911d5,'commands':_0x52c384[0x0]['commands'],'parentMenuView':_0x206be9,'onExecute':_0x3ea471})['forEach'](_0x40ba26=>_0x5a6c15['items']['add'](_0x40ba26)):_0x52c384['forEach'](({groupId:_0x8aaa99,groupLabel:_0x38f3dd,commands:_0x1dc51e})=>{const _0x2e4062=new _0x589943(_0x428106,_0x206be9),_0x526179=new _0x45d7de(_0x428106),_0x768e8=new _0x25f0ce(_0x428106),_0x4f25f8=this['_getMenuBarGroupButtons']({'command':_0x2911d5,'commands':_0x1dc51e,'parentMenuView':_0x526179,'onExecute':_0x3ea471});_0x526179['buttonView']['set']({'label':_0x38f3dd||_0x8aaa99}),_0x526179['delegate']('execute')['to'](_0x206be9),_0x768e8['items']['addMany'](_0x4f25f8),_0x526179['panelView']['children']['add'](_0x768e8),_0x2e4062['children']['add'](_0x526179),_0x5a6c15['items']['add'](_0x2e4062);}),_0x206be9['panelView']['children']['add'](_0x5a6c15);}_getMenuBarGroupButtons({command:_0x454ac7,commands:_0xde3c53,parentMenuView:_0x5ec99d,onExecute:_0x26270}){const _0x1b8b24=this['editor'],_0x11225b=_0x1b8b24['locale'];return ns(_0x1b8b24,_0xde3c53)['map'](_0x277858=>{const _0x4983a6=new _0x589943(_0x11225b,_0x5ec99d),_0x5afa4f=new _0xe556ab(_0x11225b);return _0x5afa4f['set']({'label':_0x277858['label']}),_0x5afa4f['delegate']('execute')['to'](_0x5ec99d),_0x5afa4f['on']('execute',()=>_0x26270(_0x277858['id'])),_0x5afa4f['bind']('isEnabled')['to'](_0x454ac7,'enabledCommandsIds',_0x5df4b3=>_0x5df4b3['includes'](_0x277858['id'])),_0x4983a6['children']['add'](_0x5afa4f),_0x4983a6;});}};function ss(_0x585801,_0x2ca7f4){return void 0x0!==_0x585801['order']&&void 0x0===_0x2ca7f4['order']?0x1:void 0x0===_0x585801['order']&&void 0x0!==_0x2ca7f4['order']?-0x1:void 0x0!==_0x585801['order']&&void 0x0!==_0x2ca7f4['order']?_0x585801['order']-_0x2ca7f4['order']:0x0;}function ns(_0x56b65a,_0x4b4e0a){_0x4b4e0a['sort'](ss);const _0x1bbb37={},_0x43421f=[];for(const _0x20e7a5 of _0x4b4e0a)if(void 0x0!==_0x20e7a5['order']){if(_0x20e7a5['order']in _0x1bbb37)throw new ct('ai-commands-config-order-collision',_0x56b65a,{'conflictingDefinitions':[_0x20e7a5,_0x1bbb37[_0x20e7a5['order']]]});_0x1bbb37[_0x20e7a5['order']]=_0x20e7a5,_0x43421f['splice'](_0x20e7a5['order'],0x0,_0x20e7a5);}else _0x43421f['push'](_0x20e7a5);return _0x43421f;}var rs=class extends _0x31535a{static get requires(){return[is,Pi];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x34358f){super(_0x34358f);const _0xef303d=_0x34358f['config'],_0x51900a=_0x34358f['locale'];_0xef303d['define']('ai.assistant.preserveComments',!0x0),_0xef303d['define']('ai.assistant.commands',os(_0x51900a)),_0xef303d['define']('ai.assistant.extraCommandGroups',[]),_0xef303d['define']('ai.assistant.removeCommands',[]);let _0x21ec21=Ni(_0xef303d['get']('ai.assistant.commands'),_0x51900a);const _0x237117=_0xef303d['get']('ai.assistant.extraCommandGroups'),_0x552037=_0xef303d['get']('ai.assistant.removeCommands');_0x237117['forEach'](_0x4af259=>{const _0x5a0a4c=_0x21ec21['find'](_0x1988d9=>_0x1988d9['groupId']===_0x4af259['groupId']);_0x5a0a4c?_0x5a0a4c['commands']=_0x5a0a4c['commands']['concat'](_0x4af259['commands']):_0x21ec21['push'](_0x4af259);}),_0x21ec21=_0x21ec21['filter'](_0x51f8a6=>!_0x552037['includes'](_0x51f8a6['groupId'])),_0x21ec21['forEach'](_0x1c7545=>{_0x1c7545['commands']=_0x1c7545['commands']['filter'](_0x44e876=>!_0x552037['includes'](_0x44e876['id']));}),_0xef303d['set']('ai.assistant.commands',_0x21ec21);}};function os(_0x4aaf24){return[{'groupId':'editOrReview','groupLabel':Mi(_0x4aaf24,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Mi(_0x4aaf24,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Mi(_0x4aaf24,'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':Mi(_0x4aaf24,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Mi(_0x4aaf24,'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':Mi(_0x4aaf24,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Mi(_0x4aaf24,'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':Mi(_0x4aaf24,'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':Mi(_0x4aaf24,'Change\x20tone'),'commands':[{'id':'professional','label':Mi(_0x4aaf24,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Mi(_0x4aaf24,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Mi(_0x4aaf24,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Mi(_0x4aaf24,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Mi(_0x4aaf24,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Mi(_0x4aaf24,'Change\x20style'),'commands':[{'id':'business','label':Mi(_0x4aaf24,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Mi(_0x4aaf24,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Mi(_0x4aaf24,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Mi(_0x4aaf24,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Mi(_0x4aaf24,'Translate'),'commands':[{'id':'translateEnglish','label':Mi(_0x4aaf24,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Mi(_0x4aaf24,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Mi(_0x4aaf24,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Mi(_0x4aaf24,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Mi(_0x4aaf24,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Mi(_0x4aaf24,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Mi(_0x4aaf24,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Mi(_0x4aaf24,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var as=class extends _0x31535a{abortController;static get requires(){return[Di];}constructor(_0x9aa16e){super(_0x9aa16e),this['abortController']=new AbortController();}init(){this['editor']['plugins']['get'](Di)['textAdapter']=this;}abort(){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async makeRequest(_0x1955a9){return this['sendRequest'](_0x1955a9)['catch'](_0x3c38c1=>{if(_0x3c38c1 instanceof Hi)return Promise['reject'](_0x3c38c1);if('AbortError'==_0x3c38c1['name'])return Promise['resolve']();throw console['error'](_0x3c38c1),new ct('aitextadapter-send-request-failed',null);});}async _prepareRequestHeaders(_0x71cf8b,_0x46a7df){const _0x54bbd0=this['editor']['locale'],_0x523a82={'Content-Type':'application/json'};if('object'==typeof _0x71cf8b)Object['assign'](_0x523a82,_0x71cf8b);else{if(_0x71cf8b)try{const _0x5aee0d=await _0x71cf8b(_0x46a7df);Object['assign'](_0x523a82,_0x5aee0d);}catch{return Promise['reject'](new Hi(Mi(_0x54bbd0,'AI_ERROR_GET_HEADERS')));}}return _0x523a82;}async _prepareRequestParameters(_0x503db7,_0x48f6d2){const _0x1220b5=this['editor']['locale'];if('object'==typeof _0x503db7)return _0x503db7;try{return await _0x503db7(_0x48f6d2);}catch{return Promise['reject'](new Hi(Mi(_0x1220b5,'AI_ERROR_GET_PARAMETERS')));}}},hs=class extends as{['_apiUrl'];_requestHeaders;_requestParameters;static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x3f678a){super(_0x3f678a),_0x3f678a['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x3f678a['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x3f678a['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x3f678a['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x3f678a['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x3f678a['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async sendRequest({query:_0x41af64,context:_0x57821b,onData:_0x3e634d,actionId:_0x4f7fb3}){const _0x17b1ee=this['editor']['locale'],_0x45cb70=await this['prepareMessages'](_0x41af64,_0x57821b,_0x4f7fb3),_0x2564ac=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x4f7fb3),_0x547909=await this['_prepareRequestParameters'](this['_requestParameters'],_0x4f7fb3),_0x4b85b6={'messages':_0x45cb70,..._0x547909},_0x5b2eeb={'method':'POST','headers':_0x2564ac,'body':JSON['stringify'](_0x4b85b6),'signal':this['abortController']['signal']},_0x545647=await fetch(this['_apiUrl'],_0x5b2eeb);if(_0x545647['ok'])return _0x547909['stream']?await this['_readStreamableResponse'](_0x545647,_0x3e634d):await this['_readStaticResponse'](_0x545647,_0x3e634d),Promise['resolve']();{const _0x5a07e7=await _0x545647['text']();return _0x5a07e7['includes']('context_length_exceeded')?Promise['reject'](new Hi(Mi(_0x17b1ee,'AI_ERROR_CONTEXT_LENGTH'))):_0x5a07e7['includes']('Moderation')?Promise['reject'](new Hi(Mi(_0x17b1ee,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x5a07e7));}}async['prepareMessages'](_0x241aa3,_0x4ba1b0,_0x2b5d1f){let _0x2ee310,_0x2d9807;return _0x4ba1b0?(_0x2ee310='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.',_0x2d9807='Instruction:\x0a'+_0x241aa3+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x4ba1b0):(_0x2ee310='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.',_0x2d9807=_0x241aa3),[{'role':'system','content':_0x2ee310},{'role':'user','content':_0x2d9807}];}async _readStreamableResponse(_0x588899,_0x23ce51){const _0x14746c=_0x588899['body']['getReader'](),_0x5849db=new TextDecoder();let _0x8cec02='',_0x4433aa='',_0xf20221='',_0x5d8e7b=!0x1;for(;!_0x5d8e7b;){const {done:_0x328cc0,value:_0x2d3b5b}=await _0x14746c['read'](),_0xde240d=_0x8cec02+_0x5849db['decode'](_0x2d3b5b);let _0x3c5198;_0x5d8e7b=_0x328cc0;try{_0x3c5198=this['_cleanUpData'](_0xde240d),_0x8cec02='';}catch{_0x8cec02=_0xde240d;continue;}_0x4433aa+=_0x3c5198,!_0x5d8e7b&&this['_isBufferIncomplete'](_0x4433aa)||_0x4433aa&&(_0xf20221+=_0x4433aa,_0x4433aa='',_0x23ce51(_0xf20221));}return Promise['resolve']();}async _readStaticResponse(_0xc7795e,_0x3d7940){return _0x3d7940((await _0xc7795e['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}_isBufferIncomplete(_0x5f586a){const _0x348b74=_0x5f586a['split']('<')['length']!==_0x5f586a['split']('>')['length'],_0x4f7e68=_0x5f586a['length']<0x1e;return _0x348b74&&_0x4f7e68;}_cleanUpData(_0x217729){return _0x217729['split'](/\n(?![^{]*\})/g)['map'](_0x3e05ff=>_0x3e05ff['replace']('data:\x20',''))['filter'](_0x411025=>_0x411025&&_0x411025['length']>0x0&&'[DONE]'!==_0x411025)['map'](_0x37cf3e=>{const {choices:_0x30693a}=JSON['parse'](_0x37cf3e);if(_0x30693a[0x0]?.['delta']?.['content'])return _0x30693a[0x0]['delta']['content'];})['filter'](_0x101b04=>_0x101b04)['join']('');}},cs=class extends as{static get['pluginName'](){return'AWSTextAdapter';}init(){super['init'](),Ot('ai-aws-adapter-not-supported');}async sendRequest(_0x1f51fa){throw Rt('ai-aws-adapter-not-supported'),new Hi(Mi(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ls=class extends Vt{constructor(_0x2dfd76,_0x3d7526={}){super(_0x2dfd76),this['isToggleable']=!0x0,this['set']('side',_0x3d7526['side']||'top');const _0x1fa6ae=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...yt(_0x3d7526['class']||[]),_0x1fa6ae['to']('side',_0x236d7c=>'ck-tab-button_'+_0x236d7c),_0x1fa6ae['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},us=class extends _0x4f75f8{['children'];constructor(_0x3666d7,_0x583409={}){super(_0x3666d7);const _0x3575b7=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...yt(_0x583409['class']||[]),_0x3575b7['to']('class'),_0x3575b7['if']('isVisible','ck-hidden',_0x52b423=>!_0x52b423)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ds=class extends _0x4f75f8{buttonViews=this['createCollection']();['panelViews']=this['createCollection']();_tabs=new Map();constructor(_0x2d48a8,_0x400394={}){super(_0x2d48a8),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x400394['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x400394['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x17c806,_0x2402ae)=>_0x17c806&&!_0x2402ae);const _0x34564f=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...yt(_0x400394['class']||[]),_0x34564f['to']('side',_0x59d82e=>'ck-tabs_'+_0x59d82e),_0x34564f['to']('class'),_0x34564f['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x34564f['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x34564f['to']('side',_0x5202e0=>'ck-tabs__buttons-container_'+_0x5202e0)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x34564f['to']('side',_0x279f15=>'ck-tabs__panels-container_'+_0x279f15)]},'children':this['panelViews']},...yt(_0x400394['children']||[])]});}getTabIds(){return[...this['_tabs']['keys']()];}getTab(_0x5da7df){const _0x3e1821=this['_tabs']['get'](_0x5da7df);return _0x3e1821||null;}['addTab'](_0x27a5cf){const _0x38395f=this['_setupButton']({'id':_0x27a5cf['id'],'label':_0x27a5cf['buttonLabel'],'icon':_0x27a5cf['buttonIcon'],'order':_0x27a5cf['order']}),_0x493264=new us(this['locale']);return _0x493264['render'](),_0x27a5cf['content']&&_0x493264['children']['add'](_0x27a5cf['content']),this['panelViews']['add'](_0x493264),this['_tabs']['set'](_0x27a5cf['id'],{'button':_0x38395f,'panel':_0x493264,'order':void 0x0!==_0x27a5cf['order']?_0x27a5cf['order']:null}),this['fire']('addTab:'+_0x27a5cf['id'],{'id':_0x27a5cf['id'],'button':_0x38395f,'panel':_0x493264}),null===this['activeTab']?this['activateTab'](_0x27a5cf['id']):this['_hidePanel'](_0x27a5cf['id']),{'button':_0x38395f,'panel':_0x493264};}activateTab(_0x352084){if(null!==_0x352084&&!this['getTab'](_0x352084))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x352084});if(this['isCollapsed']=!0x1,this['activeTab']===_0x352084)return;const _0xea7110=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x352084,_0x352084&&this['_showPanel'](_0x352084),this['fire']('activateTab:'+_0x352084,{'newTab':_0x352084,'oldTab':_0xea7110});}toggleTabPanel(_0x1d7051){this['activeTab']===_0x1d7051?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x1d7051);}['showTab'](_0x22d508){if(!this['getTab'](_0x22d508))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x22d508});this['_showPanel'](_0x22d508),this['_showButton'](_0x22d508),this['fire']('show:'+_0x22d508,_0x22d508);}['hideTab'](_0x11a69c){if(!this['getTab'](_0x11a69c))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x11a69c});const _0x4ccb66=this['activeTab'];this['_hidePanel'](_0x11a69c),this['_hideButton'](_0x11a69c);const _0x174776=this['getTabIds']();_0x4ccb66===_0x11a69c&&_0x174776['length']>0x1&&this['activateTab'](_0x174776['find'](_0x1bd5f0=>_0x1bd5f0!==_0x11a69c)),this['fire']('hide:'+_0x11a69c,_0x11a69c);}_getPanel(_0x35a372){const _0x3cfa5d=this['_tabs']['get'](_0x35a372);return _0x3cfa5d?_0x3cfa5d['panel']:null;}['_showPanel'](_0x121a7b){null!==this['activeTab']&&this['activeTab']!==_0x121a7b||this['_getPanel'](_0x121a7b)['show']();}['_hidePanel'](_0x3e1dae){const _0x3498cc=this['_getPanel'](_0x3e1dae);_0x3498cc['isVisible']&&(this['activeTab']===_0x3e1dae&&(this['activeTab']=null),_0x3498cc['hide']());}_getButton(_0x3b4281){const _0x48702b=this['_tabs']['get'](_0x3b4281);return _0x48702b?_0x48702b['button']:null;}_showButton(_0x26baf2){this['_getButton'](_0x26baf2)['show']();}_hideButton(_0x3936a7){this['_getButton'](_0x3936a7)['hide']();}_setupButton(_0x432f04){const _0x29fb89=new ls(this['locale'],{'side':this['side']}),_0x432fdc=this['buttonViews'];if(_0x29fb89['set']({'label':_0x432f04['label'],'icon':_0x432f04['icon'],'tooltip':!0x0,'withText':!0x0}),_0x29fb89['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x3c01af,_0x34c21e)=>_0x3c01af===_0x432f04['id']&&!_0x34c21e),_0x29fb89['bind']('side')['to'](this,'side'),_0x432f04['order']){const _0x55895c=[...this['_tabs']]['reduce']((_0x54e039,_0x23e27b)=>{const _0x41b99a=_0x23e27b[0x0],{order:_0x296e84}=_0x23e27b[0x1];return!_0x296e84||_0x296e84>_0x432f04['order']?_0x54e039:_0x296e84>=_0x54e039['order']?{'id':_0x41b99a,'order':_0x296e84}:_0x54e039;},{'id':'','order':0x0}),_0x1fd903=_0x432fdc['getIndex'](this['_getButton'](_0x55895c['id']));_0x432fdc['add'](_0x29fb89,_0x1fd903+0x1);}else _0x432fdc['add'](_0x29fb89);return _0x29fb89['on']('execute',()=>{this['toggleTabPanel'](_0x432f04['id']);}),_0x29fb89;}};const _s=['overlay','sidebar','custom'],gs=['left','right'];var As=class extends ds{constructor(_0x2641c9,_0x21a8f4={}){super(_0x2641c9,_0x21a8f4),this['set']('type',_0x21a8f4['type']||'sidebar'),this['set']('side',_0x21a8f4['side']||'right'),this['set']('isVisible',_0x21a8f4['visibleByDefault']??!0x0);const _0x546a6d=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x546a6d['if']('type','ck-ai-tabs__overlay',_0x31517c=>'overlay'===_0x31517c),_0x546a6d['if']('type','ck-ai-tabs__sidebar',_0x114b9a=>'sidebar'===_0x114b9a),_0x546a6d['if']('isVisible','ck-hidden',_0x2ea38a=>!_0x2ea38a)]}}),this['buttonViews']['on']('add',(_0x17103b,_0x526029)=>{_0x526029['set']('withText',!0x1);});}},Is=class extends _0x45fe7d{['view'];container=null;showResizeButton=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x554945){if(super(_0x554945),!this['context']['config']['get']('ai.container'))throw new ct('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x1d2ba0=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x1d2ba0['showResizeButton']&&(this['showResizeButton']=_0x1d2ba0['showResizeButton']),'sidebar'!==_0x1d2ba0['type']&&'overlay'!==_0x1d2ba0['type']||_0x1d2ba0['side']&&(this['side']=_0x1d2ba0['side']),'sidebar'===_0x1d2ba0['type']){if(this['container']=_0x1d2ba0['element'],this['set']('type','sidebar'),!this['container'])throw new ct('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x1d2ba0['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new As(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x1d2ba0['visibleByDefault'],'collapsible':_0x1d2ba0['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 _0x5c73d5&&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(_0x225f4d){if(_0x225f4d&&this['type']!==_0x225f4d){if(!_s['includes'](_0x225f4d))throw new ct('ai-tabs-unsupported-ui-type');this['type']=_0x225f4d;}}switchSide(_0x295c14){if(_0x295c14&&this['side']!==_0x295c14){if(!gs['includes'](_0x295c14))throw new ct('ai-tabs-unsupported-ui-side');this['side']=_0x295c14;}}destroy(){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}};function ps(_0x17db67){return{..._0x17db67,'type':'context'};}var Es=class extends _0x45fe7d{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}_token;['_decoder'];static get requires(){return[_0x2c3df2];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x45eba8){if(super(_0x45eba8),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 ct('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder();}init(){const _0x4997a0=this['context']['plugins']['get'](_0x2c3df2);if(!_0x4997a0['token'])throw new ct('ai-missing-token',this);this['_token']=_0x4997a0['token'];}_getExtraHttpHeaders(){const _0x10c8b8=this['context']['config']['get']('ai.extraHttpHeaders'),_0x48dc5f='function'==typeof _0x10c8b8?_0x10c8b8():_0x10c8b8;if(Array['isArray'](_0x48dc5f)&&_0x48dc5f['length'])return Object['fromEntries'](_0x48dc5f['map'](({domain:_0x1918dc,headers:_0xedfc69})=>[_0x1918dc,_0xedfc69]));}startConversation(_0x1e6654,_0x4bdc60){const _0x47404e=this['_sendApiRequest']('/conversations','POST',{'id':_0x1e6654,'group':_0x4bdc60});return{'getConversation':async()=>(await _0x47404e['request'])['json'](),'abortController':_0x47404e['abortController']};}queryAssistant({message:_0x186290,conversationId:_0x496120,parts:_0x20c6e7,capabilities:_0x4c856b,model:_0x14cfdd,attributes:_0x711125}){const _0x2f1dc5=this['_getExtraHttpHeaders'](),_0x2413b1={..._0x186290&&{'prompt':_0x186290},'content':_0x20c6e7,'model':_0x14cfdd,..._0x4c856b&&{'capabilities':_0x4c856b},..._0x711125&&{'attributes':_0x711125},..._0x2f1dc5&&{'extraHttpHeaders':_0x2f1dc5}},_0x1473b8=this['_sendApiRequest']('/conversations/'+_0x496120+'/messages','POST',_0x2413b1,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x43fe30=(await _0x1473b8['request'])['body'];return this['_getStreamReader'](_0x43fe30);},'abortController':_0x1473b8['abortController']};}executeCustomAction({content:_0x3f923f,message:_0x42dab8,model:_0x4ba0bc,outputFormat:_0x11d73e,contexts:_0x5a4e22}){const _0x1ce0fb={'content':[{'type':'text','content':_0x3f923f}],..._0x42dab8&&{'prompt':_0x42dab8},'model':_0x4ba0bc,'outputFormat':_0x11d73e,...ms(_0x5a4e22)},_0x4f54f2=this['_sendApiRequest']('/actions/custom/calls','POST',_0x1ce0fb);return{'getStream':async()=>{const _0x441074=(await _0x4f54f2['request'])['body'];return this['_getStreamReader'](_0x441074);},'abortController':_0x4f54f2['abortController']};}executeAction({actionName:_0x29e0b2,content:_0x2c9894,args:_0x2a4a73,contexts:_0x3a61f7}){const _0x36005e={'content':[{'type':'text','content':_0x2c9894}],'args':_0x2a4a73,...ms(_0x3a61f7)},_0x120643=this['_sendApiRequest']('/actions/system/'+_0x29e0b2+'/calls','POST',_0x36005e);return{'getStream':async()=>{const _0x1ad0c2=(await _0x120643['request'])['body'];return this['_getStreamReader'](_0x1ad0c2);},'abortController':_0x120643['abortController']};}['uploadFile'](_0x2862a5,_0x434069,_0x3b0b50){const _0x1452c9=new FormData();_0x1452c9['append']('file',_0x434069,_0x434069['name']),_0x3b0b50&&_0x1452c9['append']('attributes',JSON['stringify'](_0x3b0b50));const _0x1047c8=this['_sendApiRequest']('/conversations/'+_0x2862a5+'/files','POST',_0x1452c9);return{'getId':async()=>(await _0x1047c8['request'])['json'](),'abortController':_0x1047c8['abortController']};}uploadDocuments(_0x1b45ad,_0x3d5860){const _0x1dd08a={'documents':_0x3d5860['map'](_0x3ecaa4=>({'content':_0x3ecaa4['content'],'attributes':{'version':_0x3ecaa4['version'],'sessionId':_0x3ecaa4['sessionId'],'channelId':_0x3ecaa4['channelId'],'rootName':_0x3ecaa4['rootName'],'selections':_0x3ecaa4['selections']},...void 0x0!==_0x3ecaa4['name']?{'name':_0x3ecaa4['name']}:{},...void 0x0!==_0x3ecaa4['description']?{'description':_0x3ecaa4['description']}:{}}))},_0x3b104e=this['_sendApiRequest']('/conversations/'+_0x1b45ad+'/documents/batch','POST',_0x1dd08a);return{'getIds':async()=>(await _0x3b104e['request'])['json'](),'abortController':_0x3b104e['abortController']};}fetchDocuments(_0x3306cb,_0x10d30f){const _0x236e63=new URLSearchParams();_0x236e63['append']('documentIds',_0x10d30f['join'](','));const _0x250878=this['_sendApiRequest']('/conversations/'+_0x3306cb+'/documents/batch?'+_0x236e63['toString'](),'GET');return{'getDocuments':async()=>(await _0x250878['request'])['json'](),'abortController':_0x250878['abortController']};}fetchConversations(_0x43ea8a,_0x430372={}){const _0x531de9=new URLSearchParams();_0x531de9['append']('group',_0x43ea8a),_0x531de9['append']('excludeEmpty',!0x1!==_0x430372['excludeEmpty']?'true':'false'),_0x531de9['append']('limit',_0x430372['limit']?_0x430372['limit']['toString']():0x64['toString']()),_0x531de9['append']('sortBy',_0x430372['sortBy']?_0x430372['sortBy']:'createdAt'),_0x531de9['append']('order',_0x430372['order']?_0x430372['order']:'desc');const _0x1df464=this['_sendApiRequest']('/conversations?'+_0x531de9['toString'](),'GET');return{'getConversations':async()=>(await(await _0x1df464['request'])['json']())['items'],'abortController':_0x1df464['abortController']};}deleteConversation(_0x9a9c05){const _0x327531=this['_sendApiRequest']('/conversations/'+_0x9a9c05,'DELETE');return{'execute':async()=>{await _0x327531['request'];},'abortController':_0x327531['abortController']};}updateConversation(_0x1e72d8,_0x3641f5){const _0x464b7a=this['_sendApiRequest']('/conversations/'+_0x1e72d8,'PATCH',_0x3641f5);return{'getResult':async()=>(await _0x464b7a['request'],_0x3641f5),'abortController':_0x464b7a['abortController']};}fetchConversation(_0x3cf5a5){const _0x10e35e=this['_sendApiRequest']('/conversations/'+_0x3cf5a5,'GET');return{'getConversation':async()=>(await _0x10e35e['request'])['json'](),'abortController':_0x10e35e['abortController']};}fetchConversationMessages(_0x3b0b0f){const _0x1e1fac=this['_sendApiRequest']('/conversations/'+_0x3b0b0f+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x1e1fac['request'])['json']())['items'],'abortController':_0x1e1fac['abortController']};}['uploadUrl'](_0x108a69,_0x3d93ec,_0x4b8174){const _0x2ee80d=this['_sendApiRequest']('/conversations/'+_0x108a69+'/web-resources','POST',{'url':_0x3d93ec,'attributes':_0x4b8174});return{'getId':async()=>(await _0x2ee80d['request'])['json'](),'abortController':_0x2ee80d['abortController']};}getModels(_0x5698ce='en'){const _0xe55bb7=new URLSearchParams();_0xe55bb7['append']('language',_0x5698ce);const _0x5bcd6c='/models/1?'+_0xe55bb7['toString'](),_0x4a67cc=this['_sendApiRequest'](_0x5bcd6c,'GET');return{'list':async()=>await(await _0x4a67cc['request'])['json'](),'abortController':_0x4a67cc['abortController']};}listContexts(_0x13a506={}){const _0x38ae11=new URLSearchParams();_0x38ae11['append']('limit',_0x13a506['limit']?_0x13a506['limit']['toString']():0x64['toString']()),_0x13a506['cursor']&&_0x38ae11['append']('cursor',_0x13a506['cursor']),_0x13a506['order']&&_0x38ae11['append']('order',_0x13a506['order']);const _0x506ca4=this['_sendApiRequest']('/contexts?'+_0x38ae11['toString'](),'GET');return{'getContexts':async()=>(await(await _0x506ca4['request'])['json']())['items'],'abortController':_0x506ca4['abortController']};}deleteFile(_0x2e440d,_0x5e2171){const _0x4f01d6=this['_sendApiRequest']('/conversations/'+_0x2e440d+'/files/'+_0x5e2171,'DELETE');return{'execute':async()=>{await _0x4f01d6['request'];},'abortController':_0x4f01d6['abortController']};}deleteDocument(_0x1f0eaf,_0x3cd736){const _0x19d9ac=this['_sendApiRequest']('/conversations/'+_0x1f0eaf+'/documents/'+_0x3cd736,'DELETE');return{'execute':async()=>{await _0x19d9ac['request'];},'abortController':_0x19d9ac['abortController']};}deleteWebResource(_0x1d5a0a,_0x55b05a){const _0x2297dd=this['_sendApiRequest']('/conversations/'+_0x1d5a0a+'/web-resources/'+_0x55b05a,'DELETE');return{'execute':async()=>{await _0x2297dd['request'];},'abortController':_0x2297dd['abortController']};}cancelStream(_0x1f469d,_0x28ddfa){const _0x5b9df6=this['_sendApiRequest']('/conversations/'+_0x1f469d+'/messages/'+_0x28ddfa+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x5b9df6['request'];},'abortController':_0x5b9df6['abortController']};}resumeStream(_0x11d119,_0x395714,_0x483c8b='0-0'){const _0x348582=new URLSearchParams({'lastEventId':_0x483c8b}),_0x38fa78=this['_sendApiRequest']('/conversations/'+_0x11d119+'/messages/'+_0x395714+'/stream?'+_0x348582['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0xb547c7=await _0x38fa78['request'];return this['_getStreamReader'](_0xb547c7['body']);},'abortController':_0x38fa78['abortController']};}callSystemReview({reviewName:_0x2a92d1,content:_0x47f0b9,args:_0x33b0c2,contexts:_0x50e088}){const _0x4972bc=this['_sendApiRequest']('/reviews/system/'+_0x2a92d1+'/calls','POST',{'content':[{'type':'text','content':_0x47f0b9}],'args':_0x33b0c2,...ms(_0x50e088)});return{'getStream':async()=>{const _0x35dfd8=(await _0x4972bc['request'])['body'];return this['_getStreamReader'](_0x35dfd8);},'abortController':_0x4972bc['abortController']};}processDocument({content:_0x48d388,prompt:_0x2671f2,model:_0x2d66f5,capabilities:_0x479414,contexts:_0x1ee307}){const _0x9ba8c7=this['_getExtraHttpHeaders'](),_0x1d0dfd=this['_sendApiRequest']('/documents/process','POST',{'content':_0x48d388,'prompt':_0x2671f2,'model':_0x2d66f5,..._0x479414&&{'capabilities':_0x479414},...ms(_0x1ee307),..._0x9ba8c7&&{'extraHttpHeaders':_0x9ba8c7}});return{'getResult':async()=>(await _0x1d0dfd['request'])['json'](),'abortController':_0x1d0dfd['abortController']};}callCustomReview({content:_0x4a2237,prompt:_0x5df804,model:_0x18b342,contexts:_0x2a004d}){const _0x42cb10=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x4a2237}],..._0x5df804&&{'prompt':_0x5df804},'model':_0x18b342,...ms(_0x2a004d)});return{'getStream':async()=>{const _0x4fcd61=(await _0x42cb10['request'])['body'];return this['_getStreamReader'](_0x4fcd61);},'abortController':_0x42cb10['abortController']};}upsertAIChatRating(_0x1b889a,_0x2e4af5,_0x50cb2f){const _0x1b2d61=this['_sendApiRequest']('/conversations/'+_0x1b889a+'/messages/'+_0x2e4af5+'/ratings','PUT',{'positiveCount':_0x50cb2f['positiveCount'],'totalCount':_0x50cb2f['totalCount'],'modificationId':_0x50cb2f['modificationId']});return{'execute':async()=>{await _0x1b2d61['request'];},'abortController':_0x1b2d61['abortController']};}upsertAIActionRating(_0x1e2904,_0x395f10,_0x1a6b6d){const _0x2b770e=this['_sendApiRequest']('/actions/system/'+_0x1e2904+'/calls/'+_0x395f10+'/ratings','PUT',{'positiveCount':_0x1a6b6d['positiveCount'],'totalCount':_0x1a6b6d['totalCount']});return{'execute':async()=>{await _0x2b770e['request'];},'abortController':_0x2b770e['abortController']};}upsertCustomAIActionRating(_0x4ffc32,_0x385d8a){const _0x1e6aca=this['_sendApiRequest']('/actions/custom/calls/'+_0x4ffc32+'/ratings','PUT',{'positiveCount':_0x385d8a['positiveCount'],'totalCount':_0x385d8a['totalCount']});return{'execute':async()=>{await _0x1e6aca['request'];},'abortController':_0x1e6aca['abortController']};}upsertAIReviewRating(_0x2e9437,_0x1abc93,_0x1c70cc,_0x5e6541){const _0xdc047e=this['_sendApiRequest']('/reviews/system/'+_0x2e9437+'/calls/'+_0x1abc93+'/ratings','PUT',{'positiveCount':_0x1c70cc['positiveCount'],'totalCount':_0x1c70cc['totalCount'],'dataId':_0x5e6541});return{'execute':async()=>{await _0xdc047e['request'];},'abortController':_0xdc047e['abortController']};}upsertCustomAIReviewRating(_0x46e2b2,_0x3ed2f8,_0x468baa){const _0x4873c5=this['_sendApiRequest']('/reviews/custom/calls/'+_0x46e2b2+'/ratings','PUT',{'positiveCount':_0x3ed2f8['positiveCount'],'totalCount':_0x3ed2f8['totalCount'],'dataId':_0x468baa});return{'execute':async()=>{await _0x4873c5['request'];},'abortController':_0x4873c5['abortController']};}_sendApiRequest(_0x5e9f96,_0x52f0b4,_0x256855,_0x5b7f01={}){const {apiUrl:_0x3adb95=this['_apiUrl']}=_0x5b7f01,_0x336643=new AbortController(),_0xd640a3=_0x256855 instanceof FormData,_0x1cb90c={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':xt};_0x256855&&!_0xd640a3&&(_0x1cb90c['Content-Type']='application/json');const _0x286083={'method':_0x52f0b4,'headers':_0x1cb90c,'signal':_0x336643['signal']};return _0x256855&&(_0x286083['body']=_0xd640a3?_0x256855:JSON['stringify'](_0x256855)),{'request':fetch(''+_0x3adb95+_0x5e9f96,_0x286083)['catch'](_0x5854e7=>{this['_handleError'](_0x5854e7);})['then'](_0x25da21=>_0x25da21['ok']?_0x25da21:_0x25da21['json']()['then'](_0x3eb84f=>{throw{'url':_0x3adb95,'path':_0x5e9f96,'method':_0x52f0b4,'body':_0x256855,'status':(_0x25da21||{})['status'],'statusText':(_0x25da21||{})['statusText'],'code':_0x3eb84f['code'],'message':_0x3eb84f['message'],'traceId':_0x3eb84f['traceId'],'data':_0x3eb84f['data']};})),'abortController':_0x336643};}async *_getStreamReader(_0x5ab5b0){const _0x2cecc0=[],_0x2f69f6=_0x5ab5b0['getReader'](),_0x9bebcf=_0xeb522d({'onError':_0x112b0d=>{this['_handleError'](_0x112b0d);},'onEvent':_0x524a7e=>{_0x524a7e['data']=JSON['parse'](_0x524a7e['data']),_0x2cecc0['push'](_0x524a7e);}});try{let _0x4e9144=!0x1;for(;!_0x4e9144;){const {done:_0x13ef21,value:_0x4a5488}=await _0x2f69f6['read']();_0x13ef21&&(_0x4e9144=!0x0),_0x9bebcf['feed'](this['_decoder']['decode'](_0x4a5488,{'stream':!0x0})),yield*_0x2cecc0,_0x2cecc0['length']=0x0;}}catch(_0x218b41){this['_handleError'](_0x218b41);}finally{_0x2f69f6['releaseLock'](),_0x9bebcf['reset']();}}['_handleError'](_0x103b9a){if(_0x103b9a instanceof ct)throw _0x103b9a;if(_0x103b9a instanceof Error&&'AbortError'===_0x103b9a['name'])throw new ct('ai-request-aborted',this,{'originalError':_0x103b9a});throw new ct('ai-request-failed',this,{'originalError':_0x103b9a});}};function ms(_0x11805f){return _0x11805f?.['length']?{'contexts':_0x11805f['map'](ps)}:{};}function Ts(_0x7a1ab8,_0x1d7b38,_0x374a36){const t=_0x7a1ab8['t'];switch(_0x1d7b38){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'},_0x374a36);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_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});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.'},_0x374a36);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.'},_0x374a36);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_LIBRARY_LABEL':return t({'id':'AI_CHAT_CONTEXT_LIBRARY_LABEL','string':'Context\x20library'});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.'},_0x374a36);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'},_0x374a36);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x374a36);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'},_0x374a36);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.'},_0x374a36);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.'},_0x374a36);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.'},_0x374a36);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.'},_0x374a36);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'},_0x374a36);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.'},_0x374a36);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.'});default:return _0x1d7b38;}}const ws=/* #__PURE__ -- @preserve */
25
- dt();var Cs=class extends ws{_connector;['_config'];['_locale'];_modelList=[];_modelsRequest=null;constructor({connector:_0x368571,config:_0x237d53,locale:_0x33037e}){super(),this['_connector']=_0x368571,this['_config']=_0x237d53,this['_locale']=_0x33037e;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get _defaultModelId(){return this['_config']?.['defaultModelId'];}async getAllModels(){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()['catch'](_0x446a21=>{throw this['_modelsRequest']=null,_0x446a21;})),this['_modelsRequest'];}async getAvailableModels(){const _0xcbb3aa=await this['getAllModels']();let _0x17912b;return _0x17912b=this['_availableModels']?this['_filterModels'](_0xcbb3aa,this['_availableModels']):_0xcbb3aa['filter'](_0x5638f1=>_0x5638f1['recommended']),_0x17912b;}async['resolveModel'](_0x55bae5){const _0x43319d=await this['getAllModels']();if(!_0x43319d['length'])return null;if(_0x55bae5){const _0x39eec9=this['_getModelById'](_0x43319d,_0x55bae5);if(_0x39eec9)return _0x39eec9;Ot('ai-chat-model-id-unrecognized',{'modelId':_0x55bae5,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async getDefault(){const _0x47c37a=await this['getAvailableModels']();if(!_0x47c37a['length'])return null;if(this['_defaultModelId']){const _0x4bc6d1=this['_getModelById'](_0x47c37a,this['_defaultModelId']);if(_0x4bc6d1)return _0x4bc6d1;Ot('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x47c37a[0x0]['id']});}return _0x47c37a[0x0];}async['isAvailable'](_0x307d28){return(await this['getAvailableModels']())['some'](_0x36b221=>_0x36b221['name']===_0x307d28['name']&&_0x36b221['provider']===_0x307d28['provider']);}async getModel(_0x20033c){const _0x4230ed=await this['getAllModels']();return this['_getModelById'](_0x4230ed,_0x20033c)||null;}async _retrieveModels(){if(!this['_modelList']['length']){const _0x4f2e29=this['_locale']['uiLanguage']||'en',_0x224386=await this['_connector']['getModels'](_0x4f2e29)['list']();this['_modelList']=_0x224386['items']['map'](_0x1a2fad=>fs(_0x1a2fad)?{..._0x1a2fad,'name':Ts(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x1a2fad);}return[...this['_modelList']];}_filterModels(_0x33d014,_0x50b360){let _0x448f2a;if(_0x50b360){_0x448f2a=[];const _0xc42e06=new Set(),_0x470807='string'==typeof _0x50b360?[_0x50b360['toLocaleLowerCase']()]:_0x50b360['map'](_0x42d9aa=>_0x42d9aa['toLocaleLowerCase']());for(const _0xc3f5cf of _0x470807)for(const _0x1373fd of _0x33d014)!_0xc42e06['has'](_0x1373fd['id'])&&this['_isMatchingFilter'](_0x1373fd,_0xc3f5cf)&&(_0x448f2a['push'](_0x1373fd),_0xc42e06['add'](_0x1373fd['id']));}else _0x448f2a=_0x33d014;return _0x448f2a;}_isMatchingFilter(_0x44ebb0,_0x1e94fd){const _0x539c9f=_0x44ebb0['id']['toLocaleLowerCase'](),_0x17a5c4=_0x44ebb0['name']['toLocaleLowerCase'](),_0x306247=_0x44ebb0['provider']['toLocaleLowerCase']();return _0x539c9f===_0x1e94fd||_0x17a5c4===_0x1e94fd||fs(_0x44ebb0)&&'auto'===_0x1e94fd||_0x306247===_0x1e94fd||_0x539c9f['startsWith'](_0x1e94fd);}_getModelById(_0x5828e4,_0x96d6a4){return _0x5828e4['find'](_0x63c213=>fs(_0x63c213)&&'auto'===_0x96d6a4?_0x63c213:_0x63c213['id']===_0x96d6a4)||null;}};function fs(_0x3889d3){return _0x3889d3['id']['startsWith']('agent');}var bs=class{_connector;_defaultContext;_contextsRequest=null;constructor({connector:_0x37bc92,defaultContext:_0x35e88b}){this['_connector']=_0x37bc92,this['_defaultContext']=_0x35e88b;}async getAllContexts(){return this['_contextsRequest']||(this['_contextsRequest']=this['_connector']['listContexts']()['getContexts']()['catch'](_0x2e0ef8=>{throw this['_contextsRequest']=null,_0x2e0ef8;})),[...await this['_contextsRequest']];}async getAvailableContexts(){const _0x2f92ba=await this['getAllContexts'](),_0x14581a=new Set((this['_defaultContext']??[])['map'](_0xd59c62=>_0xd59c62['id']));return _0x2f92ba['filter'](_0x4c54bf=>!_0x14581a['has'](_0x4c54bf['id']));}resolveContext({feature:_0x3bc06c,ids:_0x2f5a1b=[],extraContexts:_0x3d425b=[],idScopedOnly:_0x514219=!0x1,context:_0x4939cb}){const _0x530387=this['_resolveDefaultContext'](_0x3bc06c,_0x2f5a1b,_0x514219);return _0x4939cb['addDefaultContext']([..._0x530387,..._0x3d425b]),_0x4939cb;}_resolveDefaultContext(_0x4b769c,_0xdfc5aa,_0x2558f8=!0x1){if(!this['_defaultContext'])return[];const _0x38d966=[];for(const _0x192ea3 of this['_defaultContext'])this['_entryAppliesToFeature'](_0x192ea3['features'],_0x4b769c,_0xdfc5aa)&&(_0x2558f8&&this['_entryAppliesToFeature'](_0x192ea3['features'],_0x4b769c,[])||_0x38d966['push'](this['_toContextRef'](_0x192ea3)));return _0x38d966;}_toContextRef(_0x13d365){return'promptId'in _0x13d365?{'id':_0x13d365['id'],'promptId':_0x13d365['promptId']}:'fileId'in _0x13d365?{'id':_0x13d365['id'],'fileId':_0x13d365['fileId']}:{'id':_0x13d365['id']};}_entryAppliesToFeature(_0x4da92f,_0x372703,_0x527b4){if(!_0x4da92f)return!0x0;const _0x363ea3=_0x4da92f[_0x372703];return!!_0x363ea3&&(!0x0===_0x363ea3||_0x527b4['some'](_0x3fe6c5=>_0x363ea3['test'](_0x3fe6c5)));}},Ss=class extends _0x45fe7d{['models'];contextLibrary;static get['pluginName'](){return'AICore';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[Es];}init(){const _0x97eeaf=this['context']['plugins']['get'](Es);this['models']=new Cs({'connector':_0x97eeaf,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),this['contextLibrary']=new bs({'connector':_0x97eeaf,'defaultContext':this['context']['config']['get']('ai.defaultContext')});}};function Rs(_0x394a24){return _0x394a24?_0x394a24 instanceof _0x5c73d5?[_0x394a24]:_0x394a24['editors']&&0x0!==_0x394a24['editors']['length']?Array['from'](_0x394a24['editors']):[]:[];}function Os(_0x4391ca){const _0xbc7b39=Rs(_0x4391ca);if(!_0xbc7b39['length'])throw new ct('ai-get-editor-from-context-no-editor');if(0x1===_0xbc7b39['length'])return _0xbc7b39[0x0];const _0x4388b1=_0xbc7b39['find'](_0x57c4dc=>_0x57c4dc['ui']?.['focusTracker']?.['isFocused']);if(_0x4388b1)return _0x4388b1;const _0x52a545=function(_0xed1ae9){if(_0xed1ae9 instanceof _0x5c73d5)return;const _0x3d5622=_0xed1ae9;if(!_0x3d5622['plugins']||!_0x3d5622['plugins']['has']('AIEditing'))return;return _0x3d5622['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x4391ca);return _0x52a545&&_0xbc7b39['includes'](_0x52a545)?_0x52a545:_0xbc7b39[0x0];}function vs(_0x4ab9fb,_0x385af8){return _0x4aaf38(_0x4ab9fb,_0x385af8);}function ks(_0x29be20,_0x4f0884){return _0x3395d0(_0x29be20,_0x4f0884);}function ys(_0x3e770d,_0x32da04,_0x20a7f8){const _0xd8060b=null!==_0x32da04?_0x48fd35=>_0x48fd35['attribs'][_0x3e770d]===_0x32da04:_0xc882d4=>Boolean(_0xc882d4['attribs'][_0x3e770d]);return _0x11f9ef(_0x1a30f9=>_0x3b00a1(_0x1a30f9)&&_0xd8060b(_0x1a30f9),_0x20a7f8);}function Ns(_0x5c7603,_0x28ffff,_0x26287b){const _0x25c3ca=null!==_0x28ffff?_0x308be1=>_0x308be1['attribs'][_0x5c7603]===_0x28ffff:_0x38ec3f=>Boolean(_0x38ec3f['attribs'][_0x5c7603]);return _0x1b7e15(_0x5073d6=>_0x3b00a1(_0x5073d6)&&_0x25c3ca(_0x5073d6),_0x26287b);}function xs(_0x4635f5){return _0x1b7e15(_0x430074=>_0x3b00a1(_0x430074)&&function(_0x5a6fd7){const _0x4d72d3=_0x5a6fd7['toLowerCase']();return'script'===_0x4d72d3||'style'===_0x4d72d3||_0x4d72d3['includes']('-');}(_0x430074['name']),_0x4635f5);}const Ls=['comment-start','comment-end','suggestion-start','suggestion-end'];function Ps(_0x5ea245){return _0x3b00a1(_0x5ea245)&&Ls['includes'](_0x5ea245['name']['toLowerCase']());}function Ds(_0x46f075){return _0x3cf4b1(_0x38e6b5=>ti(_0x38e6b5),_0x46f075,!0x0,0x1/0x0);}function Hs(_0x37269d,_0x92fe77){return _0x37269d&&_0x3b00a1(_0x37269d)?_0x37269d['attribs'][_0x92fe77]:null;}function Ms(_0x375871,_0x451e52,_0x343a60){_0x3b00a1(_0x375871)&&(null===_0x343a60?delete _0x375871['attribs'][_0x451e52]:_0x375871['attribs'][_0x451e52]=_0x343a60);}function Us(_0x2c933a,_0x5629e4,_0x56fba8){const _0x12d039=_0x5629e4['cloneNode'](!0x0);'beforebegin'===_0x56fba8?_0x200678(_0x2c933a,_0x12d039):'afterbegin'===_0x56fba8?_0xbccd04(_0x2c933a,_0x12d039):'beforeend'===_0x56fba8?_0x30ab63(_0x2c933a,_0x12d039):'afterend'===_0x56fba8&&_0x633a95(_0x2c933a,_0x12d039);}function Vs(_0x17d52f){const _0x2aa4a3=[];let _0x5ec7ee=_0x17d52f;for(;_0x5ec7ee;)_0x5ec7ee=_0x1e8dd2(_0x5ec7ee),_0x5ec7ee&&_0x2aa4a3['push'](_0x5ec7ee);return _0x2aa4a3;}function Bs(_0x597535){return _0x597535['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Gs(_0x1d56b1){let _0x5ec42b=0x0;for(;_0x1d56b1['parentNode'];)_0x1d56b1=_0x1d56b1['parentNode'],_0x5ec42b++;return _0x5ec42b;}function Fs(_0x190315){const _0x3fb3b3=[];let _0x50bd35=_0x190315['nextSibling'];for(;_0x50bd35;)_0x3fb3b3['push'](_0x50bd35),_0x50bd35=_0x50bd35['nextSibling'];_0x3fb3b3['forEach'](_0x14a9d3=>{_0x147247(_0x14a9d3);});}function Ks(_0x462c60,_0x42efe5){return!!_0x462c60['model']['document']['getRoot'](_0x42efe5)&&!_0x1d1635(_0x462c60,_0x42efe5);}function Ws(_0x536aca,_0x4a176e){return'<p\x20data-id=\x22'+_0x4a176e+'\x22>'+_0x536aca+'</p>';}function Ys(_0xf7840e){return'p'===_0xf7840e['name']['toLowerCase']()&&Boolean(_0xf7840e['attribs']['data-id']);}function $s(_0x5dc11b){const _0x557576=vs(_0x5dc11b)['children']['filter'](_0x3b00a1);return 0x1===_0x557576['length']&&Ys(_0x557576[0x0])?_0x557576[0x0]['children']['map'](_0x3fb887=>ks(_0x3fb887))['join'](''):_0x5dc11b;}function qs(_0x7d780a,_0x2082f1){const _0x415b8f=function(_0x4926e8){const _0x54eb53=_0x4926e8['children']['filter'](_0x3b00a1);return 0x1===_0x54eb53['length']&&Ys(_0x54eb53[0x0])?_0x54eb53[0x0]['children']:_0x4926e8['children'];}(_0x2082f1),{blockElements:_0x51b83a}=_0x7d780a['editing']['view']['domConverter'],_0x528139=_0x55353c=>_0x55353c['some'](_0x420563=>_0x3b00a1(_0x420563)&&('p'!==_0x420563['name']['toLowerCase']()&&_0x51b83a['includes'](_0x420563['name']['toLowerCase']())||_0x528139(_0x420563['children'])));if(_0x528139(_0x415b8f))return!0x1;const _0x59e68e=_0x415b8f['map'](_0x305860=>ks(_0x305860))['join'](''),_0x126bf1=_0x7d780a['data']['parse'](_0x59e68e,'$root'),{schema:_0x1c13ac}=_0x7d780a['model'];let _0x139e40=0x0;for(const {item:_0x1b5e72}of _0x7d780a['model']['createRangeIn'](_0x126bf1))if(_0x1b5e72['is']('element')&&_0x1c13ac['isBlock'](_0x1b5e72)&&(++_0x139e40>0x1||'paragraph'!==_0x1b5e72['name']))return!0x1;return!0x0;}function Qs(_0x12b374,_0x136848){const _0x18bdb7=_0x136848['filter'](_0x341458=>'new'!=_0x341458['type'])['map'](_0x2cc182=>ys('data-id',_0x2cc182['id'],_0x12b374))['filter'](_0x451d26=>null!==_0x451d26),_0x262dae=_0x136848['filter'](_0x163602=>'removed'!=_0x163602['type'])['map'](_0x311640=>_0x311640['node']['cloneNode'](!0x0));let _0xf216e5=null;if(_0x18bdb7['length']){_0xf216e5=_0x18bdb7[0x0]['previousSibling'];for(let _0x2d9abb=0x0;_0x2d9abb<_0x18bdb7['length'];_0x2d9abb++)_0x147247(_0x18bdb7[_0x2d9abb]);}if(_0x262dae['length']){_0xf216e5||(_0x136848[0x0]['anchorId']?_0xf216e5=ys('data-id',_0x136848[0x0]['anchorId'],_0x12b374):(_0xf216e5=_0x262dae['shift'](),_0xbccd04(_0x12b374,_0xf216e5)));for(let _0x17a620=0x0;_0x17a620<_0x262dae['length'];_0x17a620++)_0x633a95(_0xf216e5,_0x262dae[_0x17a620]),_0xf216e5=_0x262dae[_0x17a620];}}function Xs(_0x185cdf,_0x4e3c36){const _0x402fbb=new Set();for(const _0x13ca9f of _0x185cdf){if(!_0x13ca9f['editor']||'destroyed'===_0x13ca9f['editor']['state']||!Ks(_0x13ca9f['editor'],_0x13ca9f['rootName']))continue;const _0x5bb44f=_0x4e3c36['get'](_0x13ca9f['documentId']);let _0x18344a;_0x5bb44f?(_0x18344a=_0x5bb44f['cloneNode'](!0x0),Qs(_0x18344a,_0x13ca9f['changes'])):_0x18344a=new _0x59229a(_0x13ca9f['changes']['filter'](_0x299b81=>'removed'!=_0x299b81['type'])['map'](_0x481f57=>_0x481f57['node']['cloneNode'](!0x0))),qs(_0x13ca9f['editor'],_0x18344a)||_0x402fbb['add'](_0x13ca9f['index']);}return _0x402fbb;}function zs(_0x19c069,_0x52ce8b,_0x50b95a,_0x1a7dc2){return Ks(_0x19c069,_0x52ce8b)?qs(_0x19c069,vs(_0x1a7dc2))?{'before':$s(_0x50b95a),'after':$s(_0x1a7dc2)}:null:{'before':_0x50b95a,'after':_0x1a7dc2};}function js(_0x23b079,_0x59de97){return _0x50b2c9(_0x23b079,_0x59de97);}function Js(_0x2bed10,_0x383819){return _0x2bed10['map'](_0xa8010c=>null!==_0xa8010c&&'object'==typeof _0xa8010c?js(_0xa8010c,_0x383819):_0xa8010c);}const Zs=[['BlockQuoteEditing','blockQuote'],['BoldEditing','bold'],['BookmarkEditing','bookmark'],['CodeEditing','code'],['HorizontalLineEditing','horizontalLine'],['HtmlEmbedEditing','htmlEmbed'],['ItalicEditing','italic'],['MathType','math'],['PageBreakEditing','pageBreak'],['Paragraph','paragraph'],['StandardEditingModeEditing','restrictedEditing'],['StrikethroughEditing','strikethrough'],['SubscriptEditing','subscript'],['SuperscriptEditing','superscript'],['TableOfContentsEditing','tableOfContents'],['Title','title'],['TodoListEditing','todoList'],['UnderlineEditing','underline']],tn='ai-selection',en=['br'];var sn=class extends _0x45fe7d{constructor(_0x5c792a){super(_0x5c792a),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}_outputDataProcessor;_fakeSelections=[];_sessionIdByEditor=new WeakMap();_editorsToConfigs=new WeakMap();_lastContentFocusedEditor;static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}getLastContentFocusedEditor(){return this['_lastContentFocusedEditor'];}getSessionId(_0x3dbacc){let _0x5e9b38=this['_sessionIdByEditor']['get'](_0x3dbacc);return _0x5e9b38||(_0x5e9b38=_0x3dbacc['plugins']['has']('RealTimeCollaborationClient')&&_0x3dbacc['plugins']['get']('RealTimeCollaborationClient')['sessionId']||Nt(),this['_sessionIdByEditor']['set'](_0x3dbacc,_0x5e9b38)),_0x5e9b38;}async getDocumentData(_0x35d6cc){const _0x3a6860=Rs(this['context']),_0x988aff=[],_0xf9439e=new Set();for(const _0x1df47e of _0x3a6860){if(_0x35d6cc&&!_0x35d6cc['has'](_0x1df47e['config']['get']('collaboration.channelId')))continue;const _0x7e4d89=_0x1df47e['config']['get']('roots')||{},_0x12a0cc=this['_getEditorSelectionSignature'](_0x1df47e),_0xcab9e2=_0x1df47e['config']['get']('collaboration.channelId'),_0x5589c7=this['getSessionId'](_0x1df47e);for(const _0xdcccbf of _0x1df47e['model']['document']['getRoots']()){if('$graveyard'===_0xdcccbf['rootName'])continue;const _0x55dd11=await this['_getDocumentDataForEditorRoot'](_0x1df47e,_0xdcccbf,_0xf9439e),_0x434806=_0x7e4d89[_0xdcccbf['rootName']],_0xbb2b41=_0xdcccbf['getAttribute']('$description')??_0x434806?.['description'];let _0x176b6d=_0xdcccbf['getAttribute']('$title')??_0x434806?.['title'];_0x176b6d||(_0x176b6d=_0xdcccbf['getAttribute']('$rootEditableOptions')?.['label']??_0x434806?.['label']),_0x176b6d||(Ot('ai-document-root-missing-title',{'editor':_0x1df47e,'rootName':_0xdcccbf['rootName']}),_0x176b6d=_0xdcccbf['rootName']),_0x988aff['push']({'editor':_0x1df47e,'rootName':_0xdcccbf['rootName'],'content':_0x55dd11['content'],'version':_0x55dd11['version'],'sessionId':_0x5589c7,'channelId':_0xcab9e2,'selections':_0x55dd11['selections'],'selectionSignature':_0x12a0cc,'editorConfig':this['_getEditorConfig'](_0x1df47e),'name':_0x176b6d,'description':_0xbb2b41});}}return _0x988aff;}getEditorsVersions(){const _0x46cbab=Rs(this['context']),_0x41705f=new Map();for(const _0x317b41 of _0x46cbab){const _0x522d2b=_0x317b41['config']['get']('collaboration.channelId');_0x41705f['set'](_0x522d2b,_0x317b41['model']['document']['version']);}return _0x41705f;}getEditorsSelections(){const _0x3ab467=Rs(this['context']),_0x1d97fb=new Map();for(const _0x56db9f of _0x3ab467){const _0x4c1983=_0x56db9f['config']['get']('collaboration.channelId'),_0xe10759=this['_getEditorSelectionSignature'](_0x56db9f);_0x1d97fb['set'](_0x4c1983,_0xe10759);}return _0x1d97fb;}_getEditorSelectionSignature(_0x4d5c03){return this['_getMarkersInDocumentOrder'](_0x4d5c03)['map'](_0x33561d=>{const _0x328e62=_0x33561d['getRange']();return _0x328e62['root']['rootName']+':'+_0x328e62['start']['path']['join']('.')+'-'+_0x328e62['end']['path']['join']('.');})['join']('|');}async _getDocumentDataForEditorRoot(_0xbdb4b8,_0x45275f,_0x60bd1d){const _0x1263ed=_0xbdb4b8['data']['toView'](_0x45275f,{'convertAiChatSelectionMarker':!0x0}),_0x3ff66d=new _0x353d59(_0xbdb4b8['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x1263ed,_0x3ff66d,_0x60bd1d);let _0x432751=await this['_getDocumentDataStringFromView'](_0x1263ed,_0xbdb4b8);Ks(_0xbdb4b8,_0x45275f['rootName'])&&(_0x432751=Ws(_0x432751,this['_nextDataId'](_0x60bd1d)));const _0x46d2d8=this['_getMarkersInDocumentOrder'](_0xbdb4b8,_0x45275f),_0x113da0=[];for(const _0x2a1392 of _0x46d2d8){const _0x15b98d='<'+_0x2a1392['name']+':start></'+_0x2a1392['name']+':start>',_0x1265ba=_0x432751['indexOf'](_0x15b98d);_0x432751=_0x432751['substring'](0x0,_0x1265ba)+_0x432751['substring'](_0x1265ba+_0x15b98d['length']);const _0x1e8255='<'+_0x2a1392['name']+':end></'+_0x2a1392['name']+':end>',_0x48541a=_0x432751['indexOf'](_0x1e8255);_0x432751=_0x432751['substring'](0x0,_0x48541a)+_0x432751['substring'](_0x48541a+_0x1e8255['length']),_0x113da0['push']({'markerName':_0x2a1392['name'],'start':_0x1265ba,'end':_0x48541a,'htmlFragment':_0x432751['substring'](_0x1265ba,_0x48541a)});}return{'content':_0x432751,'version':_0xbdb4b8['model']['document']['version'],'selections':_0x113da0};}afterInit(){this['context']instanceof _0x5c73d5?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0xe3f70d,_0x3dbbba)=>{_0x3dbbba['on']('ready',()=>{this['_integrateEditor'](_0x3dbbba);});});}_setOutputDataProcessor(_0x33198a){this['_outputDataProcessor']=_0x33198a;}async _getDocumentDataStringFromView(_0x2460b2,_0x4c7d2f){let _0x3488f5;if(this['_outputDataProcessor']){const _0x12a710=_0x4c7d2f['data']['processor']['domConverter']['viewToDom'](_0x2460b2),_0x2b643b=await this['_outputDataProcessor'](_0x12a710);_0x3488f5=_0x4c7d2f['data']['processor']['htmlWriter']['getHtml'](_0x2b643b);}else _0x3488f5=_0x4c7d2f['data']['processor']['toData'](_0x2460b2);return _0x3488f5;}_integrateEditor(_0x5c44ee){if(!_0x5c44ee['config']['get']('collaboration.channelId'))throw new ct('ai-missing-channel-id',_0x5c44ee);_0x5c44ee['ui']['focusTracker']['on']('change:isFocused',(_0x26c6c2,_0x6d40cf,_0x3d3321)=>{_0x3d3321&&(this['_lastContentFocusedEditor']=_0x5c44ee);}),_0x5c44ee['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x5c44ee&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x5c44ee['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tn,'view':({markerName:_0x5760bf})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x5760bf['split'](':')[0x1]],'priority':0xc})}),_0x5c44ee['conversion']['for']('dataDowncast')['markerToElement']({'model':tn+':context','view':(_0x3d92a3,{writer:_0x4d1347,options:_0x220e7e})=>_0x220e7e['convertAiChatSelectionMarker']?_0x4d1347['createUIElement'](_0x3d92a3['markerName']+':'+(_0x3d92a3['isOpening']?'start':'end')):null});}showFakeVisualSelection(_0x49d356){const _0x2bf1f9=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x49d356);const _0x41467d=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x2bf1f9,_0x41467d);}hideFakeVisualSelection(_0x54ca78){const _0x26c6dd=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x54ca78);const _0x231b84=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x26c6dd,_0x231b84);}async modelToDataWithIds(_0x5a1fca,_0x5a5bcc,_0x1caaca){const _0x5f6ef9=_0x5a5bcc['data']['toView'](_0x5a1fca),_0x4aa9ae=new _0x353d59(_0x5a5bcc['editing']['view']['document']),_0x47d58b=new Set();this['_setDataIdsOnChildren'](_0x5f6ef9,_0x4aa9ae,_0x47d58b);const _0x50f599=await this['_getDocumentDataStringFromView'](_0x5f6ef9,_0x5a5bcc);return _0x1caaca&&Ks(_0x5a5bcc,_0x1caaca)?Ws(_0x50f599,this['_nextDataId'](_0x47d58b)):_0x50f599;}_setDataIdsOnChildren(_0x2094ed,_0x147084,_0x50fb88=new Set()){let _0x236db7=!0x1;for(const _0x55c8a3 of _0x2094ed['getChildren']()){if(!_0x55c8a3['is']('view:element')||en['includes'](_0x55c8a3['name']))continue;const _0x2d2d68=_0x55c8a3['is']('view:containerElement'),_0x5b8c5d=_0x55c8a3['is']('view:emptyElement'),_0x45d9a9=_0x55c8a3['is']('view:rawElement'),_0x427cc2=this['_setDataIdsOnChildren'](_0x55c8a3,_0x147084,_0x50fb88);_0x55c8a3['hasAttribute']('data-id')?(_0x236db7=!0x0,_0x50fb88['add'](_0x55c8a3['getAttribute']('data-id'))):(_0x2d2d68||_0x5b8c5d||_0x45d9a9||_0x427cc2)&&(_0x147084['setAttribute']('data-id',this['_nextDataId'](_0x50fb88),_0x55c8a3),_0x236db7=!0x0);}return _0x236db7;}_nextDataId(_0x5c3b6f){let _0x57377d;do{_0x57377d='';for(let _0x5d45c5=0x0;_0x5d45c5<0x4;_0x5d45c5++)_0x57377d+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x5c3b6f['has'](_0x57377d));return _0x5c3b6f['add'](_0x57377d),_0x57377d;}getSelectionText(_0x1d9b4d){const _0x58b4fb=(_0x1d9b4d?_0x1d9b4d['model']:Os(this['context'])['model'])['document']['selection'],_0x10e180=[],_0x141e9a=Array['from'](_0x58b4fb['getRanges']());_0x141e9a['sort']((_0x1ee64b,_0xd66a94)=>_0x1ee64b['start']['isBefore'](_0xd66a94['start'])?-0x1:0x1);for(const _0x1ac870 of _0x141e9a)for(const _0x130672 of _0x1ac870['getItems']())_0x130672['is']('$textProxy')?_0x10e180['push'](_0x130672['data']):_0x130672['is']('element')&&_0x10e180['length']>0x0&&'\x20'!==_0x10e180[_0x10e180['length']-0x1]&&_0x10e180['push']('\x20');return _0x10e180['length']?'\x22'+_0x10e180['join']('')['trim']()+'\x22':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}_removeFakeSelectionById(_0x2a89ce){for(let _0x204c59=0x0;_0x204c59<this['_fakeSelections']['length'];_0x204c59++)if(this['_fakeSelections'][_0x204c59]['id']==_0x2a89ce)return void this['_fakeSelections']['splice'](_0x204c59,0x1);}_addFakeSelection(_0x12e58d){this['_removeFakeSelectionById'](_0x12e58d['id']),ft(this['_fakeSelections'],_0x12e58d);}_refreshFakeSelection(_0x3054f1,_0x575bbb){if(_0x3054f1==_0x575bbb)return;const _0x3a06d6=_0x3054f1?_0x3054f1['editor']:null,_0x208980=_0x575bbb?_0x575bbb['editor']:null,_0x4d85a3=(_0x4760d8,_0x471207)=>{const _0x88e81d=_0x471207['model']['markers']['getMarkersGroup'](tn);for(const _0x3b3598 of _0x88e81d)_0x4760d8['removeMarker'](_0x3b3598);},_0x498d41=(_0x2c8294,_0x352d7a,_0x4930dc)=>{const _0x33f7d7=_0x352d7a['model'];for(let _0x2bd8be=0x0;_0x2bd8be<_0x4930dc['ranges']['length'];_0x2bd8be++){let _0xf50799=_0x4930dc['ranges'][_0x2bd8be];const _0x26459a=tn+':'+_0x4930dc['id']+':'+_0x2bd8be;if(_0xf50799['start']['isAtEnd']){const _0x2d3793=_0xf50799['start']['getLastMatchingPosition'](({item:_0x4c4b9c})=>!_0x33f7d7['schema']['isContent'](_0x4c4b9c),{'boundaries':_0xf50799});_0xf50799=_0x2c8294['createRange'](_0x2d3793,_0xf50799['end']);}_0x2c8294['addMarker'](_0x26459a,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0xf50799});}};_0x3a06d6&&_0x208980&&_0x3a06d6===_0x208980&&_0x575bbb?_0x3a06d6['model']['change'](_0x2d685d=>{_0x4d85a3(_0x2d685d,_0x3a06d6),_0x498d41(_0x2d685d,_0x208980,_0x575bbb);}):(_0x3a06d6&&_0x3a06d6['model']['change'](_0x1a3bd5=>_0x4d85a3(_0x1a3bd5,_0x3a06d6)),_0x208980&&_0x575bbb&&_0x208980['model']['change'](_0x56c005=>_0x498d41(_0x56c005,_0x208980,_0x575bbb)));}_getMarkersInDocumentOrder(_0x5a17f4,_0x195207){const _0x4af812=Array['from'](_0x5a17f4['model']['markers']['getMarkersGroup'](tn+':context'));return(_0x195207?_0x4af812['filter'](_0x34e03d=>{const _0xd68dfc=_0x34e03d['getRange']();return _0xd68dfc&&_0xd68dfc['root']['rootName']===_0x195207['rootName'];}):_0x4af812)['sort']((_0x1f5ce6,_0x4d481c)=>_0x1f5ce6['getStart']()['isBefore'](_0x4d481c['getStart']())?-0x1:_0x1f5ce6['getStart']()['isAfter'](_0x4d481c['getStart']())?0x1:0x0);}_getEditorConfig(_0x231b20){let _0x3272a8=this['_editorsToConfigs']['get'](_0x231b20);return _0x3272a8||(_0x3272a8=function(_0x49cf82){const _0x486582={};if(_0x49cf82['plugins']['has']('AlignmentEditing')&&(_0x486582['alignment']=_0x49cf82['config']['get']('alignment')),_0x49cf82['plugins']['has']('CodeBlockEditing')&&(_0x486582['codeBlock']=_0x49cf82['config']['get']('codeBlock')),_0x49cf82['plugins']['has']('FontBackgroundColorEditing')&&(_0x486582['fontBackgroundColor']=js(_0x49cf82['config']['get']('fontBackgroundColor'),['documentColors','columns','colorPicker'])),_0x49cf82['plugins']['has']('FontColorEditing')&&(_0x486582['fontColor']=js(_0x49cf82['config']['get']('fontColor'),['documentColors','columns','colorPicker'])),_0x49cf82['plugins']['has']('FontFamilyEditing')&&(_0x486582['fontFamily']=_0x49cf82['config']['get']('fontFamily'),_0x486582['fontFamily']&&_0x486582['fontFamily']['options']&&(_0x486582['fontFamily']['options']=Js(_0x486582['fontFamily']['options'],['model','upcastAlso']))),_0x49cf82['plugins']['has']('FontSizeEditing')&&(_0x486582['fontSize']=_0x49cf82['config']['get']('fontSize'),_0x486582['fontSize']&&_0x486582['fontSize']['options']&&(_0x486582['fontSize']['options']=Js(_0x486582['fontSize']['options'],['upcastAlso']))),_0x49cf82['plugins']['has']('FootnotesEditing')){const _0x504316=_0x49cf82['config']['get']('footnotes')??{};_0x504316['footnotesProperties']&&'object'==typeof _0x504316['footnotesProperties']&&(_0x504316['footnotesProperties']=js(_0x504316['footnotesProperties'],['toolbar','listStyles'])),_0x486582['footnotes']=_0x504316;}if(_0x49cf82['plugins']['has']('HeadingEditing')&&(_0x486582['heading']=_0x49cf82['config']['get']('heading'),_0x486582['heading']&&_0x486582['heading']['options']&&(_0x486582['heading']['options']=Js(_0x486582['heading']['options'],['model','icon','class','converterPriority','upcastAlso']))),_0x49cf82['plugins']['has']('HighlightEditing')&&(_0x486582['highlight']=_0x49cf82['config']['get']('highlight'),_0x486582['highlight']&&_0x486582['highlight']['options']&&(_0x486582['highlight']['options']=Js(_0x486582['highlight']['options'],['model','color']))),_0x49cf82['plugins']['has']('ImageBlockEditing')||_0x49cf82['plugins']['has']('ImageInlineEditing')){const _0x4c45f0=js(_0x49cf82['config']['get']('image'),['toolbar','upload','insert','resizeOptions']);_0x49cf82['plugins']['has']('ImageResizeEditing')||delete _0x4c45f0['resizeUnit'],_0x49cf82['plugins']['has']('ImageStyleEditing')?_0x4c45f0['styles']?.['options']&&(_0x4c45f0['styles']['options']=Js(_0x4c45f0['styles']['options'],['icon'])):delete _0x4c45f0['styles'],_0x486582['image']=_0x4c45f0;}if(_0x49cf82['plugins']['has']('IndentBlock')&&(_0x486582['indentBlock']=_0x49cf82['config']['get']('indentBlock')),_0x49cf82['plugins']['has']('LineHeightEditing')&&(_0x486582['lineHeight']=_0x49cf82['config']['get']('lineHeight'),_0x486582['lineHeight']&&(delete _0x486582['lineHeight']['supportAllValues'],_0x486582['lineHeight']['options']&&(_0x486582['lineHeight']['options']=Js(_0x486582['lineHeight']['options'],['model'])))),_0x49cf82['plugins']['has']('LinkEditing')&&(_0x486582['link']=js(_0x49cf82['config']['get']('link'),['toolbar'])),_0x49cf82['plugins']['has']('ListEditing')){const _0x382a65=_0x49cf82['config']['get']('list')??{};delete _0x382a65['enableListItemMarkerFormatting'],_0x49cf82['plugins']['has']('ListPropertiesEditing')?_0x382a65['properties']&&_0x382a65['properties']['styles']&&'object'==typeof _0x382a65['properties']['styles']&&(_0x382a65['properties']['styles']=js(_0x382a65['properties']['styles'],['listStyleTypes'])):delete _0x382a65['properties'],_0x486582['list']=_0x382a65;}if(_0x49cf82['plugins']['has']('MediaEmbedEditing')&&(_0x486582['mediaEmbed']=_0x49cf82['config']['get']('mediaEmbed'),_0x486582['mediaEmbed']&&(delete _0x486582['mediaEmbed']['toolbar'],_0x49cf82['plugins']['has']('MediaEmbedResizeEditing')?_0x486582['mediaEmbed']['resizeOptions']&&(_0x486582['mediaEmbed']['resizeOptions']=_0x486582['mediaEmbed']['resizeOptions']['map'](_0x343514=>js(_0x343514,['icon','label']))):delete _0x486582['mediaEmbed']['resizeOptions'],_0x49cf82['plugins']['has']('MediaEmbedStyleEditing')?_0x486582['mediaEmbed']['styles']&&_0x486582['mediaEmbed']['styles']['options']&&(_0x486582['mediaEmbed']['styles']['options']=Js(_0x486582['mediaEmbed']['styles']['options'],['icon','title'])):delete _0x486582['mediaEmbed']['styles'])),_0x49cf82['plugins']['has']('MultiLevelListEditing')&&(_0x486582['listMultiLevel']=_0x49cf82['config']['get']('listMultiLevel')??{}),_0x49cf82['plugins']['has']('MentionEditing')){const _0x5918c8=js(_0x49cf82['config']['get']('mention'),['commitKeys','dropdownLimit']);_0x5918c8['feeds']&&(_0x5918c8['feeds']=_0x5918c8['feeds']['map'](_0x5ac7c3=>js(_0x5ac7c3,['minimumCharacters','itemRenderer','dropdownLimit']))),_0x486582['mention']=_0x5918c8;}if(_0x49cf82['plugins']['has']('MergeFieldsEditing')){const _0x140dac=js(_0x49cf82['config']['get']('mergeFields'),['previewModes','initialPreviewMode','previewHtmlValues','sanitizeHtml']);Array['isArray'](_0x140dac['definitions'])&&(_0x140dac['definitions']=_0x140dac['definitions']['map'](_0x47cfd9=>'groupId'in _0x47cfd9?(Array['isArray'](_0x47cfd9['definitions'])&&(_0x47cfd9['definitions']=_0x47cfd9['definitions']['map'](_0x4dbdd3=>js(_0x4dbdd3,['defaultValue']))),_0x47cfd9):js(_0x47cfd9,['defaultValue']))),_0x486582['mergeFields']=_0x140dac;}if(_0x49cf82['plugins']['has']('StyleEditing')&&(_0x486582['style']=_0x49cf82['config']['get']('style')),_0x49cf82['plugins']['has']('TableEditing')){const _0x50593d=js(_0x49cf82['config']['get']('table'),['contentToolbar','tableToolbar','showHiddenBorders']);_0x49cf82['plugins']['has']('TablePropertiesEditing')?_0x50593d['tableProperties']&&'object'==typeof _0x50593d['tableProperties']&&(_0x50593d['tableProperties']=js(_0x50593d['tableProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x50593d['tableProperties'],_0x49cf82['plugins']['has']('TableCellPropertiesEditing')?_0x50593d['tableCellProperties']&&'object'==typeof _0x50593d['tableCellProperties']&&(_0x50593d['tableCellProperties']=js(_0x50593d['tableCellProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x50593d['tableCellProperties'],_0x49cf82['plugins']['has']('TableLayoutEditing')?_0x50593d['tableLayout']||(_0x50593d['tableLayout']={}):delete _0x50593d['tableLayout'],_0x49cf82['plugins']['has']('TableCaptionEditing')?_0x50593d['tableCaption']||(_0x50593d['tableCaption']={}):delete _0x50593d['tableCaption'],_0x486582['table']=_0x50593d;}_0x49cf82['plugins']['has']('TextPartLanguageEditing')&&(_0x486582['textPartLanguage']=_0x49cf82['config']['get']('language.textPartLanguage'));for(const [_0x18419a,_0x146f43]of Zs)_0x49cf82['plugins']['has'](_0x18419a)&&(_0x486582[_0x146f43]={});return _0x486582;}(_0x231b20),this['_editorsToConfigs']['set'](_0x231b20,_0x3272a8)),_0x3272a8;}};const nn=/* #__PURE__ -- @preserve */
26
- At();var rn=class extends nn{_generateUid;_uidCounter=0x0;_touchedNodesState={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};_existingDataIds=new Set();_referencedExistingIds=new Set();constructor(_0x36b06e){super(),this['_generateUid']=_0x36b06e||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x3a350c,_0x4cca9e,_0x40954e){this['_uidCounter']=0x0;const _0x3170e7=_0x3a350c['cloneNode'](!0x0);hn(_0x4cca9e,_0x3170e7);const _0x48af47=_0x3170e7['childNodes'],_0x233e5e=Array['from'](_0x48af47)['filter'](_0xa72324=>!(0x3===_0xa72324['nodeType']&&''===ks(_0xa72324)['trim']())),_0x5cee86=_0x233e5e['length'];this['_existingDataIds']=new Set(Ns('data-id',null,_0x4cca9e)['map'](_0x2b5e98=>Hs(_0x2b5e98,'data-id'))['filter'](_0x7d9e5e=>!!_0x7d9e5e));for(const _0x8e2c0c of _0x233e5e)_0x8e2c0c&&_0x3b00a1(_0x8e2c0c)&&void 0x0===_0x8e2c0c['attribs']['data-id']&&Ms(_0x8e2c0c,'data-id','new-element');if(Ns('data-id',null,_0x3170e7)['forEach'](_0x131942=>{const _0x47adee=Hs(_0x131942,'data-id');'new-element'===_0x47adee||this['_existingDataIds']['has'](_0x47adee)||Ms(_0x131942,'data-id','new-element');}),0x0===_0x4cca9e['childNodes']['length']){const _0x522408=[];return Ns('data-id','new-element',_0x3170e7)['forEach'](_0xaea082=>{const _0x274454=this['_generateUid']();Ms(_0xaea082,'data-id',_0x274454),_0x522408['push'](_0x274454);}),this['_removeSpecialComments'](_0x3170e7),{'parsedContent':_0x3170e7,'newNodeIds':_0x522408,'modifiedNodeIds':[],'removedNodeIds':[]};}this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_touchedNodesState']['rescuedNewIds']=new Set(),this['_referencedExistingIds']=new Set();let _0x5f2702=-0x1,_0x2ae2ac=!0x1;for(let _0x467685=0x0;_0x467685<_0x5cee86;_0x467685++){const _0x3009d7=_0x233e5e[_0x467685],_0x7c8adb=_0x233e5e[_0x467685+0x1];if(this['_isNewNode'](_0x3009d7)){if(-0x1===_0x5f2702&&(_0x5f2702=_0x467685),this['_markWrappedElements'](_0x3009d7),!this['_isNewNode'](_0x7c8adb)){const [_0x3664af,_0x5548c7]=this['_findReferenceNode'](_0x3009d7,_0x2ae2ac,_0x4cca9e);if(_0x3664af){const _0x2feda8=Array['from'](_0x233e5e)['slice'](_0x5f2702,_0x467685+0x1);this['_insertNodes'](_0x3664af,_0x2feda8,_0x5548c7),_0x5f2702=-0x1;}}}else{if(this['_isExistingContentComment'](_0x3009d7))_0x2ae2ac=!0x0;else{if(this['_isExistingNode'](_0x3009d7)){const _0x1eeca6=Hs(_0x3009d7,'data-id');if(_0x1eeca6&&this['_existingDataIds']['has'](_0x1eeca6)){this['_referencedExistingIds']['add'](_0x1eeca6);const _0x14c49e=ys('data-id',_0x1eeca6,_0x4cca9e);this['_replaceNode'](_0x14c49e,_0x3009d7);}}else{if(on(_0x3009d7)){const _0x3cc73f=an(_0x3009d7);ys('data-id',_0x3cc73f,_0x3170e7)||this['_touchedNodesState']['removedIds']['push'](_0x3cc73f);}}}}}for(const _0xc921b6 of this['_touchedNodesState']['removedIds']){const _0x579978=ys('data-id',_0xc921b6,_0x4cca9e);_0x579978&&(this['_rescueUnwrappedElements'](_0x579978),this['_removeNode'](_0x579978,_0xc921b6,_0x40954e));}if(Ns('data-id','new-element',_0x4cca9e)['forEach'](_0x130345=>{const _0x35b6f7=this['_getUid'](_0x130345);Ms(_0x130345,'data-id',_0x35b6f7),this['_touchedNodesState']['newIds']['push'](_0x35b6f7);}),this['_removeSpecialComments'](_0x4cca9e),_0x40954e&&_0x40954e['cutAfterUnstable']){const _0x35641f=this['_findLastConfirmationPoint'](_0x233e5e),_0x422393=this['_getLastStableElement'](_0x4cca9e,_0x35641f);this['_markUnstableElements'](_0x4cca9e,_0x422393);}if(this['_processWrappedElements'](_0x4cca9e,_0x40954e),_0x40954e&&_0x40954e['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x82dfd=Ns('data-id',this['_touchedNodesState']['lastTouchedId'],_0x4cca9e);let _0x2b7225=_0x82dfd[_0x82dfd['length']-0x1];for(;_0x2b7225;)Fs(_0x2b7225),_0x2b7225=_0x2b7225['parentNode'];}return{'parsedContent':_0x4cca9e,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}_insertNodes(_0x11438b,_0x3f35e3,_0xd22085){for(const _0x3de5c7 of _0x3f35e3){const _0x25aefe=this['_getUid'](_0x3de5c7);Ms(_0x3de5c7,'data-id',_0x25aefe),this['_touchedNodesState']['newIds']['push'](_0x25aefe),this['_touchedNodesState']['lastTouchedId']=_0x25aefe;}const _0x5accd1='afterbegin'===_0xd22085||'afterend'===_0xd22085?_0x3f35e3['reverse']():_0x3f35e3;for(const _0x1dff72 of _0x5accd1)Us(_0x11438b,_0x1dff72,_0xd22085);}['_replaceNode'](_0x20b650,_0x471646){if(!_0x20b650)return;if(_0x3922ef=_0x471646,Bs(ks(_0x20b650))===Bs(ks(_0x3922ef)))return;var _0x3922ef;const _0x46a433=Hs(_0x20b650,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x46a433),this['_touchedNodesState']['lastTouchedId']=_0x46a433,_0x54b98e(_0x20b650,_0x471646['cloneNode'](!0x0));}['_removeNode'](_0x43b0a6,_0x5455ea,_0x399738){if(_0x399738&&_0x399738['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x5455ea;const _0x1518b0=_0x399738['replaceRemovedWith']['cloneNode'](!0x0);Ms(_0x1518b0,'data-id',_0x5455ea),Ms(_0x1518b0,'data-removed','true'),_0x54b98e(_0x43b0a6,_0x1518b0);}else _0x147247(_0x43b0a6);}['_findReferenceNode'](_0x29d196,_0x59d8d6,_0x3ef737){const _0x543e00=this['_findPrevElementWithDataId'](_0x29d196,!0x1);if(_0x543e00){const _0x3ecbf6=an(_0x543e00),_0x1a474a=ys('data-id',_0x3ecbf6,_0x3ef737);if(_0x1a474a)return[_0x1a474a,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x3ecbf6);}const _0x239e2b=this['_findNextElementWithDataId'](_0x29d196,!0x1);if(_0x239e2b){const _0x157549=an(_0x239e2b),_0x38ff29=ys('data-id',_0x157549,_0x3ef737);if(_0x38ff29)return[_0x38ff29,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x157549);}return _0x59d8d6?_0x29d196['nextSibling']?this['_findFallbackReferenceNode'](_0x29d196,_0x3ef737):[_0x3ef737['childNodes'][_0x3ef737['childNodes']['length']-0x1],'afterend']:[_0x3ef737['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x58e298,_0x330e15){const _0xf57cc1=[],_0x1f0348=this['_findPrevElementWithDataId'](_0x58e298,!0x0);if(_0x1f0348){const _0x400d43=ys('data-id',an(_0x1f0348),_0x330e15);_0x400d43&&_0xf57cc1['push']([_0x400d43,'afterend']);}const _0x2a8262=this['_findNextElementWithDataId'](_0x58e298,!0x0);if(_0x2a8262){const _0x502761=ys('data-id',an(_0x2a8262),_0x330e15);_0x502761&&_0xf57cc1['push']([_0x502761,'beforebegin']);}return _0xf57cc1['length']>0x1?Gs(_0xf57cc1[0x0][0x0])<=Gs(_0xf57cc1[0x1][0x0])?_0xf57cc1[0x0]:_0xf57cc1[0x1]:0x1===_0xf57cc1['length']?_0xf57cc1[0x0]:[_0x330e15['lastChild'],'afterend'];}_findNextElementWithDataId(_0x2f3f72,_0x3239de){let _0x150b63=_0x2f3f72['nextSibling'],_0x5da92f=null,_0x56b0fb=!0x1;for(;_0x150b63;){if(ti(_0x150b63)){if(on(_0x150b63)&&(_0x5da92f=_0x150b63),this['_isExistingContentComment'](_0x150b63)&&_0x3239de&&!_0x56b0fb){_0x56b0fb=!0x0,_0x150b63=_0x150b63['nextSibling'];continue;}break;}const _0x4a7b3c=Hs(_0x150b63,'data-id');if(_0x4a7b3c&&'new-element'!==_0x4a7b3c&&this['_existingDataIds']['has'](_0x4a7b3c)){_0x5da92f=_0x150b63;break;}_0x150b63=_0x150b63['nextSibling'];}return _0x5da92f;}_findPrevElementWithDataId(_0x5552f6,_0x6b5fac){let _0xbb50c0=_0x5552f6['previousSibling'],_0x3dde63=null,_0x500339=!0x1;for(;_0xbb50c0;){if(ti(_0xbb50c0)){if(on(_0xbb50c0)&&(_0x3dde63=_0xbb50c0),this['_isExistingContentComment'](_0xbb50c0)&&_0x6b5fac&&!_0x500339){_0x500339=!0x0,_0xbb50c0=_0xbb50c0['previousSibling'];continue;}break;}const _0x204e54=Hs(_0xbb50c0,'data-id');if(_0x204e54&&'new-element'!==_0x204e54&&this['_existingDataIds']['has'](_0x204e54)){_0x3dde63=_0xbb50c0;break;}_0xbb50c0=_0xbb50c0['previousSibling'];}return _0x3dde63;}_markWrappedElements(_0x22e85f){_0x3b00a1(_0x22e85f)&&Ns('data-id',null,_0x22e85f)['forEach'](_0x18ea47=>{this['_isExistingNode'](_0x18ea47)&&(Ms(_0x18ea47,'data-wrapped-id',Hs(_0x18ea47,'data-id')),Ms(_0x18ea47,'data-id',null));});}_processWrappedElements(_0x1ec278,_0x2dd881){Ns('data-wrapped-id',null,_0x1ec278)['forEach'](_0x163081=>{const _0x4fc787=Hs(_0x163081,'data-wrapped-id');if(this['_hasUnstableParent'](_0x163081))return;const _0x82e16=ys('data-id',_0x4fc787,_0x1ec278);Ms(_0x163081,'data-id',_0x4fc787),_0x82e16&&(this['_removeNode'](_0x82e16,_0x4fc787,_0x2dd881),this['_touchedNodesState']['removedIds']['push'](_0x4fc787),this['_touchedNodesState']['lastTouchedId']=_0x4fc787);});}_hasUnstableParent(_0x94b0a8){let _0x5230c3=_0x94b0a8['parentNode'];for(;_0x5230c3;){if(Hs(_0x5230c3,'data-unstable'))return!0x0;_0x5230c3=_0x5230c3['parentNode'];}return!0x1;}_rescueUnwrappedElements(_0x3f61ac){const _0x3702f3=new Set(this['_touchedNodesState']['removedIds']),_0x41ae5d=new Set(this['_touchedNodesState']['newIds']);Ns('data-id',null,_0x3f61ac)['forEach'](_0x10a33f=>{const _0x2ab325=Hs(_0x10a33f,'data-id'),_0x41d27f=!!_0x2ab325&&this['_referencedExistingIds']['has'](_0x2ab325),_0x418a5e=!!_0x2ab325&&_0x41ae5d['has'](_0x2ab325);if(!_0x2ab325||!_0x41d27f&&!_0x418a5e)return;if(_0x3702f3['has'](_0x2ab325))return;let _0x3b00c8=_0x10a33f['parentNode'],_0x165f1d=!0x1;for(;_0x3b00c8;){if(_0x3b00c8===_0x3f61ac){_0x165f1d=!0x0;break;}const _0x3b7371=Hs(_0x3b00c8,'data-id');if(_0x3b7371&&(this['_referencedExistingIds']['has'](_0x3b7371)||_0x41ae5d['has'](_0x3b7371)))return;_0x3b00c8=_0x3b00c8['parentNode'];}if(_0x165f1d){if(_0x200678(_0x3f61ac,_0x10a33f),_0x41d27f){const _0x5223de=this['_generateUid'](),_0x5f4342=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x2ab325);-0x1!==_0x5f4342&&this['_touchedNodesState']['modifiedIds']['splice'](_0x5f4342,0x1),Ms(_0x10a33f,'data-unwrapped-id',_0x2ab325),Ms(_0x10a33f,'data-id',_0x5223de),this['_touchedNodesState']['newIds']['push'](_0x5223de),this['_touchedNodesState']['rescuedNewIds']['add'](_0x5223de),this['_touchedNodesState']['lastTouchedId']=_0x5223de;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x2ab325),this['_touchedNodesState']['lastTouchedId']=_0x2ab325;}});}_getUid(_0x248800){return this['_isExistingNode'](_0x248800)?Hs(_0x248800,'data-id'):this['_generateUid']();}_removeSpecialComments(_0x3ce6cb){Ds(_0x3ce6cb)['filter'](_0x361305=>on(_0x361305)||this['_isExistingContentComment'](_0x361305))['forEach'](_0xdb4cab=>{_0x147247(_0xdb4cab);});}_findLastConfirmationPoint(_0x332ada){let _0x2470f5=null,_0x3b2b3c=null,_0x42676e=null,_0x59694d=null;const _0x59668c=_0x6347=>{_0x6347&&(_0x2470f5=_0x6347),_0x42676e=null,_0x59694d=null;};for(let _0x5a686c=0x0;_0x5a686c<_0x332ada['length'];_0x5a686c++){const _0x16921d=_0x332ada[_0x5a686c];if(this['_isExistingContentComment'](_0x16921d)){_0x59668c(_0x3b2b3c);continue;}if(_0x3b00a1(_0x16921d)){const _0x406fde=Hs(_0x16921d,'data-id'),_0x5a513d=_0x5a686c===_0x332ada['length']-0x1;if(_0x406fde&&'new-element'!==_0x406fde&&this['_touchedNodesState']['modifiedIds']['includes'](_0x406fde)&&!_0x5a513d){_0x59668c(_0x406fde),_0x3b2b3c=_0x406fde;continue;}}let _0x51f248;const _0x5760e1=an(_0x16921d);if(_0x5760e1&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x5760e1))_0x3b2b3c=_0x5760e1;else{if(_0x5760e1&&this['_touchedNodesState']['newIds']['includes'](_0x5760e1))_0x51f248='N';else{if(!on(_0x16921d))continue;_0x51f248='R';}_0x51f248===_0x59694d||null===_0x59694d?_0x59694d=_0x51f248:null!==_0x42676e?(_0x59668c(_0x3b2b3c),_0x59694d=_0x51f248):(_0x42676e=_0x59694d,_0x59694d=_0x51f248),_0x3b2b3c=_0x5760e1;}}const _0x3c9b42=_0x332ada[_0x332ada['length']-0x1];return _0x3c9b42&&!_0x3b00a1(_0x3c9b42)&&!on(_0x3c9b42)&&_0x3b2b3c&&_0x59668c(_0x3b2b3c),_0x2470f5;}_getLastStableElement(_0x1c525b,_0xfce420){if(!_0xfce420)return null;const _0x3b2726=ys('data-id',_0xfce420,_0x1c525b);if(!_0x3b2726)return null;const _0x8d965e=[_0x3b2726,...Vs(_0x3b2726)]['at'](-0x2);if(_0x8d965e===_0x3b2726)return _0x3b2726;let _0x52d992=_0x8d965e['previousSibling'];for(;_0x52d992&&!_0x3b00a1(_0x52d992);)_0x52d992=_0x52d992['previousSibling'];return _0x52d992;}_markUnstableElements(_0x101974,_0xfa656e){const _0x4f6016=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x1595cb=_0xfa656e?_0xfa656e['nextSibling']:_0x101974['firstChild'];for(;_0x1595cb;)_0x3b00a1(_0x1595cb)&&(_0x4f6016['has'](Hs(_0x1595cb,'data-id'))||Ns('data-id',null,_0x1595cb)['some'](_0x43d167=>_0x4f6016['has'](Hs(_0x43d167,'data-id'))))&&Ms(_0x1595cb,'data-unstable','true'),_0x1595cb=_0x1595cb['nextSibling'];}['_isNewNode'](_0x63a369){return Boolean('new-element'===Hs(_0x63a369,'data-id'));}_isExistingNode(_0x1d1a19){return Boolean((Hs(_0x1d1a19,'data-id')||'')['length']>0x0&&'new-element'!==Hs(_0x1d1a19,'data-id'));}_isExistingContentComment(_0x223a08){return Boolean(ti(_0x223a08)&&ks(_0x223a08)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function on(_0x29a51f){return!!_0x29a51f&&Boolean(ti(_0x29a51f)&&ks(_0x29a51f)['match'](/removed[\s*-]data-id="[^"]+"/));}function an(_0x1d13e2){if(!_0x1d13e2)return null;if(_0x3b00a1(_0x1d13e2))return Hs(_0x1d13e2,'data-id')??null;if(ti(_0x1d13e2)){const _0x1e32bb=ks(_0x1d13e2)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x1e32bb&&_0x1e32bb[0x1])return _0x1e32bb[0x1];}return null;}function hn(_0x51ca59,_0x1b2ba5){const _0x387ad3=new Map();for(const _0x4c4a3c of xs(_0x51ca59))Ps(_0x4c4a3c)||_0x387ad3['set'](Hs(_0x4c4a3c,'data-id'),_0x4c4a3c);const _0x3738bc=new Set();for(const _0x5b1cf5 of xs(_0x1b2ba5)){if(Ps(_0x5b1cf5))continue;const _0x4b992e=Hs(_0x5b1cf5,'data-id'),_0x18bd2f=_0x4b992e?_0x387ad3['get'](_0x4b992e):void 0x0;_0x18bd2f?(_0x54b98e(_0x5b1cf5,_0x3717a9(_0x18bd2f,!0x0)),_0x3738bc['add'](_0x4b992e)):_0x147247(_0x5b1cf5);}for(const _0x3b7167 of Ds(_0x1b2ba5))on(_0x3b7167)&&_0x387ad3['has'](an(_0x3b7167))&&_0x147247(_0x3b7167);const _0x3850bf=new Set(Ns('data-id',null,_0x1b2ba5)['map'](_0xf4c47c=>Hs(_0xf4c47c,'data-id')));for(const [_0x1d2122,_0x162789]of _0x387ad3){if(_0x3738bc['has'](_0x1d2122))continue;let _0x1d0f43=_0x162789['parent'],_0x44ed27=null;for(;_0x1d0f43&&_0x3b00a1(_0x1d0f43);){const _0x31e835=Hs(_0x1d0f43,'data-id');if(_0x31e835&&_0x3850bf['has'](_0x31e835)){_0x44ed27=_0x31e835;break;}_0x1d0f43=_0x1d0f43['parent'];}if(!_0x44ed27)continue;const _0x40f59a=ys('data-id',_0x44ed27,_0x1b2ba5);_0x40f59a&&_0x30ab63(_0x40f59a,_0x3717a9(_0x162789,!0x0));}}const cn=/* #__PURE__ -- @preserve */
27
- At();var ln=class extends cn{_m2html;constructor(){super();const _0x3cf410=Object['entries'](_0x46113c),_0x21da8e=_0x3cf410['findIndex'](([_0x17df2e])=>'rehypeDomRaw'===_0x17df2e);if(-0x1===_0x21da8e)throw new ct('ai-response-parser-unable-to-set-up-parser');_0x3cf410['splice'](_0x21da8e+0x1,0x0,['rehypeSanitize',_0x3212e6]),this['_m2html']=new _0xc30a1d({'plugins':Object['fromEntries'](_0x3cf410)});}convertMarkdownToHTML(_0x5e50ed){const _0x34b1ef=this['_m2html']['parse'](_0x5e50ed);return this['parseAndNormalizeHTML'](_0x34b1ef);}['parseAndNormalizeHTML'](_0x3d0920){return this['_parseHTML'](_0x3d0920);}['_parseHTML'](_0x2035a7){const _0x2ba3a7=vs('<dummy>'+_0x2035a7['replace'](/<[^>]*?$/g,'')+'</dummy>');return un(_0x2ba3a7),_0x2ba3a7['children']=_0x2ba3a7['children'][0x0]['children'],_0x2ba3a7;}};function un(_0x47268c){for(const _0x3fb031 of _0x47268c['children'])_0x3b00a1(_0x3fb031)?'pre'!==_0x3fb031['name']&&un(_0x3fb031):_0x3ed223(_0x3fb031)&&(_0x3fb031['data']=_0x3fb031['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function dn({changeGroups:_0x3946b4,documentContextContent:_0x353c3e,showDiff:_0x1e2b18,trimUnchanged:_0x3b03c4=!0x0}){const _0x44adc6=Xs(_0x3946b4,_0x353c3e);return _0x3946b4['map'](_0x5e5e7e=>{if(!_0x5e5e7e['editor']||'destroyed'===_0x5e5e7e['editor']['state'])return null;const _0x45a921=Ks(_0x5e5e7e['editor'],_0x5e5e7e['rootName']),_0x94311a=new _0x59229a([]),_0x7b63f6=new _0x59229a([]),_0x245205=new Set();for(const _0xf29be8 of _0x5e5e7e['changes'])'new'==_0xf29be8['type']&&Ns('data-id',null,_0xf29be8['node'])['forEach'](_0x7e159b=>{_0x245205['add'](Hs(_0x7e159b,'data-id'));});for(const _0x107ac3 of _0x5e5e7e['changes'])if('removed'!=_0x107ac3['type']?_0x7b63f6['children']['push'](_0x107ac3['node']['cloneNode'](!0x0)):_0x1e2b18||_0x245205['has'](_0x107ac3['id'])||_0x7b63f6['children']['push'](_0x107ac3['node']['cloneNode'](!0x0)),'new'!=_0x107ac3['type']&&(_0x1e2b18||'removed'!=_0x107ac3['type'])){const _0x1b5c93=_0x11f9ef(_0x45712e=>Hs(_0x45712e,'data-id')==_0x107ac3['id'],_0x353c3e['get'](_0x5e5e7e['documentId']),!0x0);_0x1b5c93&&_0x94311a['children']['push'](_0x1b5c93['cloneNode'](!0x0));}if(_0x45a921&&_0x44adc6['has'](_0x5e5e7e['index']))return{'type':_0x5e5e7e['changes'][0x0]['type'],'index':_0x5e5e7e['index'],'state':_0x5e5e7e['state'],'outdatedReason':_0x5e5e7e['outdatedReason'],'content':new _0x59229a([]),'hasChanges':!0x1};let _0x51e94a,_0x12f9d0,_0x155d16;try{({content:_0x51e94a,hasChanges:_0x12f9d0}=_n(_0x5e5e7e['editor'],_0x94311a,_0x7b63f6,_0x1e2b18,_0x3b03c4));}catch{return{'type':_0x5e5e7e['changes'][0x0]['type'],'index':_0x5e5e7e['index'],'state':_0x5e5e7e['state'],'outdatedReason':_0x5e5e7e['outdatedReason'],'content':new _0x59229a([]),'hasChanges':!0x1};}if(_0x45a921){_0x155d16=_0x5e5e7e['editor']['ui']['getEditableElement'](_0x5e5e7e['rootName'])?.['tagName']['toLowerCase']();const _0x9bd912=_0x51e94a['children']['filter'](_0x3b00a1);0x1===_0x9bd912['length']&&(_0x51e94a=new _0x59229a(_0x9bd912[0x0]['children']));}return{'type':_0x5e5e7e['changes'][0x0]['type'],'index':_0x5e5e7e['index'],'state':_0x5e5e7e['state'],'outdatedReason':_0x5e5e7e['outdatedReason'],'content':_0x51e94a,'hasChanges':_0x12f9d0,'wrapperTag':_0x155d16};})['filter'](_0x1bd353=>null!==_0x1bd353);}function _n(_0x4bc6cb,_0x476760,_0x21d68d,_0x25e0bd,_0x179f3a=!0x0){const _0x405c2e=_0x4bc6cb['plugins']['get']('DocumentCompare'),_0x2ec107=ks(_0x476760),_0x264e72=ks(_0x21d68d),_0x15e903=_0x4bc6cb['data']['parse'](_0x2ec107,'$root'),_0x2a737f=_0x4bc6cb['model']['createPositionAt'](_0x15e903,0x0),_0x2331e2=_0x405c2e['getDiff'](_0x2ec107,_0x264e72,{'anchor':_0x2a737f,'markDeletions':_0x25e0bd,'targetEditor':_0x4bc6cb})['getOperations']();if(0x0==_0x2331e2['length'])return{'content':_0x476760['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x25e0bd?function(_0x4fc307,_0x280dc4,_0x143258){if(0x0==_0x4fc307['length'])return;const _0x23cca4=_0x143258['plugins']['get']('DocumentCompare'),_0xb50bbb=_0x143258['plugins']['get']('SuggestionsConversion');_0x143258['model']['change'](_0x264bca=>{const _0xfed1dc=new Set();for(let _0x12c66e=0x0;_0x12c66e<_0x4fc307['length'];_0x12c66e++){const _0x288877=_0x4fc307[_0x12c66e];if(_0x288877['baseVersion']=null,_0x288877['isDocumentOperation']=!0x1,!_0xb8d6ce(_0x288877)){if(_0x23cca4['isMarkedRemoveOperation'](_0x288877)){const _0x55bfe4=_0x2ae50f(_0x288877['newRange'],_0x143258['model']),_0x47fc72='suggestion:deletion:'+Nt()+':$aiSuggestion';_0x280dc4['markers']['set'](_0x47fc72,_0x55bfe4);}else switch(_0x288877['type']){case'rename':{if(_0x288877['oldName']==_0x288877['newName'])break;_0x264bca['batch']['addOperation'](_0x288877),_0x143258['model']['applyOperation'](_0x288877);const _0xad2a95='$elementName',_0x495c77=_0x288877['position'],_0x569471=_0x143258['model']['createRange'](_0x495c77,_0x143258['model']['createPositionAt'](_0x495c77['nodeAfter'],'end')),_0xf9ac1='suggestion:attribute:'+_0xad2a95+':'+Nt()+':$aiSuggestion';_0x280dc4['markers']['set'](_0xf9ac1,_0x569471);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x288877['oldValue']==_0x288877['newValue'])break;_0x264bca['batch']['addOperation'](_0x288877),_0x143258['model']['applyOperation'](_0x288877);const _0x2dc892=_0x288877['key'];if(!_0xb50bbb['isRegisteredAttribute'](_0x2dc892))break;const _0x429046=_0x2ae50f(_0x288877['range'],_0x143258['model']),_0x4cf273='suggestion:attribute:'+_0x2dc892+':'+Nt()+':$aiSuggestion';_0x280dc4['markers']['set'](_0x4cf273,_0x429046);break;}case'insert':{if(_0x264bca['batch']['addOperation'](_0x288877),_0x143258['model']['applyOperation'](_0x288877),gn(_0x280dc4,_0x288877),_0x4fc307[_0x12c66e+0x1]&&'move'==_0x4fc307[_0x12c66e+0x1]['type'])break;const _0x11e6e3=_0x288877['position'],_0x50a252=_0x288877['howMany'],_0xff6ab8=_0x2ae50f(_0x143258['model']['createRange'](_0x11e6e3,_0x11e6e3['getShiftedBy'](_0x50a252)),_0x143258['model']),_0x5a579b='suggestion:insertion:'+Nt()+':$aiSuggestion';_0x280dc4['markers']['set'](_0x5a579b,_0xff6ab8);break;}case'split':{_0x264bca['batch']['addOperation'](_0x288877),_0x143258['model']['applyOperation'](_0x288877),gn(_0x280dc4,_0x288877);const _0x3ad3cc=_0x288877['splitPosition'],_0x50256e=_0x288877['moveTargetPosition'],_0x81186d=_0x143258['model']['createRange'](_0x3ad3cc,_0x50256e),_0x3b1034='suggestion:insertion:'+Nt()+':$aiSuggestion';_0x280dc4['markers']['set'](_0x3b1034,_0x81186d);break;}case'move':{_0x264bca['batch']['addOperation'](_0x288877),_0x143258['model']['applyOperation'](_0x288877),gn(_0x280dc4,_0x288877);const _0x310099=_0x288877['getMovedRangeStart'](),_0x403598=_0x288877['howMany'];for(let _0xbeba2d=0x0;_0xbeba2d<_0x403598;_0xbeba2d++){const _0x5d446c=_0x310099['getShiftedBy'](_0xbeba2d)['nodeAfter'];_0xfed1dc['add'](_0x5d446c);}break;}case'remove':{const _0x140d51=_0x288877['sourcePosition'],_0x401480=_0x288877['howMany'],_0x2faef2=new _0x4374a5(_0x140d51,_0x401480);_0x264bca['batch']['addOperation'](_0x2faef2),_0x143258['model']['applyOperation'](_0x2faef2),gn(_0x280dc4,_0x288877);break;}}}}for(const _0xa7c187 of _0xfed1dc){const _0x32c87d=_0x143258['model']['createRangeOn'](_0xa7c187),_0x358ac2='suggestion:formatBlock:$fakeWrap:'+Nt()+':$aiSuggestion';_0x280dc4['markers']['set'](_0x358ac2,_0x2ae50f(_0x32c87d,_0x143258['model']));}});}(_0x2331e2,_0x15e903,_0x4bc6cb):_0x4bc6cb['model']['change'](_0x349c5e=>{for(const _0x55ff49 of _0x2331e2)if(!_0xb8d6ce(_0x55ff49)){if('remove'==_0x55ff49['type']){const _0x4a21b1=_0x55ff49['sourcePosition'],_0x5a6c2b=_0x55ff49['howMany'],_0xc09a61=new _0x4374a5(_0x4a21b1,_0x5a6c2b);_0x349c5e['batch']['addOperation'](_0xc09a61),_0x4bc6cb['model']['applyOperation'](_0xc09a61),gn(_0x15e903,_0x55ff49);}else{if('marker'==_0x55ff49['type']){const _0x10a44d=_0x55ff49['name'],_0x3d2f68=_0x55ff49['newRange'];null!==_0x3d2f68?_0x15e903['markers']['set'](_0x10a44d,_0x3d2f68):_0x15e903['markers']['delete'](_0x10a44d);}else _0x55ff49['baseVersion']=null,_0x55ff49['isDocumentOperation']=!0x1,_0x349c5e['batch']['addOperation'](_0x55ff49),_0x4bc6cb['model']['applyOperation'](_0x55ff49),gn(_0x15e903,_0x55ff49);}}}),_0x179f3a){const _0x26b32f=An(_0x4bc6cb,_0x2331e2,_0x15e903);pn(_0x4bc6cb['model'],_0x26b32f),function(_0x82d5a1,_0x431e12){const _0x379a7e=_0x431e12['getFirstRange']()['start'];let _0x36e358=_0x431e12['getFirstRange']()['end'];const _0xfda63b=_0x379a7e['root'];(_0x36e358['textNode']||_0x36e358['nodeAfter']&&_0x36e358['nodeAfter']['is']('$text'))&&(_0x10acb9(_0x36e358,'...'),Tn(_0xfda63b,_0x36e358,0x3),_0x36e358=_0x36e358['getShiftedBy'](0x3)),(_0x379a7e['textNode']||_0x379a7e['nodeBefore']&&_0x379a7e['nodeBefore']['is']('$text'))&&(_0x10acb9(_0x379a7e,'...'),Tn(_0xfda63b,_0x379a7e,0x3),_0x379a7e['parent']==_0x36e358['parent']&&(_0x36e358=_0x36e358['getShiftedBy'](0x3)));const _0x3f2f22=_0x82d5a1['createRange'](_0x82d5a1['createPositionAt'](_0xfda63b,0x0),_0x379a7e),_0x1745d0=_0x82d5a1['createRange'](_0x36e358,_0x82d5a1['createPositionAt'](_0xfda63b,'end')),_0x5a42=[..._0x3f2f22['getMinimalFlatRanges'](),..._0x1745d0['getMinimalFlatRanges']()];_0x5a42['reverse']();for(const _0x2d447d of _0x5a42)_0x46a587(_0x2d447d),mn(_0xfda63b,_0x2d447d);}(_0x4bc6cb['model'],_0x26b32f);}return{'content':vs(_0x4bc6cb['data']['stringify'](_0x15e903,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function gn(_0x158bfa,_0x4c9c24){for(const [_0x3e3428,_0x196871]of _0x158bfa['markers']){const _0x4ccba1=_0x2be128['_createFromRanges'](_0x196871['getTransformedByOperation'](_0x4c9c24));_0x4ccba1['root']==_0x158bfa?_0x158bfa['markers']['set'](_0x3e3428,_0x4ccba1):_0x158bfa['markers']['delete'](_0x3e3428);}}function An(_0x36ef0d,_0x18a879,_0x34828f){const _0x42efe6=_0x36ef0d['plugins']['get']('DocumentCompare');let _0x9be3f4=_0x36ef0d['model']['createPositionAt'](_0x34828f,Number['POSITIVE_INFINITY']),_0xd55ef8=_0x36ef0d['model']['createPositionAt'](_0x34828f,0x0);for(const _0x5c7903 of _0x18a879){let _0x354e9f,_0x385295;if(_0x42efe6['isMarkedRemoveOperation'](_0x5c7903))_0x354e9f=_0x5c7903['newRange']['start'],_0x385295=_0x5c7903['newRange']['end'];else switch(_0x9be3f4=In(_0x9be3f4,_0x5c7903),_0xd55ef8=In(_0xd55ef8,_0x5c7903),_0x5c7903['type']){case'rename':_0x354e9f=_0x5c7903['position'],_0x385295=_0x354e9f['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x354e9f=_0x5c7903['range']['start'],_0x385295=_0x5c7903['range']['end'];break;case'insert':_0x354e9f=_0x5c7903['position'],_0x385295=_0x354e9f['getShiftedBy'](_0x5c7903['howMany']);break;case'split':_0x354e9f=_0x5c7903['splitPosition'],_0x385295=_0x5c7903['moveTargetPosition'];break;case'merge':{const _0x3b6b26=_0x5c7903['targetPosition']['path']['slice'](0x0,-0x1);_0x354e9f=_0x36ef0d['model']['createPositionFromPath'](_0x34828f,_0x3b6b26),_0x385295=_0x354e9f['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x310632=_0x5c7903['howMany'],_0x489586=_0x5c7903['sourcePosition']['_getTransformedByInsertion'](_0x5c7903['targetPosition'],_0x310632),_0x168d15=_0x5c7903['getMovedRangeStart']();'remove'==_0x5c7903['type']?(_0x354e9f=_0x489586,_0x385295=_0x489586):(_0x354e9f=_0x168d15,_0x385295=_0x168d15['getShiftedBy'](_0x310632));break;}}_0x354e9f&&_0x354e9f['isBefore'](_0x9be3f4)&&(_0x9be3f4=_0x354e9f['clone'](),_0x9be3f4['stickiness']='toNone'),_0x385295&&_0x385295['isAfter'](_0xd55ef8)&&(_0xd55ef8=_0x385295['clone'](),_0xd55ef8['stickiness']='toNone');}return _0x36ef0d['model']['createSelection'](_0x36ef0d['model']['createRange'](_0x9be3f4,_0xd55ef8));}function In(_0x91b46d,_0x5362c1){return'move'!=_0x5362c1['type']&&'remove'!=_0x5362c1['type']||_0x5362c1['sourceRange']['containsPosition'](_0x91b46d)&&((_0x91b46d=_0x5362c1['sourcePosition']['clone']())['stickiness']='toNone'),_0x91b46d['getTransformedByOperation'](_0x5362c1);}function pn(_0x4d2445,_0x596a27){En(_0x4d2445,_0x596a27,'forward');const _0x355599=_0x596a27['getFirstRange']();_0x596a27['setTo']([]),_0x596a27['setTo'](_0x355599,{'backward':!0x0}),En(_0x4d2445,_0x596a27,'backward');}function En(_0x16fea9,_0x35cf95,_0x56661f){let _0x11d64e=0x14;for(;_0x11d64e;){_0x16fea9['modifySelection'](_0x35cf95,{'unit':'word','direction':_0x56661f}),_0x11d64e--;const _0x5e5659=_0x35cf95['focus']['forward'==_0x56661f?'nodeBefore':'nodeAfter'];if(_0x5e5659&&_0x5e5659['is']('element')&&_0x16fea9['schema']['isBlock'](_0x5e5659)&&_0x16fea9['schema']['isObject'](_0x5e5659))break;}}function mn(_0x155ee2,_0xa7bb75){for(const [_0x532db8,_0xe39eb9]of _0x155ee2['markers']){const _0x13300f=_0xe39eb9['_getTransformedByDeletion'](_0xa7bb75['start'],_0xa7bb75['end']['offset']-_0xa7bb75['start']['offset']);null!=_0x13300f?_0x155ee2['markers']['set'](_0x532db8,_0x13300f):_0x155ee2['markers']['delete'](_0x532db8);}}function Tn(_0x1fdab0,_0x2c4f83,_0x17470e){for(let [_0x51e710,_0x20df7d]of _0x1fdab0['markers'])_0x20df7d=_0x20df7d['_getTransformedByInsertion'](_0x2c4f83,_0x17470e,!0x1)[0x0],_0x1fdab0['markers']['set'](_0x51e710,_0x20df7d);}function wn(_0x3b4045,_0x376bea){for(const _0x50d023 of _0x3b4045)'noop'!==_0x50d023['type']&&(_0x50d023['_aiSource']=_0x376bea);}var Cn=class extends _0x45fe7d{static get['pluginName'](){return'AIGateway';}static get requires(){return[_0x4eecd6,Ss];}get['models'](){return this['context']['plugins']['get'](Ss)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0xb00138,_0x2d74a8){const {applyMethod:_0x321845,roots:_0x3384dd}=_0x2d74a8,_0xcf2ce3='suggest'===_0x321845;if(_0xb00138['error']||!_0xb00138['results']['length'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0xb00138['status']});if(_0x3384dd){if(0x0===_0x3384dd['length'])throw new ct('ai-gateway-apply-empty-roots',this);for(const {channelId:_0x3ec4ce,rootName:_0x3bc082}of _0x3384dd)if(!_0xb00138['results']['some'](_0x3530a3=>_0x3530a3['channelId']===_0x3ec4ce&&_0x3530a3['rootName']===_0x3bc082))throw new ct('ai-gateway-apply-root-not-found',this,{'channelId':_0x3ec4ce,'rootName':_0x3bc082});}const _0x36604a=_0xb00138['results']['reduce']((_0x335554,_0x13e323)=>{if(_0x3384dd&&!_0x3384dd['some'](_0x1142a8=>_0x1142a8['channelId']===_0x13e323['channelId']&&_0x1142a8['rootName']===_0x13e323['rootName']))return _0x335554;if('completed'!==_0x13e323['status'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x13e323['status'],'channelId':_0x13e323['channelId'],'rootName':_0x13e323['rootName']});if(_0xcf2ce3&&!_0x13e323['editor']['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',this,{'channelId':_0x13e323['channelId'],'rootName':_0x13e323['rootName']});let _0x2b0253=_0x335554['get'](_0x13e323['editor']);return _0x2b0253||(_0x2b0253=[],_0x335554['set'](_0x13e323['editor'],_0x2b0253)),_0x2b0253['push'](_0x13e323),_0x335554;},new Map()),_0x38b204=this['context']['plugins']['get'](_0x4eecd6);for(const [_0x2351bd,_0xbd4579]of _0x36604a){const _0x479c1b=_0xbd4579['map'](_0x2ba1bb=>{const _0x37178a=_0x2351bd['model']['createPositionAt'](_0x2351bd['model']['document']['getRoot'](_0x2ba1bb['rootName']),0x0),_0x3a299f=zs(_0x2351bd,_0x2ba1bb['rootName'],_0x2ba1bb['contentRawOld'],_0x2ba1bb['contentRawNew']);if(!_0x3a299f)return _0x2ba1bb['droppedUnsupportedInlineChange']=!0x0,null;const _0x1e5b6a=_0x38b204['getDiff'](_0x3a299f['before'],_0x3a299f['after'],{'anchor':_0x37178a,'markDeletions':_0xcf2ce3,'targetEditor':_0x2351bd}),_0x575ed5=_0x2351bd['model']['document']['history']['getOperations'](_0x2ba1bb['documentVersion']),_0x59ab4a={'document':_0x2351bd['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x29afa9=_0x400478(_0x1e5b6a['getOperations'](),_0x575ed5,_0x59ab4a)['operationsA'];return wn(_0x29afa9,_0x2d74a8['aiSource']??'api'),_0x29afa9;});_0x2351bd['model']['change'](_0x44b0b0=>{for(const _0x30dc10 of _0x479c1b)_0x30dc10&&(_0xcf2ce3?_0x2351bd['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x30dc10):_0x38b204['applyOperations'](_0x44b0b0,_0x30dc10));});}}mergeChangesIntoContent(_0x99e5ff,_0x4dd73c,_0x526ca2){const _0x329e3d=new ln(),_0x32c105=new rn();let _0x2f1df6=_0x329e3d['parseAndNormalizeHTML'](_0x4dd73c);for(const _0x25fc2e of _0x99e5ff)try{const _0x1c535c=_0x329e3d['parseAndNormalizeHTML'](_0x25fc2e['content']);_0x2f1df6=_0x32c105['merge'](_0x1c535c,_0x2f1df6,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x2b3655){throw new ct('ai-gateway-merge-failed',this,{..._0x25fc2e},_0x2b3655);}return _n(_0x526ca2,_0x329e3d['parseAndNormalizeHTML'](_0x4dd73c),_0x2f1df6,!0x1,!0x1)['content'];}};const fn=/* #__PURE__ -- @preserve */
28
- dt(),bn=['capabilitiesUpdated'];var Sn=class extends fn{['_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(_0x216f65){const _0x569abb={};if(!_0x216f65)return _0x569abb;('isWebSearchEnabled'in _0x216f65?_0x216f65['isWebSearchEnabled']:_0x216f65['webSearch'])&&(_0x569abb['webSearch']={});const _0x15872e='isReasoningEnabled'in _0x216f65?_0x216f65['isReasoningEnabled']:_0x216f65['reasoning'];return _0x15872e&&(_0x569abb['reasoning']='string'==typeof _0x15872e?{'level':_0x15872e}:{}),_0x569abb;}toggleWebSearch(){this['setWebSearch'](!this['_isWebSearchEnabled']);}toggleReasoning(){this['setReasoning'](!this['_isReasoningEnabled']);}setWebSearch(_0x13dd2c){_0x13dd2c!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x13dd2c,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}setReasoning(_0x43775e){_0x43775e!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x43775e,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}};function Rn(_0x2a87fb,_0x33b91e,_0x2d3c09,_0x509a30){if(_0x2a87fb instanceof ct)return _0x2a87fb;const _0x5897e3=_0x2a87fb?.['data'];return new ct(_0x33b91e,_0x2d3c09,void 0x0!==_0x5897e3?{..._0x509a30,'backendData':_0x5897e3}:_0x509a30,_0x2a87fb);}var On=class{_editor;_rootName;['_channelId'];['_sessionId'];_documentVersion;_contentRawOld;_contentRawNew;['_error'];_isAborted=!0x1;_droppedUnsupportedInlineChange=!0x1;constructor(_0xb895ea){this['_editor']=_0xb895ea['editor'],this['_rootName']=_0xb895ea['rootName'],this['_channelId']=_0xb895ea['channelId'],this['_sessionId']=_0xb895ea['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(_0x24973a){this['_documentVersion']=_0x24973a;}get contentRawOld(){return this['_contentRawOld'];}set contentRawOld(_0x5b54d1){this['_contentRawOld']=_0x5b54d1;}get contentRawNew(){return this['_contentRawNew'];}set contentRawNew(_0xc2be9b){this['_contentRawNew']=_0xc2be9b;}get contentOld(){return this['_dropDataIds'](this['_contentRawOld']||'');}get contentNew(){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x32b1c0){this['_error']=_0x32b1c0;}get droppedUnsupportedInlineChange(){return this['_droppedUnsupportedInlineChange'];}set droppedUnsupportedInlineChange(_0x9a01c0){this['_droppedUnsupportedInlineChange']=_0x9a01c0;}abort(){this['_isAborted']=!0x0;}_dropDataIds(_0x252b03){return _0x252b03['replace'](/ data-id="[a-z0-9]+"/g,'');}},vn=class extends On{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x5e5fde){this['_summary']=_0x5e5fde;}},kn=class{_results;constructor(_0x15a234=[]){this['_results']=_0x15a234;}_status='initialized';['_error'];abort(){'error'!==this['_status']&&(this['_status']='aborted');}get status(){return this['_status'];}set status(_0xdcfe6){this['_status']=_0xdcfe6;}get['error'](){return this['_error'];}set['error'](_0x10d3c4){this['_status']='error',this['_error']=_0x10d3c4;}get results(){return this['_results'];}addResult(..._0x145598){this['_results']['push'](..._0x145598);}},yn=class extends _0x45fe7d{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get requires(){return[Es,sn,Cn,Ss];}get['models'](){return this['context']['plugins']['get'](Ss)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async processDocument(_0x3cf32c,_0x3a15de){if(!_0x3cf32c)throw new ct('ai-documentprocessinggateway-missing-prompt',this);const _0x50d829=await this['context']['plugins']['get'](sn)['getDocumentData'](),_0x227404=_0x3a15de['roots'];if(0x0===(_0x227404??_0x50d829)['length'])throw new ct('ai-documentprocessinggateway-empty-roots',this);if(_0x227404){for(const _0x4372c3 of _0x227404)if(!_0x50d829['some'](_0x564c57=>_0x564c57['rootName']===_0x4372c3['rootName']&&_0x564c57['channelId']===_0x4372c3['channelId']))throw new ct('ai-documentprocessinggateway-root-not-found',this,{'channelId':_0x4372c3['channelId'],'rootName':_0x4372c3['rootName']});}const _0x45bb1e=_0x227404?_0x50d829['filter'](_0x34c11b=>_0x227404['some'](_0x320ad0=>_0x320ad0['rootName']===_0x34c11b['rootName']&&_0x320ad0['channelId']===_0x34c11b['channelId'])):_0x50d829,_0x3b5635=[],_0x1b2906=[];for(const _0x31545b of _0x45bb1e){const _0x25dbf3={'editor':_0x31545b['editor'],'rootName':_0x31545b['rootName'],'sessionId':_0x31545b['sessionId'],'channelId':_0x31545b['channelId'],'contentRawOld':_0x31545b['content'],'documentVersion':_0x31545b['version']};_0x3b5635['push'](_0x25dbf3),_0x1b2906['push']({'type':'document','content':_0x25dbf3['contentRawOld']});}const _0x472240=this['context']['plugins']['get']('AIConnector')['processDocument']({'content':_0x1b2906,'prompt':_0x3cf32c,'model':_0x3a15de['model'],'capabilities':Sn['getCapabilitiesRequestData'](_0x3a15de['capabilities']),'contexts':_0x3a15de['contexts']});let _0x45695f;if(_0x3a15de?.['signal']){_0x3a15de['signal']['aborted']&&_0x472240['abortController']['abort']();const _0x3b658b=_0x3a15de['signal'],_0xc88858=()=>_0x472240['abortController']['abort']();_0x3b658b['addEventListener']('abort',_0xc88858),_0x45695f=()=>_0x3b658b['removeEventListener']('abort',_0xc88858);}const _0x286edb=new kn();let _0x177460=[];try{if(_0x177460=(await _0x472240['getResult']())['documents'],!(_0x177460&&_0x177460['length']>0x0))throw new ct('ai-documentprocessinggateway-empty-reply',this);if(_0x177460['length']!==_0x1b2906['length'])throw new ct('ai-documentprocessinggateway-reply-count-mismatch',this,{'expected':_0x1b2906['length'],'received':_0x177460['length']});const _0x296ebf=_0x177460['findIndex'](({document:_0x5c8622})=>!_0x5c8622['length']);if(-0x1!==_0x296ebf){const _0x168b64=_0x3b5635[_0x296ebf];throw new ct('ai-documentprocessinggateway-empty-root-content',this,{'channelId':_0x168b64['channelId'],'rootName':_0x168b64['rootName']});}_0x286edb['status']='completed';}catch(_0x1dabf7){_0x1dabf7 instanceof Error&&_0x1dabf7['message']['includes']('ai-request-aborted')?_0x286edb['abort']():_0x286edb['error']=Rn(_0x1dabf7,'ai-documentprocessinggateway-run-failed',this);}finally{_0x45695f&&_0x45695f();}if('completed'===_0x286edb['status'])for(const [_0x821a96,_0x585728]of _0x3b5635['entries']()){const {channelId:_0x5b92bf,contentRawOld:_0x1fcdd8,documentVersion:_0x2debf0,editor:_0x5c318f,rootName:_0xdba8ac,sessionId:_0x1d327a}=_0x585728,_0x567f03=new vn({'channelId':_0x5b92bf,'editor':_0x5c318f,'rootName':_0xdba8ac,'sessionId':_0x1d327a});_0x567f03['contentRawOld']=_0x1fcdd8,_0x567f03['documentVersion']=_0x2debf0,_0x567f03['contentRawNew']=_0x177460[_0x821a96]['document'],_0x567f03['summary']=_0x177460[_0x821a96]['summary'],_0x286edb['addResult'](_0x567f03);}return _0x286edb;}applyResult(_0x253795,_0x341594){this['context']['plugins']['get']('AIGateway')['apply'](_0x253795,_0x341594);}};function Nn(_0x542897){return _0x542897 instanceof Error&&('AbortError'===_0x542897['name']||('AICoreError'===_0x542897['name']?!0x0===_0x542897['isAbort']:_0x542897['message']['startsWith']('ai-request-aborted')));}var xn=class extends Error{['code'];severity;type;context;isAbort;constructor(_0x28b694){super(_0x28b694['code'],_0x28b694['cause']instanceof Error?{'cause':_0x28b694['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x28b694['code'],this['severity']=_0x28b694['severity']??'error',this['type']=_0x28b694['type']??'system',this['context']=_0x28b694['context'],this['isAbort']=_0x28b694['isAbort']??Nn(_0x28b694['cause']);}},Ln=class extends _0x45fe7d{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}createReporter(_0x3e83ec){return new Pn(this,_0x3e83ec);}},Pn=class{['_sink'];_component;constructor(_0x511f9f,_0x5328ea){this['_sink']=_0x511f9f,this['_component']=_0x5328ea;}['logError'](_0x42fe61,_0x49fbf7={}){this['_emit'](_0x42fe61,_0x49fbf7),this['_defaultLog'](_0x42fe61);}reportError(_0x55a871,_0x26771a={}){this['_emit'](_0x55a871,_0x26771a);}_emit(_0x13046f,_0x20d009){Nn(_0x13046f)||this['_sink']['fire']('error',{'error':_0x13046f,'component':this['_component'],'context':_0x20d009['context']});}_defaultLog(_0x26e3b5){if(!Nn(_0x26e3b5)){if(_0x26e3b5 instanceof xn){if('user'===_0x26e3b5['type']||'network'===_0x26e3b5['type'])return;if('warning'===_0x26e3b5['severity'])return void console['warn'](this['_component'],_0x26e3b5);}console['error'](this['_component'],_0x26e3b5);}}};const Dn='ck-ai-button-primary',Hn='ck-ai-button-secondary',Mn='ck-ai-button-tertiary';function Un(_0x44bfb1,_0x1f3742){const _0x1b787f=new Vt(_0x44bfb1),_0x3bb029=Ts(_0x44bfb1,'AI_TABS_LABEL_MINIMIZE'),_0x4b029a=Ts(_0x44bfb1,'AI_TABS_LABEL_MAXIMIZE');return _0x1b787f['set']({'withText':!0x1,'icon':_0x13f65e,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Mn}),_0x1b787f['bind']('label')['to'](_0x1f3742,'isMaximized',_0x1ce5fd=>_0x1ce5fd?_0x3bb029:_0x4b029a),_0x1b787f['bind']('icon')['to'](_0x1f3742,'isMaximized',_0x2944f8=>_0x2944f8?_0x5e937b:_0x13f65e),_0x1b787f['bind']('isOn')['to'](_0x1f3742,'isMaximized'),_0x1b787f['on']('execute',()=>{_0x1f3742['fire']('resizeTabs');}),_0x1b787f;}function Vn(_0x250664){const _0x58fba6=new Ht(_0x250664);return _0x58fba6['attachToDom'](),_0x58fba6['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x58fba6;}const Bn=/* #__PURE__ -- @preserve */
29
- At();var Gn=class extends Bn{['id'];interactionId;type;content=new Map();['sources']=[];parsedContent=new Map();parsedMergedContent=new Map();['changeGroups']=[];areActionsDisabled=!0x1;_outdatedReasonByDocumentId;isFromHistory=!0x1;documentContextContent;_documentIdToSource=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];cachedSuggestionContentParts={'withDiff':[],'withoutDiff':[]};constructor({type:_0x4cda28,isDone:_0x3724b3=!0x1,isComplete:_0x570018,interactionId:_0x568212,areActionsDisabled:_0x5f5776,outdatedReasonByDocumentId:_0x5a26b3,isFromHistory:_0x2b5525=!0x1,documentContextContent:_0x33043c,locale:_0x5ec5a4,id:_0x3841e4,channelsToEditors:_0x138ab1}){super(),this['id']=_0x3841e4||Nt(),this['interactionId']=_0x568212,this['type']=_0x4cda28,this['areActionsDisabled']=!!_0x5f5776,this['_outdatedReasonByDocumentId']=_0x5a26b3,this['isFromHistory']=_0x2b5525,this['locale']=_0x5ec5a4,this['aiResponseParser']=new ln(),this['aiResponseApplier']=new rn(),this['documentContextContent']=new Map(_0x33043c?.['map'](_0xece34=>[_0xece34['id'],vs(_0xece34['content'])])||[]),this['_documentIdToSource']=new Map(_0x33043c?.['map'](_0xf498c=>[_0xf498c['id'],{'editor':_0x138ab1['get'](_0xf498c['channelId']),'rootName':_0xf498c['rootName']}])||[]),this['set']('isDone',_0x3724b3),this['set']('isComplete',_0x570018??_0x3724b3),'text'===this['type']&&this['content']['set']('text','');}appendContent(_0x2c46c2,_0x317f63){const _0x5f4514='text'===this['type']?'text':_0x317f63;this['content']['has'](_0x5f4514)||this['content']['set'](_0x5f4514,''),this['content']['set'](_0x5f4514,this['content']['get'](_0x5f4514)+_0x2c46c2),this['onContentChange'](_0x5f4514);}['done'](_0x316d98=!0x0){this['isComplete']=_0x316d98,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}destroy(){this['stopListening']();}setChangeGroupState(_0xb3016b,_0x2e3b24,_0x2e2864){this['changeGroups'][_0xb3016b]['state']=_0x2e3b24,this['changeGroups'][_0xb3016b]['outdatedReason']=_0x2e2864,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0xb3016b,'state':_0x2e3b24,'outdatedReason':_0x2e2864});}getContentParts({showDiff:_0x5cf8b4,groupIndex:_0x492024}){const _0x3660d8=this['_getCachedContentParts'](_0x5cf8b4,_0x492024);if(_0x3660d8)return _0x3660d8;let _0x3a4d64;if(void 0x0===_0x492024)_0x3a4d64=this['changeGroups'];else{const _0x2b4f91=this['changeGroups']['find'](({index:_0x491082})=>_0x491082===_0x492024);if(!_0x2b4f91)throw new ct('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x492024});_0x3a4d64=[_0x2b4f91];}const _0x6078c4=dn({'showDiff':_0x5cf8b4,'changeGroups':_0x3a4d64,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x5cf8b4,_0x6078c4),_0x6078c4;}_getCachedContentParts(_0x2a51b3,_0x7e79fd){const _0x225ff4=_0x2a51b3?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x225ff4]['length'])return null;const _0x46ad4f=this['cachedSuggestionContentParts'][_0x225ff4];if(void 0x0===_0x7e79fd)return _0x46ad4f['length']>0x0&&_0x46ad4f['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x2a51b3,null),null):_0x4f5d65(_0x46ad4f);{const _0x407cb6=_0x46ad4f['find'](({index:_0x5072b5})=>_0x5072b5===_0x7e79fd);if(_0x407cb6)return[_0x4f5d65(_0x407cb6)];}return null;}_setCachedContentParts(_0x1ef1f8,_0x9b34fd){const _0x443496=_0x1ef1f8?'withDiff':'withoutDiff';_0x9b34fd?_0x9b34fd['forEach'](_0x3ea812=>{const _0x553857=this['cachedSuggestionContentParts'][_0x443496],_0x2c98bd=_0x553857['find'](({index:_0x13e9fd})=>_0x13e9fd===_0x3ea812['index']);if(_0x2c98bd){const _0x43a9b1=_0x553857['indexOf'](_0x2c98bd);_0x553857['splice'](_0x43a9b1,0x1,_0x3ea812);}else _0x553857['push'](_0x3ea812);}):this['cachedSuggestionContentParts'][_0x443496]['length']=0x0;}onContentChange(_0x2bd57d){if('modification'===this['type']){if(_0x2bd57d)this['parsedContent']['set'](_0x2bd57d,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x2bd57d)));else{for(const [_0x110cbc,_0x2636b6]of this['content'])this['parsedContent']['set'](_0x110cbc,this['aiResponseParser']['parseAndNormalizeHTML'](_0x2636b6));}const _0x1a7ff0=this['changeGroups'];for(const _0x2287f0 of this['content']['keys']())this['updateChangeGroups'](_0x2287f0);const _0x35c87d=this['_getDifferentChangeGroups'](_0x1a7ff0,this['changeGroups']);(_0x35c87d['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x35c87d),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(_0x159816,_0x370ff3){const _0x56610e=[];for(const _0x31a342 of _0x370ff3){const _0x2a053a=_0x159816[_0x31a342['index']];_0x2a053a?_0x2a053a['changes']['length']!==_0x31a342['changes']['length']?_0x56610e['push'](_0x31a342):_0x2a053a['changes']['forEach']((_0x17c022,_0x13be4e)=>{const _0x56c639=_0x31a342['changes'][_0x13be4e];_0x17c022['id']!==_0x56c639['id']&&_0x56610e['push'](_0x31a342);}):_0x56610e['push'](_0x31a342);}return _0x56610e;}updateChangeGroups(_0x3d7875){const _0x3e811d=this['documentContextContent']['get'](_0x3d7875),_0x578540=this['parsedContent']['get'](_0x3d7875);if(!_0x3e811d||!_0x578540)return;const _0x19aa1f=new _0x484959('p',{},[new _0x484959('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x1ced06(Ts(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x2a809c=this['aiResponseApplier']['merge'](_0x578540,_0x3e811d['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x19aa1f});this['parsedMergedContent']['set'](_0x3d7875,_0x2a809c['parsedContent']);let _0x37b38f=[];if(_0x1b7e15(_0x491bf1=>{const _0x50ca33=Hs(_0x491bf1,'data-id');if(!_0x50ca33||!_0x55cfdf(_0x50ca33))return!0x1;const _0x239b0a=[_0x491bf1,...Vs(_0x491bf1)]['at'](-0x2);if(_0x491bf1!=_0x239b0a){const _0x2958f2=Hs(_0x239b0a,'data-id');_0x55cfdf(_0x2958f2)||(_0x37b38f['push']({'node':_0x239b0a,'id':_0x2958f2,'type':'modified'}),_0x2a809c['modifiedNodeIds']['push'](_0x2958f2));}else _0x2a809c['modifiedNodeIds']['includes'](_0x50ca33)?_0x37b38f['push']({'node':_0x491bf1,'type':'modified','id':_0x50ca33}):_0x2a809c['newNodeIds']['includes'](_0x50ca33)?_0x37b38f['push']({'node':_0x491bf1,'type':'new','id':_0x50ca33,'anchorId':Hs(_0x491bf1['previousSibling'],'data-id')}):_0x37b38f['push']({'node':_0x491bf1,'type':'removed','id':_0x50ca33});return!0x0;},this['parsedMergedContent']['get'](_0x3d7875)),_0x37b38f=_0x37b38f['filter'](({node:_0x1ad59d})=>[...Vs(_0x1ad59d),_0x1ad59d]['every'](_0x3bd7fa=>!Hs(_0x3bd7fa,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x2d2d09=>_0x2d2d09['documentId']!==_0x3d7875),0x0==_0x37b38f['length'])return;const _0x535300=[[_0x37b38f[0x0]]];for(let _0x27752b=0x1;_0x27752b<_0x37b38f['length'];_0x27752b++){const _0x3b40b3=_0x535300[_0x535300['length']-0x1],_0xee2e84=_0x3b40b3[_0x3b40b3['length']-0x1];_0x37b38f[_0x27752b]['node']['previousSibling']==_0xee2e84['node']&&'modified'!=_0x37b38f[_0x27752b]['type']&&'modified'!=_0xee2e84['type']?_0x3b40b3['push'](_0x37b38f[_0x27752b]):_0x535300['push']([_0x37b38f[_0x27752b]]);}for(const _0x4d0f61 of _0x535300){const _0x8727e8=_0x4d0f61[0x0],_0x3e29a3=_0x4d0f61[_0x4d0f61['length']-0x1],_0x3feffc=_0x2059f2(_0x8727e8['node']['previousSibling']);_0x3feffc&&_0x4d0f61['unshift'](_0x3feffc);const _0x5dc843=_0x2059f2(_0x3e29a3['node']['nextSibling']);_0x5dc843&&_0x4d0f61['push'](_0x5dc843);}Ns('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x3d7875))['forEach'](_0x1f72e2=>{Ms(_0x1f72e2,'data-wrapped-id',null);});const _0x1f9cd1=new Map();Ns('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x3d7875))['forEach'](_0x37165b=>{const _0x11fc34=Hs(_0x37165b,'data-unwrapped-id'),_0x2db572=Hs(_0x37165b,'data-id');_0x1f9cd1['set'](_0x2db572,_0x11fc34),Ms(_0x37165b,'data-id',_0x11fc34),Ms(_0x37165b,'data-unwrapped-id',null);});for(const _0x223685 of _0x37b38f){const _0x4ea9d9=_0x1f9cd1['get'](_0x223685['id']);_0x4ea9d9&&(_0x223685['id']=_0x4ea9d9);}this['changeGroups']['push'](..._0x535300['map']((_0x5a5128,_0x3a7fc3)=>{const _0x5c10f1=this['_documentIdToSource']['get'](_0x3d7875),_0x52ffbe=this['_outdatedReasonByDocumentId']?.['get'](_0x3d7875),_0x3fdfd4=this['areActionsDisabled']||void 0x0!==_0x52ffbe;return{'changes':_0x5a5128,'state':_0x3fdfd4?'outdated':'pending','outdatedReason':_0x3fdfd4?_0x52ffbe:void 0x0,'index':_0x3a7fc3,'editor':_0x5c10f1['editor'],'rootName':_0x5c10f1['rootName'],'documentId':_0x3d7875};}));const _0x16c49a=Array['from'](this['documentContextContent']['keys']());function _0x55cfdf(_0x4628bb){return _0x2a809c['modifiedNodeIds']['includes'](_0x4628bb)||_0x2a809c['newNodeIds']['includes'](_0x4628bb)||_0x2a809c['removedNodeIds']['includes'](_0x4628bb);}function _0x2059f2(_0x4accf4){if(_0x4accf4&&Hs(_0x4accf4,'data-id')&&!Hs(_0x4accf4,'data-unstable')){const _0x1fa071=Hs(_0x4accf4,'data-id');if(!_0x55cfdf(_0x1fa071))return{'node':_0x4accf4,'type':'context','id':_0x1fa071};}return null;}this['changeGroups']['sort']((_0x58e737,_0x2858a0)=>_0x16c49a['indexOf'](_0x58e737['documentId'])-_0x16c49a['indexOf'](_0x2858a0['documentId'])),this['changeGroups']['forEach']((_0x30d6a5,_0x4a0386)=>{_0x30d6a5['index']=_0x4a0386;});}};const Fn=/* #__PURE__ -- @preserve */
30
- dt(),Kn=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var Wn=class extends Fn{['id'];['replies']=[];currentReply;['messageId'];actionCallId;currentRequest;connector;isStopped=!0x1;isDestroyed=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;_channelsToEditors;constructor({connector:_0x394ba9,locale:_0x55ef55,channelsToEditors:_0x509640}){super(),this['id']=Nt(),this['connector']=_0x394ba9,this['isStopped']=!0x0,this['locale']=_0x55ef55,this['_channelsToEditors']=_0x509640||new Map();}async start(){await this['_run']();}async['resume'](_0x485854){await this['_run'](_0x485854);}async['_run'](_0x197061){const _0xea6a07=[];let _0xd424c0,_0x24c6ac,_0x567a93,_0x592d03=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x197061||this['sendRequest'](),this['fire']('interactionStarted',this);const _0x1c54c8=await this['currentRequest']['getStream']();for await(const _0x162cf3 of _0x1c54c8){if(this['isStopped'])return;if('error'==_0x162cf3['event'])return void this['fire']('error',{'error':new ct('ai-chat-interaction-error',this)});switch(_0x162cf3['event']){case'message-metadata':this['messageId']=_0x162cf3['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x162cf3['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x162cf3['data']['conversationTitle'],!0x0);break;case'source':_0xea6a07['push'](_0x162cf3['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'](),_0xd424c0='modification-delta'==_0x162cf3['event']?'modification':'text',_0x24c6ac='modification-delta'==_0x162cf3['event']?_0x162cf3['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0xd424c0&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0xd424c0,'interactionId':this['id'],'id':_0x24c6ac,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x162cf3['event']&&{'documentId':_0x162cf3['data']['documentId']}}),'modification'==_0xd424c0&&(this['currentReply']['sources']=_0xea6a07['splice'](0x0))),this['currentReply']['appendContent'](_0x162cf3['data']['textDelta'],_0x162cf3['data']['documentId']);break;case'mcp-tool-result':_0x567a93=JSON['parse'](_0x162cf3['data']['result']),this['_handleToolResultData']({'toolName':_0x162cf3['data']['toolName'],'data':_0x567a93['data'],'attributes':_0x567a93['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x162cf3['data']['toolName'],'data':_0x162cf3['data']['data']});}}_0x592d03=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0xea6a07['length']>0x0&&(this['currentReply']['sources']=_0xea6a07['splice'](0x0)),this['_finalizeInteraction'](_0x592d03),this['fire']('interactionFinished',this));}}stop(){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}getReply(_0x2a4fbb){return this['replies']['find'](_0x774bd8=>_0x774bd8['id']===_0x2a4fbb);}destroy(){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x21841=>_0x21841['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}createReply(_0x3adf9b){const _0x10eb05=this['getDocumentContext'](),_0x54fea8=new Gn({'locale':this['locale'],'documentContextContent':_0x10eb05?.['documents'],..._0x3adf9b});return this['replies']['push'](_0x54fea8),_0x54fea8['delegate'](...Kn)['to'](this),this['fire']('replyCreated',_0x54fea8),_0x54fea8;}setConversationTitle(_0x3a2ec5,_0x2013eb=!0x1){this['fire']('setConversationTitle',_0x3a2ec5,_0x2013eb);}resetWebSearchState(){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}resetReasoningState(){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}_handleToolResultData(_0x44db1e){this['fire']('toolDataReceived',{'type':'result','toolName':_0x44db1e['toolName'],'data':structuredClone(_0x44db1e['data']||{}),'attributes':structuredClone(_0x44db1e['attributes']||{})},this);}_handleToolNotificationData(_0x4d124b){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x4d124b['toolName'],'data':structuredClone(_0x4d124b['data'])},this);}_finalizeInteraction(_0x5de278=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x5de278),this['currentRequest']=this['currentReply']=void 0x0;}};const Yn='defaultContextIds',$n=/* #__PURE__ -- @preserve */
31
- At();var qn=class AIContext extends $n{['_refs'];constructor(_0x2d6bc3=[]){super(),this['_refs']=[..._0x2d6bc3];}get['refs'](){return[...this['_refs']];}get isEmpty(){return 0x0===this['_refs']['length'];}cloneWith(..._0x2c8e0f){return new AIContext([...this['_refs'],..._0x2c8e0f]);}addDefaultContext(_0x19591b){this['_refs']=[...this['_refs'],..._0x19591b];}toRequestParts(_0x50153b=[]){return[...this['_refs']['map'](ps),..._0x50153b];}toMessageAttributes(_0x152863){return this['isEmpty']?_0x152863:{..._0x152863,[Yn]:[...new Set(this['_refs']['map'](_0x3f9261=>_0x3f9261['id']))]};}static getDefaultContextIds(_0x4edc17){const _0x67d9c0=_0x4edc17&&_0x4edc17[Yn];return new Set(Array['isArray'](_0x67d9c0)?_0x67d9c0:[]);}};const Qn=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']]),Xn=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var zn=class AIChatContext extends qn{_connector;['_config'];['_ownerId'];constructor({connector:_0x44ea99,config:_0x569aa7,ownerId:_0x3da88f}){super(),this['_connector']=_0x44ea99,this['_config']=_0x569aa7,this['_ownerId']=_0x3da88f;}init(){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}getPendingContextItems(){return new Map(this['_pendingContextItems']);}async populateFromMessage(_0x3b98d2,_0x18be66,_0x2034e3=new Set()){const _0x1c2431=new Map(),{contextItem:_0x38a1db,unmatchedDocumentIds:_0x20a645}=await this['_populateDocumentContextItem'](_0x3b98d2,_0x18be66);_0x38a1db&&_0x1c2431['set'](_0x38a1db['id'],_0x38a1db);for(const _0x3ff92c of _0x3b98d2){if('document'===_0x3ff92c['type'])continue;const _0x342ff2=await this['_createContextItemFromContent'](_0x3ff92c,_0x2034e3);'context'!==_0x342ff2['type']&&this['_addToConversationContextItem'](_0x342ff2),_0x1c2431['set'](_0x342ff2['id'],_0x342ff2);}return{'contextItems':_0x1c2431,'hasUnmatched':_0x20a645['size']>0x0,'unmatchedDocumentIds':_0x20a645};}async _populateDocumentContextItem(_0x35e58a,_0x174c3f){const _0x3303dc=_0x35e58a['filter'](_0x190ad3=>'document'===_0x190ad3['type']);if(0x0===_0x3303dc['length'])return{'unmatchedDocumentIds':new Set()};const _0x9bc8ec=_0x3303dc['map'](_0x4c85ca=>_0x4c85ca['id']),_0x3dbf17=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x9bc8ec)['getDocuments'](),_0x28cfdd=new Map(_0x3dbf17['map'](_0x1dad5b=>[_0x1dad5b['id'],_0x1dad5b])),_0xc78cec=[],_0x1e4b8e=new Set();for(const _0x38e1b4 of _0x3303dc){const _0x298a95=_0x28cfdd['get'](_0x38e1b4['id']);_0x298a95&&(this['_matchDocumentToRoot'](_0x298a95,_0x174c3f)||_0x1e4b8e['add'](_0x298a95['id']),_0xc78cec['push']({'id':_0x298a95['id'],'content':_0x298a95['content'],'version':_0x298a95['attributes']?.['version']??0x0,'sessionId':_0x298a95['attributes']?.['sessionId']??null,'selection':[],'selectionSignature':'','channelId':_0x298a95['attributes']?.['channelId']??_0x174c3f[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x298a95['attributes']?.['rootName']??_0x174c3f[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??'','editorConfig':_0x38e1b4['editorConfig']}));}const _0x489e53={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0xc78cec};return this['_addToConversationContextItem'](_0x489e53),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x489e53,'unmatchedDocumentIds':_0x1e4b8e};}_matchDocumentToRoot(_0x4c39ae,_0x4fd876){const _0x3a02a8=_0x4c39ae['attributes']?.['channelId'],_0x4df321=_0x4c39ae['attributes']?.['rootName'];if(_0x3a02a8&&_0x4df321){for(const _0x390b73 of _0x4fd876)if(_0x390b73['config']['get']('collaboration.channelId')===_0x3a02a8){for(const _0x3e50b9 of _0x390b73['model']['document']['getRoots']())if('$graveyard'!==_0x3e50b9['rootName']&&_0x3e50b9['rootName']===_0x4df321)return{'editor':_0x390b73,'rootName':_0x3e50b9['rootName']};}}}async _createContextItemFromContent(_0x15d75a,_0x550640=new Set()){return'mcp-tool-context'===_0x15d75a['type']?{'id':_0x15d75a['id'],'uiId':_0x15d75a['id'],'label':_0x15d75a['data']?.['label']||_0x15d75a['id'],'type':'mcp-tool-context','mcpServerName':_0x15d75a['mcpServerName'],'toolName':_0x15d75a['toolName'],'data':_0x15d75a['data']||{}}:{'id':_0x15d75a['id'],'uiId':_0x15d75a['id'],'label':_0x15d75a['attributes']?.['label']||_0x15d75a['name']||_0x15d75a['url']||_0x15d75a['id'],'type':_0x15d75a['type'],..._0x15d75a?.['attributes']?.['resourceId']?{'resourceId':_0x15d75a['attributes']?.['resourceId']}:{},...'context'===_0x15d75a['type']&&_0x550640['has'](_0x15d75a['id'])?{'hidden':!0x0}:{}};}getSentContextItems(){return new Map(this['_conversationContextItems']);}removeFromContext(_0x4936ad){this['_pendingContextItems']['get'](_0x4936ad)?.['isReadOnly']||this['_removeContextItem'](_0x4936ad);}clearPendingContextItems(){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x2c7d0f of this['_pendingContextItems']['values']())'context'!==_0x2c7d0f['type']&&this['_removeContextItem'](_0x2c7d0f['uiId']);const _0xfb35ba=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0xfb35ba&&this['_addContextItem']({..._0xfb35ba,'isReadOnly':!0x0,'hidden':!0x0});}addToConversationContext(_0x25e7c6){for(const _0x226a95 of _0x25e7c6['values']())'context'!==_0x226a95['type']&&this['_addToConversationContextItem'](_0x226a95);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(_0x20b684){return Array['from'](_0x20b684['values']())['flatMap'](_0x365b22=>this['_mapContextItemToRequestData'](_0x365b22));}async addFilesToContext(_0x38cba2,_0x4b5ec0,_0x3c9874='file'){const _0x10f370='files-'+Nt();this['_startUploadOperation'](_0x10f370);try{await Promise['all'](_0x38cba2['map'](async _0x5af896=>{const _0x356771='file-'+Nt(),_0x56d242=_0x34b9ac(_0x5af896['name']),_0x24e9d7='file'===_0x3c9874&&_0x5af896['type']['startsWith']('image/')?'image':_0x3c9874;try{this['_addContextItem']({'type':_0x24e9d7,'label':_0x4b5ec0?.['label']||_0x56d242,'uiId':_0x356771,'resourceId':_0x4b5ec0?.['resourceId']},!0x0);const _0x42dc58=this['_connector']['uploadFile'](this['_ownerId'],_0x5af896,_0x4b5ec0);this['_ongoingUploads']['set'](_0x356771,_0x42dc58['abortController']);const {id:_0x517704}=await _0x42dc58['getId']();this['_ongoingUploads']['delete'](_0x356771),this['_finishContextItemLoading']({'type':_0x24e9d7,'id':_0x517704,'label':_0x4b5ec0?.['label']||_0x56d242,'uiId':_0x356771,'resourceId':_0x4b5ec0?.['resourceId']},!0x1);}catch(_0x3db71c){if(this['_ongoingUploads']['delete'](_0x356771),!Nn(_0x3db71c)){const _0x4522aa=new xn({'code':Qn['get'](_0x3db71c['code'])||'ai-chat-file-upload-failed','cause':_0x3db71c,'context':{'fileName':_0x56d242}});this['fire']('error',{'error':_0x4522aa});}this['_removeContextItem'](_0x356771);}}));}finally{this['_finishUploadOperation'](_0x10f370);}}addCurrentDocumentToContext(_0x5cffb2){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x1a9bc4={'type':'document','uiId':'current-document','label':_0x5cffb2,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x1a9bc4);}getCurrentDocumentContext(){return this['_pendingContextItems']['get']('current-document');}async updateCurrentDocuments(_0x1cb9df,_0x14cef3){const _0x181fc6=this['getCurrentDocumentContext']();if(!_0x181fc6)return;_0x1cb9df['length']>0x1&&_0x1cb9df['some'](_0x3b9340=>!_0x3b9340['description'])&&Ot('ai-chat-documents-missing-description');try{const _0x4f370e=(_0x181fc6['documents']||[])['filter'](_0x597af8=>_0x14cef3['has'](_0x597af8['channelId']));if(!_0x1cb9df['length'])return void(_0x181fc6['documents']=_0x4f370e);const _0x33081b=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x1cb9df)['getIds']();if(_0x33081b['length']!==_0x1cb9df['length']||_0x33081b['some'](_0x1c5590=>!_0x1c5590?.['id'])){const _0x25fffb=new ct('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x25fffb});}const _0x30ebf6=_0x1cb9df['map']((_0x401375,_0x5189bc)=>{return{'id':_0x33081b[_0x5189bc]['id'],'content':_0x401375['content'],'version':_0x401375['version'],'sessionId':_0x401375['sessionId'],'selection':(_0x533afd=_0x401375['selections'],_0x533afd?_0x533afd['map'](_0x5dea2a=>({'start':_0x5dea2a['start'],'end':_0x5dea2a['end']})):[]),'selectionSignature':_0x401375['selectionSignature'],'channelId':_0x401375['channelId'],'rootName':_0x401375['rootName'],'editorConfig':_0x401375['editorConfig']};var _0x533afd;});_0x181fc6['documents']=[..._0x4f370e,..._0x30ebf6];}catch(_0x1d4cdf){throw new xn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x1d4cdf});}}addSelectionToContext(_0x2f39a6){this['_addContextItem']({'type':'selection','label':_0x2f39a6,'uiId':'selection','content':_0x2f39a6});}removeSelectionFromContext(){this['_removeContextItem']('selection');}async addUrlToContext(_0x4703ef,_0x200ae6){const _0x1b8cf5='url-'+Nt();this['_startUploadOperation'](_0x1b8cf5);const _0x16734d='url-'+Nt();try{this['_addContextItem']({'type':'web-resource','label':_0x200ae6?.['label']||_0x4703ef,'uiId':_0x16734d,'resourceId':_0x200ae6?.['resourceId']},!0x0);const _0x1d35d2=this['_connector']['uploadUrl'](this['_ownerId'],_0x4703ef,_0x200ae6);this['_ongoingUploads']['set'](_0x16734d,_0x1d35d2['abortController']);const {id:_0x506b29}=await _0x1d35d2['getId']();this['_ongoingUploads']['delete'](_0x16734d),this['_finishContextItemLoading']({'type':'web-resource','id':_0x506b29,'label':_0x200ae6?.['label']||_0x4703ef,'uiId':_0x16734d,'resourceId':_0x200ae6?.['resourceId']},!0x1);}catch(_0x2502a8){this['_ongoingUploads']['delete'](_0x16734d),Nn(_0x2502a8)||this['fire']('error',{'error':new ct('ai-chat-url-upload-failed',this,{'url':_0x4703ef,'originalError':_0x2502a8}),'url':_0x4703ef}),this['_removeContextItem'](_0x16734d);}finally{this['_finishUploadOperation'](_0x1b8cf5);}}addToolItemToContext(_0x2b4230){_0x2b4230['id']=_0x2b4230['id']??Nt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x2b4230['uiId'],_0x2b4230),this['fire']('contextItemAdded',{'contextItem':_0x2b4230,'isLoading':!0x1});}async['loadSourceResources'](_0x33120d,_0x56f08c,_0x1fe1b9){const _0x28f560=this['_addContextOptionsState']['sources']['find'](_0x5392f0=>_0x5392f0['id']===_0x33120d);if(!_0x28f560)return this['fire']('error',{'error':new ct('ai-chat-source-not-found',this,{'sourceId':_0x33120d}),'sourceId':_0x33120d}),[];try{const _0x2950ac=(await _0x28f560['getResources'](_0x56f08c))['map'](_0x117cd5=>{const _0x12920a=this['_isResourceInContext'](_0x117cd5['id']);return{..._0x117cd5,'isInContext':_0x12920a};});return _0x28f560['resources']=_0x2950ac,this['fire']('sourceResourcesLoaded',{'sourceId':_0x33120d,'source':_0x28f560,'resources':_0x2950ac,'uid':_0x1fe1b9}),_0x2950ac;}catch(_0x5dfef3){return this['fire']('error',{'error':new ct('ai-chat-source-resources-load-failed',this,{'sourceId':_0x33120d,'originalError':_0x5dfef3}),'sourceId':_0x33120d,'sourceLabel':_0x28f560['label']}),[];}}async addResourceToContext(_0x531038,_0x39ce60){if(this['_isResourceInContext'](_0x39ce60['id']))return;if('context'===_0x39ce60['type'])return void this['_addContextItem']({'type':'context','id':_0x39ce60['id'],'label':_0x39ce60['label'],'uiId':'context-'+Nt(),'resourceId':_0x39ce60['id']});let _0x3598cc=_0x39ce60['data'];if(!_0x3598cc&&_0x531038['getData'])try{_0x3598cc=await _0x531038['getData'](_0x39ce60['id']);}catch(_0x49c84c){return void this['fire']('error',{'error':new ct('ai-chat-resource-load-failed',this,{'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id'],'originalError':_0x49c84c}),'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id']});}if(_0x3598cc)switch(_0x39ce60['type']){case'web-resource':if('string'!=typeof _0x3598cc)return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id'],'expectedType':'string','actualType':typeof _0x3598cc}),'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id']});await this['addUrlToContext'](_0x3598cc,{'label':_0x39ce60['label'],'resourceId':_0x39ce60['id']});break;case'file':if(!(_0x3598cc instanceof File))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id'],'expectedType':'File','actualType':typeof _0x3598cc}),'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id']});await this['addFilesToContext']([_0x3598cc],{'label':_0x39ce60['label'],'resourceId':_0x39ce60['id']});break;case'text':if('object'!=typeof _0x3598cc||!('content'in _0x3598cc)||!('type'in _0x3598cc))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x3598cc}),'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id']});_0x3598cc=AIChatContext['_convertTextResourceToFile'](_0x3598cc,_0x39ce60['label']),await this['addFilesToContext']([_0x3598cc],{'label':_0x39ce60['label'],'resourceId':_0x39ce60['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ct('ai-chat-context-unsupported-type',this,{'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id'],'resourceType':_0x39ce60['type']}),'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id']});}else this['fire']('error',{'error':new ct('ai-chat-resource-no-data',this,{'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id']}),'resourceId':_0x39ce60['id'],'sourceId':_0x531038['id']});}addContextSource(_0x1b0262){this['_addContextOptionsState']['sources']['some'](_0xaa4a0d=>_0xaa4a0d['id']===_0x1b0262['id'])||(this['_addContextOptionsState']['sources']['push']({..._0x1b0262,'resources':[]}),this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']}));}toggleAddCurrentDocumentOptionVisibility(_0x3f4bb5){if(void 0x0!==_0x3f4bb5)this['_addContextOptionsState']['document']['isHidden']=!_0x3f4bb5;else{const _0x58f26c=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x58f26c;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static _convertTextResourceToFile(_0x42988c,_0x293a54){switch(_0x42988c['type']){case'markdown':return new File([_0x42988c['content']],_0x293a54,{'type':'text/markdown'});case'html':return new File([_0x42988c['content']],_0x293a54,{'type':'text/html'});default:return new File([_0x42988c['content']],_0x293a54,{'type':'text/plain'});}}static _mapContextItemToRequestData(_0x2aba3d){switch(_0x2aba3d['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x2aba3d['id']}];case'web-resource':return[{'type':'web-resource','id':_0x2aba3d['id']}];case'context':return[{'type':'context','id':_0x2aba3d['id']}];case'document':return _0x2aba3d['documents']?.['length']?_0x2aba3d['documents']['map'](({id:_0x3ff13b,editorConfig:_0x448f56,selection:_0x1e3e14})=>({'type':'document','id':_0x3ff13b,..._0x448f56&&{'editorConfig':_0x448f56},..._0x1e3e14?.['length']&&{'selection':_0x1e3e14}})):[];case'mcp-tool-context':{const _0xf40acb=_0x2aba3d;return[{'type':'mcp-tool-context','mcpServerName':_0xf40acb['mcpServerName'],'toolName':_0xf40acb['toolName'],'data':{..._0xf40acb['data'],'label':_0xf40acb['label']||_0xf40acb['data']?.['label']||_0xf40acb['id']},'id':_0xf40acb['id']}];}default:return[];}}_addContextItem(_0x558445,_0x5aaf9e=!0x1){if(this['_pendingContextItems']['set'](_0x558445['uiId'],_0x558445),_0x558445['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x558445,'isLoading':_0x5aaf9e}),'current-document'===_0x558445['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x558445['resourceId']){const _0x538477=this['_findSourceIdsByResourceId'](_0x558445['resourceId']);_0x538477&&_0x538477['forEach'](_0x2cab16=>{this['_updateResourceInContextState'](_0x2cab16,_0x558445['resourceId'],!0x0);});}}_removeContextItem(_0x205117){const _0x3bbe83=this['_pendingContextItems']['get'](_0x205117),_0x37f1d5=this['_ongoingUploads']['get'](_0x205117);if(_0x37f1d5&&(_0x37f1d5['abort'](),this['_ongoingUploads']['delete'](_0x205117)),_0x3bbe83?.['resourceId']){const _0x13dbd4=this['_findSourceIdsByResourceId'](_0x3bbe83['resourceId']);_0x13dbd4&&_0x13dbd4['forEach'](_0x574a50=>{this['_updateResourceInContextState'](_0x574a50,_0x3bbe83['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x205117),this['fire']('contextItemRemoved',{'uiId':_0x205117,'type':_0x3bbe83?.['type']}),'current-document'===_0x205117&&this['toggleAddCurrentDocumentOptionVisibility']();}_finishContextItemLoading(_0x22cc4d,_0x351508){if(this['_pendingContextItems']['has'](_0x22cc4d['uiId'])&&(this['_pendingContextItems']['set'](_0x22cc4d['uiId'],_0x22cc4d),this['fire']('contextItemLoadingEnded',{'contextItem':_0x22cc4d,'isLoading':_0x351508}),_0x22cc4d['resourceId'])){const _0x9004be=this['_findSourceIdsByResourceId'](_0x22cc4d['resourceId']);_0x9004be&&_0x9004be['forEach'](_0x8b82e6=>{this['_updateResourceInContextState'](_0x8b82e6,_0x22cc4d['resourceId'],!0x0);});}}_addToConversationContextItem(_0x50451d){this['_conversationContextItems']['set'](_0x50451d['uiId'],_0x50451d);}_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'](_0x36924b=>({..._0x36924b,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}_getCustomSourcesInitialState(){return this['_config']?.['sources']?.['map'](_0x379a68=>({..._0x379a68,'resources':[]}))??[];}_isResourceInContext(_0x4ba82a){for(const _0x2d5441 of this['_pendingContextItems']['values']())if(_0x2d5441['resourceId']===_0x4ba82a)return!0x0;for(const _0x3edc2f of this['_conversationContextItems']['values']())if(_0x3edc2f['resourceId']===_0x4ba82a)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x4d2425){const _0x5a3aa1=[];for(const _0x314fbf of this['_addContextOptionsState']['sources'])_0x314fbf['resources']['find'](_0x4f0d90=>_0x4f0d90['id']===_0x4d2425)&&_0x5a3aa1['push'](_0x314fbf['id']);return 0x0===_0x5a3aa1['length']?null:_0x5a3aa1;}_updateResourceInContextState(_0x4ed742,_0x4bf652,_0x356346){const _0x2f5139=this['_addContextOptionsState']['sources']['find'](_0x537a19=>_0x537a19['id']===_0x4ed742);if(!_0x2f5139)return;const _0x57cc7b=_0x2f5139['resources']['find'](_0x2b49f5=>_0x2b49f5['id']===_0x4bf652);_0x57cc7b&&(_0x57cc7b['isInContext']=_0x356346,this['fire']('resourceStateChanged',{'sourceId':_0x4ed742,'resourceId':_0x4bf652,'isInContext':_0x356346}));}_startUploadOperation(_0x5da68b){this['_ongoingUploadOperations']['set'](_0x5da68b,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}_finishUploadOperation(_0x33da4e){this['_ongoingUploadOperations']['delete'](_0x33da4e),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}},jn=class extends Wn{['userMessage'];conversationId;contextItems=new Map();capabilities;['model'];attributes;context;constructor(_0x2a7f3c){super(_0x2a7f3c),this['conversationId']=_0x2a7f3c['conversationId'],this['contextItems']=_0x2a7f3c['contextItems'],this['capabilities']=_0x2a7f3c['capabilities'],this['userMessage']=_0x2a7f3c['userMessage'],this['model']=_0x2a7f3c['model'],this['attributes']=_0x2a7f3c['attributes'],this['context']=_0x2a7f3c['context']??new qn();}sendRequest(){const _0x8262ba=zn['mapContextItemsToRequestData'](this['contextItems']),_0x51a1df=this['context']['toRequestParts'](_0x8262ba);return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':_0x51a1df,'capabilities':Sn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['context']['toMessageAttributes'](this['attributes'])});}getDocumentContext(){return this['contextItems']['get']('current-document');}};const Jn=/* #__PURE__ -- @preserve */
32
- dt();var Zn=class extends Jn{['id'];isStarted=!0x1;isFromHistory;interactions=[];currentInteraction;selectedModel;connector;options;_abortReject;_channelsToEditors;_getSessionId;constructor(_0x21327e){super(),this['options']=_0x21327e,this['connector']=_0x21327e['connector'],this['chatModels']=_0x21327e['chatModels'],this['id']=_0x21327e['conversationId'],this['isFromHistory']=_0x21327e['isFromHistory'],this['_channelsToEditors']=_0x21327e['channelsToEditors'],this['_getSessionId']=_0x21327e['getSessionId'];}async init(_0x3f4f99){try{this['chatContext']=new zn({'connector':this['connector'],'config':_0x3f4f99,'ownerId':this['id']}),this['chatContext']['delegate'](...Xn)['to'](this),this['chatContext']['init'](),this['options']['contextLibrary']?.['resolveContext']({'feature':'chat','extraContexts':this['options']['extraContexts'],'context':this['chatContext']}),this['chatCapabilities']=new Sn(),this['chatCapabilities']['delegate'](...bn)['to'](this),this['chatCapabilities']['init']();const _0x45e5ae=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x45e5ae});const _0x16fe35=await this['chatModels']['resolveModel'](this['options']['selectedModelId']);_0x16fe35&&await this['setModel'](_0x16fe35);}catch(_0x19b915){const _0x4c9586=new xn({'code':'ai-chat-conversation-init-failed','cause':_0x19b915,'type':'network'});this['fire']('error',{'error':_0x4c9586});}}async start(){if(this['isStarted'])throw new ct('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ct('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x3c606d}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x3c606d,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x50ba19){const _0x5055a1=new xn({'code':'ai-chat-conversation-start-failed','cause':_0x50ba19,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x5055a1}),_0x5055a1;}}async['load'](_0x24e955){try{const _0x33d7be=await this['connector']['fetchConversation'](_0x24e955)['getConversation'](),_0x475e49=await this['connector']['fetchConversationMessages'](_0x24e955)['getMessages'](),_0x1c407f=_0x475e49[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x33d7be['id'],'title'in _0x33d7be?this['fire']('setConversationTitle',_0x33d7be['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']),this['selectedModel']=await this['chatModels']['getModel'](_0x1c407f)??void 0x0,this['fire']('modelSelected',{'selectedModel':this['selectedModel'],'isDisabled':!0x0});const {streamingMessageId:_0x4118da}=await this['_processMessagesToInteractions'](_0x475e49,_0x1c407f);return _0x4118da&&this['currentInteraction']?this['_resumeStream'](_0x4118da):this['currentInteraction']=void 0x0,this;}catch(_0xfd4b89){const _0x3cbb7f=new xn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0xfd4b89,'type':'network','context':{'conversationId':_0x24e955}});throw this['fire']('error',{'error':_0x3cbb7f}),_0x3cbb7f;}}async _processMessagesToInteractions(_0x63a94f,_0x1b5b5f){let _0x974733,_0x4eac57,_0x59d210=new Set();for(const _0x2c4cd0 of _0x63a94f)if('user'===_0x2c4cd0['role']){const {contextItems:_0x264269,unmatchedDocumentIds:_0x2ed8bb}=await this['_extractContextItems'](_0x2c4cd0);_0x59d210=_0x2ed8bb;const _0x4a54f0={'isReasoningEnabled':Object['hasOwn'](_0x2c4cd0['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x2c4cd0['capabilities'],'webSearch')};_0x974733=this['createInteraction']({'userMessage':_0x2c4cd0['prompt'],'contextItems':_0x264269,'capabilities':_0x4a54f0,'modelId':_0x1b5b5f,'attributes':_0x2c4cd0['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x974733,_0x4eac57=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x2c4cd0['role']&&_0x974733){if('streaming'===_0x2c4cd0['status']){_0x4eac57=_0x2c4cd0['id'];continue;}if('error'===_0x2c4cd0['status'])continue;const _0x3dc088=[];for(const _0x343fed of _0x2c4cd0['content'])switch(_0x343fed['type']){case'text':case'modification':{const _0x29bc81=_0x974733['getDocumentContext'](),_0x51d940=this['_getOutdatedReasonsByDocumentId'](_0x29bc81,_0x59d210),_0x245623=_0x29bc81?.['documents']??[],_0x535965=_0x245623['length']>0x0&&_0x245623['every'](_0x3eaf37=>_0x51d940['has'](_0x3eaf37['id']));_0x974733['currentReply']?.['type']!==_0x343fed['type']&&(_0x974733['currentReply']=_0x974733['createReply']({'type':_0x343fed['type'],'isDone':!0x0,'interactionId':_0x974733['id'],'areActionsDisabled':_0x535965,'outdatedReasonByDocumentId':_0x51d940,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x3dc088['length']>0x0&&(_0x974733['currentReply']['sources']=_0x3dc088['splice'](0x0))),_0x974733['currentReply']['appendContent'](_0x343fed['content'],_0x343fed['documentId']);break;}case'url':_0x3dc088['push'](_0x343fed);break;case'mcp-tool-result':{const {data:_0xe946e2,attributes:_0xc07aa4}=JSON['parse'](_0x343fed['content']);_0x974733['_handleToolResultData']({'toolName':_0x343fed['toolName'],'data':_0xe946e2,'attributes':_0xc07aa4});break;}}'cancelled'===_0x2c4cd0['status']&&this['fire']('error',{'interactionId':_0x974733['id'],'error':new ct('ai-request-aborted',this)});}}return{'streamingMessageId':_0x4eac57};}async _resumeStream(_0x39a7fd){if(this['currentInteraction'])try{const _0xf89bde=this['connector']['resumeStream'](this['id'],_0x39a7fd);await this['currentInteraction']['resume'](_0xf89bde);}catch(_0x520146){_0x520146 instanceof ct&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x520146});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async _extractContextItems(_0x3187cb){return _0x3187cb['content']?this['chatContext']['populateFromMessage'](_0x3187cb['content'],Array['from'](this['_channelsToEditors']['values']()),qn['getDefaultContextIds'](_0x3187cb['attributes'])):{'contextItems':new Map(),'unmatchedDocumentIds':new Set()};}async handleUserInteraction({userMessage:_0x5c3bd8,attributes:_0x706a21}){if(!this['isStarted'])throw new ct('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ct('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x20516e=new Map(this['getPendingContextItems']()),_0x3ec277=this['chatCapabilities']['getCapabilitiesConfig'](),_0x4f4e2d=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x5c3bd8,'contextItems':_0x20516e,'capabilities':_0x3ec277,'modelId':_0x4f4e2d,'attributes':_0x706a21,'channelsToEditors':this['_channelsToEditors']}),await this['updateCurrentDocumentsInContext'](),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x4c5bc4){if(_0x4c5bc4 instanceof ct)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x4c5bc4});else{const _0x60f1b2=Qn['get'](_0x4c5bc4['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ct(_0x60f1b2,null,{'error':_0x4c5bc4})});}}finally{this['stopProcessing']();}}stopProcessing(){this['_abortReject']&&(this['_abortReject'](),this['_abortReject']=void 0x0),this['currentInteraction']&&(this['currentInteraction']['stop'](),this['currentInteraction']=void 0x0);}createInteraction({userMessage:_0x354c27,contextItems:_0x39bc2c,capabilities:_0x7bea89,modelId:_0x404830,attributes:_0x1228b5,channelsToEditors:_0xcfdd20}){const _0x59aa04=new jn({'userMessage':_0x354c27,'contextItems':_0x39bc2c,'capabilities':_0x7bea89,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x404830,'attributes':_0x1228b5,'channelsToEditors':_0xcfdd20,'context':this['chatContext']['isEmpty']?void 0x0:new qn(this['chatContext']['refs'])});return _0x59aa04['delegate'](...Kn)['to'](this),this['interactions']['push'](_0x59aa04),this['fire']('interactionCreated',_0x59aa04),_0x59aa04;}getInteraction(_0x305d05){return this['interactions']['find'](_0x3bea58=>_0x3bea58['id']===_0x305d05);}removeInteraction(_0x82b380){const _0x35c320=this['getInteraction'](_0x82b380);_0x35c320&&(_0x35c320['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x35c320),0x1));}get lastInteraction(){return this['interactions'][this['interactions']['length']-0x1];}cancelLastInteractionStream(){const _0x131636=this['lastInteraction'];_0x131636?.['conversationId']&&_0x131636['messageId']&&this['connector']['cancelStream'](_0x131636['conversationId'],_0x131636['messageId'])['execute']()['catch'](()=>{});}addCurrentDocumentToContext(_0x400511){this['chatContext']['addCurrentDocumentToContext'](_0x400511);}async updateCurrentDocumentsInContext(){if(!this['isCurrentDocumentInContext']())return;const {changedIds:_0x1e6989,unchangedIds:_0x45de89}=this['_compareEditorStateWithDocumentContext'](),_0x23c146=new Promise((_0x1f2056,_0x23ef68)=>{this['_abortReject']=()=>_0x23ef68(new ct('ai-request-aborted',this));}),_0x4ff870=await Promise['race']([this['options']['aiEditing']['getDocumentData'](_0x1e6989),_0x23c146]);await Promise['race']([this['chatContext']['updateCurrentDocuments'](_0x4ff870,_0x45de89),_0x23c146]);}_compareEditorStateWithDocumentContext(){const _0x30c917=new Set(),_0x225aed=new Set(),_0x399c3a=this['options']['aiEditing']['getEditorsVersions'](),_0x4f5e83=this['options']['aiEditing']['getEditorsSelections'](),_0x1577cf=this['chatContext']['getCurrentDocumentContext']()['documents']||[],_0x5d2681=new Map(_0x1577cf['map'](({channelId:_0x454f77,version:_0x1e38c7})=>[_0x454f77,_0x1e38c7])),_0x302f92=new Map(_0x1577cf['map'](({channelId:_0x5dd58f,selectionSignature:_0x468ca7})=>[_0x5dd58f,_0x468ca7]));for(const [_0x1e8ab5,_0x546d93]of _0x399c3a){const _0x54a5f3=_0x4f5e83['get'](_0x1e8ab5);_0x5d2681['get'](_0x1e8ab5)!=_0x546d93||_0x302f92['get'](_0x1e8ab5)!=_0x54a5f3?_0x30c917['add'](_0x1e8ab5):_0x5d2681['has'](_0x1e8ab5)&&_0x225aed['add'](_0x1e8ab5);}return{'changedIds':_0x30c917,'unchangedIds':_0x225aed};}toggleAddCurrentDocumentOptionVisibility(_0x245d89){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x245d89);}_getOutdatedReasonsByDocumentId(_0x133c4b,_0x3fc50b){const _0x3e5200=new Map();if(!_0x133c4b||!_0x133c4b['documents'])return _0x3e5200;for(const _0x1b4ec5 of _0x133c4b['documents']){const _0x1c3ea8=this['_channelsToEditors']['get'](_0x1b4ec5['channelId']);_0x1c3ea8&&'destroyed'!==_0x1c3ea8['state']?_0x1b4ec5['sessionId']!==this['_getSessionId'](_0x1c3ea8)?_0x3e5200['set'](_0x1b4ec5['id'],'session-changed'):_0x3fc50b['has'](_0x1b4ec5['id'])&&_0x3e5200['set'](_0x1b4ec5['id'],'content-removed'):_0x3e5200['set'](_0x1b4ec5['id'],'editor-removed');}return _0x3e5200;}addSelectionToContext(_0x3ae108){this['chatContext']['addSelectionToContext'](_0x3ae108);}removeSelectionFromContext(){this['chatContext']['removeSelectionFromContext']();}addFilesToContext(_0x24400a){this['chatContext']['addFilesToContext'](_0x24400a);}addUrlToContext(_0xc1806b){this['chatContext']['addUrlToContext'](_0xc1806b);}addToolItemToContext(_0x7dc0cf){this['chatContext']['addToolItemToContext'](_0x7dc0cf);}addResourceToContext(_0x57c4c8,_0x3c8aee){this['chatContext']['addResourceToContext'](_0x57c4c8,_0x3c8aee);}['loadSourceResources'](_0x5040cc,_0x30f0c2,_0x19a7ea){return this['chatContext']['loadSourceResources'](_0x5040cc,_0x30f0c2,_0x19a7ea);}removeFromContext(_0x369997){this['chatContext']['removeFromContext'](_0x369997);}setWebSearch(_0x57f02a){this['chatCapabilities']['setWebSearch'](_0x57f02a);}toggleWebSearch(){this['chatCapabilities']['toggleWebSearch']();}setReasoning(_0x45bad6){this['chatCapabilities']['setReasoning'](_0x45bad6);}toggleReasoning(){this['chatCapabilities']['toggleReasoning']();}isCurrentDocumentInContext(){return this['chatContext']['isCurrentDocumentInContext']();}isCurrentDocumentInConversation(){return this['chatContext']['isCurrentDocumentInConversation']();}isSelectionInContext(){return this['chatContext']['isSelectionInContext']();}getPendingContextItems(){return this['chatContext']['getPendingContextItems']();}addDefaultContext(_0x5b3c9f){_0x5b3c9f['length']&&this['chatContext']['addDefaultContext'](_0x5b3c9f);}async setModel(_0x55547a){_0x55547a?!0x1===await this['chatModels']['isAvailable'](_0x55547a)&&(Ot('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x55547a}),_0x55547a=(await this['chatModels']['getAvailableModels']())[0x0]):(Ot('ai-chat-conversation-set-model-null',{'conversation':this}),_0x55547a=(await this['chatModels']['getAvailableModels']())[0x0]),_0x55547a['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x55547a,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x55547a}));}};function tr({documentSuggestions:_0x33e87f,transform:_0x3ae8ff,documentCompare:_0xead5fa,documentCompareOptions:_0x5004bc}){const _0x5c71d3=new Map();for(const [_0x47ebda,{groups:_0x3b7852,documentContext:_0x57eee1,documentContent:_0x3d85fc,editor:_0x500e45}]of _0x33e87f){const _0x4e397b=_0x57eee1['content'],_0x15c0ac=_0x57eee1['version'],_0x1cb7c9=_0x3d85fc['cloneNode'](!0x0);for(const {changes:_0x1ec471}of _0x3b7852)Qs(_0x1cb7c9,_0x1ec471);const _0x5c243e=ks(_0x1cb7c9),_0x673470=zs(_0x500e45,_0x57eee1['rootName'],_0x4e397b,_0x5c243e);if(!_0x673470)continue;const _0x48d6e=_0xead5fa['getDiff'](_0x673470['before'],_0x673470['after'],{'targetEditor':_0x500e45,'anchor':_0x57eee1['rootName'],..._0x5004bc})['getOperations']();if(_0x3ae8ff){const _0x5aed3e=_0x500e45['model']['document']['history']['getOperations'](_0x15c0ac),_0x3213e2={'document':_0x500e45['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x5c71d3['set'](_0x47ebda,_0x400478(_0x48d6e,_0x5aed3e,_0x3213e2)['operationsA']);}else _0x5c71d3['set'](_0x47ebda,_0x48d6e);}return _0x5c71d3;}function er({groups:_0x3a766e,documentContextContent:_0x1ab9e1,documents:_0x5adb31}){const _0x2d2313=new Map();for(const _0x38bbe6 of _0x3a766e){const {documentId:_0x56a040}=_0x38bbe6,_0x2c2760=_0x2d2313['get'](_0x56a040);if(_0x2c2760)_0x2c2760['groups']['push'](_0x38bbe6),_0x2c2760['indexes']['push'](_0x38bbe6['index']);else{const _0x122e98=_0x5adb31['find'](_0x2bd3ec=>_0x2bd3ec['id']===_0x56a040),_0x35c49c=_0x1ab9e1['get'](_0x56a040);if(!_0x122e98||!_0x35c49c)continue;_0x2d2313['set'](_0x56a040,{'groups':[_0x38bbe6],'documentContext':_0x122e98,'documentContent':_0x35c49c,'editor':_0x38bbe6['editor'],'indexes':[_0x38bbe6['index']]});}}return _0x2d2313;}function ir(_0x38f083,_0xf3b347){const _0x560758=_0x38f083['files']['length']>0x0&&_0x38f083['files']['every'](_0x5a6c09=>_0x5a6c09['type']['startsWith']('image/')),_0x22cc67=_0x38f083['plainText']['trim']()['length']>0x0;if(_0x38f083['files']['length']>0x0&&_0xf3b347['filesEnabled']&&(!_0x560758||!_0x22cc67)){const _0x349cdd=_0x38f083['files']['filter'](_0xb4b8d3=>_0xb4b8d3['name']);return _0x349cdd['length']>0x0?{'type':'file','files':_0x349cdd}:null;}if(_0xf3b347['urlsEnabled']){const _0x475012=function(_0x1ce8d7){const _0x474c36=_0x1ce8d7['trim']();if(/\s/['test'](_0x474c36))return null;try{const _0x34e4e9=new URL(_0x474c36);return'http:'!==_0x34e4e9['protocol']&&'https:'!==_0x34e4e9['protocol']?null:_0x34e4e9['toString']();}catch{return null;}}(_0x38f083['plainText']);if(_0x475012)return{'type':'url','url':_0x475012};}const _0x5172b8=_0x38f083['forceTextAttachment']?0x1:_0xf3b347['longTextThreshold']??0x1/0x0;if(_0x38f083['plainText']['length']>=Math['max'](_0x5172b8,0x1)&&_0xf3b347['filesEnabled']){const _0x562074=_0xf3b347['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x38f083['plainText']],_0x562074,{'type':'text/plain'})]};}return null;}var sr=class extends _0x45fe7d{activeConversation;_aiEditing;_aiConnector;_aiChatUi;['_aiModels'];_aiContextLibrary;_contextLibrarySource=null;_hasAIChatBalloon=!0x1;_activeBalloon;_reporter;_batchToChanges=new Map();_currentPreviewedChangeGroup=null;_bodyCollection;_channelsToEditors=new Map();static get requires(){return[Es,Ln,_0x4eecd6,Ss];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['set']('isConversationReady',!0x1),this['_bodyCollection']=Vn(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](Ln)['createReporter']('aichat'),this['_aiModels']=this['context']['plugins']['get'](Ss)['models'],this['_aiContextLibrary']=this['context']['plugins']['get'](Ss)['contextLibrary'];const _0x5a1a26=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x38e97e,_0x5a3daa)=>{this['sendMessage']({'message':_0x5a3daa});}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',()=>{this['activeConversation']?.['stopProcessing']();}),this['listenTo'](_0x5a1a26['view'],'change:activeTab',(_0x3cc4e4,_0x5f1eec,_0x37b637)=>{'chat'!==_0x37b637&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x2ad19c,_0x401c2c)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x401c2c));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x40bad7,_0x443155)=>{this['activeConversation']?.['addUrlToContext'](_0x443155);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x437447,_0xa854d4)=>{const _0x90f1d6=this['activeConversation'];if(!_0x90f1d6)return;_0xa854d4['hasDirectory']&&(_0xa854d4['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+Nt()}));const _0x42eda4=ir(_0xa854d4,{'pastedTextLabel':Ts(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')});_0x42eda4&&(_0xa854d4['preventDefault'](),'url'===_0x42eda4['type']?_0x90f1d6['addUrlToContext'](_0x42eda4['url']):_0x90f1d6['chatContext']['addFilesToContext'](_0x42eda4['files'],void 0x0,_0x42eda4['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x24a840,_0x317f72)=>{_0x317f72['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x7a390a,_0x44de5c)=>{this['activeConversation']?.['addResourceToContext'](_0x44de5c['source'],_0x44de5c['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x3c6a8e,_0x469d03)=>{this['_removeFromContext'](_0x469d03);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x4b3297,_0x381018)=>{this['activeConversation']?.['loadSourceResources'](_0x381018['sourceId'],_0x381018['query'],_0x381018['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x258f95,_0x25fe71)=>{this['activeConversation']?.['setModel'](_0x25fe71);}),this['listenTo'](this['_aiChatUi'],'like',(_0x1dc235,{replyId:_0x574d16})=>{console['log']('Liked\x20response',_0x574d16);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x1280cf,{replyId:_0x116b89})=>{console['log']('Disliked\x20response',_0x116b89);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x1e5060,_0x118df3)=>{this['_insertSuggestion'](_0x118df3);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x25982c,{replyId:_0x6d8997,partIndex:_0x228740})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x6d8997,_0x228740);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x4cc945,{replyId:_0x2380d2,partIndex:_0x21889f})=>{const _0x27ae41=this['_getDocumentRangeForReplyChanges'](_0x2380d2,_0x21889f);if(!_0x27ae41)return;const {reply:_0x39dd61}=this['getInteractionAndReplyById'](_0x2380d2);'$graveyard'!=_0x27ae41['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x39dd61['changeGroups'][_0x21889f]['editor'],'ranges':[_0x27ae41['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x2639a2,_0x513f1c)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x513f1c);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x4643bb,{replyId:_0x55d64e,showDiff:_0x25f132})=>{const {interaction:_0x3561ae,reply:_0x5e303b}=this['getInteractionAndReplyById'](_0x55d64e),_0x2dea6a=_0x5e303b['getContentParts']({'showDiff':_0x25f132});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x3561ae['id']+':'+_0x5e303b['id'],'parts':_0x2dea6a});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x172c27,{replyId:_0x1f7cbb,partIndex:_0x1139bb})=>{this['_rejectSuggestion']({'replyId':_0x1f7cbb,'partIndex':_0x1139bb}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x1d61b7,_0x3ce13f)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x3ce13f);}),this['on']('replyCreated',(_0xdadfc8,_0x136416)=>{this['_addFeedItemReply'](_0x136416);});}afterInit(){this['context']instanceof _0x5c73d5?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x4ba359,_0x390225)=>{_0x390225['on']('ready',()=>{this['_integrateEditor'](_0x390225);});}),this['context']['config']['get']('ai.chat.context')?.['contextLibrary']?.['enabled']&&this['_setUpContextLibrarySource'](),this['_initConversation']();}async _initConversation(){const _0xe3cb7=this['context']['config']['get']('ai.chat.initialConversation');let _0x554c45=_0xe3cb7;('lastCreated'!=_0xe3cb7||(_0x554c45=await this['_getLastCreatedConversationId'](),_0x554c45))&&('new'==_0x554c45?await this['_startConversationSafely']():await this['loadConversation'](_0x554c45));}async destroy(){return this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async loadConversation(_0xcbd4a9){this['_closeActiveBalloon'](),this['context']['plugins']['get'](Is)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['_detachFromActiveConversation'](),this['_stopLastInteraction'](),this['_aiChatUi']['toggleConversationLoading'](!0x0);try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0xcbd4a9)['getConversation'](),await this['_startConversationSafely']({'id':_0xcbd4a9}),await this['activeConversation']['load'](_0xcbd4a9),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext'](),this['set']('isConversationReady',!0x0),this['activeConversation']?.['currentInteraction']?this['_aiChatUi']['enableControls']():this['_aiChatUi']['toggleConversationLoading'](!0x1);}catch(_0x1c6f1d){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0xcbd4a9}),this['_reporter']['logError'](new ct('ai-chat-conversation-not-found',this,void 0x0,_0x1c6f1d),{'context':{'operation':'load-conversation'}}),await this['_stopLastInteraction'](),this['_aiChatUi']['disableControls'](),this['set']('isConversationReady',!0x1),this['_aiChatUi']['resetChatBusyStateToIdle'](),this['activeConversation']?.['cancelLastInteractionStream']();}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}registerToolDataCallback(_0x30ecc5){let _0x4b3846=null,_0x2d16f4=null;this['on']('toolDataReceived',(_0x1d1b66,_0xe0f4c6,_0x17a9aa)=>{_0x17a9aa['id']!==_0x4b3846&&(_0x4b3846=_0x17a9aa['id'],_0x2d16f4=this['_getAIChatFeedAPI'](_0x17a9aa)),_0x30ecc5(_0xe0f4c6,_0x2d16f4);});}addCurrentDocumentToChatContext(){Rs(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Ts(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async addSelectionToChatContext(_0x243de2){const _0x2dfa5c=this['_aiEditing']['getSelectionText'](_0x243de2);this['activeConversation']?.['addSelectionToContext'](_0x2dfa5c),this['addCurrentDocumentToChatContext']();}removeSelectionFromChatContext(){this['activeConversation']?.['removeSelectionFromContext']();}focusPromptInput(){this['_aiChatUi']['focusPromptInput']();}async startConversation(_0x124f07){await this['_startConversationSafely']({'modelId':_0x124f07?.['modelId'],'contexts':_0x124f07?.['contexts']});}async['sendMessage']({message:_0x2af537,attributes:_0x262bfa}){if(!this['activeConversation'])throw new ct('ai-chat-controller-no-active-conversation');this['activeConversation']['id']&&this['activeConversation']['isStarted']&&(this['_aiChatUi']['startInteraction'](),await this['activeConversation']['handleUserInteraction']({'userMessage':_0x2af537,'attributes':_0x262bfa}));}getGroupId(){const _0x29e5cb=this['context']['config']['get']('collaboration.channelId');if(!_0x29e5cb)throw new ct('ai-missing-channel-id',this);return _0x29e5cb;}_handleRemovedConversation(_0x2b6af1){this['activeConversation']['id']===_0x2b6af1&&this['_startConversationSafely']();}['_isGroupReadOnly'](_0x43c9c3){return!(!_0x43c9c3['editor']||'destroyed'===_0x43c9c3['editor']['state']||!_0x43c9c3['editor']['isReadOnly']);}_isGroupWriteable(_0x34cb29){return!(!_0x34cb29['editor']||'destroyed'===_0x34cb29['editor']['state']||_0x34cb29['editor']['isReadOnly']);}_computeSuggestionGating(_0x54243d){const _0x328e36=new Map();for(const _0x8ff2a5 of _0x54243d['changeGroups'])_0x328e36['set'](_0x8ff2a5['index'],this['_isGroupReadOnly'](_0x8ff2a5));const _0x9ca39f=new Set(_0x54243d['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']})['filter'](_0x585016=>_0x585016['hasChanges'])['map'](_0x20f34f=>_0x20f34f['index']));return{'readOnlyByIndex':_0x328e36,'isAcceptAllEnabled':_0x54243d['changeGroups']['some'](_0x140d15=>'pending'===_0x140d15['state']&&this['_isGroupWriteable'](_0x140d15)&&_0x9ca39f['has'](_0x140d15['index']))};}_refreshSuggestionGating(){if(this['activeConversation']){for(const _0x1b80cd of this['activeConversation']['interactions'])for(const _0x33bbf0 of _0x1b80cd['replies'])'modification'===_0x33bbf0['type']&&this['_aiChatUi']['hasFeedItem'](_0x33bbf0['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x33bbf0['id'],this['_computeSuggestionGating'](_0x33bbf0));}if(this['_activeBalloon']&&this['_currentPreviewedChangeGroup']){const {reply:_0x499378}=this['getInteractionAndReplyById'](this['_currentPreviewedChangeGroup']['replyId']),_0x37f42d=_0x499378['changeGroups']['find'](_0x5d8702=>_0x5d8702['index']===this['_currentPreviewedChangeGroup']['partIndex']);_0x37f42d&&this['_activeBalloon']['setTargetReadOnly'](this['_isGroupReadOnly'](_0x37f42d));}}_prepareDocumentSuggestions(_0x2139ec){const {reply:_0x28c6ca,interaction:_0x34c15c}=this['getInteractionAndReplyById'](_0x2139ec['replyId']),_0x3b7b46=void 0x0!==_0x2139ec['partIndex']?[_0x28c6ca['changeGroups'][_0x2139ec['partIndex']]]:_0x28c6ca['changeGroups']['filter'](_0x543904=>'pending'===_0x543904['state']&&!this['_isGroupReadOnly'](_0x543904)),_0x2934f9=_0x3b7b46['map'](_0x9e647c=>_0x28c6ca['changeGroups']['indexOf'](_0x9e647c)),_0x48b66f=Xs(_0x28c6ca['changeGroups'],_0x28c6ca['documentContextContent']);return _0x2934f9['forEach'](_0x56d32c=>{if(_0x48b66f['has'](_0x56d32c))return;const _0x3373af=this['_getDocumentRangeForReplyChanges'](_0x2139ec['replyId'],_0x56d32c);_0x3373af&&'$graveyard'!=_0x3373af['range']['root']['rootName']?(_0x28c6ca['setChangeGroupState'](_0x56d32c,'accepted'),void 0x0!==_0x2139ec['partIndex']&&this['_scrollToSuggestionRange'](_0x3373af['range'],!0x1,_0x3373af['targetEditor'])):_0x28c6ca['setChangeGroupState'](_0x56d32c,'outdated',this['_getOutdatedReason'](_0x28c6ca['changeGroups'][_0x56d32c]));}),er({'groups':_0x3b7b46['filter'](_0x4baa9c=>'accepted'===_0x4baa9c['state']),'documentContextContent':_0x28c6ca['documentContextContent'],'documents':_0x34c15c['getDocumentContext']()?.['documents']??[]});}_insertSuggestion(_0x421cbd){const _0x33895a=this['context']['plugins']['get'](_0x4eecd6),{reply:_0x5935d2,interaction:_0x3ddafa}=this['getInteractionAndReplyById'](_0x421cbd['replyId']),_0x232e14=this['_prepareDocumentSuggestions'](_0x421cbd),_0x55d1e5=tr({'documentSuggestions':_0x232e14,'transform':!0x0,'documentCompare':_0x33895a,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x1e4054,_0x4530b2]of _0x55d1e5){const {editor:_0x37d996,indexes:_0x1cd0cc}=_0x232e14['get'](_0x1e4054);if(!_0x37d996['plugins']['has']('TrackChanges')){Ot('ai-no-track-changes',{'editor':_0x37d996});continue;}let _0x3932fc;wn(_0x4530b2,'chat'),_0x37d996['model']['change'](_0x1289e1=>{_0x3932fc=_0x1289e1['batch'],_0x37d996['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x4530b2),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x3932fc,{'interactionId':_0x3ddafa['id'],'replyId':_0x5935d2['id'],'indexes':_0x1cd0cc});}this['_updateRatings'](_0x5935d2);}_applySuggestion(_0x577c7b){const _0x51aac1=this['context']['plugins']['get'](_0x4eecd6),{reply:_0x43d7cb,interaction:_0xa32602}=this['getInteractionAndReplyById'](_0x577c7b['replyId']),_0x34afa2=this['_prepareDocumentSuggestions'](_0x577c7b),_0x1b5c9=tr({'documentSuggestions':_0x34afa2,'transform':!0x0,'documentCompare':_0x51aac1,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x4dd352,_0x294f28]of _0x1b5c9){const {editor:_0x4167e0,indexes:_0x571989}=_0x34afa2['get'](_0x4dd352);let _0x1e8a5f;wn(_0x294f28,'chat');try{_0x4167e0['model']['change'](_0x1e0202=>{_0x1e8a5f=_0x1e0202['batch'],_0x51aac1['applyOperations'](_0x1e0202,_0x294f28);}),this['_batchToChanges']['set'](_0x1e8a5f,{'interactionId':_0xa32602['id'],'replyId':_0x43d7cb['id'],'indexes':_0x571989});}catch(_0x733d65){throw this['_reporter']['logError'](new xn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x733d65})),_0x733d65;}}this['_updateRatings'](_0x43d7cb);}_rejectSuggestion(_0xacf717){const {reply:_0x24a1c8}=this['getInteractionAndReplyById'](_0xacf717['replyId']);_0x24a1c8['setChangeGroupState'](_0xacf717['partIndex'],'rejected');}['_openBalloonFor'](_0x184665,_0x5068ee){if(!this['_hasAIChatBalloon'])return;const {reply:_0x19f5ec}=this['getInteractionAndReplyById'](_0x184665),_0x5dd2e7=_0x19f5ec['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x5dd2e7['length'])return;let _0x3533fe,_0x961137;if(void 0x0!==_0x5068ee?(_0x961137=_0x5dd2e7['find'](_0xeec08f=>_0xeec08f['index']==_0x5068ee),_0x3533fe=_0x961137?.['index']):(_0x961137=_0x5dd2e7[0x0],_0x3533fe=_0x961137['index']),!_0x961137)return void _0x19f5ec['setChangeGroupState'](_0x5068ee??0x0,'outdated','editor-removed');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x184665&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x3533fe)return;const _0x443eb9=this['_getUserPresentableContentPartDocumentRange'](_0x184665,_0x19f5ec,_0x961137),_0x1817c4=_0x19f5ec['changeGroups']['find'](_0x54d094=>_0x54d094['index']==_0x3533fe),_0x346d0c=_0x1817c4['editor'],_0x2b31ea=_0x346d0c['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x2b31ea&&this['_activeBalloon']['close'](),!_0x443eb9)return _0x2b31ea['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x2b31ea,this['_currentPreviewedChangeGroup']={'replyId':_0x184665,'partIndex':_0x3533fe},this['_scrollToSuggestionRange'](_0x443eb9,!0x0,_0x346d0c);const _0x34af32=this['_getPresentableSiblingContentPartIndex'](_0x184665,_0x3533fe,'next');_0x2b31ea['clearContent'](),_0x2b31ea['updateContent']({'part':_0x961137,'renderingStrategy':'static'}),_0x2b31ea['open']({'index':_0x3533fe,'title':Ts(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x3533fe+0x1)['toString']()),'showRotator':null!==_0x34af32,'ranges':[_0x443eb9],'areActionsDisabled':_0x19f5ec['areActionsDisabled'],'targetEditor':_0x346d0c,'isTargetReadOnly':this['_isGroupReadOnly'](_0x1817c4)}),_0x2b31ea['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x184665,_0x3533fe),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x184665,'index':_0x3533fe,'isActive':!0x0});}_closeActiveBalloon(){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}_getPresentableSiblingContentPartIndex(_0x17af53,_0x191e2b,_0xdb1136){const {reply:_0x249030}=this['getInteractionAndReplyById'](_0x17af53),_0x22681b=_0x249030['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x22681b['length'])return null;const _0x23c0a3='next'==_0xdb1136?0x1:-0x1;function _0x3b980c(_0x463ff9){const _0x1a2ef4=(_0x463ff9+_0x23c0a3+_0x22681b['length'])%_0x22681b['length'];return{'siblingIndex':_0x1a2ef4,'siblingPart':_0x22681b[_0x1a2ef4]};}const _0x5daf31=_0x22681b['findIndex'](_0xbab59f=>_0xbab59f['index']==_0x191e2b);let {siblingIndex:_0x1fd43e,siblingPart:_0x180fc1}=_0x3b980c(_0x5daf31);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x17af53,_0x249030,_0x180fc1);)if({siblingIndex:_0x1fd43e,siblingPart:_0x180fc1}=_0x3b980c(_0x1fd43e),_0x1fd43e===_0x5daf31)return null;return _0x180fc1['index'];}_getOutdatedReason(_0x178ef4){return _0x178ef4?.['editor']&&'destroyed'!==_0x178ef4['editor']['state']?'content-removed':'editor-removed';}_getUserPresentableContentPartDocumentRange(_0x59492e,_0x314417,_0x5a85c5){const _0x5386de=_0x314417['changeGroups'];if(!_0x5a85c5['hasChanges'])return null;const _0x3a8fa2=_0x5386de['find'](_0x27f8c7=>_0x27f8c7['index']==_0x5a85c5['index']);if('pending'!==_0x3a8fa2?.['state'])return null;if(!_0x3a8fa2?.['editor']||'destroyed'===_0x3a8fa2['editor']['state'])return _0x314417['setChangeGroupState'](_0x5a85c5['index'],'outdated',this['_getOutdatedReason'](_0x3a8fa2)),null;const _0x227c24=this['_getDocumentRangeForReplyChanges'](_0x59492e,_0x5a85c5['index']);if(!_0x227c24)return _0x314417['setChangeGroupState'](_0x5a85c5['index'],'outdated',this['_getOutdatedReason'](_0x3a8fa2)),null;const {range:_0x4ac807,currentIndex:_0x4f989b}=_0x227c24;return'$graveyard'==_0x4ac807['root']['rootName']?(_0x314417['setChangeGroupState'](_0x4f989b,'outdated',this['_getOutdatedReason'](_0x3a8fa2)),null):_0x227c24['range'];}_getDocumentRangeForReplyChanges(_0x4af8c6,_0x2e4064){const {reply:_0x3f05af,interaction:_0x38eaec}=this['getInteractionAndReplyById'](_0x4af8c6),_0x4fcc22=_0x3f05af['changeGroups']['filter'](_0x1d189e=>'pending'==_0x1d189e['state']),_0x53346b=_0x4fcc22['map'](_0xa97b83=>_0x3f05af['changeGroups']['indexOf'](_0xa97b83));void 0x0===_0x2e4064&&(_0x2e4064=_0x53346b[0x0]);const _0x35836c=_0x53346b['indexOf'](_0x2e4064);if(-0x1==_0x35836c)return null;const _0x5e3fa6=_0x4fcc22[_0x35836c],_0x382ccd=_0x5e3fa6['editor'];if(!_0x382ccd||'destroyed'===_0x382ccd['state'])return null;const _0x2e6292=Ks(_0x382ccd,_0x5e3fa6['rootName']),_0x32a58a=_0x3f05af['documentContextContent']['get'](_0x5e3fa6['documentId']),_0x5367ea=new _0x59229a([]),_0x3716f7=new _0x59229a([]);for(const _0x1c7483 of _0x5e3fa6['changes'])if('removed'!=_0x1c7483['type']&&_0x3716f7['children']['push'](_0x1c7483['node']['cloneNode'](!0x0)),'new'!=_0x1c7483['type']){const _0x5d26f9=_0x11f9ef(_0x54cdf4=>Hs(_0x54cdf4,'data-id')==_0x1c7483['id'],_0x32a58a,!0x0);_0x5367ea['children']['push'](_0x5d26f9['cloneNode'](!0x0));}if(0x0==_0x5367ea['children']['length']){if(_0x5e3fa6['changes'][0x0]['anchorId']){const _0x61e4f5=ys('data-id',_0x5e3fa6['changes'][0x0]['anchorId'],_0x32a58a);_0x5367ea['children']['unshift'](_0x61e4f5['cloneNode'](!0x0)),_0x3716f7['children']['unshift'](_0x61e4f5['cloneNode'](!0x0)),_0x61e4f5['nextSibling']&&(_0x5367ea['children']['push'](_0x61e4f5['nextSibling']['cloneNode'](!0x0)),_0x3716f7['children']['push'](_0x61e4f5['nextSibling']['cloneNode'](!0x0)));}else{const _0x1b15d6=_0x32a58a['children'][0x0];if(!_0x1b15d6)return null;_0x5367ea['children']['push'](_0x1b15d6['cloneNode'](!0x0)),_0x3716f7['children']['push'](_0x1b15d6['cloneNode'](!0x0));}}if(_0x2e6292&&Xs(_0x3f05af['changeGroups'],_0x3f05af['documentContextContent'])['has'](_0x5e3fa6['index']))return null;const _0x10083e=_0x38eaec['getDocumentContext'](),_0x1d4767=_0x10083e['documents']['find'](_0x35e2a8=>_0x35e2a8['id']==_0x5e3fa6['documentId'])['content'],_0x4ea840=_0x382ccd['model']['document']['getRoot'](_0x5e3fa6['rootName']),_0xdad542=_0x382ccd['data']['parse'](_0x1d4767,_0x4ea840),_0x43f7f9=_0x2e6292?$s(ks(_0x5367ea)):ks(_0x5367ea),_0x25ae01=_0x382ccd['data']['parse'](_0x43f7f9,_0x4ea840),_0x24df2e=_0x382ccd['data']['parse'](_0x43f7f9,_0x4ea840),_0x713166=_0x382ccd['model']['createPositionAt'](_0x25ae01,0x0),_0x51b2db=_0x2e6292?$s(ks(_0x3716f7)):ks(_0x3716f7),_0x5c0624={'targetEditor':_0x382ccd,'anchor':_0x713166,'markDeletions':!0x1};let _0x1a1403;try{_0x1a1403=_0x382ccd['plugins']['get'](_0x4eecd6)['getDiff'](_0x43f7f9,_0x51b2db,_0x5c0624)['getOperations']();}catch(_0x5017b9){return this['_reporter']['reportError'](new xn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x5017b9,'context':{'replyId':_0x4af8c6,'partIndex':_0x2e4064}})),null;}if(!_0x1a1403['length'])return null;_0x382ccd['model']['change'](_0x33340f=>{for(const _0x49a45e of _0x1a1403)if(!_0xb8d6ce(_0x49a45e)){if('remove'==_0x49a45e['type']){const _0x364760=_0x49a45e['sourcePosition'],_0x9ae704=_0x49a45e['howMany'],_0x520590=new _0x4374a5(_0x364760,_0x9ae704);_0x33340f['batch']['addOperation'](_0x520590),_0x382ccd['model']['applyOperation'](_0x520590);}else'marker'!==_0x49a45e['type']&&(_0x49a45e['baseVersion']=null,_0x49a45e['isDocumentOperation']=!0x1,_0x33340f['batch']['addOperation'](_0x49a45e),_0x382ccd['model']['applyOperation'](_0x49a45e));}});const _0x2313ab=An(_0x382ccd,_0x1a1403,_0x25ae01);pn(_0x382ccd['model'],_0x2313ab);const _0x17f2be=_0x2313ab['getFirstRange']()['start']['path']['slice'](),_0x29c588=_0x2313ab['getFirstRange']()['end']['path']['slice'](),_0x3a94a7=[];let _0x55d458=_0x25ae01,_0x4b1d35=_0x24df2e;for(let _0x8dbfe4=0x0;_0x8dbfe4<_0x29c588['length'];_0x8dbfe4++){const _0x513166=_0x55d458['maxOffset']-_0x29c588[_0x8dbfe4];_0x3a94a7[_0x8dbfe4]=_0x4b1d35['maxOffset']-_0x513166,_0x55d458=_0x55d458['getChildAtOffset'](_0x29c588[_0x8dbfe4]),_0x4b1d35=_0x4b1d35['getChildAtOffset'](_0x3a94a7[_0x8dbfe4]);}const _0x2ce293=_0x382ccd['model']['createRange'](_0x382ccd['model']['createPositionFromPath'](_0x24df2e,_0x17f2be),_0x382ccd['model']['createPositionFromPath'](_0x24df2e,_0x3a94a7)),_0x33c62c=_0x2ce293['start']['path']['slice'](),_0x38b05f=_0x2ce293['end']['path']['slice']();if(!_0x2e6292){const _0x1b21d0=_0x24df2e['getChild'](0x0)['getAttribute'](_0x4eb302),_0x4042e5=Array['from'](_0xdad542['getChildren']())['find'](_0x2a50bc=>_0x2a50bc['getAttribute'](_0x4eb302)==_0x1b21d0)['getPath']();_0x33c62c[0x0]=_0x4042e5[0x0]+_0x33c62c[0x0],_0x38b05f[0x0]=_0x4042e5[0x0]+_0x38b05f[0x0];}let _0x41ed92=_0x382ccd['model']['createRange'](_0x382ccd['model']['createPositionFromPath'](_0x382ccd['model']['document']['getRoot'](_0x5e3fa6['rootName']),_0x33c62c),_0x382ccd['model']['createPositionFromPath'](_0x382ccd['model']['document']['getRoot'](_0x5e3fa6['rootName']),_0x38b05f));const _0x490cf7=_0x10083e['documents']['find'](_0x1ebe60=>_0x1ebe60['id']==_0x5e3fa6['documentId'])['version'],_0x55b8e2=_0x382ccd['model']['document']['history']['getOperations'](_0x490cf7);for(const _0x1ef33d of _0x55b8e2)_0x41ed92=_0x2be128['_createFromRanges'](_0x41ed92['getTransformedByOperation'](_0x1ef33d));return{'range':_0x41ed92,'currentIndex':_0x2e4064,'targetEditor':_0x382ccd};}_integrateEditorBalloon(_0x35dbe5){if(!_0x35dbe5['plugins']['has']('AIChatBalloon'))return;const _0x38c7b6=_0x35dbe5['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x38c7b6['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x38c7b6,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x240856,partIndex:_0x81121f}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x30706a}=this['getInteractionAndReplyById'](_0x240856),_0x5a28df=_0x30706a['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x81121f});_0x38c7b6['updateContent']({'part':_0x5a28df[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x38c7b6,'applySuggestion',()=>{const {replyId:_0x12fad1,partIndex:_0x604e63}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x12fad1,'partIndex':_0x604e63}),_0x38c7b6['setState']('accepted');}),this['listenTo'](_0x38c7b6,'insertSuggestion',()=>{const {replyId:_0xf28cd,partIndex:_0x4c841a}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0xf28cd,'partIndex':_0x4c841a}),_0x38c7b6['setState']('accepted');}),this['listenTo'](_0x38c7b6,'rejectSuggestion',()=>{const {replyId:_0x526ccf,partIndex:_0x1aa1ee}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x526ccf,'partIndex':_0x1aa1ee}),_0x38c7b6['setState']('rejected');}),this['listenTo'](_0x38c7b6,'showNext',()=>{const {replyId:_0x42d99e,partIndex:_0x1cd1a1}=this['_currentPreviewedChangeGroup'],_0xa90b62=this['_getPresentableSiblingContentPartIndex'](_0x42d99e,_0x1cd1a1,'next');null!==_0xa90b62&&this['_openBalloonFor'](_0x42d99e,_0xa90b62);}),this['listenTo'](_0x38c7b6,'showPrevious',()=>{const {replyId:_0x5bf6de,partIndex:_0x280c52}=this['_currentPreviewedChangeGroup'],_0x47befe=this['_getPresentableSiblingContentPartIndex'](_0x5bf6de,_0x280c52,'previous');null!==_0x47befe&&this['_openBalloonFor'](_0x5bf6de,_0x47befe);}),this['listenTo'](_0x38c7b6,'dialogClosed',(_0x444f82,{id:_0x1e4221})=>{if('aiChatBalloon'!==_0x1e4221)return;const {replyId:_0x20e790,partIndex:_0xf283a5}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x20e790,'index':_0xf283a5,'isActive':!0x1}),this['_activeBalloon']===_0x38c7b6&&(this['_activeBalloon']=void 0x0);});}_integrateEditor(_0x6ba925){if(this['_channelsToEditors']['set'](_0x6ba925['config']['get']('collaboration.channelId'),_0x6ba925),this['_integrateEditorBalloon'](_0x6ba925),this['addCurrentDocumentToChatContext'](),this['listenTo'](_0x6ba925,'change:isReadOnly',()=>this['_refreshSuggestionGating']()),_0x6ba925['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x6ba925['plugins']['has']('Undo')){const _0x199976=_0x6ba925['commands']['get']('undo'),_0x488ed0=_0x6ba925['commands']['get']('redo');this['listenTo'](_0x199976,'revert',(_0x21987a,_0x127b5d,_0x29f5a0)=>{const _0x27584c=this['_batchToChanges']['get'](_0x127b5d);if(!_0x27584c)return;const _0x22cb9f=this['activeConversation']['getInteraction'](_0x27584c['interactionId']),_0x51f394=_0x22cb9f?.['getReply'](_0x27584c['replyId']);this['_batchToChanges']['delete'](_0x127b5d),_0x22cb9f&&_0x51f394&&(_0x27584c['indexes']['forEach'](_0x2e69a1=>_0x51f394['setChangeGroupState'](_0x2e69a1,'pending')),this['_batchToChanges']['set'](_0x29f5a0,_0x27584c));}),this['listenTo'](_0x488ed0,'revert',(_0x5996d8,_0x3e3197,_0x4e0999)=>{const _0x2efb0f=this['_batchToChanges']['get'](_0x3e3197);if(!_0x2efb0f)return;const _0x5c4364=this['activeConversation']['getInteraction'](_0x2efb0f['interactionId']),_0x40809c=_0x5c4364?.['getReply'](_0x2efb0f['replyId']);this['_batchToChanges']['delete'](_0x3e3197),_0x5c4364&&_0x40809c&&(_0x2efb0f['indexes']['forEach'](_0x1fdaa4=>_0x40809c['setChangeGroupState'](_0x1fdaa4,'accepted')),this['_batchToChanges']['set'](_0x4e0999,_0x2efb0f));});}const _0x1df8ba=_0x6ba925['config']['get']('ai.chat.context');_0x1df8ba['alwaysAddSelection']&&_0x1df8ba['document']['enabled']&&this['listenTo'](_0x6ba925['model']['document']['selection'],'change:range',(_0x5d3d81,_0xb1be4d)=>{_0xb1be4d['directChange']&&'chat'===_0x6ba925['plugins']['get']('AITabs')['view']['activeTab']&&(_0x6ba925['model']['hasContent'](_0x6ba925['model']['document']['selection'])?this['addSelectionToChatContext'](_0x6ba925):this['removeSelectionFromChatContext']());});}async _getLastCreatedConversationId(){const _0x11fb1d=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x399ffb=await _0x11fb1d['getConversations']();return _0x399ffb['length']?_0x399ffb[0x0]['id']:'new';}catch(_0x103877){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':Nt()}),this['_reporter']['logError'](new ct('ai-chat-conversation-init-failed',this,{'error':_0x103877})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async _startConversationSafely(_0x5af262={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x5af262),_0x5af262['id']||this['set']('isConversationReady',!0x0);}catch(_0x1c06f4){this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x5af262['id']||Nt()}),this['_reporter']['logError'](_0x1c06f4),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}_detachFromActiveConversation(){this['_aiChatUi']['setIsUploadInProgress'](!0x1),this['activeConversation']&&this['stopListening'](this['activeConversation']);}async _handleStartConversation({id:_0x3ae142,modelId:_0x3c2082,contexts:_0xbef3d7}={}){this['_detachFromActiveConversation'](),this['_closeActiveBalloon']();let _0x469043=_0x3c2082;_0x469043||(_0x3ae142||!this['activeConversation']?_0x469043=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x469043=this['activeConversation']['selectedModel']?.['id'])),this['_stopLastInteraction']();const _0x8cc05d=this['getGroupId'](),_0x578252=_0x3ae142||Nt(),_0x6f4b70=await this['_aiModels']['getAvailableModels']();let _0x48a041;this['activeConversation']=new Zn({'connector':this['_aiConnector'],'chatModels':this['_aiModels'],'selectedModelId':_0x469043,'conversationId':_0x578252,'group':_0x8cc05d,'locale':this['context']['locale'],'isFromHistory':!!_0x3ae142,'channelsToEditors':this['_channelsToEditors'],'contextLibrary':this['_aiContextLibrary'],'extraContexts':_0xbef3d7,'getSessionId':_0x23afb2=>this['_aiEditing']['getSessionId'](_0x23afb2),'aiEditing':this['_aiEditing']}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',()=>{this['_aiChatUi']['createConversation']({'availableModels':_0x6f4b70}),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x3ae142||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x13e50b,_0x3cd3ae)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x3cd3ae['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x204af4=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x204af4);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x391f5d=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x391f5d);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x343f71,_0x38b55d)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x38b55d,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x2e2c05,_0x481c38)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x481c38,{'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',(_0xf738aa,_0x52fe55)=>{this['_aiChatUi']['removeFeedInteraction'](_0x52fe55['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x2bf073,_0xdbc758,_0x347923)=>{this['_updateConversationTitle'](_0xdbc758,_0x347923);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x356fd4,_0x34f570)=>{void 0x0!==_0x48a041&&_0x48a041!==_0x34f570['id']&&this['_updateReplyContentThrottled']['flush'](),_0x48a041=_0x34f570['id'],_0x34f570['isFromHistory']?await this['_updateReplyContent']({'reply':_0x34f570}):await this['_updateReplyContentThrottled']({'reply':_0x34f570});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x4f2a1d,{reply:_0x414604,index:_0x1dea56,state:_0x269118,outdatedReason:_0x4d9d2d})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x414604['id'],'index':_0x1dea56,'state':_0x269118,'outdatedReason':_0x4d9d2d}),this['_aiChatUi']['hasFeedItem'](_0x414604['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x414604['id'],this['_computeSuggestionGating'](_0x414604)),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x414604['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x1dea56&&this['_activeBalloon']?.['setState'](_0x269118,_0x4d9d2d);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x447302,_0x56b600)=>{if(this['_aiChatUi']['addContextItem'](_0x56b600['contextItem'],_0x56b600['isLoading']),'selection'===_0x56b600['contextItem']['type']){const _0x4a4bab=Os(this['context']),_0x481328=[..._0x4a4bab['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x4a4bab,'ranges':_0x481328,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x58b66e,_0x292566)=>{this['_aiChatUi']['removeContextItem'](_0x292566['uiId']),'current-document'==_0x292566['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x292566['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x3721ff,_0x36a987)=>{this['_aiChatUi']['setContextItemLoading'](_0x36a987['contextItem']['uiId'],_0x36a987['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x216e1b,_0x359f9f)=>{this['_aiChatUi']['setConversationContext'](_0x359f9f['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x42246a,_0x191820)=>{this['_aiChatUi']['setAddContextOptions'](_0x191820['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x3bee58,_0x2890d4)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x2890d4['sourceId'],_0x2890d4['source'],_0x2890d4['resources'],_0x2890d4['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x389aa1,_0xc18f94)=>{this['_aiChatUi']['updateResourceState'](_0xc18f94['sourceId'],_0xc18f94['resourceId'],_0xc18f94['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0xa8066c,_0x5af44c)=>{this['_aiChatUi']['updateCapabilities'](_0x5af44c);}),this['listenTo'](this['activeConversation'],'modelSelected',(_0xa489bf,_0x3067e8)=>{this['_aiChatUi']['setSelectedModel'](_0x3067e8['selectedModel']??null,_0x3067e8['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',async(_0x581a8d,{error:_0x3e90b8,interactionId:_0x574747,fileName:_0x491246,url:_0x4b780e,sourceId:_0x46ff8a,sourceLabel:_0x202e26})=>{let _0x556e48;const _0xca1599=_0x574747?_0x574747+':'+Nt():Nt();this['_reporter']['reportError'](_0x3e90b8),this['_aiChatUi']['startAutoScroll'](),_0x3e90b8['message']['startsWith']('ai-request-aborted')?(this['_cancelProcessing'](),this['activeConversation']?.['cancelLastInteractionStream'](),_0x556e48=this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Ts(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0xca1599})):_0x3e90b8['message']['startsWith']('ai-chat-conversation-init-failed')||_0x3e90b8['message']['startsWith']('ai-chat-conversation-start-failed')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-file-upload-failed')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x491246),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-url-upload-failed')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x4b780e),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-context-invalid-data')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-context-unsupported-type')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x46ff8a&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x46ff8a),_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x202e26||'source'),'id':_0xca1599})):_0x3e90b8['message']['startsWith']('ai-chat-resource-load-failed')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-invalid-request')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-context-unsupported-file-type')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-context-file-too-large')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-context-file-too-many-pages')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0xca1599}):_0x3e90b8['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0xca1599}):(this['_cancelProcessing'](),_0x556e48=this['_aiChatUi']['addFeedItemError']({'errorMessage':Ts(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0xca1599}));try{await Promise['race']([_0x556e48,this['_aiChatUi']['idleUiPromise']]);}finally{this['_aiChatUi']['isBusy']||this['_aiChatUi']['stopAutoScroll']();}}),await this['activeConversation']['init'](this['_buildConversationContextConfig']()),_0x3ae142||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']());}_buildConversationContextConfig(){const _0x3f524b=this['context']['config']['get']('ai.chat.context');return this['_contextLibrarySource']?{..._0x3f524b,'sources':[..._0x3f524b?.['sources']??[],this['_contextLibrarySource']]}:_0x3f524b;}async _setUpContextLibrarySource(){const _0x517eb6=await this['_createContextLibrarySource']();_0x517eb6&&(this['_contextLibrarySource']=_0x517eb6,this['activeConversation']&&this['activeConversation']['chatContext']['addContextSource'](_0x517eb6));}async _createContextLibrarySource(){let _0x4c2bdd;try{_0x4c2bdd=await this['_aiContextLibrary']['getAvailableContexts']();}catch{return null;}if(!_0x4c2bdd['length'])return null;const _0x1501b4=_0x4c2bdd['map'](_0x45fdff=>({'id':_0x45fdff['id'],'type':'context','label':_0x45fdff['name']||_0x45fdff['id']}));return{'id':'ck-ai-context-library','label':Ts(this['context']['locale'],'AI_CHAT_CONTEXT_LIBRARY_LABEL'),'useDefaultFiltering':!0x0,'getResources':()=>Promise['resolve'](_0x1501b4)};}_removeFromContext(_0x446a34){this['activeConversation']?.['removeFromContext'](_0x446a34);}_toggleWebSearch(){this['activeConversation']?.['toggleWebSearch']();}_toggleReasoning(){this['activeConversation']?.['toggleReasoning']();}getInteractionAndReplyById(_0x3bef71){const [_0x55eb19,_0x44fbbf]=_0x3bef71['split'](':'),_0xd53950=this['activeConversation']['getInteraction'](_0x55eb19);return{'interaction':_0xd53950,'reply':_0xd53950['getReply'](_0x44fbbf)};}_scrollToSuggestionRange(_0x27cf41,_0x32ba90=!0x1,_0x181a8d){const _0x58af67={'target':_0x181a8d['editing']['view']['domConverter']['viewRangeToDom'](_0x181a8d['editing']['mapper']['toViewRange'](_0x27cf41)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x32ba90};_0x32ba90&&(_0x58af67['alignToTop']=!0x0),kt(_0x58af67);}_updateConversationTitle(_0x3167ee,_0x2ef5c7=!0x1){this['_aiChatUi']['setConversationTitle'](_0x3167ee||Ts(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x2ef5c7);}_addFeedItemReply(_0x37e858){'text'===_0x37e858['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x37e858):this['_aiChatUi']['addFeedItemAISuggestion'](_0x37e858);}async _updateReplyContent({reply:_0x3a7bb2,renderingStrategy:_0x4a706d}){const {id:_0x48e3f5,interactionId:_0x7beda,isDone:_0x2ff738,type:_0x15dd5f,parsedContent:_0x4896f1}=_0x3a7bb2,_0x4add68=_0x7beda+':'+_0x48e3f5;if('modification'===_0x15dd5f){const _0x2ebe57=_0x3a7bb2['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x4add68,'parts':_0x2ebe57,'isDone':_0x2ff738,'skipLoadingEffects':_0x3a7bb2['isFromHistory']}),this['_aiChatUi']['hasFeedItem'](_0x3a7bb2['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x3a7bb2['id'],this['_computeSuggestionGating'](_0x3a7bb2));}else'text'===_0x15dd5f&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x4add68,'parsedContent':_0x4896f1['get']('text'),'renderingStrategy':_0x4a706d,'isDone':_0x2ff738});_0x2ff738&&_0x3a7bb2['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x4add68,_0x3a7bb2['sources']);}_updateReplyContentThrottled=_0x38ba6d(this['_updateReplyContent']['bind'](this),0xc8);_stopLastInteraction(){this['activeConversation']?.['stopProcessing'](),this['_aiChatUi']['stopInteraction'](this['activeConversation']?.['lastInteraction']),this['_updateReplyContentThrottled']['cancel']();}async _flushLastInteractionUI(){const _0x357a50=this['activeConversation']?.['lastInteraction'];if(_0x357a50){for await(const _0x5e1fa9 of _0x357a50['replies'])this['_aiChatUi']['hasFeedItem'](_0x5e1fa9['id'])||this['_addFeedItemReply'](_0x5e1fa9),await this['_updateReplyContent']({'reply':_0x5e1fa9,'renderingStrategy':'static'});}}async['_cancelProcessing'](){this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}_updateRatings(_0xce4abe){const _0xe2008d={'positiveCount':_0xce4abe['changeGroups']['filter'](_0x1fc0d5=>'accepted'===_0x1fc0d5['state'])['length'],'totalCount':_0xce4abe['changeGroups']['length'],'modificationId':_0xce4abe['id']},_0x5f411c=this['activeConversation']['getInteraction'](_0xce4abe['interactionId'])['messageId'];_0x5f411c&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x5f411c,_0xe2008d);}_getAIChatFeedAPI(_0x40ba1b){const _0x57229d=this['_aiChatUi'],_0x350f2b=()=>{_0x40ba1b['resetWebSearchState'](),_0x40ba1b['resetReasoningState'](),_0x57229d['clearLoadingMessage']();},_0x4b2874=()=>{_0x40ba1b['currentReply']&&(_0x40ba1b['currentReply']['done'](),_0x40ba1b['currentReply']=void 0x0);};return{'insertTextReply':(_0x1249a0,_0x5e1178)=>{_0x4b2874(),_0x350f2b();const _0x593aac=_0x40ba1b['currentReply']=_0x40ba1b['createReply']({'type':'text','interactionId':_0x40ba1b['id'],'id':_0x5e1178||Nt(),'channelsToEditors':this['_channelsToEditors']});return _0x593aac['appendContent'](_0x1249a0),_0x4b2874(),_0x593aac;},'insertCustomElement':async(_0xfd616,_0x3d0d9a)=>(_0x4b2874(),_0x350f2b(),_0x57229d['addFeedItemCustomElement'](_0xfd616,_0x3d0d9a||Nt())),'setLoadingMessage':_0x16e731=>{_0x57229d['setLoadingMessage'](_0x16e731);},'clearLoadingMessage':()=>{_0x57229d['clearLoadingMessage']();}};}_checkRemoveCurrentDocumentFromChatContext(){Rs(this['context'])['find'](_0x47a647=>'destroyed'!==_0x47a647['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const nr=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],rr=[...nr,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function or(_0x40f658){const _0x5b414d=new AbortController();return{'promise':new Promise((_0x569dec,_0x14151e)=>{const _0x59fa65=setTimeout(_0x569dec,_0x40f658);_0x5b414d['signal']['addEventListener']('abort',()=>{clearTimeout(_0x59fa65),_0x14151e();});}),'abortController':_0x5b414d};}var ar=class{options;isStreaming=!0x1;document=null;nodesList=[];currentIndex=0x0;timeoutAbortController=null;lastUpdateTime=0x0;constructor(_0x50cd02){this['options']={'delay':_0x50cd02?.['delay']??0xa,'textNodeStyle':_0x50cd02?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async stream({document:_0x2a714d,targetElement:_0x57746a,abortSignal:_0x189c76}){this['isStreaming']&&this['stop'](),_0x189c76?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x3717a9(_0x2a714d,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x5ced1f=0x0;_0x5ced1f<this['currentIndex'];_0x5ced1f++)this['nodesList'][_0x5ced1f]['shouldBeStreamed']=!0x0;do{const _0x3cd44d=Date['now'](),_0x4f068c=this['nodesList'][this['currentIndex']],_0x345e68=_0x3cd44d-this['lastUpdateTime'];if(_0x4f068c){_0x4f068c['shouldBeStreamed']=!0x0;let _0x5e857c=_0x4f068c['parent'];for(;_0x5e857c;)_0x5e857c['shouldBeStreamed']=!0x0,_0x5e857c=_0x5e857c['parent'];}if(_0x345e68<this['options']['delay'])try{const {promise:_0x11d116,abortController:_0x505830}=or(this['options']['delay']-_0x345e68);this['timeoutAbortController']=_0x505830,await _0x11d116;}catch(_0x5e367d){return;}_0x4b13e9(_0x57746a,'<'+_0x57746a['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x57746a['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:_0x4cb722}){Array['from'](_0x4cb722['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x197353=>{_0x197353['replaceWith'](_0x197353['childNodes'][0x0]);});}stop(){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x59490e){let _0x5559d5='';if(function(_0x4b916d){return _0x450ec6(_0x4b916d);}(_0x59490e)){for(const _0x148f5d of _0x59490e['children'])_0x5559d5+=this['renderNode'](_0x148f5d);}else{if(lr(_0x59490e)){if(!_0x59490e['shouldBeStreamed'])return'';const _0x9ae914=_0x59490e,_0x4d288c=Object['entries'](_0x9ae914['attribs'])['map'](([_0x4b54a5,_0x27f20f])=>_0x4b54a5+'=\x22'+_0x27f20f+'\x22')['join']('\x20');_0x5559d5+='<'+_0x9ae914['tagName']+(_0x4d288c?'\x20'+_0x4d288c:'')+'>';for(const _0x313e81 of _0x59f4e5(_0x9ae914))_0x5559d5+=this['renderNode'](_0x313e81);_0x5559d5+='</'+_0x9ae914['tagName']+'>';}else{if(!cr(_0x59490e))return'';if(!_0x59490e['shouldBeStreamed'])return'';!function(_0xc4771f){return!(!_0xc4771f['parent']||!lr(_0xc4771f['parent']))&&(!!hr['includes'](_0xc4771f['parent']['tagName'])&&!_0x317deb(_0xc4771f)['match'](/^\s*[<>]\s*$/));}(_0x59490e)?_0x5559d5+=_0x3395d0(_0x59490e):_0x5559d5+=_0x3395d0(new _0x484959('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x59490e]));}}return _0x5559d5;}getParsedDocumentNodeList(){const _0x7fd246=[];return function(_0x36a9da,_0x2901d7){const _0x50fb00=_0xe0fb0=>{if(_0x2901d7(_0xe0fb0),_0xe0fb0 instanceof _0x4a0076)for(let _0x4d8010=0x0;_0x4d8010<_0xe0fb0['children']['length'];_0x4d8010++){const _0x4f0db2=_0xe0fb0['children'][_0x4d8010];_0x50fb00(_0x4f0db2);}};for(let _0x13a453=0x0;_0x13a453<_0x36a9da['children']['length'];_0x13a453++)_0x50fb00(_0x36a9da['children'][_0x13a453]);}(this['document'],_0x9dd15a=>{if(cr(_0x9dd15a)){const _0x16e770=this['splitTextNodeIntoWordNodes'](_0x9dd15a);_0x16e770['length']&&_0x7fd246['push'](..._0x16e770);}_0x9dd15a['isWordSplitSource']||_0x9dd15a['isWordSplitResult']||_0x7fd246['push'](_0x9dd15a);}),_0x7fd246;}splitTextNodeIntoWordNodes(_0x2f2934){if(_0x2f2934['isWordSplitSource']||_0x2f2934['isWordSplitResult'])return[];const _0x5567d2=_0x317deb(_0x2f2934)['match'](/(?:\s*\S+\s*)/g),_0x10b16d=[];if(_0x5567d2&&_0x5567d2['length']>0x1){for(const _0x5ccd68 of _0x5567d2){const _0x5a2d73=new _0x1ced06(_0x5ccd68);_0x5a2d73['isWordSplitResult']=!0x0,_0x200678(_0x2f2934,_0x5a2d73),_0x10b16d['push'](_0x5a2d73);}_0x2f2934['isWordSplitSource']=!0x0,_0x147247(_0x2f2934);}return _0x10b16d;}};const hr=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function cr(_0x4d4095){return _0x3ed223(_0x4d4095);}function lr(_0x135110){return _0x3b00a1(_0x135110);}function ur(_0x3c319e,_0xd5b6c){_0x3c319e['cleanUpAnimations']({'targetElement':_0xd5b6c}),_0xd5b6c['querySelectorAll']('[data-id]')['forEach'](_0x55dd68=>{_0x55dd68['removeAttribute']('data-id');});}var dr=class extends _0x4f75f8{options;content='';htmlStreamer;['children'];constructor(_0x592e7a){super();const _0x1c1c6d=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new ar(),this['options']=_0x592e7a,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x1c1c6d['if']('isDone','ck-ai-chat__feed__item_done'),_0x1c1c6d['if']('isVisible','ck-hidden',_0x4693c8=>!_0x4693c8),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){ur(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async streamIntoElement(_0x24ea33,_0x5c9e73,_0x15275c){await this['htmlStreamer']['stream']({'document':_0x24ea33,'targetElement':_0x5c9e73,'abortSignal':_0x15275c});}},_r=class extends _0x4f75f8{['showChangesToggleView'];constructor(_0x38d982,_0x15663b){super(_0x38d982),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new gr(_0x38d982),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Mn,'label':Ts(_0x38d982,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x15663b['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x45a7f4=>_0x45a7f4?it:et),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x56a305=new Qt();_0x56a305['content']=_0x36b436,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x15663b['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x56a305,{'tag':'span','children':[Ts(_0x38d982,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},gr=class extends Vt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Ar={'accepted':_0x11611b,'rejected':_0x591646,'outdated':_0x431939};var Ir=class extends _0x4f75f8{statePillView;constructor(_0x1f382c){super(_0x1f382c);const _0x465e41=this['bindTemplate'];this['set']('state','accepted'),this['set']('outdatedReason',void 0x0),this['set']('isVisible',!0x0),this['statePillView']=new _0x5b131e(_0x1f382c),this['statePillView']['bind']('label')['to'](this,'state',_0x1bbea7=>function(_0x4af978,_0x285a59){return Ts(_0x4af978,'AI_SUGGESTION_CONTENT_PART_STATE_'+_0x285a59['toUpperCase']());}(_0x1f382c,_0x1bbea7)),this['statePillView']['bind']('icon')['to'](this,'state',_0xa5494=>Ar[_0xa5494]),this['statePillView']['bind']('class')['to'](this,'state',_0x5c3835=>'ck-pill_'+_0x5c3835),this['statePillView']['bind']('tooltip')['to'](this,'state',this,'outdatedReason',(_0x3a5c5b,_0x2d5a3b)=>function(_0x356dd6,_0x5aa1e6,_0x309b13){if('outdated'!==_0x5aa1e6)return;return Ts(_0x356dd6,_0x309b13?pr[_0x309b13]:'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP');}(_0x1f382c,_0x3a5c5b,_0x2d5a3b)),this['statePillView']['tooltipPosition']='s',this['statePillView']['tooltipClass']='ck-tooltip_multi-line',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x465e41['if']('isVisible','ck-hidden',_0x5760a8=>!_0x5760a8)]},'children':[this['statePillView']]});}setState(_0x56e2b9,_0xaeb55){this['state']=_0x56e2b9,this['outdatedReason']='outdated'===_0x56e2b9?_0xaeb55:void 0x0;}};const pr={'content-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','editor-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','session-changed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP'};var Er=class extends _0x4a1d9b{_applyButton;_suggestButton;constructor(_0x672a6e,_0x57e6fe,_0x3f0918){super(_0x672a6e);const _0x5111bd=Boolean(_0x3f0918);this['set']('isEnabled',!_0x5111bd),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x3e95f3=[];if(!_0x5111bd){_0x57e6fe['includes']('applySuggestion')&&(this['_applyButton']=new Vt(_0x672a6e),this['_applyButton']['set']({'label':Ts(_0x672a6e,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x46d8d6}),this['_applyButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x13ec1a,_0x53f3fc)=>_0x13ec1a&&!_0x53f3fc),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x5bb27d=>!_0x5bb27d),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x3e95f3['push'](this['_applyButton'])),_0x57e6fe['includes']('insertSuggestion')&&(this['_suggestButton']=new Vt(_0x672a6e),this['_suggestButton']['set']({'label':Ts(_0x672a6e,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x141a3c}),this['_suggestButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x5238fa,_0x3112e5)=>_0x5238fa&&!_0x3112e5),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x3e95f3['push'](this['_suggestButton']));const _0x3fea26=new Vt(_0x672a6e);_0x3fea26['set']({'label':Ts(_0x672a6e,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x5a5da8}),_0x3fea26['bind']('isEnabled')['to'](this),_0x3fea26['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x3e95f3['push'](_0x3fea26);}this['items']['addMany'](_0x3e95f3);const _0x166a20=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x166a20['if']('isVisible','ck-hidden',_0x27aa8f=>!_0x27aa8f)]}});}setButtonsVisibility({showApplyButton:_0x2f5bcd,showSuggestButton:_0x380033}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x2f5bcd),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x380033);}},mr=class extends _0x4f75f8{toolbarView;stateView;titleLabelView;['children'];constructor(_0x2ebb17,{part:_0x39320e,uiIndex:_0x243a8f,availableActions:_0x3902d6,areActionsDisabled:_0x3d21c2}){super(_0x2ebb17),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['toolbarView']=new Er(_0x2ebb17,_0x3902d6,_0x3d21c2),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x39320e['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x39320e['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x39320e['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn','isTargetReadOnly')['to'](this),this['stateView']=new Ir(_0x2ebb17),this['titleLabelView']=new Tr(_0x2ebb17,_0x243a8f),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',(_0x5391d7,_0xff649a,_0x28dede,_0x32b933)=>{'pending'===_0x32b933?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x28dede?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x28dede,this['outdatedReason']),this['children']['add'](this['stateView']));});}},Tr=class extends _0x4f75f8{constructor(_0x4e8250,_0x26179c){super(_0x4e8250),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Ts(_0x4e8250,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x26179c['toString']())]});}},wr=class extends _0x4f75f8{htmlStreamer;constructor(_0x5004d1){super(_0x5004d1),this['htmlStreamer']=new ar(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async update({part:_0x5d8c37,renderingStrategy:_0x3039aa,abortSignal:_0x101fc6}){this['_ensureHostElementTag'](_0x5d8c37['wrapperTag']||'div');const _0x12be52=_0x3717a9(_0x5d8c37['content'],!0x0);for(const _0x47e7c4 of xs(_0x12be52))_0x147247(_0x47e7c4);'streaming'===_0x3039aa?await this['htmlStreamer']['stream']({'document':_0x12be52,'targetElement':this['element'],'abortSignal':_0x101fc6}):_0x4b13e9(this['element'],'<'+this['element']['tagName']+'>'+ks(_0x12be52)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}cleanUpStreamingArtifacts(){ur(this['htmlStreamer'],this['element']);}_ensureHostElementTag(_0x540dd0){if(!this['element']||this['element']['tagName']['toLowerCase']()===_0x540dd0)return;const _0x52d6c3=new _0x120a21({'tag':_0x540dd0,'attributes':{'class':this['element']['className']}})['render']();this['element']['replaceWith'](_0x52d6c3),this['element']=_0x52d6c3;}},Cr=class extends _0x4f75f8{['_children'];['_headerView'];_streamableContentView;constructor(_0x4172f7,{part:_0x913161,uiIndex:_0x32945f,areActionsDisabled:_0x136013,availableActions:_0xfbc685}){super(_0x4172f7);const _0x43e247=this['bindTemplate'];this['set']('state',_0x913161['state']),this['set']('outdatedReason',_0x913161['outdatedReason']),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1);const _0x571cb6=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x136013;};this['on']('change:state',_0x571cb6),this['on']('change:isDone',_0x571cb6),_0x571cb6(),this['_children']=this['createCollection'](),this['_headerView']=new mr(_0x4172f7,{'part':_0x913161,'uiIndex':_0x32945f,'availableActions':_0xfbc685,'areActionsDisabled':_0x136013}),this['_headerView']['bind']('isEnabled','outdatedReason','state','isTrackChangesOn','isTargetReadOnly')['to'](this),this['_headerView']['delegate'](...nr)['to'](this),this['_streamableContentView']=new wr(_0x4172f7),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x43e247['to']('state',_0x4286a0=>'ck-ai-suggestion__body__content-part_'+_0x4286a0),_0x43e247['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x43e247['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x43e247['if']('isVisible','ck-hidden',_0x3dee3f=>!_0x3dee3f)]},'children':this['_children'],'on':{'mouseenter':_0x43e247['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x913161['index']});}),'mouseleave':_0x43e247['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x913161['index']});}),'click':_0x43e247['to'](_0x83b0dc=>{const _0x2dad0c=_0x83b0dc['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x2dad0c)&&this['fire']('showChangeInText',{'index':_0x913161['index']});})}});}async updateContent({part:_0x21d56b,showUnchangedParts:_0x2e9725=!0x1,abortSignal:_0x549bca}){this['partDefinition']=_0x21d56b,this['isVisible']=this['partDefinition']['hasChanges']||_0x2e9725,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x21d56b,'renderingStrategy':'static','abortSignal':_0x549bca});}['markAsDone'](){this['isDone']=!0x0;}},fr=class extends _0x4f75f8{constructor(_0x391c15,_0x589b24){super(_0x391c15),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x3ae3e3=>!_0x3ae3e3)]},'children':this['_createSkeletonItems'](_0x589b24)});}_createSkeletonItems(_0x30d1ea){const _0xb928ac=['ck','ck-ai-skeleton__item'];return _0x30d1ea['map'](_0x53af12=>{let _0x37b182='';switch(_0x53af12['attributes']['align']){case'right':_0x37b182='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x37b182='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x37b182='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x53af12['tag'],'attributes':{'class':[..._0xb928ac,_0x53af12['attributes']['class']?_0x53af12['attributes']['class']:''],'style':'width:\x20'+_0x53af12['attributes']['width']+';\x20height:\x20'+_0x53af12['attributes']['height']+';'+_0x37b182}};});}};const br={'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':Sr(0x5,'100%','44px','right'),'aiChatResources':Sr(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 Sr(_0x231337,_0x3c453e,_0x2a6650,_0x14c0c6){return new Array(_0x231337)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x3c453e,'height':_0x2a6650,'align':_0x14c0c6}}));}const Rr=/* #__PURE__ -- @preserve */
33
- dt();var Or=class extends Rr{['queue']=[];['isProcessing']=!0x1;_abortController;async['enqueue'](_0x4f578c){const _0x2ee57e=this['createTask'](_0x4f578c);return this['queue']['push'](_0x2ee57e),this['_processQueue'](),_0x2ee57e['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(_0x19cfe6=>{this['once']('_queueEmpty',()=>{_0x19cfe6();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x2b912c=this['queue']['shift']();try{await _0x2b912c['callback'](this['_abortController']['signal']),_0x2b912c['resolve']();}catch(_0x52289b){_0x2b912c['reject'](_0x52289b);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}createTask(_0x11200c){let _0x542d83,_0x59e54e;const _0xee0289=new Promise((_0x514395,_0x45b68f)=>{_0x542d83=_0x514395,_0x59e54e=_0x45b68f;});return{'callback':_0x11200c,'resolve':_0x542d83,'reject':_0x59e54e,'completePromise':_0xee0289};}},vr=class extends dr{constructor(_0x5aa30c){super(_0x5aa30c),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x5aa30c['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}setContent(_0x7d818f){this['element']['innerHTML']=_0x7d818f;}};const kr=['applySuggestion','insertSuggestion'];var yr=class extends _0x4f75f8{_applyChangesButton;_insertSuggestionsButton;['children'];constructor(_0x3e9c3f,_0x48293b=[...kr],_0x9d2b0c){super(_0x3e9c3f);const _0x59c2a8=this['bindTemplate'],_0x21a4d5=Boolean(_0x9d2b0c);this['set']('isEnabled',!_0x21a4d5),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x21a4d5||(this['_applyChangesButton']=new Vt(_0x3e9c3f),this['_applyChangesButton']['set']({'label':Ts(_0x3e9c3f,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x48293b['includes']('applySuggestion'),'class':Dn}),this['_insertSuggestionsButton']=new Vt(_0x3e9c3f),this['_insertSuggestionsButton']['set']({'label':Ts(_0x3e9c3f,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x48293b['includes']('insertSuggestion'),'class':Hn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x67c869=>{_0x67c869['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',_0x59c2a8['if']('isVisible','ck-hidden',_0x27c670=>!_0x27c670)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}updateVisibility(_0x403ec6){this['isVisible']=_0x403ec6;}_switchButtonLabelsPlurality(_0x34ff0b){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x34ff0b?(this['_applyChangesButton']['label']=Ts(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Ts(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Ts(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Ts(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},Nr=class extends _0x4f75f8{['children'];['balloonPanelView'];bodyCollection;constructor(_0x2a5cd9,_0xbad7d8){super(_0x2a5cd9),this['bodyCollection']=_0xbad7d8,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',_0x7439be=>!_0x7439be)]},'children':this['children']});const _0x40d608=new _0x4f75f8(this['locale']),_0x5c36a7=new Qt();_0x5c36a7['content']=ht,_0x40d608['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x5c36a7,{'tag':'span','children':[{'text':Ts(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x40d608),this['_setupBalloonPanel'](_0x2a5cd9);}['addSource'](_0x1e9006){this['children']['add'](new xr(this['locale'],_0x1e9006,this['balloonPanelView']));}_setupBalloonPanel(_0x11c004){this['balloonPanelView']=new Pt(_0x11c004),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},xr=class extends Vt{['balloonPanelView'];['source'];constructor(_0x5b55d8,_0x530f15,_0x44d909){super(_0x5b55d8),this['source']=_0x530f15,this['balloonPanelView']=_0x44d909,this['set']({'label':_0x530f15['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x38d8b2=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x38d8b2['to'](()=>{window['open'](_0x530f15['url'],'_blank');}),'mouseenter':_0x38d8b2['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x38d8b2['to'](()=>{this['_hideTooltip']();})}}),_0x530f15['favicon']){const _0x40033f=new _0x4f75f8(_0x5b55d8);_0x40033f['setTemplate']({'tag':'img','attributes':{'src':_0x530f15['favicon']||ht,'alt':_0x530f15['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x40033f);}else this['set']('icon',ht);}_createTooltipContentView(_0x4930c1,_0x3e7643){const _0x59e994=new _0x4f75f8(_0x4930c1),_0x82fae2=[];let _0x2787ea;_0x3e7643?.['favicon']?(_0x2787ea=new _0x4f75f8(_0x4930c1),_0x2787ea['setTemplate']({'tag':'img','attributes':{'src':_0x3e7643['favicon'],'alt':_0x3e7643['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x2787ea=new Qt(),_0x2787ea['content']=ht,_0x2787ea['extendTemplate']({'attributes':{'alt':_0x3e7643['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x82fae2['push'](_0x2787ea);const _0x4af261=new _0x4f75f8(_0x4930c1);_0x4af261['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x3e7643['url']},'children':[{'text':new URL(_0x3e7643['url'])?.['hostname']}]}),_0x82fae2['push'](_0x4af261);const _0xc0f887=new _0x4f75f8(_0x4930c1);_0xc0f887['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x82fae2});const _0x241170=new _0x4f75f8(_0x4930c1);return _0x241170['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x3e7643['title']['length']>0x190?_0x3e7643['title']['substring'](0x0,0x190)+'...':_0x3e7643['title']}]}),_0x59e994['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0xc0f887,_0x241170]}),_0x59e994;}_showTooltip(){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[Pt['defaultPositions']['northArrowSouth'],Pt['defaultPositions']['northArrowSouthWest'],Pt['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 _0x1003bc=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x1003bc);}},Lr=class extends _0x4f75f8{_actionsView;['_readOnlyByIndex']=new Map();['_sourcesView'];['_children'];_skeletonView;_showSkeletonDebounced=_0xce404c(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);_skeletonShownAt=null;_areActionsDisabled;_showUnchangedParts;_updateContentPartsPromiseQueue;_emptyPartsWarningView;_availableActions;_cachedContentParts=[];constructor(_0x21076e,_0x4f230a){super(_0x21076e);const {areActionsDisabled:_0x568ba1,showUnchangedParts:_0x34f147,availableActions:_0x5e0509}=_0x4f230a;this['_areActionsDisabled']=_0x568ba1,this['_showUnchangedParts']=_0x34f147,this['_availableActions']=_0x5e0509,this['set']('isTrackChangesOn',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new fr(_0x21076e,br['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Or(),this['_emptyPartsWarningView']=new vr({'id':'empty-parts-warning','initialContent':Ts(_0x21076e,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new yr(_0x21076e,_0x4f230a['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new Nr(this['locale'],_0x4f230a['bodyCollection']),_0x4f230a['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled'),this['_actionsView']['delegate'](...nr)['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'](_0x479206=>_0x479206 instanceof Cr);}async updateContentParts({parts:_0x494583,abortSignal:_0x19a82d,skipLoadingEffects:_0x311c58}){this['_cachedContentParts']['length']?_0x494583['forEach'](_0x169ba5=>{const _0x857899=this['_cachedContentParts']['findIndex'](_0x2a6871=>_0x2a6871['index']==_0x169ba5['index']);-0x1===_0x857899?this['_cachedContentParts']['push'](_0x169ba5):this['_cachedContentParts'][_0x857899]=_0x169ba5;}):this['_cachedContentParts']=_0x494583;const _0x3b54ed=this['_showUnchangedParts']?_0x494583:_0x494583['filter'](_0x148309=>_0x148309['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x3b54ed['length']>0x1),_0x311c58&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x2e83c9 of _0x494583)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x3d7b8c=>{let _0x4951c6=this['getPartView'](_0x2e83c9['index']);if(_0x4951c6||_0x2e83c9['hasChanges']||this['_showUnchangedParts']){if(!_0x4951c6){if(_0x4951c6=new Cr(this['locale'],{'part':_0x2e83c9,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x4951c6['delegate'](...nr)['to'](this),_0x4951c6['bind']('isTrackChangesOn')['to'](this),!_0x311c58&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x3d7b8c),_0x3d7b8c['aborted']))return;_0x4951c6['isTargetReadOnly']=this['_readOnlyByIndex']['get'](_0x2e83c9['index'])??!0x1,this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x4951c6,this['_children']['length']-0x1),_0x311c58||this['_showSkeletonDebounced']();}await _0x4951c6['updateContent']({'part':_0x2e83c9,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x3d7b8c}),_0x4951c6['markAsDone']();}});return _0x19a82d?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}updatePartState(_0x3422d6,_0x5bf545,_0x5dc7a2){const _0x11346b=this['getPartView'](_0x3422d6);_0x11346b&&(_0x11346b['outdatedReason']=_0x5dc7a2,_0x11346b['state']=_0x5bf545);}setGating({readOnlyByIndex:_0x349900,isAcceptAllEnabled:_0x52aba0}){this['_readOnlyByIndex']=_0x349900,this['isAcceptAllEnabled']=_0x52aba0;for(const _0x28642c of this['_contentPartViews'])_0x28642c['isTargetReadOnly']=_0x349900['get'](_0x28642c['partDefinition']['index'])??!0x1;}setPartActive(_0x3529b6,_0x1096fd){if(!0x1===_0x3529b6){for(const _0x11804b of this['_contentPartViews'])_0x11804b['isActive']=!0x1;}else{const _0x25aedc=this['getPartView'](_0x3529b6);_0x25aedc&&(_0x25aedc['isActive']=_0x1096fd);}}updateSources(_0x2cdac9){_0x2cdac9['forEach'](_0x3244c1=>this['_sourcesView']['addSource'](_0x3244c1)),this['_sourcesView']['isVisible']=!0x0;}getPartView(_0x5b59e4){return this['_contentPartViews']['find'](_0x1a4263=>_0x1a4263['partDefinition']['index']==_0x5b59e4)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x1471ad=!this['_cachedContentParts']['find'](({hasChanges:_0x3214fc})=>_0x3214fc),_0x29046f=!!this['_cachedContentParts']['find'](({hasChanges:_0x665c8f})=>!_0x665c8f);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x29046f,_0x1471ad?this['_emptyPartsWarningView']['setContent'](Ts(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Ts(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x20cde6=>_0x20cde6['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']&&!this['_areActionsDisabled']);}async _awaitMinimumSkeletonDisplayTime(_0x2432df){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x1f3d87=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x1f3d87>0x0){const {promise:_0x29a2f2,abortController:_0x11ae47}=or(_0x1f3d87);_0x2432df?.['addEventListener']('abort',()=>_0x11ae47['abort']()),await _0x29a2f2['catch'](()=>{});}}get hasNonEmptyParts(){return this['_contentPartViews']['filter'](_0x2d24c0=>_0x2d24c0['partDefinition']['hasChanges'])['length']>0x0;}},Pr=class extends _0x4f75f8{['bodyView'];['children'];['headerView'];constructor(_0x2c6943,_0x4d8639,_0xdab670){super(_0x2c6943);const {showDiff:_0xe78043,areActionsDisabled:_0x596bc7,showUnchangedParts:_0x3b9279,availableActions:_0x6721bb}=_0x4d8639;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new _r(_0x2c6943,{'showDiff':_0xe78043}),this['headerView']['on']('toggleShowChanges',(_0x34c86f,_0x218032)=>{this['areChangesVisible']=_0x218032['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x218032['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new Lr(_0x2c6943,{'areActionsDisabled':_0x596bc7,'showUnchangedParts':!!_0x3b9279,'availableActions':_0x6721bb,'bodyCollection':_0xdab670}),this['bodyView']['delegate'](...nr)['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(_0x3aecfc){await this['bodyView']['updateContentParts'](_0x3aecfc);}updateSources(_0x27b21c){this['bodyView']['updateSources'](_0x27b21c);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},Dr=class extends dr{containerView;constructor(_0x3697d6,_0x7ff33,_0x10aae7){super(_0x7ff33),this['set']('isTrackChangesOn',!0x1),this['containerView']=new Pr(_0x3697d6,{'showDiff':_0x7ff33['showDiff'],'areActionsDisabled':_0x7ff33['areActionsDisabled'],'availableActions':_0x7ff33['availableActions']},_0x10aae7),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x2cf759,_0x4716ff)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x4716ff['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',(_0x5d91f5,{index:_0x5727a9})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x5727a9});}),this['containerView']['on']('applySuggestion',(_0x4703f1,{index:_0x50402f}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x50402f});}),this['containerView']['on']('insertSuggestion',(_0x515b9e,{index:_0x1a51c1}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1a51c1});}),this['containerView']['on']('rejectSuggestion',(_0x3d686b,{index:_0x3fad6f})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3fad6f});}),this['containerView']['on']('mouseOverSuggestion',(_0x44d178,{index:_0x74bc12})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x74bc12});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x1beb97,{index:_0x9fcece})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x9fcece});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async updateContent(_0x709202){await this['containerView']['updateContent'](_0x709202);}updatePartState(_0x2d1c6b,_0xe0bc17,_0x162c76){this['containerView']['bodyView']['updatePartState'](_0x2d1c6b,_0xe0bc17,_0x162c76);}setPartActive(_0x3eb6b5,_0x5bba2f){!0x1===_0x3eb6b5?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x3eb6b5,_0x5bba2f);}updateSources(_0x3f0961){this['containerView']['updateSources'](_0x3f0961);}getPartView(_0x5bfe1a){return this['containerView']['bodyView']['getPartView'](_0x5bfe1a);}setGating(_0x5321cb){this['containerView']['bodyView']['setGating'](_0x5321cb);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},Hr=class extends dr{replyContainer;_bodyCollection;constructor(_0x645d30,_0x51470d,_0x14beb1){super(_0x51470d),this['_bodyCollection']=_0x14beb1,this['locale']=_0x645d30,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x4f75f8(),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':vs(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async updateContent({parsedContent:_0xf5b9a8,renderingStrategy:_0x2d6929,abortSignal:_0x2b10b5}){'streaming'===_0x2d6929?await this['streamIntoElement'](_0xf5b9a8,this['replyContainer']['element'],_0x2b10b5):this['replyContainer']['element']['innerHTML']=_0x3395d0(_0xf5b9a8);}updateSources(_0x5d1096){const _0x5e0b7a=new Nr(this['locale'],this['_bodyCollection']);_0x5e0b7a['children']['addMany'](_0x5d1096['map'](_0x2e2c5c=>new xr(this['locale'],_0x2e2c5c,_0x5e0b7a['balloonPanelView']))),_0x5e0b7a['isVisible']=!0x0,this['children']['add'](_0x5e0b7a);}},Mr=class extends _0x1224fa{constructor(_0x18d110=void 0x0){super();const _0x4553c0=_0x18d110?'ck-ai-spinner_'+_0x18d110:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x4553c0]}});}};const Ur={'file':_0x118543,'image':_0x3b675d,'document':_0x36b436,'web-resource':_0x305afd,'text':_0x118543,'selection':tt,'mcp-tool-context':_0x36b436,'context':_0x36b436},Vr='ck-ai-chat-context-chip',Br='ck-ai-chat-context-chip_wide',Gr='ck-ai-chat-context-chip_document',Fr='ck-ai-chat-context-chip__label',Kr='ck-ai-chat-context-chip__type-icon',Wr='ck-ai-chat-context-controls__chip-tooltip',Yr='n';var $r=class extends Vt{constructor(_0x4e4154,_0x27b6fd,_0x5265e3,_0x1d6e1b,_0x107a63=!0x1){super(_0x4e4154),this['_isAnimationOnEnterEnabled']=_0x1d6e1b,this['_initializeProperties'](_0x27b6fd,_0x5265e3,_0x107a63),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(_0x468d8b,_0x25f061,_0xc3a4a1){this['set']('label',_0x468d8b['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x468d8b['type']),this['set']('id',_0x468d8b['uiId']),this['set']('readonly',_0x25f061),this['set']('isLoading',_0xc3a4a1);}_setupTemplate(){const _0x4baf14=this['_createIconView'](),_0x1fc733=this['_createRemoveButton'](),_0x2d26e0=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x2d26e0),'children':this['_createTemplateChildren'](_0x4baf14,_0x1fc733,_0x2d26e0)});}_createTemplateAttributes(_0x5d3ef6){return{'class':[Vr,_0x5d3ef6['if']('itemType',Gr,_0x2f9d00=>'document'==_0x2f9d00),_0x5d3ef6['if']('itemType',Br,_0x401de9=>'selection'==_0x401de9)],'data-cke-tooltip-text':_0x5d3ef6['to']('label',qr),'data-cke-tooltip-position':Yr,'data-cke-tooltip-class':Wr};}_createTemplateChildren(_0x1237df,_0x258dd0,_0x12ba04){const _0x51f5a0=this['_createLabelElement'](_0x12ba04),_0x48b327=this['_createLoaderIcon']();return this['readonly']?[_0x1237df,_0x51f5a0]:[_0x1237df,_0x48b327,_0x51f5a0,_0x258dd0];}_createLabelElement(_0x212b9e){return{'tag':'span','attributes':{'class':Fr},'children':[{'text':_0x212b9e['to']('label')}]};}_createRemoveButton(){const _0x40564b=new Vt(this['locale']);return _0x40564b['set']({'label':Ts(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x591646}),this['_setupRemoveButtonEvent'](_0x40564b),_0x40564b;}_setupRemoveButtonEvent(_0xae2775){_0xae2775['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}_createIconView(){const _0x5cf8ff=this['bindTemplate'],_0x484e3a=new Qt();return _0x484e3a['content']=Ur[this['itemType']],_0x484e3a['extendTemplate']({'attributes':{'class':[Kr,_0x5cf8ff['if']('isLoading','ck-hidden',_0x27a14b=>_0x27a14b)]}}),_0x484e3a;}_handleAnimationEndOnce(_0x21d83d,_0x293ebe){if(!_0x21d83d)return;const _0x2247ed=()=>{_0x293ebe(),_0x21d83d['removeEventListener']('animationend',_0x2247ed),_0x21d83d['removeEventListener']('webkitAnimationEnd',_0x2247ed);};_0x21d83d['addEventListener']('animationend',_0x2247ed),_0x21d83d['addEventListener']('webkitAnimationEnd',_0x2247ed);}_createLoaderIcon(){const _0x2a3c9a=new Mr('small');return _0x2a3c9a['bind']('isVisible')['to'](this,'isLoading',_0x3bdeb9=>_0x3bdeb9),_0x2a3c9a;}};function qr(_0x242e69){if(!_0x242e69)return _0x242e69;if(_0x242e69['length']<=0x78)return _0x242e69;const _0x5e12dd=_0x242e69['slice'](0x0,0x78),_0xca1a10=_0x5e12dd['lastIndexOf']('\x20');return(_0xca1a10>0x0?_0x5e12dd['slice'](0x0,_0xca1a10):_0x5e12dd)+'…';}const Qr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},Xr='300px';var zr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];_showMoreButtonView=null;['_showMoreBalloonPanelView']=null;_containerElement=null;_bodyCollection;_parentView=null;_intersectionObserver=null;_pendingCalculation=!0x1;constructor(_0x2a82a2,_0x303121,_0x4041f6,_0x3d396e,_0x1609c1){this['_locale']=_0x2a82a2,this['_visibleChips']=_0x303121,this['_config']={...Qr,..._0x4041f6,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x4041f6['cssClasses']}},this['_overflowChips']=new lt(),this['_bodyCollection']=_0x3d396e,this['_parentView']=_0x1609c1||null;}setContainerElement(_0x185196){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x185196,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 _0x3eb170=[...this['_visibleChips'],...this['_overflowChips']],_0x40ca1d=this['_createCalculationContainer'](),_0x5f5c00=this['_calculateOverflowInContainer'](_0x40ca1d,_0x3eb170),_0x524828=_0x40ca1d['_ancestorsToRestore'];_0x524828&&this['_restoreAncestorVisibility'](_0x524828),_0x40ca1d['remove'](),this['_applyOverflowResults'](_0x3eb170,_0x5f5c00);}_createShowMoreButton(){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x1a4c41({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}_createShowMoreButtonView(){const _0x16eb69=new Vt(this['_locale']);_0x16eb69['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x6b11b9=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x6b11b9['push'](this['_config']['cssClasses']['controlsButton']),_0x16eb69['extendTemplate']({'attributes':{'class':_0x6b11b9}}),_0x16eb69;}_createShowMoreBalloonPanelView(){const _0x33ed04=new Pt(this['_locale']);return _0x33ed04['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x33ed04),_0x33ed04;}_updateBalloonContent(){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0xf1d027=>{_0xf1d027['disableAnimationOnEnter']();});const _0x3c4333=new _0x4f75f8(this['_locale']);_0x3c4333['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x3c4333);}}_handleShowMoreButtonClick(){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}_updateShowMoreButtonVisibility(){const _0x229aab=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x229aab?'':'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(_0x1f1aee){const _0x416161=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0xe2c6e0=this['_containerElement']?.['classList'];if(_0xe2c6e0){const _0x4793df=_0xe2c6e0[0x0]||'',_0x343b8f=_0x1f1aee['querySelector']('.'+_0x4793df),_0x4cd78f=_0x1f1aee['querySelector'](_0x416161);return _0x343b8f||_0x4cd78f||_0x1f1aee;}return _0x1f1aee['querySelector'](_0x416161)||_0x1f1aee;}_calculateContainerWidth(){const _0x2e6247=this['_parentView']?.['element']||this['_containerElement'];if(!_0x2e6247)return Xr;const _0x7c230=window['getComputedStyle'](_0x2e6247)['width'];if('auto'===_0x7c230||'0px'===_0x7c230||!_0x7c230){const _0x578778=_0x2e6247['parentElement'];if(_0x578778){const _0x3b39d7=window['getComputedStyle'](_0x578778);return'auto'!==_0x3b39d7['width']?_0x3b39d7['width']:Xr;}return Xr;}return _0x7c230;}_applyCalculationStyles(_0x1ad0ff,_0x3bf765){this['_config']['cssClasses']['calculationContainer']&&_0x1ad0ff['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x1ad0ff['style']['width']=_0x3bf765,_0x1ad0ff['style']['position']='absolute',_0x1ad0ff['style']['top']='-9999px',_0x1ad0ff['style']['left']='-9999px',_0x1ad0ff['style']['opacity']='0',_0x1ad0ff['style']['pointerEvents']='none',_0x1ad0ff['style']['zIndex']='-1',_0x1ad0ff['style']['visibility']='visible\x20!important',_0x1ad0ff['style']['display']='block\x20!important',_0x1ad0ff['style']['boxSizing']='border-box';}_restoreAncestorVisibility(_0x2535a6){_0x2535a6['forEach'](({element:_0x4ac56c,originalDisplay:_0x543038,originalVisibility:_0x338670})=>{_0x4ac56c['style']['display']=_0x543038,_0x4ac56c['style']['visibility']=_0x338670;});}_makeAncestorsVisible(_0x2fa9a4){const _0x2c1ec2=[];let _0x38bc91=_0x2fa9a4;for(;_0x38bc91&&_0x38bc91!==document['body'];){const _0x25fcb4=window['getComputedStyle'](_0x38bc91);'none'!==_0x25fcb4['display']&&'hidden'!==_0x25fcb4['visibility']||(_0x2c1ec2['push']({'element':_0x38bc91,'originalDisplay':_0x38bc91['style']['display'],'originalVisibility':_0x38bc91['style']['visibility']}),_0x38bc91['style']['display']='block',_0x38bc91['style']['visibility']='visible'),_0x38bc91=_0x38bc91['parentElement'];}return _0x2c1ec2;}_createContainerElements(){let _0x28672f,_0x397b4e;return this['_parentView']?.['element']?(_0x28672f=this['_parentView']['element']['cloneNode'](!0x0),_0x397b4e=this['_findTargetContainer'](_0x28672f)):(_0x28672f=document['createElement']('div'),_0x397b4e=_0x28672f),{'calculationContainer':_0x28672f,'targetContainer':_0x397b4e};}_createCalculationContainer(){const {calculationContainer:_0x59d53d,targetContainer:_0x51b27a}=this['_createContainerElements'](),_0x416ee9=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x59d53d,_0x416ee9);const _0x5cec44=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x5cec44?_0x5cec44['appendChild'](_0x59d53d):document['body']['appendChild'](_0x59d53d),_0x59d53d['_targetContainer']=_0x51b27a;const _0x2b70e7=this['_makeAncestorsVisible'](_0x5cec44||null);return _0x59d53d['offsetWidth'],_0x59d53d['_ancestorsToRestore']=_0x2b70e7,_0x59d53d;}_calculateOverflowInContainer(_0x4e469b,_0x219056){const _0x48f1ad=_0x4e469b['_targetContainer']||_0x4e469b,_0x2558ba=[],{rowCount:_0x3f9b67}=this['_renderChipsAndCountRows'](_0x48f1ad,_0x219056);if(_0x3f9b67<=this['_config']['maxVisibleRows'])return _0x2558ba;const _0x2c3ea7=_0x219056['slice']();for(;_0x2c3ea7['length']>0x0;){if(this['_testButtonFit'](_0x4e469b,_0x48f1ad,_0x2c3ea7)){const _0x15edde=_0x219056['filter'](_0x2732ba=>!_0x2c3ea7['includes'](_0x2732ba));_0x2558ba['push'](..._0x15edde);break;}if(!_0x2c3ea7['pop']())break;}return _0x2558ba;}_renderChipsAndCountRows(_0x234650,_0x836f07){_0x234650['innerHTML']='',_0x836f07['forEach'](_0x2d9605=>{if(_0x2d9605['element']){const _0x1726b7=_0x2d9605['element']['cloneNode'](!0x0);_0x234650['appendChild'](_0x1726b7);}}),_0x234650['offsetWidth'];const _0x1915e6=_0x234650['children'],_0x5b4b82=[];return Array['from'](_0x1915e6)['forEach'](_0xe63b42=>{const _0x1d4d42=_0xe63b42['getBoundingClientRect']()['top'];_0x5b4b82['some'](_0x33be20=>Math['abs'](_0x33be20-_0x1d4d42)<this['_config']['rowDetectionTolerance'])||_0x5b4b82['push'](_0x1d4d42);}),{'rowCount':_0x5b4b82['length']};}_createMockButton(){const _0x5216f1=document['createElement']('button');return _0x5216f1['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x5216f1['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x5216f1['textContent']='+\x201',_0x5216f1;}_testButtonFit(_0x5f4688,_0x55da4d,_0x29d6a5){this['_renderChipsAndCountRows'](_0x55da4d,_0x29d6a5);const _0x2973d2=this['_createMockButton']();_0x5f4688['appendChild'](_0x2973d2),_0x5f4688['offsetWidth'];const _0x45fb38=[..._0x55da4d['children'],_0x2973d2],_0x449e74=[];_0x45fb38['forEach'](_0x53614a=>{const _0x42ba27=_0x53614a['getBoundingClientRect']()['top'];_0x449e74['some'](_0x459439=>Math['abs'](_0x459439-_0x42ba27)<this['_config']['rowDetectionTolerance'])||_0x449e74['push'](_0x42ba27);});const _0x14d0fd=_0x449e74['length'];return _0x2973d2['remove'](),_0x14d0fd<=this['_config']['maxVisibleRows'];}_distributeChips(_0x56e722,_0x411ca3){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x56e722['forEach'](_0x188f93=>{_0x411ca3['includes'](_0x188f93)?this['_overflowChips']['add'](_0x188f93):this['_visibleChips']['add'](_0x188f93);});}_updateOverflowUI(_0x45d617){if(_0x45d617>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x45d617>0x0&&this['_showMoreButtonView']){const _0x4ad870=''+this['_config']['showMoreLabelPrefix']+(_0x45d617<0x63?_0x45d617:'99');this['_showMoreButtonView']['label']=_0x4ad870;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}_applyOverflowResults(_0x117f7d,_0x54e3e2){this['_distributeChips'](_0x117f7d,_0x54e3e2),this['_updateOverflowUI'](_0x54e3e2['length']);}_setupVisibilityObserver(){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x402aa6=>{_0x402aa6[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 _0x3335d2=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x3335d2['width']||0x0===_0x3335d2['height'])return!0x1;const _0x374869=window['innerHeight']||document['documentElement']['clientHeight'],_0x568cc9=window['innerWidth']||document['documentElement']['clientWidth'];return _0x3335d2['bottom']>=-0xc8&&_0x3335d2['top']<=_0x374869+0xc8&&_0x3335d2['right']>=-0xc8&&_0x3335d2['left']<=_0x568cc9+0xc8;}};const jr='ck-ai-chat__feed__context-chips',Jr='ck-ai-chat-context-chips-wrapper',Zr='ck-ai-chat-context-chips-wrapper-balloon',to='ck-ai-chat-controls-button',eo='ck-ai-chat-controls_context_show-more-button',io='ck-ai-chat-context-controls__show-more-balloon-panel';var so=class extends _0x4f75f8{_contextChips=this['createCollection']();['_overflowManager'];_bodyCollection;constructor(_0x3254ef,_0x3877f2,_0x4bbef3){super(_0x3254ef),this['_bodyCollection']=_0x4bbef3,this['_createContextChips'](_0x3877f2);const _0x2ce9c0={'cssClasses':{'showMoreButton':eo+'\x20'+Mn,'showMoreBalloon':io,'overflowContainer':Zr,'controlsButton':to}};this['_overflowManager']=new zr(_0x3254ef,this['_contextChips'],_0x2ce9c0,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[jr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Jr},'children':this['_contextChips']}]});}['render'](){super['render']();const _0xc95b5a=this['element']['querySelector']('.'+Jr);_0xc95b5a&&(this['_overflowManager']['setContainerElement'](_0xc95b5a),this['_overflowManager']['reorganizeChips']());}destroy(){super['destroy'](),this['_overflowManager']['destroy']();}_createContextChips(_0x51be12){for(const _0x42c5d0 of _0x51be12){const _0x55e975=new $r(this['locale'],_0x42c5d0,!0x0,!0x1);this['_contextChips']['add'](_0x55e975);}}},no=class extends dr{_contextChipsView=null;['_locale'];_bodyCollection;_messageContentView;constructor(_0x30b631,_0x4db089,_0xe2e4f){super(_0x4db089),this['_locale']=_0x30b631,this['_bodyCollection']=_0xe2e4f,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 so(this['_locale'],this['options']['contextItems']['filter'](_0x5f4f66=>!_0x5f4f66['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}_createMessageContentView(){this['_messageContentView']=new _0x4f75f8(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']();}},ro=class extends dr{capabilities;constructor(_0x129034,_0x47f397){super(_0x47f397);const {isWebSearchEnabled:_0x43d4ca,isReasoningEnabled:_0x4320cf}=_0x47f397['capabilities'],_0x2279e6=[];let _0x4bfef0='';_0x43d4ca&&_0x4320cf?(_0x4bfef0=Ts(_0x129034,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x2279e6['push'](oo(ht)),_0x2279e6['push'](oo(_0x5eeff8))):_0x43d4ca?(_0x4bfef0=Ts(_0x129034,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x2279e6['push'](oo(ht))):_0x4320cf&&(_0x4bfef0=Ts(_0x129034,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x2279e6['push'](oo(_0x5eeff8))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x4bfef0?'':'ck-hidden']}});const _0x4597e6=new _0x4f75f8();_0x4597e6['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x2279e6,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x4bfef0]}]}),this['children']['add'](_0x4597e6),this['capabilities']=_0x47f397['capabilities'];}};function oo(_0x45ff71){const _0x468592=new Qt();return _0x468592['content']=_0x45ff71,_0x468592;}const ao=['wheel','touchstart','pointerdown','keydown'],ho=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var co=class{element;animationFrameId;['isRunning'];abortController;['isUserPaused'];['scrollBehavior'];constructor(_0x2a462e){this['element']=_0x2a462e,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x589326 of ao){const _0x191322='keydown'!==_0x589326;this['element']['addEventListener'](_0x589326,this['_onUserEvent']['bind'](this),{'passive':_0x191322,'signal':this['abortController']['signal']});}}start({smooth:_0xd03378=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0xd03378?'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(_0x1220d4){if(this['isRunning']){if('keydown'===_0x1220d4['type']){const _0x4987b0=_0x1220d4['key'];if(!ho['includes'](_0x4987b0))return;}_0x1220d4 instanceof WheelEvent?_0x1220d4['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}_isAtBottom(){const {scrollTop:_0xb8a276,scrollHeight:_0x1424bc,clientHeight:_0x4b292b}=this['element'];return _0x1424bc-_0xb8a276-_0x4b292b<=0x5;}_rafUpdate(){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},lo=class extends dr{constructor(_0x3b0b38){super(_0x3b0b38),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']);}},uo=class extends _0x4f75f8{['children'];['scrollManager'];_bodyCollection;constructor(_0xd72308,_0x1d0a47){super(_0xd72308),this['_bodyCollection']=_0x1d0a47,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...rr)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new co(this['element']);}destroy(){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}addItem(_0x16e16a,_0x3f458e){let _0x146cc2;return'ai-reply'===_0x16e16a?_0x146cc2=new Hr(this['locale'],_0x3f458e,this['_bodyCollection']):'ai-suggestion-reply'===_0x16e16a?(_0x146cc2=new Dr(this['locale'],_0x3f458e,this['_bodyCollection']),_0x146cc2['bind']('isTrackChangesOn')['to'](this)):_0x146cc2='user-message'===_0x16e16a?new no(this['locale'],_0x3f458e,this['_bodyCollection']):'interaction-header'===_0x16e16a?new ro(this['locale'],_0x3f458e):'custom-element'===_0x16e16a?new lo(_0x3f458e):new vr(_0x3f458e),this['children']['add'](_0x146cc2),_0x146cc2;}async updateReplyItem({id:_0x238057,parsedContent:_0x3aeb41,renderingStrategy:_0x55bc0b,abortSignal:_0x162a1a}){const _0x20b6a8=this['getItemById'](_0x238057);if(!(_0x20b6a8 instanceof Hr))throw new ct('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x20b6a8,'id':_0x238057,'parsedContent':_0x3aeb41});await _0x20b6a8['updateContent']({'parsedContent':_0x3aeb41,'renderingStrategy':_0x55bc0b,'abortSignal':_0x162a1a});}async updateWebSources(_0x4bd193,_0x16ef36){const _0x1737c0=this['getItemById'](_0x4bd193);if(_0x1737c0 instanceof Dr)_0x1737c0['updateSources'](_0x16ef36);else{if(!(_0x1737c0 instanceof Hr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x1737c0,'id':_0x4bd193,'sources':_0x16ef36});_0x1737c0['updateSources'](_0x16ef36);}}async updateSuggestionItem({id:_0x8e4632,parts:_0x52eb6e,abortSignal:_0x30bb55,skipLoadingEffects:_0x2a272c}){const _0xc16f96=this['getItemById'](_0x8e4632);if(!(_0xc16f96 instanceof Dr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0xc16f96,'id':_0x8e4632,'parts':_0x52eb6e});await _0xc16f96['updateContent']({'parts':_0x52eb6e,'abortSignal':_0x30bb55,'skipLoadingEffects':_0x2a272c});}updateSuggestionPartState({id:_0x39a727,index:_0x373920,state:_0x4a2cae,outdatedReason:_0x36de2c}){const _0x12d9c8=this['getItemById'](_0x39a727);if(!(_0x12d9c8 instanceof Dr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x39a727});_0x12d9c8['updatePartState'](_0x373920,_0x4a2cae,_0x36de2c);}updateSuggestionGating(_0x3c0d91,_0xdb4aa5){const _0x42f101=this['getItemById'](_0x3c0d91);if(!(_0x42f101 instanceof Dr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x3c0d91});_0x42f101['setGating'](_0xdb4aa5);}setSuggestionPartActive({id:_0x27e3df,index:_0x32a412,isActive:_0x1c3ee3}){const _0x345e3e=this['getItemById'](_0x27e3df);if(!(_0x345e3e instanceof Dr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x27e3df});this['children']['filter'](_0x5abf6a=>_0x5abf6a instanceof Dr)['forEach'](_0x19a587=>{_0x19a587['setPartActive'](!0x1);}),_0x345e3e['setPartActive'](_0x32a412,_0x1c3ee3);}markItemAsDone(_0x185220){this['getItemById'](_0x185220)['markAsDone']();}getItemIds(){return this['children']['map'](_0x535cb3=>_0x535cb3['options']['id']);}removeItem(_0x38d0c9){this['children']['remove'](this['getItemById'](_0x38d0c9));}hasItem(_0x55b284){return!!this['children']['find'](_0x55f983=>_0x55f983['options']['id']['includes'](_0x55b284));}scrollToSuggestion(_0x260712,_0x3c18e4){const _0x3c6122=this['getItemById'](_0x260712);if(!(_0x3c6122 instanceof Dr))return void Ot('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x260712,'partIndex':_0x3c18e4});const _0x4a046e=_0x3c6122['getPartView'](_0x3c18e4);_0x4a046e?vt(_0x4a046e['element'],0x14,this['element']['parentElement'],!0x0,!0x0):Ot('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x260712,'partIndex':_0x3c18e4});}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}_createTemplateChildren(){const _0x1717c9=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x1717c9,this['_createFeedLoader']()];}_createSkeletonLoader(){const _0x2a3b2c=new fr(this['locale'],br['aiFeed']);return _0x2a3b2c['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x2a3b2c;}_createFeedItems(){const _0x4d4f24=new _0x4f75f8(this['locale']);return _0x4d4f24['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x4d4f24;}_createFeedLoader(){const _0x34385d=new _0x4f75f8(this['locale']);return _0x34385d['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x241c9a=>!_0x241c9a)]},'children':this['_createLoaderChildren']()}),_0x34385d;}_createLoaderChildren(){const _0x1aa3e9=new Mr();return _0x1aa3e9['isVisible']=!0x0,[_0x1aa3e9,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}getItemById(_0x383277){const _0x3be251=this['children']['find'](_0x3bcd22=>_0x3bcd22['options']['id']['includes'](_0x383277));if(!_0x3be251)throw new ct('ai-chat-feed-view-item-not-found',this,{'id':_0x383277});return _0x3be251;}setLoadingMessage(_0x1aa3ba){this['set']('loadingMessage',_0x1aa3ba);}toggleLoadingSkeleton(_0x270f26){this['set']('isLoadingSkeletonVisible',_0x270f26);}startAutoScroll(_0x5d22a9={}){this['scrollManager']['start'](_0x5d22a9);}stopAutoScroll(){this['scrollManager']['stop']();}},_o=class extends te{filter(){let _0x12f048=0x0;for(const _0x98b842 of this['items'])_0x12f048+=_0x98b842['items']['length'];return{'resultsCount':_0x12f048,'totalItemsCount':_0x12f048};}};function go(_0x597998){const _0xafbe84=[];let _0x21c12d=!0x1;for(const _0x5718a2 of Array['from'](_0x597998['items'])){if('file'!==_0x5718a2['kind'])continue;if(_0x5718a2['webkitGetAsEntry']()?.['isDirectory']){_0x21c12d=!0x0;continue;}const _0x4effa6=_0x5718a2['getAsFile']();_0x4effa6&&_0xafbe84['push'](_0x4effa6);}return{'files':_0xafbe84,'hasDirectory':_0x21c12d};}const Ao='ck-ai-chat__prompt-input_highlighted';var Io=class AIChatPromptInputView extends Lt{submitButtonView;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;_addContextButtonView;['_queryViewResizeObserver'];constructor(_0x2f00cd,_0x32094f){super(_0x2f00cd,{'queryView':{'label':'','creator':_0x11a29a,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new _o(_0x2f00cd),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x32094f,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',(_0x23f20a,_0x2cfa3a)=>!_0x23f20a&&!_0x2cfa3a),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x351c73,_0x21b0dd)=>{this['isUploadInProgress']||this['isEmpty']||_0x351c73['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x21b0dd());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x242e4a=>this['_handlePaste'](_0x242e4a)),this['element']['addEventListener']('drop',_0xfa9d46=>this['_handleDrop'](_0xfa9d46));}_handlePaste(_0x68ffb){const _0xc5073c=_0x68ffb['clipboardData'];if(!_0xc5073c)return;const {files:_0x273327,hasDirectory:_0x3ac8ae}=go(_0xc5073c),_0x22d4c8={'files':_0x273327,'plainText':_0xc5073c['getData']('text/plain'),'hasDirectory':_0x3ac8ae,'forceTextAttachment':!0x1,'preventDefault':()=>_0x68ffb['preventDefault']()};this['fire']('promptInputPaste',_0x22d4c8);}['_handleDrop'](_0x348df8){const _0x5d6d13=_0x348df8['dataTransfer'];if(!_0x5d6d13)return;const _0x1dffcf={'files':[],'plainText':_0x5d6d13['getData']('text/uri-list')||_0x5d6d13['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x348df8['preventDefault']()};this['fire']('promptInputPaste',_0x1dffcf);}destroy(){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}submit(){const _0x5ebe64=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x5ebe64)return this['queryView']['errorText']=Ts(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x13a915=_0x34b9ac(_0x5ebe64);this['fire']('sendUserMessage',_0x13a915),this['queryView']['fieldView']['reset']();}setPlaceholderText(_0x250223){this['queryView']['fieldView']['set']('placeholder',_0x250223);}['focus'](_0x3ce12a=!0x1){super['focus'](),_0x3ce12a&&(this['element']['classList']['contains'](Ao)||(this['element']['classList']['add'](Ao),setTimeout(()=>{this['element']['classList']['remove'](Ao);},0x320)));}_createSubmitButton(){const _0x235c26=new Vt(this['locale']);return _0x235c26['set']({'icon':nt,'label':Ts(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Dn,'isEnabled':!0x1}),_0x235c26['on']('execute',()=>{this['submit']();}),_0x235c26;}setIsUploadInProgress(_0x517da0){this['isUploadInProgress']=_0x517da0;}_setUpAddContextButtonPositioning(){const _0x7c5613=this['locale'],_0x531fc7=()=>{Ct['window']['requestAnimationFrame'](()=>{if(St(this['element'])){const _0x3de5f1=new It(this['queryView']['fieldView']['element']),_0x14e2de=new It(this['_addContextButtonView']['element']),_0x58c0a1=_0x3de5f1['width'],_0x149065='rtl'===_0x7c5613['uiLanguageDirection']?'right':'left';_0x3de5f1['excludeScrollbarsAndBorders']();const _0x5d32f2=_0x58c0a1-_0x3de5f1['width']+0x1;this['_addContextButtonView']['element']['style'][_0x149065]='calc('+(_0x58c0a1-_0x14e2de['width']-_0x5d32f2)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x531fc7),this['on']('render',()=>{_0x531fc7(),this['_queryViewResizeObserver']=new pt(this['queryView']['fieldView']['element'],()=>{_0x531fc7();});});}},po=class extends _0x4f75f8{constructor(_0x3f8d9c){super(_0x3f8d9c),this['set']('isEnabled',!0x0);const _0x557d1c=new Qt();_0x557d1c['content']=_0x118543,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x557d1c,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Ts(_0x3f8d9c,'AI_CHAT_DROP_ZONE_HINT')}]}]});}attach(_0x2c5467){let _0x3ea5c2=0x0;const _0x2f51c2=()=>{_0x2c5467['classList']['toggle']('ck-ai-chat-controls_drag-over',this['isEnabled']&&_0x3ea5c2>0x0);};this['on']('change:isEnabled',(_0xc3d20d,_0x27a861,_0x5a027c)=>{_0x5a027c&&_0x3ea5c2>0x0&&this['fire']('dragEnter'),_0x2f51c2();}),_0x2c5467['addEventListener']('dragenter',_0x21059c=>{_0x21059c['dataTransfer']&&(_0x3ea5c2++,0x1===_0x3ea5c2&&this['isEnabled']&&this['fire']('dragEnter'),_0x2f51c2());}),_0x2c5467['addEventListener']('dragover',_0xe5f216=>{_0xe5f216['dataTransfer']&&_0xe5f216['preventDefault']();}),_0x2c5467['addEventListener']('dragleave',()=>{--_0x3ea5c2<0x0&&(_0x3ea5c2=0x0),_0x2f51c2();}),_0x2c5467['addEventListener']('drop',_0x14e6f4=>{_0x14e6f4['preventDefault'](),_0x3ea5c2=0x0,_0x2f51c2(),this['isEnabled']&&this['_handleDrop'](_0x14e6f4);});}['_handleDrop'](_0x270e0a){const _0x53dcab=_0x270e0a['dataTransfer'];if(!_0x53dcab)return;const {files:_0x3acbb2,hasDirectory:_0x4e5083}=go(_0x53dcab),_0x83d9a1={'files':_0x3acbb2,'plainText':_0x53dcab['getData']('text/uri-list')||_0x53dcab['getData']('text/plain'),'hasDirectory':_0x4e5083,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x83d9a1);}},Eo=class extends _0x4f75f8{['dropdownView'];['nameView'];_items;['_config'];constructor(_0x5a5515,_0x51a830){super(_0x5a5515),this['_config']=_0x51a830,this['set']('modelDisplayMode','selector'),this['set']('activeModelId',null),this['set']('activeModelName',null),this['set']('isEnabled',!0x0),this['dropdownView']=this['_createDropdown'](),this['_items']=new lt(),_0x5ccc98(this['dropdownView'],this['_items']),this['nameView']=new mo(_0x5a5515,_0x51a830['nameClass']),this['nameView']['bind']('text')['to'](this,'activeModelName',_0x207e76=>_0x207e76??''),this['nameView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3619e4=>'name'===_0x3619e4),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-model-selector']},'children':[this['dropdownView'],this['nameView']]});}setModels(_0x4ac2e6,_0x1c7701){var _0x2a806b;this['set']('modelDisplayMode',(_0x2a806b=_0x4ac2e6['length'],_0x1c7701?0x1===_0x2a806b?'name':'selector':'hidden')),this['_items']['clear'](),0x1===_0x4ac2e6['length']&&this['set']('activeModelName',_0x4ac2e6[0x0]['name']||_0x4ac2e6[0x0]['id']);for(const _0x1cbdd6 of _0x4ac2e6){const _0x2c88e1=new _0x50627c({'label':_0x1cbdd6['name'],'withText':!0x0,'role':'menuitemradio','id':_0x1cbdd6['id'],'model':_0x1cbdd6});_0x2c88e1['bind']('isOn')['to'](this,'activeModelId',_0x1b12f6=>_0x1b12f6===_0x1cbdd6['id']),this['_items']['add']({'type':'button','model':_0x2c88e1,'labelView':new To(this['locale'],_0x1cbdd6,{'nameClass':this['_config']['itemClasses']['name'],'descriptionClass':this['_config']['itemClasses']['description'],'capabilitiesClass':this['_config']['itemClasses']['capabilities'],'extraContent':this['_config']['showCapabilities']?wo(this['locale'],_0x1cbdd6):void 0x0})});}}setSelectedModel(_0x2f82ba){this['set']('activeModelId',_0x2f82ba?_0x2f82ba['id']:null),this['set']('activeModelName',_0x2f82ba?_0x2f82ba['name']||_0x2f82ba['id']:null);}_createDropdown(){const _0x5e43f3=_0x5c62d3(this['locale']);return _0x5e43f3['set']({'panelPosition':this['_config']['panelPosition'],'class':this['_config']['dropdownClass']}),_0x5e43f3['buttonView']['set']({'withText':!0x0,'tooltipPosition':this['_config']['tooltipPosition'],'class':Mn}),_0x5e43f3['buttonView']['bind']('label')['to'](this,'activeModelName',_0xb800=>_0xb800??this['_config']['defaultLabel']??''),_0x5e43f3['buttonView']['bind']('tooltip')['to'](this,'activeModelName',this,'isEnabled',(_0x309e3b,_0x4ec8c4)=>!_0x4ec8c4&&this['_config']['disabledTooltip']?this['_config']['disabledTooltip']:_0x309e3b??this['_config']['defaultLabel']??''),_0x5e43f3['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x226c43=>'selector'===_0x226c43),_0x5e43f3['bind']('isEnabled')['to'](this,'isEnabled'),this['listenTo'](_0x5e43f3,'execute',_0x5580d8=>{this['fire']('selectModel',_0x5580d8['source']['model']);}),_0x5e43f3;}},mo=class extends _0x4f75f8{constructor(_0x5bbbff,_0x4ffc9e){super(_0x5bbbff),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x472b64=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck',_0x4ffc9e,_0x472b64['if']('isVisible','ck-hidden',_0x42e528=>!_0x42e528)]},'children':[{'text':_0x472b64['to']('text')}]});}},To=class extends Mt{constructor(_0x2fb6ed,_0xa8769c,_0x41c5af){super();const _0x609fef=this['bindTemplate'],_0x3a152a=[{'tag':'div','attributes':{'class':[_0x41c5af['nameClass']]},'children':[{'tag':'span','children':[{'text':_0x609fef['to']('text')}]}]},{'tag':'div','attributes':{'class':[_0x41c5af['descriptionClass']]},'children':[{'tag':'span','children':[_0xa8769c['description']||'']}]}];_0x41c5af['extraContent']?.['length']&&_0x41c5af['capabilitiesClass']&&_0x3a152a['push']({'tag':'div','attributes':{'class':[_0x41c5af['capabilitiesClass']]},'children':_0x41c5af['extraContent']}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x609fef['to']('style'),'id':_0x609fef['to']('id')},'children':_0x3a152a});}};function wo(_0x5d4a9b,_0x514e73){return[...Co(_0x5d4a9b,ht,'AI_CHAT_SEARCH_WEB',_0x514e73['capabilities']['webSearch']?.['enabled']??!0x1),...Co(_0x5d4a9b,_0x5eeff8,'AI_CHAT_REASONING',_0x514e73['capabilities']['reasoning']?.['enabled']??!0x1)];}function Co(_0x41311b,_0x5eaf0a,_0x571e49,_0x40302e){const _0x545c7d=new Qt();_0x545c7d['content']=_0x5eaf0a;const _0x4a3ce2=new _0x4f75f8(_0x41311b);_0x4a3ce2['setTemplate']({'tag':'span','children':[{'text':Ts(_0x41311b,_0x571e49)+':\x20'}]});const _0x15ede0=new _0x4f75f8(_0x41311b);return _0x15ede0['setTemplate']({'tag':'span','children':[{'text':Ts(_0x41311b,_0x40302e?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x545c7d,_0x4a3ce2,_0x15ede0];}const fo='ck-ai-chat__prompt-capabilities',bo='ck-ai-chat-controls-button',So='ck-ai-chat-controls-button--commands',Ro='ck-ai-chat-controls__model-selection',Oo='ck-ai-chat-controls__model-selection__item-name',vo='ck-ai-chat-controls__model-selection__item-description',ko='ck-ai-chat-controls__model-selection__item-capabilities',yo='n';var No=class extends _0x4f75f8{_webSearchButton;_reasoningButton;_commandsButton;_modelSelector;constructor(_0x523caf){super(_0x523caf),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelSelectorEnabled',!0x0),this['_modelSelector']=function(_0xe236e5){return new Eo(_0xe236e5,{'panelPosition':'ne','dropdownClass':[Ro],'nameClass':'ck-ai-chat-controls__model-name','itemClasses':{'name':Oo,'description':vo,'capabilities':ko},'defaultLabel':Ts(_0xe236e5,'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'disabledTooltip':Ts(_0xe236e5,'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP'),'tooltipPosition':yo,'showCapabilities':!0x0});}(_0x523caf),this['_modelSelector']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x55c108=>_0x55c108),this['_modelSelector']['delegate']('selectModel')['to'](this),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x124469=>_0x124469),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x22c1e5=>Ts(this['locale'],_0x22c1e5?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x561a73=>_0x561a73),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x3c89f1=>Ts(this['locale'],_0x3c89f1?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[fo]},'children':[this['_modelSelector'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]});}setWebSearch(_0x41b8ff){this['set']('webSearchActive',_0x41b8ff);}setReasoning(_0x3097f9){this['set']('reasoningActive',_0x3097f9);}setModelList(_0x373612,_0x10f7ca){this['_modelSelector']['setModels'](_0x373612,!_0x10f7ca);}setModel(_0xbbf402){if(!_0xbbf402)return;this['_modelSelector']['setSelectedModel'](_0xbbf402);const _0x38abaf=_0xbbf402['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x38abaf),this['_webSearchButton']['set']('isVisible',_0x38abaf);const _0x45be8f=_0xbbf402['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x45be8f),this['_reasoningButton']['set']('isVisible',_0x45be8f);}enableModelSelector(){this['set']('modelSelectorEnabled',!0x0);}disableModelSelector(_0x479dd3){this['set']('modelSelectorEnabled',!0x1),_0x479dd3&&(this['_modelSelector']['modelDisplayMode']='hidden');}_createWebSearchButton(){const _0x5b045a=new Vt();return _0x5b045a['set']({'label':Ts(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ht,'class':bo+'\x20'+Mn,'isToggleable':!0x0,'tooltipPosition':yo}),_0x5b045a['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x5b045a;}_createReasoningButton(){const _0x31d1a4=new Vt();return _0x31d1a4['set']({'label':Ts(this['locale'],'AI_CHAT_REASONING'),'icon':_0x5eeff8,'class':bo+'\x20'+Mn,'isToggleable':!0x0,'tooltipPosition':yo}),_0x31d1a4['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x31d1a4;}_createCommandsButton(){const _0x41ab73=new Vt();return _0x41ab73['set']({'label':Ts(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x5aedd4,'withText':!0x0,'class':bo+'\x20'+Mn,'isToggleable':!0x0,'tooltip':Ts(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':yo}),_0x41ab73['extendTemplate']({'attributes':{'class':[So]}}),_0x41ab73['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x41ab73;}};const xo='ck-ai-chat-context-controls__url-form',Lo='ck-ai-chat-context-controls__url-input-section';var Po=class extends _0x4f75f8{['focusTracker'];keystrokes;['_focusables'];['focusCycler'];urlInputField;backButton;confirmButton;constructor(_0x3c5d00){super(_0x3c5d00),this['focusTracker']=new _t(),this['keystrokes']=new gt(),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 Wt({'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'](_0xd82b5d=>{this['focusTracker']['add'](_0xd82b5d['element']),this['keystrokes']['listenTo'](_0xd82b5d['element']);}),_0x510cd9({'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(_0x550954){this['urlInputField']['errorText']=_0x550954,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}_createBackButton(){const _0x578cfa=new Vt(this['locale']);return _0x578cfa['set']({'icon':_0x406e30,'tooltip':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x7b5c7b,_0x436abc,_0xf191c9)=>{_0x578cfa['set']({'class':['ck-button-icon\x20ck-button-back'+(_0xf191c9?'':'\x20ck-hidden')]});}),_0x578cfa;}_createUrlInputField(){const _0x257345=new zt(this['locale'],_0x3e888c);return _0x257345['set']({'label':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x257345['fieldView']['set']({'placeholder':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x257345;}_createConfirmButton(){const _0x40af45=new Vt(this['locale']);return _0x40af45['set']({'icon':_0x11611b,'tooltip':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x40af45;}_setupTemplate(){const _0x42fe36=new Yt(this['locale'],{'label':Ts(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x42fe36['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':xo,'tabindex':'-1'},'children':[_0x42fe36,{'tag':'div','attributes':{'class':Lo},'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',_0x12c8a2=>{_0x12c8a2['stop'](),this['_handleSubmit']();});}_setupKeystrokes(){this['keystrokes']['set']('esc',(_0x129c74,_0x5ca6d2)=>{this['clear'](),this['fire']('cancel'),_0x5ca6d2();});}_handleSubmit(){const _0x346866=this['getValue']()['trim']();_0x346866?this['_isValidUrl'](_0x346866)?(this['clearError'](),this['fire']('submitUrl',_0x346866)):this['setError'](Ts(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Ts(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}_updateConfirmButtonState(){const _0x15712a=this['getValue']()['trim'](),_0x230929=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x15712a['length']>0x0&&!_0x230929;}['_isValidUrl'](_0x57f0bc){try{return!!new URL(_0x57f0bc);}catch{return!0x1;}}};const Do='ck-ai-chat-resources__item',Ho='ck-ai-chat-resources__item--in-context',Mo='ck-ai-chat-resources__item-title',Uo='ck-ai-chat-resources__item__icon';var Vo=class extends Zt{['resource'];_titleView;['_iconView'];constructor(_0x39c2d6,_0x5b83e6){super(_0x39c2d6),this['resource']=_0x5b83e6,this['set']('isInContext',!!_0x5b83e6['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}getResourceIcon(_0x2f6855){if(_0x2f6855['isInContext'])return _0x11611b;switch(_0x2f6855['type']){case'document':return _0x36b436;case'web-resource':return _0x305afd;case'file':case'text':return _0x118543;default:return _0x5133a4;}}highlightText(_0x5b65e5){if(!_0x5b65e5||''===_0x5b65e5['trim']())return void this['_titleView']['highlightText'](null);const _0x1ce4c4=new RegExp(_0x922d45(_0x5b65e5),'gi');this['_titleView']['highlightText'](_0x1ce4c4);}updateResourceState(_0x4ee8a5){this['resource']['isInContext']=_0x4ee8a5,this['isInContext']=_0x4ee8a5,this['_updateIcon']();}_createTitleView(){const _0x75563e=new qt();return _0x75563e['text']=this['resource']['label'],_0x75563e['extendTemplate']({'tag':'span','attributes':{'class':[Mo]}}),_0x75563e;}_createIconView(){const _0x596a51=new Qt();return _0x596a51['content']=this['getResourceIcon'](this['resource']),_0x596a51;}_setupTemplate(){const _0x14366b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[Do,_0x14366b['if']('isVisible','ck-hidden',_0x51723f=>!_0x51723f),_0x14366b['if']('isInContext',Ho)]},'children':[{'tag':'div','attributes':{'class':[Uo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x14366b['to']('execute')}});}_updateIcon(){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const Bo='ck-ai-chat-resources__list';var Go=class extends te{['_source'];constructor(_0x33c762,_0x47ac32){super(_0x33c762),this['_source']=_0x47ac32,this['extendTemplate']({'attributes':{'class':[Bo]}});}setResources(_0x43d98f,_0x25e0d2){this['items']['clear']();let _0x5cf063=_0x43d98f;if(this['_source']['useDefaultFiltering']&&_0x25e0d2&&''!==_0x25e0d2['trim']()){const _0x4580b3=new RegExp(_0x25e0d2['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x5cf063=_0x43d98f['filter'](_0x17adb2=>_0x4580b3['test'](_0x17adb2['label']));}for(const _0x29edbd of _0x5cf063){const _0x7f875f=new Vo(this['locale'],_0x29edbd);_0x7f875f['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x29edbd);}),this['items']['add'](_0x7f875f);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x25e0d2);}highlightText(_0x10888a){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x5e9c76=>{_0x5e9c76['highlightText'](_0x10888a);});}updateResourceState(_0x24110f,_0x3ac9a3){for(const _0x1a751e of this['items']){const _0x13b02c=_0x1a751e;_0x13b02c['resource']['id']===_0x24110f&&_0x13b02c['updateResourceState'](_0x3ac9a3);}}_handleResourceSelection(_0xe15199,_0x41557c){this['fire']('addResourceToContext',{'source':_0xe15199,'resource':_0x41557c});}},Fo=class extends zt{['iconView'];resetButtonView;['_viewConfig'];constructor(_0x5ee1c3){const t=_0x5ee1c3['t'],_0x147b99={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x3e888c,'label':Ts(_0x5ee1c3,'AI_CHAT_SEARCH_RESOURCES')};super(_0x5ee1c3,_0x147b99['creator']),this['label']=_0x147b99['label'],this['_viewConfig']=_0x147b99,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x5ee1c3,t),this['_setupEventListeners']();}reset(){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x451fdf){this['fire']('search',_0x451fdf);}getQuery(){return this['fieldView']['element']?.['value']||'';}_setupSearchIcon(){this['iconView']=new Qt(),this['iconView']['content']=_0x3cc163,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}_setupResetButton(_0xdbf643,t){this['resetButtonView']=new Vt(_0xdbf643),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x591646,'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',_0x4649cc=>!_0x4649cc),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);}},Ko=class extends _0x4f75f8{['_searchView'];_searchSection;_searchInputVisibleFrom;_resourcesListView;_skeletonLoader;['_source'];['children'];_latestLoadResourcesUid=null;constructor(_0x182c81,_0x14793d){super(_0x182c81),this['_source']=_0x14793d['source'],this['_searchInputVisibleFrom']=_0x14793d['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 _0x340edf([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}_createSearchView(){return new Fo(this['locale']);}_createSearchSection(){const _0x10dd06=new _0x4f75f8(this['locale']);return _0x10dd06['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x5133b6,_0xd45402)=>{this['loadResources'](_0xd45402),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0xd45402);}),_0x10dd06;}_createResourcesListView(){const _0x50abf7=new Go(this['locale'],this['_source']);return _0x50abf7['delegate']('addResourceToContext')['to'](this),_0x50abf7['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x50abf7;}_createSkeletonView(){const _0x489d22=new fr(this['locale'],br['aiChatResources']);return _0x489d22['bind']('isVisible')['to'](this,'isLoading'),_0x489d22;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x4a7ef2){const _0xb4902b=Nt();this['_latestLoadResourcesUid']=_0xb4902b,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x4a7ef2,'uid':_0xb4902b}),this['isLoading']=!0x0;}setResources(_0x5a3260,_0x11f03d){if(_0x11f03d&&_0x11f03d!==this['_latestLoadResourcesUid'])return;const _0x4d3e40=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x5a3260,_0x4d3e40),_0x5a3260['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}updateResourceState(_0x3244bd,_0x326709){this['_resourcesListView']['updateResourceState'](_0x3244bd,_0x326709);}};const Wo='ck-ai-chat-context-controls__source-balloon-panel',Yo='ck-button-icon\x20ck-button-back',$o='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var qo=class{['_sourceResourceBalloons']=new Map();_bodyCollection;['_locale'];['_config'];constructor(_0xe0995a,_0x4d5bd6,_0x6880d6){this['_locale']=_0xe0995a,this['_bodyCollection']=_0x4d5bd6,this['_config']=_0x6880d6;}['showSourceResourcesBalloon']({source:_0x1aa7bd,withBackButton:_0x42dde0}){let _0x334153=this['_sourceResourceBalloons']['get'](_0x1aa7bd['id']);_0x334153||(_0x334153=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x1aa7bd['id'],_0x334153),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x334153)),this['_addSourceResourceContent']({'balloonPanel':_0x334153,'source':_0x1aa7bd,'withBackButton':_0x42dde0}),_0x334153['show']();const _0x2e3549=this['_config']['getTargetElement']();_0x2e3549&&_0x334153['pin']({'target':_0x2e3549,'limiter':this['_config']['getLimiterElement']()});}populateSourceResourceBalloon(_0x21ca7f,_0x59ab4d,_0x4e5a1b){const _0x11441a=this['_sourceResourceBalloons']['get'](_0x21ca7f);if(!_0x11441a)return;const _0x27ddbb=this['_getResourcesViewFromBalloon'](_0x11441a);_0x27ddbb&&(_0x27ddbb['setResources'](_0x59ab4d,_0x4e5a1b),_0x27ddbb['once']('change:isLoading',()=>{_0x11441a['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x1af658){const _0x41c9e1=this['_sourceResourceBalloons']['get'](_0x1af658);_0x41c9e1&&requestAnimationFrame(()=>{_0x41c9e1['hide'](),this['_sourceResourceBalloons']['delete'](_0x1af658),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x52dab6 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x52dab6);}['isAnyResourceBalloonVisible'](){for(const _0x15591b of this['_sourceResourceBalloons']['values']())if(_0x15591b['isVisible'])return!0x0;return!0x1;}updateResourceState(_0x180dc9,_0x5b2e65,_0x4bb635){const _0x1bc070=this['_sourceResourceBalloons']['get'](_0x180dc9);if(!_0x1bc070||!_0x1bc070['isVisible'])return;const _0x4434c3=this['_config']['getTargetElement']();if(!_0x4434c3)return;_0x1bc070['pin']({'target':_0x4434c3,'limiter':this['_config']['getLimiterElement']()});const _0x42a2e4=this['_getResourcesViewFromBalloon'](_0x1bc070);_0x42a2e4&&_0x42a2e4['updateResourceState'](_0x5b2e65,_0x4bb635);}destroy(){for(const _0x2413f5 of this['_sourceResourceBalloons']['values']())_0x2413f5['destroy']();this['_sourceResourceBalloons']['clear']();}_createSourceResourceBalloonPanel(){const _0x54eaa1=new Pt(this['_locale']);return _0x54eaa1['extendTemplate']({'attributes':{'class':Wo}}),this['_bodyCollection']['add'](_0x54eaa1),_0x54eaa1;}_addSourceResourceContent({balloonPanel:_0x5cb62e,source:_0x22bc5a,withBackButton:_0x23f1b8}){_0x5cb62e['content']['clear']();const _0x5d0f3a=this['_createBalloonHeader']({'balloonPanel':_0x5cb62e,'source':_0x22bc5a,'withBackButton':_0x23f1b8});_0x5cb62e['content']['add'](_0x5d0f3a);const _0x1c47e1=this['_createBalloonResourcesView'](_0x22bc5a);_0x5cb62e['content']['add'](_0x1c47e1);}_createBalloonHeader({balloonPanel:_0x3bd446,source:_0x68a647,withBackButton:_0x5a7429}){const _0x13d1fa=new Yt(this['_locale'],{'label':_0x68a647['label'],'class':$o});return _0x5a7429&&_0x13d1fa['children']['add'](this['_createBackButton'](_0x3bd446),0x0),_0x13d1fa;}_createBackButton(_0x2d175a){const _0x226366=new Vt(this['_locale']);return _0x226366['set']({'icon':_0x406e30,'tooltip':Ts(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':Yo}),_0x226366['on']('execute',()=>{_0x2d175a['hide'](),this['_config']['onBackToContext']();}),_0x226366;}_createBalloonResourcesView(_0x58829c){const _0x30f0f7=new Ko(this['_locale'],{'source':_0x58829c,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x30f0f7['on']('loadSourceResources',(_0xb1f4ef,_0x1848ac)=>{this['_config']['onLoadSourceResources'](_0x1848ac);}),_0x30f0f7['on']('addResourceToContext',(_0x910230,_0x28a7dd)=>{this['_config']['onResourceSelected'](_0x28a7dd['source'],_0x28a7dd['resource']),this['closeSourceResourceBalloon'](_0x58829c['id']);}),_0x30f0f7;}_getResourcesViewFromBalloon(_0x1142dc){const _0x50b37d=_0x1142dc['content']['get'](0x1);return _0x50b37d instanceof Ko?_0x50b37d:null;}_setupSingleResourceBalloonClickOutsideHandler(_0x26794e){_0x1a4c41({'emitter':_0x26794e,'contextElements':[_0x26794e['element']],'callback':()=>{_0x26794e['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x26794e['isVisible']});}};const Qo=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Xo='ck-ai-chat-context-controls',zo='ck-ai-chat-context-controls__pending-contexts',jo='ck-ai-chat-context-controls__add-context-balloon-panel',Jo='ck-ai-chat-context-controls__add-context-button',Zo='ck-ai-chat-context-controls__url-balloon-panel',ta='ck-ai-chat-context-controls__balloon-button',ea='ck-ai-chat-context-controls__balloon-button-source',ia='ck-ai-chat-controls-button',sa='ck-ai-chat-context-chips-wrapper-balloon',na='ck-ai-chat-controls_context_show-more-button',ra='ck-ai-chat-context-controls__show-more-balloon-panel',oa='ck-ai-chat',aa=[Pt['defaultPositions']['northArrowSouthWest'],Pt['defaultPositions']['northArrowSouth'],Pt['defaultPositions']['northArrowSouthEast'],Pt['defaultPositions']['southArrowNorthWest'],Pt['defaultPositions']['southArrowNorth'],Pt['defaultPositions']['southArrowNorthEast']];var ha=class extends _0x4f75f8{addContextButtonView;_currentContextsChips=this['createCollection']();_conversationContextsChips=this['createCollection']();['_overflowManager'];_addContextBalloonPanelView;['_urlBalloonPanelView'];_urlInputView;['_resourcesBalloonView'];_addContextBalloonConfig;_hasExactlyOneSource=!0x1;bodyCollection;constructor(_0x4cb037,_0x349390){super(_0x4cb037),this['bodyCollection']=_0x349390['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x4cb037),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x4cb037),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x4cb037),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x4cb037,_0x349390);const _0xd5f103={'cssClasses':{'showMoreButton':na+'\x20'+Mn,'showMoreBalloon':ra,'overflowContainer':sa,'controlsButton':ia}};this['_overflowManager']=new zr(_0x4cb037,this['_currentContextsChips'],_0xd5f103,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(_0x402b13,_0x42cbb5){const _0x93fef2=this['_createContextButton'](_0x402b13,'current',!0x0,_0x42cbb5);this['_addContextToCollection'](_0x93fef2,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}removeContextItem(_0x7bb49d){this['_removeContextFromCollection'](_0x7bb49d,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x7bb49d,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}setContextItemLoading(_0x2499cc,_0x1ac74b){let _0x30b39f=this['_currentContextsChips']['find'](_0x5be87b=>_0x5be87b['id']===_0x2499cc);_0x30b39f||(_0x30b39f=this['_overflowManager']['overflowChips']['find'](_0xa872b2=>_0xa872b2['id']===_0x2499cc)),_0x30b39f&&(_0x30b39f['isLoading']=_0x1ac74b);}setConversationContext(_0x54c81c){this['_conversationContextsChips']['clear']();for(const _0x4aa8a8 of _0x54c81c){const _0xdfd8a3=this['_createContextButton'](_0x4aa8a8,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0xdfd8a3,this['_conversationContextsChips']);}}clearCurrentContextItems(){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}clearConversationContextItems(){this['_conversationContextsChips']['clear']();}updateResourceState(_0x3e7e7e,_0x3371c8,_0x1344b4){this['_resourcesBalloonView']['updateResourceState'](_0x3e7e7e,_0x3371c8,_0x1344b4);}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:_0x57d87c,withBackButton:_0x2d36f8}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x57d87c,'withBackButton':_0x2d36f8}),this['addContextButtonView']['isOn']=!0x0;}populateSourceResourceBalloon(_0x43df05,_0x3a4a06,_0x5904dc,_0x1816fb){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x43df05,_0x5904dc,_0x1816fb);}['closeSourceResourceBalloon'](_0x3abb5d){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x3abb5d),this['addContextButtonView']['isOn']=!0x1;}setAddContextOptions(_0x350c00){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x350c00),this['_setAddContextButtonEnabled'](_0x350c00);}_setAddContextButtonEnabled(_0x395d62){const _0x26fa32=!_0x395d62['document']['isHidden']&&_0x395d62['document']['enabled'],_0x19f469=_0x395d62['urls']['enabled'],_0x554f1f=_0x395d62['files']['enabled'],_0x5a0557=_0x395d62['sources']['length']>0x0,_0x15a506=_0x395d62['customItems']&&_0x395d62['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x26fa32||_0x19f469||_0x554f1f||_0x5a0557||_0x15a506;}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':[Xo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':zo},'children':this['_currentContextsChips']}]});}_bindEventHandlers(){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}_createAddContextButtonView(_0x10ac4f){const _0x3b0459=new Vt(_0x10ac4f);return _0x3b0459['set']({'label':Ts(_0x10ac4f,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':ia+'\x20'+Jo+'\x20'+Mn,'icon':_0x52ed99,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x3b0459;}_createAddContextBalloonPanelView(_0x437941){return this['_createBaseBalloonPanel'](_0x437941,jo);}_createUrlBalloonPanelView(_0x2daec9){const _0x3bd0dc=this['_createBaseBalloonPanel'](_0x2daec9,Zo);return this['_addUrlContent'](_0x3bd0dc,_0x2daec9),_0x3bd0dc;}_createResourcesBalloonView(_0x3e2bd2,_0x343f7a){const _0x9e9a4b={'searchInputVisibleFrom':_0x343f7a['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa});},'onResourceSelected':(_0x3bbe56,_0x2f3b69)=>{this['fire']('addResourceToContext',{'source':_0x3bbe56,'resource':_0x2f3b69});},'onLoadSourceResources':_0x13c217=>{this['fire']('loadSourceResources',_0x13c217);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new qo(_0x3e2bd2,_0x343f7a['bodyCollection'],_0x9e9a4b);}_getLimiterElement(){return this['element']?.['closest']('.'+oa)||document['body'];}_createBaseBalloonPanel(_0x45305a,_0x20de81){const _0x56fe25=new Pt(_0x45305a);return _0x56fe25['extendTemplate']({'attributes':{'class':_0x20de81}}),this['bodyCollection']['add'](_0x56fe25),_0x56fe25;}_setBalloonPanelContent(_0x276b6e,_0x34680b,_0x283641){if(_0x276b6e['content']['clear'](),!_0x283641['document']['isHidden']&&_0x283641['document']['enabled']){const _0x21ee26=this['_createBalloonButton'](_0x34680b,{'label':Ts(_0x34680b,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x36b436});_0x21ee26['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x276b6e['content']['add'](_0x21ee26);}if(_0x283641['urls']['enabled']){const _0x5bed32=this['_createBalloonButton'](_0x34680b,{'label':Ts(_0x34680b,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x305afd});_0x5bed32['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa}),this['_urlInputView']['focus']();}),_0x276b6e['content']['add'](_0x5bed32);}if(_0x283641['files']['enabled']){const _0x2aa5be=new Kt(_0x34680b);_0x2aa5be['set']({'label':Ts(_0x34680b,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x12e5f0,'withText':!0x0,'tooltip':!0x0,'class':ta,'allowMultipleFiles':!0x0}),_0x2aa5be['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x2aa5be['on']('done',(_0x1a0f7b,_0x462547)=>{this['fire']('addFileToContext',_0x462547);}),_0x2aa5be['tooltip']=!0x0,_0x276b6e['content']['add'](_0x2aa5be);}for(const _0x140d2a of _0x283641['sources']){const _0x502661=this['_createBalloonButton'](_0x34680b,{'label':_0x140d2a['label'],'icon':_0x140d2a['icon']||_0x5133a4,'type':'source'});_0x276b6e['content']['add'](_0x502661),_0x502661['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x140d2a,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x3dae70 of _0x283641['customItems']||[]){const _0x447c68=this['_createBalloonButton'](_0x34680b,{'label':_0x3dae70['label'],'icon':_0x3dae70['icon']||_0x5133a4,'type':'customItem'});_0x276b6e['content']['add'](_0x447c68),_0x447c68['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x3dae70);});}this['_hasExactlyOneSource']=0x1===_0x276b6e['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}_addUrlContent(_0x4bd834,_0x54944f){this['_urlInputView']=new Po(_0x54944f),this['_urlInputView']['on']('submitUrl',(_0x591c7d,_0x2502eb)=>{this['_handleUrlSubmit'](_0x2502eb);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa});}),_0x4bd834['content']['add'](this['_urlInputView']);}_createBalloonButton(_0x265491,_0x5e22d4){const _0x4a33ce='source'===_0x5e22d4['type']?new ca(_0x265491):new Vt(_0x265491);return _0x4a33ce['set']({'label':_0x5e22d4['label'],'icon':_0x5e22d4['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':ta}),_0x4a33ce;}_setupAllBalloonClickOutsideHandlers(){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}_setupUrlBalloonClickOutsideHandler(){_0x1a4c41({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}_toggleAddContextBalloon(_0x1b1f9c){const _0xba15a6=this['_addContextBalloonConfig'];_0xba15a6['buttonView']['isOn']=_0x1b1f9c,_0x1b1f9c?_0xba15a6['balloonView']['show']():_0xba15a6['balloonView']['hide']();}_setupAddContextBalloonClickOutsideHandler(){const {balloonView:_0x3e4061,buttonView:_0x3359,hideMethod:_0x5e0d81}=this['_addContextBalloonConfig'];_0x1a4c41({'emitter':_0x3e4061,'contextElements':[_0x3e4061['element'],_0x3359['element']],'callback':()=>{_0x5e0d81();},'activator':()=>_0x3359['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}_createContextButton(_0x354311,_0x2e7a66,_0x2a75d1=!0x1,_0x376e12=!0x1){const _0x4685ca='conversation'===_0x2e7a66||!0x0===_0x354311['isReadOnly'],_0xf26e95=new $r(this['locale'],_0x354311,_0x4685ca,_0x2a75d1,_0x376e12);return _0x4685ca||_0xf26e95['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0xf26e95['id']);}),_0xf26e95;}_addContextToCollection(_0x2323a5,_0x4e0532){_0x4e0532['add'](_0x2323a5,0x0);}_removeContextFromCollection(_0x59ab41,_0x52ec27){const _0x4aed6d=_0x52ec27['find'](_0x155c5e=>_0x155c5e['id']===_0x59ab41);_0x4aed6d&&_0x52ec27['remove'](_0x4aed6d);}_handleAddContextButtonClick(){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':aa}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}_handleUrlSubmit(_0x4c9a50){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x4c9a50);}},ca=class extends Vt{['arrowView'];constructor(_0x3a69e3){super(_0x3a69e3),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[ea]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x1d1b17=new Qt();return _0x1d1b17['content']=_0x630c7e,_0x1d1b17['extendTemplate']({'attributes':{'class':ea+'__arrow'}}),_0x1d1b17;}},la=class extends _0x4f75f8{_cancelButtonView;['_loaderView'];constructor(_0x7f6108){super(_0x7f6108),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 _0x65b40e=new Vt(this['locale']);return _0x65b40e['set']({'label':Ts(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Hn+'\x20ck-ai-button-stop-generating','icon':st}),_0x65b40e['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x65b40e;}_createLoaderView(){const _0x18affd=new _0x4f75f8(this['locale']);return _0x18affd['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':Ts(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x18affd;}},ua=class extends _0x4f75f8{_contextPanelView;_promptInputView;['_dropZoneView'];_promptCapabilitiesView;['_loaderView'];['_modelUnavailableMessageView'];_shouldRestorePromptInputFocus;['_filesEnabled'];constructor(_0x452a74,_0x3f2755){super(_0x452a74),this['_filesEnabled']=_0x3f2755['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x452a74,{'bodyCollection':_0x3f2755['bodyCollection'],'searchInputVisibleFrom':_0x3f2755['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x452a74),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x452a74),this['_loaderView']=this['_createLoaderView'](_0x452a74),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x452a74),this['_dropZoneView']=new po(_0x452a74),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_dropZoneView']['bind']('isEnabled')['to'](this,'isLoading',_0x390ff9=>!_0x390ff9),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'](...Qo)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x61b16=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x61b16['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x61b16['if']('isLoading','ck-hidden',_0x5c67cd=>_0x5c67cd||!this['isModelAvailable']),_0x61b16['if']('isModelAvailable','ck-hidden',_0x2dfccc=>!_0x2dfccc||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x61b16['if']('isLoading','ck-hidden',_0x4e2943=>!_0x4e2943)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x61b16['if']('isModelAvailable','ck-hidden',_0x3b3f7e=>_0x3b3f7e)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x1a4c41({'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(_0x2fb841,_0x5ad03b){return new ha(_0x2fb841,_0x5ad03b);}_createPromptInputView(_0x21b56d){return new Io(_0x21b56d,this['_contextPanelView']['addContextButtonView']);}_createPromptCapabilitiesView(_0x140594){return new No(_0x140594);}_createLoaderView(_0x271c8b){return new la(_0x271c8b);}_createModelUnavailableMessageView(_0x216a3f){const _0x167c3a=new da(_0x216a3f);return _0x167c3a['delegate']('startConversation')['to'](this),_0x167c3a;}_handlePromptInputFocus(_0x31ba14,_0x2258c4,_0x1b29a9){_0x1b29a9?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}addContextItem(_0x40510a,_0x21130f){this['_contextPanelView']['addContextItem'](_0x40510a,_0x21130f);}removeContextItem(_0x2e2cbb){this['_contextPanelView']['removeContextItem'](_0x2e2cbb);}setContextItemLoading(_0x51ea15,_0x19512a){this['_contextPanelView']['setContextItemLoading'](_0x51ea15,_0x19512a);}setIsUploadInProgress(_0x51a392){this['_promptInputView']['setIsUploadInProgress'](_0x51a392);}setConversationContext(_0x52d970){this['_contextPanelView']['setConversationContext'](_0x52d970);}clearPendingContextUI(){this['_contextPanelView']['clearCurrentContextItems']();}clearConversationContextUI(){this['_contextPanelView']['clearConversationContextItems']();}updateResourceState(_0x1efddc,_0x530135,_0x580275){this['_contextPanelView']['updateResourceState'](_0x1efddc,_0x530135,_0x580275);}setWebSearch(_0x38eb97){this['_promptCapabilitiesView']['setWebSearch'](_0x38eb97);}setReasoning(_0x57c2bb){this['_promptCapabilitiesView']['setReasoning'](_0x57c2bb);}resetMessageInput(){this['_promptInputView']['reset']();}setAddContextOptions(_0x34e14b){this['_contextPanelView']['setAddContextOptions'](_0x34e14b);}setInputPlaceholder(_0x309c69){this['_promptInputView']['setPlaceholderText'](_0x309c69);}setModelList(_0x6da516,_0x348b31){this['_promptCapabilitiesView']['setModelList'](_0x6da516,_0x348b31);}setModel(_0x1876cd){_0x1876cd?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x1876cd)):this['isModelAvailable']=!0x1;}enableModelSelector(){this['_promptCapabilitiesView']['enableModelSelector']();}disableModelSelector(_0x3ded18){this['_promptCapabilitiesView']['disableModelSelector'](_0x3ded18);}populateSourceResourceBalloon(_0x2cc7d8,_0x5a0f62,_0x888375,_0xb3563e){this['_contextPanelView']['populateSourceResourceBalloon'](_0x2cc7d8,_0x5a0f62,_0x888375,_0xb3563e);}['closeSourceResourceBalloon'](_0x15b0d4){this['_contextPanelView']['closeSourceResourceBalloon'](_0x15b0d4);}focusPromptInput(_0x168c55=!0x1){this['_promptInputView']['focus'](_0x168c55);}setPromptInputValue(_0x47f729){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x47f729;}},da=class extends _0x4f75f8{constructor(_0x3c979d){super(_0x3c979d);const _0x53bc99=new Vt(_0x3c979d);_0x53bc99['set']({'label':Ts(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x53bc99['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Ts(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x53bc99]}]});}},_a=class extends Yt{resizeButton;constructor(_0x324c8f,_0x146e6c){super(_0x324c8f,{'label':_0x146e6c['label'],'class':'ck-ai-header\x20'+_0x146e6c['class'],'icon':_0x146e6c['icon']}),this['set']('isMaximized',!0x1),_0x146e6c['content']&&this['children']['add'](_0x146e6c['content']),_0x146e6c['showResizeButton']&&(this['resizeButton']=Un(_0x324c8f,this),this['children']['add'](this['resizeButton']));}},ga=class extends _0x4f75f8{constructor(_0x58a1d5){super(_0x58a1d5),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Ts(_0x58a1d5,'AI_DISCLAIMER_TEXT')}]}]});}};function Aa(_0x5b91c9,_0xaf344f){const _0x35f2fb=new Vt(_0x5b91c9);return _0x35f2fb['set']({'label':Ts(_0x5b91c9,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0xd49c1e,'class':'ck-ai-chat__start-conversation\x20'+Hn}),_0x35f2fb['on']('execute',()=>{_0xaf344f['fire']('startConversation');}),_0x35f2fb;}var Ia=class extends _0x4f75f8{chatHeader;chatFeed;chatControls;chatDisclaimer;_bodyCollection;constructor(_0x543283,_0x38f310){super(_0x543283),this['_bodyCollection']=Vn(_0x543283);const _0xc7b4d4=Aa(_0x543283,this);this['chatHeader']=new _a(_0x543283,{'label':Ts(_0x543283,'AI_CHAT_HEADING'),'icon':_0x55e1ac,'class':'ck-ai-header_chat','content':_0xc7b4d4,'showResizeButton':_0x38f310['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new uo(_0x543283,this['_bodyCollection']),this['chatFeed']['delegate'](...rr)['to'](this),this['chatControls']=new ua(_0x543283,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x38f310['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x38f310['filesEnabled']}),this['chatControls']['delegate'](...rr)['to'](this),this['chatDisclaimer']=new ga(_0x543283),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x543283['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}populateSourceResourceBalloon(_0x30bf44,_0x257e0e,_0x28b5f7,_0x4c78bb){this['chatControls']['populateSourceResourceBalloon'](_0x30bf44,_0x257e0e,_0x28b5f7,_0x4c78bb);}['closeSourceResourceBalloon'](_0x103c46){this['chatControls']['closeSourceResourceBalloon'](_0x103c46);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},pa=class extends _0x45fe7d{static get requires(){return[Is];}['_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;get['idleUiPromise'](){return this['_promiseQueue']['queueEmptyPromise'];}constructor(_0x38ec83){super(_0x38ec83);const _0x48e02e=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['set']('isChatStreaming',!0x1),this['_promiseQueue']=new Or(),this['_view']=new Ia(this['context']['locale'],{'showResizeButton':_0x48e02e['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'](_0x48e02e),this['_view']['delegate'](...rr)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x41171e,{showDiff:_0x45650d})=>{this['showDiff']=_0x45650d;}),this['disableControls'](),_0x48e02e['view']['addTab']({'id':'chat','buttonLabel':Ts(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x55e1ac,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x48e02e['view'],'isMaximized',_0x8252f0=>_0x8252f0),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isChatStreaming',_0x595299=>_0x595299),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}destroy(){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}createConversation({availableModels:_0x13415c}){const _0x2f7be0=this['context']['config']['get']('ai.chat.welcomeMessage')??Ts(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x13415c,!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x2f7be0}),this['fire']('conversationCreated');}async addFeedItemStaticMessage({id:_0x14792a,staticMessage:_0x2f192a}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x14792a,'initialContent':'<p>'+_0x2f192a+'</p>'});});}async addFeedItemUserMessage(_0x57f5a6){const _0x18cbf0=_0x57f5a6['attributes']?.['displayedPrompt']||_0x57f5a6['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x57f5a6['contextItems']['values']()),'initialContent':'<p>'+_0x18cbf0+'</p>','id':_0x57f5a6['id']});});}async addFeedItemError({errorMessage:_0x3b22b2,id:_0x1e090b}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x3b22b2+'</p>','id':_0x1e090b});});}async addFeedItemAIReply(_0x1152e4){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x1152e4['interactionId']+':'+_0x1152e4['id']}),this['clearLoadingMessage']();});}async addFeedItemAISuggestion(_0x4569d4){const _0x135bbc=Rs(this['context']),_0x914fa9=_0x135bbc['map'](_0x47594a=>_0x47594a['config']['get']('ai.availableReplyActions')||[...kr]);let _0x30398c=_0x914fa9['reduce']((_0x44e244,_0x9e6332)=>_0x44e244['filter'](_0x401a60=>_0x9e6332['includes'](_0x401a60)),_0x914fa9[0x0]||[...kr]);const _0x185d86=_0x135bbc['every'](_0x329984=>_0x329984['plugins']['has']('TrackChanges')),_0x10645d=_0x135bbc['map'](_0x295ad4=>_0x295ad4['commands']['get']('trackChanges'));return _0x185d86?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x10645d,'value',(..._0x3fad4f)=>_0x3fad4f['some'](_0x403bef=>_0x403bef))):_0x30398c=_0x30398c['filter'](_0x6b410b=>'insertSuggestion'!=_0x6b410b),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x4569d4['interactionId']+':'+_0x4569d4['id'],'areActionsDisabled':_0x4569d4['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x30398c}),this['clearLoadingMessage']();});}async addFeedInteractionHeader(_0x2ccda9,_0x4fce34){return this['_promiseQueue']['enqueue'](async()=>{const _0x1af6a9=this['_view']['chatFeed']['children']['last'];if(_0x1af6a9 instanceof ro)return this['_view']['chatFeed']['children']['remove'](_0x1af6a9),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x2ccda9['id'],'capabilities':{'isWebSearchEnabled':_0x1af6a9['capabilities']['isWebSearchEnabled']||_0x4fce34['isWebSearchEnabled'],'isReasoningEnabled':_0x1af6a9['capabilities']['isReasoningEnabled']||_0x4fce34['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x2ccda9['id'],'capabilities':_0x4fce34});});}async addFeedItemCustomElement(_0x2339ce,_0x1cde82){let _0xed3b81;return await this['_promiseQueue']['enqueue'](async()=>{_0xed3b81=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x2339ce,'id':_0x1cde82});}),_0xed3b81;}removeFeedItem(_0x4442a7){this['_view']['chatFeed']['removeItem'](_0x4442a7);}hasFeedItem(_0x4e029a){return this['_view']['chatFeed']['hasItem'](_0x4e029a);}updateFeedInteractionHeader(_0x384f6b){const _0x5ed35f=this['_view']['chatFeed']['children']['find'](_0x1e198b=>_0x1e198b['options']['id']==_0x384f6b['id']&&_0x1e198b instanceof ro);_0x5ed35f&&_0x5ed35f['set']('isVisible',_0x384f6b['isVisible']);}async updateFeedItemAIReplyContent(_0x503758){const _0x374e42=_0x503758['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x85b9ea=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x503758,'abortSignal':_0x85b9ea,'renderingStrategy':_0x374e42}),_0x503758['isDone']&&this['markFeedItemAsDone'](_0x503758['id']);});}updateFeedItemAIReplySources(_0x53869e,_0x1c78a1){this['_view']['chatFeed']['updateWebSources'](_0x53869e,_0x1c78a1);}async updateFeedItemAIReplySuggestionContent(_0x36c030){return this['_promiseQueue']['enqueue'](async _0x4f6baa=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x36c030,'abortSignal':_0x4f6baa}),_0x36c030['isDone']&&this['markFeedItemAsDone'](_0x36c030['id']);});}updateFeedItemAIReplySuggestionPartState(_0x202981){this['_view']['chatFeed']['updateSuggestionPartState'](_0x202981);}setSuggestionGating(_0x2bf17b,_0x4c52ad){this['_view']['chatFeed']['updateSuggestionGating'](_0x2bf17b,_0x4c52ad);}setFeedItemAIReplySuggestionPartActive(_0xbd160e){this['_view']['chatFeed']['setSuggestionPartActive'](_0xbd160e);}markFeedItemAsDone(_0xb51ffa){this['_view']['chatFeed']['markItemAsDone'](_0xb51ffa);}removeFeedInteraction(_0x52dc7c){this['_view']['chatFeed']['getItemIds']()['filter'](_0x47e9a9=>_0x47e9a9['startsWith'](_0x52dc7c))['forEach'](_0x3f9fdf=>this['_view']['chatFeed']['removeItem'](_0x3f9fdf));}startInteraction(){const _0x355468=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x355468),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['isChatStreaming']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}stopInteraction(_0x4586d7){this['_promiseQueue']['abort'](),_0x4586d7&&this['_view']['chatFeed']['getItemIds']()['filter'](_0x27299f=>_0x27299f['startsWith'](_0x4586d7['id']))['forEach'](_0x398548=>this['markFeedItemAsDone'](_0x398548)),this['resetChatBusyStateToIdle']();}resetChatBusyStateToIdle(){this['isBusy']=!0x1,this['isChatStreaming']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async finishInteraction(){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['resetChatBusyStateToIdle']();});}addContextItem(_0x533664,_0x2a8778){this['_view']['chatControls']['addContextItem'](_0x533664,_0x2a8778);}removeContextItem(_0x48807f){this['_view']['chatControls']['removeContextItem'](_0x48807f);}setContextItemLoading(_0x4474dc,_0x1e8769){this['_view']['chatControls']['setContextItemLoading'](_0x4474dc,_0x1e8769);}setIsUploadInProgress(_0xad630){this['_view']['chatControls']['setIsUploadInProgress'](_0xad630);}setConversationContext(_0x246960){this['_view']['chatControls']['setConversationContext'](_0x246960);}clearPendingContextUI(){this['_view']['chatControls']['clearPendingContextUI']();}clearConversationContextUI(){this['_view']['chatControls']['clearConversationContextUI']();}updateResourceState(_0xe01de0,_0x13f580,_0x525ffe){this['_view']['chatControls']['updateResourceState'](_0xe01de0,_0x13f580,_0x525ffe);}resetMessageInput(){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}setAddContextOptions(_0x94b2c0){this['_view']['chatControls']['setAddContextOptions'](_0x94b2c0);}updateCapabilities(_0x8d7590){this['_view']['chatControls']['setWebSearch'](_0x8d7590['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x8d7590['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x8d7590));}setSelectedModel(_0x143d9b,_0x1f30d1){this['_view']['chatControls']['setModel'](_0x143d9b),_0x1f30d1&&this['_view']['chatControls']['disableModelSelector'](!0x1);}setFeedItemRenderingStrategy(_0x220494){this['feedItemRenderingStrategy']=_0x220494;}toggleLoadingSkeleton(_0xafe392){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0xafe392);}resetConversationTitle(){this['setConversationTitle'](Ts(this['context']['locale'],'AI_CHAT_HEADING'));}emptyConversationTitle(){this['setConversationTitle']('');}setConversationTitle(_0x3dcefc,_0x792fef=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x792fef&&!Et()&&_0x3dcefc['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x3dcefc);this['_view']['chatHeader']['label']=_0x3dcefc;}setLoadingMessage(_0x5af6b5){this['_view']['chatFeed']['setLoadingMessage'](_0x5af6b5);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}_animateConversationTitle(_0x534168){let _0x5c565d=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x534168[_0x5c565d],_0x5c565d++,_0x5c565d===_0x534168['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x2ba06f){return _0x2ba06f['isWebSearchEnabled']&&_0x2ba06f['isReasoningEnabled']?Ts(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x2ba06f['isWebSearchEnabled']?Ts(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x2ba06f['isReasoningEnabled']?Ts(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Ts(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}_getInputPlaceholder(_0xffec72){return _0xffec72?_0xffec72['isWebSearchEnabled']&&_0xffec72['isReasoningEnabled']?Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0xffec72['isWebSearchEnabled']?Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0xffec72['isReasoningEnabled']?Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Ts(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}populateSourceResourceBalloon(_0x18741d,_0x370bda,_0x442ee9,_0x515838){this['_view']['populateSourceResourceBalloon'](_0x18741d,_0x370bda,_0x442ee9,_0x515838);}['closeSourceResourceBalloon'](_0x5c982b){this['_view']['closeSourceResourceBalloon'](_0x5c982b);}setPromptInputValue(_0x448a58){this['_view']['chatControls']['setPromptInputValue'](_0x448a58);}focusPromptInput(_0x1cb305=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x1cb305);}scrollFeedToSuggestion(_0x1de1a0,_0x390677){this['_view']['chatFeed']['scrollToSuggestion'](_0x1de1a0,_0x390677);}startAutoScroll(_0x1f3f2d={}){this['_view']['chatFeed']['startAutoScroll'](_0x1f3f2d);}stopAutoScroll(){this['_view']['chatFeed']['stopAutoScroll']();}disableControls(){this['_view']['chatControls']['isDisabled']=!0x0;}enableControls(){this['_view']['chatControls']['isDisabled']=!0x1;}toggleConversationLoading(_0x390306){_0x390306?(this['isBusy']=_0x390306,this['disableControls']()):(this['enableControls'](),this['resetChatBusyStateToIdle']());}},Ea=class extends te{sections;constructor(_0x270d10,_0x108419){super(_0x270d10),this['sections']=_0x108419,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}filter(_0x3db960){let _0x28ac1e=0x0,_0x2c8d44=0x0;for(const _0x2842f5 of this['sections']){const {resultsCount:_0x46026f,totalItemsCount:_0x135b90}=_0x2842f5['filter'](_0x3db960);_0x28ac1e+=_0x46026f,_0x2c8d44+=_0x135b90;}return{'resultsCount':_0x28ac1e,'totalItemsCount':_0x2c8d44};}},ma=class extends Zt{title;itemsViews;_itemsListView;constructor(_0x17a93c,{title:_0x5a9d58,items:_0x11ab59}){super(_0x17a93c);const _0x2014af=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x5a9d58,this['itemsViews']=_0x11ab59;const _0x253368=new _0x4f75f8(_0x17a93c);_0x253368['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new te(_0x17a93c),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x2014af['if']('isVisible','ck-hidden',_0x3368ab=>!_0x3368ab)]},'children':[_0x253368,this['_itemsListView']]});}filter(_0x55ec5f){const _0x4694d4=this['itemsViews']['length'];let _0x238c9a=0x0;for(const _0x244030 of this['itemsViews'])_0x55ec5f?(_0x244030['isVisible']=!!_0x244030['isMatching'](_0x55ec5f),_0x244030['highlightText'](_0x55ec5f)):(_0x244030['isVisible']=!0x0,_0x244030['highlightText'](null)),_0x244030['isVisible']&&_0x238c9a++;return this['isVisible']=_0x238c9a>0x0,{'resultsCount':_0x238c9a,'totalItemsCount':_0x4694d4};}getItem(_0x33ae7c){return this['itemsViews']['find'](_0x3d3744=>_0x3d3744['id']===_0x33ae7c);}removeItem(_0x551ca3){const _0x388094=this['itemsViews']['indexOf'](_0x551ca3);-0x1!==_0x388094&&(this['itemsViews']['splice'](_0x388094,0x1),this['_itemsListView']['items']['remove'](_0x551ca3));}};const Ta=/* #__PURE__ -- @preserve */
34
- _0x1a5634(Zt);var wa=class AIChatHistoryListItemView extends Ta{['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(_0x4f4910,_0x44ad85){super(_0x4f4910);const _0x127cd3=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x44ad85['pinned']),this['set']('loadingState',null),this['set']('title',_0x44ad85['title']),this['id']=_0x44ad85['id'];const {createdAt:_0x3af39f,active:_0xbfa0f2=!0x1}=_0x44ad85;this['_titleView']=new qt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x442a00=this['_createCheckView'](),_0x54e954=this['_createPinButtonView'](_0x4f4910),_0x4f0614=this['_createMenuDropdownView'](),_0x5ba80b=this['_createEditInputView'](_0x4f4910),_0x56f171=this['_createAcceptEditButtonView'](_0x4f4910,_0x5ba80b),_0x1231f4=this['_createCancelEditButtonView'](_0x4f4910);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x54e954),this['actions']['add'](_0x4f0614),this['on']('change:isEdit',(_0x23e093,_0x57a5c3,_0x417f7a)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x417f7a?(this['actions']['add'](_0x56f171),this['actions']['add'](_0x1231f4),this['mainContent']['add'](_0x5ba80b),_0x5ba80b['element']['value']=this['title']||'',_0x5ba80b['element']['focus']()):(this['actions']['add'](_0x54e954),this['actions']['add'](_0x4f0614),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0xbfa0f2?'ck-ai-chat-history__item--active':'',_0x127cd3['if']('isVisible','ck-hidden',_0x2da92a=>!_0x2da92a),_0x127cd3['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',_0x127cd3['if']('loadingState','ck-hidden',_0x31b8a5=>!!_0x31b8a5)]},'children':_0xbfa0f2?[_0x442a00]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x127cd3['if']('loadingState','ck-hidden',_0x5536de=>!_0x5536de)]},'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',_0x127cd3['if']('loadingState','ck-hidden',_0x53860d=>!!_0x53860d)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x127cd3['if']('loadingState','ck-hidden',_0x16fbd1=>!_0x16fbd1)]},'children':[{'text':_0x127cd3['to']('loadingState',_0xf0bd1c=>_0xf0bd1c?Ts(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0xf0bd1c]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x3af39f]}]},{'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(_0x24219f){this['set']('title',_0x24219f);}updateLoadingState(_0x852eb5,_0x284e93){this['set']('loadingState',_0x284e93?_0x852eb5:null);}_createCheckView(){const _0x3c6d21=new Qt();return _0x3c6d21['set']({'content':_0x11611b}),_0x3c6d21;}_createPinButtonView(_0x5e9122){const _0xc15fcc=new Vt(_0x5e9122);return _0xc15fcc['set']({'label':Ts(_0x5e9122,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x185fef,'withText':!0x1,'tooltip':!0x0}),_0xc15fcc['bind']('isOn')['to'](this,'pinned'),_0xc15fcc['on']('execute',()=>{const _0x45ea2c=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x45ea2c});}),_0xc15fcc;}_createMenuDropdownView(){const _0x559379=_0x5c62d3(this['locale']),_0x3c3450=_0x559379['panelView']['children'];_0x559379['buttonView']['set']({'label':Ts(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':rt}),_0x559379['panelPosition']='sw';const _0xd9a16d=new Vt(this['locale']);_0xd9a16d['label']=Ts(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0xd9a16d['withText']=!0x0,_0xd9a16d['on']('execute',()=>{this['isEdit']=!0x0;});const _0x4540d6=new Vt(this['locale']);_0x4540d6['label']=Ts(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x4540d6['withText']=!0x0,_0x4540d6['on']('execute',()=>{this['showConfirm'](Ts(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x476084=new te(this['locale']),_0x2f1711=new Zt(this['locale']);_0x2f1711['children']['add'](_0xd9a16d);const _0x24a8ce=new Zt(this['locale']);return _0x24a8ce['children']['add'](_0x4540d6),_0x476084['items']['addMany']([_0x2f1711,_0x24a8ce]),_0x3c3450['add'](_0x476084),_0x559379;}_createEditInputView(_0x159329){const _0x5b3ede=new Xt(_0x159329),_0x1b6740=_0x5b3ede['bindTemplate'];return _0x5b3ede['extendTemplate']({'on':{'keydown':_0x1b6740['to'](_0x3056d2=>{'Enter'==_0x3056d2['key']&&this['_commitEditInputValue'](_0x5b3ede);})}}),_0x5b3ede;}_createAcceptEditButtonView(_0x9f691a,_0x469425){const _0x40a073=new Vt(_0x9f691a);return _0x40a073['set']({'icon':_0x11611b,'withText':!0x1,'tooltip':Ts(_0x9f691a,'AI_CHAT_HISTORY_ACCEPT')}),_0x40a073['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x40a073['on']('execute',()=>{this['_commitEditInputValue'](_0x469425);}),_0x40a073;}_commitEditInputValue(_0x6ea9d2){const _0x3ab9c9=_0x6ea9d2['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x3ab9c9});}_createCancelEditButtonView(_0xe2f03a){const _0xf03f83=new Vt(_0xe2f03a);return _0xf03f83['set']({'icon':_0x591646,'withText':!0x1,'tooltip':Ts(_0xe2f03a,'AI_CHAT_HISTORY_CANCEL')}),_0xf03f83['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0xf03f83['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0xf03f83;}_createSpinnerView(){const _0x579400=new Mr('tiny');return _0x579400['isVisible']=!0x0,_0x579400;}isMatching(_0x474bfe){return'string'==typeof this['title']&&this['title']['match'](_0x474bfe)?{'title':!0x0}:null;}highlightText(_0x219bda){this['_titleView']['highlightText'](_0x219bda);}},Ca=class extends _0x4f75f8{['headerView'];['searchView'];['mainErrorView'];skeletonView;emptyView;sectionsView;constructor(_0x5f484d,_0x17f6c6){super(_0x5f484d),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x3f5a06=Aa(_0x5f484d,this);this['headerView']=new _a(_0x5f484d,{'label':Ts(_0x5f484d,'AI_CHAT_HISTORY_HEADING'),'icon':_0x156574,'class':'ck-ai-header_history','content':_0x3f5a06,'showResizeButton':_0x17f6c6}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Ea(_0x5f484d,[]),this['sectionsView']['delegate'](...fa)['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',_0x53ff9d=>!_0x53ff9d)]}}),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 _0x2c73f9=new _0x2cb476(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Ts(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x2659b4=>Ts(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x2659b4),'secondary':Ts(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x2f13d8=this['_createErrorView']();return _0x2f13d8['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x5ef90a=>!_0x5ef90a)]}}),_0x2c73f9['on']('render',()=>{_0x2c73f9['children']['add'](_0x2f13d8,0x1);}),_0x2c73f9['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x2270c4=>!_0x2270c4)]}}),_0x2c73f9;}_createSkeletonView(){const _0x5b1a4c=new fr(this['locale'],br['aiHistory']);return _0x5b1a4c['bind']('isVisible')['to'](this,'isLoading'),_0x5b1a4c;}_createErrorView(){const _0x5366ab=new _0x4f75f8(this['locale']),_0x3f9feb=new Vt(this['locale']);_0x3f9feb['set']({'withText':!0x1,'icon':_0x591646,'class':'ck-ai-notification_error__dismiss-button'}),_0x3f9feb['bind']('isVisible')['to'](this,'hasItems',_0x67322=>!!_0x67322),_0x3f9feb['on']('execute',()=>{this['errorMessage']='';});const _0x130d6a=this['bindTemplate'];return _0x5366ab['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x130d6a['to']('errorMessage')}]},_0x3f9feb]}),_0x5366ab;}_createEmptyStateView(){const _0x1cfb88=new _0x4f75f8(this['locale']);return _0x1cfb88['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x3890ac=>!_0x3890ac)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Ts(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x1cfb88;}_createListItemViews(_0x5e1a35,_0x432865){const _0x5ee156=[];for(const _0x493885 of _0x5e1a35){const _0x243f95=new wa(_0x432865,_0x493885);_0x243f95['delegate'](...fa)['to'](this),_0x5ee156['push'](_0x243f95);}return _0x5ee156;}updateHistoryItemsWithCategories(_0x21a804){const _0x323a63=this['locale']||'en',_0xb64c3a=[];for(const _0xdafadb of _0x21a804){const _0x3bf04d=this['_createListItemViews'](_0xdafadb['items'],_0x323a63);_0xb64c3a['push'](new ma(_0x323a63,{'title':_0xdafadb['title'],'items':_0x3bf04d}));}this['sectionsView']['sections']=_0xb64c3a,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0xb64c3a),this['hasItems']=_0x21a804['some'](_0x342d44=>_0x342d44['items']['length']>0x0),this['_refreshSearch']();}removeHistoryItem(_0x1cbd76){for(const _0x51ceaf of this['sectionsView']['sections']){const _0x3db93c=_0x51ceaf['getItem'](_0x1cbd76);if(_0x3db93c){if(_0x51ceaf['removeItem'](_0x3db93c),0x0===_0x51ceaf['itemsViews']['length']){const _0x5542a5=this['sectionsView']['sections']['indexOf'](_0x51ceaf);-0x1!==_0x5542a5&&(this['sectionsView']['sections']['splice'](_0x5542a5,0x1),this['sectionsView']['items']['remove'](_0x51ceaf));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}updateItemTitle(_0x55c94b,_0x5cd7e5){for(const _0x47e792 of this['sectionsView']['sections']){const _0x387fcf=_0x47e792['getItem'](_0x55c94b);if(_0x387fcf){_0x387fcf['updateTitle'](_0x5cd7e5);break;}}}updateItemLoadingState(_0x1168cb,_0x39160d,_0x998e72){for(const _0x5048fe of this['sectionsView']['sections']){const _0x28e7d5=_0x5048fe['getItem'](_0x1168cb);if(_0x28e7d5){_0x28e7d5['updateLoadingState'](_0x39160d,_0x998e72);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x588657=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x588657);}}};const fa=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var ba=class extends _0x45fe7d{static get requires(){return[Is];}_historyView;static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3e34c9){super(_0x3e34c9);const _0x3a9a5e=this['context']['plugins']['get']('AITabs');this['_historyView']=new Ca(this['context']['locale'],_0x3a9a5e['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x3a9a5e),this['_historyView']['delegate'](...fa)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x3a9a5e['view'],'isMaximized',_0x159dee=>_0x159dee),_0x3a9a5e['view']['addTab']({'id':'history','buttonLabel':Ts(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x156574,'order':0x0,'content':this['_historyView']});}removeHistoryItem(_0x1bfbc6){this['_historyView']['removeHistoryItem'](_0x1bfbc6);}updateItems(_0x2978f1){this['_historyView']['updateHistoryItemsWithCategories'](_0x2978f1);}updateItemTitle(_0x47cc83,_0x222d86){this['_historyView']['updateItemTitle'](_0x47cc83,_0x222d86);}updateItemLoadingState(_0x1cb05f,_0x514327,_0x5daaf2){this['_historyView']['updateItemLoadingState'](_0x1cb05f,_0x514327,_0x5daaf2);}setLoadingSkeleton(_0x389327){this['_historyView']['isLoading']=_0x389327;}['showError'](_0x2a1f5d){this['_historyView']['errorMessage']=_0x2a1f5d;}['hideError'](){this['_historyView']['errorMessage']='';}};const Sa=/* #__PURE__ -- @preserve */
35
- At();var Ra=class extends Sa{['id'];createdAt;constructor({id:_0x3b5653,title:_0x2c99c8,createdAt:_0x57488b,updatedAt:_0x505e24,pinned:_0x9003fd}){super(),this['id']=_0x3b5653,this['createdAt']=new Date(_0x57488b),this['set']('title',_0x2c99c8),this['set']('updatedAt',_0x505e24?new Date(_0x505e24):null),this['set']('pinned',_0x9003fd||!0x1);}updateTitle(_0x17d866){this['set']('title',_0x17d866),this['updatedAt']=new Date();}updatePinned(_0x2cecee){this['set']('pinned',_0x2cecee),this['updatedAt']=new Date();}};const Oa=/* #__PURE__ -- @preserve */
36
- dt();var va=class extends Oa{items=[];connector;['group'];constructor({connector:_0xc34e6,group:_0x4e3897}){super(),this['connector']=_0xc34e6,this['group']=_0x4e3897;}async init(){try{const _0x4c2e67=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x4c2e67);}catch(_0x282052){this['fire']('error',{'error':_0x282052,'operation':'init'});}}addItem(_0x1230f0){this['items']['push'](_0x1230f0);}async removeItem(_0x1049f1){const _0x5b64eb=this['items']['findIndex'](_0x43b6a4=>_0x43b6a4['id']===_0x1049f1);if(-0x1===_0x5b64eb)return!0x1;try{return await this['connector']['deleteConversation'](_0x1049f1)['execute'](),this['items']['splice'](_0x5b64eb,0x1),this['fire']('itemRemoved',{'itemId':_0x1049f1}),!0x0;}catch(_0x2c375f){return this['fire']('error',{'error':_0x2c375f,'operation':'removeItem','itemId':_0x1049f1}),!0x1;}}getItem(_0x334cbe){return this['items']['find'](_0x2bb0ab=>_0x2bb0ab['id']===_0x334cbe);}async updateItemTitle(_0x2e8320,_0x38dda7){const _0x31776a=this['getItem'](_0x2e8320);if(!_0x31776a)return!0x1;try{return await this['connector']['updateConversation'](_0x2e8320,{'title':_0x38dda7})['getResult'](),_0x31776a['updateTitle'](_0x38dda7),this['fire']('itemUpdated',{'itemId':_0x2e8320,'updates':{'title':_0x38dda7}}),!0x0;}catch(_0x5a70dd){return this['fire']('error',{'error':_0x5a70dd,'operation':'updateItemTitle','itemId':_0x2e8320}),!0x1;}}async updateItemPinned(_0x3b395f,_0x5c906f){const _0x2ad57f=this['getItem'](_0x3b395f);if(!_0x2ad57f)return!0x1;try{return await this['connector']['updateConversation'](_0x3b395f,{'pinned':_0x5c906f})['getResult'](),_0x2ad57f['updatePinned'](_0x5c906f),this['fire']('itemUpdated',{'itemId':_0x3b395f,'updates':{'pinned':_0x5c906f}}),!0x0;}catch(_0x5a8a7c){return this['fire']('error',{'error':_0x5a8a7c,'operation':'updateItemPinned','itemId':_0x3b395f}),!0x1;}}loadItems(_0x55aa10){try{this['items']=[],_0x55aa10['map'](_0x87dff9=>{this['addItem'](new Ra(_0x87dff9));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x2c88c4){this['fire']('error',{'error':_0x2c88c4,'operation':'loadItems'});}}getItems(_0x3d6a43={}){const _0x8ab182=void 0x0!==_0x3d6a43['pinned']&&_0x3d6a43['pinned'],_0x3983db=_0x3d6a43['from']?new Date(_0x3d6a43['from']['getFullYear'](),_0x3d6a43['from']['getMonth'](),_0x3d6a43['from']['getDate']()):null,_0x345ddd=_0x3d6a43['to']?new Date(_0x3d6a43['to']['getFullYear'](),_0x3d6a43['to']['getMonth'](),_0x3d6a43['to']['getDate']()):null;return this['items']['filter'](_0xf5091b=>{if(_0xf5091b['pinned']!==_0x8ab182)return!0x1;if(_0x345ddd){const _0x55379f=new Date(_0xf5091b['createdAt']['getFullYear'](),_0xf5091b['createdAt']['getMonth'](),_0xf5091b['createdAt']['getDate']());return _0x3983db?_0x3983db['getTime']()===_0x345ddd['getTime']()?_0x55379f['getTime']()===_0x3983db['getTime']():_0x55379f<_0x345ddd&&_0x55379f>=_0x3983db:_0x55379f<_0x345ddd;}return!0x0;});}},ka=class extends _0x45fe7d{_aiConnector;_reporter;_aiChatHistoryUi;_aiChatController;static get requires(){return[Es,Ln,sr,ba,Is];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiConnector']=this['context']['plugins']['get'](Es),this['_aiChatHistoryUi']=this['context']['plugins']['get'](ba),this['_aiChatController']=this['context']['plugins']['get'](sr),this['_reporter']=this['context']['plugins']['get'](Ln)['createReporter']('aichathistory');const _0x35d5f0=this['context']['plugins']['get'](Is);try{const _0x2b5732=this['_aiChatController']['getGroupId']();this['history']=new va({'connector':this['_aiConnector'],'group':_0x2b5732}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x32251b,_0x228d82)=>{this['_setItemLoading'](_0x228d82['id'],'remove'),this['_handleRemove'](_0x228d82['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x2ceecc,_0x40b544)=>{this['_setItemLoading'](_0x40b544['id'],'rename'),this['_handleEditTitle'](_0x40b544['id'],_0x40b544['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0xb0d37a,_0x4cbc54)=>{void 0x0!==_0x4cbc54['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x4cbc54['itemId'],_0x4cbc54['updates']['title']),void 0x0!==_0x4cbc54['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x4cbc54['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x5007d4,_0x2f9fc5)=>{this['_aiChatController']['_handleRemovedConversation'](_0x2f9fc5['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x2f9fc5['itemId']),this['_clearItemLoading'](_0x2f9fc5['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x3a60fc,_0x31a5f3)=>{this['_handleHistoryErrorUI'](_0x31a5f3['error'],_0x31a5f3['operation'],_0x31a5f3['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x1692e0,_0x2b240c)=>{this['_handleSelectConversation'](_0x2b240c['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x357e23,_0x228876)=>{const _0x23e916=_0x228876['pinned']?'pin':'unpin';this['_setItemLoading'](_0x228876['id'],_0x23e916),this['_handleTogglePin'](_0x228876['id'],_0x228876['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x35d5f0['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x35d5f0['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x3cfc9d){this['_handleHistoryErrorUI'](_0x3cfc9d,'init');}}async _handleEditTitle(_0x287fac,_0x167166){await this['history']['updateItemTitle'](_0x287fac,_0x167166);}async['_handleTogglePin'](_0x44c1d1,_0x11b012){await this['history']['updateItemPinned'](_0x44c1d1,_0x11b012);}async['_handleRemove'](_0x2383b5){await this['history']['removeItem'](_0x2383b5);}async _handleSelectConversation(_0x2da068){await this['_aiChatController']['loadConversation'](_0x2da068);}async _showConversationHistory(){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_updateHistoryItemsUI(){const _0x2b2389=this['_aiChatController']['activeConversation']?.['id'],_0x400862=this['_getCategorizedItems']()['map'](_0x31286c=>({'title':_0x31286c['title'],'items':_0x31286c['items']['map'](_0x5cad56=>({'id':_0x5cad56['id'],'title':_0x5cad56['title']||Ts(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x5cad56['createdAt'])['toLocaleDateString'](),'active':_0x5cad56['id']===_0x2b2389,'pinned':_0x5cad56['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x400862);}_setItemLoading(_0x12e502,_0x404a54){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x12e502,_0x404a54,!0x0);}_clearItemLoading(_0x4340d8){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x4340d8,null,!0x1);}_handleHistoryErrorUI(_0x2da4b0,_0x169ae8,_0x1a45a1){const _0x1ec9fa=this['_generateErrorMessage'](_0x169ae8,_0x1a45a1);this['_aiChatHistoryUi']['showError'](_0x1ec9fa),this['_reporter']['reportError'](_0x2da4b0,{'context':{'operation':_0x169ae8}}),_0x1a45a1&&this['_clearItemLoading'](_0x1a45a1),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_generateErrorMessage(_0x27e42e,_0x5a35c7){const _0x5cfd4e=_0x5a35c7?this['history']['getItem'](_0x5a35c7):null,_0x1ecd2c=_0x5cfd4e?.['title']||Ts(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x27e42e){case'updateItemTitle':return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x1ecd2c);case'updateItemPinned':{const _0x14ab9c=Ts(this['context']['locale'],_0x5cfd4e?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x14ab9c,_0x1ecd2c]);}case'removeItem':return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x1ecd2c);case'init':case'loadItems':return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Ts(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}_getCategorizedItems(){const _0x2fcc47=new Date(),_0x2814a9=new Date(_0x2fcc47['getFullYear'](),_0x2fcc47['getMonth'](),_0x2fcc47['getDate']()),_0x321d5d=new Date(_0x2814a9);_0x321d5d['setDate'](_0x321d5d['getDate']()-0x1);const _0xc62703=new Date(_0x2814a9);_0xc62703['setDate'](_0xc62703['getDate']()-0xe);const _0x20c468=this['history']['getItems']({'pinned':!0x0}),_0x4dcc3d=this['history']['getItems']({'from':_0x2814a9,'to':_0x2814a9}),_0x10f0e6=this['history']['getItems']({'from':_0x321d5d,'to':_0x321d5d}),_0x218159=this['history']['getItems']({'from':_0xc62703,'to':_0x321d5d}),_0x95c227=this['history']['getItems']({'to':_0xc62703}),_0x50daba=[];return _0x20c468['length']>0x0&&_0x50daba['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x20c468}),_0x4dcc3d['length']>0x0&&_0x50daba['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x4dcc3d}),_0x10f0e6['length']>0x0&&_0x50daba['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x10f0e6}),_0x218159['length']>0x0&&_0x50daba['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x218159}),_0x95c227['length']>0x0&&_0x50daba['push']({'title':Ts(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x95c227}),_0x50daba;}},ya=class extends _0x45fe7d{static get requires(){return[ka,ba];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},Na=class extends _0x45fe7d{static get requires(){return[sr,sn,pa,ya,yn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xdffb3d){super(_0xdffb3d),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'contextLibrary':{'enabled':!0x1},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},xa=class extends Vt{['id'];constructor(_0x530bd8,_0x3de772){super(_0x530bd8);const {id:_0x9ff36d,type:_0x551cf7,icon:_0x47f8a2}=_0x3de772;this['id']=_0x9ff36d,this['set']({'label':_0x3de772['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x3de772['id']}}),_0x47f8a2?this['icon']=_0x47f8a2:'chat'===_0x551cf7?this['icon']=_0x55e1ac:'review'===_0x551cf7?this['icon']=_0x308ecc:'translate'===_0x551cf7&&(this['icon']=_0x616488);}},La=class extends _0x4f75f8{listView;constructor(_0x595361,_0x43cb30){super(_0x595361),this['set']('isEnabled',!0x0);const _0x19fa05=_0x43cb30['map'](_0x162b41=>{const _0x2c1c3d=new Zt(this['locale']),_0x2cf4cc=new xa(this['locale'],_0x162b41);return _0x2cf4cc['bind']('isEnabled')['to'](this),_0x2c1c3d['children']['add'](_0x2cf4cc),_0x2cf4cc['delegate']('execute')['to'](this),_0x2c1c3d;});this['listView']=new te(this['locale']),this['listView']['items']['addMany'](_0x19fa05),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const Pa='chat-shortcuts';var Da=class extends _0x45fe7d{_shortcuts;_shortcutsView;_aiChatUI;_listenedConversation;static get requires(){return[pa,Ss];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiChatUI']=this['context']['plugins']['get'](pa),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x5df9d3=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x255957=_0x5df9d3['activeConversation'];_0x255957['isFromHistory']||this['_injectShortcuts'](_0x255957);}),this['listenTo'](_0x5df9d3,'interactionStarted',()=>{this['_removeShortcuts']();}));}_validateShortcuts(){const _0x116002=['chat','review','translate'];this['_shortcuts']['forEach'](_0x188aa3=>{let _0x5037e0=!0x0;if(_0x188aa3['id']&&_0x188aa3['label']&&_0x116002['includes'](_0x188aa3['type'])?'chat'===_0x188aa3['type']&&(_0x5037e0='string'==typeof _0x188aa3['prompt']):_0x5037e0=!0x1,!_0x5037e0)throw new ct('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x188aa3});});}_injectShortcuts(_0x3bffb6){this['_removeShortcuts'](),this['_shortcutsView']=new La(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],Pa),this['_shortcutsView']['on']('execute',_0x2dbf42=>{const _0x2c8837=_0x2dbf42['source']['id'];this['_executeShortcut'](_0x2c8837);}),this['_listenedConversation']=_0x3bffb6,this['listenTo'](_0x3bffb6,'uploadProgressChanged',(_0x395dad,_0x56485e)=>{this['_shortcutsView']['isEnabled']=!_0x56485e['isUploadInProgress'];});}_removeShortcuts(){const _0x2e2460=this['context']['plugins']['get'](pa);_0x2e2460['hasFeedItem'](Pa)&&_0x2e2460['removeFeedItem'](Pa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}_executeShortcut(_0x40f708){const _0x127132=this['_shortcuts']['find'](_0x8de9a5=>_0x8de9a5['id']===_0x40f708),_0x3ec282=_0x127132['type'];'chat'===_0x3ec282?this['_runChatShortcut'](_0x127132):'review'===_0x3ec282?_0x127132['commandId']?this['_runReviewShortcut'](_0x127132):this['_switchTab']('reviewMode'):'translate'===_0x3ec282&&(_0x127132['language']?this['_runTranslateShortcut'](_0x127132):this['_switchTab']('translate'));}_switchTab(_0x12facd){if(!this['context']['plugins']['has']('AITabs'))throw new ct('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x12facd});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x12facd);}async _runChatShortcut({id:_0x55ada7,prompt:_0x50aea1,draftMode:_0x1a946f,useWebSearch:_0x35c043=!0x1,useReasoning:_0x45a841=!0x1,model:_0x39ca69}){const _0x594b13=this['context']['plugins']['get']('AIChatController'),_0xc8bd50=_0x594b13['activeConversation'],_0xf6ebf4=this['context']['plugins']['get'](Ss),_0x8c731d=await _0xf6ebf4['models']['resolveModel'](_0x39ca69);_0x8c731d&&await _0xc8bd50['setModel'](_0x8c731d),_0xc8bd50['setWebSearch'](_0x35c043),_0xc8bd50['setReasoning'](_0x45a841);const _0xc2273d=_0xf6ebf4['contextLibrary']['resolveContext']({'feature':'chat','ids':[_0x55ada7],'idScopedOnly':!0x0,'context':new qn()});_0xc8bd50['addDefaultContext'](_0xc2273d['refs']),_0x594b13['addCurrentDocumentToChatContext'](),_0x1a946f?(this['_aiChatUI']['setPromptInputValue'](_0x50aea1),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x594b13['sendMessage']({'message':_0x50aea1});}_runReviewShortcut({commandId:_0x3c74aa,model:_0x2b4457,prompt:_0x4473ae,params:_0x35212e}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ct('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x28bdac={'id':_0x3c74aa,'isCustom':'custom'===_0x3c74aa};_0x2b4457&&_0x4473ae&&(_0x28bdac['args']={'model':_0x2b4457,'prompt':_0x4473ae}),_0x35212e&&(_0x28bdac['params']=_0x35212e),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x28bdac);}_runTranslateShortcut({language:_0x17676d}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ct('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x17676d,'args':{'language':_0x17676d}});}},Ha=class extends _0x426681{constructor(_0x32c634){super(_0x32c634);const _0x5e3bef=_0x32c634['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x5e3bef,'isVisible'),this['isEnabled']=!0x0;}execute(){const _0x4eb4cb=this['editor']['plugins']['get']('AITabs')['view'];_0x4eb4cb['isVisible']=!_0x4eb4cb['isVisible'];}},Ma=class extends _0x31535a{static get requires(){return[Is];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x37c53f=this['editor'];_0x37c53f['commands']['add']('toggleAi',new Ha(_0x37c53f)),_0x37c53f['ui']['componentFactory']['add']('toggleAi',()=>{const _0x4d92d8=this['_createAIUIButton'](Vt);return _0x4d92d8['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x4d92d8;}),_0x37c53f['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x33308b=this['_createAIUIButton'](_0xe556ab);return _0x33308b['set']({'role':'menuitemcheckbox'}),_0x33308b;});}_createAIUIButton(_0x4d9b9a){const _0x39bdab=this['editor'],_0xd9be16=_0x39bdab['commands']['get']('toggleAi'),_0x2ddd3c=new _0x4d9b9a(_0x39bdab['locale']);return _0x2ddd3c['set']({'label':Ts(_0x39bdab['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x100f7b,'isToggleable':!0x0}),_0x2ddd3c['bind']('isEnabled')['to'](_0xd9be16),_0x2ddd3c['bind']('isOn')['to'](_0xd9be16,'value',_0x1b468e=>!!_0x1b468e),this['listenTo'](_0x2ddd3c,'execute',()=>{_0xd9be16['execute']();}),_0x2ddd3c;}};const Ua=['applySuggestion','insertSuggestion','showNext','showPrevious'];var Va=class extends _0x4f75f8{['_errorView'];constructor(_0x1d93ab){super(_0x1d93ab),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x22525a){this['showError'](_0x22525a);}['showError'](_0x5b726f){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x5b726f,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}_createErrorView(){const _0x9e481b=new _0x4f75f8(this['locale']),_0x5d31b6=new _0x4f75f8(this['locale']);return _0x5d31b6['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x9e481b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x5543b7=>!_0x5543b7)]},'children':[_0x5d31b6]}),_0x9e481b;}};const Ba=0xa;var Ga=class extends _0x45fe7d{static get requires(){return[sn];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;_currentConfig;_editor;_isUpdatingMarkers=!0x1;['open'](_0x246ae3){const {id:_0x2a9c9b}=this['_currentConfig']??{};this['_currentConfig']=_0x246ae3,this['_editor']=_0x246ae3['targetEditor'];const {id:_0xdb59a1}=this['_currentConfig'];this['isOpen']&&_0x2a9c9b===_0xdb59a1?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x521fd1=this['_editor'];if(!_0x521fd1)return;const _0x1856a3=_0x521fd1['plugins']['get']('Dialog');_0x1856a3['isOpen']&&this['_currentConfig']&&_0x1856a3['id']===this['_currentConfig']['id']&&_0x1856a3['hide']();}_updateDialog(){const _0x1100a5=this['_editor']['plugins']['get']('Dialog'),{icon:_0x40ebe1,title:_0x5315fb}=this['_currentConfig'];_0x1100a5['view']?.['headerView']&&(_0x1100a5['view']['headerView']['label']=_0x5315fb,_0x1100a5['view']['headerView']['iconView']&&_0x40ebe1&&(_0x1100a5['view']['headerView']['iconView']['content']=_0x40ebe1)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x1100a5['view']?.['updatePosition']();}_showFakeVisualSelection(){this['context']['plugins']['get'](sn)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}_hideFakeVisualSelection(){this['context']['plugins']['get'](sn)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x4a0061=this['_editor']['plugins']['get']('Dialog'),{id:_0x39e97a,title:_0x51f9bf,icon:_0x13c4e5,class:_0x62b28,mainView:_0xfcbc05}=this['_currentConfig'];_0xfcbc05['delegate'](...Ua)['to'](this),_0x4a0061['show']({'title':_0x51f9bf,'icon':_0x13c4e5,'hasCloseButton':!0x0,'id':_0x39e97a,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x62b28||''),'content':_0xfcbc05,'onShow':_0x2c3515=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x2c3515['view']?.['updatePosition']();const _0x1a3eb4=this['_getSelectionElements']();_0x1a3eb4&&_0x1a3eb4[0x0]&&kt({'target':_0x1a3eb4[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x2c3515['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x39e97a});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x39e97a}),this['isOpen']=!0x1;}});}_calculateDialogPosition(_0x4885c6,_0x9561a3,_0x5b8d0a){const _0x241db0=_0x9561a3||_0x5b8d0a;if(!_0x241db0)return null;const _0xc27938=this['_getSelectionElements']();if(!_0xc27938||0x0===_0xc27938['length'])return{'left':Math['round'](_0x241db0['left']+_0x241db0['width']/0x2-_0x4885c6['width']/0x2),'top':Math['round'](_0x241db0['top']+_0x241db0['height']/0x2-_0x4885c6['height']/0x2)};const _0x51c2d1=Math['round'](_0x241db0['left']+_0x241db0['width']/0x2-_0x4885c6['width']/0x2),_0x53183c=_0xc27938['map'](_0x3e03a4=>new It(_0x3e03a4)),_0x2d3020=_0x4885c6['height'];return{'left':_0x51c2d1,'top':this['_calculateOptimalTopPosition'](_0x53183c,_0x2d3020,_0x241db0)};}_calculateOptimalTopPosition(_0x5be010,_0x363d37,_0x1bac53){const _0x29b583=new It(Ct['window']),_0x14e508=_0x5be010['map'](_0x40f9ae=>_0x40f9ae['getVisible']())['filter'](_0x39d464=>_0x39d464),_0x377500=It['getBoundingRect'](_0x14e508);if(!_0x377500)return Math['round'](_0x1bac53['top']+_0x1bac53['height']/0x2);const _0x5db3e8=_0x29b583['getIntersection'](_0x377500);if(!_0x5db3e8)return Math['round'](_0x1bac53['top']+_0x1bac53['height']/0x2);const _0x222a61=_0x1bac53['getVisible'](),_0x4d16ff=_0x222a61&&_0x377500['height']>_0x222a61['height'],_0x5c94ad=_0x5db3e8['top'],_0x371632=_0x5db3e8['bottom'];if(_0x4d16ff){const _0x1c876b=_0x29b583['top']+_0x29b583['height']/0x2-_0x363d37/0x2,_0x474cb1=_0x5c94ad-Ba-_0x29b583['top'],_0x2bbdb0=_0x29b583['bottom']-_0x371632-Ba;return _0x474cb1>=_0x363d37?Math['max'](Ba,_0x5c94ad-_0x363d37-Ba):_0x2bbdb0>=_0x363d37?_0x371632+Ba:Math['max'](Ba,_0x1c876b);}const _0x3b1bd8=_0x5c94ad-_0x363d37,_0x2cf13c=_0x29b583['bottom']-_0x371632-Ba,_0x400d4e=_0x5c94ad-Ba-_0x29b583['top'];let _0x4ddd3c;return _0x4ddd3c=_0x2cf13c>=_0x363d37?_0x371632+Ba:_0x400d4e>=_0x363d37?_0x3b1bd8-Ba:_0x5c94ad+_0x377500['height']/0x2-_0x363d37/0x2,_0x4ddd3c;}_setupFakeVisualSelectionMarkerRemovalListener(){const _0x472892=this['_editor'];this['listenTo'](_0x472892['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x4c8ea2,data:{newRange:_0x56e3b7}}of _0x472892['model']['document']['differ']['getChangedMarkers']())if(_0x4c8ea2['startsWith']('ai-selection:')&&(_0x56e3b7&&(_0x56e3b7['start']['isEqual'](_0x56e3b7['end'])||'$graveyard'==_0x56e3b7['root']['rootName'])||null==_0x56e3b7)){const _0x1bb15c=Ts(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x1bb15c),this['fire']('selectionRemoved');}}});}_cleanupFakeVisualSelectionMarkerRemovalListener(){const _0x41e46d=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x41e46d['model']['document']);}_getSelectionElements(){const _0x3a98a4=this['_editor'];return _0x5bfa90(_0x3a98a4['editing'],[..._0x3a98a4['model']['markers']['getMarkersGroup']('ai-selection'),..._0x3a98a4['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}_getCurrentDomRootName(){const _0x3dd0d9=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x3dd0d9&&_0x3dd0d9['rootName']?_0x3dd0d9['rootName']:null;}},Fa=class extends _0x4a1d9b{copyButton;likeButton;dislikeButton;showChangesButton;['_config'];constructor(_0x3987cd,_0x319c83={}){super(_0x3987cd),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x319c83};const _0x50c2d4=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x50c2d4?'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(_0x1b09b1){this['showChangesButton']['isEnabled']=_0x1b09b1;}_setupRatingButtons(){this['likeButton']=new Vt(this['locale']),this['likeButton']['set']({'icon':at,'label':Ts(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Mn,'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':ot,'label':Ts(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Mn,'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':_0x356e25,'label':Ts(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Mn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x5d1aa6=new Qt();_0x5d1aa6['set']({'content':_0x11611b}),_0x5d1aa6['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'+Mn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Mn;},0x7d0);}),this['copyButton']['children']['add'](_0x5d1aa6);}_setupShowChangesButton(){this['showChangesButton']=new Vt(this['locale']),this['showChangesButton']['set']({'icon':et,'label':Ts(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Mn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x2e6e86=>_0x2e6e86?it:et),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},Ka=class extends Va{['children'];nextButtonView;previousButtonView;['focusCycler'];['_focusables'];['_focusTracker'];_keystrokes;['_config'];_streamableContentView;_toolbarContainerView;_partToolbarView;_stateView;['_miniToolbarView'];constructor(_0x13b2f7,_0x5f115c){super(_0x13b2f7);const _0x490a9f=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['set']('_outdatedReason',void 0x0),this['set']('isTargetReadOnly',!0x1),this['set']('areActionsDisabled',!0x1),this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Wt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x5f115c,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new wr(_0x13b2f7),this['_partToolbarView']=new Er(_0x13b2f7,_0x5f115c['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_partToolbarView']['bind']('isTargetReadOnly')['to'](this),this['_partToolbarView']['bind']('isEnabled')['to'](this,'areActionsDisabled',this,'_isErrorVisible',(_0x31fabc,_0x54dc9b)=>!_0x31fabc&&!_0x54dc9b),this['_togglePartToolbarButtonsVisibility'](_0x5f115c),this['_stateView']=new Ir(_0x13b2f7),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new Fa(_0x13b2f7,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new Wa(_0x13b2f7,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x4894d3,_0x746dee,_0x24270a,_0xc7bead)=>{let _0x38e15b,_0x18de03;'pending'===_0xc7bead?(_0x38e15b=this['_partToolbarView'],_0x18de03=this['_stateView']):(_0x38e15b=this['_stateView'],_0x18de03=this['_partToolbarView']),this['_stateView']['setState'](_0x24270a,this['_outdatedReason']),_0x38e15b['isVisible']=!0x1,_0x18de03['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x490a9f['to']('_state',_0x2c8a18=>'ck-ai-chat-balloon-main_state_'+_0x2c8a18)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x5f115c);});}['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(_0x2f0715){_0x2f0715?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x2f0715);}clearContent(){this['_streamableContentView']['clear']();}setState(_0x51cae3,_0x595b9e){this['_outdatedReason']=_0x595b9e,this['_state']=_0x51cae3;}['showError'](_0x535440){super['showError'](_0x535440),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}toggleRotatorButtonsVisibility(_0x846777){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x846777;}_togglePartToolbarButtonsVisibility({showApplyButton:_0xafa3b4,showSuggestButton:_0x4130e5}){_0xafa3b4=_0xafa3b4&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x4130e5=_0x4130e5&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0xafa3b4,'showSuggestButton':_0x4130e5});}_createNextButtonView(){const _0x3cf72e=new Vt(this['locale']);return _0x3cf72e['set']({'icon':_0x474bea,'label':Ts(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x3cf72e['on']('execute',()=>{this['fire']('showNext');}),_0x3cf72e;}_createPreviousButtonView(){const _0xbb759f=new Vt(this['locale']);return _0xbb759f['set']({'icon':_0x577615,'label':Ts(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0xbb759f['on']('execute',()=>{this['fire']('showPrevious');}),_0xbb759f;}},Wa=class extends _0x4f75f8{constructor(_0x4bb669,_0xd990cd){super(_0x4bb669),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0xd990cd});}},Ya=class extends _0x31535a{static get requires(){return[Bt,Ga];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_chatBalloonView;constructor(_0x988b8a){super(_0x988b8a),this['set']('showDiff',!0x1);}['open'](_0x495c5a){const _0x3ac493=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x3ac493['plugins']['get']('AIBalloon')['open']({..._0x495c5a,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x495c5a['showRotator']),this['_chatBalloonView']['areActionsDisabled']=_0x495c5a['areActionsDisabled'],this['_chatBalloonView']['isTargetReadOnly']=_0x495c5a['isTargetReadOnly'],this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}updateContent(_0x2bca91){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x2bca91);}clearContent(){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}setState(_0x18ae76,_0x52abf9){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x18ae76,_0x52abf9);}setTargetReadOnly(_0x19267c){this['_chatBalloonView']&&(this['_chatBalloonView']['isTargetReadOnly']=_0x19267c);}_createChatBalloonView(){const _0x2ee5cf=this['editor'],_0x4c4f94=_0x2ee5cf['plugins']['get']('AIBalloon'),_0x130823=_0x2ee5cf['commands']['get']('trackChanges');let _0x59c268=_0x2ee5cf['config']['get']('ai.availableReplyActions')||[...kr];_0x2ee5cf['plugins']['has']('TrackChanges')||(_0x59c268=_0x59c268['filter'](_0x52aa94=>'insertSuggestion'!=_0x52aa94));const _0x220d5a=new Ka(_0x2ee5cf['locale'],{'availableActions':_0x59c268,'showApplyButton':!0x0,'showSuggestButton':!!_0x130823});return _0x220d5a['bind']('showDiff')['to'](this),_0x220d5a['delegate'](...nr)['to'](this),_0x220d5a['delegate']('showPrevious','showNext')['to'](this),_0x4c4f94['delegate']('dialogClosed')['to'](this),_0x220d5a['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x220d5a['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x220d5a['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x130823&&_0x220d5a['bind']('isTrackChangesOn')['to'](_0x130823,'value'),_0x220d5a['render'](),_0x220d5a;}_toggleRotatorButtonsInDialogHeader(_0x2488ac){const _0x135dd7=this['editor'],_0x552b25=_0x135dd7['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x2488ac),_0x552b25['has'](this['_chatBalloonView']['previousButtonView'])||(_0x552b25['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x135dd7['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x552b25['remove'](this['_chatBalloonView']['previousButtonView']),_0x552b25['remove'](this['_chatBalloonView']['nextButtonView']);}));}_restoreDefaultViewFocus(){this['_chatBalloonView']['focus']();}},$a=class extends _0x31535a{static get requires(){return[Ma,Ya,_0xb43a06];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function qa(_0xb2240){const {editor:_0x38d2d3,action:_0x7c9697,withText:_0x49cc8f=!0x1,withIcon:_0x3baf97=!0x0,isInDropdown:_0x29aae5=!0x0,shouldPreventFocus:_0x4be287=!0x1,actionButtons:_0x1dc518}=_0xb2240;return()=>{const _0x44808c=_0x38d2d3['locale'],_0x4f2080=new Vt(_0x44808c),_0x82ff6d=_0x4f2080['bindTemplate'];_0x29aae5&&_0x4f2080['extendTemplate']({'on':{'mouseenter':_0x82ff6d['to'](()=>{_0x4be287&&_0x4be287()||_0x4f2080['focus']();})}}),_0x1dc518['push']({'buttonView':_0x4f2080,'action':_0x7c9697});const _0x3fdc12=_0x7c9697['icon']??_0x7c9697['parent']?.['icon'];return _0x4f2080['set']({'label':_0x7c9697['label'],'withText':_0x49cc8f,'role':'menuitem','icon':_0x3baf97?_0x3fdc12??_0x3c7204:void 0x0,'tooltip':!_0x49cc8f,'class':'ck-ai-quick-actions-button','isEnabled':_0x7c9697['isEnabled']}),_0x4f2080['on']('execute',()=>{_0x38d2d3['editing']['view']['focus'](),_0x38d2d3['commands']['execute']('aiQuickAction',_0x7c9697);}),_0x4f2080;};}var Qa=class extends jt{['arrowView'];constructor(_0x41d347,_0x2196de){super(_0x41d347,_0x2196de);const _0x5bf98c=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',_0x41ddf5=>String(_0x41ddf5)),'data-cke-tooltip-disabled':_0x5bf98c['to']('isOn')},'on':{'mouseenter':_0x5bf98c['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x300287=new Qt();return _0x300287['content']=_0x630c7e,_0x300287['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x300287;}},Xa=class extends te{_allListItems;_allSearchableItems;constructor(_0x299a54,_0x222f03,_0x424d01){super(_0x299a54),this['_allListItems']=_0x222f03,this['_allSearchableItems']=_0x424d01;}filter(_0x3cacaa){if(!_0x3cacaa)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x1e61fe=_0x3cacaa['source']['toLowerCase']()['trim'](),_0x2df953=this['_allSearchableItems']['filter'](_0x625b4a=>(_0x625b4a['groupLabel']?_0x625b4a['label']+'\x20('+_0x625b4a['groupLabel']+')':_0x625b4a['label'])['toLowerCase']()['includes'](_0x1e61fe));return this['items']['clear'](),this['items']['addMany'](_0x2df953['sort']((_0x2e24df,_0x29d289)=>{const _0x2e5ed5=_0x2e24df['groupLabel'],_0x199505=_0x29d289['groupLabel'];return _0x2e5ed5||_0x199505?_0x2e5ed5?0x1:-0x1:0x0;})['map'](_0x3cbec7=>_0x3cbec7['item'])),this['_highlightQuery'](_0x1e61fe,_0x2df953),{'resultsCount':_0x2df953['length'],'totalItemsCount':this['_allSearchableItems']['length']};}_highlightQuery(_0x2bba79,_0x3e7a48){if(!_0x2bba79)return;const _0x1e0be5=new RegExp(_0x922d45(_0x2bba79),'gi');_0x3e7a48['forEach'](_0x2c4290=>{_0x2c4290['highlightViews']&&_0x2c4290['highlightViews']['forEach'](_0x5c0c7c=>{'function'==typeof _0x5c0c7c['highlightText']&&_0x5c0c7c['highlightText'](_0x1e0be5);});});}_clearHighlight(){this['_allSearchableItems']['forEach'](_0x2840af=>{_0x2840af['highlightViews']&&_0x2840af['highlightViews']['forEach'](_0xb54295=>{'function'==typeof _0xb54295['highlightText']&&_0xb54295['highlightText'](null);});});}};const za='menu',ja='menuitem';var Ja=class extends _0x4f75f8{_bodyCollection;optionsListView;_searchTextView=null;_allSearchableItems=[];['children'];['focusTracker'];keystrokes;['_focusables'];['focusCycler'];_openNestedPanels=new Set();['_hasSearch'];_actionButtons;constructor(_0x577419,_0xaedea5,_0x280dee,_0x4f160d,_0xfdec76=!0x1,_0x3070a9=[]){const _0x3ac2ca=_0x577419['locale'];super(_0x3ac2ca),this['_bodyCollection']=_0x4f160d,this['_hasSearch']=_0xfdec76,this['_actionButtons']=_0x3070a9;const _0x13767a=this['_createListItems'](_0x577419,_0xaedea5,_0x280dee);this['optionsListView']=new Xa(_0x3ac2ca,_0x13767a,this['_allSearchableItems']),this['optionsListView']['role']=za,this['optionsListView']['items']['addMany'](_0x13767a),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0xfdec76&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x13767a,this['focusCycler']=new Wt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0xfdec76&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x42ac7d=_0xfdec76&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x340edf(_0x42ac7d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x3ac2ca['uiLanguageDirection']},'children':this['children']});}_createSearchTextView(){return new _0x2cb476(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Ts(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Ts(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x4e9325=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x4e9325);}_createListItems(_0x3b6eb9,_0x5d5c9b,_0x1dc1df){const _0x38d30c=new _0x340edf();return _0x5d5c9b['forEach'](_0x310394=>{if('actions'in _0x310394){const {listItem:_0x57f563}=this['_createActionGroupButton'](_0x3b6eb9,_0x310394,_0x1dc1df);_0x38d30c['add'](_0x57f563),_0x310394['actions']['forEach'](_0xfbad31=>{const {listItem:_0x3bcce1,highlightViews:_0x55da01}=this['_createSearchResultActionButton'](_0x3b6eb9,_0xfbad31,_0x310394['label'],_0x310394['icon']);this['_allSearchableItems']['push']({'item':_0x3bcce1,'label':_0xfbad31['label'],'groupLabel':_0x310394['label'],'highlightViews':_0x55da01});});}else{const {listItem:_0xbade04}=this['_createActionButton'](_0x3b6eb9,_0x310394);_0x38d30c['add'](_0xbade04);const _0x254bf1=_0xbade04['children']['first'];if(_0x254bf1){const {listItem:_0x232026,highlightViews:_0x591ee2}=this['_createSearchResultActionButton'](_0x3b6eb9,_0x310394);this['_allSearchableItems']['push']({'item':_0x232026,'label':_0x254bf1['label']||'','highlightViews':_0x591ee2});}}}),_0x38d30c;}_createActionButton(_0x36b2a7,_0x255cc8,_0x1cc3eb,_0xef8ed3){const _0x2283bd=new Zt(this['locale']);if(_0x1cc3eb&&_0xef8ed3){const _0x38befd=new Vt(this['locale']),_0x8882be=_0x38befd['bindTemplate'],_0x1dc4fb=new qt();_0x1dc4fb['text']=_0x255cc8['label'];const _0x123b79=new qt();_0x123b79['text']=_0x1cc3eb;const _0x3c5942=new Qt();_0x3c5942['content']=_0xef8ed3,_0x3c5942['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x508526=new _0x4f75f8(this['locale']);_0x508526['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x511cc3=new _0x4f75f8(this['locale']);return _0x511cc3['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x38befd['set']({'label':_0x255cc8['label']+'\x20('+_0x1cc3eb+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x255cc8['isEnabled']}),_0x38befd['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x8882be['if']('isEnabled','ck-disabled',_0x55c868=>!_0x55c868)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x1dc4fb,_0x508526,_0x3c5942,_0x123b79,_0x511cc3],'on':{'mouseenter':_0x8882be['to'](()=>{this['_isSearchFocused']()||_0x38befd['focus']();}),'click':_0x8882be['to'](()=>{_0x38befd['fire']('execute');})}}),_0x38befd['on']('execute',()=>{_0x38befd['isEnabled']&&(_0x36b2a7['editing']['view']['focus'](),_0x36b2a7['commands']['execute']('aiQuickAction',_0x255cc8));}),_0x2283bd['children']['add'](_0x38befd),this['_actionButtons']['push']({'buttonView':_0x38befd,'action':_0x255cc8}),{'listItem':_0x2283bd,'highlightViews':[_0x1dc4fb,_0x123b79]};}{const _0x4ec502=new Ut(),_0x2ab200=new Vt(this['locale'],_0x4ec502),_0x538d1b=_0x2ab200['bindTemplate'],_0x2b4791=_0x255cc8['icon']??_0x255cc8['parent']?.['icon'],_0x35589d=void 0x0!==_0x255cc8['icon'];return _0x2ab200['set']({'label':_0x255cc8['label'],'withText':!0x0,'role':'menuitem','icon':_0x35589d?_0x2b4791??_0x3c7204:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x255cc8['isEnabled']}),_0x2ab200['extendTemplate']({'on':{'mouseenter':_0x538d1b['to'](()=>{this['_isSearchFocused']()||_0x2ab200['focus']();})}}),_0x2ab200['on']('execute',()=>{_0x36b2a7['editing']['view']['focus'](),_0x36b2a7['commands']['execute']('aiQuickAction',_0x255cc8);}),_0x2283bd['children']['add'](_0x2ab200),this['_actionButtons']['push']({'buttonView':_0x2ab200,'action':_0x255cc8}),{'listItem':_0x2283bd,'highlightViews':[_0x4ec502]};}}_createSearchResultActionButton(_0x57c75a,_0x2179a3,_0x278ca5,_0x5e7224){return _0x278ca5&&_0x5e7224?this['_createSearchResultGroupedActionButton'](_0x57c75a,_0x2179a3,_0x278ca5,_0x5e7224):this['_createSearchResultIndividualActionButton'](_0x57c75a,_0x2179a3);}_createSearchResultGroupedActionButton(_0x3c39ef,_0x49c806,_0x452c60,_0x47be6b){const _0x121a84=new Zt(this['locale']),_0x4a7547=new Vt(this['locale']),_0x12e429=_0x4a7547['bindTemplate'],{view:_0xdadd86,highlightView:_0x574046}=this['_createSearchResultGroupRow'](_0x452c60,_0x47be6b),{view:_0x444493,highlightView:_0x404cc8}=this['_createSearchResultActionRow'](_0x49c806['label']),_0x198963=this['_createSearchResultContentView'](_0xdadd86,_0x444493);return _0x4a7547['set']({'label':_0x49c806['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':_0x49c806['isEnabled']}),_0x4a7547['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',_0x12e429['if']('isEnabled','ck-disabled',_0x87dbc9=>!_0x87dbc9)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x198963],'on':{'mouseenter':_0x12e429['to'](()=>{this['_isSearchFocused']()||_0x4a7547['focus']();}),'click':_0x12e429['to'](()=>{this['_handleSearchResultButtonClick'](_0x4a7547);})}}),this['_setupActionButtonExecution'](_0x4a7547,_0x3c39ef,_0x49c806),_0x121a84['children']['add'](_0x4a7547),this['_actionButtons']['push']({'buttonView':_0x4a7547,'action':_0x49c806}),{'listItem':_0x121a84,'highlightViews':[_0x574046,_0x404cc8]};}_createSearchResultIndividualActionButton(_0x17f05b,_0x53acd8){const _0xb63691=new Zt(this['locale']),_0x264cc1=new Ut(),_0x5dd7b2=new Vt(this['locale'],_0x264cc1),_0x4f5f39=_0x5dd7b2['bindTemplate'];return _0x5dd7b2['set']({'label':_0x53acd8['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x53acd8['isEnabled']}),_0x5dd7b2['extendTemplate']({'on':{'mouseenter':_0x4f5f39['to'](()=>{this['_isSearchFocused']()||_0x5dd7b2['focus']();})}}),this['_setupActionButtonExecution'](_0x5dd7b2,_0x17f05b,_0x53acd8),_0xb63691['children']['add'](_0x5dd7b2),this['_actionButtons']['push']({'buttonView':_0x5dd7b2,'action':_0x53acd8}),{'listItem':_0xb63691,'highlightViews':[_0x264cc1]};}_createSearchResultGroupRow(_0x3c7dd6,_0x25d8bc){const _0x502f06=new _0x4f75f8(this['locale']),_0x448a60=new Qt();_0x448a60['content']=_0x25d8bc,_0x448a60['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x59f306=new qt();return _0x59f306['text']=_0x3c7dd6,_0x502f06['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x448a60,_0x59f306]}),{'view':_0x502f06,'highlightView':_0x59f306};}_createSearchResultActionRow(_0xf87e7b){const _0x12942f=new _0x4f75f8(this['locale']),_0x40bac5=new qt();return _0x40bac5['text']=_0xf87e7b,_0x12942f['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x40bac5]}),{'view':_0x12942f,'highlightView':_0x40bac5};}_createSearchResultContentView(_0xb9723b,_0x553daa){const _0x39ff52=new _0x4f75f8(this['locale']);return _0x39ff52['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0xb9723b,_0x553daa]}),_0x39ff52;}_setupActionButtonExecution(_0x48d296,_0x5f2204,_0x150279){_0x48d296['on']('execute',()=>{_0x48d296['isEnabled']&&(_0x5f2204['editing']['view']['focus'](),_0x5f2204['commands']['execute']('aiQuickAction',_0x150279));});}_createActionGroupButton(_0x5e6c47,_0x22afeb,_0x1e7b90){const _0x4996ce=new Zt(this['locale']),_0x23e272=new Ut(),_0x2cacd4=new Qa(this['locale'],_0x23e272),_0x228088=_0x2cacd4['bindTemplate'],_0x1b63bf=this['_getPanelKeystroke'](_0x1e7b90),_0x8dcef4=this['_createGroupActionsList'](_0x5e6c47,_0x22afeb['actions'],_0x1e7b90);_0x2cacd4['set']({'label':_0x22afeb['label'],'withText':!0x0,'role':ja,'icon':_0x22afeb['icon']??_0x3c7204,'isEnabled':_0x22afeb['actions']['some'](_0x130c82=>_0x130c82['isEnabled'])}),_0x2cacd4['extendTemplate']({'on':{'mouseenter':_0x228088['to'](()=>{this['_isSearchFocused']()||_0x2cacd4['focus']();})}});const _0x58d53f=new Pt(this['locale']);return _0x58d53f['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x228088['to'](_0x48061a=>{this['_handlePanelKeydown'](_0x48061a,_0x1b63bf,_0x2cacd4,_0x58d53f);})}}),_0x2cacd4['bind']('isOn')['to'](_0x58d53f,'isVisible'),this['_bodyCollection']['add'](_0x58d53f),_0x58d53f['content']['add'](_0x8dcef4),this['_setupGroupMenuBehavior'](_0x2cacd4,_0x58d53f),_0x4996ce['children']['add'](_0x2cacd4),this['_actionButtons']['push']({'buttonView':_0x2cacd4,'action':_0x22afeb}),{'listItem':_0x4996ce,'highlightView':_0x23e272};}_createGroupActionsList(_0xf58361,_0x264e42,_0x23eb77){const _0x3c98d5=new te(this['locale']);return _0x3c98d5['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x264e42['forEach'](_0x542605=>{const _0xdc57ea=new Zt(this['locale']),_0x49d2b5=qa({'editor':_0xf58361,'action':_0x542605,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0xdc57ea['children']['add'](_0x49d2b5),_0x23eb77['focusTracker']['add'](_0x49d2b5),_0x3c98d5['items']['add'](_0xdc57ea);}),_0x3c98d5;}_setupGroupMenuBehavior(_0x2b3d8f,_0x4f56d3){const _0x13894b=_0x2b3d8f['bindTemplate'],_0x1b0faa=this['_getButtonKeystroke'](_0x2b3d8f);_0x2b3d8f['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x13894b['to'](()=>{this['_showNestedPanel'](_0x4f56d3,_0x2b3d8f);}),'mouseleave':_0x13894b['to'](_0xccf46a=>{const _0x4a10c6=_0xccf46a['relatedTarget'];this['_isMovingToNestedMenu'](_0x4a10c6,_0x4f56d3)||this['_hideNestedPanel'](_0x4f56d3);}),'keydown':_0x13894b['to'](_0x43da73=>{_0x43da73['key']==_0x1b0faa&&(this['_showNestedPanel'](_0x4f56d3,_0x2b3d8f),_0x4f56d3['content']['get'](0x0)['focus']());})}}),_0x4f56d3['on']('render',()=>{_0x4f56d3['element']?.['addEventListener']('mouseleave',_0x21bf70=>{const _0x6d79a9=_0x21bf70['relatedTarget'];_0x2b3d8f['element']?.['contains'](_0x6d79a9)||this['_isMovingToNestedMenu'](_0x6d79a9,_0x4f56d3)||this['_hideNestedPanel'](_0x4f56d3);});});}_showNestedPanel(_0x53194c,_0x4aa76e){this['_openNestedPanels']['forEach'](_0x59073a=>{_0x59073a!==_0x53194c&&_0x59073a['isVisible']&&_0x59073a['hide']();}),_0x53194c['show'](),_0x53194c['pin']({'positions':[Ft['eastSouth']],'target':_0x4aa76e['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x53194c);}_hideNestedPanel(_0x277399){_0x277399['hide'](),this['_openNestedPanels']['delete'](_0x277399);}_hideAllNestedPanels(){this['_openNestedPanels']['forEach'](_0x4bba31=>_0x4bba31['hide']()),this['_openNestedPanels']['clear']();}_isMovingToNestedMenu(_0x15065e,_0x5e0152){if(!_0x15065e)return!0x1;if(_0x5e0152['element']?.['contains'](_0x15065e))return!0x0;const _0x3031aa=_0x15065e;return _0x3031aa['closest']&&(null!==_0x3031aa['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x3031aa['closest']('.ck-ai-quick-actions-group-list')||null!==_0x3031aa['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(_0x886942){return'rtl'===_0x886942['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}_getButtonKeystroke(_0x33d275){return'rtl'===_0x33d275['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x45ac17,_0x46495a,_0x2fbc5d,_0x462e93){_0x45ac17['key']==_0x46495a&&(_0x2fbc5d['focus'](),this['_hideNestedPanel'](_0x462e93));}_handleSearchResultButtonClick(_0xb003d4){_0xb003d4['fire']('execute');}};function Za(_0x29a10a){const {editor:_0x2fccac,content:_0x4b8820,buttonDefinition:_0x557650,bodyCollection:_0x37b869,hasSearch:_0x391a15=!0x1,actionButtons:_0x5447a4}=_0x29a10a;return()=>{const _0x41af97=_0x2fccac['locale'],_0xda3a44=_0x2fccac['commands']['get']('aiQuickAction'),_0x7226d8=_0x5c62d3(_0x41af97);_0x7226d8['bind']('isEnabled')['to'](_0xda3a44),_0x7226d8['buttonView']['set']({'icon':_0x557650['icon']??_0x3c7204,'label':_0x557650['label'],'tooltip':!0x0}),_0x7226d8['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x2739e3=new Ja(_0x2fccac,_0x4b8820,_0x7226d8,_0x37b869,_0x391a15,_0x5447a4);return _0x7226d8['panelView']['children']['add'](_0x2739e3),_0x391a15&&_0x7226d8['on']('change:isOpen',(_0x38f579,_0x3e8feb,_0x29fcfd)=>{if(_0x29fcfd){if(_0x2fccac['plugins']['has']('AIEditing')){const _0x30befa=_0x2fccac['plugins']['get'](sn),_0x3bf5b3=_0x2fccac['model']['document']['selection'],_0xabee35=Array['from'](_0x3bf5b3['getRanges']());_0xabee35['length']>0x0&&_0x30befa['showFakeVisualSelection']({'editor':_0x2fccac,'ranges':_0xabee35,'id':'quick-action','priority':0x14});}}else _0x2fccac['plugins']['has']('AIEditing')&&_0x2fccac['plugins']['get'](sn)['hideFakeVisualSelection']('quick-action'),_0x2739e3['resetSearch']();}),_0x7226d8;};}const th='<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>',eh='<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>',ih='<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>',sh=/* #__PURE__ -- @preserve */
37
- ((()=>({'chat':'AIChat','action':'AIActions'}))());var nh=class AIQuickActionsUI extends _0x31535a{_actionButtons=[];['_menuBarGroupViews']=[];_reporter;static get requires(){return[Dt,Es,Ln,Ss];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_reporter']=this['editor']['plugins']['get'](Ln)['createReporter']('aiquickactions');const _0x15485b=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x15485b),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static getDefaultQuickActions(_0xc2010a){return function(_0x58aa90){const _0x4d3674=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x58aa90['uiLanguage'])||'English';return[{'id':'ask-ai','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x5a9a65},{'id':'chat-commands','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x5a9a65,'actions':[{'id':'explain','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Ts(_0x58aa90,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':th['replace']('%0',_0x4d3674),'type':'chat'},{'id':'summarize','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Ts(_0x58aa90,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':eh['replace']('%0',_0x4d3674),'type':'chat'},{'id':'highlight-key-points','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Ts(_0x58aa90,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':ih['replace']('%0',_0x4d3674),'type':'chat'}]},{'id':'improve-writing','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x5ba3cf},{'id':'continue','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x2fa747},{'id':'fix-grammar','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x2cf474},{'id':'adjust-length','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x50c465,'actions':[{'id':'make-shorter','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x3bd80d,'actions':[{'id':'make-tone-casual','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x616488,'actions':[{'id':'translate-to-english','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Ts(_0x58aa90,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x55d41e,'actions':[]}];}(_0xc2010a);}_getDefaultAndCustomActions(){const _0x4dc375=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x1a9add=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x5ca0eb=>({..._0x5ca0eb,'type':'chat'===_0x5ca0eb['type']?'chat':'action','icon':void 0x0}));return _0x4dc375['find'](_0x1e3aa3=>'other'===_0x1e3aa3['id'])['actions']['push'](..._0x1a9add),_0x4dc375;}async _initActionTypeQuickActions(){try{const _0x5f565f=this['editor']['plugins']['get'](Ss),_0x39830d=await _0x5f565f['models']['getAllModels'](),_0xcca99=(await _0x5f565f['models']['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0xcca99),this['_enableButtonsByType']('action',_0x9150ef=>!!_0x39830d['find'](_0x595b28=>_0x595b28['id']===_0x9150ef['model'])||void 0x0===_0x9150ef['model']);}catch(_0x41719f){const _0x51e633=new ct('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x41719f});this['_reporter']['logError'](_0x51e633);}}_initChatTypeQuickActions(){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x22e288=this['editor']['plugins']['get']('AIChatController'),_0x1f74cd=this['editor']['plugins']['has']('AIChatUI')?this['editor']['plugins']['get']('AIChatUI'):null;this['listenTo'](_0x22e288,'change:isConversationReady',(_0xa871fb,_0x5651f9,_0x18aa6b)=>{this['_enableButtonsByType']('chat',()=>_0x18aa6b&&!_0x1f74cd?.['isBusy']);}),_0x1f74cd&&this['listenTo'](_0x1f74cd,'change:isBusy',(_0x2009b7,_0x2d5218,_0x3c83d2)=>{this['_enableButtonsByType']('chat',()=>_0x22e288['isConversationReady']&&!_0x3c83d2);}),this['_enableButtonsByType']('chat',()=>_0x22e288['isConversationReady']&&!_0x1f74cd?.['isBusy']);}_enableButtonsByType(_0x487abf,_0x1e074d){this['_quickActionsDefinition']['forEach'](_0x453735=>{'actions'in _0x453735?_0x453735['actions']['forEach'](_0x27d543=>{_0x27d543['type']===_0x487abf&&(_0x27d543['isEnabled']=_0x1e074d(_0x27d543));}):_0x453735['type']===_0x487abf&&(_0x453735['isEnabled']=_0x1e074d(_0x453735));}),this['_actionButtons']['forEach'](_0x5c7c08=>{if(rh(_0x5c7c08['action']))return;if(_0x5c7c08['action']['type']!==_0x487abf)return;const _0xd6cea5=_0x1e074d(_0x5c7c08['action']);if(_0x5c7c08['action']['isEnabled']=_0xd6cea5,_0x5c7c08['buttonView']['isEnabled']=_0xd6cea5,'action'===_0x487abf&&!_0xd6cea5&&_0x5c7c08['action']['model']){const _0x36446b=new ct('ai-quick-actions-unavailable-model',this,{'actionId':_0x5c7c08['action']['id'],'modelId':_0x5c7c08['action']['model']});this['_reporter']['logError'](_0x36446b);}}),this['_actionButtons']['filter'](_0x360596=>rh(_0x360596['action']))['forEach'](_0x3b80c0=>{_0x3b80c0['buttonView']['isEnabled']=_0x3b80c0['action']['actions']['some'](_0x15ab49=>_0x15ab49['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x2759e5,group:_0x5522f3})=>{_0x2759e5['isEnabled']=_0x5522f3['actions']['some'](_0x4b728c=>_0x4b728c['isEnabled']);});}_enableButtonById(_0x42bfef,_0x55d5f8){this['_quickActionsDefinition']['forEach'](_0x28e316=>{'actions'in _0x28e316?_0x28e316['actions']['forEach'](_0x453a12=>{_0x453a12['id']===_0x42bfef&&(_0x453a12['isEnabled']=_0x55d5f8(_0x453a12));}):_0x28e316['id']===_0x42bfef&&(_0x28e316['isEnabled']=_0x55d5f8(_0x28e316));}),this['_actionButtons']['forEach'](_0x280bc3=>{if(rh(_0x280bc3['action']))return;if(_0x280bc3['action']['id']!==_0x42bfef)return;const _0x11bf78=_0x55d5f8(_0x280bc3['action']);_0x280bc3['action']['isEnabled']=_0x11bf78,_0x280bc3['buttonView']['isEnabled']=_0x11bf78;});}_assignDefaultModelToCustomActions(_0x38fd5e){this['_actionButtons']['forEach'](_0x243fca=>{rh(_0x243fca['action'])||'action'===_0x243fca['action']['type']&&(_0x243fca['action']['model']||(_0x243fca['action']['model']=_0x38fd5e));});}_initializeQuickActionsComponentsAndCommands(){const _0x571191=new Ht(this['editor']['locale']);_0x571191['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x571191),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x571191);}_initializeQuickActionsDropdown(_0x2ecef5){const _0x1278d0=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Za({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x3c7204,'label':Ts(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x2ecef5,'hasSearch':_0x1278d0,'actionButtons':this['_actionButtons']}));}_prepareQuickActionsDefinition(_0x548f4c){this['_quickActionsDefinition']=_0x548f4c['map'](_0x5d17ce=>{if('actions'in _0x5d17ce){const _0x3ce30d=_0x5d17ce;return{..._0x3ce30d,'actions':_0x3ce30d['actions']['map'](_0x557a45=>{const {actions:_0x52ba56,..._0x104e93}=_0x3ce30d;return{..._0x557a45,'isEnabled':!0x1,'parent':_0x104e93};})['filter'](_0x4f98fb=>this['_shouldIncludeAction'](_0x4f98fb))};}return{..._0x5d17ce,'isEnabled':!0x1};})['filter'](_0x1f87cd=>'actions'in _0x1f87cd?_0x1f87cd['actions']['length']>0x0:this['_shouldIncludeAction'](_0x1f87cd));}_shouldIncludeAction(_0xe62344){const _0x53b207=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](sh[_0xe62344['type']])&&!_0x53b207['includes'](_0xe62344['id'])&&!('chat'===_0xe62344['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}_initializeQuickActionsComponents(_0x17b93d){this['_quickActionsDefinition']['forEach'](_0x314f77=>{if('actions'in _0x314f77){const _0x48ebab=Za({'editor':this['editor'],'content':_0x314f77['actions'],'buttonDefinition':_0x314f77,'bodyCollection':_0x17b93d,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x314f77['id'],_0x48ebab),_0x314f77['actions']['forEach'](_0x21a770=>{const _0x3836bb=qa({'editor':this['editor'],'action':_0x21a770,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x21a770['id'],_0x3836bb);});}else{const _0x1a5c20=qa({'editor':this['editor'],'action':_0x314f77,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x314f77['id'],_0x1a5c20);}});}_initializeQuickActionsMenuBar(){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x3141d0=>{const _0x3c84a9=this['editor']['commands']['get']('aiQuickAction'),_0x19f71b=new _0x45d7de(_0x3141d0),_0x4ad0f7=Ts(_0x3141d0,'AI_QUICK_ACTIONS_HEADING');_0x19f71b['buttonView']['set']({'label':_0x4ad0f7,'icon':_0x3c7204});const _0x1fa5b9=new _0x25f0ce(_0x3141d0);return _0x1fa5b9['set']({'ariaLabel':_0x4ad0f7,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0xe13945=>{if('actions'in _0xe13945){const _0x5f4b9d=_0xe13945,_0x1fc4c7=new _0x589943(_0x3141d0,_0x19f71b),_0x1fd7c7=new _0x45d7de(_0x3141d0),_0x3251cc=new _0x25f0ce(_0x3141d0);_0x1fd7c7['buttonView']['set']({'label':_0x5f4b9d['label'],'icon':_0x5f4b9d['icon']}),_0x5f4b9d['actions']['forEach'](_0x26b415=>{const _0xa26d35=new _0x589943(_0x3141d0,_0x1fd7c7),_0x32527f=new _0xe556ab(_0x3141d0);_0x32527f['set']({'label':_0x26b415['label'],'icon':_0x26b415['icon'],'role':'menuitem','isEnabled':_0x26b415['isEnabled']}),_0x32527f['on']('execute',()=>{this['_executeQuickAction'](_0x26b415);}),this['_actionButtons']['push']({'buttonView':_0x32527f,'action':_0x26b415}),_0x32527f['delegate']('execute')['to'](_0x1fd7c7),_0xa26d35['children']['add'](_0x32527f),_0x3251cc['items']['add'](_0xa26d35);}),_0x1fd7c7['isEnabled']=_0x5f4b9d['actions']['some'](_0x2e9221=>_0x2e9221['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x1fd7c7,'group':_0x5f4b9d}),_0x1fd7c7['panelView']['children']['add'](_0x3251cc),_0x1fc4c7['children']['add'](_0x1fd7c7),_0x1fa5b9['items']['add'](_0x1fc4c7);}else{const _0x4bfe27=_0xe13945,_0x17e752=new _0x589943(_0x3141d0,_0x19f71b),_0x59bd0a=new _0xe556ab(_0x3141d0);_0x59bd0a['set']({'label':_0x4bfe27['label'],'icon':_0x4bfe27['icon'],'role':'menuitem','isEnabled':_0x4bfe27['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x59bd0a,'action':_0x4bfe27}),_0x59bd0a['on']('execute',()=>{this['_executeQuickAction'](_0x4bfe27);}),_0x59bd0a['delegate']('execute')['to'](_0x19f71b),_0x17e752['children']['add'](_0x59bd0a),_0x1fa5b9['items']['add'](_0x17e752);}}),Object['values'](sh)['some'](_0x7ce3ff=>this['editor']['plugins']['has'](_0x7ce3ff))?_0x19f71b['bind']('isEnabled')['to'](_0x3c84a9):_0x19f71b['set']({'isEnabled':!0x1}),_0x19f71b['panelView']['children']['add'](_0x1fa5b9),_0x19f71b;});}_executeQuickAction(_0xc3177c){const _0x2c01f4=this['editor'];_0x2c01f4['editing']['view']['focus'](),_0x2c01f4['commands']['execute']('aiQuickAction',_0xc3177c);const _0x42892a=_0x2c01f4['ui']['view']['menuBarView'];_0x42892a&&_0x42892a['close']&&_0x42892a['close']();}};function rh(_0x287b5f){return'actions'in _0x287b5f;}function oh(_0x3024e5,_0x42bce5){const _0x2e52f9=_0x3024e5['plugins']['get']('AITabs')['view'];_0x2e52f9['isVisible']=!0x0,_0x2e52f9['activateTab'](_0x42bce5);}var ah=class extends _0x426681{execute(_0x1da6f1){switch(this['_expandSelectionIfCollapsed'](),_0x1da6f1['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x1d11c7=Ts(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x1d11c7});}this['_handleAIChatAction'](_0x1da6f1);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x3df76e=Ts(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3df76e});}this['_handleAIActionsAction'](_0x1da6f1);}}async _handleAIChatAction(_0x15e71b){const _0x39c742=this['editor']['plugins']['get']('AIChatController');if(oh(this['editor'],'chat'),'ask-ai'===_0x15e71b['id'])_0x39c742['removeSelectionFromChatContext'](),_0x39c742['addSelectionToChatContext'](this['editor']),_0x39c742['focusPromptInput']();else await _0x39c742['startConversation']({'modelId':_0x15e71b['model'],'contexts':this['_resolveActionContexts'](_0x15e71b)}),_0x39c742['removeSelectionFromChatContext'](),_0x39c742['addSelectionToChatContext'](this['editor']),_0x39c742['focusPromptInput'](),await _0x39c742['sendMessage']({'message':_0x15e71b['prompt']||_0x15e71b['displayedPrompt']||_0x15e71b['label'],'attributes':{'quickActionData':{'id':_0x15e71b['id']},'displayedPrompt':_0x15e71b['displayedPrompt']}});}_expandSelectionIfCollapsed(){const _0xe28120=this['editor'],_0x15cfbe=_0xe28120['model']['document']['selection'];if(!_0x15cfbe['isCollapsed'])return;const _0x42bfcb=Tt(_0x15cfbe['getSelectedBlocks']())||_0xe28120['model']['schema']['getLimitElement'](_0x15cfbe);_0xe28120['model']['change'](_0x3373ec=>{_0x3373ec['setSelection'](_0x42bfcb,'in');});}_handleAIActionsActionLabel(_0x4f8f8f){return _0x4f8f8f['parent']?.['label']&&'other'!==_0x4f8f8f['parent']?.['id']?_0x4f8f8f['parent']['label']+':\x20'+_0x4f8f8f['label']:_0x4f8f8f['label'];}async _handleAIActionsAction(_0x1c327f){const _0x5e6ae0=this['editor']['plugins']['get']('AIActions'),_0xa7500e=this['_resolveActionContexts'](_0x1c327f);let _0x2b8254;_0x2b8254=_0x1c327f['prompt']?{'userMessage':_0x1c327f['prompt'],'model':_0x1c327f['model'],'contexts':_0xa7500e}:_0x1c327f['context']?{'model':_0x1c327f['model'],'contexts':_0xa7500e}:{'actionName':_0x1c327f['actionName']||_0x1c327f['id'],'args':_0x1c327f['args'],'contexts':_0xa7500e};const _0x52e648=this['_handleAIActionsActionLabel'](_0x1c327f);await _0x5e6ae0['executeAction'](_0x2b8254,_0x52e648,_0x1c327f['icon']);}_resolveActionContexts(_0x2cab2d){const _0x3fab9b=_0x2cab2d['parent']?.['id']?[_0x2cab2d['id'],_0x2cab2d['parent']['id']]:[_0x2cab2d['id']];return this['editor']['plugins']['get'](Ss)['contextLibrary']['resolveContext']({'feature':'quickActions','ids':_0x3fab9b,'extraContexts':_0x2cab2d['context']?[_0x2cab2d['context']]:[],'context':new qn()})['refs'];}},hh=class extends _0x31535a{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x470106=this['editor'],_0x3976f6=new ah(this['editor']);if(_0x470106['commands']['add']('aiQuickAction',_0x3976f6),_0x470106['plugins']['has']('AIChat')){const _0x275562=this['editor']['plugins']['get']('AIChatController');_0x470106['model']['document']['selection']['on']('change:range',(_0x109b47,_0x2eec2c)=>{_0x2eec2c['directChange']&&_0x275562['removeSelectionFromChatContext']();});}}},ch=class extends Gn{appendContent(_0x515178,_0x339902='text'){'modification'===this['type']&&'text'===_0x339902&&(_0x339902=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x515178,_0x339902);}updateChangeGroups(_0x164da3){const _0x13d7ea=this['parsedContent']['get'](_0x164da3)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x164da3,_0x13d7ea),this['changeGroups']=[],0x0==_0x13d7ea['childNodes']['length'])return;hn(this['documentContextContent']['get'](_0x164da3),this['parsedMergedContent']['get'](_0x164da3));const _0x237a79=_0x4a1d6a(this['documentContextContent']['get'](_0x164da3)['children']['map'](_0x10ccbe=>({'node':_0x10ccbe,'id':Hs(_0x10ccbe,'data-id')})),_0x13d7ea['children']['map'](_0x24dcd0=>({'node':_0x24dcd0,'id':Hs(_0x24dcd0,'data-id')||Nt()})),{'comparator':(_0x40807b,_0x518a70)=>_0x40807b['id']==_0x518a70['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x237a79['length']&&_0x237a79[_0x237a79['length']-0x1]['removed'];)_0x237a79['pop']();}const _0xf65d43=_0x237a79['map'](_0x1eeb70=>{const _0x22eaa0=_0x1eeb70['added']?'new':_0x1eeb70['removed']?'removed':'modified';return{'node':_0x1eeb70['value'][0x0]['node'],'type':_0x22eaa0,'id':_0x1eeb70['value'][0x0]['id']};}),_0x3ad7de=this['_documentIdToSource']['get'](_0x164da3);this['changeGroups']['push']({'changes':_0xf65d43,'state':'pending','index':this['changeGroups']['length'],'editor':_0x3ad7de['editor'],'rootName':_0x3ad7de['rootName'],'documentId':_0x164da3});}_getDifferentChangeGroups(_0x4d6d19,_0x567736){return _0x567736;}},lh=class extends Wn{content;['version'];editor;rootName;actionName;['args'];['userMessage'];['model'];contexts;['hasError']=!0x1;stoppedExplicitly=!0x1;constructor(_0x652f76){super(_0x652f76),this['content']=_0x652f76['content'],this['version']=_0x652f76['version'],this['editor']=_0x652f76['editor'],this['rootName']=_0x652f76['rootName'],this['actionName']=_0x652f76['actionName'],this['args']=_0x652f76['args'],this['userMessage']=_0x652f76['userMessage'],this['model']=_0x652f76['model'],this['contexts']=_0x652f76['contexts'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}sendRequest(){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args'],'contexts':this['contexts']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html','contexts':this['contexts']});}getDocumentContext(){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':Nt(),'channelId':this['editor']['config']['get']('collaboration.channelId'),'selectionSignature':''}],'label':'Current\x20document','uiId':'current-document'};}createReply(_0x32ce2f){const _0x3dc028=this['editor']['config']['get']('collaboration.channelId'),_0x41a1c9=new ch({..._0x32ce2f,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x3dc028,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x3dc028,this['editor']]])});return this['replies']['push'](_0x41a1c9),_0x41a1c9['delegate'](...Kn)['to'](this),this['fire']('replyCreated',_0x41a1c9),_0x41a1c9;}},uh=class extends _0x4a1d9b{constructor(_0x57ee12,_0x2e1b5b=!0x0,_0x143818=!0x0){super(_0x57ee12),this['set']('isEnabled',!0x1),_0x2e1b5b&&(this['applyButton']=this['_createButton'](Ts(_0x57ee12,'AI_BALLOON_APPLY_BUTTON'),Dn),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x143818&&(this['suggestButton']=this['_createButton'](Ts(_0x57ee12,'AI_BALLOON_SUGGEST_BUTTON'),_0x2e1b5b?Hn:Dn),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x2e1b5b,'showSuggestButton':_0x143818}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}setButtonsVisibility({showApplyButton:_0x2374fd,showSuggestButton:_0x474fa5}){this['applyButton']&&(this['applyButton']['isVisible']=_0x2374fd),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x474fa5);}_createButton(_0x9356d9,_0x23a1fe){const _0x30c38c=new Vt(this['locale']);return _0x30c38c['set']({'label':_0x9356d9,'class':_0x23a1fe,'isVisible':!0x0,'withText':!0x0}),_0x30c38c;}},dh=class extends _0x4f75f8{constructor(_0x197830){super(_0x197830),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Ts(_0x197830,'AI_DISCLAIMER_TEXT')}]}]});}},_h=class extends _0x4f75f8{constructor(_0x459c62){super(_0x459c62),this['set']('isVisible',!0x0);const _0x526cbf=new Mr('small');_0x526cbf['isVisible']=!0x0;const _0x1c19f3=new _0x4f75f8(this['locale']);_0x1c19f3['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Ts(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x5c1774=>!_0x5c1774)]},'children':[_0x526cbf,_0x1c19f3]});}},gh=class extends Va{['focusCycler'];['_config'];_contentWrapper;_streamableContentView;_toolbarView;['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];_keystrokes;_dialogContent;['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];_navigationPreviousButton;_navigationNextButton;_navigationTryAgainButton;_navigationCounter;constructor(_0x17d71d,_0x30b228){super(_0x17d71d),this['set']('isBusy',!0x1),this['set']('isTargetReadOnly',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x30b228,this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Wt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x340edf(),this['_addContentWrapper'](_0x30b228),this['_addDisclaimerView'](),this['_addToolbar'](_0x30b228),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'](_0x30b228);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x5a8638 of this['_focusables'])this['_focusTracker']['add'](_0x5a8638['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}destroy(){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x2b710e){-0x1===_0x2b710e?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}setIsLoading(_0x5785af){this['_isLoading']=_0x5785af;}setErrorState(){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}clearErrorState(){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x470627){super['showError'](_0x470627),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x50e429){super['showBlockingError'](_0x50e429),this['setErrorState']();}addMiniToolbarItem(_0x468080){this['_miniToolbarView']['items']['has'](_0x468080)||this['_miniToolbarView']['items']['add'](_0x468080);}removeMiniToolbarItem(_0x397d1e){this['_miniToolbarView']['items']['has'](_0x397d1e)&&this['_miniToolbarView']['items']['remove'](_0x397d1e);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}_toggleToolbarButtonsVisibility({showApplyButton:_0x425603,showSuggestButton:_0x29b3d3}){_0x425603=_0x425603&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x29b3d3=_0x29b3d3&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x425603,'showSuggestButton':_0x29b3d3});}async updateContent(_0x22fd5e){await this['_streamableContentView']['update'](_0x22fd5e);}finalizeContent(){this['_streamableContentView']['cleanUpStreamingArtifacts']();}clearContent(){this['_streamableContentView']['clear']();}_addContentWrapper(_0x5819a4){this['_contentWrapper']=new _0x4f75f8(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content',this['bindTemplate']['if']('_isErrorVisible','ck-hidden')]},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x5819a4['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new dh(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x4f4a22,showSuggestButton:_0x5343ca}){this['_toolbarView']=new uh(this['locale'],_0x4f4a22,_0x5343ca),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',this,'isTargetReadOnly',(_0x13c42a,_0x3c4750,_0x18858b,_0x1a6861)=>!(_0x13c42a||_0x3c4750||_0x18858b||_0x1a6861)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x4f4a22,'showSuggestButton':_0x5343ca}),this['_dialogContent']['add'](this['_toolbarView']);}_createMiniToolbar(_0x3064b9){return this['_miniToolbarView']=new Fa(this['locale'],_0x3064b9),this['_miniToolbarView']['delegate'](...nr)['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',(_0xcbf027,_0x4650da)=>!(_0xcbf027||_0x4650da)),this['_miniToolbarView'];}_createLoaderView(){return this['_loaderView']=new _h(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}_createStreamableContentView(){return this['_streamableContentView']=new wr(this['locale']),this['_streamableContentView'];}_setupMiniToolbarButtons(){const _0x1f4af2=new Vt(this['locale']),_0x5afa90=new Vt(this['locale']),_0x224be1=new Ah(this['locale']),_0x502bdd=new Vt(this['locale']);_0x1f4af2['set']({'icon':_0x3a355c,'label':Ts(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Mn}),_0x5afa90['set']({'icon':_0x406e30,'tooltip':Ts(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Mn}),_0x502bdd['set']({'icon':_0x5aa540,'tooltip':Ts(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Mn}),_0x1f4af2['bind']('isEnabled')['to'](this,'isBusy',_0x128bf0=>!_0x128bf0),_0x1f4af2['on']('execute',()=>{this['fire']('tryAgain');}),_0x5afa90['bind']('isEnabled')['to'](this,'isBusy',_0x35d3c6=>!_0x35d3c6),_0x5afa90['on']('execute',()=>{this['fire']('showPrevious');}),_0x502bdd['bind']('isEnabled')['to'](this,'isBusy',_0x59fd60=>!_0x59fd60),_0x502bdd['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x5afa90,this['_navigationCounter']=_0x224be1,this['_navigationNextButton']=_0x502bdd,this['_navigationTryAgainButton']=_0x1f4af2;}updateMiniToolbarButtons(_0x367607,_0x42fa08){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x5a1201=_0x367607>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x5a1201){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x4fab28=_0x367607-_0x42fa08;this['_navigationCounter']['setInteractionCount'](_0x4fab28+'/'+_0x367607),this['_navigationPreviousButton']['isEnabled']=_0x42fa08<_0x367607-0x1,this['_navigationNextButton']['isEnabled']=_0x42fa08>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(_0x46c259){this['_isLoading']=_0x46c259;}resetShowChangesButton(){this['_miniToolbarView']['isShowChangesOn']=!0x1;}_setupMiniToolbarPositioning(){const _0x4b8754=this['_streamableContentView']['element'],_0x329c82=this['_miniToolbarView']['element'],_0x1f4cb6=()=>{Ct['window']['requestAnimationFrame'](()=>{const _0x2fd75f=_0x4b8754['offsetWidth']-_0x4b8754['clientWidth'];_0x329c82['style']['right']='calc('+_0x2fd75f+'px\x20+\x20var(--ck-spacing-large))';});};_0x1f4cb6(),this['_miniToolbarResizeObserver']=new pt(_0x4b8754,()=>{_0x1f4cb6();});}_initializeScrollManager(){const _0x57db53=this['_getScrollableElement']();_0x57db53&&!this['_scrollManager']&&(this['_scrollManager']=new co(_0x57db53));}_getScrollableElement(){return this['_streamableContentView']['element'];}},Ah=class extends _0x4f75f8{constructor(_0x47bdae){super(_0x47bdae);const _0x4fb75a=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x4fb75a['to']('interactionCount')}]});}setInteractionCount(_0x2e4a16){this['set']('interactionCount',_0x2e4a16);}},Ih=class extends _0x31535a{static get requires(){return[Es,Ln,Bt,sn,Ga,_0x4eecd6];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_aiConnector;_interactions=[];_currentInteractionIndex=0x0;_interactionParams;['_balloonShowDiff']=!0x1;['_promiseQueue'];get _interaction(){return this['_interactions'][this['_interactions']['length']-0x1];}_actionsBalloonView;_reporter;constructor(_0xc87d7a){super(_0xc87d7a),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](Ln)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Or();}stopInteraction(){this['_stopInteraction']();}async executeAction(_0x3142a2,_0x265882,_0x1f7ebc){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x345457,anchorData:_0x407ac5,root:_0x368cf4}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x3142a2,_0x345457,_0x407ac5,_0x368cf4,_0x265882,_0x1f7ebc);}const {modelFragment:_0x5d273f,anchorData:_0x3c1fb9,root:_0x3f2567}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x3142a2,_0x5d273f,_0x3c1fb9,_0x3f2567,_0x265882,_0x1f7ebc);}async destroy(){return this['_stopInteraction'](),super['destroy']();}_createActionsBalloonView(){const _0x382e39=this['editor']['plugins']['has']('TrackChanges');let _0x1986c1=this['editor']['config']['get']('ai.availableReplyActions')||[...kr];_0x382e39||(_0x1986c1=_0x1986c1['filter'](_0x5bab50=>'insertSuggestion'!=_0x5bab50));const _0xc5acf4=this['editor']['commands']['get']('trackChanges'),_0x23005d=new gh(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x382e39,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x1986c1});return _0x23005d['bind']('isBusy')['to'](this),_0x23005d['bind']('isTargetReadOnly')['to'](this['editor'],'isReadOnly'),_0xc5acf4&&_0x23005d['bind']('isTrackChangesOn')['to'](_0xc5acf4,'value'),_0x23005d['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x23005d['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x23005d['on']('showNext',()=>{this['_navigateToNext']();}),_0x23005d;}_normalizeSelectionStart(){const _0x43bed5=this['editor']['model'],_0xf1c20c=_0x43bed5['document']['selection'],_0x134645=_0xf1c20c['getFirstRange']();if(!_0x134645||_0x134645['isCollapsed'])return;const _0x568bcc=Tt(_0xf1c20c['getSelectedBlocks']());if(!_0x568bcc)return;const _0x3cd1d3=_0x43bed5['createPositionAt'](_0x568bcc,0x0);_0x3cd1d3['isAfter'](_0x134645['start'])&&_0x43bed5['change'](_0x4c2f8e=>{_0x4c2f8e['setSelection'](_0x4c2f8e['createRange'](_0x3cd1d3,_0x134645['end']));});}_getExecuteDataRegular(){const _0x459279=this['editor']['model']['document']['selection'],_0x412da6=_0x459279['getFirstRange']()['start']['root'];if(_0x459279['isCollapsed']){const _0x36932d=Tt(_0x459279['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x459279);this['editor']['model']['change'](_0x50ce1e=>{_0x50ce1e['setSelection'](_0x36932d,'in');});}this['_normalizeSelectionStart']();const _0x153281=_0x459279['getFirstRange'](),_0x3dd6a2=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x459279),_0x153281['start'],_0x153281['end']);this['_copyMarkersToFragment'](_0x3dd6a2,_0x459279,{'isTableSelection':!0x1});const _0x343ea8=_0x459279['getFirstRange']()['start'],_0x1697a1=new Map();let _0x86722b=_0x3dd6a2;for(let _0x363dc7=0x0;_0x363dc7<_0x343ea8['path']['length'];_0x363dc7++)_0x1697a1['set'](_0x86722b,_0x343ea8['path'][_0x363dc7]),_0x86722b=_0x86722b['getChild'](0x0);return{'modelFragment':_0x3dd6a2,'anchorData':_0x1697a1,'root':_0x412da6};}_getExecuteDataInTable(){const _0x2161a2=this['editor']['model']['document']['selection'],_0x515151=this['editor']['plugins']['get']('TableSelection'),_0x8153a=_0x2161a2['getFirstRange']()['start']['root'],_0x238de7=_0x515151['getSelectionAsFragment'](),_0x1d06db=_0x2161a2['getFirstRange']()['start']['parent']['parent'],_0x5e5577=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x1d06db),this['editor']['model']['createPositionAfter'](_0x1d06db)),_0x55eb03=this['_wrapWithCommonAncestors'](_0x238de7,_0x5e5577['start'],_0x5e5577['end']);this['_copyMarkersToFragment'](_0x55eb03,_0x2161a2,{'isTableSelection':!0x0});const _0x5627cc=_0x2161a2['getFirstRange']()['start'],_0x1b5e18=new Map();let _0xfab5e9=_0x55eb03;for(let _0x574795=0x0;_0x574795<_0x5627cc['path']['length'];_0x574795++)if(_0x1b5e18['set'](_0xfab5e9,_0x5627cc['path'][_0x574795]),_0x574795<_0x5627cc['path']['length']-0x1)_0xfab5e9=_0xfab5e9['getChild'](0x0);else{let _0x294da6=_0xfab5e9['nextSibling'];for(;_0x294da6;)_0x1b5e18['set'](_0x294da6,_0x5627cc['path'][_0x574795]),_0x294da6=_0x294da6['nextSibling'];}return{'modelFragment':_0x55eb03,'anchorData':_0x1b5e18,'root':_0x8153a};}async _executeAction(_0x3a2235,_0x1359ff,_0x35aad1,_0x39a68b,_0x18ace6,_0x55a005){const _0x1bfe3b=this['editor']['plugins']['get'](sn),_0x31c037=this['editor']['plugins']['get'](Ga),_0x5ce85e=this['editor']['model']['document']['selection'],_0x5d7b55=await _0x1bfe3b['modelToDataWithIds'](_0x1359ff,this['editor'],_0x39a68b['rootName']),_0x12e014=this['editor']['model']['document']['version'],_0x5798fc=[..._0x5ce85e['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x31c037['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x18ace6,'icon':_0x55a005||_0x3c7204,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x5798fc,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x31c037),this['_interactionParams']={'action':_0x3a2235,'content':_0x5d7b55,'version':_0x12e014,'aiBalloon':_0x31c037,'modelFragment':_0x1359ff,'anchorData':_0x35aad1,'root':_0x39a68b},this['_setupApplyListeners'](),this['listenTo'](_0x31c037,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x31c037,'dialogClosed',(_0x52be00,{id:_0x2846dc})=>{if('aiActionsBalloon'===_0x2846dc){for(const _0x109fe3 of this['_interactions']){if(0x0===_0x109fe3['replies']['length']||_0x109fe3['stoppedExplicitly'])continue;const _0x1f490f=_0x109fe3['replies'][_0x109fe3['replies']['length']-0x1],_0x2e1c75=_0x1f490f['changeGroups'][0x0];_0x2e1c75&&'pending'===_0x2e1c75['state']&&_0x1f490f['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x31c037);}}),this['_createInteraction'](_0x5d7b55,_0x12e014,_0x31c037,_0x3a2235);}_setupApplyListeners(){if(!this['_interactionParams'])return;const {modelFragment:_0xd63dec,anchorData:_0x4380cf,root:_0x208a84}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0xd63dec,_0x4380cf,_0x208a84,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0xd63dec,_0x4380cf,_0x208a84,!0x0);});}_wrapWithCommonAncestors(_0xa67d3d,_0x191590,_0x252381){const _0x181a04=this['editor']['model']['createRange'](_0x191590,_0x252381)['getCommonAncestor'](),_0x15f135=_0x181a04['is']('documentFragment')?[]:_0x181a04['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x15f135['length']){const _0xeefc35=_0x15f135['map'](_0x4079f3=>_0x4079f3['_clone'](!0x1));for(let _0x264cb9=0x1;_0x264cb9<_0xeefc35['length'];_0x264cb9++)_0xeefc35[_0x264cb9-0x1]['_appendChild'](_0xeefc35[_0x264cb9]);return _0xeefc35[_0xeefc35['length']-0x1]['_appendChild'](_0xa67d3d),new _0x58f66a(_0xeefc35[0x0]);}return _0xa67d3d;}_copyMarkersToFragment(_0x3026c6,_0x4fb11c,_0x5c13d5={'isTableSelection':!0x1}){const _0x48c4a9=this['editor']['model'],_0x2c1b34=Array['from'](_0x4fb11c['getRanges']()),_0x1f990d=_0x4fb11c['getFirstRange']()['start'];for(const _0xac97c0 of _0x48c4a9['markers']){if(_0xac97c0['name']['startsWith']('ai-selection')||!_0xac97c0['affectsData'])continue;const _0x16cd09=_0xac97c0['getRange']();if(!_0x2c1b34['some'](_0x2cd607=>_0x2cd607['containsRange'](_0x16cd09,!0x0)))continue;const _0x1739a0=this['_regularCalculateMarkerPath'](_0x16cd09['start'],_0x1f990d,_0x5c13d5['isTableSelection']),_0x2c45d1=this['_regularCalculateMarkerPath'](_0x16cd09['end'],_0x1f990d,_0x5c13d5['isTableSelection']),_0x5117d2=_0x48c4a9['createPositionFromPath'](_0x3026c6,_0x1739a0),_0x131c10=_0x48c4a9['createPositionFromPath'](_0x3026c6,_0x2c45d1);if(!_0x5117d2['isEqual'](_0x131c10)){const _0x37a758=_0x48c4a9['createRange'](_0x5117d2,_0x131c10);_0x3026c6['markers']['set'](_0xac97c0['name'],_0x37a758);}}}_regularCalculateMarkerPath(_0x4c00ec,_0x10b311,_0x2ee3a3=!0x1){const _0x37ce33=[..._0x4c00ec['path']['slice']()];for(let _0x4a9397=0x0;_0x4a9397<Math['max'](_0x10b311['path']['length'],_0x4c00ec['path']['length']);_0x4a9397++){const _0x3678fa=_0x10b311['path'][_0x4a9397]||0x0,_0x15b377=(_0x4c00ec['path'][_0x4a9397]||0x0)-_0x3678fa;if(_0x37ce33[_0x4a9397]=_0x15b377,0x0!==_0x15b377&&!_0x2ee3a3)break;}return _0x37ce33;}async _createInteraction(_0x9d8a5b,_0x2d8655,_0x26b363,_0x411302){const _0x729556=this['editor'],_0x29d523=_0x729556['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x411302,'content':_0x9d8a5b,'version':_0x2d8655,'aiBalloon':_0x26b363,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x29d523});const _0x352e62=new lh({'connector':this['_aiConnector'],'locale':_0x729556['locale'],'content':_0x9d8a5b,'version':_0x2d8655,'editor':_0x729556,'rootName':_0x29d523['rootName'],..._0x411302});this['_interactions']['push'](_0x352e62);const _0x197344=(_0x42e8ae,_0x3286ce=!0x1,_0x7edac0='streaming')=>{const {isDone:_0xcc2e7b}=_0x42e8ae;return this['_promiseQueue']['enqueue'](async _0x5d0f48=>{try{if(this['_isUnsupportedInlineRootChange'](_0x42e8ae,_0x29d523))return this['_actionsBalloonView']['showBlockingError'](Ts(_0x729556['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),void(_0xcc2e7b&&this['_actionsBalloonView']['finalizeContent']());const _0x41617f=dn({'changeGroups':_0x42e8ae['changeGroups'],'documentContextContent':_0x42e8ae['documentContextContent'],'showDiff':_0x3286ce,'trimUnchanged':!0x1});_0x41617f['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x41617f[0x0],'renderingStrategy':_0x7edac0,'abortSignal':_0x5d0f48}),_0xcc2e7b&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x1f06f6){if(Nn(_0x1f06f6))return;throw _0x1f06f6;}});};_0x352e62['on']('replyCreated',(_0x55bca3,_0x2bca42)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x197344(_0x2bca42)['catch'](_0x107297=>{this['_reporter']['logError'](_0x107297,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x352e62,_0x107297);});}),_0x352e62['on']('replyContentUpdated',(_0x24b2b0,_0x2a8076)=>{_0x197344(_0x2a8076)['catch'](_0x22358b=>{this['_reporter']['logError'](_0x22358b,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x352e62,_0x22358b);});}),_0x352e62['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x2a2bd4){this['_reporter']['logError'](_0x2a2bd4,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x352e62,_0x2a2bd4);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x2a9f4b,{showDiff:_0x1b61c6})=>{try{this['_balloonShowDiff']=_0x1b61c6;const _0x31836e=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x31836e&&await _0x197344(_0x31836e,_0x1b61c6,'static');}catch(_0x398651){this['_reporter']['logError'](_0x398651,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x352e62,_0x398651);}}),_0x352e62['on']('replyChangeGroupStateUpdated',()=>{const _0x3a1809={'positiveCount':_0x352e62['replies']['reduce']((_0x5b220d,_0x5c8e50)=>_0x5b220d+_0x5c8e50['changeGroups']['filter'](_0x3a9876=>'accepted'===_0x3a9876['state'])['length'],0x0),'totalCount':_0x352e62['replies']['reduce']((_0x4e82f8,_0x688c21)=>_0x4e82f8+_0x688c21['changeGroups']['length'],0x0)},_0xcc4521=_0x352e62['actionCallId'],_0x5706f7=_0x352e62['actionName'];_0x5706f7?this['_aiConnector']['upsertAIActionRating'](_0x5706f7,_0xcc4521,_0x3a1809):this['_aiConnector']['upsertCustomAIActionRating'](_0xcc4521,_0x3a1809);}),this['_setLoadingState']();try{const _0x305bdb=await _0x352e62['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x305bdb;}catch(_0x9cee61){Nn(_0x9cee61)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x9cee61,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x352e62,_0x9cee61);}}_isUnsupportedInlineRootChange(_0x563070,_0xfd011b){const _0x24a002=this['editor'];return!!Ks(_0x24a002,_0xfd011b['rootName'])&&!qs(_0x24a002,new _0x59229a((_0x563070['changeGroups'][0x0]?.['changes']??[])['filter'](_0x4bc95b=>'removed'!==_0x4bc95b['type'])['map'](_0x55b1bf=>_0x55b1bf['node']['cloneNode'](!0x0))));}['_applyChanges'](_0x9d8c4e,_0x271069,_0x513793,_0x311106){const _0x25ae48=this['editor'];if(_0x311106&&!_0x25ae48['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',null);const _0x219ecf=this['editor']['plugins']['get'](_0x4eecd6),_0x5019aa=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5019aa||!_0x5019aa['replies']['length'])return;const _0x5bb492=_0x5019aa['replies'][_0x5019aa['replies']['length']-0x1];if(this['_isUnsupportedInlineRootChange'](_0x5bb492,_0x513793))return void this['_actionsBalloonView']['showBlockingError'](Ts(_0x25ae48['locale'],'AI_SUGGESTION_NO_PARTS_WARNING'));_0x5bb492['setChangeGroupState'](0x0,'accepted');const _0x1d4de2=tr({'documentSuggestions':er({'groups':[_0x5bb492['changeGroups'][0x0]],'documentContextContent':_0x5bb492['documentContextContent'],'documents':_0x5019aa['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x219ecf,'documentCompareOptions':{'anchor':_0x25ae48['model']['createPositionAt'](_0x9d8c4e,0x0),'markDeletions':_0x311106}})['values']()['next']()['value']??[],_0xb65cfb=this['_filterOperationsOutsideRange'](_0x1d4de2,_0x271069);for(const _0x5a6980 of _0xb65cfb)this['_anchorOperation'](_0x271069,_0x5a6980,_0x513793);const _0x36ffc4=_0x5019aa['getDocumentContext']()['documents'][0x0]['version'],_0x13ca2c=_0x400478(_0xb65cfb,_0x25ae48['model']['document']['history']['getOperations'](_0x36ffc4),{'document':_0x25ae48['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];wn(_0x13ca2c,'quickActions');try{_0x25ae48['model']['change'](_0x571027=>{_0x571027['setSelection'](_0x25ae48['model']['document']['selection']['focus']),_0x311106?_0x25ae48['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x13ca2c):_0x219ecf['applyOperations'](_0x571027,_0x13ca2c);});}catch(_0x5bdb89){throw this['_reporter']['logError'](new xn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x5bdb89})),_0x5bdb89;}this['editor']['plugins']['get']('AIBalloon')['close']();}_filterOperationsOutsideRange(_0x376531,_0x659f70){return _0x376531['filter'](_0xbd93e4=>{if('rename'==_0xbd93e4['type']){const _0xb22f64=_0xbd93e4['position']['nodeAfter'];return!_0x659f70['has'](_0xb22f64);}if(_0xbd93e4['type']['indexOf']('Attribute')>-0x1){const _0x587e87=_0xbd93e4['range']['start']['nodeAfter'];return!_0x659f70['has'](_0x587e87);}return!0x0;});}_anchorOperation(_0x374bab,_0x42565b,_0x20a13f){const _0xaa4462=_0x42565b['clone']();for(const _0x5e8ab2 in _0x42565b){const _0x5b07b6=_0x42565b[_0x5e8ab2];_0x5b07b6 instanceof _0x2be128?_0x42565b[_0x5e8ab2]=new _0x2be128(_0x5c3f76(_0x5b07b6['start']),_0x5c3f76(_0x5b07b6['end'])):_0x5b07b6 instanceof _0x159a64&&(_0x42565b[_0x5e8ab2]=_0x5c3f76(_0x5b07b6));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0xaa4462['type'])){if(_0xaa4462['isDocumentOperation']=!0x1,_0xaa4462['baseVersion']=null,'remove'==_0xaa4462['type']){const _0x4a217a=_0xaa4462['sourcePosition'],_0x3703d7=_0xaa4462['howMany'];new _0x4374a5(_0x4a217a,_0x3703d7)['_execute']();}else _0xaa4462['_execute']();}function _0x5c3f76(_0x5c3739){if('$graveyard'==_0x5c3739['root']['rootName'])return _0x5c3739;const _0x320605=[];let _0x547227=_0x5c3739['root'];for(let _0x23b841=0x0;_0x23b841<_0x5c3739['path']['length'];_0x23b841++){const _0x3e44a1=_0x374bab['get'](_0x547227)||0x0;_0x320605[_0x23b841]=_0x5c3739['path'][_0x23b841]+_0x3e44a1,_0x547227=_0x547227['getChildAtOffset'](_0x5c3739['path'][_0x23b841]);}return new _0x159a64(_0x20a13f,_0x320605,_0x5c3739['stickiness']);}}_refreshInteraction(){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x43e990,content:_0x2f6077,version:_0x228494,aiBalloon:_0x9f8970}=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'](_0x2f6077,_0x228494,_0x9f8970,_0x43e990)['catch'](_0x40729f=>{this['_reporter']['logError'](_0x40729f,{'context':{'operation':'refresh-interaction'}});});}_clearInteractionHistory(){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_stopInteraction(){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}_navigateToPrevious(){const _0x560618=this['_interactions']['length'];this['_currentInteractionIndex']<_0x560618-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}_navigateToNext(){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async _displayInteractionAtIndex(_0x49ca28){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x49ca28;const _0x211147=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x211147)return;if(_0x211147['hasError'])return this['_setErrorState'](_0x211147),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x211147['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x13b73f=_0x211147['replies'][_0x211147['replies']['length']-0x1];if(_0x13b73f)try{const _0x29cb8d=dn({'changeGroups':_0x13b73f['changeGroups'],'documentContextContent':_0x13b73f['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x434810=>setTimeout(_0x434810,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x29cb8d[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x3699d3){this['_reporter']['logError'](_0x3699d3,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_setLoadingState(){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async _setErrorState(_0x32e54e,_0x10c1cd){if(void 0x0!==_0x10c1cd&&Nn(_0x10c1cd))return;const _0x528f9b=Ts(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x528f9b),_0x32e54e['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);}},ph=class extends _0x31535a{static get requires(){return[nh,hh,Ih];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2a58d8){super(_0x2a58d8),_0x2a58d8['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Eh=class extends _0x4f75f8{resultResponseView;acceptButtonView;dismissButtonView;infoButtonView;outdatedButtonView;constructor(_0x35693b,_0x205b63){super(_0x35693b),this['id']=_0x205b63,this['set']('status','pending'),this['set']('changeId',_0x205b63),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',(_0x8aafe6,_0x7e61cb)=>{_0x7e61cb&&_0x7e61cb['target']&&'A'===_0x7e61cb['target']['tagName']&&_0x7e61cb['preventDefault'](),this['fire']('activateChange',{'id':_0x205b63,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x205b63,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x205b63,'source':this});}),this['on']('change:showDiff',()=>this['_syncResponseVisibility']());}['render'](){super['render'](),this['_syncResponseVisibility']();}setItemAsActive(){this['isActive']=!0x0;}setItemAsInactive(){this['isActive']=!0x1;}_createResultResponseView(){const _0x3815e5=new _0x4f75f8(this['locale']);return _0x3815e5['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response']}}),_0x3815e5;}updateResponseContent(_0x5527d4,_0x13e214){const _0x4d9701=_0x13e214||'div',_0x2e4811=this['resultResponseView']['element'];if(_0x2e4811['tagName']['toLowerCase']()!==_0x4d9701){const _0x3b7bb7=new _0x120a21({'tag':_0x4d9701,'attributes':{'class':_0x2e4811['className']}})['render']();_0x2e4811['replaceWith'](_0x3b7bb7),this['resultResponseView']['element']=_0x3b7bb7,this['_syncResponseVisibility']();}this['resultResponseView']['element']['innerHTML']=_0x5527d4;}_syncResponseVisibility(){this['resultResponseView']['element']?.['classList']['toggle']('ck-hidden',!this['showDiff']);}_createAcceptButtonView(){const _0x345124=new Vt(this['locale']);return _0x345124['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x345124['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4c4403=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x4c4403['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x4c2882=>'pending'!==_0x4c2882&&'accepted'!==_0x4c2882),this['bindTemplate']['if']('status',Hn,_0x2b2c14=>'pending'===_0x2b2c14),this['bindTemplate']['if']('status',Mn,_0x589be3=>'pending'!==_0x589be3),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x4fffc2=>'accepted'===_0x4fffc2)]}}),this['on']('change:status',(_0x18b67d,_0xf7a24b,_0x4e2986)=>{_0x345124['isEnabled']='pending'===_0x4e2986,'accepted'===_0x4e2986&&(_0x345124['label']=Ts(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x345124['icon']=_0x11611b);}),_0x345124;}_createDismissButtonView(){const _0x15feb2=new Vt(this['locale']);return _0x15feb2['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x15feb2['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x591897=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x591897['stopPropagation']();})},'attributes':{'class':[Mn,this['bindTemplate']['if']('status','ck-hidden',_0x93f01=>'pending'!==_0x93f01&&'rejected'!==_0x93f01),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x7c135a=>'pending'===_0x7c135a),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x149ff6=>'rejected'===_0x149ff6)]}}),this['on']('change:status',(_0x175356,_0x6f3909,_0x1d1caf)=>{_0x15feb2['isEnabled']='pending'===_0x1d1caf,'rejected'===_0x1d1caf&&(_0x15feb2['label']=Ts(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x15feb2['icon']=_0x591646);}),_0x15feb2;}_createInfoButtonView(){const _0x456510=new Vt(this['locale']);return _0x456510['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x20e75b,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Mn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x456510['bind']('isOn')['to'](this,'isInfoToggleOn',_0x3035a8=>_0x3035a8),_0x456510['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x456510;}_createOutdatedButtonView(){const _0x1f8a70=new Vt(this['locale']);return _0x1f8a70['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0xe7e212,'withText':!0x0,'isEnabled':!0x1}),_0x1f8a70['extendTemplate']({'attributes':{'class':[Mn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x25e778=>'outdated'!==_0x25e778)],'disabled':'disabled'}}),_0x1f8a70;}},mh=class extends Pt{resultItemView;_pinnedRectIndex=void 0x0;_pinnedTargetElement=void 0x0;_pinnedTargetChangeId=void 0x0;constructor(_0x302630,_0x128a18){super(_0x302630),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']()),_0x128a18['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}updateContent(_0x4d7ab6){this['resultItemView']['changeId']=_0x4d7ab6['id'],this['resultItemView']['updateResponseContent'](_0x4d7ab6['contentDiffed'],_0x4d7ab6['wrapperTag']);}['showBalloon'](_0x81688c,_0x17aabc,_0x4307a2,_0x4ff755,_0x44088f,_0x18aa43){const _0x318878=_0x17aabc();if(!_0x318878)return;this['updateContent'](_0x81688c),this['show']();const _0x107bb7=Array['from'](_0x318878['getClientRects']())['reverse'](),_0x3292d4=this['_getPointedRectIndexFromEvent'](_0x4307a2,_0x107bb7),_0x2aeaac=_0x107bb7[_0x3292d4??0x0];'click'===_0x4ff755?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x17aabc(),_0x3292d4,_0x81688c['id'],_0x44088f,_0x18aa43)||_0x2aeaac})):'hover'===_0x4ff755&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x17aabc(),_0x3292d4,_0x81688c['id'])||_0x2aeaac}));}['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(){_0x1a4c41({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0xb12c60=[this['element']];return this['_pinnedTargetElement']&&_0xb12c60['push'](this['_pinnedTargetElement']),_0xb12c60;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}_createContentView(){const _0x48b533=new _0x4f75f8();return this['resultItemView']=new Eh(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x48b533['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']]}]}),_0x48b533;}_getBestRectPositionOnClick(_0x3a1a8,_0x4def26,_0x362f8c,_0x184cad,_0x55959b){if(!_0x3a1a8)return null;const _0x10f4a0=this['position']['replace']('arrow_',''),_0x47d771=Array['from'](_0x3a1a8['getClientRects']());let _0x38bab2,_0x3e5f84=_0x47d771['reverse']();return void 0x0!==_0x4def26&&this['_isPinnedRectVisible'](_0x3e5f84[_0x4def26],_0x184cad,_0x55959b)?(_0x38bab2=_0x3e5f84[_0x4def26],this['_pinnedRectIndex']=_0x4def26):this['_isPinnedRectVisible'](_0x3e5f84[0x0],_0x184cad,_0x55959b)&&void 0x0===_0x4def26?_0x38bab2=_0x3e5f84[0x0]:(_0x3e5f84='s'==_0x10f4a0[0x0]?[..._0x47d771]['reverse']():_0x47d771,_0x3e5f84['forEach'](_0x238961=>{this['_isPinnedRectVisible'](_0x238961,_0x184cad,_0x55959b)&&(_0x38bab2=_0x238961);})),this['_pinnedTargetChangeId']=_0x362f8c,this['_pinnedTargetElement']=_0x3a1a8,_0x38bab2||_0x3a1a8['getBoundingClientRect']();}_getBestRectPositionOnHover(_0x47faa7,_0x520127,_0x227313){if(!_0x47faa7)return null;const _0x25b5f4=Array['from'](_0x47faa7['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x520127&&this['_pinnedTargetChangeId']!==_0x227313?(this['_pinnedRectIndex']=_0x520127,this['_pinnedTargetElement']=_0x47faa7,this['_pinnedTargetChangeId']=_0x227313,_0x25b5f4[_0x520127]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x227313?_0x47faa7!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x25b5f4[this['_pinnedRectIndex']]:void 0x0!==_0x520127&&this['_pinnedTargetChangeId']!==_0x227313?(this['_pinnedRectIndex']=_0x520127,this['_pinnedTargetElement']=_0x47faa7,this['_pinnedTargetChangeId']=_0x227313,_0x25b5f4[_0x520127]):_0x47faa7['getBoundingClientRect']();}_getPointedRectIndexFromEvent(_0x2cc57c,_0x593d12){if(_0x2cc57c)for(let _0x4b6d4b=0x0;_0x4b6d4b<_0x593d12['length'];_0x4b6d4b++){const _0x267ef0=_0x593d12[_0x4b6d4b];if(_0x2cc57c['clientX']>=_0x267ef0['left']-0x3&&_0x2cc57c['clientX']<=_0x267ef0['right']+0x3&&_0x2cc57c['clientY']>=_0x267ef0['top']-0x3&&_0x2cc57c['clientY']<=_0x267ef0['bottom']+0x3)return _0x4b6d4b;}}_isPinnedRectVisible(_0x102fe0,_0x15c9f2,_0x4f7ee0){const _0xcc9568=new It(_0x102fe0),_0x2cf489=_0x15c9f2||document['documentElement'],_0x5eb8c4=_0xcc9568['getIntersection'](wt(_0x4f7ee0)),_0x2272d0=new It(_0x2cf489)['getIntersection'](_0xcc9568);return!!(_0x5eb8c4&&_0x2272d0&&_0xcc9568['width']>0x0);}};const Th=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var wh=class extends _0x45fe7d{['_mainView'];_balloonSuggestionView;_bodyCollection;static get requires(){return[Is];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3894fd){super(_0x3894fd),this['_bodyCollection']=Vn(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Th)['to'](this),this['_balloonSuggestionView']=new mh(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}init(){const _0x1e5d04=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x1e5d04);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}setAvailableChecks(_0x2971ac){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x3f6322=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x2971ac,_0x3f6322);}this['_mainView']['showReviewCheckListView']();}showReviewCheckList(){this['fire']('getReviewCheckList');}showCheckRunResults(_0x246cfb){_0x246cfb&&('error-general'!==_0x246cfb['status']?'error-chunk'!==_0x246cfb['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}showCheckRunResult(_0xa6ec7c){this['_mainView']['addCheckRunResult'](_0xa6ec7c);}showGeneralResultsErrorView(){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x4408ef){this['_mainView']['showGeneralReviewCoreErrorView'](_0x4408ef??Ts(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}showUnsupportedInlineChangeView(){this['_mainView']['showUnsupportedInlineChangeView']();}setCheckResultTitle(_0x37a2de,_0x53d2f6){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x37a2de,_0x53d2f6);}setAcceptAllEnabled(_0x3da591){this['_mainView']['reviewCheckResultsView']['setAcceptAllEnabled'](_0x3da591);}setActiveStateInResults(_0x1c23fe){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x3aba99=>{_0x3aba99['id']===_0x1c23fe&&_0x3aba99['setItemAsActive']();});}resetActiveStateInResults(){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x59369d=>_0x59369d['setItemAsInactive']());}updateChangeState(_0x8a2ff5,_0x2a0d71){'accepted'===_0x2a0d71||'rejected'===_0x2a0d71||'outdated'===_0x2a0d71?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x8a2ff5,_0x2a0d71):this['_mainView']['reviewCheckResultsView']['showResult'](_0x8a2ff5,_0x2a0d71);}showReviewCompletedView(){this['_mainView']['showReviewCompletedView']();}showActionsWhenResultIsReady(){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}hideActionsWhenResultIsReady(){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x2a878a,_0x4a2c4b,_0x595f8f,_0x369da4,_0x5be85f,_0x3de96e){this['_balloonSuggestionView']['showBalloon'](_0x2a878a,_0x4a2c4b,_0x595f8f,_0x369da4,_0x5be85f,_0x3de96e);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}getChangeElement(_0x524c72){const _0x4339c1=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x4e0618=>_0x4e0618['id']===_0x524c72);return _0x4339c1?_0x4339c1['element']:null;}deactivateChange(){this['_balloonSuggestionView']['deactivateChange']();}},Ch=class extends _0x4f75f8{constructor(_0xc8f4d1){super(_0xc8f4d1),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x2dc93e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x2dc93e['if']('isVisible','ck-hidden',_0x54667a=>!_0x54667a)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x2dc93e['to']('errorMessage')}]}]});}},fh=class extends _0x4f75f8{['reviewCoreHeader'];['generalErrorView'];reviewCheckListView;reviewCheckResultsView;reviewCompletedView;constructor(_0x392768,_0x44da1a){super(_0x392768),this['reviewCoreHeader']=_0x44da1a['header'],this['generalErrorView']=new Ch(_0x392768),this['reviewCheckListView']=_0x44da1a['list'],this['reviewCheckListView']['delegate'](...Th)['to'](this),this['reviewCheckResultsView']=_0x44da1a['results'],this['reviewCheckResultsView']['delegate'](...Th)['to'](this),this['reviewCompletedView']=_0x44da1a['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(_0x1ceff5){this['reviewCheckResultsView']['addResult'](_0x1ceff5),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'](_0x2bae6c){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x2bae6c;}showGeneralResultsErrorView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}showUnsupportedInlineChangeView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showUnsupportedInlineChangeMessage']();}},bh=class extends Vt{constructor(_0xbbc12a,_0xcda354){super(_0xcda354),this['set']({'label':_0xbbc12a,'withText':!0x0,'class':Dn}),this['on']('execute',()=>{this['fire']('finishReview');});}},Sh=class extends Zt{_resultViews;_resultsHeader;_resultsBody;['reviewDisclaimer'];_cancelButtonView;_acceptAllButtonView;_exitReviewButtonView;_toggleDiffButtonView;['_errorMessageView'];_finishReviewButtonView;_contents;constructor(_0x1a110f,_0x4c4055){super(_0x1a110f),this['_contents']=_0x4c4055,this['_resultViews']=new _0x340edf(),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 ga(_0x1a110f),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),this['set']('isAcceptAllEnabled',!0x1),this['_acceptAllButtonView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled',this,'isError',(_0x384a46,_0x5e33d5)=>_0x384a46&&!_0x5e33d5);const _0x4d7df9=this['_createCombinedSkeletonLoader'](),_0xf35370=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0xf35370['if']('isLoading','ck-ai_review__check-run_loading',_0x415229=>_0x415229),_0xf35370['if']('isResultReady','ck-ai_review__check-run_ready',_0x5b02a3=>_0x5b02a3),_0xf35370['if']('isVisible','ck-hidden',_0x4ac0bd=>!_0x4ac0bd)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x4d7df9,this['reviewDisclaimer']]});}clearResults(){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}getResults(){return this['_resultViews'];}addResult(_0x1400ed){const _0x13d3d4=new Eh(this['locale'],_0x1400ed['id']);_0x13d3d4['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x13d3d4),_0x13d3d4['updateResponseContent'](_0x1400ed['contentDiffed'],_0x1400ed['wrapperTag']);}hideResult(_0x16c1e7,_0x42935b){if('pending'===_0x42935b)return;const _0x406633=this['_resultViews']['find'](_0x48f261=>_0x48f261['id']===_0x16c1e7);_0x406633&&(_0x406633['status']=_0x42935b,_0x406633['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}showResult(_0x28aca1,_0x42dcad){if('pending'!==_0x42dcad)return;const _0x198348=this['_resultViews']['find'](_0x472377=>_0x472377['id']===_0x28aca1);_0x198348&&(_0x198348['status']=_0x42dcad,_0x198348['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}setTitle(_0x2510d7,_0x3e9ce6){this['headerTitle']=_0x2510d7,this['headerSubtitle']=_0x3e9ce6||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}showUnsupportedInlineChangeMessage(){this['errorType']='unsupported-inline',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}resetErrorState(){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}setAcceptAllEnabled(_0x24d2c1){this['isAcceptAllEnabled']=_0x24d2c1;}_createSkeletonLoader(){return new fr(this['locale'],br['aiReviewChecks']);}_createCombinedSkeletonLoader(){const _0x397047=new _0x4f75f8(this['locale']),_0xb47f26=[];for(let _0x545c0a=0x0;_0x545c0a<0x10;_0x545c0a++){const _0x592915=this['_createSkeletonLoader']();_0x592915['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0xb47f26['push'](_0x592915);}return _0x397047['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x23cbfe=>!_0x23cbfe)]},'children':_0xb47f26}),_0x397047;}_createResultsBodyView(){const _0x49bc78=new _0x4f75f8(this['locale']);return _0x49bc78['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x34d858=>_0x34d858)]},'children':this['_resultViews']}),_0x49bc78;}_createErrorView(){const _0x51b47a=new _0x4f75f8(this['locale']),_0x4103c1=new Vt(this['locale']),t=this['locale']['t'];return _0x51b47a['delegate']('retryReview')['to'](this),_0x4103c1['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Hn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x4103c1['on']('execute',()=>{this['fire']('retryReview');}),_0x51b47a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x525b31=>!_0x525b31),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x404dce=>'chunk'===_0x404dce)]},'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',_0x16ca38=>'chunk'===_0x16ca38||'unsupported-inline'===_0x16ca38)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x382042=>'general'!==_0x382042)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x399ffe=>'chunk'!==_0x399ffe)]},'children':[{'text':Ts(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x1d1f9c=>'unsupported-inline'!==_0x1d1f9c)]},'children':[{'text':Ts(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')}]}]},_0x4103c1]}),_0x51b47a;}_createCancelButtonView(){const _0x8bd20a=new Vt(this['locale']);return _0x8bd20a['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Hn+'\x20ck-ai-button-stop-generating'],'icon':st}),_0x8bd20a['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x238d7a=>_0x238d7a),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x216828=>_0x216828)]}}),_0x8bd20a['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x8bd20a;}_createToggleDiffButtonView(){const _0x3d3f13=new Vt(this['locale']);_0x3d3f13['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x3d3f13['bind']('isEnabled')['to'](this,'isError',_0x1e59a9=>!_0x1e59a9),_0x3d3f13['extendTemplate']({'attributes':{'class':[Hn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x1a705e=>!_0x1a705e),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x576a07=>_0x576a07)]}});const _0x4dd92e=Ts(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x2abef9=Ts(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x3d3f13['bind']('isOn')['to'](this,'isToggleDiffOn',_0x5c320e=>_0x5c320e),_0x3d3f13['bind']('icon')['to'](this,'isToggleDiffOn',_0x3ee95a=>_0x3ee95a?_0x3eec7b:_0x4b0353),_0x3d3f13['bind']('label')['to'](this,'isToggleDiffOn',_0x1793d9=>_0x1793d9?_0x4dd92e:_0x2abef9),_0x3d3f13['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x3d3f13;}_createAcceptAllButtonView(){const _0x363e61=new Vt(this['locale']);return _0x363e61['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x363e61['extendTemplate']({'attributes':{'class':[Dn,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x476da2=>!_0x476da2),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3f5b44=>_0x3f5b44)]}}),_0x363e61['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x363e61;}_createExitReviewButtonView(){const _0xd8b31=new Vt(this['locale']);return _0xd8b31['set']({'label':Ts(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0xd8b31['extendTemplate']({'attributes':{'class':[Mn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x441640=>!_0x441640),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3779fe=>_0x3779fe)]}}),_0xd8b31['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0xd8b31;}_createResultHeaderView(){const _0x3f9401=new _0x4f75f8(this['locale']),_0x46383e=this['_createTitleView']();return _0x3f9401['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x1a5810=>_0x1a5810)]},'children':[_0x46383e,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x7b5f23=>!_0x7b5f23)],'title':Ts(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Ts(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x3f9401;}_createTitleView(){const _0x10c6e3=new _0x4f75f8(this['locale']),_0x3e0a4a=new Mr();return _0x3e0a4a['bind']('isVisible')['to'](this,'isResultReady',_0x28590b=>!_0x28590b),_0x10c6e3['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2fe5a1=>_0x2fe5a1)]},'children':[_0x3e0a4a,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-title']},'children':[{'text':this['bindTemplate']['to']('headerTitle')}]},{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-subtitle']},'children':[{'text':this['bindTemplate']['to']('headerSubtitle')}]}]}]}),_0x10c6e3;}_createFinishReviewButtonView(){const _0x3c2ca6=new bh(Ts(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x3c2ca6['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2149de=>!_0x2149de)]}}),_0x3c2ca6['delegate']('finishReview')['to'](this),_0x3c2ca6;}},Rh=class extends Zt{_resultsHeader;_finishReviewButtonView;constructor(_0x1b0797,_0x1e0169){super(_0x1b0797),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x1e0169['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x1e0169['headerText']);const _0xfdd91d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0xfdd91d['if']('isVisible','ck-hidden',_0x5e6c03=>!_0x5e6c03)]},'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':_0x1e0169['emptyResultsText']}]}]}]});}_createFinishReviewButtonView(_0x566624){const _0x59c66b=new bh(_0x566624,this['locale']);return _0x59c66b['delegate']('finishReview')['to'](this),_0x59c66b;}_createResultHeaderView(_0xef6310){const _0x3e360b=new _0x4f75f8(this['locale']);return _0x3e360b['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0xef6310},'children':[{'text':_0xef6310}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x3e360b;}},Oh=class extends _0x4f75f8{['_dropdownView'];_defaultValue;_defaultLabel;constructor(_0x5cb4d5,_0x3952bb){super(_0x5cb4d5),this['_defaultValue']=_0x3952bb['default']||(_0x3952bb['data']['length']>0x0?_0x3952bb['data'][0x0]['id']:''),this['_defaultLabel']=_0x3952bb['data']['find'](_0xd73704=>_0xd73704['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x5c62d3(this['locale']);const _0x4d9ecf=this['_prepareListOptions'](_0x3952bb['data']);_0x5ccc98(this['_dropdownView'],_0x4d9ecf,{'role':'menu','ariaLabel':_0x3952bb['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x313a16=>{_0x313a16['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x11e0cb=>{this['formValue']=_0x11e0cb['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x11e0cb['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(_0xfc51ca=[]){const _0x462d44=new lt();this['resetToDefault']();for(const _0x57d704 of _0xfc51ca){const _0x47517e=new _0x50627c({'label':_0x57d704['label'],'withText':!0x0,'role':'menuitemradio','id':_0x57d704['id'],'model':_0x57d704});_0x47517e['bind']('isOn')['to'](this,'formValue',_0x2fe29f=>_0x2fe29f===_0x47517e['id']);const _0x2ac313={'type':'button','model':_0x47517e};_0x462d44['add'](_0x2ac313);}return _0x462d44;}},vh=class extends Zt{_formItem=null;constructor(_0x393e40,_0x2796b6,_0xdfd58a){if(super(_0x393e40),this['argsKey']=_0x2796b6?.['argsKey'],'dropdown'===_0x2796b6['formType'])this['_formItem']=new Oh(this['locale'],_0x2796b6);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x209d10=new $t(this['locale'],{'children':[this['_formItem']],'class':[_0xdfd58a?'ck-form__row_with-submit':'']});_0xdfd58a&&_0x209d10['children']['add'](_0xdfd58a),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x209d10]});}resetToDefault(){this['_formItem']['resetToDefault']();}},kh=class AIReviewCorePromptInputView extends _0x572ca5{keystrokes;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x16455a){super(_0x16455a),this['set']('isEmpty',!0x0),this['keystrokes']=new gt(),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']);}},yh=class extends _0x4f75f8{['focusTracker']=new _t();keystrokes=new gt();['focusCycler'];['_focusables']=new _0x340edf();submitButtonView;cancelButtonView;promptInputView;actionsFooterView;_modelSelector;['_check'];constructor(_0x1e6879,_0x24530d,_0x4fb344=!0x1){super(_0x1e6879),this['_check']=_0x24530d,this['set']('prompt',''),this['set']('modelId',''),this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new zt(this['locale'],()=>new kh(_0x1e6879)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelector']=new Eo(_0x1e6879,{'panelPosition':'se','dropdownClass':'ck-ai_review__check-list-item-model-dropdown','nameClass':'ck-ai_review__check-list-item-model-name','itemClasses':{'name':'ck-ai_review__check-list-item-model-dropdown-name','description':'ck-ai_review__check-list-item-model-dropdown-description'}}),this['listenTo'](this['_modelSelector'],'selectModel',(_0x33c3ed,_0x2e4f81)=>{this['modelId']=_0x2e4f81['id'],this['_modelSelector']['setSelectedModel'](_0x2e4f81);}),this['_setModelList'](_0x4fb344),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new $t(this['locale'],{'children':[this['promptInputView']]}),new $t(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x269809,_0x5cf161)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x5cf161()):_0x5cf161();}),this['focusCycler']=new Wt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelector']['dropdownView'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x4fcb56=>{this['_focusables']['add'](_0x4fcb56),this['focusTracker']['add'](_0x4fcb56['element']);}),this['keystrokes']['listenTo'](this['element']);}resetToDefault(){this['prompt']='',this['modelId']=this['_check']['defaultModel']?.['id']??'',this['_check']['defaultModel']&&this['_modelSelector']['setSelectedModel'](this['_check']['defaultModel']),this['resetFormValidationStatus']();}resetFormValidationStatus(){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x5d54f1 of this['_getFormValidators']()){const _0x52fab7=_0x5d54f1();if(_0x52fab7)return this['promptInputView']['errorText']=_0x52fab7,!0x1;}return!0x0;}_getFormValidators(){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Ts(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}_createSubmitButtonView(){const _0xfd0c29=new Vt(this['locale']),t=this['locale']['t'];return _0xfd0c29['set']({'label':t('Submit'),'withText':!0x0,'class':Dn}),_0xfd0c29['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0xfd0c29;}_createCancelButtonView(){const _0x50dac7=new Vt(this['locale']),t=this['locale']['t'];return _0x50dac7['set']({'label':t('Cancel'),'withText':!0x0,'class':Mn}),_0x50dac7['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x315a92=>{_0x315a92['stopPropagation']();})}}),_0x50dac7['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x50dac7;}_setModelList(_0x38a69a){this['_modelSelector']['setModels'](this['_check']['models'],!_0x38a69a),this['resetToDefault']();}_createActionsFooterView(){const _0x1d83c8=new _0x4f75f8(this['locale']);return _0x1d83c8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelector'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x1d83c8;}},Nh=class extends Zt{_formItemsCollection=new _0x340edf();_customCheckView=null;['_hideModels']=!0x1;constructor(_0x2538fc,_0x4d250b,_0x4cba0b,_0x21b2cd=!0x1){super(_0x2538fc),this['_hideModels']=_0x21b2cd,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x4d250b['isParameterized']);const _0x125864=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',_0x161afa=>_0x161afa),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x2d813c=>_0x2d813c)],'style':{'--ck-ai-review-check-list-item-index':_0x4cba0b}},'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':_0x4d250b['title']}]},_0x125864]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x4d250b['description']?[{'text':_0x4d250b['description']}]:[]}]}]},..._0x4d250b['isParameterized']?[this['_createParameterizedView'](_0x4d250b)]:[],...'custom'===_0x4d250b['id']?[this['_createCustomView'](_0x4d250b,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x4d250b['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x4d250b['id'],'args':_0x4d250b['useArgs']?_0x4d250b['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x1a4c41({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}resetToDefault(){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x114b30=>{_0x114b30['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}_createIconView(){const _0x1ab187=new Qt();return _0x1ab187['content']=_0x1c3a57,_0x1ab187['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x1ab187;}_createParameterizedView(_0x26e0c7){const _0x478990=new _0x4f75f8(),_0x2747e8=this['_createFormView'](_0x26e0c7);return _0x478990['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x228a3f=>!_0x228a3f)]},'children':[_0x2747e8]}),_0x478990;}_createFormView(_0x48d94e){const _0x529f67=new _0x4f75f8(),_0x1f1ffe=Array['isArray'](_0x48d94e['options'])?_0x48d94e['options']:[],_0x3c4455=new Vt(this['locale']),t=this['locale']['t'];_0x3c4455['set']({'label':t('Submit'),'withText':!0x0,'class':Dn}),_0x3c4455['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x50027a=>{_0x50027a['stopPropagation']();})}}),_0x3c4455['on']('execute',()=>{const _0x4f28be=[],_0xc3f6b5={};this['_formItemsCollection']['forEach'](_0x58e321=>{_0x4f28be['push'](_0x58e321['value']),_0x48d94e['useArgs']&&_0x48d94e['options']&&(_0xc3f6b5[_0x58e321['argsKey']]=_0x58e321['value']);}),this['fire']('runReviewCheck',{'id':_0x48d94e['id'],'params':_0x4f28be['length']?_0x4f28be:void 0x0,'args':Object['keys'](_0xc3f6b5)['length']?_0xc3f6b5:void 0x0});});const _0x375d0c=_0x1f1ffe['length'];return _0x1f1ffe['forEach']((_0x133bc6,_0x1067de)=>{const _0x33ab2b=_0x1067de===_0x375d0c-0x1;this['_formItemsCollection']['add'](new vh(this['locale'],_0x133bc6,_0x33ab2b?_0x3c4455:null));}),_0x529f67['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x529f67;}_createCustomView(_0x223dd2,_0x33b5ac=!0x1){return this['_customCheckView']=new yh(this['locale'],_0x223dd2,_0x33b5ac),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',_0x3105d2=>!_0x3105d2)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x396d2b,_0x260bed,_0x33e999)=>{_0x33e999||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},xh=class extends Zt{['_checkViews'];constructor(_0x23d7a4){super(_0x23d7a4),this['_checkViews']=new _0x340edf(),this['_setupTemplate']();}setChecks(_0x399150,_0x1db229=!0x1){this['_checkViews']['clear']();for(const [_0x7c1f9a,_0x50705c]of _0x399150['entries']()){const _0x323936=new Nh(this['locale'],_0x50705c,_0x7c1f9a,_0x1db229);_0x323936['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x323936);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}resetAllParameterizedChecks(){for(const _0x15a48d of this['_checkViews'])_0x15a48d instanceof Nh&&_0x15a48d['resetToDefault']();}_setupTemplate(){const _0x22899e=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x22899e['if']('isVisible','ck-hidden',_0x131cba=>!_0x131cba)]},'children':this['_checkViews']});}},Lh=class extends wh{static get['pluginName'](){return'AIReviewModeUI';}createMainView(){const _0xe16ec4=this['context']['plugins']['get']('AITabs'),_0x4ecc1c=this['context']['locale'],_0x58bc0c=new _a(_0x4ecc1c,{'label':Ts(_0x4ecc1c,'AI_REVIEW_MODE'),'icon':_0x308ecc,'class':'ck-ai-header_review','showResizeButton':_0xe16ec4['showResizeButton']});return _0x58bc0c['delegate']('resizeTabs')['to'](_0xe16ec4),_0x58bc0c['bind']('isMaximized')['to'](_0xe16ec4['view'],'isMaximized',_0x47541e=>_0x47541e),new fh(this['context']['locale'],{'header':_0x58bc0c,'list':new xh(_0x4ecc1c),'results':new Sh(_0x4ecc1c,{'generalErrorText':Ts(_0x4ecc1c,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Rh(_0x4ecc1c,{'headerText':Ts(_0x4ecc1c,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Ts(_0x4ecc1c,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Ts(_0x4ecc1c,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}registerTab(){const _0x40ab77=this['context']['plugins']['get']('AITabs');_0x40ab77['view']['on']('activateTab',(_0x546677,{newTab:_0x228301,oldTab:_0x2468fa})=>{'reviewMode'===_0x228301?this['fire']('getReviewCheckList'):'reviewMode'===_0x2468fa&&this['fire']('leaveReview');}),_0x40ab77['view']['addTab']({'id':'reviewMode','buttonLabel':Ts(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x308ecc,'order':0x0,'content':this['_mainView']});}},Ph=class extends On{_affectedBlocks=[];get affectedBlocks(){return this['_affectedBlocks']['slice']();}set affectedBlocks(_0x4dc06d){this['_affectedBlocks']=_0x4dc06d;}};const Dh='review-',Hh=['softBreak'],Mh=['htmlScript','htmlStyle','htmlCustomElement'];var Uh=class extends _0x45fe7d{static get requires(){return[_0x4eecd6,sn];}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();_inlineRootDataIds=new WeakMap();constructor(_0x58b9a2){super(_0x58b9a2),this['_domEmitter']=new(ut())(),this['_eventEmitter']=new(dt())();}get emitter(){return this['_eventEmitter'];}afterInit(){const _0x478e86=_0xdbb084=>this['_scheduleAttachReviewEditingToEditor'](_0xdbb084);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x5c73d5)return void _0x478e86(this['context']);const _0x1c6d2d=this['context'];for(const _0x133ee7 of _0x1c6d2d['editors'])_0x478e86(_0x133ee7);this['listenTo'](_0x1c6d2d['editors'],'add',(_0x16597b,_0x15f691)=>{_0x478e86(_0x15f691);}),this['listenTo'](_0x1c6d2d['editors'],'remove',(_0xad16ce,_0x5b9acf)=>{for(const [_0x30e94b,_0x57611b]of this['_markers'])_0x57611b['editor']===_0x5b9acf&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x30e94b,'changeId':_0x57611b['groupId']}),this['_markers']['delete'](_0x30e94b));});}_scheduleAttachReviewEditingToEditor(_0x5f0dd4){const _0x1b972a=()=>{'destroyed'!==_0x5f0dd4['state']&&_0x5f0dd4['conversion']&&this['_attachReviewEditingToEditor'](_0x5f0dd4);};if('ready'===_0x5f0dd4['state'])return void _0x1b972a();const _0x3048f6=()=>{this['stopListening'](_0x5f0dd4,'ready',_0x3048f6),_0x1b972a();};this['listenTo'](_0x5f0dd4,'ready',_0x3048f6);}_attachReviewEditingToEditor(_0x2c5b28){this['_reviewEditingAttachedEditors']['has'](_0x2c5b28)||(_0x2c5b28['conversion']['for']('editingDowncast')['markerToElement']({'model':Dh+'insert','view':(_0x10e28d,{writer:_0x3dec98})=>{const _0x5bd9d2=this['_markers']['get'](_0x10e28d['markerName']),_0x1db487={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x5bd9d2?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x10e28d['markerName']};return _0x3dec98['createUIElement']('span',_0x1db487,function(_0x2c2c1c){const _0x3101c4=this['toDomElement'](_0x2c2c1c);return _0x3101c4['innerHTML']=_0x5bd9d2?.['content']?.['asString']||'',_0x3101c4;});}}),_0x2c5b28['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Dh+'remove-only','view':_0x11d89e=>{const _0x79b3d3=this['_markers']['get'](_0x11d89e['markerName']),_0x73327=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x79b3d3?.['id']||'')&&_0x73327['push']('ck-ai_review__change_active'),{'classes':_0x73327,'attributes':{'data-marker-id':_0x11d89e['markerName']}};}}),_0x2c5b28['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Dh+'remove-context','view':_0x3823d7=>{const _0x1c281f=this['_markers']['get'](_0x3823d7['markerName']),_0x3aa939=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x1c281f?.['id']||'')&&_0x3aa939['push']('ck-ai_review__change_active'),{'classes':_0x3aa939,'attributes':{'data-marker-id':_0x3823d7['markerName']}};}}),_0x2c5b28['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Dh+'remove-text','view':_0x5889ae=>{const _0x2e5b30=this['_markers']['get'](_0x5889ae['markerName']),_0x35394b=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x2e5b30?.['id']||'')&&_0x35394b['push']('ck-ai_review__change_active'),{'classes':_0x35394b,'attributes':{'data-marker-id':_0x5889ae['markerName']}};}}),_0x2c5b28['conversion']['for']('dataDowncast')['markerToElement']({'model':Dh+'suggestion-context','view':(_0x657858,{writer:_0x4b18f6})=>_0x4b18f6['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x657858['isOpening']?'start':'end')})}),_0x2c5b28['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x4eb302,'view':_0x35bb41}),this['_updateMouseMarkerInteractionListeners'](_0x2c5b28),this['listenTo'](_0x2c5b28,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x2c5b28),{'priority':'lowest'}),this['listenTo'](_0x2c5b28,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x2c5b28),{'priority':'lowest'}),_0x2c5b28['model']['document']['registerPostFixer'](_0x42ec99=>this['_validateMarkers'](_0x2c5b28,_0x42ec99)),_0x2c5b28['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x2c5b28)),this['_reviewEditingAttachedEditors']['add'](_0x2c5b28));}_updateMouseMarkerInteractionListeners(_0x372bf5){let _0x1f3c2e=this['_boundEditables']['get'](_0x372bf5);_0x1f3c2e||(_0x1f3c2e=new Map(),this['_boundEditables']['set'](_0x372bf5,_0x1f3c2e));const _0x3da14a=new Set(_0x372bf5['ui']['getEditableElementsNames']());for(const _0x1f831a of _0x3da14a){if(_0x1f3c2e['has'](_0x1f831a))continue;const _0x48f876=_0x372bf5['ui']['getEditableElement'](_0x1f831a);_0x1f3c2e['set'](_0x1f831a,_0x48f876),this['_attachMouseMarkerInteractionListeners'](_0x48f876);}for(const [_0x2ff047,_0x8b7490]of _0x1f3c2e)_0x3da14a['has'](_0x2ff047)||(_0x1f3c2e['delete'](_0x2ff047),this['_domEmitter']['stopListening'](_0x8b7490));}_attachMouseMarkerInteractionListeners(_0x34e793){this['_domEmitter']['listenTo'](_0x34e793,'mouseup',(_0xb4b602,_0x5d1bfb)=>{const _0x5526c3=_0x5d1bfb['target'],_0x2db5fa=this['_findMarkerElement'](_0x5526c3);if(!_0x2db5fa)return;const _0x46c872=_0x2db5fa['getAttribute']('data-marker-id'),_0x168372=_0x46c872['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x46c872,'changeId':_0x168372,'markerElement':()=>this['_findMarkerElementById'](_0x46c872),'domEvent':_0x5d1bfb});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x34e793,'mouseover',(_0x5572a3,_0x428e43)=>{const _0x42188f=_0x428e43['target'],_0x249bf5=_0x428e43['relatedTarget'];let _0x57850b=this['_findMarkerElement'](_0x42188f);if(!_0x57850b&&_0x249bf5&&(_0x57850b=this['_findMarkerElement'](_0x249bf5)),!_0x57850b)return;const _0x4abb95=_0x57850b['getAttribute']('data-marker-id'),_0x3a3deb=_0x4abb95['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x3a3deb,'markerElement':()=>this['_findMarkerElementById'](_0x4abb95),'domEvent':_0x428e43});});}_registerGlobalBalloonBlurHandler(){this['_domEmitter']['listenTo'](document,'mouseover',_0xce404c((_0xecd235,_0x23576c)=>{const _0x30a922=_0x23576c['target'];this['_findMarkerElement'](_0x30a922)||_0x30a922['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}getDocumentData(_0xa44af){const _0x46d1c1=this['context']['plugins']['get']('AIEditing'),_0x51cc7a=Rs(this['context']);if(!_0x51cc7a['length'])throw new ct('ai-get-editor-from-context-no-editor',this);const _0x232e9d=_0xa44af?.['roots'];if(_0x232e9d&&0x0===_0x232e9d['length'])throw new ct('ai-reviewcoreediting-empty-roots',this);const _0x133dde=_0x232e9d?new Set(_0x232e9d['map'](_0x144398=>_0x144398['channelId']+'\x00'+_0x144398['rootName'])):null,_0x1b077a=_0x133dde?new Set():null,_0x4c7c63=new Set(),_0x37d4c8=[],_0x1a48eb=new Map(),_0x94888d=[];for(const _0x1a8662 of _0x51cc7a){const _0x1ce9d2=_0x1a8662['config']['get']('collaboration.channelId');for(const _0x1684c0 of _0x1a8662['model']['document']['getRoots']()){const _0x3cad0f=_0x1ce9d2+'\x00'+_0x1684c0['rootName'];if(_0x133dde&&!_0x133dde['has'](_0x3cad0f))continue;const _0x10d9d5=this['_buildDocumentDataSliceForRoot'](_0x1a8662,_0x1684c0,_0x46d1c1,_0x4c7c63);_0x37d4c8['push'](_0x10d9d5['content']);for(const [_0x2d9d66,_0x2f9dee]of _0x10d9d5['elements'])_0x1a48eb['set'](_0x2d9d66,_0x2f9dee);_0x94888d['push']({'channelId':_0x1ce9d2,'rootName':_0x1684c0['rootName']}),_0x1b077a?.['add'](_0x3cad0f);}}if(_0x232e9d&&_0x1b077a['size']!==_0x133dde['size']){const _0x5af812=_0x232e9d['find'](_0x168585=>!_0x1b077a['has'](_0x168585['channelId']+'\x00'+_0x168585['rootName']));throw new ct('ai-reviewcoreediting-root-not-found',this,{'channelId':_0x5af812['channelId'],'rootName':_0x5af812['rootName']});}return{'elements':_0x1a48eb,'content':_0x37d4c8['join'](''),'roots':_0x94888d};}async['runCheck'](_0x1810d8,_0x3ff6eb){const _0x4b1111=new kn(),_0x1731c3=_0x3ff6eb?.['signal'];let _0x2f9c9d;const _0x1e7fbc=()=>{_0x4b1111['abort'](),_0x1810d8['abort']();};if(_0x1731c3){if(_0x1731c3['aborted'])return _0x1e7fbc(),_0x4b1111;_0x1731c3['addEventListener']('abort',_0x1e7fbc),_0x2f9c9d=()=>_0x1731c3['removeEventListener']('abort',_0x1e7fbc);}const _0x2189ab={'apiId':_0x1810d8['sourceCheck']['apiId']};try{_0x1810d8['on']('reviewCheckRunUpdated',(_0x33dba4,_0x311e37)=>{'aborted'===_0x311e37['status']?_0x4b1111['abort']():'error-general'!==_0x311e37['status']&&'error-chunk'!==_0x311e37['status']||(_0x4b1111['error']=Rn(_0x311e37['error'],'ai-reviewcoreediting-check-run-failed',this,_0x2189ab));}),'aborted'!==_0x4b1111['status']&&await _0x1810d8['start']();}catch(_0x5d0b78){_0x4b1111['error']=Rn(_0x5d0b78,'ai-reviewcoreediting-check-run-failed',this,_0x2189ab);}finally{_0x2f9c9d&&_0x2f9c9d();}return'error'===_0x4b1111['status']||'aborted'===_0x4b1111['status']||(_0x4b1111['addResult'](...this['_buildPerRootResults'](_0x1810d8)),_0x4b1111['status']='completed'),_0x4b1111;}buildErrorContext(_0x55eede){return{'apiId':_0x55eede['sourceCheck']['apiId']};}_buildPerRootResults(_0x4b9732){const _0x46fd31=this['buildErrorContext'](_0x4b9732),_0x34ad8d=this['context']['plugins']['get']('AIEditing'),_0x4e7096=this['context']['plugins']['get']('AIGateway'),_0x2d2940=this['_groupElementsByRoot'](_0x4b9732['documentData']['elements']),_0x2085eb=new Map();for(const _0x48b239 of Rs(this['context']))_0x2085eb['set'](_0x48b239['config']['get']('collaboration.channelId'),_0x48b239);return _0x4b9732['documentData']['roots']['map'](({channelId:_0x3d3187,rootName:_0x18df39})=>{const _0x3a8451=_0x2085eb['get'](_0x3d3187),_0x37d9d7=new Ph({'editor':_0x3a8451,'rootName':_0x18df39,'channelId':_0x3d3187,'sessionId':_0x34ad8d['getSessionId'](_0x3a8451)}),_0x2d351a=_0x2d2940['get'](_0x37d9d7['editor'])?.['get'](_0x37d9d7['rootName'])??[];_0x37d9d7['contentRawOld']=_0x2d351a['map'](_0x34f9e9=>_0x34f9e9['getContent']())['join'](''),_0x37d9d7['documentVersion']=_0x2d351a[0x0]?.['documentVersion']??0x1;const _0x2e1ac4=this['_collectResultAffectedBlocks'](_0x37d9d7,_0x4b9732['results'],_0x4b9732['documentData']['elements']);_0x37d9d7['affectedBlocks']=_0x2e1ac4;try{_0x37d9d7['contentRawNew']=ks(_0x4e7096['mergeChangesIntoContent'](_0x2e1ac4,_0x37d9d7['contentRawOld'],_0x37d9d7['editor']));}catch(_0xcdff5a){_0x37d9d7['error']=Rn(_0xcdff5a,'ai-reviewcoreediting-check-run-failed',this,_0x46fd31);}return _0x37d9d7;});}_collectResultAffectedBlocks(_0x5def55,_0x2243d3,_0x13adb1){return _0x2243d3['filter'](_0x2e4d53=>{const _0x463736=_0x13adb1['get'](_0x2e4d53['id']);return!!_0x463736&&_0x463736['editor']===_0x5def55['editor']&&_0x463736['rootName']===_0x5def55['rootName'];})['map'](_0x1c2550=>({'id':_0x1c2550['id'],'content':_0x1c2550['contentNew']}));}_groupElementsByRoot(_0x3669ef){const _0x4fffe8=new Map();for(const _0x23397f of _0x3669ef['values']()){let _0x2037c4=_0x4fffe8['get'](_0x23397f['editor']);_0x2037c4||(_0x2037c4=new Map(),_0x4fffe8['set'](_0x23397f['editor'],_0x2037c4));let _0x22d28f=_0x2037c4['get'](_0x23397f['rootName']);_0x22d28f||(_0x22d28f=[],_0x2037c4['set'](_0x23397f['rootName'],_0x22d28f)),_0x22d28f['push'](_0x23397f);}return _0x4fffe8;}_buildDocumentDataSliceForRoot(_0x4149c6,_0x1e5a56,_0x4cced4,_0x54b642){const _0x5d0f6d=_0x4149c6['model'],_0x2709b9=new _0x58f66a();for(const _0x55a56f of _0x1e5a56['getChildren']())_0x2709b9['_appendChild'](_0x55a56f['_clone'](!0x0));for(const _0x40b570 of _0x5d0f6d['markers']){const _0x5aa6f1=_0x40b570['getRange']();_0x5aa6f1&&_0x5aa6f1['root']['rootName']===_0x1e5a56['rootName']&&_0x2709b9['markers']['set'](_0x40b570['name'],this['_changeRangeOwnerDocument'](_0x5aa6f1['clone'](),_0x2709b9));}const _0x3436a7=new Map(),_0xf9583f=_0x5d0f6d['document']['version'];if(Ks(_0x4149c6,_0x1e5a56['rootName'])){let _0x32ed77=this['_inlineRootDataIds']['get'](_0x1e5a56);_0x32ed77?_0x54b642['add'](_0x32ed77):(_0x32ed77=_0x4cced4['_nextDataId'](_0x54b642),this['_inlineRootDataIds']['set'](_0x1e5a56,_0x32ed77));const _0x3a1265=Ws(_0x4149c6['data']['processor']['toData'](_0x4149c6['data']['toView'](_0x2709b9)),_0x32ed77);return _0x3436a7['set'](_0x32ed77,{'editor':_0x4149c6,'rootName':_0x1e5a56['rootName'],'path':[],'documentVersion':_0xf9583f,'getContent':()=>_0x3a1265}),{'content':_0x3a1265,'elements':_0x3436a7};}const _0x1d9429=new _0x362d3b({'ignoreElementEnd':!0x0,'startPosition':_0x5d0f6d['createPositionAt'](_0x2709b9,0x0)});for(const {item:_0x68e881}of _0x1d9429){if(_0x68e881['is']('element')&&_0x68e881['name']&&Mh['includes'](_0x68e881['name'])){const _0x5030e1=this['_upsertDataId'](_0x68e881,()=>_0x4cced4['_nextDataId'](_0x54b642));_0x54b642['add'](_0x5030e1);}if(!_0x68e881['is']('$textProxy'))continue;const _0x2de406=_0x68e881['parent'];if(!_0x2de406||!_0x2de406['is']('element'))continue;const _0x4f7502=this['_upsertDataId'](_0x2de406,()=>_0x4cced4['_nextDataId'](_0x54b642));_0x54b642['add'](_0x4f7502);for(const _0x3cd2a6 of _0x2de406['getChildren']())_0x3cd2a6['is']('element')&&(_0x3cd2a6['name']&&Hh['includes'](_0x3cd2a6['name'])||_0x54b642['add'](this['_upsertDataId'](_0x3cd2a6,()=>_0x4cced4['_nextDataId'](_0x54b642))));let _0x325ae8=_0x2de406;for(;_0x325ae8['parent']&&!_0x325ae8['parent']['is']('documentFragment');)_0x325ae8=_0x325ae8['parent'],_0x325ae8['hasAttribute'](_0x4eb302)&&_0x325ae8['_removeAttribute'](_0x4eb302);_0x3436a7['set'](_0x4f7502,{'editor':_0x4149c6,'rootName':_0x1e5a56['rootName'],'path':_0x2de406['getPath'](),'documentVersion':_0xf9583f,'getContent':this['_createGetContentUsingDataIdFn'](_0x325ae8['_clone'](!0x0),_0x4f7502,_0x4149c6['data'])}),_0x1d9429['jumpTo'](_0x5d0f6d['createPositionAfter'](_0x2de406));}return{'content':_0x4149c6['data']['processor']['toData'](_0x4149c6['data']['toView'](_0x2709b9)),'elements':_0x3436a7};}diffContent(_0x444d2a,_0x5a50d2,_0x5516cf,_0x326c9d=!0x1){const {contentInitial:_0x20b478,contentNew:_0x998e12}=this['_neutralizeChangesOnUnsupportedElements'](_0x5a50d2,_0x5516cf),_0x5b9f12=[],_0x5bfba0=_0x444d2a['data']['parse'](_0x998e12,'$documentFragment'),_0x1a70ac=_0x444d2a['data']['parse'](_0x20b478,'$documentFragment'),_0x296ae8=_0x444d2a['model']['createPositionAt'](_0x1a70ac,0x0);if(this['_haveSingleTopLevelElement'](_0x5bfba0)){if(!this['_hasSameTopLevelElement'](_0x1a70ac,_0x5bfba0))return _0x5b9f12;}else{const _0x2a6c71=_0x444d2a['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x1a70ac,_0x2a6c71)||!this['_haveOnlyInlineContent'](_0x5bfba0,_0x2a6c71))return _0x5b9f12;}const _0x218325=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x20b478,_0x998e12,{'targetEditor':_0x444d2a,'anchor':_0x296ae8,'markDeletions':!0x0})['getOperations']()['filter'](_0x49e94b=>'insert'===_0x49e94b['type']||'marker'===_0x49e94b['type']&&_0x49e94b['name']['startsWith']('$markedRemove')),_0x47a545=this['_groupAdjacentOperations'](_0x218325),_0x152030=[];if(_0x326c9d){if(_0x47a545['length']){const _0xaefc8a=_0x47a545[0x0]['operations'][0x0],_0x243efe='insert'===_0xaefc8a['type']?_0xaefc8a['position']:_0xaefc8a['newRange']['start'],_0xe8783b=this['_getPositionLimitingRange'](_0x243efe,_0x444d2a,'inside'),_0x126e92=_0xe8783b?_0x5bfba0['getChild'](0x0)['getChildren']():_0x5bfba0['getChildren'](),_0x355070=_0xe8783b||_0x444d2a['model']['createRangeIn'](_0x1a70ac),_0x5f1b0e=[new _0x1122b4('$markedRemove:synthetic'+Nt(),null,_0x355070,_0x444d2a['model']['document']['model']['markers'],!0x0,_0x444d2a['model']['document']['version']+0x1),new _0xb0469(_0x355070['end'],_0x126e92,_0x444d2a['model']['document']['version']+0x2)];_0x152030['push']({'operations':_0x5f1b0e,'operationsIsolated':_0x5f1b0e,'groupOffset':0x0});}}else _0x152030['push'](..._0x47a545);let _0x4c0400=0x0;return _0x444d2a['model']['change'](_0x564687=>{for(let _0x3039bc=0x0;_0x3039bc<_0x152030['length'];_0x3039bc++){const _0x5bc242=_0x152030[_0x3039bc],_0x5cfcc9=_0x564687['createDocumentFragment']();for(const _0x162b79 of _0x1a70ac['getChildren']())_0x564687['append'](_0x162b79['_clone'](!0x0),_0x5cfcc9);for(const _0x356621 of _0x5bc242['operationsIsolated'])if('insert'===_0x356621['type']){const _0x92c0c7=_0x356621;_0x92c0c7['baseVersion']=null,_0x92c0c7['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x92c0c7,_0x5cfcc9),_0x564687['batch']['addOperation'](_0x356621),_0x444d2a['model']['applyOperation'](_0x356621);const _0x5d30fd='suggestion:insertion:id:authorId:'+_0x4c0400++,_0x1e8f06=_0x444d2a['model']['createRange'](_0x92c0c7['position'],_0x92c0c7['position']['getShiftedBy'](_0x92c0c7['howMany']));_0x5cfcc9['markers']['set'](_0x5d30fd,_0x1e8f06);}else{if('marker'===_0x356621['type']&&_0x356621['name']['startsWith']('$markedRemove')){const _0x510366=_0x356621,_0x4816fb='suggestion:deletion:id:authorId:'+_0x4c0400++;this['_changeOperationOwnerDocument'](_0x510366,_0x5cfcc9),_0x5cfcc9['markers']['set'](_0x4816fb,_0x510366['newRange']);}}if(_0x326c9d)_0x5b9f12['push']({..._0x5bc242,'context':this['_createGetContentFn'](_0x1a70ac,_0x444d2a['data']),'content':this['_createGetContentFn'](_0x1a70ac,_0x444d2a['data'])});else{const _0x3da859=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x5bc242['operationsIsolated'][0x0]),_0x5cfcc9),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x5bc242['operationsIsolated'][_0x5bc242['operationsIsolated']['length']-0x1]),_0x5cfcc9),_0x444d2a);_0x5cfcc9['markers']['set'](Dh+'suggestion-context',new _0x2be128(_0x3da859['start'],_0x3da859['end'])),_0x5b9f12['push']({..._0x5bc242,'context':this['_createGetContextFn'](_0x5cfcc9,_0x444d2a['data'],{'ellipsisBefore':_0x3da859['hasContentBefore'],'ellipsisAfter':_0x3da859['hasContentAfter']}),'content':this['_createGetContentFn'](_0x5cfcc9,_0x444d2a['data'])});}}}),_0x5b9f12;}markChangePositionInEditorContent(_0x59e5d8,_0x27e41f){if(!_0x59e5d8['length'])return;const _0x5d4ffb=_0x59e5d8[0x0]['parent']['id'],_0x3f5b00=_0x27e41f['elements']['get'](_0x5d4ffb);if(!_0x3f5b00)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x5d4ffb);const _0x4c0ff7=_0x3f5b00['path'],_0x4d3ebb=_0x3f5b00['editor'],_0x2fcf96=_0x4d3ebb['model']['document']['getRoot'](_0x3f5b00['rootName']);if(!_0x2fcf96)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x3f5b00['rootName']);const _0x12d707=_0x4d3ebb['model']['document']['history']['getOperations'](_0x3f5b00['documentVersion']),_0x301f8c=[];for(const _0x31c8ba of _0x59e5d8){const _0x560b6b=_0x31c8ba['operationsIsolated']['map'](_0x5a0467=>this['_translateOperationToEditorContent'](_0x5a0467,_0x4c0ff7,_0x2fcf96));if(!_0x560b6b||!_0x560b6b['length'])continue;const _0x122598=_0x560b6b['every'](_0x5d9cc6=>'marker'===_0x5d9cc6['type']&&_0x5d9cc6['name']['startsWith']('$markedRemove')),_0x230b26=_0x400478(_0x560b6b,_0x12d707,{'document':_0x4d3ebb['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x70ca24 of _0x230b26)if('insert'===_0x70ca24['type']){const _0x147333=_0x70ca24,_0x148f94=_0x147333['nodes'];_0x4d3ebb['model']['change'](_0x1f62f4=>{const _0x39ebb4=_0x1f62f4['createDocumentFragment']();for(const _0x1bb8c9 of _0x148f94)_0x1f62f4['append'](_0x1bb8c9['_clone'](!0x0),_0x39ebb4);_0x301f8c['push']({'start':_0x147333['position'],'end':_0x147333['position'],'type':'insert','groupId':_0x31c8ba['id'],'content':{'asString':this['_createGetContentFn'](_0x39ebb4,_0x4d3ebb['data'])(),'asFragment':_0x39ebb4}});});}else{if('marker'===_0x70ca24['type']&&_0x70ca24['name']['startsWith']('$markedRemove')){const _0x14924c=_0x70ca24;let _0xf976e8='remove-text';if(_0x122598){const _0x4d012d=this['_findAdjacentContextDistance'](_0x14924c['newRange']['start'],'backward',_0x4d3ebb['model']['schema']),_0x2d9d70=this['_findAdjacentContextDistance'](_0x14924c['newRange']['end'],'forward',_0x4d3ebb['model']['schema']);if(_0x4d012d||_0x2d9d70){const _0x2c86e5=_0x14924c['newRange']['start']['getShiftedBy'](-_0x4d012d),_0x53513d=_0x14924c['newRange']['end']['getShiftedBy'](_0x2d9d70);_0x301f8c['push']({'start':_0x2c86e5,'end':_0x53513d,'groupId':_0x31c8ba['id'],'type':'remove-context'});}else _0xf976e8='remove-only';}_0x301f8c['push']({'start':_0x14924c['newRange']['start'],'end':_0x14924c['newRange']['end'],'groupId':_0x31c8ba['id'],'type':_0xf976e8});}}}this['_insertMarkers'](_0x301f8c,_0x4d3ebb);}['clearAllMarkers'](){const _0x368aed=new Map();for(const _0x4edb54 of this['_markers']['keys']()){const _0x56c5f4=this['_markers']['get'](_0x4edb54);_0x56c5f4?.['editor']&&(_0x368aed['has'](_0x56c5f4['editor'])||_0x368aed['set'](_0x56c5f4['editor'],[]),_0x368aed['get'](_0x56c5f4['editor'])['push'](_0x4edb54));}for(const [_0x4617be,_0x41072a]of _0x368aed)_0x4617be['model']['change'](_0x323532=>{for(const _0x23887d of _0x41072a)_0x4617be['model']['markers']['get'](_0x23887d)&&_0x323532['removeMarker'](_0x23887d);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}switchToReadOnly(){for(const _0x5dccde of this['getEditors']())_0x5dccde['enableReadOnlyMode']('ai-review');}switchToEdit(){for(const _0x39da53 of this['getEditors']())_0x39da53['disableReadOnlyMode']('ai-review');}['applyChange'](_0x1b117d,_0x15412b=null){const _0x5295b8=_0x1b117d['map'](_0x510678=>this['_getMarkersDataForGroup'](_0x510678))['flat'](),_0x52ffb3=new Map();for(const _0x38da4d of _0x5295b8)_0x52ffb3['has'](_0x38da4d['editor'])||_0x52ffb3['set'](_0x38da4d['editor'],[]),_0x52ffb3['get'](_0x38da4d['editor'])['push'](_0x38da4d);for(const [_0x58698e,_0x4641bf]of _0x52ffb3){const _0x2131df=_0x58698e['model'],_0x1c34eb=_0x58698e['plugins']['has']('TrackChangesEditing')?_0x58698e['plugins']['get']('TrackChangesEditing'):null,_0x1ce2a8=_0x15412b&&_0x1c34eb?new Set(_0x1c34eb['getSuggestions']()['map'](_0x3d28e1=>_0x3d28e1['id'])):null;_0x2131df['change'](_0x34d888=>{const _0x32ae4b=_0x34d888['batch']['operations']['length'];for(const _0x1b1bac of _0x4641bf){const _0x280cea=_0x58698e['model']['markers']['get'](_0x1b1bac['id']);if(_0x280cea){if('insert'===_0x1b1bac['type']){if(!_0x1b1bac['content'])continue;_0x2131df['insertContent'](_0x1b1bac['content']['asFragment']||null,_0x280cea['getRange']()['start']);}else'remove-text'!==_0x1b1bac['type']&&'remove-only'!==_0x1b1bac['type']||_0x2131df['deleteContent'](_0x2131df['createSelection'](_0x280cea['getRange']()));_0x34d888['removeMarker'](_0x1b1bac['id']),this['_markers']['delete'](_0x1b1bac['id']);}}if(_0x15412b&&(wn(_0x34d888['batch']['operations']['slice'](_0x32ae4b),_0x15412b),_0x1c34eb)){for(const _0x30a2a9 of _0x1c34eb['getSuggestions']())_0x1ce2a8['has'](_0x30a2a9['id'])||_0x30a2a9['setAttribute']('@ai',{'type':_0x15412b});}});}}rejectChange(_0x1db6a4){const _0x133b81=this['_getMarkersDataForGroup'](_0x1db6a4),_0xefcb1b=new Map();for(const _0x53770d of _0x133b81)_0xefcb1b['has'](_0x53770d['editor'])||_0xefcb1b['set'](_0x53770d['editor'],[]),_0xefcb1b['get'](_0x53770d['editor'])['push'](_0x53770d);for(const [_0x484c33,_0x790c9a]of _0xefcb1b)_0x484c33['model']['change'](_0x379eac=>{for(const _0x375525 of _0x790c9a)_0x379eac['removeMarker'](_0x375525['id']),this['_markers']['delete'](_0x375525['id']);});}getEditor(){return Os(this['context']);}getEditors(){return Rs(this['context']);}getEditorForChange(_0xd1e33){return this['_getMarkersDataForGroup'](_0xd1e33)[0x0]?.['editor'];}getMarkerElementForChange(_0x2b46ae){const _0x22e075=Array['from'](this['_markers']['values']())['filter'](_0x50e307=>_0x50e307['groupId']===_0x2b46ae);if(!_0x22e075['length'])return null;const _0x12451f=0x1===_0x22e075['length']?_0x22e075[0x0]:this['_sortMarkers'](_0x22e075)[0x0],_0x508f3b=_0x12451f['editor']['model']['markers']['get'](_0x12451f['id']);return _0x508f3b?{'modelRange':_0x508f3b['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x12451f['id'])}:null;}getContentElementForChange(_0x2f9fd3){const _0x13cdbb=Array['from'](this['_markers']['values']())['filter'](_0x5e8413=>_0x5e8413['groupId']===_0x2f9fd3);if(!_0x13cdbb['length'])return null;const _0x1dddde=0x1===_0x13cdbb['length']?_0x13cdbb[0x0]:this['_sortMarkers'](_0x13cdbb)[0x0],_0x2441ae=_0x1dddde['editor'],_0x2137a5=_0x2441ae['model']['markers']['get'](_0x1dddde['id']);if(!_0x2137a5)return null;const _0x2670c6=_0x2137a5['getRange'](),_0x4535b9=_0x2441ae['editing']['view']['getDomRoot'](_0x2670c6['root']['rootName'])||_0x2441ae['editing']['view']['getDomRoot']();if(!_0x4535b9||!_0x2670c6)return null;let _0x113a2e=_0x2670c6['start']['parent'];for(;_0x113a2e['parent']&&!_0x113a2e['parent']['is']('rootElement');)_0x113a2e=_0x113a2e['parent'];if(!_0x113a2e||!_0x113a2e['name'])return null;const _0x9105b6=_0x4535b9['querySelector']('[data-marker-id=\x22'+_0x1dddde['id']+'\x22]');if(!_0x9105b6)return null;if(_0x113a2e['is']('rootElement'))return _0x9105b6;let _0x50a78b=null;_0x2441ae['model']['change'](_0x4357fd=>{_0x50a78b=_0x4357fd['createDocumentFragment'](),_0x4357fd['append'](_0x113a2e['_clone'](!0x0),_0x50a78b);});const _0x41418e=_0x2441ae['data']['toView'](_0x50a78b)['getChild'](0x0);return _0x9105b6['closest'](_0x41418e['name']);}reactivateMarkers(_0x35939c){const _0x25a237=this['_getMarkersDataForGroup'](_0x35939c);if(!_0x25a237['length'])return;const _0x23f072=Array['from'](this['_activeMarkers'])['sort'](),_0x232faf=Array['from'](new Set(_0x25a237['map'](_0x433a82=>_0x433a82['id'])))['sort']();_0x23f072['join']('|')!==_0x232faf['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x35939c));}setMarkersInElementAsActive(_0x3c5239){const _0x4918f4=this['_getMarkersDataForGroup'](_0x3c5239);if(!_0x4918f4['length'])return;const _0x5b5d1b=_0x4918f4[0x0]['editor'],_0x4ce926=new Set(_0x4918f4['map'](_0x9d8e33=>_0x9d8e33['id'])),_0x41ea9b=Array['from'](_0x4ce926['values']())['map'](_0x52ff5d=>_0x5b5d1b['model']['markers']['get'](_0x52ff5d))['filter'](_0x5d1a77=>!!_0x5d1a77);_0x4ce926['forEach'](_0xc56279=>{this['_activeMarkers']['add'](_0xc56279);}),_0x5b5d1b['model']['change'](()=>{_0x41ea9b['forEach'](_0x1db8c4=>{_0x5b5d1b['editing']['reconvertMarker'](_0x1db8c4);});});}setAllMarkersAsInactive(){const _0x22158b=Array['from'](this['_activeMarkers']);if(!_0x22158b['length'])return;this['_activeMarkers']['clear']();const _0x2fa000=new Map();for(const _0x2cf7eb of _0x22158b){const _0x448859=this['_markers']['get'](_0x2cf7eb);if(!_0x448859)continue;const _0x1e1598=_0x448859['editor'],_0x56c855=_0x1e1598['model']['markers']['get'](_0x2cf7eb);_0x56c855&&(_0x2fa000['has'](_0x1e1598)||_0x2fa000['set'](_0x1e1598,[]),_0x2fa000['get'](_0x1e1598)['push'](_0x56c855));}for(const [_0x435488,_0x413288]of _0x2fa000)_0x435488['model']['change'](()=>{_0x413288['forEach'](_0x56d4b0=>{_0x435488['editing']['reconvertMarker'](_0x56d4b0);});});}_getPositionLimitingRange(_0x1e4e3e,_0xf961a4,_0x577dce='outside'){if(!_0x1e4e3e)return null;let _0x5e0cc4=_0x1e4e3e['parent'];for(;_0x5e0cc4&&_0x5e0cc4['parent']&&!_0x5e0cc4['parent']['is']('rootElement')&&!_0xf961a4['model']['schema']['isLimit'](_0x5e0cc4)&&!_0xf961a4['model']['schema']['isBlock'](_0x5e0cc4);)_0x5e0cc4=_0x5e0cc4['parent'];if(!_0x5e0cc4||!_0x5e0cc4['name']||_0x5e0cc4['is']('rootElement'))return null;let _0x341c30=null;return _0xf961a4['model']['change'](_0x5b9435=>{_0x341c30='inside'===_0x577dce?_0x5b9435['createRangeIn'](_0x5e0cc4):_0x5b9435['createRangeOn'](_0x5e0cc4);}),_0x341c30;}_validateMarkers(_0x10ce96,_0x1bbd7c){const _0x23af04=Array['from'](this['_markers']['keys']()),_0x232346=new Map();for(const _0x306fcf of _0x23af04){const _0x3ea65d=_0x10ce96['model']['markers']['get'](_0x306fcf);if(!_0x3ea65d)continue;const _0x2cb196=_0x3ea65d['getStart']()['root']['rootName']+':'+_0x3ea65d['getStart']()['path'][0x0];_0x232346['has'](_0x2cb196)||_0x232346['set'](_0x2cb196,[]),_0x232346['get'](_0x2cb196)['push'](_0x3ea65d);}const _0x27f1b=new Set();for(const _0xdeb936 of _0x10ce96['model']['document']['differ']['getChanges']()){let _0x33a802,_0x20886c;if('insert'===_0xdeb936['type'])_0x20886c=new _0x2be128(_0xdeb936['position'],_0xdeb936['position']['getShiftedBy'](_0xdeb936['length'])),_0x33a802=_0xdeb936['position']['root']['rootName']+':'+_0xdeb936['position']['path'][0x0];else{if('remove'!==_0xdeb936['type'])continue;_0x20886c=new _0x2be128(_0xdeb936['position']),_0x33a802=_0xdeb936['position']['root']['rootName']+':'+_0xdeb936['position']['path'][0x0];}const _0x470edf=_0x232346['get'](_0x33a802)||[];if(_0x470edf['length']){for(const _0x2ef51a of _0x470edf)if(_0x20886c['root']['rootName']===_0x2ef51a['getRange']()['root']['rootName']&&('insert'!==_0xdeb936['type']||!_0x20886c['containsRange'](_0x2ef51a['getRange']()))&&(_0x20886c['isIntersecting'](_0x2ef51a['getRange']())||_0x20886c['start']['isTouching'](_0x2ef51a['getRange']()['end'])||_0x20886c['end']['isTouching'](_0x2ef51a['getRange']()['start']))){const _0x4bcf1f=this['_parseMarkerName'](_0x2ef51a['name']);Array['from'](this['_markers']['values']())['filter'](_0x763fd4=>_0x763fd4['groupId']===_0x4bcf1f['groupId'])['forEach'](_0x5ea3c3=>_0x27f1b['add'](_0x5ea3c3['id']));}}}if(_0x27f1b['size']){for(const _0x23abe0 of _0x27f1b)_0x1bbd7c['removeMarker'](_0x23abe0);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x58e194){for(const {name:_0x37441f,data:_0x5dc67f}of _0x58e194['model']['document']['differ']['getChangedMarkers']()){if(!_0x37441f['startsWith'](Dh))continue;const _0x24828c=_0x5dc67f['oldRange'],_0x454c9b=_0x5dc67f['newRange'],_0x1d9c6e=_0x24828c&&'$graveyard'===_0x24828c['root']['rootName'],_0x309578=_0x454c9b&&'$graveyard'===_0x454c9b['root']['rootName'];if(_0x1d9c6e&&_0x309578)continue;const _0x42f900=this['_parseMarkerName'](_0x37441f);this['_markers']['get'](_0x37441f)&&(_0x309578||!_0x454c9b?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x37441f,'changeId':_0x42f900['groupId']}):_0x1d9c6e&&_0x454c9b&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x37441f,'changeId':_0x42f900['groupId']}));}}['_parseMarkerName'](_0x22e5ab){const _0x57e940=_0x22e5ab['split'](':'),_0x366ea0=(_0x57e940[0x1]||'')['split']('_');return{'prefix':_0x57e940[0x0],'groupId':_0x366ea0[0x0],'suffix':_0x366ea0[0x1]};}_translateOperationToEditorContent(_0x2e8c04,_0x12bdbd,_0x9ed499){if('insert'===_0x2e8c04['type']){const _0x68fbe3=_0x2e8c04;return new _0xb0469(this['_changePosition'](_0x12bdbd['concat'](_0x68fbe3['position']['offset']),_0x9ed499),_0x68fbe3['nodes'],_0x68fbe3['baseVersion']);}if('marker'===_0x2e8c04['type']&&_0x2e8c04['name']['startsWith']('$markedRemove')){const _0x2a333c=_0x2e8c04;return new _0x1122b4(_0x2a333c['name'],_0x2a333c['oldRange'],this['_changeRange'](_0x2a333c['newRange'],_0x12bdbd['concat'](_0x2a333c['newRange']['start']['offset']),_0x12bdbd['concat'](_0x2a333c['newRange']['end']['offset']),_0x9ed499),_0x2a333c['_markers'],_0x2a333c['affectsData'],_0x2a333c['baseVersion']);}return _0x2e8c04;}_groupAdjacentOperations(_0x5b0717){if(!_0x5b0717['length'])return[];const _0x2f946f=[];let _0x2fa017=0x0,_0x3d0c9e=0x0,_0x1becda=[];for(let _0x4f3698=0x0;_0x4f3698<=_0x5b0717['length'];_0x4f3698++){const _0x390c5f=_0x5b0717[_0x4f3698],_0x5b8331=_0x5b0717[_0x4f3698-0x1];!_0x390c5f||_0x5b8331&&!this['_getOperationEnd'](_0x5b8331)['isTouching'](this['_getOperationStart'](_0x390c5f))?(_0x2f946f['push']({'operations':_0x1becda,'operationsIsolated':_0x1becda['map'](_0x12172e=>this['_shiftOperation'](_0x12172e['clone'](),-_0x3d0c9e)),'groupOffset':_0x2fa017}),_0x1becda=_0x390c5f?[_0x390c5f]:[],_0x3d0c9e+=_0x2fa017,_0x2fa017=0x0):_0x1becda['push'](_0x390c5f),_0x390c5f&&'insert'===_0x390c5f['type']&&(_0x2fa017+=_0x390c5f['howMany']);}return _0x2f946f;}_findAdjacentContextDistance(_0x22c8ff,_0x25f91f,_0x5a336e,_0x3f0069=0x1){const _0x5e4382=new _0x362d3b({'startPosition':_0x22c8ff,'direction':_0x25f91f});let _0x579b15=0x0;for(let _0x140bc2=0x0;_0x140bc2<_0x3f0069;_0x140bc2++){let _0x1b880e=0x0,_0x247c3f=!0x1,_0x173d13='forward'===_0x25f91f?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x481a46}of _0x5e4382)if(_0x481a46['is']('$textProxy')){const _0x403101=_0x173d13['exec'](_0x481a46['data']);if(_0x403101&&_0x403101['length']){if(_0x1b880e+='forward'===_0x25f91f?_0x403101['index']+_0x403101[0x0]['length']:_0x481a46['data']['length']-_0x403101['index'],_0x403101[0x0]['length']!==_0x481a46['data']['length'])break;_0x247c3f=!0x0,_0x173d13='forward'===_0x25f91f?/^\w+/:/\w+$/;}else{if(_0x247c3f)break;_0x1b880e+=_0x481a46['offsetSize'];}}else{if(_0x481a46['is']('element')){_0x5a336e['isInline'](_0x481a46)&&!_0x247c3f&&(_0x1b880e+=0x1);break;}}_0x579b15+=_0x1b880e,_0x5e4382['jumpTo'](_0x22c8ff['getShiftedBy']('forward'===_0x25f91f?_0x579b15:-_0x579b15));}return _0x579b15;}_getChangeContext(_0x27ed71,_0x46ace4,_0x143a2c){const _0xb4c5f1=_0x143a2c['model']['schema'],_0x6a6fe4=this['_findAdjacentContextDistance'](_0x27ed71,'backward',_0xb4c5f1,0x6),_0xcf5438=this['_findAdjacentContextDistance'](_0x46ace4,'forward',_0xb4c5f1,0x6),_0x5b4cdb=_0x27ed71['getShiftedBy'](-_0x6a6fe4),_0x728453=_0x46ace4['getShiftedBy'](_0xcf5438);return{'start':_0x5b4cdb,'end':_0x728453,'hasContentBefore':!_0x5b4cdb['isAtStart'],'hasContentAfter':!_0x728453['isAtEnd']};}_insertMarkers(_0x141ae7,_0x16c5b1){const _0x46d5c0=this['context']['plugins']['get']('AIEditing'),_0x219979=new Set();_0x16c5b1['model']['change'](_0x5eb777=>{for(const _0x4be5ed of _0x141ae7){const _0x4ddb9a=''+Dh+_0x4be5ed['type']+':'+_0x4be5ed['groupId']+'_'+_0x46d5c0['_nextDataId'](_0x219979);this['_markers']['set'](_0x4ddb9a,{'id':_0x4ddb9a,'groupId':_0x4be5ed['groupId'],'type':_0x4be5ed['type'],'content':_0x4be5ed['content'],'editor':_0x16c5b1}),_0x5eb777['addMarker'](_0x4ddb9a,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x5eb777['createRange'](_0x4be5ed['start'],_0x4be5ed['end'])});}});}_createGetContextFn(_0x3f320b,_0x1fe7d7,_0x598064){let _0x45d3d2='';return()=>{if(!_0x45d3d2){const _0x1a0961=_0x1fe7d7['toView'](_0x3f320b,{'showSuggestionHighlights':!0x0});let _0x23cf1a=_0x1a0961['getChild'](0x0);if(_0x23cf1a['is']('containerElement')||(_0x23cf1a=_0x1a0961),!_0x23cf1a)return'';let _0x193340=!0x1;const _0x261034=[];for(const _0x114083 of _0x23cf1a['getChildren']())_0x114083['is']('element','span')&&_0x114083['hasClass']('ck-ai_review-marker_context-end')&&(_0x193340=!0x1),_0x193340&&_0x261034['push'](_0x114083),_0x114083['is']('element','span')&&_0x114083['hasClass']('ck-ai_review-marker_context-start')&&(_0x193340=!0x0);_0x23cf1a['_removeChildren'](0x0,_0x23cf1a['childCount']),_0x598064?.['ellipsisBefore']&&_0x23cf1a['_appendChild']('…'),_0x23cf1a['_appendChild'](_0x261034),_0x598064?.['ellipsisAfter']&&_0x23cf1a['_appendChild']('…');const _0xd62cff=_0x1fe7d7['htmlProcessor']['domConverter']['viewToDom'](_0x1a0961),_0x1a0ba6=_0x1fe7d7['htmlProcessor']['htmlWriter']['getHtml'](_0xd62cff);_0x45d3d2=this['_removeUnsupportedElements'](_0x1a0ba6);}return _0x45d3d2;};}_createGetContentFn(_0x4f5b2e,_0x36e5a3){let _0x348aac='';return()=>(_0x348aac||(_0x348aac=this['_removeUnsupportedElements'](_0x36e5a3['stringify'](_0x4f5b2e,{'showSuggestionHighlights':!0x0}))),_0x348aac);}_createGetContentUsingDataIdFn(_0x526ef1,_0x30fb3d,_0x1d6777){let _0x27e88a='';return()=>{if(!_0x27e88a){const _0x42b7dd=_0x1d6777['toView'](new _0x58f66a(_0x526ef1));_0x27e88a=_0x1d6777['htmlProcessor']['domConverter']['viewToDom'](_0x42b7dd)['querySelector']('[data-id=\x22'+_0x30fb3d+'\x22]')?.['outerHTML']||'';}return _0x27e88a;};}_removeUnsupportedElements(_0x55b31b){if(!_0x55b31b)return'';const _0x2cb34d=vs(_0x55b31b,{'decodeEntities':!0x1}),_0x3ecb62=xs(_0x2cb34d);if(!_0x3ecb62['length'])return _0x55b31b;for(const _0xd83186 of _0x3ecb62)_0x147247(_0xd83186);return ks(_0x2cb34d,{'encodeEntities':!0x1});}_neutralizeChangesOnUnsupportedElements(_0x42cfba,_0x2ed376){const _0x442576=vs(_0x42cfba,{'decodeEntities':!0x1}),_0x1bd239=vs(_0x2ed376,{'decodeEntities':!0x1}),_0x3dce20=xs(_0x442576),_0x2fced6=xs(_0x1bd239);if(!_0x3dce20['length']&&!_0x2fced6['length'])return{'contentInitial':_0x42cfba,'contentNew':_0x2ed376};const _0x587a18=new Map(),_0x1be9ef=new Map();for(const _0x40d3d1 of _0x3dce20){const _0x24f72e=Hs(_0x40d3d1,'data-id');if(_0x24f72e)_0x587a18['set'](_0x24f72e,_0x40d3d1);else{const _0x14aa3c=ks(_0x40d3d1,{'encodeEntities':!0x1}),_0x3d676b=_0x1be9ef['get'](_0x14aa3c);_0x3d676b?_0x3d676b['push'](_0x40d3d1):_0x1be9ef['set'](_0x14aa3c,[_0x40d3d1]);}}for(const _0xeb6dfa of _0x2fced6){const _0x3bf79c=Hs(_0xeb6dfa,'data-id');let _0x2e0a79;if(_0x3bf79c)_0x2e0a79=_0x587a18['get'](_0x3bf79c);else{const _0xf11aa3=_0x1be9ef['get'](ks(_0xeb6dfa,{'encodeEntities':!0x1}));_0x2e0a79=_0xf11aa3&&_0xf11aa3['length']?_0xf11aa3['shift']():void 0x0;}_0x2e0a79?_0x54b98e(_0xeb6dfa,_0x3717a9(_0x2e0a79,!0x0)):_0x147247(_0xeb6dfa);}return{'contentInitial':ks(_0x442576,{'encodeEntities':!0x1}),'contentNew':ks(_0x1bd239,{'encodeEntities':!0x1})};}_findMarkerElement(_0x19c500,_0x3b7d7e=0x5){let _0xae1b3b=_0x19c500,_0x293194=null;for(let _0x303e16=0x0;_0x303e16<_0x3b7d7e&&_0xae1b3b;_0x303e16++)if(_0xae1b3b['className']){if((''+_0xae1b3b['className'])['includes']('ck-ai_review-marker_')){if(!_0xae1b3b['getAttribute']('data-marker-id'))break;_0x293194=_0xae1b3b;break;}_0xae1b3b=_0xae1b3b['parentElement'];}else _0xae1b3b=_0xae1b3b['parentElement'];return _0x293194;}_findMarkerElementById(_0x4bb10d){const _0x41f4a5=this['_markers']['get'](_0x4bb10d);if(!_0x41f4a5)return null;const _0x3a5bd0=_0x41f4a5['editor']['model']['markers']['get'](_0x4bb10d);return _0x3a5bd0?_0x53cb27(_0x41f4a5['editor']['editing'],_0x3a5bd0):null;}_getMarkersDataForGroup(_0x35e65f){return Array['from'](this['_markers']['values']())['filter'](_0x2224fa=>_0x2224fa['groupId']===_0x35e65f);}_getOperationStart(_0x14b4db){return'insert'===_0x14b4db['type']?_0x14b4db['position']:_0x14b4db['newRange']['start'];}_getOperationEnd(_0xcd82c6,_0x3b5153=!0x1){return'insert'===_0xcd82c6['type']?_0x3b5153?_0xcd82c6['position']:_0xcd82c6['position']['getShiftedBy'](_0xcd82c6['howMany']):_0xcd82c6['newRange']['end'];}_shiftOperation(_0x18396e,_0x246ffb){return'insert'===_0x18396e['type']?_0x18396e['position']=_0x18396e['position']['getShiftedBy'](_0x246ffb):'marker'===_0x18396e['type']&&_0x18396e['newRange']&&(_0x18396e['newRange']=new _0x2be128(_0x18396e['newRange']['start']['getShiftedBy'](_0x246ffb),_0x18396e['newRange']['end']['getShiftedBy'](_0x246ffb))),_0x18396e;}_changeOperationOwnerDocument(_0x326263,_0x5b2171){'insert'===_0x326263['type']?_0x326263['position']=this['_changePositionOwnerDocument'](_0x326263['position'],_0x5b2171):'marker'===_0x326263['type']&&_0x326263['newRange']&&(_0x326263['newRange']=this['_changeRangeOwnerDocument'](_0x326263['newRange'],_0x5b2171));}_changePositionOwnerDocument(_0xd8d4f6,_0x4500cb){return new _0x159a64(_0x4500cb,_0xd8d4f6['path']);}_changeRangeOwnerDocument(_0x3a4652,_0x4d9407){return new _0x2be128(this['_changePositionOwnerDocument'](_0x3a4652['start'],_0x4d9407),this['_changePositionOwnerDocument'](_0x3a4652['end'],_0x4d9407));}_changePosition(_0x49b53e,_0x33853a){return new _0x159a64(_0x33853a,[..._0x49b53e]);}['_changeRange'](_0x156dc6,_0x3b21e9,_0x2cf7df,_0x45890e){return new _0x2be128(this['_changePosition'](_0x3b21e9,_0x45890e),this['_changePosition'](_0x2cf7df,_0x45890e));}_sortMarkers(_0x3c3b61){const _0x367abb=_0x16308e=>{switch(_0x16308e){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x3c3b61['sort']((_0x29b9e3,_0x2df2ec)=>_0x367abb(_0x29b9e3['type'])-_0x367abb(_0x2df2ec['type']));}_hasSameTopLevelElement(_0x4af220,_0x3f9cb8){const _0x22f0bd=_0x4af220['getChild'](0x0),_0xd8027f=_0x3f9cb8['getChild'](0x0);return!(!_0x22f0bd||!_0xd8027f)&&((!_0x22f0bd['is']('element')||!_0xd8027f['is']('element')||_0x22f0bd['name']===_0xd8027f['name'])&&!(_0x22f0bd['is']('element')&&!_0xd8027f['is']('element')||!_0x22f0bd['is']('element')&&_0xd8027f['is']('element')));}_haveSingleTopLevelElement(_0x53cc04){return 0x1===_0x53cc04['childCount'];}_haveOnlyInlineContent(_0x1167bc,_0x4a3917){for(const _0x548781 of _0x1167bc['getChildren']())if(_0x548781['is']('element')&&!_0x4a3917['isInline'](_0x548781))return!0x1;return!0x0;}_upsertDataId(_0x202290,_0x1a8ac6){let _0x5b3091=_0x202290['getAttribute'](_0x4eb302);return _0x5b3091||(_0x5b3091=_0x1a8ac6(),_0x202290['_setAttribute'](_0x4eb302,_0x5b3091)),_0x5b3091;}};const Vh=/* #__PURE__ -- @preserve */
38
- dt();var Bh=class extends Vh{['id'];contentNew;contentInitial;documentVersion;constructor({id:_0x3b5a88,contentNew:_0x8608a1,contentInitial:_0x330b15,documentVersion:_0x1dfe08}){super(),this['id']=_0x3b5a88,this['contentNew']=_0x8608a1,this['contentInitial']=_0x330b15,this['documentVersion']=_0x1dfe08;}};const Gh=/* #__PURE__ -- @preserve */
39
- At();var Fh=class extends Gh{['id'];parent;editor;_data;_editorOperations=[];constructor(_0x1041ba,_0x3c7b99,_0x21ce88,_0x11ce3c){super(),this['id']=_0x1041ba,this['parent']=_0x21ce88,this['editor']=_0x11ce3c,this['_data']=_0x3c7b99,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']['wrapperTag']?function(_0x4cda26){const _0x1e01f8=vs(_0x4cda26)['children']['filter'](_0x3b00a1);return 0x1!==_0x1e01f8['length']?_0x4cda26:_0x1e01f8[0x0]['children']['map'](_0xf48ce4=>ks(_0xf48ce4))['join']('');}(this['_data']['context']()):this['_data']['context']();}get['wrapperTag'](){return this['_data']['wrapperTag'];}get operations(){return this['_data']['operations']['slice']();}get operationsIsolated(){return this['_data']['operationsIsolated']['slice']();}};const Kh=/* #__PURE__ -- @preserve */
40
- At();var Wh=class extends Kh{['id']=Nt();['callId'];_results=new Map();['_changes']=[];_hasUnsupportedInlineChange=!0x1;['_sourceCheck'];_documentData;_aiConnector;['_reviewParams'];['_reviewArgs'];_contexts;_activeRequest=null;_currentError;_wasAborted=!0x1;constructor(_0xc4bd4b,_0x85a0e9,_0x340dfb,_0x3c10e1,_0x209c81,_0x56e7ba){super(),this['_sourceCheck']=_0x85a0e9,this['_documentData']=_0xc4bd4b,this['_aiConnector']=_0x340dfb,this['_reviewParams']=_0x3c10e1,this['_reviewArgs']=_0x209c81,this['_contexts']=_0x56e7ba,this['on']('change:status',(_0x2ba92,_0x3c515b,_0xdd04e)=>{'aborted'==_0xdd04e&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0xdd04e,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get documentData(){return this['_documentData'];}get['sourceCheck'](){return this['_sourceCheck'];}get processedResultsCount(){return this['_results']['size'];}get hasUnsupportedInlineChange(){return this['_hasUnsupportedInlineChange'];}get title(){return this['_sourceCheck']['title'];}get subTitle(){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get hasModifications(){return!this['_changes']['every'](_0x2a3794=>'pending'===_0x2a3794['status']);}get currentError(){return this['_currentError'];}get results(){return Array['from'](this['_results']['values']());}updateDocumentData(_0x45115a){this['_documentData']=_0x45115a;}async start(){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x50bd5d=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x1e7554 of _0x50bd5d)'unmodified'!==_0x1e7554['data']['operation']&&('error'!==_0x1e7554['data']['operation']?'review-metadata'!==_0x1e7554['event']?this['_addReviewCheckResult'](_0x1e7554['data']['dataId'],_0x1e7554['data']['textDelta']):this['callId']=_0x1e7554['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(_0x567095){this['_currentError']=_0x567095,Nn(_0x567095)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async restart(){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,this['_hasUnsupportedInlineChange']=!0x1,await this['start']();}addResultChanges(_0x4ad40c,_0x3e7104){const _0x472d3e=this['_results']['get'](_0x4ad40c);if(!_0x472d3e)return;if(0x0===_0x3e7104['length'])return;const _0x3bfdd2=this['_documentData']['elements']['get'](_0x4ad40c);if(!_0x3bfdd2)return;const _0x2df8c7=[];_0x3e7104['forEach']((_0x25eeee,_0x42a5be)=>{const _0xa4b0b8=new Fh(_0x472d3e['id']+'-'+_0x42a5be,_0x25eeee,_0x472d3e,_0x3bfdd2['editor']);_0xa4b0b8['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0xa4b0b8,'status':_0xa4b0b8['status']});}),_0xa4b0b8['on']('change:isActivated',()=>{_0xa4b0b8['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0xa4b0b8}):this['fire']('reviewCheckResultDeactivated',{'change':_0xa4b0b8});}),this['_changes']['push'](_0xa4b0b8),_0x2df8c7['push'](_0xa4b0b8);}),this['fire']('reviewCheckResultReady',{'changes':_0x2df8c7,'result':_0x472d3e,'source':this});}abort(){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}isChangeActive(_0x835441){const _0x47a529=this['_changes']['find'](_0x24f96c=>_0x24f96c['id']===_0x835441);return!(!_0x47a529||'pending'!==_0x47a529['status']);}isAnyChangeActivated(){return this['_changes']['some'](_0x416c0f=>!0x0===_0x416c0f['isActivated']);}getActiveChanges(){return this['_changes']['filter'](_0x1d22eb=>'pending'===_0x1d22eb['status']);}getChangeById(_0x49b33e){return this['_changes']['find'](_0x148925=>_0x148925['id']===_0x49b33e);}markAllChangesAsAccepted(){for(const _0x43824b of this['_changes'])'pending'===_0x43824b['status']&&(_0x43824b['status']='accepted');this['_checkIfFinished']();}markChangeAsAccepted(_0x50b284){const _0x51eb13=this['_changes']['find'](_0x4e3891=>_0x4e3891['id']===_0x50b284);_0x51eb13&&'pending'===_0x51eb13['status']&&(_0x51eb13['status']='accepted'),this['_checkIfFinished']();}markChangeAsRejected(_0x4e641d){const _0x180c84=this['_changes']['find'](_0x2c7ecb=>_0x2c7ecb['id']===_0x4e641d);_0x180c84&&'pending'===_0x180c84['status']&&(_0x180c84['status']='rejected'),this['_checkIfFinished']();}markChangeAsOutdated(_0x38d37c){const _0x34cbe3=this['_changes']['find'](_0x47e6b5=>_0x47e6b5['id']===_0x38d37c);_0x34cbe3&&'pending'===_0x34cbe3['status']&&(_0x34cbe3['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x48adc2){const _0x2cc750=this['_changes']['find'](_0x592539=>_0x592539['id']===_0x48adc2);_0x2cc750&&'outdated'===_0x2cc750['status']&&(_0x2cc750['status']='pending'),this['_checkIfFinished']();}activateChange(_0x5da333){this['_changes']['filter'](_0x4fe3d=>_0x4fe3d['isActivated']&&_0x4fe3d['id']!==_0x5da333)['forEach'](_0x49a790=>{_0x49a790['isActivated']=!0x1;});const _0x4b2f40=this['_changes']['find'](_0x3a0b33=>_0x3a0b33['id']===_0x5da333);_0x4b2f40&&'pending'===_0x4b2f40['status']&&(_0x4b2f40['isActivated']=!0x0);}deactivateChange(){this['_changes']['filter'](_0x1678c0=>_0x1678c0['isActivated'])['forEach'](_0x5e7049=>{_0x5e7049['isActivated']=!0x1;});}forceReadyState(){this['status']='ready';}async sendRating(_0x2478f3){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x3bf1b0;if(_0x2478f3){const _0x3c8ae9=this['_changes']['find'](_0x201eaa=>_0x201eaa['id']===_0x2478f3);if(_0x3c8ae9&&_0x3c8ae9['isRated'])return;_0x3c8ae9&&(_0x3bf1b0=_0x3c8ae9['parent']['id'],_0x3c8ae9['isRated']=!0x0);}const _0x23e62c={'positiveCount':this['_changes']['filter'](_0x4a6628=>'accepted'===_0x4a6628['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x23e62c,this['callId'],_0x3bf1b0);}_addReviewCheckResult(_0x6a74a4,_0x387125){const _0x5aad25=this['_documentData']['elements']['get'](_0x6a74a4);if(!_0x5aad25)return;if(Ks(_0x5aad25['editor'],_0x5aad25['rootName'])&&!qs(_0x5aad25['editor'],vs(_0x387125)))return void(this['_hasUnsupportedInlineChange']=!0x0);const _0x4b2d8f=_0x5aad25['getContent']();if(_0x4b2d8f===_0x387125)return;const _0x4524ee=new Bh({'id':_0x6a74a4,'contentInitial':_0x4b2d8f,'contentNew':_0x387125,'documentVersion':_0x5aad25['documentVersion']});this['_results']['set'](_0x4524ee['id'],_0x4524ee),this['fire']('reviewCheckResultAdded',{'result':_0x4524ee,'source':this,'editor':_0x5aad25['editor'],'rootName':_0x5aad25['rootName']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x4dcbda=>'pending'===_0x4dcbda['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x3a7769=>'pending'===_0x3a7769['status'])['length']&&(this['status']='finished');}},Yh=class extends Wh{get subTitle(){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x5bdc1f=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x144f94=0x0;_0x144f94<this['_reviewParams']['length'];_0x144f94++){if(!this['_reviewParams'][_0x144f94]||!this['_sourceCheck']['options'][_0x144f94])continue;const _0x44c0d1=this['_sourceCheck']['options'][_0x144f94]['data']?.['find'](_0x151ddc=>_0x151ddc['id']===this['_reviewParams'][_0x144f94]);_0x44c0d1&&_0x5bdc1f['push'](_0x44c0d1['label']);}return _0x5bdc1f['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}_createApiRequest(){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs'],'contexts':this['_contexts']});}_sendRatingRequest(_0x1b438c,_0x41e5a4,_0x554fa9){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x41e5a4,_0x1b438c,_0x554fa9);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},$h=class extends _0x45fe7d{_aiConnector;['_aiReviewCoreUi'];_aiReviewCoreEditing;['_availableReviewChecks'];_reporter;_currentReviewCheckRun;_changeActivationSource=null;static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_initRequiredPlugins'](),this['_initAvailableReviewChecks'](),this['_initUIListeners']();}async _initAvailableReviewChecks(){this['_availableReviewChecks']=await this['_getReviewChecks'](),this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}_initUIListeners(){this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_availableReviewChecks']&&this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',(_0x1769cf,_0x5bc696)=>this['runCheck'](_0x5bc696)),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 _0x5dfc9e=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x5dfc9e['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x5dfc9e['map'](_0x5858e5=>_0x5858e5['id']),this['_aiSource']);const _0x373425=this['_currentReviewCheckRun'];_0x373425['markAllChangesAsAccepted'](),_0x373425['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x35f21d,_0xaaf6a)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0xaaf6a['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0xaaf6a['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0xaaf6a['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0xaaf6a['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x163bc8,_0x4e4832)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x4e4832['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x4e4832['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x4e4832['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x4e4832['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x5022d4,_0x5a792a)=>{this['_onActivateChange'](_0x5a792a);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x434391,_0x160983)=>{this['_onDeactivateChange'](_0x160983);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x41d00f,_0x21af5a)=>{this['_onChangeMarkerClicked'](_0x41d00f,_0x21af5a);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x4d9c1b,_0x2fdf73)=>{this['_onChangeMarkerHovered'](_0x4d9c1b,_0x2fdf73);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x1c133a,_0xfcc4e6)=>{this['_onChangeMarkerRemoved'](_0x1c133a,_0xfcc4e6);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x511d2c,_0x2c5125)=>{this['_onChangeMarkerRestored'](_0x511d2c,_0x2c5125);});}async['runCheck'](_0x22be5e){if(!this['_availableReviewChecks'])return;const _0x37ca7a=this['_availableReviewChecks']['find'](_0x1c2c47=>_0x1c2c47['id']===_0x22be5e['id']);if(!_0x37ca7a)return void this['_logError'](new ct('ai-review-mode-source-check-not-found',this,{'checkId':_0x22be5e['id']}));this['_onReviewCheckRun'](_0x22be5e),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1);const _0x148dac=this['context']['plugins']['get'](Ss)['contextLibrary']['resolveContext']({'feature':this['_defaultContextFeature'],'ids':[_0x22be5e['id']],'context':new qn()});this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x22be5e,_0x37ca7a,_0x148dac);const _0x349a26=this['_currentReviewCheckRun'];_0x349a26['on']('reviewCheckResultChangeStatusUpdated',(_0x46e680,_0x41184d)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x41184d['change']['id'],_0x41184d['status']),this['_pushAcceptAllEnabled'](_0x349a26);}),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0xc57830,_0x4a34e4)=>{switch(_0x4a34e4['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x4a34e4);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ct('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ct('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'!==_0x4a34e4['status']&&'error-chunk'!==_0x4a34e4['status']&&'error-general'!==_0x4a34e4['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x2ad75b,_0x46d9cd)=>{if(!this['_currentReviewCheckRun'])throw new ct('ai-review-mode-no-current-check-run',this);const _0x33a691=Ks(_0x46d9cd['editor'],_0x46d9cd['rootName']);let _0x39dd84=_0x46d9cd['result']['contentInitial'],_0x5e3b8a=_0x46d9cd['result']['contentNew'];_0x33a691&&(_0x39dd84=$s(_0x39dd84),_0x5e3b8a=$s(_0x5e3b8a));const _0x22c51f=this['_diffContent'](_0x46d9cd['editor'],_0x39dd84,_0x5e3b8a);if(_0x33a691){const _0x2a99c6=_0x46d9cd['editor']['ui']['getEditableElement'](_0x46d9cd['rootName'])?.['tagName']['toLowerCase']();for(const _0x509c70 of _0x22c51f)_0x509c70['wrapperTag']=_0x2a99c6;}_0x46d9cd['source']['addResultChanges'](_0x46d9cd['result']['id'],_0x22c51f);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x321578,_0x4bac25)=>{for(const _0xc8babd of _0x4bac25['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0xc8babd);this['_pushAcceptAllEnabled'](_0x4bac25['source']),this['_markChangePositionInEditorContent'](_0x4bac25['changes'],_0x4bac25['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x4f6e26,_0x369c65)=>{this['_onReviewCheckResultActivated'](_0x369c65);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x55dce1){if(Nn(_0x55dce1))return;_0x55dce1 instanceof ct?this['_logError'](_0x55dce1):this['_logError'](new ct('ai-review-mode-check-run-failed',this,void 0x0,_0x55dce1));}}abort(){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}getAvailableChecks(){return(this['_availableReviewChecks']??[])['slice']();}getCurrentCheckRun(){return this['_currentReviewCheckRun'];}_pushAcceptAllEnabled(_0x33f58b){this['_aiReviewCoreUi']['setAcceptAllEnabled'](_0x33f58b['getActiveChanges']()['length']>0x0);}_createReviewCheckRun(_0x427bbc,_0x561f30,_0x46c7a=new qn()){return new Yh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x561f30,this['_aiConnector'],_0x427bbc['params'],_0x427bbc['args'],_0x46c7a['refs']);}['_onChangeMarkerRemoved'](_0x5902a2,_0xcb5d4){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0xcb5d4['changeId']);}_onChangeMarkerRestored(_0x3b46bc,_0x8d1b91){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x8d1b91['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}_initRequiredPlugins(){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](Ln)['createReporter']('aireview');}['_onReviewRunLeave'](_0x18acc5=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x18acc5&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x2931bd of this['_aiReviewCoreEditing']['getEditors']())_0x2931bd['editing']['view']['change'](_0xabf8ff=>{for(const _0x1854db of _0x2931bd['editing']['view']['document']['getRoots']())_0xabf8ff['removeClass']('ck-ai_review-diff',_0x1854db),_0xabf8ff['removeClass']('ck-ai_review-highlights',_0x1854db),_0xabf8ff['removeClass']('ck-ai-translate-mode-content',_0x1854db);});}['_logError'](_0x1528b4){this['_reporter']['logError'](_0x1528b4),'ai-review-mode-models-unable-to-retrieve'===function(_0x30111b){return _0x30111b instanceof xn?_0x30111b['code']:_0x30111b instanceof Error?_0x30111b['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x1528b4)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x19f3ee){if('content'===this['_changeActivationSource']){const _0xe44f75=this['_aiReviewCoreUi']['getChangeElement'](_0x19f3ee);_0xe44f75&&vt(_0xe44f75['closest']('.ck-ai_review__check-run-result')||_0xe44f75);}else{if('panel'===this['_changeActivationSource']){const _0x5a9fe1=this['_getChangeContentElement'](_0x19f3ee);if(!_0x5a9fe1)return;kt({'target':_0x5a9fe1,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},qh=class extends Wh{_prompt;['_model'];constructor(_0xe20cc2,_0x1443c3,_0x1a1871,_0x1f68e9,_0x475483,_0x2a9dd2){super(_0x1a1871,_0x1f68e9,_0x475483,void 0x0,void 0x0,_0x2a9dd2),this['_prompt']=_0xe20cc2,this['_model']=_0x1443c3;}get subTitle(){return this['_prompt']??'';}_createApiRequest(){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],...void 0x0!==this['_prompt']&&{'prompt':this['_prompt']},'model':this['_model'],'contexts':this['_contexts']});}_sendRatingRequest(_0x3bfabd,_0x3448ed,_0x240d91){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x3448ed,_0x3bfabd,_0x240d91);}},Qh=class{['id'];['commandId'];title;description;isParameterized;['useArgs'];options;['args'];get['apiId'](){return this['commandId'];}constructor(_0x225205){this['id']=_0x225205['id'],this['commandId']=_0x225205['commandId'],this['title']=_0x225205['title'],this['description']=_0x225205['description'],this['isParameterized']=_0x225205['isParameterized'],this['useArgs']=_0x225205['useArgs'],this['options']=_0x225205['options'],this['args']=_0x225205['args'];}},Xh=class extends Qh{isExtra=!0x0;prompt;context;['model'];_defaultModel=null;constructor(_0xe83393,_0xfe7f04,_0x268856){super(_0xe83393),this['prompt']=_0xe83393['prompt'],this['context']=_0xe83393['context'],this['model']=_0xe83393['model'],this['model']?this['_defaultModel']=_0xfe7f04['find'](_0x346e99=>_0x346e99['id']===this['model'])||null:this['_defaultModel']=_0x268856;}get defaultModel(){return this['_defaultModel'];}},zh=class extends qh{get subTitle(){return'';}set prompt(_0x1d8818){this['_prompt']=_0x1d8818;}set['model'](_0x57db33){this['_model']=_0x57db33;}},jh=class extends _0x45fe7d{static get requires(){return[Es,Ln];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];_reporter;init(){this['_reporter']=this['context']['plugins']['get'](Ln)['createReporter']('aireview');}getChecksList(){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const Jh=[{'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'}]}]}],Zh=/* #__PURE__ -- @preserve */
41
- At();var tc=class extends Zh{['_checks']=[];setupChecks(_0x201be4){this['_checks']=_0x201be4['map'](_0x1abb95=>new Qh(_0x1abb95));}get['checks'](){return this['_checks']['slice']();}getCheckById(_0x4f6bc9){return this['checks']['find'](_0xac92e0=>_0xac92e0['id']===_0x4f6bc9);}['removeCheckById'](_0x302b11){this['_checks']=this['_checks']['filter'](_0x23c07a=>_0x23c07a['id']!==_0x302b11);}},ec=class extends Qh{['_models']=[];_defaultModel=null;constructor(_0x5abfde,_0x4a9644,_0x1a52ad){super(_0x5abfde),this['_models']=_0x4a9644,this['_defaultModel']=_0x1a52ad;}get['models'](){return this['_models']['slice']();}get defaultModel(){return this['_defaultModel'];}},ic=class extends tc{['_allModels']=[];['_recommendedModels']=[];_defaultModel=null;constructor(_0x2e440a,_0x2faf71,_0x38014a){super(),this['_allModels']=_0x2e440a,this['_recommendedModels']=_0x2faf71,this['_defaultModel']=_0x38014a;}get['allModels'](){return this['_allModels']['slice']();}setupChecks(_0xa7ce1f){this['_checks']=_0xa7ce1f['map'](_0x4e6e87=>!0x0===_0x4e6e87['isExtra']?new Xh(_0x4e6e87,this['_allModels'],this['_defaultModel']):'custom'===_0x4e6e87['id']?new ec(_0x4e6e87,this['_recommendedModels'],this['_defaultModel']):new Qh(_0x4e6e87));}},sc=class extends jh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}static get requires(){return[Es,Ln,Ss];}['_modelsLoadError']=null;constructor(_0x3e0ba3){super(_0x3e0ba3),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}getExtraChecks(){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x29c1a2=>({'id':_0x29c1a2['id'],'commandId':_0x29c1a2['id'],'title':_0x29c1a2['label'],'description':_0x29c1a2['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x29c1a2['prompt'],'context':_0x29c1a2['context'],'model':_0x29c1a2['model']}));}async _loadChecksList(){const _0x830ec4=[...Jh,...this['getExtraChecks']()]['map'](_0x358923=>_0x358923['isExtra']?_0x358923:this['_translateReviewCheck'](_0x358923)),_0x4b4a50=this['context']['plugins']['get'](Ss);let _0x44232c;try{_0x44232c=new ic(await _0x4b4a50['models']['getAllModels'](),await _0x4b4a50['models']['getAvailableModels'](),await _0x4b4a50['models']['getDefault']()),this['_modelsLoadError']=null;}catch(_0x3863a8){this['_modelsLoadError']=new ct('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x3863a8),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),_0x44232c=new ic([],[],null);}return _0x44232c['setupChecks'](_0x830ec4),_0x44232c;}_translateReviewCheck(_0x2866e2){const _0x554464='AI_REVIEW_CHECK_'+_0x2866e2['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x46d1b4={..._0x2866e2,'title':this['_translate'](_0x554464+'_TITLE',_0x2866e2['title']),'description':this['_translate'](_0x554464+'_DESCRIPTION',_0x2866e2['description'])};return _0x2866e2['options']&&(_0x46d1b4['options']=_0x2866e2['options']['map'](_0x415e80=>({..._0x415e80,'label':this['_translate'](_0x554464+'_OPTIONS_LABEL',_0x415e80['label']||''),'data':_0x415e80['data']?_0x415e80['data']['map'](_0x9f6e69=>({..._0x9f6e69,'label':this['_translate'](_0x554464+'_OPTIONS_DATA_'+_0x9f6e69['id']['toUpperCase'](),_0x9f6e69['label'])})):void 0x0}))),_0x46d1b4;}_translate(_0x158913,_0x4033f6){const _0x28b502=Ts(this['context']['locale'],_0x158913);return _0x28b502===_0x158913?_0x4033f6:_0x28b502;}},nc=class extends $h{static get['pluginName'](){return'AIReviewModeController';}static get requires(){return[Ln,sc,Ss];}get['_aiSource'](){return'review';}get _defaultContextFeature(){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x598b66){super(_0x598b66),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Jh['map'](_0xa215fd=>_0xa215fd['id']));}init(){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x519113,_0x29eed1)=>{this['_isDiffOn']=_0x29eed1['on'],this['_onDiffChange'](this['_isDiffOn']);});}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x2767be,_0x2fe77b,_0x3cd5ed=new qn()){if(_0x2767be['isCustom'])return new qh(_0x2767be['args']['prompt'],_0x2767be['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x2fe77b,this['_aiConnector'],_0x3cd5ed['refs']);if(_0x2fe77b['isExtra']){const _0x2e266f=_0x2fe77b,_0x2d87c6=_0x2e266f['context']?_0x3cd5ed['cloneWith'](_0x2e266f['context'])['refs']:_0x3cd5ed['refs'];return new zh(_0x2767be['args']?.['prompt']??_0x2e266f['prompt'],_0x2767be['args']?.['model']??_0x2e266f['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x2fe77b,this['_aiConnector'],_0x2d87c6);}return new Yh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x2fe77b,this['_aiConnector'],_0x2767be['params'],_0x2767be['args'],_0x3cd5ed['refs']);}_onReviewCheckResultActivated(_0x4b21ed){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x4b21ed['change']['id']),this['_scrollToChange'](_0x4b21ed['change']['id']);const _0x2cad22=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x4b21ed['change']['id']);if(!_0x2cad22)return;const _0x576dc0=this['_aiReviewCoreEditing']['getEditorForChange'](_0x4b21ed['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x4b21ed['change'],()=>_0x2cad22['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x576dc0,_0x2cad22['modelRange']['root']['rootName']),_0x576dc0?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x4b21ed['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}_onActivateChange(_0x54256b){this['_currentReviewCheckRun']&&'click'===_0x54256b['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x54256b['id']));}_onDeactivateChange(_0x1063ac){this['_currentReviewCheckRun']&&'balloon'===_0x1063ac['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x34f08e,_0x695d6a){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x695d6a['changeId']);const _0x39cb45=this['_currentReviewCheckRun']['getChangeById'](_0x695d6a['changeId']);if(!_0x39cb45)return;const _0x1fddec=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x695d6a['changeId']),_0x4c7781=this['_aiReviewCoreEditing']['getEditorForChange'](_0x695d6a['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x39cb45,_0x695d6a['markerElement'],_0x695d6a['domEvent'],'click',this['_getBalloonDomRoot'](_0x4c7781,_0x1fddec?.['modelRange']['root']['rootName']),_0x4c7781?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x483a68,_0x14dcf7){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x3345c6=this['_currentReviewCheckRun']['getChangeById'](_0x14dcf7['changeId']);if(!_0x3345c6)return;const _0x349a15=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x14dcf7['changeId']),_0x387633=this['_aiReviewCoreEditing']['getEditorForChange'](_0x14dcf7['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x3345c6,_0x14dcf7['markerElement'],_0x14dcf7['domEvent'],'hover',this['_getBalloonDomRoot'](_0x387633,_0x349a15?.['modelRange']['root']['rootName']),_0x387633?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}_getChangeContentElement(_0x5c2f29){const _0x48a2a7=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5c2f29);return _0x48a2a7?_0x48a2a7['getElement']():null;}_markChangePositionInEditorContent(_0x558434,_0x1106a4){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x558434,_0x1106a4);}_diffContent(_0x5508db,_0xb5345,_0x2a6f70){return this['_aiReviewCoreEditing']['diffContent'](_0x5508db,_0xb5345,_0x2a6f70,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x53e63f){_0x53e63f?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x12805d of this['_aiReviewCoreEditing']['getEditors']())_0x12805d['editing']['view']['change'](_0x147575=>{for(const _0x312ec7 of _0x12805d['editing']['view']['document']['getRoots']()){for(const _0xd5a69e of _0x312ec7['getClassNames']())_0xd5a69e['startsWith']('ck-ai_review-')&&_0x147575['removeClass'](_0xd5a69e,_0x312ec7);_0x147575['addClass'](_0x53e63f?'ck-ai_review-diff':'ck-ai_review-highlights',_0x312ec7);}});}_getBalloonDomRoot(_0x253a95,_0x12e4a6){const _0x5d6f23=_0x253a95['editing']['view'];if(_0x12e4a6){const _0x4fdef7=_0x5d6f23['getDomRoot'](_0x12e4a6);if(_0x4fdef7)return _0x4fdef7;}return _0x5d6f23['getDomRoot']()??void 0x0;}async _getReviewChecks(){const _0x47c6aa=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x5d7f3d=await _0x47c6aa['getChecksList']();_0x47c6aa['modelsLoadError']&&this['_logError'](_0x47c6aa['modelsLoadError']);let _0x389527=_0x5d7f3d['checks'];const _0x46421d=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x46421d,_0x389527),this['_usesAvailableCommandsConfig']&&(_0x389527=_0x46421d['map'](_0x1d91ad=>_0x389527['find'](_0x1d01ac=>_0x1d01ac['id']===_0x1d91ad))['filter'](_0xb6908f=>!!_0xb6908f)),this['_filterChecksWithMissingModel'](_0x389527);}_logWarningForNonExistentChecks(_0x409afa,_0x4bd1fa){const _0x2e2153=_0x409afa['filter'](_0xb66f38=>!_0x4bd1fa['some'](_0x32190c=>_0x32190c['id']===_0xb66f38));_0x2e2153['length']&&this['_reporter']['logError'](new xn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x2e2153['join'](',\x20')}}));}_filterChecksWithMissingModel(_0x27368c){const _0x174c47=[];return _0x27368c['forEach'](_0x284b17=>{(_0x284b17 instanceof Xh&&!_0x284b17['defaultModel']||_0x284b17 instanceof ec&&!_0x284b17['models']['length'])&&_0x174c47['push'](_0x284b17['id']);}),_0x174c47['length']&&_0x174c47['forEach'](_0x41ca9b=>{_0x27368c=_0x27368c['filter'](_0x2ef2ce=>_0x2ef2ce['id']!==_0x41ca9b),this['_reporter']['logError'](new xn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x41ca9b}}));}),_0x27368c;}},rc=class extends _0x45fe7d{static get['pluginName'](){return'AIReviewGateway';}static get requires(){return[Uh,sc,Es,sn,Cn,Ss];}get['models'](){return this['context']['plugins']['get'](Ss)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async getAllCommands(){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x1c6740=>{const _0x51ea25={'id':_0x1c6740['id'],'title':_0x1c6740['title'],'description':_0x1c6740['description']};return'custom'!==_0x1c6740['id']&&_0x1c6740['options']?.['length']&&(_0x51ea25['parameters']=_0x1c6740['options'][0x0]['data']['map'](_0x60c653=>({..._0x60c653}))),_0x51ea25;});}async['runReview'](_0x2c6e93,_0x1c9015){const _0x3e43d1=await this['_resolveReviewCheck'](_0x2c6e93),_0x7bbb9e=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x347b96=this['context']['plugins']['get']('AIConnector'),_0x786608=_0x7bbb9e['getDocumentData']({'roots':_0x1c9015?.['roots']}),_0xe8f2fa=this['_createReviewCheckRun'](_0x3e43d1,_0x786608,_0x347b96,_0x1c9015?.['parameterId'],_0x1c9015?.['contexts']);return _0x7bbb9e['runCheck'](_0xe8f2fa,{'signal':_0x1c9015?.['signal']});}async runCustomReview(_0x45c9d9,_0x436943){const {reviewCheck:_0x480c75,resolvedModel:_0x5af4f4}=await this['_resolveCustomReviewCheck'](_0x45c9d9,_0x436943?.['model']),_0x54e565=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x305b07=this['context']['plugins']['get']('AIConnector'),_0x1acef8=new qh(_0x45c9d9,_0x5af4f4,_0x54e565['getDocumentData']({'roots':_0x436943?.['roots']}),_0x480c75,_0x305b07,_0x436943?.['contexts']);return _0x54e565['runCheck'](_0x1acef8,{'signal':_0x436943?.['signal']});}['applyReview'](_0x2e7547,_0x36687f){this['context']['plugins']['get']('AIGateway')['apply'](_0x2e7547,{'aiSource':'review',..._0x36687f});}async['_resolveReviewCheck'](_0x258d7e){const _0x145c70=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x4d288f=>_0x4d288f['id']===_0x258d7e);if(!_0x145c70)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x258d7e});if(_0x145c70 instanceof ec)throw new ct('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x258d7e});if(_0x145c70 instanceof Xh&&!_0x145c70['defaultModel']?.['id'])throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x258d7e});return _0x145c70;}async _resolveCustomReviewCheck(_0x5d8548,_0x396cf8){const _0x3abb6f='custom',_0x521ab0=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x236839=>_0x236839['id']===_0x3abb6f);if(!_0x521ab0)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x3abb6f});if(!(_0x521ab0 instanceof ec))throw new ct('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x3abb6f});if(!_0x5d8548)throw new ct('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x3abb6f});const _0x4964b4=_0x396cf8??_0x521ab0['defaultModel']?.['id'];if(!_0x4964b4)throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x3abb6f});return{'reviewCheck':_0x521ab0,'resolvedModel':_0x4964b4};}_createReviewCheckRun(_0x45054e,_0x35c3bc,_0x882b8f,_0x4b26c2,_0x562698=[]){if(_0x45054e instanceof Xh){const _0x3cf711=_0x45054e['context']?[..._0x562698,_0x45054e['context']]:_0x562698;return new zh(_0x45054e['prompt'],_0x45054e['defaultModel']['id'],_0x35c3bc,_0x45054e,_0x882b8f,_0x3cf711);}return new Yh(_0x35c3bc,_0x45054e,_0x882b8f,_0x4b26c2?[_0x4b26c2]:void 0x0,void 0x0,_0x562698);}},oc=class extends _0x45fe7d{static get requires(){return[nc,Lh,Uh,rc];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startReview(_0x1fc2fc,_0x54a3a4){if(this['assertStartReviewPreconditions'](_0x1fc2fc)instanceof ec)throw new ct('ai-reviewmode-not-a-system-command',this,{'commandId':_0x1fc2fc});oh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x1fc2fc,'params':_0x54a3a4?.['parameterId']?[_0x54a3a4['parameterId']]:void 0x0});}async startCustomReview(_0x18688c,_0xa44b0f){if(!_0x18688c)throw new ct('ai-reviewmode-missing-custom-command-prompt',this);const _0x3144d6=Jh['find'](_0x3d8d8d=>'custom'===_0x3d8d8d['commandId'])['id'],_0x14b7c6=this['assertStartReviewPreconditions'](_0x3144d6),_0x544285=_0xa44b0f?.['model']??_0x14b7c6['defaultModel']?.['id'];if(!_0x544285)throw new ct('ai-reviewmode-missing-custom-command-model',this);oh(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x3144d6,'isCustom':!0x0,'args':{'prompt':_0x18688c,'model':_0x544285}});}getAvailableCommands(){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x3e4f1d=>{const _0x4dcf31={'id':_0x3e4f1d['id'],'title':_0x3e4f1d['title'],'description':_0x3e4f1d['description']};return'custom'!==_0x3e4f1d['id']&&_0x3e4f1d['options']?.['length']&&(_0x4dcf31['parameters']=_0x3e4f1d['options'][0x0]['data']['map'](_0x209b35=>({..._0x209b35}))),_0x4dcf31;});}assertStartReviewPreconditions(_0x2f7dfc){const _0x4abe0e=this['context']['plugins']['get']('AIReviewModeController');if(_0x4abe0e['getCurrentCheckRun']())throw new ct('ai-reviewmode-review-already-running',this);const _0x38f9d2=_0x4abe0e['getAvailableChecks']()['find'](_0x5011ca=>_0x5011ca['id']===_0x2f7dfc);if(!_0x38f9d2)throw new ct('ai-reviewmode-unknown-command',this,{'commandId':_0x2f7dfc});return _0x38f9d2;}},ac=class extends Yh{_title;constructor(_0x581912,_0x105910,_0x5d414d,_0x18f196,_0x1e3721,_0x492fbe,_0xee8aa9){super(_0x581912,_0x105910,_0x5d414d,_0x1e3721,_0x492fbe,_0xee8aa9),this['_title']=_0x18f196;}get title(){return this['_title'];}get subTitle(){return this['_sourceCheck']['title'];}},hc=class extends Qh{get['apiId'](){return'translate';}},cc=class extends tc{setupChecks(_0x1974eb){this['_checks']=_0x1974eb['map'](_0x17fed3=>new hc(_0x17fed3));}};const lc=[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}];var uc=class extends jh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x416424){super(_0x416424),this['context']['config']['define']('ai.translate.languages',lc);}async _loadChecksList(){const _0x69257=[],_0x46c94d=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x489f00 of _0x46c94d)_0x69257['push']({'title':_0x489f00['label'],'id':_0x489f00['id'],'commandId':_0x489f00['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x489f00['id']}});const _0x52f402=new cc();return _0x52f402['setupChecks'](this['_translateChecks'](_0x69257)),_0x52f402;}_translateChecks(_0x558c53){const _0xb2e43=this['context']['locale'];return _0x558c53['map'](_0x3e17c5=>{const _0x30a2e4='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x3e17c5['title']['toUpperCase']()['replaceAll']('-','_'),_0x404496=Ts(_0xb2e43,_0x30a2e4);return{..._0x3e17c5,'title':_0x404496===_0x30a2e4?_0x3e17c5['title']:_0x404496};});}},dc=class extends $h{static get['pluginName'](){return'AITranslateController';}static get requires(){return[Ln,uc,Ss];}get['_aiSource'](){return'translate';}get _defaultContextFeature(){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x162e7f,_0x53ab13,_0x1019c4){return new ac(this['_aiReviewCoreEditing']['getDocumentData'](),_0x53ab13,this['_aiConnector'],Ts(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x162e7f['params'],_0x162e7f['args'],_0x1019c4?.['refs']);}_onReviewCheckResultActivated(_0x2db001){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x2db001['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x2db001['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}_onActivateChange(_0x3f9b46){this['_currentReviewCheckRun']&&('hover'===_0x3f9b46['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x3f9b46['id'])),'click'===_0x3f9b46['uiInteraction']&&this['_scrollToChange'](_0x3f9b46['id']));}_onDeactivateChange(_0x466968){this['_currentReviewCheckRun']&&'panel'===_0x466968['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x2d7ce,_0xb34118){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0xb34118['changeId']),this['_scrollToChange'](_0xb34118['changeId']));}['_onChangeMarkerHovered'](_0xe4b373,_0x9f3a70){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x9f3a70['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x9f3a70['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}_getChangeContentElement(_0x138d3f){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x138d3f);}_markChangePositionInEditorContent(_0x39f105,_0x4cf4b5){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x39f105,_0x4cf4b5);}_diffContent(_0x3b2ea0,_0x5495e2,_0x1a1aaa){return this['_aiReviewCoreEditing']['diffContent'](_0x3b2ea0,_0x5495e2,_0x1a1aaa,!0x0);}['_onReviewCheckRun'](){for(const _0xcd9b25 of this['_aiReviewCoreEditing']['getEditors']())_0xcd9b25['editing']['view']['change'](_0x119356=>{for(const _0x268e86 of _0xcd9b25['editing']['view']['document']['getRoots']())_0x119356['addClass']('ck-ai-translate-mode-content',_0x268e86);});}async _getReviewChecks(){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},_c=class extends Sh{constructor(_0x55a75,_0x33be9a){super(_0x55a75,_0x33be9a),this['on']('set:isLoading',(_0x433c74,_0x54b2b5,_0x818679)=>{_0x818679&&(this['headerTitle']=Ts(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x19b5b8,_0x259fbb,_0x22b552)=>{_0x22b552&&(this['headerTitle']=Ts(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}_createAcceptAllButtonView(){const _0x4c400c=super['_createAcceptAllButtonView']();return _0x4c400c['set']('label',Ts(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x4c400c;}_createExitReviewButtonView(){const _0x4fe59e=super['_createExitReviewButtonView']();return _0x4fe59e['set']('label',Ts(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x4fe59e;}},gc=class extends xh{_setupTemplate(){const _0x1b8227=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x1b8227['if']('isVisible','ck-hidden',_0x3a8fce=>!_0x3a8fce)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Ts(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Ts(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x1b8227['if']('isVisible','ck-hidden',_0x5acd86=>!_0x5acd86)]},'children':this['_checkViews']}]});}},Ac=class extends wh{static get['pluginName'](){return'AITranslateUI';}createMainView(){const _0x3263c6=this['context']['plugins']['get']('AITabs'),_0x2ca773=this['context']['locale'],_0x319a49=new _a(_0x2ca773,{'label':Ts(_0x2ca773,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x616488,'class':'ck-ai-header_review-translate','showResizeButton':_0x3263c6['showResizeButton']});_0x319a49['delegate']('resizeTabs')['to'](_0x3263c6),_0x319a49['bind']('isMaximized')['to'](_0x3263c6['view'],'isMaximized',_0x51ec97=>_0x51ec97);const _0x1b6001=new fh(_0x2ca773,{'header':_0x319a49,'list':new gc(_0x2ca773),'results':new _c(_0x2ca773,{'generalErrorText':Ts(_0x2ca773,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Rh(_0x2ca773,{'headerText':Ts(_0x2ca773,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Ts(_0x2ca773,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Ts(_0x2ca773,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x1b6001['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x1b6001;}registerTab(){const _0x240239=this['context']['plugins']['get']('AITabs');_0x240239['view']['on']('activateTab',(_0x2f2ea2,{newTab:_0x146bea,oldTab:_0x23bcd3})=>{'translate'===_0x146bea?this['fire']('getReviewCheckList'):'translate'===_0x23bcd3&&this['fire']('leaveReview');}),_0x240239['view']['addTab']({'id':'translate','buttonLabel':Ts(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x616488,'order':0x0,'content':this['_mainView']});}},Ic=class extends _0x45fe7d{static get['pluginName'](){return'AITranslateGateway';}static get requires(){return[Uh,Es,sn,Cn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async runTranslate(_0x53a9d9,_0x5655b2){const _0x172d65=this['context']['plugins']['get']('AIReviewCoreEditing'),_0xe23725=this['context']['plugins']['get']('AIConnector'),_0x3483a1=new hc({'id':_0x53a9d9,'commandId':_0x53a9d9,'title':_0x53a9d9,'description':'','isParameterized':!0x1}),_0x4eef8b=new Yh(_0x172d65['getDocumentData']({'roots':_0x5655b2?.['roots']}),_0x3483a1,_0xe23725,void 0x0,{'language':_0x53a9d9},_0x5655b2?.['contexts']);return _0x172d65['runCheck'](_0x4eef8b,{'signal':_0x5655b2?.['signal']});}applyTranslate(_0x390341,_0x16c003){this['context']['plugins']['get']('AIGateway')['apply'](_0x390341,_0x16c003);}},pc=class extends _0x45fe7d{static get requires(){return[dc,Ac,Uh,Ic];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startTranslate(_0x4dc895){const _0xd70fc7=this['assertStartTranslatePreconditions'](_0x4dc895);oh(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0xd70fc7['id'],'args':_0xd70fc7['useArgs']?_0xd70fc7['args']:void 0x0});}getAvailableLanguages(){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x475550=>({'id':_0x475550['id'],'label':_0x475550['title']}));}assertStartTranslatePreconditions(_0x3da0a7){const _0x123e0b=this['context']['plugins']['get']('AITranslateController');if(_0x123e0b['getCurrentCheckRun']())throw new ct('ai-translate-translation-already-running',this);const _0x1dbb2f=_0x123e0b['getAvailableChecks']()['find'](_0x2a15ad=>_0x2a15ad['id']===_0x3da0a7);if(!_0x1dbb2f)throw new ct('ai-translate-unknown-language',this,{'languageId':_0x3da0a7});return _0x1dbb2f;}};export{Ih as AIActions,Di as AIAdapter,rs as AIAssistant,is as AIAssistantUI,Ga as AIBalloon,Na as AIChat,sr as AIChatController,lo as AIChatFeedCustomElementView,ya as AIChatHistory,ka as AIChatHistoryController,ba as AIChatHistoryUI,jn as AIChatInteraction,Da as AIChatShortcuts,pa as AIChatUI,Ph as AICheckRunSingleRootResult,Es as AIConnector,qn as AIContext,bs as AIContextLibrary,Ss as AICore,xn as AICoreError,yn as AIDocumentProcessingGateway,vn as AIDocumentProcessingRunResult,sn as AIEditing,$a as AIEditorIntegration,Pn as AIErrorReporter,Ln as AIErrorSink,Cn as AIGateway,Wn as AIInteraction,Cs as AIModels,ph as AIQuickActions,nh as AIQuickActionsUI,Gn as AIReply,Hi as AIRequestError,Qh as AIReviewCheck,Bh as AIReviewCheckResult,Fh as AIReviewCheckResultChange,Wh as AIReviewCheckRun,rc as AIReviewGateway,oc as AIReviewMode,$h as AIReviewModeController,Uh as AIReviewModeEditing,Lh as AIReviewModeUI,kn as AIRunResult,On as AIRunSingleRootResult,Is as AITabs,As as AITabsMainView,ds as AITabsView,as as AITextAdapter,Ma as AIToggleButtonUI,pc as AITranslate,dc as AITranslateController,Ic as AITranslateGateway,Ac as AITranslateUI,cs as AWSTextAdapter,hs as OpenAITextAdapter,Ui as ShowAIAssistantCommand,Ha as ToggleAICommand,Un as createResizeButton,os as getDefaultAICommands,wn as markOperationsAsAI};
23
+ import{Command as _0x3faa90,ContextPlugin as _0x338e6f,Editor as _0x36c7af,Plugin as _0xe451ae,rootAcceptsBlocks as _0x186e8a}from'@ckeditor/ckeditor5-core';import{IconAI as _0x3d4e25,IconAIAdjustLength as _0x1dc9a1,IconAIAskAI as _0x483d03,IconAIChangeTone as _0x2f7370,IconAIChat as _0x5213f,IconAIChatCommands as _0x12b7b9,IconAIContinueWriting as _0x2e6df4,IconAIGrammarCheck as _0x205f34,IconAIHistory as _0xa09b29,IconAIImproveWriting as _0x46aec1,IconAIOther as _0x4b7e86,IconAIQuickActions as _0x4a335e,IconAIReview as _0x5684ad,IconAITranslate as _0x333580,IconBoxWithCheck as _0x157716,IconBoxWithCross as _0x57faee,IconBoxWithMarker as _0x3bf0bc,IconBrowseFiles as _0x10880d,IconBulb as _0xfbdb8e,IconCancel as _0x509f6e,IconCheck as _0xca6ce1,IconChevronDown as _0x5025fd,IconChevronRight as _0x2a0ae6,IconChevronUp as _0x34b83e,IconCopy as _0x49526f,IconDocument as _0x399c89,IconDocumentOutline as _0x47568f,IconDropdownArrow as _0x58a8f2,IconError as _0x5a664d,IconEye as _0x20e467,IconEyeCrossedOut as _0x4dee8e,IconFileUpload as _0x28c155,IconImage as _0x1d30bc,IconInfo as _0x47e54a,IconLink as _0x11032b,IconLoupe as _0x5cdfe0,IconMagicWand as _0x399a6e,IconMaximize as _0x268ae8,IconMinimize as _0x187829,IconNextArrow as _0x2e94cb,IconOutdated as _0x2ffcd8,IconPaperClip as _0x1c0fd0,IconPin as _0x25f1af,IconPlus as _0x3f9794,IconPreviousArrow as _0x52157c,IconRefresh as _0x331cc1,IconRevisionHistory as _0x3e7339,IconRobotPencil as _0x4c2e14,IconSelection as tt,IconShowChangesOff as et,IconShowChangesOn as it,IconStop as st,IconSubmit as nt,IconThreeHorizontalDots as rt,IconThumbDown as ot,IconThumbUp as at,IconWeb as ht}from'@ckeditor/ckeditor5-icons';import{CKEditorError as ct,Collection as lt,DomEmitterMixin as ut,EmitterMixin as dt,FocusTracker as _t,KeystrokeHandler as gt,ObservableMixin as At,Rect as It,ResizeObserver as pt,_isMotionReduced as mt,decodeLicenseKey as Et,first as wt,getConstrainedViewportRect as Tt,global as ft,insertToPriorityArray as Ct,isFeatureBlockedByLicenseKey as bt,isVisible as St,logError as Rt,logWarning as Ot,priorities as vt,scrollAncestorsToShowTarget as yt,scrollViewportToShowTarget as kt,toArray as Nt,uid as xt,version as Lt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as Dt,BalloonPanelView as Pt,BalloonToolbar as Ht,BodyCollection as Mt,ButtonLabelView as Ut,ButtonLabelWithHighlightView as Vt,ButtonView as Bt,Dialog as Gt,DialogViewPosition as Kt,DropdownMenuPanelPositioningFunctions as Ft,FileDialogButtonView as Wt,FocusCycler as $t,FormHeaderView as Yt,FormRowView as qt,HighlightedTextView as Qt,IconView as Xt,InputTextView as zt,LabeledFieldView as jt,ListItemButtonView as Jt,ListItemGroupView as Zt,ListItemView as te,ListView as _0x4ca5fe,MenuBarMenuListItemButtonView as _0x48f08b,MenuBarMenuListItemView as _0x5262e5,MenuBarMenuListView as _0x24a343,MenuBarMenuView as _0x4c2379,SearchTextView as _0x1909b9,SpinnerView as _0x3afe73,Template as _0xe6f3c8,TextareaView as _0x52b342,ToolbarView as _0x3a20a6,UIModel as _0x115df1,View as _0xfd0945,ViewCollection as _0x353304,addListToDropdown as _0x5b9bd6,addMenuToDropdown as _0xafdd9,clickOutsideHandler as _0x4f15a2,createDropdown as _0x5d526e,createLabeledInputText as _0x2c6629,createLabeledTextarea as _0x2ce018,submitHandler as _0xebad48}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0x50d807,ClipboardPipeline as _0x15ae11}from'@ckeditor/ckeditor5-clipboard';import{AttributeOperation as _0x1fa2c6,InsertOperation as _0x942e3b,MarkerOperation as _0x8c29f8,Matcher as _0xe624bf,MergeOperation as _0x60d4bf,ModelDocumentFragment as _0x332f21,ModelPosition as _0x41b2e6,ModelRange as _0x5708b2,ModelText as _0x257eed,ModelTreeWalker as _0x59cde9,MoveOperation as _0xbb6ea5,RenameOperation as _0x3f202c,RootAttributeOperation as _0x39ad90,RootOperation as _0x2a38f3,SplitOperation as _0xd60981,ViewDataTransfer as _0x39b23c,ViewDocumentDomEventData as _0x169f96,ViewDowncastWriter as _0x1614f9,ViewUpcastWriter as _0x53f73a,_DetachOperation as _0x4b3a4f,_insertIntoModelNodeList as _0x2cc674,_removeFromModelNodeList as _0x3b9fef,transformOperationSets as _0x3ceee1}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0xfb63c0,debounce as _0x16107c,escape as _0x5a8f00,escapeRegExp as _0x16a55e,omit as _0x15497c,throttle as _0x425461,unescape as _0x2b0909}from'es-toolkit/compat';import{createParser as _0x233d05}from'eventsource-parser';import{CloudServices as ti}from'@ckeditor/ckeditor5-cloud-services';import{parseDocument as _0x67d3bf}from'htmlparser2';import{append as _0x54a4aa,appendChild as _0x252f1a,find as _0x2955be,findAll as _0x4b5d81,findOne as _0x580dea,getChildren as _0x5e1910,getParent as _0x1f2119,isComment as _0x3b1aa0,isTag as _0x5ebc36,prepend as _0x4c725e,prependChild as _0x151e71,removeElement as _0x3339cd,replaceElement as _0x22ab5c,textContent as _0x48e653}from'domutils';import _0x2a51a3 from'dom-serializer';import{Document as _0x481874,Element as _0x5a2eed,NodeWithChildren as _0x5c1b78,Text as _0x34d40c,cloneNode as _0x4f309c,isDocument as _0x230e03,isText as _0x17ad85}from'domhandler';import{diffArrays as _0x1bdce3}from'diff';import{ConfirmMixin as _0x5c9b71,PillView as _0x3097ca,SuggestionsConversion as _0x5572a2,fixElementSuggestionRange as _0xd84b36,getAllMarkersDomElementsSorted as _0x64b1d9,getMarkerDomElement as _0x1bc72f,hashObject as _0x2bc6ba,isInvalidAttributeOperation as _0x3a283d,reRootOperation as _0x585c53}from'@ckeditor/ckeditor5-collaboration-core';import{MarkdownGfmMdToHtml as _0x102060,MarkdownGfmMdToHtmlDefaultPlugins as _0x3e7f88}from'@ckeditor/ckeditor5-markdown-gfm';import _0x519373 from'rehype-sanitize';import _0x22a371 from'morphdom';const Ui='_ungrouppedCommands';function Vi(_0x3b0b64,_0x4834b1){const _0x5e2cfe=(0x0,_0x4834b1['t'])('Other');return _0x3b0b64['length']?'groupId'in _0x3b0b64[0x0]?_0x3b0b64:[{'groupId':Ui,'groupLabel':_0x5e2cfe,'order':0x1/0x0,'commands':_0x3b0b64}]:[{'groupId':Ui,'groupLabel':_0x5e2cfe,'order':0x1/0x0,'commands':[]}];}const Bi=globalThis['DataTransfer'],Gi='ai-ui';var Ki=class extends _0xe451ae{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const {editor:_0x31fc6c}=this,_0x31fbd3=['ck-fake-ai-selection'];_0x31fc6c['config']['get']('ai.assistant.useTheme')&&_0x31fbd3['push']('ck-ai-assistant-ui_theme'),_0x31fc6c['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Gi,'view':{'classes':_0x31fbd3,'priority':0xc}}),_0x31fc6c['conversion']['for']('editingDowncast')['markerToElement']({'model':Gi,'view':(_0x16b923,{writer:_0x56688b})=>{if(!_0x16b923['markerRange']['isCollapsed'])return null;const _0x5ad4a4=_0x56688b['createUIElement']('span');return _0x56688b['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x5ad4a4),_0x5ad4a4;}});}afterInit(){this['_blockIfRemovedByLicenseKey'](),async function(_0x38fd7e){const _0x125b61='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x186fb8=0x793c8,_0x332f14={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x362280(_0x2dd208){const _0x19a7ea=new window['Promise'](_0x5061d8=>{_0x2dd208['once']('ready',_0x5061d8);}),_0x2cbc25=window['Date']['now'](),_0x133fff=_0x2dd208['config']['get']('licenseKey');async function _0x55bb98(){let _0x438dcc,_0x543e90=null,_0x31e38b=null;try{return'GPL'==_0x133fff?'NotAllowed':(_0x438dcc=_0xbdd3b6(),_0x438dcc?(_0x438dcc['usageEndpoint']&&(_0x31e38b=_0x42692c(_0x438dcc['usageEndpoint'],_0x438dcc['jti'])),await _0x1d4c33()?_0x319e25()?_0x10c2a7()?'Expired':_0x5f5972()?('evaluation'==_0x438dcc['licenseType']&&(_0x543e90=_0x13aca7('EvaluationLimit')),await _0x1283cf()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x10c2a7(){const _0x23a287=['evaluation','trial']['includes'](_0x438dcc['licenseType'])?_0x2cbc25/0x3e8:0xe10*_0x186fb8;return _0x438dcc['exp']<_0x23a287;}function _0x319e25(){const _0x5177ca=_0x438dcc['features'];return!!_0x5177ca&&(!!_0x5177ca['includes']('*')||!!_0x5177ca['includes']('AI'));}function _0x5f5972(){const _0x57c62c=_0x438dcc['licensedHosts'];if(!_0x57c62c||0x0==_0x57c62c['length'])return!0x0;const {hostname:_0x309393}=new URL(window['location']['href']);if(_0x57c62c['includes'](_0x309393))return!0x0;const _0x37a306=_0x309393['split']('.');return _0x57c62c['filter'](_0x18dfdf=>_0x18dfdf['includes']('*'))['map'](_0x227086=>_0x227086['split']('.'))['filter'](_0x51cf96=>_0x51cf96['length']<=_0x37a306['length'])['map'](_0xd37c8e=>Array(_0x37a306['length']-_0xd37c8e['length'])['fill']('*'===_0xd37c8e[0x0]?'*':'')['concat'](_0xd37c8e))['some'](_0xcf1461=>_0x37a306['every']((_0x5e69d2,_0x3f70fb)=>_0xcf1461[_0x3f70fb]===_0x5e69d2||'*'===_0xcf1461[_0x3f70fb]));}function _0x1283cf(){return _0x543e90&&_0x31e38b?new window['Promise']((_0x758552,_0x27d826)=>{_0x543e90['then'](_0x758552,_0x27d826),_0x31e38b['then'](_0x46a22c=>{'Valid'!=_0x46a22c&&_0x758552(_0x46a22c);},_0x27d826);}):_0x543e90||_0x31e38b||'Valid';}}function _0x42692c(_0x58d5ad,_0x2a6877){return new window['Promise'](_0xabfe3a=>{if(_0x251b21())return _0xabfe3a('Valid');_0x552f48(),_0x2dd208['decorate']('_sendUsageRequest');let _0x464601=!0x1;const _0x4ee9a4=xt();function _0x31cef5(_0x329e2d){return!!_0x329e2d&&('object'==typeof _0x329e2d||'function'==typeof _0x329e2d)&&'function'==typeof _0x329e2d['then']&&'function'==typeof _0x329e2d['catch'];}function _0xb84c83(_0x25b2b6){_0x1c4c78(_0x25b2b6)['then'](_0x2ae287=>_0x2ae287&&'ok'==_0x2ae287['status']?_0x66ef9(_0x2e8564(_0x4ee9a4+_0x2a6877))!=_0x2ae287['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x363843=>(_0x1fba15(),_0x363843),()=>{const _0x2fa492=_0x49a2f6();return null==_0x2fa492?(_0x1fba15(),'Valid'):_0x2cbc25-_0x2fa492>0x240c8400?'UsageLimit':'Valid';})['then'](_0xabfe3a)['catch'](()=>{_0xabfe3a('UsageLimit');});const _0x107d8e=0x36ee80;function _0x1fba15(){const _0x101745='llct-'+_0x66ef9(_0x2e8564(_0x58d5ad)),_0x2a745b=_0x3daebc(_0x66ef9(window['Math']['ceil'](_0x2cbc25/_0x107d8e)));window['localStorage']['setItem'](_0x101745,_0x2a745b);}function _0x49a2f6(){const _0x5754f4='llct-'+_0x66ef9(_0x2e8564(_0x58d5ad)),_0x244c67=window['localStorage']['getItem'](_0x5754f4);return _0x244c67?window['parseInt'](_0x3daebc(_0x244c67),0x10)*_0x107d8e:null;}function _0x1c4c78(_0x499488){return new window['Promise']((_0xe3806e,_0x363327)=>{_0x499488['then'](_0xe3806e,_0x363327),window['setTimeout'](_0x363327,0x1d4c0);});}}_0x2dd208['on']('_sendUsageRequest',(_0x27a753,_0x5b363c)=>{if(_0x5b363c[0x0]!=_0x58d5ad)return _0xabfe3a('UsageLimit');_0x5b363c[0x1]={..._0x5b363c[0x1],'requestId':_0x4ee9a4};},{'priority':'high'}),_0x2dd208['on']('_sendUsageRequest',_0x271301=>{_0x31cef5(_0x271301['return'])&&(_0x464601=!0x0,_0xb84c83(_0x271301['return']));},{'priority':'low'}),_0x19a7ea['then'](()=>{_0x464601||_0xabfe3a('UsageLimit');});});function _0x251b21(){return'auto'==_0x2dd208['editing']['view']['_overlayModeHint'];}function _0x552f48(){_0x2dd208['editing']['view']['_overlayModeHint']='auto';}}function _0x13aca7(_0x5488ad){const _0x550bb=[new window['Promise'](_0x2fe151=>setTimeout(_0x2fe151,0x93ecc)),_0x19a7ea['then'](()=>new window['Promise'](_0x77cc1d=>{let _0x924d1c=0x0;_0x2dd208['model']['on']('applyOperation',(_0x2383ff,_0x44a618)=>{_0x44a618[0x0]['isDocumentOperation']&&_0x924d1c++,0x5e8==_0x924d1c&&(_0x77cc1d(),_0x2383ff['off']());});}))];return window['Promise']['race'](_0x550bb)['then'](()=>_0x5488ad);}async function _0x580447(){await _0x19a7ea,_0x2dd208['model']['change']=_0x4fe9c5,_0x2dd208['model']['enqueueChange']=_0x4fe9c5,_0x2dd208['enableReadOnlyMode']('model');}function _0x420854(_0x53af7a){const _0x5afa7e=_0x2d906d();_0x2dd208[_0x5afa7e]='aiLicenseKey'+_0x53af7a,'Valid'!=_0x53af7a&&_0x580447();}function _0x2d906d(){const _0x4b8d85=window['String'](window['performance']['now']())['replace']('.','');let _0xbfe8ee='n';for(let _0x332a6f=0x0;_0x332a6f<_0x4b8d85['length'];_0x332a6f+=0x2){let _0xdeb758=window['parseInt'](_0x4b8d85['substring'](_0x332a6f,_0x332a6f+0x2));_0xdeb758>=0x3e&&(_0xdeb758-=0x3e),_0xbfe8ee+=_0x125b61[_0xdeb758];}return _0xbfe8ee;}function _0xbdd3b6(){const _0xbda9f=_0x133fff['split']('.');if(0x3!=_0xbda9f['length'])return null;return _0x154252(_0xbda9f[0x1]);function _0x154252(_0x62a371){const _0x5014b9=_0x1d27fb(_0x62a371);return _0x5014b9&&_0x5267d3()?_0x5014b9:null;function _0x5267d3(){const _0x55042f=_0x5014b9['jti'],_0x3a65f1=window['parseInt'](_0x55042f['substring'](_0x55042f['length']-0x8),0x10),_0x59cc6d={..._0x5014b9,'jti':_0x55042f['substring'](0x0,_0x55042f['length']-0x8)};return delete _0x59cc6d['vc'],_0x2e8564(_0x59cc6d)==_0x3a65f1;}}}async function _0x1d4c33(){let _0x2105f6=!0x0;try{const [_0x34904f,_0x575558,_0x42ff09]=_0x133fff['split']('.');return _0x5ed259(_0x34904f),await _0x4ca7e7(_0x34904f,_0x575558,_0x42ff09),_0x2105f6;}catch{return!0x1;}function _0x5ed259(_0x4bb175){const _0x5633ab=_0x1d27fb(_0x4bb175);_0x5633ab&&'ES256'==_0x5633ab['alg']||(_0x2105f6=!0x1);}async function _0x4ca7e7(_0x41b372,_0x437e96,_0x4b4949){const _0x2dce7b=window['Uint8Array']['from'](_0x1ff93(_0x4b4949),_0x9a3715=>_0x9a3715['charCodeAt'](0x0)),_0x532e68=new window['TextEncoder']()['encode'](_0x41b372+'.'+_0x437e96),_0x1734fd=window['crypto']['subtle'];if(!_0x1734fd)return;const _0x141d41=await _0x1734fd['importKey']('jwk',_0x332f14,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x1734fd['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x141d41,_0x2dce7b,_0x532e68)||(_0x2105f6=!0x1);}}function _0x1d27fb(_0x34b041){return _0x34b041['startsWith']('ey')?JSON['parse'](_0x1ff93(_0x34b041)):null;}function _0x1ff93(_0x20334a){return window['atob'](_0x20334a['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x2e8564(_0x2cfdf9){let _0x5a76bf=0x1505;function _0x4157ef(_0x41fe39){for(let _0x1ae0e3=0x0;_0x1ae0e3<_0x41fe39['length'];_0x1ae0e3++){const _0x4d50dc=_0x41fe39['charCodeAt'](_0x1ae0e3);_0x5a76bf=(_0x5a76bf<<0x5)+_0x5a76bf+_0x4d50dc,_0x5a76bf&=_0x5a76bf;}}function _0x4deeff(_0x2033e7){Array['isArray'](_0x2033e7)?_0x2033e7['forEach'](_0x4deeff):_0x2033e7&&'object'==typeof _0x2033e7?Object['entries'](_0x2033e7)['sort']()['forEach'](([_0x1e08c8,_0x53b439])=>{_0x4157ef(_0x1e08c8),_0x4deeff(_0x53b439);}):_0x4157ef(window['String'](_0x2033e7));}return _0x4deeff(_0x2cfdf9),_0x5a76bf>>>0x0;}function _0x66ef9(_0x22ad52){return _0x22ad52['toString'](0x10)['padStart'](0x8,'0');}function _0x3daebc(_0x22c05f){return _0x22c05f['split']('')['reverse']()['join']('');}function _0x4fe9c5(){}_0x420854(await _0x55bb98());}_0x362280(_0x38fd7e['editor']);}(this);}['_blockIfRemovedByLicenseKey'](){const _0x5f2e39=this['editor'],_0xf95da3=Et(_0x5f2e39['config']['get']('licenseKey'));_0xf95da3&&bt(_0xf95da3,'AI')&&(_0x5f2e39['enableReadOnlyMode'](Symbol('invalidLicense')),_0x5f2e39['_showLicenseError']('featureNotAllowed','AIAssistant'));}showFakeVisualSelection(){const _0x19cbab=this['editor']['model'];_0x19cbab['change'](_0x3608e1=>{const _0x1ce800=_0x19cbab['document']['selection']['getRanges']();let _0x441b06=0x0;for(const _0x54dd3e of _0x1ce800){const _0x4ead0c=Gi+':'+_0x441b06;if(_0x19cbab['markers']['has'](_0x4ead0c))_0x3608e1['updateMarker'](_0x4ead0c,{'range':_0x54dd3e});else{if(_0x54dd3e['start']['isAtEnd']){const _0x3cbcc4=_0x54dd3e['start']['getLastMatchingPosition'](({item:_0xf01c06})=>!_0x19cbab['schema']['isContent'](_0xf01c06),{'boundaries':_0x54dd3e});_0x3608e1['addMarker'](_0x4ead0c,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3608e1['createRange'](_0x3cbcc4,_0x54dd3e['end'])});}else _0x3608e1['addMarker'](_0x4ead0c,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x54dd3e});}_0x441b06++;}});}hideFakeVisualSelection(){const _0x182397=this['editor']['model'],_0x10f894=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Gi));_0x10f894['length']&&_0x182397['change'](_0xf88619=>{_0x10f894['forEach'](_0x26f3dc=>{_0xf88619['removeMarker'](_0x26f3dc);});});}insertContent(_0x1ca59c,_0x17d5ae){const _0x459ef3=this['_getAISelection'](),_0x571dd7=_0x17d5ae||_0x459ef3['getFirstRange']();this['editor']['model']['canEditAt'](_0x571dd7)&&this['editor']['model']['change'](_0x43e581=>{this['hideFakeVisualSelection'](),_0x17d5ae||this['_resetContentOfSelectedTableCells'](_0x43e581,_0x459ef3),this['_pasteHTMLUsingClipboard']({'insertAt':_0x571dd7,'writer':_0x43e581,'html':_0x1ca59c});});}insertContentBelow(_0x1e29db){const {model:_0x3e9408}=this['editor'],_0x58ae11=this['_getAISelection']();_0x3e9408['change'](()=>{const _0x5b394e=this['_prepareTableInsertBelowPosition'](_0x1e29db,_0x58ae11)||this['_getDefaultInsertBelowPosition'](_0x58ae11);this['insertContent'](_0x1e29db,_0x5b394e);});}_getAISelection(){const _0x29afb1=this['editor']['model'],_0x12c454=Array['from'](_0x29afb1['markers']['getMarkersGroup'](Gi))['map'](_0x18400d=>_0x18400d['getRange']());return _0x29afb1['createSelection'](_0x12c454);}_pasteHTMLUsingClipboard({writer:_0x59d44f,html:_0x58c55c,insertAt:_0x31c332}){const {view:_0x5bcbc5}=this['editor']['editing'],_0x98e39f=this['editor']['plugins']['get'](_0x15ae11),_0x1b9dd2=new Bi();_0x1b9dd2['setData']('text/html',_0x58c55c);const _0x5440bb=new ClipboardEvent('paste',{'clipboardData':_0x1b9dd2}),_0x1996e0=new _0x169f96(_0x5bcbc5,_0x5440bb,{'dataTransfer':new _0x39b23c(_0x1b9dd2)});_0x59d44f['setSelection'](_0x31c332);const _0x4fae4f=(_0x14f34a,_0x5360d0)=>{_0x5360d0['resultRange']&&_0x59d44f['setSelection'](_0x5360d0['resultRange']);};_0x98e39f['once']('contentInsertion',_0x4fae4f,{'priority':'lowest'}),_0x5bcbc5['document']['fire']('paste',_0x1996e0),_0x98e39f['off']('contentInsertion',_0x4fae4f);}_getDefaultInsertBelowPosition(_0x2e6591){const {model:_0x2dae68}=this['editor'],_0xd210ed=Array['from'](_0x2e6591['getSelectedBlocks']());return _0xd210ed['length']?_0x2dae68['createPositionAfter'](_0xd210ed['pop']()):_0x2e6591['getLastPosition']();}_prepareTableInsertBelowPosition(_0x427191,_0x3715b4){const {model:_0x340aa5,plugins:_0x5ac8a8}=this['editor'];if(_0x5ac8a8['has']('TableUtils')){const _0x193104=_0x5ac8a8['get']('TableUtils')['getSelectedTableCells'](_0x3715b4);if(_0x193104['length']){const _0x2e9df1=this['_getTableRowCountFromContent'](_0x427191),_0x849457=this['_createEmptyTableRows'](_0x193104,_0x2e9df1);return _0x340aa5['createPositionAt'](_0x849457,0x0);}}return null;}_getTableRowCountFromContent(_0x390d02){const _0x3647cd=this['editor']['plugins']['get']('TableUtils'),_0x4aaca7=this['editor']['data']['parse'](_0x390d02,'$documentFragment'),_0x11968c=Array['from'](_0x4aaca7['getChildren']())['filter'](_0x4a9e57=>_0x4a9e57['is']('element','table'));let _0xdec798=0x0;return _0x11968c['forEach'](_0x140f63=>{_0xdec798+=_0x3647cd['getRows'](_0x140f63);}),_0xdec798;}_createEmptyTableRows(_0x17892e,_0x1f6f9c){const _0x33818b=this['editor']['plugins']['get']('TableUtils'),_0x1bf0e4=_0x33818b['getRowIndexes'](_0x17892e),_0x307dab=_0x33818b['getColumnIndexes'](_0x17892e),_0x5bf020=_0x1bf0e4['last']+0x1,_0x1890ac=_0x307dab['first'],_0x6b2bbf=_0x17892e[0x0]['findAncestor']('table');for(let _0x1634fe=0x0;_0x1634fe<_0x1f6f9c;_0x1634fe++)_0x33818b['insertRows'](_0x6b2bbf,{'at':_0x5bf020});return _0x6b2bbf['getChild'](_0x5bf020)['getChild'](_0x1890ac);}_resetContentOfSelectedTableCells(_0x331d98,_0x55cf97){const {plugins:_0x289866}=this['editor'],{model:_0x2afad6}=_0x331d98;_0x289866['has']('TableUtils')&&_0x289866['get']('TableUtils')['getSelectedTableCells'](_0x55cf97)['length']&&_0x2afad6['deleteContent'](_0x55cf97);}},Fi=class extends _0xe451ae{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}afterInit(){if(!this['textAdapter'])throw new ct('aiadapter-text-adapter-not-set',null);}},Wi=class extends Error{constructor(_0x3ef4b4){super(_0x3ef4b4),this['name']='AIRequestError';}};function $i(_0x526bbb,_0x5f3955,_0x4e5138){const t=_0x526bbb['t'];switch(_0x5f3955){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',_0x4e5138);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x4e5138);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'},_0x4e5138);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 _0x5f3955;}}var Yi=class extends _0x3faa90{_commandDefinitions;constructor(_0x306537,_0x2afe0b){super(_0x306537),this['_commandDefinitions']=_0x2afe0b,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x30d77b,_0x273339,_0x47524c)=>{this['isEnabled']&&(this['enabledCommandsIds']=qi(this['_commandDefinitions'],_0x47524c));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x238282,_0x26ded5,_0x5dea63)=>{this['enabledCommandsIds']=_0x5dea63?qi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x36d1d5=this['editor']['model'];this['_hasContext']=function(_0x32f6d1){const _0x37c86d=_0x32f6d1['document']['selection'];return _0x37c86d['isCollapsed']?0x0!==[..._0x37c86d['getSelectedBlocks']()]['length']&&![..._0x37c86d['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x32f6d1['hasContent'](_0x37c86d['getFirstRange']());}(_0x36d1d5);const _0x596867=_0x36d1d5['document']['selection'],_0x19893c=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x50ee9c of _0x596867['getRanges']())for(const _0x20a101 of _0x50ee9c['getItems']())if(_0x20a101['is']('element')&&_0x19893c['includes'](_0x20a101['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}execute(_0x59ecfb='',_0x21f673='',_0x1254dc='custom'){this['editor']['plugins']['get'](ls)['showUI'](_0x59ecfb,_0x21f673,_0x1254dc);}};function qi(_0x1646f2,_0x29553b){const _0x1d4e14=new Set();for(const _0x5123ae of _0x1646f2['values']())(_0x29553b||!0x1===_0x5123ae['requiresContent'])&&_0x1d4e14['add'](_0x5123ae['id']);return Array['from'](_0x1d4e14);}const Qi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Xi=/* #__PURE__ -- @preserve */
24
+ At();var zi=class extends Xi{editor;textAdapter;['view'];_sanitizationContainer;['_domParser'];['_xmlSerializer'];constructor(_0x68381,_0x5c1ff2,_0x661d99){super(),this['editor']=_0x68381,this['textAdapter']=_0x5c1ff2,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x661d99,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x2b9bee,_0x39f96e,_0x5cbef0)=>{this['view']['value']=this['_sanitizeHTML'](_0x5cbef0);}),this['listenTo'](this['view'],'submitPrompt',(_0x3851ef,_0x28192f)=>{const _0x4c0406=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x28192f,_0x4c0406,'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:_0x1aa77e,query:_0x37a349,htmlContent:_0x3f80d3,label:_0x5183fa,mainActionLabel:_0x3fca9b}){this['view']['prompt']=_0x5183fa,this['view']['mainAction']=_0x3fca9b,this['initialContext']=_0x3f80d3,_0x37a349&&(this['view']['isRendered']?this['_handleQuery'](_0x37a349,_0x3f80d3,_0x1aa77e,_0x5183fa):this['view']['once']('render',()=>{this['_handleQuery'](_0x37a349,_0x3f80d3,_0x1aa77e,_0x5183fa);}));}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'](_0x229d0b,_0x5cca2c,_0x14adda,_0x1cf40b){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x5cca2c,this['previousQuery']=_0x229d0b,this['previousLabel']=_0x1cf40b||_0x229d0b,this['previousActionId']=_0x14adda,new Promise(_0x5280f7=>{this['textAdapter']['makeRequest']({'query':_0x229d0b,'context':_0x5cca2c,'onData':_0x23ee0b=>{this['currentResponse']=_0x23ee0b,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x14adda})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x2c4e61=>{_0x2c4e61 instanceof Wi?this['view']['handleError'](_0x2c4e61['message']):this['view']['handleError'](),_0x5280f7();})['finally'](()=>{this['stopProcessing'](),_0x5280f7();});});}_parseAndNormalizeContent(_0x365006,_0x2422f7=!0x1){const _0x468503=Qi['exec'](_0x365006);_0x365006=_0x468503?_0x365006['substring'](_0x468503[0x1]['length']):_0x365006['length']<0x64&&!_0x2422f7?'':this['_stripMarkdownSyntax'](_0x365006);const _0x4dd1e2=this['_domParser']['parseFromString'](_0x365006,'text/html');if(_0x468503){const _0x1d2bb0=Array['from'](_0x4dd1e2['body']['childNodes']);_0x1d2bb0['reverse']();for(const _0x3861b5 of _0x1d2bb0){if(_0x3861b5['nodeType']==Node['ELEMENT_NODE'])break;_0x3861b5['remove']();}}const _0x36ff34=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x4dd1e2['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x36ff34);const _0x14fb15=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x489663=this['editor']['data']['toModel'](_0x36ff34);return _0x14fb15||_0x489663['markers']['clear'](),this['editor']['data']['stringify'](_0x489663);}['_normalizeResponseHeadings'](_0x1c6990){const _0x52ec05=new _0x53f73a(this['editor']['editing']['view']['document']),_0x4a3573=new _0xe624bf({'name':/^h[1-5]$/}),_0x50ff91=[];let _0x5debd3=!0x1;for(const _0x40c48f of _0x1c6990)_0x40c48f['is']('element')&&_0x4a3573['match'](_0x40c48f)&&(_0x50ff91['push'](_0x40c48f),'h1'==_0x40c48f['name']&&(_0x5debd3=!0x0));if(_0x5debd3){for(const _0x11cafd of _0x50ff91)_0x52ec05['rename']('h'+(parseInt(_0x11cafd['name'][0x1])+0x1),_0x11cafd);}}_isH1TagSupportEnabled(){const {data:_0x400886,editing:_0x3ca574}=this['editor'],_0x58adf9=_0x400886['htmlProcessor']['toView']('<h1></h1>'),_0x3c5f3c=_0x400886['toView'](_0x400886['toModel'](_0x58adf9));return!!_0x3ca574['view']['domConverter']['viewToDom'](_0x3c5f3c)['querySelector']('h1');}_sanitizeHTML(_0x5eb580){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x5eb580),this['_sanitizationContainer']['innerHTML'];}_stripMarkdownSyntax(_0x2a4a03){const _0x2e399a=_0x2a4a03['trim']();return _0x2e399a['startsWith']('```html')?_0x2e399a['endsWith']('```')?_0x2e399a['substring'](0x7,_0x2e399a['length']-0x3):_0x2e399a['substring'](0x7):_0x2a4a03;}};const ji={'REPLACE':'replace','INSERT':'insert'};var Ji=class extends _0x3a20a6{constructor(_0x338ae1){super(_0x338ae1),this['set']('isVisible',!0x1),this['set']('mainAction',ji['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x359422=>$i(_0x338ae1,'AI_'+_0x359422['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton']($i(_0x338ae1,'Insert\x20below')),this['tryAgainButton']=this['_createButton']($i(_0x338ae1,'Try\x20again')),this['stopButton']=this['_createButton']($i(_0x338ae1,'Stop'));const _0x13e052=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x13e052['if']('isVisible','ck-hidden',_0x36f161=>!_0x36f161)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}_createButton(_0x144099,_0x17c2f8){const _0x9a0a48=new Bt(this['locale']);return _0x9a0a48['set']({'label':_0x144099,'class':_0x17c2f8||'','isVisible':!0x0,'withText':!0x0}),_0x9a0a48;}},Zi=class extends _0xfd0945{contentFieldView;copyButtonView;constructor(_0x584aab,_0xeaaf4d=''){super(_0x584aab),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x705384=this['bindTemplate'];this['contentFieldView']=new ts(_0x584aab,_0xeaaf4d),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x705384['if']('isVisible','ck-hidden',_0x5dbae4=>!_0x5dbae4)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x705384['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 _0x4e3b16=!0x1;this['on']('change:value',(_0x3d5500,_0x11e36d,_0x39e1e2)=>{const _0x3b75af=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x39e1e2),this['isProcessing']&&_0x3b75af&&!_0x4e3b16&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x3c607e,_0x546e68,_0x2b0e62)=>{_0x4e3b16=!0x1,_0x2b0e62?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x4e3b16=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x4e3b16=!0x0;});}['focus'](){this['element']['focus']();}_createCopyButton(){const _0x201540=this['locale'],_0x1b32d9=new Bt(this['locale']),_0x2df2c8='ck-ai-form__copy-button';return _0x1b32d9['set']({'label':$i(_0x201540,'Copy'),'icon':_0x49526f,'class':_0x2df2c8,'tooltip':!0x0}),_0x1b32d9['bind']('isVisible')['to'](this,'value',_0x5c42af=>!!_0x5c42af),_0x1b32d9['bind']('isEnabled')['to'](this,'isProcessing',_0x1f24a5=>!_0x1f24a5),_0x1b32d9['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x1b32d9['icon']=_0xca6ce1,_0x1b32d9['class']=_0x2df2c8+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x1b32d9['icon']=_0x49526f,_0x1b32d9['class']=_0x2df2c8;},0x3e8);}),_0x1b32d9;}['_copyHTMLToClipboard'](_0x188521){const {window:_0x4721ab,document:_0x175479}=ft;if(_0x4721ab['ClipboardItem']){const {Blob:_0x3c4ad0,ClipboardItem:_0x23e0a5}=_0x4721ab,_0x477ee5=[new _0x23e0a5({'text/html':new _0x3c4ad0([_0x188521['innerHTML']],{'type':'text/html'}),'text/plain':new _0x3c4ad0([_0x188521['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x477ee5);}else{const _0x51bfbc=_0x175479['createElement']('div');_0x51bfbc['style']['position']='absolute',_0x51bfbc['style']['left']='-9999px',_0x51bfbc['innerHTML']='<span>[</span>'+_0x188521['innerHTML']+'<span>]</span>',_0x175479['body']['appendChild'](_0x51bfbc);const _0x1e975f=_0x175479['createRange']();_0x1e975f['setStartAfter'](_0x51bfbc['firstElementChild']),_0x1e975f['setEndBefore'](_0x51bfbc['lastElementChild']);const _0xd29094=_0x4721ab['getSelection']();_0xd29094['removeAllRanges'](),_0xd29094['addRange'](_0x1e975f),_0x175479['execCommand']('copy'),_0x51bfbc['remove']();}}},ts=class extends _0xfd0945{constructor(_0x5d7904,_0xc4930d=''){super(_0x5d7904),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0xc4930d,'ck-reset_all-excluded','ck-ai-form__content-field']}});}setContent(_0x4adb26){this['element']['innerHTML']=_0x4adb26;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}_createLoader(){const _0x1c544b=new _0xfd0945(),_0x3d6d16=this['locale'],_0x4e3c7a=new _0x3afe73();return _0x4e3c7a['isVisible']=!0x0,_0x1c544b['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x4e3c7a,{'text':$i(_0x3d6d16,'AI\x20is\x20writing...')}]}),_0x1c544b['render'](),_0x1c544b;}},es=class extends _0xfd0945{constructor(_0x15bf75,_0x4f8158=''){super(_0x15bf75);const _0x32c8cb=new Xt(),_0x29dd8c=this['bindTemplate'];this['set']('text',_0x4f8158),_0x32c8cb['content']=_0x5a664d,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x32c8cb,{'text':_0x29dd8c['to']('text')}]});}},is=class extends Dt{submitButtonView;showHistoryButtonView;constructor(_0x35d934,_0x43c74f){super(_0x35d934,_0x43c74f),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',(_0x44fe3a,_0x12f3c9)=>{_0x44fe3a['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x12f3c9());});}_createSubmitButton(){const _0xc05fa2=new Bt(this['locale']),_0x4b0b77=this['locale'];return _0xc05fa2['set']({'icon':nt,'label':$i(_0x4b0b77,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0xc05fa2['on']('execute',()=>{this['submit']();}),_0xc05fa2['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x3f1167,_0x50ef95)=>!_0x3f1167&&_0x50ef95),_0xc05fa2;}_createShowHistoryButton(){const _0x4fefd1=new Bt(this['locale']),_0x34eddc=this['resultsView'],_0x250872=this['locale'];_0x4fefd1['set']({'label':$i(_0x250872,'History'),'withText':!0x1,'icon':_0xa09b29,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x4fefd1['bind']('isOn')['to'](_0x34eddc,'isVisible'),_0x4fefd1['bind']('isEnabled')['to'](this,'isEnabled'),_0x4fefd1['on']('execute',()=>{_0x34eddc['isVisible']=!_0x34eddc['isVisible'],_0x34eddc['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x3de056=()=>{ft['window']['requestAnimationFrame'](()=>{if(St(this['element'])){const _0x3f3d81=new It(this['queryView']['fieldView']['element']),_0x3b4e7f=_0x3f3d81['width'],_0x1448ca='rtl'===_0x250872['uiLanguageDirection']?'left':'right';_0x3f3d81['excludeScrollbarsAndBorders'](),_0x4fefd1['element']['style'][_0x1448ca]=_0x3b4e7f-_0x3f3d81['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x3de056),this['on']('render',_0x3de056),_0x4fefd1;}submit(){const _0x118d34=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x118d34);}['focus'](_0x3827d7){-0x1===_0x3827d7?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},ss=class extends _0x4ca5fe{historyGroupView;clearHistoryButton;constructor(_0x993cb0){super(_0x993cb0),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Zt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=$i(_0x993cb0,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}filter(){let _0x549078=0x0;for(const _0x4b7c0b of this['items'])_0x549078+=_0x4b7c0b['items']['length'];return{'resultsCount':_0x549078,'totalItemsCount':_0x549078};}_createClearHistoryButton(){const _0x571e85=this['locale'],_0x52055f=new Bt(this['locale']);return _0x52055f['set']({'label':'('+$i(_0x571e85,'Clear')+')','withText':!0x0}),_0x52055f['on']('execute',()=>this['fire']('clearHistory')),_0x52055f;}},ns=class extends te{constructor(_0x4b9623){super();const _0x5c2e1f=new Ut(),_0x2cf9a9=new Bt(this['locale'],_0x5c2e1f);this['children']['add'](_0x2cf9a9),_0x2cf9a9['set']({'label':_0x4b9623['prompt'],'withText':!0x0}),_0x2cf9a9['on']('execute',()=>{this['fire']('execute',{'value':_0x2b0909(_0x4b9623['prompt'])});});}};const rs='CKEditor/AIFormView/PromptHistory';var os=class extends lt{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x3e4cf6,_0x4b6368)=>{const _0x3dd3d7=as(_0x4b6368['prompt']);for(const _0x403c85 of this)if(_0x403c85!=_0x4b6368&&as(_0x403c85['prompt'])===_0x3dd3d7){this['remove'](_0x403c85);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}_loadFromSessionStorage(){const _0x5d1774=sessionStorage['getItem'](rs)||'[]';this['addMany'](JSON['parse'](_0x5d1774));}_saveToSessionStorage(){sessionStorage['setItem'](rs,JSON['stringify'](this['map'](_0x280295=>_0x280295)));}};function as(_0x4db431){return _0x4db431['toLowerCase']()['trim']();}var hs=class extends _0xfd0945{['focusTracker'];keystrokes;contentArea;toolbar;promptView;['errorView'];['_focusables'];['focusCycler'];_promptHistory;constructor(_0xb6645a,_0x1cf9fc,_0x903fd6=''){super(_0xb6645a),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',ji['REPLACE']),this['_promptHistory']=new os(),this['errorView']=new es(_0xb6645a),this['contentArea']=new Zi(_0xb6645a,_0x903fd6),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 gt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new $t({'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 _0x2a315b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x1cf9fc],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x2a315b['if']('isError','ck-hidden',_0x53abcb=>!_0x53abcb)]},'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'](_0x239f6a=0x1){-0x1===_0x239f6a?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 _0x1fc57c=this['locale'],_0xc73e72=new is(_0x1fc57c,{'queryView':{'label':$i(_0x1fc57c,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x2ce018,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':$i(_0x1fc57c,'Empty\x20history'),'secondary':$i(_0x1fc57c,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0xc73e72['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x2fe206,_0x121995)=>_0x2fe206&&!_0x121995),this['listenTo'](_0xc73e72,'submit',(_0x219127,_0x2bfc5a)=>{this['prompt']=_0x2bfc5a;const _0x168986=_0x5a8f00(_0x2bfc5a);this['fire']('submitPrompt',_0x168986),_0x2bfc5a['trim']()&&this['_promptHistory']['add']({'prompt':_0x168986},0x0);},{'priority':'high'}),_0xc73e72;}_createHistoryView(){const _0x115967=new ss(this['locale']);return _0x115967['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](ns),_0x115967['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x115967;}_createToolbar(){const _0x1fba17=new Ji(this['locale']);return _0x1fba17['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2a2503,_0xd97856,_0x3c9a9b)=>_0x2a2503&&!_0xd97856&&!!_0x3c9a9b),_0x1fba17['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x1fba17['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x59eca8,_0x25cc7d,_0x10ea99)=>_0x59eca8&&!_0x25cc7d&&!!_0x10ea99),_0x1fba17['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x1fba17['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x50efe2,_0x1d871f)=>_0x50efe2&&!_0x1d871f),_0x1fba17['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x1fba17['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x1fba17['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x1fba17;}startProcessing(){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x386e2d=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=$i(_0x386e2d,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x250c39){const _0x3185df=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x250c39||$i(_0x3185df,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const cs=globalThis['DataTransfer'];var ls=class extends _0xe451ae{['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[_0x50d807,Ki,Fi,Gt];}constructor(_0x3e6174){super(_0x3e6174),_0x3e6174['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x3e6174['config']['define']('ai.assistant.contentAreaCssClass',''),_0x3e6174['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x3e6174['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}init(){const {editor:_0x3a8710}=this;this['_aiAdapter']=_0x3a8710['plugins']['get'](Fi),this['_dialog']=_0x3a8710['plugins']['get'](Gt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x27c3d4=new Yi(_0x3a8710,Array['from'](this['_commandDefinitions']['values']()));_0x3a8710['commands']['add']('showAIAssistant',_0x27c3d4),_0x3a8710['ui']['componentFactory']['add']('aiCommands',_0x508040=>{const _0x3979fb=_0x5d526e(_0x508040);return _0x3979fb['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x3979fb['buttonView']['set']({'label':$i(_0x508040,'AI\x20Commands'),'icon':_0x399a6e,'tooltip':!0x0}),_0x3979fb['on']('execute',_0x53adf2=>this['_onExecute'](_0x53adf2['source']['id'])),_0xafdd9(_0x3979fb,_0x3a8710['ui']['view']['body'],function(_0x93e34){const _0x5c49e7=ds(_0x93e34,Vi(_0x93e34['config']['get']('ai.assistant.commands'),_0x93e34['locale']))['filter'](_0x6c773e=>_0x6c773e['commands']['length']);return 0x1===_0x5c49e7['length']?ds(_0x93e34,_0x5c49e7[0x0]['commands'])['map'](_0x2e5d92=>({'id':_0x2e5d92['id'],'label':_0x2e5d92['label']})):_0x5c49e7['map'](_0x224b0b=>{const {groupId:_0x2d7010,groupLabel:_0xe7cc99,commands:_0x8890d0}=_0x224b0b,_0x4f4f54=ds(_0x93e34,_0x8890d0)['map'](_0xd72a61=>({'id':_0xd72a61['id'],'label':_0xd72a61['label']}));return{'id':_0x2d7010,'menu':_0xe7cc99||_0x2d7010,'children':_0x4f4f54};});}(_0x3a8710),{'ariaLabel':$i(_0x508040,'AI\x20Commands')}),_0x3979fb['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x27c3d4['on']('change:enabledCommandsIds',_0x56946f),_0x3979fb['menuView']['once']('render',_0x56946f),_0x3979fb;function _0x56946f(){_0x3979fb['isEnabled']=_0x27c3d4['enabledCommandsIds']['length']>0x0;for(const _0x584a01 of _0x3979fb['menuView']['buttons'])_0x584a01['isEnabled']=_0x27c3d4['enabledCommandsIds']['includes'](_0x584a01['id']);}}),_0x3a8710['ui']['componentFactory']['add']('menuBar:aiCommands',_0x493b91=>{const _0x30d48c=new _0x4c2379(_0x493b91);_0x30d48c['buttonView']['set']({'label':$i(_0x493b91,'AI\x20Commands'),'icon':_0x399a6e}),_0x30d48c['bind']('isEnabled')['to'](_0x27c3d4,'enabledCommandsIds',_0x38e342=>_0x38e342['length']>0x0);const _0x2444e5=Vi(_0x3a8710['config']['get']('ai.assistant.commands'),_0x493b91);return this['_populateMenuBarMenu'](_0x27c3d4,_0x30d48c,_0x2444e5,_0x2f51f5=>this['_onExecute'](_0x2f51f5)),_0x30d48c;}),_0x3a8710['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x5e8ac7=this['_createAIAssistantUIButton'](Bt);return _0x5e8ac7['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x5e8ac7;}),_0x3a8710['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x10a60a=this['_createAIAssistantUIButton'](_0x48f08b);return _0x10a60a['set']({'role':'menuitemcheckbox'}),_0x10a60a;}),this['licenseKey']=this['editor']['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{const _0x2ba60b=[this['editor']];for(const _0x580b31 of _0x2ba60b){let _0x1865f8;for(const _0x4b2656 in _0x580b31){const _0xc6e800=_0x4b2656,_0x2afd23=_0x580b31[_0xc6e800];if('aiLicenseKeyValid'==_0x2afd23||'aiLicenseKeyInvalid'==_0x2afd23||'aiLicenseKeyExpired'==_0x2afd23||'aiLicenseKeyDomainLimit'==_0x2afd23||'aiLicenseKeyNotAllowed'==_0x2afd23||'aiLicenseKeyEvaluationLimit'==_0x2afd23||'aiLicenseKeyUsageLimit'==_0x2afd23){delete _0x580b31[_0xc6e800],_0x1865f8=_0x2afd23,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x1865f8&&_0x580b31['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x1865f8&&_0x580b31['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x1865f8&&_0x580b31['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x1865f8&&_0x580b31['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x1865f8&&_0x580b31['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x1865f8&&_0x580b31['_showLicenseError']('usageLimit');}},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x45fe80='',_0x1fe808='',_0x5bf8ab='custom'){const _0x459fd6=this['editor'],_0x866372=_0x459fd6['editing']['view'],_0x11f86a=_0x459fd6['plugins']['get'](Ki),_0x38d06b=_0x459fd6['plugins']['get'](_0x50d807);_0x11f86a['showFakeVisualSelection']();const _0x150374=new cs(),_0x3c6abf=new ClipboardEvent('copy',{'clipboardData':_0x150374}),_0x5eee8d=new _0x39b23c(_0x150374),_0xe282f8=new _0x169f96(_0x866372,_0x3c6abf,{'dataTransfer':_0x5eee8d});_0x38d06b['_forceMarkersCopy']('comment',()=>{_0x866372['document']['fire']('copy',_0xe282f8);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new zi(_0x459fd6,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x180d7b=_0x5eee8d['getData']('text/html');const _0x11bf5f=_0x459fd6['model']['document']['selection'],_0x1464f9=Array['from'](_0x11bf5f['getRanges']());0x1===_0x1464f9['length']&&_0x1464f9[0x0]['isFlat']&&!_0x11bf5f['getSelectedElement']()&&''!==_0x180d7b['replace'](/&nbsp;/g,'')['trim']()&&(_0x180d7b='<p>'+_0x180d7b+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x5bf8ab,'query':_0x45fe80,'htmlContent':_0x180d7b,'label':_0x1fe808,'mainActionLabel':ji[_0x459fd6['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x4c2e14,'title':$i(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Kt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x11f86a['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}_getResolvedCommandsDefinitions(){const _0x20a9d3=new Map(),_0x13ebd5=Vi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x435e3f of _0x13ebd5)for(const _0x57fd40 of _0x435e3f['commands'])_0x20a9d3['set'](_0x57fd40['id'],{..._0x57fd40,'groupId':_0x435e3f['groupId'],'groupLabel':_0x435e3f['groupLabel']||_0x435e3f['groupId']});return _0x20a9d3;}_createAIAssistantUIButton(_0x3b361e){const _0x4b0274=this['editor'],_0x419224=_0x4b0274['commands']['get']('showAIAssistant'),_0x42717d=new _0x3b361e(_0x4b0274['locale']);return _0x42717d['set']({'label':$i(_0x4b0274['locale'],'AI\x20Assistant'),'icon':_0x4c2e14,'isToggleable':!0x0}),_0x42717d['bind']('isEnabled')['to'](_0x419224),_0x42717d['bind']('isOn')['to'](this['_dialog'],'id',_0x1517a2=>'aiAssistant'===_0x1517a2),this['listenTo'](_0x42717d,'execute',()=>{_0x42717d['isOn']?this['hideUI']():_0x419224['execute']();}),_0x42717d;}_initView(){const _0x687ae7=this['editor']['plugins']['get'](Ki);this['_formView']=new hs(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',()=>{_0x687ae7['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x687ae7['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}_initAriaAiStatusChangeAnnouncements(){const {locale:_0x1524f0,ui:{ariaLiveAnnouncer:_0x4ebeb7}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0xc7dbd5,_0x13db85,_0x3b9d7c)=>{const _0x576488=this['_aiAssistantController']['currentContext'];_0x3b9d7c?_0x4ebeb7['announce']($i(_0x1524f0,'AI\x20is\x20writing')):_0x576488&&_0x4ebeb7['announce']($i(_0x1524f0,'Generated\x20content:\x20%0',_0x576488),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x54446c,_0x38b969,_0x14cb81)=>{if(_0x14cb81){const _0x13f569=this['_formView']['errorView']['text'];_0x4ebeb7['announce']($i(_0x1524f0,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x13f569));}});}_onExecute(_0x183537){const _0x5c90d9=this['_commandDefinitions']['get'](_0x183537),_0x4f1ced=this['editor'],_0x9cf90e=_0x4f1ced['model']['document']['selection'],_0x3c21f3=_0x4f1ced['commands']['get']('showAIAssistant'),_0x17226b=_0x4f1ced['plugins']['get'](Ki),_0x59a2b2=''+('_ungrouppedCommands'!==_0x5c90d9['groupId']?_0x5c90d9['groupLabel']+':\x20':'')+_0x5c90d9['label'];if(!0x1!==_0x5c90d9['requiresContent']&&_0x9cf90e['isCollapsed']){const _0x5bdfce=wt(_0x9cf90e['getSelectedBlocks']())||_0x4f1ced['model']['schema']['getLimitElement'](_0x9cf90e);_0x4f1ced['model']['change'](_0xf91d9c=>{_0xf91d9c['setSelection'](_0x5bdfce,'in');});}_0x17226b['showFakeVisualSelection'](),_0x3c21f3['execute'](_0x5c90d9['prompt'],_0x59a2b2,'command:'+_0x183537);}_populateMenuBarMenu(_0x5eea2e,_0x23ad0d,_0x26c7e7,_0x1d1677){const _0x3bd391=this['editor'],_0x5e2ad4=_0x3bd391['locale'],_0x43a189=new _0x24a343(_0x5e2ad4),_0x54a071=ds(_0x3bd391,_0x26c7e7)['filter'](_0x4fbd50=>_0x4fbd50['commands']['length']);0x1===_0x54a071['length']?this['_getMenuBarGroupButtons']({'command':_0x5eea2e,'commands':_0x54a071[0x0]['commands'],'parentMenuView':_0x23ad0d,'onExecute':_0x1d1677})['forEach'](_0x4b2972=>_0x43a189['items']['add'](_0x4b2972)):_0x54a071['forEach'](({groupId:_0x4b8624,groupLabel:_0x48dec5,commands:_0x3c621f})=>{const _0x3259a3=new _0x5262e5(_0x5e2ad4,_0x23ad0d),_0x28df1e=new _0x4c2379(_0x5e2ad4),_0x4d2192=new _0x24a343(_0x5e2ad4),_0x6292bb=this['_getMenuBarGroupButtons']({'command':_0x5eea2e,'commands':_0x3c621f,'parentMenuView':_0x28df1e,'onExecute':_0x1d1677});_0x28df1e['buttonView']['set']({'label':_0x48dec5||_0x4b8624}),_0x28df1e['delegate']('execute')['to'](_0x23ad0d),_0x4d2192['items']['addMany'](_0x6292bb),_0x28df1e['panelView']['children']['add'](_0x4d2192),_0x3259a3['children']['add'](_0x28df1e),_0x43a189['items']['add'](_0x3259a3);}),_0x23ad0d['panelView']['children']['add'](_0x43a189);}_getMenuBarGroupButtons({command:_0xd71cff,commands:_0x350a97,parentMenuView:_0x5191e4,onExecute:_0x2408fb}){const _0x1a84a1=this['editor'],_0x239e8e=_0x1a84a1['locale'];return ds(_0x1a84a1,_0x350a97)['map'](_0x1db7b5=>{const _0x5d1378=new _0x5262e5(_0x239e8e,_0x5191e4),_0x36e865=new _0x48f08b(_0x239e8e);return _0x36e865['set']({'label':_0x1db7b5['label']}),_0x36e865['delegate']('execute')['to'](_0x5191e4),_0x36e865['on']('execute',()=>_0x2408fb(_0x1db7b5['id'])),_0x36e865['bind']('isEnabled')['to'](_0xd71cff,'enabledCommandsIds',_0x202402=>_0x202402['includes'](_0x1db7b5['id'])),_0x5d1378['children']['add'](_0x36e865),_0x5d1378;});}};function us(_0x5ec8e0,_0x3921cc){return void 0x0!==_0x5ec8e0['order']&&void 0x0===_0x3921cc['order']?0x1:void 0x0===_0x5ec8e0['order']&&void 0x0!==_0x3921cc['order']?-0x1:void 0x0!==_0x5ec8e0['order']&&void 0x0!==_0x3921cc['order']?_0x5ec8e0['order']-_0x3921cc['order']:0x0;}function ds(_0x126db0,_0x4b16c5){_0x4b16c5['sort'](us);const _0x5ca9e9={},_0x2ed29a=[];for(const _0x2889c2 of _0x4b16c5)if(void 0x0!==_0x2889c2['order']){if(_0x2889c2['order']in _0x5ca9e9)throw new ct('ai-commands-config-order-collision',_0x126db0,{'conflictingDefinitions':[_0x2889c2,_0x5ca9e9[_0x2889c2['order']]]});_0x5ca9e9[_0x2889c2['order']]=_0x2889c2,_0x2ed29a['splice'](_0x2889c2['order'],0x0,_0x2889c2);}else _0x2ed29a['push'](_0x2889c2);return _0x2ed29a;}var _s=class extends _0xe451ae{static get requires(){return[ls,Ki];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x133635){super(_0x133635);const _0x30ca5d=_0x133635['config'],_0x3aa9f0=_0x133635['locale'];_0x30ca5d['define']('ai.assistant.preserveComments',!0x0),_0x30ca5d['define']('ai.assistant.commands',gs(_0x3aa9f0)),_0x30ca5d['define']('ai.assistant.extraCommandGroups',[]),_0x30ca5d['define']('ai.assistant.removeCommands',[]);let _0x59f82d=Vi(_0x30ca5d['get']('ai.assistant.commands'),_0x3aa9f0);const _0x2ac273=_0x30ca5d['get']('ai.assistant.extraCommandGroups'),_0xbc43f2=_0x30ca5d['get']('ai.assistant.removeCommands');_0x2ac273['forEach'](_0x3e7c8a=>{const _0xd15e3f=_0x59f82d['find'](_0x1696e6=>_0x1696e6['groupId']===_0x3e7c8a['groupId']);_0xd15e3f?_0xd15e3f['commands']=_0xd15e3f['commands']['concat'](_0x3e7c8a['commands']):_0x59f82d['push'](_0x3e7c8a);}),_0x59f82d=_0x59f82d['filter'](_0x4bbb71=>!_0xbc43f2['includes'](_0x4bbb71['groupId'])),_0x59f82d['forEach'](_0x30c292=>{_0x30c292['commands']=_0x30c292['commands']['filter'](_0xb7176=>!_0xbc43f2['includes'](_0xb7176['id']));}),_0x30ca5d['set']('ai.assistant.commands',_0x59f82d);}};function gs(_0x52b86c){return[{'groupId':'editOrReview','groupLabel':$i(_0x52b86c,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':$i(_0x52b86c,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':$i(_0x52b86c,'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':$i(_0x52b86c,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':$i(_0x52b86c,'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':$i(_0x52b86c,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':$i(_0x52b86c,'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':$i(_0x52b86c,'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':$i(_0x52b86c,'Change\x20tone'),'commands':[{'id':'professional','label':$i(_0x52b86c,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':$i(_0x52b86c,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':$i(_0x52b86c,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':$i(_0x52b86c,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':$i(_0x52b86c,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':$i(_0x52b86c,'Change\x20style'),'commands':[{'id':'business','label':$i(_0x52b86c,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':$i(_0x52b86c,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':$i(_0x52b86c,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':$i(_0x52b86c,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':$i(_0x52b86c,'Translate'),'commands':[{'id':'translateEnglish','label':$i(_0x52b86c,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':$i(_0x52b86c,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':$i(_0x52b86c,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':$i(_0x52b86c,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':$i(_0x52b86c,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':$i(_0x52b86c,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':$i(_0x52b86c,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':$i(_0x52b86c,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var As=class extends _0xe451ae{abortController;static get requires(){return[Fi];}constructor(_0xf6093f){super(_0xf6093f),this['abortController']=new AbortController();}init(){this['editor']['plugins']['get'](Fi)['textAdapter']=this;}abort(){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async makeRequest(_0x25fedd){return this['sendRequest'](_0x25fedd)['catch'](_0x29039=>{if(_0x29039 instanceof Wi)return Promise['reject'](_0x29039);if('AbortError'==_0x29039['name'])return Promise['resolve']();throw console['error'](_0x29039),new ct('aitextadapter-send-request-failed',null);});}async _prepareRequestHeaders(_0x4f2e75,_0x1993a2){const _0x51db65=this['editor']['locale'],_0x553428={'Content-Type':'application/json'};if('object'==typeof _0x4f2e75)Object['assign'](_0x553428,_0x4f2e75);else{if(_0x4f2e75)try{const _0x542c2d=await _0x4f2e75(_0x1993a2);Object['assign'](_0x553428,_0x542c2d);}catch{return Promise['reject'](new Wi($i(_0x51db65,'AI_ERROR_GET_HEADERS')));}}return _0x553428;}async _prepareRequestParameters(_0x56174c,_0x136a61){const _0x561388=this['editor']['locale'];if('object'==typeof _0x56174c)return _0x56174c;try{return await _0x56174c(_0x136a61);}catch{return Promise['reject'](new Wi($i(_0x561388,'AI_ERROR_GET_PARAMETERS')));}}},Is=class extends As{['_apiUrl'];_requestHeaders;_requestParameters;static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x2a1b3a){super(_0x2a1b3a),_0x2a1b3a['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x2a1b3a['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x2a1b3a['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x2a1b3a['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x2a1b3a['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x2a1b3a['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async sendRequest({query:_0x4893e7,context:_0x527008,onData:_0x293bc7,actionId:_0x47f681}){const _0x2290b1=this['editor']['locale'],_0x219c24=await this['prepareMessages'](_0x4893e7,_0x527008,_0x47f681),_0x427839=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x47f681),_0x3a65e1=await this['_prepareRequestParameters'](this['_requestParameters'],_0x47f681),_0x57b29d={'messages':_0x219c24,..._0x3a65e1},_0x563a08={'method':'POST','headers':_0x427839,'body':JSON['stringify'](_0x57b29d),'signal':this['abortController']['signal']},_0xff0b6e=await fetch(this['_apiUrl'],_0x563a08);if(_0xff0b6e['ok'])return _0x3a65e1['stream']?await this['_readStreamableResponse'](_0xff0b6e,_0x293bc7):await this['_readStaticResponse'](_0xff0b6e,_0x293bc7),Promise['resolve']();{const _0x2fea78=await _0xff0b6e['text']();return _0x2fea78['includes']('context_length_exceeded')?Promise['reject'](new Wi($i(_0x2290b1,'AI_ERROR_CONTEXT_LENGTH'))):_0x2fea78['includes']('Moderation')?Promise['reject'](new Wi($i(_0x2290b1,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x2fea78));}}async['prepareMessages'](_0x264f90,_0x319a1a,_0x165bb8){let _0x30ea5c,_0x306c09;return _0x319a1a?(_0x30ea5c='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.',_0x306c09='Instruction:\x0a'+_0x264f90+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x319a1a):(_0x30ea5c='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.',_0x306c09=_0x264f90),[{'role':'system','content':_0x30ea5c},{'role':'user','content':_0x306c09}];}async _readStreamableResponse(_0x5d93ad,_0x17575e){const _0x5a1e29=_0x5d93ad['body']['getReader'](),_0x3bf4b1=new TextDecoder();let _0x42107e='',_0x3b8697='',_0x7ef82b='',_0x3ff909=!0x1;for(;!_0x3ff909;){const {done:_0x41ffe8,value:_0x28df71}=await _0x5a1e29['read'](),_0x522a35=_0x42107e+_0x3bf4b1['decode'](_0x28df71);let _0x4a3879;_0x3ff909=_0x41ffe8;try{_0x4a3879=this['_cleanUpData'](_0x522a35),_0x42107e='';}catch{_0x42107e=_0x522a35;continue;}_0x3b8697+=_0x4a3879,!_0x3ff909&&this['_isBufferIncomplete'](_0x3b8697)||_0x3b8697&&(_0x7ef82b+=_0x3b8697,_0x3b8697='',_0x17575e(_0x7ef82b));}return Promise['resolve']();}async _readStaticResponse(_0xf65cc3,_0x1568e3){return _0x1568e3((await _0xf65cc3['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}_isBufferIncomplete(_0x1680cb){const _0x40c821=_0x1680cb['split']('<')['length']!==_0x1680cb['split']('>')['length'],_0x4be804=_0x1680cb['length']<0x1e;return _0x40c821&&_0x4be804;}_cleanUpData(_0x501651){return _0x501651['split'](/\n(?![^{]*\})/g)['map'](_0x107dfa=>_0x107dfa['replace']('data:\x20',''))['filter'](_0x182999=>_0x182999&&_0x182999['length']>0x0&&'[DONE]'!==_0x182999)['map'](_0x238b46=>{const {choices:_0x56835b}=JSON['parse'](_0x238b46);if(_0x56835b[0x0]?.['delta']?.['content'])return _0x56835b[0x0]['delta']['content'];})['filter'](_0x2e342e=>_0x2e342e)['join']('');}},ps=class extends As{static get['pluginName'](){return'AWSTextAdapter';}init(){super['init'](),Ot('ai-aws-adapter-not-supported');}async sendRequest(_0x460636){throw Rt('ai-aws-adapter-not-supported'),new Wi($i(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},ms=class extends Bt{constructor(_0x3d4c64,_0x26b157={}){super(_0x3d4c64),this['isToggleable']=!0x0,this['set']('side',_0x26b157['side']||'top');const _0x47d938=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Nt(_0x26b157['class']||[]),_0x47d938['to']('side',_0x2b93d4=>'ck-tab-button_'+_0x2b93d4),_0x47d938['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},Es=class extends _0xfd0945{['children'];constructor(_0x44d232,_0x2288dc={}){super(_0x44d232);const _0x4ab4e8=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Nt(_0x2288dc['class']||[]),_0x4ab4e8['to']('class'),_0x4ab4e8['if']('isVisible','ck-hidden',_0x4cbc94=>!_0x4cbc94)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ws=class extends _0xfd0945{buttonViews=this['createCollection']();['panelViews']=this['createCollection']();_tabs=new Map();constructor(_0x107963,_0x1d7301={}){super(_0x107963),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x1d7301['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x1d7301['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0x4fb87e,_0x53e56f)=>_0x4fb87e&&!_0x53e56f);const _0x4ee5ce=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Nt(_0x1d7301['class']||[]),_0x4ee5ce['to']('side',_0x2fcae8=>'ck-tabs_'+_0x2fcae8),_0x4ee5ce['to']('class'),_0x4ee5ce['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x4ee5ce['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x4ee5ce['to']('side',_0x570e66=>'ck-tabs__buttons-container_'+_0x570e66)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x4ee5ce['to']('side',_0x44590f=>'ck-tabs__panels-container_'+_0x44590f)]},'children':this['panelViews']},...Nt(_0x1d7301['children']||[])]});}getTabIds(){return[...this['_tabs']['keys']()];}getTab(_0x4106fc){const _0x2c789a=this['_tabs']['get'](_0x4106fc);return _0x2c789a||null;}['addTab'](_0x4b80bd){const _0x1aec23=this['_setupButton']({'id':_0x4b80bd['id'],'label':_0x4b80bd['buttonLabel'],'icon':_0x4b80bd['buttonIcon'],'order':_0x4b80bd['order']}),_0x5dc067=new Es(this['locale']);return _0x5dc067['render'](),_0x4b80bd['content']&&_0x5dc067['children']['add'](_0x4b80bd['content']),this['panelViews']['add'](_0x5dc067),this['_tabs']['set'](_0x4b80bd['id'],{'button':_0x1aec23,'panel':_0x5dc067,'order':void 0x0!==_0x4b80bd['order']?_0x4b80bd['order']:null}),this['fire']('addTab:'+_0x4b80bd['id'],{'id':_0x4b80bd['id'],'button':_0x1aec23,'panel':_0x5dc067}),null===this['activeTab']?this['activateTab'](_0x4b80bd['id']):this['_hidePanel'](_0x4b80bd['id']),{'button':_0x1aec23,'panel':_0x5dc067};}activateTab(_0x5e26f2){if(null!==_0x5e26f2&&!this['getTab'](_0x5e26f2))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5e26f2});if(this['isCollapsed']=!0x1,this['activeTab']===_0x5e26f2)return;const _0x46815d=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x5e26f2,_0x5e26f2&&this['_showPanel'](_0x5e26f2),this['fire']('activateTab:'+_0x5e26f2,{'newTab':_0x5e26f2,'oldTab':_0x46815d});}toggleTabPanel(_0x2b7900){this['activeTab']===_0x2b7900?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x2b7900);}['showTab'](_0x248e44){if(!this['getTab'](_0x248e44))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x248e44});this['_showPanel'](_0x248e44),this['_showButton'](_0x248e44),this['fire']('show:'+_0x248e44,_0x248e44);}['hideTab'](_0x33b6e8){if(!this['getTab'](_0x33b6e8))throw new ct('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x33b6e8});const _0x3bb3a9=this['activeTab'];this['_hidePanel'](_0x33b6e8),this['_hideButton'](_0x33b6e8);const _0x1246cd=this['getTabIds']();_0x3bb3a9===_0x33b6e8&&_0x1246cd['length']>0x1&&this['activateTab'](_0x1246cd['find'](_0xbe3289=>_0xbe3289!==_0x33b6e8)),this['fire']('hide:'+_0x33b6e8,_0x33b6e8);}_getPanel(_0x21fb3a){const _0x4589fc=this['_tabs']['get'](_0x21fb3a);return _0x4589fc?_0x4589fc['panel']:null;}['_showPanel'](_0x3f4f28){null!==this['activeTab']&&this['activeTab']!==_0x3f4f28||this['_getPanel'](_0x3f4f28)['show']();}['_hidePanel'](_0x305fee){const _0x4800d6=this['_getPanel'](_0x305fee);_0x4800d6['isVisible']&&(this['activeTab']===_0x305fee&&(this['activeTab']=null),_0x4800d6['hide']());}_getButton(_0x477191){const _0x3eb028=this['_tabs']['get'](_0x477191);return _0x3eb028?_0x3eb028['button']:null;}_showButton(_0x5059f8){this['_getButton'](_0x5059f8)['show']();}_hideButton(_0x4fd821){this['_getButton'](_0x4fd821)['hide']();}_setupButton(_0xcf0a27){const _0x5092b0=new ms(this['locale'],{'side':this['side']}),_0x498b86=this['buttonViews'];if(_0x5092b0['set']({'label':_0xcf0a27['label'],'icon':_0xcf0a27['icon'],'tooltip':!0x0,'withText':!0x0}),_0x5092b0['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x1d837f,_0xcb40b3)=>_0x1d837f===_0xcf0a27['id']&&!_0xcb40b3),_0x5092b0['bind']('side')['to'](this,'side'),_0xcf0a27['order']){const _0x40919c=[...this['_tabs']]['reduce']((_0x2d8588,_0x8aa635)=>{const _0x293e6f=_0x8aa635[0x0],{order:_0x5ed009}=_0x8aa635[0x1];return!_0x5ed009||_0x5ed009>_0xcf0a27['order']?_0x2d8588:_0x5ed009>=_0x2d8588['order']?{'id':_0x293e6f,'order':_0x5ed009}:_0x2d8588;},{'id':'','order':0x0}),_0x517f78=_0x498b86['getIndex'](this['_getButton'](_0x40919c['id']));_0x498b86['add'](_0x5092b0,_0x517f78+0x1);}else _0x498b86['add'](_0x5092b0);return _0x5092b0['on']('execute',()=>{this['toggleTabPanel'](_0xcf0a27['id']);}),_0x5092b0;}};const Ts=['overlay','sidebar','custom'],fs=['left','right'];var Cs=class extends ws{constructor(_0x27facf,_0x23a0e7={}){super(_0x27facf,_0x23a0e7),this['set']('type',_0x23a0e7['type']||'sidebar'),this['set']('side',_0x23a0e7['side']||'right'),this['set']('isVisible',_0x23a0e7['visibleByDefault']??!0x0);const _0x1b0a58=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x1b0a58['if']('type','ck-ai-tabs__overlay',_0x589691=>'overlay'===_0x589691),_0x1b0a58['if']('type','ck-ai-tabs__sidebar',_0x55d9ea=>'sidebar'===_0x55d9ea),_0x1b0a58['if']('isVisible','ck-hidden',_0x109714=>!_0x109714)]}}),this['buttonViews']['on']('add',(_0x3433ed,_0x494943)=>{_0x494943['set']('withText',!0x1);});}},bs=class extends _0x338e6f{['view'];container=null;showResizeButton=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x46814b){if(super(_0x46814b),!this['context']['config']['get']('ai.container'))throw new ct('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x20f6a3=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x20f6a3['showResizeButton']&&(this['showResizeButton']=_0x20f6a3['showResizeButton']),'sidebar'!==_0x20f6a3['type']&&'overlay'!==_0x20f6a3['type']||_0x20f6a3['side']&&(this['side']=_0x20f6a3['side']),'sidebar'===_0x20f6a3['type']){if(this['container']=_0x20f6a3['element'],this['set']('type','sidebar'),!this['container'])throw new ct('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x20f6a3['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new Cs(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x20f6a3['visibleByDefault'],'collapsible':_0x20f6a3['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 _0x36c7af&&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(_0x171133){if(_0x171133&&this['type']!==_0x171133){if(!Ts['includes'](_0x171133))throw new ct('ai-tabs-unsupported-ui-type');this['type']=_0x171133;}}switchSide(_0x188afa){if(_0x188afa&&this['side']!==_0x188afa){if(!fs['includes'](_0x188afa))throw new ct('ai-tabs-unsupported-ui-side');this['side']=_0x188afa;}}destroy(){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},Ss=class extends _0x338e6f{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}_token;['_decoder'];static get requires(){return[ti];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5b3af0){if(super(_0x5b3af0),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 ct('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder();}init(){const _0x485264=this['context']['plugins']['get'](ti);if(!_0x485264['token'])throw new ct('ai-missing-token',this);this['_token']=_0x485264['token'];}_getExtraHttpHeaders(){const _0x30c113=this['context']['config']['get']('ai.extraHttpHeaders'),_0x20c809='function'==typeof _0x30c113?_0x30c113():_0x30c113;if(Array['isArray'](_0x20c809)&&_0x20c809['length'])return Object['fromEntries'](_0x20c809['map'](({domain:_0x2a9233,headers:_0x1d8ae9})=>[_0x2a9233,_0x1d8ae9]));}startConversation(_0x1f4fc6,_0x55cec6){const _0x4fac90=this['_sendApiRequest']('/conversations','POST',{'id':_0x1f4fc6,'group':_0x55cec6});return{'getConversation':async()=>(await _0x4fac90['request'])['json'](),'abortController':_0x4fac90['abortController']};}queryAssistant({message:_0x3aca3f,conversationId:_0x3702c3,parts:_0x200c1a,capabilities:_0x59afbb,model:_0x3fbcee,attributes:_0x32f134}){const _0xe5362c=this['_getExtraHttpHeaders'](),_0x26cbc4={..._0x3aca3f&&{'prompt':_0x3aca3f},'content':_0x200c1a,'model':_0x3fbcee,..._0x59afbb&&{'capabilities':_0x59afbb},..._0x32f134&&{'attributes':_0x32f134},..._0xe5362c&&{'extraHttpHeaders':_0xe5362c}},_0x5e962e=this['_sendApiRequest']('/conversations/'+_0x3702c3+'/messages','POST',_0x26cbc4,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x345295=(await _0x5e962e['request'])['body'];return this['_getStreamReader'](_0x345295);},'abortController':_0x5e962e['abortController']};}executeCustomAction({content:_0x22f844,message:_0x4d5b89,model:_0x2a373e,outputFormat:_0x4ace81,contexts:_0x16a47e}){const _0x4d5f0e={'content':[{'type':'text','content':_0x22f844}],..._0x4d5b89&&{'prompt':_0x4d5b89},'model':_0x2a373e,'outputFormat':_0x4ace81,...Rs(_0x16a47e)},_0x4bc1de=this['_sendApiRequest']('/actions/custom/calls','POST',_0x4d5f0e);return{'getStream':async()=>{const _0x1db12c=(await _0x4bc1de['request'])['body'];return this['_getStreamReader'](_0x1db12c);},'abortController':_0x4bc1de['abortController']};}executeAction({actionName:_0x1aa80b,content:_0x1651a3,args:_0x45c39d,contexts:_0x48321f}){const _0x286d14={'content':[{'type':'text','content':_0x1651a3}],'args':_0x45c39d,...Rs(_0x48321f)},_0x170cbf=this['_sendApiRequest']('/actions/system/'+_0x1aa80b+'/calls','POST',_0x286d14);return{'getStream':async()=>{const _0x67ed28=(await _0x170cbf['request'])['body'];return this['_getStreamReader'](_0x67ed28);},'abortController':_0x170cbf['abortController']};}['uploadFile'](_0x48ace5,_0x1b2732,_0x21eaf9){const _0x3dd4d0=new FormData();_0x3dd4d0['append']('file',_0x1b2732,_0x1b2732['name']),_0x21eaf9&&_0x3dd4d0['append']('attributes',JSON['stringify'](_0x21eaf9));const _0x302195=this['_sendApiRequest']('/conversations/'+_0x48ace5+'/files','POST',_0x3dd4d0);return{'getId':async()=>(await _0x302195['request'])['json'](),'abortController':_0x302195['abortController']};}uploadDocuments(_0xb83650,_0x314ead){const _0x207e3a={'documents':_0x314ead['map'](_0x44ce5a=>({'content':_0x44ce5a['content'],'attributes':{'version':_0x44ce5a['version'],'sessionId':_0x44ce5a['sessionId'],'channelId':_0x44ce5a['channelId'],'rootName':_0x44ce5a['rootName'],'selections':_0x44ce5a['selections']},...void 0x0!==_0x44ce5a['name']?{'name':_0x44ce5a['name']}:{},...void 0x0!==_0x44ce5a['description']?{'description':_0x44ce5a['description']}:{}}))},_0x234979=this['_sendApiRequest']('/conversations/'+_0xb83650+'/documents/batch','POST',_0x207e3a);return{'getIds':async()=>(await _0x234979['request'])['json'](),'abortController':_0x234979['abortController']};}fetchDocuments(_0x28cde4,_0x290fd3){const _0xfb5323=new URLSearchParams();_0xfb5323['append']('documentIds',_0x290fd3['join'](','));const _0x9e8115=this['_sendApiRequest']('/conversations/'+_0x28cde4+'/documents/batch?'+_0xfb5323['toString'](),'GET');return{'getDocuments':async()=>(await _0x9e8115['request'])['json'](),'abortController':_0x9e8115['abortController']};}fetchConversations(_0x21645e,_0x8f49c={}){const _0x3f37ab=new URLSearchParams();_0x3f37ab['append']('group',_0x21645e),_0x3f37ab['append']('excludeEmpty',!0x1!==_0x8f49c['excludeEmpty']?'true':'false'),_0x3f37ab['append']('limit',_0x8f49c['limit']?_0x8f49c['limit']['toString']():0x64['toString']()),_0x3f37ab['append']('sortBy',_0x8f49c['sortBy']?_0x8f49c['sortBy']:'createdAt'),_0x3f37ab['append']('order',_0x8f49c['order']?_0x8f49c['order']:'desc');const _0x222f08=this['_sendApiRequest']('/conversations?'+_0x3f37ab['toString'](),'GET');return{'getConversations':async()=>(await(await _0x222f08['request'])['json']())['items'],'abortController':_0x222f08['abortController']};}deleteConversation(_0xa251a6){const _0x3cf831=this['_sendApiRequest']('/conversations/'+_0xa251a6,'DELETE');return{'execute':async()=>{await _0x3cf831['request'];},'abortController':_0x3cf831['abortController']};}updateConversation(_0x46bd82,_0x26ed00){const _0x20672d=this['_sendApiRequest']('/conversations/'+_0x46bd82,'PATCH',_0x26ed00);return{'getResult':async()=>(await _0x20672d['request'],_0x26ed00),'abortController':_0x20672d['abortController']};}fetchConversation(_0x300b0f){const _0x3fc6df=this['_sendApiRequest']('/conversations/'+_0x300b0f,'GET');return{'getConversation':async()=>(await _0x3fc6df['request'])['json'](),'abortController':_0x3fc6df['abortController']};}fetchConversationMessages(_0x24acec){const _0x5066ea=this['_sendApiRequest']('/conversations/'+_0x24acec+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x5066ea['request'])['json']())['items'],'abortController':_0x5066ea['abortController']};}['uploadUrl'](_0xd9289b,_0x27f06b,_0x981953){const _0x3c2c51=this['_sendApiRequest']('/conversations/'+_0xd9289b+'/web-resources','POST',{'url':_0x27f06b,'attributes':_0x981953});return{'getId':async()=>(await _0x3c2c51['request'])['json'](),'abortController':_0x3c2c51['abortController']};}getModels(_0x1aeaf1='en'){const _0x129f10=new URLSearchParams();_0x129f10['append']('language',_0x1aeaf1);const _0x5cb81e='/models/1?'+_0x129f10['toString'](),_0x221000=this['_sendApiRequest'](_0x5cb81e,'GET');return{'list':async()=>await(await _0x221000['request'])['json'](),'abortController':_0x221000['abortController']};}listContexts(_0x3932e2={}){const _0xc765d4=new URLSearchParams();_0xc765d4['append']('limit',_0x3932e2['limit']?_0x3932e2['limit']['toString']():0x64['toString']()),_0x3932e2['cursor']&&_0xc765d4['append']('cursor',_0x3932e2['cursor']),_0x3932e2['order']&&_0xc765d4['append']('order',_0x3932e2['order']);const _0x38a374=this['_sendApiRequest']('/contexts?'+_0xc765d4['toString'](),'GET');return{'getContexts':async()=>(await(await _0x38a374['request'])['json']())['items'],'abortController':_0x38a374['abortController']};}deleteFile(_0x11af9e,_0xb3b77f){const _0x18f2bd=this['_sendApiRequest']('/conversations/'+_0x11af9e+'/files/'+_0xb3b77f,'DELETE');return{'execute':async()=>{await _0x18f2bd['request'];},'abortController':_0x18f2bd['abortController']};}deleteDocument(_0x9f2804,_0x487743){const _0x507977=this['_sendApiRequest']('/conversations/'+_0x9f2804+'/documents/'+_0x487743,'DELETE');return{'execute':async()=>{await _0x507977['request'];},'abortController':_0x507977['abortController']};}deleteWebResource(_0x2e5471,_0x596fb4){const _0x2e2200=this['_sendApiRequest']('/conversations/'+_0x2e5471+'/web-resources/'+_0x596fb4,'DELETE');return{'execute':async()=>{await _0x2e2200['request'];},'abortController':_0x2e2200['abortController']};}cancelStream(_0x310a17,_0x29ae4b){const _0x48047a=this['_sendApiRequest']('/conversations/'+_0x310a17+'/messages/'+_0x29ae4b+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x48047a['request'];},'abortController':_0x48047a['abortController']};}resumeStream(_0x5e84ad,_0x26954f,_0x313866='0-0'){const _0x45a136=new URLSearchParams({'lastEventId':_0x313866}),_0x2e380b=this['_sendApiRequest']('/conversations/'+_0x5e84ad+'/messages/'+_0x26954f+'/stream?'+_0x45a136['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x5d5e81=await _0x2e380b['request'];return this['_getStreamReader'](_0x5d5e81['body']);},'abortController':_0x2e380b['abortController']};}callSystemReview({reviewName:_0x2c9d0a,content:_0x5d0c8a,args:_0x59e52d,contexts:_0x135afa}){const _0x4662c9=this['_sendApiRequest']('/reviews/system/'+_0x2c9d0a+'/calls','POST',{'content':[{'type':'text','content':_0x5d0c8a}],'args':_0x59e52d,...Rs(_0x135afa)});return{'getStream':async()=>{const _0x563131=(await _0x4662c9['request'])['body'];return this['_getStreamReader'](_0x563131);},'abortController':_0x4662c9['abortController']};}processDocument({content:_0x41a480,prompt:_0x5bd1a4,model:_0x17cb27,capabilities:_0x5d1500,contexts:_0x4e2976}){const _0x540e0a=this['_getExtraHttpHeaders'](),_0x286bec=this['_sendApiRequest']('/documents/process','POST',{'content':_0x41a480,'prompt':_0x5bd1a4,'model':_0x17cb27,..._0x5d1500&&{'capabilities':_0x5d1500},...Rs(_0x4e2976),..._0x540e0a&&{'extraHttpHeaders':_0x540e0a}});return{'getResult':async()=>(await _0x286bec['request'])['json'](),'abortController':_0x286bec['abortController']};}callCustomReview({content:_0x5c0d53,prompt:_0x483b58,model:_0xe09f01,contexts:_0x409f9f}){const _0x192de8=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x5c0d53}],..._0x483b58&&{'prompt':_0x483b58},'model':_0xe09f01,...Rs(_0x409f9f)});return{'getStream':async()=>{const _0x2acf22=(await _0x192de8['request'])['body'];return this['_getStreamReader'](_0x2acf22);},'abortController':_0x192de8['abortController']};}upsertAIChatRating(_0x2bcdb1,_0x48f85b,_0x488e24){const _0x38f13d=this['_sendApiRequest']('/conversations/'+_0x2bcdb1+'/messages/'+_0x48f85b+'/ratings','PUT',{'positiveCount':_0x488e24['positiveCount'],'totalCount':_0x488e24['totalCount'],'modificationId':_0x488e24['modificationId']});return{'execute':async()=>{await _0x38f13d['request'];},'abortController':_0x38f13d['abortController']};}upsertAIActionRating(_0x3d136b,_0x496aaf,_0x467f73){const _0x1f9a73=this['_sendApiRequest']('/actions/system/'+_0x3d136b+'/calls/'+_0x496aaf+'/ratings','PUT',{'positiveCount':_0x467f73['positiveCount'],'totalCount':_0x467f73['totalCount']});return{'execute':async()=>{await _0x1f9a73['request'];},'abortController':_0x1f9a73['abortController']};}upsertCustomAIActionRating(_0x5cd43f,_0x484716){const _0x1d8173=this['_sendApiRequest']('/actions/custom/calls/'+_0x5cd43f+'/ratings','PUT',{'positiveCount':_0x484716['positiveCount'],'totalCount':_0x484716['totalCount']});return{'execute':async()=>{await _0x1d8173['request'];},'abortController':_0x1d8173['abortController']};}upsertAIReviewRating(_0xc359,_0x575cac,_0x285c56,_0x5dbf46){const _0x19fcc4=this['_sendApiRequest']('/reviews/system/'+_0xc359+'/calls/'+_0x575cac+'/ratings','PUT',{'positiveCount':_0x285c56['positiveCount'],'totalCount':_0x285c56['totalCount'],'dataId':_0x5dbf46});return{'execute':async()=>{await _0x19fcc4['request'];},'abortController':_0x19fcc4['abortController']};}upsertCustomAIReviewRating(_0x592a7a,_0x1f5a36,_0x497d3c){const _0x54980a=this['_sendApiRequest']('/reviews/custom/calls/'+_0x592a7a+'/ratings','PUT',{'positiveCount':_0x1f5a36['positiveCount'],'totalCount':_0x1f5a36['totalCount'],'dataId':_0x497d3c});return{'execute':async()=>{await _0x54980a['request'];},'abortController':_0x54980a['abortController']};}_sendApiRequest(_0x44958c,_0x427970,_0x5937cc,_0x11bc10={}){const {apiUrl:_0x4e46ee=this['_apiUrl']}=_0x11bc10,_0x10e585=new AbortController(),_0x200f63=_0x5937cc instanceof FormData,_0x5e2151={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':Lt};_0x5937cc&&!_0x200f63&&(_0x5e2151['Content-Type']='application/json');const _0x41d781={'method':_0x427970,'headers':_0x5e2151,'signal':_0x10e585['signal']};return _0x5937cc&&(_0x41d781['body']=_0x200f63?_0x5937cc:JSON['stringify'](_0x5937cc)),{'request':fetch(''+_0x4e46ee+_0x44958c,_0x41d781)['catch'](_0x513716=>{this['_handleError'](_0x513716);})['then'](_0x35587d=>_0x35587d['ok']?_0x35587d:_0x35587d['json']()['then'](_0x5506ed=>{throw{'url':_0x4e46ee,'path':_0x44958c,'method':_0x427970,'body':_0x5937cc,'status':(_0x35587d||{})['status'],'statusText':(_0x35587d||{})['statusText'],'code':_0x5506ed['code'],'message':_0x5506ed['message'],'traceId':_0x5506ed['traceId'],'data':_0x5506ed['data']};})),'abortController':_0x10e585};}async *_getStreamReader(_0x2ed305){const _0x1978df=[],_0x44c007=_0x2ed305['getReader'](),_0x3551b5=_0x233d05({'onError':_0x562a4e=>{this['_handleError'](_0x562a4e);},'onEvent':_0x3ca018=>{_0x3ca018['data']=JSON['parse'](_0x3ca018['data']),_0x1978df['push'](_0x3ca018);}});try{let _0x5aa936=!0x1;for(;!_0x5aa936;){const {done:_0xff1cbf,value:_0x186256}=await _0x44c007['read']();_0xff1cbf&&(_0x5aa936=!0x0),_0x3551b5['feed'](this['_decoder']['decode'](_0x186256,{'stream':!0x0})),yield*_0x1978df,_0x1978df['length']=0x0;}}catch(_0x80d207){this['_handleError'](_0x80d207);}finally{_0x44c007['releaseLock'](),_0x3551b5['reset']();}}['_handleError'](_0x4e9755){if(_0x4e9755 instanceof ct)throw _0x4e9755;if(_0x4e9755 instanceof Error&&'AbortError'===_0x4e9755['name'])throw new ct('ai-request-aborted',this,{'originalError':_0x4e9755});throw new ct('ai-request-failed',this,{'originalError':_0x4e9755});}};function Rs(_0x280934){return _0x280934?.['length']?{'contexts':_0x280934}:{};}function Os(_0x3decf2,_0x3ac332,_0x565153){const t=_0x3decf2['t'];switch(_0x3ac332){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'},_0x565153);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_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','string':'Created\x20for\x20content\x20that\x20no\x20longer\x20exists.'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP','string':'Created\x20for\x20a\x20previous\x20version\x20of\x20the\x20document\x20and\x20can\x20no\x20longer\x20be\x20applied.'});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.'},_0x565153);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.'},_0x565153);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_LIBRARY_LABEL':return t({'id':'AI_CHAT_CONTEXT_LIBRARY_LABEL','string':'Context\x20library'});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.'},_0x565153);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'},_0x565153);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x565153);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'},_0x565153);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.'},_0x565153);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.'},_0x565153);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.'},_0x565153);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.'},_0x565153);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'},_0x565153);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.'},_0x565153);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.'});default:return _0x3ac332;}}const vs=/* #__PURE__ -- @preserve */
25
+ dt();var ys=class extends vs{_connector;['_config'];['_locale'];_modelList=[];_modelsRequest=null;constructor({connector:_0xd98cb3,config:_0x2c4429,locale:_0x25b5cf}){super(),this['_connector']=_0xd98cb3,this['_config']=_0x2c4429,this['_locale']=_0x25b5cf;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get _defaultModelId(){return this['_config']?.['defaultModelId'];}async getAllModels(){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()['catch'](_0x6ab76c=>{throw this['_modelsRequest']=null,_0x6ab76c;})),this['_modelsRequest'];}async getAvailableModels(){const _0x4e20f6=await this['getAllModels']();let _0x3139ee;return _0x3139ee=this['_availableModels']?this['_filterModels'](_0x4e20f6,this['_availableModels']):_0x4e20f6['filter'](_0x24e5df=>_0x24e5df['recommended']),_0x3139ee;}async['resolveModel'](_0x182ea9){const _0x54f510=await this['getAllModels']();if(!_0x54f510['length'])return null;if(_0x182ea9){const _0x482866=this['_getModelById'](_0x54f510,_0x182ea9);if(_0x482866)return _0x482866;Ot('ai-chat-model-id-unrecognized',{'modelId':_0x182ea9,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async getDefault(){const _0x41ecb1=await this['getAvailableModels']();if(!_0x41ecb1['length'])return null;if(this['_defaultModelId']){const _0x22b8a6=this['_getModelById'](_0x41ecb1,this['_defaultModelId']);if(_0x22b8a6)return _0x22b8a6;Ot('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x41ecb1[0x0]['id']});}return _0x41ecb1[0x0];}async['isAvailable'](_0x4cd942){return(await this['getAvailableModels']())['some'](_0x4a6cc6=>_0x4a6cc6['name']===_0x4cd942['name']&&_0x4a6cc6['provider']===_0x4cd942['provider']);}async getModel(_0x5cc2a1){const _0x4c994a=await this['getAllModels']();return this['_getModelById'](_0x4c994a,_0x5cc2a1)||null;}async _retrieveModels(){if(!this['_modelList']['length']){const _0x350ca2=this['_locale']['uiLanguage']||'en',_0x36c88e=await this['_connector']['getModels'](_0x350ca2)['list']();this['_modelList']=_0x36c88e['items']['map'](_0x352774=>ks(_0x352774)?{..._0x352774,'name':Os(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x352774);}return[...this['_modelList']];}_filterModels(_0x9ac15c,_0xde7728){let _0x1fe498;if(_0xde7728){_0x1fe498=[];const _0x1a608f=new Set(),_0x1dcc62='string'==typeof _0xde7728?[_0xde7728['toLocaleLowerCase']()]:_0xde7728['map'](_0x24e4e0=>_0x24e4e0['toLocaleLowerCase']());for(const _0x1bc7f4 of _0x1dcc62)for(const _0x224b3e of _0x9ac15c)!_0x1a608f['has'](_0x224b3e['id'])&&this['_isMatchingFilter'](_0x224b3e,_0x1bc7f4)&&(_0x1fe498['push'](_0x224b3e),_0x1a608f['add'](_0x224b3e['id']));}else _0x1fe498=_0x9ac15c;return _0x1fe498;}_isMatchingFilter(_0x27eaf7,_0x332762){const _0x396d1a=_0x27eaf7['id']['toLocaleLowerCase'](),_0x3d10c2=_0x27eaf7['name']['toLocaleLowerCase'](),_0x15c21d=_0x27eaf7['provider']['toLocaleLowerCase']();return _0x396d1a===_0x332762||_0x3d10c2===_0x332762||ks(_0x27eaf7)&&'auto'===_0x332762||_0x15c21d===_0x332762||_0x396d1a['startsWith'](_0x332762);}_getModelById(_0x265138,_0x3f5cb9){return _0x265138['find'](_0x552d51=>ks(_0x552d51)&&'auto'===_0x3f5cb9?_0x552d51:_0x552d51['id']===_0x3f5cb9)||null;}};function ks(_0x1227da){return _0x1227da['id']['startsWith']('agent');}var Ns=class{_connector;_defaultContext;_contextsRequest=null;constructor({connector:_0x2d52a9,defaultContext:_0x4efdbc}){this['_connector']=_0x2d52a9,this['_defaultContext']=_0x4efdbc;}async getAllContexts(){return this['_contextsRequest']||(this['_contextsRequest']=this['_connector']['listContexts']()['getContexts']()['catch'](_0x21bd9f=>{throw this['_contextsRequest']=null,_0x21bd9f;})),[...await this['_contextsRequest']];}async getAvailableContexts(){const _0xbb380f=await this['getAllContexts'](),_0x1a6d83=new Set((this['_defaultContext']??[])['map'](_0x115888=>_0x115888['id']));return _0xbb380f['filter'](_0x1e0f1c=>!_0x1a6d83['has'](_0x1e0f1c['id']));}resolveContext({feature:_0x10cd6a,ids:_0xe8cfbc=[],extraContexts:_0x550959=[],idScopedOnly:_0x55bfb7=!0x1,context:_0x298aad}){const _0x3ad008=this['_resolveDefaultContext'](_0x10cd6a,_0xe8cfbc,_0x55bfb7);return _0x298aad['addDefaultContext']([..._0x3ad008,..._0x550959]),_0x298aad;}_resolveDefaultContext(_0x36a7be,_0x17d2ef,_0x54896d=!0x1){if(!this['_defaultContext'])return[];const _0x3b670f=[];for(const _0x11e02f of this['_defaultContext'])this['_entryAppliesToFeature'](_0x11e02f['features'],_0x36a7be,_0x17d2ef)&&(_0x54896d&&this['_entryAppliesToFeature'](_0x11e02f['features'],_0x36a7be,[])||_0x3b670f['push'](this['_toContextRef'](_0x11e02f)));return _0x3b670f;}_toContextRef(_0x772b5a){return'promptId'in _0x772b5a?{'id':_0x772b5a['id'],'promptId':_0x772b5a['promptId']}:'fileId'in _0x772b5a?{'id':_0x772b5a['id'],'fileId':_0x772b5a['fileId']}:{'id':_0x772b5a['id']};}_entryAppliesToFeature(_0x32bc08,_0x3b0131,_0x28d65b){if(!_0x32bc08)return!0x0;const _0xa15413=_0x32bc08[_0x3b0131];return!!_0xa15413&&(!0x0===_0xa15413||_0x28d65b['some'](_0x5dbdc6=>_0xa15413['test'](_0x5dbdc6)));}},xs=class extends _0x338e6f{['models'];contextLibrary;static get['pluginName'](){return'AICore';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[Ss];}init(){const _0x21f18b=this['context']['plugins']['get'](Ss);this['models']=new ys({'connector':_0x21f18b,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),this['contextLibrary']=new Ns({'connector':_0x21f18b,'defaultContext':this['context']['config']['get']('ai.defaultContext')});}};function Ls(_0x58989d){return _0x58989d?_0x58989d instanceof _0x36c7af?[_0x58989d]:_0x58989d['editors']&&0x0!==_0x58989d['editors']['length']?Array['from'](_0x58989d['editors']):[]:[];}function Ds(_0x572c31){const _0x586ccb=Ls(_0x572c31);if(!_0x586ccb['length'])throw new ct('ai-get-editor-from-context-no-editor');if(0x1===_0x586ccb['length'])return _0x586ccb[0x0];const _0x348b04=_0x586ccb['find'](_0x1b809c=>_0x1b809c['ui']?.['focusTracker']?.['isFocused']);if(_0x348b04)return _0x348b04;const _0xac46b5=function(_0x107765){if(_0x107765 instanceof _0x36c7af)return;const _0x1669b1=_0x107765;if(!_0x1669b1['plugins']||!_0x1669b1['plugins']['has']('AIEditing'))return;return _0x1669b1['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x572c31);return _0xac46b5&&_0x586ccb['includes'](_0xac46b5)?_0xac46b5:_0x586ccb[0x0];}function Ps(_0x50ee5e,_0x8eece0){return _0x67d3bf(_0x50ee5e,_0x8eece0);}function Hs(_0x398434,_0x3c842f){return _0x2a51a3(_0x398434,_0x3c842f);}function Ms(_0x3eee63,_0x318b61,_0x59c55e){const _0x460b59=null!==_0x318b61?_0x1739f5=>_0x1739f5['attribs'][_0x3eee63]===_0x318b61:_0x42872d=>Boolean(_0x42872d['attribs'][_0x3eee63]);return _0x580dea(_0x26c076=>_0x5ebc36(_0x26c076)&&_0x460b59(_0x26c076),_0x59c55e);}function Us(_0x27da76,_0x5b6207,_0x39dad2){const _0x41ed39=null!==_0x5b6207?_0x27b1fe=>_0x27b1fe['attribs'][_0x27da76]===_0x5b6207:_0x38a5b1=>Boolean(_0x38a5b1['attribs'][_0x27da76]);return _0x4b5d81(_0x4d8727=>_0x5ebc36(_0x4d8727)&&_0x41ed39(_0x4d8727),_0x39dad2);}function Vs(_0x4eb02a){return _0x4b5d81(_0xcc2a1d=>_0x5ebc36(_0xcc2a1d)&&function(_0x4c211c){const _0x6da29b=_0x4c211c['toLowerCase']();return'script'===_0x6da29b||'style'===_0x6da29b||_0x6da29b['includes']('-');}(_0xcc2a1d['name']),_0x4eb02a);}const Bs=['comment-start','comment-end','suggestion-start','suggestion-end'];function Gs(_0x192f0d){return _0x5ebc36(_0x192f0d)&&Bs['includes'](_0x192f0d['name']['toLowerCase']());}function Ks(_0x2e825f){return _0x2955be(_0x348871=>_0x3b1aa0(_0x348871),_0x2e825f,!0x0,0x1/0x0);}function Fs(_0x4a0079,_0x4f0117){return _0x4a0079&&_0x5ebc36(_0x4a0079)?_0x4a0079['attribs'][_0x4f0117]:null;}function Ws(_0x550b5b,_0x2852ab,_0x38adb4){_0x5ebc36(_0x550b5b)&&(null===_0x38adb4?delete _0x550b5b['attribs'][_0x2852ab]:_0x550b5b['attribs'][_0x2852ab]=_0x38adb4);}function $s(_0x42f0b6,_0x2e4310,_0x548606){const _0x145516=_0x2e4310['cloneNode'](!0x0);'beforebegin'===_0x548606?_0x4c725e(_0x42f0b6,_0x145516):'afterbegin'===_0x548606?_0x151e71(_0x42f0b6,_0x145516):'beforeend'===_0x548606?_0x252f1a(_0x42f0b6,_0x145516):'afterend'===_0x548606&&_0x54a4aa(_0x42f0b6,_0x145516);}function Ys(_0x34634e){const _0x52842a=[];let _0x1da48d=_0x34634e;for(;_0x1da48d;)_0x1da48d=_0x1f2119(_0x1da48d),_0x1da48d&&_0x52842a['push'](_0x1da48d);return _0x52842a;}function qs(_0x2765cd){return _0x2765cd['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Qs(_0x3d56c0){let _0xbd698e=0x0;for(;_0x3d56c0['parentNode'];)_0x3d56c0=_0x3d56c0['parentNode'],_0xbd698e++;return _0xbd698e;}function Xs(_0x570a86){const _0x1d6685=[];let _0x2c68df=_0x570a86['nextSibling'];for(;_0x2c68df;)_0x1d6685['push'](_0x2c68df),_0x2c68df=_0x2c68df['nextSibling'];_0x1d6685['forEach'](_0x16f3b0=>{_0x3339cd(_0x16f3b0);});}function zs(_0x567a08,_0x4bad6d){return!!_0x567a08['model']['document']['getRoot'](_0x4bad6d)&&!_0x186e8a(_0x567a08,_0x4bad6d);}function js(_0x47c2c2,_0x2d9c43){return'<p\x20data-id=\x22'+_0x2d9c43+'\x22>'+_0x47c2c2+'</p>';}function Js(_0x38f4c5){return'p'===_0x38f4c5['name']['toLowerCase']()&&Boolean(_0x38f4c5['attribs']['data-id']);}function Zs(_0x368925){const _0x1e4fb2=Ps(_0x368925)['children']['filter'](_0x5ebc36);return 0x1===_0x1e4fb2['length']&&Js(_0x1e4fb2[0x0])?_0x1e4fb2[0x0]['children']['map'](_0x40e6ec=>Hs(_0x40e6ec))['join'](''):_0x368925;}function tn(_0x2880cb,_0x361863){const _0x3e8b09=function(_0x276ff2){const _0x1957f1=_0x276ff2['children']['filter'](_0x5ebc36);return 0x1===_0x1957f1['length']&&Js(_0x1957f1[0x0])?_0x1957f1[0x0]['children']:_0x276ff2['children'];}(_0x361863),{blockElements:_0x46f6a2}=_0x2880cb['editing']['view']['domConverter'],_0x3394fe=_0x57e647=>_0x57e647['some'](_0x4df233=>_0x5ebc36(_0x4df233)&&('p'!==_0x4df233['name']['toLowerCase']()&&_0x46f6a2['includes'](_0x4df233['name']['toLowerCase']())||_0x3394fe(_0x4df233['children'])));if(_0x3394fe(_0x3e8b09))return!0x1;const _0x369c48=_0x3e8b09['map'](_0x4e2afe=>Hs(_0x4e2afe))['join'](''),_0x247ae0=_0x2880cb['data']['parse'](_0x369c48,'$root'),{schema:_0x4e1e5d}=_0x2880cb['model'];let _0x5a7e38=0x0;for(const {item:_0x31e4ba}of _0x2880cb['model']['createRangeIn'](_0x247ae0))if(_0x31e4ba['is']('element')&&_0x4e1e5d['isBlock'](_0x31e4ba)&&(++_0x5a7e38>0x1||'paragraph'!==_0x31e4ba['name']))return!0x1;return!0x0;}function en(_0x5d346f,_0x44ed5e){const _0x2a9af7=_0x44ed5e['filter'](_0x1ae626=>'new'!=_0x1ae626['type'])['map'](_0x9e5ca5=>Ms('data-id',_0x9e5ca5['id'],_0x5d346f))['filter'](_0x1116a1=>null!==_0x1116a1),_0x2ad8fd=_0x44ed5e['filter'](_0x76582e=>'removed'!=_0x76582e['type'])['map'](_0x2dd03c=>_0x2dd03c['node']['cloneNode'](!0x0));let _0x1c3893=null;if(_0x2a9af7['length']){_0x1c3893=_0x2a9af7[0x0]['previousSibling'];for(let _0x50e7d5=0x0;_0x50e7d5<_0x2a9af7['length'];_0x50e7d5++)_0x3339cd(_0x2a9af7[_0x50e7d5]);}if(_0x2ad8fd['length']){_0x1c3893||(_0x44ed5e[0x0]['anchorId']?_0x1c3893=Ms('data-id',_0x44ed5e[0x0]['anchorId'],_0x5d346f):(_0x1c3893=_0x2ad8fd['shift'](),_0x151e71(_0x5d346f,_0x1c3893)));for(let _0x48705f=0x0;_0x48705f<_0x2ad8fd['length'];_0x48705f++)_0x54a4aa(_0x1c3893,_0x2ad8fd[_0x48705f]),_0x1c3893=_0x2ad8fd[_0x48705f];}}function sn(_0x3f311b,_0x33b003){const _0x50eb47=new Set();for(const _0x5a831b of _0x3f311b){if(!_0x5a831b['editor']||'destroyed'===_0x5a831b['editor']['state']||!zs(_0x5a831b['editor'],_0x5a831b['rootName']))continue;const _0x18d7a7=_0x33b003['get'](_0x5a831b['documentId']);let _0x3d15fe;_0x18d7a7?(_0x3d15fe=_0x18d7a7['cloneNode'](!0x0),en(_0x3d15fe,_0x5a831b['changes'])):_0x3d15fe=new _0x481874(_0x5a831b['changes']['filter'](_0x35735a=>'removed'!=_0x35735a['type'])['map'](_0x3d604e=>_0x3d604e['node']['cloneNode'](!0x0))),tn(_0x5a831b['editor'],_0x3d15fe)||_0x50eb47['add'](_0x5a831b['index']);}return _0x50eb47;}function nn(_0x401910,_0x224d53,_0x38d9d7,_0x4f1996){return zs(_0x401910,_0x224d53)?tn(_0x401910,Ps(_0x4f1996))?{'before':Zs(_0x38d9d7),'after':Zs(_0x4f1996)}:null:{'before':_0x38d9d7,'after':_0x4f1996};}function rn(_0x1e87a9,_0x4a99ab){return _0x15497c(_0x1e87a9,_0x4a99ab);}function on(_0x1c8765,_0x59665c){return _0x1c8765['map'](_0x30668e=>null!==_0x30668e&&'object'==typeof _0x30668e?rn(_0x30668e,_0x59665c):_0x30668e);}function an(_0x54e93b){return _0x54e93b instanceof RegExp?String(_0x54e93b):Array['isArray'](_0x54e93b)?_0x54e93b['map'](_0x4888bd=>an(_0x4888bd)):null!==_0x54e93b&&'object'==typeof _0x54e93b?Object['fromEntries'](Object['entries'](_0x54e93b)['map'](([_0x1cfce0,_0x3fb39c])=>[_0x1cfce0,an(_0x3fb39c)])):_0x54e93b;}const hn=[['BlockQuoteEditing','blockQuote'],['BoldEditing','bold'],['BookmarkEditing','bookmark'],['CodeEditing','code'],['HorizontalLineEditing','horizontalLine'],['HtmlEmbedEditing','htmlEmbed'],['ItalicEditing','italic'],['MathType','math'],['PageBreakEditing','pageBreak'],['Paragraph','paragraph'],['StandardEditingModeEditing','restrictedEditing'],['StrikethroughEditing','strikethrough'],['SubscriptEditing','subscript'],['SuperscriptEditing','superscript'],['TableOfContentsEditing','tableOfContents'],['Title','title'],['TodoListEditing','todoList'],['UnderlineEditing','underline']];function cn(_0x2394b6){const _0x582da4={};if(_0x2394b6['plugins']['has']('AlignmentEditing')&&(_0x582da4['alignment']=_0x2394b6['config']['get']('alignment')),_0x2394b6['plugins']['has']('CodeBlockEditing')&&(_0x582da4['codeBlock']=_0x2394b6['config']['get']('codeBlock')),_0x2394b6['plugins']['has']('FontBackgroundColorEditing')&&(_0x582da4['fontBackgroundColor']=rn(_0x2394b6['config']['get']('fontBackgroundColor'),['documentColors','columns','colorPicker'])),_0x2394b6['plugins']['has']('FontColorEditing')&&(_0x582da4['fontColor']=rn(_0x2394b6['config']['get']('fontColor'),['documentColors','columns','colorPicker'])),_0x2394b6['plugins']['has']('FontFamilyEditing')&&(_0x582da4['fontFamily']=_0x2394b6['config']['get']('fontFamily'),_0x582da4['fontFamily']&&_0x582da4['fontFamily']['options']&&(_0x582da4['fontFamily']['options']=on(_0x582da4['fontFamily']['options'],['model','upcastAlso']))),_0x2394b6['plugins']['has']('FontSizeEditing')&&(_0x582da4['fontSize']=_0x2394b6['config']['get']('fontSize'),_0x582da4['fontSize']&&_0x582da4['fontSize']['options']&&(_0x582da4['fontSize']['options']=on(_0x582da4['fontSize']['options'],['upcastAlso']))),_0x2394b6['plugins']['has']('FootnotesEditing')){const _0x23d159=_0x2394b6['config']['get']('footnotes')??{};_0x23d159['footnotesProperties']&&'object'==typeof _0x23d159['footnotesProperties']&&(_0x23d159['footnotesProperties']=rn(_0x23d159['footnotesProperties'],['toolbar','listStyles'])),_0x582da4['footnotes']=_0x23d159;}if(_0x2394b6['plugins']['has']('GeneralHtmlSupport')){const _0x56d007=_0x2394b6['config']['get']('htmlSupport');_0x56d007&&(_0x582da4['htmlSupport']=an(rn(_0x56d007,['preserveEmptyBlocksInEditingView','htmlIframeSandbox','fullPage'])));}if(_0x2394b6['plugins']['has']('HeadingEditing')&&(_0x582da4['heading']=_0x2394b6['config']['get']('heading'),_0x582da4['heading']&&_0x582da4['heading']['options']&&(_0x582da4['heading']['options']=on(_0x582da4['heading']['options'],['model','icon','class','converterPriority','upcastAlso']))),_0x2394b6['plugins']['has']('HighlightEditing')&&(_0x582da4['highlight']=_0x2394b6['config']['get']('highlight'),_0x582da4['highlight']&&_0x582da4['highlight']['options']&&(_0x582da4['highlight']['options']=on(_0x582da4['highlight']['options'],['model','color']))),_0x2394b6['plugins']['has']('ImageBlockEditing')||_0x2394b6['plugins']['has']('ImageInlineEditing')){const _0x61b916=rn(_0x2394b6['config']['get']('image'),['toolbar','upload','insert','resizeOptions']);_0x2394b6['plugins']['has']('ImageResizeEditing')||delete _0x61b916['resizeUnit'],_0x2394b6['plugins']['has']('ImageStyleEditing')?_0x61b916['styles']?.['options']&&(_0x61b916['styles']['options']=on(_0x61b916['styles']['options'],['icon'])):delete _0x61b916['styles'],_0x582da4['image']=_0x61b916;}if(_0x2394b6['plugins']['has']('IndentBlock')&&(_0x582da4['indentBlock']=_0x2394b6['config']['get']('indentBlock')),_0x2394b6['plugins']['has']('LineHeightEditing')&&(_0x582da4['lineHeight']=_0x2394b6['config']['get']('lineHeight'),_0x582da4['lineHeight']&&(delete _0x582da4['lineHeight']['supportAllValues'],_0x582da4['lineHeight']['options']&&(_0x582da4['lineHeight']['options']=on(_0x582da4['lineHeight']['options'],['model'])))),_0x2394b6['plugins']['has']('LinkEditing')&&(_0x582da4['link']=rn(_0x2394b6['config']['get']('link'),['toolbar'])),_0x2394b6['plugins']['has']('ListEditing')){const _0xdb22c2=_0x2394b6['config']['get']('list')??{};delete _0xdb22c2['enableListItemMarkerFormatting'],_0x2394b6['plugins']['has']('ListPropertiesEditing')?_0xdb22c2['properties']&&_0xdb22c2['properties']['styles']&&'object'==typeof _0xdb22c2['properties']['styles']&&(_0xdb22c2['properties']['styles']=rn(_0xdb22c2['properties']['styles'],['listStyleTypes'])):delete _0xdb22c2['properties'],_0x582da4['list']=_0xdb22c2;}if(_0x2394b6['plugins']['has']('MediaEmbedEditing')&&(_0x582da4['mediaEmbed']=_0x2394b6['config']['get']('mediaEmbed'),_0x582da4['mediaEmbed']&&(delete _0x582da4['mediaEmbed']['toolbar'],_0x2394b6['plugins']['has']('MediaEmbedResizeEditing')?_0x582da4['mediaEmbed']['resizeOptions']&&(_0x582da4['mediaEmbed']['resizeOptions']=_0x582da4['mediaEmbed']['resizeOptions']['map'](_0x24aba8=>rn(_0x24aba8,['icon','label']))):delete _0x582da4['mediaEmbed']['resizeOptions'],_0x2394b6['plugins']['has']('MediaEmbedStyleEditing')?_0x582da4['mediaEmbed']['styles']&&_0x582da4['mediaEmbed']['styles']['options']&&(_0x582da4['mediaEmbed']['styles']['options']=on(_0x582da4['mediaEmbed']['styles']['options'],['icon','title'])):delete _0x582da4['mediaEmbed']['styles'])),_0x2394b6['plugins']['has']('MultiLevelListEditing')&&(_0x582da4['listMultiLevel']=_0x2394b6['config']['get']('listMultiLevel')??{}),_0x2394b6['plugins']['has']('MentionEditing')){const _0x5f0255=rn(_0x2394b6['config']['get']('mention'),['commitKeys','dropdownLimit']);_0x5f0255['feeds']&&(_0x5f0255['feeds']=_0x5f0255['feeds']['map'](_0x554f6b=>rn(_0x554f6b,['minimumCharacters','itemRenderer','dropdownLimit']))),_0x582da4['mention']=_0x5f0255;}if(_0x2394b6['plugins']['has']('MergeFieldsEditing')){const _0x25f283=rn(_0x2394b6['config']['get']('mergeFields'),['previewModes','initialPreviewMode','previewHtmlValues','sanitizeHtml']);Array['isArray'](_0x25f283['definitions'])&&(_0x25f283['definitions']=_0x25f283['definitions']['map'](_0x1e6a40=>'groupId'in _0x1e6a40?(Array['isArray'](_0x1e6a40['definitions'])&&(_0x1e6a40['definitions']=_0x1e6a40['definitions']['map'](_0x3ff4d7=>rn(_0x3ff4d7,['defaultValue']))),_0x1e6a40):rn(_0x1e6a40,['defaultValue']))),_0x582da4['mergeFields']=_0x25f283;}if(_0x2394b6['plugins']['has']('StyleEditing')&&(_0x582da4['style']=_0x2394b6['config']['get']('style')),_0x2394b6['plugins']['has']('TableEditing')){const _0x7d8edc=rn(_0x2394b6['config']['get']('table'),['contentToolbar','tableToolbar','showHiddenBorders']);_0x2394b6['plugins']['has']('TablePropertiesEditing')?_0x7d8edc['tableProperties']&&'object'==typeof _0x7d8edc['tableProperties']&&(_0x7d8edc['tableProperties']=rn(_0x7d8edc['tableProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x7d8edc['tableProperties'],_0x2394b6['plugins']['has']('TableCellPropertiesEditing')?_0x7d8edc['tableCellProperties']&&'object'==typeof _0x7d8edc['tableCellProperties']&&(_0x7d8edc['tableCellProperties']=rn(_0x7d8edc['tableCellProperties'],['colorPicker','borderColors','backgroundColors'])):delete _0x7d8edc['tableCellProperties'],_0x2394b6['plugins']['has']('TableLayoutEditing')?_0x7d8edc['tableLayout']||(_0x7d8edc['tableLayout']={}):delete _0x7d8edc['tableLayout'],_0x2394b6['plugins']['has']('TableCaptionEditing')?_0x7d8edc['tableCaption']||(_0x7d8edc['tableCaption']={}):delete _0x7d8edc['tableCaption'],_0x582da4['table']=_0x7d8edc;}_0x2394b6['plugins']['has']('TextPartLanguageEditing')&&(_0x582da4['textPartLanguage']=_0x2394b6['config']['get']('language.textPartLanguage'));for(const [_0xee9c75,_0x38b9a5]of hn)_0x2394b6['plugins']['has'](_0xee9c75)&&(_0x582da4[_0x38b9a5]={});return _0x582da4;}const ln='ai-selection',un=['br'];var dn=class extends _0x338e6f{constructor(_0x476f58){super(_0x476f58),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}_outputDataProcessor;_fakeSelections=[];_sessionIdByEditor=new WeakMap();_editorsToConfigs=new WeakMap();_lastContentFocusedEditor;static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}getLastContentFocusedEditor(){return this['_lastContentFocusedEditor'];}getSessionId(_0x318ae9){let _0xa25c8=this['_sessionIdByEditor']['get'](_0x318ae9);return _0xa25c8||(_0xa25c8=_0x318ae9['plugins']['has']('RealTimeCollaborationClient')&&_0x318ae9['plugins']['get']('RealTimeCollaborationClient')['sessionId']||xt(),this['_sessionIdByEditor']['set'](_0x318ae9,_0xa25c8)),_0xa25c8;}async getDocumentData(_0x1dfcfa){const _0x271e5f=Ls(this['context']),_0x435f69=[],_0x281cd4=new Set();for(const _0x18a8d0 of _0x271e5f){if(_0x1dfcfa&&!_0x1dfcfa['has'](_0x18a8d0['config']['get']('collaboration.channelId')))continue;const _0x6e5a76=_0x18a8d0['config']['get']('roots')||{},_0xed4a8d=this['_getEditorSelectionSignature'](_0x18a8d0),_0x425711=_0x18a8d0['config']['get']('collaboration.channelId'),_0x4a84cc=this['getSessionId'](_0x18a8d0);for(const _0x1f8ce9 of _0x18a8d0['model']['document']['getRoots']()){if('$graveyard'===_0x1f8ce9['rootName'])continue;const _0x2f7b3=await this['_getDocumentDataForEditorRoot'](_0x18a8d0,_0x1f8ce9,_0x281cd4),_0x1579fd=_0x6e5a76[_0x1f8ce9['rootName']],_0x36d525=_0x1f8ce9['getAttribute']('$description')??_0x1579fd?.['description'];let _0x192c4e=_0x1f8ce9['getAttribute']('$title')??_0x1579fd?.['title'];_0x192c4e||(_0x192c4e=_0x1f8ce9['getAttribute']('$rootEditableOptions')?.['label']??_0x1579fd?.['label']),_0x192c4e||(Ot('ai-document-root-missing-title',{'editor':_0x18a8d0,'rootName':_0x1f8ce9['rootName']}),_0x192c4e=_0x1f8ce9['rootName']),_0x435f69['push']({'editor':_0x18a8d0,'rootName':_0x1f8ce9['rootName'],'content':_0x2f7b3['content'],'version':_0x2f7b3['version'],'sessionId':_0x4a84cc,'channelId':_0x425711,'selections':_0x2f7b3['selections'],'selectionSignature':_0xed4a8d,'editorConfig':this['_getEditorConfig'](_0x18a8d0),'name':_0x192c4e,'description':_0x36d525});}}return _0x435f69;}getEditorsVersions(){const _0x10988a=Ls(this['context']),_0x4eacb2=new Map();for(const _0x23ddbf of _0x10988a){const _0xea2667=_0x23ddbf['config']['get']('collaboration.channelId');_0x4eacb2['set'](_0xea2667,_0x23ddbf['model']['document']['version']);}return _0x4eacb2;}getEditorsSelections(){const _0x5d2881=Ls(this['context']),_0x342e08=new Map();for(const _0x3b356f of _0x5d2881){const _0x75f199=_0x3b356f['config']['get']('collaboration.channelId'),_0x3850e5=this['_getEditorSelectionSignature'](_0x3b356f);_0x342e08['set'](_0x75f199,_0x3850e5);}return _0x342e08;}_getEditorSelectionSignature(_0x5ce1de){return this['_getMarkersInDocumentOrder'](_0x5ce1de)['map'](_0x25aad0=>{const _0x43e1b1=_0x25aad0['getRange']();return _0x43e1b1['root']['rootName']+':'+_0x43e1b1['start']['path']['join']('.')+'-'+_0x43e1b1['end']['path']['join']('.');})['join']('|');}async _getDocumentDataForEditorRoot(_0x41b478,_0x40e9ad,_0x14dbf8){const _0x46505b=_0x41b478['data']['toView'](_0x40e9ad,{'convertAiChatSelectionMarker':!0x0}),_0x2cc802=new _0x1614f9(_0x41b478['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x46505b,_0x2cc802,_0x14dbf8);let _0x4fdde8=await this['_getDocumentDataStringFromView'](_0x46505b,_0x41b478);zs(_0x41b478,_0x40e9ad['rootName'])&&(_0x4fdde8=js(_0x4fdde8,this['_nextDataId'](_0x14dbf8)));const _0x50c0a6=this['_getMarkersInDocumentOrder'](_0x41b478,_0x40e9ad),_0x2fe9fe=[];for(const _0x118e53 of _0x50c0a6){const _0x48c2ad='<'+_0x118e53['name']+':start></'+_0x118e53['name']+':start>',_0x2752d4=_0x4fdde8['indexOf'](_0x48c2ad);_0x4fdde8=_0x4fdde8['substring'](0x0,_0x2752d4)+_0x4fdde8['substring'](_0x2752d4+_0x48c2ad['length']);const _0x5eeded='<'+_0x118e53['name']+':end></'+_0x118e53['name']+':end>',_0x2f445a=_0x4fdde8['indexOf'](_0x5eeded);_0x4fdde8=_0x4fdde8['substring'](0x0,_0x2f445a)+_0x4fdde8['substring'](_0x2f445a+_0x5eeded['length']),_0x2fe9fe['push']({'markerName':_0x118e53['name'],'start':_0x2752d4,'end':_0x2f445a,'htmlFragment':_0x4fdde8['substring'](_0x2752d4,_0x2f445a)});}return{'content':_0x4fdde8,'version':_0x41b478['model']['document']['version'],'selections':_0x2fe9fe};}afterInit(){this['context']instanceof _0x36c7af?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x1c5453,_0x272153)=>{_0x272153['on']('ready',()=>{this['_integrateEditor'](_0x272153);});});}_setOutputDataProcessor(_0x4b5ca0){this['_outputDataProcessor']=_0x4b5ca0;}async _getDocumentDataStringFromView(_0x1ead12,_0x144ee1){let _0x637dd6;if(this['_outputDataProcessor']){const _0x210129=_0x144ee1['data']['processor']['domConverter']['viewToDom'](_0x1ead12),_0x280c4d=await this['_outputDataProcessor'](_0x210129);_0x637dd6=_0x144ee1['data']['processor']['htmlWriter']['getHtml'](_0x280c4d);}else _0x637dd6=_0x144ee1['data']['processor']['toData'](_0x1ead12);return _0x637dd6;}_integrateEditor(_0x4b30a9){if(!_0x4b30a9['config']['get']('collaboration.channelId'))throw new ct('ai-missing-channel-id',_0x4b30a9);_0x4b30a9['ui']['focusTracker']['on']('change:isFocused',(_0x1584c5,_0x916a3f,_0x5d190c)=>{_0x5d190c&&(this['_lastContentFocusedEditor']=_0x4b30a9);}),_0x4b30a9['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x4b30a9&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x4b30a9['conversion']['for']('editingDowncast')['markerToHighlight']({'model':ln,'view':({markerName:_0x6518dc})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x6518dc['split'](':')[0x1]],'priority':0xc})}),_0x4b30a9['conversion']['for']('dataDowncast')['markerToElement']({'model':ln+':context','view':(_0x53bf70,{writer:_0x478507,options:_0x27058e})=>_0x27058e['convertAiChatSelectionMarker']?_0x478507['createUIElement'](_0x53bf70['markerName']+':'+(_0x53bf70['isOpening']?'start':'end')):null});}showFakeVisualSelection(_0x351388){const _0x2d093a=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x351388);const _0x531e91=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x2d093a,_0x531e91);}hideFakeVisualSelection(_0x5ccffb){const _0x3ee926=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x5ccffb);const _0x33d289=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x3ee926,_0x33d289);}async modelToDataWithIds(_0x4bd85e,_0x432fe9,_0x3181d7){const _0x354aad=_0x432fe9['data']['toView'](_0x4bd85e),_0x537a1f=new _0x1614f9(_0x432fe9['editing']['view']['document']),_0x4c2da1=new Set();this['_setDataIdsOnChildren'](_0x354aad,_0x537a1f,_0x4c2da1);const _0x40f472=await this['_getDocumentDataStringFromView'](_0x354aad,_0x432fe9);return _0x3181d7&&zs(_0x432fe9,_0x3181d7)?js(_0x40f472,this['_nextDataId'](_0x4c2da1)):_0x40f472;}_setDataIdsOnChildren(_0x51bee2,_0xfd7bcf,_0x3387f7=new Set()){let _0x4d0d9a=!0x1;for(const _0xe9d976 of _0x51bee2['getChildren']()){if(!_0xe9d976['is']('view:element')||un['includes'](_0xe9d976['name']))continue;const _0x1205a0=_0xe9d976['is']('view:containerElement'),_0x194717=_0xe9d976['is']('view:emptyElement'),_0x24bf43=_0xe9d976['is']('view:rawElement'),_0x5684dd=this['_setDataIdsOnChildren'](_0xe9d976,_0xfd7bcf,_0x3387f7);_0xe9d976['hasAttribute']('data-id')?(_0x4d0d9a=!0x0,_0x3387f7['add'](_0xe9d976['getAttribute']('data-id'))):(_0x1205a0||_0x194717||_0x24bf43||_0x5684dd)&&(_0xfd7bcf['setAttribute']('data-id',this['_nextDataId'](_0x3387f7),_0xe9d976),_0x4d0d9a=!0x0);}return _0x4d0d9a;}_nextDataId(_0x1f2d1c){let _0x7a2750;do{_0x7a2750='';for(let _0x1fea5d=0x0;_0x1fea5d<0x4;_0x1fea5d++)_0x7a2750+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x1f2d1c['has'](_0x7a2750));return _0x1f2d1c['add'](_0x7a2750),_0x7a2750;}getSelectionText(_0x16af55){const _0x474979=(_0x16af55?_0x16af55['model']:Ds(this['context'])['model'])['document']['selection'],_0x4ef978=[],_0x2e53ab=Array['from'](_0x474979['getRanges']());_0x2e53ab['sort']((_0x4ac765,_0x38eb3c)=>_0x4ac765['start']['isBefore'](_0x38eb3c['start'])?-0x1:0x1);for(const _0x26a56c of _0x2e53ab)for(const _0xf0c67c of _0x26a56c['getItems']())_0xf0c67c['is']('$textProxy')?_0x4ef978['push'](_0xf0c67c['data']):_0xf0c67c['is']('element')&&_0x4ef978['length']>0x0&&'\x20'!==_0x4ef978[_0x4ef978['length']-0x1]&&_0x4ef978['push']('\x20');return _0x4ef978['length']?'\x22'+_0x4ef978['join']('')['trim']()+'\x22':Os(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}_removeFakeSelectionById(_0x329012){for(let _0x2c6a93=0x0;_0x2c6a93<this['_fakeSelections']['length'];_0x2c6a93++)if(this['_fakeSelections'][_0x2c6a93]['id']==_0x329012)return void this['_fakeSelections']['splice'](_0x2c6a93,0x1);}_addFakeSelection(_0x4599ed){this['_removeFakeSelectionById'](_0x4599ed['id']),Ct(this['_fakeSelections'],_0x4599ed);}_refreshFakeSelection(_0x16dc6a,_0x362038){if(_0x16dc6a==_0x362038)return;const _0x18b571=_0x16dc6a?_0x16dc6a['editor']:null,_0x317f46=_0x362038?_0x362038['editor']:null,_0x4754bc=(_0x3e69b8,_0x7d0ea5)=>{const _0x226b03=_0x7d0ea5['model']['markers']['getMarkersGroup'](ln);for(const _0x2c4a10 of _0x226b03)_0x3e69b8['removeMarker'](_0x2c4a10);},_0x583934=(_0x4e52db,_0x169d50,_0x22f5e1)=>{const _0x50c37f=_0x169d50['model'];for(let _0x3a4714=0x0;_0x3a4714<_0x22f5e1['ranges']['length'];_0x3a4714++){let _0x31ab4d=_0x22f5e1['ranges'][_0x3a4714];const _0x24b4ca=ln+':'+_0x22f5e1['id']+':'+_0x3a4714;if(_0x31ab4d['start']['isAtEnd']){const _0x49c2a1=_0x31ab4d['start']['getLastMatchingPosition'](({item:_0x37f182})=>!_0x50c37f['schema']['isContent'](_0x37f182),{'boundaries':_0x31ab4d});_0x31ab4d=_0x4e52db['createRange'](_0x49c2a1,_0x31ab4d['end']);}_0x4e52db['addMarker'](_0x24b4ca,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x31ab4d});}};_0x18b571&&_0x317f46&&_0x18b571===_0x317f46&&_0x362038?_0x18b571['model']['change'](_0x377d2f=>{_0x4754bc(_0x377d2f,_0x18b571),_0x583934(_0x377d2f,_0x317f46,_0x362038);}):(_0x18b571&&_0x18b571['model']['change'](_0xf06f=>_0x4754bc(_0xf06f,_0x18b571)),_0x317f46&&_0x362038&&_0x317f46['model']['change'](_0x63831d=>_0x583934(_0x63831d,_0x317f46,_0x362038)));}_getMarkersInDocumentOrder(_0x3bb46e,_0x219228){const _0x92544c=Array['from'](_0x3bb46e['model']['markers']['getMarkersGroup'](ln+':context'));return(_0x219228?_0x92544c['filter'](_0x5dc1b3=>{const _0x41a907=_0x5dc1b3['getRange']();return _0x41a907&&_0x41a907['root']['rootName']===_0x219228['rootName'];}):_0x92544c)['sort']((_0x7e4af1,_0x2b7c5c)=>_0x7e4af1['getStart']()['isBefore'](_0x2b7c5c['getStart']())?-0x1:_0x7e4af1['getStart']()['isAfter'](_0x2b7c5c['getStart']())?0x1:0x0);}_getEditorConfig(_0x59c8f6){let _0x364a7d=this['_editorsToConfigs']['get'](_0x59c8f6);return _0x364a7d||(_0x364a7d=cn(_0x59c8f6),this['_editorsToConfigs']['set'](_0x59c8f6,_0x364a7d)),_0x364a7d;}},_n=class extends _0x338e6f{['licenseKey'];_licenseKeyCheckInterval;static get['pluginName'](){return'DocumentChangesUtils';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['licenseKey']=this['context']['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{const _0x3e53a4=this['context'],_0x1a0a5b=_0x3e53a4['editors']||[_0x3e53a4],_0xd326e1=!_0x3e53a4['editors'];for(const _0xb70b8a of _0x1a0a5b){let _0x38dedb;for(const _0x2e5fe2 in _0xb70b8a){const _0x3020d3=_0x2e5fe2,_0x421b78=_0xb70b8a[_0x3020d3];if('documentChangesLicenseKeyValid'==_0x421b78||'documentChangesLicenseKeyInvalid'==_0x421b78||'documentChangesLicenseKeyExpired'==_0x421b78||'documentChangesLicenseKeyDomainLimit'==_0x421b78||'documentChangesLicenseKeyNotAllowed'==_0x421b78||'documentChangesLicenseKeyEvaluationLimit'==_0x421b78||'documentChangesLicenseKeyUsageLimit'==_0x421b78){delete _0xb70b8a[_0x3020d3],_0x38dedb=_0x421b78,_0xd326e1&&(clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0);break;}}'documentChangesLicenseKeyInvalid'==_0x38dedb&&_0xb70b8a['_showLicenseError']('invalid'),'documentChangesLicenseKeyExpired'==_0x38dedb&&_0xb70b8a['_showLicenseError']('expired'),'documentChangesLicenseKeyDomainLimit'==_0x38dedb&&_0xb70b8a['_showLicenseError']('domainLimit'),'documentChangesLicenseKeyNotAllowed'==_0x38dedb&&_0xb70b8a['_showLicenseError']('featureNotAllowed','DocumentChanges'),'documentChangesLicenseKeyEvaluationLimit'==_0x38dedb&&_0xb70b8a['_showLicenseError']('evaluationLimit'),'documentChangesLicenseKeyUsageLimit'==_0x38dedb&&_0xb70b8a['_showLicenseError']('usageLimit');}},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}};const gn='$elementId',An='data-id';var In=class extends _0x338e6f{static get['pluginName'](){return'DocumentChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[_n];}async init(){!async function(_0x2b6546){const _0x23a9a1='EMDS3dsLoJY0nbe9cmlCrXyaZ8zpPqN6jxThf7gwBi2KFOVUWRAG14HQIkut5v',_0x2e1b0d=0x793c8,_0x2f328a={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x5aaa7d(_0x26d19a){const _0x1e2dbb=window['Promise']['resolve'](_0x26d19a),_0x5b4fe7=window['Date']['now'](),_0x9c699b=_0x26d19a['config']['get']('licenseKey');async function _0x535ad5(){let _0xea744,_0xb94d5e=null,_0x49af23=null;try{return'GPL'==_0x9c699b?'NotAllowed':(_0xea744=_0xd88bfa(),_0xea744?(_0xea744['usageEndpoint']&&(_0x49af23=_0x2f0b56(_0xea744['usageEndpoint'],_0xea744['jti'])),await _0x418365()?_0x16f7a6()?_0x68d7a4()?'Expired':_0x3095aa()?('evaluation'==_0xea744['licenseType']&&(_0xb94d5e=_0x17b1ff('EvaluationLimit')),await _0x45bbf5()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x68d7a4(){const _0x1739c6=['evaluation','trial']['includes'](_0xea744['licenseType'])?_0x5b4fe7/0x3e8:0xe10*_0x2e1b0d;return _0xea744['exp']<_0x1739c6;}function _0x16f7a6(){const _0x2cc067=_0xea744['features'];return!!_0x2cc067&&(!!_0x2cc067['includes']('*')||(!!_0x2cc067['includes']('DIFF')||(!!_0x2cc067['includes']('ET')||!!_0x2cc067['includes']('CKAI'))));}function _0x3095aa(){const _0x37e373=_0xea744['licensedHosts'];if(!_0x37e373||0x0==_0x37e373['length'])return!0x0;const {hostname:_0x155146}=new URL(window['location']['href']);if(_0x37e373['includes'](_0x155146))return!0x0;const _0x24a39a=_0x155146['split']('.');return _0x37e373['filter'](_0x42b108=>_0x42b108['includes']('*'))['map'](_0x41ffe0=>_0x41ffe0['split']('.'))['filter'](_0x2d1164=>_0x2d1164['length']<=_0x24a39a['length'])['map'](_0x4e94d5=>Array(_0x24a39a['length']-_0x4e94d5['length'])['fill']('*'===_0x4e94d5[0x0]?'*':'')['concat'](_0x4e94d5))['some'](_0x47182a=>_0x24a39a['every']((_0x323ec4,_0x45af3b)=>_0x47182a[_0x45af3b]===_0x323ec4||'*'===_0x47182a[_0x45af3b]));}function _0x45bbf5(){return _0xb94d5e&&_0x49af23?new window['Promise']((_0x454013,_0x54ee93)=>{_0xb94d5e['then'](_0x454013,_0x54ee93),_0x49af23['then'](_0x1f8c21=>{'Valid'!=_0x1f8c21&&_0x454013(_0x1f8c21);},_0x54ee93);}):_0xb94d5e||_0x49af23||'Valid';}}function _0x2f0b56(_0x34a498,_0x247c47){return new window['Promise'](_0x1411ee=>{if(_0x345dad())return _0x1411ee('Valid');_0x6f48c5(),_0x26d19a['decorate']('_sendUsageRequest');let _0x3b8f4d=!0x1;const _0x101573=xt();function _0x4cb0d2(_0x123e6b){return!!_0x123e6b&&('object'==typeof _0x123e6b||'function'==typeof _0x123e6b)&&'function'==typeof _0x123e6b['then']&&'function'==typeof _0x123e6b['catch'];}function _0x24838a(_0x4913e9){_0x246f49(_0x4913e9)['then'](_0x36c370=>_0x36c370&&'ok'==_0x36c370['status']?_0x3e0396(_0x19201c(_0x101573+_0x247c47))!=_0x36c370['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x3b6886=>(_0x394d3d(),_0x3b6886),()=>{const _0x1fed0f=_0x24f1d2();return null==_0x1fed0f?(_0x394d3d(),'Valid'):_0x5b4fe7-_0x1fed0f>0x240c8400?'UsageLimit':'Valid';})['then'](_0x1411ee)['catch'](()=>{_0x1411ee('UsageLimit');});const _0x476c65=0x36ee80;function _0x394d3d(){const _0x39d35c='llct-'+_0x3e0396(_0x19201c(_0x34a498)),_0xd436f6=_0x4afa7b(_0x3e0396(window['Math']['ceil'](_0x5b4fe7/_0x476c65)));window['localStorage']['setItem'](_0x39d35c,_0xd436f6);}function _0x24f1d2(){const _0x3a8fa8='llct-'+_0x3e0396(_0x19201c(_0x34a498)),_0x1bdd9b=window['localStorage']['getItem'](_0x3a8fa8);return _0x1bdd9b?window['parseInt'](_0x4afa7b(_0x1bdd9b),0x10)*_0x476c65:null;}function _0x246f49(_0x471022){return new window['Promise']((_0x2be0bd,_0x4dd4b1)=>{_0x471022['then'](_0x2be0bd,_0x4dd4b1),window['setTimeout'](_0x4dd4b1,0x1d4c0);});}}_0x26d19a['on']('_sendUsageRequest',(_0x298718,_0x48d894)=>{if(_0x48d894[0x0]!=_0x34a498)return _0x1411ee('UsageLimit');_0x48d894[0x1]={..._0x48d894[0x1],'requestId':_0x101573};},{'priority':'high'}),_0x26d19a['on']('_sendUsageRequest',_0x1f39ed=>{_0x4cb0d2(_0x1f39ed['return'])&&(_0x3b8f4d=!0x0,_0x24838a(_0x1f39ed['return']));},{'priority':'low'}),_0x1e2dbb['then'](()=>{_0x3b8f4d||_0x1411ee('UsageLimit');});});function _0x345dad(){return'auto'==_0x26d19a['editing']['view']['_overlayModeHint'];}function _0x6f48c5(){_0x26d19a['editing']['view']['_overlayModeHint']='auto';}}function _0x17b1ff(_0x49b684){const _0x2a13f0=[new window['Promise'](_0xf89960=>setTimeout(_0xf89960,0x93ecc)),_0x1e2dbb['then'](()=>new window['Promise'](_0x49df33=>{let _0x4d3a98=0x0;_0x26d19a['model']['on']('applyOperation',(_0xf2f4b4,_0x431b42)=>{_0x431b42[0x0]['isDocumentOperation']&&_0x4d3a98++,0x5e8==_0x4d3a98&&(_0x49df33(),_0xf2f4b4['off']());});}))];return window['Promise']['race'](_0x2a13f0)['then'](()=>_0x49b684);}async function _0x521172(){await _0x1e2dbb,_0x2b6546['getDiff']=_0x42a1be,_0x2b6546['_createDiff']=_0x42a1be,_0x26d19a['model']['change']=_0x42a1be,_0x26d19a['model']['enqueueChange']=_0x42a1be,_0x26d19a['enableReadOnlyMode']('model');}function _0x3378f8(_0xa7bc29){const _0x3c29b8=_0x387905();_0x26d19a[_0x3c29b8]='documentChangesLicenseKey'+_0xa7bc29,'Valid'!=_0xa7bc29&&_0x521172();}function _0x387905(){const _0x4de03d=window['String'](window['performance']['now']())['replace']('.','');let _0x5f3619='E';for(let _0x47657a=0x0;_0x47657a<_0x4de03d['length'];_0x47657a+=0x2){let _0x3da9b9=window['parseInt'](_0x4de03d['substring'](_0x47657a,_0x47657a+0x2));_0x3da9b9>=0x3e&&(_0x3da9b9-=0x3e),_0x5f3619+=_0x23a9a1[_0x3da9b9];}return _0x5f3619;}function _0xd88bfa(){const _0xd9b03f=_0x9c699b['split']('.');if(0x3!=_0xd9b03f['length'])return null;return _0x40e4f6(_0xd9b03f[0x1]);function _0x40e4f6(_0x706628){const _0xa553d9=_0x32f9b2(_0x706628);return _0xa553d9&&_0x554c0d()?_0xa553d9:null;function _0x554c0d(){const _0x420e1c=_0xa553d9['jti'],_0x323b0=window['parseInt'](_0x420e1c['substring'](_0x420e1c['length']-0x8),0x10),_0x1e14a2={..._0xa553d9,'jti':_0x420e1c['substring'](0x0,_0x420e1c['length']-0x8)};return delete _0x1e14a2['vc'],_0x19201c(_0x1e14a2)==_0x323b0;}}}async function _0x418365(){let _0x90e593=!0x0;try{const [_0x4d9ea9,_0x105ee5,_0x5a9594]=_0x9c699b['split']('.');return _0x694cdb(_0x4d9ea9),await _0x2f5bb7(_0x4d9ea9,_0x105ee5,_0x5a9594),_0x90e593;}catch{return!0x1;}function _0x694cdb(_0x29fc08){const _0x662fc7=_0x32f9b2(_0x29fc08);_0x662fc7&&'ES256'==_0x662fc7['alg']||(_0x90e593=!0x1);}async function _0x2f5bb7(_0x31e2aa,_0x5ee20a,_0x242ff9){const _0x3f9f73=window['Uint8Array']['from'](_0x374a85(_0x242ff9),_0x1284d1=>_0x1284d1['charCodeAt'](0x0)),_0x2369c5=new window['TextEncoder']()['encode'](_0x31e2aa+'.'+_0x5ee20a),_0x123f36=window['crypto']['subtle'];if(!_0x123f36)return;const _0x5c9ff9=await _0x123f36['importKey']('jwk',_0x2f328a,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x123f36['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x5c9ff9,_0x3f9f73,_0x2369c5)||(_0x90e593=!0x1);}}function _0x32f9b2(_0xbd29f){return _0xbd29f['startsWith']('ey')?JSON['parse'](_0x374a85(_0xbd29f)):null;}function _0x374a85(_0x12e530){return window['atob'](_0x12e530['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x19201c(_0x274546){let _0x4f30ad=0x1505;function _0x4ad216(_0xce0d2b){for(let _0x5f0799=0x0;_0x5f0799<_0xce0d2b['length'];_0x5f0799++){const _0x376bb7=_0xce0d2b['charCodeAt'](_0x5f0799);_0x4f30ad=(_0x4f30ad<<0x5)+_0x4f30ad+_0x376bb7,_0x4f30ad&=_0x4f30ad;}}function _0xd985e6(_0x473302){Array['isArray'](_0x473302)?_0x473302['forEach'](_0xd985e6):_0x473302&&'object'==typeof _0x473302?Object['entries'](_0x473302)['sort']()['forEach'](([_0xd04640,_0x107bb5])=>{_0x4ad216(_0xd04640),_0xd985e6(_0x107bb5);}):_0x4ad216(window['String'](_0x473302));}return _0xd985e6(_0x274546),_0x4f30ad>>>0x0;}function _0x3e0396(_0x37f6bd){return _0x37f6bd['toString'](0x10)['padStart'](0x8,'0');}function _0x4afa7b(_0x444bc0){return _0x444bc0['split']('')['reverse']()['join']('');}function _0x42a1be(){}_0x3378f8(await _0x535ad5());}const _0x22aaf3=_0x2b6546['context'],_0x4408eb=_0x22aaf3['editors'];_0x4408eb?(_0x4408eb['forEach'](_0x21b457),_0x2b6546['listenTo'](_0x4408eb,'add',(_0x54dc1e,_0x2e53c9)=>_0x21b457(_0x2e53c9),{'priority':'highest'})):_0x21b457(_0x22aaf3);function _0x21b457(_0x30bdeb){_0x30bdeb['once']('ready',()=>_0x5aaa7d(_0x30bdeb),{'priority':'highest'});}}(this),this['context']instanceof _0x36c7af?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x297a49,_0x4032a7)=>{_0x4032a7['on']('ready',()=>{this['_integrateEditor'](_0x4032a7);});});}get editor(){if(this['context']instanceof _0x36c7af)return this['context'];{const _0x4b9ffd=this['context']['editors']['first'];if(!_0x4b9ffd)throw new ct('documentchanges-no-editor',this);return _0x4b9ffd;}}getDiff(_0x13d406,_0x554ed1,_0x2e4e66={'anchor':'main','markDeletions':!0x1}){return this['_createDiff'](_0x13d406,_0x554ed1,_0x2e4e66)['getOperations']();}_getDiffWithOperationsData(_0xe429a6,_0x81b7e1,_0x54bc3d={'anchor':'main','markDeletions':!0x1}){const _0x51d115=this['_createDiff'](_0xe429a6,_0x81b7e1,_0x54bc3d);return{'operationsData':_0x51d115['getOperationsData'](),'operations':_0x51d115['getOperations']()};}_createDiff(_0x5a04c8,_0xd9c736,_0x55695e){const _0x4b9faf=_0x55695e['targetEditor']||this['editor'],_0x493862=_0x55695e['anchor']??'main';let _0x105ab0,_0x19a5ab;if('string'==typeof _0x493862){const _0x287d1b=_0x4b9faf['model']['document']['getRoot'](_0x493862);if(!_0x287d1b)throw new ct('documentchanges-compare-no-root',this,{'anchor':_0x493862});_0x105ab0=_0x287d1b,_0x19a5ab=_0x4b9faf['model']['createPositionAt'](_0x287d1b,0x0);}else _0x105ab0=_0x493862['clone'](),_0x19a5ab=_0x493862['clone']();const _0x412049=_0x4b9faf['data']['parse'](_0x5a04c8,_0x105ab0),_0x497ac1=_0x4b9faf['data']['parse'](_0xd9c736,_0x105ab0);return new pn({'editor':_0x4b9faf,'before':_0x412049,'after':_0x497ac1,'options':{'anchor':_0x19a5ab,'markDeletions':_0x55695e['markDeletions']}});}isMarkedRemoveOperation(_0x32daa4){return'marker'==_0x32daa4['type']&&_0x32daa4['name']['startsWith']('$markedRemove');}applyOperations(_0x48f461,_0x122d11){const _0x4fff9a=_0x48f461['model'];for(const _0x47c003 of _0x122d11)_0x3a283d(_0x47c003)||(_0x47c003 instanceof _0xbb6ea5?_0x48f461['_addOperationForAffectedMarkers']('move',_0x5708b2['_createFromPositionAndShift'](_0x47c003['sourcePosition'],_0x47c003['howMany'])):_0x47c003 instanceof _0x60d4bf?_0x48f461['_addOperationForAffectedMarkers']('merge',_0x47c003['deletionPosition']):_0x47c003 instanceof _0x8c29f8&&this['_fixMarkerOperationOldRange'](_0x4fff9a,_0x47c003),_0x47c003['baseVersion']=_0x4fff9a['document']['version'],_0x48f461['batch']['addOperation'](_0x47c003),_0x4fff9a['applyOperation'](_0x47c003));}_fixMarkerOperationOldRange(_0x4e971f,_0x739115){const _0x52f21f=_0x4e971f['markers']['get'](_0x739115['name']);_0x52f21f&&(_0x739115['oldRange']=_0x52f21f['getRange']());}_integrateEditor(_0x43be0a){_0x43be0a['conversion']['for']('upcast')['add'](_0x3fa5ec=>{_0x3fa5ec['on']('element',(_0x2c822d,_0x80653f,_0x2a7143)=>{if(_0x80653f['modelRange']&&_0x2a7143['consumable']['consume'](_0x80653f['viewItem'],{'attributes':'data-id'}))for(const _0x38ac6d of _0x80653f['modelRange']['getItems']({'shallow':!0x0})){if(_0x38ac6d['is']('$textProxy'))continue;const _0x5dac02=_0x80653f['viewItem']['getAttribute'](An);_0x5dac02&&_0x2a7143['writer']['setAttribute'](gn,_0x5dac02,_0x38ac6d);}},{'priority':vt['low']+0x1});}),_0x43be0a['model']['schema']['addAttributeCheck'](()=>!0x0,gn);}},pn=class{_editor;_diffItems=[];_markDeletions;['_anchor'];_operationsData=[];_path=[0x0];_parents=[];_splitPostponedData=new Map();constructor({editor:_0xee7aed,before:_0x3590ae,after:_0x4761d7,options:_0x3cd0ca}){this['_editor']=_0xee7aed,this['_markDeletions']=!!_0x3cd0ca['markDeletions'],this['_anchor']=_0x3cd0ca['anchor'];const _0x538314=this['_tokenizeModel'](_0x3590ae),_0x6db7df=this['_tokenizeModel'](_0x4761d7);this['_diffItems']=this['_diffModelTokens'](_0x538314,_0x6db7df),this['_calculateOperationsData'](),this['_markDeletions']||this['_calculateMarkersOperationsData'](_0x3590ae['markers'],_0x4761d7['markers']);}getOperationsData(){return this['_operationsData'];}getOperations(){const _0x480117=this['_editor']['model']['document'],_0x4fb29d=[];let _0x568446=_0x480117['version'];for(const _0x1265eb of this['getOperationsData']())switch(_0x1265eb['type']){case'attribute':{const _0x3045f6=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['path']),_0x41a217=_0x3045f6['getShiftedBy'](_0x1265eb['howMany']),_0x10cd74=new _0x5708b2(_0x3045f6,_0x41a217),_0x5c9487=JSON['parse'](_0x1265eb['oldValue']),_0x1ed692=JSON['parse'](_0x1265eb['newValue']);_0x4fb29d['push'](new _0x1fa2c6(_0x10cd74,_0x1265eb['key'],_0x5c9487,_0x1ed692,_0x568446++));break;}case'insert':{const _0x229f9e=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['path']),_0x1d9ad2=this['_makeModelFromTokens'](_0x1265eb['tokens']);_0x4fb29d['push'](new _0x942e3b(_0x229f9e,_0x1d9ad2,_0x568446++));break;}case'remove':{const _0x53daf6=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['path']),_0x47a8d1=new _0x41b2e6(_0x480117['graveyard'],[0x0]);_0x4fb29d['push'](new _0xbb6ea5(_0x53daf6,_0x1265eb['howMany'],_0x47a8d1,_0x568446++));break;}case'rename':{const _0x48b0f1=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['path']);_0x4fb29d['push'](new _0x3f202c(_0x48b0f1,_0x1265eb['oldName'],_0x1265eb['newName'],_0x568446++));break;}case'split':{const _0x595415=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['path']),_0x666b8b=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['path']['slice'](0x0,-0x1));_0x666b8b['offset']++,_0x4fb29d['push'](new _0xd60981(_0x595415,Number['NEGATIVE_INFINITY'],_0x666b8b,null,_0x568446++));break;}case'merge':{const _0x8b132=_0x1265eb['path']['slice'](),_0x3081fb=_0x8b132['slice'](0x0,-0x1);_0x3081fb[_0x3081fb['length']-0x1]++,_0x3081fb['push'](0x0);const _0x2373d0=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x3081fb),_0xa8f36f=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x8b132),_0x12b456=new _0x41b2e6(_0x480117['graveyard'],[0x0]);_0x4fb29d['push'](new _0x60d4bf(_0x2373d0,Number['NEGATIVE_INFINITY'],_0xa8f36f,_0x12b456,_0x568446++));break;}case'marker':case'markedRemove':{let _0x2fa7bb=null;if(_0x1265eb['range']){const _0x24dfec=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['range']['start']),_0x1d9557=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['range']['end']);_0x2fa7bb=new _0x5708b2(_0x24dfec,_0x1d9557);}const _0x444b2a='marker'==_0x1265eb['type']?_0x1265eb['name']:'$markedRemove:'+xt();_0x4fb29d['push'](new _0x8c29f8(_0x444b2a,null,_0x2fa7bb,_0x480117['model']['markers'],!0x0,_0x568446++));break;}case'unwrap':{const _0xdcc10b=_0x1265eb['path']['slice']();_0xdcc10b['push'](0x0);const _0xe0b925=_0x1265eb['path']['slice'](),_0x378402=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0xdcc10b),_0x5ddfc2=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0xe0b925),_0x2a39e8=new _0x41b2e6(_0x480117['graveyard'],[0x0]);_0x4fb29d['push'](new _0xbb6ea5(_0x378402,_0x1265eb['howMany'],_0x5ddfc2,_0x568446++)),_0x4fb29d['push'](new _0xbb6ea5(_0x5ddfc2['getShiftedBy'](_0x1265eb['howMany']),0x1,_0x2a39e8,_0x568446++));break;}case'wrap':{const _0x22320a=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['range']['start']),_0x3308bd=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x1265eb['range']['end']),_0x78cabc=_0x1265eb['token']['element']['_clone'](!0x1);_0x78cabc['_removeAttribute'](gn);const _0x164060=_0x1265eb['range']['end']['slice']();_0x164060['push'](0x0);const _0x5e30a7=this['_getPositionFromAnchorAndPath'](this['_anchor'],_0x164060);_0x4fb29d['push'](new _0x942e3b(_0x3308bd,_0x78cabc,_0x568446++)),_0x4fb29d['push'](new _0xbb6ea5(_0x22320a,_0x3308bd['offset']-_0x22320a['offset'],_0x5e30a7,_0x568446++));break;}}return _0x4fb29d;}_tokenizeModel(_0x2e53d0){const _0x80c3d9=[],_0xf81cac=_0x5708b2['_createIn'](_0x2e53d0),_0x3ee326=new _0x59cde9({'boundaries':_0xf81cac});let _0x44f9f3='',_0x2c388a=null;const _0x37a213=[''],_0x17c581=new Map();for(const _0x18f182 of _0x3ee326)if('elementStart'==_0x18f182['type']||'elementEnd'==_0x18f182['type']){let _0x25a287=_0x37a213[0x0];''!==_0x44f9f3&&(_0x80c3d9['push'](...this['_makeTokensFromTextByWords'](_0x44f9f3,_0x2c388a,_0x25a287)),_0x44f9f3='');const _0x225bd3=_0x18f182['item'];let _0x3dc70b;_0x225bd3['getAttribute']('$elementId')?_0x3dc70b=_0x225bd3['getAttribute'](gn):'elementStart'==_0x18f182['type']?(_0x3dc70b=En(_0x225bd3),_0x17c581['set'](_0x225bd3,_0x3dc70b)):_0x3dc70b=_0x17c581['get'](_0x225bd3);const _0x578956=this['_getElementCategory'](_0x225bd3);'solid'==_0x578956&&('elementStart'==_0x18f182['type']?(_0x25a287=_0x3dc70b,_0x37a213['unshift'](_0x25a287)):_0x37a213['shift']());const _0x268996={'type':'element','element':_0x225bd3,'elementId':_0x3dc70b,'category':_0x578956,'isStart':'elementStart'==_0x18f182['type'],'limitId':_0x25a287};_0x80c3d9['push'](_0x268996);}else''==_0x44f9f3&&(_0x2c388a=_0x18f182['previousPosition']['clone']()),_0x44f9f3+=_0x18f182['item']['data'];return''!==_0x44f9f3&&_0x80c3d9['push'](...this['_makeTokensFromTextByWords'](_0x44f9f3,_0x2c388a,_0x37a213[0x0])),_0x80c3d9;}_makeTokensFromTextByWords(_0x17c7f8,_0x13350a,_0x5494ad){const _0x3afc19=_0x17c7f8['matchAll'](/(\s)/g),_0x363522=Array['from'](_0x3afc19)['map'](_0x11806b=>_0x11806b['index']);_0x363522['push'](_0x17c7f8['length']),0x0==_0x363522[0x0]&&_0x363522['shift']();const _0x234407=[],_0xe3e0d0=_0x13350a['parent'];let _0x54787a=0x0,_0x3aa17c=_0x13350a['offset'];for(let _0x2edc27=0x0;_0x2edc27<_0x363522['length'];_0x2edc27++)_0x234407['push']({'type':'text','data':_0x17c7f8['slice'](_0x54787a,_0x363522[_0x2edc27]),'parent':_0xe3e0d0,'offset':_0x3aa17c,'limitId':_0x5494ad}),_0x54787a=_0x363522[_0x2edc27],_0x3aa17c=_0x13350a['offset']+_0x363522[_0x2edc27];return _0x234407;}_getElementCategory(_0x1740cb){const _0x473d53=this['_editor']['model']['schema'];return _0x473d53['isLimit'](_0x1740cb)||_0x473d53['isContent'](_0x1740cb)||_0x473d53['isInline'](_0x1740cb)?'solid':_0x473d53['isBlock'](_0x1740cb)?'block':function(_0x4e27cb,_0x557373){const _0x410611=_0x4e27cb['parent'];if(!_0x410611||_0x410611['is']('documentFragment'))return!0x1;if(_0x557373['checkChild'](_0x410611,'$text'))return!0x1;for(const _0x1ae601 of _0x4e27cb['getChildren']())if(_0x1ae601['is']('$text'))return!0x0;return!0x1;}(_0x1740cb,_0x473d53)?'solid':'container';}['_diffModelTokens'](_0x15a9db,_0x4cda80){const _0x5a0bc6=_0x1bdce3(_0x15a9db,_0x4cda80,{'comparator':mn});this['_handleUnclosedBlockOpeningTags'](_0x5a0bc6);const _0x54ef93=_0x5a0bc6['flatMap'](_0x48aae0=>{const _0x3453ec=_0x48aae0['added']?'added':_0x48aae0['removed']?'removed':'unchanged';return _0x48aae0['value']['map'](_0x1a6f5a=>({'token':_0x1a6f5a,'change':_0x3453ec}));});let _0x5db5ee=0x0;for(const _0x4e2085 of _0x54ef93)'added'!=_0x4e2085['change']&&('unchanged'==_0x4e2085['change']&&(_0x4e2085['before']=_0x15a9db[_0x5db5ee]),_0x5db5ee++);return _0x54ef93;}['_handleUnclosedBlockOpeningTags'](_0x3345b6){for(let _0x2392bb=0x0;_0x2392bb<_0x3345b6['length']-0x1;_0x2392bb++)if(_0x3345b6[_0x2392bb]['removed']&&_0x3345b6[_0x2392bb+0x1]['added']){const _0x1d90ed=this['_findUnclosedBlockOpeningToken'](_0x3345b6[_0x2392bb]['value']);if(null!==_0x1d90ed){const _0x12da0c=this['_findUnclosedBlockOpeningToken'](_0x3345b6[_0x2392bb+0x1]['value']),_0xf6330b=_0x3345b6[_0x2392bb]['value']['splice'](_0x1d90ed),_0x18cfc7=_0x3345b6[_0x2392bb+0x1]['value']['splice'](_0x12da0c),_0x4a7ba0=[_0x18cfc7['shift']()];_0xf6330b['shift']();const _0x9c0880={'value':_0xf6330b,'removed':!0x0},_0x52dcfc={'value':_0x18cfc7,'added':!0x0},_0x5385bd={'value':_0x4a7ba0};_0x3345b6['splice'](_0x2392bb+0x2,0x0,_0x5385bd,_0x9c0880,_0x52dcfc);}}}['_findUnclosedBlockOpeningToken'](_0x26eaa0){let _0x2b041d=0x0,_0x44ff05=-0x1;for(let _0x46ff66=0x0;_0x46ff66<_0x26eaa0['length'];_0x46ff66++){const _0x2cd882=_0x26eaa0[_0x46ff66];'element'==_0x2cd882['type']&&'block'==_0x2cd882['category']&&(_0x2b041d+=_0x2cd882['isStart']?0x1:-0x1,_0x2cd882['isStart']&&(_0x44ff05=_0x46ff66));}return 0x0===_0x2b041d?null:_0x44ff05;}_calculateOperationsData(){this['_handleUnwraps'](),this['_path']=[0x0],this['_parents']=[];for(let _0x39904f=0x0;_0x39904f<this['_diffItems']['length'];_0x39904f++){const _0x1e1b36=this['_diffItems'][_0x39904f]['change'],_0x1f8be4=[];_0x1f8be4['push'](this['_diffItems'][_0x39904f]);let _0x58a701=_0x39904f+0x1;for(;this['_diffItems'][_0x58a701]&&this['_diffItems'][_0x58a701]['change']==_0x1e1b36;)_0x1f8be4['push'](this['_diffItems'][_0x58a701]),_0x58a701++,_0x39904f++;const _0x323f32=_0x1f8be4['map'](_0x4e1c2b=>_0x4e1c2b['token']);if('unchanged'==_0x1e1b36)_0x1f8be4['map'](_0x50387a=>_0x50387a['before'])['forEach'](_0x13e3d7=>this['_traverseOverItem'](_0x13e3d7));else{if('removed'==_0x1e1b36){if(this['_markDeletions']){const _0x13c041=this['_path']['slice']();_0x323f32['forEach'](_0x311a56=>this['_traverseOverItem'](_0x311a56));const _0x3f72d8=this['_path']['slice']();this['_operationsData']['push']({'type':'markedRemove','range':{'start':_0x13c041,'end':_0x3f72d8}});}else this['_handleChanged'](_0x323f32,!0x0,this['_path']['slice']());}else{const _0xab4edd=_0x323f32['filter'](_0x49bac5=>'element'!=_0x49bac5['type']||'container'!=_0x49bac5['category']);this['_handleChanged'](_0xab4edd,!0x1,this['_path']);}}}this['_handleWraps'](),this['_path']=[0x0],this['_parents']=[];for(let _0x41f193=0x0;_0x41f193<this['_diffItems']['length'];_0x41f193++){const _0x173002=this['_diffItems'][_0x41f193]['change'],_0x2deaa0=[];_0x2deaa0['push'](this['_diffItems'][_0x41f193]);let _0x44e27c=_0x41f193+0x1;for(;this['_diffItems'][_0x44e27c]&&this['_diffItems'][_0x44e27c]['change']==_0x173002;)_0x2deaa0['push'](this['_diffItems'][_0x44e27c]),_0x44e27c++,_0x41f193++;const _0x102d8e=_0x2deaa0['map'](_0x1c430a=>_0x1c430a['token']);if('unchanged'==_0x173002){const _0x17feeb=_0x2deaa0['map'](_0x5bdd14=>_0x5bdd14['before']);this['_handleUnchanged'](_0x17feeb,_0x102d8e);}else('added'==_0x173002||this['_markDeletions'])&&_0x102d8e['forEach'](_0x53fb2b=>{'element'==_0x53fb2b['type']&&_0x53fb2b['isStart']&&this['_splitPostponedData']['has'](_0x53fb2b['element'])&&this['_handleSplitPostponedData'](_0x53fb2b['element'],this['_path']),this['_traverseOverItem'](_0x53fb2b);});}}_handleSplitPostponedData(_0xd0ef1c,_0x2fbd62){const _0x594caf=this['_splitPostponedData']['get'](_0xd0ef1c);for(const _0x552297 of _0x594caf)'rename'==_0x552297['type']?this['_operationsData']['push']({'type':'rename','path':_0x2fbd62['slice'](),'oldName':_0x552297['oldValue'],'newName':_0xd0ef1c['name']}):this['_operationsData']['push']({'type':'attribute','path':_0x2fbd62['slice'](),'howMany':0x1,'key':_0x552297['key'],'oldValue':_0x552297['oldValue'],'newValue':JSON['stringify'](_0xd0ef1c['getAttribute'](_0x552297['key'])??null)});}_calculateMarkersOperationsData(_0x3dfc05,_0x35a397){const _0x65fec1={};for(const [_0x5ca941]of _0x3dfc05)_0x65fec1[_0x5ca941]=null;for(const [_0x21a8f2,_0x12cfeb]of _0x35a397)_0x65fec1[_0x21a8f2]=_0x12cfeb;const _0x12e53a=Object['entries'](_0x65fec1)['map'](([_0x295bec,_0x53eb7e])=>({'type':'marker','name':_0x295bec,'range':_0x53eb7e?{'start':_0x53eb7e['start']['path']['slice'](),'end':_0x53eb7e['end']['path']['slice']()}:null}));this['_operationsData']['push'](..._0x12e53a);}['_handleUnwraps'](){const _0x6d807e=new Map(),_0x2b3475=[],_0x3dc25b=[0x0];let _0x46884f=this['_diffItems']['length']+0x1;for(let _0x2bfe5e=this['_diffItems']['length']-0x1;_0x2bfe5e>=0x0;_0x2bfe5e--){const {token:_0xc1a944,before:_0x2dddaf,change:_0x31b86c}=this['_diffItems'][_0x2bfe5e];if('removed'!=_0x31b86c&&(_0x46884f=_0x2bfe5e),'element'!=_0xc1a944['type']||'container'!=_0xc1a944['category']||'added'==_0x31b86c)continue;const _0x1320e9=_0x2dddaf?_0x2dddaf['element']:_0xc1a944['element'];if(_0xc1a944['isStart']){const _0x3fc0c4=_0x6d807e['get'](_0x1320e9),_0x2b88ff=this['_diffItems'][_0x3fc0c4];('removed'==_0x31b86c||'removed'==_0x2b88ff['change'])&&_0x46884f<_0x3fc0c4&&(this['_operationsData']['push']({'type':'unwrap','path':_0x1320e9['getPath'](),'howMany':_0x1320e9['maxOffset']+_0x3dc25b[0x0]}),_0x3dc25b['shift'](),_0x3dc25b[0x0]+=_0x1320e9['maxOffset']-0x1,_0x2b3475['push'](_0x2bfe5e),_0x2b3475['push'](_0x3fc0c4));}else _0x6d807e['set'](_0x1320e9,_0x2bfe5e),_0x3dc25b['unshift'](0x0);}_0x2b3475['sort']((_0x57638a,_0x4db65f)=>_0x4db65f-_0x57638a),_0x2b3475['forEach'](_0x4cbbc7=>{const _0x4bd1b7=this['_diffItems'][_0x4cbbc7];'removed'==_0x4bd1b7['change']?this['_diffItems']['splice'](_0x4cbbc7,0x1):(_0x4bd1b7['change']='added',delete _0x4bd1b7['before']);});}['_handleWraps'](){this['_path']=[0x0],this['_parents']=[];const _0xf8dd43=[];for(let _0x41b075=0x0;_0x41b075<this['_diffItems']['length'];_0x41b075++){const {change:_0x55a47d,token:_0x1b478f}=this['_diffItems'][_0x41b075];if('added'==_0x55a47d&&'element'==_0x1b478f['type']&&'container'==_0x1b478f['category']){if(_0x1b478f['isStart'])_0xf8dd43['push'](this['_path']['slice']());else{if(!_0x1b478f['isStart']){const _0x747523=_0xf8dd43['pop']();this['_operationsData']['push']({'type':'wrap','range':{'start':_0x747523,'end':this['_path']['slice']()},'token':_0x1b478f}),this['_path'][this['_path']['length']-0x1]=_0x747523[this['_path']['length']-0x1]+0x1;}}}else('removed'!=_0x55a47d||this['_markDeletions'])&&this['_traverseOverItem'](_0x1b478f);}}['_handleUnchanged'](_0x24ca1c,_0x57732f){for(let _0x34b6d4=0x0;_0x34b6d4<_0x24ca1c['length'];_0x34b6d4++){const _0x5aefe5=_0x24ca1c[_0x34b6d4];if('element'==_0x5aefe5['type']&&_0x5aefe5['isStart']){const _0x2a0387=_0x57732f[_0x34b6d4];'block'==_0x5aefe5['category']&&this['_handleElementRename'](_0x5aefe5['element'],_0x2a0387['element'],this['_path']),this['_handleElementAttributeChanges'](_0x5aefe5['element'],_0x2a0387['element'],this['_path']),this['_path']['push'](0x0),this['_parents']['push'](_0x2a0387);}else{if('element'!=_0x5aefe5['type']||_0x5aefe5['isStart']){if('text'==_0x5aefe5['type']){const _0x5b762d=this['_path']['slice'](),_0xb5c3f9=[],_0x49a958=[];for(;_0x24ca1c[_0x34b6d4]&&'text'==_0x24ca1c[_0x34b6d4]['type'];)_0xb5c3f9['push'](_0x24ca1c[_0x34b6d4]),_0x49a958['push'](_0x57732f[_0x34b6d4]),this['_path'][this['_path']['length']-0x1]+=_0x24ca1c[_0x34b6d4]['data']['length'],_0x34b6d4++;_0x34b6d4--,this['_handleTextAttributeChanges'](_0xb5c3f9,_0x49a958,_0x5b762d);}}else this['_path']['pop'](),this['_path'][this['_path']['length']-0x1]++,this['_parents']['pop']();}}}['_handleChanged'](_0x782ca9,_0x11f386,_0x365ccb){const _0x2cbf83=[],_0x12a369=[],_0x1a8261=_0x365ccb['slice']();let _0xc448bd=this['_parents']['length']-0x1;for(let _0x3fe99=0x0;_0x3fe99<_0x782ca9['length'];_0x3fe99++){const _0x274c85=_0x782ca9[_0x3fe99],_0x4e7261=_0x365ccb['slice']();'element'!=_0x274c85['type']||_0x274c85['isStart']?'element'==_0x274c85['type']&&_0x274c85['isStart']?(_0x365ccb['push'](0x0),_0xc448bd++,_0x12a369['push']({'before':_0x4e7261,'after':_0x365ccb['slice'](),'index':_0x3fe99})):_0x365ccb[_0x365ccb['length']-0x1]+=_0x274c85['data']['length']:(_0x365ccb['pop'](),_0x365ccb[_0x365ccb['length']-0x1]++,_0xc448bd--,_0x12a369['length']?_0x12a369['pop']():_0x2cbf83['push']({'before':_0x4e7261,'after':_0x365ccb['slice'](),'index':_0x3fe99}));}if(_0x12a369['length']!==_0x2cbf83['length'])throw new ct('model-diff-incorrect-matching-and-closing-tags',null,{'tokens':_0x782ca9,'isRemove':_0x11f386});const _0x19c994=[{'after':_0x1a8261['slice'](),'index':-0x1},..._0x2cbf83,..._0x12a369,{'before':_0x365ccb['slice'](),'index':_0x782ca9['length']}];if(_0x11f386){for(let _0x540163=_0x19c994['length']-0x1;_0x540163>=0x1;_0x540163--){const _0x348397=_0x19c994[_0x540163-0x1]['after'],_0x13a593=_0x19c994[_0x540163]['before'],_0xcb2646=_0x13a593[_0x13a593['length']-0x1]-_0x348397[_0x348397['length']-0x1];_0xcb2646&&(this['_operationsData']['push']({'type':'remove','path':_0x348397,'howMany':_0xcb2646}),_0x13a593[_0x13a593['length']-0x1]-=_0xcb2646);}for(const {before:_0x585aaa}of _0x2cbf83)this['_operationsData']['push']({'type':'merge','path':_0x585aaa});}else for(let _0x23cd94=0x0;_0x23cd94<_0x19c994['length']-0x1;_0x23cd94++){const _0x2ad0e8=_0x19c994[_0x23cd94]['after'],_0x4aa2fd=_0x19c994[_0x23cd94+0x1]['before'],_0x3526f7=_0x19c994[_0x23cd94]['index']+0x1,_0x18f3c8=_0x19c994[_0x23cd94+0x1]['index'];if(_0x3526f7!==_0x18f3c8&&this['_operationsData']['push']({'type':'insert','path':_0x2ad0e8,'tokens':_0x782ca9['slice'](_0x3526f7,_0x18f3c8)}),_0x23cd94<_0x2cbf83['length']){this['_operationsData']['push']({'type':'split','path':_0x4aa2fd});const _0x50d7e4=_0x782ca9[_0x12a369[_0x12a369['length']-0x1-_0x23cd94]['index']],_0x23ddbc=this['_parents'][_0xc448bd]['element'];_0x23ddbc['name']!=_0x50d7e4['element']['name']&&this['_addSplitPostponedData'](_0x50d7e4['element'],{'type':'rename','oldValue':_0x23ddbc['name']});const _0x568e45=this['_getAttributeChanges'](_0x23ddbc['getAttributes'](),_0x50d7e4['element']['getAttributes']());for(const _0x13bccb in _0x568e45){const _0x580ead=_0x568e45[_0x13bccb]['oldValue'];this['_addSplitPostponedData'](_0x50d7e4['element'],{'type':'attribute','key':_0x13bccb,'oldValue':_0x580ead});}}}}_addSplitPostponedData(_0x5458ef,_0x2d54a0){const _0x417174=this['_splitPostponedData']['get'](_0x5458ef)||[];_0x417174['push'](_0x2d54a0),this['_splitPostponedData']['set'](_0x5458ef,_0x417174);}_traverseOverItem(_0x54b51d){'element'==_0x54b51d['type']&&_0x54b51d['isStart']?(this['_path']['push'](0x0),this['_parents']['push'](_0x54b51d)):'element'!=_0x54b51d['type']||_0x54b51d['isStart']?'text'==_0x54b51d['type']&&(this['_path'][this['_path']['length']-0x1]+=_0x54b51d['data']['length']):(this['_path']['pop'](),this['_path'][this['_path']['length']-0x1]++,this['_parents']['pop']());}_handleElementRename(_0x3de254,_0x137cc7,_0x3504b7){_0x3de254['name']!=_0x137cc7['name']&&this['_operationsData']['push']({'type':'rename','path':_0x3504b7['slice'](),'oldName':_0x3de254['name'],'newName':_0x137cc7['name']});}_handleElementAttributeChanges(_0x11d9a4,_0x515264,_0x12e7e4){const _0x5d237a=this['_getAttributeChanges'](_0x11d9a4['getAttributes'](),_0x515264['getAttributes']());for(const _0x2b5058 in _0x5d237a){const {oldValue:_0x2f6b3b,newValue:_0x5eb0e0}=_0x5d237a[_0x2b5058];this['_operationsData']['push']({'type':'attribute','path':_0x12e7e4['slice'](),'howMany':0x1,'key':_0x2b5058,'oldValue':_0x2f6b3b,'newValue':_0x5eb0e0});}}_handleTextAttributeChanges(_0x2eb243,_0x351621,_0x7a9ab3){const _0xd1c4ca=this['_operationsData'],_0x2f9e92=_0x2eb243[0x0]['parent'],_0x511666=_0x2eb243[0x0]['offset'],_0x225e5f=_0x351621[0x0]['parent'],_0x49b8c2=_0x351621[0x0]['offset'],_0x279670=_0x2eb243['reduce']((_0x9cc94e,_0x318ba7)=>_0x9cc94e+_0x318ba7['data']['length'],0x0),_0x5d28d6=this['_getAttrsForOffsets'](_0x2f9e92,_0x511666,_0x279670),_0x1d5320=this['_getAttrsForOffsets'](_0x225e5f,_0x49b8c2,_0x279670),_0x26688f={};for(let _0x53ecc7=0x0;_0x53ecc7<_0x279670;_0x53ecc7++){const _0x1dd306=_0x5d28d6[_0x511666+_0x53ecc7],_0x3a3545=_0x1d5320[_0x49b8c2+_0x53ecc7],_0x341324=this['_getAttributeChanges'](_0x1dd306,_0x3a3545);for(const _0x36151f in _0x26688f)_0x341324[_0x36151f]||_0x2b4424(_0x36151f);for(const _0x19cf6f in _0x341324){const {oldValue:_0x56675a,newValue:_0x48261b}=_0x341324[_0x19cf6f],_0x2748fe=_0x26688f[_0x19cf6f];_0x2748fe?_0x2748fe['oldValue']==_0x56675a&&_0x2748fe['newValue']==_0x48261b?_0x2748fe['length']++:(_0x2b4424(_0x19cf6f),_0x26688f[_0x19cf6f]={'oldValue':_0x56675a,'newValue':_0x48261b,'start':_0x53ecc7,'length':0x1}):_0x26688f[_0x19cf6f]={'oldValue':_0x56675a,'newValue':_0x48261b,'start':_0x53ecc7,'length':0x1};}}for(const _0x33ea7f in _0x26688f)_0x2b4424(_0x33ea7f);function _0x2b4424(_0x92c8e9){const _0x456ff1=_0x26688f[_0x92c8e9],_0x3a9425=_0x7a9ab3['slice']();_0x3a9425[_0x3a9425['length']-0x1]+=_0x456ff1['start'],_0xd1c4ca['push']({'type':'attribute','path':_0x3a9425,'howMany':_0x456ff1['length'],'key':_0x92c8e9,'oldValue':_0x456ff1['oldValue'],'newValue':_0x456ff1['newValue']}),delete _0x26688f[_0x92c8e9];}}_getAttributeChanges(_0x17ad1d,_0x26dd4e){const _0x4078bd={};for(const [_0x23ebc5,_0x577f62]of _0x17ad1d)_0x4078bd[_0x23ebc5]={'oldValue':JSON['stringify'](_0x577f62),'newValue':'null'};for(const [_0x2d6226,_0x63485]of _0x26dd4e){const _0x159ad6=JSON['stringify'](_0x63485);_0x4078bd[_0x2d6226]?_0x4078bd[_0x2d6226]['oldValue']==_0x159ad6?delete _0x4078bd[_0x2d6226]:_0x4078bd[_0x2d6226]['newValue']=_0x159ad6:_0x4078bd[_0x2d6226]={'oldValue':'null','newValue':_0x159ad6};}return delete _0x4078bd[gn],_0x4078bd;}_getAttrsForOffsets(_0x114c7e,_0x403763,_0x40977b){const _0x5c58a2=new Array(_0x403763+_0x40977b);let _0x290039=_0x114c7e['getChildAtOffset'](_0x403763),_0x3fed38=_0x290039['startOffset'];for(;_0x290039&&_0x3fed38<_0x403763+_0x40977b;){const _0x573f60=Array['from'](_0x290039['getAttributes']());_0x5c58a2['fill'](_0x573f60,_0x3fed38,_0x3fed38+_0x290039['offsetSize']),_0x3fed38+=_0x290039['offsetSize'],_0x290039=_0x290039['nextSibling'];}return _0x5c58a2;}_getPositionFromAnchorAndPath(_0x3cf5aa,_0x11b4d1){const _0x4474a0=[..._0x3cf5aa['path']['slice'](0x0,-0x1),_0x3cf5aa['offset']+_0x11b4d1[0x0],..._0x11b4d1['slice'](0x1)];return new _0x41b2e6(_0x3cf5aa['root'],_0x4474a0);}['_makeModelFromTokens'](_0x4e2e4e){const _0x5ce05c=[];let _0x3bd798=null;for(const _0x42be0d of _0x4e2e4e)if('element'!=_0x42be0d['type']||_0x42be0d['isStart']||_0x3bd798!=_0x42be0d['element']){if(!_0x3bd798){if('text'==_0x42be0d['type']){const _0x257489=_0x41b2e6['_createAt'](_0x42be0d['parent'],_0x42be0d['offset']),_0x25e8ac=_0x5708b2['_createFromPositionAndShift'](_0x257489,_0x42be0d['data']['length']),_0x3c7aaa=Array['from'](_0x25e8ac['getItems']())['map'](_0x1d3c2c=>new _0x257eed(_0x1d3c2c['data'],_0x1d3c2c['getAttributes']()));_0x5ce05c['push'](..._0x3c7aaa);}else{_0x3bd798=_0x42be0d['element'];const _0x268340=_0x42be0d['element']['_clone'](!0x0);_0x268340['_removeAttribute'](gn);for(const _0x735541 of this['_editor']['model']['createRangeIn'](_0x268340)['getItems']())_0x735541['is']('element')&&_0x735541['_removeAttribute'](gn);_0x5ce05c['push'](_0x268340);}}}else _0x3bd798=null;return _0x5ce05c;}};function mn(_0x498d47,_0x2a65ff){return _0x498d47['type']===_0x2a65ff['type']&&(_0x498d47['limitId']===_0x2a65ff['limitId']&&('text'==_0x498d47['type']?_0x498d47['data']==_0x2a65ff['data']:function(_0x59ac15,_0x15a6f7){if(_0x59ac15['isStart']!=_0x15a6f7['isStart'])return!0x1;if(_0x59ac15['isStart']&&_0x59ac15['elementId']!=_0x15a6f7['elementId'])return!0x1;if(_0x59ac15['category']!=_0x15a6f7['category'])return!0x1;if('block'==_0x59ac15['category'])return!0x0;if('container'==_0x59ac15['category']&&_0x59ac15['elementId']!=_0x15a6f7['elementId'])return!0x1;return _0x59ac15['element']['name']==_0x15a6f7['element']['name'];}(_0x498d47,_0x2a65ff)));}function En(_0x56e5e5){return _0x2bc6ba({'name':_0x56e5e5['name'],...Object['fromEntries'](_0x56e5e5['getAttributes']())});}const wn=/* #__PURE__ -- @preserve */
26
+ At();var Tn=class extends wn{_generateUid;_uidCounter=0x0;_touchedNodesState={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};_existingDataIds=new Set();_referencedExistingIds=new Set();constructor(_0x39c78){super(),this['_generateUid']=_0x39c78||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x4d88be,_0x5d5fb7,_0x2d8942){this['_uidCounter']=0x0;const _0x5855af=_0x4d88be['cloneNode'](!0x0);bn(_0x5d5fb7,_0x5855af);const _0x305c80=_0x5855af['childNodes'],_0xa37b2b=Array['from'](_0x305c80)['filter'](_0x2e4f5b=>!(0x3===_0x2e4f5b['nodeType']&&''===Hs(_0x2e4f5b)['trim']())),_0x2096c4=_0xa37b2b['length'];this['_existingDataIds']=new Set(Us('data-id',null,_0x5d5fb7)['map'](_0x121eb6=>Fs(_0x121eb6,'data-id'))['filter'](_0x305906=>!!_0x305906));for(const _0x4ff9d0 of _0xa37b2b)_0x4ff9d0&&_0x5ebc36(_0x4ff9d0)&&void 0x0===_0x4ff9d0['attribs']['data-id']&&Ws(_0x4ff9d0,'data-id','new-element');if(Us('data-id',null,_0x5855af)['forEach'](_0x4eb932=>{const _0x384ce2=Fs(_0x4eb932,'data-id');'new-element'===_0x384ce2||this['_existingDataIds']['has'](_0x384ce2)||Ws(_0x4eb932,'data-id','new-element');}),0x0===_0x5d5fb7['childNodes']['length']){const _0x48efef=[];return Us('data-id','new-element',_0x5855af)['forEach'](_0x326dcd=>{const _0x2638c9=this['_generateUid']();Ws(_0x326dcd,'data-id',_0x2638c9),_0x48efef['push'](_0x2638c9);}),this['_removeSpecialComments'](_0x5855af),{'parsedContent':_0x5855af,'newNodeIds':_0x48efef,'modifiedNodeIds':[],'removedNodeIds':[]};}this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_touchedNodesState']['rescuedNewIds']=new Set(),this['_referencedExistingIds']=new Set();let _0x4043eb=-0x1,_0x2032ac=!0x1;for(let _0x2500a1=0x0;_0x2500a1<_0x2096c4;_0x2500a1++){const _0x4539ae=_0xa37b2b[_0x2500a1],_0xf17dfe=_0xa37b2b[_0x2500a1+0x1];if(this['_isNewNode'](_0x4539ae)){if(-0x1===_0x4043eb&&(_0x4043eb=_0x2500a1),this['_markWrappedElements'](_0x4539ae),!this['_isNewNode'](_0xf17dfe)){const [_0x43a797,_0x54d099]=this['_findReferenceNode'](_0x4539ae,_0x2032ac,_0x5d5fb7);if(_0x43a797){const _0x5e039a=Array['from'](_0xa37b2b)['slice'](_0x4043eb,_0x2500a1+0x1);this['_insertNodes'](_0x43a797,_0x5e039a,_0x54d099),_0x4043eb=-0x1;}}}else{if(this['_isExistingContentComment'](_0x4539ae))_0x2032ac=!0x0;else{if(this['_isExistingNode'](_0x4539ae)){const _0x3e8d1e=Fs(_0x4539ae,'data-id');if(_0x3e8d1e&&this['_existingDataIds']['has'](_0x3e8d1e)){this['_referencedExistingIds']['add'](_0x3e8d1e);const _0x18d7cd=Ms('data-id',_0x3e8d1e,_0x5d5fb7);this['_replaceNode'](_0x18d7cd,_0x4539ae);}}else{if(fn(_0x4539ae)){const _0x2f66e9=Cn(_0x4539ae);Ms('data-id',_0x2f66e9,_0x5855af)||this['_touchedNodesState']['removedIds']['push'](_0x2f66e9);}}}}}for(const _0x18f0f6 of this['_touchedNodesState']['removedIds']){const _0xf769ad=Ms('data-id',_0x18f0f6,_0x5d5fb7);_0xf769ad&&(this['_rescueUnwrappedElements'](_0xf769ad),this['_removeNode'](_0xf769ad,_0x18f0f6,_0x2d8942));}if(Us('data-id','new-element',_0x5d5fb7)['forEach'](_0x30bf67=>{const _0x2b6291=this['_getUid'](_0x30bf67);Ws(_0x30bf67,'data-id',_0x2b6291),this['_touchedNodesState']['newIds']['push'](_0x2b6291);}),this['_removeSpecialComments'](_0x5d5fb7),_0x2d8942&&_0x2d8942['cutAfterUnstable']){const _0x2aa6d0=this['_findLastConfirmationPoint'](_0xa37b2b),_0x2bd0d8=this['_getLastStableElement'](_0x5d5fb7,_0x2aa6d0);this['_markUnstableElements'](_0x5d5fb7,_0x2bd0d8);}if(this['_processWrappedElements'](_0x5d5fb7,_0x2d8942),_0x2d8942&&_0x2d8942['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0xde5f29=Us('data-id',this['_touchedNodesState']['lastTouchedId'],_0x5d5fb7);let _0x229b54=_0xde5f29[_0xde5f29['length']-0x1];for(;_0x229b54;)Xs(_0x229b54),_0x229b54=_0x229b54['parentNode'];}return{'parsedContent':_0x5d5fb7,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}_insertNodes(_0x515961,_0x1d3468,_0x24c4b8){for(const _0x1bb770 of _0x1d3468){const _0x3e2c23=this['_getUid'](_0x1bb770);Ws(_0x1bb770,'data-id',_0x3e2c23),this['_touchedNodesState']['newIds']['push'](_0x3e2c23),this['_touchedNodesState']['lastTouchedId']=_0x3e2c23;}const _0x4417ae='afterbegin'===_0x24c4b8||'afterend'===_0x24c4b8?_0x1d3468['reverse']():_0x1d3468;for(const _0x5828a7 of _0x4417ae)$s(_0x515961,_0x5828a7,_0x24c4b8);}['_replaceNode'](_0x5a0706,_0x49be6b){if(!_0x5a0706)return;if(_0x228d5d=_0x49be6b,qs(Hs(_0x5a0706))===qs(Hs(_0x228d5d)))return;var _0x228d5d;const _0x1ef0c5=Fs(_0x5a0706,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x1ef0c5),this['_touchedNodesState']['lastTouchedId']=_0x1ef0c5,_0x22ab5c(_0x5a0706,_0x49be6b['cloneNode'](!0x0));}['_removeNode'](_0x4a557b,_0x598c91,_0xc3f098){if(_0xc3f098&&_0xc3f098['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x598c91;const _0x1b96bb=_0xc3f098['replaceRemovedWith']['cloneNode'](!0x0);Ws(_0x1b96bb,'data-id',_0x598c91),Ws(_0x1b96bb,'data-removed','true'),_0x22ab5c(_0x4a557b,_0x1b96bb);}else _0x3339cd(_0x4a557b);}['_findReferenceNode'](_0x4bbb00,_0x110164,_0x5eb125){const _0x13dd89=this['_findPrevElementWithDataId'](_0x4bbb00,!0x1);if(_0x13dd89){const _0x45108c=Cn(_0x13dd89),_0x2cc943=Ms('data-id',_0x45108c,_0x5eb125);if(_0x2cc943)return[_0x2cc943,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x45108c);}const _0x37ef8c=this['_findNextElementWithDataId'](_0x4bbb00,!0x1);if(_0x37ef8c){const _0x101a72=Cn(_0x37ef8c),_0x48f276=Ms('data-id',_0x101a72,_0x5eb125);if(_0x48f276)return[_0x48f276,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x101a72);}return _0x110164?_0x4bbb00['nextSibling']?this['_findFallbackReferenceNode'](_0x4bbb00,_0x5eb125):[_0x5eb125['childNodes'][_0x5eb125['childNodes']['length']-0x1],'afterend']:[_0x5eb125['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x241a2d,_0x1fcecb){const _0xde5f56=[],_0x5d7a52=this['_findPrevElementWithDataId'](_0x241a2d,!0x0);if(_0x5d7a52){const _0x3ffda2=Ms('data-id',Cn(_0x5d7a52),_0x1fcecb);_0x3ffda2&&_0xde5f56['push']([_0x3ffda2,'afterend']);}const _0x52df87=this['_findNextElementWithDataId'](_0x241a2d,!0x0);if(_0x52df87){const _0x395232=Ms('data-id',Cn(_0x52df87),_0x1fcecb);_0x395232&&_0xde5f56['push']([_0x395232,'beforebegin']);}return _0xde5f56['length']>0x1?Qs(_0xde5f56[0x0][0x0])<=Qs(_0xde5f56[0x1][0x0])?_0xde5f56[0x0]:_0xde5f56[0x1]:0x1===_0xde5f56['length']?_0xde5f56[0x0]:[_0x1fcecb['lastChild'],'afterend'];}_findNextElementWithDataId(_0x2d4d86,_0x21b27a){let _0x11f913=_0x2d4d86['nextSibling'],_0x3f70df=null,_0x26b7cd=!0x1;for(;_0x11f913;){if(_0x3b1aa0(_0x11f913)){if(fn(_0x11f913)&&(_0x3f70df=_0x11f913),this['_isExistingContentComment'](_0x11f913)&&_0x21b27a&&!_0x26b7cd){_0x26b7cd=!0x0,_0x11f913=_0x11f913['nextSibling'];continue;}break;}const _0x992d=Fs(_0x11f913,'data-id');if(_0x992d&&'new-element'!==_0x992d&&this['_existingDataIds']['has'](_0x992d)){_0x3f70df=_0x11f913;break;}_0x11f913=_0x11f913['nextSibling'];}return _0x3f70df;}_findPrevElementWithDataId(_0x2d6279,_0x26bfb0){let _0x54bfaf=_0x2d6279['previousSibling'],_0x5d6433=null,_0x4015ff=!0x1;for(;_0x54bfaf;){if(_0x3b1aa0(_0x54bfaf)){if(fn(_0x54bfaf)&&(_0x5d6433=_0x54bfaf),this['_isExistingContentComment'](_0x54bfaf)&&_0x26bfb0&&!_0x4015ff){_0x4015ff=!0x0,_0x54bfaf=_0x54bfaf['previousSibling'];continue;}break;}const _0x2e4ff7=Fs(_0x54bfaf,'data-id');if(_0x2e4ff7&&'new-element'!==_0x2e4ff7&&this['_existingDataIds']['has'](_0x2e4ff7)){_0x5d6433=_0x54bfaf;break;}_0x54bfaf=_0x54bfaf['previousSibling'];}return _0x5d6433;}_markWrappedElements(_0x12d6f8){_0x5ebc36(_0x12d6f8)&&Us('data-id',null,_0x12d6f8)['forEach'](_0x535fcb=>{this['_isExistingNode'](_0x535fcb)&&(Ws(_0x535fcb,'data-wrapped-id',Fs(_0x535fcb,'data-id')),Ws(_0x535fcb,'data-id',null));});}_processWrappedElements(_0x1e43c8,_0x1596e8){Us('data-wrapped-id',null,_0x1e43c8)['forEach'](_0x1ef29e=>{const _0x459f6c=Fs(_0x1ef29e,'data-wrapped-id');if(this['_hasUnstableParent'](_0x1ef29e))return;const _0x540965=Ms('data-id',_0x459f6c,_0x1e43c8);Ws(_0x1ef29e,'data-id',_0x459f6c),_0x540965&&(this['_removeNode'](_0x540965,_0x459f6c,_0x1596e8),this['_touchedNodesState']['removedIds']['push'](_0x459f6c),this['_touchedNodesState']['lastTouchedId']=_0x459f6c);});}_hasUnstableParent(_0xeb356e){let _0x28cb37=_0xeb356e['parentNode'];for(;_0x28cb37;){if(Fs(_0x28cb37,'data-unstable'))return!0x0;_0x28cb37=_0x28cb37['parentNode'];}return!0x1;}_rescueUnwrappedElements(_0x5ecede){const _0x5f2ee9=new Set(this['_touchedNodesState']['removedIds']),_0x9d815c=new Set(this['_touchedNodesState']['newIds']);Us('data-id',null,_0x5ecede)['forEach'](_0x46ce16=>{const _0x1112c4=Fs(_0x46ce16,'data-id'),_0x5de6a3=!!_0x1112c4&&this['_referencedExistingIds']['has'](_0x1112c4),_0x7b884f=!!_0x1112c4&&_0x9d815c['has'](_0x1112c4);if(!_0x1112c4||!_0x5de6a3&&!_0x7b884f)return;if(_0x5f2ee9['has'](_0x1112c4))return;let _0x4d1809=_0x46ce16['parentNode'],_0x6bc378=!0x1;for(;_0x4d1809;){if(_0x4d1809===_0x5ecede){_0x6bc378=!0x0;break;}const _0x4c0924=Fs(_0x4d1809,'data-id');if(_0x4c0924&&(this['_referencedExistingIds']['has'](_0x4c0924)||_0x9d815c['has'](_0x4c0924)))return;_0x4d1809=_0x4d1809['parentNode'];}if(_0x6bc378){if(_0x4c725e(_0x5ecede,_0x46ce16),_0x5de6a3){const _0xac2068=this['_generateUid'](),_0x5129af=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x1112c4);-0x1!==_0x5129af&&this['_touchedNodesState']['modifiedIds']['splice'](_0x5129af,0x1),Ws(_0x46ce16,'data-unwrapped-id',_0x1112c4),Ws(_0x46ce16,'data-id',_0xac2068),this['_touchedNodesState']['newIds']['push'](_0xac2068),this['_touchedNodesState']['rescuedNewIds']['add'](_0xac2068),this['_touchedNodesState']['lastTouchedId']=_0xac2068;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x1112c4),this['_touchedNodesState']['lastTouchedId']=_0x1112c4;}});}_getUid(_0x323e63){return this['_isExistingNode'](_0x323e63)?Fs(_0x323e63,'data-id'):this['_generateUid']();}_removeSpecialComments(_0x26c648){Ks(_0x26c648)['filter'](_0x273c78=>fn(_0x273c78)||this['_isExistingContentComment'](_0x273c78))['forEach'](_0x24d30f=>{_0x3339cd(_0x24d30f);});}_findLastConfirmationPoint(_0x4b1e38){let _0x7d8382=null,_0x3c5add=null,_0x11f157=null,_0x1d81ae=null;const _0xf4970e=_0x224b58=>{_0x224b58&&(_0x7d8382=_0x224b58),_0x11f157=null,_0x1d81ae=null;};for(let _0x578ae7=0x0;_0x578ae7<_0x4b1e38['length'];_0x578ae7++){const _0xf1098e=_0x4b1e38[_0x578ae7];if(this['_isExistingContentComment'](_0xf1098e)){_0xf4970e(_0x3c5add);continue;}if(_0x5ebc36(_0xf1098e)){const _0x4f7bcd=Fs(_0xf1098e,'data-id'),_0x1ed58a=_0x578ae7===_0x4b1e38['length']-0x1;if(_0x4f7bcd&&'new-element'!==_0x4f7bcd&&this['_touchedNodesState']['modifiedIds']['includes'](_0x4f7bcd)&&!_0x1ed58a){_0xf4970e(_0x4f7bcd),_0x3c5add=_0x4f7bcd;continue;}}let _0x35aa99;const _0x3bea49=Cn(_0xf1098e);if(_0x3bea49&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x3bea49))_0x3c5add=_0x3bea49;else{if(_0x3bea49&&this['_touchedNodesState']['newIds']['includes'](_0x3bea49))_0x35aa99='N';else{if(!fn(_0xf1098e))continue;_0x35aa99='R';}_0x35aa99===_0x1d81ae||null===_0x1d81ae?_0x1d81ae=_0x35aa99:null!==_0x11f157?(_0xf4970e(_0x3c5add),_0x1d81ae=_0x35aa99):(_0x11f157=_0x1d81ae,_0x1d81ae=_0x35aa99),_0x3c5add=_0x3bea49;}}const _0x1f8bf9=_0x4b1e38[_0x4b1e38['length']-0x1];return _0x1f8bf9&&!_0x5ebc36(_0x1f8bf9)&&!fn(_0x1f8bf9)&&_0x3c5add&&_0xf4970e(_0x3c5add),_0x7d8382;}_getLastStableElement(_0x435f5e,_0x411b55){if(!_0x411b55)return null;const _0x5108d9=Ms('data-id',_0x411b55,_0x435f5e);if(!_0x5108d9)return null;const _0x2884db=[_0x5108d9,...Ys(_0x5108d9)]['at'](-0x2);if(_0x2884db===_0x5108d9)return _0x5108d9;let _0x2d52e8=_0x2884db['previousSibling'];for(;_0x2d52e8&&!_0x5ebc36(_0x2d52e8);)_0x2d52e8=_0x2d52e8['previousSibling'];return _0x2d52e8;}_markUnstableElements(_0x1afdd0,_0xc71f03){const _0x48906d=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x108505=_0xc71f03?_0xc71f03['nextSibling']:_0x1afdd0['firstChild'];for(;_0x108505;)_0x5ebc36(_0x108505)&&(_0x48906d['has'](Fs(_0x108505,'data-id'))||Us('data-id',null,_0x108505)['some'](_0x8de627=>_0x48906d['has'](Fs(_0x8de627,'data-id'))))&&Ws(_0x108505,'data-unstable','true'),_0x108505=_0x108505['nextSibling'];}['_isNewNode'](_0x3b51c0){return Boolean('new-element'===Fs(_0x3b51c0,'data-id'));}_isExistingNode(_0x56841b){return Boolean((Fs(_0x56841b,'data-id')||'')['length']>0x0&&'new-element'!==Fs(_0x56841b,'data-id'));}_isExistingContentComment(_0x2a99d6){return Boolean(_0x3b1aa0(_0x2a99d6)&&Hs(_0x2a99d6)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function fn(_0x143912){return!!_0x143912&&Boolean(_0x3b1aa0(_0x143912)&&Hs(_0x143912)['match'](/removed[\s*-]data-id="[^"]+"/));}function Cn(_0x591027){if(!_0x591027)return null;if(_0x5ebc36(_0x591027))return Fs(_0x591027,'data-id')??null;if(_0x3b1aa0(_0x591027)){const _0xafbf20=Hs(_0x591027)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0xafbf20&&_0xafbf20[0x1])return _0xafbf20[0x1];}return null;}function bn(_0x2c5782,_0x163194){const _0x25a6a1=new Map();for(const _0x52235b of Vs(_0x2c5782))Gs(_0x52235b)||_0x25a6a1['set'](Fs(_0x52235b,'data-id'),_0x52235b);const _0x20774e=new Set();for(const _0x3fc600 of Vs(_0x163194)){if(Gs(_0x3fc600))continue;const _0x5d2f0a=Fs(_0x3fc600,'data-id'),_0x16b6d5=_0x5d2f0a?_0x25a6a1['get'](_0x5d2f0a):void 0x0;_0x16b6d5?(_0x22ab5c(_0x3fc600,_0x4f309c(_0x16b6d5,!0x0)),_0x20774e['add'](_0x5d2f0a)):_0x3339cd(_0x3fc600);}for(const _0x499659 of Ks(_0x163194))fn(_0x499659)&&_0x25a6a1['has'](Cn(_0x499659))&&_0x3339cd(_0x499659);const _0x520806=new Set(Us('data-id',null,_0x163194)['map'](_0x2824cd=>Fs(_0x2824cd,'data-id')));for(const [_0x356e82,_0x28f15a]of _0x25a6a1){if(_0x20774e['has'](_0x356e82))continue;let _0x230020=_0x28f15a['parent'],_0x40d206=null;for(;_0x230020&&_0x5ebc36(_0x230020);){const _0x1a3d8a=Fs(_0x230020,'data-id');if(_0x1a3d8a&&_0x520806['has'](_0x1a3d8a)){_0x40d206=_0x1a3d8a;break;}_0x230020=_0x230020['parent'];}if(!_0x40d206)continue;const _0x8aa927=Ms('data-id',_0x40d206,_0x163194);_0x8aa927&&_0x252f1a(_0x8aa927,_0x4f309c(_0x28f15a,!0x0));}}const Sn=/* #__PURE__ -- @preserve */
27
+ At();var Rn=class extends Sn{_m2html;constructor(){super();const _0x3d7810=Object['entries'](_0x3e7f88),_0x340852=_0x3d7810['findIndex'](([_0x258b44])=>'rehypeDomRaw'===_0x258b44);if(-0x1===_0x340852)throw new ct('ai-response-parser-unable-to-set-up-parser');_0x3d7810['splice'](_0x340852+0x1,0x0,['rehypeSanitize',_0x519373]),this['_m2html']=new _0x102060({'plugins':Object['fromEntries'](_0x3d7810)});}convertMarkdownToHTML(_0x2d7016){const _0x517e79=this['_m2html']['parse'](_0x2d7016);return this['parseAndNormalizeHTML'](_0x517e79);}['parseAndNormalizeHTML'](_0x5b86c4){return this['_parseHTML'](_0x5b86c4);}['_parseHTML'](_0x9c0928){const _0x28f2c2=Ps('<dummy>'+_0x9c0928['replace'](/<[^>]*?$/g,'')+'</dummy>');return On(_0x28f2c2),_0x28f2c2['children']=_0x28f2c2['children'][0x0]['children'],_0x28f2c2;}};function On(_0x4ba1fb){for(const _0x363bb9 of _0x4ba1fb['children'])_0x5ebc36(_0x363bb9)?'pre'!==_0x363bb9['name']&&On(_0x363bb9):_0x17ad85(_0x363bb9)&&(_0x363bb9['data']=_0x363bb9['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function vn({changeGroups:_0x5b97e1,documentContextContent:_0xa36de8,showDiff:_0x11d573,trimUnchanged:_0x198892=!0x0}){const _0x4a2dcf=sn(_0x5b97e1,_0xa36de8);return _0x5b97e1['map'](_0x5ac7ad=>{if(!_0x5ac7ad['editor']||'destroyed'===_0x5ac7ad['editor']['state'])return null;const _0x27ca0a=zs(_0x5ac7ad['editor'],_0x5ac7ad['rootName']),_0x27e0be=new _0x481874([]),_0x1ee1f4=new _0x481874([]),_0xde269e=new Set();for(const _0x465e64 of _0x5ac7ad['changes'])'new'==_0x465e64['type']&&Us('data-id',null,_0x465e64['node'])['forEach'](_0x38b1d4=>{_0xde269e['add'](Fs(_0x38b1d4,'data-id'));});for(const _0x26363c of _0x5ac7ad['changes'])if('removed'!=_0x26363c['type']?_0x1ee1f4['children']['push'](_0x26363c['node']['cloneNode'](!0x0)):_0x11d573||_0xde269e['has'](_0x26363c['id'])||_0x1ee1f4['children']['push'](_0x26363c['node']['cloneNode'](!0x0)),'new'!=_0x26363c['type']&&(_0x11d573||'removed'!=_0x26363c['type'])){const _0x589eaa=_0x580dea(_0x5a90b5=>Fs(_0x5a90b5,'data-id')==_0x26363c['id'],_0xa36de8['get'](_0x5ac7ad['documentId']),!0x0);_0x589eaa&&_0x27e0be['children']['push'](_0x589eaa['cloneNode'](!0x0));}if(_0x27ca0a&&_0x4a2dcf['has'](_0x5ac7ad['index']))return{'type':_0x5ac7ad['changes'][0x0]['type'],'index':_0x5ac7ad['index'],'state':_0x5ac7ad['state'],'outdatedReason':_0x5ac7ad['outdatedReason'],'content':new _0x481874([]),'hasChanges':!0x1};let _0x3661b8,_0x16f92d,_0x491544;try{({content:_0x3661b8,hasChanges:_0x16f92d}=yn(_0x5ac7ad['editor'],_0x27e0be,_0x1ee1f4,_0x11d573,_0x198892));}catch{return{'type':_0x5ac7ad['changes'][0x0]['type'],'index':_0x5ac7ad['index'],'state':_0x5ac7ad['state'],'outdatedReason':_0x5ac7ad['outdatedReason'],'content':new _0x481874([]),'hasChanges':!0x1};}if(_0x27ca0a){_0x491544=_0x5ac7ad['editor']['ui']['getEditableElement'](_0x5ac7ad['rootName'])?.['tagName']['toLowerCase']();const _0x2d7637=_0x3661b8['children']['filter'](_0x5ebc36);0x1===_0x2d7637['length']&&(_0x3661b8=new _0x481874(_0x2d7637[0x0]['children']));}return{'type':_0x5ac7ad['changes'][0x0]['type'],'index':_0x5ac7ad['index'],'state':_0x5ac7ad['state'],'outdatedReason':_0x5ac7ad['outdatedReason'],'content':_0x3661b8,'hasChanges':_0x16f92d,'wrapperTag':_0x491544};})['filter'](_0x3ecfdd=>null!==_0x3ecfdd);}function yn(_0x73e21d,_0x3ec5e1,_0x587563,_0x43abe5,_0x254570=!0x0){const _0x43118b=_0x73e21d['plugins']['get']('DocumentChanges'),_0x49a132=Hs(_0x3ec5e1),_0x18be40=Hs(_0x587563),_0x19869d=_0x73e21d['data']['parse'](_0x49a132,'$root'),_0x42755f=_0x73e21d['model']['createPositionAt'](_0x19869d,0x0),_0x45db95=_0x43118b['getDiff'](_0x49a132,_0x18be40,{'anchor':_0x42755f,'markDeletions':_0x43abe5,'targetEditor':_0x73e21d});if(0x0==_0x45db95['length'])return{'content':_0x3ec5e1['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x43abe5?function(_0x1f2fb1,_0x4ee4aa,_0x129f67){if(0x0==_0x1f2fb1['length'])return;const _0x3a4b6c=_0x129f67['plugins']['get']('DocumentChanges'),_0x3120ae=_0x129f67['plugins']['get']('SuggestionsConversion');_0x129f67['model']['change'](_0xfe302e=>{const _0x32ffc3=new Set();for(let _0x5825e0=0x0;_0x5825e0<_0x1f2fb1['length'];_0x5825e0++){const _0x141f44=_0x1f2fb1[_0x5825e0];if(_0x141f44['baseVersion']=null,_0x141f44['isDocumentOperation']=!0x1,!_0x3a283d(_0x141f44)){if(_0x3a4b6c['isMarkedRemoveOperation'](_0x141f44)){const _0x1cdb56=_0xd84b36(_0x141f44['newRange'],_0x129f67['model']),_0x3f2619='suggestion:deletion:'+xt()+':$aiSuggestion';_0x4ee4aa['markers']['set'](_0x3f2619,_0x1cdb56);}else switch(_0x141f44['type']){case'rename':{if(_0x141f44['oldName']==_0x141f44['newName'])break;_0xfe302e['batch']['addOperation'](_0x141f44),_0x129f67['model']['applyOperation'](_0x141f44);const _0x21fe97='$elementName',_0x445f53=_0x141f44['position'],_0x58816e=_0x129f67['model']['createRange'](_0x445f53,_0x129f67['model']['createPositionAt'](_0x445f53['nodeAfter'],'end')),_0xcc9dbe='suggestion:attribute:'+_0x21fe97+':'+xt()+':$aiSuggestion';_0x4ee4aa['markers']['set'](_0xcc9dbe,_0x58816e);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x141f44['oldValue']==_0x141f44['newValue'])break;_0xfe302e['batch']['addOperation'](_0x141f44),_0x129f67['model']['applyOperation'](_0x141f44);const _0xc73562=_0x141f44['key'];if(!_0x3120ae['isRegisteredAttribute'](_0xc73562))break;const _0xe9e545=_0xd84b36(_0x141f44['range'],_0x129f67['model']),_0x54e6ee='suggestion:attribute:'+_0xc73562+':'+xt()+':$aiSuggestion';_0x4ee4aa['markers']['set'](_0x54e6ee,_0xe9e545);break;}case'insert':{if(_0xfe302e['batch']['addOperation'](_0x141f44),_0x129f67['model']['applyOperation'](_0x141f44),kn(_0x4ee4aa,_0x141f44),_0x1f2fb1[_0x5825e0+0x1]&&'move'==_0x1f2fb1[_0x5825e0+0x1]['type'])break;const _0x3eb530=_0x141f44['position'],_0x2f39cf=_0x141f44['howMany'],_0x305473=_0xd84b36(_0x129f67['model']['createRange'](_0x3eb530,_0x3eb530['getShiftedBy'](_0x2f39cf)),_0x129f67['model']),_0x3511e8='suggestion:insertion:'+xt()+':$aiSuggestion';_0x4ee4aa['markers']['set'](_0x3511e8,_0x305473);break;}case'split':{_0xfe302e['batch']['addOperation'](_0x141f44),_0x129f67['model']['applyOperation'](_0x141f44),kn(_0x4ee4aa,_0x141f44);const _0x347a76=_0x141f44['splitPosition'],_0x3472e0=_0x141f44['moveTargetPosition'],_0x15135e=_0x129f67['model']['createRange'](_0x347a76,_0x3472e0),_0x4b332f='suggestion:insertion:'+xt()+':$aiSuggestion';_0x4ee4aa['markers']['set'](_0x4b332f,_0x15135e);break;}case'move':{_0xfe302e['batch']['addOperation'](_0x141f44),_0x129f67['model']['applyOperation'](_0x141f44),kn(_0x4ee4aa,_0x141f44);const _0x567df7=_0x141f44['getMovedRangeStart'](),_0x3c6a45=_0x141f44['howMany'];for(let _0x1fac32=0x0;_0x1fac32<_0x3c6a45;_0x1fac32++){const _0x1cc998=_0x567df7['getShiftedBy'](_0x1fac32)['nodeAfter'];_0x32ffc3['add'](_0x1cc998);}break;}case'remove':{const _0x3269c8=_0x141f44['sourcePosition'],_0x2295b7=_0x141f44['howMany'],_0x326c6d=new _0x4b3a4f(_0x3269c8,_0x2295b7);_0xfe302e['batch']['addOperation'](_0x326c6d),_0x129f67['model']['applyOperation'](_0x326c6d),kn(_0x4ee4aa,_0x141f44);break;}}}}for(const _0x5c8357 of _0x32ffc3){const _0x5f0e31=_0x129f67['model']['createRangeOn'](_0x5c8357),_0x4e2af1='suggestion:formatBlock:$fakeWrap:'+xt()+':$aiSuggestion';_0x4ee4aa['markers']['set'](_0x4e2af1,_0xd84b36(_0x5f0e31,_0x129f67['model']));}});}(_0x45db95,_0x19869d,_0x73e21d):_0x73e21d['model']['change'](_0x2ee047=>{for(const _0x2d5232 of _0x45db95)if(!_0x3a283d(_0x2d5232)){if('remove'==_0x2d5232['type']){const _0x258f1a=_0x2d5232['sourcePosition'],_0xae09dd=_0x2d5232['howMany'],_0x118e24=new _0x4b3a4f(_0x258f1a,_0xae09dd);_0x2ee047['batch']['addOperation'](_0x118e24),_0x73e21d['model']['applyOperation'](_0x118e24),kn(_0x19869d,_0x2d5232);}else{if('marker'==_0x2d5232['type']){const _0x3fcdc3=_0x2d5232['name'],_0x3b4110=_0x2d5232['newRange'];null!==_0x3b4110?_0x19869d['markers']['set'](_0x3fcdc3,_0x3b4110):_0x19869d['markers']['delete'](_0x3fcdc3);}else _0x2d5232['baseVersion']=null,_0x2d5232['isDocumentOperation']=!0x1,_0x2ee047['batch']['addOperation'](_0x2d5232),_0x73e21d['model']['applyOperation'](_0x2d5232),kn(_0x19869d,_0x2d5232);}}}),_0x254570){const _0x1d28ac=Nn(_0x73e21d,_0x45db95,_0x19869d);Ln(_0x73e21d['model'],_0x1d28ac),function(_0xe0ab62,_0x20da06){const _0x319f1f=_0x20da06['getFirstRange']()['start'];let _0x70c74c=_0x20da06['getFirstRange']()['end'];const _0x367d7e=_0x319f1f['root'];(_0x70c74c['textNode']||_0x70c74c['nodeAfter']&&_0x70c74c['nodeAfter']['is']('$text'))&&(_0x2cc674(_0x70c74c,'...'),Hn(_0x367d7e,_0x70c74c,0x3),_0x70c74c=_0x70c74c['getShiftedBy'](0x3)),(_0x319f1f['textNode']||_0x319f1f['nodeBefore']&&_0x319f1f['nodeBefore']['is']('$text'))&&(_0x2cc674(_0x319f1f,'...'),Hn(_0x367d7e,_0x319f1f,0x3),_0x319f1f['parent']==_0x70c74c['parent']&&(_0x70c74c=_0x70c74c['getShiftedBy'](0x3)));const _0x5c6c1b=_0xe0ab62['createRange'](_0xe0ab62['createPositionAt'](_0x367d7e,0x0),_0x319f1f),_0x3a60e3=_0xe0ab62['createRange'](_0x70c74c,_0xe0ab62['createPositionAt'](_0x367d7e,'end')),_0x2ff232=[..._0x5c6c1b['getMinimalFlatRanges'](),..._0x3a60e3['getMinimalFlatRanges']()];_0x2ff232['reverse']();for(const _0x2232e2 of _0x2ff232)_0x3b9fef(_0x2232e2),Pn(_0x367d7e,_0x2232e2);}(_0x73e21d['model'],_0x1d28ac);}return{'content':Ps(_0x73e21d['data']['stringify'](_0x19869d,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function kn(_0xce5585,_0x4a4b57){for(const [_0x2eb955,_0x28c6b6]of _0xce5585['markers']){const _0x206182=_0x5708b2['_createFromRanges'](_0x28c6b6['getTransformedByOperation'](_0x4a4b57));_0x206182['root']==_0xce5585?_0xce5585['markers']['set'](_0x2eb955,_0x206182):_0xce5585['markers']['delete'](_0x2eb955);}}function Nn(_0x87c551,_0x2c90e9,_0x3bb5cc){const _0x5518c1=_0x87c551['plugins']['get']('DocumentChanges');let _0x300fc3=_0x87c551['model']['createPositionAt'](_0x3bb5cc,Number['POSITIVE_INFINITY']),_0x12b1eb=_0x87c551['model']['createPositionAt'](_0x3bb5cc,0x0);for(const _0x5f56fc of _0x2c90e9){let _0x25029b,_0x2c8412;if(_0x5518c1['isMarkedRemoveOperation'](_0x5f56fc))_0x25029b=_0x5f56fc['newRange']['start'],_0x2c8412=_0x5f56fc['newRange']['end'];else switch(_0x300fc3=xn(_0x300fc3,_0x5f56fc),_0x12b1eb=xn(_0x12b1eb,_0x5f56fc),_0x5f56fc['type']){case'rename':_0x25029b=_0x5f56fc['position'],_0x2c8412=_0x25029b['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x25029b=_0x5f56fc['range']['start'],_0x2c8412=_0x5f56fc['range']['end'];break;case'insert':_0x25029b=_0x5f56fc['position'],_0x2c8412=_0x25029b['getShiftedBy'](_0x5f56fc['howMany']);break;case'split':_0x25029b=_0x5f56fc['splitPosition'],_0x2c8412=_0x5f56fc['moveTargetPosition'];break;case'merge':{const _0x1ac31b=_0x5f56fc['targetPosition']['path']['slice'](0x0,-0x1);_0x25029b=_0x87c551['model']['createPositionFromPath'](_0x3bb5cc,_0x1ac31b),_0x2c8412=_0x25029b['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x597538=_0x5f56fc['howMany'],_0x40b682=_0x5f56fc['sourcePosition']['_getTransformedByInsertion'](_0x5f56fc['targetPosition'],_0x597538),_0x34b9c4=_0x5f56fc['getMovedRangeStart']();'remove'==_0x5f56fc['type']?(_0x25029b=_0x40b682,_0x2c8412=_0x40b682):(_0x25029b=_0x34b9c4,_0x2c8412=_0x34b9c4['getShiftedBy'](_0x597538));break;}}_0x25029b&&_0x25029b['isBefore'](_0x300fc3)&&(_0x300fc3=_0x25029b['clone'](),_0x300fc3['stickiness']='toNone'),_0x2c8412&&_0x2c8412['isAfter'](_0x12b1eb)&&(_0x12b1eb=_0x2c8412['clone'](),_0x12b1eb['stickiness']='toNone');}return _0x87c551['model']['createSelection'](_0x87c551['model']['createRange'](_0x300fc3,_0x12b1eb));}function xn(_0x191f86,_0x3b77cf){return'move'!=_0x3b77cf['type']&&'remove'!=_0x3b77cf['type']||_0x3b77cf['sourceRange']['containsPosition'](_0x191f86)&&((_0x191f86=_0x3b77cf['sourcePosition']['clone']())['stickiness']='toNone'),_0x191f86['getTransformedByOperation'](_0x3b77cf);}function Ln(_0x4ee704,_0x516523){Dn(_0x4ee704,_0x516523,'forward');const _0x39ef57=_0x516523['getFirstRange']();_0x516523['setTo']([]),_0x516523['setTo'](_0x39ef57,{'backward':!0x0}),Dn(_0x4ee704,_0x516523,'backward');}function Dn(_0x41a77b,_0x34c1d0,_0x584be0){let _0xdd52c5=0x14;for(;_0xdd52c5;){_0x41a77b['modifySelection'](_0x34c1d0,{'unit':'word','direction':_0x584be0}),_0xdd52c5--;const _0x18ce39=_0x34c1d0['focus']['forward'==_0x584be0?'nodeBefore':'nodeAfter'];if(_0x18ce39&&_0x18ce39['is']('element')&&_0x41a77b['schema']['isBlock'](_0x18ce39)&&_0x41a77b['schema']['isObject'](_0x18ce39))break;}}function Pn(_0x2e4c61,_0x14e35d){for(const [_0x578c85,_0x2d697c]of _0x2e4c61['markers']){const _0x263f05=_0x2d697c['_getTransformedByDeletion'](_0x14e35d['start'],_0x14e35d['end']['offset']-_0x14e35d['start']['offset']);null!=_0x263f05?_0x2e4c61['markers']['set'](_0x578c85,_0x263f05):_0x2e4c61['markers']['delete'](_0x578c85);}}function Hn(_0x2d80a7,_0x34442c,_0x48dfe4){for(let [_0x6b46d8,_0x208883]of _0x2d80a7['markers'])_0x208883=_0x208883['_getTransformedByInsertion'](_0x34442c,_0x48dfe4,!0x1)[0x0],_0x2d80a7['markers']['set'](_0x6b46d8,_0x208883);}function Mn(_0x5aff16,_0x12b5ae){for(const _0x426b5c of _0x5aff16)'noop'!==_0x426b5c['type']&&(_0x426b5c['_aiSource']=_0x12b5ae);}var Un=class extends _0x338e6f{static get['pluginName'](){return'AIGateway';}static get requires(){return[In,xs];}get['models'](){return this['context']['plugins']['get'](xs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x3db0cc,_0x253e9d){const {applyMethod:_0x17254b,roots:_0x9f4f90}=_0x253e9d,_0x10a201='suggest'===_0x17254b;if(_0x3db0cc['error']||!_0x3db0cc['results']['length'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0x3db0cc['status']});if(_0x9f4f90){if(0x0===_0x9f4f90['length'])throw new ct('ai-gateway-apply-empty-roots',this);for(const {channelId:_0x126d78,rootName:_0x3e0ea1}of _0x9f4f90)if(!_0x3db0cc['results']['some'](_0x330f5a=>_0x330f5a['channelId']===_0x126d78&&_0x330f5a['rootName']===_0x3e0ea1))throw new ct('ai-gateway-apply-root-not-found',this,{'channelId':_0x126d78,'rootName':_0x3e0ea1});}const _0x519cb5=_0x3db0cc['results']['reduce']((_0x46b2c3,_0xf02702)=>{if(_0x9f4f90&&!_0x9f4f90['some'](_0x2fe432=>_0x2fe432['channelId']===_0xf02702['channelId']&&_0x2fe432['rootName']===_0xf02702['rootName']))return _0x46b2c3;if('completed'!==_0xf02702['status'])throw new ct('ai-gateway-apply-invalid-status',this,{'status':_0xf02702['status'],'channelId':_0xf02702['channelId'],'rootName':_0xf02702['rootName']});if(_0x10a201&&!_0xf02702['editor']['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',this,{'channelId':_0xf02702['channelId'],'rootName':_0xf02702['rootName']});let _0x53e381=_0x46b2c3['get'](_0xf02702['editor']);return _0x53e381||(_0x53e381=[],_0x46b2c3['set'](_0xf02702['editor'],_0x53e381)),_0x53e381['push'](_0xf02702),_0x46b2c3;},new Map()),_0x4b6f26=this['context']['plugins']['get'](In);for(const [_0x3a8a1a,_0x177f03]of _0x519cb5){const _0x149176=_0x177f03['map'](_0x5a9a95=>{const _0x510530=_0x3a8a1a['model']['createPositionAt'](_0x3a8a1a['model']['document']['getRoot'](_0x5a9a95['rootName']),0x0),_0x4eecfc=nn(_0x3a8a1a,_0x5a9a95['rootName'],_0x5a9a95['contentRawOld'],_0x5a9a95['contentRawNew']);if(!_0x4eecfc)return _0x5a9a95['droppedUnsupportedInlineChange']=!0x0,null;const _0x10ff8f=_0x4b6f26['getDiff'](_0x4eecfc['before'],_0x4eecfc['after'],{'anchor':_0x510530,'markDeletions':_0x10a201,'targetEditor':_0x3a8a1a}),_0xefcd54=_0x3a8a1a['model']['document']['history']['getOperations'](_0x5a9a95['documentVersion']),_0x366f04={'document':_0x3a8a1a['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x3959e0=_0x3ceee1(_0x10ff8f,_0xefcd54,_0x366f04)['operationsA'];return Mn(_0x3959e0,_0x253e9d['aiSource']??'api'),_0x3959e0;});_0x3a8a1a['model']['change'](_0x5ca918=>{for(const _0x52c5d4 of _0x149176)_0x52c5d4&&(_0x10a201?_0x3a8a1a['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x52c5d4):_0x4b6f26['applyOperations'](_0x5ca918,_0x52c5d4));});}}mergeChangesIntoContent(_0x16512b,_0x33763b,_0x1783af){const _0x4cd317=new Rn(),_0xb327ed=new Tn();let _0x6e6b3d=_0x4cd317['parseAndNormalizeHTML'](_0x33763b);for(const _0x42bd12 of _0x16512b)try{const _0x87fe07=_0x4cd317['parseAndNormalizeHTML'](_0x42bd12['content']);_0x6e6b3d=_0xb327ed['merge'](_0x87fe07,_0x6e6b3d,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x560a3d){throw new ct('ai-gateway-merge-failed',this,{..._0x42bd12},_0x560a3d);}return yn(_0x1783af,_0x4cd317['parseAndNormalizeHTML'](_0x33763b),_0x6e6b3d,!0x1,!0x1)['content'];}};const Vn=/* #__PURE__ -- @preserve */
28
+ dt(),Bn=['capabilitiesUpdated'];var Gn=class extends Vn{['_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(_0x498947){const _0x430ebb={};if(!_0x498947)return _0x430ebb;('isWebSearchEnabled'in _0x498947?_0x498947['isWebSearchEnabled']:_0x498947['webSearch'])&&(_0x430ebb['webSearch']={});const _0xf43744='isReasoningEnabled'in _0x498947?_0x498947['isReasoningEnabled']:_0x498947['reasoning'];return _0xf43744&&(_0x430ebb['reasoning']='string'==typeof _0xf43744?{'level':_0xf43744}:{}),_0x430ebb;}toggleWebSearch(){this['setWebSearch'](!this['_isWebSearchEnabled']);}toggleReasoning(){this['setReasoning'](!this['_isReasoningEnabled']);}setWebSearch(_0x5c775d){_0x5c775d!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x5c775d,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}setReasoning(_0x5a1a47){_0x5a1a47!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x5a1a47,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}};const Kn='defaultContextIds',Fn=/* #__PURE__ -- @preserve */
29
+ At();var Wn=class AIContext extends Fn{['_refs'];constructor(_0x237c86=[]){super(),this['_refs']=[..._0x237c86];}get['refs'](){return[...this['_refs']];}get isEmpty(){return 0x0===this['_refs']['length'];}cloneWith(..._0x2a884e){return new AIContext([...this['_refs'],..._0x2a884e]);}addDefaultContext(_0x41e60e){this['_refs']=[...this['_refs'],..._0x41e60e];}toRequestParts(_0x1606a9=[]){return[...this['toRequestContexts'](),..._0x1606a9];}toRequestContexts(){return this['_refs']['map'](_0x3a7ba9=>({..._0x3a7ba9,'type':'context'}));}toMessageAttributes(_0x5b904d){return this['isEmpty']?_0x5b904d:{..._0x5b904d,[Kn]:[...new Set(this['_refs']['map'](_0x12d9fc=>_0x12d9fc['id']))]};}static getDefaultContextIds(_0x3feefe){const _0x422e8a=_0x3feefe&&_0x3feefe[Kn];return new Set(Array['isArray'](_0x422e8a)?_0x422e8a:[]);}};function $n(_0xe4a88d,_0x1808a9,_0x5c1d2d,_0x2f7e33){if(_0xe4a88d instanceof ct)return _0xe4a88d;const _0xfc47a5=_0xe4a88d?.['data'],_0x51a97a=void 0x0!==_0xfc47a5?{..._0x2f7e33,'backendData':_0xfc47a5}:_0x2f7e33;return new ct(_0x1808a9,_0x5c1d2d,_0x51a97a,_0xe4a88d);}var Yn=class{_editor;_rootName;['_channelId'];['_sessionId'];_documentVersion;_contentRawOld;_contentRawNew;['_error'];_isAborted=!0x1;_droppedUnsupportedInlineChange=!0x1;constructor(_0x5bb248){this['_editor']=_0x5bb248['editor'],this['_rootName']=_0x5bb248['rootName'],this['_channelId']=_0x5bb248['channelId'],this['_sessionId']=_0x5bb248['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(_0x3d3df5){this['_documentVersion']=_0x3d3df5;}get contentRawOld(){return this['_contentRawOld'];}set contentRawOld(_0x3dc6a9){this['_contentRawOld']=_0x3dc6a9;}get contentRawNew(){return this['_contentRawNew'];}set contentRawNew(_0x334758){this['_contentRawNew']=_0x334758;}get contentOld(){return this['_dropDataIds'](this['_contentRawOld']||'');}get contentNew(){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x217295){this['_error']=_0x217295;}get droppedUnsupportedInlineChange(){return this['_droppedUnsupportedInlineChange'];}set droppedUnsupportedInlineChange(_0x483b4b){this['_droppedUnsupportedInlineChange']=_0x483b4b;}abort(){this['_isAborted']=!0x0;}_dropDataIds(_0xfd5d42){return _0xfd5d42['replace'](/ data-id="[a-z0-9]+"/g,'');}},qn=class extends Yn{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x11971b){this['_summary']=_0x11971b;}},Qn=class{_results;constructor(_0x1144ae=[]){this['_results']=_0x1144ae;}_status='initialized';['_error'];abort(){'error'!==this['_status']&&(this['_status']='aborted');}get status(){return this['_status'];}set status(_0x24293a){this['_status']=_0x24293a;}get['error'](){return this['_error'];}set['error'](_0x37f25c){this['_status']='error',this['_error']=_0x37f25c;}get results(){return this['_results'];}addResult(..._0x38a6d6){this['_results']['push'](..._0x38a6d6);}},Xn=class extends _0x338e6f{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get requires(){return[Ss,dn,Un,xs];}get['models'](){return this['context']['plugins']['get'](xs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async processDocument(_0x405b22,_0x303a26){if(!_0x405b22)throw new ct('ai-documentprocessinggateway-missing-prompt',this);const _0x152025=await this['context']['plugins']['get'](dn)['getDocumentData'](),_0x462881=_0x303a26['roots'];if(0x0===(_0x462881??_0x152025)['length'])throw new ct('ai-documentprocessinggateway-empty-roots',this);if(_0x462881){for(const _0x282ab1 of _0x462881)if(!_0x152025['some'](_0xa430aa=>_0xa430aa['rootName']===_0x282ab1['rootName']&&_0xa430aa['channelId']===_0x282ab1['channelId']))throw new ct('ai-documentprocessinggateway-root-not-found',this,{'channelId':_0x282ab1['channelId'],'rootName':_0x282ab1['rootName']});}const _0x511d98=_0x462881?_0x152025['filter'](_0x41d96e=>_0x462881['some'](_0xe309f9=>_0xe309f9['rootName']===_0x41d96e['rootName']&&_0xe309f9['channelId']===_0x41d96e['channelId'])):_0x152025,_0xd86c67=[],_0x13f588=[];for(const _0x25f564 of _0x511d98){const _0x58d4b7={'editor':_0x25f564['editor'],'rootName':_0x25f564['rootName'],'sessionId':_0x25f564['sessionId'],'channelId':_0x25f564['channelId'],'contentRawOld':_0x25f564['content'],'documentVersion':_0x25f564['version']};_0xd86c67['push'](_0x58d4b7),_0x13f588['push']({'type':'document','content':_0x58d4b7['contentRawOld']});}const _0x4039b3=this['context']['plugins']['get']('AIConnector')['processDocument']({'content':_0x13f588,'prompt':_0x405b22,'model':_0x303a26['model'],'capabilities':Gn['getCapabilitiesRequestData'](_0x303a26['capabilities']),'contexts':new Wn(_0x303a26['contexts'])['toRequestContexts']()});let _0x4dc705;if(_0x303a26?.['signal']){_0x303a26['signal']['aborted']&&_0x4039b3['abortController']['abort']();const _0x47fd3a=_0x303a26['signal'],_0x56f4c2=()=>_0x4039b3['abortController']['abort']();_0x47fd3a['addEventListener']('abort',_0x56f4c2),_0x4dc705=()=>_0x47fd3a['removeEventListener']('abort',_0x56f4c2);}const _0x38093c=new Qn();let _0x4c79c3=[];try{if(_0x4c79c3=(await _0x4039b3['getResult']())['documents'],!(_0x4c79c3&&_0x4c79c3['length']>0x0))throw new ct('ai-documentprocessinggateway-empty-reply',this);if(_0x4c79c3['length']!==_0x13f588['length'])throw new ct('ai-documentprocessinggateway-reply-count-mismatch',this,{'expected':_0x13f588['length'],'received':_0x4c79c3['length']});const _0x5631bf=_0x4c79c3['findIndex'](({document:_0x40a554})=>!_0x40a554['length']);if(-0x1!==_0x5631bf){const _0x58ef4f=_0xd86c67[_0x5631bf];throw new ct('ai-documentprocessinggateway-empty-root-content',this,{'channelId':_0x58ef4f['channelId'],'rootName':_0x58ef4f['rootName']});}_0x38093c['status']='completed';}catch(_0x1101df){_0x1101df instanceof Error&&_0x1101df['message']['includes']('ai-request-aborted')?_0x38093c['abort']():_0x38093c['error']=$n(_0x1101df,'ai-documentprocessinggateway-run-failed',this);}finally{_0x4dc705&&_0x4dc705();}if('completed'===_0x38093c['status'])for(const [_0x59c848,_0x12d900]of _0xd86c67['entries']()){const {channelId:_0x4f9dd1,contentRawOld:_0x22897d,documentVersion:_0x1c62cf,editor:_0x5e8425,rootName:_0x4887ed,sessionId:_0x4605fc}=_0x12d900,_0x47dbf2=new qn({'channelId':_0x4f9dd1,'editor':_0x5e8425,'rootName':_0x4887ed,'sessionId':_0x4605fc});_0x47dbf2['contentRawOld']=_0x22897d,_0x47dbf2['documentVersion']=_0x1c62cf,_0x47dbf2['contentRawNew']=_0x4c79c3[_0x59c848]['document'],_0x47dbf2['summary']=_0x4c79c3[_0x59c848]['summary'],_0x38093c['addResult'](_0x47dbf2);}return _0x38093c;}applyResult(_0x2deb78,_0x1a84b1){this['context']['plugins']['get']('AIGateway')['apply'](_0x2deb78,_0x1a84b1);}};function zn(_0x8a5f14){return _0x8a5f14 instanceof Error&&('AbortError'===_0x8a5f14['name']||('AICoreError'===_0x8a5f14['name']?!0x0===_0x8a5f14['isAbort']:_0x8a5f14['message']['startsWith']('ai-request-aborted')));}var jn=class extends Error{['code'];severity;type;context;isAbort;constructor(_0x24eca2){super(_0x24eca2['code'],_0x24eca2['cause']instanceof Error?{'cause':_0x24eca2['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x24eca2['code'],this['severity']=_0x24eca2['severity']??'error',this['type']=_0x24eca2['type']??'system',this['context']=_0x24eca2['context'],this['isAbort']=_0x24eca2['isAbort']??zn(_0x24eca2['cause']);}},Jn=class extends _0x338e6f{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}createReporter(_0x23b5f7){return new Zn(this,_0x23b5f7);}},Zn=class{['_sink'];_component;constructor(_0x275915,_0x2af17c){this['_sink']=_0x275915,this['_component']=_0x2af17c;}['logError'](_0x320d72,_0x8b6b6c={}){this['_emit'](_0x320d72,_0x8b6b6c),this['_defaultLog'](_0x320d72);}reportError(_0x598388,_0x968b17={}){this['_emit'](_0x598388,_0x968b17);}_emit(_0x22814c,_0x1d82a2){if(zn(_0x22814c))return;const _0x400e83=_0x22814c instanceof jn?_0x22814c:void 0x0,_0x4bb487=_0x400e83?.['context']||_0x1d82a2['context']?{..._0x400e83?.['context'],..._0x1d82a2['context']}:void 0x0;this['_sink']['fire']('error',{'error':_0x22814c,'component':this['_component'],'code':_0x400e83?.['code'],'type':_0x400e83?.['type'],'severity':_0x400e83?.['severity'],'context':_0x4bb487});}_defaultLog(_0x1aa941){if(!zn(_0x1aa941)){if(_0x1aa941 instanceof jn){if('user'===_0x1aa941['type']||'network'===_0x1aa941['type'])return;if('warning'===_0x1aa941['severity'])return void console['warn'](this['_component'],_0x1aa941);}console['error'](this['_component'],_0x1aa941);}}};const tr='ck-ai-button-primary',er='ck-ai-button-secondary',ir='ck-ai-button-tertiary';function sr(_0x105e1e,_0x24ee30){const _0x2dcc6d=new Bt(_0x105e1e),_0x26b542=Os(_0x105e1e,'AI_TABS_LABEL_MINIMIZE'),_0x271ed1=Os(_0x105e1e,'AI_TABS_LABEL_MAXIMIZE');return _0x2dcc6d['set']({'withText':!0x1,'icon':_0x268ae8,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+ir}),_0x2dcc6d['bind']('label')['to'](_0x24ee30,'isMaximized',_0x34f99d=>_0x34f99d?_0x26b542:_0x271ed1),_0x2dcc6d['bind']('icon')['to'](_0x24ee30,'isMaximized',_0x2d2bd7=>_0x2d2bd7?_0x187829:_0x268ae8),_0x2dcc6d['bind']('isOn')['to'](_0x24ee30,'isMaximized'),_0x2dcc6d['on']('execute',()=>{_0x24ee30['fire']('resizeTabs');}),_0x2dcc6d;}function nr(_0x41afc2){const _0x1977e2=new Mt(_0x41afc2);return _0x1977e2['attachToDom'](),_0x1977e2['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x1977e2;}const rr=/* #__PURE__ -- @preserve */
30
+ At();var or=class extends rr{['id'];interactionId;type;content=new Map();['sources']=[];parsedContent=new Map();parsedMergedContent=new Map();['changeGroups']=[];areActionsDisabled=!0x1;_outdatedReasonByDocumentId;isFromHistory=!0x1;documentContextContent;_documentIdToSource=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];cachedSuggestionContentParts={'withDiff':[],'withoutDiff':[]};constructor({type:_0x5315d6,isDone:_0x5ca225=!0x1,isComplete:_0x227588,interactionId:_0x48c536,areActionsDisabled:_0x48f671,outdatedReasonByDocumentId:_0x46eb78,isFromHistory:_0x3bdbda=!0x1,documentContextContent:_0x4e9447,locale:_0x1291ab,id:_0x89a0c5,channelsToEditors:_0x54179a}){super(),this['id']=_0x89a0c5||xt(),this['interactionId']=_0x48c536,this['type']=_0x5315d6,this['areActionsDisabled']=!!_0x48f671,this['_outdatedReasonByDocumentId']=_0x46eb78,this['isFromHistory']=_0x3bdbda,this['locale']=_0x1291ab,this['aiResponseParser']=new Rn(),this['aiResponseApplier']=new Tn(),this['documentContextContent']=new Map(_0x4e9447?.['map'](_0x5211a8=>[_0x5211a8['id'],Ps(_0x5211a8['content'])])||[]),this['_documentIdToSource']=new Map(_0x4e9447?.['map'](_0x57ed5c=>[_0x57ed5c['id'],{'editor':_0x54179a['get'](_0x57ed5c['channelId']),'rootName':_0x57ed5c['rootName']}])||[]),this['set']('isDone',_0x5ca225),this['set']('isComplete',_0x227588??_0x5ca225),'text'===this['type']&&this['content']['set']('text','');}appendContent(_0x2731b9,_0x5f056d){const _0x35292c='text'===this['type']?'text':_0x5f056d;this['content']['has'](_0x35292c)||this['content']['set'](_0x35292c,''),this['content']['set'](_0x35292c,this['content']['get'](_0x35292c)+_0x2731b9),this['onContentChange'](_0x35292c);}['done'](_0x28a866=!0x0){this['isComplete']=_0x28a866,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}destroy(){this['stopListening']();}setChangeGroupState(_0x5d5fe8,_0x4e139f,_0x286d9a){this['changeGroups'][_0x5d5fe8]['state']=_0x4e139f,this['changeGroups'][_0x5d5fe8]['outdatedReason']=_0x286d9a,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x5d5fe8,'state':_0x4e139f,'outdatedReason':_0x286d9a});}getContentParts({showDiff:_0x41bbdb,groupIndex:_0x1232e1}){const _0x434063=this['_getCachedContentParts'](_0x41bbdb,_0x1232e1);if(_0x434063)return _0x434063;let _0x305a38;if(void 0x0===_0x1232e1)_0x305a38=this['changeGroups'];else{const _0x4d683e=this['changeGroups']['find'](({index:_0x39a28e})=>_0x39a28e===_0x1232e1);if(!_0x4d683e)throw new ct('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x1232e1});_0x305a38=[_0x4d683e];}const _0x1b888d=vn({'showDiff':_0x41bbdb,'changeGroups':_0x305a38,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x41bbdb,_0x1b888d),_0x1b888d;}_getCachedContentParts(_0x2f1d2b,_0x1d0418){const _0x1fe42d=_0x2f1d2b?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x1fe42d]['length'])return null;const _0x52dc48=this['cachedSuggestionContentParts'][_0x1fe42d];if(void 0x0===_0x1d0418)return _0x52dc48['length']>0x0&&_0x52dc48['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x2f1d2b,null),null):_0xfb63c0(_0x52dc48);{const _0x290d4e=_0x52dc48['find'](({index:_0x18a151})=>_0x18a151===_0x1d0418);if(_0x290d4e)return[_0xfb63c0(_0x290d4e)];}return null;}_setCachedContentParts(_0x1d6d1c,_0x58e10d){const _0x515db9=_0x1d6d1c?'withDiff':'withoutDiff';_0x58e10d?_0x58e10d['forEach'](_0x2e3b84=>{const _0x8015fc=this['cachedSuggestionContentParts'][_0x515db9],_0x5c63e8=_0x8015fc['find'](({index:_0x166aca})=>_0x166aca===_0x2e3b84['index']);if(_0x5c63e8){const _0x1ddb35=_0x8015fc['indexOf'](_0x5c63e8);_0x8015fc['splice'](_0x1ddb35,0x1,_0x2e3b84);}else _0x8015fc['push'](_0x2e3b84);}):this['cachedSuggestionContentParts'][_0x515db9]['length']=0x0;}onContentChange(_0xb9fde){if('modification'===this['type']){if(_0xb9fde)this['parsedContent']['set'](_0xb9fde,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0xb9fde)));else{for(const [_0x447afe,_0x21d70e]of this['content'])this['parsedContent']['set'](_0x447afe,this['aiResponseParser']['parseAndNormalizeHTML'](_0x21d70e));}const _0x358ca1=this['changeGroups'];for(const _0x4b58ae of this['content']['keys']())this['updateChangeGroups'](_0x4b58ae);const _0x1300fd=this['_getDifferentChangeGroups'](_0x358ca1,this['changeGroups']);(_0x1300fd['length']||this['isDone'])&&(this['cachedSuggestionContentParts']['withDiff']['length']=this['cachedSuggestionContentParts']['withoutDiff']['length']=0x0,this['fire']('replyContentUpdated',this,_0x1300fd));}else this['parsedContent']['set']('text',this['aiResponseParser']['convertMarkdownToHTML'](this['content']['get']('text'))),this['fire']('replyContentUpdated',this);}_getDifferentChangeGroups(_0x541190,_0x526011){const _0x34356d=[];for(const _0x196833 of _0x526011){const _0x42a9e5=_0x541190[_0x196833['index']];_0x42a9e5?_0x42a9e5['changes']['length']!==_0x196833['changes']['length']?_0x34356d['push'](_0x196833):_0x42a9e5['changes']['forEach']((_0x4f34ea,_0x2ba08b)=>{const _0x58919c=_0x196833['changes'][_0x2ba08b];_0x4f34ea['id']!==_0x58919c['id']&&_0x34356d['push'](_0x196833);}):_0x34356d['push'](_0x196833);}return _0x34356d;}updateChangeGroups(_0x32a268){const _0x306e92=this['documentContextContent']['get'](_0x32a268),_0x9d671c=this['parsedContent']['get'](_0x32a268);if(!_0x306e92||!_0x9d671c)return;const _0x3d11f7=new _0x5a2eed('p',{},[new _0x5a2eed('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x34d40c(Os(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x1b72bf=this['aiResponseApplier']['merge'](_0x9d671c,_0x306e92['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x3d11f7});this['parsedMergedContent']['set'](_0x32a268,_0x1b72bf['parsedContent']);let _0x4040f8=[];if(_0x4b5d81(_0x24525f=>{const _0x62805f=Fs(_0x24525f,'data-id');if(!_0x62805f||!_0x10e38c(_0x62805f))return!0x1;const _0x3b4b8b=[_0x24525f,...Ys(_0x24525f)]['at'](-0x2);if(_0x24525f!=_0x3b4b8b){const _0x3ac696=Fs(_0x3b4b8b,'data-id');_0x10e38c(_0x3ac696)||(_0x4040f8['push']({'node':_0x3b4b8b,'id':_0x3ac696,'type':'modified'}),_0x1b72bf['modifiedNodeIds']['push'](_0x3ac696));}else _0x1b72bf['modifiedNodeIds']['includes'](_0x62805f)?_0x4040f8['push']({'node':_0x24525f,'type':'modified','id':_0x62805f}):_0x1b72bf['newNodeIds']['includes'](_0x62805f)?_0x4040f8['push']({'node':_0x24525f,'type':'new','id':_0x62805f,'anchorId':Fs(_0x24525f['previousSibling'],'data-id')}):_0x4040f8['push']({'node':_0x24525f,'type':'removed','id':_0x62805f});return!0x0;},this['parsedMergedContent']['get'](_0x32a268)),_0x4040f8=_0x4040f8['filter'](({node:_0x37e7a7})=>[...Ys(_0x37e7a7),_0x37e7a7]['every'](_0x2d21cb=>!Fs(_0x2d21cb,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x2161f3=>_0x2161f3['documentId']!==_0x32a268),0x0==_0x4040f8['length'])return;const _0xff275a=[[_0x4040f8[0x0]]];for(let _0x4ca432=0x1;_0x4ca432<_0x4040f8['length'];_0x4ca432++){const _0x5e264c=_0xff275a[_0xff275a['length']-0x1],_0x4ab25d=_0x5e264c[_0x5e264c['length']-0x1];_0x4040f8[_0x4ca432]['node']['previousSibling']==_0x4ab25d['node']&&'modified'!=_0x4040f8[_0x4ca432]['type']&&'modified'!=_0x4ab25d['type']?_0x5e264c['push'](_0x4040f8[_0x4ca432]):_0xff275a['push']([_0x4040f8[_0x4ca432]]);}for(const _0x572f70 of _0xff275a){const _0x55898c=_0x572f70[0x0],_0x20d0f9=_0x572f70[_0x572f70['length']-0x1],_0x28744d=_0x5105a5(_0x55898c['node']['previousSibling']);_0x28744d&&_0x572f70['unshift'](_0x28744d);const _0x85abae=_0x5105a5(_0x20d0f9['node']['nextSibling']);_0x85abae&&_0x572f70['push'](_0x85abae);}Us('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x32a268))['forEach'](_0x45c9a9=>{Ws(_0x45c9a9,'data-wrapped-id',null);});const _0x517607=new Map();Us('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x32a268))['forEach'](_0x53e634=>{const _0x1fd3bb=Fs(_0x53e634,'data-unwrapped-id'),_0x36398a=Fs(_0x53e634,'data-id');_0x517607['set'](_0x36398a,_0x1fd3bb),Ws(_0x53e634,'data-id',_0x1fd3bb),Ws(_0x53e634,'data-unwrapped-id',null);});for(const _0xb5ada7 of _0x4040f8){const _0x19b788=_0x517607['get'](_0xb5ada7['id']);_0x19b788&&(_0xb5ada7['id']=_0x19b788);}this['changeGroups']['push'](..._0xff275a['map']((_0x11e03f,_0x3312b2)=>{const _0x43d52e=this['_documentIdToSource']['get'](_0x32a268),_0x1f0cf5=this['_outdatedReasonByDocumentId']?.['get'](_0x32a268),_0x491d0c=this['areActionsDisabled']||void 0x0!==_0x1f0cf5;return{'changes':_0x11e03f,'state':_0x491d0c?'outdated':'pending','outdatedReason':_0x491d0c?_0x1f0cf5:void 0x0,'index':_0x3312b2,'editor':_0x43d52e['editor'],'rootName':_0x43d52e['rootName'],'documentId':_0x32a268};}));const _0x29dfd2=Array['from'](this['documentContextContent']['keys']());function _0x10e38c(_0x46eadc){return _0x1b72bf['modifiedNodeIds']['includes'](_0x46eadc)||_0x1b72bf['newNodeIds']['includes'](_0x46eadc)||_0x1b72bf['removedNodeIds']['includes'](_0x46eadc);}function _0x5105a5(_0x29260f){if(_0x29260f&&Fs(_0x29260f,'data-id')&&!Fs(_0x29260f,'data-unstable')){const _0x1f75f2=Fs(_0x29260f,'data-id');if(!_0x10e38c(_0x1f75f2))return{'node':_0x29260f,'type':'context','id':_0x1f75f2};}return null;}this['changeGroups']['sort']((_0x39d30d,_0x2dbe3a)=>_0x29dfd2['indexOf'](_0x39d30d['documentId'])-_0x29dfd2['indexOf'](_0x2dbe3a['documentId'])),this['changeGroups']['forEach']((_0x249d93,_0x5cfe09)=>{_0x249d93['index']=_0x5cfe09;});}};const ar=/* #__PURE__ -- @preserve */
31
+ dt(),hr=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var cr=class extends ar{['id'];['replies']=[];currentReply;['messageId'];actionCallId;currentRequest;connector;isStopped=!0x1;isDestroyed=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;_channelsToEditors;constructor({connector:_0x48ac69,locale:_0x516c6d,channelsToEditors:_0x30d659}){super(),this['id']=xt(),this['connector']=_0x48ac69,this['isStopped']=!0x0,this['locale']=_0x516c6d,this['_channelsToEditors']=_0x30d659||new Map();}async start(){await this['_run']();}async['resume'](_0x286a19){await this['_run'](_0x286a19);}async['_run'](_0x5c46bd){const _0x355415=[];let _0x51052b,_0x2ffeed,_0x4dd30a,_0xe7c6a3=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x5c46bd||this['sendRequest'](),this['fire']('interactionStarted',this);const _0x5096fe=await this['currentRequest']['getStream']();for await(const _0x2a9c69 of _0x5096fe){if(this['isStopped'])return;if('error'==_0x2a9c69['event'])return void this['fire']('error',{'error':new ct('ai-chat-interaction-error',this)});switch(_0x2a9c69['event']){case'message-metadata':this['messageId']=_0x2a9c69['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x2a9c69['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x2a9c69['data']['conversationTitle'],!0x0);break;case'source':_0x355415['push'](_0x2a9c69['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'](),_0x51052b='modification-delta'==_0x2a9c69['event']?'modification':'text',_0x2ffeed='modification-delta'==_0x2a9c69['event']?_0x2a9c69['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x51052b&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x51052b,'interactionId':this['id'],'id':_0x2ffeed,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x2a9c69['event']&&{'documentId':_0x2a9c69['data']['documentId']}}),'modification'==_0x51052b&&(this['currentReply']['sources']=_0x355415['splice'](0x0))),this['currentReply']['appendContent'](_0x2a9c69['data']['textDelta'],_0x2a9c69['data']['documentId']);break;case'mcp-tool-result':_0x4dd30a=JSON['parse'](_0x2a9c69['data']['result']),this['_handleToolResultData']({'toolName':_0x2a9c69['data']['toolName'],'data':_0x4dd30a['data'],'attributes':_0x4dd30a['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x2a9c69['data']['toolName'],'data':_0x2a9c69['data']['data']});}}_0xe7c6a3=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x355415['length']>0x0&&(this['currentReply']['sources']=_0x355415['splice'](0x0)),this['_finalizeInteraction'](_0xe7c6a3),this['fire']('interactionFinished',this));}}stop(){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}getReply(_0xc38097){return this['replies']['find'](_0x34abf3=>_0x34abf3['id']===_0xc38097);}destroy(){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x302c63=>_0x302c63['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}createReply(_0x423bb4){const _0x9b5ab8=this['getDocumentContext'](),_0x376007=new or({'locale':this['locale'],'documentContextContent':_0x9b5ab8?.['documents'],..._0x423bb4});return this['replies']['push'](_0x376007),_0x376007['delegate'](...hr)['to'](this),this['fire']('replyCreated',_0x376007),_0x376007;}setConversationTitle(_0x355240,_0x1eb9b1=!0x1){this['fire']('setConversationTitle',_0x355240,_0x1eb9b1);}resetWebSearchState(){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}resetReasoningState(){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}_handleToolResultData(_0x1ec20d){this['fire']('toolDataReceived',{'type':'result','toolName':_0x1ec20d['toolName'],'data':structuredClone(_0x1ec20d['data']||{}),'attributes':structuredClone(_0x1ec20d['attributes']||{})},this);}_handleToolNotificationData(_0x5ae7c6){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x5ae7c6['toolName'],'data':structuredClone(_0x5ae7c6['data'])},this);}_finalizeInteraction(_0x135bd9=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x135bd9),this['currentRequest']=this['currentReply']=void 0x0;}};const lr=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']]),ur=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var dr=class AIChatContext extends Wn{_connector;['_config'];['_ownerId'];constructor({connector:_0x4d6028,config:_0xf6a791,ownerId:_0x36066c}){super(),this['_connector']=_0x4d6028,this['_config']=_0xf6a791,this['_ownerId']=_0x36066c;}init(){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_shownLibraryContextRefIds']=new Set(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}getPendingContextItems(){return new Map(this['_pendingContextItems']);}async populateFromMessage(_0x20b2fd,_0x4649f2,_0x14c9d3=new Set()){const _0x4dde94=new Map(),{contextItem:_0x3b1503,unmatchedDocumentIds:_0xbbc12d}=await this['_populateDocumentContextItem'](_0x20b2fd,_0x4649f2);_0x3b1503&&_0x4dde94['set'](_0x3b1503['id'],_0x3b1503);for(const _0x5b6c85 of _0x20b2fd){if('document'===_0x5b6c85['type'])continue;const _0x52cc00=await this['_createContextItemFromContent'](_0x5b6c85,_0x14c9d3);_r(_0x52cc00)?this['_hideRepeatedContextReference'](_0x52cc00,_0x14c9d3):this['_addToConversationContextItem'](_0x52cc00),_0x4dde94['set'](_0x52cc00['id'],_0x52cc00);}return this['_restoreContextReferencesAttachment'](_0x4dde94,_0x14c9d3),{'contextItems':_0x4dde94,'hasUnmatched':_0xbbc12d['size']>0x0,'unmatchedDocumentIds':_0xbbc12d};}async _populateDocumentContextItem(_0x49929a,_0x3f20b1){const _0x3862d9=_0x49929a['filter'](_0x280929=>'document'===_0x280929['type']);if(0x0===_0x3862d9['length'])return{'unmatchedDocumentIds':new Set()};const _0x108d07=_0x3862d9['map'](_0x422d37=>_0x422d37['id']),_0x52bfaf=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x108d07)['getDocuments'](),_0x536917=new Map(_0x52bfaf['map'](_0x41c7bb=>[_0x41c7bb['id'],_0x41c7bb])),_0x566999=[],_0x3b37c4=new Set();for(const _0x5a3c9c of _0x3862d9){const _0x36b16e=_0x536917['get'](_0x5a3c9c['id']);_0x36b16e&&(this['_matchDocumentToRoot'](_0x36b16e,_0x3f20b1)||_0x3b37c4['add'](_0x36b16e['id']),_0x566999['push']({'id':_0x36b16e['id'],'content':_0x36b16e['content'],'version':_0x36b16e['attributes']?.['version']??0x0,'sessionId':_0x36b16e['attributes']?.['sessionId']??null,'selection':[],'selectionSignature':'','channelId':_0x36b16e['attributes']?.['channelId']??_0x3f20b1[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x36b16e['attributes']?.['rootName']??_0x3f20b1[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??'','editorConfig':_0x5a3c9c['editorConfig']}));}const _0x206e79={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x566999};return this['_addToConversationContextItem'](_0x206e79),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x206e79,'unmatchedDocumentIds':_0x3b37c4};}_matchDocumentToRoot(_0xabde66,_0x5b6e57){const _0xb4201f=_0xabde66['attributes']?.['channelId'],_0x31db80=_0xabde66['attributes']?.['rootName'];if(_0xb4201f&&_0x31db80){for(const _0x316b17 of _0x5b6e57)if(_0x316b17['config']['get']('collaboration.channelId')===_0xb4201f){for(const _0xd48d06 of _0x316b17['model']['document']['getRoots']())if('$graveyard'!==_0xd48d06['rootName']&&_0xd48d06['rootName']===_0x31db80)return{'editor':_0x316b17,'rootName':_0xd48d06['rootName']};}}}async _createContextItemFromContent(_0x5f580c,_0x4f2b21=new Set()){if('mcp-tool-context'===_0x5f580c['type'])return{'id':_0x5f580c['id'],'uiId':_0x5f580c['id'],'label':_0x5f580c['data']?.['label']||_0x5f580c['id'],'type':'mcp-tool-context','mcpServerName':_0x5f580c['mcpServerName'],'toolName':_0x5f580c['toolName'],'data':_0x5f580c['data']||{}};const _0xb30701=_0x5f580c['attributes']?.['resourceId']||(_r(_0x5f580c)?_0x5f580c['id']:void 0x0);return{'id':_0x5f580c['id'],'uiId':_0x5f580c['id'],'label':_0x5f580c['attributes']?.['label']||_0x5f580c['name']||_0x5f580c['url']||_0x5f580c['id'],'type':_0x5f580c['type'],..._0xb30701?{'resourceId':_0xb30701}:{},..._r(_0x5f580c)&&_0x4f2b21['has'](_0x5f580c['id'])?{'hidden':!0x0}:{}};}_restoreContextReferencesAttachment(_0x23ab24,_0x32b6cf){const _0x190256=new Set(),_0x462357=new Set();for(const _0x4abf20 of _0x23ab24['values']())_r(_0x4abf20)&&!_0x32b6cf['has'](_0x4abf20['id'])&&_0x190256['add'](_0x4abf20['id']);for(const _0xc8ad52 of Array['from'](this['_pendingContextItems']['values']()))_r(_0xc8ad52)&&(_0x190256['has'](_0xc8ad52['id'])?_0x462357['add'](_0xc8ad52['id']):this['_removeContextItem'](_0xc8ad52['uiId']));for(const _0x1112f6 of _0x23ab24['values']())_0x190256['has'](_0x1112f6['id'])&&!_0x462357['has'](_0x1112f6['id'])&&this['_keepContextItemAttached'](_0x1112f6);}getSentContextItems(){return new Map(this['_conversationContextItems']);}removeFromContext(_0x582a39){this['_pendingContextItems']['get'](_0x582a39)?.['isReadOnly']||this['_removeContextItem'](_0x582a39);}clearPendingContextItems(){if(0x0===this['_pendingContextItems']['size'])return;const _0x130b8e=Array['from'](this['_pendingContextItems']['values']());for(const _0x593542 of _0x130b8e)_r(_0x593542)&&_0x593542['hidden']||(this['_removeContextItem'](_0x593542['uiId']),_r(_0x593542)&&this['_keepContextItemAttached'](_0x593542));const _0x19f483=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x19f483&&this['_keepContextItemAttached'](_0x19f483);}addToConversationContext(_0x38b63b){for(const _0x44c87f of _0x38b63b['values']())_r(_0x44c87f)||this['_addToConversationContextItem'](_0x44c87f);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(_0x1fe705){return Array['from'](_0x1fe705['values']())['flatMap'](_0x5a8fe1=>this['_mapContextItemToRequestData'](_0x5a8fe1));}async addFilesToContext(_0x1d1f83,_0xb4b2ef,_0x46ef0b='file'){const _0x38799f='files-'+xt();this['_startUploadOperation'](_0x38799f);try{await Promise['all'](_0x1d1f83['map'](async _0xa4a92b=>{const _0x29b0e3='file-'+xt(),_0x4ccfd8=_0x5a8f00(_0xa4a92b['name']),_0x4c5edf='file'===_0x46ef0b&&_0xa4a92b['type']['startsWith']('image/')?'image':_0x46ef0b;try{this['_addContextItem']({'type':_0x4c5edf,'label':_0xb4b2ef?.['label']||_0x4ccfd8,'uiId':_0x29b0e3,'resourceId':_0xb4b2ef?.['resourceId']},!0x0);const _0x244c43=this['_connector']['uploadFile'](this['_ownerId'],_0xa4a92b,_0xb4b2ef);this['_ongoingUploads']['set'](_0x29b0e3,_0x244c43['abortController']);const {id:_0x3c6907}=await _0x244c43['getId']();this['_ongoingUploads']['delete'](_0x29b0e3),this['_finishContextItemLoading']({'type':_0x4c5edf,'id':_0x3c6907,'label':_0xb4b2ef?.['label']||_0x4ccfd8,'uiId':_0x29b0e3,'resourceId':_0xb4b2ef?.['resourceId']},!0x1);}catch(_0x40f9d9){if(this['_ongoingUploads']['delete'](_0x29b0e3),!zn(_0x40f9d9)){const _0x21d843=lr['get'](_0x40f9d9['code'])||'ai-chat-file-upload-failed',_0xac5e4a=new jn({'code':_0x21d843,'cause':_0x40f9d9,'context':{'fileName':_0x4ccfd8}});this['fire']('error',{'error':_0xac5e4a});}this['_removeContextItem'](_0x29b0e3);}}));}finally{this['_finishUploadOperation'](_0x38799f);}}addCurrentDocumentToContext(_0x69b421){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x93cf78={'type':'document','uiId':'current-document','label':_0x69b421,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x93cf78);}getCurrentDocumentContext(){return this['_pendingContextItems']['get']('current-document');}async updateCurrentDocuments(_0x2d4d24,_0xca55d4){const _0x44a8fa=this['getCurrentDocumentContext']();if(!_0x44a8fa)return;_0x2d4d24['length']>0x1&&_0x2d4d24['some'](_0x322ae0=>!_0x322ae0['description'])&&Ot('ai-chat-documents-missing-description');try{const _0xd44e0=(_0x44a8fa['documents']||[])['filter'](_0x568760=>_0xca55d4['has'](_0x568760['channelId']));if(!_0x2d4d24['length'])return void(_0x44a8fa['documents']=_0xd44e0);const _0x5487c0=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x2d4d24)['getIds']();if(_0x5487c0['length']!==_0x2d4d24['length']||_0x5487c0['some'](_0x253720=>!_0x253720?.['id'])){const _0x59dffe=new ct('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x59dffe});}const _0x5b25e2=_0x2d4d24['map']((_0x258efe,_0x279075)=>{return{'id':_0x5487c0[_0x279075]['id'],'content':_0x258efe['content'],'version':_0x258efe['version'],'sessionId':_0x258efe['sessionId'],'selection':(_0x4f7b30=_0x258efe['selections'],_0x4f7b30?_0x4f7b30['map'](_0xb70c40=>({'start':_0xb70c40['start'],'end':_0xb70c40['end']})):[]),'selectionSignature':_0x258efe['selectionSignature'],'channelId':_0x258efe['channelId'],'rootName':_0x258efe['rootName'],'editorConfig':_0x258efe['editorConfig']};var _0x4f7b30;});_0x44a8fa['documents']=[..._0xd44e0,..._0x5b25e2];}catch(_0x1edae9){throw new jn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x1edae9});}}addSelectionToContext(_0x5cad2c){this['_addContextItem']({'type':'selection','label':_0x5cad2c,'uiId':'selection','content':_0x5cad2c});}removeSelectionFromContext(){this['_removeContextItem']('selection');}async addUrlToContext(_0x44c77d,_0xfac5ed){const _0x4d4b89='url-'+xt();this['_startUploadOperation'](_0x4d4b89);const _0x7f93dc='url-'+xt();try{this['_addContextItem']({'type':'web-resource','label':_0xfac5ed?.['label']||_0x44c77d,'uiId':_0x7f93dc,'resourceId':_0xfac5ed?.['resourceId']},!0x0);const _0x38c26b=this['_connector']['uploadUrl'](this['_ownerId'],_0x44c77d,_0xfac5ed);this['_ongoingUploads']['set'](_0x7f93dc,_0x38c26b['abortController']);const {id:_0x266e96}=await _0x38c26b['getId']();this['_ongoingUploads']['delete'](_0x7f93dc),this['_finishContextItemLoading']({'type':'web-resource','id':_0x266e96,'label':_0xfac5ed?.['label']||_0x44c77d,'uiId':_0x7f93dc,'resourceId':_0xfac5ed?.['resourceId']},!0x1);}catch(_0x3d2106){this['_ongoingUploads']['delete'](_0x7f93dc),zn(_0x3d2106)||this['fire']('error',{'error':new ct('ai-chat-url-upload-failed',this,{'url':_0x44c77d,'originalError':_0x3d2106}),'url':_0x44c77d}),this['_removeContextItem'](_0x7f93dc);}finally{this['_finishUploadOperation'](_0x4d4b89);}}addToolItemToContext(_0xf1e008){_0xf1e008['id']=_0xf1e008['id']??xt()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0xf1e008['uiId'],_0xf1e008),this['fire']('contextItemAdded',{'contextItem':_0xf1e008,'isLoading':!0x1});}async['loadSourceResources'](_0x55e5af,_0x3e1862,_0x1e258b){const _0xf7116=this['_addContextOptionsState']['sources']['find'](_0x5e1c1e=>_0x5e1c1e['id']===_0x55e5af);if(!_0xf7116)return this['fire']('error',{'error':new ct('ai-chat-source-not-found',this,{'sourceId':_0x55e5af}),'sourceId':_0x55e5af}),[];try{const _0x31455b=(await _0xf7116['getResources'](_0x3e1862))['map'](_0x3a8561=>{const _0x138c0b=this['_isResourceInContext'](_0x3a8561['id']);return{..._0x3a8561,'isInContext':_0x138c0b};});return _0xf7116['resources']=_0x31455b,this['fire']('sourceResourcesLoaded',{'sourceId':_0x55e5af,'source':_0xf7116,'resources':_0x31455b,'uid':_0x1e258b}),_0x31455b;}catch(_0x63ac90){return this['fire']('error',{'error':new ct('ai-chat-source-resources-load-failed',this,{'sourceId':_0x55e5af,'originalError':_0x63ac90}),'sourceId':_0x55e5af,'sourceLabel':_0xf7116['label']}),[];}}async addResourceToContext(_0x442860,_0x3d0cf8){if(this['_isResourceInContext'](_0x3d0cf8['id']))return;if(_r(_0x3d0cf8))return void this['_addContextItem']({'type':'context','id':_0x3d0cf8['id'],'label':_0x3d0cf8['label'],'uiId':'context-'+xt(),'resourceId':_0x3d0cf8['id']});let _0x554c20=_0x3d0cf8['data'];if(!_0x554c20&&_0x442860['getData'])try{_0x554c20=await _0x442860['getData'](_0x3d0cf8['id']);}catch(_0x439f8d){return void this['fire']('error',{'error':new ct('ai-chat-resource-load-failed',this,{'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id'],'originalError':_0x439f8d}),'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id']});}if(_0x554c20)switch(_0x3d0cf8['type']){case'web-resource':if('string'!=typeof _0x554c20)return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id'],'expectedType':'string','actualType':typeof _0x554c20}),'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id']});await this['addUrlToContext'](_0x554c20,{'label':_0x3d0cf8['label'],'resourceId':_0x3d0cf8['id']});break;case'file':if(!(_0x554c20 instanceof File))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id'],'expectedType':'File','actualType':typeof _0x554c20}),'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id']});await this['addFilesToContext']([_0x554c20],{'label':_0x3d0cf8['label'],'resourceId':_0x3d0cf8['id']});break;case'text':if('object'!=typeof _0x554c20||!('content'in _0x554c20)||!('type'in _0x554c20))return void this['fire']('error',{'error':new ct('ai-chat-context-invalid-data',this,{'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x554c20}),'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id']});_0x554c20=AIChatContext['_convertTextResourceToFile'](_0x554c20,_0x3d0cf8['label']),await this['addFilesToContext']([_0x554c20],{'label':_0x3d0cf8['label'],'resourceId':_0x3d0cf8['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ct('ai-chat-context-unsupported-type',this,{'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id'],'resourceType':_0x3d0cf8['type']}),'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id']});}else this['fire']('error',{'error':new ct('ai-chat-resource-no-data',this,{'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id']}),'resourceId':_0x3d0cf8['id'],'sourceId':_0x442860['id']});}addContextSource(_0x47a2f2){this['_addContextOptionsState']['sources']['some'](_0x1b30dd=>_0x1b30dd['id']===_0x47a2f2['id'])||(this['_addContextOptionsState']['sources']['push']({..._0x47a2f2,'resources':[]}),this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']}));}toggleAddCurrentDocumentOptionVisibility(_0x4a90d5){if(void 0x0!==_0x4a90d5)this['_addContextOptionsState']['document']['isHidden']=!_0x4a90d5;else{const _0x4c50bc=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x4c50bc;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static _convertTextResourceToFile(_0x2d8712,_0x8e7924){switch(_0x2d8712['type']){case'markdown':return new File([_0x2d8712['content']],_0x8e7924,{'type':'text/markdown'});case'html':return new File([_0x2d8712['content']],_0x8e7924,{'type':'text/html'});default:return new File([_0x2d8712['content']],_0x8e7924,{'type':'text/plain'});}}static _mapContextItemToRequestData(_0x2d6dd){switch(_0x2d6dd['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x2d6dd['id']}];case'web-resource':return[{'type':'web-resource','id':_0x2d6dd['id']}];case'context':return[{'type':'context','id':_0x2d6dd['id']}];case'document':return _0x2d6dd['documents']?.['length']?_0x2d6dd['documents']['map'](({id:_0x2343e0,editorConfig:_0x1cc8ed,selection:_0x85e847})=>({'type':'document','id':_0x2343e0,..._0x1cc8ed&&{'editorConfig':_0x1cc8ed},..._0x85e847?.['length']&&{'selection':_0x85e847}})):[];case'mcp-tool-context':{const _0x46898c=_0x2d6dd;return[{'type':'mcp-tool-context','mcpServerName':_0x46898c['mcpServerName'],'toolName':_0x46898c['toolName'],'data':{..._0x46898c['data'],'label':_0x46898c['label']||_0x46898c['data']?.['label']||_0x46898c['id']},'id':_0x46898c['id']}];}default:return[];}}_addContextItem(_0x28441e,_0xee8ecb=!0x1){if(this['_pendingContextItems']['set'](_0x28441e['uiId'],_0x28441e),_0x28441e['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x28441e,'isLoading':_0xee8ecb}),'current-document'===_0x28441e['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x28441e['resourceId']){const _0x54724f=this['_findSourceIdsByResourceId'](_0x28441e['resourceId']);_0x54724f&&_0x54724f['forEach'](_0x47a279=>{this['_updateResourceInContextState'](_0x47a279,_0x28441e['resourceId'],!0x0);});}}_keepContextItemAttached(_0xd84d34){this['_addContextItem']({..._0xd84d34,'isReadOnly':!0x0,'hidden':!0x0});}_removeContextItem(_0x4a5a57){const _0x44dd1c=this['_pendingContextItems']['get'](_0x4a5a57),_0x5dc055=this['_ongoingUploads']['get'](_0x4a5a57);if(_0x5dc055&&(_0x5dc055['abort'](),this['_ongoingUploads']['delete'](_0x4a5a57)),_0x44dd1c?.['resourceId']){const _0x1b5c21=this['_findSourceIdsByResourceId'](_0x44dd1c['resourceId']);_0x1b5c21&&_0x1b5c21['forEach'](_0x16160a=>{this['_updateResourceInContextState'](_0x16160a,_0x44dd1c['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x4a5a57),this['fire']('contextItemRemoved',{'uiId':_0x4a5a57,'type':_0x44dd1c?.['type']}),'current-document'===_0x4a5a57&&this['toggleAddCurrentDocumentOptionVisibility']();}_finishContextItemLoading(_0x11533b,_0x572c10){if(this['_pendingContextItems']['has'](_0x11533b['uiId'])&&(this['_pendingContextItems']['set'](_0x11533b['uiId'],_0x11533b),this['fire']('contextItemLoadingEnded',{'contextItem':_0x11533b,'isLoading':_0x572c10}),_0x11533b['resourceId'])){const _0x2e950d=this['_findSourceIdsByResourceId'](_0x11533b['resourceId']);_0x2e950d&&_0x2e950d['forEach'](_0x511a85=>{this['_updateResourceInContextState'](_0x511a85,_0x11533b['resourceId'],!0x0);});}}_addToConversationContextItem(_0x1ac76b){this['_conversationContextItems']['set'](_0x1ac76b['uiId'],_0x1ac76b);}_hideRepeatedContextReference(_0xf648a7,_0x581728){_0x581728['has'](_0xf648a7['id'])||(this['_shownLibraryContextRefIds']['has'](_0xf648a7['id'])?_0xf648a7['hidden']=!0x0:this['_shownLibraryContextRefIds']['add'](_0xf648a7['id']));}_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'](_0x4b245d=>({..._0x4b245d,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}_getCustomSourcesInitialState(){return this['_config']?.['sources']?.['map'](_0x39cb29=>({..._0x39cb29,'resources':[]}))??[];}_isResourceInContext(_0x100d05){for(const _0x32812a of this['_pendingContextItems']['values']())if(_0x32812a['resourceId']===_0x100d05)return!0x0;for(const _0x484fe9 of this['_conversationContextItems']['values']())if(_0x484fe9['resourceId']===_0x100d05)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x2f1c80){const _0x2f4edf=[];for(const _0x3d8d42 of this['_addContextOptionsState']['sources'])_0x3d8d42['resources']['find'](_0x224b78=>_0x224b78['id']===_0x2f1c80)&&_0x2f4edf['push'](_0x3d8d42['id']);return 0x0===_0x2f4edf['length']?null:_0x2f4edf;}_updateResourceInContextState(_0x31ac7f,_0xa978ec,_0x339cf0){const _0x7a1e86=this['_addContextOptionsState']['sources']['find'](_0x2738ed=>_0x2738ed['id']===_0x31ac7f);if(!_0x7a1e86)return;const _0x212e72=_0x7a1e86['resources']['find'](_0x90d619=>_0x90d619['id']===_0xa978ec);_0x212e72&&(_0x212e72['isInContext']=_0x339cf0,this['fire']('resourceStateChanged',{'sourceId':_0x31ac7f,'resourceId':_0xa978ec,'isInContext':_0x339cf0}));}_startUploadOperation(_0x1c927a){this['_ongoingUploadOperations']['set'](_0x1c927a,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}_finishUploadOperation(_0x753838){this['_ongoingUploadOperations']['delete'](_0x753838),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};function _r(_0x19c065){return'context'===_0x19c065['type'];}var gr=class extends cr{['userMessage'];conversationId;contextItems=new Map();capabilities;['model'];attributes;context;constructor(_0x1575f5){super(_0x1575f5),this['conversationId']=_0x1575f5['conversationId'],this['contextItems']=_0x1575f5['contextItems'],this['capabilities']=_0x1575f5['capabilities'],this['userMessage']=_0x1575f5['userMessage'],this['model']=_0x1575f5['model'],this['attributes']=_0x1575f5['attributes'],this['context']=_0x1575f5['context']??new Wn();}sendRequest(){const _0x3adf52=dr['mapContextItemsToRequestData'](this['contextItems']),_0x36203c=this['context']['toRequestParts'](_0x3adf52);return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':_0x36203c,'capabilities':Gn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['context']['toMessageAttributes'](this['attributes'])});}getDocumentContext(){return this['contextItems']['get']('current-document');}};const Ar=/* #__PURE__ -- @preserve */
32
+ dt();var Ir=class extends Ar{['id'];isStarted=!0x1;isFromHistory;interactions=[];currentInteraction;selectedModel;connector;options;_abortReject;_channelsToEditors;_getSessionId;constructor(_0x5c5cb0){super(),this['options']=_0x5c5cb0,this['connector']=_0x5c5cb0['connector'],this['chatModels']=_0x5c5cb0['chatModels'],this['id']=_0x5c5cb0['conversationId'],this['isFromHistory']=_0x5c5cb0['isFromHistory'],this['_channelsToEditors']=_0x5c5cb0['channelsToEditors'],this['_getSessionId']=_0x5c5cb0['getSessionId'];}async init(_0xb2273b){try{this['chatContext']=new dr({'connector':this['connector'],'config':_0xb2273b,'ownerId':this['id']}),this['chatContext']['delegate'](...ur)['to'](this),this['chatContext']['init'](),this['options']['contextLibrary']?.['resolveContext']({'feature':'chat','extraContexts':this['options']['extraContexts'],'context':this['chatContext']}),this['chatCapabilities']=new Gn(),this['chatCapabilities']['delegate'](...Bn)['to'](this),this['chatCapabilities']['init']();const _0x3a41b0=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x3a41b0});const _0x1abdd2=await this['chatModels']['resolveModel'](this['options']['selectedModelId']);_0x1abdd2&&await this['setModel'](_0x1abdd2);}catch(_0x2d03ea){const _0x15cffb=new jn({'code':'ai-chat-conversation-init-failed','cause':_0x2d03ea,'type':'network'});this['fire']('error',{'error':_0x15cffb});}}async start(){if(this['isStarted'])throw new ct('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ct('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x1bdc98}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x1bdc98,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x5224c6){const _0x5002cd=new jn({'code':'ai-chat-conversation-start-failed','cause':_0x5224c6,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x5002cd}),_0x5002cd;}}async['load'](_0x23e22e){try{const _0xcff2b6=await this['connector']['fetchConversation'](_0x23e22e)['getConversation'](),_0x3d6190=await this['connector']['fetchConversationMessages'](_0x23e22e)['getMessages'](),_0x32e657=_0x3d6190[0x0]['model'];this['isStarted']=!0x0,this['id']=_0xcff2b6['id'],'title'in _0xcff2b6?this['fire']('setConversationTitle',_0xcff2b6['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']),this['selectedModel']=await this['chatModels']['getModel'](_0x32e657)??void 0x0,this['fire']('modelSelected',{'selectedModel':this['selectedModel'],'isDisabled':!0x0});const {streamingMessageId:_0x13461d}=await this['_processMessagesToInteractions'](_0x3d6190,_0x32e657);return _0x13461d&&this['currentInteraction']?this['_resumeStream'](_0x13461d):this['currentInteraction']=void 0x0,this;}catch(_0x2d65b0){const _0x692912=new jn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x2d65b0,'type':'network','context':{'conversationId':_0x23e22e}});throw this['fire']('error',{'error':_0x692912}),_0x692912;}}async _processMessagesToInteractions(_0xd43421,_0x3e20ce){let _0x2426d5,_0x5a3472,_0x586ae9=new Set();for(const _0x5cff23 of _0xd43421)if('user'===_0x5cff23['role']){const {contextItems:_0xfb6456,unmatchedDocumentIds:_0x415b60}=await this['_extractContextItems'](_0x5cff23);_0x586ae9=_0x415b60;const _0x170663={'isReasoningEnabled':Object['hasOwn'](_0x5cff23['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x5cff23['capabilities'],'webSearch')};_0x2426d5=this['createInteraction']({'userMessage':_0x5cff23['prompt'],'contextItems':_0xfb6456,'capabilities':_0x170663,'modelId':_0x3e20ce,'attributes':_0x5cff23['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x2426d5,_0x5a3472=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x5cff23['role']&&_0x2426d5){if('streaming'===_0x5cff23['status']){_0x5a3472=_0x5cff23['id'];continue;}if('error'===_0x5cff23['status'])continue;const _0x303ebe=[];for(const _0xa186ff of _0x5cff23['content'])switch(_0xa186ff['type']){case'text':case'modification':{const _0x5bda67=_0x2426d5['getDocumentContext'](),_0x4c64a8=this['_getOutdatedReasonsByDocumentId'](_0x5bda67,_0x586ae9),_0x49621e=_0x5bda67?.['documents']??[],_0x1e7730=_0x49621e['length']>0x0&&_0x49621e['every'](_0x53a13e=>_0x4c64a8['has'](_0x53a13e['id']));_0x2426d5['currentReply']?.['type']!==_0xa186ff['type']&&(_0x2426d5['currentReply']=_0x2426d5['createReply']({'type':_0xa186ff['type'],'isDone':!0x0,'interactionId':_0x2426d5['id'],'areActionsDisabled':_0x1e7730,'outdatedReasonByDocumentId':_0x4c64a8,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x303ebe['length']>0x0&&(_0x2426d5['currentReply']['sources']=_0x303ebe['splice'](0x0))),_0x2426d5['currentReply']['appendContent'](_0xa186ff['content'],_0xa186ff['documentId']);break;}case'url':_0x303ebe['push'](_0xa186ff);break;case'mcp-tool-result':{const {data:_0x5d88fd,attributes:_0x125ca5}=JSON['parse'](_0xa186ff['content']);_0x2426d5['_handleToolResultData']({'toolName':_0xa186ff['toolName'],'data':_0x5d88fd,'attributes':_0x125ca5});break;}}'cancelled'===_0x5cff23['status']&&this['fire']('error',{'interactionId':_0x2426d5['id'],'error':new ct('ai-request-aborted',this)});}}return{'streamingMessageId':_0x5a3472};}async _resumeStream(_0x1343a5){if(this['currentInteraction'])try{const _0xa0ae86=this['connector']['resumeStream'](this['id'],_0x1343a5);await this['currentInteraction']['resume'](_0xa0ae86);}catch(_0x29dba6){_0x29dba6 instanceof ct&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x29dba6});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async _extractContextItems(_0x518ace){return _0x518ace['content']?this['chatContext']['populateFromMessage'](_0x518ace['content'],Array['from'](this['_channelsToEditors']['values']()),Wn['getDefaultContextIds'](_0x518ace['attributes'])):{'contextItems':new Map(),'unmatchedDocumentIds':new Set()};}async handleUserInteraction({userMessage:_0x85f0b1,attributes:_0x3d5d28}){if(!this['isStarted'])throw new ct('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ct('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x419345=new Map(this['getPendingContextItems']()),_0x3b83a1=this['chatCapabilities']['getCapabilitiesConfig'](),_0x44d928=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x85f0b1,'contextItems':_0x419345,'capabilities':_0x3b83a1,'modelId':_0x44d928,'attributes':_0x3d5d28,'channelsToEditors':this['_channelsToEditors']}),await this['updateCurrentDocumentsInContext'](),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x4bc306){if(_0x4bc306 instanceof ct)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x4bc306});else{const _0xd87379=lr['get'](_0x4bc306['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ct(_0xd87379,null,{'error':_0x4bc306})});}}finally{this['stopProcessing']();}}stopProcessing(){this['_abortReject']&&(this['_abortReject'](),this['_abortReject']=void 0x0),this['currentInteraction']&&(this['currentInteraction']['stop'](),this['currentInteraction']=void 0x0);}createInteraction({userMessage:_0x57127e,contextItems:_0x4520c5,capabilities:_0x5db009,modelId:_0x3c76b9,attributes:_0xe6ddc3,channelsToEditors:_0xfb0bc5}){const _0xb834d5=new gr({'userMessage':_0x57127e,'contextItems':_0x4520c5,'capabilities':_0x5db009,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x3c76b9,'attributes':_0xe6ddc3,'channelsToEditors':_0xfb0bc5,'context':this['chatContext']['isEmpty']?void 0x0:new Wn(this['chatContext']['refs'])});return _0xb834d5['delegate'](...hr)['to'](this),this['interactions']['push'](_0xb834d5),this['fire']('interactionCreated',_0xb834d5),_0xb834d5;}getInteraction(_0x125710){return this['interactions']['find'](_0x5ddc68=>_0x5ddc68['id']===_0x125710);}removeInteraction(_0x3d7e61){const _0x1a5e61=this['getInteraction'](_0x3d7e61);_0x1a5e61&&(_0x1a5e61['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x1a5e61),0x1));}get lastInteraction(){return this['interactions'][this['interactions']['length']-0x1];}cancelLastInteractionStream(){const _0xa1236=this['lastInteraction'];_0xa1236?.['conversationId']&&_0xa1236['messageId']&&this['connector']['cancelStream'](_0xa1236['conversationId'],_0xa1236['messageId'])['execute']()['catch'](()=>{});}addCurrentDocumentToContext(_0x3ed7fe){this['chatContext']['addCurrentDocumentToContext'](_0x3ed7fe);}async updateCurrentDocumentsInContext(){if(!this['isCurrentDocumentInContext']())return;const {changedIds:_0x389c1e,unchangedIds:_0x295cf8}=this['_compareEditorStateWithDocumentContext'](),_0x4e46f9=new Promise((_0x45ebf7,_0x39b320)=>{this['_abortReject']=()=>_0x39b320(new ct('ai-request-aborted',this));}),_0x27ceb4=await Promise['race']([this['options']['aiEditing']['getDocumentData'](_0x389c1e),_0x4e46f9]);await Promise['race']([this['chatContext']['updateCurrentDocuments'](_0x27ceb4,_0x295cf8),_0x4e46f9]);}_compareEditorStateWithDocumentContext(){const _0x16bd84=new Set(),_0x455472=new Set(),_0x458cf0=this['options']['aiEditing']['getEditorsVersions'](),_0x4632b3=this['options']['aiEditing']['getEditorsSelections'](),_0x2005c7=this['chatContext']['getCurrentDocumentContext']()['documents']||[],_0x1b2ce2=new Map(_0x2005c7['map'](({channelId:_0x3c3dc0,version:_0x2a55ea})=>[_0x3c3dc0,_0x2a55ea])),_0x2a0e3d=new Map(_0x2005c7['map'](({channelId:_0x26f3a3,selectionSignature:_0x58bcb8})=>[_0x26f3a3,_0x58bcb8]));for(const [_0x237918,_0x22dc9f]of _0x458cf0){const _0x3d1efd=_0x4632b3['get'](_0x237918);_0x1b2ce2['get'](_0x237918)!=_0x22dc9f||_0x2a0e3d['get'](_0x237918)!=_0x3d1efd?_0x16bd84['add'](_0x237918):_0x1b2ce2['has'](_0x237918)&&_0x455472['add'](_0x237918);}return{'changedIds':_0x16bd84,'unchangedIds':_0x455472};}toggleAddCurrentDocumentOptionVisibility(_0x27d59b){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x27d59b);}_getOutdatedReasonsByDocumentId(_0x591481,_0x269842){const _0x219102=new Map();if(!_0x591481||!_0x591481['documents'])return _0x219102;for(const _0xdd5cb3 of _0x591481['documents']){const _0x4b0f8c=this['_channelsToEditors']['get'](_0xdd5cb3['channelId']);_0x4b0f8c&&'destroyed'!==_0x4b0f8c['state']?_0xdd5cb3['sessionId']!==this['_getSessionId'](_0x4b0f8c)?_0x219102['set'](_0xdd5cb3['id'],'session-changed'):_0x269842['has'](_0xdd5cb3['id'])&&_0x219102['set'](_0xdd5cb3['id'],'content-removed'):_0x219102['set'](_0xdd5cb3['id'],'editor-removed');}return _0x219102;}addSelectionToContext(_0x13522e){this['chatContext']['addSelectionToContext'](_0x13522e);}removeSelectionFromContext(){this['chatContext']['removeSelectionFromContext']();}addFilesToContext(_0x4db117){this['chatContext']['addFilesToContext'](_0x4db117);}addUrlToContext(_0x564a50){this['chatContext']['addUrlToContext'](_0x564a50);}addToolItemToContext(_0x1f1e3c){this['chatContext']['addToolItemToContext'](_0x1f1e3c);}addResourceToContext(_0x157ab7,_0x28b2ca){this['chatContext']['addResourceToContext'](_0x157ab7,_0x28b2ca);}['loadSourceResources'](_0x1e8d27,_0x466a84,_0x425c61){return this['chatContext']['loadSourceResources'](_0x1e8d27,_0x466a84,_0x425c61);}removeFromContext(_0x5d742e){this['chatContext']['removeFromContext'](_0x5d742e);}setWebSearch(_0x17d0f7){this['chatCapabilities']['setWebSearch'](_0x17d0f7);}toggleWebSearch(){this['chatCapabilities']['toggleWebSearch']();}setReasoning(_0x404109){this['chatCapabilities']['setReasoning'](_0x404109);}toggleReasoning(){this['chatCapabilities']['toggleReasoning']();}isCurrentDocumentInContext(){return this['chatContext']['isCurrentDocumentInContext']();}isCurrentDocumentInConversation(){return this['chatContext']['isCurrentDocumentInConversation']();}isSelectionInContext(){return this['chatContext']['isSelectionInContext']();}getPendingContextItems(){return this['chatContext']['getPendingContextItems']();}addDefaultContext(_0x4a7928){_0x4a7928['length']&&this['chatContext']['addDefaultContext'](_0x4a7928);}async setModel(_0x564819){_0x564819?!0x1===await this['chatModels']['isAvailable'](_0x564819)&&(Ot('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x564819}),_0x564819=(await this['chatModels']['getAvailableModels']())[0x0]):(Ot('ai-chat-conversation-set-model-null',{'conversation':this}),_0x564819=(await this['chatModels']['getAvailableModels']())[0x0]),_0x564819['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x564819,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x564819}));}};function pr({documentSuggestions:_0xdbddae,transform:_0x2d8825,documentChanges:_0x2e168a,documentChangesOptions:_0x2cec56}){const _0xa8124f=new Map();for(const [_0xdefbb1,{groups:_0x5268b3,documentContext:_0x2ef9b6,documentContent:_0x2f9572,editor:_0x8460f6}]of _0xdbddae){const _0x3b3047=_0x2ef9b6['content'],_0x1df95f=_0x2ef9b6['version'],_0x441377=_0x2f9572['cloneNode'](!0x0);for(const {changes:_0x531de9}of _0x5268b3)en(_0x441377,_0x531de9);const _0x5f06c5=Hs(_0x441377),_0x6eeee=nn(_0x8460f6,_0x2ef9b6['rootName'],_0x3b3047,_0x5f06c5);if(!_0x6eeee)continue;const _0x7b443e=_0x2e168a['getDiff'](_0x6eeee['before'],_0x6eeee['after'],{'targetEditor':_0x8460f6,'anchor':_0x2ef9b6['rootName'],..._0x2cec56});if(_0x2d8825){const _0x2921d1=_0x8460f6['model']['document']['history']['getOperations'](_0x1df95f),_0x75816c={'document':_0x8460f6['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0xa8124f['set'](_0xdefbb1,_0x3ceee1(_0x7b443e,_0x2921d1,_0x75816c)['operationsA']);}else _0xa8124f['set'](_0xdefbb1,_0x7b443e);}return _0xa8124f;}function mr({groups:_0x3e2d76,documentContextContent:_0xe3b169,documents:_0x187a11}){const _0x48c7ae=new Map();for(const _0x574d2c of _0x3e2d76){const {documentId:_0x44d352}=_0x574d2c,_0xd474d=_0x48c7ae['get'](_0x44d352);if(_0xd474d)_0xd474d['groups']['push'](_0x574d2c),_0xd474d['indexes']['push'](_0x574d2c['index']);else{const _0x4fe3ac=_0x187a11['find'](_0x42b8ec=>_0x42b8ec['id']===_0x44d352),_0x417d77=_0xe3b169['get'](_0x44d352);if(!_0x4fe3ac||!_0x417d77)continue;_0x48c7ae['set'](_0x44d352,{'groups':[_0x574d2c],'documentContext':_0x4fe3ac,'documentContent':_0x417d77,'editor':_0x574d2c['editor'],'indexes':[_0x574d2c['index']]});}}return _0x48c7ae;}function Er(_0x422905,_0x332878){const _0x1eae10=_0x422905['files']['length']>0x0&&_0x422905['files']['every'](_0x188247=>_0x188247['type']['startsWith']('image/')),_0x12b00d=_0x422905['plainText']['trim']()['length']>0x0;if(_0x422905['files']['length']>0x0&&_0x332878['filesEnabled']&&(!_0x1eae10||!_0x12b00d)){const _0x3e39b1=_0x422905['files']['filter'](_0x17610f=>_0x17610f['name']);return _0x3e39b1['length']>0x0?{'type':'file','files':_0x3e39b1}:null;}if(_0x332878['urlsEnabled']){const _0xf6f142=function(_0xb76648){const _0x38ba71=_0xb76648['trim']();if(/\s/['test'](_0x38ba71))return null;try{const _0xff3570=new URL(_0x38ba71);return'http:'!==_0xff3570['protocol']&&'https:'!==_0xff3570['protocol']?null:_0xff3570['toString']();}catch{return null;}}(_0x422905['plainText']);if(_0xf6f142)return{'type':'url','url':_0xf6f142};}const _0x155bdd=_0x422905['forceTextAttachment']?0x1:_0x332878['longTextThreshold']??0x1/0x0;if(_0x422905['plainText']['length']>=Math['max'](_0x155bdd,0x1)&&_0x332878['filesEnabled']){const _0x541eb1=_0x332878['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x422905['plainText']],_0x541eb1,{'type':'text/plain'})]};}return null;}var wr=class extends _0x338e6f{activeConversation;_aiEditing;_aiConnector;_aiChatUi;['_aiModels'];_aiContextLibrary;_contextLibrarySource=null;_hasAIChatBalloon=!0x1;_activeBalloon;_reporter;_batchToChanges=new Map();_currentPreviewedChangeGroup=null;_bodyCollection;_channelsToEditors=new Map();static get requires(){return[Ss,Jn,In,xs];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['set']('isConversationReady',!0x1),this['_bodyCollection']=nr(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](Jn)['createReporter']('aichat'),this['_aiModels']=this['context']['plugins']['get'](xs)['models'],this['_aiContextLibrary']=this['context']['plugins']['get'](xs)['contextLibrary'];const _0x4da036=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x299cf8,_0x396d7c)=>{this['sendMessage']({'message':_0x396d7c});}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',()=>{this['activeConversation']?.['stopProcessing']();}),this['listenTo'](_0x4da036['view'],'change:activeTab',(_0x560260,_0x454b3f,_0x28b6b4)=>{'chat'!==_0x28b6b4&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x3b0248,_0x567bdf)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x567bdf));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x2938c6,_0x39fab3)=>{this['activeConversation']?.['addUrlToContext'](_0x39fab3);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x2d24e1,_0x1a467c)=>{const _0x221de3=this['activeConversation'];if(!_0x221de3)return;_0x1a467c['hasDirectory']&&(_0x1a467c['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+xt()}));const _0x2d6c48=Er(_0x1a467c,{'pastedTextLabel':Os(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')});_0x2d6c48&&(_0x1a467c['preventDefault'](),'url'===_0x2d6c48['type']?_0x221de3['addUrlToContext'](_0x2d6c48['url']):_0x221de3['chatContext']['addFilesToContext'](_0x2d6c48['files'],void 0x0,_0x2d6c48['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x3fef8e,_0xfc2125)=>{_0xfc2125['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x43c686,_0x23ee06)=>{this['activeConversation']?.['addResourceToContext'](_0x23ee06['source'],_0x23ee06['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x5ca7be,_0x31c5ac)=>{this['_removeFromContext'](_0x31c5ac);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x4113a7,_0x547ea6)=>{this['activeConversation']?.['loadSourceResources'](_0x547ea6['sourceId'],_0x547ea6['query'],_0x547ea6['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x3e9180,_0x32b9ec)=>{this['activeConversation']?.['setModel'](_0x32b9ec);}),this['listenTo'](this['_aiChatUi'],'like',(_0x341d4f,{replyId:_0x44523c})=>{console['log']('Liked\x20response',_0x44523c);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x1f5b3e,{replyId:_0x347e66})=>{console['log']('Disliked\x20response',_0x347e66);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x2b3a46,_0x59ce82)=>{this['_insertSuggestion'](_0x59ce82);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x3993f5,{replyId:_0x301dd8,partIndex:_0x17b768})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x301dd8,_0x17b768);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x1a25c8,{replyId:_0x3c217b,partIndex:_0x2c992c})=>{const _0x1fa9ee=this['_getDocumentRangeForReplyChanges'](_0x3c217b,_0x2c992c);if(!_0x1fa9ee)return;const {reply:_0x141f1b}=this['getInteractionAndReplyById'](_0x3c217b);'$graveyard'!=_0x1fa9ee['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x141f1b['changeGroups'][_0x2c992c]['editor'],'ranges':[_0x1fa9ee['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x392b5e,_0x570f1f)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x570f1f);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x26f2e2,{replyId:_0x7a72a9,showDiff:_0x12ee34})=>{const {interaction:_0x37c52c,reply:_0x41be4f}=this['getInteractionAndReplyById'](_0x7a72a9),_0x3b0300=_0x41be4f['getContentParts']({'showDiff':_0x12ee34});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x37c52c['id']+':'+_0x41be4f['id'],'parts':_0x3b0300});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x3de9e4,{replyId:_0x3704a0,partIndex:_0x2c916b})=>{this['_rejectSuggestion']({'replyId':_0x3704a0,'partIndex':_0x2c916b}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x543466,_0x4564d1)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x4564d1);}),this['on']('replyCreated',(_0x2d35a5,_0x25897a)=>{this['_addFeedItemReply'](_0x25897a);});}afterInit(){this['context']instanceof _0x36c7af?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0xc5de39,_0x44cbdc)=>{_0x44cbdc['on']('ready',()=>{this['_integrateEditor'](_0x44cbdc);});}),this['context']['config']['get']('ai.chat.context')?.['contextLibrary']?.['enabled']&&this['_setUpContextLibrarySource'](),this['_initConversation']();}async _initConversation(){const _0x15f081=this['context']['config']['get']('ai.chat.initialConversation');let _0x39b76f=_0x15f081;('lastCreated'!=_0x15f081||(_0x39b76f=await this['_getLastCreatedConversationId'](),_0x39b76f))&&('new'==_0x39b76f?await this['_startConversationSafely']():await this['loadConversation'](_0x39b76f));}async destroy(){return this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async loadConversation(_0x27e394){this['_closeActiveBalloon'](),this['context']['plugins']['get'](bs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['_detachFromActiveConversation'](),this['_stopLastInteraction'](),this['_aiChatUi']['toggleConversationLoading'](!0x0);try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x27e394)['getConversation'](),await this['_startConversationSafely']({'id':_0x27e394}),await this['activeConversation']['load'](_0x27e394),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext'](),this['set']('isConversationReady',!0x0),this['activeConversation']?.['currentInteraction']?this['_aiChatUi']['enableControls']():this['_aiChatUi']['toggleConversationLoading'](!0x1);}catch(_0x10a126){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x27e394}),this['_reporter']['logError'](new ct('ai-chat-conversation-not-found',this,void 0x0,_0x10a126),{'context':{'operation':'load-conversation'}}),await this['_stopLastInteraction'](),this['_aiChatUi']['disableControls'](),this['set']('isConversationReady',!0x1),this['_aiChatUi']['resetChatBusyStateToIdle'](),this['activeConversation']?.['cancelLastInteractionStream']();}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}registerToolDataCallback(_0x41ded3){let _0x16e09a=null,_0x3a687f=null;this['on']('toolDataReceived',(_0x78c462,_0x345e33,_0x4e1771)=>{_0x4e1771['id']!==_0x16e09a&&(_0x16e09a=_0x4e1771['id'],_0x3a687f=this['_getAIChatFeedAPI'](_0x4e1771)),_0x41ded3(_0x345e33,_0x3a687f);});}addCurrentDocumentToChatContext(){Ls(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Os(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async addSelectionToChatContext(_0x32f4f6){const _0x5254eb=this['_aiEditing']['getSelectionText'](_0x32f4f6);this['activeConversation']?.['addSelectionToContext'](_0x5254eb),this['addCurrentDocumentToChatContext']();}removeSelectionFromChatContext(){this['activeConversation']?.['removeSelectionFromContext']();}focusPromptInput(){this['_aiChatUi']['focusPromptInput']();}async startConversation(_0x193b5e){await this['_startConversationSafely']({'modelId':_0x193b5e?.['modelId'],'contexts':_0x193b5e?.['contexts']});}async['sendMessage']({message:_0xa724c0,attributes:_0x32e34f}){if(!this['activeConversation'])throw new ct('ai-chat-controller-no-active-conversation');this['activeConversation']['id']&&this['activeConversation']['isStarted']&&(this['_aiChatUi']['startInteraction'](),await this['activeConversation']['handleUserInteraction']({'userMessage':_0xa724c0,'attributes':_0x32e34f}));}getGroupId(){const _0x45ed19=this['context']['config']['get']('collaboration.channelId');if(!_0x45ed19)throw new ct('ai-missing-channel-id',this);return _0x45ed19;}_handleRemovedConversation(_0x36021a){this['activeConversation']['id']===_0x36021a&&this['_startConversationSafely']();}['_isGroupReadOnly'](_0x363222){return!(!_0x363222['editor']||'destroyed'===_0x363222['editor']['state']||!_0x363222['editor']['isReadOnly']);}_isGroupWriteable(_0x3ac735){return!(!_0x3ac735['editor']||'destroyed'===_0x3ac735['editor']['state']||_0x3ac735['editor']['isReadOnly']);}_computeSuggestionGating(_0xeb4112){const _0xb04d86=new Map();for(const _0x40c235 of _0xeb4112['changeGroups'])_0xb04d86['set'](_0x40c235['index'],this['_isGroupReadOnly'](_0x40c235));const _0x16b8f=new Set(_0xeb4112['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']})['filter'](_0x49d016=>_0x49d016['hasChanges'])['map'](_0x6ff5cb=>_0x6ff5cb['index']));return{'readOnlyByIndex':_0xb04d86,'isAcceptAllEnabled':_0xeb4112['changeGroups']['some'](_0x27085d=>'pending'===_0x27085d['state']&&this['_isGroupWriteable'](_0x27085d)&&_0x16b8f['has'](_0x27085d['index']))};}_refreshSuggestionGating(){if(this['activeConversation']){for(const _0x48bd49 of this['activeConversation']['interactions'])for(const _0x236193 of _0x48bd49['replies'])'modification'===_0x236193['type']&&this['_aiChatUi']['hasFeedItem'](_0x236193['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x236193['id'],this['_computeSuggestionGating'](_0x236193));}if(this['_activeBalloon']&&this['_currentPreviewedChangeGroup']){const {reply:_0x42dcdc}=this['getInteractionAndReplyById'](this['_currentPreviewedChangeGroup']['replyId']),_0x438576=_0x42dcdc['changeGroups']['find'](_0x1e4262=>_0x1e4262['index']===this['_currentPreviewedChangeGroup']['partIndex']);_0x438576&&this['_activeBalloon']['setTargetReadOnly'](this['_isGroupReadOnly'](_0x438576));}}_prepareDocumentSuggestions(_0x1c47ac){const {reply:_0x4c7658,interaction:_0x33075f}=this['getInteractionAndReplyById'](_0x1c47ac['replyId']),_0x3d79ba=void 0x0!==_0x1c47ac['partIndex']?[_0x4c7658['changeGroups'][_0x1c47ac['partIndex']]]:_0x4c7658['changeGroups']['filter'](_0x53463=>'pending'===_0x53463['state']&&!this['_isGroupReadOnly'](_0x53463)),_0x18bf9c=_0x3d79ba['map'](_0x4a81f9=>_0x4c7658['changeGroups']['indexOf'](_0x4a81f9)),_0x124d17=sn(_0x4c7658['changeGroups'],_0x4c7658['documentContextContent']);return _0x18bf9c['forEach'](_0x15e999=>{if(_0x124d17['has'](_0x15e999))return;const _0x4a8c03=this['_getDocumentRangeForReplyChanges'](_0x1c47ac['replyId'],_0x15e999);_0x4a8c03&&'$graveyard'!=_0x4a8c03['range']['root']['rootName']?(_0x4c7658['setChangeGroupState'](_0x15e999,'accepted'),void 0x0!==_0x1c47ac['partIndex']&&this['_scrollToSuggestionRange'](_0x4a8c03['range'],!0x1,_0x4a8c03['targetEditor'])):_0x4c7658['setChangeGroupState'](_0x15e999,'outdated',this['_getOutdatedReason'](_0x4c7658['changeGroups'][_0x15e999]));}),mr({'groups':_0x3d79ba['filter'](_0x1179e7=>'accepted'===_0x1179e7['state']),'documentContextContent':_0x4c7658['documentContextContent'],'documents':_0x33075f['getDocumentContext']()?.['documents']??[]});}_insertSuggestion(_0x56e87f){const _0x10bd96=this['context']['plugins']['get'](In),{reply:_0xf0f0cc,interaction:_0x5399c4}=this['getInteractionAndReplyById'](_0x56e87f['replyId']),_0x53f8a0=this['_prepareDocumentSuggestions'](_0x56e87f),_0x5cf466=pr({'documentSuggestions':_0x53f8a0,'transform':!0x0,'documentChanges':_0x10bd96,'documentChangesOptions':{'markDeletions':!0x0}});for(const [_0x25b9a0,_0x2aa8da]of _0x5cf466){const {editor:_0x3887f4,indexes:_0x6e7440}=_0x53f8a0['get'](_0x25b9a0);if(!_0x3887f4['plugins']['has']('TrackChanges')){Ot('ai-no-track-changes',{'editor':_0x3887f4});continue;}let _0x43ad17;Mn(_0x2aa8da,'chat'),_0x3887f4['model']['change'](_0x275209=>{_0x43ad17=_0x275209['batch'],_0x3887f4['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x2aa8da),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x43ad17,{'interactionId':_0x5399c4['id'],'replyId':_0xf0f0cc['id'],'indexes':_0x6e7440});}this['_updateRatings'](_0xf0f0cc);}_applySuggestion(_0x4cdc6d){const _0x5f4950=this['context']['plugins']['get'](In),{reply:_0x35d3d8,interaction:_0x53d6e9}=this['getInteractionAndReplyById'](_0x4cdc6d['replyId']),_0x3cba46=this['_prepareDocumentSuggestions'](_0x4cdc6d),_0x489cd8=pr({'documentSuggestions':_0x3cba46,'transform':!0x0,'documentChanges':_0x5f4950,'documentChangesOptions':{'markDeletions':!0x1}});for(const [_0x245eeb,_0x225994]of _0x489cd8){const {editor:_0x3b2261,indexes:_0x2994a4}=_0x3cba46['get'](_0x245eeb);let _0x4dd755;Mn(_0x225994,'chat');try{_0x3b2261['model']['change'](_0x402253=>{_0x4dd755=_0x402253['batch'],_0x5f4950['applyOperations'](_0x402253,_0x225994);}),this['_batchToChanges']['set'](_0x4dd755,{'interactionId':_0x53d6e9['id'],'replyId':_0x35d3d8['id'],'indexes':_0x2994a4});}catch(_0x4c605c){throw this['_reporter']['logError'](new jn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x4c605c})),_0x4c605c;}}this['_updateRatings'](_0x35d3d8);}_rejectSuggestion(_0x513cd2){const {reply:_0x3cc05b}=this['getInteractionAndReplyById'](_0x513cd2['replyId']);_0x3cc05b['setChangeGroupState'](_0x513cd2['partIndex'],'rejected');}['_openBalloonFor'](_0x466bcb,_0x42b7a7){if(!this['_hasAIChatBalloon'])return;const {reply:_0x307d39}=this['getInteractionAndReplyById'](_0x466bcb),_0x3d0bbf=_0x307d39['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x3d0bbf['length'])return;let _0x43fd65,_0x2f9620;if(void 0x0!==_0x42b7a7?(_0x2f9620=_0x3d0bbf['find'](_0x5c3995=>_0x5c3995['index']==_0x42b7a7),_0x43fd65=_0x2f9620?.['index']):(_0x2f9620=_0x3d0bbf[0x0],_0x43fd65=_0x2f9620['index']),!_0x2f9620)return void _0x307d39['setChangeGroupState'](_0x42b7a7??0x0,'outdated','editor-removed');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x466bcb&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x43fd65)return;const _0x5b7a50=this['_getUserPresentableContentPartDocumentRange'](_0x466bcb,_0x307d39,_0x2f9620),_0x2ea58b=_0x307d39['changeGroups']['find'](_0x51197f=>_0x51197f['index']==_0x43fd65),_0x82e602=_0x2ea58b['editor'],_0x136013=_0x82e602['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x136013&&this['_activeBalloon']['close'](),!_0x5b7a50)return _0x136013['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x136013,this['_currentPreviewedChangeGroup']={'replyId':_0x466bcb,'partIndex':_0x43fd65},this['_scrollToSuggestionRange'](_0x5b7a50,!0x0,_0x82e602);const _0x28bafc=this['_getPresentableSiblingContentPartIndex'](_0x466bcb,_0x43fd65,'next');_0x136013['clearContent'](),_0x136013['updateContent']({'part':_0x2f9620,'renderingStrategy':'static'}),_0x136013['open']({'index':_0x43fd65,'title':Os(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x43fd65+0x1)['toString']()),'showRotator':null!==_0x28bafc,'ranges':[_0x5b7a50],'areActionsDisabled':_0x307d39['areActionsDisabled'],'targetEditor':_0x82e602,'isTargetReadOnly':this['_isGroupReadOnly'](_0x2ea58b)}),_0x136013['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x466bcb,_0x43fd65),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x466bcb,'index':_0x43fd65,'isActive':!0x0});}_closeActiveBalloon(){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}_getPresentableSiblingContentPartIndex(_0x213c75,_0x543c91,_0x41fa7b){const {reply:_0x86b90d}=this['getInteractionAndReplyById'](_0x213c75),_0xb2f1a2=_0x86b90d['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0xb2f1a2['length'])return null;const _0x43330c='next'==_0x41fa7b?0x1:-0x1;function _0x25200d(_0x59c234){const _0x47d960=(_0x59c234+_0x43330c+_0xb2f1a2['length'])%_0xb2f1a2['length'];return{'siblingIndex':_0x47d960,'siblingPart':_0xb2f1a2[_0x47d960]};}const _0x32da58=_0xb2f1a2['findIndex'](_0x3e0137=>_0x3e0137['index']==_0x543c91);let {siblingIndex:_0x1ee12d,siblingPart:_0xe7ade5}=_0x25200d(_0x32da58);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x213c75,_0x86b90d,_0xe7ade5);)if({siblingIndex:_0x1ee12d,siblingPart:_0xe7ade5}=_0x25200d(_0x1ee12d),_0x1ee12d===_0x32da58)return null;return _0xe7ade5['index'];}_getOutdatedReason(_0xec97c4){return _0xec97c4?.['editor']&&'destroyed'!==_0xec97c4['editor']['state']?'content-removed':'editor-removed';}_getUserPresentableContentPartDocumentRange(_0xc8744b,_0x1c8080,_0xe9e219){const _0x322d26=_0x1c8080['changeGroups'];if(!_0xe9e219['hasChanges'])return null;const _0x5f3c8f=_0x322d26['find'](_0x19e880=>_0x19e880['index']==_0xe9e219['index']);if('pending'!==_0x5f3c8f?.['state'])return null;if(!_0x5f3c8f?.['editor']||'destroyed'===_0x5f3c8f['editor']['state'])return _0x1c8080['setChangeGroupState'](_0xe9e219['index'],'outdated',this['_getOutdatedReason'](_0x5f3c8f)),null;const _0x26457f=this['_getDocumentRangeForReplyChanges'](_0xc8744b,_0xe9e219['index']);if(!_0x26457f)return _0x1c8080['setChangeGroupState'](_0xe9e219['index'],'outdated',this['_getOutdatedReason'](_0x5f3c8f)),null;const {range:_0x33c30d,currentIndex:_0xf4403a}=_0x26457f;return'$graveyard'==_0x33c30d['root']['rootName']?(_0x1c8080['setChangeGroupState'](_0xf4403a,'outdated',this['_getOutdatedReason'](_0x5f3c8f)),null):_0x26457f['range'];}_getDocumentRangeForReplyChanges(_0x20f6f9,_0x633c28){const {reply:_0x3b2eff,interaction:_0x1ed9ef}=this['getInteractionAndReplyById'](_0x20f6f9),_0xf2ced0=_0x3b2eff['changeGroups']['filter'](_0x5c98fe=>'pending'==_0x5c98fe['state']),_0x1fbf37=_0xf2ced0['map'](_0x345cfc=>_0x3b2eff['changeGroups']['indexOf'](_0x345cfc));void 0x0===_0x633c28&&(_0x633c28=_0x1fbf37[0x0]);const _0x2e4397=_0x1fbf37['indexOf'](_0x633c28);if(-0x1==_0x2e4397)return null;const _0x491b07=_0xf2ced0[_0x2e4397],_0x5ba695=_0x491b07['editor'];if(!_0x5ba695||'destroyed'===_0x5ba695['state'])return null;const _0x1e27ba=zs(_0x5ba695,_0x491b07['rootName']),_0x110393=_0x3b2eff['documentContextContent']['get'](_0x491b07['documentId']),_0x4c0d47=new _0x481874([]),_0x1bb241=new _0x481874([]);for(const _0x56b026 of _0x491b07['changes'])if('removed'!=_0x56b026['type']&&_0x1bb241['children']['push'](_0x56b026['node']['cloneNode'](!0x0)),'new'!=_0x56b026['type']){const _0x1a2a19=_0x580dea(_0x471f30=>Fs(_0x471f30,'data-id')==_0x56b026['id'],_0x110393,!0x0);_0x4c0d47['children']['push'](_0x1a2a19['cloneNode'](!0x0));}if(0x0==_0x4c0d47['children']['length']){if(_0x491b07['changes'][0x0]['anchorId']){const _0x115c8b=Ms('data-id',_0x491b07['changes'][0x0]['anchorId'],_0x110393);_0x4c0d47['children']['unshift'](_0x115c8b['cloneNode'](!0x0)),_0x1bb241['children']['unshift'](_0x115c8b['cloneNode'](!0x0)),_0x115c8b['nextSibling']&&(_0x4c0d47['children']['push'](_0x115c8b['nextSibling']['cloneNode'](!0x0)),_0x1bb241['children']['push'](_0x115c8b['nextSibling']['cloneNode'](!0x0)));}else{const _0x27095f=_0x110393['children'][0x0];if(!_0x27095f)return null;_0x4c0d47['children']['push'](_0x27095f['cloneNode'](!0x0)),_0x1bb241['children']['push'](_0x27095f['cloneNode'](!0x0));}}if(_0x1e27ba&&sn(_0x3b2eff['changeGroups'],_0x3b2eff['documentContextContent'])['has'](_0x491b07['index']))return null;const _0x4aa397=_0x1ed9ef['getDocumentContext'](),_0x453e43=_0x4aa397['documents']['find'](_0x40105e=>_0x40105e['id']==_0x491b07['documentId'])['content'],_0x2a9aa3=_0x5ba695['model']['document']['getRoot'](_0x491b07['rootName']),_0x57a5e9=_0x5ba695['data']['parse'](_0x453e43,_0x2a9aa3),_0x37e073=_0x1e27ba?Zs(Hs(_0x4c0d47)):Hs(_0x4c0d47),_0x3c8c74=_0x5ba695['data']['parse'](_0x37e073,_0x2a9aa3),_0x46c571=_0x5ba695['data']['parse'](_0x37e073,_0x2a9aa3),_0x3f66fc=_0x5ba695['model']['createPositionAt'](_0x3c8c74,0x0),_0x10e1e5=_0x1e27ba?Zs(Hs(_0x1bb241)):Hs(_0x1bb241),_0x8107ff={'targetEditor':_0x5ba695,'anchor':_0x3f66fc,'markDeletions':!0x1};let _0x307127;try{_0x307127=_0x5ba695['plugins']['get'](In)['getDiff'](_0x37e073,_0x10e1e5,_0x8107ff);}catch(_0x12353d){return this['_reporter']['reportError'](new jn({'code':'ai-chat-suggestion-diff-failed','type':'runtime','severity':'warning','cause':_0x12353d,'context':{'replyId':_0x20f6f9,'partIndex':_0x633c28}})),null;}if(!_0x307127['length'])return null;_0x5ba695['model']['change'](_0x4215e5=>{for(const _0x26ad9f of _0x307127)if(!_0x3a283d(_0x26ad9f)){if('remove'==_0x26ad9f['type']){const _0x1128c1=_0x26ad9f['sourcePosition'],_0x3253b5=_0x26ad9f['howMany'],_0x345a66=new _0x4b3a4f(_0x1128c1,_0x3253b5);_0x4215e5['batch']['addOperation'](_0x345a66),_0x5ba695['model']['applyOperation'](_0x345a66);}else'marker'!==_0x26ad9f['type']&&(_0x26ad9f['baseVersion']=null,_0x26ad9f['isDocumentOperation']=!0x1,_0x4215e5['batch']['addOperation'](_0x26ad9f),_0x5ba695['model']['applyOperation'](_0x26ad9f));}});const _0x450f0d=Nn(_0x5ba695,_0x307127,_0x3c8c74);Ln(_0x5ba695['model'],_0x450f0d);const _0x3787a3=_0x450f0d['getFirstRange']()['start']['path']['slice'](),_0x595454=_0x450f0d['getFirstRange']()['end']['path']['slice'](),_0x4c4186=[];let _0x13fe35=_0x3c8c74,_0x4c4972=_0x46c571;for(let _0x3723b9=0x0;_0x3723b9<_0x595454['length'];_0x3723b9++){const _0x1cf89f=_0x13fe35['maxOffset']-_0x595454[_0x3723b9];_0x4c4186[_0x3723b9]=_0x4c4972['maxOffset']-_0x1cf89f,_0x13fe35=_0x13fe35['getChildAtOffset'](_0x595454[_0x3723b9]),_0x4c4972=_0x4c4972['getChildAtOffset'](_0x4c4186[_0x3723b9]);}const _0x3fac9b=_0x5ba695['model']['createRange'](_0x5ba695['model']['createPositionFromPath'](_0x46c571,_0x3787a3),_0x5ba695['model']['createPositionFromPath'](_0x46c571,_0x4c4186)),_0x33dc3c=_0x3fac9b['start']['path']['slice'](),_0x3b0c94=_0x3fac9b['end']['path']['slice']();if(!_0x1e27ba){const _0x328b22=_0x46c571['getChild'](0x0)['getAttribute'](gn),_0x511edf=Array['from'](_0x57a5e9['getChildren']())['find'](_0x1e04ad=>_0x1e04ad['getAttribute'](gn)==_0x328b22)['getPath']();_0x33dc3c[0x0]=_0x511edf[0x0]+_0x33dc3c[0x0],_0x3b0c94[0x0]=_0x511edf[0x0]+_0x3b0c94[0x0];}let _0x588999=_0x5ba695['model']['createRange'](_0x5ba695['model']['createPositionFromPath'](_0x5ba695['model']['document']['getRoot'](_0x491b07['rootName']),_0x33dc3c),_0x5ba695['model']['createPositionFromPath'](_0x5ba695['model']['document']['getRoot'](_0x491b07['rootName']),_0x3b0c94));const _0x4b2cf9=_0x4aa397['documents']['find'](_0x3c9a15=>_0x3c9a15['id']==_0x491b07['documentId'])['version'],_0x39ea6d=_0x5ba695['model']['document']['history']['getOperations'](_0x4b2cf9);for(const _0x2c4927 of _0x39ea6d)_0x588999=_0x5708b2['_createFromRanges'](_0x588999['getTransformedByOperation'](_0x2c4927));return{'range':_0x588999,'currentIndex':_0x633c28,'targetEditor':_0x5ba695};}_integrateEditorBalloon(_0x7015d4){if(!_0x7015d4['plugins']['has']('AIChatBalloon'))return;const _0x2fbe8b=_0x7015d4['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x2fbe8b['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x2fbe8b,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x3af47d,partIndex:_0x3fc847}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x4d7c36}=this['getInteractionAndReplyById'](_0x3af47d),_0x53b20a=_0x4d7c36['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x3fc847});_0x2fbe8b['updateContent']({'part':_0x53b20a[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x2fbe8b,'applySuggestion',()=>{const {replyId:_0x1893b1,partIndex:_0x3dd87e}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x1893b1,'partIndex':_0x3dd87e}),_0x2fbe8b['setState']('accepted');}),this['listenTo'](_0x2fbe8b,'insertSuggestion',()=>{const {replyId:_0x3a5e34,partIndex:_0x53bc12}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x3a5e34,'partIndex':_0x53bc12}),_0x2fbe8b['setState']('accepted');}),this['listenTo'](_0x2fbe8b,'rejectSuggestion',()=>{const {replyId:_0x193058,partIndex:_0x213a00}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x193058,'partIndex':_0x213a00}),_0x2fbe8b['setState']('rejected');}),this['listenTo'](_0x2fbe8b,'showNext',()=>{const {replyId:_0x293ed5,partIndex:_0x198c60}=this['_currentPreviewedChangeGroup'],_0x561411=this['_getPresentableSiblingContentPartIndex'](_0x293ed5,_0x198c60,'next');null!==_0x561411&&this['_openBalloonFor'](_0x293ed5,_0x561411);}),this['listenTo'](_0x2fbe8b,'showPrevious',()=>{const {replyId:_0x530986,partIndex:_0x52eab2}=this['_currentPreviewedChangeGroup'],_0xd887c2=this['_getPresentableSiblingContentPartIndex'](_0x530986,_0x52eab2,'previous');null!==_0xd887c2&&this['_openBalloonFor'](_0x530986,_0xd887c2);}),this['listenTo'](_0x2fbe8b,'dialogClosed',(_0x3f53d1,{id:_0x2803c5})=>{if('aiChatBalloon'!==_0x2803c5)return;const {replyId:_0x4271e9,partIndex:_0x1227d4}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x4271e9,'index':_0x1227d4,'isActive':!0x1}),this['_activeBalloon']===_0x2fbe8b&&(this['_activeBalloon']=void 0x0);});}_integrateEditor(_0x21726f){if(this['_channelsToEditors']['set'](_0x21726f['config']['get']('collaboration.channelId'),_0x21726f),this['_integrateEditorBalloon'](_0x21726f),this['addCurrentDocumentToChatContext'](),this['listenTo'](_0x21726f,'change:isReadOnly',()=>this['_refreshSuggestionGating']()),_0x21726f['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x21726f['plugins']['has']('Undo')){const _0x345fa5=_0x21726f['commands']['get']('undo'),_0x5f2476=_0x21726f['commands']['get']('redo');this['listenTo'](_0x345fa5,'revert',(_0x4dd215,_0x58c8ab,_0xb3f1f7)=>{const _0x205e87=this['_batchToChanges']['get'](_0x58c8ab);if(!_0x205e87)return;const _0x3e8e0a=this['activeConversation']['getInteraction'](_0x205e87['interactionId']),_0x2a2f5a=_0x3e8e0a?.['getReply'](_0x205e87['replyId']);this['_batchToChanges']['delete'](_0x58c8ab),_0x3e8e0a&&_0x2a2f5a&&(_0x205e87['indexes']['forEach'](_0x1999f2=>_0x2a2f5a['setChangeGroupState'](_0x1999f2,'pending')),this['_batchToChanges']['set'](_0xb3f1f7,_0x205e87));}),this['listenTo'](_0x5f2476,'revert',(_0x4e986d,_0x125393,_0x2111fc)=>{const _0x4120ba=this['_batchToChanges']['get'](_0x125393);if(!_0x4120ba)return;const _0x59ad63=this['activeConversation']['getInteraction'](_0x4120ba['interactionId']),_0xe2b912=_0x59ad63?.['getReply'](_0x4120ba['replyId']);this['_batchToChanges']['delete'](_0x125393),_0x59ad63&&_0xe2b912&&(_0x4120ba['indexes']['forEach'](_0x2c6930=>_0xe2b912['setChangeGroupState'](_0x2c6930,'accepted')),this['_batchToChanges']['set'](_0x2111fc,_0x4120ba));});}const _0x46de1c=_0x21726f['config']['get']('ai.chat.context');_0x46de1c['alwaysAddSelection']&&_0x46de1c['document']['enabled']&&this['listenTo'](_0x21726f['model']['document']['selection'],'change:range',(_0xe64114,_0x3cf337)=>{_0x3cf337['directChange']&&'chat'===_0x21726f['plugins']['get']('AITabs')['view']['activeTab']&&(_0x21726f['model']['hasContent'](_0x21726f['model']['document']['selection'])?this['addSelectionToChatContext'](_0x21726f):this['removeSelectionFromChatContext']());});}async _getLastCreatedConversationId(){const _0x4d2321=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x2ff1b5=await _0x4d2321['getConversations']();return _0x2ff1b5['length']?_0x2ff1b5[0x0]['id']:'new';}catch(_0x451279){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':xt()}),this['_reporter']['logError'](new ct('ai-chat-conversation-init-failed',this,{'error':_0x451279})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async _startConversationSafely(_0x176176={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x176176),_0x176176['id']||this['set']('isConversationReady',!0x0);}catch(_0x30a0d1){this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x176176['id']||xt()}),this['_reporter']['logError'](_0x30a0d1),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}_detachFromActiveConversation(){this['_aiChatUi']['setIsUploadInProgress'](!0x1),this['activeConversation']&&this['stopListening'](this['activeConversation']);}async _handleStartConversation({id:_0x283f82,modelId:_0x2da076,contexts:_0x17cfc2}={}){this['_detachFromActiveConversation'](),this['_closeActiveBalloon']();let _0x24e765=_0x2da076;_0x24e765||(_0x283f82||!this['activeConversation']?_0x24e765=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x24e765=this['activeConversation']['selectedModel']?.['id'])),this['_stopLastInteraction']();const _0x78615e=this['getGroupId'](),_0x2fda8c=_0x283f82||xt(),_0x152eb7=await this['_aiModels']['getAvailableModels']();let _0x52a79a;this['activeConversation']=new Ir({'connector':this['_aiConnector'],'chatModels':this['_aiModels'],'selectedModelId':_0x24e765,'conversationId':_0x2fda8c,'group':_0x78615e,'locale':this['context']['locale'],'isFromHistory':!!_0x283f82,'channelsToEditors':this['_channelsToEditors'],'contextLibrary':this['_aiContextLibrary'],'extraContexts':_0x17cfc2,'getSessionId':_0x67fdf6=>this['_aiEditing']['getSessionId'](_0x67fdf6),'aiEditing':this['_aiEditing']}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',()=>{this['_aiChatUi']['createConversation']({'availableModels':_0x152eb7}),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x283f82||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x42dcbf,_0x3fba40)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x3fba40['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x4fd969=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x4fd969);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x19714f=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x19714f);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x5eec26,_0x3504de)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x3504de,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x3da6a5,_0x99d589)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x99d589,{'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',(_0x544271,_0x19707b)=>{this['_aiChatUi']['removeFeedInteraction'](_0x19707b['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x5ac041,_0x3f4897,_0x1332d2)=>{this['_updateConversationTitle'](_0x3f4897,_0x1332d2);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x13709e,_0x384d2f)=>{void 0x0!==_0x52a79a&&_0x52a79a!==_0x384d2f['id']&&this['_updateReplyContentThrottled']['flush'](),_0x52a79a=_0x384d2f['id'],_0x384d2f['isFromHistory']?await this['_updateReplyContent']({'reply':_0x384d2f}):await this['_updateReplyContentThrottled']({'reply':_0x384d2f});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x44cd43,{reply:_0x332c40,index:_0x4901bc,state:_0x90a82,outdatedReason:_0x302409})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x332c40['id'],'index':_0x4901bc,'state':_0x90a82,'outdatedReason':_0x302409}),this['_aiChatUi']['hasFeedItem'](_0x332c40['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x332c40['id'],this['_computeSuggestionGating'](_0x332c40)),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x332c40['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x4901bc&&this['_activeBalloon']?.['setState'](_0x90a82,_0x302409);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x1eaebd,_0x1ffca3)=>{if(this['_aiChatUi']['addContextItem'](_0x1ffca3['contextItem'],_0x1ffca3['isLoading']),'selection'===_0x1ffca3['contextItem']['type']){const _0xd4a9cc=Ds(this['context']),_0x12963a=[..._0xd4a9cc['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0xd4a9cc,'ranges':_0x12963a,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x4e9993,_0x504cd5)=>{this['_aiChatUi']['removeContextItem'](_0x504cd5['uiId']),'current-document'==_0x504cd5['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x504cd5['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x227aaf,_0x15181d)=>{this['_aiChatUi']['setContextItemLoading'](_0x15181d['contextItem']['uiId'],_0x15181d['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0xa23a51,_0x24b875)=>{this['_aiChatUi']['setConversationContext'](_0x24b875['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x3727ee,_0x424cb1)=>{this['_aiChatUi']['setAddContextOptions'](_0x424cb1['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x7d32c,_0x195ec8)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x195ec8['sourceId'],_0x195ec8['source'],_0x195ec8['resources'],_0x195ec8['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x146974,_0x14cd66)=>{this['_aiChatUi']['updateResourceState'](_0x14cd66['sourceId'],_0x14cd66['resourceId'],_0x14cd66['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x142efb,_0x5a4e3d)=>{this['_aiChatUi']['updateCapabilities'](_0x5a4e3d);}),this['listenTo'](this['activeConversation'],'modelSelected',(_0x5c1c92,_0x49bd8e)=>{this['_aiChatUi']['setSelectedModel'](_0x49bd8e['selectedModel']??null,_0x49bd8e['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',async(_0xab7fc2,{error:_0x367d7b,interactionId:_0x1e34d5,fileName:_0x45c7c0,url:_0x18b8d3,sourceId:_0x2a6b3f,sourceLabel:_0x1fb684})=>{let _0x4c1e47;const _0x5d52fa=_0x1e34d5?_0x1e34d5+':'+xt():xt();this['_reporter']['reportError'](_0x367d7b),this['_aiChatUi']['startAutoScroll'](),_0x367d7b['message']['startsWith']('ai-request-aborted')?(this['_cancelProcessing'](),this['activeConversation']?.['cancelLastInteractionStream'](),_0x4c1e47=this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Os(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x5d52fa})):_0x367d7b['message']['startsWith']('ai-chat-conversation-init-failed')||_0x367d7b['message']['startsWith']('ai-chat-conversation-start-failed')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-file-upload-failed')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x45c7c0),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-url-upload-failed')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x18b8d3),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-context-invalid-data')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-context-unsupported-type')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x2a6b3f&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x2a6b3f),_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x1fb684||'source'),'id':_0x5d52fa})):_0x367d7b['message']['startsWith']('ai-chat-resource-load-failed')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-invalid-request')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-context-unsupported-file-type')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-context-file-too-large')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-context-file-too-many-pages')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x5d52fa}):_0x367d7b['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x5d52fa}):(this['_cancelProcessing'](),_0x4c1e47=this['_aiChatUi']['addFeedItemError']({'errorMessage':Os(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x5d52fa}));try{await Promise['race']([_0x4c1e47,this['_aiChatUi']['idleUiPromise']]);}finally{this['_aiChatUi']['isBusy']||this['_aiChatUi']['stopAutoScroll']();}}),await this['activeConversation']['init'](this['_buildConversationContextConfig']()),_0x283f82||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']());}_buildConversationContextConfig(){const _0x2b0cc6=this['context']['config']['get']('ai.chat.context');return this['_contextLibrarySource']?{..._0x2b0cc6,'sources':[..._0x2b0cc6?.['sources']??[],this['_contextLibrarySource']]}:_0x2b0cc6;}async _setUpContextLibrarySource(){const _0x40d8c8=await this['_createContextLibrarySource']();_0x40d8c8&&(this['_contextLibrarySource']=_0x40d8c8,this['activeConversation']&&this['activeConversation']['chatContext']['addContextSource'](_0x40d8c8));}async _createContextLibrarySource(){let _0x164601;try{_0x164601=await this['_aiContextLibrary']['getAvailableContexts']();}catch{return null;}if(!_0x164601['length'])return null;const _0x37c382=_0x164601['map'](_0x2dd9fe=>({'id':_0x2dd9fe['id'],'type':'context','label':_0x2dd9fe['name']||_0x2dd9fe['id']}));return{'id':'ck-ai-context-library','label':Os(this['context']['locale'],'AI_CHAT_CONTEXT_LIBRARY_LABEL'),'useDefaultFiltering':!0x0,'getResources':()=>Promise['resolve'](_0x37c382)};}_removeFromContext(_0x2bf7ed){this['activeConversation']?.['removeFromContext'](_0x2bf7ed);}_toggleWebSearch(){this['activeConversation']?.['toggleWebSearch']();}_toggleReasoning(){this['activeConversation']?.['toggleReasoning']();}getInteractionAndReplyById(_0x403d0d){const [_0xceb252,_0x15a617]=_0x403d0d['split'](':'),_0x5ad818=this['activeConversation']['getInteraction'](_0xceb252);return{'interaction':_0x5ad818,'reply':_0x5ad818['getReply'](_0x15a617)};}_scrollToSuggestionRange(_0x4c232c,_0x16f957=!0x1,_0x702186){const _0x51c346={'target':_0x702186['editing']['view']['domConverter']['viewRangeToDom'](_0x702186['editing']['mapper']['toViewRange'](_0x4c232c)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x16f957};_0x16f957&&(_0x51c346['alignToTop']=!0x0),kt(_0x51c346);}_updateConversationTitle(_0x23a9f5,_0x3ce26c=!0x1){this['_aiChatUi']['setConversationTitle'](_0x23a9f5||Os(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x3ce26c);}_addFeedItemReply(_0xc91887){'text'===_0xc91887['type']?this['_aiChatUi']['addFeedItemAIReply'](_0xc91887):this['_aiChatUi']['addFeedItemAISuggestion'](_0xc91887);}async _updateReplyContent({reply:_0x22c792,renderingStrategy:_0x51a32b}){const {id:_0x1c43b4,interactionId:_0x31c9c7,isDone:_0x123495,type:_0x4e4b81,parsedContent:_0x1c68e0}=_0x22c792,_0xb4951d=_0x31c9c7+':'+_0x1c43b4;if('modification'===_0x4e4b81){const _0x38c401=_0x22c792['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0xb4951d,'parts':_0x38c401,'isDone':_0x123495,'skipLoadingEffects':_0x22c792['isFromHistory']}),this['_aiChatUi']['hasFeedItem'](_0x22c792['id'])&&this['_aiChatUi']['setSuggestionGating'](_0x22c792['id'],this['_computeSuggestionGating'](_0x22c792));}else'text'===_0x4e4b81&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0xb4951d,'parsedContent':_0x1c68e0['get']('text'),'renderingStrategy':_0x51a32b,'isDone':_0x123495});_0x123495&&_0x22c792['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0xb4951d,_0x22c792['sources']);}_updateReplyContentThrottled=_0x425461(this['_updateReplyContent']['bind'](this),0xc8);_stopLastInteraction(){this['activeConversation']?.['stopProcessing'](),this['_aiChatUi']['stopInteraction'](this['activeConversation']?.['lastInteraction']),this['_updateReplyContentThrottled']['cancel']();}async _flushLastInteractionUI(){const _0x15d737=this['activeConversation']?.['lastInteraction'];if(_0x15d737){for await(const _0x3696c2 of _0x15d737['replies'])this['_aiChatUi']['hasFeedItem'](_0x3696c2['id'])||this['_addFeedItemReply'](_0x3696c2),await this['_updateReplyContent']({'reply':_0x3696c2,'renderingStrategy':'static'});}}async['_cancelProcessing'](){this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext']();}_updateRatings(_0x4094f4){const _0x2c0500={'positiveCount':_0x4094f4['changeGroups']['filter'](_0x1a7fa8=>'accepted'===_0x1a7fa8['state'])['length'],'totalCount':_0x4094f4['changeGroups']['length'],'modificationId':_0x4094f4['id']},_0x5ab141=this['activeConversation']['getInteraction'](_0x4094f4['interactionId'])['messageId'];_0x5ab141&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x5ab141,_0x2c0500);}_getAIChatFeedAPI(_0x2d6744){const _0x29edac=this['_aiChatUi'],_0x10752e=()=>{_0x2d6744['resetWebSearchState'](),_0x2d6744['resetReasoningState'](),_0x29edac['clearLoadingMessage']();},_0x3f5acf=()=>{_0x2d6744['currentReply']&&(_0x2d6744['currentReply']['done'](),_0x2d6744['currentReply']=void 0x0);};return{'insertTextReply':(_0x11ef3e,_0x5bb5d7)=>{_0x3f5acf(),_0x10752e();const _0x917805=_0x2d6744['currentReply']=_0x2d6744['createReply']({'type':'text','interactionId':_0x2d6744['id'],'id':_0x5bb5d7||xt(),'channelsToEditors':this['_channelsToEditors']});return _0x917805['appendContent'](_0x11ef3e),_0x3f5acf(),_0x917805;},'insertCustomElement':async(_0x5ced87,_0x2a481f)=>(_0x3f5acf(),_0x10752e(),_0x29edac['addFeedItemCustomElement'](_0x5ced87,_0x2a481f||xt())),'setLoadingMessage':_0x2d76db=>{_0x29edac['setLoadingMessage'](_0x2d76db);},'clearLoadingMessage':()=>{_0x29edac['clearLoadingMessage']();}};}_checkRemoveCurrentDocumentFromChatContext(){Ls(this['context'])['find'](_0x5c38f2=>'destroyed'!==_0x5c38f2['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const Tr=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],fr=[...Tr,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function Cr(_0x250e62){const _0x4dec2a=new AbortController();return{'promise':new Promise((_0x46adeb,_0x527ac7)=>{const _0x50a14c=setTimeout(_0x46adeb,_0x250e62);_0x4dec2a['signal']['addEventListener']('abort',()=>{clearTimeout(_0x50a14c),_0x527ac7();});}),'abortController':_0x4dec2a};}var br=class{options;isStreaming=!0x1;document=null;nodesList=[];currentIndex=0x0;timeoutAbortController=null;lastUpdateTime=0x0;constructor(_0x2e4252){this['options']={'delay':_0x2e4252?.['delay']??0xa,'textNodeStyle':_0x2e4252?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async stream({document:_0x4e932c,targetElement:_0x2907b9,abortSignal:_0x224b56}){this['isStreaming']&&this['stop'](),_0x224b56?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x4f309c(_0x4e932c,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0xb095bf=0x0;_0xb095bf<this['currentIndex'];_0xb095bf++)this['nodesList'][_0xb095bf]['shouldBeStreamed']=!0x0;do{const _0x5cd3c2=Date['now'](),_0x4dd7bb=this['nodesList'][this['currentIndex']],_0x45aa93=_0x5cd3c2-this['lastUpdateTime'];if(_0x4dd7bb){_0x4dd7bb['shouldBeStreamed']=!0x0;let _0x478428=_0x4dd7bb['parent'];for(;_0x478428;)_0x478428['shouldBeStreamed']=!0x0,_0x478428=_0x478428['parent'];}if(_0x45aa93<this['options']['delay'])try{const {promise:_0xfd892,abortController:_0x25b616}=Cr(this['options']['delay']-_0x45aa93);this['timeoutAbortController']=_0x25b616,await _0xfd892;}catch(_0x1acc1d){return;}_0x22a371(_0x2907b9,'<'+_0x2907b9['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x2907b9['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:_0x6e4c45}){Array['from'](_0x6e4c45['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x167960=>{_0x167960['replaceWith'](_0x167960['childNodes'][0x0]);});}stop(){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x573bf7){let _0x2cebd4='';if(function(_0x2e6dc5){return _0x230e03(_0x2e6dc5);}(_0x573bf7)){for(const _0x422d9f of _0x573bf7['children'])_0x2cebd4+=this['renderNode'](_0x422d9f);}else{if(Or(_0x573bf7)){if(!_0x573bf7['shouldBeStreamed'])return'';const _0x968015=_0x573bf7,_0x5ce6f3=Object['entries'](_0x968015['attribs'])['map'](([_0x71cb2a,_0xa5e275])=>_0x71cb2a+'=\x22'+_0xa5e275+'\x22')['join']('\x20');_0x2cebd4+='<'+_0x968015['tagName']+(_0x5ce6f3?'\x20'+_0x5ce6f3:'')+'>';for(const _0x219c13 of _0x5e1910(_0x968015))_0x2cebd4+=this['renderNode'](_0x219c13);_0x2cebd4+='</'+_0x968015['tagName']+'>';}else{if(!Rr(_0x573bf7))return'';if(!_0x573bf7['shouldBeStreamed'])return'';!function(_0x409432){return!(!_0x409432['parent']||!Or(_0x409432['parent']))&&(!!Sr['includes'](_0x409432['parent']['tagName'])&&!_0x48e653(_0x409432)['match'](/^\s*[<>]\s*$/));}(_0x573bf7)?_0x2cebd4+=_0x2a51a3(_0x573bf7):_0x2cebd4+=_0x2a51a3(new _0x5a2eed('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x573bf7]));}}return _0x2cebd4;}getParsedDocumentNodeList(){const _0x45cdd5=[];return function(_0x5a9ea9,_0x522bc5){const _0x3e2f29=_0x4844ae=>{if(_0x522bc5(_0x4844ae),_0x4844ae instanceof _0x5c1b78)for(let _0x2bdeab=0x0;_0x2bdeab<_0x4844ae['children']['length'];_0x2bdeab++){const _0x466f39=_0x4844ae['children'][_0x2bdeab];_0x3e2f29(_0x466f39);}};for(let _0x547193=0x0;_0x547193<_0x5a9ea9['children']['length'];_0x547193++)_0x3e2f29(_0x5a9ea9['children'][_0x547193]);}(this['document'],_0x848113=>{if(Rr(_0x848113)){const _0x504b5e=this['splitTextNodeIntoWordNodes'](_0x848113);_0x504b5e['length']&&_0x45cdd5['push'](..._0x504b5e);}_0x848113['isWordSplitSource']||_0x848113['isWordSplitResult']||_0x45cdd5['push'](_0x848113);}),_0x45cdd5;}splitTextNodeIntoWordNodes(_0x104162){if(_0x104162['isWordSplitSource']||_0x104162['isWordSplitResult'])return[];const _0x3c936c=_0x48e653(_0x104162)['match'](/(?:\s*\S+\s*)/g),_0x1aec09=[];if(_0x3c936c&&_0x3c936c['length']>0x1){for(const _0x3e7b1f of _0x3c936c){const _0x566d79=new _0x34d40c(_0x3e7b1f);_0x566d79['isWordSplitResult']=!0x0,_0x4c725e(_0x104162,_0x566d79),_0x1aec09['push'](_0x566d79);}_0x104162['isWordSplitSource']=!0x0,_0x3339cd(_0x104162);}return _0x1aec09;}};const Sr=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function Rr(_0x369ecc){return _0x17ad85(_0x369ecc);}function Or(_0x388da0){return _0x5ebc36(_0x388da0);}function vr(_0x3491b8,_0x53f460){_0x3491b8['cleanUpAnimations']({'targetElement':_0x53f460}),_0x53f460['querySelectorAll']('[data-id]')['forEach'](_0x2e761f=>{_0x2e761f['removeAttribute']('data-id');});}var yr=class extends _0xfd0945{options;content='';htmlStreamer;['children'];constructor(_0x2e6ec8){super();const _0x435c82=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new br(),this['options']=_0x2e6ec8,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x435c82['if']('isDone','ck-ai-chat__feed__item_done'),_0x435c82['if']('isVisible','ck-hidden',_0xc06b4f=>!_0xc06b4f),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){vr(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async streamIntoElement(_0x5b5bce,_0x48ad1b,_0x558479){await this['htmlStreamer']['stream']({'document':_0x5b5bce,'targetElement':_0x48ad1b,'abortSignal':_0x558479});}},kr=class extends _0xfd0945{['showChangesToggleView'];constructor(_0x242f19,_0x3974af){super(_0x242f19),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Nr(_0x242f19),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+ir,'label':Os(_0x242f19,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x3974af['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x16e800=>_0x16e800?it:et),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x2f9045=new Xt();_0x2f9045['content']=_0x399c89,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x3974af['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x2f9045,{'tag':'span','children':[Os(_0x242f19,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Nr=class extends Bt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const xr={'accepted':_0xca6ce1,'rejected':_0x509f6e,'outdated':_0x3e7339};var Lr=class extends _0xfd0945{statePillView;constructor(_0x1e6484){super(_0x1e6484);const _0x3cdadf=this['bindTemplate'];this['set']('state','accepted'),this['set']('outdatedReason',void 0x0),this['set']('isVisible',!0x0),this['statePillView']=new _0x3097ca(_0x1e6484),this['statePillView']['bind']('label')['to'](this,'state',_0x1c98a5=>function(_0x1c1508,_0x4c76e0){return Os(_0x1c1508,'AI_SUGGESTION_CONTENT_PART_STATE_'+_0x4c76e0['toUpperCase']());}(_0x1e6484,_0x1c98a5)),this['statePillView']['bind']('icon')['to'](this,'state',_0x3071fa=>xr[_0x3071fa]),this['statePillView']['bind']('class')['to'](this,'state',_0x5c091a=>'ck-pill_'+_0x5c091a),this['statePillView']['bind']('tooltip')['to'](this,'state',this,'outdatedReason',(_0x547f5e,_0x9ce616)=>function(_0x795477,_0x1525d5,_0xdc05a8){if('outdated'!==_0x1525d5)return;return Os(_0x795477,_0xdc05a8?Dr[_0xdc05a8]:'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_TOOLTIP');}(_0x1e6484,_0x547f5e,_0x9ce616)),this['statePillView']['tooltipPosition']='s',this['statePillView']['tooltipClass']='ck-tooltip_multi-line',this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x3cdadf['if']('isVisible','ck-hidden',_0x237e2b=>!_0x237e2b)]},'children':[this['statePillView']]});}setState(_0x3a089d,_0x149387){this['state']=_0x3a089d,this['outdatedReason']='outdated'===_0x3a089d?_0x149387:void 0x0;}};const Dr={'content-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_CONTENT_REMOVED_TOOLTIP','editor-removed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_EDITOR_REMOVED_TOOLTIP','session-changed':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED_SESSION_CHANGED_TOOLTIP'};var Pr=class extends _0x3a20a6{_applyButton;_suggestButton;constructor(_0x4e4c99,_0x29d5ac,_0x38f924){super(_0x4e4c99);const _0x40a94c=Boolean(_0x38f924);this['set']('isEnabled',!_0x40a94c),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x41be06=[];if(!_0x40a94c){_0x29d5ac['includes']('applySuggestion')&&(this['_applyButton']=new Bt(_0x4e4c99),this['_applyButton']['set']({'label':Os(_0x4e4c99,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x157716}),this['_applyButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x2b702e,_0x4ed03d)=>_0x2b702e&&!_0x4ed03d),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0xcf5d31=>!_0xcf5d31),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x41be06['push'](this['_applyButton'])),_0x29d5ac['includes']('insertSuggestion')&&(this['_suggestButton']=new Bt(_0x4e4c99),this['_suggestButton']['set']({'label':Os(_0x4e4c99,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x3bf0bc}),this['_suggestButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isTargetReadOnly',(_0x4b8e92,_0x246ed4)=>_0x4b8e92&&!_0x246ed4),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x41be06['push'](this['_suggestButton']));const _0x5ca464=new Bt(_0x4e4c99);_0x5ca464['set']({'label':Os(_0x4e4c99,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x57faee}),_0x5ca464['bind']('isEnabled')['to'](this),_0x5ca464['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x41be06['push'](_0x5ca464);}this['items']['addMany'](_0x41be06);const _0x28644b=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x28644b['if']('isVisible','ck-hidden',_0x2623f8=>!_0x2623f8)]}});}setButtonsVisibility({showApplyButton:_0x483963,showSuggestButton:_0x361f27}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x483963),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x361f27);}},Hr=class extends _0xfd0945{toolbarView;stateView;titleLabelView;['children'];constructor(_0x4dafd0,{part:_0x147533,uiIndex:_0x1166e1,availableActions:_0x400b1a,areActionsDisabled:_0x5e06dd}){super(_0x4dafd0),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1),this['toolbarView']=new Pr(_0x4dafd0,_0x400b1a,_0x5e06dd),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x147533['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x147533['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x147533['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn','isTargetReadOnly')['to'](this),this['stateView']=new Lr(_0x4dafd0),this['titleLabelView']=new Mr(_0x4dafd0,_0x1166e1),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',(_0xdc1b30,_0x18b2c7,_0x3bd268,_0x2f5060)=>{'pending'===_0x2f5060?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x3bd268?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x3bd268,this['outdatedReason']),this['children']['add'](this['stateView']));});}},Mr=class extends _0xfd0945{constructor(_0x4fc6f2,_0x352859){super(_0x4fc6f2),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Os(_0x4fc6f2,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x352859['toString']())]});}},Ur=class extends _0xfd0945{htmlStreamer;constructor(_0x4abbc7){super(_0x4abbc7),this['htmlStreamer']=new br(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async update({part:_0x5d2754,renderingStrategy:_0x484ae7,abortSignal:_0x331c7f}){this['_ensureHostElementTag'](_0x5d2754['wrapperTag']||'div');const _0x4586be=_0x4f309c(_0x5d2754['content'],!0x0);for(const _0x40ecc4 of Vs(_0x4586be))_0x3339cd(_0x40ecc4);'streaming'===_0x484ae7?await this['htmlStreamer']['stream']({'document':_0x4586be,'targetElement':this['element'],'abortSignal':_0x331c7f}):_0x22a371(this['element'],'<'+this['element']['tagName']+'>'+Hs(_0x4586be)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}cleanUpStreamingArtifacts(){vr(this['htmlStreamer'],this['element']);}_ensureHostElementTag(_0x199ccf){if(!this['element']||this['element']['tagName']['toLowerCase']()===_0x199ccf)return;const _0x11ef52=new _0xe6f3c8({'tag':_0x199ccf,'attributes':{'class':this['element']['className']}})['render']();this['element']['replaceWith'](_0x11ef52),this['element']=_0x11ef52;}},Vr=class extends _0xfd0945{['_children'];['_headerView'];_streamableContentView;constructor(_0x1fc895,{part:_0xa51d45,uiIndex:_0xf68a84,areActionsDisabled:_0x44cb90,availableActions:_0x25d2b8}){super(_0x1fc895);const _0x30fc32=this['bindTemplate'];this['set']('state',_0xa51d45['state']),this['set']('outdatedReason',_0xa51d45['outdatedReason']),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('isTargetReadOnly',!0x1);const _0xd14e34=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x44cb90;};this['on']('change:state',_0xd14e34),this['on']('change:isDone',_0xd14e34),_0xd14e34(),this['_children']=this['createCollection'](),this['_headerView']=new Hr(_0x1fc895,{'part':_0xa51d45,'uiIndex':_0xf68a84,'availableActions':_0x25d2b8,'areActionsDisabled':_0x44cb90}),this['_headerView']['bind']('isEnabled','outdatedReason','state','isTrackChangesOn','isTargetReadOnly')['to'](this),this['_headerView']['delegate'](...Tr)['to'](this),this['_streamableContentView']=new Ur(_0x1fc895),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x30fc32['to']('state',_0x389bb3=>'ck-ai-suggestion__body__content-part_'+_0x389bb3),_0x30fc32['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x30fc32['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x30fc32['if']('isVisible','ck-hidden',_0x2cc5ee=>!_0x2cc5ee)]},'children':this['_children'],'on':{'mouseenter':_0x30fc32['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0xa51d45['index']});}),'mouseleave':_0x30fc32['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0xa51d45['index']});}),'click':_0x30fc32['to'](_0x6e40c7=>{const _0x236f9a=_0x6e40c7['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x236f9a)&&this['fire']('showChangeInText',{'index':_0xa51d45['index']});})}});}async updateContent({part:_0x3b26fc,showUnchangedParts:_0x24b0a5=!0x1,abortSignal:_0x5c517a}){this['partDefinition']=_0x3b26fc,this['isVisible']=this['partDefinition']['hasChanges']||_0x24b0a5,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x3b26fc,'renderingStrategy':'static','abortSignal':_0x5c517a});}['markAsDone'](){this['isDone']=!0x0;}},Br=class extends _0xfd0945{constructor(_0x869088,_0x5d4b24){super(_0x869088),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0xf847f9=>!_0xf847f9)]},'children':this['_createSkeletonItems'](_0x5d4b24)});}_createSkeletonItems(_0x1bdb6f){const _0x1e7cac=['ck','ck-ai-skeleton__item'];return _0x1bdb6f['map'](_0x80f83b=>{let _0x4ff47e='';switch(_0x80f83b['attributes']['align']){case'right':_0x4ff47e='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x4ff47e='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x4ff47e='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x80f83b['tag'],'attributes':{'class':[..._0x1e7cac,_0x80f83b['attributes']['class']?_0x80f83b['attributes']['class']:''],'style':'width:\x20'+_0x80f83b['attributes']['width']+';\x20height:\x20'+_0x80f83b['attributes']['height']+';'+_0x4ff47e}};});}};const Gr={'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':Kr(0x5,'100%','44px','right'),'aiChatResources':Kr(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 Kr(_0x5e1f11,_0x4c78b9,_0x151728,_0x5359bf){return new Array(_0x5e1f11)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x4c78b9,'height':_0x151728,'align':_0x5359bf}}));}const Fr=/* #__PURE__ -- @preserve */
33
+ dt();var Wr=class extends Fr{['queue']=[];['isProcessing']=!0x1;_abortController;async['enqueue'](_0x205faa){const _0x59e745=this['createTask'](_0x205faa);return this['queue']['push'](_0x59e745),this['_processQueue'](),_0x59e745['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(_0x43f7b7=>{this['once']('_queueEmpty',()=>{_0x43f7b7();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x5992db=this['queue']['shift']();try{await _0x5992db['callback'](this['_abortController']['signal']),_0x5992db['resolve']();}catch(_0x531271){_0x5992db['reject'](_0x531271);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}createTask(_0x2dc6b5){let _0x4d7098,_0x185da8;const _0x2c8ea7=new Promise((_0x4b767a,_0x59b909)=>{_0x4d7098=_0x4b767a,_0x185da8=_0x59b909;});return{'callback':_0x2dc6b5,'resolve':_0x4d7098,'reject':_0x185da8,'completePromise':_0x2c8ea7};}},$r=class extends yr{constructor(_0x3fb11d){super(_0x3fb11d),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x3fb11d['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}setContent(_0x589b68){this['element']['innerHTML']=_0x589b68;}};const Yr=['applySuggestion','insertSuggestion'];var qr=class extends _0xfd0945{_applyChangesButton;_insertSuggestionsButton;['children'];constructor(_0x567524,_0x4cf212=[...Yr],_0x5f590a){super(_0x567524);const _0x1f2be7=this['bindTemplate'],_0x5dc12c=Boolean(_0x5f590a);this['set']('isEnabled',!_0x5dc12c),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x5dc12c||(this['_applyChangesButton']=new Bt(_0x567524),this['_applyChangesButton']['set']({'label':Os(_0x567524,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4cf212['includes']('applySuggestion'),'class':tr}),this['_insertSuggestionsButton']=new Bt(_0x567524),this['_insertSuggestionsButton']['set']({'label':Os(_0x567524,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x4cf212['includes']('insertSuggestion'),'class':er}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x1a18b8=>{_0x1a18b8['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',_0x1f2be7['if']('isVisible','ck-hidden',_0x43f7ee=>!_0x43f7ee)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}updateVisibility(_0x10ec95){this['isVisible']=_0x10ec95;}_switchButtonLabelsPlurality(_0x82e8cb){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x82e8cb?(this['_applyChangesButton']['label']=Os(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Os(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Os(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Os(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},Qr=class extends _0xfd0945{['children'];['balloonPanelView'];bodyCollection;constructor(_0x1ac2b8,_0x5773ce){super(_0x1ac2b8),this['bodyCollection']=_0x5773ce,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',_0x5844eb=>!_0x5844eb)]},'children':this['children']});const _0x4c6eb9=new _0xfd0945(this['locale']),_0x171ac0=new Xt();_0x171ac0['content']=ht,_0x4c6eb9['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x171ac0,{'tag':'span','children':[{'text':Os(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x4c6eb9),this['_setupBalloonPanel'](_0x1ac2b8);}['addSource'](_0x4c866e){this['children']['add'](new Xr(this['locale'],_0x4c866e,this['balloonPanelView']));}_setupBalloonPanel(_0x1834a4){this['balloonPanelView']=new Pt(_0x1834a4),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},Xr=class extends Bt{['balloonPanelView'];['source'];constructor(_0xdb709f,_0x22e0e3,_0x113f58){super(_0xdb709f),this['source']=_0x22e0e3,this['balloonPanelView']=_0x113f58,this['set']({'label':_0x22e0e3['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0xa75d91=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0xa75d91['to'](()=>{window['open'](_0x22e0e3['url'],'_blank');}),'mouseenter':_0xa75d91['to'](()=>{this['_showTooltip']();}),'mouseleave':_0xa75d91['to'](()=>{this['_hideTooltip']();})}}),_0x22e0e3['favicon']){const _0x14e9e5=new _0xfd0945(_0xdb709f);_0x14e9e5['setTemplate']({'tag':'img','attributes':{'src':_0x22e0e3['favicon']||ht,'alt':_0x22e0e3['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x14e9e5);}else this['set']('icon',ht);}_createTooltipContentView(_0x3f1fdb,_0x368d84){const _0x5e2b5f=new _0xfd0945(_0x3f1fdb),_0x4c3804=[];let _0x21cc65;_0x368d84?.['favicon']?(_0x21cc65=new _0xfd0945(_0x3f1fdb),_0x21cc65['setTemplate']({'tag':'img','attributes':{'src':_0x368d84['favicon'],'alt':_0x368d84['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x21cc65=new Xt(),_0x21cc65['content']=ht,_0x21cc65['extendTemplate']({'attributes':{'alt':_0x368d84['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x4c3804['push'](_0x21cc65);const _0x4571c9=new _0xfd0945(_0x3f1fdb);_0x4571c9['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x368d84['url']},'children':[{'text':new URL(_0x368d84['url'])?.['hostname']}]}),_0x4c3804['push'](_0x4571c9);const _0x8d216d=new _0xfd0945(_0x3f1fdb);_0x8d216d['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x4c3804});const _0x577f75=new _0xfd0945(_0x3f1fdb);return _0x577f75['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x368d84['title']['length']>0x190?_0x368d84['title']['substring'](0x0,0x190)+'...':_0x368d84['title']}]}),_0x5e2b5f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x8d216d,_0x577f75]}),_0x5e2b5f;}_showTooltip(){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[Pt['defaultPositions']['northArrowSouth'],Pt['defaultPositions']['northArrowSouthWest'],Pt['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 _0x59eb37=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x59eb37);}},zr=class extends _0xfd0945{_actionsView;['_readOnlyByIndex']=new Map();['_sourcesView'];['_children'];_skeletonView;_showSkeletonDebounced=_0x16107c(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);_skeletonShownAt=null;_areActionsDisabled;_showUnchangedParts;_updateContentPartsPromiseQueue;_emptyPartsWarningView;_availableActions;_cachedContentParts=[];constructor(_0x14154b,_0x1b7e74){super(_0x14154b);const {areActionsDisabled:_0x1649c3,showUnchangedParts:_0x5866a6,availableActions:_0x4d1089}=_0x1b7e74;this['_areActionsDisabled']=_0x1649c3,this['_showUnchangedParts']=_0x5866a6,this['_availableActions']=_0x4d1089,this['set']('isTrackChangesOn',!0x1),this['set']('isAcceptAllEnabled',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new Br(_0x14154b,Gr['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Wr(),this['_emptyPartsWarningView']=new $r({'id':'empty-parts-warning','initialContent':Os(_0x14154b,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new qr(_0x14154b,_0x1b7e74['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new Qr(this['locale'],_0x1b7e74['bodyCollection']),_0x1b7e74['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled'),this['_actionsView']['delegate'](...Tr)['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'](_0x2892e5=>_0x2892e5 instanceof Vr);}async updateContentParts({parts:_0x338c93,abortSignal:_0x122522,skipLoadingEffects:_0x18f761}){this['_cachedContentParts']['length']?_0x338c93['forEach'](_0x135a2a=>{const _0x4a4920=this['_cachedContentParts']['findIndex'](_0x52e499=>_0x52e499['index']==_0x135a2a['index']);-0x1===_0x4a4920?this['_cachedContentParts']['push'](_0x135a2a):this['_cachedContentParts'][_0x4a4920]=_0x135a2a;}):this['_cachedContentParts']=_0x338c93;const _0x3bb754=this['_showUnchangedParts']?_0x338c93:_0x338c93['filter'](_0x21ee23=>_0x21ee23['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x3bb754['length']>0x1),_0x18f761&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0xd4d5b4 of _0x338c93)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x2b1cfc=>{let _0x407ea8=this['getPartView'](_0xd4d5b4['index']);if(_0x407ea8||_0xd4d5b4['hasChanges']||this['_showUnchangedParts']){if(!_0x407ea8){if(_0x407ea8=new Vr(this['locale'],{'part':_0xd4d5b4,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x407ea8['delegate'](...Tr)['to'](this),_0x407ea8['bind']('isTrackChangesOn')['to'](this),!_0x18f761&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x2b1cfc),_0x2b1cfc['aborted']))return;_0x407ea8['isTargetReadOnly']=this['_readOnlyByIndex']['get'](_0xd4d5b4['index'])??!0x1,this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x407ea8,this['_children']['length']-0x1),_0x18f761||this['_showSkeletonDebounced']();}await _0x407ea8['updateContent']({'part':_0xd4d5b4,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x2b1cfc}),_0x407ea8['markAsDone']();}});return _0x122522?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}updatePartState(_0x47d785,_0x3d9f92,_0xa26cfe){const _0x3c1fff=this['getPartView'](_0x47d785);_0x3c1fff&&(_0x3c1fff['outdatedReason']=_0xa26cfe,_0x3c1fff['state']=_0x3d9f92);}setGating({readOnlyByIndex:_0x462264,isAcceptAllEnabled:_0x3e828b}){this['_readOnlyByIndex']=_0x462264,this['isAcceptAllEnabled']=_0x3e828b;for(const _0x1d95c1 of this['_contentPartViews'])_0x1d95c1['isTargetReadOnly']=_0x462264['get'](_0x1d95c1['partDefinition']['index'])??!0x1;}setPartActive(_0x451def,_0x276dc8){if(!0x1===_0x451def){for(const _0x5e5472 of this['_contentPartViews'])_0x5e5472['isActive']=!0x1;}else{const _0x567ec1=this['getPartView'](_0x451def);_0x567ec1&&(_0x567ec1['isActive']=_0x276dc8);}}updateSources(_0x5e8b2b){_0x5e8b2b['forEach'](_0x1517d8=>this['_sourcesView']['addSource'](_0x1517d8)),this['_sourcesView']['isVisible']=!0x0;}getPartView(_0x4accc2){return this['_contentPartViews']['find'](_0x5e6a9d=>_0x5e6a9d['partDefinition']['index']==_0x4accc2)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x539469=!this['_cachedContentParts']['find'](({hasChanges:_0xc00acb})=>_0xc00acb),_0x29a060=!!this['_cachedContentParts']['find'](({hasChanges:_0x429293})=>!_0x429293);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x29a060,_0x539469?this['_emptyPartsWarningView']['setContent'](Os(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Os(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x5b3c80=>_0x5b3c80['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']&&!this['_areActionsDisabled']);}async _awaitMinimumSkeletonDisplayTime(_0x2cb71d){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x133c34=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x133c34>0x0){const {promise:_0x4b4524,abortController:_0xce78a2}=Cr(_0x133c34);_0x2cb71d?.['addEventListener']('abort',()=>_0xce78a2['abort']()),await _0x4b4524['catch'](()=>{});}}get hasNonEmptyParts(){return this['_contentPartViews']['filter'](_0x217655=>_0x217655['partDefinition']['hasChanges'])['length']>0x0;}},jr=class extends _0xfd0945{['bodyView'];['children'];['headerView'];constructor(_0x3eb4c1,_0x5a1575,_0x1ed338){super(_0x3eb4c1);const {showDiff:_0x47c2d,areActionsDisabled:_0x1ee71e,showUnchangedParts:_0x4c6648,availableActions:_0x330dea}=_0x5a1575;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new kr(_0x3eb4c1,{'showDiff':_0x47c2d}),this['headerView']['on']('toggleShowChanges',(_0x4d8182,_0x3394a1)=>{this['areChangesVisible']=_0x3394a1['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x3394a1['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new zr(_0x3eb4c1,{'areActionsDisabled':_0x1ee71e,'showUnchangedParts':!!_0x4c6648,'availableActions':_0x330dea,'bodyCollection':_0x1ed338}),this['bodyView']['delegate'](...Tr)['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(_0x2b2382){await this['bodyView']['updateContentParts'](_0x2b2382);}updateSources(_0xe1d654){this['bodyView']['updateSources'](_0xe1d654);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},Jr=class extends yr{containerView;constructor(_0x43a706,_0x181615,_0x137378){super(_0x181615),this['set']('isTrackChangesOn',!0x1),this['containerView']=new jr(_0x43a706,{'showDiff':_0x181615['showDiff'],'areActionsDisabled':_0x181615['areActionsDisabled'],'availableActions':_0x181615['availableActions']},_0x137378),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x18f8ed,_0x1a778e)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x1a778e['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',(_0x45569c,{index:_0x117ee4})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x117ee4});}),this['containerView']['on']('applySuggestion',(_0x30db7f,{index:_0x19d725}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x19d725});}),this['containerView']['on']('insertSuggestion',(_0x18beb1,{index:_0x3d0f6a}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3d0f6a});}),this['containerView']['on']('rejectSuggestion',(_0x344269,{index:_0x1f7ebb})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1f7ebb});}),this['containerView']['on']('mouseOverSuggestion',(_0x21c5ae,{index:_0x4a9849})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4a9849});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x3a18a7,{index:_0x131fca})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x131fca});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async updateContent(_0x109281){await this['containerView']['updateContent'](_0x109281);}updatePartState(_0x27eb78,_0x11adad,_0x59d0f6){this['containerView']['bodyView']['updatePartState'](_0x27eb78,_0x11adad,_0x59d0f6);}setPartActive(_0x418de7,_0x4e9291){!0x1===_0x418de7?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x418de7,_0x4e9291);}updateSources(_0x580cc9){this['containerView']['updateSources'](_0x580cc9);}getPartView(_0x49fc0b){return this['containerView']['bodyView']['getPartView'](_0x49fc0b);}setGating(_0x33c3c8){this['containerView']['bodyView']['setGating'](_0x33c3c8);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},Zr=class extends yr{replyContainer;_bodyCollection;constructor(_0x5196a6,_0x124031,_0x5f2964){super(_0x124031),this['_bodyCollection']=_0x5f2964,this['locale']=_0x5196a6,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0xfd0945(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Ps(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async updateContent({parsedContent:_0x533b85,renderingStrategy:_0x53bf42,abortSignal:_0x4e8350}){'streaming'===_0x53bf42?await this['streamIntoElement'](_0x533b85,this['replyContainer']['element'],_0x4e8350):this['replyContainer']['element']['innerHTML']=_0x2a51a3(_0x533b85);}updateSources(_0x33522f){const _0x50e7f1=new Qr(this['locale'],this['_bodyCollection']);_0x50e7f1['children']['addMany'](_0x33522f['map'](_0x34e631=>new Xr(this['locale'],_0x34e631,_0x50e7f1['balloonPanelView']))),_0x50e7f1['isVisible']=!0x0,this['children']['add'](_0x50e7f1);}},to=class extends _0x3afe73{constructor(_0x2a36ec=void 0x0){super();const _0x280784=_0x2a36ec?'ck-ai-spinner_'+_0x2a36ec:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x280784]}});}};const eo={'file':_0x28c155,'image':_0x1d30bc,'document':_0x399c89,'web-resource':_0x11032b,'text':_0x28c155,'selection':tt,'mcp-tool-context':_0x399c89,'context':_0x399c89},io='ck-ai-chat-context-chip',so='ck-ai-chat-context-chip_wide',no='ck-ai-chat-context-chip_document',ro='ck-ai-chat-context-chip__label',oo='ck-ai-chat-context-chip__type-icon',ao='ck-ai-chat-context-controls__chip-tooltip',ho='n';var co=class extends Bt{constructor(_0xfd8d6f,_0x14e36e,_0x41398b,_0x26c61a,_0x5a5f7a=!0x1){super(_0xfd8d6f),this['_isAnimationOnEnterEnabled']=_0x26c61a,this['_initializeProperties'](_0x14e36e,_0x41398b,_0x5a5f7a),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(_0x1df784,_0x3667a4,_0x3a5738){this['set']('label',_0x1df784['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x1df784['type']),this['set']('id',_0x1df784['uiId']),this['set']('readonly',_0x3667a4),this['set']('isLoading',_0x3a5738);}_setupTemplate(){const _0x5b436d=this['_createIconView'](),_0x1b9e47=this['_createRemoveButton'](),_0x4e682d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x4e682d),'children':this['_createTemplateChildren'](_0x5b436d,_0x1b9e47,_0x4e682d)});}_createTemplateAttributes(_0x4c3197){return{'class':[io,_0x4c3197['if']('itemType',no,_0x417dbe=>'document'==_0x417dbe),_0x4c3197['if']('itemType',so,_0x9689d6=>'selection'==_0x9689d6)],'data-cke-tooltip-text':_0x4c3197['to']('label',lo),'data-cke-tooltip-position':ho,'data-cke-tooltip-class':ao};}_createTemplateChildren(_0x513c97,_0x627c26,_0x4803d5){const _0x347d26=this['_createLabelElement'](_0x4803d5),_0x191d8c=this['_createLoaderIcon']();return this['readonly']?[_0x513c97,_0x347d26]:[_0x513c97,_0x191d8c,_0x347d26,_0x627c26];}_createLabelElement(_0x4ca42b){return{'tag':'span','attributes':{'class':ro},'children':[{'text':_0x4ca42b['to']('label')}]};}_createRemoveButton(){const _0x5e7436=new Bt(this['locale']);return _0x5e7436['set']({'label':Os(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x509f6e}),this['_setupRemoveButtonEvent'](_0x5e7436),_0x5e7436;}_setupRemoveButtonEvent(_0x4796ca){_0x4796ca['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}_createIconView(){const _0x50fd27=this['bindTemplate'],_0x1c491d=new Xt();return _0x1c491d['content']=eo[this['itemType']],_0x1c491d['extendTemplate']({'attributes':{'class':[oo,_0x50fd27['if']('isLoading','ck-hidden',_0x546313=>_0x546313)]}}),_0x1c491d;}_handleAnimationEndOnce(_0x511cd9,_0xdb291e){if(!_0x511cd9)return;const _0x566f2b=()=>{_0xdb291e(),_0x511cd9['removeEventListener']('animationend',_0x566f2b),_0x511cd9['removeEventListener']('webkitAnimationEnd',_0x566f2b);};_0x511cd9['addEventListener']('animationend',_0x566f2b),_0x511cd9['addEventListener']('webkitAnimationEnd',_0x566f2b);}_createLoaderIcon(){const _0x175f0e=new to('small');return _0x175f0e['bind']('isVisible')['to'](this,'isLoading',_0x416400=>_0x416400),_0x175f0e;}};function lo(_0x11354d){if(!_0x11354d)return _0x11354d;if(_0x11354d['length']<=0x78)return _0x11354d;const _0x41bea9=_0x11354d['slice'](0x0,0x78),_0x46c1ca=_0x41bea9['lastIndexOf']('\x20');return(_0x46c1ca>0x0?_0x41bea9['slice'](0x0,_0x46c1ca):_0x41bea9)+'…';}const uo={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},_o='300px';var go=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];_showMoreButtonView=null;['_showMoreBalloonPanelView']=null;_containerElement=null;_bodyCollection;_parentView=null;_intersectionObserver=null;_pendingCalculation=!0x1;constructor(_0xe1c9c8,_0x51f423,_0xded3c7,_0x24c8c7,_0x24b4c7){this['_locale']=_0xe1c9c8,this['_visibleChips']=_0x51f423,this['_config']={...uo,..._0xded3c7,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0xded3c7['cssClasses']}},this['_overflowChips']=new lt(),this['_bodyCollection']=_0x24c8c7,this['_parentView']=_0x24b4c7||null;}setContainerElement(_0x46692f){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x46692f,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 _0x336115=[...this['_visibleChips'],...this['_overflowChips']],_0x30fea7=this['_createCalculationContainer'](),_0x4480f5=this['_calculateOverflowInContainer'](_0x30fea7,_0x336115),_0x2f55f5=_0x30fea7['_ancestorsToRestore'];_0x2f55f5&&this['_restoreAncestorVisibility'](_0x2f55f5),_0x30fea7['remove'](),this['_applyOverflowResults'](_0x336115,_0x4480f5);}_createShowMoreButton(){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x4f15a2({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}_createShowMoreButtonView(){const _0x2bddb7=new Bt(this['_locale']);_0x2bddb7['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x5368d5=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x5368d5['push'](this['_config']['cssClasses']['controlsButton']),_0x2bddb7['extendTemplate']({'attributes':{'class':_0x5368d5}}),_0x2bddb7;}_createShowMoreBalloonPanelView(){const _0x205a9b=new Pt(this['_locale']);return _0x205a9b['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x205a9b),_0x205a9b;}_updateBalloonContent(){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x230d2b=>{_0x230d2b['disableAnimationOnEnter']();});const _0x2efe19=new _0xfd0945(this['_locale']);_0x2efe19['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x2efe19);}}_handleShowMoreButtonClick(){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}_updateShowMoreButtonVisibility(){const _0x4e99d1=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x4e99d1?'':'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(_0x28ba7b){const _0xe8478e=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x356e80=this['_containerElement']?.['classList'];if(_0x356e80){const _0x3051aa=_0x356e80[0x0]||'',_0x5e1666=_0x28ba7b['querySelector']('.'+_0x3051aa),_0x31f2a4=_0x28ba7b['querySelector'](_0xe8478e);return _0x5e1666||_0x31f2a4||_0x28ba7b;}return _0x28ba7b['querySelector'](_0xe8478e)||_0x28ba7b;}_calculateContainerWidth(){const _0x18329e=this['_parentView']?.['element']||this['_containerElement'];if(!_0x18329e)return _o;const _0x4062f2=window['getComputedStyle'](_0x18329e)['width'];if('auto'===_0x4062f2||'0px'===_0x4062f2||!_0x4062f2){const _0x316f28=_0x18329e['parentElement'];if(_0x316f28){const _0x3aa2e4=window['getComputedStyle'](_0x316f28);return'auto'!==_0x3aa2e4['width']?_0x3aa2e4['width']:_o;}return _o;}return _0x4062f2;}_applyCalculationStyles(_0x1ab460,_0x298117){this['_config']['cssClasses']['calculationContainer']&&_0x1ab460['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x1ab460['style']['width']=_0x298117,_0x1ab460['style']['position']='absolute',_0x1ab460['style']['top']='-9999px',_0x1ab460['style']['left']='-9999px',_0x1ab460['style']['opacity']='0',_0x1ab460['style']['pointerEvents']='none',_0x1ab460['style']['zIndex']='-1',_0x1ab460['style']['visibility']='visible\x20!important',_0x1ab460['style']['display']='block\x20!important',_0x1ab460['style']['boxSizing']='border-box';}_restoreAncestorVisibility(_0x4c45be){_0x4c45be['forEach'](({element:_0x59d201,originalDisplay:_0x11a769,originalVisibility:_0x92c88})=>{_0x59d201['style']['display']=_0x11a769,_0x59d201['style']['visibility']=_0x92c88;});}_makeAncestorsVisible(_0x44e1aa){const _0x3e21bb=[];let _0x386c58=_0x44e1aa;for(;_0x386c58&&_0x386c58!==document['body'];){const _0x28ab96=window['getComputedStyle'](_0x386c58);'none'!==_0x28ab96['display']&&'hidden'!==_0x28ab96['visibility']||(_0x3e21bb['push']({'element':_0x386c58,'originalDisplay':_0x386c58['style']['display'],'originalVisibility':_0x386c58['style']['visibility']}),_0x386c58['style']['display']='block',_0x386c58['style']['visibility']='visible'),_0x386c58=_0x386c58['parentElement'];}return _0x3e21bb;}_createContainerElements(){let _0x2adb0c,_0x27abc7;return this['_parentView']?.['element']?(_0x2adb0c=this['_parentView']['element']['cloneNode'](!0x0),_0x27abc7=this['_findTargetContainer'](_0x2adb0c)):(_0x2adb0c=document['createElement']('div'),_0x27abc7=_0x2adb0c),{'calculationContainer':_0x2adb0c,'targetContainer':_0x27abc7};}_createCalculationContainer(){const {calculationContainer:_0x3f32db,targetContainer:_0xc1c5f0}=this['_createContainerElements'](),_0x2e1e6e=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x3f32db,_0x2e1e6e);const _0x3d2bd7=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x3d2bd7?_0x3d2bd7['appendChild'](_0x3f32db):document['body']['appendChild'](_0x3f32db),_0x3f32db['_targetContainer']=_0xc1c5f0;const _0x324160=this['_makeAncestorsVisible'](_0x3d2bd7||null);return _0x3f32db['offsetWidth'],_0x3f32db['_ancestorsToRestore']=_0x324160,_0x3f32db;}_calculateOverflowInContainer(_0x5bb890,_0x3eab23){const _0x38af44=_0x5bb890['_targetContainer']||_0x5bb890,_0x1e6df8=[],{rowCount:_0x5cf269}=this['_renderChipsAndCountRows'](_0x38af44,_0x3eab23);if(_0x5cf269<=this['_config']['maxVisibleRows'])return _0x1e6df8;const _0x3e2c89=_0x3eab23['slice']();for(;_0x3e2c89['length']>0x0;){if(this['_testButtonFit'](_0x5bb890,_0x38af44,_0x3e2c89)){const _0x5f3b58=_0x3eab23['filter'](_0x3f526f=>!_0x3e2c89['includes'](_0x3f526f));_0x1e6df8['push'](..._0x5f3b58);break;}if(!_0x3e2c89['pop']())break;}return _0x1e6df8;}_renderChipsAndCountRows(_0x473a24,_0x1aaf4a){_0x473a24['innerHTML']='',_0x1aaf4a['forEach'](_0x3a8a37=>{if(_0x3a8a37['element']){const _0x3ba9c1=_0x3a8a37['element']['cloneNode'](!0x0);_0x473a24['appendChild'](_0x3ba9c1);}}),_0x473a24['offsetWidth'];const _0x4c43bb=_0x473a24['children'],_0x565686=[];return Array['from'](_0x4c43bb)['forEach'](_0x339838=>{const _0x12ba97=_0x339838['getBoundingClientRect']()['top'];_0x565686['some'](_0xd3ca8d=>Math['abs'](_0xd3ca8d-_0x12ba97)<this['_config']['rowDetectionTolerance'])||_0x565686['push'](_0x12ba97);}),{'rowCount':_0x565686['length']};}_createMockButton(){const _0x2af9fc=document['createElement']('button');return _0x2af9fc['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x2af9fc['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x2af9fc['textContent']='+\x201',_0x2af9fc;}_testButtonFit(_0x323152,_0x2a2ad0,_0x31f490){this['_renderChipsAndCountRows'](_0x2a2ad0,_0x31f490);const _0x3e8f43=this['_createMockButton']();_0x323152['appendChild'](_0x3e8f43),_0x323152['offsetWidth'];const _0x2f9535=[..._0x2a2ad0['children'],_0x3e8f43],_0x32a4db=[];_0x2f9535['forEach'](_0x265a07=>{const _0x501534=_0x265a07['getBoundingClientRect']()['top'];_0x32a4db['some'](_0x17a70c=>Math['abs'](_0x17a70c-_0x501534)<this['_config']['rowDetectionTolerance'])||_0x32a4db['push'](_0x501534);});const _0x19f09a=_0x32a4db['length'];return _0x3e8f43['remove'](),_0x19f09a<=this['_config']['maxVisibleRows'];}_distributeChips(_0x3cf1ec,_0x55fcc1){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x3cf1ec['forEach'](_0x2afe9d=>{_0x55fcc1['includes'](_0x2afe9d)?this['_overflowChips']['add'](_0x2afe9d):this['_visibleChips']['add'](_0x2afe9d);});}_updateOverflowUI(_0x475fb3){if(_0x475fb3>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x475fb3>0x0&&this['_showMoreButtonView']){const _0x57b5a7=''+this['_config']['showMoreLabelPrefix']+(_0x475fb3<0x63?_0x475fb3:'99');this['_showMoreButtonView']['label']=_0x57b5a7;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}_applyOverflowResults(_0x2c743f,_0x13ed90){this['_distributeChips'](_0x2c743f,_0x13ed90),this['_updateOverflowUI'](_0x13ed90['length']);}_setupVisibilityObserver(){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x10d15b=>{_0x10d15b[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 _0x41802c=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x41802c['width']||0x0===_0x41802c['height'])return!0x1;const _0x2ea42b=window['innerHeight']||document['documentElement']['clientHeight'],_0x44a331=window['innerWidth']||document['documentElement']['clientWidth'];return _0x41802c['bottom']>=-0xc8&&_0x41802c['top']<=_0x2ea42b+0xc8&&_0x41802c['right']>=-0xc8&&_0x41802c['left']<=_0x44a331+0xc8;}};const Ao='ck-ai-chat__feed__context-chips',Io='ck-ai-chat-context-chips-wrapper',po='ck-ai-chat-context-chips-wrapper-balloon',mo='ck-ai-chat-controls-button',Eo='ck-ai-chat-controls_context_show-more-button',wo='ck-ai-chat-context-controls__show-more-balloon-panel';var To=class extends _0xfd0945{_contextChips=this['createCollection']();['_overflowManager'];_bodyCollection;constructor(_0x3eb343,_0x462c42,_0x157d28){super(_0x3eb343),this['_bodyCollection']=_0x157d28,this['_createContextChips'](_0x462c42);const _0x493be7={'cssClasses':{'showMoreButton':Eo+'\x20'+ir,'showMoreBalloon':wo,'overflowContainer':po,'controlsButton':mo}};this['_overflowManager']=new go(_0x3eb343,this['_contextChips'],_0x493be7,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[Ao,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Io},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x1af642=this['element']['querySelector']('.'+Io);_0x1af642&&(this['_overflowManager']['setContainerElement'](_0x1af642),this['_overflowManager']['reorganizeChips']());}destroy(){super['destroy'](),this['_overflowManager']['destroy']();}_createContextChips(_0x285e54){for(const _0x1024a7 of _0x285e54){const _0x5d6842=new co(this['locale'],_0x1024a7,!0x0,!0x1);this['_contextChips']['add'](_0x5d6842);}}},fo=class extends yr{_contextChipsView=null;['_locale'];_bodyCollection;_messageContentView;constructor(_0x1e7ec5,_0x5469aa,_0x51bbb0){super(_0x5469aa),this['_locale']=_0x1e7ec5,this['_bodyCollection']=_0x51bbb0,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 To(this['_locale'],this['options']['contextItems']['filter'](_0x3b611a=>!_0x3b611a['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}_createMessageContentView(){this['_messageContentView']=new _0xfd0945(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']();}},Co=class extends yr{capabilities;constructor(_0x1322c3,_0x314b91){super(_0x314b91);const {isWebSearchEnabled:_0x443950,isReasoningEnabled:_0x12e6c2}=_0x314b91['capabilities'],_0x215c3e=[];let _0x2ae297='';_0x443950&&_0x12e6c2?(_0x2ae297=Os(_0x1322c3,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x215c3e['push'](bo(ht)),_0x215c3e['push'](bo(_0xfbdb8e))):_0x443950?(_0x2ae297=Os(_0x1322c3,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x215c3e['push'](bo(ht))):_0x12e6c2&&(_0x2ae297=Os(_0x1322c3,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x215c3e['push'](bo(_0xfbdb8e))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x2ae297?'':'ck-hidden']}});const _0x1f7b54=new _0xfd0945();_0x1f7b54['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x215c3e,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x2ae297]}]}),this['children']['add'](_0x1f7b54),this['capabilities']=_0x314b91['capabilities'];}};function bo(_0x1e72c0){const _0x5ad463=new Xt();return _0x5ad463['content']=_0x1e72c0,_0x5ad463;}const So=['wheel','touchstart','pointerdown','keydown'],Ro=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Oo=class{element;animationFrameId;['isRunning'];abortController;['isUserPaused'];['scrollBehavior'];constructor(_0x4d2208){this['element']=_0x4d2208,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x7e2d84 of So){const _0x2a6eac='keydown'!==_0x7e2d84;this['element']['addEventListener'](_0x7e2d84,this['_onUserEvent']['bind'](this),{'passive':_0x2a6eac,'signal':this['abortController']['signal']});}}start({smooth:_0x47ae1a=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x47ae1a?'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(_0x257f2f){if(this['isRunning']){if('keydown'===_0x257f2f['type']){const _0xdd7723=_0x257f2f['key'];if(!Ro['includes'](_0xdd7723))return;}_0x257f2f instanceof WheelEvent?_0x257f2f['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}_isAtBottom(){const {scrollTop:_0x4aab7c,scrollHeight:_0x42a478,clientHeight:_0x23c07c}=this['element'];return _0x42a478-_0x4aab7c-_0x23c07c<=0x5;}_rafUpdate(){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},vo=class extends yr{constructor(_0x4d5f29){super(_0x4d5f29),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']);}},yo=class extends _0xfd0945{['children'];['scrollManager'];_bodyCollection;constructor(_0x2ec6d7,_0x20300a){super(_0x2ec6d7),this['_bodyCollection']=_0x20300a,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...fr)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new Oo(this['element']);}destroy(){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}addItem(_0x18456a,_0x436be4){let _0x37a187;return'ai-reply'===_0x18456a?_0x37a187=new Zr(this['locale'],_0x436be4,this['_bodyCollection']):'ai-suggestion-reply'===_0x18456a?(_0x37a187=new Jr(this['locale'],_0x436be4,this['_bodyCollection']),_0x37a187['bind']('isTrackChangesOn')['to'](this)):_0x37a187='user-message'===_0x18456a?new fo(this['locale'],_0x436be4,this['_bodyCollection']):'interaction-header'===_0x18456a?new Co(this['locale'],_0x436be4):'custom-element'===_0x18456a?new vo(_0x436be4):new $r(_0x436be4),this['children']['add'](_0x37a187),_0x37a187;}async updateReplyItem({id:_0x124fad,parsedContent:_0x594fb3,renderingStrategy:_0x470167,abortSignal:_0x3c7550}){const _0x4c8ffd=this['getItemById'](_0x124fad);if(!(_0x4c8ffd instanceof Zr))throw new ct('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x4c8ffd,'id':_0x124fad,'parsedContent':_0x594fb3});await _0x4c8ffd['updateContent']({'parsedContent':_0x594fb3,'renderingStrategy':_0x470167,'abortSignal':_0x3c7550});}async updateWebSources(_0x242e1c,_0x1534b3){const _0x2359b6=this['getItemById'](_0x242e1c);if(_0x2359b6 instanceof Jr)_0x2359b6['updateSources'](_0x1534b3);else{if(!(_0x2359b6 instanceof Zr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x2359b6,'id':_0x242e1c,'sources':_0x1534b3});_0x2359b6['updateSources'](_0x1534b3);}}async updateSuggestionItem({id:_0xc2675b,parts:_0x53ddbd,abortSignal:_0x57ccf1,skipLoadingEffects:_0x53fc14}){const _0x469729=this['getItemById'](_0xc2675b);if(!(_0x469729 instanceof Jr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x469729,'id':_0xc2675b,'parts':_0x53ddbd});await _0x469729['updateContent']({'parts':_0x53ddbd,'abortSignal':_0x57ccf1,'skipLoadingEffects':_0x53fc14});}updateSuggestionPartState({id:_0xd92291,index:_0x2e3fe7,state:_0xdd09fb,outdatedReason:_0x39cfb6}){const _0x3c4a75=this['getItemById'](_0xd92291);if(!(_0x3c4a75 instanceof Jr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0xd92291});_0x3c4a75['updatePartState'](_0x2e3fe7,_0xdd09fb,_0x39cfb6);}updateSuggestionGating(_0x1ce616,_0x234b2d){const _0x27dbb0=this['getItemById'](_0x1ce616);if(!(_0x27dbb0 instanceof Jr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1ce616});_0x27dbb0['setGating'](_0x234b2d);}setSuggestionPartActive({id:_0x1d4465,index:_0x37e815,isActive:_0x2f8d84}){const _0x5d3ea5=this['getItemById'](_0x1d4465);if(!(_0x5d3ea5 instanceof Jr))throw new ct('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x1d4465});this['children']['filter'](_0x54665e=>_0x54665e instanceof Jr)['forEach'](_0x38fc7f=>{_0x38fc7f['setPartActive'](!0x1);}),_0x5d3ea5['setPartActive'](_0x37e815,_0x2f8d84);}markItemAsDone(_0x2a7e00){this['getItemById'](_0x2a7e00)['markAsDone']();}getItemIds(){return this['children']['map'](_0x58c902=>_0x58c902['options']['id']);}removeItem(_0x4c1ca1){this['children']['remove'](this['getItemById'](_0x4c1ca1));}hasItem(_0x49a33e){return!!this['children']['find'](_0x393259=>_0x393259['options']['id']['includes'](_0x49a33e));}scrollToSuggestion(_0x1974f8,_0x1de76f){const _0xc8ce6c=this['getItemById'](_0x1974f8);if(!(_0xc8ce6c instanceof Jr))return void Ot('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x1974f8,'partIndex':_0x1de76f});const _0x53208b=_0xc8ce6c['getPartView'](_0x1de76f);_0x53208b?yt(_0x53208b['element'],0x14,this['element']['parentElement'],!0x0,!0x0):Ot('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x1974f8,'partIndex':_0x1de76f});}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}_createTemplateChildren(){const _0x26a96e=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x26a96e,this['_createFeedLoader']()];}_createSkeletonLoader(){const _0x5e67c4=new Br(this['locale'],Gr['aiFeed']);return _0x5e67c4['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x5e67c4;}_createFeedItems(){const _0x1980c5=new _0xfd0945(this['locale']);return _0x1980c5['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x1980c5;}_createFeedLoader(){const _0x5eeec2=new _0xfd0945(this['locale']);return _0x5eeec2['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x11b464=>!_0x11b464)]},'children':this['_createLoaderChildren']()}),_0x5eeec2;}_createLoaderChildren(){const _0x392d76=new to();return _0x392d76['isVisible']=!0x0,[_0x392d76,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}getItemById(_0x593feb){const _0x91c28a=this['children']['find'](_0x58f3f0=>_0x58f3f0['options']['id']['includes'](_0x593feb));if(!_0x91c28a)throw new ct('ai-chat-feed-view-item-not-found',this,{'id':_0x593feb});return _0x91c28a;}setLoadingMessage(_0x78641f){this['set']('loadingMessage',_0x78641f);}toggleLoadingSkeleton(_0x257631){this['set']('isLoadingSkeletonVisible',_0x257631);}startAutoScroll(_0x5b070d={}){this['scrollManager']['start'](_0x5b070d);}stopAutoScroll(){this['scrollManager']['stop']();}},ko=class extends _0x4ca5fe{filter(){let _0x815b4a=0x0;for(const _0x2bde57 of this['items'])_0x815b4a+=_0x2bde57['items']['length'];return{'resultsCount':_0x815b4a,'totalItemsCount':_0x815b4a};}};function No(_0x146803){const _0x30cd96=[];let _0x360ce7=!0x1;for(const _0x589854 of Array['from'](_0x146803['items'])){if('file'!==_0x589854['kind'])continue;if(_0x589854['webkitGetAsEntry']()?.['isDirectory']){_0x360ce7=!0x0;continue;}const _0x4fab8e=_0x589854['getAsFile']();_0x4fab8e&&_0x30cd96['push'](_0x4fab8e);}return{'files':_0x30cd96,'hasDirectory':_0x360ce7};}const xo='ck-ai-chat__prompt-input_highlighted';var Lo=class AIChatPromptInputView extends Dt{submitButtonView;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;_addContextButtonView;['_queryViewResizeObserver'];constructor(_0x4a8b0d,_0x4c8a27){super(_0x4a8b0d,{'queryView':{'label':'','creator':_0x2ce018,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new ko(_0x4a8b0d),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x4c8a27,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',(_0x316c0c,_0xdf9165)=>!_0x316c0c&&!_0xdf9165),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x23de7c,_0x5810d4)=>{this['isUploadInProgress']||this['isEmpty']||_0x23de7c['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x5810d4());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x3554dc=>this['_handlePaste'](_0x3554dc)),this['element']['addEventListener']('drop',_0x510273=>this['_handleDrop'](_0x510273));}_handlePaste(_0x1cdea8){const _0x5e7a71=_0x1cdea8['clipboardData'];if(!_0x5e7a71)return;const {files:_0x46296c,hasDirectory:_0xc316c1}=No(_0x5e7a71),_0x319af2={'files':_0x46296c,'plainText':_0x5e7a71['getData']('text/plain'),'hasDirectory':_0xc316c1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x1cdea8['preventDefault']()};this['fire']('promptInputPaste',_0x319af2);}['_handleDrop'](_0x36a6a2){const _0x1aa2dd=_0x36a6a2['dataTransfer'];if(!_0x1aa2dd)return;const _0x1137a1={'files':[],'plainText':_0x1aa2dd['getData']('text/uri-list')||_0x1aa2dd['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x36a6a2['preventDefault']()};this['fire']('promptInputPaste',_0x1137a1);}destroy(){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}submit(){const _0x4c20d3=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x4c20d3)return this['queryView']['errorText']=Os(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x38aa6d=_0x5a8f00(_0x4c20d3);this['fire']('sendUserMessage',_0x38aa6d),this['queryView']['fieldView']['reset']();}setPlaceholderText(_0x218ee7){this['queryView']['fieldView']['set']('placeholder',_0x218ee7);}['focus'](_0x44b4b3=!0x1){super['focus'](),_0x44b4b3&&(this['element']['classList']['contains'](xo)||(this['element']['classList']['add'](xo),setTimeout(()=>{this['element']['classList']['remove'](xo);},0x320)));}_createSubmitButton(){const _0x12a4c2=new Bt(this['locale']);return _0x12a4c2['set']({'icon':nt,'label':Os(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+tr,'isEnabled':!0x1}),_0x12a4c2['on']('execute',()=>{this['submit']();}),_0x12a4c2;}setIsUploadInProgress(_0x2c5903){this['isUploadInProgress']=_0x2c5903;}_setUpAddContextButtonPositioning(){const _0x3e5416=this['locale'],_0x1ab4e8=()=>{ft['window']['requestAnimationFrame'](()=>{if(St(this['element'])){const _0xce0524=new It(this['queryView']['fieldView']['element']),_0x44c0bd=new It(this['_addContextButtonView']['element']),_0x492a88=_0xce0524['width'],_0xb5a454='rtl'===_0x3e5416['uiLanguageDirection']?'right':'left';_0xce0524['excludeScrollbarsAndBorders']();const _0x42c878=_0x492a88-_0xce0524['width']+0x1;this['_addContextButtonView']['element']['style'][_0xb5a454]='calc('+(_0x492a88-_0x44c0bd['width']-_0x42c878)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x1ab4e8),this['on']('render',()=>{_0x1ab4e8(),this['_queryViewResizeObserver']=new pt(this['queryView']['fieldView']['element'],()=>{_0x1ab4e8();});});}},Do=class extends _0xfd0945{constructor(_0x33c793){super(_0x33c793),this['set']('isEnabled',!0x0);const _0x517124=new Xt();_0x517124['content']=_0x28c155,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x517124,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Os(_0x33c793,'AI_CHAT_DROP_ZONE_HINT')}]}]});}attach(_0x48b67c){let _0x362806=0x0;const _0x3b5597=()=>{_0x48b67c['classList']['toggle']('ck-ai-chat-controls_drag-over',this['isEnabled']&&_0x362806>0x0);};this['on']('change:isEnabled',(_0x5c83e7,_0x59f59c,_0x150c13)=>{_0x150c13&&_0x362806>0x0&&this['fire']('dragEnter'),_0x3b5597();}),_0x48b67c['addEventListener']('dragenter',_0x57e40f=>{_0x57e40f['dataTransfer']&&(_0x362806++,0x1===_0x362806&&this['isEnabled']&&this['fire']('dragEnter'),_0x3b5597());}),_0x48b67c['addEventListener']('dragover',_0x35356f=>{_0x35356f['dataTransfer']&&_0x35356f['preventDefault']();}),_0x48b67c['addEventListener']('dragleave',()=>{--_0x362806<0x0&&(_0x362806=0x0),_0x3b5597();}),_0x48b67c['addEventListener']('drop',_0x13c5d1=>{_0x13c5d1['preventDefault'](),_0x362806=0x0,_0x3b5597(),this['isEnabled']&&this['_handleDrop'](_0x13c5d1);});}['_handleDrop'](_0x3bd7ed){const _0xef4e9b=_0x3bd7ed['dataTransfer'];if(!_0xef4e9b)return;const {files:_0x82b3a1,hasDirectory:_0x15cc98}=No(_0xef4e9b),_0x3af6c8={'files':_0x82b3a1,'plainText':_0xef4e9b['getData']('text/uri-list')||_0xef4e9b['getData']('text/plain'),'hasDirectory':_0x15cc98,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x3af6c8);}},Po=class extends _0xfd0945{['dropdownView'];['nameView'];_items;['_config'];constructor(_0x389f6f,_0x53aba6){super(_0x389f6f),this['_config']=_0x53aba6,this['set']('modelDisplayMode','selector'),this['set']('activeModelId',null),this['set']('activeModelName',null),this['set']('isEnabled',!0x0),this['dropdownView']=this['_createDropdown'](),this['_items']=new lt(),_0x5b9bd6(this['dropdownView'],this['_items']),this['nameView']=new Ho(_0x389f6f,_0x53aba6['nameClass']),this['nameView']['bind']('text')['to'](this,'activeModelName',_0x1d5224=>_0x1d5224??''),this['nameView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1275de=>'name'===_0x1275de),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-model-selector']},'children':[this['dropdownView'],this['nameView']]});}setModels(_0x2e8464,_0x2a6b6a){var _0x38c267;this['set']('modelDisplayMode',(_0x38c267=_0x2e8464['length'],_0x2a6b6a?0x1===_0x38c267?'name':'selector':'hidden')),this['_items']['clear'](),0x1===_0x2e8464['length']&&this['set']('activeModelName',_0x2e8464[0x0]['name']||_0x2e8464[0x0]['id']);for(const _0x213cbd of _0x2e8464){const _0x4d0bec=new _0x115df1({'label':_0x213cbd['name'],'withText':!0x0,'role':'menuitemradio','id':_0x213cbd['id'],'model':_0x213cbd});_0x4d0bec['bind']('isOn')['to'](this,'activeModelId',_0x8e4544=>_0x8e4544===_0x213cbd['id']),this['_items']['add']({'type':'button','model':_0x4d0bec,'labelView':new Mo(this['locale'],_0x213cbd,{'nameClass':this['_config']['itemClasses']['name'],'descriptionClass':this['_config']['itemClasses']['description'],'capabilitiesClass':this['_config']['itemClasses']['capabilities'],'extraContent':this['_config']['showCapabilities']?Uo(this['locale'],_0x213cbd):void 0x0})});}}setSelectedModel(_0x5c2c15){this['set']('activeModelId',_0x5c2c15?_0x5c2c15['id']:null),this['set']('activeModelName',_0x5c2c15?_0x5c2c15['name']||_0x5c2c15['id']:null);}_createDropdown(){const _0x3e0b98=_0x5d526e(this['locale']);return _0x3e0b98['set']({'panelPosition':this['_config']['panelPosition'],'class':this['_config']['dropdownClass']}),_0x3e0b98['buttonView']['set']({'withText':!0x0,'tooltipPosition':this['_config']['tooltipPosition'],'class':ir}),_0x3e0b98['buttonView']['bind']('label')['to'](this,'activeModelName',_0x1f2226=>_0x1f2226??this['_config']['defaultLabel']??''),_0x3e0b98['buttonView']['bind']('tooltip')['to'](this,'activeModelName',this,'isEnabled',(_0x2fab02,_0x111a09)=>!_0x111a09&&this['_config']['disabledTooltip']?this['_config']['disabledTooltip']:_0x2fab02??this['_config']['defaultLabel']??''),_0x3e0b98['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0xd82c6c=>'selector'===_0xd82c6c),_0x3e0b98['bind']('isEnabled')['to'](this,'isEnabled'),this['listenTo'](_0x3e0b98,'execute',_0x3cb4b8=>{this['fire']('selectModel',_0x3cb4b8['source']['model']);}),_0x3e0b98;}},Ho=class extends _0xfd0945{constructor(_0x508889,_0x421397){super(_0x508889),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x1e2659=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck',_0x421397,_0x1e2659['if']('isVisible','ck-hidden',_0x3afde2=>!_0x3afde2)]},'children':[{'text':_0x1e2659['to']('text')}]});}},Mo=class extends Ut{constructor(_0x24b141,_0x2e3bd5,_0x280e88){super();const _0x24ad28=this['bindTemplate'],_0x53255e=[{'tag':'div','attributes':{'class':[_0x280e88['nameClass']]},'children':[{'tag':'span','children':[{'text':_0x24ad28['to']('text')}]}]},{'tag':'div','attributes':{'class':[_0x280e88['descriptionClass']]},'children':[{'tag':'span','children':[_0x2e3bd5['description']||'']}]}];_0x280e88['extraContent']?.['length']&&_0x280e88['capabilitiesClass']&&_0x53255e['push']({'tag':'div','attributes':{'class':[_0x280e88['capabilitiesClass']]},'children':_0x280e88['extraContent']}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x24ad28['to']('style'),'id':_0x24ad28['to']('id')},'children':_0x53255e});}};function Uo(_0x3b7f89,_0x214e79){return[...Vo(_0x3b7f89,ht,'AI_CHAT_SEARCH_WEB',_0x214e79['capabilities']['webSearch']?.['enabled']??!0x1),...Vo(_0x3b7f89,_0xfbdb8e,'AI_CHAT_REASONING',_0x214e79['capabilities']['reasoning']?.['enabled']??!0x1)];}function Vo(_0x3461dc,_0x1b24e6,_0x3919ca,_0x1c2ed0){const _0x4da7da=new Xt();_0x4da7da['content']=_0x1b24e6;const _0x504f5b=new _0xfd0945(_0x3461dc);_0x504f5b['setTemplate']({'tag':'span','children':[{'text':Os(_0x3461dc,_0x3919ca)+':\x20'}]});const _0x487b7e=new _0xfd0945(_0x3461dc);return _0x487b7e['setTemplate']({'tag':'span','children':[{'text':Os(_0x3461dc,_0x1c2ed0?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x4da7da,_0x504f5b,_0x487b7e];}const Bo='ck-ai-chat__prompt-capabilities',Go='ck-ai-chat-controls-button',Ko='ck-ai-chat-controls-button--commands',Fo='ck-ai-chat-controls__model-selection',Wo='ck-ai-chat-controls__model-selection__item-name',$o='ck-ai-chat-controls__model-selection__item-description',Yo='ck-ai-chat-controls__model-selection__item-capabilities',qo='n';var Qo=class extends _0xfd0945{_webSearchButton;_reasoningButton;_commandsButton;_modelSelector;constructor(_0x166714){super(_0x166714),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelSelectorEnabled',!0x0),this['_modelSelector']=function(_0x49b4a6){return new Po(_0x49b4a6,{'panelPosition':'ne','dropdownClass':[Fo],'nameClass':'ck-ai-chat-controls__model-name','itemClasses':{'name':Wo,'description':$o,'capabilities':Yo},'defaultLabel':Os(_0x49b4a6,'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'disabledTooltip':Os(_0x49b4a6,'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP'),'tooltipPosition':qo,'showCapabilities':!0x0});}(_0x166714),this['_modelSelector']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x3bfa78=>_0x3bfa78),this['_modelSelector']['delegate']('selectModel')['to'](this),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x4792ee=>_0x4792ee),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x4f03d5=>Os(this['locale'],_0x4f03d5?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x3c4ae7=>_0x3c4ae7),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x5f0dc5=>Os(this['locale'],_0x5f0dc5?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Bo]},'children':[this['_modelSelector'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]});}setWebSearch(_0x24281c){this['set']('webSearchActive',_0x24281c);}setReasoning(_0x346f1c){this['set']('reasoningActive',_0x346f1c);}setModelList(_0xa65ccf,_0x5b2242){this['_modelSelector']['setModels'](_0xa65ccf,!_0x5b2242);}setModel(_0x46c51e){if(!_0x46c51e)return;this['_modelSelector']['setSelectedModel'](_0x46c51e);const _0xac516b=_0x46c51e['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0xac516b),this['_webSearchButton']['set']('isVisible',_0xac516b);const _0x1a539f=_0x46c51e['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x1a539f),this['_reasoningButton']['set']('isVisible',_0x1a539f);}enableModelSelector(){this['set']('modelSelectorEnabled',!0x0);}disableModelSelector(_0x3bac6b){this['set']('modelSelectorEnabled',!0x1),_0x3bac6b&&(this['_modelSelector']['modelDisplayMode']='hidden');}_createWebSearchButton(){const _0x4d5ee5=new Bt();return _0x4d5ee5['set']({'label':Os(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ht,'class':Go+'\x20'+ir,'isToggleable':!0x0,'tooltipPosition':qo}),_0x4d5ee5['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x4d5ee5;}_createReasoningButton(){const _0x36a7bc=new Bt();return _0x36a7bc['set']({'label':Os(this['locale'],'AI_CHAT_REASONING'),'icon':_0xfbdb8e,'class':Go+'\x20'+ir,'isToggleable':!0x0,'tooltipPosition':qo}),_0x36a7bc['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x36a7bc;}_createCommandsButton(){const _0x3671a3=new Bt();return _0x3671a3['set']({'label':Os(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x3d4e25,'withText':!0x0,'class':Go+'\x20'+ir,'isToggleable':!0x0,'tooltip':Os(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':qo}),_0x3671a3['extendTemplate']({'attributes':{'class':[Ko]}}),_0x3671a3['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x3671a3;}};const Xo='ck-ai-chat-context-controls__url-form',zo='ck-ai-chat-context-controls__url-input-section';var jo=class extends _0xfd0945{['focusTracker'];keystrokes;['_focusables'];['focusCycler'];urlInputField;backButton;confirmButton;constructor(_0x396640){super(_0x396640),this['focusTracker']=new _t(),this['keystrokes']=new gt(),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 $t({'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'](_0x298038=>{this['focusTracker']['add'](_0x298038['element']),this['keystrokes']['listenTo'](_0x298038['element']);}),_0xebad48({'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(_0x25d273){this['urlInputField']['errorText']=_0x25d273,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}_createBackButton(){const _0x384023=new Bt(this['locale']);return _0x384023['set']({'icon':_0x52157c,'tooltip':Os(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x2ae04f,_0x24dcd9,_0x27db34)=>{_0x384023['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x27db34?'':'\x20ck-hidden')]});}),_0x384023;}_createUrlInputField(){const _0x3cbac8=new jt(this['locale'],_0x2c6629);return _0x3cbac8['set']({'label':Os(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x3cbac8['fieldView']['set']({'placeholder':Os(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x3cbac8;}_createConfirmButton(){const _0x3b2bb9=new Bt(this['locale']);return _0x3b2bb9['set']({'icon':_0xca6ce1,'tooltip':Os(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x3b2bb9;}_setupTemplate(){const _0x3119b4=new Yt(this['locale'],{'label':Os(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x3119b4['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':Xo,'tabindex':'-1'},'children':[_0x3119b4,{'tag':'div','attributes':{'class':zo},'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',_0x12e474=>{_0x12e474['stop'](),this['_handleSubmit']();});}_setupKeystrokes(){this['keystrokes']['set']('esc',(_0x2118b1,_0x486fea)=>{this['clear'](),this['fire']('cancel'),_0x486fea();});}_handleSubmit(){const _0x162327=this['getValue']()['trim']();_0x162327?this['_isValidUrl'](_0x162327)?(this['clearError'](),this['fire']('submitUrl',_0x162327)):this['setError'](Os(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Os(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}_updateConfirmButtonState(){const _0x39cbb4=this['getValue']()['trim'](),_0x354d68=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x39cbb4['length']>0x0&&!_0x354d68;}['_isValidUrl'](_0x12fa82){try{return!!new URL(_0x12fa82);}catch{return!0x1;}}};const Jo='ck-ai-chat-resources__item',Zo='ck-ai-chat-resources__item--in-context',ta='ck-ai-chat-resources__item-title',ea='ck-ai-chat-resources__item__icon';var ia=class extends te{['resource'];_titleView;['_iconView'];constructor(_0x9042a0,_0xd64848){super(_0x9042a0),this['resource']=_0xd64848,this['set']('isInContext',!!_0xd64848['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}getResourceIcon(_0x12e969){if(_0x12e969['isInContext'])return _0xca6ce1;switch(_0x12e969['type']){case'document':return _0x399c89;case'web-resource':return _0x11032b;case'file':case'text':return _0x28c155;default:return _0x47568f;}}highlightText(_0x49d512){if(!_0x49d512||''===_0x49d512['trim']())return void this['_titleView']['highlightText'](null);const _0x170093=new RegExp(_0x16a55e(_0x49d512),'gi');this['_titleView']['highlightText'](_0x170093);}updateResourceState(_0x92a85d){this['resource']['isInContext']=_0x92a85d,this['isInContext']=_0x92a85d,this['_updateIcon']();}_createTitleView(){const _0x267376=new Qt();return _0x267376['text']=this['resource']['label'],_0x267376['extendTemplate']({'tag':'span','attributes':{'class':[ta]}}),_0x267376;}_createIconView(){const _0x4d05c5=new Xt();return _0x4d05c5['content']=this['getResourceIcon'](this['resource']),_0x4d05c5;}_setupTemplate(){const _0x3caa90=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[Jo,_0x3caa90['if']('isVisible','ck-hidden',_0x3f394b=>!_0x3f394b),_0x3caa90['if']('isInContext',Zo)]},'children':[{'tag':'div','attributes':{'class':[ea]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x3caa90['to']('execute')}});}_updateIcon(){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const sa='ck-ai-chat-resources__list';var na=class extends _0x4ca5fe{['_source'];constructor(_0xdc6ae1,_0x491bc5){super(_0xdc6ae1),this['_source']=_0x491bc5,this['extendTemplate']({'attributes':{'class':[sa]}});}setResources(_0x373fe2,_0x40de4c){this['items']['clear']();let _0x228b49=_0x373fe2;if(this['_source']['useDefaultFiltering']&&_0x40de4c&&''!==_0x40de4c['trim']()){const _0x31d697=new RegExp(_0x40de4c['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x228b49=_0x373fe2['filter'](_0x37f438=>_0x31d697['test'](_0x37f438['label']));}for(const _0x2b9d48 of _0x228b49){const _0x57dddf=new ia(this['locale'],_0x2b9d48);_0x57dddf['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x2b9d48);}),this['items']['add'](_0x57dddf);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x40de4c);}highlightText(_0x5f1577){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x55b91d=>{_0x55b91d['highlightText'](_0x5f1577);});}updateResourceState(_0x4f4a77,_0x59f125){for(const _0x170b09 of this['items']){const _0x4153f9=_0x170b09;_0x4153f9['resource']['id']===_0x4f4a77&&_0x4153f9['updateResourceState'](_0x59f125);}}_handleResourceSelection(_0x196396,_0x5f4fae){this['fire']('addResourceToContext',{'source':_0x196396,'resource':_0x5f4fae});}},ra=class extends jt{['iconView'];resetButtonView;['_viewConfig'];constructor(_0x3e0471){const t=_0x3e0471['t'],_0x3a9eb3={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x2c6629,'label':Os(_0x3e0471,'AI_CHAT_SEARCH_RESOURCES')};super(_0x3e0471,_0x3a9eb3['creator']),this['label']=_0x3a9eb3['label'],this['_viewConfig']=_0x3a9eb3,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x3e0471,t),this['_setupEventListeners']();}reset(){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x181714){this['fire']('search',_0x181714);}getQuery(){return this['fieldView']['element']?.['value']||'';}_setupSearchIcon(){this['iconView']=new Xt(),this['iconView']['content']=_0x5cdfe0,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}_setupResetButton(_0x27e1d2,t){this['resetButtonView']=new Bt(_0x27e1d2),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x509f6e,'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',_0x2f9a7e=>!_0x2f9a7e),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);}},oa=class extends _0xfd0945{['_searchView'];_searchSection;_searchInputVisibleFrom;_resourcesListView;_skeletonLoader;['_source'];['children'];_latestLoadResourcesUid=null;constructor(_0x522c99,_0x1a02cb){super(_0x522c99),this['_source']=_0x1a02cb['source'],this['_searchInputVisibleFrom']=_0x1a02cb['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 _0x353304([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}_createSearchView(){return new ra(this['locale']);}_createSearchSection(){const _0x59354f=new _0xfd0945(this['locale']);return _0x59354f['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x102634,_0x3b7a55)=>{this['loadResources'](_0x3b7a55),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x3b7a55);}),_0x59354f;}_createResourcesListView(){const _0x49407b=new na(this['locale'],this['_source']);return _0x49407b['delegate']('addResourceToContext')['to'](this),_0x49407b['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x49407b;}_createSkeletonView(){const _0x38a8cd=new Br(this['locale'],Gr['aiChatResources']);return _0x38a8cd['bind']('isVisible')['to'](this,'isLoading'),_0x38a8cd;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x2b156b){const _0x246f10=xt();this['_latestLoadResourcesUid']=_0x246f10,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x2b156b,'uid':_0x246f10}),this['isLoading']=!0x0;}setResources(_0x3f4d00,_0x172100){if(_0x172100&&_0x172100!==this['_latestLoadResourcesUid'])return;const _0x49cc6b=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x3f4d00,_0x49cc6b),_0x3f4d00['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}updateResourceState(_0x58d3f3,_0x1c325b){this['_resourcesListView']['updateResourceState'](_0x58d3f3,_0x1c325b);}};const aa='ck-ai-chat-context-controls__source-balloon-panel',ha='ck-button-icon\x20ck-button-back',ca='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var la=class{['_sourceResourceBalloons']=new Map();_bodyCollection;['_locale'];['_config'];constructor(_0x46636f,_0x15d3e1,_0x53b38e){this['_locale']=_0x46636f,this['_bodyCollection']=_0x15d3e1,this['_config']=_0x53b38e;}['showSourceResourcesBalloon']({source:_0x2dc6ed,withBackButton:_0x41ca3d}){let _0x5249b5=this['_sourceResourceBalloons']['get'](_0x2dc6ed['id']);_0x5249b5||(_0x5249b5=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x2dc6ed['id'],_0x5249b5),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x5249b5)),this['_addSourceResourceContent']({'balloonPanel':_0x5249b5,'source':_0x2dc6ed,'withBackButton':_0x41ca3d}),_0x5249b5['show']();const _0x1a8e47=this['_config']['getTargetElement']();_0x1a8e47&&_0x5249b5['pin']({'target':_0x1a8e47,'limiter':this['_config']['getLimiterElement']()});}populateSourceResourceBalloon(_0x1e50a8,_0x5d6846,_0x53d021){const _0x2a5def=this['_sourceResourceBalloons']['get'](_0x1e50a8);if(!_0x2a5def)return;const _0x1a4652=this['_getResourcesViewFromBalloon'](_0x2a5def);_0x1a4652&&(_0x1a4652['setResources'](_0x5d6846,_0x53d021),_0x1a4652['once']('change:isLoading',()=>{_0x2a5def['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x214f1f){const _0x19d6f3=this['_sourceResourceBalloons']['get'](_0x214f1f);_0x19d6f3&&requestAnimationFrame(()=>{_0x19d6f3['hide'](),this['_sourceResourceBalloons']['delete'](_0x214f1f),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x33fff0 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x33fff0);}['isAnyResourceBalloonVisible'](){for(const _0x3c865d of this['_sourceResourceBalloons']['values']())if(_0x3c865d['isVisible'])return!0x0;return!0x1;}updateResourceState(_0x36d5d1,_0x455fda,_0x497ae5){const _0x4753b0=this['_sourceResourceBalloons']['get'](_0x36d5d1);if(!_0x4753b0||!_0x4753b0['isVisible'])return;const _0x5d5076=this['_config']['getTargetElement']();if(!_0x5d5076)return;_0x4753b0['pin']({'target':_0x5d5076,'limiter':this['_config']['getLimiterElement']()});const _0x579330=this['_getResourcesViewFromBalloon'](_0x4753b0);_0x579330&&_0x579330['updateResourceState'](_0x455fda,_0x497ae5);}destroy(){for(const _0x4a2d62 of this['_sourceResourceBalloons']['values']())_0x4a2d62['destroy']();this['_sourceResourceBalloons']['clear']();}_createSourceResourceBalloonPanel(){const _0x38e4f1=new Pt(this['_locale']);return _0x38e4f1['extendTemplate']({'attributes':{'class':aa}}),this['_bodyCollection']['add'](_0x38e4f1),_0x38e4f1;}_addSourceResourceContent({balloonPanel:_0x52f1cc,source:_0x125149,withBackButton:_0x5d0add}){_0x52f1cc['content']['clear']();const _0x461ca1=this['_createBalloonHeader']({'balloonPanel':_0x52f1cc,'source':_0x125149,'withBackButton':_0x5d0add});_0x52f1cc['content']['add'](_0x461ca1);const _0x5c315a=this['_createBalloonResourcesView'](_0x125149);_0x52f1cc['content']['add'](_0x5c315a);}_createBalloonHeader({balloonPanel:_0x24ce99,source:_0x5dc2f5,withBackButton:_0x458f14}){const _0x254ab8=new Yt(this['_locale'],{'label':_0x5dc2f5['label'],'class':ca});return _0x458f14&&_0x254ab8['children']['add'](this['_createBackButton'](_0x24ce99),0x0),_0x254ab8;}_createBackButton(_0x9c8578){const _0x293bf1=new Bt(this['_locale']);return _0x293bf1['set']({'icon':_0x52157c,'tooltip':Os(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':ha}),_0x293bf1['on']('execute',()=>{_0x9c8578['hide'](),this['_config']['onBackToContext']();}),_0x293bf1;}_createBalloonResourcesView(_0x2e2e6f){const _0xa248b=new oa(this['_locale'],{'source':_0x2e2e6f,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0xa248b['on']('loadSourceResources',(_0x20dd7b,_0x59c535)=>{this['_config']['onLoadSourceResources'](_0x59c535);}),_0xa248b['on']('addResourceToContext',(_0x5cc104,_0x594ed4)=>{this['_config']['onResourceSelected'](_0x594ed4['source'],_0x594ed4['resource']),this['closeSourceResourceBalloon'](_0x2e2e6f['id']);}),_0xa248b;}_getResourcesViewFromBalloon(_0x214ab6){const _0x174567=_0x214ab6['content']['get'](0x1);return _0x174567 instanceof oa?_0x174567:null;}_setupSingleResourceBalloonClickOutsideHandler(_0x36e4f2){_0x4f15a2({'emitter':_0x36e4f2,'contextElements':[_0x36e4f2['element']],'callback':()=>{_0x36e4f2['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x36e4f2['isVisible']});}};const ua=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],da='ck-ai-chat-context-controls',_a='ck-ai-chat-context-controls__pending-contexts',ga='ck-ai-chat-context-controls__add-context-balloon-panel',Aa='ck-ai-chat-context-controls__add-context-button',Ia='ck-ai-chat-context-controls__url-balloon-panel',pa='ck-ai-chat-context-controls__balloon-button',ma='ck-ai-chat-context-controls__balloon-button-source',Ea='ck-ai-chat-controls-button',wa='ck-ai-chat-context-chips-wrapper-balloon',Ta='ck-ai-chat-controls_context_show-more-button',fa='ck-ai-chat-context-controls__show-more-balloon-panel',Ca='ck-ai-chat',ba=[Pt['defaultPositions']['northArrowSouthWest'],Pt['defaultPositions']['northArrowSouth'],Pt['defaultPositions']['northArrowSouthEast'],Pt['defaultPositions']['southArrowNorthWest'],Pt['defaultPositions']['southArrowNorth'],Pt['defaultPositions']['southArrowNorthEast']];var Sa=class extends _0xfd0945{addContextButtonView;_currentContextsChips=this['createCollection']();_conversationContextsChips=this['createCollection']();['_overflowManager'];_addContextBalloonPanelView;['_urlBalloonPanelView'];_urlInputView;['_resourcesBalloonView'];_addContextBalloonConfig;_hasExactlyOneSource=!0x1;bodyCollection;constructor(_0x1ff105,_0x1c7948){super(_0x1ff105),this['bodyCollection']=_0x1c7948['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x1ff105),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x1ff105),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x1ff105),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x1ff105,_0x1c7948);const _0x5d2d5e={'cssClasses':{'showMoreButton':Ta+'\x20'+ir,'showMoreBalloon':fa,'overflowContainer':wa,'controlsButton':Ea}};this['_overflowManager']=new go(_0x1ff105,this['_currentContextsChips'],_0x5d2d5e,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(_0x1ed694,_0x41e413){const _0x134f41=this['_createContextButton'](_0x1ed694,'current',!0x0,_0x41e413);this['_addContextToCollection'](_0x134f41,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}removeContextItem(_0x30539e){this['_removeContextFromCollection'](_0x30539e,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x30539e,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}setContextItemLoading(_0x1e1153,_0x4cf9f1){let _0x5389b6=this['_currentContextsChips']['find'](_0x57e419=>_0x57e419['id']===_0x1e1153);_0x5389b6||(_0x5389b6=this['_overflowManager']['overflowChips']['find'](_0x111ffb=>_0x111ffb['id']===_0x1e1153)),_0x5389b6&&(_0x5389b6['isLoading']=_0x4cf9f1);}setConversationContext(_0x2f83db){this['_conversationContextsChips']['clear']();for(const _0x557e26 of _0x2f83db){const _0x4a351a=this['_createContextButton'](_0x557e26,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x4a351a,this['_conversationContextsChips']);}}clearCurrentContextItems(){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}clearConversationContextItems(){this['_conversationContextsChips']['clear']();}updateResourceState(_0x5e1987,_0x221e7d,_0x888764){this['_resourcesBalloonView']['updateResourceState'](_0x5e1987,_0x221e7d,_0x888764);}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:_0x361ea4,withBackButton:_0x334774}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x361ea4,'withBackButton':_0x334774}),this['addContextButtonView']['isOn']=!0x0;}populateSourceResourceBalloon(_0x550882,_0x2cae83,_0x45ae57,_0x18297b){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x550882,_0x45ae57,_0x18297b);}['closeSourceResourceBalloon'](_0x543f08){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x543f08),this['addContextButtonView']['isOn']=!0x1;}setAddContextOptions(_0x34f1b6){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x34f1b6),this['_setAddContextButtonEnabled'](_0x34f1b6);}_setAddContextButtonEnabled(_0x27a522){const _0x42a3e1=!_0x27a522['document']['isHidden']&&_0x27a522['document']['enabled'],_0x403ea8=_0x27a522['urls']['enabled'],_0xed3911=_0x27a522['files']['enabled'],_0x42f190=_0x27a522['sources']['length']>0x0,_0x11cece=_0x27a522['customItems']&&_0x27a522['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x42a3e1||_0x403ea8||_0xed3911||_0x42f190||_0x11cece;}_setupTemplate(){this['setTemplate']({'tag':'div','attributes':{'class':[da,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':_a},'children':this['_currentContextsChips']}]});}_bindEventHandlers(){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}_createAddContextButtonView(_0x253083){const _0x1d97dc=new Bt(_0x253083);return _0x1d97dc['set']({'label':Os(_0x253083,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Ea+'\x20'+Aa+'\x20'+ir,'icon':_0x1c0fd0,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x1d97dc;}_createAddContextBalloonPanelView(_0xe412f3){return this['_createBaseBalloonPanel'](_0xe412f3,ga);}_createUrlBalloonPanelView(_0x42e24f){const _0x53a7ce=this['_createBaseBalloonPanel'](_0x42e24f,Ia);return this['_addUrlContent'](_0x53a7ce,_0x42e24f),_0x53a7ce;}_createResourcesBalloonView(_0x502a26,_0x49a621){const _0x2c0676={'searchInputVisibleFrom':_0x49a621['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ba});},'onResourceSelected':(_0x6b2773,_0x8de5c7)=>{this['fire']('addResourceToContext',{'source':_0x6b2773,'resource':_0x8de5c7});},'onLoadSourceResources':_0x1c66e2=>{this['fire']('loadSourceResources',_0x1c66e2);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new la(_0x502a26,_0x49a621['bodyCollection'],_0x2c0676);}_getLimiterElement(){return this['element']?.['closest']('.'+Ca)||document['body'];}_createBaseBalloonPanel(_0xca6586,_0x43b0e3){const _0x3f745d=new Pt(_0xca6586);return _0x3f745d['extendTemplate']({'attributes':{'class':_0x43b0e3}}),this['bodyCollection']['add'](_0x3f745d),_0x3f745d;}_setBalloonPanelContent(_0x17316a,_0x4f5aa5,_0x57eea6){if(_0x17316a['content']['clear'](),!_0x57eea6['document']['isHidden']&&_0x57eea6['document']['enabled']){const _0x7a68f5=this['_createBalloonButton'](_0x4f5aa5,{'label':Os(_0x4f5aa5,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x399c89});_0x7a68f5['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x17316a['content']['add'](_0x7a68f5);}if(_0x57eea6['urls']['enabled']){const _0x3153dd=this['_createBalloonButton'](_0x4f5aa5,{'label':Os(_0x4f5aa5,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x11032b});_0x3153dd['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ba}),this['_urlInputView']['focus']();}),_0x17316a['content']['add'](_0x3153dd);}if(_0x57eea6['files']['enabled']){const _0x109b85=new Wt(_0x4f5aa5);_0x109b85['set']({'label':Os(_0x4f5aa5,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x10880d,'withText':!0x0,'tooltip':!0x0,'class':pa,'allowMultipleFiles':!0x0}),_0x109b85['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x109b85['on']('done',(_0x52db28,_0x254a7b)=>{this['fire']('addFileToContext',_0x254a7b);}),_0x109b85['tooltip']=!0x0,_0x17316a['content']['add'](_0x109b85);}for(const _0x14d02d of _0x57eea6['sources']){const _0x45978a=this['_createBalloonButton'](_0x4f5aa5,{'label':_0x14d02d['label'],'icon':_0x14d02d['icon']||_0x47568f,'type':'source'});_0x17316a['content']['add'](_0x45978a),_0x45978a['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x14d02d,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x5ee379 of _0x57eea6['customItems']||[]){const _0x39bdef=this['_createBalloonButton'](_0x4f5aa5,{'label':_0x5ee379['label'],'icon':_0x5ee379['icon']||_0x47568f,'type':'customItem'});_0x17316a['content']['add'](_0x39bdef),_0x39bdef['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x5ee379);});}this['_hasExactlyOneSource']=0x1===_0x17316a['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}_addUrlContent(_0x6fe104,_0x2c3e47){this['_urlInputView']=new jo(_0x2c3e47),this['_urlInputView']['on']('submitUrl',(_0x51c190,_0x13b901)=>{this['_handleUrlSubmit'](_0x13b901);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ba}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ba});}),_0x6fe104['content']['add'](this['_urlInputView']);}_createBalloonButton(_0x2c66e7,_0x2d860b){const _0x550d53='source'===_0x2d860b['type']?new Ra(_0x2c66e7):new Bt(_0x2c66e7);return _0x550d53['set']({'label':_0x2d860b['label'],'icon':_0x2d860b['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':pa}),_0x550d53;}_setupAllBalloonClickOutsideHandlers(){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}_setupUrlBalloonClickOutsideHandler(){_0x4f15a2({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}_toggleAddContextBalloon(_0x2e43e6){const _0x19fb5f=this['_addContextBalloonConfig'];_0x19fb5f['buttonView']['isOn']=_0x2e43e6,_0x2e43e6?_0x19fb5f['balloonView']['show']():_0x19fb5f['balloonView']['hide']();}_setupAddContextBalloonClickOutsideHandler(){const {balloonView:_0x4ec9af,buttonView:_0x121f23,hideMethod:_0x4de7a5}=this['_addContextBalloonConfig'];_0x4f15a2({'emitter':_0x4ec9af,'contextElements':[_0x4ec9af['element'],_0x121f23['element']],'callback':()=>{_0x4de7a5();},'activator':()=>_0x121f23['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}_createContextButton(_0x18719b,_0x4dbdbf,_0x591494=!0x1,_0x5f37a2=!0x1){const _0x5d934c='conversation'===_0x4dbdbf||!0x0===_0x18719b['isReadOnly'],_0x5d2ebc=new co(this['locale'],_0x18719b,_0x5d934c,_0x591494,_0x5f37a2);return _0x5d934c||_0x5d2ebc['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x5d2ebc['id']);}),_0x5d2ebc;}_addContextToCollection(_0x128c49,_0x47b4c4){_0x47b4c4['add'](_0x128c49,0x0);}_removeContextFromCollection(_0x1c8476,_0x3d7db5){const _0xe1de39=_0x3d7db5['find'](_0xddb524=>_0xddb524['id']===_0x1c8476);_0xe1de39&&_0x3d7db5['remove'](_0xe1de39);}_handleAddContextButtonClick(){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':ba}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}_handleUrlSubmit(_0x54fea4){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x54fea4);}},Ra=class extends Bt{['arrowView'];constructor(_0x40d809){super(_0x40d809),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[ma]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0x1344c8=new Xt();return _0x1344c8['content']=_0x58a8f2,_0x1344c8['extendTemplate']({'attributes':{'class':ma+'__arrow'}}),_0x1344c8;}},Oa=class extends _0xfd0945{_cancelButtonView;['_loaderView'];constructor(_0x733ff5){super(_0x733ff5),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 _0x4f51af=new Bt(this['locale']);return _0x4f51af['set']({'label':Os(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':er+'\x20ck-ai-button-stop-generating','icon':st}),_0x4f51af['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x4f51af;}_createLoaderView(){const _0x1596f8=new _0xfd0945(this['locale']);return _0x1596f8['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':Os(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x1596f8;}},va=class extends _0xfd0945{_contextPanelView;_promptInputView;['_dropZoneView'];_promptCapabilitiesView;['_loaderView'];['_modelUnavailableMessageView'];_shouldRestorePromptInputFocus;['_filesEnabled'];constructor(_0x37a0b2,_0x187024){super(_0x37a0b2),this['_filesEnabled']=_0x187024['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x37a0b2,{'bodyCollection':_0x187024['bodyCollection'],'searchInputVisibleFrom':_0x187024['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x37a0b2),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x37a0b2),this['_loaderView']=this['_createLoaderView'](_0x37a0b2),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x37a0b2),this['_dropZoneView']=new Do(_0x37a0b2),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_dropZoneView']['bind']('isEnabled')['to'](this,'isLoading',_0x4021b4=>!_0x4021b4),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'](...ua)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x723b3e=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x723b3e['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x723b3e['if']('isLoading','ck-hidden',_0x2da4ba=>_0x2da4ba||!this['isModelAvailable']),_0x723b3e['if']('isModelAvailable','ck-hidden',_0x49db06=>!_0x49db06||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x723b3e['if']('isLoading','ck-hidden',_0x33adc3=>!_0x33adc3)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x723b3e['if']('isModelAvailable','ck-hidden',_0x3f629e=>_0x3f629e)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x4f15a2({'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(_0x5cc6a4,_0x4c200e){return new Sa(_0x5cc6a4,_0x4c200e);}_createPromptInputView(_0x46a203){return new Lo(_0x46a203,this['_contextPanelView']['addContextButtonView']);}_createPromptCapabilitiesView(_0x514839){return new Qo(_0x514839);}_createLoaderView(_0x588c3c){return new Oa(_0x588c3c);}_createModelUnavailableMessageView(_0x14ef5f){const _0xb6cd31=new ya(_0x14ef5f);return _0xb6cd31['delegate']('startConversation')['to'](this),_0xb6cd31;}_handlePromptInputFocus(_0x3b8f3b,_0x1b7881,_0x6a1d92){_0x6a1d92?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}addContextItem(_0x2f86fc,_0x4e42c6){this['_contextPanelView']['addContextItem'](_0x2f86fc,_0x4e42c6);}removeContextItem(_0x37c845){this['_contextPanelView']['removeContextItem'](_0x37c845);}setContextItemLoading(_0x524abd,_0x4ba73d){this['_contextPanelView']['setContextItemLoading'](_0x524abd,_0x4ba73d);}setIsUploadInProgress(_0x48cf21){this['_promptInputView']['setIsUploadInProgress'](_0x48cf21);}setConversationContext(_0x316f95){this['_contextPanelView']['setConversationContext'](_0x316f95);}clearPendingContextUI(){this['_contextPanelView']['clearCurrentContextItems']();}clearConversationContextUI(){this['_contextPanelView']['clearConversationContextItems']();}updateResourceState(_0x528a0e,_0x29d141,_0x54a9ac){this['_contextPanelView']['updateResourceState'](_0x528a0e,_0x29d141,_0x54a9ac);}setWebSearch(_0xdc24cd){this['_promptCapabilitiesView']['setWebSearch'](_0xdc24cd);}setReasoning(_0x57d0f2){this['_promptCapabilitiesView']['setReasoning'](_0x57d0f2);}resetMessageInput(){this['_promptInputView']['reset']();}setAddContextOptions(_0xbc9be6){this['_contextPanelView']['setAddContextOptions'](_0xbc9be6);}setInputPlaceholder(_0x7b9ff3){this['_promptInputView']['setPlaceholderText'](_0x7b9ff3);}setModelList(_0x2cff31,_0x29f11f){this['_promptCapabilitiesView']['setModelList'](_0x2cff31,_0x29f11f);}setModel(_0x2efe5b){_0x2efe5b?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x2efe5b)):this['isModelAvailable']=!0x1;}enableModelSelector(){this['_promptCapabilitiesView']['enableModelSelector']();}disableModelSelector(_0x18da14){this['_promptCapabilitiesView']['disableModelSelector'](_0x18da14);}populateSourceResourceBalloon(_0x165c4b,_0x328c4d,_0x4d8c2d,_0x55fe0f){this['_contextPanelView']['populateSourceResourceBalloon'](_0x165c4b,_0x328c4d,_0x4d8c2d,_0x55fe0f);}['closeSourceResourceBalloon'](_0x4bcc8f){this['_contextPanelView']['closeSourceResourceBalloon'](_0x4bcc8f);}focusPromptInput(_0x245e62=!0x1){this['_promptInputView']['focus'](_0x245e62);}setPromptInputValue(_0x2de37c){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x2de37c;}},ya=class extends _0xfd0945{constructor(_0x517e4d){super(_0x517e4d);const _0x4b008b=new Bt(_0x517e4d);_0x4b008b['set']({'label':Os(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x4b008b['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Os(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x4b008b]}]});}},ka=class extends Yt{resizeButton;constructor(_0xc1ab20,_0x5c002e){super(_0xc1ab20,{'label':_0x5c002e['label'],'class':'ck-ai-header\x20'+_0x5c002e['class'],'icon':_0x5c002e['icon']}),this['set']('isMaximized',!0x1),_0x5c002e['content']&&this['children']['add'](_0x5c002e['content']),_0x5c002e['showResizeButton']&&(this['resizeButton']=sr(_0xc1ab20,this),this['children']['add'](this['resizeButton']));}},Na=class extends _0xfd0945{constructor(_0x17abf7){super(_0x17abf7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Os(_0x17abf7,'AI_DISCLAIMER_TEXT')}]}]});}};function xa(_0xfbb812,_0x39d1a5){const _0x3ddc0a=new Bt(_0xfbb812);return _0x3ddc0a['set']({'label':Os(_0xfbb812,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x3f9794,'class':'ck-ai-chat__start-conversation\x20'+er}),_0x3ddc0a['on']('execute',()=>{_0x39d1a5['fire']('startConversation');}),_0x3ddc0a;}var La=class extends _0xfd0945{chatHeader;chatFeed;chatControls;chatDisclaimer;_bodyCollection;constructor(_0x54e2f4,_0x2fc713){super(_0x54e2f4),this['_bodyCollection']=nr(_0x54e2f4);const _0x1167a9=xa(_0x54e2f4,this);this['chatHeader']=new ka(_0x54e2f4,{'label':Os(_0x54e2f4,'AI_CHAT_HEADING'),'icon':_0x5213f,'class':'ck-ai-header_chat','content':_0x1167a9,'showResizeButton':_0x2fc713['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new yo(_0x54e2f4,this['_bodyCollection']),this['chatFeed']['delegate'](...fr)['to'](this),this['chatControls']=new va(_0x54e2f4,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x2fc713['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x2fc713['filesEnabled']}),this['chatControls']['delegate'](...fr)['to'](this),this['chatDisclaimer']=new Na(_0x54e2f4),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x54e2f4['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}populateSourceResourceBalloon(_0x5dbd9f,_0xe4e224,_0x417970,_0x23ebe4){this['chatControls']['populateSourceResourceBalloon'](_0x5dbd9f,_0xe4e224,_0x417970,_0x23ebe4);}['closeSourceResourceBalloon'](_0x1fa5d1){this['chatControls']['closeSourceResourceBalloon'](_0x1fa5d1);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Da=class extends _0x338e6f{static get requires(){return[bs];}['_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;get['idleUiPromise'](){return this['_promiseQueue']['queueEmptyPromise'];}constructor(_0xa1f023){super(_0xa1f023);const _0x30b366=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['set']('isChatStreaming',!0x1),this['_promiseQueue']=new Wr(),this['_view']=new La(this['context']['locale'],{'showResizeButton':_0x30b366['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'](_0x30b366),this['_view']['delegate'](...fr)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x10ac54,{showDiff:_0x2bdf05})=>{this['showDiff']=_0x2bdf05;}),this['disableControls'](),_0x30b366['view']['addTab']({'id':'chat','buttonLabel':Os(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x5213f,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x30b366['view'],'isMaximized',_0x11c56f=>_0x11c56f),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isChatStreaming',_0x5db9f0=>_0x5db9f0),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}destroy(){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}createConversation({availableModels:_0x2c903b}){const _0x5b5086=this['context']['config']['get']('ai.chat.welcomeMessage')??Os(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x2c903b,!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x5b5086}),this['fire']('conversationCreated');}async addFeedItemStaticMessage({id:_0x2c3d89,staticMessage:_0x23f27d}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x2c3d89,'initialContent':'<p>'+_0x23f27d+'</p>'});});}async addFeedItemUserMessage(_0x40be28){const _0x1537a3=_0x40be28['attributes']?.['displayedPrompt']||_0x40be28['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x40be28['contextItems']['values']()),'initialContent':'<p>'+_0x1537a3+'</p>','id':_0x40be28['id']});});}async addFeedItemError({errorMessage:_0x5438a5,id:_0x1a2ec4}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x5438a5+'</p>','id':_0x1a2ec4});});}async addFeedItemAIReply(_0xd41751){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0xd41751['interactionId']+':'+_0xd41751['id']}),this['clearLoadingMessage']();});}async addFeedItemAISuggestion(_0x18d009){const _0x421c4e=Ls(this['context']),_0x72bcd0=_0x421c4e['map'](_0x17d87c=>_0x17d87c['config']['get']('ai.availableReplyActions')||[...Yr]);let _0x5fdf7e=_0x72bcd0['reduce']((_0x305ea2,_0xe33ccd)=>_0x305ea2['filter'](_0x4fd083=>_0xe33ccd['includes'](_0x4fd083)),_0x72bcd0[0x0]||[...Yr]);const _0x140d37=_0x421c4e['every'](_0x5521b4=>_0x5521b4['plugins']['has']('TrackChanges')),_0x520d95=_0x421c4e['map'](_0x3ad899=>_0x3ad899['commands']['get']('trackChanges'));return _0x140d37?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x520d95,'value',(..._0x4483ca)=>_0x4483ca['some'](_0x2df827=>_0x2df827))):_0x5fdf7e=_0x5fdf7e['filter'](_0x1bf420=>'insertSuggestion'!=_0x1bf420),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x18d009['interactionId']+':'+_0x18d009['id'],'areActionsDisabled':_0x18d009['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x5fdf7e}),this['clearLoadingMessage']();});}async addFeedInteractionHeader(_0x1eecb2,_0x34000b){return this['_promiseQueue']['enqueue'](async()=>{const _0x10be37=this['_view']['chatFeed']['children']['last'];if(_0x10be37 instanceof Co)return this['_view']['chatFeed']['children']['remove'](_0x10be37),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x1eecb2['id'],'capabilities':{'isWebSearchEnabled':_0x10be37['capabilities']['isWebSearchEnabled']||_0x34000b['isWebSearchEnabled'],'isReasoningEnabled':_0x10be37['capabilities']['isReasoningEnabled']||_0x34000b['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x1eecb2['id'],'capabilities':_0x34000b});});}async addFeedItemCustomElement(_0x58e8cc,_0x331c0f){let _0xef38ba;return await this['_promiseQueue']['enqueue'](async()=>{_0xef38ba=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x58e8cc,'id':_0x331c0f});}),_0xef38ba;}removeFeedItem(_0x33995a){this['_view']['chatFeed']['removeItem'](_0x33995a);}hasFeedItem(_0x31809b){return this['_view']['chatFeed']['hasItem'](_0x31809b);}updateFeedInteractionHeader(_0x23ca9d){const _0x41e967=this['_view']['chatFeed']['children']['find'](_0x541c7c=>_0x541c7c['options']['id']==_0x23ca9d['id']&&_0x541c7c instanceof Co);_0x41e967&&_0x41e967['set']('isVisible',_0x23ca9d['isVisible']);}async updateFeedItemAIReplyContent(_0x12122e){const _0x32ba59=_0x12122e['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x3bba5a=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x12122e,'abortSignal':_0x3bba5a,'renderingStrategy':_0x32ba59}),_0x12122e['isDone']&&this['markFeedItemAsDone'](_0x12122e['id']);});}updateFeedItemAIReplySources(_0x26d63c,_0x5dca3d){this['_view']['chatFeed']['updateWebSources'](_0x26d63c,_0x5dca3d);}async updateFeedItemAIReplySuggestionContent(_0x52152e){return this['_promiseQueue']['enqueue'](async _0xf876e6=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x52152e,'abortSignal':_0xf876e6}),_0x52152e['isDone']&&this['markFeedItemAsDone'](_0x52152e['id']);});}updateFeedItemAIReplySuggestionPartState(_0x1e6206){this['_view']['chatFeed']['updateSuggestionPartState'](_0x1e6206);}setSuggestionGating(_0x1dfe8e,_0x4f3f0a){this['_view']['chatFeed']['updateSuggestionGating'](_0x1dfe8e,_0x4f3f0a);}setFeedItemAIReplySuggestionPartActive(_0x23d5aa){this['_view']['chatFeed']['setSuggestionPartActive'](_0x23d5aa);}markFeedItemAsDone(_0x3091d7){this['_view']['chatFeed']['markItemAsDone'](_0x3091d7);}removeFeedInteraction(_0x4e3709){this['_view']['chatFeed']['getItemIds']()['filter'](_0x329542=>_0x329542['startsWith'](_0x4e3709))['forEach'](_0x4e4be6=>this['_view']['chatFeed']['removeItem'](_0x4e4be6));}startInteraction(){const _0x13309a=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x13309a),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['isChatStreaming']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}stopInteraction(_0x54a078){this['_promiseQueue']['abort'](),_0x54a078&&this['_view']['chatFeed']['getItemIds']()['filter'](_0x56d304=>_0x56d304['startsWith'](_0x54a078['id']))['forEach'](_0x40c827=>this['markFeedItemAsDone'](_0x40c827)),this['resetChatBusyStateToIdle']();}resetChatBusyStateToIdle(){this['isBusy']=!0x1,this['isChatStreaming']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async finishInteraction(){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['resetChatBusyStateToIdle']();});}addContextItem(_0x7e04f1,_0x403206){this['_view']['chatControls']['addContextItem'](_0x7e04f1,_0x403206);}removeContextItem(_0x2c4b49){this['_view']['chatControls']['removeContextItem'](_0x2c4b49);}setContextItemLoading(_0xc8a11d,_0x21d6f4){this['_view']['chatControls']['setContextItemLoading'](_0xc8a11d,_0x21d6f4);}setIsUploadInProgress(_0x24b174){this['_view']['chatControls']['setIsUploadInProgress'](_0x24b174);}setConversationContext(_0x2d9cf4){this['_view']['chatControls']['setConversationContext'](_0x2d9cf4);}clearPendingContextUI(){this['_view']['chatControls']['clearPendingContextUI']();}clearConversationContextUI(){this['_view']['chatControls']['clearConversationContextUI']();}updateResourceState(_0x95d80f,_0x4ea3ab,_0x561c1d){this['_view']['chatControls']['updateResourceState'](_0x95d80f,_0x4ea3ab,_0x561c1d);}resetMessageInput(){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}setAddContextOptions(_0x2ce820){this['_view']['chatControls']['setAddContextOptions'](_0x2ce820);}updateCapabilities(_0x27c542){this['_view']['chatControls']['setWebSearch'](_0x27c542['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x27c542['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x27c542));}setSelectedModel(_0xd8b8ef,_0x199238){this['_view']['chatControls']['setModel'](_0xd8b8ef),_0x199238&&this['_view']['chatControls']['disableModelSelector'](!0x1);}setFeedItemRenderingStrategy(_0x4fc8aa){this['feedItemRenderingStrategy']=_0x4fc8aa;}toggleLoadingSkeleton(_0x733b92){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x733b92);}resetConversationTitle(){this['setConversationTitle'](Os(this['context']['locale'],'AI_CHAT_HEADING'));}emptyConversationTitle(){this['setConversationTitle']('');}setConversationTitle(_0x2b2034,_0x1975c0=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x1975c0&&!mt()&&_0x2b2034['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x2b2034);this['_view']['chatHeader']['label']=_0x2b2034;}setLoadingMessage(_0x40acf7){this['_view']['chatFeed']['setLoadingMessage'](_0x40acf7);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}_animateConversationTitle(_0xa52870){let _0xe82849=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0xa52870[_0xe82849],_0xe82849++,_0xe82849===_0xa52870['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x6edf8a){return _0x6edf8a['isWebSearchEnabled']&&_0x6edf8a['isReasoningEnabled']?Os(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x6edf8a['isWebSearchEnabled']?Os(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x6edf8a['isReasoningEnabled']?Os(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Os(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}_getInputPlaceholder(_0x1a71a6){return _0x1a71a6?_0x1a71a6['isWebSearchEnabled']&&_0x1a71a6['isReasoningEnabled']?Os(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x1a71a6['isWebSearchEnabled']?Os(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x1a71a6['isReasoningEnabled']?Os(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Os(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Os(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}populateSourceResourceBalloon(_0x1a02e3,_0x554825,_0x247915,_0x5c351c){this['_view']['populateSourceResourceBalloon'](_0x1a02e3,_0x554825,_0x247915,_0x5c351c);}['closeSourceResourceBalloon'](_0x483966){this['_view']['closeSourceResourceBalloon'](_0x483966);}setPromptInputValue(_0x207478){this['_view']['chatControls']['setPromptInputValue'](_0x207478);}focusPromptInput(_0x40886b=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x40886b);}scrollFeedToSuggestion(_0x4e88bc,_0x169cc7){this['_view']['chatFeed']['scrollToSuggestion'](_0x4e88bc,_0x169cc7);}startAutoScroll(_0xe21087={}){this['_view']['chatFeed']['startAutoScroll'](_0xe21087);}stopAutoScroll(){this['_view']['chatFeed']['stopAutoScroll']();}disableControls(){this['_view']['chatControls']['isDisabled']=!0x0;}enableControls(){this['_view']['chatControls']['isDisabled']=!0x1;}toggleConversationLoading(_0x2cf1d1){_0x2cf1d1?(this['isBusy']=_0x2cf1d1,this['disableControls']()):(this['enableControls'](),this['resetChatBusyStateToIdle']());}},Pa=class extends _0x4ca5fe{sections;constructor(_0x36b53e,_0x124d2f){super(_0x36b53e),this['sections']=_0x124d2f,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}filter(_0x2ba34a){let _0x4d1c58=0x0,_0x38f12b=0x0;for(const _0x5c633e of this['sections']){const {resultsCount:_0x2ff3e0,totalItemsCount:_0x478f45}=_0x5c633e['filter'](_0x2ba34a);_0x4d1c58+=_0x2ff3e0,_0x38f12b+=_0x478f45;}return{'resultsCount':_0x4d1c58,'totalItemsCount':_0x38f12b};}},Ha=class extends te{title;itemsViews;_itemsListView;constructor(_0x2f536f,{title:_0x2e4836,items:_0xbfdffc}){super(_0x2f536f);const _0x19aba2=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x2e4836,this['itemsViews']=_0xbfdffc;const _0x5a2611=new _0xfd0945(_0x2f536f);_0x5a2611['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new _0x4ca5fe(_0x2f536f),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x19aba2['if']('isVisible','ck-hidden',_0x3029b9=>!_0x3029b9)]},'children':[_0x5a2611,this['_itemsListView']]});}filter(_0x3ac35c){const _0x46f1a2=this['itemsViews']['length'];let _0x3c33e0=0x0;for(const _0x29da9e of this['itemsViews'])_0x3ac35c?(_0x29da9e['isVisible']=!!_0x29da9e['isMatching'](_0x3ac35c),_0x29da9e['highlightText'](_0x3ac35c)):(_0x29da9e['isVisible']=!0x0,_0x29da9e['highlightText'](null)),_0x29da9e['isVisible']&&_0x3c33e0++;return this['isVisible']=_0x3c33e0>0x0,{'resultsCount':_0x3c33e0,'totalItemsCount':_0x46f1a2};}getItem(_0x405955){return this['itemsViews']['find'](_0x22472b=>_0x22472b['id']===_0x405955);}removeItem(_0x3cb430){const _0x68ada4=this['itemsViews']['indexOf'](_0x3cb430);-0x1!==_0x68ada4&&(this['itemsViews']['splice'](_0x68ada4,0x1),this['_itemsListView']['items']['remove'](_0x3cb430));}};const Ma=/* #__PURE__ -- @preserve */
34
+ _0x5c9b71(te);var Ua=class AIChatHistoryListItemView extends Ma{['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(_0x3100ad,_0x24e504){super(_0x3100ad);const _0x23e241=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x24e504['pinned']),this['set']('loadingState',null),this['set']('title',_0x24e504['title']),this['id']=_0x24e504['id'];const {createdAt:_0x4b4a97,active:_0x25c5b3=!0x1}=_0x24e504;this['_titleView']=new Qt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x484520=this['_createCheckView'](),_0x5c76ff=this['_createPinButtonView'](_0x3100ad),_0x2e300d=this['_createMenuDropdownView'](),_0x3efd26=this['_createEditInputView'](_0x3100ad),_0x533d04=this['_createAcceptEditButtonView'](_0x3100ad,_0x3efd26),_0x38ca37=this['_createCancelEditButtonView'](_0x3100ad);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x5c76ff),this['actions']['add'](_0x2e300d),this['on']('change:isEdit',(_0x5d99fd,_0x19114e,_0x2b140)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x2b140?(this['actions']['add'](_0x533d04),this['actions']['add'](_0x38ca37),this['mainContent']['add'](_0x3efd26),_0x3efd26['element']['value']=this['title']||'',_0x3efd26['element']['focus']()):(this['actions']['add'](_0x5c76ff),this['actions']['add'](_0x2e300d),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x25c5b3?'ck-ai-chat-history__item--active':'',_0x23e241['if']('isVisible','ck-hidden',_0x1ff8e8=>!_0x1ff8e8),_0x23e241['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',_0x23e241['if']('loadingState','ck-hidden',_0x429d86=>!!_0x429d86)]},'children':_0x25c5b3?[_0x484520]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x23e241['if']('loadingState','ck-hidden',_0x3e52a1=>!_0x3e52a1)]},'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',_0x23e241['if']('loadingState','ck-hidden',_0x30aa8f=>!!_0x30aa8f)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x23e241['if']('loadingState','ck-hidden',_0x58aee5=>!_0x58aee5)]},'children':[{'text':_0x23e241['to']('loadingState',_0x38bd3a=>_0x38bd3a?Os(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x38bd3a]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x4b4a97]}]},{'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(_0x365ed8){this['set']('title',_0x365ed8);}updateLoadingState(_0x2aca34,_0x6a041a){this['set']('loadingState',_0x6a041a?_0x2aca34:null);}_createCheckView(){const _0x265506=new Xt();return _0x265506['set']({'content':_0xca6ce1}),_0x265506;}_createPinButtonView(_0x2aa354){const _0x3d1992=new Bt(_0x2aa354);return _0x3d1992['set']({'label':Os(_0x2aa354,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x25f1af,'withText':!0x1,'tooltip':!0x0}),_0x3d1992['bind']('isOn')['to'](this,'pinned'),_0x3d1992['on']('execute',()=>{const _0x44c600=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x44c600});}),_0x3d1992;}_createMenuDropdownView(){const _0x2aed69=_0x5d526e(this['locale']),_0x33e093=_0x2aed69['panelView']['children'];_0x2aed69['buttonView']['set']({'label':Os(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':rt}),_0x2aed69['panelPosition']='sw';const _0x53fe62=new Bt(this['locale']);_0x53fe62['label']=Os(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x53fe62['withText']=!0x0,_0x53fe62['on']('execute',()=>{this['isEdit']=!0x0;});const _0x1ee18e=new Bt(this['locale']);_0x1ee18e['label']=Os(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x1ee18e['withText']=!0x0,_0x1ee18e['on']('execute',()=>{this['showConfirm'](Os(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x27b856=new _0x4ca5fe(this['locale']),_0x339195=new te(this['locale']);_0x339195['children']['add'](_0x53fe62);const _0xdfe41d=new te(this['locale']);return _0xdfe41d['children']['add'](_0x1ee18e),_0x27b856['items']['addMany']([_0x339195,_0xdfe41d]),_0x33e093['add'](_0x27b856),_0x2aed69;}_createEditInputView(_0x570cfb){const _0x1ba5de=new zt(_0x570cfb),_0x255d3b=_0x1ba5de['bindTemplate'];return _0x1ba5de['extendTemplate']({'on':{'keydown':_0x255d3b['to'](_0x40e43f=>{'Enter'==_0x40e43f['key']&&this['_commitEditInputValue'](_0x1ba5de);})}}),_0x1ba5de;}_createAcceptEditButtonView(_0x22b58b,_0x5a6dab){const _0x446698=new Bt(_0x22b58b);return _0x446698['set']({'icon':_0xca6ce1,'withText':!0x1,'tooltip':Os(_0x22b58b,'AI_CHAT_HISTORY_ACCEPT')}),_0x446698['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x446698['on']('execute',()=>{this['_commitEditInputValue'](_0x5a6dab);}),_0x446698;}_commitEditInputValue(_0x48b84f){const _0x125169=_0x48b84f['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x125169});}_createCancelEditButtonView(_0x287df8){const _0x21d04c=new Bt(_0x287df8);return _0x21d04c['set']({'icon':_0x509f6e,'withText':!0x1,'tooltip':Os(_0x287df8,'AI_CHAT_HISTORY_CANCEL')}),_0x21d04c['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x21d04c['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x21d04c;}_createSpinnerView(){const _0x2d09df=new to('tiny');return _0x2d09df['isVisible']=!0x0,_0x2d09df;}isMatching(_0x5ccf15){return'string'==typeof this['title']&&this['title']['match'](_0x5ccf15)?{'title':!0x0}:null;}highlightText(_0x38b5a2){this['_titleView']['highlightText'](_0x38b5a2);}},Va=class extends _0xfd0945{['headerView'];['searchView'];['mainErrorView'];skeletonView;emptyView;sectionsView;constructor(_0x103092,_0x139863){super(_0x103092),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0xe03e60=xa(_0x103092,this);this['headerView']=new ka(_0x103092,{'label':Os(_0x103092,'AI_CHAT_HISTORY_HEADING'),'icon':_0xa09b29,'class':'ck-ai-header_history','content':_0xe03e60,'showResizeButton':_0x139863}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Pa(_0x103092,[]),this['sectionsView']['delegate'](...Ba)['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',_0x115d39=>!_0x115d39)]}}),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 _0x1cb878=new _0x1909b9(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Os(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x74578e=>Os(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x74578e),'secondary':Os(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x201453=this['_createErrorView']();return _0x201453['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x392750=>!_0x392750)]}}),_0x1cb878['on']('render',()=>{_0x1cb878['children']['add'](_0x201453,0x1);}),_0x1cb878['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x3ed06a=>!_0x3ed06a)]}}),_0x1cb878;}_createSkeletonView(){const _0x4eca48=new Br(this['locale'],Gr['aiHistory']);return _0x4eca48['bind']('isVisible')['to'](this,'isLoading'),_0x4eca48;}_createErrorView(){const _0x508986=new _0xfd0945(this['locale']),_0x20614a=new Bt(this['locale']);_0x20614a['set']({'withText':!0x1,'icon':_0x509f6e,'class':'ck-ai-notification_error__dismiss-button'}),_0x20614a['bind']('isVisible')['to'](this,'hasItems',_0x5774e4=>!!_0x5774e4),_0x20614a['on']('execute',()=>{this['errorMessage']='';});const _0x13818d=this['bindTemplate'];return _0x508986['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x13818d['to']('errorMessage')}]},_0x20614a]}),_0x508986;}_createEmptyStateView(){const _0x200686=new _0xfd0945(this['locale']);return _0x200686['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x43d6c9=>!_0x43d6c9)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Os(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x200686;}_createListItemViews(_0x36e955,_0x4759e9){const _0x240eb7=[];for(const _0x1b4816 of _0x36e955){const _0x3bf642=new Ua(_0x4759e9,_0x1b4816);_0x3bf642['delegate'](...Ba)['to'](this),_0x240eb7['push'](_0x3bf642);}return _0x240eb7;}updateHistoryItemsWithCategories(_0x3ec505){const _0x5847ee=this['locale']||'en',_0x46f713=[];for(const _0x14a984 of _0x3ec505){const _0x2f00d9=this['_createListItemViews'](_0x14a984['items'],_0x5847ee);_0x46f713['push'](new Ha(_0x5847ee,{'title':_0x14a984['title'],'items':_0x2f00d9}));}this['sectionsView']['sections']=_0x46f713,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x46f713),this['hasItems']=_0x3ec505['some'](_0x1bf3d5=>_0x1bf3d5['items']['length']>0x0),this['_refreshSearch']();}removeHistoryItem(_0x310d7e){for(const _0x3dcc78 of this['sectionsView']['sections']){const _0xdd00e8=_0x3dcc78['getItem'](_0x310d7e);if(_0xdd00e8){if(_0x3dcc78['removeItem'](_0xdd00e8),0x0===_0x3dcc78['itemsViews']['length']){const _0x38083c=this['sectionsView']['sections']['indexOf'](_0x3dcc78);-0x1!==_0x38083c&&(this['sectionsView']['sections']['splice'](_0x38083c,0x1),this['sectionsView']['items']['remove'](_0x3dcc78));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}updateItemTitle(_0x4709f8,_0x2c13e8){for(const _0x5aee50 of this['sectionsView']['sections']){const _0x5504ba=_0x5aee50['getItem'](_0x4709f8);if(_0x5504ba){_0x5504ba['updateTitle'](_0x2c13e8);break;}}}updateItemLoadingState(_0xb57c2b,_0x34606f,_0x349943){for(const _0xe34f94 of this['sectionsView']['sections']){const _0x1df751=_0xe34f94['getItem'](_0xb57c2b);if(_0x1df751){_0x1df751['updateLoadingState'](_0x34606f,_0x349943);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x126ef8=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x126ef8);}}};const Ba=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var Ga=class extends _0x338e6f{static get requires(){return[bs];}_historyView;static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3a8334){super(_0x3a8334);const _0x1fd7e2=this['context']['plugins']['get']('AITabs');this['_historyView']=new Va(this['context']['locale'],_0x1fd7e2['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x1fd7e2),this['_historyView']['delegate'](...Ba)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x1fd7e2['view'],'isMaximized',_0x3b18dd=>_0x3b18dd),_0x1fd7e2['view']['addTab']({'id':'history','buttonLabel':Os(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0xa09b29,'order':0x0,'content':this['_historyView']});}removeHistoryItem(_0x240613){this['_historyView']['removeHistoryItem'](_0x240613);}updateItems(_0xc40d07){this['_historyView']['updateHistoryItemsWithCategories'](_0xc40d07);}updateItemTitle(_0x3c298c,_0x24f8a2){this['_historyView']['updateItemTitle'](_0x3c298c,_0x24f8a2);}updateItemLoadingState(_0x20665a,_0x2f8d7b,_0x527f70){this['_historyView']['updateItemLoadingState'](_0x20665a,_0x2f8d7b,_0x527f70);}setLoadingSkeleton(_0x15f77b){this['_historyView']['isLoading']=_0x15f77b;}['showError'](_0xd6b9c1){this['_historyView']['errorMessage']=_0xd6b9c1;}['hideError'](){this['_historyView']['errorMessage']='';}};const Ka=/* #__PURE__ -- @preserve */
35
+ At();var Fa=class extends Ka{['id'];createdAt;constructor({id:_0x4a660e,title:_0xa90f36,createdAt:_0xe4971b,updatedAt:_0x22d963,pinned:_0x4716b2}){super(),this['id']=_0x4a660e,this['createdAt']=new Date(_0xe4971b),this['set']('title',_0xa90f36),this['set']('updatedAt',_0x22d963?new Date(_0x22d963):null),this['set']('pinned',_0x4716b2||!0x1);}updateTitle(_0x44562d){this['set']('title',_0x44562d),this['updatedAt']=new Date();}updatePinned(_0x28dbf1){this['set']('pinned',_0x28dbf1),this['updatedAt']=new Date();}};const Wa=/* #__PURE__ -- @preserve */
36
+ dt();var $a=class extends Wa{items=[];connector;['group'];constructor({connector:_0x24c4af,group:_0x632633}){super(),this['connector']=_0x24c4af,this['group']=_0x632633;}async init(){try{const _0x322234=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x322234);}catch(_0x16242a){this['fire']('error',{'error':_0x16242a,'operation':'init'});}}addItem(_0x476f63){this['items']['push'](_0x476f63);}async removeItem(_0x2390dc){const _0x1704f6=this['items']['findIndex'](_0x52f232=>_0x52f232['id']===_0x2390dc);if(-0x1===_0x1704f6)return!0x1;try{return await this['connector']['deleteConversation'](_0x2390dc)['execute'](),this['items']['splice'](_0x1704f6,0x1),this['fire']('itemRemoved',{'itemId':_0x2390dc}),!0x0;}catch(_0x5614b4){return this['fire']('error',{'error':_0x5614b4,'operation':'removeItem','itemId':_0x2390dc}),!0x1;}}getItem(_0xc8ff09){return this['items']['find'](_0x48da5c=>_0x48da5c['id']===_0xc8ff09);}async updateItemTitle(_0x5eadac,_0x566fc9){const _0x3d299f=this['getItem'](_0x5eadac);if(!_0x3d299f)return!0x1;try{return await this['connector']['updateConversation'](_0x5eadac,{'title':_0x566fc9})['getResult'](),_0x3d299f['updateTitle'](_0x566fc9),this['fire']('itemUpdated',{'itemId':_0x5eadac,'updates':{'title':_0x566fc9}}),!0x0;}catch(_0x33615b){return this['fire']('error',{'error':_0x33615b,'operation':'updateItemTitle','itemId':_0x5eadac}),!0x1;}}async updateItemPinned(_0x41a973,_0x1759ea){const _0x37a90a=this['getItem'](_0x41a973);if(!_0x37a90a)return!0x1;try{return await this['connector']['updateConversation'](_0x41a973,{'pinned':_0x1759ea})['getResult'](),_0x37a90a['updatePinned'](_0x1759ea),this['fire']('itemUpdated',{'itemId':_0x41a973,'updates':{'pinned':_0x1759ea}}),!0x0;}catch(_0x211645){return this['fire']('error',{'error':_0x211645,'operation':'updateItemPinned','itemId':_0x41a973}),!0x1;}}loadItems(_0x35bece){try{this['items']=[],_0x35bece['map'](_0x241988=>{this['addItem'](new Fa(_0x241988));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x24cb3a){this['fire']('error',{'error':_0x24cb3a,'operation':'loadItems'});}}getItems(_0x1262e8={}){const _0x82172e=void 0x0!==_0x1262e8['pinned']&&_0x1262e8['pinned'],_0x41ef08=_0x1262e8['from']?new Date(_0x1262e8['from']['getFullYear'](),_0x1262e8['from']['getMonth'](),_0x1262e8['from']['getDate']()):null,_0x12abd1=_0x1262e8['to']?new Date(_0x1262e8['to']['getFullYear'](),_0x1262e8['to']['getMonth'](),_0x1262e8['to']['getDate']()):null;return this['items']['filter'](_0xe5274c=>{if(_0xe5274c['pinned']!==_0x82172e)return!0x1;if(_0x12abd1){const _0x4b6ab4=new Date(_0xe5274c['createdAt']['getFullYear'](),_0xe5274c['createdAt']['getMonth'](),_0xe5274c['createdAt']['getDate']());return _0x41ef08?_0x41ef08['getTime']()===_0x12abd1['getTime']()?_0x4b6ab4['getTime']()===_0x41ef08['getTime']():_0x4b6ab4<_0x12abd1&&_0x4b6ab4>=_0x41ef08:_0x4b6ab4<_0x12abd1;}return!0x0;});}},Ya=class extends _0x338e6f{_aiConnector;_reporter;_aiChatHistoryUi;_aiChatController;static get requires(){return[Ss,Jn,wr,Ga,bs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiConnector']=this['context']['plugins']['get'](Ss),this['_aiChatHistoryUi']=this['context']['plugins']['get'](Ga),this['_aiChatController']=this['context']['plugins']['get'](wr),this['_reporter']=this['context']['plugins']['get'](Jn)['createReporter']('aichathistory');const _0x1ddb5c=this['context']['plugins']['get'](bs);try{const _0x34a589=this['_aiChatController']['getGroupId']();this['history']=new $a({'connector':this['_aiConnector'],'group':_0x34a589}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x51a29c,_0x373f6f)=>{this['_setItemLoading'](_0x373f6f['id'],'remove'),this['_handleRemove'](_0x373f6f['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x2c69a3,_0x13007c)=>{this['_setItemLoading'](_0x13007c['id'],'rename'),this['_handleEditTitle'](_0x13007c['id'],_0x13007c['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x41d2f8,_0x1161e8)=>{void 0x0!==_0x1161e8['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x1161e8['itemId'],_0x1161e8['updates']['title']),void 0x0!==_0x1161e8['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x1161e8['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x328161,_0x45d35a)=>{this['_aiChatController']['_handleRemovedConversation'](_0x45d35a['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x45d35a['itemId']),this['_clearItemLoading'](_0x45d35a['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x49d1c7,_0x6c11b3)=>{this['_handleHistoryErrorUI'](_0x6c11b3['error'],_0x6c11b3['operation'],_0x6c11b3['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x908054,_0x2694f7)=>{this['_handleSelectConversation'](_0x2694f7['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x22231f,_0x35f61c)=>{const _0x1c0d6b=_0x35f61c['pinned']?'pin':'unpin';this['_setItemLoading'](_0x35f61c['id'],_0x1c0d6b),this['_handleTogglePin'](_0x35f61c['id'],_0x35f61c['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x1ddb5c['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x1ddb5c['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x4be5ae){this['_handleHistoryErrorUI'](_0x4be5ae,'init');}}async _handleEditTitle(_0xc340df,_0x20c9b5){await this['history']['updateItemTitle'](_0xc340df,_0x20c9b5);}async['_handleTogglePin'](_0x4da32f,_0x3f3f04){await this['history']['updateItemPinned'](_0x4da32f,_0x3f3f04);}async['_handleRemove'](_0x1ca4cf){await this['history']['removeItem'](_0x1ca4cf);}async _handleSelectConversation(_0x1eabfa){await this['_aiChatController']['loadConversation'](_0x1eabfa);}async _showConversationHistory(){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_updateHistoryItemsUI(){const _0x5eb4f0=this['_aiChatController']['activeConversation']?.['id'],_0x456d29=this['_getCategorizedItems']()['map'](_0xa42d7a=>({'title':_0xa42d7a['title'],'items':_0xa42d7a['items']['map'](_0x1c075e=>({'id':_0x1c075e['id'],'title':_0x1c075e['title']||Os(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x1c075e['createdAt'])['toLocaleDateString'](),'active':_0x1c075e['id']===_0x5eb4f0,'pinned':_0x1c075e['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x456d29);}_setItemLoading(_0x1afcb5,_0x5b35c1){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x1afcb5,_0x5b35c1,!0x0);}_clearItemLoading(_0x227b21){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x227b21,null,!0x1);}_handleHistoryErrorUI(_0x4cdf83,_0x5aba8f,_0x532157){const _0x1aeae2=this['_generateErrorMessage'](_0x5aba8f,_0x532157);this['_aiChatHistoryUi']['showError'](_0x1aeae2),this['_reporter']['reportError'](_0x4cdf83,{'context':{'operation':_0x5aba8f}}),_0x532157&&this['_clearItemLoading'](_0x532157),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}_generateErrorMessage(_0x3af107,_0x5b5f56){const _0xbcda89=_0x5b5f56?this['history']['getItem'](_0x5b5f56):null,_0x427b4e=_0xbcda89?.['title']||Os(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x3af107){case'updateItemTitle':return Os(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x427b4e);case'updateItemPinned':{const _0x1482dd=Os(this['context']['locale'],_0xbcda89?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Os(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x1482dd,_0x427b4e]);}case'removeItem':return Os(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x427b4e);case'init':case'loadItems':return Os(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Os(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}_getCategorizedItems(){const _0x2fd81b=new Date(),_0x284d64=new Date(_0x2fd81b['getFullYear'](),_0x2fd81b['getMonth'](),_0x2fd81b['getDate']()),_0x96b17b=new Date(_0x284d64);_0x96b17b['setDate'](_0x96b17b['getDate']()-0x1);const _0x13baf3=new Date(_0x284d64);_0x13baf3['setDate'](_0x13baf3['getDate']()-0xe);const _0x1a6ef2=this['history']['getItems']({'pinned':!0x0}),_0x34abd1=this['history']['getItems']({'from':_0x284d64,'to':_0x284d64}),_0x34c5d7=this['history']['getItems']({'from':_0x96b17b,'to':_0x96b17b}),_0x3b0101=this['history']['getItems']({'from':_0x13baf3,'to':_0x96b17b}),_0x30f23a=this['history']['getItems']({'to':_0x13baf3}),_0x3ec226=[];return _0x1a6ef2['length']>0x0&&_0x3ec226['push']({'title':Os(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x1a6ef2}),_0x34abd1['length']>0x0&&_0x3ec226['push']({'title':Os(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x34abd1}),_0x34c5d7['length']>0x0&&_0x3ec226['push']({'title':Os(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x34c5d7}),_0x3b0101['length']>0x0&&_0x3ec226['push']({'title':Os(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x3b0101}),_0x30f23a['length']>0x0&&_0x3ec226['push']({'title':Os(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x30f23a}),_0x3ec226;}},qa=class extends _0x338e6f{static get requires(){return[Ya,Ga];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},Qa=class extends _0x338e6f{static get requires(){return[wr,dn,Da,qa,Xn];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2a882b){super(_0x2a882b),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'contextLibrary':{'enabled':!0x1},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},Xa=class extends Bt{['id'];constructor(_0x3b5b38,_0x1fc055){super(_0x3b5b38);const {id:_0x3d542e,type:_0x1077f6,icon:_0xf70348}=_0x1fc055;this['id']=_0x3d542e,this['set']({'label':_0x1fc055['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x1fc055['id']}}),_0xf70348?this['icon']=_0xf70348:'chat'===_0x1077f6?this['icon']=_0x5213f:'review'===_0x1077f6?this['icon']=_0x5684ad:'translate'===_0x1077f6&&(this['icon']=_0x333580);}},za=class extends _0xfd0945{listView;constructor(_0x33572e,_0x47c77b){super(_0x33572e),this['set']('isEnabled',!0x0);const _0x2b344e=_0x47c77b['map'](_0x239ca5=>{const _0x139a09=new te(this['locale']),_0x5f5a2a=new Xa(this['locale'],_0x239ca5);return _0x5f5a2a['bind']('isEnabled')['to'](this),_0x139a09['children']['add'](_0x5f5a2a),_0x5f5a2a['delegate']('execute')['to'](this),_0x139a09;});this['listView']=new _0x4ca5fe(this['locale']),this['listView']['items']['addMany'](_0x2b344e),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const ja='chat-shortcuts';var Ja=class extends _0x338e6f{_shortcuts;_shortcutsView;_aiChatUI;_listenedConversation;static get requires(){return[Da,xs];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_aiChatUI']=this['context']['plugins']['get'](Da),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x5040bb=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0xa793bb=_0x5040bb['activeConversation'];_0xa793bb['isFromHistory']||this['_injectShortcuts'](_0xa793bb);}),this['listenTo'](_0x5040bb,'interactionStarted',()=>{this['_removeShortcuts']();}));}_validateShortcuts(){const _0x3b0ff5=['chat','review','translate'];this['_shortcuts']['forEach'](_0x795cb2=>{let _0x5d0cab=!0x0;if(_0x795cb2['id']&&_0x795cb2['label']&&_0x3b0ff5['includes'](_0x795cb2['type'])?'chat'===_0x795cb2['type']&&(_0x5d0cab='string'==typeof _0x795cb2['prompt']):_0x5d0cab=!0x1,!_0x5d0cab)throw new ct('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x795cb2});});}_injectShortcuts(_0x3c6bce){this['_removeShortcuts'](),this['_shortcutsView']=new za(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],ja),this['_shortcutsView']['on']('execute',_0x292eab=>{const _0x327e0d=_0x292eab['source']['id'];this['_executeShortcut'](_0x327e0d);}),this['_listenedConversation']=_0x3c6bce,this['listenTo'](_0x3c6bce,'uploadProgressChanged',(_0x48eba2,_0x2a21a6)=>{this['_shortcutsView']['isEnabled']=!_0x2a21a6['isUploadInProgress'];});}_removeShortcuts(){const _0x4292ac=this['context']['plugins']['get'](Da);_0x4292ac['hasFeedItem'](ja)&&_0x4292ac['removeFeedItem'](ja),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}_executeShortcut(_0x2f6478){const _0x385855=this['_shortcuts']['find'](_0x5190aa=>_0x5190aa['id']===_0x2f6478),_0x4d741b=_0x385855['type'];'chat'===_0x4d741b?this['_runChatShortcut'](_0x385855):'review'===_0x4d741b?_0x385855['commandId']?this['_runReviewShortcut'](_0x385855):this['_switchTab']('reviewMode'):'translate'===_0x4d741b&&(_0x385855['language']?this['_runTranslateShortcut'](_0x385855):this['_switchTab']('translate'));}_switchTab(_0x4a5921){if(!this['context']['plugins']['has']('AITabs'))throw new ct('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x4a5921});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x4a5921);}async _runChatShortcut({id:_0x22ea7a,prompt:_0x711198,draftMode:_0x4689bd,useWebSearch:_0x2bfa0b=!0x1,useReasoning:_0x465ef5=!0x1,model:_0x3fcb61}){const _0x56db5d=this['context']['plugins']['get']('AIChatController'),_0xad503d=_0x56db5d['activeConversation'],_0x2c27d4=this['context']['plugins']['get'](xs),_0x3a73c5=await _0x2c27d4['models']['resolveModel'](_0x3fcb61);_0x3a73c5&&await _0xad503d['setModel'](_0x3a73c5),_0xad503d['setWebSearch'](_0x2bfa0b),_0xad503d['setReasoning'](_0x465ef5);const _0x59be73=_0x2c27d4['contextLibrary']['resolveContext']({'feature':'chat','ids':[_0x22ea7a],'idScopedOnly':!0x0,'context':new Wn()});_0xad503d['addDefaultContext'](_0x59be73['refs']),_0x56db5d['addCurrentDocumentToChatContext'](),_0x4689bd?(this['_aiChatUI']['setPromptInputValue'](_0x711198),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x56db5d['sendMessage']({'message':_0x711198});}_runReviewShortcut({commandId:_0x140a63,model:_0x15039c,prompt:_0x4f3cdf,params:_0x2b9a66}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ct('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x5d6830={'id':_0x140a63,'isCustom':'custom'===_0x140a63};_0x15039c&&_0x4f3cdf&&(_0x5d6830['args']={'model':_0x15039c,'prompt':_0x4f3cdf}),_0x2b9a66&&(_0x5d6830['params']=_0x2b9a66),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x5d6830);}_runTranslateShortcut({language:_0x4f1f17}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ct('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x4f1f17,'args':{'language':_0x4f1f17}});}},Za=class extends _0x3faa90{constructor(_0x5c31e1){super(_0x5c31e1);const _0x40de5e=_0x5c31e1['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x40de5e,'isVisible'),this['isEnabled']=!0x0;}execute(){const _0x224251=this['editor']['plugins']['get']('AITabs')['view'];_0x224251['isVisible']=!_0x224251['isVisible'];}},th=class extends _0xe451ae{static get requires(){return[bs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0xd6f818=this['editor'];_0xd6f818['commands']['add']('toggleAi',new Za(_0xd6f818)),_0xd6f818['ui']['componentFactory']['add']('toggleAi',()=>{const _0x507b03=this['_createAIUIButton'](Bt);return _0x507b03['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x507b03;}),_0xd6f818['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x12354e=this['_createAIUIButton'](_0x48f08b);return _0x12354e['set']({'role':'menuitemcheckbox'}),_0x12354e;});}_createAIUIButton(_0x43bf15){const _0x332132=this['editor'],_0x1f583e=_0x332132['commands']['get']('toggleAi'),_0x59e369=new _0x43bf15(_0x332132['locale']);return _0x59e369['set']({'label':Os(_0x332132['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x483d03,'isToggleable':!0x0}),_0x59e369['bind']('isEnabled')['to'](_0x1f583e),_0x59e369['bind']('isOn')['to'](_0x1f583e,'value',_0x159e19=>!!_0x159e19),this['listenTo'](_0x59e369,'execute',()=>{_0x1f583e['execute']();}),_0x59e369;}};const eh=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ih=class extends _0xfd0945{['_errorView'];constructor(_0x595eec){super(_0x595eec),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x24af28){this['showError'](_0x24af28);}['showError'](_0x3f0e5b){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x3f0e5b,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}_createErrorView(){const _0xefd97c=new _0xfd0945(this['locale']),_0x264364=new _0xfd0945(this['locale']);return _0x264364['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0xefd97c['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x56d36e=>!_0x56d36e)]},'children':[_0x264364]}),_0xefd97c;}};const sh=0xa;var nh=class extends _0x338e6f{static get requires(){return[dn];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;_currentConfig;_editor;_isUpdatingMarkers=!0x1;['open'](_0x4744a8){const {id:_0x7768a1}=this['_currentConfig']??{};this['_currentConfig']=_0x4744a8,this['_editor']=_0x4744a8['targetEditor'];const {id:_0x4a36c6}=this['_currentConfig'];this['isOpen']&&_0x7768a1===_0x4a36c6?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x51ea7f=this['_editor'];if(!_0x51ea7f)return;const _0x4aaa24=_0x51ea7f['plugins']['get']('Dialog');_0x4aaa24['isOpen']&&this['_currentConfig']&&_0x4aaa24['id']===this['_currentConfig']['id']&&_0x4aaa24['hide']();}_updateDialog(){const _0x5b991c=this['_editor']['plugins']['get']('Dialog'),{icon:_0x44c6df,title:_0x352aeb}=this['_currentConfig'];_0x5b991c['view']?.['headerView']&&(_0x5b991c['view']['headerView']['label']=_0x352aeb,_0x5b991c['view']['headerView']['iconView']&&_0x44c6df&&(_0x5b991c['view']['headerView']['iconView']['content']=_0x44c6df)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x5b991c['view']?.['updatePosition']();}_showFakeVisualSelection(){this['context']['plugins']['get'](dn)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}_hideFakeVisualSelection(){this['context']['plugins']['get'](dn)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x1cc8f6=this['_editor']['plugins']['get']('Dialog'),{id:_0x1145e8,title:_0xe3d1f2,icon:_0x41399d,class:_0x8d8b55,mainView:_0x572108}=this['_currentConfig'];_0x572108['delegate'](...eh)['to'](this),_0x1cc8f6['show']({'title':_0xe3d1f2,'icon':_0x41399d,'hasCloseButton':!0x0,'id':_0x1145e8,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x8d8b55||''),'content':_0x572108,'onShow':_0x57a3fa=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x57a3fa['view']?.['updatePosition']();const _0x1d12e6=this['_getSelectionElements']();_0x1d12e6&&_0x1d12e6[0x0]&&kt({'target':_0x1d12e6[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x57a3fa['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x1145e8});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x1145e8}),this['isOpen']=!0x1;}});}_calculateDialogPosition(_0x56bfc8,_0x2cc96e,_0x425966){const _0x2099c9=_0x2cc96e||_0x425966;if(!_0x2099c9)return null;const _0x4a6b30=this['_getSelectionElements']();if(!_0x4a6b30||0x0===_0x4a6b30['length'])return{'left':Math['round'](_0x2099c9['left']+_0x2099c9['width']/0x2-_0x56bfc8['width']/0x2),'top':Math['round'](_0x2099c9['top']+_0x2099c9['height']/0x2-_0x56bfc8['height']/0x2)};const _0x5b97c4=Math['round'](_0x2099c9['left']+_0x2099c9['width']/0x2-_0x56bfc8['width']/0x2),_0x3ba3b3=_0x4a6b30['map'](_0x5b23a7=>new It(_0x5b23a7)),_0x37d943=_0x56bfc8['height'];return{'left':_0x5b97c4,'top':this['_calculateOptimalTopPosition'](_0x3ba3b3,_0x37d943,_0x2099c9)};}_calculateOptimalTopPosition(_0x4aa496,_0x36a0d7,_0x5a82fe){const _0x51e52b=new It(ft['window']),_0x3f0dbb=_0x4aa496['map'](_0x547c55=>_0x547c55['getVisible']())['filter'](_0x34d1ba=>_0x34d1ba),_0x249123=It['getBoundingRect'](_0x3f0dbb);if(!_0x249123)return Math['round'](_0x5a82fe['top']+_0x5a82fe['height']/0x2);const _0x151969=_0x51e52b['getIntersection'](_0x249123);if(!_0x151969)return Math['round'](_0x5a82fe['top']+_0x5a82fe['height']/0x2);const _0x138382=_0x5a82fe['getVisible'](),_0x3ae7de=_0x138382&&_0x249123['height']>_0x138382['height'],_0x5173cc=_0x151969['top'],_0x210e20=_0x151969['bottom'];if(_0x3ae7de){const _0x491317=_0x51e52b['top']+_0x51e52b['height']/0x2-_0x36a0d7/0x2,_0x5115fb=_0x5173cc-sh-_0x51e52b['top'],_0x10e765=_0x51e52b['bottom']-_0x210e20-sh;return _0x5115fb>=_0x36a0d7?Math['max'](sh,_0x5173cc-_0x36a0d7-sh):_0x10e765>=_0x36a0d7?_0x210e20+sh:Math['max'](sh,_0x491317);}const _0x2e511b=_0x5173cc-_0x36a0d7,_0x488366=_0x51e52b['bottom']-_0x210e20-sh,_0x626b56=_0x5173cc-sh-_0x51e52b['top'];let _0x4d6696;return _0x4d6696=_0x488366>=_0x36a0d7?_0x210e20+sh:_0x626b56>=_0x36a0d7?_0x2e511b-sh:_0x5173cc+_0x249123['height']/0x2-_0x36a0d7/0x2,_0x4d6696;}_setupFakeVisualSelectionMarkerRemovalListener(){const _0x269eaf=this['_editor'];this['listenTo'](_0x269eaf['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x289a65,data:{newRange:_0x139a05}}of _0x269eaf['model']['document']['differ']['getChangedMarkers']())if(_0x289a65['startsWith']('ai-selection:')&&(_0x139a05&&(_0x139a05['start']['isEqual'](_0x139a05['end'])||'$graveyard'==_0x139a05['root']['rootName'])||null==_0x139a05)){const _0x509f22=Os(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x509f22),this['fire']('selectionRemoved');}}});}_cleanupFakeVisualSelectionMarkerRemovalListener(){const _0x1cd5dc=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x1cd5dc['model']['document']);}_getSelectionElements(){const _0x5e2439=this['_editor'];return _0x64b1d9(_0x5e2439['editing'],[..._0x5e2439['model']['markers']['getMarkersGroup']('ai-selection'),..._0x5e2439['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}_getCurrentDomRootName(){const _0x20d34f=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x20d34f&&_0x20d34f['rootName']?_0x20d34f['rootName']:null;}},rh=class extends _0x3a20a6{copyButton;likeButton;dislikeButton;showChangesButton;['_config'];constructor(_0x48233c,_0x192933={}){super(_0x48233c),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x192933};const _0x43da63=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x43da63?'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(_0x458ef5){this['showChangesButton']['isEnabled']=_0x458ef5;}_setupRatingButtons(){this['likeButton']=new Bt(this['locale']),this['likeButton']['set']({'icon':at,'label':Os(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':ir,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Bt(this['locale']),this['dislikeButton']['set']({'icon':ot,'label':Os(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':ir,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}_setupCopyButton(){this['copyButton']=new Bt(this['locale']),this['copyButton']['set']({'icon':_0x49526f,'label':Os(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+ir,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x3b398b=new Xt();_0x3b398b['set']({'content':_0xca6ce1}),_0x3b398b['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'+ir,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+ir;},0x7d0);}),this['copyButton']['children']['add'](_0x3b398b);}_setupShowChangesButton(){this['showChangesButton']=new Bt(this['locale']),this['showChangesButton']['set']({'icon':et,'label':Os(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':ir}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x2ea68b=>_0x2ea68b?it:et),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},oh=class extends ih{['children'];nextButtonView;previousButtonView;['focusCycler'];['_focusables'];['_focusTracker'];_keystrokes;['_config'];_streamableContentView;_toolbarContainerView;_partToolbarView;_stateView;['_miniToolbarView'];constructor(_0x1295f8,_0x416da8){super(_0x1295f8);const _0x3f8907=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['set']('_outdatedReason',void 0x0),this['set']('isTargetReadOnly',!0x1),this['set']('areActionsDisabled',!0x1),this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new $t({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x416da8,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new Ur(_0x1295f8),this['_partToolbarView']=new Pr(_0x1295f8,_0x416da8['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_partToolbarView']['bind']('isTargetReadOnly')['to'](this),this['_partToolbarView']['bind']('isEnabled')['to'](this,'areActionsDisabled',this,'_isErrorVisible',(_0x49af75,_0x189f0a)=>!_0x49af75&&!_0x189f0a),this['_togglePartToolbarButtonsVisibility'](_0x416da8),this['_stateView']=new Lr(_0x1295f8),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new rh(_0x1295f8,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new ah(_0x1295f8,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x5e008f,_0x530029,_0x2cadc6,_0x543bb9)=>{let _0x170f2e,_0x1069e1;'pending'===_0x543bb9?(_0x170f2e=this['_partToolbarView'],_0x1069e1=this['_stateView']):(_0x170f2e=this['_stateView'],_0x1069e1=this['_partToolbarView']),this['_stateView']['setState'](_0x2cadc6,this['_outdatedReason']),_0x170f2e['isVisible']=!0x1,_0x1069e1['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x3f8907['to']('_state',_0x5bd4fb=>'ck-ai-chat-balloon-main_state_'+_0x5bd4fb)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x416da8);});}['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(_0x1d5412){_0x1d5412?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x1d5412);}clearContent(){this['_streamableContentView']['clear']();}setState(_0x3b877f,_0x2cb81a){this['_outdatedReason']=_0x2cb81a,this['_state']=_0x3b877f;}['showError'](_0x79e9d1){super['showError'](_0x79e9d1),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}toggleRotatorButtonsVisibility(_0xe03c26){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0xe03c26;}_togglePartToolbarButtonsVisibility({showApplyButton:_0xefd8ed,showSuggestButton:_0x2dff13}){_0xefd8ed=_0xefd8ed&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x2dff13=_0x2dff13&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0xefd8ed,'showSuggestButton':_0x2dff13});}_createNextButtonView(){const _0x44780e=new Bt(this['locale']);return _0x44780e['set']({'icon':_0x5025fd,'label':Os(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x44780e['on']('execute',()=>{this['fire']('showNext');}),_0x44780e;}_createPreviousButtonView(){const _0x517d47=new Bt(this['locale']);return _0x517d47['set']({'icon':_0x34b83e,'label':Os(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x517d47['on']('execute',()=>{this['fire']('showPrevious');}),_0x517d47;}},ah=class extends _0xfd0945{constructor(_0x294355,_0x52a013){super(_0x294355),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x52a013});}},hh=class extends _0xe451ae{static get requires(){return[Gt,nh];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_chatBalloonView;constructor(_0x45195b){super(_0x45195b),this['set']('showDiff',!0x1);}['open'](_0x2f6802){const _0x3bb096=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x3bb096['plugins']['get']('AIBalloon')['open']({..._0x2f6802,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x2f6802['showRotator']),this['_chatBalloonView']['areActionsDisabled']=_0x2f6802['areActionsDisabled'],this['_chatBalloonView']['isTargetReadOnly']=_0x2f6802['isTargetReadOnly'],this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}updateContent(_0x24babe){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x24babe);}clearContent(){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}setState(_0x386bc6,_0x29af26){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x386bc6,_0x29af26);}setTargetReadOnly(_0x459734){this['_chatBalloonView']&&(this['_chatBalloonView']['isTargetReadOnly']=_0x459734);}_createChatBalloonView(){const _0x49b305=this['editor'],_0x2341bd=_0x49b305['plugins']['get']('AIBalloon'),_0x4dd128=_0x49b305['commands']['get']('trackChanges');let _0x448d25=_0x49b305['config']['get']('ai.availableReplyActions')||[...Yr];_0x49b305['plugins']['has']('TrackChanges')||(_0x448d25=_0x448d25['filter'](_0x3c52ea=>'insertSuggestion'!=_0x3c52ea));const _0x3fda4b=new oh(_0x49b305['locale'],{'availableActions':_0x448d25,'showApplyButton':!0x0,'showSuggestButton':!!_0x4dd128});return _0x3fda4b['bind']('showDiff')['to'](this),_0x3fda4b['delegate'](...Tr)['to'](this),_0x3fda4b['delegate']('showPrevious','showNext')['to'](this),_0x2341bd['delegate']('dialogClosed')['to'](this),_0x3fda4b['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x3fda4b['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x3fda4b['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x4dd128&&_0x3fda4b['bind']('isTrackChangesOn')['to'](_0x4dd128,'value'),_0x3fda4b['render'](),_0x3fda4b;}_toggleRotatorButtonsInDialogHeader(_0x392a7c){const _0x571d9a=this['editor'],_0x43d8bc=_0x571d9a['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x392a7c),_0x43d8bc['has'](this['_chatBalloonView']['previousButtonView'])||(_0x43d8bc['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0x571d9a['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x43d8bc['remove'](this['_chatBalloonView']['previousButtonView']),_0x43d8bc['remove'](this['_chatBalloonView']['nextButtonView']);}));}_restoreDefaultViewFocus(){this['_chatBalloonView']['focus']();}},ch=class extends _0xe451ae{static get requires(){return[th,hh,_0x5572a2];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function lh(_0x4e93ef){const {editor:_0x36b8a2,action:_0x711c5b,withText:_0x2014ca=!0x1,withIcon:_0x1987fd=!0x0,isInDropdown:_0x1c4c69=!0x0,shouldPreventFocus:_0x492af3=!0x1,actionButtons:_0x3c0c2c}=_0x4e93ef;return()=>{const _0x4c8ada=_0x36b8a2['locale'],_0x38812d=new Bt(_0x4c8ada),_0x34e455=_0x38812d['bindTemplate'];_0x1c4c69&&_0x38812d['extendTemplate']({'on':{'mouseenter':_0x34e455['to'](()=>{_0x492af3&&_0x492af3()||_0x38812d['focus']();})}}),_0x3c0c2c['push']({'buttonView':_0x38812d,'action':_0x711c5b});const _0x2e4adf=_0x711c5b['icon']??_0x711c5b['parent']?.['icon'];return _0x38812d['set']({'label':_0x711c5b['label'],'withText':_0x2014ca,'role':'menuitem','icon':_0x1987fd?_0x2e4adf??_0x4a335e:void 0x0,'tooltip':!_0x2014ca,'class':'ck-ai-quick-actions-button','isEnabled':_0x711c5b['isEnabled']}),_0x38812d['on']('execute',()=>{_0x36b8a2['editing']['view']['focus'](),_0x36b8a2['commands']['execute']('aiQuickAction',_0x711c5b);}),_0x38812d;};}var uh=class extends Jt{['arrowView'];constructor(_0x444cd5,_0x2b0b93){super(_0x444cd5,_0x2b0b93);const _0x28ca12=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',_0x45e3a0=>String(_0x45e3a0)),'data-cke-tooltip-disabled':_0x28ca12['to']('isOn')},'on':{'mouseenter':_0x28ca12['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}_createArrowView(){const _0xd30001=new Xt();return _0xd30001['content']=_0x58a8f2,_0xd30001['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0xd30001;}},dh=class extends _0x4ca5fe{_allListItems;_allSearchableItems;constructor(_0x429f18,_0x5d8bf8,_0x50cf9c){super(_0x429f18),this['_allListItems']=_0x5d8bf8,this['_allSearchableItems']=_0x50cf9c;}filter(_0x532865){if(!_0x532865)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x21d8bb=_0x532865['source']['toLowerCase']()['trim'](),_0x1042a8=this['_allSearchableItems']['filter'](_0x3b306d=>(_0x3b306d['groupLabel']?_0x3b306d['label']+'\x20('+_0x3b306d['groupLabel']+')':_0x3b306d['label'])['toLowerCase']()['includes'](_0x21d8bb));return this['items']['clear'](),this['items']['addMany'](_0x1042a8['sort']((_0x3ca384,_0x40a5f9)=>{const _0x4d23e2=_0x3ca384['groupLabel'],_0x3e1671=_0x40a5f9['groupLabel'];return _0x4d23e2||_0x3e1671?_0x4d23e2?0x1:-0x1:0x0;})['map'](_0x278666=>_0x278666['item'])),this['_highlightQuery'](_0x21d8bb,_0x1042a8),{'resultsCount':_0x1042a8['length'],'totalItemsCount':this['_allSearchableItems']['length']};}_highlightQuery(_0x1e82f1,_0x4a94d1){if(!_0x1e82f1)return;const _0x6e5055=new RegExp(_0x16a55e(_0x1e82f1),'gi');_0x4a94d1['forEach'](_0x41fcf2=>{_0x41fcf2['highlightViews']&&_0x41fcf2['highlightViews']['forEach'](_0xcc874b=>{'function'==typeof _0xcc874b['highlightText']&&_0xcc874b['highlightText'](_0x6e5055);});});}_clearHighlight(){this['_allSearchableItems']['forEach'](_0x236259=>{_0x236259['highlightViews']&&_0x236259['highlightViews']['forEach'](_0x3b6b9e=>{'function'==typeof _0x3b6b9e['highlightText']&&_0x3b6b9e['highlightText'](null);});});}};const _h='menu',gh='menuitem';var Ah=class extends _0xfd0945{_bodyCollection;optionsListView;_searchTextView=null;_allSearchableItems=[];['children'];['focusTracker'];keystrokes;['_focusables'];['focusCycler'];_openNestedPanels=new Set();['_hasSearch'];_actionButtons;constructor(_0x4c5177,_0x527412,_0x1b00c6,_0x15d28b,_0x245686=!0x1,_0x348916=[]){const _0x426086=_0x4c5177['locale'];super(_0x426086),this['_bodyCollection']=_0x15d28b,this['_hasSearch']=_0x245686,this['_actionButtons']=_0x348916;const _0xffe94e=this['_createListItems'](_0x4c5177,_0x527412,_0x1b00c6);this['optionsListView']=new dh(_0x426086,_0xffe94e,this['_allSearchableItems']),this['optionsListView']['role']=_h,this['optionsListView']['items']['addMany'](_0xffe94e),this['focusTracker']=new _t(),this['keystrokes']=new gt(),_0x245686&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0xffe94e,this['focusCycler']=new $t({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x245686&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x5a0e94=_0x245686&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x353304(_0x5a0e94),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x426086['uiLanguageDirection']},'children':this['children']});}_createSearchTextView(){return new _0x1909b9(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Os(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Os(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x27bfad=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x27bfad);}_createListItems(_0x99722e,_0x32bc18,_0xb808b5){const _0x14ab9c=new _0x353304();return _0x32bc18['forEach'](_0x2cebb9=>{if('actions'in _0x2cebb9){const {listItem:_0xdc0846}=this['_createActionGroupButton'](_0x99722e,_0x2cebb9,_0xb808b5);_0x14ab9c['add'](_0xdc0846),_0x2cebb9['actions']['forEach'](_0x534b77=>{const {listItem:_0x2e5d2e,highlightViews:_0x2b131b}=this['_createSearchResultActionButton'](_0x99722e,_0x534b77,_0x2cebb9['label'],_0x2cebb9['icon']);this['_allSearchableItems']['push']({'item':_0x2e5d2e,'label':_0x534b77['label'],'groupLabel':_0x2cebb9['label'],'highlightViews':_0x2b131b});});}else{const {listItem:_0x1740a1}=this['_createActionButton'](_0x99722e,_0x2cebb9);_0x14ab9c['add'](_0x1740a1);const _0x3d1986=_0x1740a1['children']['first'];if(_0x3d1986){const {listItem:_0x1c2432,highlightViews:_0x37922c}=this['_createSearchResultActionButton'](_0x99722e,_0x2cebb9);this['_allSearchableItems']['push']({'item':_0x1c2432,'label':_0x3d1986['label']||'','highlightViews':_0x37922c});}}}),_0x14ab9c;}_createActionButton(_0x2e3fc3,_0x2f8a20,_0x1c4b83,_0xa4ef73){const _0x54b758=new te(this['locale']);if(_0x1c4b83&&_0xa4ef73){const _0x528da1=new Bt(this['locale']),_0x525d79=_0x528da1['bindTemplate'],_0x35a96c=new Qt();_0x35a96c['text']=_0x2f8a20['label'];const _0x2ea698=new Qt();_0x2ea698['text']=_0x1c4b83;const _0x1f9bed=new Xt();_0x1f9bed['content']=_0xa4ef73,_0x1f9bed['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x5df6e6=new _0xfd0945(this['locale']);_0x5df6e6['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x2198c9=new _0xfd0945(this['locale']);return _0x2198c9['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x528da1['set']({'label':_0x2f8a20['label']+'\x20('+_0x1c4b83+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x2f8a20['isEnabled']}),_0x528da1['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x525d79['if']('isEnabled','ck-disabled',_0x5293aa=>!_0x5293aa)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x35a96c,_0x5df6e6,_0x1f9bed,_0x2ea698,_0x2198c9],'on':{'mouseenter':_0x525d79['to'](()=>{this['_isSearchFocused']()||_0x528da1['focus']();}),'click':_0x525d79['to'](()=>{_0x528da1['fire']('execute');})}}),_0x528da1['on']('execute',()=>{_0x528da1['isEnabled']&&(_0x2e3fc3['editing']['view']['focus'](),_0x2e3fc3['commands']['execute']('aiQuickAction',_0x2f8a20));}),_0x54b758['children']['add'](_0x528da1),this['_actionButtons']['push']({'buttonView':_0x528da1,'action':_0x2f8a20}),{'listItem':_0x54b758,'highlightViews':[_0x35a96c,_0x2ea698]};}{const _0xd11396=new Vt(),_0x299a1b=new Bt(this['locale'],_0xd11396),_0x48891c=_0x299a1b['bindTemplate'],_0x20d1c8=_0x2f8a20['icon']??_0x2f8a20['parent']?.['icon'],_0x4b8452=void 0x0!==_0x2f8a20['icon'];return _0x299a1b['set']({'label':_0x2f8a20['label'],'withText':!0x0,'role':'menuitem','icon':_0x4b8452?_0x20d1c8??_0x4a335e:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x2f8a20['isEnabled']}),_0x299a1b['extendTemplate']({'on':{'mouseenter':_0x48891c['to'](()=>{this['_isSearchFocused']()||_0x299a1b['focus']();})}}),_0x299a1b['on']('execute',()=>{_0x2e3fc3['editing']['view']['focus'](),_0x2e3fc3['commands']['execute']('aiQuickAction',_0x2f8a20);}),_0x54b758['children']['add'](_0x299a1b),this['_actionButtons']['push']({'buttonView':_0x299a1b,'action':_0x2f8a20}),{'listItem':_0x54b758,'highlightViews':[_0xd11396]};}}_createSearchResultActionButton(_0x49558f,_0x2e51eb,_0x49a128,_0x1616db){return _0x49a128&&_0x1616db?this['_createSearchResultGroupedActionButton'](_0x49558f,_0x2e51eb,_0x49a128,_0x1616db):this['_createSearchResultIndividualActionButton'](_0x49558f,_0x2e51eb);}_createSearchResultGroupedActionButton(_0x50024a,_0x847628,_0x2387be,_0x192488){const _0x4df2c5=new te(this['locale']),_0x181e53=new Bt(this['locale']),_0x42411f=_0x181e53['bindTemplate'],{view:_0x504463,highlightView:_0xda9c1e}=this['_createSearchResultGroupRow'](_0x2387be,_0x192488),{view:_0x421e8f,highlightView:_0x5c7595}=this['_createSearchResultActionRow'](_0x847628['label']),_0x4b7b24=this['_createSearchResultContentView'](_0x504463,_0x421e8f);return _0x181e53['set']({'label':_0x847628['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':_0x847628['isEnabled']}),_0x181e53['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',_0x42411f['if']('isEnabled','ck-disabled',_0x14fb28=>!_0x14fb28)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x4b7b24],'on':{'mouseenter':_0x42411f['to'](()=>{this['_isSearchFocused']()||_0x181e53['focus']();}),'click':_0x42411f['to'](()=>{this['_handleSearchResultButtonClick'](_0x181e53);})}}),this['_setupActionButtonExecution'](_0x181e53,_0x50024a,_0x847628),_0x4df2c5['children']['add'](_0x181e53),this['_actionButtons']['push']({'buttonView':_0x181e53,'action':_0x847628}),{'listItem':_0x4df2c5,'highlightViews':[_0xda9c1e,_0x5c7595]};}_createSearchResultIndividualActionButton(_0x50e7bc,_0x350b18){const _0x48f8c1=new te(this['locale']),_0x2fffbb=new Vt(),_0x6a1458=new Bt(this['locale'],_0x2fffbb),_0x29042a=_0x6a1458['bindTemplate'];return _0x6a1458['set']({'label':_0x350b18['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x350b18['isEnabled']}),_0x6a1458['extendTemplate']({'on':{'mouseenter':_0x29042a['to'](()=>{this['_isSearchFocused']()||_0x6a1458['focus']();})}}),this['_setupActionButtonExecution'](_0x6a1458,_0x50e7bc,_0x350b18),_0x48f8c1['children']['add'](_0x6a1458),this['_actionButtons']['push']({'buttonView':_0x6a1458,'action':_0x350b18}),{'listItem':_0x48f8c1,'highlightViews':[_0x2fffbb]};}_createSearchResultGroupRow(_0x245800,_0x1a9a6a){const _0x426add=new _0xfd0945(this['locale']),_0x3439e5=new Xt();_0x3439e5['content']=_0x1a9a6a,_0x3439e5['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0xf14a84=new Qt();return _0xf14a84['text']=_0x245800,_0x426add['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x3439e5,_0xf14a84]}),{'view':_0x426add,'highlightView':_0xf14a84};}_createSearchResultActionRow(_0x439dd3){const _0x414df8=new _0xfd0945(this['locale']),_0x16af2b=new Qt();return _0x16af2b['text']=_0x439dd3,_0x414df8['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x16af2b]}),{'view':_0x414df8,'highlightView':_0x16af2b};}_createSearchResultContentView(_0x175323,_0x50d318){const _0x598c9f=new _0xfd0945(this['locale']);return _0x598c9f['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x175323,_0x50d318]}),_0x598c9f;}_setupActionButtonExecution(_0x3aaf79,_0x5a4b20,_0x13901b){_0x3aaf79['on']('execute',()=>{_0x3aaf79['isEnabled']&&(_0x5a4b20['editing']['view']['focus'](),_0x5a4b20['commands']['execute']('aiQuickAction',_0x13901b));});}_createActionGroupButton(_0x4106eb,_0x19db40,_0x431ce3){const _0x2466a7=new te(this['locale']),_0x3bccea=new Vt(),_0x20c046=new uh(this['locale'],_0x3bccea),_0x4336f4=_0x20c046['bindTemplate'],_0x3c2b37=this['_getPanelKeystroke'](_0x431ce3),_0x4af662=this['_createGroupActionsList'](_0x4106eb,_0x19db40['actions'],_0x431ce3);_0x20c046['set']({'label':_0x19db40['label'],'withText':!0x0,'role':gh,'icon':_0x19db40['icon']??_0x4a335e,'isEnabled':_0x19db40['actions']['some'](_0x31b53e=>_0x31b53e['isEnabled'])}),_0x20c046['extendTemplate']({'on':{'mouseenter':_0x4336f4['to'](()=>{this['_isSearchFocused']()||_0x20c046['focus']();})}});const _0x8bae3d=new Pt(this['locale']);return _0x8bae3d['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x4336f4['to'](_0x26b19c=>{this['_handlePanelKeydown'](_0x26b19c,_0x3c2b37,_0x20c046,_0x8bae3d);})}}),_0x20c046['bind']('isOn')['to'](_0x8bae3d,'isVisible'),this['_bodyCollection']['add'](_0x8bae3d),_0x8bae3d['content']['add'](_0x4af662),this['_setupGroupMenuBehavior'](_0x20c046,_0x8bae3d),_0x2466a7['children']['add'](_0x20c046),this['_actionButtons']['push']({'buttonView':_0x20c046,'action':_0x19db40}),{'listItem':_0x2466a7,'highlightView':_0x3bccea};}_createGroupActionsList(_0x47140e,_0x3c0a30,_0x538382){const _0x371ed2=new _0x4ca5fe(this['locale']);return _0x371ed2['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x3c0a30['forEach'](_0xec50d3=>{const _0x997927=new te(this['locale']),_0x25b1e9=lh({'editor':_0x47140e,'action':_0xec50d3,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x997927['children']['add'](_0x25b1e9),_0x538382['focusTracker']['add'](_0x25b1e9),_0x371ed2['items']['add'](_0x997927);}),_0x371ed2;}_setupGroupMenuBehavior(_0x58bfe0,_0x273a50){const _0x2059b2=_0x58bfe0['bindTemplate'],_0x182181=this['_getButtonKeystroke'](_0x58bfe0);_0x58bfe0['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x2059b2['to'](()=>{this['_showNestedPanel'](_0x273a50,_0x58bfe0);}),'mouseleave':_0x2059b2['to'](_0x5a6aec=>{const _0x99ec45=_0x5a6aec['relatedTarget'];this['_isMovingToNestedMenu'](_0x99ec45,_0x273a50)||this['_hideNestedPanel'](_0x273a50);}),'keydown':_0x2059b2['to'](_0x1afbdd=>{_0x1afbdd['key']==_0x182181&&(this['_showNestedPanel'](_0x273a50,_0x58bfe0),_0x273a50['content']['get'](0x0)['focus']());})}}),_0x273a50['on']('render',()=>{_0x273a50['element']?.['addEventListener']('mouseleave',_0x24174f=>{const _0xc47cb3=_0x24174f['relatedTarget'];_0x58bfe0['element']?.['contains'](_0xc47cb3)||this['_isMovingToNestedMenu'](_0xc47cb3,_0x273a50)||this['_hideNestedPanel'](_0x273a50);});});}_showNestedPanel(_0x221b37,_0x3fe9e7){this['_openNestedPanels']['forEach'](_0x351785=>{_0x351785!==_0x221b37&&_0x351785['isVisible']&&_0x351785['hide']();}),_0x221b37['show'](),_0x221b37['pin']({'positions':[Ft['eastSouth']],'target':_0x3fe9e7['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x221b37);}_hideNestedPanel(_0x1e87ae){_0x1e87ae['hide'](),this['_openNestedPanels']['delete'](_0x1e87ae);}_hideAllNestedPanels(){this['_openNestedPanels']['forEach'](_0x3339cf=>_0x3339cf['hide']()),this['_openNestedPanels']['clear']();}_isMovingToNestedMenu(_0x9f3f0c,_0x4e8083){if(!_0x9f3f0c)return!0x1;if(_0x4e8083['element']?.['contains'](_0x9f3f0c))return!0x0;const _0x1d8e70=_0x9f3f0c;return _0x1d8e70['closest']&&(null!==_0x1d8e70['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x1d8e70['closest']('.ck-ai-quick-actions-group-list')||null!==_0x1d8e70['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(_0x4cebd7){return'rtl'===_0x4cebd7['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}_getButtonKeystroke(_0x175b48){return'rtl'===_0x175b48['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x360af9,_0x6581e8,_0x3532cc,_0x1714f1){_0x360af9['key']==_0x6581e8&&(_0x3532cc['focus'](),this['_hideNestedPanel'](_0x1714f1));}_handleSearchResultButtonClick(_0x266d37){_0x266d37['fire']('execute');}};function Ih(_0x553650){const {editor:_0x282d75,content:_0x4cae83,buttonDefinition:_0x4f0c22,bodyCollection:_0x53186b,hasSearch:_0x1be5c9=!0x1,actionButtons:_0x4c5031}=_0x553650;return()=>{const _0x123b20=_0x282d75['locale'],_0x37998e=_0x282d75['commands']['get']('aiQuickAction'),_0x463bdc=_0x5d526e(_0x123b20);_0x463bdc['bind']('isEnabled')['to'](_0x37998e),_0x463bdc['buttonView']['set']({'icon':_0x4f0c22['icon']??_0x4a335e,'label':_0x4f0c22['label'],'tooltip':!0x0}),_0x463bdc['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x5e2c10=new Ah(_0x282d75,_0x4cae83,_0x463bdc,_0x53186b,_0x1be5c9,_0x4c5031);return _0x463bdc['panelView']['children']['add'](_0x5e2c10),_0x1be5c9&&_0x463bdc['on']('change:isOpen',(_0x2a8e97,_0x3cee29,_0x329c9f)=>{if(_0x329c9f){if(_0x282d75['plugins']['has']('AIEditing')){const _0x35b423=_0x282d75['plugins']['get'](dn),_0x3ec427=_0x282d75['model']['document']['selection'],_0x4faad7=Array['from'](_0x3ec427['getRanges']());_0x4faad7['length']>0x0&&_0x35b423['showFakeVisualSelection']({'editor':_0x282d75,'ranges':_0x4faad7,'id':'quick-action','priority':0x14});}}else _0x282d75['plugins']['has']('AIEditing')&&_0x282d75['plugins']['get'](dn)['hideFakeVisualSelection']('quick-action'),_0x5e2c10['resetSearch']();}),_0x463bdc;};}const ph='<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>',mh='<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>',Eh='<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>',wh=/* #__PURE__ -- @preserve */
37
+ ((()=>({'chat':'AIChat','action':'AIActions'}))());var Th=class AIQuickActionsUI extends _0xe451ae{_actionButtons=[];['_menuBarGroupViews']=[];_reporter;static get requires(){return[Ht,Ss,Jn,xs];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_reporter']=this['editor']['plugins']['get'](Jn)['createReporter']('aiquickactions');const _0x27b65a=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x27b65a),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static getDefaultQuickActions(_0x4dd8e9){return function(_0x3a06d1){const _0x87d822=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x3a06d1['uiLanguage'])||'English';return[{'id':'ask-ai','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x12b7b9},{'id':'chat-commands','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x12b7b9,'actions':[{'id':'explain','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Os(_0x3a06d1,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':ph['replace']('%0',_0x87d822),'type':'chat'},{'id':'summarize','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Os(_0x3a06d1,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':mh['replace']('%0',_0x87d822),'type':'chat'},{'id':'highlight-key-points','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Os(_0x3a06d1,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Eh['replace']('%0',_0x87d822),'type':'chat'}]},{'id':'improve-writing','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x46aec1},{'id':'continue','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x2e6df4},{'id':'fix-grammar','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x205f34},{'id':'adjust-length','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x1dc9a1,'actions':[{'id':'make-shorter','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x2f7370,'actions':[{'id':'make-tone-casual','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x333580,'actions':[{'id':'translate-to-english','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Os(_0x3a06d1,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x4b7e86,'actions':[]}];}(_0x4dd8e9);}_getDefaultAndCustomActions(){const _0xc460d2=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x517f2a=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x3a7ac6=>({..._0x3a7ac6,'type':'chat'===_0x3a7ac6['type']?'chat':'action','icon':void 0x0}));return _0xc460d2['find'](_0x36a02f=>'other'===_0x36a02f['id'])['actions']['push'](..._0x517f2a),_0xc460d2;}async _initActionTypeQuickActions(){try{const _0x4839d6=this['editor']['plugins']['get'](xs),_0xc353f4=await _0x4839d6['models']['getAllModels'](),_0x10b3d7=(await _0x4839d6['models']['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x10b3d7),this['_enableButtonsByType']('action',_0x135aa7=>!!_0xc353f4['find'](_0x1d198f=>_0x1d198f['id']===_0x135aa7['model'])||void 0x0===_0x135aa7['model']);}catch(_0x2940a1){const _0x28ef43=new ct('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x2940a1});this['_reporter']['logError'](_0x28ef43);}}_initChatTypeQuickActions(){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x49d746=this['editor']['plugins']['get']('AIChatController'),_0x452501=this['editor']['plugins']['has']('AIChatUI')?this['editor']['plugins']['get']('AIChatUI'):null;this['listenTo'](_0x49d746,'change:isConversationReady',(_0x14a930,_0x1c6578,_0x3145a5)=>{this['_enableButtonsByType']('chat',()=>_0x3145a5&&!_0x452501?.['isBusy']);}),_0x452501&&this['listenTo'](_0x452501,'change:isBusy',(_0x1dad6f,_0x276da8,_0x176517)=>{this['_enableButtonsByType']('chat',()=>_0x49d746['isConversationReady']&&!_0x176517);}),this['_enableButtonsByType']('chat',()=>_0x49d746['isConversationReady']&&!_0x452501?.['isBusy']);}_enableButtonsByType(_0x15e931,_0x1c525e){this['_quickActionsDefinition']['forEach'](_0x3a0b81=>{'actions'in _0x3a0b81?_0x3a0b81['actions']['forEach'](_0x4ff807=>{_0x4ff807['type']===_0x15e931&&(_0x4ff807['isEnabled']=_0x1c525e(_0x4ff807));}):_0x3a0b81['type']===_0x15e931&&(_0x3a0b81['isEnabled']=_0x1c525e(_0x3a0b81));}),this['_actionButtons']['forEach'](_0x135ab7=>{if(fh(_0x135ab7['action']))return;if(_0x135ab7['action']['type']!==_0x15e931)return;const _0x54e3c6=_0x1c525e(_0x135ab7['action']);if(_0x135ab7['action']['isEnabled']=_0x54e3c6,_0x135ab7['buttonView']['isEnabled']=_0x54e3c6,'action'===_0x15e931&&!_0x54e3c6&&_0x135ab7['action']['model']){const _0x491a73=new ct('ai-quick-actions-unavailable-model',this,{'actionId':_0x135ab7['action']['id'],'modelId':_0x135ab7['action']['model']});this['_reporter']['logError'](_0x491a73);}}),this['_actionButtons']['filter'](_0x4a0680=>fh(_0x4a0680['action']))['forEach'](_0x3bf7ab=>{_0x3bf7ab['buttonView']['isEnabled']=_0x3bf7ab['action']['actions']['some'](_0x4ec297=>_0x4ec297['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x1e2cb8,group:_0x5751ec})=>{_0x1e2cb8['isEnabled']=_0x5751ec['actions']['some'](_0x4c4b1f=>_0x4c4b1f['isEnabled']);});}_enableButtonById(_0x564098,_0x59973c){this['_quickActionsDefinition']['forEach'](_0x8f7826=>{'actions'in _0x8f7826?_0x8f7826['actions']['forEach'](_0x995e44=>{_0x995e44['id']===_0x564098&&(_0x995e44['isEnabled']=_0x59973c(_0x995e44));}):_0x8f7826['id']===_0x564098&&(_0x8f7826['isEnabled']=_0x59973c(_0x8f7826));}),this['_actionButtons']['forEach'](_0x55a454=>{if(fh(_0x55a454['action']))return;if(_0x55a454['action']['id']!==_0x564098)return;const _0x547c86=_0x59973c(_0x55a454['action']);_0x55a454['action']['isEnabled']=_0x547c86,_0x55a454['buttonView']['isEnabled']=_0x547c86;});}_assignDefaultModelToCustomActions(_0x4afc0a){this['_actionButtons']['forEach'](_0x4ccd38=>{fh(_0x4ccd38['action'])||'action'===_0x4ccd38['action']['type']&&(_0x4ccd38['action']['model']||(_0x4ccd38['action']['model']=_0x4afc0a));});}_initializeQuickActionsComponentsAndCommands(){const _0x24312f=new Mt(this['editor']['locale']);_0x24312f['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x24312f),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x24312f);}_initializeQuickActionsDropdown(_0x54edc7){const _0x57aa19=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Ih({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x4a335e,'label':Os(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x54edc7,'hasSearch':_0x57aa19,'actionButtons':this['_actionButtons']}));}_prepareQuickActionsDefinition(_0xcc1bce){this['_quickActionsDefinition']=_0xcc1bce['map'](_0x3e373d=>{if('actions'in _0x3e373d){const _0x1f5e8b=_0x3e373d;return{..._0x1f5e8b,'actions':_0x1f5e8b['actions']['map'](_0x5a3bc0=>{const {actions:_0x25c71e,..._0x13e844}=_0x1f5e8b;return{..._0x5a3bc0,'isEnabled':!0x1,'parent':_0x13e844};})['filter'](_0x213acc=>this['_shouldIncludeAction'](_0x213acc))};}return{..._0x3e373d,'isEnabled':!0x1};})['filter'](_0x200356=>'actions'in _0x200356?_0x200356['actions']['length']>0x0:this['_shouldIncludeAction'](_0x200356));}_shouldIncludeAction(_0x3e77bb){const _0xd83f0c=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](wh[_0x3e77bb['type']])&&!_0xd83f0c['includes'](_0x3e77bb['id'])&&!('chat'===_0x3e77bb['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}_initializeQuickActionsComponents(_0x723e83){this['_quickActionsDefinition']['forEach'](_0x4122a3=>{if('actions'in _0x4122a3){const _0x57ef2a=Ih({'editor':this['editor'],'content':_0x4122a3['actions'],'buttonDefinition':_0x4122a3,'bodyCollection':_0x723e83,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4122a3['id'],_0x57ef2a),_0x4122a3['actions']['forEach'](_0x4be610=>{const _0x1baa1a=lh({'editor':this['editor'],'action':_0x4be610,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4be610['id'],_0x1baa1a);});}else{const _0x33949a=lh({'editor':this['editor'],'action':_0x4122a3,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x4122a3['id'],_0x33949a);}});}_initializeQuickActionsMenuBar(){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x4a3f6c=>{const _0x4bd76b=this['editor']['commands']['get']('aiQuickAction'),_0x363800=new _0x4c2379(_0x4a3f6c),_0x431d63=Os(_0x4a3f6c,'AI_QUICK_ACTIONS_HEADING');_0x363800['buttonView']['set']({'label':_0x431d63,'icon':_0x4a335e});const _0x535d87=new _0x24a343(_0x4a3f6c);return _0x535d87['set']({'ariaLabel':_0x431d63,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x510a33=>{if('actions'in _0x510a33){const _0x22f439=_0x510a33,_0xa48e68=new _0x5262e5(_0x4a3f6c,_0x363800),_0xa59b4f=new _0x4c2379(_0x4a3f6c),_0x1fca35=new _0x24a343(_0x4a3f6c);_0xa59b4f['buttonView']['set']({'label':_0x22f439['label'],'icon':_0x22f439['icon']}),_0x22f439['actions']['forEach'](_0x24f05c=>{const _0x35744c=new _0x5262e5(_0x4a3f6c,_0xa59b4f),_0x49fe7a=new _0x48f08b(_0x4a3f6c);_0x49fe7a['set']({'label':_0x24f05c['label'],'icon':_0x24f05c['icon'],'role':'menuitem','isEnabled':_0x24f05c['isEnabled']}),_0x49fe7a['on']('execute',()=>{this['_executeQuickAction'](_0x24f05c);}),this['_actionButtons']['push']({'buttonView':_0x49fe7a,'action':_0x24f05c}),_0x49fe7a['delegate']('execute')['to'](_0xa59b4f),_0x35744c['children']['add'](_0x49fe7a),_0x1fca35['items']['add'](_0x35744c);}),_0xa59b4f['isEnabled']=_0x22f439['actions']['some'](_0x50211d=>_0x50211d['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0xa59b4f,'group':_0x22f439}),_0xa59b4f['panelView']['children']['add'](_0x1fca35),_0xa48e68['children']['add'](_0xa59b4f),_0x535d87['items']['add'](_0xa48e68);}else{const _0x13fc01=_0x510a33,_0x3d1725=new _0x5262e5(_0x4a3f6c,_0x363800),_0x7888a9=new _0x48f08b(_0x4a3f6c);_0x7888a9['set']({'label':_0x13fc01['label'],'icon':_0x13fc01['icon'],'role':'menuitem','isEnabled':_0x13fc01['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x7888a9,'action':_0x13fc01}),_0x7888a9['on']('execute',()=>{this['_executeQuickAction'](_0x13fc01);}),_0x7888a9['delegate']('execute')['to'](_0x363800),_0x3d1725['children']['add'](_0x7888a9),_0x535d87['items']['add'](_0x3d1725);}}),Object['values'](wh)['some'](_0x2fe1aa=>this['editor']['plugins']['has'](_0x2fe1aa))?_0x363800['bind']('isEnabled')['to'](_0x4bd76b):_0x363800['set']({'isEnabled':!0x1}),_0x363800['panelView']['children']['add'](_0x535d87),_0x363800;});}_executeQuickAction(_0x8a366a){const _0x5b83ed=this['editor'];_0x5b83ed['editing']['view']['focus'](),_0x5b83ed['commands']['execute']('aiQuickAction',_0x8a366a);const _0x2d0bd3=_0x5b83ed['ui']['view']['menuBarView'];_0x2d0bd3&&_0x2d0bd3['close']&&_0x2d0bd3['close']();}};function fh(_0x3d22f7){return'actions'in _0x3d22f7;}function Ch(_0x47cbd2,_0x3b2af4){const _0x54522d=_0x47cbd2['plugins']['get']('AITabs')['view'];_0x54522d['isVisible']=!0x0,_0x54522d['activateTab'](_0x3b2af4);}var bh=class extends _0x3faa90{execute(_0x1829fe){switch(this['_expandSelectionIfCollapsed'](),_0x1829fe['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x5ad5de=Os(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x5ad5de});}this['_handleAIChatAction'](_0x1829fe);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x3faf8a=Os(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ct('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x3faf8a});}this['_handleAIActionsAction'](_0x1829fe);}}async _handleAIChatAction(_0x487bcd){const _0x5c31e3=this['editor']['plugins']['get']('AIChatController');if(Ch(this['editor'],'chat'),'ask-ai'===_0x487bcd['id'])_0x5c31e3['removeSelectionFromChatContext'](),_0x5c31e3['addSelectionToChatContext'](this['editor']),_0x5c31e3['focusPromptInput']();else await _0x5c31e3['startConversation']({'modelId':_0x487bcd['model'],'contexts':this['_resolveActionContexts'](_0x487bcd)}),_0x5c31e3['removeSelectionFromChatContext'](),_0x5c31e3['addSelectionToChatContext'](this['editor']),_0x5c31e3['focusPromptInput'](),await _0x5c31e3['sendMessage']({'message':_0x487bcd['prompt']||_0x487bcd['displayedPrompt']||_0x487bcd['label'],'attributes':{'quickActionData':{'id':_0x487bcd['id']},'displayedPrompt':_0x487bcd['displayedPrompt']}});}_expandSelectionIfCollapsed(){const _0x388a36=this['editor'],_0x5818b9=_0x388a36['model']['document']['selection'];if(!_0x5818b9['isCollapsed'])return;const _0x9c01a6=wt(_0x5818b9['getSelectedBlocks']())||_0x388a36['model']['schema']['getLimitElement'](_0x5818b9);_0x388a36['model']['change'](_0x1f9b7e=>{_0x1f9b7e['setSelection'](_0x9c01a6,'in');});}_handleAIActionsActionLabel(_0x927d75){return _0x927d75['parent']?.['label']&&'other'!==_0x927d75['parent']?.['id']?_0x927d75['parent']['label']+':\x20'+_0x927d75['label']:_0x927d75['label'];}async _handleAIActionsAction(_0x117357){const _0x4b6ca8=this['editor']['plugins']['get']('AIActions'),_0x34d549=this['_resolveActionContexts'](_0x117357);let _0x279a3a;_0x279a3a=_0x117357['prompt']?{'userMessage':_0x117357['prompt'],'model':_0x117357['model'],'contexts':_0x34d549}:_0x117357['context']?{'model':_0x117357['model'],'contexts':_0x34d549}:{'actionName':_0x117357['actionName']||_0x117357['id'],'args':_0x117357['args'],'contexts':_0x34d549};const _0x530885=this['_handleAIActionsActionLabel'](_0x117357);await _0x4b6ca8['executeAction'](_0x279a3a,_0x530885,_0x117357['icon']);}_resolveActionContexts(_0x42ae96){const _0x7293b6=_0x42ae96['parent']?.['id']?[_0x42ae96['id'],_0x42ae96['parent']['id']]:[_0x42ae96['id']];return this['editor']['plugins']['get'](xs)['contextLibrary']['resolveContext']({'feature':'quickActions','ids':_0x7293b6,'extraContexts':_0x42ae96['context']?[_0x42ae96['context']]:[],'context':new Wn()})['refs'];}},Sh=class extends _0xe451ae{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x31bfc8=this['editor'],_0x434918=new bh(this['editor']);if(_0x31bfc8['commands']['add']('aiQuickAction',_0x434918),_0x31bfc8['plugins']['has']('AIChat')){const _0x85b798=this['editor']['plugins']['get']('AIChatController');_0x31bfc8['model']['document']['selection']['on']('change:range',(_0x2ea08d,_0x139eb5)=>{_0x139eb5['directChange']&&_0x85b798['removeSelectionFromChatContext']();});}}},Rh=class extends or{appendContent(_0x421e0,_0x1b0133='text'){'modification'===this['type']&&'text'===_0x1b0133&&(_0x1b0133=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x421e0,_0x1b0133);}updateChangeGroups(_0x2cc4be){const _0x50d1ee=this['parsedContent']['get'](_0x2cc4be)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x2cc4be,_0x50d1ee),this['changeGroups']=[],0x0==_0x50d1ee['childNodes']['length'])return;bn(this['documentContextContent']['get'](_0x2cc4be),this['parsedMergedContent']['get'](_0x2cc4be));const _0x298d22=this['documentContextContent']['get'](_0x2cc4be)['children']['map'](_0x4dcbb8=>({'node':_0x4dcbb8,'id':Fs(_0x4dcbb8,'data-id')})),_0x212c14=_0x50d1ee['children']['map'](_0x5056b7=>({'node':_0x5056b7,'id':Fs(_0x5056b7,'data-id')||xt()})),_0x3fa3ed=_0x1bdce3(_0x298d22,_0x212c14,{'comparator':(_0x50d564,_0x53cf33)=>_0x50d564['id']==_0x53cf33['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x3fa3ed['length']&&_0x3fa3ed[_0x3fa3ed['length']-0x1]['removed'];)_0x3fa3ed['pop']();}const _0x46302a=_0x3fa3ed['map'](_0x15ec07=>{const _0x5c5ae8=_0x15ec07['added']?'new':_0x15ec07['removed']?'removed':'modified';return{'node':_0x15ec07['value'][0x0]['node'],'type':_0x5c5ae8,'id':_0x15ec07['value'][0x0]['id']};}),_0x2def64=this['_documentIdToSource']['get'](_0x2cc4be);this['changeGroups']['push']({'changes':_0x46302a,'state':'pending','index':this['changeGroups']['length'],'editor':_0x2def64['editor'],'rootName':_0x2def64['rootName'],'documentId':_0x2cc4be});}_getDifferentChangeGroups(_0x31edc5,_0x416ae6){return _0x416ae6;}},Oh=class extends cr{content;['version'];editor;rootName;actionName;['args'];['userMessage'];['model'];context;['hasError']=!0x1;stoppedExplicitly=!0x1;constructor(_0x17dce6){super(_0x17dce6),this['content']=_0x17dce6['content'],this['version']=_0x17dce6['version'],this['editor']=_0x17dce6['editor'],this['rootName']=_0x17dce6['rootName'],this['actionName']=_0x17dce6['actionName'],this['args']=_0x17dce6['args'],this['userMessage']=_0x17dce6['userMessage'],this['model']=_0x17dce6['model'],this['context']=new Wn(_0x17dce6['contexts']),this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}sendRequest(){const _0x5b6de8=this['context']['toRequestContexts']();return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args'],'contexts':_0x5b6de8}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html','contexts':_0x5b6de8});}getDocumentContext(){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':xt(),'channelId':this['editor']['config']['get']('collaboration.channelId'),'selectionSignature':''}],'label':'Current\x20document','uiId':'current-document'};}createReply(_0x511a83){const _0x5d76ca=this['editor']['config']['get']('collaboration.channelId'),_0x428475=new Rh({..._0x511a83,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x5d76ca,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x5d76ca,this['editor']]])});return this['replies']['push'](_0x428475),_0x428475['delegate'](...hr)['to'](this),this['fire']('replyCreated',_0x428475),_0x428475;}},vh=class extends _0x3a20a6{constructor(_0x112bee,_0x5cd191=!0x0,_0x1edbda=!0x0){super(_0x112bee),this['set']('isEnabled',!0x1),_0x5cd191&&(this['applyButton']=this['_createButton'](Os(_0x112bee,'AI_BALLOON_APPLY_BUTTON'),tr),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x1edbda&&(this['suggestButton']=this['_createButton'](Os(_0x112bee,'AI_BALLOON_SUGGEST_BUTTON'),_0x5cd191?er:tr),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x5cd191,'showSuggestButton':_0x1edbda}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}setButtonsVisibility({showApplyButton:_0x27a83a,showSuggestButton:_0x373b8d}){this['applyButton']&&(this['applyButton']['isVisible']=_0x27a83a),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x373b8d);}_createButton(_0x1607db,_0x31a80c){const _0x3b1d4e=new Bt(this['locale']);return _0x3b1d4e['set']({'label':_0x1607db,'class':_0x31a80c,'isVisible':!0x0,'withText':!0x0}),_0x3b1d4e;}},yh=class extends _0xfd0945{constructor(_0x301593){super(_0x301593),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Os(_0x301593,'AI_DISCLAIMER_TEXT')}]}]});}},kh=class extends _0xfd0945{constructor(_0x127b23){super(_0x127b23),this['set']('isVisible',!0x0);const _0x58cc78=new to('small');_0x58cc78['isVisible']=!0x0;const _0x300ec0=new _0xfd0945(this['locale']);_0x300ec0['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Os(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x2fdf2c=>!_0x2fdf2c)]},'children':[_0x58cc78,_0x300ec0]});}},Nh=class extends ih{['focusCycler'];['_config'];_contentWrapper;_streamableContentView;_toolbarView;['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];_keystrokes;_dialogContent;['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];_navigationPreviousButton;_navigationNextButton;_navigationTryAgainButton;_navigationCounter;constructor(_0x335928,_0x45b49f){super(_0x335928),this['set']('isBusy',!0x1),this['set']('isTargetReadOnly',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x45b49f,this['_focusTracker']=new _t(),this['_keystrokes']=new gt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new $t({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x353304(),this['_addContentWrapper'](_0x45b49f),this['_addDisclaimerView'](),this['_addToolbar'](_0x45b49f),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'](_0x45b49f);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x33c751 of this['_focusables'])this['_focusTracker']['add'](_0x33c751['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}destroy(){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x57ced9){-0x1===_0x57ced9?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}setIsLoading(_0x1cbbd7){this['_isLoading']=_0x1cbbd7;}setErrorState(){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}clearErrorState(){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x239b9b){super['showError'](_0x239b9b),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x90d24d){super['showBlockingError'](_0x90d24d),this['setErrorState']();}addMiniToolbarItem(_0x3f43a9){this['_miniToolbarView']['items']['has'](_0x3f43a9)||this['_miniToolbarView']['items']['add'](_0x3f43a9);}removeMiniToolbarItem(_0x50950b){this['_miniToolbarView']['items']['has'](_0x50950b)&&this['_miniToolbarView']['items']['remove'](_0x50950b);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}_toggleToolbarButtonsVisibility({showApplyButton:_0x2f773a,showSuggestButton:_0x3c90d8}){_0x2f773a=_0x2f773a&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x3c90d8=_0x3c90d8&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x2f773a,'showSuggestButton':_0x3c90d8});}async updateContent(_0x512903){await this['_streamableContentView']['update'](_0x512903);}finalizeContent(){this['_streamableContentView']['cleanUpStreamingArtifacts']();}clearContent(){this['_streamableContentView']['clear']();}_addContentWrapper(_0x724606){this['_contentWrapper']=new _0xfd0945(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content',this['bindTemplate']['if']('_isErrorVisible','ck-hidden')]},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x724606['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new yh(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x2178ce,showSuggestButton:_0x143c5f}){this['_toolbarView']=new vh(this['locale'],_0x2178ce,_0x143c5f),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',this,'isTargetReadOnly',(_0x4d0968,_0x2e1ac8,_0x70e85,_0x165d72)=>!(_0x4d0968||_0x2e1ac8||_0x70e85||_0x165d72)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x2178ce,'showSuggestButton':_0x143c5f}),this['_dialogContent']['add'](this['_toolbarView']);}_createMiniToolbar(_0x2a52c2){return this['_miniToolbarView']=new rh(this['locale'],_0x2a52c2),this['_miniToolbarView']['delegate'](...Tr)['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',(_0x254b0f,_0x70bf84)=>!(_0x254b0f||_0x70bf84)),this['_miniToolbarView'];}_createLoaderView(){return this['_loaderView']=new kh(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}_createStreamableContentView(){return this['_streamableContentView']=new Ur(this['locale']),this['_streamableContentView'];}_setupMiniToolbarButtons(){const _0x38a648=new Bt(this['locale']),_0x5ab6d0=new Bt(this['locale']),_0x4a9e3b=new xh(this['locale']),_0x3f0c9c=new Bt(this['locale']);_0x38a648['set']({'icon':_0x331cc1,'label':Os(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+ir}),_0x5ab6d0['set']({'icon':_0x52157c,'tooltip':Os(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+ir}),_0x3f0c9c['set']({'icon':_0x2e94cb,'tooltip':Os(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+ir}),_0x38a648['bind']('isEnabled')['to'](this,'isBusy',_0xd42b7b=>!_0xd42b7b),_0x38a648['on']('execute',()=>{this['fire']('tryAgain');}),_0x5ab6d0['bind']('isEnabled')['to'](this,'isBusy',_0x339007=>!_0x339007),_0x5ab6d0['on']('execute',()=>{this['fire']('showPrevious');}),_0x3f0c9c['bind']('isEnabled')['to'](this,'isBusy',_0x5065e3=>!_0x5065e3),_0x3f0c9c['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x5ab6d0,this['_navigationCounter']=_0x4a9e3b,this['_navigationNextButton']=_0x3f0c9c,this['_navigationTryAgainButton']=_0x38a648;}updateMiniToolbarButtons(_0x5a1cf9,_0x111d23){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x4db4a0=_0x5a1cf9>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x4db4a0){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x2da1ac=_0x5a1cf9-_0x111d23;this['_navigationCounter']['setInteractionCount'](_0x2da1ac+'/'+_0x5a1cf9),this['_navigationPreviousButton']['isEnabled']=_0x111d23<_0x5a1cf9-0x1,this['_navigationNextButton']['isEnabled']=_0x111d23>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(_0x111e05){this['_isLoading']=_0x111e05;}resetShowChangesButton(){this['_miniToolbarView']['isShowChangesOn']=!0x1;}_setupMiniToolbarPositioning(){const _0xccb8cb=this['_streamableContentView']['element'],_0x45df4f=this['_miniToolbarView']['element'],_0x24755b=()=>{ft['window']['requestAnimationFrame'](()=>{const _0x180f61=_0xccb8cb['offsetWidth']-_0xccb8cb['clientWidth'];_0x45df4f['style']['right']='calc('+_0x180f61+'px\x20+\x20var(--ck-spacing-large))';});};_0x24755b(),this['_miniToolbarResizeObserver']=new pt(_0xccb8cb,()=>{_0x24755b();});}_initializeScrollManager(){const _0x59b34f=this['_getScrollableElement']();_0x59b34f&&!this['_scrollManager']&&(this['_scrollManager']=new Oo(_0x59b34f));}_getScrollableElement(){return this['_streamableContentView']['element'];}},xh=class extends _0xfd0945{constructor(_0x342fe8){super(_0x342fe8);const _0x4446c5=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x4446c5['to']('interactionCount')}]});}setInteractionCount(_0x584d36){this['set']('interactionCount',_0x584d36);}},Lh=class extends _0xe451ae{static get requires(){return[Ss,Jn,Gt,dn,nh,In];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}_aiConnector;_interactions=[];_currentInteractionIndex=0x0;_interactionParams;['_balloonShowDiff']=!0x1;['_promiseQueue'];get _interaction(){return this['_interactions'][this['_interactions']['length']-0x1];}_actionsBalloonView;_reporter;constructor(_0x35c822){super(_0x35c822),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](Jn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Wr();}stopInteraction(){this['_stopInteraction']();}async executeAction(_0x11b714,_0x24fbec,_0x1e91a6){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x451fe4,anchorData:_0x451d01,root:_0x51f0a1}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x11b714,_0x451fe4,_0x451d01,_0x51f0a1,_0x24fbec,_0x1e91a6);}const {modelFragment:_0x20f51c,anchorData:_0x47c849,root:_0x379da7}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x11b714,_0x20f51c,_0x47c849,_0x379da7,_0x24fbec,_0x1e91a6);}async destroy(){return this['_stopInteraction'](),super['destroy']();}_createActionsBalloonView(){const _0x139b9b=this['editor']['plugins']['has']('TrackChanges');let _0x372b93=this['editor']['config']['get']('ai.availableReplyActions')||[...Yr];_0x139b9b||(_0x372b93=_0x372b93['filter'](_0x50cb8f=>'insertSuggestion'!=_0x50cb8f));const _0x739bd3=this['editor']['commands']['get']('trackChanges'),_0x4aa037=new Nh(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x139b9b,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x372b93});return _0x4aa037['bind']('isBusy')['to'](this),_0x4aa037['bind']('isTargetReadOnly')['to'](this['editor'],'isReadOnly'),_0x739bd3&&_0x4aa037['bind']('isTrackChangesOn')['to'](_0x739bd3,'value'),_0x4aa037['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x4aa037['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x4aa037['on']('showNext',()=>{this['_navigateToNext']();}),_0x4aa037;}_normalizeSelectionStart(){const _0x29ee0e=this['editor']['model'],_0x1da924=_0x29ee0e['document']['selection'],_0x1bae2f=_0x1da924['getFirstRange']();if(!_0x1bae2f||_0x1bae2f['isCollapsed'])return;const _0x51c318=wt(_0x1da924['getSelectedBlocks']());if(!_0x51c318)return;const _0x232f4a=_0x29ee0e['createPositionAt'](_0x51c318,0x0);_0x232f4a['isAfter'](_0x1bae2f['start'])&&_0x29ee0e['change'](_0x28ab06=>{_0x28ab06['setSelection'](_0x28ab06['createRange'](_0x232f4a,_0x1bae2f['end']));});}_getExecuteDataRegular(){const _0x344807=this['editor']['model']['document']['selection'],_0x1ce162=_0x344807['getFirstRange']()['start']['root'];if(_0x344807['isCollapsed']){const _0x2241e4=wt(_0x344807['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x344807);this['editor']['model']['change'](_0x384b79=>{_0x384b79['setSelection'](_0x2241e4,'in');});}this['_normalizeSelectionStart']();const _0x4b3eb0=_0x344807['getFirstRange'](),_0x553c34=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x344807),_0x4b3eb0['start'],_0x4b3eb0['end']);this['_copyMarkersToFragment'](_0x553c34,_0x344807,{'isTableSelection':!0x1});const _0x477c5b=_0x344807['getFirstRange']()['start'],_0x319d62=new Map();let _0x201f3f=_0x553c34;for(let _0x2a7c83=0x0;_0x2a7c83<_0x477c5b['path']['length'];_0x2a7c83++)_0x319d62['set'](_0x201f3f,_0x477c5b['path'][_0x2a7c83]),_0x201f3f=_0x201f3f['getChild'](0x0);return{'modelFragment':_0x553c34,'anchorData':_0x319d62,'root':_0x1ce162};}_getExecuteDataInTable(){const _0x1504dd=this['editor']['model']['document']['selection'],_0x5e2dac=this['editor']['plugins']['get']('TableSelection'),_0x2d719c=_0x1504dd['getFirstRange']()['start']['root'],_0x1f44c3=_0x5e2dac['getSelectionAsFragment'](),_0x47371e=_0x1504dd['getFirstRange']()['start']['parent']['parent'],_0x489a76=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x47371e),this['editor']['model']['createPositionAfter'](_0x47371e)),_0x356699=this['_wrapWithCommonAncestors'](_0x1f44c3,_0x489a76['start'],_0x489a76['end']);this['_copyMarkersToFragment'](_0x356699,_0x1504dd,{'isTableSelection':!0x0});const _0x32801f=_0x1504dd['getFirstRange']()['start'],_0x15ac1e=new Map();let _0x23f355=_0x356699;for(let _0x3b0cf8=0x0;_0x3b0cf8<_0x32801f['path']['length'];_0x3b0cf8++)if(_0x15ac1e['set'](_0x23f355,_0x32801f['path'][_0x3b0cf8]),_0x3b0cf8<_0x32801f['path']['length']-0x1)_0x23f355=_0x23f355['getChild'](0x0);else{let _0x1b655a=_0x23f355['nextSibling'];for(;_0x1b655a;)_0x15ac1e['set'](_0x1b655a,_0x32801f['path'][_0x3b0cf8]),_0x1b655a=_0x1b655a['nextSibling'];}return{'modelFragment':_0x356699,'anchorData':_0x15ac1e,'root':_0x2d719c};}async _executeAction(_0x3736b3,_0x29579b,_0x17759a,_0x2989ee,_0x122205,_0x3be510){const _0xdff1a1=this['editor']['plugins']['get'](dn),_0x26b46d=this['editor']['plugins']['get'](nh),_0x1eac64=this['editor']['model']['document']['selection'],_0x17fe78=await _0xdff1a1['modelToDataWithIds'](_0x29579b,this['editor'],_0x2989ee['rootName']),_0x36e491=this['editor']['model']['document']['version'],_0xbbbc06=[..._0x1eac64['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x26b46d['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x122205,'icon':_0x3be510||_0x4a335e,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0xbbbc06,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x26b46d),this['_interactionParams']={'action':_0x3736b3,'content':_0x17fe78,'version':_0x36e491,'aiBalloon':_0x26b46d,'modelFragment':_0x29579b,'anchorData':_0x17759a,'root':_0x2989ee},this['_setupApplyListeners'](),this['listenTo'](_0x26b46d,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x26b46d,'dialogClosed',(_0x3f9a94,{id:_0x29873e})=>{if('aiActionsBalloon'===_0x29873e){for(const _0x1ed287 of this['_interactions']){if(0x0===_0x1ed287['replies']['length']||_0x1ed287['stoppedExplicitly'])continue;const _0x53f154=_0x1ed287['replies'][_0x1ed287['replies']['length']-0x1],_0x260ac2=_0x53f154['changeGroups'][0x0];_0x260ac2&&'pending'===_0x260ac2['state']&&_0x53f154['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x26b46d);}}),this['_createInteraction'](_0x17fe78,_0x36e491,_0x26b46d,_0x3736b3);}_setupApplyListeners(){if(!this['_interactionParams'])return;const {modelFragment:_0x4e7311,anchorData:_0x3ad2bf,root:_0x1d39c4}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x4e7311,_0x3ad2bf,_0x1d39c4,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x4e7311,_0x3ad2bf,_0x1d39c4,!0x0);});}_wrapWithCommonAncestors(_0x3335d7,_0x1bf9b3,_0x111774){const _0x3b73fd=this['editor']['model']['createRange'](_0x1bf9b3,_0x111774)['getCommonAncestor'](),_0x3e306e=_0x3b73fd['is']('documentFragment')?[]:_0x3b73fd['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x3e306e['length']){const _0x23e5fa=_0x3e306e['map'](_0x3c18a2=>_0x3c18a2['_clone'](!0x1));for(let _0x39ea17=0x1;_0x39ea17<_0x23e5fa['length'];_0x39ea17++)_0x23e5fa[_0x39ea17-0x1]['_appendChild'](_0x23e5fa[_0x39ea17]);return _0x23e5fa[_0x23e5fa['length']-0x1]['_appendChild'](_0x3335d7),new _0x332f21(_0x23e5fa[0x0]);}return _0x3335d7;}_copyMarkersToFragment(_0x45f826,_0x296d55,_0x81de30={'isTableSelection':!0x1}){const _0x39dd51=this['editor']['model'],_0x5b85fa=Array['from'](_0x296d55['getRanges']()),_0xd1ac78=_0x296d55['getFirstRange']()['start'];for(const _0x4d315f of _0x39dd51['markers']){if(_0x4d315f['name']['startsWith']('ai-selection')||!_0x4d315f['affectsData'])continue;const _0x1e02cb=_0x4d315f['getRange']();if(!_0x5b85fa['some'](_0xe2bcb9=>_0xe2bcb9['containsRange'](_0x1e02cb,!0x0)))continue;const _0x8b2969=this['_regularCalculateMarkerPath'](_0x1e02cb['start'],_0xd1ac78,_0x81de30['isTableSelection']),_0x5c36b0=this['_regularCalculateMarkerPath'](_0x1e02cb['end'],_0xd1ac78,_0x81de30['isTableSelection']),_0x406f98=_0x39dd51['createPositionFromPath'](_0x45f826,_0x8b2969),_0x568095=_0x39dd51['createPositionFromPath'](_0x45f826,_0x5c36b0);if(!_0x406f98['isEqual'](_0x568095)){const _0x4ed2b0=_0x39dd51['createRange'](_0x406f98,_0x568095);_0x45f826['markers']['set'](_0x4d315f['name'],_0x4ed2b0);}}}_regularCalculateMarkerPath(_0x16d977,_0x58793b,_0x31533f=!0x1){const _0xa5f78=[..._0x16d977['path']['slice']()];for(let _0x191420=0x0;_0x191420<Math['max'](_0x58793b['path']['length'],_0x16d977['path']['length']);_0x191420++){const _0x57e742=_0x58793b['path'][_0x191420]||0x0,_0x4fd7e4=(_0x16d977['path'][_0x191420]||0x0)-_0x57e742;if(_0xa5f78[_0x191420]=_0x4fd7e4,0x0!==_0x4fd7e4&&!_0x31533f)break;}return _0xa5f78;}async _createInteraction(_0x2c32e3,_0x1771b3,_0x5a9149,_0xa2a6c5){const _0x29078e=this['editor'],_0x5cad55=_0x29078e['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0xa2a6c5,'content':_0x2c32e3,'version':_0x1771b3,'aiBalloon':_0x5a9149,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x5cad55});const _0x3393e2=new Oh({'connector':this['_aiConnector'],'locale':_0x29078e['locale'],'content':_0x2c32e3,'version':_0x1771b3,'editor':_0x29078e,'rootName':_0x5cad55['rootName'],..._0xa2a6c5});this['_interactions']['push'](_0x3393e2);const _0x56337b=(_0x2aed5e,_0x14bd80=!0x1,_0x59d8de='streaming')=>{const {isDone:_0x4e3182}=_0x2aed5e;return this['_promiseQueue']['enqueue'](async _0x13c901=>{try{if(this['_isUnsupportedInlineRootChange'](_0x2aed5e,_0x5cad55))return this['_actionsBalloonView']['showBlockingError'](Os(_0x29078e['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')),void(_0x4e3182&&this['_actionsBalloonView']['finalizeContent']());const _0x39e2de=vn({'changeGroups':_0x2aed5e['changeGroups'],'documentContextContent':_0x2aed5e['documentContextContent'],'showDiff':_0x14bd80,'trimUnchanged':!0x1});_0x39e2de['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x39e2de[0x0],'renderingStrategy':_0x59d8de,'abortSignal':_0x13c901}),_0x4e3182&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x5a3051){if(zn(_0x5a3051))return;throw _0x5a3051;}});};_0x3393e2['on']('replyCreated',(_0x2e38c0,_0x20a441)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x56337b(_0x20a441)['catch'](_0x360fbb=>{this['_reporter']['logError'](_0x360fbb,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x3393e2,_0x360fbb);});}),_0x3393e2['on']('replyContentUpdated',(_0x499eb7,_0x22c784)=>{_0x56337b(_0x22c784)['catch'](_0x176adf=>{this['_reporter']['logError'](_0x176adf,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x3393e2,_0x176adf);});}),_0x3393e2['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x242cf2){this['_reporter']['logError'](_0x242cf2,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x3393e2,_0x242cf2);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x51e4e0,{showDiff:_0x2bf3da})=>{try{this['_balloonShowDiff']=_0x2bf3da;const _0x5e57fc=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0x5e57fc&&await _0x56337b(_0x5e57fc,_0x2bf3da,'static');}catch(_0x5a5c96){this['_reporter']['logError'](_0x5a5c96,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x3393e2,_0x5a5c96);}}),_0x3393e2['on']('replyChangeGroupStateUpdated',()=>{const _0x4a16e3={'positiveCount':_0x3393e2['replies']['reduce']((_0x47d666,_0x333194)=>_0x47d666+_0x333194['changeGroups']['filter'](_0x112c4a=>'accepted'===_0x112c4a['state'])['length'],0x0),'totalCount':_0x3393e2['replies']['reduce']((_0x100958,_0x42b29a)=>_0x100958+_0x42b29a['changeGroups']['length'],0x0)},_0x12ddf4=_0x3393e2['actionCallId'],_0x24eea6=_0x3393e2['actionName'];_0x24eea6?this['_aiConnector']['upsertAIActionRating'](_0x24eea6,_0x12ddf4,_0x4a16e3):this['_aiConnector']['upsertCustomAIActionRating'](_0x12ddf4,_0x4a16e3);}),this['_setLoadingState']();try{const _0x5b015c=await _0x3393e2['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x5b015c;}catch(_0x248205){zn(_0x248205)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x248205,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x3393e2,_0x248205);}}_isUnsupportedInlineRootChange(_0x29132b,_0x491d80){const _0x3ef73f=this['editor'];if(!zs(_0x3ef73f,_0x491d80['rootName']))return!0x1;return!tn(_0x3ef73f,new _0x481874((_0x29132b['changeGroups'][0x0]?.['changes']??[])['filter'](_0x37392c=>'removed'!==_0x37392c['type'])['map'](_0x44eb86=>_0x44eb86['node']['cloneNode'](!0x0))));}['_applyChanges'](_0x484ff3,_0x8ccb38,_0x17cf55,_0x554178){const _0x58f49e=this['editor'];if(_0x554178&&!_0x58f49e['plugins']['has']('TrackChanges'))throw new ct('ai-no-track-changes',null);const _0x6de121=this['editor']['plugins']['get'](In),_0x173662=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x173662||!_0x173662['replies']['length'])return;const _0xec5150=_0x173662['replies'][_0x173662['replies']['length']-0x1];if(this['_isUnsupportedInlineRootChange'](_0xec5150,_0x17cf55))return void this['_actionsBalloonView']['showBlockingError'](Os(_0x58f49e['locale'],'AI_SUGGESTION_NO_PARTS_WARNING'));_0xec5150['setChangeGroupState'](0x0,'accepted');const _0x2a743b=pr({'documentSuggestions':mr({'groups':[_0xec5150['changeGroups'][0x0]],'documentContextContent':_0xec5150['documentContextContent'],'documents':_0x173662['getDocumentContext']()['documents']}),'transform':!0x1,'documentChanges':_0x6de121,'documentChangesOptions':{'anchor':_0x58f49e['model']['createPositionAt'](_0x484ff3,0x0),'markDeletions':_0x554178}})['values']()['next']()['value']??[],_0x3861e2=this['_filterOperationsOutsideRange'](_0x2a743b,_0x8ccb38);for(const _0x6a5d44 of _0x3861e2)this['_anchorOperation'](_0x8ccb38,_0x6a5d44,_0x17cf55);const _0x4d3ce4=_0x173662['getDocumentContext']()['documents'][0x0]['version'],_0x536c9a=_0x58f49e['model']['document']['history']['getOperations'](_0x4d3ce4),_0xe68c9={'document':_0x58f49e['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x207892=_0x3ceee1(_0x3861e2,_0x536c9a,_0xe68c9)['operationsA'];Mn(_0x207892,'quickActions');try{_0x58f49e['model']['change'](_0x406993=>{_0x406993['setSelection'](_0x58f49e['model']['document']['selection']['focus']),_0x554178?_0x58f49e['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x207892):_0x6de121['applyOperations'](_0x406993,_0x207892);});}catch(_0x1731cb){throw this['_reporter']['logError'](new jn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x1731cb})),_0x1731cb;}this['editor']['plugins']['get']('AIBalloon')['close']();}_filterOperationsOutsideRange(_0x3c321c,_0x29494b){return _0x3c321c['filter'](_0xa9c2c9=>{if('rename'==_0xa9c2c9['type']){const _0x110a35=_0xa9c2c9['position']['nodeAfter'];return!_0x29494b['has'](_0x110a35);}if(_0xa9c2c9['type']['indexOf']('Attribute')>-0x1){const _0x634a16=_0xa9c2c9['range']['start']['nodeAfter'];return!_0x29494b['has'](_0x634a16);}return!0x0;});}_anchorOperation(_0x20bd6b,_0x1bc127,_0x457df2){const _0x1edf35=_0x1bc127['clone']();for(const _0x1995f1 in _0x1bc127){const _0x4a67f8=_0x1bc127[_0x1995f1];_0x4a67f8 instanceof _0x5708b2?_0x1bc127[_0x1995f1]=new _0x5708b2(_0x1f0027(_0x4a67f8['start']),_0x1f0027(_0x4a67f8['end'])):_0x4a67f8 instanceof _0x41b2e6&&(_0x1bc127[_0x1995f1]=_0x1f0027(_0x4a67f8));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x1edf35['type'])){if(_0x1edf35['isDocumentOperation']=!0x1,_0x1edf35['baseVersion']=null,'remove'==_0x1edf35['type']){const _0x3d184d=_0x1edf35['sourcePosition'],_0x5983e3=_0x1edf35['howMany'];new _0x4b3a4f(_0x3d184d,_0x5983e3)['_execute']();}else _0x1edf35['_execute']();}function _0x1f0027(_0x10828b){if('$graveyard'==_0x10828b['root']['rootName'])return _0x10828b;const _0x5b4806=[];let _0x17028b=_0x10828b['root'];for(let _0x5c5ee3=0x0;_0x5c5ee3<_0x10828b['path']['length'];_0x5c5ee3++){const _0xacc3d9=_0x20bd6b['get'](_0x17028b)||0x0;_0x5b4806[_0x5c5ee3]=_0x10828b['path'][_0x5c5ee3]+_0xacc3d9,_0x17028b=_0x17028b['getChildAtOffset'](_0x10828b['path'][_0x5c5ee3]);}return new _0x41b2e6(_0x457df2,_0x5b4806,_0x10828b['stickiness']);}}_refreshInteraction(){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x513fe5,content:_0x5e4102,version:_0x13265d,aiBalloon:_0x4c3324}=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'](_0x5e4102,_0x13265d,_0x4c3324,_0x513fe5)['catch'](_0x1d1162=>{this['_reporter']['logError'](_0x1d1162,{'context':{'operation':'refresh-interaction'}});});}_clearInteractionHistory(){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_stopInteraction(){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}_navigateToPrevious(){const _0x522583=this['_interactions']['length'];this['_currentInteractionIndex']<_0x522583-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}_navigateToNext(){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async _displayInteractionAtIndex(_0x24577b){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x24577b;const _0x5d9aad=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5d9aad)return;if(_0x5d9aad['hasError'])return this['_setErrorState'](_0x5d9aad),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x5d9aad['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x400620=_0x5d9aad['replies'][_0x5d9aad['replies']['length']-0x1];if(_0x400620)try{const _0x3fc5ad=vn({'changeGroups':_0x400620['changeGroups'],'documentContextContent':_0x400620['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x1b7149=>setTimeout(_0x1b7149,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x3fc5ad[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x3dfee4){this['_reporter']['logError'](_0x3dfee4,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}_setLoadingState(){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async _setErrorState(_0x5337db,_0x454567){if(void 0x0!==_0x454567&&zn(_0x454567))return;const _0x2ff9eb=Os(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x2ff9eb),_0x5337db['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);}},Dh=class extends _0xe451ae{static get requires(){return[Th,Sh,Lh];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xc8a05e){super(_0xc8a05e),_0xc8a05e['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ph=class extends _0xfd0945{resultResponseView;acceptButtonView;dismissButtonView;infoButtonView;outdatedButtonView;constructor(_0x74b305,_0x5dba3f){super(_0x74b305),this['id']=_0x5dba3f,this['set']('status','pending'),this['set']('changeId',_0x5dba3f),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',(_0x9fb4b8,_0x331ca8)=>{_0x331ca8&&_0x331ca8['target']&&'A'===_0x331ca8['target']['tagName']&&_0x331ca8['preventDefault'](),this['fire']('activateChange',{'id':_0x5dba3f,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x5dba3f,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x5dba3f,'source':this});}),this['on']('change:showDiff',()=>this['_syncResponseVisibility']());}['render'](){super['render'](),this['_syncResponseVisibility']();}setItemAsActive(){this['isActive']=!0x0;}setItemAsInactive(){this['isActive']=!0x1;}_createResultResponseView(){const _0x365468=new _0xfd0945(this['locale']);return _0x365468['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response']}}),_0x365468;}updateResponseContent(_0x4bddb1,_0x323097){const _0x3da3ec=_0x323097||'div',_0x1c4979=this['resultResponseView']['element'];if(_0x1c4979['tagName']['toLowerCase']()!==_0x3da3ec){const _0x4fb183=new _0xe6f3c8({'tag':_0x3da3ec,'attributes':{'class':_0x1c4979['className']}})['render']();_0x1c4979['replaceWith'](_0x4fb183),this['resultResponseView']['element']=_0x4fb183,this['_syncResponseVisibility']();}this['resultResponseView']['element']['innerHTML']=_0x4bddb1;}_syncResponseVisibility(){this['resultResponseView']['element']?.['classList']['toggle']('ck-hidden',!this['showDiff']);}_createAcceptButtonView(){const _0x1bad98=new Bt(this['locale']);return _0x1bad98['set']({'label':Os(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x1bad98['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4a16e5=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x4a16e5['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x2e7fa9=>'pending'!==_0x2e7fa9&&'accepted'!==_0x2e7fa9),this['bindTemplate']['if']('status',er,_0x127b16=>'pending'===_0x127b16),this['bindTemplate']['if']('status',ir,_0x174ca9=>'pending'!==_0x174ca9),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x3cd879=>'accepted'===_0x3cd879)]}}),this['on']('change:status',(_0x21a86b,_0x5c7b6b,_0x1641d0)=>{_0x1bad98['isEnabled']='pending'===_0x1641d0,'accepted'===_0x1641d0&&(_0x1bad98['label']=Os(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x1bad98['icon']=_0xca6ce1);}),_0x1bad98;}_createDismissButtonView(){const _0x271512=new Bt(this['locale']);return _0x271512['set']({'label':Os(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x271512['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0xc55f63=>{this['fire']('dismissChange',{'id':this['changeId']}),_0xc55f63['stopPropagation']();})},'attributes':{'class':[ir,this['bindTemplate']['if']('status','ck-hidden',_0x5370e6=>'pending'!==_0x5370e6&&'rejected'!==_0x5370e6),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x3ff91e=>'pending'===_0x3ff91e),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x276faa=>'rejected'===_0x276faa)]}}),this['on']('change:status',(_0x3451dd,_0x3f6692,_0x584b9b)=>{_0x271512['isEnabled']='pending'===_0x584b9b,'rejected'===_0x584b9b&&(_0x271512['label']=Os(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x271512['icon']=_0x509f6e);}),_0x271512;}_createInfoButtonView(){const _0x62a325=new Bt(this['locale']);return _0x62a325['set']({'label':Os(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x47e54a,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':ir+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0x62a325['bind']('isOn')['to'](this,'isInfoToggleOn',_0x4ffb82=>_0x4ffb82),_0x62a325['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0x62a325;}_createOutdatedButtonView(){const _0x5ce311=new Bt(this['locale']);return _0x5ce311['set']({'label':Os(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x2ffcd8,'withText':!0x0,'isEnabled':!0x1}),_0x5ce311['extendTemplate']({'attributes':{'class':[ir,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x1c4d0c=>'outdated'!==_0x1c4d0c)],'disabled':'disabled'}}),_0x5ce311;}},Hh=class extends Pt{resultItemView;_pinnedRectIndex=void 0x0;_pinnedTargetElement=void 0x0;_pinnedTargetChangeId=void 0x0;constructor(_0x31229c,_0x54e420){super(_0x31229c),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']()),_0x54e420['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}updateContent(_0x5b175){this['resultItemView']['changeId']=_0x5b175['id'],this['resultItemView']['updateResponseContent'](_0x5b175['contentDiffed'],_0x5b175['wrapperTag']);}['showBalloon'](_0x331ac5,_0x24b605,_0x2fd28b,_0x214835,_0x5463a3,_0x15f85d){const _0x1ecc17=_0x24b605();if(!_0x1ecc17)return;this['updateContent'](_0x331ac5),this['show']();const _0x23a64d=Array['from'](_0x1ecc17['getClientRects']())['reverse'](),_0x16afb2=this['_getPointedRectIndexFromEvent'](_0x2fd28b,_0x23a64d),_0x25c639=_0x23a64d[_0x16afb2??0x0];'click'===_0x214835?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x24b605(),_0x16afb2,_0x331ac5['id'],_0x5463a3,_0x15f85d)||_0x25c639})):'hover'===_0x214835&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x24b605(),_0x16afb2,_0x331ac5['id'])||_0x25c639}));}['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(){_0x4f15a2({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x33ee2d=[this['element']];return this['_pinnedTargetElement']&&_0x33ee2d['push'](this['_pinnedTargetElement']),_0x33ee2d;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}_createContentView(){const _0x10fa15=new _0xfd0945();return this['resultItemView']=new Ph(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x10fa15['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']]}]}),_0x10fa15;}_getBestRectPositionOnClick(_0x7e5b12,_0x459fc5,_0x2903e0,_0x16e644,_0x14c7b8){if(!_0x7e5b12)return null;const _0x906eb=this['position']['replace']('arrow_',''),_0x3cdefb=Array['from'](_0x7e5b12['getClientRects']());let _0x550d1c,_0x21a875=_0x3cdefb['reverse']();return void 0x0!==_0x459fc5&&this['_isPinnedRectVisible'](_0x21a875[_0x459fc5],_0x16e644,_0x14c7b8)?(_0x550d1c=_0x21a875[_0x459fc5],this['_pinnedRectIndex']=_0x459fc5):this['_isPinnedRectVisible'](_0x21a875[0x0],_0x16e644,_0x14c7b8)&&void 0x0===_0x459fc5?_0x550d1c=_0x21a875[0x0]:(_0x21a875='s'==_0x906eb[0x0]?[..._0x3cdefb]['reverse']():_0x3cdefb,_0x21a875['forEach'](_0x47e768=>{this['_isPinnedRectVisible'](_0x47e768,_0x16e644,_0x14c7b8)&&(_0x550d1c=_0x47e768);})),this['_pinnedTargetChangeId']=_0x2903e0,this['_pinnedTargetElement']=_0x7e5b12,_0x550d1c||_0x7e5b12['getBoundingClientRect']();}_getBestRectPositionOnHover(_0x466863,_0x1eae88,_0x17b337){if(!_0x466863)return null;const _0x5cd486=Array['from'](_0x466863['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x1eae88&&this['_pinnedTargetChangeId']!==_0x17b337?(this['_pinnedRectIndex']=_0x1eae88,this['_pinnedTargetElement']=_0x466863,this['_pinnedTargetChangeId']=_0x17b337,_0x5cd486[_0x1eae88]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x17b337?_0x466863!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x5cd486[this['_pinnedRectIndex']]:void 0x0!==_0x1eae88&&this['_pinnedTargetChangeId']!==_0x17b337?(this['_pinnedRectIndex']=_0x1eae88,this['_pinnedTargetElement']=_0x466863,this['_pinnedTargetChangeId']=_0x17b337,_0x5cd486[_0x1eae88]):_0x466863['getBoundingClientRect']();}_getPointedRectIndexFromEvent(_0x382b2d,_0x4703ba){if(_0x382b2d)for(let _0x373737=0x0;_0x373737<_0x4703ba['length'];_0x373737++){const _0x21807e=_0x4703ba[_0x373737];if(_0x382b2d['clientX']>=_0x21807e['left']-0x3&&_0x382b2d['clientX']<=_0x21807e['right']+0x3&&_0x382b2d['clientY']>=_0x21807e['top']-0x3&&_0x382b2d['clientY']<=_0x21807e['bottom']+0x3)return _0x373737;}}_isPinnedRectVisible(_0x4fc75c,_0x5b6bdd,_0x185207){const _0x172ed=new It(_0x4fc75c),_0x3db298=_0x5b6bdd||document['documentElement'],_0x588f85=_0x172ed['getIntersection'](Tt(_0x185207)),_0x3b9e1b=new It(_0x3db298)['getIntersection'](_0x172ed);return!!(_0x588f85&&_0x3b9e1b&&_0x172ed['width']>0x0);}};const Mh=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Uh=class extends _0x338e6f{['_mainView'];_balloonSuggestionView;_bodyCollection;static get requires(){return[bs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x495983){super(_0x495983),this['_bodyCollection']=nr(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Mh)['to'](this),this['_balloonSuggestionView']=new Hh(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}init(){const _0x39077b=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x39077b);}destroy(){this['_bodyCollection']['detachFromDom'](),super['destroy']();}setAvailableChecks(_0x410081){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x447625=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x410081,_0x447625);}this['_mainView']['showReviewCheckListView']();}showReviewCheckList(){this['fire']('getReviewCheckList');}showCheckRunResults(_0x4d4bc3){_0x4d4bc3&&('error-general'!==_0x4d4bc3['status']?'error-chunk'!==_0x4d4bc3['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}showCheckRunResult(_0x19cf8f){this['_mainView']['addCheckRunResult'](_0x19cf8f);}showGeneralResultsErrorView(){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x4127bd){this['_mainView']['showGeneralReviewCoreErrorView'](_0x4127bd??Os(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}showUnsupportedInlineChangeView(){this['_mainView']['showUnsupportedInlineChangeView']();}setCheckResultTitle(_0x2b9028,_0x1ea3ad){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x2b9028,_0x1ea3ad);}setAcceptAllEnabled(_0x3468a4){this['_mainView']['reviewCheckResultsView']['setAcceptAllEnabled'](_0x3468a4);}setActiveStateInResults(_0x242da1){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x3a4662=>{_0x3a4662['id']===_0x242da1&&_0x3a4662['setItemAsActive']();});}resetActiveStateInResults(){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x3d03ee=>_0x3d03ee['setItemAsInactive']());}updateChangeState(_0x508245,_0x79c362){'accepted'===_0x79c362||'rejected'===_0x79c362||'outdated'===_0x79c362?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x508245,_0x79c362):this['_mainView']['reviewCheckResultsView']['showResult'](_0x508245,_0x79c362);}showReviewCompletedView(){this['_mainView']['showReviewCompletedView']();}showActionsWhenResultIsReady(){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}hideActionsWhenResultIsReady(){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x99d6c6,_0x2f8961,_0x366f1c,_0x5f468b,_0x41473d,_0x3e4a5e){this['_balloonSuggestionView']['showBalloon'](_0x99d6c6,_0x2f8961,_0x366f1c,_0x5f468b,_0x41473d,_0x3e4a5e);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}getChangeElement(_0x56a836){const _0x2dc2ba=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x26ae32=>_0x26ae32['id']===_0x56a836);return _0x2dc2ba?_0x2dc2ba['element']:null;}deactivateChange(){this['_balloonSuggestionView']['deactivateChange']();}},Vh=class extends _0xfd0945{constructor(_0x62c55f){super(_0x62c55f),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x589257=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x589257['if']('isVisible','ck-hidden',_0x32fdc0=>!_0x32fdc0)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x589257['to']('errorMessage')}]}]});}},Bh=class extends _0xfd0945{['reviewCoreHeader'];['generalErrorView'];reviewCheckListView;reviewCheckResultsView;reviewCompletedView;constructor(_0xcec170,_0x4c1984){super(_0xcec170),this['reviewCoreHeader']=_0x4c1984['header'],this['generalErrorView']=new Vh(_0xcec170),this['reviewCheckListView']=_0x4c1984['list'],this['reviewCheckListView']['delegate'](...Mh)['to'](this),this['reviewCheckResultsView']=_0x4c1984['results'],this['reviewCheckResultsView']['delegate'](...Mh)['to'](this),this['reviewCompletedView']=_0x4c1984['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(_0x1c10b3){this['reviewCheckResultsView']['addResult'](_0x1c10b3),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'](_0x4e9132){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x4e9132;}showGeneralResultsErrorView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}showUnsupportedInlineChangeView(){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showUnsupportedInlineChangeMessage']();}},Gh=class extends Bt{constructor(_0x595700,_0x16c8bb){super(_0x16c8bb),this['set']({'label':_0x595700,'withText':!0x0,'class':tr}),this['on']('execute',()=>{this['fire']('finishReview');});}},Kh=class extends te{_resultViews;_resultsHeader;_resultsBody;['reviewDisclaimer'];_cancelButtonView;_acceptAllButtonView;_exitReviewButtonView;_toggleDiffButtonView;['_errorMessageView'];_finishReviewButtonView;_contents;constructor(_0x528f44,_0xa0b4d7){super(_0x528f44),this['_contents']=_0xa0b4d7,this['_resultViews']=new _0x353304(),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 Na(_0x528f44),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),this['set']('isAcceptAllEnabled',!0x1),this['_acceptAllButtonView']['bind']('isEnabled')['to'](this,'isAcceptAllEnabled',this,'isError',(_0x57dc25,_0x2c734b)=>_0x57dc25&&!_0x2c734b);const _0x5f2ed5=this['_createCombinedSkeletonLoader'](),_0x39e124=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x39e124['if']('isLoading','ck-ai_review__check-run_loading',_0x2797fe=>_0x2797fe),_0x39e124['if']('isResultReady','ck-ai_review__check-run_ready',_0x57091b=>_0x57091b),_0x39e124['if']('isVisible','ck-hidden',_0xcedf1f=>!_0xcedf1f)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0x5f2ed5,this['reviewDisclaimer']]});}clearResults(){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}getResults(){return this['_resultViews'];}addResult(_0x1b1796){const _0xe568a1=new Ph(this['locale'],_0x1b1796['id']);_0xe568a1['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0xe568a1),_0xe568a1['updateResponseContent'](_0x1b1796['contentDiffed'],_0x1b1796['wrapperTag']);}hideResult(_0x47b4b1,_0x3d4a79){if('pending'===_0x3d4a79)return;const _0xe88ef6=this['_resultViews']['find'](_0x313bf0=>_0x313bf0['id']===_0x47b4b1);_0xe88ef6&&(_0xe88ef6['status']=_0x3d4a79,_0xe88ef6['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}showResult(_0x2f422d,_0x178525){if('pending'!==_0x178525)return;const _0x32232d=this['_resultViews']['find'](_0x411f00=>_0x411f00['id']===_0x2f422d);_0x32232d&&(_0x32232d['status']=_0x178525,_0x32232d['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}setTitle(_0xecdf06,_0x2a3fc3){this['headerTitle']=_0xecdf06,this['headerSubtitle']=_0x2a3fc3||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}showUnsupportedInlineChangeMessage(){this['errorType']='unsupported-inline',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}resetErrorState(){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}setAcceptAllEnabled(_0x1f7843){this['isAcceptAllEnabled']=_0x1f7843;}_createSkeletonLoader(){return new Br(this['locale'],Gr['aiReviewChecks']);}_createCombinedSkeletonLoader(){const _0x38d43e=new _0xfd0945(this['locale']),_0x24d99a=[];for(let _0x3b1aaf=0x0;_0x3b1aaf<0x10;_0x3b1aaf++){const _0x50cd94=this['_createSkeletonLoader']();_0x50cd94['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x24d99a['push'](_0x50cd94);}return _0x38d43e['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x4affa0=>!_0x4affa0)]},'children':_0x24d99a}),_0x38d43e;}_createResultsBodyView(){const _0x2d0382=new _0xfd0945(this['locale']);return _0x2d0382['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x1daeff=>_0x1daeff)]},'children':this['_resultViews']}),_0x2d0382;}_createErrorView(){const _0x413931=new _0xfd0945(this['locale']),_0x29d575=new Bt(this['locale']),t=this['locale']['t'];return _0x413931['delegate']('retryReview')['to'](this),_0x29d575['set']({'label':t('Try\x20again'),'withText':!0x0,'class':er+'\x20ck-ai_review__check-run-error-retry-button'}),_0x29d575['on']('execute',()=>{this['fire']('retryReview');}),_0x413931['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x3b21bd=>!_0x3b21bd),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x4c18b6=>'chunk'===_0x4c18b6)]},'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',_0x306e04=>'chunk'===_0x306e04||'unsupported-inline'===_0x306e04)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x3a995c=>'general'!==_0x3a995c)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x33e9ec=>'chunk'!==_0x33e9ec)]},'children':[{'text':Os(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x17a9ea=>'unsupported-inline'!==_0x17a9ea)]},'children':[{'text':Os(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')}]}]},_0x29d575]}),_0x413931;}_createCancelButtonView(){const _0x47d4f7=new Bt(this['locale']);return _0x47d4f7['set']({'label':Os(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[er+'\x20ck-ai-button-stop-generating'],'icon':st}),_0x47d4f7['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x116bab=>_0x116bab),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4e6a33=>_0x4e6a33)]}}),_0x47d4f7['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x47d4f7;}_createToggleDiffButtonView(){const _0x2049c2=new Bt(this['locale']);_0x2049c2['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x2049c2['bind']('isEnabled')['to'](this,'isError',_0x33e215=>!_0x33e215),_0x2049c2['extendTemplate']({'attributes':{'class':[er,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x20e511=>!_0x20e511),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3a4ec9=>_0x3a4ec9)]}});const _0x6610bb=Os(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x3d8c4d=Os(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x2049c2['bind']('isOn')['to'](this,'isToggleDiffOn',_0x4811e7=>_0x4811e7),_0x2049c2['bind']('icon')['to'](this,'isToggleDiffOn',_0x342a63=>_0x342a63?_0x20e467:_0x4dee8e),_0x2049c2['bind']('label')['to'](this,'isToggleDiffOn',_0x449717=>_0x449717?_0x6610bb:_0x3d8c4d),_0x2049c2['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x2049c2;}_createAcceptAllButtonView(){const _0x3f0152=new Bt(this['locale']);return _0x3f0152['set']({'label':Os(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x3f0152['extendTemplate']({'attributes':{'class':[tr,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5bc06f=>!_0x5bc06f),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x184b32=>_0x184b32)]}}),_0x3f0152['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x3f0152;}_createExitReviewButtonView(){const _0x31d36f=new Bt(this['locale']);return _0x31d36f['set']({'label':Os(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x31d36f['extendTemplate']({'attributes':{'class':[ir,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4e7b7a=>!_0x4e7b7a),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5ec523=>_0x5ec523)]}}),_0x31d36f['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x31d36f;}_createResultHeaderView(){const _0x47c1ed=new _0xfd0945(this['locale']),_0x575b9a=this['_createTitleView']();return _0x47c1ed['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x30b563=>_0x30b563)]},'children':[_0x575b9a,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x126a46=>!_0x126a46)],'title':Os(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Os(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x47c1ed;}_createTitleView(){const _0x2a0752=new _0xfd0945(this['locale']),_0x20892b=new to();return _0x20892b['bind']('isVisible')['to'](this,'isResultReady',_0x2658e9=>!_0x2658e9),_0x2a0752['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x470a6b=>_0x470a6b)]},'children':[_0x20892b,{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-content']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-title']},'children':[{'text':this['bindTemplate']['to']('headerTitle')}]},{'tag':'span','attributes':{'class':['ck-ai_review__check-run-results-header-subtitle']},'children':[{'text':this['bindTemplate']['to']('headerSubtitle')}]}]}]}),_0x2a0752;}_createFinishReviewButtonView(){const _0x35d650=new Gh(Os(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x35d650['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x57b0c9=>!_0x57b0c9)]}}),_0x35d650['delegate']('finishReview')['to'](this),_0x35d650;}},Fh=class extends te{_resultsHeader;_finishReviewButtonView;constructor(_0x42c481,_0x306ea4){super(_0x42c481),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x306ea4['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x306ea4['headerText']);const _0x2c2611=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x2c2611['if']('isVisible','ck-hidden',_0x56ad95=>!_0x56ad95)]},'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':_0x306ea4['emptyResultsText']}]}]}]});}_createFinishReviewButtonView(_0x48d6da){const _0x54d180=new Gh(_0x48d6da,this['locale']);return _0x54d180['delegate']('finishReview')['to'](this),_0x54d180;}_createResultHeaderView(_0x58727f){const _0x24c774=new _0xfd0945(this['locale']);return _0x24c774['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x58727f},'children':[{'text':_0x58727f}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x24c774;}},Wh=class extends _0xfd0945{['_dropdownView'];_defaultValue;_defaultLabel;constructor(_0x1b9537,_0x3a5e2a){super(_0x1b9537),this['_defaultValue']=_0x3a5e2a['default']||(_0x3a5e2a['data']['length']>0x0?_0x3a5e2a['data'][0x0]['id']:''),this['_defaultLabel']=_0x3a5e2a['data']['find'](_0x21780f=>_0x21780f['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x5d526e(this['locale']);const _0x1c1417=this['_prepareListOptions'](_0x3a5e2a['data']);_0x5b9bd6(this['_dropdownView'],_0x1c1417,{'role':'menu','ariaLabel':_0x3a5e2a['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4b25c4=>{_0x4b25c4['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x190ad0=>{this['formValue']=_0x190ad0['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x190ad0['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(_0x382a3b=[]){const _0x824aef=new lt();this['resetToDefault']();for(const _0x90b6f8 of _0x382a3b){const _0x2f6ce3=new _0x115df1({'label':_0x90b6f8['label'],'withText':!0x0,'role':'menuitemradio','id':_0x90b6f8['id'],'model':_0x90b6f8});_0x2f6ce3['bind']('isOn')['to'](this,'formValue',_0x481659=>_0x481659===_0x2f6ce3['id']);const _0x6bd7c4={'type':'button','model':_0x2f6ce3};_0x824aef['add'](_0x6bd7c4);}return _0x824aef;}},$h=class extends te{_formItem=null;constructor(_0x341b35,_0x37e5cd,_0x1a4883){if(super(_0x341b35),this['argsKey']=_0x37e5cd?.['argsKey'],'dropdown'===_0x37e5cd['formType'])this['_formItem']=new Wh(this['locale'],_0x37e5cd);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0xd14200=new qt(this['locale'],{'children':[this['_formItem']],'class':[_0x1a4883?'ck-form__row_with-submit':'']});_0x1a4883&&_0xd14200['children']['add'](_0x1a4883),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0xd14200]});}resetToDefault(){this['_formItem']['resetToDefault']();}},Yh=class AIReviewCorePromptInputView extends _0x52b342{keystrokes;static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x35c4fc){super(_0x35c4fc),this['set']('isEmpty',!0x0),this['keystrokes']=new gt(),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']);}},qh=class extends _0xfd0945{['focusTracker']=new _t();keystrokes=new gt();['focusCycler'];['_focusables']=new _0x353304();submitButtonView;cancelButtonView;promptInputView;actionsFooterView;_modelSelector;['_check'];constructor(_0x24eb26,_0x400606,_0x89d39e=!0x1){super(_0x24eb26),this['_check']=_0x400606,this['set']('prompt',''),this['set']('modelId',''),this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new jt(this['locale'],()=>new Yh(_0x24eb26)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelector']=new Po(_0x24eb26,{'panelPosition':'se','dropdownClass':'ck-ai_review__check-list-item-model-dropdown','nameClass':'ck-ai_review__check-list-item-model-name','itemClasses':{'name':'ck-ai_review__check-list-item-model-dropdown-name','description':'ck-ai_review__check-list-item-model-dropdown-description'}}),this['listenTo'](this['_modelSelector'],'selectModel',(_0x3c7e7a,_0x1fe44c)=>{this['modelId']=_0x1fe44c['id'],this['_modelSelector']['setSelectedModel'](_0x1fe44c);}),this['_setModelList'](_0x89d39e),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new qt(this['locale'],{'children':[this['promptInputView']]}),new qt(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x1aeddd,_0x767acb)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x767acb()):_0x767acb();}),this['focusCycler']=new $t({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelector']['dropdownView'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x537d9b=>{this['_focusables']['add'](_0x537d9b),this['focusTracker']['add'](_0x537d9b['element']);}),this['keystrokes']['listenTo'](this['element']);}resetToDefault(){this['prompt']='',this['modelId']=this['_check']['defaultModel']?.['id']??'',this['_check']['defaultModel']&&this['_modelSelector']['setSelectedModel'](this['_check']['defaultModel']),this['resetFormValidationStatus']();}resetFormValidationStatus(){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x577328 of this['_getFormValidators']()){const _0x530516=_0x577328();if(_0x530516)return this['promptInputView']['errorText']=_0x530516,!0x1;}return!0x0;}_getFormValidators(){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Os(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}_createSubmitButtonView(){const _0x3ee6fa=new Bt(this['locale']),t=this['locale']['t'];return _0x3ee6fa['set']({'label':t('Submit'),'withText':!0x0,'class':tr}),_0x3ee6fa['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x3ee6fa;}_createCancelButtonView(){const _0x55756d=new Bt(this['locale']),t=this['locale']['t'];return _0x55756d['set']({'label':t('Cancel'),'withText':!0x0,'class':ir}),_0x55756d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x374534=>{_0x374534['stopPropagation']();})}}),_0x55756d['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x55756d;}_setModelList(_0x1b67f0){this['_modelSelector']['setModels'](this['_check']['models'],!_0x1b67f0),this['resetToDefault']();}_createActionsFooterView(){const _0x4dfdad=new _0xfd0945(this['locale']);return _0x4dfdad['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelector'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x4dfdad;}},Qh=class extends te{_formItemsCollection=new _0x353304();_customCheckView=null;['_hideModels']=!0x1;constructor(_0x330400,_0xd1d019,_0x224310,_0xc59f92=!0x1){super(_0x330400),this['_hideModels']=_0xc59f92,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0xd1d019['isParameterized']);const _0x81b731=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',_0x532df4=>_0x532df4),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x515197=>_0x515197)],'style':{'--ck-ai-review-check-list-item-index':_0x224310}},'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':_0xd1d019['title']}]},_0x81b731]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0xd1d019['description']?[{'text':_0xd1d019['description']}]:[]}]}]},..._0xd1d019['isParameterized']?[this['_createParameterizedView'](_0xd1d019)]:[],...'custom'===_0xd1d019['id']?[this['_createCustomView'](_0xd1d019,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0xd1d019['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0xd1d019['id'],'args':_0xd1d019['useArgs']?_0xd1d019['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x4f15a2({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}resetToDefault(){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x5f518f=>{_0x5f518f['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}_createIconView(){const _0x2c9515=new Xt();return _0x2c9515['content']=_0x2a0ae6,_0x2c9515['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x2c9515;}_createParameterizedView(_0x4c3a6c){const _0x2b3fd9=new _0xfd0945(),_0x32b3e8=this['_createFormView'](_0x4c3a6c);return _0x2b3fd9['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x57dcd2=>!_0x57dcd2)]},'children':[_0x32b3e8]}),_0x2b3fd9;}_createFormView(_0x306506){const _0x157151=new _0xfd0945(),_0x42bc80=Array['isArray'](_0x306506['options'])?_0x306506['options']:[],_0x50e16d=new Bt(this['locale']),t=this['locale']['t'];_0x50e16d['set']({'label':t('Submit'),'withText':!0x0,'class':tr}),_0x50e16d['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x177263=>{_0x177263['stopPropagation']();})}}),_0x50e16d['on']('execute',()=>{const _0x3cc236=[],_0x3b9f26={};this['_formItemsCollection']['forEach'](_0x3411e4=>{_0x3cc236['push'](_0x3411e4['value']),_0x306506['useArgs']&&_0x306506['options']&&(_0x3b9f26[_0x3411e4['argsKey']]=_0x3411e4['value']);}),this['fire']('runReviewCheck',{'id':_0x306506['id'],'params':_0x3cc236['length']?_0x3cc236:void 0x0,'args':Object['keys'](_0x3b9f26)['length']?_0x3b9f26:void 0x0});});const _0x466649=_0x42bc80['length'];return _0x42bc80['forEach']((_0xb28009,_0x7d569d)=>{const _0x41fe91=_0x7d569d===_0x466649-0x1;this['_formItemsCollection']['add'](new $h(this['locale'],_0xb28009,_0x41fe91?_0x50e16d:null));}),_0x157151['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x157151;}_createCustomView(_0x587d01,_0x46ab1d=!0x1){return this['_customCheckView']=new qh(this['locale'],_0x587d01,_0x46ab1d),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',_0x3493a0=>!_0x3493a0)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x52a4c8,_0xdfca96,_0xe2395a)=>{_0xe2395a||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},Xh=class extends te{['_checkViews'];constructor(_0x4c0a64){super(_0x4c0a64),this['_checkViews']=new _0x353304(),this['_setupTemplate']();}setChecks(_0x1857be,_0x4bdb2b=!0x1){this['_checkViews']['clear']();for(const [_0x2ab138,_0x1bf2f8]of _0x1857be['entries']()){const _0x30dd8e=new Qh(this['locale'],_0x1bf2f8,_0x2ab138,_0x4bdb2b);_0x30dd8e['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x30dd8e);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}resetAllParameterizedChecks(){for(const _0x391576 of this['_checkViews'])_0x391576 instanceof Qh&&_0x391576['resetToDefault']();}_setupTemplate(){const _0x10e0c1=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x10e0c1['if']('isVisible','ck-hidden',_0x3b5f42=>!_0x3b5f42)]},'children':this['_checkViews']});}},zh=class extends Uh{static get['pluginName'](){return'AIReviewModeUI';}createMainView(){const _0x113e2f=this['context']['plugins']['get']('AITabs'),_0x111be0=this['context']['locale'],_0x58b368=new ka(_0x111be0,{'label':Os(_0x111be0,'AI_REVIEW_MODE'),'icon':_0x5684ad,'class':'ck-ai-header_review','showResizeButton':_0x113e2f['showResizeButton']});return _0x58b368['delegate']('resizeTabs')['to'](_0x113e2f),_0x58b368['bind']('isMaximized')['to'](_0x113e2f['view'],'isMaximized',_0x56e26c=>_0x56e26c),new Bh(this['context']['locale'],{'header':_0x58b368,'list':new Xh(_0x111be0),'results':new Kh(_0x111be0,{'generalErrorText':Os(_0x111be0,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Fh(_0x111be0,{'headerText':Os(_0x111be0,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Os(_0x111be0,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Os(_0x111be0,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}registerTab(){const _0x1ac397=this['context']['plugins']['get']('AITabs');_0x1ac397['view']['on']('activateTab',(_0x4dd0aa,{newTab:_0x2e856a,oldTab:_0x5a817c})=>{'reviewMode'===_0x2e856a?this['fire']('getReviewCheckList'):'reviewMode'===_0x5a817c&&this['fire']('leaveReview');}),_0x1ac397['view']['addTab']({'id':'reviewMode','buttonLabel':Os(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x5684ad,'order':0x0,'content':this['_mainView']});}},jh=class extends Yn{_affectedBlocks=[];get affectedBlocks(){return this['_affectedBlocks']['slice']();}set affectedBlocks(_0x48fcd1){this['_affectedBlocks']=_0x48fcd1;}};const Jh='review-',Zh=['softBreak'],tc=['htmlScript','htmlStyle','htmlCustomElement'];var ec=class extends _0x338e6f{static get requires(){return[In,dn];}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();_inlineRootDataIds=new WeakMap();constructor(_0x34525d){super(_0x34525d),this['_domEmitter']=new(ut())(),this['_eventEmitter']=new(dt())();}get emitter(){return this['_eventEmitter'];}afterInit(){const _0x519cef=_0xdce274=>this['_scheduleAttachReviewEditingToEditor'](_0xdce274);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x36c7af)return void _0x519cef(this['context']);const _0x5235c8=this['context'];for(const _0x1e5122 of _0x5235c8['editors'])_0x519cef(_0x1e5122);this['listenTo'](_0x5235c8['editors'],'add',(_0x582cfb,_0x591ffd)=>{_0x519cef(_0x591ffd);}),this['listenTo'](_0x5235c8['editors'],'remove',(_0x106061,_0xedb74f)=>{for(const [_0x13df68,_0x14df76]of this['_markers'])_0x14df76['editor']===_0xedb74f&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x13df68,'changeId':_0x14df76['groupId']}),this['_markers']['delete'](_0x13df68));});}_scheduleAttachReviewEditingToEditor(_0x577308){const _0x364bad=()=>{'destroyed'!==_0x577308['state']&&_0x577308['conversion']&&this['_attachReviewEditingToEditor'](_0x577308);};if('ready'===_0x577308['state'])return void _0x364bad();const _0x102fb1=()=>{this['stopListening'](_0x577308,'ready',_0x102fb1),_0x364bad();};this['listenTo'](_0x577308,'ready',_0x102fb1);}_attachReviewEditingToEditor(_0x4b4c24){this['_reviewEditingAttachedEditors']['has'](_0x4b4c24)||(_0x4b4c24['conversion']['for']('editingDowncast')['markerToElement']({'model':Jh+'insert','view':(_0x2cdb05,{writer:_0x50037a})=>{const _0x706ed8=this['_markers']['get'](_0x2cdb05['markerName']),_0x5e79c2={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x706ed8?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x2cdb05['markerName']};return _0x50037a['createUIElement']('span',_0x5e79c2,function(_0x5d8fcd){const _0x20b749=this['toDomElement'](_0x5d8fcd);return _0x20b749['innerHTML']=_0x706ed8?.['content']?.['asString']||'',_0x20b749;});}}),_0x4b4c24['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Jh+'remove-only','view':_0x15b2a0=>{const _0x66c041=this['_markers']['get'](_0x15b2a0['markerName']),_0x2ce777=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x66c041?.['id']||'')&&_0x2ce777['push']('ck-ai_review__change_active'),{'classes':_0x2ce777,'attributes':{'data-marker-id':_0x15b2a0['markerName']}};}}),_0x4b4c24['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Jh+'remove-context','view':_0x2641e4=>{const _0x41b51a=this['_markers']['get'](_0x2641e4['markerName']),_0x12cb42=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x41b51a?.['id']||'')&&_0x12cb42['push']('ck-ai_review__change_active'),{'classes':_0x12cb42,'attributes':{'data-marker-id':_0x2641e4['markerName']}};}}),_0x4b4c24['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Jh+'remove-text','view':_0x572bc5=>{const _0x3accd9=this['_markers']['get'](_0x572bc5['markerName']),_0x4020b5=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x3accd9?.['id']||'')&&_0x4020b5['push']('ck-ai_review__change_active'),{'classes':_0x4020b5,'attributes':{'data-marker-id':_0x572bc5['markerName']}};}}),_0x4b4c24['conversion']['for']('dataDowncast')['markerToElement']({'model':Jh+'suggestion-context','view':(_0xe91bae,{writer:_0x9c3858})=>_0x9c3858['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0xe91bae['isOpening']?'start':'end')})}),_0x4b4c24['conversion']['for']('downcast')['attributeToAttribute']({'model':gn,'view':An}),this['_updateMouseMarkerInteractionListeners'](_0x4b4c24),this['listenTo'](_0x4b4c24,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x4b4c24),{'priority':'lowest'}),this['listenTo'](_0x4b4c24,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x4b4c24),{'priority':'lowest'}),_0x4b4c24['model']['document']['registerPostFixer'](_0x5c56b7=>this['_validateMarkers'](_0x4b4c24,_0x5c56b7)),_0x4b4c24['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x4b4c24)),this['_reviewEditingAttachedEditors']['add'](_0x4b4c24));}_updateMouseMarkerInteractionListeners(_0x101e1d){let _0x48e997=this['_boundEditables']['get'](_0x101e1d);_0x48e997||(_0x48e997=new Map(),this['_boundEditables']['set'](_0x101e1d,_0x48e997));const _0xbd9e78=new Set(_0x101e1d['ui']['getEditableElementsNames']());for(const _0x4e0664 of _0xbd9e78){if(_0x48e997['has'](_0x4e0664))continue;const _0x421992=_0x101e1d['ui']['getEditableElement'](_0x4e0664);_0x48e997['set'](_0x4e0664,_0x421992),this['_attachMouseMarkerInteractionListeners'](_0x421992);}for(const [_0x430566,_0x3a6e3f]of _0x48e997)_0xbd9e78['has'](_0x430566)||(_0x48e997['delete'](_0x430566),this['_domEmitter']['stopListening'](_0x3a6e3f));}_attachMouseMarkerInteractionListeners(_0x1aa817){this['_domEmitter']['listenTo'](_0x1aa817,'mouseup',(_0x36f60f,_0xc3b42d)=>{const _0x249b4b=_0xc3b42d['target'],_0x4721dd=this['_findMarkerElement'](_0x249b4b);if(!_0x4721dd)return;const _0x4d1a8e=_0x4721dd['getAttribute']('data-marker-id'),_0x364bfd=_0x4d1a8e['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x4d1a8e,'changeId':_0x364bfd,'markerElement':()=>this['_findMarkerElementById'](_0x4d1a8e),'domEvent':_0xc3b42d});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x1aa817,'mouseover',(_0x2ac2a3,_0x437b5f)=>{const _0x5cef12=_0x437b5f['target'],_0x50178d=_0x437b5f['relatedTarget'];let _0x5907a0=this['_findMarkerElement'](_0x5cef12);if(!_0x5907a0&&_0x50178d&&(_0x5907a0=this['_findMarkerElement'](_0x50178d)),!_0x5907a0)return;const _0x5ae5a4=_0x5907a0['getAttribute']('data-marker-id'),_0x410547=_0x5ae5a4['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x410547,'markerElement':()=>this['_findMarkerElementById'](_0x5ae5a4),'domEvent':_0x437b5f});});}_registerGlobalBalloonBlurHandler(){this['_domEmitter']['listenTo'](document,'mouseover',_0x16107c((_0x212443,_0x30bbe4)=>{const _0x51f55a=_0x30bbe4['target'];this['_findMarkerElement'](_0x51f55a)||_0x51f55a['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}getDocumentData(_0x2649b8){const _0x3e625f=this['context']['plugins']['get']('AIEditing'),_0x22bdbb=Ls(this['context']);if(!_0x22bdbb['length'])throw new ct('ai-get-editor-from-context-no-editor',this);const _0x4c7944=_0x2649b8?.['roots'];if(_0x4c7944&&0x0===_0x4c7944['length'])throw new ct('ai-reviewcoreediting-empty-roots',this);const _0x23f084=_0x4c7944?new Set(_0x4c7944['map'](_0x15b8d2=>_0x15b8d2['channelId']+'\x00'+_0x15b8d2['rootName'])):null,_0x35adce=_0x23f084?new Set():null,_0x1e8147=new Set(),_0xd386cb=[],_0x31bbda=new Map(),_0x3022ef=[];for(const _0x1a86e1 of _0x22bdbb){const _0x44c54b=_0x1a86e1['config']['get']('collaboration.channelId');for(const _0x235d60 of _0x1a86e1['model']['document']['getRoots']()){const _0x5aa78c=_0x44c54b+'\x00'+_0x235d60['rootName'];if(_0x23f084&&!_0x23f084['has'](_0x5aa78c))continue;const _0x42544d=this['_buildDocumentDataSliceForRoot'](_0x1a86e1,_0x235d60,_0x3e625f,_0x1e8147);_0xd386cb['push'](_0x42544d['content']);for(const [_0x316792,_0x3ed026]of _0x42544d['elements'])_0x31bbda['set'](_0x316792,_0x3ed026);_0x3022ef['push']({'channelId':_0x44c54b,'rootName':_0x235d60['rootName']}),_0x35adce?.['add'](_0x5aa78c);}}if(_0x4c7944&&_0x35adce['size']!==_0x23f084['size']){const _0x24a03a=_0x4c7944['find'](_0x54f8ca=>!_0x35adce['has'](_0x54f8ca['channelId']+'\x00'+_0x54f8ca['rootName']));throw new ct('ai-reviewcoreediting-root-not-found',this,{'channelId':_0x24a03a['channelId'],'rootName':_0x24a03a['rootName']});}return{'elements':_0x31bbda,'content':_0xd386cb['join'](''),'roots':_0x3022ef};}async['runCheck'](_0x643115,_0x31ff11){const _0x165f46=new Qn(),_0x26ea16=_0x31ff11?.['signal'];let _0x1a7887;const _0x4bf748=()=>{_0x165f46['abort'](),_0x643115['abort']();};if(_0x26ea16){if(_0x26ea16['aborted'])return _0x4bf748(),_0x165f46;_0x26ea16['addEventListener']('abort',_0x4bf748),_0x1a7887=()=>_0x26ea16['removeEventListener']('abort',_0x4bf748);}const _0x5ed11f={'apiId':_0x643115['sourceCheck']['apiId']};try{_0x643115['on']('reviewCheckRunUpdated',(_0x223baf,_0x5298ca)=>{'aborted'===_0x5298ca['status']?_0x165f46['abort']():'error-general'!==_0x5298ca['status']&&'error-chunk'!==_0x5298ca['status']||(_0x165f46['error']=$n(_0x5298ca['error'],'ai-reviewcoreediting-check-run-failed',this,_0x5ed11f));}),'aborted'!==_0x165f46['status']&&await _0x643115['start']();}catch(_0xfccc15){_0x165f46['error']=$n(_0xfccc15,'ai-reviewcoreediting-check-run-failed',this,_0x5ed11f);}finally{_0x1a7887&&_0x1a7887();}return'error'===_0x165f46['status']||'aborted'===_0x165f46['status']||(_0x165f46['addResult'](...this['_buildPerRootResults'](_0x643115)),_0x165f46['status']='completed'),_0x165f46;}buildErrorContext(_0x170382){return{'apiId':_0x170382['sourceCheck']['apiId']};}_buildPerRootResults(_0x46acef){const _0x467a79=this['buildErrorContext'](_0x46acef),_0x4c9af7=this['context']['plugins']['get']('AIEditing'),_0x3cc503=this['context']['plugins']['get']('AIGateway'),_0x20ce74=this['_groupElementsByRoot'](_0x46acef['documentData']['elements']),_0x4ae0a2=new Map();for(const _0x28522f of Ls(this['context']))_0x4ae0a2['set'](_0x28522f['config']['get']('collaboration.channelId'),_0x28522f);return _0x46acef['documentData']['roots']['map'](({channelId:_0x7498b7,rootName:_0x38a8cc})=>{const _0x2a5f65=_0x4ae0a2['get'](_0x7498b7),_0x17a3d6=new jh({'editor':_0x2a5f65,'rootName':_0x38a8cc,'channelId':_0x7498b7,'sessionId':_0x4c9af7['getSessionId'](_0x2a5f65)}),_0x2e2450=_0x20ce74['get'](_0x17a3d6['editor'])?.['get'](_0x17a3d6['rootName'])??[];_0x17a3d6['contentRawOld']=_0x2e2450['map'](_0x11f80a=>_0x11f80a['getContent']())['join'](''),_0x17a3d6['documentVersion']=_0x2e2450[0x0]?.['documentVersion']??0x1;const _0x58aedf=this['_collectResultAffectedBlocks'](_0x17a3d6,_0x46acef['results'],_0x46acef['documentData']['elements']);_0x17a3d6['affectedBlocks']=_0x58aedf;try{_0x17a3d6['contentRawNew']=Hs(_0x3cc503['mergeChangesIntoContent'](_0x58aedf,_0x17a3d6['contentRawOld'],_0x17a3d6['editor']));}catch(_0x40b3cc){_0x17a3d6['error']=$n(_0x40b3cc,'ai-reviewcoreediting-check-run-failed',this,_0x467a79);}return _0x17a3d6;});}_collectResultAffectedBlocks(_0x57b561,_0x23a793,_0x3ee33f){return _0x23a793['filter'](_0x26c682=>{const _0x53e3af=_0x3ee33f['get'](_0x26c682['id']);return!!_0x53e3af&&_0x53e3af['editor']===_0x57b561['editor']&&_0x53e3af['rootName']===_0x57b561['rootName'];})['map'](_0x328936=>({'id':_0x328936['id'],'content':_0x328936['contentNew']}));}_groupElementsByRoot(_0x424a05){const _0x159680=new Map();for(const _0x58273a of _0x424a05['values']()){let _0x57cbc1=_0x159680['get'](_0x58273a['editor']);_0x57cbc1||(_0x57cbc1=new Map(),_0x159680['set'](_0x58273a['editor'],_0x57cbc1));let _0x46c51b=_0x57cbc1['get'](_0x58273a['rootName']);_0x46c51b||(_0x46c51b=[],_0x57cbc1['set'](_0x58273a['rootName'],_0x46c51b)),_0x46c51b['push'](_0x58273a);}return _0x159680;}_buildDocumentDataSliceForRoot(_0x498bfb,_0x3741ce,_0x51810f,_0x32c939){const _0x318b9b=_0x498bfb['model'],_0x1cdbff=new _0x332f21();for(const _0x49f4e0 of _0x3741ce['getChildren']())_0x1cdbff['_appendChild'](_0x49f4e0['_clone'](!0x0));for(const _0x4f65ca of _0x318b9b['markers']){const _0x6c8191=_0x4f65ca['getRange']();_0x6c8191&&_0x6c8191['root']['rootName']===_0x3741ce['rootName']&&_0x1cdbff['markers']['set'](_0x4f65ca['name'],this['_changeRangeOwnerDocument'](_0x6c8191['clone'](),_0x1cdbff));}const _0x1fe0df=new Map(),_0x13a631=_0x318b9b['document']['version'];if(zs(_0x498bfb,_0x3741ce['rootName'])){let _0x372ceb=this['_inlineRootDataIds']['get'](_0x3741ce);_0x372ceb?_0x32c939['add'](_0x372ceb):(_0x372ceb=_0x51810f['_nextDataId'](_0x32c939),this['_inlineRootDataIds']['set'](_0x3741ce,_0x372ceb));const _0x4ca987=js(_0x498bfb['data']['processor']['toData'](_0x498bfb['data']['toView'](_0x1cdbff)),_0x372ceb);return _0x1fe0df['set'](_0x372ceb,{'editor':_0x498bfb,'rootName':_0x3741ce['rootName'],'path':[],'documentVersion':_0x13a631,'getContent':()=>_0x4ca987}),{'content':_0x4ca987,'elements':_0x1fe0df};}const _0x42ced9=new _0x59cde9({'ignoreElementEnd':!0x0,'startPosition':_0x318b9b['createPositionAt'](_0x1cdbff,0x0)});for(const {item:_0xf13a6c}of _0x42ced9){if(_0xf13a6c['is']('element')&&_0xf13a6c['name']&&tc['includes'](_0xf13a6c['name'])){const _0x52c789=this['_upsertDataId'](_0xf13a6c,()=>_0x51810f['_nextDataId'](_0x32c939));_0x32c939['add'](_0x52c789);}if(!_0xf13a6c['is']('$textProxy'))continue;const _0x36db6a=_0xf13a6c['parent'];if(!_0x36db6a||!_0x36db6a['is']('element'))continue;const _0xbddfd8=this['_upsertDataId'](_0x36db6a,()=>_0x51810f['_nextDataId'](_0x32c939));_0x32c939['add'](_0xbddfd8);for(const _0x2249cc of _0x36db6a['getChildren']())_0x2249cc['is']('element')&&(_0x2249cc['name']&&Zh['includes'](_0x2249cc['name'])||_0x32c939['add'](this['_upsertDataId'](_0x2249cc,()=>_0x51810f['_nextDataId'](_0x32c939))));let _0x2fa52d=_0x36db6a;for(;_0x2fa52d['parent']&&!_0x2fa52d['parent']['is']('documentFragment');)_0x2fa52d=_0x2fa52d['parent'],_0x2fa52d['hasAttribute']('$elementId')&&_0x2fa52d['_removeAttribute'](gn);_0x1fe0df['set'](_0xbddfd8,{'editor':_0x498bfb,'rootName':_0x3741ce['rootName'],'path':_0x36db6a['getPath'](),'documentVersion':_0x13a631,'getContent':this['_createGetContentUsingDataIdFn'](_0x2fa52d['_clone'](!0x0),_0xbddfd8,_0x498bfb['data'])}),_0x42ced9['jumpTo'](_0x318b9b['createPositionAfter'](_0x36db6a));}return{'content':_0x498bfb['data']['processor']['toData'](_0x498bfb['data']['toView'](_0x1cdbff)),'elements':_0x1fe0df};}diffContent(_0x3475f1,_0x282913,_0x1aa94d,_0x30ca3c=!0x1){const {contentInitial:_0x246828,contentNew:_0xe1cba2}=this['_neutralizeChangesOnUnsupportedElements'](_0x282913,_0x1aa94d),_0x1758b4=[],_0x3b695c=_0x3475f1['data']['parse'](_0xe1cba2,'$documentFragment'),_0x1786a3=_0x3475f1['data']['parse'](_0x246828,'$documentFragment'),_0x232f5e=_0x3475f1['model']['createPositionAt'](_0x1786a3,0x0);if(this['_haveSingleTopLevelElement'](_0x3b695c)){if(!this['_hasSameTopLevelElement'](_0x1786a3,_0x3b695c))return _0x1758b4;}else{const _0x518971=_0x3475f1['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x1786a3,_0x518971)||!this['_haveOnlyInlineContent'](_0x3b695c,_0x518971))return _0x1758b4;}const _0x2f936c=this['context']['plugins']['get']('DocumentChanges')['getDiff'](_0x246828,_0xe1cba2,{'targetEditor':_0x3475f1,'anchor':_0x232f5e,'markDeletions':!0x0})['filter'](_0x4e5e68=>'insert'===_0x4e5e68['type']||'marker'===_0x4e5e68['type']&&_0x4e5e68['name']['startsWith']('$markedRemove')),_0x3a954e=this['_groupAdjacentOperations'](_0x2f936c),_0x1b1a7c=[];if(_0x30ca3c){if(_0x3a954e['length']){const _0x4d101d=_0x3a954e[0x0]['operations'][0x0],_0x5cc2fd='insert'===_0x4d101d['type']?_0x4d101d['position']:_0x4d101d['newRange']['start'],_0x126a91=this['_getPositionLimitingRange'](_0x5cc2fd,_0x3475f1,'inside'),_0x1302db=_0x126a91?_0x3b695c['getChild'](0x0)['getChildren']():_0x3b695c['getChildren'](),_0x53846e=_0x126a91||_0x3475f1['model']['createRangeIn'](_0x1786a3),_0x58b514=[new _0x8c29f8('$markedRemove:synthetic'+xt(),null,_0x53846e,_0x3475f1['model']['document']['model']['markers'],!0x0,_0x3475f1['model']['document']['version']+0x1),new _0x942e3b(_0x53846e['end'],_0x1302db,_0x3475f1['model']['document']['version']+0x2)];_0x1b1a7c['push']({'operations':_0x58b514,'operationsIsolated':_0x58b514,'groupOffset':0x0});}}else _0x1b1a7c['push'](..._0x3a954e);let _0x3e9ced=0x0;return _0x3475f1['model']['change'](_0x3e9436=>{for(let _0x844f31=0x0;_0x844f31<_0x1b1a7c['length'];_0x844f31++){const _0x51a390=_0x1b1a7c[_0x844f31],_0x366cc5=_0x3e9436['createDocumentFragment']();for(const _0xd68231 of _0x1786a3['getChildren']())_0x3e9436['append'](_0xd68231['_clone'](!0x0),_0x366cc5);for(const _0x1f551e of _0x51a390['operationsIsolated'])if('insert'===_0x1f551e['type']){const _0x3c54fc=_0x1f551e;_0x3c54fc['baseVersion']=null,_0x3c54fc['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x3c54fc,_0x366cc5),_0x3e9436['batch']['addOperation'](_0x1f551e),_0x3475f1['model']['applyOperation'](_0x1f551e);const _0x2a9eb6='suggestion:insertion:id:authorId:'+_0x3e9ced++,_0x34f8f2=_0x3475f1['model']['createRange'](_0x3c54fc['position'],_0x3c54fc['position']['getShiftedBy'](_0x3c54fc['howMany']));_0x366cc5['markers']['set'](_0x2a9eb6,_0x34f8f2);}else{if('marker'===_0x1f551e['type']&&_0x1f551e['name']['startsWith']('$markedRemove')){const _0x411483=_0x1f551e,_0x1a804c='suggestion:deletion:id:authorId:'+_0x3e9ced++;this['_changeOperationOwnerDocument'](_0x411483,_0x366cc5),_0x366cc5['markers']['set'](_0x1a804c,_0x411483['newRange']);}}if(_0x30ca3c)_0x1758b4['push']({..._0x51a390,'context':this['_createGetContentFn'](_0x1786a3,_0x3475f1['data']),'content':this['_createGetContentFn'](_0x1786a3,_0x3475f1['data'])});else{const _0x34cfa9=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x51a390['operationsIsolated'][0x0]),_0x366cc5),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x51a390['operationsIsolated'][_0x51a390['operationsIsolated']['length']-0x1]),_0x366cc5),_0x3475f1);_0x366cc5['markers']['set'](Jh+'suggestion-context',new _0x5708b2(_0x34cfa9['start'],_0x34cfa9['end'])),_0x1758b4['push']({..._0x51a390,'context':this['_createGetContextFn'](_0x366cc5,_0x3475f1['data'],{'ellipsisBefore':_0x34cfa9['hasContentBefore'],'ellipsisAfter':_0x34cfa9['hasContentAfter']}),'content':this['_createGetContentFn'](_0x366cc5,_0x3475f1['data'])});}}}),_0x1758b4;}markChangePositionInEditorContent(_0xefeb92,_0x52be24){if(!_0xefeb92['length'])return;const _0x25d490=_0xefeb92[0x0]['parent']['id'],_0x4cfe3b=_0x52be24['elements']['get'](_0x25d490);if(!_0x4cfe3b)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x25d490);const _0x4ca140=_0x4cfe3b['path'],_0x160112=_0x4cfe3b['editor'],_0x11cfb4=_0x160112['model']['document']['getRoot'](_0x4cfe3b['rootName']);if(!_0x11cfb4)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x4cfe3b['rootName']);const _0x4210b1=_0x160112['model']['document']['history']['getOperations'](_0x4cfe3b['documentVersion']),_0x5108b8=[];for(const _0x2e676c of _0xefeb92){const _0x2c2128=_0x2e676c['operationsIsolated']['map'](_0x2b99ff=>this['_translateOperationToEditorContent'](_0x2b99ff,_0x4ca140,_0x11cfb4));if(!_0x2c2128||!_0x2c2128['length'])continue;const _0x2bb2d3=_0x2c2128['every'](_0x43e1ee=>'marker'===_0x43e1ee['type']&&_0x43e1ee['name']['startsWith']('$markedRemove')),_0x5a625c={'document':_0x160112['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x8c40a2=_0x3ceee1(_0x2c2128,_0x4210b1,_0x5a625c)['operationsA'];for(const _0x3e7f03 of _0x8c40a2)if('insert'===_0x3e7f03['type']){const _0x3d5504=_0x3e7f03,_0x20082c=_0x3d5504['nodes'];_0x160112['model']['change'](_0x1e5f54=>{const _0x2390ac=_0x1e5f54['createDocumentFragment']();for(const _0x4debb2 of _0x20082c)_0x1e5f54['append'](_0x4debb2['_clone'](!0x0),_0x2390ac);_0x5108b8['push']({'start':_0x3d5504['position'],'end':_0x3d5504['position'],'type':'insert','groupId':_0x2e676c['id'],'content':{'asString':this['_createGetContentFn'](_0x2390ac,_0x160112['data'])(),'asFragment':_0x2390ac}});});}else{if('marker'===_0x3e7f03['type']&&_0x3e7f03['name']['startsWith']('$markedRemove')){const _0xd5140c=_0x3e7f03;let _0x20d36d='remove-text';if(_0x2bb2d3){const _0x38d855=this['_findAdjacentContextDistance'](_0xd5140c['newRange']['start'],'backward',_0x160112['model']['schema']),_0x4a5a27=this['_findAdjacentContextDistance'](_0xd5140c['newRange']['end'],'forward',_0x160112['model']['schema']);if(_0x38d855||_0x4a5a27){const _0x5d7415=_0xd5140c['newRange']['start']['getShiftedBy'](-_0x38d855),_0x135ec5=_0xd5140c['newRange']['end']['getShiftedBy'](_0x4a5a27);_0x5108b8['push']({'start':_0x5d7415,'end':_0x135ec5,'groupId':_0x2e676c['id'],'type':'remove-context'});}else _0x20d36d='remove-only';}_0x5108b8['push']({'start':_0xd5140c['newRange']['start'],'end':_0xd5140c['newRange']['end'],'groupId':_0x2e676c['id'],'type':_0x20d36d});}}}this['_insertMarkers'](_0x5108b8,_0x160112);}['clearAllMarkers'](){const _0xecc6aa=new Map();for(const _0x6ed8f2 of this['_markers']['keys']()){const _0x7f1513=this['_markers']['get'](_0x6ed8f2);_0x7f1513?.['editor']&&(_0xecc6aa['has'](_0x7f1513['editor'])||_0xecc6aa['set'](_0x7f1513['editor'],[]),_0xecc6aa['get'](_0x7f1513['editor'])['push'](_0x6ed8f2));}for(const [_0x57121f,_0xc0f766]of _0xecc6aa)_0x57121f['model']['change'](_0x454703=>{for(const _0x2fb455 of _0xc0f766)_0x57121f['model']['markers']['get'](_0x2fb455)&&_0x454703['removeMarker'](_0x2fb455);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}switchToReadOnly(){for(const _0x5514be of this['getEditors']())_0x5514be['enableReadOnlyMode']('ai-review');}switchToEdit(){for(const _0x50efaa of this['getEditors']())_0x50efaa['disableReadOnlyMode']('ai-review');}['applyChange'](_0x32e876,_0x168b86=null){const _0x255c0b=_0x32e876['map'](_0x10303d=>this['_getMarkersDataForGroup'](_0x10303d))['flat'](),_0x4da284=new Map();for(const _0x517954 of _0x255c0b)_0x4da284['has'](_0x517954['editor'])||_0x4da284['set'](_0x517954['editor'],[]),_0x4da284['get'](_0x517954['editor'])['push'](_0x517954);for(const [_0x54e5f8,_0x1b7642]of _0x4da284){const _0x1a0736=_0x54e5f8['model'],_0x12d23f=_0x54e5f8['plugins']['has']('TrackChangesEditing')?_0x54e5f8['plugins']['get']('TrackChangesEditing'):null,_0x27f068=_0x168b86&&_0x12d23f?new Set(_0x12d23f['getSuggestions']()['map'](_0x2ae266=>_0x2ae266['id'])):null;_0x1a0736['change'](_0x77d35b=>{const _0x16b870=_0x77d35b['batch']['operations']['length'];for(const _0x38fdd4 of _0x1b7642){const _0x3d99ab=_0x54e5f8['model']['markers']['get'](_0x38fdd4['id']);if(_0x3d99ab){if('insert'===_0x38fdd4['type']){if(!_0x38fdd4['content'])continue;_0x1a0736['insertContent'](_0x38fdd4['content']['asFragment']||null,_0x3d99ab['getRange']()['start']);}else'remove-text'!==_0x38fdd4['type']&&'remove-only'!==_0x38fdd4['type']||_0x1a0736['deleteContent'](_0x1a0736['createSelection'](_0x3d99ab['getRange']()));_0x77d35b['removeMarker'](_0x38fdd4['id']),this['_markers']['delete'](_0x38fdd4['id']);}}if(_0x168b86&&(Mn(_0x77d35b['batch']['operations']['slice'](_0x16b870),_0x168b86),_0x12d23f)){for(const _0x3e2aba of _0x12d23f['getSuggestions']())_0x27f068['has'](_0x3e2aba['id'])||_0x3e2aba['setAttribute']('@ai',{'type':_0x168b86});}});}}rejectChange(_0x5449d9){const _0x39e63a=this['_getMarkersDataForGroup'](_0x5449d9),_0x83c48c=new Map();for(const _0x1d14dc of _0x39e63a)_0x83c48c['has'](_0x1d14dc['editor'])||_0x83c48c['set'](_0x1d14dc['editor'],[]),_0x83c48c['get'](_0x1d14dc['editor'])['push'](_0x1d14dc);for(const [_0x529520,_0x5ad370]of _0x83c48c)_0x529520['model']['change'](_0x32924b=>{for(const _0x2e3552 of _0x5ad370)_0x32924b['removeMarker'](_0x2e3552['id']),this['_markers']['delete'](_0x2e3552['id']);});}getEditor(){return Ds(this['context']);}getEditors(){return Ls(this['context']);}getEditorForChange(_0x99236c){return this['_getMarkersDataForGroup'](_0x99236c)[0x0]?.['editor'];}getMarkerElementForChange(_0x4b5132){const _0x1ee177=Array['from'](this['_markers']['values']())['filter'](_0x2df590=>_0x2df590['groupId']===_0x4b5132);if(!_0x1ee177['length'])return null;const _0x13c177=0x1===_0x1ee177['length']?_0x1ee177[0x0]:this['_sortMarkers'](_0x1ee177)[0x0],_0x2537b5=_0x13c177['editor']['model']['markers']['get'](_0x13c177['id']);return _0x2537b5?{'modelRange':_0x2537b5['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x13c177['id'])}:null;}getContentElementForChange(_0x521f0f){const _0x190652=Array['from'](this['_markers']['values']())['filter'](_0x11e44a=>_0x11e44a['groupId']===_0x521f0f);if(!_0x190652['length'])return null;const _0x46e439=0x1===_0x190652['length']?_0x190652[0x0]:this['_sortMarkers'](_0x190652)[0x0],_0x1ba604=_0x46e439['editor'],_0x264473=_0x1ba604['model']['markers']['get'](_0x46e439['id']);if(!_0x264473)return null;const _0x1b1e84=_0x264473['getRange'](),_0x5da7e2=_0x1ba604['editing']['view']['getDomRoot'](_0x1b1e84['root']['rootName'])||_0x1ba604['editing']['view']['getDomRoot']();if(!_0x5da7e2||!_0x1b1e84)return null;let _0xd47ff7=_0x1b1e84['start']['parent'];for(;_0xd47ff7['parent']&&!_0xd47ff7['parent']['is']('rootElement');)_0xd47ff7=_0xd47ff7['parent'];if(!_0xd47ff7||!_0xd47ff7['name'])return null;const _0x42c863=_0x5da7e2['querySelector']('[data-marker-id=\x22'+_0x46e439['id']+'\x22]');if(!_0x42c863)return null;if(_0xd47ff7['is']('rootElement'))return _0x42c863;let _0x1b10b1=null;_0x1ba604['model']['change'](_0x4e8494=>{_0x1b10b1=_0x4e8494['createDocumentFragment'](),_0x4e8494['append'](_0xd47ff7['_clone'](!0x0),_0x1b10b1);});const _0x2ad381=_0x1ba604['data']['toView'](_0x1b10b1)['getChild'](0x0);return _0x42c863['closest'](_0x2ad381['name']);}reactivateMarkers(_0xac0a6c){const _0x4440be=this['_getMarkersDataForGroup'](_0xac0a6c);if(!_0x4440be['length'])return;const _0x3aef51=Array['from'](this['_activeMarkers'])['sort'](),_0x403c4b=Array['from'](new Set(_0x4440be['map'](_0x5685e2=>_0x5685e2['id'])))['sort']();_0x3aef51['join']('|')!==_0x403c4b['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0xac0a6c));}setMarkersInElementAsActive(_0x583490){const _0x36826e=this['_getMarkersDataForGroup'](_0x583490);if(!_0x36826e['length'])return;const _0x236115=_0x36826e[0x0]['editor'],_0x230d69=new Set(_0x36826e['map'](_0x5bbf69=>_0x5bbf69['id'])),_0x18381d=Array['from'](_0x230d69['values']())['map'](_0x217a57=>_0x236115['model']['markers']['get'](_0x217a57))['filter'](_0x6837d4=>!!_0x6837d4);_0x230d69['forEach'](_0x26698d=>{this['_activeMarkers']['add'](_0x26698d);}),_0x236115['model']['change'](()=>{_0x18381d['forEach'](_0x578169=>{_0x236115['editing']['reconvertMarker'](_0x578169);});});}setAllMarkersAsInactive(){const _0x3ef3a4=Array['from'](this['_activeMarkers']);if(!_0x3ef3a4['length'])return;this['_activeMarkers']['clear']();const _0x55c8ec=new Map();for(const _0x2c1b41 of _0x3ef3a4){const _0x277234=this['_markers']['get'](_0x2c1b41);if(!_0x277234)continue;const _0x1ded15=_0x277234['editor'],_0x25bec9=_0x1ded15['model']['markers']['get'](_0x2c1b41);_0x25bec9&&(_0x55c8ec['has'](_0x1ded15)||_0x55c8ec['set'](_0x1ded15,[]),_0x55c8ec['get'](_0x1ded15)['push'](_0x25bec9));}for(const [_0x3faa81,_0x193293]of _0x55c8ec)_0x3faa81['model']['change'](()=>{_0x193293['forEach'](_0xce3960=>{_0x3faa81['editing']['reconvertMarker'](_0xce3960);});});}_getPositionLimitingRange(_0xb902c3,_0x30ef2b,_0x3838bc='outside'){if(!_0xb902c3)return null;let _0x47e1ae=_0xb902c3['parent'];for(;_0x47e1ae&&_0x47e1ae['parent']&&!_0x47e1ae['parent']['is']('rootElement')&&!_0x30ef2b['model']['schema']['isLimit'](_0x47e1ae)&&!_0x30ef2b['model']['schema']['isBlock'](_0x47e1ae);)_0x47e1ae=_0x47e1ae['parent'];if(!_0x47e1ae||!_0x47e1ae['name']||_0x47e1ae['is']('rootElement'))return null;let _0x16613a=null;return _0x30ef2b['model']['change'](_0x2305b2=>{_0x16613a='inside'===_0x3838bc?_0x2305b2['createRangeIn'](_0x47e1ae):_0x2305b2['createRangeOn'](_0x47e1ae);}),_0x16613a;}_validateMarkers(_0x2b6092,_0x52d382){const _0x19a218=Array['from'](this['_markers']['keys']()),_0x33c21c=new Map();for(const _0x38dea2 of _0x19a218){const _0x574698=_0x2b6092['model']['markers']['get'](_0x38dea2);if(!_0x574698)continue;const _0x49a063=_0x574698['getStart']()['root']['rootName']+':'+_0x574698['getStart']()['path'][0x0];_0x33c21c['has'](_0x49a063)||_0x33c21c['set'](_0x49a063,[]),_0x33c21c['get'](_0x49a063)['push'](_0x574698);}const _0x5b58b5=new Set();for(const _0x541551 of _0x2b6092['model']['document']['differ']['getChanges']()){let _0x29aa36,_0x58f6db;if('insert'===_0x541551['type'])_0x58f6db=new _0x5708b2(_0x541551['position'],_0x541551['position']['getShiftedBy'](_0x541551['length'])),_0x29aa36=_0x541551['position']['root']['rootName']+':'+_0x541551['position']['path'][0x0];else{if('remove'!==_0x541551['type'])continue;_0x58f6db=new _0x5708b2(_0x541551['position']),_0x29aa36=_0x541551['position']['root']['rootName']+':'+_0x541551['position']['path'][0x0];}const _0x15b765=_0x33c21c['get'](_0x29aa36)||[];if(_0x15b765['length']){for(const _0x2c6bcf of _0x15b765)if(_0x58f6db['root']['rootName']===_0x2c6bcf['getRange']()['root']['rootName']&&('insert'!==_0x541551['type']||!_0x58f6db['containsRange'](_0x2c6bcf['getRange']()))&&(_0x58f6db['isIntersecting'](_0x2c6bcf['getRange']())||_0x58f6db['start']['isTouching'](_0x2c6bcf['getRange']()['end'])||_0x58f6db['end']['isTouching'](_0x2c6bcf['getRange']()['start']))){const _0x39be02=this['_parseMarkerName'](_0x2c6bcf['name']);Array['from'](this['_markers']['values']())['filter'](_0x5b35d0=>_0x5b35d0['groupId']===_0x39be02['groupId'])['forEach'](_0x25ac54=>_0x5b58b5['add'](_0x25ac54['id']));}}}if(_0x5b58b5['size']){for(const _0x407dc8 of _0x5b58b5)_0x52d382['removeMarker'](_0x407dc8);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x192eae){for(const {name:_0x2897bc,data:_0xc69e0a}of _0x192eae['model']['document']['differ']['getChangedMarkers']()){if(!_0x2897bc['startsWith'](Jh))continue;const _0x5cbc3c=_0xc69e0a['oldRange'],_0x59db52=_0xc69e0a['newRange'],_0x79f852=_0x5cbc3c&&'$graveyard'===_0x5cbc3c['root']['rootName'],_0x52e20c=_0x59db52&&'$graveyard'===_0x59db52['root']['rootName'];if(_0x79f852&&_0x52e20c)continue;const _0x12e77e=this['_parseMarkerName'](_0x2897bc);this['_markers']['get'](_0x2897bc)&&(_0x52e20c||!_0x59db52?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x2897bc,'changeId':_0x12e77e['groupId']}):_0x79f852&&_0x59db52&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x2897bc,'changeId':_0x12e77e['groupId']}));}}['_parseMarkerName'](_0x3f4239){const _0x5eb4e2=_0x3f4239['split'](':'),_0x479249=(_0x5eb4e2[0x1]||'')['split']('_');return{'prefix':_0x5eb4e2[0x0],'groupId':_0x479249[0x0],'suffix':_0x479249[0x1]};}_translateOperationToEditorContent(_0x3f1614,_0xdf2988,_0x3f4ec8){if('insert'===_0x3f1614['type']){const _0x14ab4d=_0x3f1614;return new _0x942e3b(this['_changePosition'](_0xdf2988['concat'](_0x14ab4d['position']['offset']),_0x3f4ec8),_0x14ab4d['nodes'],_0x14ab4d['baseVersion']);}if('marker'===_0x3f1614['type']&&_0x3f1614['name']['startsWith']('$markedRemove')){const _0x38514d=_0x3f1614;return new _0x8c29f8(_0x38514d['name'],_0x38514d['oldRange'],this['_changeRange'](_0x38514d['newRange'],_0xdf2988['concat'](_0x38514d['newRange']['start']['offset']),_0xdf2988['concat'](_0x38514d['newRange']['end']['offset']),_0x3f4ec8),_0x38514d['_markers'],_0x38514d['affectsData'],_0x38514d['baseVersion']);}return _0x3f1614;}_groupAdjacentOperations(_0x125562){if(!_0x125562['length'])return[];const _0x1457ea=[];let _0x2efe51=0x0,_0x1ae53a=0x0,_0x5635e6=[];for(let _0x1c6d4f=0x0;_0x1c6d4f<=_0x125562['length'];_0x1c6d4f++){const _0x4d4cae=_0x125562[_0x1c6d4f],_0x44f2ba=_0x125562[_0x1c6d4f-0x1];!_0x4d4cae||_0x44f2ba&&!this['_getOperationEnd'](_0x44f2ba)['isTouching'](this['_getOperationStart'](_0x4d4cae))?(_0x1457ea['push']({'operations':_0x5635e6,'operationsIsolated':_0x5635e6['map'](_0x3b693b=>this['_shiftOperation'](_0x3b693b['clone'](),-_0x1ae53a)),'groupOffset':_0x2efe51}),_0x5635e6=_0x4d4cae?[_0x4d4cae]:[],_0x1ae53a+=_0x2efe51,_0x2efe51=0x0):_0x5635e6['push'](_0x4d4cae),_0x4d4cae&&'insert'===_0x4d4cae['type']&&(_0x2efe51+=_0x4d4cae['howMany']);}return _0x1457ea;}_findAdjacentContextDistance(_0x10131,_0x12e5d5,_0x361c41,_0x416ded=0x1){const _0x5145c6=new _0x59cde9({'startPosition':_0x10131,'direction':_0x12e5d5});let _0x148c64=0x0;for(let _0x4ea77c=0x0;_0x4ea77c<_0x416ded;_0x4ea77c++){let _0x2fccfb=0x0,_0x94e1fa=!0x1,_0x1f6425='forward'===_0x12e5d5?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x55cf80}of _0x5145c6)if(_0x55cf80['is']('$textProxy')){const _0x176b96=_0x1f6425['exec'](_0x55cf80['data']);if(_0x176b96&&_0x176b96['length']){if(_0x2fccfb+='forward'===_0x12e5d5?_0x176b96['index']+_0x176b96[0x0]['length']:_0x55cf80['data']['length']-_0x176b96['index'],_0x176b96[0x0]['length']!==_0x55cf80['data']['length'])break;_0x94e1fa=!0x0,_0x1f6425='forward'===_0x12e5d5?/^\w+/:/\w+$/;}else{if(_0x94e1fa)break;_0x2fccfb+=_0x55cf80['offsetSize'];}}else{if(_0x55cf80['is']('element')){_0x361c41['isInline'](_0x55cf80)&&!_0x94e1fa&&(_0x2fccfb+=0x1);break;}}_0x148c64+=_0x2fccfb,_0x5145c6['jumpTo'](_0x10131['getShiftedBy']('forward'===_0x12e5d5?_0x148c64:-_0x148c64));}return _0x148c64;}_getChangeContext(_0x4b831c,_0xe07838,_0x20428c){const _0x4da4cd=_0x20428c['model']['schema'],_0x3517ba=this['_findAdjacentContextDistance'](_0x4b831c,'backward',_0x4da4cd,0x6),_0x570ff2=this['_findAdjacentContextDistance'](_0xe07838,'forward',_0x4da4cd,0x6),_0x48b7e4=_0x4b831c['getShiftedBy'](-_0x3517ba),_0x2c95de=_0xe07838['getShiftedBy'](_0x570ff2);return{'start':_0x48b7e4,'end':_0x2c95de,'hasContentBefore':!_0x48b7e4['isAtStart'],'hasContentAfter':!_0x2c95de['isAtEnd']};}_insertMarkers(_0x317800,_0x40f221){const _0x238809=this['context']['plugins']['get']('AIEditing'),_0x36dd2c=new Set();_0x40f221['model']['change'](_0x3b4d7c=>{for(const _0x3f928b of _0x317800){const _0x1b995c=''+Jh+_0x3f928b['type']+':'+_0x3f928b['groupId']+'_'+_0x238809['_nextDataId'](_0x36dd2c);this['_markers']['set'](_0x1b995c,{'id':_0x1b995c,'groupId':_0x3f928b['groupId'],'type':_0x3f928b['type'],'content':_0x3f928b['content'],'editor':_0x40f221}),_0x3b4d7c['addMarker'](_0x1b995c,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x3b4d7c['createRange'](_0x3f928b['start'],_0x3f928b['end'])});}});}_createGetContextFn(_0x244183,_0x1cde32,_0x319c88){let _0x37edb3='';return()=>{if(!_0x37edb3){const _0xb2bd55=_0x1cde32['toView'](_0x244183,{'showSuggestionHighlights':!0x0});let _0x5b3f14=_0xb2bd55['getChild'](0x0);if(_0x5b3f14['is']('containerElement')||(_0x5b3f14=_0xb2bd55),!_0x5b3f14)return'';let _0x5d1d01=!0x1;const _0x18d301=[];for(const _0x43f08e of _0x5b3f14['getChildren']())_0x43f08e['is']('element','span')&&_0x43f08e['hasClass']('ck-ai_review-marker_context-end')&&(_0x5d1d01=!0x1),_0x5d1d01&&_0x18d301['push'](_0x43f08e),_0x43f08e['is']('element','span')&&_0x43f08e['hasClass']('ck-ai_review-marker_context-start')&&(_0x5d1d01=!0x0);_0x5b3f14['_removeChildren'](0x0,_0x5b3f14['childCount']),_0x319c88?.['ellipsisBefore']&&_0x5b3f14['_appendChild']('…'),_0x5b3f14['_appendChild'](_0x18d301),_0x319c88?.['ellipsisAfter']&&_0x5b3f14['_appendChild']('…');const _0x415ade=_0x1cde32['htmlProcessor']['domConverter']['viewToDom'](_0xb2bd55),_0x32f2a6=_0x1cde32['htmlProcessor']['htmlWriter']['getHtml'](_0x415ade);_0x37edb3=this['_removeUnsupportedElements'](_0x32f2a6);}return _0x37edb3;};}_createGetContentFn(_0x5eba6f,_0x4b611e){let _0x1c0dbc='';return()=>(_0x1c0dbc||(_0x1c0dbc=this['_removeUnsupportedElements'](_0x4b611e['stringify'](_0x5eba6f,{'showSuggestionHighlights':!0x0}))),_0x1c0dbc);}_createGetContentUsingDataIdFn(_0x4d5086,_0x1164ab,_0x482a52){let _0x42a15e='';return()=>{if(!_0x42a15e){const _0x118bdd=_0x482a52['toView'](new _0x332f21(_0x4d5086));_0x42a15e=_0x482a52['htmlProcessor']['domConverter']['viewToDom'](_0x118bdd)['querySelector']('[data-id=\x22'+_0x1164ab+'\x22]')?.['outerHTML']||'';}return _0x42a15e;};}_removeUnsupportedElements(_0x28f18f){if(!_0x28f18f)return'';const _0x47a995=Ps(_0x28f18f,{'decodeEntities':!0x1}),_0x209f96=Vs(_0x47a995);if(!_0x209f96['length'])return _0x28f18f;for(const _0x302407 of _0x209f96)_0x3339cd(_0x302407);return Hs(_0x47a995,{'encodeEntities':!0x1});}_neutralizeChangesOnUnsupportedElements(_0x40b632,_0x409766){const _0x6c4243=Ps(_0x40b632,{'decodeEntities':!0x1}),_0x1141dc=Ps(_0x409766,{'decodeEntities':!0x1}),_0x2613bf=Vs(_0x6c4243),_0x1f3ebb=Vs(_0x1141dc);if(!_0x2613bf['length']&&!_0x1f3ebb['length'])return{'contentInitial':_0x40b632,'contentNew':_0x409766};const _0x409a45=new Map(),_0x31ec0e=new Map();for(const _0x43a54e of _0x2613bf){const _0xafc586=Fs(_0x43a54e,'data-id');if(_0xafc586)_0x409a45['set'](_0xafc586,_0x43a54e);else{const _0x4deb7c=Hs(_0x43a54e,{'encodeEntities':!0x1}),_0x59b9f6=_0x31ec0e['get'](_0x4deb7c);_0x59b9f6?_0x59b9f6['push'](_0x43a54e):_0x31ec0e['set'](_0x4deb7c,[_0x43a54e]);}}for(const _0x380ae0 of _0x1f3ebb){const _0x4068ea=Fs(_0x380ae0,'data-id');let _0x491440;if(_0x4068ea)_0x491440=_0x409a45['get'](_0x4068ea);else{const _0x3e4f80=_0x31ec0e['get'](Hs(_0x380ae0,{'encodeEntities':!0x1}));_0x491440=_0x3e4f80&&_0x3e4f80['length']?_0x3e4f80['shift']():void 0x0;}_0x491440?_0x22ab5c(_0x380ae0,_0x4f309c(_0x491440,!0x0)):_0x3339cd(_0x380ae0);}return{'contentInitial':Hs(_0x6c4243,{'encodeEntities':!0x1}),'contentNew':Hs(_0x1141dc,{'encodeEntities':!0x1})};}_findMarkerElement(_0x322740,_0x409631=0x5){let _0x20587e=_0x322740,_0x28a14c=null;for(let _0x5ac62c=0x0;_0x5ac62c<_0x409631&&_0x20587e;_0x5ac62c++)if(_0x20587e['className']){if((''+_0x20587e['className'])['includes']('ck-ai_review-marker_')){if(!_0x20587e['getAttribute']('data-marker-id'))break;_0x28a14c=_0x20587e;break;}_0x20587e=_0x20587e['parentElement'];}else _0x20587e=_0x20587e['parentElement'];return _0x28a14c;}_findMarkerElementById(_0x5ee2a8){const _0x5bb661=this['_markers']['get'](_0x5ee2a8);if(!_0x5bb661)return null;const _0xc654fa=_0x5bb661['editor']['model']['markers']['get'](_0x5ee2a8);return _0xc654fa?_0x1bc72f(_0x5bb661['editor']['editing'],_0xc654fa):null;}_getMarkersDataForGroup(_0x51ca64){return Array['from'](this['_markers']['values']())['filter'](_0x15f174=>_0x15f174['groupId']===_0x51ca64);}_getOperationStart(_0xcd1ac4){return'insert'===_0xcd1ac4['type']?_0xcd1ac4['position']:_0xcd1ac4['newRange']['start'];}_getOperationEnd(_0x17a282,_0x3093d3=!0x1){return'insert'===_0x17a282['type']?_0x3093d3?_0x17a282['position']:_0x17a282['position']['getShiftedBy'](_0x17a282['howMany']):_0x17a282['newRange']['end'];}_shiftOperation(_0x3d04ec,_0xb76180){return'insert'===_0x3d04ec['type']?_0x3d04ec['position']=_0x3d04ec['position']['getShiftedBy'](_0xb76180):'marker'===_0x3d04ec['type']&&_0x3d04ec['newRange']&&(_0x3d04ec['newRange']=new _0x5708b2(_0x3d04ec['newRange']['start']['getShiftedBy'](_0xb76180),_0x3d04ec['newRange']['end']['getShiftedBy'](_0xb76180))),_0x3d04ec;}_changeOperationOwnerDocument(_0x129b66,_0x262a23){'insert'===_0x129b66['type']?_0x129b66['position']=this['_changePositionOwnerDocument'](_0x129b66['position'],_0x262a23):'marker'===_0x129b66['type']&&_0x129b66['newRange']&&(_0x129b66['newRange']=this['_changeRangeOwnerDocument'](_0x129b66['newRange'],_0x262a23));}_changePositionOwnerDocument(_0x2f4a77,_0x24e5f9){return new _0x41b2e6(_0x24e5f9,_0x2f4a77['path']);}_changeRangeOwnerDocument(_0x213ed7,_0x3466d5){return new _0x5708b2(this['_changePositionOwnerDocument'](_0x213ed7['start'],_0x3466d5),this['_changePositionOwnerDocument'](_0x213ed7['end'],_0x3466d5));}_changePosition(_0x9548b6,_0x258d5e){return new _0x41b2e6(_0x258d5e,[..._0x9548b6]);}['_changeRange'](_0x3c8b32,_0xa37f41,_0x33bfe8,_0x14f9ed){return new _0x5708b2(this['_changePosition'](_0xa37f41,_0x14f9ed),this['_changePosition'](_0x33bfe8,_0x14f9ed));}_sortMarkers(_0x1813e7){const _0x50f6da=_0x288810=>{switch(_0x288810){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x1813e7['sort']((_0x12c63f,_0x4f9495)=>_0x50f6da(_0x12c63f['type'])-_0x50f6da(_0x4f9495['type']));}_hasSameTopLevelElement(_0x4b2974,_0x54a1f8){const _0x2af8b7=_0x4b2974['getChild'](0x0),_0x295c53=_0x54a1f8['getChild'](0x0);return!(!_0x2af8b7||!_0x295c53)&&((!_0x2af8b7['is']('element')||!_0x295c53['is']('element')||_0x2af8b7['name']===_0x295c53['name'])&&!(_0x2af8b7['is']('element')&&!_0x295c53['is']('element')||!_0x2af8b7['is']('element')&&_0x295c53['is']('element')));}_haveSingleTopLevelElement(_0x11166a){return 0x1===_0x11166a['childCount'];}_haveOnlyInlineContent(_0x56d453,_0x70cd21){for(const _0xa267f9 of _0x56d453['getChildren']())if(_0xa267f9['is']('element')&&!_0x70cd21['isInline'](_0xa267f9))return!0x1;return!0x0;}_upsertDataId(_0x5e752b,_0x54d997){let _0x55cf49=_0x5e752b['getAttribute'](gn);return _0x55cf49||(_0x55cf49=_0x54d997(),_0x5e752b['_setAttribute'](gn,_0x55cf49)),_0x55cf49;}};const ic=/* #__PURE__ -- @preserve */
38
+ dt();var sc=class extends ic{['id'];contentNew;contentInitial;documentVersion;constructor({id:_0x4ee264,contentNew:_0x357ac7,contentInitial:_0x568353,documentVersion:_0x34b581}){super(),this['id']=_0x4ee264,this['contentNew']=_0x357ac7,this['contentInitial']=_0x568353,this['documentVersion']=_0x34b581;}};const nc=/* #__PURE__ -- @preserve */
39
+ At();var rc=class extends nc{['id'];parent;editor;_data;_editorOperations=[];constructor(_0x4e3f83,_0x35343d,_0x356928,_0x2811e7){super(),this['id']=_0x4e3f83,this['parent']=_0x356928,this['editor']=_0x2811e7,this['_data']=_0x35343d,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']['wrapperTag']?function(_0xd99690){const _0x51abe6=Ps(_0xd99690)['children']['filter'](_0x5ebc36);return 0x1!==_0x51abe6['length']?_0xd99690:_0x51abe6[0x0]['children']['map'](_0x6d9261=>Hs(_0x6d9261))['join']('');}(this['_data']['context']()):this['_data']['context']();}get['wrapperTag'](){return this['_data']['wrapperTag'];}get operations(){return this['_data']['operations']['slice']();}get operationsIsolated(){return this['_data']['operationsIsolated']['slice']();}};const oc=/* #__PURE__ -- @preserve */
40
+ At();var ac=class extends oc{['id']=xt();['callId'];_results=new Map();['_changes']=[];_hasUnsupportedInlineChange=!0x1;['_sourceCheck'];_documentData;_aiConnector;['_reviewParams'];['_reviewArgs'];_context;_activeRequest=null;_currentError;_wasAborted=!0x1;constructor(_0x3b4aa6,_0x18b4e5,_0x5a39aa,_0x2af441,_0x35ecf2,_0x1772cb=new Wn()){super(),this['_sourceCheck']=_0x18b4e5,this['_documentData']=_0x3b4aa6,this['_aiConnector']=_0x5a39aa,this['_reviewParams']=_0x2af441,this['_reviewArgs']=_0x35ecf2,this['_context']=_0x1772cb,this['on']('change:status',(_0x4cde5e,_0x227a2b,_0x1ab9e8)=>{'aborted'==_0x1ab9e8&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x1ab9e8,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get documentData(){return this['_documentData'];}get['sourceCheck'](){return this['_sourceCheck'];}get processedResultsCount(){return this['_results']['size'];}get hasUnsupportedInlineChange(){return this['_hasUnsupportedInlineChange'];}get title(){return this['_sourceCheck']['title'];}get subTitle(){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get hasModifications(){return!this['_changes']['every'](_0x31e4f8=>'pending'===_0x31e4f8['status']);}get currentError(){return this['_currentError'];}get results(){return Array['from'](this['_results']['values']());}updateDocumentData(_0x377819){this['_documentData']=_0x377819;}async start(){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x164041=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x40c047 of _0x164041)'unmodified'!==_0x40c047['data']['operation']&&('error'!==_0x40c047['data']['operation']?'review-metadata'!==_0x40c047['event']?this['_addReviewCheckResult'](_0x40c047['data']['dataId'],_0x40c047['data']['textDelta']):this['callId']=_0x40c047['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(_0x199da7){this['_currentError']=_0x199da7,zn(_0x199da7)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async restart(){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,this['_hasUnsupportedInlineChange']=!0x1,await this['start']();}addResultChanges(_0x41123b,_0x5d7be6){const _0x2227c9=this['_results']['get'](_0x41123b);if(!_0x2227c9)return;if(0x0===_0x5d7be6['length'])return;const _0x298a80=this['_documentData']['elements']['get'](_0x41123b);if(!_0x298a80)return;const _0x4c1572=[];_0x5d7be6['forEach']((_0x24c3b0,_0x5d4ee1)=>{const _0x37724d=new rc(_0x2227c9['id']+'-'+_0x5d4ee1,_0x24c3b0,_0x2227c9,_0x298a80['editor']);_0x37724d['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x37724d,'status':_0x37724d['status']});}),_0x37724d['on']('change:isActivated',()=>{_0x37724d['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x37724d}):this['fire']('reviewCheckResultDeactivated',{'change':_0x37724d});}),this['_changes']['push'](_0x37724d),_0x4c1572['push'](_0x37724d);}),this['fire']('reviewCheckResultReady',{'changes':_0x4c1572,'result':_0x2227c9,'source':this});}abort(){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}isChangeActive(_0x5b92c){const _0xb0fb75=this['_changes']['find'](_0x411718=>_0x411718['id']===_0x5b92c);return!(!_0xb0fb75||'pending'!==_0xb0fb75['status']);}isAnyChangeActivated(){return this['_changes']['some'](_0x24e897=>!0x0===_0x24e897['isActivated']);}getActiveChanges(){return this['_changes']['filter'](_0x3891e2=>'pending'===_0x3891e2['status']);}getChangeById(_0x41d2ff){return this['_changes']['find'](_0x250bb6=>_0x250bb6['id']===_0x41d2ff);}markAllChangesAsAccepted(){for(const _0x15b01b of this['_changes'])'pending'===_0x15b01b['status']&&(_0x15b01b['status']='accepted');this['_checkIfFinished']();}markChangeAsAccepted(_0x90da01){const _0x5e5df2=this['_changes']['find'](_0x549f2c=>_0x549f2c['id']===_0x90da01);_0x5e5df2&&'pending'===_0x5e5df2['status']&&(_0x5e5df2['status']='accepted'),this['_checkIfFinished']();}markChangeAsRejected(_0x8cd6cd){const _0x2f2cab=this['_changes']['find'](_0x405e81=>_0x405e81['id']===_0x8cd6cd);_0x2f2cab&&'pending'===_0x2f2cab['status']&&(_0x2f2cab['status']='rejected'),this['_checkIfFinished']();}markChangeAsOutdated(_0x4385b2){const _0x3f4ea9=this['_changes']['find'](_0x1af016=>_0x1af016['id']===_0x4385b2);_0x3f4ea9&&'pending'===_0x3f4ea9['status']&&(_0x3f4ea9['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x2ce92a){const _0x3fe9b2=this['_changes']['find'](_0x41abc5=>_0x41abc5['id']===_0x2ce92a);_0x3fe9b2&&'outdated'===_0x3fe9b2['status']&&(_0x3fe9b2['status']='pending'),this['_checkIfFinished']();}activateChange(_0x5c3781){this['_changes']['filter'](_0x43adf2=>_0x43adf2['isActivated']&&_0x43adf2['id']!==_0x5c3781)['forEach'](_0x5664c4=>{_0x5664c4['isActivated']=!0x1;});const _0x536f04=this['_changes']['find'](_0x585621=>_0x585621['id']===_0x5c3781);_0x536f04&&'pending'===_0x536f04['status']&&(_0x536f04['isActivated']=!0x0);}deactivateChange(){this['_changes']['filter'](_0x4fba88=>_0x4fba88['isActivated'])['forEach'](_0x5647ba=>{_0x5647ba['isActivated']=!0x1;});}forceReadyState(){this['status']='ready';}async sendRating(_0xab98a){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x2ac9f5;if(_0xab98a){const _0x19badb=this['_changes']['find'](_0x41f73c=>_0x41f73c['id']===_0xab98a);if(_0x19badb&&_0x19badb['isRated'])return;_0x19badb&&(_0x2ac9f5=_0x19badb['parent']['id'],_0x19badb['isRated']=!0x0);}const _0x429402={'positiveCount':this['_changes']['filter'](_0x5cdd81=>'accepted'===_0x5cdd81['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x429402,this['callId'],_0x2ac9f5);}_addReviewCheckResult(_0x290846,_0x205cf6){const _0x3f7f82=this['_documentData']['elements']['get'](_0x290846);if(!_0x3f7f82)return;if(zs(_0x3f7f82['editor'],_0x3f7f82['rootName'])&&!tn(_0x3f7f82['editor'],Ps(_0x205cf6)))return void(this['_hasUnsupportedInlineChange']=!0x0);const _0x374ba3=_0x3f7f82['getContent']();if(_0x374ba3===_0x205cf6)return;const _0x564ebf=new sc({'id':_0x290846,'contentInitial':_0x374ba3,'contentNew':_0x205cf6,'documentVersion':_0x3f7f82['documentVersion']});this['_results']['set'](_0x564ebf['id'],_0x564ebf),this['fire']('reviewCheckResultAdded',{'result':_0x564ebf,'source':this,'editor':_0x3f7f82['editor'],'rootName':_0x3f7f82['rootName']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x4736d2=>'pending'===_0x4736d2['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x667339=>'pending'===_0x667339['status'])['length']&&(this['status']='finished');}},hc=class extends ac{get subTitle(){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x594f3a=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x599db0=0x0;_0x599db0<this['_reviewParams']['length'];_0x599db0++){if(!this['_reviewParams'][_0x599db0]||!this['_sourceCheck']['options'][_0x599db0])continue;const _0x22e965=this['_sourceCheck']['options'][_0x599db0]['data']?.['find'](_0x3c8296=>_0x3c8296['id']===this['_reviewParams'][_0x599db0]);_0x22e965&&_0x594f3a['push'](_0x22e965['label']);}return _0x594f3a['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}_createApiRequest(){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs'],'contexts':this['_context']['toRequestContexts']()});}_sendRatingRequest(_0x1c2640,_0x4b05fd,_0x4055f8){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x4b05fd,_0x1c2640,_0x4055f8);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},cc=class extends _0x338e6f{_aiConnector;['_aiReviewCoreUi'];_aiReviewCoreEditing;['_availableReviewChecks'];_reporter;_currentReviewCheckRun;_changeActivationSource=null;static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['_initRequiredPlugins'](),this['_initAvailableReviewChecks'](),this['_initUIListeners']();}async _initAvailableReviewChecks(){this['_availableReviewChecks']=await this['_getReviewChecks'](),this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}_initUIListeners(){this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_availableReviewChecks']&&this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',(_0x35d6e2,_0x252c29)=>this['runCheck'](_0x252c29)),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 _0x458e65=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x458e65['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x458e65['map'](_0xee57ae=>_0xee57ae['id']),this['_aiSource']);const _0x2a203f=this['_currentReviewCheckRun'];_0x2a203f['markAllChangesAsAccepted'](),_0x2a203f['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x579824,_0x284766)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x284766['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x284766['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x284766['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x284766['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x797a61,_0x5180f0)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x5180f0['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x5180f0['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x5180f0['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x5180f0['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x541c14,_0x4aa85e)=>{this['_onActivateChange'](_0x4aa85e);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x1a6ba4,_0x3d1373)=>{this['_onDeactivateChange'](_0x3d1373);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x558008,_0x592edd)=>{this['_onChangeMarkerClicked'](_0x558008,_0x592edd);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x595f60,_0x1b30b5)=>{this['_onChangeMarkerHovered'](_0x595f60,_0x1b30b5);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x4afe25,_0x4653e8)=>{this['_onChangeMarkerRemoved'](_0x4afe25,_0x4653e8);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x228307,_0x4aa01f)=>{this['_onChangeMarkerRestored'](_0x228307,_0x4aa01f);});}async['runCheck'](_0x563923){if(!this['_availableReviewChecks'])return;const _0x30c311=this['_availableReviewChecks']['find'](_0x2b9b33=>_0x2b9b33['id']===_0x563923['id']);if(!_0x30c311)return void this['_logError'](new ct('ai-review-mode-source-check-not-found',this,{'checkId':_0x563923['id']}));this['_onReviewCheckRun'](_0x563923),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_aiReviewCoreUi']['setAcceptAllEnabled'](!0x1);const _0x179660=this['context']['plugins']['get'](xs)['contextLibrary']['resolveContext']({'feature':this['_defaultContextFeature'],'ids':[_0x563923['id']],'context':new Wn()});this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x563923,_0x30c311,_0x179660);const _0x3c05d2=this['_currentReviewCheckRun'];_0x3c05d2['on']('reviewCheckResultChangeStatusUpdated',(_0x4f9ec8,_0x466ae8)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x466ae8['change']['id'],_0x466ae8['status']),this['_pushAcceptAllEnabled'](_0x3c05d2);}),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x40807c,_0xaa6b82)=>{switch(_0xaa6b82['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0xaa6b82);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_currentReviewCheckRun']?.['hasUnsupportedInlineChange']?this['_aiReviewCoreUi']['showUnsupportedInlineChangeView']():this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ct('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ct('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'!==_0xaa6b82['status']&&'error-chunk'!==_0xaa6b82['status']&&'error-general'!==_0xaa6b82['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x281204,_0x2a9515)=>{if(!this['_currentReviewCheckRun'])throw new ct('ai-review-mode-no-current-check-run',this);const _0x8abda1=zs(_0x2a9515['editor'],_0x2a9515['rootName']);let _0x41f6b1=_0x2a9515['result']['contentInitial'],_0x2226aa=_0x2a9515['result']['contentNew'];_0x8abda1&&(_0x41f6b1=Zs(_0x41f6b1),_0x2226aa=Zs(_0x2226aa));const _0x5d7130=this['_diffContent'](_0x2a9515['editor'],_0x41f6b1,_0x2226aa);if(_0x8abda1){const _0x1e793c=_0x2a9515['editor']['ui']['getEditableElement'](_0x2a9515['rootName'])?.['tagName']['toLowerCase']();for(const _0x38b937 of _0x5d7130)_0x38b937['wrapperTag']=_0x1e793c;}_0x2a9515['source']['addResultChanges'](_0x2a9515['result']['id'],_0x5d7130);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x567cb3,_0x189ac0)=>{for(const _0x3ea936 of _0x189ac0['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x3ea936);this['_pushAcceptAllEnabled'](_0x189ac0['source']),this['_markChangePositionInEditorContent'](_0x189ac0['changes'],_0x189ac0['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x27aa46,_0xd60991)=>{this['_onReviewCheckResultActivated'](_0xd60991);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x4368d7){if(zn(_0x4368d7))return;_0x4368d7 instanceof ct?this['_logError'](_0x4368d7):this['_logError'](new ct('ai-review-mode-check-run-failed',this,void 0x0,_0x4368d7));}}abort(){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}getAvailableChecks(){return(this['_availableReviewChecks']??[])['slice']();}getCurrentCheckRun(){return this['_currentReviewCheckRun'];}_pushAcceptAllEnabled(_0xec71bc){this['_aiReviewCoreUi']['setAcceptAllEnabled'](_0xec71bc['getActiveChanges']()['length']>0x0);}_createReviewCheckRun(_0x2ea54a,_0x19e46f,_0x3d2d52=new Wn()){return new hc(this['_aiReviewCoreEditing']['getDocumentData'](),_0x19e46f,this['_aiConnector'],_0x2ea54a['params'],_0x2ea54a['args'],_0x3d2d52);}['_onChangeMarkerRemoved'](_0x54085a,_0x168b94){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x168b94['changeId']);}_onChangeMarkerRestored(_0x2e0da3,_0x2c3ddc){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x2c3ddc['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}_initRequiredPlugins(){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](Jn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x1f3156=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x1f3156&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x5325e8 of this['_aiReviewCoreEditing']['getEditors']())_0x5325e8['editing']['view']['change'](_0x1b872c=>{for(const _0xf9bd05 of _0x5325e8['editing']['view']['document']['getRoots']())_0x1b872c['removeClass']('ck-ai_review-diff',_0xf9bd05),_0x1b872c['removeClass']('ck-ai_review-highlights',_0xf9bd05),_0x1b872c['removeClass']('ck-ai-translate-mode-content',_0xf9bd05);});}['_logError'](_0x5ed8dc){this['_reporter']['logError'](_0x5ed8dc),'ai-review-mode-models-unable-to-retrieve'===function(_0x54c82a){return _0x54c82a instanceof jn?_0x54c82a['code']:_0x54c82a instanceof Error?_0x54c82a['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x5ed8dc)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0xa74a57){if('content'===this['_changeActivationSource']){const _0x13611d=this['_aiReviewCoreUi']['getChangeElement'](_0xa74a57);_0x13611d&&yt(_0x13611d['closest']('.ck-ai_review__check-run-result')||_0x13611d);}else{if('panel'===this['_changeActivationSource']){const _0x19c9e2=this['_getChangeContentElement'](_0xa74a57);if(!_0x19c9e2)return;kt({'target':_0x19c9e2,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},lc=class extends ac{_prompt;['_model'];constructor(_0x55a0fb,_0x4b71bd,_0x28a1b3,_0x1d93e5,_0x14cfcc,_0x22a96){super(_0x28a1b3,_0x1d93e5,_0x14cfcc,void 0x0,void 0x0,_0x22a96),this['_prompt']=_0x55a0fb,this['_model']=_0x4b71bd;}get subTitle(){return this['_prompt']??'';}_createApiRequest(){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],...void 0x0!==this['_prompt']&&{'prompt':this['_prompt']},'model':this['_model'],'contexts':this['_context']['toRequestContexts']()});}_sendRatingRequest(_0x423d4f,_0x1d6619,_0x280c41){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x1d6619,_0x423d4f,_0x280c41);}},uc=class{['id'];['commandId'];title;description;isParameterized;['useArgs'];options;['args'];get['apiId'](){return this['commandId'];}constructor(_0x4accd0){this['id']=_0x4accd0['id'],this['commandId']=_0x4accd0['commandId'],this['title']=_0x4accd0['title'],this['description']=_0x4accd0['description'],this['isParameterized']=_0x4accd0['isParameterized'],this['useArgs']=_0x4accd0['useArgs'],this['options']=_0x4accd0['options'],this['args']=_0x4accd0['args'];}},dc=class extends uc{isExtra=!0x0;prompt;context;['model'];_defaultModel=null;constructor(_0xd00fda,_0x1c9d38,_0x3d7e9d){super(_0xd00fda),this['prompt']=_0xd00fda['prompt'],this['context']=_0xd00fda['context'],this['model']=_0xd00fda['model'],this['model']?this['_defaultModel']=_0x1c9d38['find'](_0x1b6cff=>_0x1b6cff['id']===this['model'])||null:this['_defaultModel']=_0x3d7e9d;}get defaultModel(){return this['_defaultModel'];}},_c=class extends lc{get subTitle(){return'';}set prompt(_0x5c3b01){this['_prompt']=_0x5c3b01;}set['model'](_0x1c2016){this['_model']=_0x1c2016;}},gc=class extends _0x338e6f{static get requires(){return[Ss,Jn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];_reporter;init(){this['_reporter']=this['context']['plugins']['get'](Jn)['createReporter']('aireview');}getChecksList(){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const Ac=[{'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'}]}]}],Ic=/* #__PURE__ -- @preserve */
41
+ At();var pc=class extends Ic{['_checks']=[];setupChecks(_0x11d108){this['_checks']=_0x11d108['map'](_0x890c9d=>new uc(_0x890c9d));}get['checks'](){return this['_checks']['slice']();}getCheckById(_0x1f1a25){return this['checks']['find'](_0x90598e=>_0x90598e['id']===_0x1f1a25);}['removeCheckById'](_0x4d8869){this['_checks']=this['_checks']['filter'](_0x4fc9a6=>_0x4fc9a6['id']!==_0x4d8869);}},mc=class extends uc{['_models']=[];_defaultModel=null;constructor(_0x25d873,_0x53df09,_0x2ca284){super(_0x25d873),this['_models']=_0x53df09,this['_defaultModel']=_0x2ca284;}get['models'](){return this['_models']['slice']();}get defaultModel(){return this['_defaultModel'];}},Ec=class extends pc{['_allModels']=[];['_recommendedModels']=[];_defaultModel=null;constructor(_0x40c321,_0x1031d9,_0x2ff27f){super(),this['_allModels']=_0x40c321,this['_recommendedModels']=_0x1031d9,this['_defaultModel']=_0x2ff27f;}get['allModels'](){return this['_allModels']['slice']();}setupChecks(_0x68fd5e){this['_checks']=_0x68fd5e['map'](_0x2712a9=>!0x0===_0x2712a9['isExtra']?new dc(_0x2712a9,this['_allModels'],this['_defaultModel']):'custom'===_0x2712a9['id']?new mc(_0x2712a9,this['_recommendedModels'],this['_defaultModel']):new uc(_0x2712a9));}},wc=class extends gc{static get['pluginName'](){return'AIReviewModeCheckRegistry';}static get requires(){return[Ss,Jn,xs];}['_modelsLoadError']=null;constructor(_0x3aff52){super(_0x3aff52),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}getExtraChecks(){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x11088a=>({'id':_0x11088a['id'],'commandId':_0x11088a['id'],'title':_0x11088a['label'],'description':_0x11088a['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x11088a['prompt'],'context':_0x11088a['context'],'model':_0x11088a['model']}));}async _loadChecksList(){const _0x19d557=[...Ac,...this['getExtraChecks']()]['map'](_0x3de567=>_0x3de567['isExtra']?_0x3de567:this['_translateReviewCheck'](_0x3de567)),_0x449f20=this['context']['plugins']['get'](xs);let _0x5898cb;try{_0x5898cb=new Ec(await _0x449f20['models']['getAllModels'](),await _0x449f20['models']['getAvailableModels'](),await _0x449f20['models']['getDefault']()),this['_modelsLoadError']=null;}catch(_0x46e299){this['_modelsLoadError']=new ct('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x46e299),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),_0x5898cb=new Ec([],[],null);}return _0x5898cb['setupChecks'](_0x19d557),_0x5898cb;}_translateReviewCheck(_0x460e3e){const _0x4992e2='AI_REVIEW_CHECK_'+_0x460e3e['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x4ea9b2={..._0x460e3e,'title':this['_translate'](_0x4992e2+'_TITLE',_0x460e3e['title']),'description':this['_translate'](_0x4992e2+'_DESCRIPTION',_0x460e3e['description'])};return _0x460e3e['options']&&(_0x4ea9b2['options']=_0x460e3e['options']['map'](_0x3a0289=>({..._0x3a0289,'label':this['_translate'](_0x4992e2+'_OPTIONS_LABEL',_0x3a0289['label']||''),'data':_0x3a0289['data']?_0x3a0289['data']['map'](_0xec016d=>({..._0xec016d,'label':this['_translate'](_0x4992e2+'_OPTIONS_DATA_'+_0xec016d['id']['toUpperCase'](),_0xec016d['label'])})):void 0x0}))),_0x4ea9b2;}_translate(_0x310d84,_0x36e24f){const _0x466607=Os(this['context']['locale'],_0x310d84);return _0x466607===_0x310d84?_0x36e24f:_0x466607;}},Tc=class extends cc{static get['pluginName'](){return'AIReviewModeController';}static get requires(){return[Jn,wc,xs];}get['_aiSource'](){return'review';}get _defaultContextFeature(){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x524c96){super(_0x524c96),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Ac['map'](_0x264027=>_0x264027['id']));}init(){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x15e79f,_0xdbd236)=>{this['_isDiffOn']=_0xdbd236['on'],this['_onDiffChange'](this['_isDiffOn']);});}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x1c2e68,_0x32b145,_0x42d40e=new Wn()){if(_0x1c2e68['isCustom'])return new lc(_0x1c2e68['args']['prompt'],_0x1c2e68['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x32b145,this['_aiConnector'],_0x42d40e);if(_0x32b145['isExtra']){const _0x464022=_0x32b145,_0x5b4e2c=_0x464022['context']?_0x42d40e['cloneWith'](_0x464022['context']):_0x42d40e;return new _c(_0x1c2e68['args']?.['prompt']??_0x464022['prompt'],_0x1c2e68['args']?.['model']??_0x464022['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x32b145,this['_aiConnector'],_0x5b4e2c);}return new hc(this['_aiReviewCoreEditing']['getDocumentData'](),_0x32b145,this['_aiConnector'],_0x1c2e68['params'],_0x1c2e68['args'],_0x42d40e);}_onReviewCheckResultActivated(_0x18cce5){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x18cce5['change']['id']),this['_scrollToChange'](_0x18cce5['change']['id']);const _0x17032e=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x18cce5['change']['id']);if(!_0x17032e)return;const _0x3d143a=this['_aiReviewCoreEditing']['getEditorForChange'](_0x18cce5['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x18cce5['change'],()=>_0x17032e['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x3d143a,_0x17032e['modelRange']['root']['rootName']),_0x3d143a?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x18cce5['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}_onActivateChange(_0x442154){this['_currentReviewCheckRun']&&'click'===_0x442154['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x442154['id']));}_onDeactivateChange(_0x41f3be){this['_currentReviewCheckRun']&&'balloon'===_0x41f3be['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x22d6be,_0x4b9516){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x4b9516['changeId']);const _0x287afd=this['_currentReviewCheckRun']['getChangeById'](_0x4b9516['changeId']);if(!_0x287afd)return;const _0x37fa64=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x4b9516['changeId']),_0x49e9e5=this['_aiReviewCoreEditing']['getEditorForChange'](_0x4b9516['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x287afd,_0x4b9516['markerElement'],_0x4b9516['domEvent'],'click',this['_getBalloonDomRoot'](_0x49e9e5,_0x37fa64?.['modelRange']['root']['rootName']),_0x49e9e5?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x1935e2,_0x4344c8){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x10da5f=this['_currentReviewCheckRun']['getChangeById'](_0x4344c8['changeId']);if(!_0x10da5f)return;const _0x58720b=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x4344c8['changeId']),_0x237138=this['_aiReviewCoreEditing']['getEditorForChange'](_0x4344c8['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x10da5f,_0x4344c8['markerElement'],_0x4344c8['domEvent'],'hover',this['_getBalloonDomRoot'](_0x237138,_0x58720b?.['modelRange']['root']['rootName']),_0x237138?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}_getChangeContentElement(_0x3aca97){const _0x31e490=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x3aca97);return _0x31e490?_0x31e490['getElement']():null;}_markChangePositionInEditorContent(_0x11fa33,_0x4514f4){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x11fa33,_0x4514f4);}_diffContent(_0x5d6c73,_0x3250a2,_0x100a6c){return this['_aiReviewCoreEditing']['diffContent'](_0x5d6c73,_0x3250a2,_0x100a6c,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x3a4513){_0x3a4513?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x8ad136 of this['_aiReviewCoreEditing']['getEditors']())_0x8ad136['editing']['view']['change'](_0x3b3c02=>{for(const _0x2e3027 of _0x8ad136['editing']['view']['document']['getRoots']()){for(const _0x40d03e of _0x2e3027['getClassNames']())_0x40d03e['startsWith']('ck-ai_review-')&&_0x3b3c02['removeClass'](_0x40d03e,_0x2e3027);_0x3b3c02['addClass'](_0x3a4513?'ck-ai_review-diff':'ck-ai_review-highlights',_0x2e3027);}});}_getBalloonDomRoot(_0x31c2c5,_0x2ac2db){const _0x414ab5=_0x31c2c5['editing']['view'];if(_0x2ac2db){const _0x460d8e=_0x414ab5['getDomRoot'](_0x2ac2db);if(_0x460d8e)return _0x460d8e;}return _0x414ab5['getDomRoot']()??void 0x0;}async _getReviewChecks(){const _0xc348b4=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x51bc3f=await _0xc348b4['getChecksList']();_0xc348b4['modelsLoadError']&&this['_logError'](_0xc348b4['modelsLoadError']);let _0x5df0fa=_0x51bc3f['checks'];const _0x412e75=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x412e75,_0x5df0fa),this['_usesAvailableCommandsConfig']&&(_0x5df0fa=_0x412e75['map'](_0xa1fd10=>_0x5df0fa['find'](_0x11316d=>_0x11316d['id']===_0xa1fd10))['filter'](_0x435199=>!!_0x435199)),this['_filterChecksWithMissingModel'](_0x5df0fa);}_logWarningForNonExistentChecks(_0x3e18c4,_0x5805fb){const _0x19fa5e=_0x3e18c4['filter'](_0x422346=>!_0x5805fb['some'](_0x1850bf=>_0x1850bf['id']===_0x422346));_0x19fa5e['length']&&this['_reporter']['logError'](new jn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x19fa5e['join'](',\x20')}}));}_filterChecksWithMissingModel(_0xdbb1a){const _0x14b3ef=[];return _0xdbb1a['forEach'](_0x36a104=>{(_0x36a104 instanceof dc&&!_0x36a104['defaultModel']||_0x36a104 instanceof mc&&!_0x36a104['models']['length'])&&_0x14b3ef['push'](_0x36a104['id']);}),_0x14b3ef['length']&&_0x14b3ef['forEach'](_0x12f5db=>{_0xdbb1a=_0xdbb1a['filter'](_0xae1d61=>_0xae1d61['id']!==_0x12f5db),this['_reporter']['logError'](new jn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x12f5db}}));}),_0xdbb1a;}},fc=class extends _0x338e6f{static get['pluginName'](){return'AIReviewGateway';}static get requires(){return[ec,wc,Ss,dn,Un,xs];}get['models'](){return this['context']['plugins']['get'](xs)['models'];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async getAllCommands(){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x3e267a=>{const _0x207067={'id':_0x3e267a['id'],'title':_0x3e267a['title'],'description':_0x3e267a['description']};return'custom'!==_0x3e267a['id']&&_0x3e267a['options']?.['length']&&(_0x207067['parameters']=_0x3e267a['options'][0x0]['data']['map'](_0x5cbad6=>({..._0x5cbad6}))),_0x207067;});}async['runReview'](_0x53367a,_0x2f5cf1){const _0x12e978=await this['_resolveReviewCheck'](_0x53367a),_0x2c2d67=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x2ce741=this['context']['plugins']['get']('AIConnector'),_0x58ba85=_0x2c2d67['getDocumentData']({'roots':_0x2f5cf1?.['roots']}),_0x4600a0=this['_createReviewCheckRun'](_0x12e978,_0x58ba85,_0x2ce741,_0x2f5cf1?.['parameterId'],new Wn(_0x2f5cf1?.['contexts']));return _0x2c2d67['runCheck'](_0x4600a0,{'signal':_0x2f5cf1?.['signal']});}async runCustomReview(_0xe1853d,_0x31bb09){const {reviewCheck:_0x29194f,resolvedModel:_0x189dc3}=await this['_resolveCustomReviewCheck'](_0xe1853d,_0x31bb09?.['model']),_0x3b8c4d=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x98689d=this['context']['plugins']['get']('AIConnector'),_0x5102e1=_0x3b8c4d['getDocumentData']({'roots':_0x31bb09?.['roots']}),_0x3685e8=new lc(_0xe1853d,_0x189dc3,_0x5102e1,_0x29194f,_0x98689d,new Wn(_0x31bb09?.['contexts']));return _0x3b8c4d['runCheck'](_0x3685e8,{'signal':_0x31bb09?.['signal']});}['applyReview'](_0x440ac1,_0x2b8e60){this['context']['plugins']['get']('AIGateway')['apply'](_0x440ac1,{'aiSource':'review',..._0x2b8e60});}async['_resolveReviewCheck'](_0x3404e4){const _0x181e04=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x2203e2=>_0x2203e2['id']===_0x3404e4);if(!_0x181e04)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x3404e4});if(_0x181e04 instanceof mc)throw new ct('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x3404e4});if(_0x181e04 instanceof dc&&!_0x181e04['defaultModel']?.['id'])throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x3404e4});return _0x181e04;}async _resolveCustomReviewCheck(_0x381140,_0x3497b2){const _0x502008='custom',_0x312329=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x523ab7=>_0x523ab7['id']===_0x502008);if(!_0x312329)throw new ct('ai-reviewgateway-unknown-command',this,{'checkId':_0x502008});if(!(_0x312329 instanceof mc))throw new ct('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x502008});if(!_0x381140)throw new ct('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x502008});const _0x31668e=_0x3497b2??_0x312329['defaultModel']?.['id'];if(!_0x31668e)throw new ct('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x502008});return{'reviewCheck':_0x312329,'resolvedModel':_0x31668e};}_createReviewCheckRun(_0x3b9053,_0x18b487,_0x59d05a,_0x14d916,_0x1422ed=new Wn()){if(_0x3b9053 instanceof dc){const _0x2dbb95=_0x3b9053['context']?_0x1422ed['cloneWith'](_0x3b9053['context']):_0x1422ed;return new _c(_0x3b9053['prompt'],_0x3b9053['defaultModel']['id'],_0x18b487,_0x3b9053,_0x59d05a,_0x2dbb95);}return new hc(_0x18b487,_0x3b9053,_0x59d05a,_0x14d916?[_0x14d916]:void 0x0,void 0x0,_0x1422ed);}},Cc=class extends _0x338e6f{static get requires(){return[Tc,zh,ec,fc];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startReview(_0x4fe5d8,_0x183342){if(this['assertStartReviewPreconditions'](_0x4fe5d8)instanceof mc)throw new ct('ai-reviewmode-not-a-system-command',this,{'commandId':_0x4fe5d8});Ch(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x4fe5d8,'params':_0x183342?.['parameterId']?[_0x183342['parameterId']]:void 0x0});}async startCustomReview(_0x1f3546,_0x1029be){if(!_0x1f3546)throw new ct('ai-reviewmode-missing-custom-command-prompt',this);const _0x576abe=Ac['find'](_0x2d31de=>'custom'===_0x2d31de['commandId'])['id'],_0x23ce96=this['assertStartReviewPreconditions'](_0x576abe),_0xa91dc0=_0x1029be?.['model']??_0x23ce96['defaultModel']?.['id'];if(!_0xa91dc0)throw new ct('ai-reviewmode-missing-custom-command-model',this);Ch(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x576abe,'isCustom':!0x0,'args':{'prompt':_0x1f3546,'model':_0xa91dc0}});}getAvailableCommands(){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x5ab4e3=>{const _0xa67943={'id':_0x5ab4e3['id'],'title':_0x5ab4e3['title'],'description':_0x5ab4e3['description']};return'custom'!==_0x5ab4e3['id']&&_0x5ab4e3['options']?.['length']&&(_0xa67943['parameters']=_0x5ab4e3['options'][0x0]['data']['map'](_0x1c6bc1=>({..._0x1c6bc1}))),_0xa67943;});}assertStartReviewPreconditions(_0x9ebc82){const _0x586bb4=this['context']['plugins']['get']('AIReviewModeController');if(_0x586bb4['getCurrentCheckRun']())throw new ct('ai-reviewmode-review-already-running',this);const _0x124a72=_0x586bb4['getAvailableChecks']()['find'](_0x1e2d42=>_0x1e2d42['id']===_0x9ebc82);if(!_0x124a72)throw new ct('ai-reviewmode-unknown-command',this,{'commandId':_0x9ebc82});return _0x124a72;}},bc=class extends hc{_title;constructor(_0x161617,_0x228b72,_0x327816,_0x499e2e,_0x3813f2,_0x23bbf7,_0x22a954){super(_0x161617,_0x228b72,_0x327816,_0x3813f2,_0x23bbf7,_0x22a954),this['_title']=_0x499e2e;}get title(){return this['_title'];}get subTitle(){return this['_sourceCheck']['title'];}},Sc=class extends uc{get['apiId'](){return'translate';}},Rc=class extends pc{setupChecks(_0x56aa3a){this['_checks']=_0x56aa3a['map'](_0x4efbba=>new Sc(_0x4efbba));}};const Oc=[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}];var vc=class extends gc{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x3025c9){super(_0x3025c9),this['context']['config']['define']('ai.translate.languages',Oc);}async _loadChecksList(){const _0x3d451d=[],_0x17c7f6=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x268da0 of _0x17c7f6)_0x3d451d['push']({'title':_0x268da0['label'],'id':_0x268da0['id'],'commandId':_0x268da0['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x268da0['id']}});const _0x3a1085=new Rc();return _0x3a1085['setupChecks'](this['_translateChecks'](_0x3d451d)),_0x3a1085;}_translateChecks(_0x251757){const _0x12c6b6=this['context']['locale'];return _0x251757['map'](_0x4f360c=>{const _0x51fd0c='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x4f360c['title']['toUpperCase']()['replaceAll']('-','_'),_0x45f846=Os(_0x12c6b6,_0x51fd0c);return{..._0x4f360c,'title':_0x45f846===_0x51fd0c?_0x4f360c['title']:_0x45f846};});}},yc=class extends cc{static get['pluginName'](){return'AITranslateController';}static get requires(){return[Jn,vc,xs];}get['_aiSource'](){return'translate';}get _defaultContextFeature(){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}_initRequiredPlugins(){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}_createReviewCheckRun(_0x47e76b,_0x48f77b,_0x2381a7){return new bc(this['_aiReviewCoreEditing']['getDocumentData'](),_0x48f77b,this['_aiConnector'],Os(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x47e76b['params'],_0x47e76b['args'],_0x2381a7);}_onReviewCheckResultActivated(_0xd847df){this['_aiReviewCoreUi']['setActiveStateInResults'](_0xd847df['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0xd847df['change']['id']);}_onReviewCheckResultDeactivated(){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}_onActivateChange(_0x5d3c2e){this['_currentReviewCheckRun']&&('hover'===_0x5d3c2e['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x5d3c2e['id'])),'click'===_0x5d3c2e['uiInteraction']&&this['_scrollToChange'](_0x5d3c2e['id']));}_onDeactivateChange(_0x2ffcea){this['_currentReviewCheckRun']&&'panel'===_0x2ffcea['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x5ac4c2,_0x493863){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x493863['changeId']),this['_scrollToChange'](_0x493863['changeId']));}['_onChangeMarkerHovered'](_0x1fa5a8,_0x3f7f35){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3f7f35['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x3f7f35['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}_getChangeContentElement(_0x521086){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x521086);}_markChangePositionInEditorContent(_0x15702c,_0x30194b){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x15702c,_0x30194b);}_diffContent(_0x33d6f8,_0x573ad9,_0x2ddb39){return this['_aiReviewCoreEditing']['diffContent'](_0x33d6f8,_0x573ad9,_0x2ddb39,!0x0);}['_onReviewCheckRun'](){for(const _0x4021bf of this['_aiReviewCoreEditing']['getEditors']())_0x4021bf['editing']['view']['change'](_0x3100c0=>{for(const _0x429d9e of _0x4021bf['editing']['view']['document']['getRoots']())_0x3100c0['addClass']('ck-ai-translate-mode-content',_0x429d9e);});}async _getReviewChecks(){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},kc=class extends Kh{constructor(_0x40304c,_0x15d52b){super(_0x40304c,_0x15d52b),this['on']('set:isLoading',(_0x44ff48,_0x398675,_0x44f6e7)=>{_0x44f6e7&&(this['headerTitle']=Os(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0xddc277,_0x46c5ff,_0x22f2fb)=>{_0x22f2fb&&(this['headerTitle']=Os(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}_createAcceptAllButtonView(){const _0x2fb56f=super['_createAcceptAllButtonView']();return _0x2fb56f['set']('label',Os(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x2fb56f;}_createExitReviewButtonView(){const _0x26a5ef=super['_createExitReviewButtonView']();return _0x26a5ef['set']('label',Os(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x26a5ef;}},Nc=class extends Xh{_setupTemplate(){const _0x398598=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x398598['if']('isVisible','ck-hidden',_0x2f570d=>!_0x2f570d)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Os(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Os(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x398598['if']('isVisible','ck-hidden',_0xb728ad=>!_0xb728ad)]},'children':this['_checkViews']}]});}},xc=class extends Uh{static get['pluginName'](){return'AITranslateUI';}createMainView(){const _0x466751=this['context']['plugins']['get']('AITabs'),_0x4a327f=this['context']['locale'],_0x2fab97=new ka(_0x4a327f,{'label':Os(_0x4a327f,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x333580,'class':'ck-ai-header_review-translate','showResizeButton':_0x466751['showResizeButton']});_0x2fab97['delegate']('resizeTabs')['to'](_0x466751),_0x2fab97['bind']('isMaximized')['to'](_0x466751['view'],'isMaximized',_0x57de38=>_0x57de38);const _0x1d939c=new Bh(_0x4a327f,{'header':_0x2fab97,'list':new Nc(_0x4a327f),'results':new kc(_0x4a327f,{'generalErrorText':Os(_0x4a327f,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Fh(_0x4a327f,{'headerText':Os(_0x4a327f,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Os(_0x4a327f,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Os(_0x4a327f,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x1d939c['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x1d939c;}registerTab(){const _0x360954=this['context']['plugins']['get']('AITabs');_0x360954['view']['on']('activateTab',(_0x426638,{newTab:_0x2b5535,oldTab:_0xd22ec1})=>{'translate'===_0x2b5535?this['fire']('getReviewCheckList'):'translate'===_0xd22ec1&&this['fire']('leaveReview');}),_0x360954['view']['addTab']({'id':'translate','buttonLabel':Os(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x333580,'order':0x0,'content':this['_mainView']});}},Lc=class extends _0x338e6f{static get['pluginName'](){return'AITranslateGateway';}static get requires(){return[ec,Ss,dn,Un];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async runTranslate(_0x77dca0,_0x3be272){const _0x3d31ef=this['context']['plugins']['get']('AIReviewCoreEditing'),_0x5f0f08=this['context']['plugins']['get']('AIConnector'),_0x50249d=new Sc({'id':_0x77dca0,'commandId':_0x77dca0,'title':_0x77dca0,'description':'','isParameterized':!0x1}),_0x4a8c68=_0x3d31ef['getDocumentData']({'roots':_0x3be272?.['roots']}),_0x12d75f=new hc(_0x4a8c68,_0x50249d,_0x5f0f08,void 0x0,{'language':_0x77dca0},new Wn(_0x3be272?.['contexts']));return _0x3d31ef['runCheck'](_0x12d75f,{'signal':_0x3be272?.['signal']});}applyTranslate(_0x47e1d4,_0x1c54a5){this['context']['plugins']['get']('AIGateway')['apply'](_0x47e1d4,_0x1c54a5);}},Dc=class extends _0x338e6f{static get requires(){return[yc,xc,ec,Lc];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async startTranslate(_0x1284a4){const _0x295926=this['assertStartTranslatePreconditions'](_0x1284a4);Ch(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x295926['id'],'args':_0x295926['useArgs']?_0x295926['args']:void 0x0});}getAvailableLanguages(){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x53449e=>({'id':_0x53449e['id'],'label':_0x53449e['title']}));}assertStartTranslatePreconditions(_0x43fc27){const _0x4d29ce=this['context']['plugins']['get']('AITranslateController');if(_0x4d29ce['getCurrentCheckRun']())throw new ct('ai-translate-translation-already-running',this);const _0x5030b4=_0x4d29ce['getAvailableChecks']()['find'](_0x4db76f=>_0x4db76f['id']===_0x43fc27);if(!_0x5030b4)throw new ct('ai-translate-unknown-language',this,{'languageId':_0x43fc27});return _0x5030b4;}},Pc=class extends _0xe451ae{['licenseKey'];_licenseKeyCheckInterval;static get['pluginName'](){return'DocumentCompareUtils';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['licenseKey']=this['editor']['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{const _0x3932d4=[this['editor']];for(const _0x258c53 of _0x3932d4){let _0x224b72;for(const _0x216360 in _0x258c53){const _0x1979d4=_0x216360,_0x5ef62c=_0x258c53[_0x1979d4];if('documentCompareLicenseKeyValid'==_0x5ef62c||'documentCompareLicenseKeyInvalid'==_0x5ef62c||'documentCompareLicenseKeyExpired'==_0x5ef62c||'documentCompareLicenseKeyDomainLimit'==_0x5ef62c||'documentCompareLicenseKeyNotAllowed'==_0x5ef62c||'documentCompareLicenseKeyEvaluationLimit'==_0x5ef62c||'documentCompareLicenseKeyUsageLimit'==_0x5ef62c){delete _0x258c53[_0x1979d4],_0x224b72=_0x5ef62c,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'documentCompareLicenseKeyInvalid'==_0x224b72&&_0x258c53['_showLicenseError']('invalid'),'documentCompareLicenseKeyExpired'==_0x224b72&&_0x258c53['_showLicenseError']('expired'),'documentCompareLicenseKeyDomainLimit'==_0x224b72&&_0x258c53['_showLicenseError']('domainLimit'),'documentCompareLicenseKeyNotAllowed'==_0x224b72&&_0x258c53['_showLicenseError']('featureNotAllowed','DocumentCompare'),'documentCompareLicenseKeyEvaluationLimit'==_0x224b72&&_0x258c53['_showLicenseError']('evaluationLimit'),'documentCompareLicenseKeyUsageLimit'==_0x224b72&&_0x258c53['_showLicenseError']('usageLimit');}},0x3e8);}destroy(){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}};const Hc=new Set(['br']);var Mc=class{['_usedIds']=new Set();_writer;constructor(_0x130b14){this['_writer']=new _0x1614f9(_0x130b14['editing']['view']['document']);}['assign'](_0x1af2ed){this['_assignToChildren'](_0x1af2ed);}['_assignToChildren'](_0x404348){let _0x1b628e=!0x1;for(const _0xbd09bc of _0x404348['getChildren']()){if(!_0xbd09bc['is']('view:element')||Hc['has'](_0xbd09bc['name']))continue;const _0x54fda4=_0xbd09bc['is']('view:containerElement'),_0x862e2a=_0xbd09bc['is']('view:emptyElement'),_0x552ec6=_0xbd09bc['is']('view:rawElement'),_0x1f3d60=this['_assignToChildren'](_0xbd09bc);_0xbd09bc['hasAttribute']('data-id')?(this['_usedIds']['add'](_0xbd09bc['getAttribute'](An)),_0x1b628e=!0x0):(_0x54fda4||_0x862e2a||_0x552ec6||_0x1f3d60)&&(this['_writer']['setAttribute'](An,this['_nextId'](),_0xbd09bc),_0x1b628e=!0x0);}return _0x1b628e;}_nextId(){let _0x388c40;do{_0x388c40='';for(let _0xcd7cff=0x0;_0xcd7cff<0x4;_0xcd7cff++)_0x388c40+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(this['_usedIds']['has'](_0x388c40));return this['_usedIds']['add'](_0x388c40),_0x388c40;}};function Uc(_0x38405c){return new _0x332f21(Array['from'](_0x38405c['getChildren'](),_0x11f269=>_0x11f269['_clone'](!0x0)));}const Vc='documentcompare-selection',Bc='documentcompare-selection-start',Gc='documentcompare-selection-end';function Kc(_0x36633a){const _0x1c8561='<'+Bc+'></'+Bc+'>',_0x5df40e='<'+Gc+'></'+Gc+'>';let _0x83dd38=_0x36633a;const _0x3d25ab=[];let _0x2569c3=_0x83dd38['indexOf'](_0x1c8561);for(;-0x1!==_0x2569c3;){_0x83dd38=_0x83dd38['slice'](0x0,_0x2569c3)+_0x83dd38['slice'](_0x2569c3+_0x1c8561['length']);const _0x121aaf=_0x83dd38['indexOf'](_0x1c8561);let _0x4f9f5=_0x83dd38['indexOf'](_0x5df40e);-0x1===_0x4f9f5||-0x1!==_0x121aaf&&_0x121aaf<_0x4f9f5?_0x4f9f5=_0x2569c3:_0x83dd38=_0x83dd38['slice'](0x0,_0x4f9f5)+_0x83dd38['slice'](_0x4f9f5+_0x5df40e['length']),_0x3d25ab['push']({'start':_0x2569c3,'end':_0x4f9f5}),_0x2569c3=_0x83dd38['indexOf'](_0x1c8561);}return{'content':_0x83dd38,'selection':_0x3d25ab};}var Fc=class extends _0xe451ae{['_sessionId'];static get['pluginName'](){return'DocumentCompare';}static get requires(){return[In,Pc];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){this['editor']['conversion']['for']('dataDowncast')['markerToElement']({'model':Vc,'view':(_0x2f9626,{writer:_0x6e1bc9,options:_0x5d47fb})=>_0x5d47fb['includeDocumentCompareSelection']?_0x6e1bc9['createUIElement'](_0x2f9626['isOpening']?Bc:Gc):null});}afterInit(){!async function(_0x32f717){const _0x1e59a5='KpOBJGNSEgqCyfVF1kZ8lbnRjM7eIzAsDQHw9aThu6rcYi05UmPL4d3X2Wotvx',_0x473967=0x793c8,_0xd8d342={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'};async function _0x3a7c61(_0x3ad66b){const _0x3fe304=new window['Promise'](_0x38cad9=>{_0x3ad66b['once']('ready',_0x38cad9);}),_0x5638b9=window['Date']['now'](),_0x2d494b=_0x3ad66b['config']['get']('licenseKey');async function _0x323388(){let _0x44e88f,_0x41b95f=null,_0x201976=null;try{return'GPL'==_0x2d494b?'NotAllowed':(_0x44e88f=_0x3f6528(),_0x44e88f?(_0x44e88f['usageEndpoint']&&(_0x201976=_0x130211(_0x44e88f['usageEndpoint'],_0x44e88f['jti'])),await _0x5ca65e()?_0x593dec()?_0x87cc31()?'Expired':_0x465b84()?('evaluation'==_0x44e88f['licenseType']&&(_0x41b95f=_0x480fe1('EvaluationLimit')),await _0x1df7ab()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x87cc31(){const _0x3dd66c=['evaluation','trial']['includes'](_0x44e88f['licenseType'])?_0x5638b9/0x3e8:0xe10*_0x473967;return _0x44e88f['exp']<_0x3dd66c;}function _0x593dec(){const _0x1a0f2a=_0x44e88f['features'];return!!_0x1a0f2a&&(!!_0x1a0f2a['includes']('*')||(!!_0x1a0f2a['includes']('DC')||!!_0x1a0f2a['includes']('ET')));}function _0x465b84(){const _0x38e909=_0x44e88f['licensedHosts'];if(!_0x38e909||0x0==_0x38e909['length'])return!0x0;const {hostname:_0x432bc9}=new URL(window['location']['href']);if(_0x38e909['includes'](_0x432bc9))return!0x0;const _0x2ff90f=_0x432bc9['split']('.');return _0x38e909['filter'](_0x4f9bd9=>_0x4f9bd9['includes']('*'))['map'](_0x4bd572=>_0x4bd572['split']('.'))['filter'](_0x1907e9=>_0x1907e9['length']<=_0x2ff90f['length'])['map'](_0x50e57c=>Array(_0x2ff90f['length']-_0x50e57c['length'])['fill']('*'===_0x50e57c[0x0]?'*':'')['concat'](_0x50e57c))['some'](_0x43d407=>_0x2ff90f['every']((_0x524ee9,_0x5c4a44)=>_0x43d407[_0x5c4a44]===_0x524ee9||'*'===_0x43d407[_0x5c4a44]));}function _0x1df7ab(){return _0x41b95f&&_0x201976?new window['Promise']((_0x42bd72,_0x162af7)=>{_0x41b95f['then'](_0x42bd72,_0x162af7),_0x201976['then'](_0x58ede5=>{'Valid'!=_0x58ede5&&_0x42bd72(_0x58ede5);},_0x162af7);}):_0x41b95f||_0x201976||'Valid';}}function _0x130211(_0x1aeeaf,_0x4ce24d){return new window['Promise'](_0xbddaaf=>{if(_0x99df3c())return _0xbddaaf('Valid');_0x5c486f(),_0x3ad66b['decorate']('_sendUsageRequest');let _0x1ccfa4=!0x1;const _0x47ccc5=xt();function _0x5c66ef(_0x4bfdb0){return!!_0x4bfdb0&&('object'==typeof _0x4bfdb0||'function'==typeof _0x4bfdb0)&&'function'==typeof _0x4bfdb0['then']&&'function'==typeof _0x4bfdb0['catch'];}function _0x1ddfee(_0x2fec77){_0x235f61(_0x2fec77)['then'](_0x56b47f=>_0x56b47f&&'ok'==_0x56b47f['status']?_0x1f7fc9(_0x1eabd3(_0x47ccc5+_0x4ce24d))!=_0x56b47f['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x4becf9=>(_0x3048aa(),_0x4becf9),()=>{const _0x6dcde6=_0x265c33();return null==_0x6dcde6?(_0x3048aa(),'Valid'):_0x5638b9-_0x6dcde6>0x240c8400?'UsageLimit':'Valid';})['then'](_0xbddaaf)['catch'](()=>{_0xbddaaf('UsageLimit');});const _0x2c91c7=0x36ee80;function _0x3048aa(){const _0x9d231a='llct-'+_0x1f7fc9(_0x1eabd3(_0x1aeeaf)),_0x5b2f9b=_0x38c41c(_0x1f7fc9(window['Math']['ceil'](_0x5638b9/_0x2c91c7)));window['localStorage']['setItem'](_0x9d231a,_0x5b2f9b);}function _0x265c33(){const _0x3b5df7='llct-'+_0x1f7fc9(_0x1eabd3(_0x1aeeaf)),_0x20283f=window['localStorage']['getItem'](_0x3b5df7);return _0x20283f?window['parseInt'](_0x38c41c(_0x20283f),0x10)*_0x2c91c7:null;}function _0x235f61(_0xf85443){return new window['Promise']((_0x3f3390,_0x224e77)=>{_0xf85443['then'](_0x3f3390,_0x224e77),window['setTimeout'](_0x224e77,0x1d4c0);});}}_0x3ad66b['on']('_sendUsageRequest',(_0x62ff56,_0x558a6e)=>{if(_0x558a6e[0x0]!=_0x1aeeaf)return _0xbddaaf('UsageLimit');_0x558a6e[0x1]={..._0x558a6e[0x1],'requestId':_0x47ccc5};},{'priority':'high'}),_0x3ad66b['on']('_sendUsageRequest',_0x188fc8=>{_0x5c66ef(_0x188fc8['return'])&&(_0x1ccfa4=!0x0,_0x1ddfee(_0x188fc8['return']));},{'priority':'low'}),_0x3fe304['then'](()=>{_0x1ccfa4||_0xbddaaf('UsageLimit');});});function _0x99df3c(){return'auto'==_0x3ad66b['editing']['view']['_overlayModeHint'];}function _0x5c486f(){_0x3ad66b['editing']['view']['_overlayModeHint']='auto';}}function _0x480fe1(_0x180a96){const _0x1e677c=[new window['Promise'](_0x2dce02=>setTimeout(_0x2dce02,0x93ecc)),_0x3fe304['then'](()=>new window['Promise'](_0x14dd86=>{let _0x3aeac4=0x0;_0x3ad66b['model']['on']('applyOperation',(_0x2d9300,_0xd654ba)=>{_0xd654ba[0x0]['isDocumentOperation']&&_0x3aeac4++,0x5e8==_0x3aeac4&&(_0x14dd86(),_0x2d9300['off']());});}))];return window['Promise']['race'](_0x1e677c)['then'](()=>_0x180a96);}async function _0x1c42ee(){await _0x3fe304,_0x32f717['makeSnapshot']=_0x1c2594,_0x32f717['diffSnapshot']=_0x1c2594,_0x32f717['applyPatch']=_0x1c2594,_0x3ad66b['model']['change']=_0x1c2594,_0x3ad66b['model']['enqueueChange']=_0x1c2594,_0x3ad66b['enableReadOnlyMode']('model');}function _0x4243ea(_0xa90dee){const _0xe608c2=_0x549fc1();_0x3ad66b[_0xe608c2]='documentCompareLicenseKey'+_0xa90dee,'Valid'!=_0xa90dee&&_0x1c42ee();}function _0x549fc1(){const _0x4e77c6=window['String'](window['performance']['now']())['replace']('.','');let _0x16b620='K';for(let _0x1f7b30=0x0;_0x1f7b30<_0x4e77c6['length'];_0x1f7b30+=0x2){let _0xaaea82=window['parseInt'](_0x4e77c6['substring'](_0x1f7b30,_0x1f7b30+0x2));_0xaaea82>=0x3e&&(_0xaaea82-=0x3e),_0x16b620+=_0x1e59a5[_0xaaea82];}return _0x16b620;}function _0x3f6528(){const _0x469286=_0x2d494b['split']('.');if(0x3!=_0x469286['length'])return null;return _0x1fbe0a(_0x469286[0x1]);function _0x1fbe0a(_0x172d5e){const _0x350e0d=_0x22fff6(_0x172d5e);return _0x350e0d&&_0x262a38()?_0x350e0d:null;function _0x262a38(){const _0x41a2a7=_0x350e0d['jti'],_0xa0beba=window['parseInt'](_0x41a2a7['substring'](_0x41a2a7['length']-0x8),0x10),_0x3e74df={..._0x350e0d,'jti':_0x41a2a7['substring'](0x0,_0x41a2a7['length']-0x8)};return delete _0x3e74df['vc'],_0x1eabd3(_0x3e74df)==_0xa0beba;}}}async function _0x5ca65e(){let _0x9a3de9=!0x0;try{const [_0x4d52f2,_0x70c002,_0x3801f0]=_0x2d494b['split']('.');return _0x4116ac(_0x4d52f2),await _0x6f1d46(_0x4d52f2,_0x70c002,_0x3801f0),_0x9a3de9;}catch{return!0x1;}function _0x4116ac(_0x178d5e){const _0xb3d45e=_0x22fff6(_0x178d5e);_0xb3d45e&&'ES256'==_0xb3d45e['alg']||(_0x9a3de9=!0x1);}async function _0x6f1d46(_0x444cc2,_0x3ddfdb,_0x150889){const _0x492602=window['Uint8Array']['from'](_0x1d84bc(_0x150889),_0x3c6fc5=>_0x3c6fc5['charCodeAt'](0x0)),_0x115cb7=new window['TextEncoder']()['encode'](_0x444cc2+'.'+_0x3ddfdb),_0x5e9ff3=window['crypto']['subtle'];if(!_0x5e9ff3)return;const _0x3760d6=await _0x5e9ff3['importKey']('jwk',_0xd8d342,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x5e9ff3['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x3760d6,_0x492602,_0x115cb7)||(_0x9a3de9=!0x1);}}function _0x22fff6(_0x18567f){return _0x18567f['startsWith']('ey')?JSON['parse'](_0x1d84bc(_0x18567f)):null;}function _0x1d84bc(_0x275cf8){return window['atob'](_0x275cf8['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x1eabd3(_0x1e1ccc){let _0x27a053=0x1505;function _0x7e4f6e(_0x1528f7){for(let _0x5d8a39=0x0;_0x5d8a39<_0x1528f7['length'];_0x5d8a39++){const _0x4ffb02=_0x1528f7['charCodeAt'](_0x5d8a39);_0x27a053=(_0x27a053<<0x5)+_0x27a053+_0x4ffb02,_0x27a053&=_0x27a053;}}function _0x2d7a08(_0x56db4e){Array['isArray'](_0x56db4e)?_0x56db4e['forEach'](_0x2d7a08):_0x56db4e&&'object'==typeof _0x56db4e?Object['entries'](_0x56db4e)['sort']()['forEach'](([_0x3536c5,_0x3acb01])=>{_0x7e4f6e(_0x3536c5),_0x2d7a08(_0x3acb01);}):_0x7e4f6e(window['String'](_0x56db4e));}return _0x2d7a08(_0x1e1ccc),_0x27a053>>>0x0;}function _0x1f7fc9(_0x2e7c0a){return _0x2e7c0a['toString'](0x10)['padStart'](0x8,'0');}function _0x38c41c(_0x224a9c){return _0x224a9c['split']('')['reverse']()['join']('');}function _0x1c2594(){}_0x4243ea(await _0x323388());}_0x3a7c61(_0x32f717['editor']);}(this);}makeSnapshot(_0x4be30e=[]){const _0x347b85=this['editor'],_0x5cd798=Array['from'](_0x4be30e),_0x12c98a={},_0x2521bf={},_0x237448=new Mc(_0x347b85);for(const _0xedd3ff of _0x347b85['model']['document']['getRoots']()){const _0x5671a1=Array['from'](_0xedd3ff['getChildren']())['map'](_0x39994e=>_0x39994e['_clone'](!0x0)),_0x242314=new _0x332f21(_0x5671a1);for(const _0x2ba7fb of _0x347b85['model']['markers']){const _0x11c84a=_0x2ba7fb['getRange']();_0x2ba7fb['affectsData']&&_0x11c84a['root']===_0xedd3ff&&_0x242314['markers']['set'](_0x2ba7fb['name'],_0x347b85['model']['createRange'](_0x347b85['model']['createPositionFromPath'](_0x242314,_0x11c84a['start']['path']),_0x347b85['model']['createPositionFromPath'](_0x242314,_0x11c84a['end']['path'])));}let _0x886a4=0x0;for(const _0x18edb5 of _0x5cd798)_0x18edb5['root']===_0xedd3ff&&_0x242314['markers']['set'](Vc+':'+_0x886a4++,_0x347b85['model']['createRange'](_0x347b85['model']['createPositionFromPath'](_0x242314,_0x18edb5['start']['path']),_0x347b85['model']['createPositionFromPath'](_0x242314,_0x18edb5['end']['path'])));const _0x47d976=_0x347b85['data']['toView'](_0x242314,{'includeDocumentCompareSelection':!0x0});_0x237448['assign'](_0x47d976);const {content:_0x328fa8,selection:_0x6055f0}=Kc(_0x347b85['data']['processor']['toData'](_0x47d976));_0x12c98a[_0xedd3ff['rootName']]=_0x328fa8,_0x6055f0['length']&&(_0x2521bf[_0xedd3ff['rootName']]=_0x6055f0);}return{'channelId':this['_getChannelId'](),'sessionId':this['_getSessionId'](),'version':_0x347b85['model']['document']['version'],'content':_0x12c98a,'selection':_0x2521bf,'editorConfig':cn(_0x347b85)};}diffSnapshot(_0x6eff66,_0x11460c,_0x59737f={}){const _0x21f7d2=this['editor']['plugins']['get'](In),_0x50e2f6='string'==typeof _0x11460c?{'main':_0x11460c}:_0x11460c,_0x23b8f5={};for(const _0x3eb2c1 of Object['keys'](_0x6eff66['content'])){const _0xd05324=_0x50e2f6[_0x3eb2c1];void 0x0!==_0xd05324&&(_0x23b8f5[_0x3eb2c1]=_0x21f7d2['getDiff'](_0x6eff66['content'][_0x3eb2c1],_0xd05324,{'targetEditor':this['editor'],'anchor':_0x3eb2c1,'markDeletions':_0x59737f['asSuggestions']||!0x1}));}return{'channelId':_0x6eff66['channelId'],'sessionId':_0x6eff66['sessionId'],'version':_0x6eff66['version'],'options':_0x59737f,'operations':_0x23b8f5};}applyPatch(_0x9ddc6c){const _0x3d6d6e=this['editor'];if(_0x9ddc6c['channelId']!==this['_getChannelId']()||_0x9ddc6c['sessionId']!==this['_getSessionId']())throw new ct('documentcompare-apply-session-mismatch',_0x3d6d6e);const _0x5754bb=_0x9ddc6c['options']['asSuggestions']||!0x1,_0x6ae1d8=Object['values'](_0x9ddc6c['operations'])['filter'](_0x26b255=>_0x26b255['length']);if(!_0x6ae1d8['length'])return;if(_0x5754bb&&!_0x3d6d6e['plugins']['has']('TrackChangesEditing'))throw new ct('documentcompare-no-track-changes',_0x3d6d6e);const _0x23b1e1=_0x3d6d6e['model']['document']['history']['getOperations'](_0x9ddc6c['version']),_0x54fd08=[];for(const _0x1d3813 of _0x6ae1d8)_0x54fd08['push'](..._0x3ceee1(_0x1d3813,_0x23b1e1,{'document':_0x3d6d6e['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA']);const _0x5dca48=function(_0x170d2f,_0x42b120){const _0xb27964=_0x170d2f['model']['document'],_0x5a8606=new Map();for(const _0x2e3f49 of _0xb27964['roots'])_0x5a8606['set'](_0x2e3f49['rootName'],Uc(_0x2e3f49));for(const _0x499959 of _0x42b120)if('marker'!==_0x499959['type']){if(_0x499959 instanceof _0x2a38f3||_0x499959 instanceof _0x39ad90)return{'reason':'unsupported','operation':_0x499959};try{const _0x26f900=_0x499959['clone']();if(_0x26f900['baseVersion']=null,_0x26f900['isDocumentOperation']=!0x1,_0x585c53(_0x26f900,_0x5a8606),_0x3a283d(_0x26f900))continue;_0x26f900['_validate'](),_0x26f900['_execute']();}catch(_0x4e0f01){return{'reason':'invalid','operation':_0x499959,'cause':_0x4e0f01};}}return null;}(_0x3d6d6e,_0x54fd08);if(_0x5dca48){if('unsupported'===_0x5dca48['reason'])throw new ct('documentcompare-applypatch-unsupported-operation',_0x3d6d6e,{'history':_0x23b1e1,'patch':_0x9ddc6c,'operation':_0x5dca48['operation']});throw new ct('documentcompare-applypatch-invalid-patch',_0x3d6d6e,{'history':_0x23b1e1,'patch':_0x9ddc6c,'operation':_0x5dca48['operation']},_0x5dca48['cause']);}try{_0x3d6d6e['model']['change'](_0x2958af=>{_0x5754bb?_0x3d6d6e['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x54fd08):_0x3d6d6e['plugins']['get'](In)['applyOperations'](_0x2958af,_0x54fd08);});}catch(_0x4fc5ff){throw new ct('documentcompare-apply-failed',_0x3d6d6e,{'history':_0x23b1e1,'patch':_0x9ddc6c},_0x4fc5ff);}}async['process'](_0x5cc797,_0x5f1b21={}){const _0xa5e020=this['makeSnapshot'](),_0x468bf7=await _0x5cc797(_0xa5e020);try{return this['applyPatch'](this['diffSnapshot'](_0xa5e020,_0x468bf7,_0x5f1b21)),!0x0;}catch(_0x3bd8ac){if(!_0x5f1b21['setDataOnError'])throw _0x3bd8ac;return this['editor']['data']['set'](_0x468bf7,{'suppressErrorInCollaboration':!0x0}),!0x1;}}_getSessionId(){const _0x49a572=this['editor'];return _0x49a572['plugins']['has']('RealTimeCollaborationClient')?_0x49a572['plugins']['get']('RealTimeCollaborationClient')['sessionId']:(this['_sessionId']||(this['_sessionId']=xt()),this['_sessionId']);}_getChannelId(){return this['editor']['config']['get']('collaboration.channelId')||'';}};export{Lh as AIActions,Fi as AIAdapter,_s as AIAssistant,ls as AIAssistantUI,nh as AIBalloon,Qa as AIChat,wr as AIChatController,vo as AIChatFeedCustomElementView,qa as AIChatHistory,Ya as AIChatHistoryController,Ga as AIChatHistoryUI,gr as AIChatInteraction,Ja as AIChatShortcuts,Da as AIChatUI,jh as AICheckRunSingleRootResult,Ss as AIConnector,Wn as AIContext,Ns as AIContextLibrary,xs as AICore,jn as AICoreError,Xn as AIDocumentProcessingGateway,qn as AIDocumentProcessingRunResult,dn as AIEditing,ch as AIEditorIntegration,Zn as AIErrorReporter,Jn as AIErrorSink,Un as AIGateway,cr as AIInteraction,ys as AIModels,Dh as AIQuickActions,Th as AIQuickActionsUI,or as AIReply,Wi as AIRequestError,uc as AIReviewCheck,sc as AIReviewCheckResult,rc as AIReviewCheckResultChange,ac as AIReviewCheckRun,fc as AIReviewGateway,Cc as AIReviewMode,cc as AIReviewModeController,ec as AIReviewModeEditing,zh as AIReviewModeUI,Qn as AIRunResult,Yn as AIRunSingleRootResult,bs as AITabs,Cs as AITabsMainView,ws as AITabsView,As as AITextAdapter,th as AIToggleButtonUI,Dc as AITranslate,yc as AITranslateController,Lc as AITranslateGateway,xc as AITranslateUI,ps as AWSTextAdapter,Fc as DocumentCompare,Is as OpenAITextAdapter,Yi as ShowAIAssistantCommand,Za as ToggleAICommand,sr as createResizeButton,gs as getDefaultAICommands,Mn as markOperationsAsAI};