@ckeditor/ckeditor5-ai 48.2.0 → 48.3.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.
- package/dist/aiactions/aiactions.d.ts +74 -73
- package/dist/aiactions/model/aiactionsinteraction.d.ts +53 -53
- package/dist/aiactions/model/aiactionsreply.d.ts +18 -18
- package/dist/aiassistant/adapters/aiadapter.d.ts +48 -48
- package/dist/aiassistant/adapters/aitextadapter.d.ts +133 -133
- package/dist/aiassistant/adapters/awstextadapter.d.ts +42 -42
- package/dist/aiassistant/adapters/openaitextadapter.d.ts +184 -184
- package/dist/aiassistant/aiassistant.d.ts +436 -436
- package/dist/aiassistant/aiassistantediting.d.ts +51 -51
- package/dist/aiassistant/aiassistantui.d.ts +53 -53
- package/dist/aiassistant/legacyerrors.d.ts +0 -4
- package/dist/aiassistant/ui/aiassistantcontroller.d.ts +106 -105
- package/dist/aiassistant/ui/form/aiformcontentarea.d.ts +43 -43
- package/dist/aiassistant/ui/form/aiformerrorview.d.ts +19 -19
- package/dist/aiassistant/ui/form/aiformpromptview.d.ts +38 -38
- package/dist/aiassistant/ui/form/aiformtoolbarview.d.ts +50 -50
- package/dist/aiassistant/ui/form/aiformview.d.ts +121 -121
- package/dist/aiassistant/ui/form/aihistorylistitemview.d.ts +13 -13
- package/dist/aiassistant/ui/form/aihistorylistview.d.ts +27 -27
- package/dist/aiassistant/ui/form/prompthistory.d.ts +15 -15
- package/dist/aiassistant/ui/showaiassistantcommand.d.ts +35 -35
- package/dist/aiassistant/utils/common-translations.d.ts +6 -6
- package/dist/aiassistant/utils/normalizecommandsconfig.d.ts +9 -9
- package/dist/aiballoon/aiballoon.d.ts +86 -86
- package/dist/aiballoon/ui/aiballoonview.d.ts +26 -26
- package/dist/aichat/aichat.d.ts +88 -87
- package/dist/aichat/aichatballoon.d.ts +83 -83
- package/dist/aichat/aichatcontroller.d.ts +265 -264
- package/dist/aichat/aichatui.d.ts +324 -336
- package/dist/aichat/model/aichatcontext.d.ts +623 -618
- package/dist/aichat/model/aichatconversation.d.ts +257 -268
- package/dist/aichat/model/aichatinteraction.d.ts +40 -40
- package/dist/aichat/ui/aichatballoonview.d.ts +103 -103
- package/dist/aichat/ui/aichatcontrolsview.d.ts +130 -130
- package/dist/aichat/ui/aichatfeedview.d.ts +136 -136
- package/dist/aichat/ui/aichatview.d.ts +41 -41
- package/dist/aichat/ui/controls/aichatchipsoverflowmanager.d.ts +63 -63
- package/dist/aichat/ui/controls/aichatcontextitembuttonview.d.ts +41 -41
- package/dist/aichat/ui/controls/aichatcontextpanelurlinputview.d.ts +79 -79
- package/dist/aichat/ui/controls/aichatcontextpanelview.d.ts +103 -103
- package/dist/aichat/ui/controls/aichatcontrolsloaderview.d.ts +8 -8
- package/dist/aichat/ui/controls/aichatdropzoneview.d.ts +18 -18
- package/dist/aichat/ui/controls/aichatpromptcapabilitiesview.d.ts +81 -81
- package/dist/aichat/ui/controls/aichatpromptinputview.d.ts +44 -44
- package/dist/aichat/ui/controls/aichatpromptsuggestionslistview.d.ts +13 -13
- package/dist/aichat/ui/controls/resources/aichatcontextresourceslistview.d.ts +44 -44
- package/dist/aichat/ui/controls/resources/aichatcontextresourcesview.d.ts +52 -52
- package/dist/aichat/ui/controls/resources/aichatresourcelistitemview.d.ts +56 -56
- package/dist/aichat/ui/controls/resources/aichatresourcesballoonview.d.ts +104 -104
- package/dist/aichat/ui/controls/resources/aichatresourcessearchinputview.d.ts +53 -53
- package/dist/aichat/ui/feed/aichatfeedcontextchipsview.d.ts +22 -22
- package/dist/aichat/ui/feed/aichatfeedcustomelementview.d.ts +33 -33
- package/dist/aichat/ui/feed/aichatfeederroritemview.d.ts +32 -32
- package/dist/aichat/ui/feed/aichatfeedinteractionheaderview.d.ts +24 -24
- package/dist/aichat/ui/feed/aichatfeeditemview.d.ts +39 -39
- package/dist/aichat/ui/feed/aichatfeedreplyitemview.d.ts +40 -40
- package/dist/aichat/ui/feed/aichatfeedsuggestionitemactionsview.d.ts +61 -61
- package/dist/aichat/ui/feed/aichatfeedsuggestionitemview.d.ts +82 -82
- package/dist/aichat/ui/feed/aichatfeedusermessageitem.d.ts +33 -33
- package/dist/aichat/utils/eventnames.d.ts +8 -4
- package/dist/aichat/utils/parsesingleurl.d.ts +0 -4
- package/dist/aichat/utils/promisequeue.d.ts +26 -25
- package/dist/aichat/utils/readdatatransferfiles.d.ts +9 -9
- package/dist/aichat/utils/resolvepaste.d.ts +58 -58
- package/dist/aichathistory/aichathistory.d.ts +26 -26
- package/dist/aichathistory/aichathistorycontroller.d.ts +36 -35
- package/dist/aichathistory/aichathistoryui.d.ts +81 -89
- package/dist/aichathistory/model/aichathistoryconversations.d.ts +95 -102
- package/dist/aichathistory/model/aichathistoryitem.d.ts +52 -53
- package/dist/aichathistory/ui/aichathistorylistitemview.d.ts +41 -40
- package/dist/aichathistory/ui/aichathistorylistview.d.ts +28 -28
- package/dist/aichathistory/ui/aichathistorysectionlistview.d.ts +16 -16
- package/dist/aichathistory/ui/aichathistoryview.d.ts +33 -33
- package/dist/aichatshortcuts/aichatshortcuts.d.ts +295 -295
- package/dist/aichatshortcuts/ui/aichatshortcutsview.d.ts +24 -24
- package/dist/aichatshortcuts/ui/aichatshortcutview.d.ts +18 -18
- package/dist/aiconfig.d.ts +227 -227
- package/dist/aicore/aiconnector.d.ts +359 -354
- package/dist/aicore/aiediting.d.ts +97 -97
- package/dist/aicore/aierrorreporter.d.ts +73 -0
- package/dist/aicore/aigateway.d.ts +94 -54
- package/dist/aicore/errors/aicoreerror.d.ts +67 -0
- package/dist/aicore/errors/geterrorcode.d.ts +17 -0
- package/dist/aicore/errors/isaborterror.d.ts +12 -0
- package/dist/aicore/errors/normalizeerror.d.ts +18 -0
- package/dist/aicore/model/aicapabilities.d.ts +53 -52
- package/dist/aicore/model/aicontext.d.ts +61 -61
- package/dist/aicore/model/aiinteraction.d.ts +162 -168
- package/dist/aicore/model/aimodels.d.ts +73 -76
- package/dist/aicore/model/aireply.d.ts +118 -124
- package/dist/aicore/model/airunresult.d.ts +86 -86
- package/dist/aicore/pipeline/airesponseapplier.d.ts +284 -284
- package/dist/aicore/pipeline/airesponseparser.d.ts +24 -23
- package/dist/aicore/ui/aidisclaimerview.d.ts +13 -13
- package/dist/aicore/ui/aiheaderview.d.ts +28 -28
- package/dist/aicore/ui/aiskeleton.d.ts +31 -31
- package/dist/aicore/ui/aispinner.d.ts +11 -11
- package/dist/aicore/ui/suggestioncontainer/aiminitoolbarview.d.ts +56 -56
- package/dist/aicore/ui/suggestioncontainer/aisuggestionbodyview.d.ts +80 -80
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontainerview.d.ts +46 -46
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartheaderview.d.ts +41 -41
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartstateview.d.ts +25 -28
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentparttoolbarview.d.ts +25 -25
- package/dist/aicore/ui/suggestioncontainer/aisuggestioncontentpartview.d.ts +62 -62
- package/dist/aicore/ui/suggestioncontainer/aisuggestionheaderview.d.ts +32 -32
- package/dist/aicore/ui/suggestioncontainer/aisuggestionloaderview.d.ts +11 -11
- package/dist/aicore/ui/suggestioncontainer/aisuggestionstreamablecontentview.d.ts +31 -27
- package/dist/aicore/ui/suggestioncontainer/aiwebsourcesview.d.ts +24 -24
- package/dist/aicore/utils/abortabletimeout.d.ts +11 -11
- package/dist/aicore/utils/builddocumentsuggestionsmap.d.ts +30 -0
- package/dist/aicore/utils/buttonclasses.d.ts +8 -8
- package/dist/aicore/utils/cleanupstreamingartifacts.d.ts +12 -0
- package/dist/aicore/utils/common-translations.d.ts +6 -6
- package/dist/aicore/utils/createandattachaibodycollection.d.ts +19 -0
- package/dist/aicore/utils/createresizebutton.d.ts +9 -9
- package/dist/aicore/utils/createstartconversationbutton.d.ts +8 -8
- package/dist/aicore/utils/documentposition.d.ts +37 -37
- package/dist/aicore/utils/documentrange.d.ts +41 -41
- package/dist/aicore/utils/eventnames.d.ts +5 -5
- package/dist/aicore/utils/geteditorsfromcontext.d.ts +13 -13
- package/dist/aicore/utils/getoperationsfordocumentsuggestions.d.ts +22 -0
- package/dist/aicore/utils/getsuggestionpartsfromreply.d.ts +18 -18
- package/dist/aicore/utils/htmlparser.d.ts +17 -17
- package/dist/aicore/utils/htmlstreamer.d.ts +79 -79
- package/dist/aicore/utils/markoperationsasai.d.ts +23 -0
- package/dist/aicore/utils/scrollmanager.d.ts +24 -23
- package/dist/aicore/utils/showaitab.d.ts +1 -0
- package/dist/aidocumentprocessing/aidocumentprocessinggateway.d.ts +87 -0
- package/dist/aidocumentprocessing/model/aidocumentprocessingrunresult.d.ts +19 -0
- package/dist/aieditorintegration/aieditorintegration.d.ts +32 -32
- package/dist/aieditorintegration/aitogglebutton/aitogglebuttonui.d.ts +34 -34
- package/dist/aieditorintegration/aitogglebutton/toggleaicommand.d.ts +12 -12
- package/dist/aiquickactions/aiquickactions.d.ts +250 -250
- package/dist/aiquickactions/aiquickactionscommand.d.ts +10 -10
- package/dist/aiquickactions/aiquickactionsediting.d.ts +22 -22
- package/dist/aiquickactions/aiquickactionsui.d.ts +125 -124
- package/dist/aiquickactions/ui/aiquickactionsbuttoncreator.d.ts +57 -57
- package/dist/aiquickactions/ui/aiquickactionsdropdowncontentview.d.ts +45 -45
- package/dist/aiquickactions/ui/aiquickactionsdropdowncreator.d.ts +59 -59
- package/dist/aiquickactions/ui/aiquickactionsfilteredlistview.d.ts +0 -4
- package/dist/aiquickactions/ui/balloon/aiactionsballoondisclaimerview.d.ts +12 -12
- package/dist/aiquickactions/ui/balloon/aiactionsballoontoolbarview.d.ts +32 -32
- package/dist/aiquickactions/ui/balloon/aiactionsballoonview.d.ts +129 -125
- package/dist/aiquickactions/ui/dropdownmenubuttonwithhighlightview.d.ts +24 -24
- package/dist/aireviewcore/aireviewcorecheckregistry.d.ts +34 -29
- package/dist/aireviewcore/aireviewcorecontroller.d.ts +48 -48
- package/dist/aireviewcore/aireviewcoreediting.d.ts +216 -224
- package/dist/aireviewcore/aireviewcoreui.d.ts +84 -84
- package/dist/aireviewcore/model/aireviewcheck.d.ts +49 -49
- package/dist/aireviewcore/model/aireviewchecklist.d.ts +29 -28
- package/dist/aireviewcore/model/aireviewcheckresult.d.ts +36 -35
- package/dist/aireviewcore/model/aireviewcheckresultchange.d.ts +51 -50
- package/dist/aireviewcore/model/aireviewcheckrun.d.ts +140 -151
- package/dist/aireviewcore/model/aireviewsystemcheckrun.d.ts +16 -16
- package/dist/aireviewcore/types.d.ts +24 -24
- package/dist/aireviewcore/ui/aireviewcoreballoonsuggestionview.d.ts +34 -34
- package/dist/aireviewcore/ui/aireviewcorechecklistitemresultview.d.ts +57 -65
- package/dist/aireviewcore/ui/aireviewcorecustomcheckview.d.ts +56 -56
- package/dist/aireviewcore/ui/aireviewcorefinishreviewbuttonview.d.ts +9 -9
- package/dist/aireviewcore/ui/aireviewcoregeneralerrorview.d.ts +20 -20
- package/dist/aireviewcore/ui/aireviewcorepromptinputview.d.ts +25 -25
- package/dist/aireviewcore/ui/aireviewcorereviewchecklistview.d.ts +22 -22
- package/dist/aireviewcore/ui/aireviewcorereviewcommandlistitemview.d.ts +37 -39
- package/dist/aireviewcore/ui/aireviewcorereviewcompletedview.d.ts +14 -14
- package/dist/aireviewcore/ui/aireviewcoreuicheckresultsview.d.ts +85 -87
- package/dist/aireviewcore/ui/aireviewcoreview.d.ts +50 -50
- package/dist/aireviewcore/ui/form/aireviewcoreformdropdown.d.ts +16 -16
- package/dist/aireviewcore/ui/form/aireviewcoreformmanager.d.ts +12 -12
- package/dist/aireviewmode/aireviewcheckdefinitions.d.ts +12 -12
- package/dist/aireviewmode/aireviewgateway.d.ts +141 -149
- package/dist/aireviewmode/aireviewmode.d.ts +184 -184
- package/dist/aireviewmode/aireviewmodecheckregistry.d.ts +34 -34
- package/dist/aireviewmode/aireviewmodecontroller.d.ts +23 -22
- package/dist/aireviewmode/aireviewmodeui.d.ts +17 -17
- package/dist/aireviewmode/model/aireviewcheckcustom.d.ts +16 -16
- package/dist/aireviewmode/model/aireviewcheckextra.d.ts +30 -30
- package/dist/aireviewmode/model/aireviewcustomcheckrun.d.ts +17 -17
- package/dist/aireviewmode/model/aireviewextracheckrun.d.ts +15 -15
- package/dist/aireviewmode/model/aireviewmodechecklist.d.ts +22 -22
- package/dist/aireviewmode/model/aireviewrunresult.d.ts +15 -15
- package/dist/aitabs/aitabs.d.ts +84 -84
- package/dist/aitabs/aitabsmainview.d.ts +46 -46
- package/dist/aitabs/tabs/aitabsview.d.ts +194 -188
- package/dist/aitabs/tabs/tabbuttonview.d.ts +39 -39
- package/dist/aitabs/tabs/tabpanelview.d.ts +39 -39
- package/dist/aitranslate/aitranslate.d.ts +162 -129
- package/dist/aitranslate/aitranslatecheckregistry.d.ts +22 -22
- package/dist/aitranslate/aitranslatecontroller.d.ts +17 -15
- package/dist/aitranslate/aitranslategateway.d.ts +77 -0
- package/dist/aitranslate/aitranslateui.d.ts +18 -18
- package/dist/aitranslate/model/aitranslatecheck.d.ts +12 -12
- package/dist/aitranslate/model/aitranslatechecklist.d.ts +11 -11
- package/dist/aitranslate/model/aitranslatecheckrun.d.ts +23 -23
- package/dist/aitranslate/model/aitranslaterunresult.d.ts +20 -0
- package/dist/aitranslate/ui/aitranslatechecklistview.d.ts +7 -8
- package/dist/aitranslate/ui/aitranslatecheckresultsview.d.ts +11 -11
- package/dist/augmentation.d.ts +77 -73
- package/dist/errors.d.ts +0 -4
- package/dist/errorsmap.d.ts +5 -5
- package/dist/index-content.css +1 -0
- package/dist/index-editor.css +11 -8
- package/dist/index.css +11 -8
- package/dist/index.d.ts +70 -63
- package/dist/index.js +19 -6
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/package.json +12 -12
- package/dist/aicore/utils/getoperationsfromreply.d.ts +0 -26
package/dist/index.js
CHANGED
|
@@ -20,9 +20,22 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{Plugin as _0x1970fb,Command as _0x528875,ContextPlugin as _0x915a98,Editor as _0x29da5d}from'@ckeditor/ckeditor5-core/dist/index.js';import{IconCopy as _0x380aaa,IconCheck as _0x17783f,IconError as _0x29b5b4,IconSubmit as _0x47b078,IconAIHistory as _0x17e9ed,IconMagicWand as _0x2258a8,IconRobotPencil as _0x3040e5,IconMaximize as _0x48eaa9,IconMinimize as _0x16f8b1,IconShowChangesOn as _0x554737,IconShowChangesOff as _0x27d4c5,IconDocument as _0x4c737b,IconBoxWithCross as _0x2ea868,IconBoxWithCheck as _0x3a0e00,IconBoxWithMarker as _0x5e520b,IconInfo as _0x5ccdf0,IconWeb as _0x513748,IconCancel as _0x59fd32,IconSelection as _0x581346,IconFileUpload as _0x37fe61,IconLink as _0x17ea45,IconImage as _0x265d3f,IconBulb as _0x1374fb,IconAI as _0x20b2e3,IconPreviousArrow as _0x5117cf,IconDocumentOutline as _0x38e8fc,IconLoupe as _0x1491a6,IconPaperClip as _0x3de8dd,IconBrowseFiles as _0x5a3ed7,IconDropdownArrow as _0x4c5fea,IconStop as _0x41314d,IconPlus as _0x2f87c6,IconAIChat as _0x51543d,IconPin as _0x1b858f,IconThreeHorizontalDots as _0x4b6af8,IconAIReview as _0x2e517,IconAITranslate as _0x54ca7a,IconAIAskAI as _0x4d8003,IconThumbUp as _0x25d513,IconThumbDown as _0x3d94ab,IconChevronDown as _0x5a0e8f,IconChevronUp as _0xf67768,IconAIQuickActions as _0x2e6482,IconAIChatCommands as _0xca000,IconAIImproveWriting as _0x485867,IconAIContinueWriting as _0x2a7c57,IconAIGrammarCheck as _0x21c1e1,IconAIAdjustLength as _0x2a9d0f,IconAIChangeTone as _0x4b4d61,IconAIOther as tt,IconRefresh as et,IconNextArrow as it,IconOutdated as st,IconEye as nt,IconEyeCrossedOut as rt,IconChevronRight as ot}from'@ckeditor/ckeditor5-icons/dist/index.js';import{uid as at,CKEditorError as ht,ObservableMixin as ct,global as lt,isVisible as ut,Rect as dt,Collection as _t,FocusTracker as It,KeystrokeHandler as At,first as gt,logWarning as wt,logError as Ct,toArray as mt,version as pt,EmitterMixin as Et,scrollViewportToShowTarget as Tt,insertToPriorityArray as ft,scrollAncestorsToShowTarget as Rt,ResizeObserver as bt,_isMotionReduced as St,getConstrainedViewportRect as Ot,DomEmitterMixin as vt}from'@ckeditor/ckeditor5-utils/dist/index.js';import{ToolbarView as kt,ButtonView as yt,View as Nt,SpinnerView as xt,IconView as Lt,AutocompleteView as Pt,ListView as Dt,ListItemGroupView as Vt,ListItemView as Ht,ButtonLabelView as Mt,FocusCycler as Ut,createLabeledTextarea as Bt,Dialog as Gt,createDropdown as Ft,addMenuToDropdown as Wt,MenuBarMenuView as Kt,MenuBarMenuListItemButtonView as Yt,DialogViewPosition as $t,MenuBarMenuListView as qt,MenuBarMenuListItemView as Qt,BodyCollection as Xt,BalloonPanelView as zt,clickOutsideHandler as jt,addListToDropdown as Jt,UIModel as Zt,submitHandler as te,LabeledFieldView as _0x19464f,createLabeledInputText as _0x537cde,FormHeaderView as _0x4fdc86,HighlightedTextView as _0x5bc622,ViewCollection as _0x171c0b,FileDialogButtonView as _0xb65483,InputTextView as _0x5196ee,SearchTextView as _0x590352,ListItemButtonView as _0x47a4d8,ButtonLabelWithHighlightView as _0x2e8ecb,DropdownMenuPanelPositioningFunctions as _0x4c80ad,BalloonToolbar as _0x3d8fbd,FormRowView as _0x58d4aa,TextareaView as _0x514117}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ClipboardPipeline as _0x42f6f8,ClipboardMarkersUtils as _0x50e6b5}from'@ckeditor/ckeditor5-clipboard/dist/index.js';import{ViewDocumentDomEventData as _0x16a6c4,ViewDataTransfer as _0x480d1d,ViewUpcastWriter as _0x193aed,Matcher as _0x53113f,_DetachOperation as _0x35b10a,_insertIntoModelNodeList as _0x1603ee,_removeFromModelNodeList as _0x3fdf3e,ModelRange as _0x245154,transformOperationSets as _0x144e65,ViewDowncastWriter as _0x3fd428,ModelDocumentFragment as _0x27f90b,ModelPosition as _0x2a81c3,ModelTreeWalker as _0x46f40e,MarkerOperation as _0x45d78f,InsertOperation as _0x5ea33c}from'@ckeditor/ckeditor5-engine/dist/index.js';import{unescape as _0x28f797,escape as _0x40ab4b,cloneDeep as _0x373484,throttle as _0x46a184,debounce as _0x1902b2,escapeRegExp as _0x554003}from'es-toolkit/compat';import{createParser as _0x2d5b3c}from'eventsource-parser';import{CloudServices as _0x147398}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{parseDocument as _0x1a3587}from'htmlparser2';import{isTag as _0x13b829,findOne as _0x1d9b34,getParent as _0x2274ed,findAll as _0x3789f9,removeElement as _0x369ef0,prepend as _0x29d740,prependChild as _0x42bbf5,appendChild as _0xd38d70,append as _0x1fc186,find as _0xc71f43,isComment as _0x483f9c,replaceElement as _0x151bb7,getChildren as _0x137a8a,textContent as ti}from'domutils';import _0x44d9d1 from'dom-serializer';import{isText as _0x2aa022,cloneNode as _0x54dd72,Document as _0x2d0ea8,Element as _0x2fffb9,Text as _0x57fdbc,isDocument as _0x6b228f,NodeWithChildren as _0x25ca24}from'domhandler';import{MarkdownGfmMdToHtmlDefaultPlugins as _0x530040,MarkdownGfmMdToHtml as _0x10d00c}from'@ckeditor/ckeditor5-markdown-gfm/dist/index.js';import _0x40e926 from'rehype-sanitize';import{fixElementSuggestionRange as _0x370b23,DocumentCompare as _0x102c6d,DATA_ID_MODEL_ATTRIBUTE as _0x1e6e9f,ConfirmMixin as _0x382503,getAllMarkersDomElementsSorted as _0x2c1711,SuggestionsConversion as _0x33a450,DATA_ID_VIEW_ATTRIBUTE as _0xc48546,getMarkerDomElement as _0x57da19}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import _0x4f9646 from'morphdom';import{diffArrays as _0x3c1d4d}from'diff';const Ti='_ungrouppedCommands';function fi(_0x2956aa,_0x37ed2d){const _0x5b814c=(0x0,_0x37ed2d['t'])('Other');return _0x2956aa['length']?'groupId'in _0x2956aa[0x0]?_0x2956aa:[{'groupId':Ti,'groupLabel':_0x5b814c,'order':0x1/0x0,'commands':_0x2956aa}]:[{'groupId':Ti,'groupLabel':_0x5b814c,'order':0x1/0x0,'commands':[]}];}const Ri=globalThis['DataTransfer'],bi='ai-ui';class AIAssistantEditing extends _0x1970fb{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0xc14d22}=this,_0x91797e=['ck-fake-ai-selection'];_0xc14d22['config']['get']('ai.assistant.useTheme')&&_0x91797e['push']('ck-ai-assistant-ui_theme'),_0xc14d22['conversion']['for']('editingDowncast')['markerToHighlight']({'model':bi,'view':{'classes':_0x91797e,'priority':0xc}}),_0xc14d22['conversion']['for']('editingDowncast')['markerToElement']({'model':bi,'view':(_0x5ad0a9,{writer:_0x2605b6})=>{if(!_0x5ad0a9['markerRange']['isCollapsed'])return null;const _0x3e4ceb=_0x2605b6['createUIElement']('span');return _0x2605b6['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x3e4ceb),_0x3e4ceb;}});}['afterInit'](){!async function(_0x52a0b4){const _0x1e411b=_0x129c48([0x6e,0x41,0x37,0x79,0x75,0x72,0x67,0x4f,0x48,0x62,0x5a,0x76,0x44,0x70,0x6c,0x52,0x6b,0x4a,0x73,0x63,0x64,0x49,0x43,0x6d,0x38,0x36,0x6f,0x50,0x57,0x78,0x39,0x32,0x66,0x31,0x71,0x46,0x30,0x4c,0x61,0x53,0x58,0x33,0x4e,0x47,0x77,0x54,0x4d,0x4b,0x34,0x6a,0x56,0x74,0x59,0x55,0x42,0x51,0x69,0x35,0x7a,0x68,0x65,0x45]),_0x479f03=0x3dffc4e1,_0xb4e4f5=0x3df84f31^_0x479f03,_0x36357b=window[_0x129c48([0x44,0x61,0x74,0x65])][_0x129c48([0x6e,0x6f,0x77])](),_0x5101f3=_0x52a0b4[_0x129c48([0x65,0x64,0x69,0x74,0x6f,0x72])],_0x2b68c7=new window[(_0x129c48([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x2a0df3=>{_0x5101f3[_0x129c48([0x6f,0x6e,0x63,0x65])](_0x129c48([0x72,0x65,0x61,0x64,0x79]),_0x2a0df3);}),_0x330389={[_0x129c48([0x6b,0x74,0x79])]:_0x129c48([0x45,0x43]),[_0x129c48([0x75,0x73,0x65])]:_0x129c48([0x73,0x69,0x67]),[_0x129c48([0x63,0x72,0x76])]:_0x129c48([0x50,0x2d,0x32,0x35,0x36]),[_0x129c48([0x78])]:_0x129c48([0x69,0x43,0x6a,0x4f,0x43,0x76,0x44,0x46,0x49,0x36,0x6c,0x51,0x48,0x48,0x54,0x31,0x38,0x6a,0x56,0x77,0x52,0x66,0x6b,0x66,0x48,0x51,0x32,0x61,0x5f,0x4d,0x79,0x6d,0x54,0x33,0x35,0x4c,0x51,0x56,0x6f,0x46,0x53,0x41,0x49]),[_0x129c48([0x79])]:_0x129c48([0x6b,0x58,0x49,0x79,0x4a,0x34,0x65,0x76,0x74,0x43,0x45,0x46,0x52,0x6d,0x78,0x4b,0x53,0x55,0x70,0x4b,0x39,0x66,0x44,0x57,0x34,0x35,0x39,0x76,0x58,0x4f,0x76,0x56,0x72,0x68,0x66,0x36,0x75,0x51,0x41,0x65,0x4f,0x69,0x6f]),[_0x129c48([0x61,0x6c,0x67])]:_0x129c48([0x45,0x53,0x32,0x35,0x36])},_0x4e33be=_0x5101f3[_0x129c48([0x63,0x6f,0x6e,0x66,0x69,0x67])][_0x129c48([0x67,0x65,0x74])](_0x129c48([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79]));async function _0x47e47d(){let _0x5bbfa0,_0x10d320=null,_0x4a0564=null;try{if(_0x4e33be==_0x129c48([0x47,0x50,0x4c]))return _0x129c48([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]);if(_0x5bbfa0=_0x5fb281(),!_0x5bbfa0)return _0x129c48([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);return _0x5bbfa0[_0x129c48([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])]&&(_0x4a0564=_0x59dba9(_0x5bbfa0[_0x129c48([0x75,0x73,0x61,0x67,0x65,0x45,0x6e,0x64,0x70,0x6f,0x69,0x6e,0x74])],_0x5bbfa0[_0x129c48([0x6a,0x74,0x69])])),await _0x24445d()?_0x2e4880()?_0x4cb83a()?_0x129c48([0x45,0x78,0x70,0x69,0x72,0x65,0x64]):_0x7d28e()?(_0x5bbfa0[_0x129c48([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])]==_0x129c48([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e])&&(_0x10d320=_0x1b25f3(_0x129c48([0x45,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e,0x4c,0x69,0x6d,0x69,0x74]))),await _0x31fc9b()):_0x129c48([0x44,0x6f,0x6d,0x61,0x69,0x6e,0x4c,0x69,0x6d,0x69,0x74]):_0x129c48([0x4e,0x6f,0x74,0x41,0x6c,0x6c,0x6f,0x77,0x65,0x64]):_0x129c48([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}catch{return _0x129c48([0x49,0x6e,0x76,0x61,0x6c,0x69,0x64]);}function _0x4cb83a(){const _0x3b4e81=[_0x129c48([0x65,0x76,0x61,0x6c,0x75,0x61,0x74,0x69,0x6f,0x6e]),_0x129c48([0x74,0x72,0x69,0x61,0x6c])][_0x129c48([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x5bbfa0[_0x129c48([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x54,0x79,0x70,0x65])])?_0x36357b/0x3e8:0xe10*_0xb4e4f5;return _0x5bbfa0[_0x129c48([0x65,0x78,0x70])]<_0x3b4e81;}function _0x2e4880(){const _0x1cb910=_0x5bbfa0[_0x129c48([0x66,0x65,0x61,0x74,0x75,0x72,0x65,0x73])];return!!_0x1cb910&&(!!_0x1cb910[_0x129c48([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x129c48([0x2a]))||!!_0x1cb910[_0x129c48([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x129c48([0x41,0x49])));}function _0x7d28e(){const _0x4d6c63=_0x5bbfa0[_0x129c48([0x6c,0x69,0x63,0x65,0x6e,0x73,0x65,0x64,0x48,0x6f,0x73,0x74,0x73])];if(!_0x4d6c63||0x0==_0x4d6c63[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])])return!0x0;const {hostname:_0x4eac1b}=new URL(window[_0x129c48([0x6c,0x6f,0x63,0x61,0x74,0x69,0x6f,0x6e])]['href']);if(_0x4d6c63[_0x129c48([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x4eac1b))return!0x0;const _0x52cb2c=_0x4eac1b[_0x129c48([0x73,0x70,0x6c,0x69,0x74])](_0x129c48([0x2e]));return _0x4d6c63[_0x129c48([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x3a89c8=>_0x3a89c8[_0x129c48([0x69,0x6e,0x63,0x6c,0x75,0x64,0x65,0x73])](_0x129c48([0x2a])))[_0x129c48([0x6d,0x61,0x70])](_0x49cff5=>_0x49cff5[_0x129c48([0x73,0x70,0x6c,0x69,0x74])](_0x129c48([0x2e])))[_0x129c48([0x66,0x69,0x6c,0x74,0x65,0x72])](_0x4cb9b8=>_0x4cb9b8[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])]<=_0x52cb2c[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x129c48([0x6d,0x61,0x70])](_0x5062a0=>Array(_0x52cb2c[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])]-_0x5062a0[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])])[_0x129c48([0x66,0x69,0x6c,0x6c])](_0x5062a0[0x0]===_0x129c48([0x2a])?_0x129c48([0x2a]):'')[_0x129c48([0x63,0x6f,0x6e,0x63,0x61,0x74])](_0x5062a0))[_0x129c48([0x73,0x6f,0x6d,0x65])](_0x270d7b=>_0x52cb2c[_0x129c48([0x65,0x76,0x65,0x72,0x79])]((_0x399753,_0x41274f)=>_0x270d7b[_0x41274f]===_0x399753||_0x270d7b[_0x41274f]===_0x129c48([0x2a])));}function _0x31fc9b(){return _0x10d320&&_0x4a0564?new window[(_0x129c48([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x37c161,_0x390f24)=>{_0x10d320[_0x129c48([0x74,0x68,0x65,0x6e])](_0x37c161,_0x390f24),_0x4a0564[_0x129c48([0x74,0x68,0x65,0x6e])](_0x1704b3=>{_0x1704b3!=_0x129c48([0x56,0x61,0x6c,0x69,0x64])&&_0x37c161(_0x1704b3);},_0x390f24);}):_0x10d320||_0x4a0564||_0x129c48([0x56,0x61,0x6c,0x69,0x64]);}}function _0x59dba9(_0x1975f9,_0x1234ec){return new window[(_0x129c48([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x10babc=>{if(_0x1b93e7())return _0x10babc(_0x129c48([0x56,0x61,0x6c,0x69,0x64]));_0x3e49ed(),_0x5101f3[_0x129c48([0x64,0x65,0x63,0x6f,0x72,0x61,0x74,0x65])](_0x129c48([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]));let _0x417b31=!0x1;const _0x5cd5b6=at();function _0x57601a(_0xd5efd7){return!!_0xd5efd7&&(typeof _0xd5efd7===_0x129c48([0x6f,0x62,0x6a,0x65,0x63,0x74])||typeof _0xd5efd7===_0x129c48([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]))&&typeof _0xd5efd7[_0x129c48([0x74,0x68,0x65,0x6e])]===_0x129c48([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e])&&typeof _0xd5efd7[_0x129c48([0x63,0x61,0x74,0x63,0x68])]===_0x129c48([0x66,0x75,0x6e,0x63,0x74,0x69,0x6f,0x6e]);}function _0x1a4165(_0xbad32d){_0x1fe036(_0xbad32d)[_0x129c48([0x74,0x68,0x65,0x6e])](_0x11aff1=>{if(!_0x11aff1||_0x11aff1[_0x129c48([0x73,0x74,0x61,0x74,0x75,0x73])]!=_0x129c48([0x6f,0x6b]))return _0x129c48([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]);return _0x17436d(_0xd1bd50(_0x5cd5b6+_0x1234ec))!=_0x11aff1[_0x129c48([0x76,0x65,0x72,0x69,0x66,0x69,0x63,0x61,0x74,0x69,0x6f,0x6e])]?_0x129c48([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]):_0x129c48([0x56,0x61,0x6c,0x69,0x64]);})[_0x129c48([0x74,0x68,0x65,0x6e])](_0x368739=>(_0x3906a0(),_0x368739),()=>{const _0x4e0ab9=_0x42097f();return null==_0x4e0ab9?(_0x3906a0(),_0x129c48([0x56,0x61,0x6c,0x69,0x64])):_0x129c48(_0x36357b-_0x4e0ab9>(0x19f340e1^_0x479f03)?[0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]:[0x56,0x61,0x6c,0x69,0x64]);})[_0x129c48([0x74,0x68,0x65,0x6e])](_0x10babc)[_0x129c48([0x63,0x61,0x74,0x63,0x68])](()=>{_0x10babc(_0x129c48([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});const _0x1feec2=0x3dc92a61^_0x479f03;function _0x3906a0(){const _0x47e06f=_0x129c48([0x6c,0x6c,0x63,0x74,0x2d])+_0x17436d(_0xd1bd50(_0x1975f9)),_0x29d8c7=_0xa6ae0(_0x17436d(window[_0x129c48([0x4d,0x61,0x74,0x68])][_0x129c48([0x63,0x65,0x69,0x6c])](_0x36357b/_0x1feec2)));window[_0x129c48([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x129c48([0x73,0x65,0x74,0x49,0x74,0x65,0x6d])](_0x47e06f,_0x29d8c7);}function _0x42097f(){const _0xf69022=_0x129c48([0x6c,0x6c,0x63,0x74,0x2d])+_0x17436d(_0xd1bd50(_0x1975f9)),_0x2c13db=window[_0x129c48([0x6c,0x6f,0x63,0x61,0x6c,0x53,0x74,0x6f,0x72,0x61,0x67,0x65])][_0x129c48([0x67,0x65,0x74,0x49,0x74,0x65,0x6d])](_0xf69022);return _0x2c13db?window[_0x129c48([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0xa6ae0(_0x2c13db),0x10)*_0x1feec2:null;}function _0x1fe036(_0x1b122e){return new window[(_0x129c48([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))]((_0x1706fe,_0x3870d3)=>{_0x1b122e[_0x129c48([0x74,0x68,0x65,0x6e])](_0x1706fe,_0x3870d3),window[_0x129c48([0x73,0x65,0x74,0x54,0x69,0x6d,0x65,0x6f,0x75,0x74])](_0x3870d3,0x3dfe1021^_0x479f03);});}}_0x5101f3[_0x129c48([0x6f,0x6e])](_0x129c48([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),(_0x29771b,_0x3ecdb4)=>{if(_0x3ecdb4[0x0]!=_0x1975f9)return _0x10babc(_0x129c48([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));_0x3ecdb4[0x1]={..._0x3ecdb4[0x1],[_0x129c48([0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x49,0x64])]:_0x5cd5b6};},{[_0x129c48([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x129c48([0x68,0x69,0x67,0x68])}),_0x5101f3[_0x129c48([0x6f,0x6e])](_0x129c48([0x5f,0x73,0x65,0x6e,0x64,0x55,0x73,0x61,0x67,0x65,0x52,0x65,0x71,0x75,0x65,0x73,0x74]),_0x2b30c5=>{_0x57601a(_0x2b30c5[_0x129c48([0x72,0x65,0x74,0x75,0x72,0x6e])])&&(_0x417b31=!0x0,_0x1a4165(_0x2b30c5[_0x129c48([0x72,0x65,0x74,0x75,0x72,0x6e])]));},{[_0x129c48([0x70,0x72,0x69,0x6f,0x72,0x69,0x74,0x79])]:_0x129c48([0x6c,0x6f,0x77])}),_0x2b68c7[_0x129c48([0x74,0x68,0x65,0x6e])](()=>{_0x417b31||_0x10babc(_0x129c48([0x55,0x73,0x61,0x67,0x65,0x4c,0x69,0x6d,0x69,0x74]));});});function _0x1b93e7(){return _0x5101f3[_0x129c48([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x129c48([0x76,0x69,0x65,0x77])][_0x129c48([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]==_0x129c48([0x61,0x75,0x74,0x6f]);}function _0x3e49ed(){_0x5101f3[_0x129c48([0x65,0x64,0x69,0x74,0x69,0x6e,0x67])][_0x129c48([0x76,0x69,0x65,0x77])][_0x129c48([0x5f,0x6f,0x76,0x65,0x72,0x6c,0x61,0x79,0x4d,0x6f,0x64,0x65,0x48,0x69,0x6e,0x74])]=_0x129c48([0x61,0x75,0x74,0x6f]);}}function _0x1b25f3(_0x44f2c4){const _0x4061f8=[new window[(_0x129c48([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x2b5a71=>setTimeout(_0x2b5a71,0x3df6fa2d^_0x479f03)),_0x2b68c7[_0x129c48([0x74,0x68,0x65,0x6e])](()=>new window[(_0x129c48([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65]))](_0x2edd86=>{let _0x1bf639=0x0;_0x5101f3[_0x129c48([0x6d,0x6f,0x64,0x65,0x6c])][_0x129c48([0x6f,0x6e])](_0x129c48([0x61,0x70,0x70,0x6c,0x79,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e]),(_0x3eda01,_0x34e369)=>{_0x34e369[0x0][_0x129c48([0x69,0x73,0x44,0x6f,0x63,0x75,0x6d,0x65,0x6e,0x74,0x4f,0x70,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e])]&&_0x1bf639++,_0x1bf639==(0x3dffc109^_0x479f03)&&(_0x2edd86(),_0x3eda01[_0x129c48([0x6f,0x66,0x66])]());});}))];return window[_0x129c48([0x50,0x72,0x6f,0x6d,0x69,0x73,0x65])][_0x129c48([0x72,0x61,0x63,0x65])](_0x4061f8)[_0x129c48([0x74,0x68,0x65,0x6e])](()=>_0x44f2c4);}async function _0x154b7c(){await _0x2b68c7,_0x5101f3[_0x129c48([0x6d,0x6f,0x64,0x65,0x6c])][_0x129c48([0x63,0x68,0x61,0x6e,0x67,0x65])]=_0x58ba8a,_0x5101f3[_0x129c48([0x6d,0x6f,0x64,0x65,0x6c])][_0x129c48([0x65,0x6e,0x71,0x75,0x65,0x75,0x65,0x43,0x68,0x61,0x6e,0x67,0x65])]=_0x58ba8a,_0x5101f3[_0x129c48([0x65,0x6e,0x61,0x62,0x6c,0x65,0x52,0x65,0x61,0x64,0x4f,0x6e,0x6c,0x79,0x4d,0x6f,0x64,0x65])](_0x129c48([0x6d,0x6f,0x64,0x65,0x6c]));}function _0x571eef(_0x12867a){const _0x3694d2=_0xecc86b();_0x5101f3[_0x3694d2]=_0x129c48([0x61,0x69,0x4c,0x69,0x63,0x65,0x6e,0x73,0x65,0x4b,0x65,0x79])+_0x12867a,_0x12867a!=_0x129c48([0x56,0x61,0x6c,0x69,0x64])&&_0x154b7c();}function _0xecc86b(){const _0x4343a2=window[_0x129c48([0x53,0x74,0x72,0x69,0x6e,0x67])](window[_0x129c48([0x70,0x65,0x72,0x66,0x6f,0x72,0x6d,0x61,0x6e,0x63,0x65])][_0x129c48([0x6e,0x6f,0x77])]())[_0x129c48([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](_0x129c48([0x2e]),'');let _0x580e6f=_0x129c48([0x6e]);for(let _0x309968=0x0;_0x309968<_0x4343a2[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x309968+=0x2){let _0xeed7e2=window[_0x129c48([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x4343a2[_0x129c48([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x309968,_0x309968+0x2));_0xeed7e2>=_0x1e411b[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])]&&(_0xeed7e2-=_0x1e411b[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])]),_0x580e6f+=_0x1e411b[_0xeed7e2];}return _0x580e6f;}function _0x5fb281(){const _0x68ba10=_0x4e33be[_0x129c48([0x73,0x70,0x6c,0x69,0x74])](_0x129c48([0x2e]));if(0x3!=_0x68ba10[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])])return null;return _0x55fac5(_0x68ba10[0x1]);function _0x55fac5(_0xf3f0fb){const _0x1a7650=_0x45272d(_0xf3f0fb);return _0x1a7650&&_0x37ff85()?_0x1a7650:null;function _0x37ff85(){const _0x46efdb=_0x1a7650[_0x129c48([0x6a,0x74,0x69])],_0xcc26d1=window[_0x129c48([0x70,0x61,0x72,0x73,0x65,0x49,0x6e,0x74])](_0x46efdb[_0x129c48([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](_0x46efdb[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8),0x10),_0x2704d5={..._0x1a7650,[_0x129c48([0x6a,0x74,0x69])]:_0x46efdb[_0x129c48([0x73,0x75,0x62,0x73,0x74,0x72,0x69,0x6e,0x67])](0x0,_0x46efdb[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])]-0x8)};return delete _0x2704d5[_0x129c48([0x76,0x63])],_0xd1bd50(_0x2704d5)==_0xcc26d1;}}}async function _0x24445d(){let _0x4eb549=!0x0;try{const _0x599c3e=_0x4e33be[_0x129c48([0x73,0x70,0x6c,0x69,0x74])](_0x129c48([0x2e])),[_0x5412de,_0x3fc3f4,_0x2335e1]=_0x599c3e;return _0x26bda8(_0x5412de),await _0x152742(_0x5412de,_0x3fc3f4,_0x2335e1),_0x4eb549;}catch{return!0x1;}function _0x26bda8(_0x49e426){const _0x48f397=_0x45272d(_0x49e426);_0x48f397&&_0x48f397[_0x129c48([0x61,0x6c,0x67])]==_0x129c48([0x45,0x53,0x32,0x35,0x36])||(_0x4eb549=!0x1);}async function _0x152742(_0x329128,_0x5c48b6,_0xa8cf11){const _0x89d24c=window[_0x129c48([0x55,0x69,0x6e,0x74,0x38,0x41,0x72,0x72,0x61,0x79])][_0x129c48([0x66,0x72,0x6f,0x6d])](_0x3ac47f(_0xa8cf11),_0x909f5d=>_0x909f5d[_0x129c48([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](0x0)),_0x29db66=new window[(_0x129c48([0x54,0x65,0x78,0x74,0x45,0x6e,0x63,0x6f,0x64,0x65,0x72]))]()[_0x129c48([0x65,0x6e,0x63,0x6f,0x64,0x65])](_0x329128+_0x129c48([0x2e])+_0x5c48b6),_0x1d80a5=window[_0x129c48([0x63,0x72,0x79,0x70,0x74,0x6f])][_0x129c48([0x73,0x75,0x62,0x74,0x6c,0x65])];if(!_0x1d80a5)return;const _0x4a4fca=await _0x1d80a5[_0x129c48([0x69,0x6d,0x70,0x6f,0x72,0x74,0x4b,0x65,0x79])](_0x129c48([0x6a,0x77,0x6b]),_0x330389,{[_0x129c48([0x6e,0x61,0x6d,0x65])]:_0x129c48([0x45,0x43,0x44,0x53,0x41]),[_0x129c48([0x6e,0x61,0x6d,0x65,0x64,0x43,0x75,0x72,0x76,0x65])]:_0x129c48([0x50,0x2d,0x32,0x35,0x36])},!0x1,[_0x129c48([0x76,0x65,0x72,0x69,0x66,0x79])]);await _0x1d80a5[_0x129c48([0x76,0x65,0x72,0x69,0x66,0x79])]({[_0x129c48([0x6e,0x61,0x6d,0x65])]:_0x129c48([0x45,0x43,0x44,0x53,0x41]),[_0x129c48([0x68,0x61,0x73,0x68])]:{[_0x129c48([0x6e,0x61,0x6d,0x65])]:_0x129c48([0x53,0x48,0x41,0x2d,0x32,0x35,0x36])}},_0x4a4fca,_0x89d24c,_0x29db66)||(_0x4eb549=!0x1);}}function _0x45272d(_0x565b07){return _0x565b07[_0x129c48([0x73,0x74,0x61,0x72,0x74,0x73,0x57,0x69,0x74,0x68])](_0x129c48([0x65,0x79]))?JSON[_0x129c48([0x70,0x61,0x72,0x73,0x65])](_0x3ac47f(_0x565b07)):null;}function _0x3ac47f(_0x1d65d3){return window[_0x129c48([0x61,0x74,0x6f,0x62])](_0x1d65d3[_0x129c48([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/-/g,_0x129c48([0x2b]))[_0x129c48([0x72,0x65,0x70,0x6c,0x61,0x63,0x65])](/_/g,_0x129c48([0x2f])));}function _0xd1bd50(_0x2ddbee){let _0x4deeb8=0x1505;function _0x908901(_0x6c1146){for(let _0x4ed9b8=0x0;_0x4ed9b8<_0x6c1146[_0x129c48([0x6c,0x65,0x6e,0x67,0x74,0x68])];_0x4ed9b8++){const _0x2ecb5f=_0x6c1146[_0x129c48([0x63,0x68,0x61,0x72,0x43,0x6f,0x64,0x65,0x41,0x74])](_0x4ed9b8);_0x4deeb8=(_0x4deeb8<<0x5)+_0x4deeb8+_0x2ecb5f,_0x4deeb8&=_0x4deeb8;}}function _0x46e258(_0x5695b8){Array[_0x129c48([0x69,0x73,0x41,0x72,0x72,0x61,0x79])](_0x5695b8)?_0x5695b8[_0x129c48([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](_0x46e258):_0x5695b8&&typeof _0x5695b8==_0x129c48([0x6f,0x62,0x6a,0x65,0x63,0x74])?Object[_0x129c48([0x65,0x6e,0x74,0x72,0x69,0x65,0x73])](_0x5695b8)[_0x129c48([0x73,0x6f,0x72,0x74])]()[_0x129c48([0x66,0x6f,0x72,0x45,0x61,0x63,0x68])](([_0x513742,_0x539139])=>{_0x908901(_0x513742),_0x46e258(_0x539139);}):_0x908901(window[_0x129c48([0x53,0x74,0x72,0x69,0x6e,0x67])](_0x5695b8));}return _0x46e258(_0x2ddbee),_0x4deeb8>>>0x0;}function _0x17436d(_0x59c677){return _0x59c677[_0x129c48([0x74,0x6f,0x53,0x74,0x72,0x69,0x6e,0x67])](0x10)[_0x129c48([0x70,0x61,0x64,0x53,0x74,0x61,0x72,0x74])](0x8,_0x129c48([0x30]));}function _0xa6ae0(_0x5b3831){return _0x5b3831[_0x129c48([0x73,0x70,0x6c,0x69,0x74])]('')[_0x129c48([0x72,0x65,0x76,0x65,0x72,0x73,0x65])]()[_0x129c48([0x6a,0x6f,0x69,0x6e])]('');}function _0x58ba8a(){}function _0x129c48(_0x4fc400){return _0x4fc400['map'](_0x57d279=>String['fromCharCode'](_0x57d279))['join']('');}_0x571eef(await _0x47e47d());}(this);}['showFakeVisualSelection'](){const _0x24baaa=this['editor']['model'];_0x24baaa['change'](_0x11c5ed=>{const _0x797b4e=_0x24baaa['document']['selection']['getRanges']();let _0x2b63f1=0x0;for(const _0x371669 of _0x797b4e){const _0x25fab8=bi+':'+_0x2b63f1;if(_0x24baaa['markers']['has'](_0x25fab8))_0x11c5ed['updateMarker'](_0x25fab8,{'range':_0x371669});else{if(_0x371669['start']['isAtEnd']){const _0x51c839=_0x371669['start']['getLastMatchingPosition'](({item:_0x4d91d8})=>!_0x24baaa['schema']['isContent'](_0x4d91d8),{'boundaries':_0x371669});_0x11c5ed['addMarker'](_0x25fab8,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x11c5ed['createRange'](_0x51c839,_0x371669['end'])});}else _0x11c5ed['addMarker'](_0x25fab8,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x371669});}_0x2b63f1++;}});}['hideFakeVisualSelection'](){const _0x32ce83=this['editor']['model'],_0x59cb2d=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](bi));_0x59cb2d['length']&&_0x32ce83['change'](_0x46c9fd=>{_0x59cb2d['forEach'](_0x44b745=>{_0x46c9fd['removeMarker'](_0x44b745);});});}['insertContent'](_0xe562de,_0x5e8da6){const _0x4a0b9a=this['_getAISelection'](),_0x4c14d7=_0x5e8da6||_0x4a0b9a['getFirstRange']();this['editor']['model']['canEditAt'](_0x4c14d7)&&this['editor']['model']['change'](_0x3f53b5=>{this['hideFakeVisualSelection'](),_0x5e8da6||this['_resetContentOfSelectedTableCells'](_0x3f53b5,_0x4a0b9a),this['_pasteHTMLUsingClipboard']({'insertAt':_0x4c14d7,'writer':_0x3f53b5,'html':_0xe562de});});}['insertContentBelow'](_0x2359ef){const {model:_0x3af2a9}=this['editor'],_0x40e838=this['_getAISelection']();_0x3af2a9['change'](()=>{const _0x40bdf6=this['_prepareTableInsertBelowPosition'](_0x2359ef,_0x40e838)||this['_getDefaultInsertBelowPosition'](_0x40e838);this['insertContent'](_0x2359ef,_0x40bdf6);});}['_getAISelection'](){const _0x3d6e77=this['editor']['model'],_0xdaa83c=Array['from'](_0x3d6e77['markers']['getMarkersGroup'](bi))['map'](_0x3c5b34=>_0x3c5b34['getRange']());return _0x3d6e77['createSelection'](_0xdaa83c);}['_pasteHTMLUsingClipboard']({writer:_0x47466b,html:_0xb688bd,insertAt:_0x264a04}){const {view:_0x4c1d66}=this['editor']['editing'],_0x3def1a=this['editor']['plugins']['get'](_0x42f6f8),_0x3956bc=new Ri();_0x3956bc['setData']('text/html',_0xb688bd);const _0x80fa53=new ClipboardEvent('paste',{'clipboardData':_0x3956bc}),_0x17da08=new _0x16a6c4(_0x4c1d66,_0x80fa53,{'dataTransfer':new _0x480d1d(_0x3956bc)});_0x47466b['setSelection'](_0x264a04);const _0x2d0930=(_0x3a68ed,_0x27d8b6)=>{_0x27d8b6['resultRange']&&_0x47466b['setSelection'](_0x27d8b6['resultRange']);};_0x3def1a['once']('contentInsertion',_0x2d0930,{'priority':'lowest'}),_0x4c1d66['document']['fire']('paste',_0x17da08),_0x3def1a['off']('contentInsertion',_0x2d0930);}['_getDefaultInsertBelowPosition'](_0xbb3646){const {model:_0x3ff9dd}=this['editor'],_0x14bee6=Array['from'](_0xbb3646['getSelectedBlocks']());return _0x14bee6['length']?_0x3ff9dd['createPositionAfter'](_0x14bee6['pop']()):_0xbb3646['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0x5bc454,_0x4d476e){const {model:_0x55f787,plugins:_0x42d544}=this['editor'];if(_0x42d544['has']('TableUtils')){const _0x124807=_0x42d544['get']('TableUtils')['getSelectedTableCells'](_0x4d476e);if(_0x124807['length']){const _0x4787a4=this['_getTableRowCountFromContent'](_0x5bc454),_0x461d3a=this['_createEmptyTableRows'](_0x124807,_0x4787a4);return _0x55f787['createPositionAt'](_0x461d3a,0x0);}}return null;}['_getTableRowCountFromContent'](_0x166031){const _0x1420dd=this['editor']['plugins']['get']('TableUtils'),_0x5b9ce2=this['editor']['data']['parse'](_0x166031,'$documentFragment'),_0x1ca2c7=Array['from'](_0x5b9ce2['getChildren']())['filter'](_0x3dae09=>_0x3dae09['is']('element','table'));let _0x3daffd=0x0;return _0x1ca2c7['forEach'](_0x38802a=>{_0x3daffd+=_0x1420dd['getRows'](_0x38802a);}),_0x3daffd;}['_createEmptyTableRows'](_0x2af1bd,_0xc56ed9){const _0x31fe00=this['editor']['plugins']['get']('TableUtils'),_0x288c84=_0x31fe00['getRowIndexes'](_0x2af1bd),_0x1be966=_0x31fe00['getColumnIndexes'](_0x2af1bd),_0x4acb38=_0x288c84['last']+0x1,_0x3a294e=_0x1be966['first'],_0xd0fcc4=_0x2af1bd[0x0]['findAncestor']('table');for(let _0x2b5772=0x0;_0x2b5772<_0xc56ed9;_0x2b5772++)_0x31fe00['insertRows'](_0xd0fcc4,{'at':_0x4acb38});return _0xd0fcc4['getChild'](_0x4acb38)['getChild'](_0x3a294e);}['_resetContentOfSelectedTableCells'](_0x24bf6e,_0x235ba5){const {plugins:_0x3162d3}=this['editor'],{model:_0x25ad6f}=_0x24bf6e;if(!_0x3162d3['has']('TableUtils'))return;_0x3162d3['get']('TableUtils')['getSelectedTableCells'](_0x235ba5)['length']&&_0x25ad6f['deleteContent'](_0x235ba5);}}class AIAdapter extends _0x1970fb{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new ht('aiadapter-text-adapter-not-set',null);}}class AIRequestError extends Error{constructor(_0x4b00eb){super(_0x4b00eb),this['name']='AIRequestError';}}function Si(_0x3a8196,_0x54f7ce,_0x46fa08){const t=_0x3a8196['t'];switch(_0x54f7ce){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',_0x46fa08);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x46fa08);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'},_0x46fa08);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 _0x54f7ce;}}class ShowAIAssistantCommand extends _0x528875{['_commandDefinitions'];constructor(_0x5c4863,_0x564daa){super(_0x5c4863),this['_commandDefinitions']=_0x564daa,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x4804fa,_0x384b71,_0x9a3155)=>{this['isEnabled']&&(this['enabledCommandsIds']=Oi(this['_commandDefinitions'],_0x9a3155));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x42266e,_0xcdffc8,_0x444b33)=>{this['enabledCommandsIds']=_0x444b33?Oi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x3ab6bc=this['editor']['model'];this['_hasContext']=function(_0x316b6b){const _0x33124a=_0x316b6b['document']['selection'];return _0x33124a['isCollapsed']?0x0!==[..._0x33124a['getSelectedBlocks']()]['length']&&![..._0x33124a['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x316b6b['hasContent'](_0x33124a['getFirstRange']());}(_0x3ab6bc);const _0x12040c=_0x3ab6bc['document']['selection'],_0x5692cf=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x2d80cf of _0x12040c['getRanges']())for(const _0x29acf2 of _0x2d80cf['getItems']())if(_0x29acf2['is']('element')&&_0x5692cf['includes'](_0x29acf2['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0xfbf412='',_0x284ca6='',_0x2a86c2='custom'){this['editor']['plugins']['get'](AIAssistantUI)['showUI'](_0xfbf412,_0x284ca6,_0x2a86c2);}}function Oi(_0x41fc64,_0x3f20c2){const _0x5648fb=new Set();for(const _0x1bd1f0 of _0x41fc64['values']())(_0x3f20c2||!0x1===_0x1bd1f0['requiresContent'])&&_0x5648fb['add'](_0x1bd1f0['id']);return Array['from'](_0x5648fb);}const vi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is');class AIAssistantController extends/* #__PURE__ -- @preserve */
|
|
24
|
-
ct(){['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0x5a3a85,_0x1d2dc2,_0x5414ae){super(),this['editor']=_0x5a3a85,this['textAdapter']=_0x1d2dc2,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x5414ae,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0x2ff816,_0x2f4ab4,_0x525aa9)=>{this['view']['value']=this['_sanitizeHTML'](_0x525aa9);}),this['listenTo'](this['view'],'submitPrompt',(_0x37e475,_0x213a52)=>{const _0x351326=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x213a52,_0x351326,'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:_0x184cb3,query:_0x3d343e,htmlContent:_0x3ea471,label:_0xf072c3,mainActionLabel:_0x58b4f4}){this['view']['prompt']=_0xf072c3,this['view']['mainAction']=_0x58b4f4,this['initialContext']=_0x3ea471,_0x3d343e&&(this['view']['isRendered']?this['_handleQuery'](_0x3d343e,_0x3ea471,_0x184cb3,_0xf072c3):this['view']['once']('render',()=>{this['_handleQuery'](_0x3d343e,_0x3ea471,_0x184cb3,_0xf072c3);}));}['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'](_0x49b413,_0x24a83f,_0x1f8728,_0x2517d0){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x24a83f,this['previousQuery']=_0x49b413,this['previousLabel']=_0x2517d0||_0x49b413,this['previousActionId']=_0x1f8728,new Promise(_0x21eb80=>{this['textAdapter']['makeRequest']({'query':_0x49b413,'context':_0x24a83f,'onData':_0x390e80=>{this['currentResponse']=_0x390e80,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x1f8728})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x5424a0=>{_0x5424a0 instanceof AIRequestError?this['view']['handleError'](_0x5424a0['message']):this['view']['handleError'](),_0x21eb80();})['finally'](()=>{this['stopProcessing'](),_0x21eb80();});});}['_parseAndNormalizeContent'](_0x3c31a8,_0x4001fd=!0x1){const _0x543651=vi['exec'](_0x3c31a8);_0x3c31a8=_0x543651?_0x3c31a8['substring'](_0x543651[0x1]['length']):_0x3c31a8['length']<0x64&&!_0x4001fd?'':this['_stripMarkdownSyntax'](_0x3c31a8);const _0x32cbc2=this['_domParser']['parseFromString'](_0x3c31a8,'text/html');if(_0x543651){const _0x46cff8=Array['from'](_0x32cbc2['body']['childNodes']);_0x46cff8['reverse']();for(const _0x205e78 of _0x46cff8){if(_0x205e78['nodeType']==Node['ELEMENT_NODE'])break;_0x205e78['remove']();}}const _0x326f47=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x32cbc2['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x326f47);const _0x19aeb4=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x9d4dda=this['editor']['data']['toModel'](_0x326f47);return _0x19aeb4||_0x9d4dda['markers']['clear'](),this['editor']['data']['stringify'](_0x9d4dda);}['_normalizeResponseHeadings'](_0x5e191b){const _0x293ad3=new _0x193aed(this['editor']['editing']['view']['document']),_0x1d0786=new _0x53113f({'name':/^h[1-5]$/}),_0x508a5d=[];let _0x11d29d=!0x1;for(const _0x34ad91 of _0x5e191b)_0x34ad91['is']('element')&&_0x1d0786['match'](_0x34ad91)&&(_0x508a5d['push'](_0x34ad91),'h1'==_0x34ad91['name']&&(_0x11d29d=!0x0));if(_0x11d29d){for(const _0x4c04c7 of _0x508a5d)_0x293ad3['rename']('h'+(parseInt(_0x4c04c7['name'][0x1])+0x1),_0x4c04c7);}}['_isH1TagSupportEnabled'](){const {data:_0x263237,editing:_0x286a3a}=this['editor'],_0x5e907d=_0x263237['htmlProcessor']['toView']('<h1></h1>'),_0x1f30ae=_0x263237['toView'](_0x263237['toModel'](_0x5e907d));return!!_0x286a3a['view']['domConverter']['viewToDom'](_0x1f30ae)['querySelector']('h1');}['_sanitizeHTML'](_0x380665){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x380665),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x429705){const _0x40db28=_0x429705['trim']();return _0x40db28['startsWith']('```html')?_0x40db28['endsWith']('```')?_0x40db28['substring'](0x7,_0x40db28['length']-0x3):_0x40db28['substring'](0x7):_0x429705;}}const ki={'REPLACE':'replace','INSERT':'insert'};class AIFormToolbarView extends kt{constructor(_0x51a372){super(_0x51a372),this['set']('isVisible',!0x1),this['set']('mainAction',ki['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x40e12c=>Si(_0x51a372,'AI_'+_0x40e12c['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](Si(_0x51a372,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](Si(_0x51a372,'Try\x20again')),this['stopButton']=this['_createButton'](Si(_0x51a372,'Stop'));const _0x379f6d=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x379f6d['if']('isVisible','ck-hidden',_0x2d7dc6=>!_0x2d7dc6)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0xb8427b,_0x10b973){const _0x4ece89=new yt(this['locale']);return _0x4ece89['set']({'label':_0xb8427b,'class':_0x10b973||'','isVisible':!0x0,'withText':!0x0}),_0x4ece89;}}class AIFormContentArea extends Nt{['contentFieldView'];['copyButtonView'];constructor(_0x21640f,_0x11c8e3=''){super(_0x21640f),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x38a0f5=this['bindTemplate'];this['contentFieldView']=new ContentFieldView(_0x21640f,_0x11c8e3),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x38a0f5['if']('isVisible','ck-hidden',_0x17223d=>!_0x17223d)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x38a0f5['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 _0x4c65ef=!0x1;this['on']('change:value',(_0x5d47c8,_0xdb686d,_0x5335c9)=>{const _0x250bea=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x5335c9),this['isProcessing']&&_0x250bea&&!_0x4c65ef&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x5a61a1,_0x1609f1,_0x34ba97)=>{_0x4c65ef=!0x1,_0x34ba97?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x4c65ef=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x4c65ef=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x3bf01c=this['locale'],_0x2ee0c5=new yt(this['locale']),_0x34701f='ck-ai-form__copy-button';return _0x2ee0c5['set']({'label':Si(_0x3bf01c,'Copy'),'icon':_0x380aaa,'class':_0x34701f,'tooltip':!0x0}),_0x2ee0c5['bind']('isVisible')['to'](this,'value',_0x473a9e=>!!_0x473a9e),_0x2ee0c5['bind']('isEnabled')['to'](this,'isProcessing',_0x15dc8e=>!_0x15dc8e),_0x2ee0c5['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x2ee0c5['icon']=_0x17783f,_0x2ee0c5['class']=_0x34701f+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x2ee0c5['icon']=_0x380aaa,_0x2ee0c5['class']=_0x34701f;},0x3e8);}),_0x2ee0c5;}['_copyHTMLToClipboard'](_0x4e569e){const {window:_0x43cb6e,document:_0x13898}=lt;if(_0x43cb6e['ClipboardItem']){const {Blob:_0x57c509,ClipboardItem:_0x17c231}=_0x43cb6e,_0xcb035a=[new _0x17c231({'text/html':new _0x57c509([_0x4e569e['innerHTML']],{'type':'text/html'}),'text/plain':new _0x57c509([_0x4e569e['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0xcb035a);}else{const _0x249f0c=_0x13898['createElement']('div');_0x249f0c['style']['position']='absolute',_0x249f0c['style']['left']='-9999px',_0x249f0c['innerHTML']='<span>[</span>'+_0x4e569e['innerHTML']+'<span>]</span>',_0x13898['body']['appendChild'](_0x249f0c);const _0x3412f7=_0x13898['createRange']();_0x3412f7['setStartAfter'](_0x249f0c['firstElementChild']),_0x3412f7['setEndBefore'](_0x249f0c['lastElementChild']);const _0x160bce=_0x43cb6e['getSelection']();_0x160bce['removeAllRanges'](),_0x160bce['addRange'](_0x3412f7),_0x13898['execCommand']('copy'),_0x249f0c['remove']();}}}class ContentFieldView extends Nt{constructor(_0xef17e7,_0x523f46=''){super(_0xef17e7),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x523f46,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x1a1c67){this['element']['innerHTML']=_0x1a1c67;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x2a05d1=new Nt(),_0x491ffc=this['locale'],_0x435e2c=new xt();return _0x435e2c['isVisible']=!0x0,_0x2a05d1['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x435e2c,{'text':Si(_0x491ffc,'AI\x20is\x20writing...')}]}),_0x2a05d1['render'](),_0x2a05d1;}}class AIFormErrorView extends Nt{constructor(_0x4246b6,_0x27e7a9=''){super(_0x4246b6);const _0x256331=new Lt(),_0x39a5ac=this['bindTemplate'];this['set']('text',_0x27e7a9),_0x256331['content']=_0x29b5b4,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x256331,{'text':_0x39a5ac['to']('text')}]});}}class AIFormPromptView extends Pt{['submitButtonView'];['showHistoryButtonView'];constructor(_0xa3c33,_0x5ee7b0){super(_0xa3c33,_0x5ee7b0),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',(_0x29dd79,_0x65c080)=>{_0x29dd79['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x65c080());});}['_createSubmitButton'](){const _0x45062b=new yt(this['locale']),_0x4d7e68=this['locale'];return _0x45062b['set']({'icon':_0x47b078,'label':Si(_0x4d7e68,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x45062b['on']('execute',()=>{this['submit']();}),_0x45062b['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x4b0392,_0x59635b)=>!_0x4b0392&&_0x59635b),_0x45062b;}['_createShowHistoryButton'](){const _0x3f6eaa=new yt(this['locale']),_0x113c44=this['resultsView'],_0x389065=this['locale'];_0x3f6eaa['set']({'label':Si(_0x389065,'History'),'withText':!0x1,'icon':_0x17e9ed,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x3f6eaa['bind']('isOn')['to'](_0x113c44,'isVisible'),_0x3f6eaa['bind']('isEnabled')['to'](this,'isEnabled'),_0x3f6eaa['on']('execute',()=>{_0x113c44['isVisible']=!_0x113c44['isVisible'],_0x113c44['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x129894=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0x554cc3=new dt(this['queryView']['fieldView']['element']),_0x530aa7=_0x554cc3['width'],_0x167dda='rtl'===_0x389065['uiLanguageDirection']?'left':'right';_0x554cc3['excludeScrollbarsAndBorders'](),_0x3f6eaa['element']['style'][_0x167dda]=_0x530aa7-_0x554cc3['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x129894),this['on']('render',_0x129894),_0x3f6eaa;}['submit'](){const _0x9f970d=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x9f970d);}['focus'](_0x2343be){-0x1===_0x2343be?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}}class AIHistoryListView extends Dt{['historyGroupView'];['clearHistoryButton'];constructor(_0x42afa2){super(_0x42afa2),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Vt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=Si(_0x42afa2,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x990b91=0x0;for(const _0x401e80 of this['items'])_0x990b91+=_0x401e80['items']['length'];return{'resultsCount':_0x990b91,'totalItemsCount':_0x990b91};}['_createClearHistoryButton'](){const _0xd5ce4c=this['locale'],_0x2bb9c3=new yt(this['locale']);return _0x2bb9c3['set']({'label':'('+Si(_0xd5ce4c,'Clear')+')','withText':!0x0}),_0x2bb9c3['on']('execute',()=>this['fire']('clearHistory')),_0x2bb9c3;}}class AIHistoryListItemView extends Ht{constructor(_0x344fc3){super();const _0x2178be=new Mt(),_0xca69a=new yt(this['locale'],_0x2178be);this['children']['add'](_0xca69a),_0xca69a['set']({'label':_0x344fc3['prompt'],'withText':!0x0}),_0xca69a['on']('execute',()=>{this['fire']('execute',{'value':_0x28f797(_0x344fc3['prompt'])});});}}const yi='CKEditor/AIFormView/PromptHistory';class PromptHistory extends _t{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x103bdf,_0x5af4da)=>{const _0x30403a=Ni(_0x5af4da['prompt']);for(const _0x4cea1e of this)if(_0x4cea1e!=_0x5af4da&&Ni(_0x4cea1e['prompt'])===_0x30403a){this['remove'](_0x4cea1e);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x2ef8a2=sessionStorage['getItem'](yi)||'[]';this['addMany'](JSON['parse'](_0x2ef8a2));}['_saveToSessionStorage'](){sessionStorage['setItem'](yi,JSON['stringify'](this['map'](_0x229fab=>_0x229fab)));}}function Ni(_0x50135a){return _0x50135a['toLowerCase']()['trim']();}class AIFormView extends Nt{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x1adff1,_0x18d7bc,_0x14d3de=''){super(_0x1adff1),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',ki['REPLACE']),this['_promptHistory']=new PromptHistory(),this['errorView']=new AIFormErrorView(_0x1adff1),this['contentArea']=new AIFormContentArea(_0x1adff1,_0x14d3de),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new It(),this['keystrokes']=new At(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0xea9d80=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x18d7bc],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0xea9d80['if']('isError','ck-hidden',_0xacc64b=>!_0xacc64b)]},'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'](_0x143cc0=0x1){-0x1===_0x143cc0?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 _0x56dae0=this['locale'],_0x52c3fb=new AIFormPromptView(_0x56dae0,{'queryView':{'label':Si(_0x56dae0,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':Si(_0x56dae0,'Empty\x20history'),'secondary':Si(_0x56dae0,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x52c3fb['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x468acc,_0x3f0d9b)=>_0x468acc&&!_0x3f0d9b),this['listenTo'](_0x52c3fb,'submit',(_0x1e6fc8,_0x2aa4dd)=>{this['prompt']=_0x2aa4dd;const _0x47e0ee=_0x40ab4b(_0x2aa4dd);this['fire']('submitPrompt',_0x47e0ee),_0x2aa4dd['trim']()&&this['_promptHistory']['add']({'prompt':_0x47e0ee},0x0);},{'priority':'high'}),_0x52c3fb;}['_createHistoryView'](){const _0x30138f=new AIHistoryListView(this['locale']);return _0x30138f['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](AIHistoryListItemView),_0x30138f['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x30138f;}['_createToolbar'](){const _0x5e42de=new AIFormToolbarView(this['locale']);return _0x5e42de['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x1a1097,_0x2dbebd,_0x64282)=>_0x1a1097&&!_0x2dbebd&&!!_0x64282),_0x5e42de['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x5e42de['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x1c4bf5,_0x3536b5,_0x44b7cb)=>_0x1c4bf5&&!_0x3536b5&&!!_0x44b7cb),_0x5e42de['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x5e42de['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x570f63,_0x20d7e7)=>_0x570f63&&!_0x20d7e7),_0x5e42de['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x5e42de['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x5e42de['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x5e42de;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x4992c8=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=Si(_0x4992c8,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x5b5abe){const _0x58627a=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x5b5abe||Si(_0x58627a,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}}const xi=globalThis['DataTransfer'];class AIAssistantUI extends _0x1970fb{['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[_0x50e6b5,AIAssistantEditing,AIAdapter,Gt];}constructor(_0x5ddb66){super(_0x5ddb66),_0x5ddb66['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x5ddb66['config']['define']('ai.assistant.contentAreaCssClass',''),_0x5ddb66['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x5ddb66['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x222747}=this;this['_aiAdapter']=_0x222747['plugins']['get'](AIAdapter),this['_dialog']=_0x222747['plugins']['get'](Gt),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x1db6e3=new ShowAIAssistantCommand(_0x222747,Array['from'](this['_commandDefinitions']['values']()));_0x222747['commands']['add']('showAIAssistant',_0x1db6e3),_0x222747['ui']['componentFactory']['add']('aiCommands',_0x415926=>{const _0x134714=Ft(_0x415926);return _0x134714['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x134714['buttonView']['set']({'label':Si(_0x415926,'AI\x20Commands'),'icon':_0x2258a8,'tooltip':!0x0}),_0x134714['on']('execute',_0x3c3813=>this['_onExecute'](_0x3c3813['source']['id'])),Wt(_0x134714,_0x222747['ui']['view']['body'],function(_0x5615a1){const _0x3a5fc0=fi(_0x5615a1['config']['get']('ai.assistant.commands'),_0x5615a1['locale']),_0x3fafca=Pi(_0x5615a1,_0x3a5fc0)['filter'](_0x5c9028=>_0x5c9028['commands']['length']);if(0x1===_0x3fafca['length'])return Pi(_0x5615a1,_0x3fafca[0x0]['commands'])['map'](_0x364102=>({'id':_0x364102['id'],'label':_0x364102['label']}));return _0x3fafca['map'](_0x4f04b2=>{const {groupId:_0x72cf8b,groupLabel:_0x5c1ac5,commands:_0x3eac89}=_0x4f04b2,_0x1216ff=Pi(_0x5615a1,_0x3eac89)['map'](_0x1785f5=>({'id':_0x1785f5['id'],'label':_0x1785f5['label']}));return{'id':_0x72cf8b,'menu':_0x5c1ac5||_0x72cf8b,'children':_0x1216ff};});}(_0x222747),{'ariaLabel':Si(_0x415926,'AI\x20Commands')}),_0x134714['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x1db6e3['on']('change:enabledCommandsIds',_0x4f29bc),_0x134714['menuView']['once']('render',_0x4f29bc),_0x134714;function _0x4f29bc(){_0x134714['isEnabled']=_0x1db6e3['enabledCommandsIds']['length']>0x0;for(const _0x5cc558 of _0x134714['menuView']['buttons'])_0x5cc558['isEnabled']=_0x1db6e3['enabledCommandsIds']['includes'](_0x5cc558['id']);}}),_0x222747['ui']['componentFactory']['add']('menuBar:aiCommands',_0x1112ee=>{const _0x283107=new Kt(_0x1112ee);_0x283107['buttonView']['set']({'label':Si(_0x1112ee,'AI\x20Commands'),'icon':_0x2258a8}),_0x283107['bind']('isEnabled')['to'](_0x1db6e3,'enabledCommandsIds',_0x1c50a3=>_0x1c50a3['length']>0x0);const _0x51c272=fi(_0x222747['config']['get']('ai.assistant.commands'),_0x1112ee);return this['_populateMenuBarMenu'](_0x1db6e3,_0x283107,_0x51c272,_0xc0345d=>this['_onExecute'](_0xc0345d)),_0x283107;}),_0x222747['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x3601d5=this['_createAIAssistantUIButton'](yt);return _0x3601d5['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x3601d5;}),_0x222747['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x47c6d9=this['_createAIAssistantUIButton'](Yt);return _0x47c6d9['set']({'role':'menuitemcheckbox'}),_0x47c6d9;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x1299ab=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x39c7df;for(const _0x2ead1f in _0x1299ab){const _0x5d5129=_0x2ead1f,_0x1b87c4=_0x1299ab[_0x5d5129];if('aiLicenseKeyValid'==_0x1b87c4||'aiLicenseKeyInvalid'==_0x1b87c4||'aiLicenseKeyExpired'==_0x1b87c4||'aiLicenseKeyDomainLimit'==_0x1b87c4||'aiLicenseKeyNotAllowed'==_0x1b87c4||'aiLicenseKeyEvaluationLimit'==_0x1b87c4||'aiLicenseKeyUsageLimit'==_0x1b87c4){delete _0x1299ab[_0x5d5129],_0x39c7df=_0x1b87c4,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x39c7df&&_0x1299ab['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x39c7df&&_0x1299ab['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x39c7df&&_0x1299ab['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x39c7df&&_0x1299ab['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x39c7df&&_0x1299ab['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x39c7df&&_0x1299ab['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x4affce='',_0x584a9a='',_0xa589da='custom'){const _0x15e969=this['editor'],_0x5bfd98=_0x15e969['editing']['view'],_0x1ea725=_0x15e969['plugins']['get'](AIAssistantEditing),_0x28e89e=_0x15e969['plugins']['get'](_0x50e6b5);_0x1ea725['showFakeVisualSelection']();const _0x1ae330=new xi(),_0x198940=new ClipboardEvent('copy',{'clipboardData':_0x1ae330}),_0x175f88=new _0x480d1d(_0x1ae330),_0x42d825=new _0x16a6c4(_0x5bfd98,_0x198940,{'dataTransfer':_0x175f88});_0x28e89e['_forceMarkersCopy']('comment',()=>{_0x5bfd98['document']['fire']('copy',_0x42d825);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new AIAssistantController(_0x15e969,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x357327=_0x175f88['getData']('text/html');const _0x2c7c82=_0x15e969['model']['document']['selection'],_0x5693f4=Array['from'](_0x2c7c82['getRanges']());0x1===_0x5693f4['length']&&_0x5693f4[0x0]['isFlat']&&!_0x2c7c82['getSelectedElement']()&&''!==_0x357327['replace'](/ /g,'')['trim']()&&(_0x357327='<p>'+_0x357327+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0xa589da,'query':_0x4affce,'htmlContent':_0x357327,'label':_0x584a9a,'mainActionLabel':ki[_0x15e969['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x3040e5,'title':Si(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':$t['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x1ea725['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x39daaf=new Map(),_0x45d8ad=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x45071e of _0x45d8ad)for(const _0x4ce02e of _0x45071e['commands'])_0x39daaf['set'](_0x4ce02e['id'],{..._0x4ce02e,'groupId':_0x45071e['groupId'],'groupLabel':_0x45071e['groupLabel']||_0x45071e['groupId']});return _0x39daaf;}['_createAIAssistantUIButton'](_0x18e618){const _0x4e21ac=this['editor'],_0x3043c2=_0x4e21ac['commands']['get']('showAIAssistant'),_0x4799cf=new _0x18e618(_0x4e21ac['locale']);return _0x4799cf['set']({'label':Si(_0x4e21ac['locale'],'AI\x20Assistant'),'icon':_0x3040e5,'isToggleable':!0x0}),_0x4799cf['bind']('isEnabled')['to'](_0x3043c2),_0x4799cf['bind']('isOn')['to'](this['_dialog'],'id',_0x3b20f4=>'aiAssistant'===_0x3b20f4),this['listenTo'](_0x4799cf,'execute',()=>{_0x4799cf['isOn']?this['hideUI']():_0x3043c2['execute']();}),_0x4799cf;}['_initView'](){const _0x22e34f=this['editor']['plugins']['get'](AIAssistantEditing);this['_formView']=new AIFormView(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.assistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x22e34f['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x22e34f['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0x2d92d1,ui:{ariaLiveAnnouncer:_0x1f8b49}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x55090b,_0x834ec6,_0x310c23)=>{const _0x10452e=this['_aiAssistantController']['currentContext'];_0x310c23?_0x1f8b49['announce'](Si(_0x2d92d1,'AI\x20is\x20writing')):_0x10452e&&_0x1f8b49['announce'](Si(_0x2d92d1,'Generated\x20content:\x20%0',_0x10452e),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x379f29,_0x29dbd1,_0x2066e0)=>{if(_0x2066e0){const _0x4f0193=this['_formView']['errorView']['text'];_0x1f8b49['announce'](Si(_0x2d92d1,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x4f0193));}});}['_onExecute'](_0x29ed62){const _0x3734a9=this['_commandDefinitions']['get'](_0x29ed62),_0x40eeb5=this['editor'],_0x84151=_0x40eeb5['model']['document']['selection'],_0x329a5f=_0x40eeb5['commands']['get']('showAIAssistant'),_0x301baf=_0x40eeb5['plugins']['get'](AIAssistantEditing),_0x52c6f1=''+(_0x3734a9['groupId']!==Ti?_0x3734a9['groupLabel']+':\x20':'')+_0x3734a9['label'];if(!0x1!==_0x3734a9['requiresContent']&&_0x84151['isCollapsed']){const _0x328b69=gt(_0x84151['getSelectedBlocks']())||_0x40eeb5['model']['schema']['getLimitElement'](_0x84151);_0x40eeb5['model']['change'](_0x1b9afd=>{_0x1b9afd['setSelection'](_0x328b69,'in');});}_0x301baf['showFakeVisualSelection'](),_0x329a5f['execute'](_0x3734a9['prompt'],_0x52c6f1,'command:'+_0x29ed62);}['_populateMenuBarMenu'](_0x56a61c,_0x12e459,_0x37e8fa,_0x4dbf40){const _0x4a2630=this['editor'],_0x5150f5=_0x4a2630['locale'],_0x314859=new qt(_0x5150f5),_0x5a8721=Pi(_0x4a2630,_0x37e8fa)['filter'](_0x365efb=>_0x365efb['commands']['length']);0x1===_0x5a8721['length']?this['_getMenuBarGroupButtons']({'command':_0x56a61c,'commands':_0x5a8721[0x0]['commands'],'parentMenuView':_0x12e459,'onExecute':_0x4dbf40})['forEach'](_0x487190=>_0x314859['items']['add'](_0x487190)):_0x5a8721['forEach'](({groupId:_0x2d2711,groupLabel:_0x558e68,commands:_0x567bd8})=>{const _0x2682dd=new Qt(_0x5150f5,_0x12e459),_0x14dc8c=new Kt(_0x5150f5),_0x4800ed=new qt(_0x5150f5),_0x3e1102=this['_getMenuBarGroupButtons']({'command':_0x56a61c,'commands':_0x567bd8,'parentMenuView':_0x14dc8c,'onExecute':_0x4dbf40});_0x14dc8c['buttonView']['set']({'label':_0x558e68||_0x2d2711}),_0x14dc8c['delegate']('execute')['to'](_0x12e459),_0x4800ed['items']['addMany'](_0x3e1102),_0x14dc8c['panelView']['children']['add'](_0x4800ed),_0x2682dd['children']['add'](_0x14dc8c),_0x314859['items']['add'](_0x2682dd);}),_0x12e459['panelView']['children']['add'](_0x314859);}['_getMenuBarGroupButtons']({command:_0x5d1d98,commands:_0x250839,parentMenuView:_0x2d657e,onExecute:_0x368a60}){const _0x1c1cfd=this['editor'],_0x46c837=_0x1c1cfd['locale'];return Pi(_0x1c1cfd,_0x250839)['map'](_0x352166=>{const _0x16c15c=new Qt(_0x46c837,_0x2d657e),_0x152002=new Yt(_0x46c837);return _0x152002['set']({'label':_0x352166['label']}),_0x152002['delegate']('execute')['to'](_0x2d657e),_0x152002['on']('execute',()=>_0x368a60(_0x352166['id'])),_0x152002['bind']('isEnabled')['to'](_0x5d1d98,'enabledCommandsIds',_0x471fce=>_0x471fce['includes'](_0x352166['id'])),_0x16c15c['children']['add'](_0x152002),_0x16c15c;});}}function Li(_0x4d52b3,_0x36a48c){return void 0x0!==_0x4d52b3['order']&&void 0x0===_0x36a48c['order']?0x1:void 0x0===_0x4d52b3['order']&&void 0x0!==_0x36a48c['order']?-0x1:void 0x0!==_0x4d52b3['order']&&void 0x0!==_0x36a48c['order']?_0x4d52b3['order']-_0x36a48c['order']:0x0;}function Pi(_0x4f7933,_0x4f4d3e){_0x4f4d3e['sort'](Li);const _0x1b44a6={},_0x41e460=[];for(const _0x5eab56 of _0x4f4d3e)if(void 0x0!==_0x5eab56['order']){if(_0x5eab56['order']in _0x1b44a6)throw new ht('ai-commands-config-order-collision',_0x4f7933,{'conflictingDefinitions':[_0x5eab56,_0x1b44a6[_0x5eab56['order']]]});_0x1b44a6[_0x5eab56['order']]=_0x5eab56,_0x41e460['splice'](_0x5eab56['order'],0x0,_0x5eab56);}else _0x41e460['push'](_0x5eab56);return _0x41e460;}class AIAssistant extends _0x1970fb{static get['requires'](){return[AIAssistantUI,AIAssistantEditing];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x14b5a8){super(_0x14b5a8);const _0x31b5a9=_0x14b5a8['config'],_0x5545fc=_0x14b5a8['locale'];_0x31b5a9['define']('ai.assistant.preserveComments',!0x0),_0x31b5a9['define']('ai.assistant.commands',Di(_0x5545fc)),_0x31b5a9['define']('ai.assistant.extraCommandGroups',[]),_0x31b5a9['define']('ai.assistant.removeCommands',[]);let _0x38b50b=fi(_0x31b5a9['get']('ai.assistant.commands'),_0x5545fc);const _0x599584=_0x31b5a9['get']('ai.assistant.extraCommandGroups'),_0x4bff0d=_0x31b5a9['get']('ai.assistant.removeCommands');_0x599584['forEach'](_0x2e08c2=>{const _0x3b1b8e=_0x38b50b['find'](_0x5bb90f=>_0x5bb90f['groupId']===_0x2e08c2['groupId']);_0x3b1b8e?_0x3b1b8e['commands']=_0x3b1b8e['commands']['concat'](_0x2e08c2['commands']):_0x38b50b['push'](_0x2e08c2);}),_0x38b50b=_0x38b50b['filter'](_0x1105b9=>!_0x4bff0d['includes'](_0x1105b9['groupId'])),_0x38b50b['forEach'](_0x3cb8b8=>{_0x3cb8b8['commands']=_0x3cb8b8['commands']['filter'](_0x46f083=>!_0x4bff0d['includes'](_0x46f083['id']));}),_0x31b5a9['set']('ai.assistant.commands',_0x38b50b);}}function Di(_0x57f746){return[{'groupId':'editOrReview','groupLabel':Si(_0x57f746,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':Si(_0x57f746,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':Si(_0x57f746,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':Si(_0x57f746,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':Si(_0x57f746,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':Si(_0x57f746,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':Si(_0x57f746,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':Si(_0x57f746,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':Si(_0x57f746,'Change\x20tone'),'commands':[{'id':'professional','label':Si(_0x57f746,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':Si(_0x57f746,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':Si(_0x57f746,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':Si(_0x57f746,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':Si(_0x57f746,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':Si(_0x57f746,'Change\x20style'),'commands':[{'id':'business','label':Si(_0x57f746,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':Si(_0x57f746,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':Si(_0x57f746,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':Si(_0x57f746,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':Si(_0x57f746,'Translate'),'commands':[{'id':'translateEnglish','label':Si(_0x57f746,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':Si(_0x57f746,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':Si(_0x57f746,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':Si(_0x57f746,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':Si(_0x57f746,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':Si(_0x57f746,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':Si(_0x57f746,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':Si(_0x57f746,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}class AITextAdapter extends _0x1970fb{['abortController'];static get['requires'](){return[AIAdapter];}constructor(_0x27fbc5){super(_0x27fbc5),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](AIAdapter)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x2f7d7d){return this['sendRequest'](_0x2f7d7d)['catch'](_0x2a6904=>{if(_0x2a6904 instanceof AIRequestError)return Promise['reject'](_0x2a6904);if('AbortError'==_0x2a6904['name'])return Promise['resolve']();throw console['error'](_0x2a6904),new ht('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0xecad0e,_0x518b3c){const _0x5b1a8d=this['editor']['locale'],_0x17282b={'Content-Type':'application/json'};if('object'==typeof _0xecad0e)Object['assign'](_0x17282b,_0xecad0e);else{if(_0xecad0e)try{const _0x605761=await _0xecad0e(_0x518b3c);Object['assign'](_0x17282b,_0x605761);}catch{return Promise['reject'](new AIRequestError(Si(_0x5b1a8d,'AI_ERROR_GET_HEADERS')));}}return _0x17282b;}async['_prepareRequestParameters'](_0x516355,_0x4e0ebb){const _0x2a416e=this['editor']['locale'];if('object'==typeof _0x516355)return _0x516355;try{return await _0x516355(_0x4e0ebb);}catch{return Promise['reject'](new AIRequestError(Si(_0x2a416e,'AI_ERROR_GET_PARAMETERS')));}}}class OpenAITextAdapter extends AITextAdapter{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0x26671f){super(_0x26671f),_0x26671f['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0x26671f['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0x26671f['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0x26671f['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0x26671f['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0x26671f['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x26d8db,context:_0x54a57a,onData:_0x21350d,actionId:_0xed6eac}){const _0x258546=this['editor']['locale'],_0x10d7ed=await this['prepareMessages'](_0x26d8db,_0x54a57a,_0xed6eac),_0x147b36=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0xed6eac),_0x5b41c1=await this['_prepareRequestParameters'](this['_requestParameters'],_0xed6eac),_0x22cb1c={'messages':_0x10d7ed,..._0x5b41c1},_0x19d725={'method':'POST','headers':_0x147b36,'body':JSON['stringify'](_0x22cb1c),'signal':this['abortController']['signal']},_0x2285e6=await fetch(this['_apiUrl'],_0x19d725);if(_0x2285e6['ok'])return _0x5b41c1['stream']?await this['_readStreamableResponse'](_0x2285e6,_0x21350d):await this['_readStaticResponse'](_0x2285e6,_0x21350d),Promise['resolve']();{const _0x513f0f=await _0x2285e6['text']();return _0x513f0f['includes']('context_length_exceeded')?Promise['reject'](new AIRequestError(Si(_0x258546,'AI_ERROR_CONTEXT_LENGTH'))):_0x513f0f['includes']('Moderation')?Promise['reject'](new AIRequestError(Si(_0x258546,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x513f0f));}}async['prepareMessages'](_0x208ce8,_0x198790,_0x156ee4){let _0x4f4d3c,_0x446998;return _0x198790?(_0x4f4d3c='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.',_0x446998='Instruction:\x0a'+_0x208ce8+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x198790):(_0x4f4d3c='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.',_0x446998=_0x208ce8),[{'role':'system','content':_0x4f4d3c},{'role':'user','content':_0x446998}];}async['_readStreamableResponse'](_0x4e71f3,_0x4c238b){const _0x59f7b3=_0x4e71f3['body']['getReader'](),_0xd28290=new TextDecoder();let _0x36902e='',_0x35cbe9='',_0x45714c='',_0x2b0ee2=!0x1;for(;!_0x2b0ee2;){const {done:_0x5a7055,value:_0x329dea}=await _0x59f7b3['read'](),_0x1f076f=_0x36902e+_0xd28290['decode'](_0x329dea);let _0x2df0ef='';_0x2b0ee2=_0x5a7055;try{_0x2df0ef=this['_cleanUpData'](_0x1f076f),_0x36902e='';}catch{_0x36902e=_0x1f076f;continue;}_0x35cbe9+=_0x2df0ef,!_0x2b0ee2&&this['_isBufferIncomplete'](_0x35cbe9)||_0x35cbe9&&(_0x45714c+=_0x35cbe9,_0x35cbe9='',_0x4c238b(_0x45714c));}return Promise['resolve']();}async['_readStaticResponse'](_0x380945,_0x3e5b01){return _0x3e5b01((await _0x380945['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x351fd9){const _0xec7e76=_0x351fd9['split']('<')['length']!==_0x351fd9['split']('>')['length'],_0x3ff8c9=_0x351fd9['length']<0x1e;return _0xec7e76&&_0x3ff8c9;}['_cleanUpData'](_0x1579a5){return _0x1579a5['split'](/\n(?![^{]*\})/g)['map'](_0x6708be=>_0x6708be['replace']('data:\x20',''))['filter'](_0x40cffe=>_0x40cffe&&_0x40cffe['length']>0x0&&'[DONE]'!==_0x40cffe)['map'](_0x1c754b=>{const {choices:_0x220fac}=JSON['parse'](_0x1c754b);if(_0x220fac[0x0]?.['delta']?.['content'])return _0x220fac[0x0]['delta']['content'];})['filter'](_0x489066=>_0x489066)['join']('');}}class AWSTextAdapter extends AITextAdapter{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),wt('ai-aws-adapter-not-supported');}async['sendRequest'](_0x5064d9){throw Ct('ai-aws-adapter-not-supported'),new AIRequestError(Si(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}}class TabButtonView extends yt{constructor(_0x5b0e0f,_0x245c52={}){super(_0x5b0e0f),this['isToggleable']=!0x0,this['set']('side',_0x245c52['side']||'top');const _0x2832b9=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...mt(_0x245c52['class']||[]),_0x2832b9['to']('side',_0x35ab51=>'ck-tab-button_'+_0x35ab51),_0x2832b9['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class TabPanelView extends Nt{['children'];constructor(_0x4ca805,_0x23099f={}){super(_0x4ca805);const _0x1e378d=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...mt(_0x23099f['class']||[]),_0x1e378d['to']('class'),_0x1e378d['if']('isVisible','ck-hidden',_0x55a412=>!_0x55a412)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}}class AITabsView extends Nt{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x3fd867,_0x19bbd8={}){super(_0x3fd867),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x19bbd8['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x19bbd8['collapsible']||!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'activeTab',(_0x4cd16f,_0x3d9021)=>_0x4cd16f&&null!==_0x3d9021);const _0x2ee2b3=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...mt(_0x19bbd8['class']||[]),_0x2ee2b3['to']('side',_0xe5bab=>'ck-tabs_'+_0xe5bab),_0x2ee2b3['to']('class'),_0x2ee2b3['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x2ee2b3['to']('activeTab',_0x5c8358=>null===_0x5c8358?'ck-ai-tabs_collapsed':'')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x2ee2b3['to']('side',_0x28f834=>'ck-tabs__buttons-container_'+_0x28f834)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x2ee2b3['to']('side',_0x144eea=>'ck-tabs__panels-container_'+_0x144eea)]},'children':this['panelViews']},...mt(_0x19bbd8['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x40d4f9){const _0x5d84fe=this['_tabs']['get'](_0x40d4f9);return _0x5d84fe||null;}['addTab'](_0x1be234){const _0x5eadc4=this['_setupButton']({'id':_0x1be234['id'],'label':_0x1be234['buttonLabel'],'icon':_0x1be234['buttonIcon'],'order':_0x1be234['order']}),_0x207e32=new TabPanelView(this['locale']);return _0x207e32['render'](),_0x1be234['content']&&_0x207e32['children']['add'](_0x1be234['content']),this['panelViews']['add'](_0x207e32),this['_tabs']['set'](_0x1be234['id'],{'button':_0x5eadc4,'panel':_0x207e32,'order':void 0x0!==_0x1be234['order']?_0x1be234['order']:null}),this['fire']('addTab:'+_0x1be234['id'],{'id':_0x1be234['id'],'button':_0x5eadc4,'panel':_0x207e32}),null===this['activeTab']?this['activateTab'](_0x1be234['id']):this['_hidePanel'](_0x1be234['id']),{'button':_0x5eadc4,'panel':_0x207e32};}['activateTab'](_0x218c7d){if(null!==_0x218c7d&&!this['getTab'](_0x218c7d))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x218c7d});if(this['activeTab']===_0x218c7d)return;const _0x45391e=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x218c7d,_0x218c7d&&this['_showPanel'](_0x218c7d),this['fire']('activateTab:'+_0x218c7d,{'newTab':_0x218c7d,'oldTab':_0x45391e});}['toggleTabPanel'](_0x217eed){if(!this['getTab'](_0x217eed))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x217eed});this['activeTab']===_0x217eed?this['collapsible']&&(this['activeTab']=null):this['activateTab'](_0x217eed);}['showTab'](_0x4f6b81){if(!this['getTab'](_0x4f6b81))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x4f6b81});this['_showPanel'](_0x4f6b81),this['_showButton'](_0x4f6b81),this['fire']('show:'+_0x4f6b81,_0x4f6b81);}['hideTab'](_0x2ebfa6){if(!this['getTab'](_0x2ebfa6))throw new ht('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2ebfa6});const _0x3f9e81=this['activeTab'];this['_hidePanel'](_0x2ebfa6),this['_hideButton'](_0x2ebfa6);const _0x3ccbcf=this['getTabIds']();_0x3f9e81===_0x2ebfa6&&_0x3ccbcf['length']>0x1&&this['activateTab'](_0x3ccbcf['find'](_0x579877=>_0x579877!==_0x2ebfa6)),this['fire']('hide:'+_0x2ebfa6,_0x2ebfa6);}['_getPanel'](_0x3980a3){const _0x3dd758=this['_tabs']['get'](_0x3980a3);return _0x3dd758?_0x3dd758['panel']:null;}['_showPanel'](_0xaf41be){null!==this['activeTab']&&this['activeTab']!==_0xaf41be||this['_getPanel'](_0xaf41be)['show']();}['_hidePanel'](_0x28daef){const _0x5e5978=this['_getPanel'](_0x28daef);_0x5e5978['isVisible']&&(this['activeTab']===_0x28daef&&(this['activeTab']=null),_0x5e5978['hide']());}['_getButton'](_0x4eb395){const _0x6bb040=this['_tabs']['get'](_0x4eb395);return _0x6bb040?_0x6bb040['button']:null;}['_showButton'](_0x539471){this['_getButton'](_0x539471)['show']();}['_hideButton'](_0x2ad609){this['_getButton'](_0x2ad609)['hide']();}['_setupButton'](_0x58e5a5){const _0x12faf5=new TabButtonView(this['locale'],{'side':this['side']}),_0xa3d702=this['buttonViews'];if(_0x12faf5['set']({'label':_0x58e5a5['label'],'icon':_0x58e5a5['icon'],'tooltip':!0x0,'withText':!0x0}),_0x12faf5['bind']('isOn')['to'](this,'activeTab',_0x45c3fb=>_0x45c3fb===_0x58e5a5['id']),_0x12faf5['bind']('side')['to'](this,'side'),_0x58e5a5['order']){const _0x3fc8eb=[...this['_tabs']]['reduce']((_0xf7f69,_0x4f89eb)=>{const _0xad1103=_0x4f89eb[0x0],{order:_0x2cf1b8}=_0x4f89eb[0x1];return!_0x2cf1b8||_0x2cf1b8>_0x58e5a5['order']?_0xf7f69:_0x2cf1b8>=_0xf7f69['order']?{'id':_0xad1103,'order':_0x2cf1b8}:_0xf7f69;},{'id':'','order':0x0}),_0x1ab792=_0xa3d702['getIndex'](this['_getButton'](_0x3fc8eb['id']));_0xa3d702['add'](_0x12faf5,_0x1ab792+0x1);}else _0xa3d702['add'](_0x12faf5);return _0x12faf5['on']('execute',()=>{this['toggleTabPanel'](_0x58e5a5['id']);}),_0x12faf5;}}const Vi=['overlay','sidebar','custom'],Hi=['left','right'];class AITabsMainView extends AITabsView{constructor(_0x19631b,_0x43cfb3={}){super(_0x19631b,_0x43cfb3),this['set']('type',_0x43cfb3['type']||'sidebar'),this['set']('side',_0x43cfb3['side']||'right'),this['set']('isVisible',_0x43cfb3['visibleByDefault']??!0x0);const _0x17dde1=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x17dde1['if']('type','ck-ai-tabs__overlay',_0x3ac56a=>'overlay'===_0x3ac56a),_0x17dde1['if']('type','ck-ai-tabs__sidebar',_0x288289=>'sidebar'===_0x288289),_0x17dde1['if']('isVisible','ck-hidden',_0x1fa2dc=>!_0x1fa2dc)]}}),this['buttonViews']['on']('add',(_0x897395,_0x1b5c17)=>{_0x1b5c17['set']('withText',!0x1);});}}class AITabs extends _0x915a98{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4825f1){if(super(_0x4825f1),!this['context']['config']['get']('ai.container'))throw new ht('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x2a6604=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x2a6604['showResizeButton']&&(this['showResizeButton']=_0x2a6604['showResizeButton']),'sidebar'!==_0x2a6604['type']&&'overlay'!==_0x2a6604['type']||_0x2a6604['side']&&(this['side']=_0x2a6604['side']),'sidebar'===_0x2a6604['type']){if(this['container']=_0x2a6604['element'],this['set']('type','sidebar'),!this['container'])throw new ht('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x2a6604['type']?(this['container']=document['body'],this['set']('type','overlay')):(this['container']=null,this['set']('type','custom'));this['view']=new AITabsMainView(this['context']['locale'],{'side':this['side'],'type':this['type'],'visibleByDefault':_0x2a6604['visibleByDefault'],'collapsible':_0x2a6604['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 _0x29da5d&&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'](_0x397a54){if(_0x397a54&&this['type']!==_0x397a54){if(!Vi['includes'](_0x397a54))throw new ht('ai-tabs-unsupported-ui-type');this['type']=_0x397a54;}}['switchSide'](_0x4858b7){if(_0x4858b7&&this['side']!==_0x4858b7){if(!Hi['includes'](_0x4858b7))throw new ht('ai-tabs-unsupported-ui-side');this['side']=_0x4858b7;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}}class AIConnector extends _0x915a98{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x147398];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1e4813){if(super(_0x1e4813),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new ht('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x459522=this['context']['plugins']['get'](_0x147398);if(!_0x459522['token'])throw new ht('ai-missing-token',this);this['_token']=_0x459522['token'];}['startConversation'](_0x2329e2,_0x2ce5b5){const _0x5a1670=this['_sendApiRequest']('/conversations','POST',{'id':_0x2329e2,'group':_0x2ce5b5});return{'getConversation':async()=>(await _0x5a1670['request'])['json'](),'abortController':_0x5a1670['abortController']};}['queryAssistant']({message:_0x122af3,conversationId:_0x56d722,parts:_0x6a5f22,capabilities:_0x38599f,model:_0xa26278,attributes:_0x57a503}){const _0x1be2c7={'prompt':_0x122af3,'content':_0x6a5f22,'model':_0xa26278,..._0x38599f&&{'capabilities':_0x38599f},..._0x57a503&&{'attributes':_0x57a503}},_0x1d6a06=this['_sendApiRequest']('/conversations/'+_0x56d722+'/messages','POST',_0x1be2c7,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x16a5e5=(await _0x1d6a06['request'])['body'];return this['_getStreamReader'](_0x16a5e5);},'abortController':_0x1d6a06['abortController']};}['executeCustomAction']({content:_0x54c82c,message:_0x532458,model:_0x29548c,outputFormat:_0xa0945}){const _0x542eb3={'content':[{'type':'text','content':_0x54c82c}],'prompt':_0x532458,'model':_0x29548c,'outputFormat':_0xa0945},_0x5bb41b=this['_sendApiRequest']('/actions/custom/calls','POST',_0x542eb3);return{'getStream':async()=>{const _0xa0de3c=(await _0x5bb41b['request'])['body'];return this['_getStreamReader'](_0xa0de3c);},'abortController':_0x5bb41b['abortController']};}['executeAction']({actionName:_0x188164,content:_0x54e4fd,args:_0x390ee4}){const _0xe11e7c={'content':[{'type':'text','content':_0x54e4fd}],'args':_0x390ee4},_0x3969af=this['_sendApiRequest']('/actions/system/'+_0x188164+'/calls','POST',_0xe11e7c);return{'getStream':async()=>{const _0x53f1be=(await _0x3969af['request'])['body'];return this['_getStreamReader'](_0x53f1be);},'abortController':_0x3969af['abortController']};}['uploadFile'](_0xa34d33,_0x35e928,_0x22fba6){const _0x20228c=new FormData();_0x20228c['append']('file',_0x35e928,_0x35e928['name']),_0x22fba6&&_0x20228c['append']('attributes',JSON['stringify'](_0x22fba6));const _0xebae5e=this['_sendApiRequest']('/conversations/'+_0xa34d33+'/files','POST',_0x20228c);return{'getId':async()=>(await _0xebae5e['request'])['json'](),'abortController':_0xebae5e['abortController']};}['fetchDocument'](_0xa4d196,_0x343d93){const _0x44f3ba=this['_sendApiRequest']('/conversations/'+_0xa4d196+'/documents/'+_0x343d93,'GET');return{'getDocument':async()=>(await _0x44f3ba['request'])['json'](),'abortController':_0x44f3ba['abortController']};}['uploadDocument'](_0x484cd3,_0x4474d6,_0x37ec2){const _0x4ac90d={'content':_0x4474d6};_0x37ec2&&(_0x4ac90d['attributes']=_0x37ec2);const _0x270e5f=this['_sendApiRequest']('/conversations/'+_0x484cd3+'/documents','POST',_0x4ac90d);return{'getId':async()=>(await _0x270e5f['request'])['json'](),'abortController':_0x270e5f['abortController']};}['uploadDocuments'](_0x21415a,_0x5ef103){const _0x5d8ccf={'documents':_0x5ef103['map'](_0x4bb906=>({'content':_0x4bb906['content'],'attributes':{'version':_0x4bb906['version'],'sessionId':_0x4bb906['sessionId'],'channelId':_0x4bb906['channelId'],'rootName':_0x4bb906['rootName'],'selections':_0x4bb906['selections']},...void 0x0!==_0x4bb906['name']?{'name':_0x4bb906['name']}:{},...void 0x0!==_0x4bb906['description']?{'description':_0x4bb906['description']}:{}}))},_0x3b23ae=this['_sendApiRequest']('/conversations/'+_0x21415a+'/documents/batch','POST',_0x5d8ccf);return{'getIds':async()=>(await _0x3b23ae['request'])['json'](),'abortController':_0x3b23ae['abortController']};}['fetchDocuments'](_0x424a79,_0x30f681){const _0x3d87e0=new URLSearchParams();_0x3d87e0['append']('documentIds',_0x30f681['join'](','));const _0x3927b7=this['_sendApiRequest']('/conversations/'+_0x424a79+'/documents/batch?'+_0x3d87e0['toString'](),'GET');return{'getDocuments':async()=>(await _0x3927b7['request'])['json'](),'abortController':_0x3927b7['abortController']};}['fetchConversations'](_0x481098,_0x59dc35={}){const _0x2a9875=new URLSearchParams();_0x2a9875['append']('group',_0x481098),_0x2a9875['append']('excludeEmpty',!0x1!==_0x59dc35['excludeEmpty']?'true':'false'),_0x2a9875['append']('limit',_0x59dc35['limit']?_0x59dc35['limit']['toString']():'100'),_0x2a9875['append']('sortBy',_0x59dc35['sortBy']?_0x59dc35['sortBy']:'createdAt'),_0x2a9875['append']('order',_0x59dc35['order']?_0x59dc35['order']:'desc');const _0x2c02fd=this['_sendApiRequest']('/conversations?'+_0x2a9875['toString'](),'GET');return{'getConversations':async()=>{const _0x10b2d4=await _0x2c02fd['request'];return(await _0x10b2d4['json']())['items'];},'abortController':_0x2c02fd['abortController']};}['deleteConversation'](_0x4967d2){const _0x5a268e=this['_sendApiRequest']('/conversations/'+_0x4967d2,'DELETE');return{'execute':async()=>{await _0x5a268e['request'];},'abortController':_0x5a268e['abortController']};}['updateConversation'](_0x396ada,_0x109edc){const _0xe20544=this['_sendApiRequest']('/conversations/'+_0x396ada,'PATCH',_0x109edc);return{'getResult':async()=>(await _0xe20544['request'],_0x109edc),'abortController':_0xe20544['abortController']};}['fetchConversation'](_0x10715b){const _0xca592b=this['_sendApiRequest']('/conversations/'+_0x10715b,'GET');return{'getConversation':async()=>(await _0xca592b['request'])['json'](),'abortController':_0xca592b['abortController']};}['fetchConversationMessages'](_0x292daf){const _0xe85091=this['_sendApiRequest']('/conversations/'+_0x292daf+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>{const _0x84f1ce=await _0xe85091['request'];return(await _0x84f1ce['json']())['items'];},'abortController':_0xe85091['abortController']};}['uploadUrl'](_0x1a481a,_0x2a6019,_0x31fba5){const _0x26bcf3=this['_sendApiRequest']('/conversations/'+_0x1a481a+'/web-resources','POST',{'url':_0x2a6019,'attributes':_0x31fba5});return{'getId':async()=>(await _0x26bcf3['request'])['json'](),'abortController':_0x26bcf3['abortController']};}['getModels'](_0x39f921='en'){const _0x15bc0c=new URLSearchParams();_0x15bc0c['append']('language',_0x39f921);const _0x3a9b31='/models/1?'+_0x15bc0c['toString'](),_0x277a15=this['_sendApiRequest'](_0x3a9b31,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x277a15['request'])['json'](),'abortController':_0x277a15['abortController']};}['deleteFile'](_0x47cc51,_0x1a9fe5){const _0x16bd5a=this['_sendApiRequest']('/conversations/'+_0x47cc51+'/files/'+_0x1a9fe5,'DELETE');return{'execute':async()=>{await _0x16bd5a['request'];},'abortController':_0x16bd5a['abortController']};}['deleteDocument'](_0x2e1e76,_0x107147){const _0x5885ac=this['_sendApiRequest']('/conversations/'+_0x2e1e76+'/documents/'+_0x107147,'DELETE');return{'execute':async()=>{await _0x5885ac['request'];},'abortController':_0x5885ac['abortController']};}['deleteWebResource'](_0x16bbf2,_0x512e72){const _0x9dd00b=this['_sendApiRequest']('/conversations/'+_0x16bbf2+'/web-resources/'+_0x512e72,'DELETE');return{'execute':async()=>{await _0x9dd00b['request'];},'abortController':_0x9dd00b['abortController']};}['cancelStream'](_0x2188d8,_0x1424f4){const _0x18bde0=this['_sendApiRequest']('/conversations/'+_0x2188d8+'/messages/'+_0x1424f4+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0x18bde0['request'];},'abortController':_0x18bde0['abortController']};}['resumeStream'](_0x329dc1,_0x1bc984,_0x2ef046='0-0'){const _0x557c5f=new URLSearchParams({'lastEventId':_0x2ef046}),_0x50d10e=this['_sendApiRequest']('/conversations/'+_0x329dc1+'/messages/'+_0x1bc984+'/stream?'+_0x557c5f['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x2620a0=await _0x50d10e['request'];return this['_getStreamReader'](_0x2620a0['body']);},'abortController':_0x50d10e['abortController']};}['callSystemReview']({reviewName:_0x418d20,content:_0x53744f,args:_0x4bd62f}){const _0x2ae6f8=this['_sendApiRequest']('/reviews/system/'+_0x418d20+'/calls','POST',{'content':[{'type':'text','content':_0x53744f}],'args':_0x4bd62f});return{'getStream':async()=>{const _0x224567=(await _0x2ae6f8['request'])['body'];return this['_getStreamReader'](_0x224567);},'abortController':_0x2ae6f8['abortController']};}['callCustomReview']({content:_0x27654e,prompt:_0x26ceb0,model:_0x145719}){const _0x36c25b=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x27654e}],'prompt':_0x26ceb0,'model':_0x145719});return{'getStream':async()=>{const _0x151a89=(await _0x36c25b['request'])['body'];return this['_getStreamReader'](_0x151a89);},'abortController':_0x36c25b['abortController']};}['upsertAIChatRating'](_0x59821a,_0x240bf0,_0x589799){const _0xf92088=this['_sendApiRequest']('/conversations/'+_0x59821a+'/messages/'+_0x240bf0+'/ratings','PUT',{'positiveCount':_0x589799['positiveCount'],'totalCount':_0x589799['totalCount'],'modificationId':_0x589799['modificationId']});return{'execute':async()=>{await _0xf92088['request'];},'abortController':_0xf92088['abortController']};}['upsertAIActionRating'](_0x351152,_0x547796,_0x4cd7f9){const _0x5c065f=this['_sendApiRequest']('/actions/system/'+_0x351152+'/calls/'+_0x547796+'/ratings','PUT',{'positiveCount':_0x4cd7f9['positiveCount'],'totalCount':_0x4cd7f9['totalCount']});return{'execute':async()=>{await _0x5c065f['request'];},'abortController':_0x5c065f['abortController']};}['upsertCustomAIActionRating'](_0x718205,_0x58fe65){const _0x5dc6f5=this['_sendApiRequest']('/actions/custom/calls/'+_0x718205+'/ratings','PUT',{'positiveCount':_0x58fe65['positiveCount'],'totalCount':_0x58fe65['totalCount']});return{'execute':async()=>{await _0x5dc6f5['request'];},'abortController':_0x5dc6f5['abortController']};}['upsertAIReviewRating'](_0x19b0c9,_0x2ac3b6,_0x24a855,_0x69193f){const _0x2b8cc0=this['_sendApiRequest']('/reviews/system/'+_0x19b0c9+'/calls/'+_0x2ac3b6+'/ratings','PUT',{'positiveCount':_0x24a855['positiveCount'],'totalCount':_0x24a855['totalCount'],'dataId':_0x69193f});return{'execute':async()=>{await _0x2b8cc0['request'];},'abortController':_0x2b8cc0['abortController']};}['upsertCustomAIReviewRating'](_0x238193,_0x199efb,_0x4fc8aa){const _0x14b9c8=this['_sendApiRequest']('/reviews/custom/calls/'+_0x238193+'/ratings','PUT',{'positiveCount':_0x199efb['positiveCount'],'totalCount':_0x199efb['totalCount'],'dataId':_0x4fc8aa});return{'execute':async()=>{await _0x14b9c8['request'];},'abortController':_0x14b9c8['abortController']};}['_sendApiRequest'](_0xcaf87e,_0x8565c3,_0x1523aa,_0x46875e={}){const {useCache:_0x12ef5f=!0x1,apiUrl:_0x33fed9=this['_apiUrl']}=_0x46875e,_0x110f9a=new AbortController(),_0x1fdcc3=_0x12ef5f?_0x8565c3+':'+_0xcaf87e:null;if(_0x1fdcc3){const _0x35e6be=this['_responseCache']['get'](_0x1fdcc3);if(_0x35e6be)return{'request':_0x35e6be['then'](_0x54e6cf=>_0x54e6cf['clone']()),'abortController':_0x110f9a};}const _0x4f11c1=_0x1523aa instanceof FormData,_0x287990={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':pt};_0x1523aa&&!_0x4f11c1&&(_0x287990['Content-Type']='application/json');const _0x28e1ba={'method':_0x8565c3,'headers':_0x287990,'signal':_0x110f9a['signal']};_0x1523aa&&(_0x28e1ba['body']=_0x4f11c1?_0x1523aa:JSON['stringify'](_0x1523aa));const _0x1a2cdc=fetch(''+_0x33fed9+_0xcaf87e,_0x28e1ba)['catch'](_0x51b68e=>{_0x1fdcc3&&this['_responseCache']['delete'](_0x1fdcc3),this['_handleError'](_0x51b68e);})['then'](_0x9e8db=>_0x9e8db['ok']?_0x9e8db:_0x9e8db['json']()['then'](_0x310d22=>{throw _0x1fdcc3&&this['_responseCache']['delete'](_0x1fdcc3),{'url':_0x33fed9,'path':_0xcaf87e,'method':_0x8565c3,'body':_0x1523aa,'status':(_0x9e8db||{})['status'],'statusText':(_0x9e8db||{})['statusText'],'code':_0x310d22['code'],'message':_0x310d22['message'],'traceId':_0x310d22['traceId']};}));return _0x1fdcc3&&this['_responseCache']['set'](_0x1fdcc3,_0x1a2cdc['then'](_0x34c6a0=>_0x34c6a0['clone']())),{'request':_0x1a2cdc,'abortController':_0x110f9a};}async*['_getStreamReader'](_0x3c83d9){const _0x443dc3=[],_0x1de15e=_0x3c83d9['getReader'](),_0x31047f=_0x2d5b3c({'onError':_0x3e4287=>{this['_handleError'](_0x3e4287);},'onEvent':_0x5d7cc8=>{_0x5d7cc8['data']=JSON['parse'](_0x5d7cc8['data']),_0x443dc3['push'](_0x5d7cc8);}});try{let _0x27af21=!0x1;for(;!_0x27af21;){const {done:_0x151f7a,value:_0x1ef852}=await _0x1de15e['read']();_0x151f7a&&(_0x27af21=!0x0),_0x31047f['feed'](this['_decoder']['decode'](_0x1ef852,{'stream':!0x0})),yield*_0x443dc3,_0x443dc3['length']=0x0;}}catch(_0x4e8769){this['_handleError'](_0x4e8769);}finally{_0x1de15e['releaseLock'](),_0x31047f['reset']();}}['_handleError'](_0x3ab536){if(_0x3ab536 instanceof ht)throw _0x3ab536;if(_0x3ab536 instanceof Error&&'AbortError'===_0x3ab536['name'])throw new ht('ai-request-aborted',this,{'originalError':_0x3ab536});throw new ht('ai-request-failed',this,{'originalError':_0x3ab536});}}function Mi(_0x53ef4e,_0x3965c2,_0x230c3a){const t=_0x53ef4e['t'];switch(_0x3965c2){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'},_0x230c3a);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0x230c3a);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.'},_0x230c3a);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0x230c3a);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'},_0x230c3a);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0x230c3a);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'},_0x230c3a);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.'},_0x230c3a);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.'},_0x230c3a);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.'},_0x230c3a);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.'},_0x230c3a);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'},_0x230c3a);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.'},_0x230c3a);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0x3965c2;}}const Ui='ck-ai-button-primary',Bi='ck-ai-button-secondary',Gi='ck-ai-button-tertiary';function Fi(_0x44d672,_0x5e68de){const _0x2ab271=new yt(_0x44d672),_0x13c7c7=Mi(_0x44d672,'AI_TABS_LABEL_MINIMIZE'),_0x1dfe21=Mi(_0x44d672,'AI_TABS_LABEL_MAXIMIZE');return _0x2ab271['set']({'withText':!0x1,'icon':_0x48eaa9,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+Gi}),_0x2ab271['bind']('label')['to'](_0x5e68de,'isMaximized',_0x490d16=>_0x490d16?_0x13c7c7:_0x1dfe21),_0x2ab271['bind']('icon')['to'](_0x5e68de,'isMaximized',_0x1c655e=>_0x1c655e?_0x16f8b1:_0x48eaa9),_0x2ab271['bind']('isOn')['to'](_0x5e68de,'isMaximized'),_0x2ab271['on']('execute',()=>{_0x5e68de['fire']('resizeTabs');}),_0x2ab271;}function Wi(_0x8c514b,_0x1669d4){return _0x1a3587(_0x8c514b,_0x1669d4);}function Ki(_0x2494b0,_0x5f4129){return _0x44d9d1(_0x2494b0,_0x5f4129);}function Yi(_0x18c1ea,_0x58a710,_0x58139d){const _0x2e9c8d=null!==_0x58a710?_0x2c72a9=>_0x2c72a9['attribs'][_0x18c1ea]===_0x58a710:_0xd9c6b8=>Boolean(_0xd9c6b8['attribs'][_0x18c1ea]);return _0x1d9b34(_0x3dcbb5=>_0x13b829(_0x3dcbb5)&&_0x2e9c8d(_0x3dcbb5),_0x58139d);}function $i(_0x57917d,_0x2fab47,_0x496176){const _0x1ed238=null!==_0x2fab47?_0x393bd1=>_0x393bd1['attribs'][_0x57917d]===_0x2fab47:_0x5b0b9c=>Boolean(_0x5b0b9c['attribs'][_0x57917d]);return _0x3789f9(_0x1405c3=>_0x13b829(_0x1405c3)&&_0x1ed238(_0x1405c3),_0x496176);}function qi(_0x2957b8){return _0x3789f9(_0x41556d=>_0x13b829(_0x41556d)&&function(_0x552ee2){const _0x25e7be=_0x552ee2['toLowerCase']();return'script'===_0x25e7be||'style'===_0x25e7be||_0x25e7be['includes']('-');}(_0x41556d['name']),_0x2957b8);}function Qi(_0x21e6af){return _0xc71f43(_0x4f2ca4=>_0x483f9c(_0x4f2ca4),_0x21e6af,!0x0,0x1/0x0);}function Xi(_0x5cd1a7,_0x1a730f){return _0x5cd1a7&&_0x13b829(_0x5cd1a7)?_0x5cd1a7['attribs'][_0x1a730f]:null;}function zi(_0xd10d1b,_0x53fe50,_0x418b30){_0x13b829(_0xd10d1b)&&(null===_0x418b30?delete _0xd10d1b['attribs'][_0x53fe50]:_0xd10d1b['attribs'][_0x53fe50]=_0x418b30);}function ji(_0xfdeed4,_0x3dc025,_0x5a0780){const _0x28b4b7=_0x3dc025['cloneNode'](!0x0);'beforebegin'===_0x5a0780?_0x29d740(_0xfdeed4,_0x28b4b7):'afterbegin'===_0x5a0780?_0x42bbf5(_0xfdeed4,_0x28b4b7):'beforeend'===_0x5a0780?_0xd38d70(_0xfdeed4,_0x28b4b7):'afterend'===_0x5a0780&&_0x1fc186(_0xfdeed4,_0x28b4b7);}function Ji(_0x18049f){const _0x20f90b=[];let _0x497e3f=_0x18049f;for(;_0x497e3f;)_0x497e3f=_0x2274ed(_0x497e3f),_0x497e3f&&_0x20f90b['push'](_0x497e3f);return _0x20f90b;}function Zi(_0x2b43fb){return _0x2b43fb['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function ts(_0x4c3715){let _0x4c4931=0x0;for(;_0x4c3715['parentNode'];)_0x4c3715=_0x4c3715['parentNode'],_0x4c4931++;return _0x4c4931;}function es(_0x4adab1){const _0x25e0f5=[];let _0x345a7e=_0x4adab1['nextSibling'];for(;_0x345a7e;)_0x25e0f5['push'](_0x345a7e),_0x345a7e=_0x345a7e['nextSibling'];_0x25e0f5['forEach'](_0xefd84d=>{_0x369ef0(_0xefd84d);});}class AIResponseParser extends/* #__PURE__ -- @preserve */
|
|
25
|
-
ct(){['_m2html'];constructor(){super();const _0x3ae22a=Object['entries'](_0x530040),_0x24a46f=_0x3ae22a['findIndex'](([_0x2b41ca])=>'rehypeDomRaw'===_0x2b41ca);if(-0x1===_0x24a46f)throw new ht('ai-response-parser-unable-to-set-up-parser');_0x3ae22a['splice'](_0x24a46f+0x1,0x0,['rehypeSanitize',_0x40e926]),this['_m2html']=new _0x10d00c({'plugins':Object['fromEntries'](_0x3ae22a)});}['convertMarkdownToHTML'](_0xf8f031){const _0x551516=this['_m2html']['parse'](_0xf8f031);return this['parseAndNormalizeHTML'](_0x551516);}['parseAndNormalizeHTML'](_0xf34617){return this['_parseHTML'](_0xf34617);}['_parseHTML'](_0x4166f7){const _0x48c18c=Wi('<dummy>'+_0x4166f7['replace'](/<[^>]*?$/g,'')+'</dummy>');return is(_0x48c18c),_0x48c18c['children']=_0x48c18c['children'][0x0]['children'],_0x48c18c;}}function is(_0x35c275){for(const _0x284c53 of _0x35c275['children'])_0x13b829(_0x284c53)?'pre'!==_0x284c53['name']&&is(_0x284c53):_0x2aa022(_0x284c53)&&(_0x284c53['data']=_0x284c53['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}class AIResponseApplier extends/* #__PURE__ -- @preserve */
|
|
26
|
-
ct(){['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x26684c){super(),this['_generateUid']=_0x26684c||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x2e7d86,_0x54acd8,_0x219008){this['_uidCounter']=0x0;const _0x5304b8=_0x2e7d86['cloneNode'](!0x0);rs(_0x54acd8,_0x5304b8);const _0x1e0d85=_0x5304b8['childNodes'],_0x7d8dca=Array['from'](_0x1e0d85)['filter'](_0x1c8191=>!(0x3===_0x1c8191['nodeType']&&''===Ki(_0x1c8191)['trim']())),_0x3997a9=_0x7d8dca['length'];for(const _0x14de78 of _0x7d8dca)_0x14de78&&_0x13b829(_0x14de78)&&void 0x0===_0x14de78['attribs']['data-id']&&zi(_0x14de78,'data-id','new-element');if(0x0===_0x54acd8['childNodes']['length']){const _0x5c5f8c=[];return $i('data-id','new-element',_0x5304b8)['forEach'](_0x2ae08e=>{const _0x3b3d79=this['_generateUid']();zi(_0x2ae08e,'data-id',_0x3b3d79),_0x5c5f8c['push'](_0x3b3d79);}),this['_removeSpecialComments'](_0x5304b8),{'parsedContent':_0x5304b8,'newNodeIds':_0x5c5f8c,'modifiedNodeIds':[],'removedNodeIds':[]};}this['_touchedNodesState']['newIds']=[],this['_touchedNodesState']['modifiedIds']=[],this['_touchedNodesState']['removedIds']=[],this['_touchedNodesState']['invalidIds']=[],this['_touchedNodesState']['lastTouchedId']=null,this['_touchedNodesState']['rescuedNewIds']=new Set(),this['_referencedExistingIds']=new Set(),this['_existingDataIds']=new Set($i('data-id',null,_0x54acd8)['map'](_0x528b86=>Xi(_0x528b86,'data-id'))['filter'](_0x29fd7d=>!!_0x29fd7d));let _0x5a6a5c=-0x1,_0x2e148a=!0x1;for(let _0x4d7250=0x0;_0x4d7250<_0x3997a9;_0x4d7250++){const _0xcabbad=_0x7d8dca[_0x4d7250],_0x3aca03=_0x7d8dca[_0x4d7250+0x1];if(this['_isNewNode'](_0xcabbad)){if(-0x1===_0x5a6a5c&&(_0x5a6a5c=_0x4d7250),this['_markWrappedElements'](_0xcabbad),!this['_isNewNode'](_0x3aca03)){const [_0x744987,_0x48dd5d]=this['_findReferenceNode'](_0xcabbad,_0x2e148a,_0x54acd8);if(_0x744987){const _0x27bd07=Array['from'](_0x7d8dca)['slice'](_0x5a6a5c,_0x4d7250+0x1);this['_insertNodes'](_0x744987,_0x27bd07,_0x48dd5d),_0x5a6a5c=-0x1;}}}else{if(this['_isExistingContentComment'](_0xcabbad))_0x2e148a=!0x0;else{if(this['_isExistingNode'](_0xcabbad)){const _0x119626=Xi(_0xcabbad,'data-id');if(_0x119626&&this['_existingDataIds']['has'](_0x119626)){this['_referencedExistingIds']['add'](_0x119626);const _0x5b1139=Yi('data-id',_0x119626,_0x54acd8);this['_replaceNode'](_0x5b1139,_0xcabbad);}}else{if(ss(_0xcabbad)){const _0x579e7d=ns(_0xcabbad);!!Yi('data-id',_0x579e7d,_0x5304b8)||this['_touchedNodesState']['removedIds']['push'](_0x579e7d);}}}}}for(const _0x357e2a of this['_touchedNodesState']['removedIds']){const _0x137cf6=Yi('data-id',_0x357e2a,_0x54acd8);_0x137cf6&&(this['_rescueUnwrappedElements'](_0x137cf6),this['_removeNode'](_0x137cf6,_0x357e2a,_0x219008));}if($i('data-id','new-element',_0x54acd8)['forEach'](_0x192e64=>{const _0x17a6c2=this['_getUid'](_0x192e64);zi(_0x192e64,'data-id',_0x17a6c2),this['_touchedNodesState']['newIds']['push'](_0x17a6c2);}),this['_removeSpecialComments'](_0x54acd8),_0x219008&&_0x219008['cutAfterUnstable']){const _0x2f5f93=this['_findLastConfirmationPoint'](_0x7d8dca),_0x13af6f=this['_getLastStableElement'](_0x54acd8,_0x2f5f93);this['_markUnstableElements'](_0x54acd8,_0x13af6f);}if(this['_processWrappedElements'](_0x54acd8,_0x219008),_0x219008&&_0x219008['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x25341a=$i('data-id',this['_touchedNodesState']['lastTouchedId'],_0x54acd8);let _0x1e6d83=_0x25341a[_0x25341a['length']-0x1];for(;_0x1e6d83;)es(_0x1e6d83),_0x1e6d83=_0x1e6d83['parentNode'];}return{'parsedContent':_0x54acd8,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x39d23c,_0x12cf08,_0x2b432b){for(const _0xe10f03 of _0x12cf08){const _0x81fbb1=this['_getUid'](_0xe10f03);zi(_0xe10f03,'data-id',_0x81fbb1),this['_touchedNodesState']['newIds']['push'](_0x81fbb1),this['_touchedNodesState']['lastTouchedId']=_0x81fbb1;}const _0x22d0da='afterbegin'===_0x2b432b||'afterend'===_0x2b432b?_0x12cf08['reverse']():_0x12cf08;for(const _0x1a8317 of _0x22d0da)ji(_0x39d23c,_0x1a8317,_0x2b432b);}['_replaceNode'](_0x1ae458,_0x13fe15){if(!_0x1ae458)return;if(_0x27cff0=_0x13fe15,Zi(Ki(_0x1ae458))===Zi(Ki(_0x27cff0)))return;var _0x27cff0;const _0x42de10=Xi(_0x1ae458,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x42de10),this['_touchedNodesState']['lastTouchedId']=_0x42de10,_0x151bb7(_0x1ae458,_0x13fe15['cloneNode'](!0x0));}['_removeNode'](_0xb1f72d,_0x5d6c25,_0x2a6d2f){if(_0x2a6d2f&&_0x2a6d2f['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0x5d6c25;const _0x28fbf4=_0x2a6d2f['replaceRemovedWith']['cloneNode'](!0x0);zi(_0x28fbf4,'data-id',_0x5d6c25),zi(_0x28fbf4,'data-removed','true'),_0x151bb7(_0xb1f72d,_0x28fbf4);}else _0x369ef0(_0xb1f72d);}['_findReferenceNode'](_0x35fe43,_0x5d7c34,_0xcaf158){const _0x1d3b50=this['_findPrevElementWithDataId'](_0x35fe43,!0x1);if(_0x1d3b50){const _0x1784e1=ns(_0x1d3b50),_0x1c047b=Yi('data-id',_0x1784e1,_0xcaf158);if(_0x1c047b)return[_0x1c047b,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x1784e1);}const _0x35d479=this['_findNextElementWithDataId'](_0x35fe43,!0x1);if(_0x35d479){const _0x1c2788=ns(_0x35d479),_0x4743fd=Yi('data-id',_0x1c2788,_0xcaf158);if(_0x4743fd)return[_0x4743fd,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x1c2788);}return _0x5d7c34?_0x35fe43['nextSibling']?this['_findFallbackReferenceNode'](_0x35fe43,_0xcaf158):[_0xcaf158['childNodes'][_0xcaf158['childNodes']['length']-0x1],'afterend']:[_0xcaf158['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x1965fd,_0x87a792){const _0x5316c8=[],_0x36357e=this['_findPrevElementWithDataId'](_0x1965fd,!0x0);if(_0x36357e){const _0x5ae5b3=Yi('data-id',ns(_0x36357e),_0x87a792);_0x5ae5b3&&_0x5316c8['push']([_0x5ae5b3,'afterend']);}const _0x1752e7=this['_findNextElementWithDataId'](_0x1965fd,!0x0);if(_0x1752e7){const _0x381f89=Yi('data-id',ns(_0x1752e7),_0x87a792);_0x381f89&&_0x5316c8['push']([_0x381f89,'beforebegin']);}if(_0x5316c8['length']>0x1)return ts(_0x5316c8[0x0][0x0])<=ts(_0x5316c8[0x1][0x0])?_0x5316c8[0x0]:_0x5316c8[0x1];return 0x1===_0x5316c8['length']?_0x5316c8[0x0]:[_0x87a792['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x248f24,_0x2a201f){let _0x289220=_0x248f24['nextSibling'],_0x1f88c6=null,_0x3dfe29=!0x1;for(;_0x289220;){if(_0x483f9c(_0x289220)){if(ss(_0x289220)&&(_0x1f88c6=_0x289220),this['_isExistingContentComment'](_0x289220)&&_0x2a201f&&!_0x3dfe29){_0x3dfe29=!0x0,_0x289220=_0x289220['nextSibling'];continue;}break;}const _0x4dc53f=Xi(_0x289220,'data-id');if(_0x4dc53f&&'new-element'!==_0x4dc53f&&this['_existingDataIds']['has'](_0x4dc53f)){_0x1f88c6=_0x289220;break;}_0x289220=_0x289220['nextSibling'];}return _0x1f88c6;}['_findPrevElementWithDataId'](_0x4767c7,_0x136f36){let _0x2ae060=_0x4767c7['previousSibling'],_0x31448f=null,_0x3cc3e7=!0x1;for(;_0x2ae060;){if(_0x483f9c(_0x2ae060)){if(ss(_0x2ae060)&&(_0x31448f=_0x2ae060),this['_isExistingContentComment'](_0x2ae060)&&_0x136f36&&!_0x3cc3e7){_0x3cc3e7=!0x0,_0x2ae060=_0x2ae060['previousSibling'];continue;}break;}const _0x1ed865=Xi(_0x2ae060,'data-id');if(_0x1ed865&&'new-element'!==_0x1ed865&&this['_existingDataIds']['has'](_0x1ed865)){_0x31448f=_0x2ae060;break;}_0x2ae060=_0x2ae060['previousSibling'];}return _0x31448f;}['_markWrappedElements'](_0x19f632){_0x13b829(_0x19f632)&&$i('data-id',null,_0x19f632)['forEach'](_0x544c8a=>{this['_isExistingNode'](_0x544c8a)&&(zi(_0x544c8a,'data-wrapped-id',Xi(_0x544c8a,'data-id')),zi(_0x544c8a,'data-id',null));});}['_processWrappedElements'](_0x370171,_0x3fd70e){$i('data-wrapped-id',null,_0x370171)['forEach'](_0x2ea3ff=>{const _0x237e25=Xi(_0x2ea3ff,'data-wrapped-id');if(this['_hasUnstableParent'](_0x2ea3ff))return;const _0x3d720c=Yi('data-id',_0x237e25,_0x370171);zi(_0x2ea3ff,'data-id',_0x237e25),_0x3d720c&&(this['_removeNode'](_0x3d720c,_0x237e25,_0x3fd70e),this['_touchedNodesState']['removedIds']['push'](_0x237e25),this['_touchedNodesState']['lastTouchedId']=_0x237e25);});}['_hasUnstableParent'](_0x353dbf){let _0x2efae2=_0x353dbf['parentNode'];for(;_0x2efae2;){if(Xi(_0x2efae2,'data-unstable'))return!0x0;_0x2efae2=_0x2efae2['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x2b7250){const _0x534cfd=new Set(this['_touchedNodesState']['removedIds']),_0xa5e821=new Set(this['_touchedNodesState']['newIds']);$i('data-id',null,_0x2b7250)['forEach'](_0x4f41be=>{const _0x2cf88e=Xi(_0x4f41be,'data-id'),_0x34e259=!!_0x2cf88e&&this['_referencedExistingIds']['has'](_0x2cf88e),_0x4d7975=!!_0x2cf88e&&_0xa5e821['has'](_0x2cf88e);if(!_0x2cf88e||!_0x34e259&&!_0x4d7975)return;if(_0x534cfd['has'](_0x2cf88e))return;let _0x266506=_0x4f41be['parentNode'],_0x1bf0cb=!0x1;for(;_0x266506;){if(_0x266506===_0x2b7250){_0x1bf0cb=!0x0;break;}const _0x4b157e=Xi(_0x266506,'data-id');if(_0x4b157e&&(this['_referencedExistingIds']['has'](_0x4b157e)||_0xa5e821['has'](_0x4b157e)))return;_0x266506=_0x266506['parentNode'];}if(_0x1bf0cb){if(_0x29d740(_0x2b7250,_0x4f41be),_0x34e259){const _0x251442=this['_generateUid'](),_0x3e24e6=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x2cf88e);-0x1!==_0x3e24e6&&this['_touchedNodesState']['modifiedIds']['splice'](_0x3e24e6,0x1),zi(_0x4f41be,'data-unwrapped-id',_0x2cf88e),zi(_0x4f41be,'data-id',_0x251442),this['_touchedNodesState']['newIds']['push'](_0x251442),this['_touchedNodesState']['rescuedNewIds']['add'](_0x251442),this['_touchedNodesState']['lastTouchedId']=_0x251442;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x2cf88e),this['_touchedNodesState']['lastTouchedId']=_0x2cf88e;}});}['_getUid'](_0x5254f6){return this['_isExistingNode'](_0x5254f6)?Xi(_0x5254f6,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x2b02fa){Qi(_0x2b02fa)['filter'](_0x5c9a44=>ss(_0x5c9a44)||this['_isExistingContentComment'](_0x5c9a44))['forEach'](_0x4cae8d=>{_0x369ef0(_0x4cae8d);});}['_findLastConfirmationPoint'](_0x4c3814){let _0x54a24e=null,_0x56d389=null,_0x461389=null,_0x508f8f=null;const _0x39a3b7=_0xcc5dc9=>{_0xcc5dc9&&(_0x54a24e=_0xcc5dc9),_0x461389=null,_0x508f8f=null;};for(let _0x1cc9e6=0x0;_0x1cc9e6<_0x4c3814['length'];_0x1cc9e6++){const _0x5057e0=_0x4c3814[_0x1cc9e6];if(this['_isExistingContentComment'](_0x5057e0)){_0x39a3b7(_0x56d389);continue;}if(_0x13b829(_0x5057e0)){const _0x39fe4b=Xi(_0x5057e0,'data-id'),_0xa7d61b=_0x1cc9e6===_0x4c3814['length']-0x1;if(_0x39fe4b&&'new-element'!==_0x39fe4b&&this['_touchedNodesState']['modifiedIds']['includes'](_0x39fe4b)&&!_0xa7d61b){_0x39a3b7(_0x39fe4b),_0x56d389=_0x39fe4b;continue;}}let _0x41688b=null;const _0x48ac89=ns(_0x5057e0);if(_0x48ac89&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x48ac89))_0x56d389=_0x48ac89;else{if(_0x48ac89&&this['_touchedNodesState']['newIds']['includes'](_0x48ac89))_0x41688b='N';else{if(!ss(_0x5057e0))continue;_0x41688b='R';}_0x41688b===_0x508f8f||null===_0x508f8f?_0x508f8f=_0x41688b:null!==_0x461389?(_0x39a3b7(_0x56d389),_0x508f8f=_0x41688b):(_0x461389=_0x508f8f,_0x508f8f=_0x41688b),_0x56d389=_0x48ac89;}}const _0x28873d=_0x4c3814[_0x4c3814['length']-0x1];return _0x28873d&&!_0x13b829(_0x28873d)&&!ss(_0x28873d)&&_0x56d389&&_0x39a3b7(_0x56d389),_0x54a24e;}['_getLastStableElement'](_0x43997a,_0x29bc79){if(!_0x29bc79)return null;const _0x3de1d3=Yi('data-id',_0x29bc79,_0x43997a);if(!_0x3de1d3)return null;const _0x232fab=[_0x3de1d3,...Ji(_0x3de1d3)]['at'](-0x2);if(_0x232fab===_0x3de1d3)return _0x3de1d3;let _0x32c65d=_0x232fab['previousSibling'];for(;_0x32c65d&&!_0x13b829(_0x32c65d);)_0x32c65d=_0x32c65d['previousSibling'];return _0x32c65d;}['_markUnstableElements'](_0x3c10e2,_0x58ac57){const _0x1963ee=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x3cb6e1=_0x58ac57?_0x58ac57['nextSibling']:_0x3c10e2['firstChild'];for(;_0x3cb6e1;){_0x13b829(_0x3cb6e1)&&((_0x1963ee['has'](Xi(_0x3cb6e1,'data-id'))||$i('data-id',null,_0x3cb6e1)['some'](_0x5df97b=>_0x1963ee['has'](Xi(_0x5df97b,'data-id'))))&&zi(_0x3cb6e1,'data-unstable','true')),_0x3cb6e1=_0x3cb6e1['nextSibling'];}}['_isNewNode'](_0x4c16a1){return Boolean('new-element'===Xi(_0x4c16a1,'data-id'));}['_isExistingNode'](_0x596c4c){return Boolean((Xi(_0x596c4c,'data-id')||'')['length']>0x0&&'new-element'!==Xi(_0x596c4c,'data-id'));}['_isExistingContentComment'](_0x147a23){return Boolean(_0x483f9c(_0x147a23)&&Ki(_0x147a23)['match'](/\s*existing[\s*-](content|document)\s*/g));}}function ss(_0x2c45f2){return!!_0x2c45f2&&Boolean(_0x483f9c(_0x2c45f2)&&Ki(_0x2c45f2)['match'](/removed[\s*-]data-id="[^"]+"/));}function ns(_0x1d0e7a){if(!_0x1d0e7a)return null;if(_0x13b829(_0x1d0e7a))return Xi(_0x1d0e7a,'data-id')??null;if(_0x483f9c(_0x1d0e7a)){const _0x1c8892=Ki(_0x1d0e7a)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x1c8892&&_0x1c8892[0x1])return _0x1c8892[0x1];}return null;}function rs(_0x2af6d7,_0x1dd61c){const _0x200a52=new Map();for(const _0x27f3d0 of qi(_0x2af6d7))_0x200a52['set'](Xi(_0x27f3d0,'data-id'),_0x27f3d0);const _0x33b9c6=new Set();for(const _0xa4393f of qi(_0x1dd61c)){const _0xcba97d=Xi(_0xa4393f,'data-id'),_0x27a12f=_0xcba97d?_0x200a52['get'](_0xcba97d):void 0x0;_0x27a12f?(_0x151bb7(_0xa4393f,_0x54dd72(_0x27a12f,!0x0)),_0x33b9c6['add'](_0xcba97d)):_0x369ef0(_0xa4393f);}for(const _0x3adf6b of Qi(_0x1dd61c))ss(_0x3adf6b)&&_0x200a52['has'](ns(_0x3adf6b))&&_0x369ef0(_0x3adf6b);const _0xda191=new Set($i('data-id',null,_0x1dd61c)['map'](_0x4276d2=>Xi(_0x4276d2,'data-id')));for(const [_0x9807d8,_0x2e64c8]of _0x200a52){if(_0x33b9c6['has'](_0x9807d8))continue;let _0x2a1728=_0x2e64c8['parent'],_0x1fcee9=null;for(;_0x2a1728&&_0x13b829(_0x2a1728);){const _0x2c0d2b=Xi(_0x2a1728,'data-id');if(_0x2c0d2b&&_0xda191['has'](_0x2c0d2b)){_0x1fcee9=_0x2c0d2b;break;}_0x2a1728=_0x2a1728['parent'];}if(!_0x1fcee9)continue;const _0x255031=Yi('data-id',_0x1fcee9,_0x1dd61c);_0x255031&&_0xd38d70(_0x255031,_0x54dd72(_0x2e64c8,!0x0));}}function os({changeGroups:_0x17d830,documentContextContent:_0x3d1df8,showDiff:_0x5eece8,trimUnchanged:_0x488ceb=!0x0}){return _0x17d830['map'](_0xbc8629=>{if('destroyed'===_0xbc8629['editor']['state'])return null;const _0x18e41e=new _0x2d0ea8([]),_0x21cbde=new _0x2d0ea8([]),_0x15d876=new Set();for(const _0x32cf8c of _0xbc8629['changes'])'new'==_0x32cf8c['type']&&$i('data-id',null,_0x32cf8c['node'])['forEach'](_0x3cf5a7=>{_0x15d876['add'](Xi(_0x3cf5a7,'data-id'));});for(const _0x6a9334 of _0xbc8629['changes'])if('removed'!=_0x6a9334['type']?_0x21cbde['children']['push'](_0x6a9334['node']['cloneNode'](!0x0)):_0x5eece8||_0x15d876['has'](_0x6a9334['id'])||_0x21cbde['children']['push'](_0x6a9334['node']['cloneNode'](!0x0)),'new'!=_0x6a9334['type']&&(_0x5eece8||'removed'!=_0x6a9334['type'])){const _0x16494a=_0x1d9b34(_0x42a635=>Xi(_0x42a635,'data-id')==_0x6a9334['id'],_0x3d1df8['get'](_0xbc8629['documentId']),!0x0);_0x16494a&&_0x18e41e['children']['push'](_0x16494a['cloneNode'](!0x0));}const {content:_0x1163a5,hasChanges:_0x3a6091}=as(_0xbc8629['editor'],_0x18e41e,_0x21cbde,_0x5eece8,_0x488ceb);return{'type':_0xbc8629['changes'][0x0]['type'],'index':_0xbc8629['index'],'content':_0x1163a5,'hasChanges':_0x3a6091};})['filter'](_0x334a11=>null!==_0x334a11);}function as(_0x272cbe,_0x219382,_0x54c960,_0x4b3c41,_0x2f3439=!0x0){const _0x566a8a=_0x272cbe['plugins']['get']('DocumentCompare'),_0x467a4e=Ki(_0x219382),_0x4b2bda=Ki(_0x54c960),_0x551941=_0x272cbe['data']['parse'](_0x467a4e,'$root'),_0x9f402a=_0x272cbe['model']['createPositionAt'](_0x551941,0x0),_0x194f46=_0x566a8a['getDiff'](_0x467a4e,_0x4b2bda,{'anchor':_0x9f402a,'markDeletions':_0x4b3c41,'targetEditor':_0x272cbe})['getOperations']();if(0x0==_0x194f46['length'])return{'content':_0x219382['cloneNode'](!0x0),'hasChanges':!0x1};if(_0x4b3c41?function(_0x23d1da,_0x2e654a,_0x2d6bad){if(0x0==_0x23d1da['length'])return;const _0x38fd16=_0x2d6bad['plugins']['get']('DocumentCompare'),_0x2e0fce=_0x2d6bad['plugins']['get']('SuggestionsConversion');_0x2d6bad['model']['change'](_0x1e0ffa=>{const _0x26e75d=new Set();for(let _0xa94868=0x0;_0xa94868<_0x23d1da['length'];_0xa94868++){const _0x5e5fb6=_0x23d1da[_0xa94868];if(_0x5e5fb6['baseVersion']=null,_0x5e5fb6['isDocumentOperation']=!0x1,_0x38fd16['isMarkedRemoveOperation'](_0x5e5fb6)){const _0x38376a=_0x370b23(_0x5e5fb6['newRange'],_0x2d6bad['model']),_0x1b5a2f='suggestion:deletion:'+at()+':$aiSuggestion';_0x2e654a['markers']['set'](_0x1b5a2f,_0x38376a);}else switch(_0x5e5fb6['type']){case'rename':{if(_0x5e5fb6['oldName']==_0x5e5fb6['newName'])break;_0x1e0ffa['batch']['addOperation'](_0x5e5fb6),_0x2d6bad['model']['applyOperation'](_0x5e5fb6);const _0x5748c4='$elementName',_0x5808a3=_0x5e5fb6['position'],_0x1ac8b2=_0x2d6bad['model']['createRange'](_0x5808a3,_0x2d6bad['model']['createPositionAt'](_0x5808a3['nodeAfter'],'end')),_0x1fa72c='suggestion:attribute:'+_0x5748c4+':'+at()+':$aiSuggestion';_0x2e654a['markers']['set'](_0x1fa72c,_0x1ac8b2);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x5e5fb6['oldValue']==_0x5e5fb6['newValue'])break;_0x1e0ffa['batch']['addOperation'](_0x5e5fb6),_0x2d6bad['model']['applyOperation'](_0x5e5fb6);const _0x48492b=_0x5e5fb6['key'];if(!_0x2e0fce['isRegisteredAttribute'](_0x48492b))break;const _0x21fdf2=_0x370b23(_0x5e5fb6['range'],_0x2d6bad['model']),_0x380326='suggestion:attribute:'+_0x48492b+':'+at()+':$aiSuggestion';_0x2e654a['markers']['set'](_0x380326,_0x21fdf2);break;}case'insert':{_0x1e0ffa['batch']['addOperation'](_0x5e5fb6),_0x2d6bad['model']['applyOperation'](_0x5e5fb6);if(_0x23d1da[_0xa94868+0x1]&&'move'==_0x23d1da[_0xa94868+0x1]['type']){hs(_0x2e654a,_0x5e5fb6);break;}const _0x3c5dbf=_0x5e5fb6['position'],_0x30e657=_0x5e5fb6['howMany'],_0x3afd56=_0x370b23(_0x2d6bad['model']['createRange'](_0x3c5dbf,_0x3c5dbf['getShiftedBy'](_0x30e657)),_0x2d6bad['model']),_0x22372a='suggestion:insertion:'+at()+':$aiSuggestion';_0x2e654a['markers']['set'](_0x22372a,_0x3afd56);break;}case'split':{_0x1e0ffa['batch']['addOperation'](_0x5e5fb6),_0x2d6bad['model']['applyOperation'](_0x5e5fb6);const _0x215e8b=_0x5e5fb6['splitPosition'],_0x277bd1=_0x5e5fb6['moveTargetPosition'],_0x4cba2c=_0x2d6bad['model']['createRange'](_0x215e8b,_0x277bd1),_0x56fd5a='suggestion:insertion:'+at()+':$aiSuggestion';_0x2e654a['markers']['set'](_0x56fd5a,_0x4cba2c);break;}case'move':{_0x1e0ffa['batch']['addOperation'](_0x5e5fb6),_0x2d6bad['model']['applyOperation'](_0x5e5fb6),_0x23d1da[_0xa94868-0x1]&&'insert'==_0x23d1da[_0xa94868-0x1]['type']&&hs(_0x2e654a,_0x5e5fb6);const _0x36cd27=_0x5e5fb6['getMovedRangeStart'](),_0x5a585f=_0x5e5fb6['howMany'];for(let _0x547497=0x0;_0x547497<_0x5a585f;_0x547497++){const _0x3b917d=_0x36cd27['getShiftedBy'](_0x547497)['nodeAfter'];_0x26e75d['add'](_0x3b917d);}break;}case'remove':{const _0x559f2d=_0x5e5fb6['sourcePosition'],_0x587f24=_0x5e5fb6['howMany'],_0x6420e8=new _0x35b10a(_0x559f2d,_0x587f24);_0x1e0ffa['batch']['addOperation'](_0x6420e8),_0x2d6bad['model']['applyOperation'](_0x6420e8);break;}}}for(const _0xb64e5f of _0x26e75d){const _0x22a34=_0x2d6bad['model']['createRangeOn'](_0xb64e5f),_0x4f1922='suggestion:formatBlock:$fakeWrap:'+at()+':$aiSuggestion';_0x2e654a['markers']['set'](_0x4f1922,_0x370b23(_0x22a34,_0x2d6bad['model']));}});}(_0x194f46,_0x551941,_0x272cbe):_0x272cbe['model']['change'](_0x3e265d=>{for(const _0x4d64f8 of _0x194f46)if('remove'==_0x4d64f8['type']){const _0x33af33=_0x4d64f8['sourcePosition'],_0x5034ee=_0x4d64f8['howMany'],_0x1e461a=new _0x35b10a(_0x33af33,_0x5034ee);_0x3e265d['batch']['addOperation'](_0x1e461a),_0x272cbe['model']['applyOperation'](_0x1e461a);}else{if('marker'==_0x4d64f8['type']){const _0x4e798d=_0x4d64f8['name'],_0x55f8ee=_0x4d64f8['newRange'];null!==_0x55f8ee?_0x551941['markers']['set'](_0x4e798d,_0x55f8ee):_0x551941['markers']['delete'](_0x4e798d);}else _0x4d64f8['baseVersion']=null,_0x4d64f8['isDocumentOperation']=!0x1,_0x3e265d['batch']['addOperation'](_0x4d64f8),_0x272cbe['model']['applyOperation'](_0x4d64f8);}}),_0x2f3439){const _0x44ce61=cs(_0x272cbe,_0x194f46,_0x551941);us(_0x272cbe['model'],_0x44ce61),function(_0xd18726,_0xfbfb53){const _0x53ae78=_0xfbfb53['getFirstRange']()['start'];let _0x19b0a2=_0xfbfb53['getFirstRange']()['end'];const _0x12326f=_0x53ae78['root'];(_0x19b0a2['textNode']||_0x19b0a2['nodeAfter']&&_0x19b0a2['nodeAfter']['is']('$text'))&&(_0x1603ee(_0x19b0a2,'...'),_0x19b0a2=_0x19b0a2['getShiftedBy'](0x3)),(_0x53ae78['textNode']||_0x53ae78['nodeBefore']&&_0x53ae78['nodeBefore']['is']('$text'))&&(_0x1603ee(_0x53ae78,'...'),function(_0x5a8e39,_0x7bf4c4,_0x136e4e){for(let [_0x197d6a,_0x1d885e]of _0x5a8e39['markers']){const _0x3db0b8=_0x1d885e['_getTransformedByInsertion'](_0x7bf4c4,_0x136e4e,!0x1);_0x1d885e=_0x3db0b8[0x0],_0x5a8e39['markers']['set'](_0x197d6a,_0x1d885e);}}(_0x12326f,_0x53ae78,0x3),_0x53ae78['parent']==_0x19b0a2['parent']&&(_0x19b0a2=_0x19b0a2['getShiftedBy'](0x3)));const _0xc71016=_0xd18726['createRange'](_0xd18726['createPositionAt'](_0x12326f,0x0),_0x53ae78),_0x1682d8=_0xd18726['createRange'](_0x19b0a2,_0xd18726['createPositionAt'](_0x12326f,'end')),_0x2b3646=[..._0xc71016['getMinimalFlatRanges'](),..._0x1682d8['getMinimalFlatRanges']()];_0x2b3646['reverse']();for(const _0x116030 of _0x2b3646)_0x3fdf3e(_0x116030),_s(_0x12326f,_0x116030);}(_0x272cbe['model'],_0x44ce61);}return{'content':Wi(_0x272cbe['data']['stringify'](_0x551941,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function hs(_0x3b1343,_0x378a91){for(const [_0x27d48f,_0x3de7f6]of _0x3b1343['markers']){const _0x2b28fa=_0x245154['_createFromRanges'](_0x3de7f6['getTransformedByOperation'](_0x378a91));_0x3b1343['markers']['set'](_0x27d48f,_0x2b28fa);}}function cs(_0x4237d4,_0x1e6f17,_0x4ee93b){const _0x1309a5=_0x4237d4['plugins']['get']('DocumentCompare');let _0x322eb=_0x4237d4['model']['createPositionAt'](_0x4ee93b,Number['POSITIVE_INFINITY']),_0x35a264=_0x4237d4['model']['createPositionAt'](_0x4ee93b,0x0);for(const _0x51cf17 of _0x1e6f17){let _0x50b6e7,_0x347bec;if(_0x1309a5['isMarkedRemoveOperation'](_0x51cf17))_0x50b6e7=_0x51cf17['newRange']['start'],_0x347bec=_0x51cf17['newRange']['end'];else switch(_0x322eb=ls(_0x322eb,_0x51cf17),_0x35a264=ls(_0x35a264,_0x51cf17),_0x51cf17['type']){case'rename':_0x50b6e7=_0x51cf17['position'],_0x347bec=_0x50b6e7['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x50b6e7=_0x51cf17['range']['start'],_0x347bec=_0x51cf17['range']['end'];break;case'insert':_0x50b6e7=_0x51cf17['position'],_0x347bec=_0x50b6e7['getShiftedBy'](_0x51cf17['howMany']);break;case'split':_0x50b6e7=_0x51cf17['splitPosition'],_0x347bec=_0x51cf17['moveTargetPosition'];break;case'merge':{const _0x23210a=_0x51cf17['targetPosition']['path']['slice'](0x0,-0x1);_0x50b6e7=_0x4237d4['model']['createPositionFromPath'](_0x4ee93b,_0x23210a),_0x347bec=_0x50b6e7['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x22ddbe=_0x51cf17['howMany'],_0x26b276=_0x51cf17['sourcePosition']['_getTransformedByInsertion'](_0x51cf17['targetPosition'],_0x22ddbe),_0x2670e0=_0x51cf17['getMovedRangeStart']();'remove'==_0x51cf17['type']?(_0x50b6e7=_0x26b276,_0x347bec=_0x26b276):(_0x50b6e7=_0x2670e0,_0x347bec=_0x2670e0['getShiftedBy'](_0x22ddbe));break;}}_0x50b6e7&&_0x50b6e7['isBefore'](_0x322eb)&&(_0x322eb=_0x50b6e7['clone'](),_0x322eb['stickiness']='toNone'),_0x347bec&&_0x347bec['isAfter'](_0x35a264)&&(_0x35a264=_0x347bec['clone'](),_0x35a264['stickiness']='toNone');}return _0x4237d4['model']['createSelection'](_0x4237d4['model']['createRange'](_0x322eb,_0x35a264));}function ls(_0x514e1c,_0x3b22cf){return'move'!=_0x3b22cf['type']&&'remove'!=_0x3b22cf['type']||_0x3b22cf['sourceRange']['containsPosition'](_0x514e1c)&&((_0x514e1c=_0x3b22cf['sourcePosition']['clone']())['stickiness']='toNone'),_0x514e1c['getTransformedByOperation'](_0x3b22cf);}function us(_0x152750,_0x236f89){ds(_0x152750,_0x236f89,'forward');const _0x82660b=_0x236f89['getFirstRange']();_0x236f89['setTo']([]),_0x236f89['setTo'](_0x82660b,{'backward':!0x0}),ds(_0x152750,_0x236f89,'backward');}function ds(_0x117b27,_0x1df931,_0x1aa0a1){let _0x32c9e1=0x14;for(;_0x32c9e1;){_0x117b27['modifySelection'](_0x1df931,{'unit':'word','direction':_0x1aa0a1}),_0x32c9e1--;const _0x2c5da2=_0x1df931['focus']['forward'==_0x1aa0a1?'nodeBefore':'nodeAfter'];if(_0x2c5da2&&_0x2c5da2['is']('element')&&_0x117b27['schema']['isBlock'](_0x2c5da2)&&_0x117b27['schema']['isObject'](_0x2c5da2))break;}}function _s(_0x596bf7,_0x417f68){for(const [_0xcac760,_0x2351ca]of _0x596bf7['markers']){const _0xe088ff=_0x2351ca['_getTransformedByDeletion'](_0x417f68['start'],_0x417f68['end']['offset']-_0x417f68['start']['offset']);null!=_0xe088ff?_0x596bf7['markers']['set'](_0xcac760,_0xe088ff):_0x596bf7['markers']['delete'](_0xcac760);}}class AIReply extends ct(){['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x4ee636,isDone:_0x8b4693=!0x1,isComplete:_0x155779,interactionId:_0x1e8d6f,areActionsDisabled:_0x568165,isFromHistory:_0x1349bb=!0x1,documentContextContent:_0x188a6b,locale:_0x45de04,id:_0x52e4a2,channelsToEditors:_0x2dfaf7}){super(),this['id']=_0x52e4a2||at(),this['interactionId']=_0x1e8d6f,this['type']=_0x4ee636,this['areActionsDisabled']=!!_0x568165,this['isFromHistory']=_0x1349bb,this['locale']=_0x45de04,this['aiResponseParser']=new AIResponseParser(),this['aiResponseApplier']=new AIResponseApplier(),this['documentContextContent']=new Map(_0x188a6b?.['map'](_0x9a0253=>[_0x9a0253['id'],Wi(_0x9a0253['content'])])||[]),this['_documentIdToSource']=new Map(_0x188a6b?.['map'](_0x4dba1a=>[_0x4dba1a['id'],{'editor':_0x2dfaf7['get'](_0x4dba1a['channelId']),'rootName':_0x4dba1a['rootName']}])||[]),this['set']('isDone',_0x8b4693),this['set']('isComplete',_0x155779??_0x8b4693),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x275e8a,_0x31f1c2){const _0x37783c='text'===this['type']?'text':_0x31f1c2;this['content']['has'](_0x37783c)||this['content']['set'](_0x37783c,''),this['content']['set'](_0x37783c,this['content']['get'](_0x37783c)+_0x275e8a),this['onContentChange'](_0x37783c);}['done'](_0x4ce937=!0x0){this['isComplete']=_0x4ce937,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x20a8f4,_0x21d994){this['changeGroups'][_0x20a8f4]['state']=_0x21d994,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x20a8f4,'state':_0x21d994});}['getContentParts']({showDiff:_0x4226e2,groupIndex:_0x760e59}){const _0x2ca734=this['_getCachedContentParts'](_0x4226e2,_0x760e59);if(_0x2ca734)return _0x2ca734;let _0x457500=[];if(void 0x0===_0x760e59)_0x457500=this['changeGroups'];else{const _0x4a800e=this['changeGroups']['find'](({index:_0x453550})=>_0x453550===_0x760e59);if(!_0x4a800e)throw new ht('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x760e59});_0x457500=[_0x4a800e];}const _0x12d4a5=os({'showDiff':_0x4226e2,'changeGroups':_0x457500,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0x4226e2,_0x12d4a5),_0x12d4a5;}['_getCachedContentParts'](_0xde89cb,_0x2d2e18){const _0x510499=_0xde89cb?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x510499]['length'])return null;const _0xb3e2d6=this['cachedSuggestionContentParts'][_0x510499];if(void 0x0===_0x2d2e18)return _0xb3e2d6['length']>0x0&&_0xb3e2d6['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0xde89cb,null),null):_0x373484(_0xb3e2d6);{const _0x12fb38=_0xb3e2d6['find'](({index:_0x284d12})=>_0x284d12===_0x2d2e18);if(_0x12fb38)return[_0x373484(_0x12fb38)];}return null;}['_setCachedContentParts'](_0x58f7f6,_0x1f075f){const _0x546ffd=_0x58f7f6?'withDiff':'withoutDiff';_0x1f075f?_0x1f075f['forEach'](_0x2d4476=>{const _0xce2d5f=this['cachedSuggestionContentParts'][_0x546ffd],_0x17b166=_0xce2d5f['find'](({index:_0x42ceed})=>_0x42ceed===_0x2d4476['index']);if(_0x17b166){const _0x2d426f=_0xce2d5f['indexOf'](_0x17b166);_0xce2d5f['splice'](_0x2d426f,0x1,_0x2d4476);}else _0xce2d5f['push'](_0x2d4476);}):this['cachedSuggestionContentParts'][_0x546ffd]['length']=0x0;}['onContentChange'](_0x2bb9ab){if('modification'===this['type']){if(_0x2bb9ab)this['parsedContent']['set'](_0x2bb9ab,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x2bb9ab)));else{for(const [_0x5cc8bf,_0x4a012b]of this['content'])this['parsedContent']['set'](_0x5cc8bf,this['aiResponseParser']['parseAndNormalizeHTML'](_0x4a012b));}const _0x57e77a=this['changeGroups'];for(const _0x258ccc of this['content']['keys']())this['updateChangeGroups'](_0x258ccc);const _0x3a2e07=this['_getDifferentChangeGroups'](_0x57e77a,this['changeGroups']);(_0x3a2e07['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0x3a2e07),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'](_0x5c3217,_0x176f50){const _0x5eb704=[];for(const _0x37a202 of _0x176f50){const _0x13ff21=_0x5c3217[_0x37a202['index']];_0x13ff21?_0x13ff21['changes']['length']!==_0x37a202['changes']['length']?_0x5eb704['push'](_0x37a202):_0x13ff21['changes']['forEach']((_0x2608a9,_0x46d053)=>{const _0x3f1e83=_0x37a202['changes'][_0x46d053];_0x2608a9['id']!==_0x3f1e83['id']&&_0x5eb704['push'](_0x37a202);}):_0x5eb704['push'](_0x37a202);}return _0x5eb704;}['updateChangeGroups'](_0xa65d80){const _0x91ff0f=this['documentContextContent']['get'](_0xa65d80),_0x4b6a50=this['parsedContent']['get'](_0xa65d80);if(!_0x91ff0f||!_0x4b6a50)return;const _0x2e4ca6=new _0x2fffb9('p',{},[new _0x2fffb9('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x57fdbc(Mi(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x592139=this['aiResponseApplier']['merge'](_0x4b6a50,_0x91ff0f['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0x2e4ca6});this['parsedMergedContent']['set'](_0xa65d80,_0x592139['parsedContent']);let _0x13cda8=[];if(_0x3789f9(_0x1ac160=>{const _0x12a1fe=Xi(_0x1ac160,'data-id');if(!_0x12a1fe||!_0x535646(_0x12a1fe))return!0x1;const _0x1d95d8=[_0x1ac160,...Ji(_0x1ac160)]['at'](-0x2);if(_0x1ac160!=_0x1d95d8){const _0x20ec45=Xi(_0x1d95d8,'data-id');_0x535646(_0x20ec45)||(_0x13cda8['push']({'node':_0x1d95d8,'id':_0x20ec45,'type':'modified'}),_0x592139['modifiedNodeIds']['push'](_0x20ec45));}else _0x592139['modifiedNodeIds']['includes'](_0x12a1fe)?_0x13cda8['push']({'node':_0x1ac160,'type':'modified','id':_0x12a1fe}):_0x592139['newNodeIds']['includes'](_0x12a1fe)?_0x13cda8['push']({'node':_0x1ac160,'type':'new','id':_0x12a1fe,'anchorId':Xi(_0x1ac160['previousSibling'],'data-id')}):_0x13cda8['push']({'node':_0x1ac160,'type':'removed','id':_0x12a1fe});return!0x0;},this['parsedMergedContent']['get'](_0xa65d80)),_0x13cda8=_0x13cda8['filter'](({node:_0x1ba9ec})=>[...Ji(_0x1ba9ec),_0x1ba9ec]['every'](_0x38bead=>!Xi(_0x38bead,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x39b5e2=>_0x39b5e2['documentId']!==_0xa65d80),0x0==_0x13cda8['length'])return;const _0x2be4bf=[[_0x13cda8[0x0]]];for(let _0x5943b4=0x1;_0x5943b4<_0x13cda8['length'];_0x5943b4++){const _0x2675c3=_0x2be4bf[_0x2be4bf['length']-0x1],_0x199314=_0x2675c3[_0x2675c3['length']-0x1];_0x13cda8[_0x5943b4]['node']['previousSibling']==_0x199314['node']&&'modified'!=_0x13cda8[_0x5943b4]['type']&&'modified'!=_0x199314['type']?_0x2675c3['push'](_0x13cda8[_0x5943b4]):_0x2be4bf['push']([_0x13cda8[_0x5943b4]]);}for(const _0x2d70fe of _0x2be4bf){const _0x30f608=_0x2d70fe[0x0],_0x367f76=_0x2d70fe[_0x2d70fe['length']-0x1],_0x54613b=_0x265624(_0x30f608['node']['previousSibling']);_0x54613b&&_0x2d70fe['unshift'](_0x54613b);const _0x44f96d=_0x265624(_0x367f76['node']['nextSibling']);_0x44f96d&&_0x2d70fe['push'](_0x44f96d);}$i('data-wrapped-id',null,this['parsedMergedContent']['get'](_0xa65d80))['forEach'](_0x415997=>{zi(_0x415997,'data-wrapped-id',null);});const _0x15a7cd=new Map();$i('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0xa65d80))['forEach'](_0x1e876c=>{const _0xbf08a6=Xi(_0x1e876c,'data-unwrapped-id'),_0x156ef5=Xi(_0x1e876c,'data-id');_0x15a7cd['set'](_0x156ef5,_0xbf08a6),zi(_0x1e876c,'data-id',_0xbf08a6),zi(_0x1e876c,'data-unwrapped-id',null);});for(const _0x33c2a1 of _0x13cda8){const _0x1deaa8=_0x15a7cd['get'](_0x33c2a1['id']);_0x1deaa8&&(_0x33c2a1['id']=_0x1deaa8);}this['changeGroups']['push'](..._0x2be4bf['map']((_0x5aa0d8,_0x3e0be2)=>({'changes':_0x5aa0d8,'state':'pending','index':_0x3e0be2,'editor':this['_documentIdToSource']['get'](_0xa65d80)['editor'],'rootName':this['_documentIdToSource']['get'](_0xa65d80)['rootName'],'documentId':_0xa65d80})));const _0x1ea9e8=Array['from'](this['documentContextContent']['keys']());function _0x535646(_0x5a7a35){return _0x592139['modifiedNodeIds']['includes'](_0x5a7a35)||_0x592139['newNodeIds']['includes'](_0x5a7a35)||_0x592139['removedNodeIds']['includes'](_0x5a7a35);}function _0x265624(_0x23b790){if(_0x23b790&&Xi(_0x23b790,'data-id')&&!Xi(_0x23b790,'data-unstable')){const _0x2de674=Xi(_0x23b790,'data-id');if(!_0x535646(_0x2de674))return{'node':_0x23b790,'type':'context','id':_0x2de674};}return null;}this['changeGroups']['sort']((_0x1873ce,_0x1be674)=>_0x1ea9e8['indexOf'](_0x1873ce['documentId'])-_0x1ea9e8['indexOf'](_0x1be674['documentId'])),this['changeGroups']['forEach']((_0x65c0da,_0x10fff7)=>{_0x65c0da['index']=_0x10fff7;});}}const Is=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];class AIInteraction extends Et(){['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x1f29f3,locale:_0x3c71f7,channelsToEditors:_0x35f81c}){super(),this['id']=at(),this['connector']=_0x1f29f3,this['isStopped']=!0x0,this['locale']=_0x3c71f7,this['_channelsToEditors']=_0x35f81c||new Map();}async['start'](){await this['_run']();}async['resume'](_0x724297){await this['_run'](_0x724297);}async['_run'](_0x56154e){const _0x1609d5=[];let _0x161f30,_0x55c745,_0x598b0f,_0x1630f2=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0x56154e||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x21cd94=await this['currentRequest']['getStream']();for await(const _0x21b785 of _0x21cd94){if(this['isStopped'])return;if('error'==_0x21b785['event'])return void this['fire']('error',{'error':new ht('ai-chat-interaction-error',this)});switch(_0x21b785['event']){case'message-metadata':this['messageId']=_0x21b785['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x21b785['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x21b785['data']['conversationTitle'],!0x0);break;case'source':_0x1609d5['push'](_0x21b785['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'](),_0x161f30='modification-delta'==_0x21b785['event']?'modification':'text',_0x55c745='modification-delta'==_0x21b785['event']?_0x21b785['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x161f30&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x161f30,'interactionId':this['id'],'id':_0x55c745,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x21b785['event']&&{'documentId':_0x21b785['data']['documentId']}}),'modification'==_0x161f30&&(this['currentReply']['sources']=_0x1609d5['splice'](0x0))),this['currentReply']['appendContent'](_0x21b785['data']['textDelta'],_0x21b785['data']['documentId']);break;case'mcp-tool-result':_0x598b0f=JSON['parse'](_0x21b785['data']['result']),this['_handleToolResultData']({'toolName':_0x21b785['data']['toolName'],'data':_0x598b0f['data'],'attributes':_0x598b0f['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x21b785['data']['toolName'],'data':_0x21b785['data']['data']});}}_0x1630f2=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x1609d5['length']>0x0&&(this['currentReply']['sources']=_0x1609d5['splice'](0x0)),this['_finalizeInteraction'](_0x1630f2),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x2a6b6a){return this['replies']['find'](_0x10a2ab=>_0x10a2ab['id']===_0x2a6b6a);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x356377=>_0x356377['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0x534726){const _0x734358=this['getDocumentContext'](),_0x5f514e=new AIReply({'locale':this['locale'],'documentContextContent':_0x734358?.['documents'],..._0x534726});return this['replies']['push'](_0x5f514e),_0x5f514e['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0x5f514e),_0x5f514e;}['setConversationTitle'](_0x31700a,_0x539db2=!0x1){this['fire']('setConversationTitle',_0x31700a,_0x539db2);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x1cc8c1){this['fire']('toolDataReceived',{'type':'result','toolName':_0x1cc8c1['toolName'],'data':structuredClone(_0x1cc8c1['data']||{}),'attributes':structuredClone(_0x1cc8c1['attributes']||{})},this);}['_handleToolNotificationData'](_0x544a52){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x544a52['toolName'],'data':structuredClone(_0x544a52['data'])},this);}['_finalizeInteraction'](_0x7ce2ec=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x7ce2ec),this['currentRequest']=this['currentReply']=void 0x0;}}const As=new Map([['usage-limits-exceeded','ai-usage-limits-exceeded'],['rate-limits-exceeded','ai-rate-limits-exceeded'],['invalid-content-type','ai-invalid-content-type'],['invalid-request-data','ai-chat-invalid-request'],['model-already-set','ai-chat-model-already-set'],['model-not-found','ai-chat-model-not-found'],['unsafe-content-detected','ai-chat-unsafe-content-detected'],['unsupported-content-type','ai-chat-unsupported-content-type'],['content-too-large','ai-chat-content-too-large'],['unsupported-file-type','ai-chat-context-unsupported-file-type'],['file-too-large','ai-chat-context-file-too-large'],['file-too-many-pages','ai-chat-context-file-too-many-pages'],['form-data-size-limits-exceeded','ai-chat-context-form-data-size-limits-exceeded']]),gs=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];class AIChatContext extends ct(){['_connector'];['_config'];['_ownerId'];constructor({connector:_0x32d7d4,config:_0x1eb471,ownerId:_0x4e535d}){super(),this['_connector']=_0x32d7d4,this['_config']=_0x1eb471,this['_ownerId']=_0x4e535d;}['init'](){this['_pendingContextItems']=new Map(),this['_conversationContextItems']=new Map(),this['_ongoingUploads']=new Map(),this['_ongoingUploadOperations']=new Map(),this['_setAddContextOptionsDefaultState']();}['getPendingContextItems'](){return this['_pendingContextItems'];}async['populateFromMessage'](_0x57c41c){const _0x280f45=await this['_createContextItemFromContent'](_0x57c41c);return this['_addToConversationContextItem'](_0x280f45),'current-document'===_0x280f45['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x280f45;}async['populateDocumentsFromMessage'](_0x5ab2e5,_0x4dc644){const _0x4edd34=_0x5ab2e5['filter'](_0x47cf0d=>'document'===_0x47cf0d['type']);if(0x0===_0x4edd34['length'])return{'hasUnmatched':!0x1};const _0x3f7fea=_0x4edd34['map'](_0x1c7c2c=>_0x1c7c2c['id']),_0x2bdd52=await this['_connector']['fetchDocuments'](this['_ownerId'],_0x3f7fea)['getDocuments'](),_0x380551=new Map(_0x2bdd52['map'](_0x3b3406=>[_0x3b3406['id'],_0x3b3406])),_0x135d0c=[];let _0x53f80d=!0x1;for(const _0x492355 of _0x4edd34){const _0x31d2c8=_0x380551['get'](_0x492355['id']);_0x31d2c8&&(this['_matchDocumentToRoot'](_0x31d2c8,_0x4dc644)||(_0x53f80d=!0x0),_0x135d0c['push']({'id':_0x31d2c8['id'],'content':_0x31d2c8['content'],'version':_0x31d2c8['attributes']?.['version']??0x0,'sessionId':_0x31d2c8['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x31d2c8['attributes']?.['channelId']??_0x4dc644[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x31d2c8['attributes']?.['rootName']??_0x4dc644[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x79b0ce={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x135d0c};return this['_addToConversationContextItem'](_0x79b0ce),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x79b0ce,'hasUnmatched':_0x53f80d};}['_matchDocumentToRoot'](_0x2c98d3,_0x3a9e03){const _0x4a223f=_0x2c98d3['attributes']?.['channelId'],_0x2a4dd7=_0x2c98d3['attributes']?.['rootName'];if(_0x4a223f&&_0x2a4dd7){for(const _0x3d0007 of _0x3a9e03)if(_0x3d0007['config']['get']('collaboration.channelId')===_0x4a223f){for(const _0x4ee46e of _0x3d0007['model']['document']['getRoots']())if('$graveyard'!==_0x4ee46e['rootName']&&_0x4ee46e['rootName']===_0x2a4dd7)return{'editor':_0x3d0007,'rootName':_0x4ee46e['rootName']};}}}async['_createContextItemFromContent'](_0x24473e){if('document'===_0x24473e['type']){const _0x5e4ce9=await this['_connector']['fetchDocument'](this['_ownerId'],_0x24473e['id'])['getDocument']();return{'id':'current-document','uiId':'current-document','label':'Current\x20document','type':_0x24473e['type'],'content':_0x5e4ce9['content'],'hidden':this['_conversationContextItems']['has']('current-document'),'version':_0x5e4ce9['attributes']?.['version'],'sessionId':_0x5e4ce9['attributes']?.['sessionId']};}if('mcp-tool-context'===_0x24473e['type'])return{'id':_0x24473e['id'],'uiId':_0x24473e['id'],'label':_0x24473e['data']?.['label']||_0x24473e['id'],'type':'mcp-tool-context','mcpServerName':_0x24473e['mcpServerName'],'toolName':_0x24473e['toolName'],'data':_0x24473e['data']||{}};return{'id':_0x24473e['id'],'uiId':_0x24473e['id'],'label':_0x24473e['attributes']?.['label']||_0x24473e['name']||_0x24473e['url']||_0x24473e['id'],'type':_0x24473e['type'],..._0x24473e?.['attributes']?.['resourceId']?{'resourceId':_0x24473e['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x9f0680){const _0x4180bc=this['_pendingContextItems']['get'](_0x9f0680);_0x4180bc?.['isReadOnly']||this['_removeContextItem'](_0x9f0680);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0x5e326a of this['_pendingContextItems']['values']())this['_removeContextItem'](_0x5e326a['uiId']);const _0x495af3=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x495af3&&this['_addContextItem']({..._0x495af3,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x4600ed){for(const _0x4de3d5 of _0x4600ed['values']())this['_addToConversationContextItem'](_0x4de3d5);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'](_0x193137){return Array['from'](_0x193137['values']())['flatMap'](_0xd9e812=>this['_mapContextItemToRequestData'](_0xd9e812));}async['addFilesToContext'](_0xdd94b1,_0x36dbfc,_0x4b3c4d='file'){const _0x5e1477='files-'+at();this['_startUploadOperation'](_0x5e1477);try{await Promise['all'](_0xdd94b1['map'](async _0x2694d5=>{const _0x3c9974='file-'+at(),_0x214d01=_0x40ab4b(_0x2694d5['name']),_0x289a30='file'===_0x4b3c4d&&_0x2694d5['type']['startsWith']('image/')?'image':_0x4b3c4d;try{this['_addContextItem']({'type':_0x289a30,'label':_0x36dbfc?.['label']||_0x214d01,'uiId':_0x3c9974,'resourceId':_0x36dbfc?.['resourceId']},!0x0);const _0x13c24b=this['_connector']['uploadFile'](this['_ownerId'],_0x2694d5,_0x36dbfc);this['_ongoingUploads']['set'](_0x3c9974,_0x13c24b['abortController']);const {id:_0x27d124}=await _0x13c24b['getId']();this['_ongoingUploads']['delete'](_0x3c9974),this['_finishContextItemLoading']({'type':_0x289a30,'id':_0x27d124,'label':_0x36dbfc?.['label']||_0x214d01,'uiId':_0x3c9974,'resourceId':_0x36dbfc?.['resourceId']},!0x1);}catch(_0xb8ce3c){this['_ongoingUploads']['delete'](_0x3c9974);if(!(_0xb8ce3c instanceof ht&&_0xb8ce3c['message']['startsWith']('ai-request-aborted'))){const _0x35f95b=As['get'](_0xb8ce3c['code'])||'ai-chat-file-upload-failed',_0x12fc1d=new ht(_0x35f95b,null,{'fileName':_0x214d01,..._0xb8ce3c});_0x12fc1d['stack']=_0xb8ce3c['stack'],this['fire']('error',{'error':_0x12fc1d});}this['_removeContextItem'](_0x3c9974);}}));}finally{this['_finishUploadOperation'](_0x5e1477);}}['addCurrentDocumentToContext'](_0x27636f){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x1dadf9={'type':'document','uiId':'current-document','label':_0x27636f,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x1dadf9);}async['updateCurrentDocuments'](_0x26ac2c){const _0x200781=this['_pendingContextItems']['get']('current-document');if(!_0x200781||!_0x26ac2c['length']||_0x26ac2c['every'](_0x4caf75=>!_0x4caf75['content']))return;_0x26ac2c['length']>0x1&&_0x26ac2c['some'](_0x39ba5b=>!_0x39ba5b['description'])&&wt('ai-chat-documents-missing-description');try{const _0x336d3c=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x26ac2c)['getIds']();if(_0x336d3c['length']!==_0x26ac2c['length']||_0x336d3c['some'](_0x26c6a4=>!_0x26c6a4?.['id'])){const _0x36d306=new ht('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x36d306});}_0x200781['documents']=_0x26ac2c['map']((_0x5a8955,_0x1ac1fb)=>{return{'id':_0x336d3c[_0x1ac1fb]['id'],'content':_0x5a8955['content'],'version':_0x5a8955['version'],'sessionId':_0x5a8955['sessionId'],'selection':(_0x2c6533=_0x5a8955['selections'],_0x2c6533?_0x2c6533['map'](_0x3a0915=>({'start':_0x3a0915['start'],'end':_0x3a0915['end']})):[]),'channelId':_0x5a8955['channelId'],'rootName':_0x5a8955['rootName']};var _0x2c6533;});}catch(_0x19a358){const _0x3ce5ff=new ht('ai-chat-document-upload-failed',null);_0x3ce5ff['stack']=_0x19a358['stack'],this['fire']('error',{'error':_0x3ce5ff});}}['addSelectionToContext'](_0x9fd8f6){this['_addContextItem']({'type':'selection','label':_0x9fd8f6,'uiId':'selection','content':_0x9fd8f6});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x4ec8c2,_0x3fe071){const _0x44d3e3='url-'+at();this['_startUploadOperation'](_0x44d3e3);const _0x62a313='url-'+at();try{this['_addContextItem']({'type':'web-resource','label':_0x3fe071?.['label']||_0x4ec8c2,'uiId':_0x62a313,'resourceId':_0x3fe071?.['resourceId']},!0x0);const _0x33b7da=this['_connector']['uploadUrl'](this['_ownerId'],_0x4ec8c2,_0x3fe071);this['_ongoingUploads']['set'](_0x62a313,_0x33b7da['abortController']);const {id:_0x5e9b81}=await _0x33b7da['getId']();this['_ongoingUploads']['delete'](_0x62a313),this['_finishContextItemLoading']({'type':'web-resource','id':_0x5e9b81,'label':_0x3fe071?.['label']||_0x4ec8c2,'uiId':_0x62a313,'resourceId':_0x3fe071?.['resourceId']},!0x1);}catch(_0x4bae70){this['_ongoingUploads']['delete'](_0x62a313),(_0x4bae70['message']['startsWith']('ai-request-aborted')||this['fire']('error',{'error':new ht('ai-chat-url-upload-failed',this,{'url':_0x4ec8c2,'originalError':_0x4bae70}),'url':_0x4ec8c2}),this['_removeContextItem'](_0x62a313));}finally{this['_finishUploadOperation'](_0x44d3e3);}}['addToolItemToContext'](_0xa9893f){_0xa9893f['id']=_0xa9893f['id']??at()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0xa9893f['uiId'],_0xa9893f),this['fire']('contextItemAdded',{'contextItem':_0xa9893f,'isLoading':!0x1});}async['loadSourceResources'](_0x33cdad,_0x4735e2,_0x5731f6){const _0x37f736=this['_addContextOptionsState']['sources']['find'](_0x3f5bbc=>_0x3f5bbc['id']===_0x33cdad);if(!_0x37f736)return this['fire']('error',{'error':new ht('ai-chat-source-not-found',this,{'sourceId':_0x33cdad}),'sourceId':_0x33cdad}),[];try{const _0x2fd29a=(await _0x37f736['getResources'](_0x4735e2))['map'](_0x401ad6=>{const _0x5644b3=this['_isResourceInContext'](_0x401ad6['id']);return{..._0x401ad6,'isInContext':_0x5644b3};});return _0x37f736['resources']=_0x2fd29a,this['fire']('sourceResourcesLoaded',{'sourceId':_0x33cdad,'source':_0x37f736,'resources':_0x2fd29a,'uid':_0x5731f6}),_0x2fd29a;}catch(_0x2782e7){return this['fire']('error',{'error':new ht('ai-chat-source-resources-load-failed',this,{'sourceId':_0x33cdad,'originalError':_0x2782e7}),'sourceId':_0x33cdad,'sourceLabel':_0x37f736['label']}),[];}}async['addResourceToContext'](_0x375c37,_0x5d8474){if(this['_isResourceInContext'](_0x5d8474['id']))return;let _0x1ebc02=_0x5d8474['data'];if(!_0x1ebc02&&_0x375c37['getData'])try{_0x1ebc02=await _0x375c37['getData'](_0x5d8474['id']);}catch(_0x484b0d){return void this['fire']('error',{'error':new ht('ai-chat-resource-load-failed',this,{'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id'],'originalError':_0x484b0d}),'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id']});}if(_0x1ebc02)switch(_0x5d8474['type']){case'web-resource':if('string'!=typeof _0x1ebc02)return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id'],'expectedType':'string','actualType':typeof _0x1ebc02}),'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id']});await this['addUrlToContext'](_0x1ebc02,{'label':_0x5d8474['label'],'resourceId':_0x5d8474['id']});break;case'file':if(!(_0x1ebc02 instanceof File))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id'],'expectedType':'File','actualType':typeof _0x1ebc02}),'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id']});await this['addFilesToContext']([_0x1ebc02],{'label':_0x5d8474['label'],'resourceId':_0x5d8474['id']});break;case'text':if('object'!=typeof _0x1ebc02||!('content'in _0x1ebc02)||!('type'in _0x1ebc02))return void this['fire']('error',{'error':new ht('ai-chat-context-invalid-data',this,{'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x1ebc02}),'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id']});_0x1ebc02=AIChatContext['_convertTextResourceToFile'](_0x1ebc02,_0x5d8474['label']),await this['addFilesToContext']([_0x1ebc02],{'label':_0x5d8474['label'],'resourceId':_0x5d8474['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new ht('ai-chat-context-unsupported-type',this,{'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id'],'resourceType':_0x5d8474['type']}),'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id']});}else this['fire']('error',{'error':new ht('ai-chat-resource-no-data',this,{'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id']}),'resourceId':_0x5d8474['id'],'sourceId':_0x375c37['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x5f2e78){if(void 0x0!==_0x5f2e78)this['_addContextOptionsState']['document']['isHidden']=!_0x5f2e78;else{const _0x4c48d5=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x4c48d5;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x5c21b6,_0x390d9c){switch(_0x5c21b6['type']){case'markdown':return new File([_0x5c21b6['content']],_0x390d9c,{'type':'text/markdown'});case'html':return new File([_0x5c21b6['content']],_0x390d9c,{'type':'text/html'});default:return new File([_0x5c21b6['content']],_0x390d9c,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x33cd65){switch(_0x33cd65['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x33cd65['id']}];case'web-resource':return[{'type':'web-resource','id':_0x33cd65['id']}];case'document':return _0x33cd65['documents']?.['length']?_0x33cd65['documents']['map'](_0x40f1aa=>({'type':'document','id':_0x40f1aa['id'],..._0x40f1aa['selection']?.['length']&&{'selection':_0x40f1aa['selection']}})):[{'type':'document','id':_0x33cd65['id'],..._0x33cd65['selection']?.['length']&&{'selection':_0x33cd65['selection']}}];case'mcp-tool-context':{const _0x55730d=_0x33cd65;return[{'type':'mcp-tool-context','mcpServerName':_0x55730d['mcpServerName'],'toolName':_0x55730d['toolName'],'data':{..._0x55730d['data'],'label':_0x55730d['label']||_0x55730d['data']?.['label']||_0x55730d['id']},'id':_0x55730d['id']}];}default:return[];}}['_addContextItem'](_0x59768c,_0x59b6a5=!0x1){if(this['_pendingContextItems']['set'](_0x59768c['uiId'],_0x59768c),_0x59768c['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x59768c,'isLoading':_0x59b6a5}),'current-document'===_0x59768c['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x59768c['resourceId']){const _0x1f40a6=this['_findSourceIdsByResourceId'](_0x59768c['resourceId']);_0x1f40a6&&_0x1f40a6['forEach'](_0x347de1=>{this['_updateResourceInContextState'](_0x347de1,_0x59768c['resourceId'],!0x0);});}}['_removeContextItem'](_0x17f5c3){const _0x182556=this['_pendingContextItems']['get'](_0x17f5c3),_0x1eab12=this['_ongoingUploads']['get'](_0x17f5c3);if(_0x1eab12&&(_0x1eab12['abort'](),this['_ongoingUploads']['delete'](_0x17f5c3)),_0x182556?.['resourceId']){const _0x43eb51=this['_findSourceIdsByResourceId'](_0x182556['resourceId']);_0x43eb51&&_0x43eb51['forEach'](_0x5766a2=>{this['_updateResourceInContextState'](_0x5766a2,_0x182556['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x17f5c3),this['fire']('contextItemRemoved',{'uiId':_0x17f5c3,'type':_0x182556?.['type']}),'current-document'===_0x17f5c3&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0xace8bc,_0x2b632d){if(this['_pendingContextItems']['has'](_0xace8bc['uiId'])&&(this['_pendingContextItems']['set'](_0xace8bc['uiId'],_0xace8bc),this['fire']('contextItemLoadingEnded',{'contextItem':_0xace8bc,'isLoading':_0x2b632d}),_0xace8bc['resourceId'])){const _0x469b97=this['_findSourceIdsByResourceId'](_0xace8bc['resourceId']);_0x469b97&&_0x469b97['forEach'](_0xd738c0=>{this['_updateResourceInContextState'](_0xd738c0,_0xace8bc['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x47a04d){this['_conversationContextItems']['set'](_0x47a04d['uiId'],_0x47a04d);}['_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'](_0x54c574=>({..._0x54c574,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x177e3c=>({..._0x177e3c,'resources':[]}))??[];}['_isResourceInContext'](_0x1137fd){for(const _0x5ca53e of this['_pendingContextItems']['values']())if(_0x5ca53e['resourceId']===_0x1137fd)return!0x0;for(const _0x537b5f of this['_conversationContextItems']['values']())if(_0x537b5f['resourceId']===_0x1137fd)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x50cb83){const _0x4dea14=[];for(const _0x789c9d of this['_addContextOptionsState']['sources']){_0x789c9d['resources']['find'](_0x445249=>_0x445249['id']===_0x50cb83)&&_0x4dea14['push'](_0x789c9d['id']);}return 0x0===_0x4dea14['length']?null:_0x4dea14;}['_updateResourceInContextState'](_0xfbe45c,_0x1bf923,_0x10023b){const _0x431138=this['_addContextOptionsState']['sources']['find'](_0x2bebd5=>_0x2bebd5['id']===_0xfbe45c);if(!_0x431138)return;const _0x2398c6=_0x431138['resources']['find'](_0xeeda13=>_0xeeda13['id']===_0x1bf923);_0x2398c6&&(_0x2398c6['isInContext']=_0x10023b,this['fire']('resourceStateChanged',{'sourceId':_0xfbe45c,'resourceId':_0x1bf923,'isInContext':_0x10023b}));}['_startUploadOperation'](_0x3b6854){this['_ongoingUploadOperations']['set'](_0x3b6854,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x2e41d6){this['_ongoingUploadOperations']['delete'](_0x2e41d6),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}}const ws=['capabilitiesUpdated'];class AICapabilities extends Et(){['_isWebSearchEnabled'];['_isReasoningEnabled'];constructor(){super(),this['_isWebSearchEnabled']=!0x1,this['_isReasoningEnabled']=!0x1;}['init'](){this['reset']();}['reset'](){this['setWebSearch'](!0x1),this['setReasoning'](!0x1);}['getCapabilitiesConfig'](){return{'isWebSearchEnabled':this['_isWebSearchEnabled'],'isReasoningEnabled':this['_isReasoningEnabled']};}static['getCapabilitiesRequestData'](_0x4946c1){const _0x4d0583={};return _0x4946c1&&_0x4946c1['isWebSearchEnabled']&&(_0x4d0583['webSearch']={}),_0x4946c1&&_0x4946c1['isReasoningEnabled']&&(_0x4d0583['reasoning']={}),_0x4d0583;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x1d3266){_0x1d3266!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x1d3266,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x58908b){_0x58908b!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x58908b,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}}class AIChatInteraction extends AIInteraction{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x33bd90){super(_0x33bd90),this['conversationId']=_0x33bd90['conversationId'],this['contextItems']=_0x33bd90['contextItems'],this['capabilities']=_0x33bd90['capabilities'],this['userMessage']=_0x33bd90['userMessage'],this['model']=_0x33bd90['model'],this['attributes']=_0x33bd90['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':AIChatContext['mapContextItemsToRequestData'](this['contextItems']),'capabilities':AICapabilities['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}}class AIChatConversation extends Et(){['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x41770e){super(),this['options']=_0x41770e,this['connector']=_0x41770e['connector'],this['chatModels']=_0x41770e['chatModels'],this['id']=_0x41770e['conversationId'],this['isFromHistory']=_0x41770e['isFromHistory'],this['_channelsToEditors']=_0x41770e['channelsToEditors'],this['_getSessionId']=_0x41770e['getSessionId'];}async['init'](_0x4bdb6c){try{this['chatContext']=new AIChatContext({'connector':this['connector'],'config':_0x4bdb6c,'ownerId':this['id']}),this['chatContext']['delegate'](...gs)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new AICapabilities(),this['chatCapabilities']['delegate'](...ws)['to'](this),this['chatCapabilities']['init']();const _0x318b55=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x318b55});const _0xd5c0b2=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0xd5c0b2&&await this['setModel'](_0xd5c0b2);}catch(_0x17364e){const _0x5ca5cb=new ht('ai-chat-conversation-init-failed',null,{'message':_0x17364e['message']||_0x17364e});_0x5ca5cb['stack']=_0x17364e['stack'],this['fire']('error',{'error':_0x5ca5cb});}}async['start'](){if(this['isStarted'])throw new ht('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new ht('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x123dbf}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x123dbf,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x3d9342){const _0x3921f3=new ht('ai-chat-conversation-start-failed',null,{'message':_0x3d9342['message'],'conversationId':this['id']});throw _0x3921f3['stack']=_0x3d9342['stack'],this['fire']('error',{'error':_0x3921f3}),_0x3921f3;}}async['load'](_0x97b27e){try{const _0x405e0d=await this['connector']['fetchConversation'](_0x97b27e)['getConversation'](),_0x29a581=await this['connector']['fetchConversationMessages'](_0x97b27e)['getMessages'](),_0x13e95b=_0x29a581[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x405e0d['id'],'title'in _0x405e0d?this['fire']('setConversationTitle',_0x405e0d['title'],!0x0):this['fire']('setConversationTitle','',!0x0);const _0x401af6=(await this['chatModels']['getAll']())['find'](_0x27e6be=>_0x27e6be['id']['toLowerCase']()===_0x13e95b['toLowerCase']());this['selectedModel']=_0x401af6,this['fire']('modelSelected',{'selectedModel':_0x401af6,'isDisabled':!0x0});const {streamingMessageId:_0x4f81a7}=await this['_processMessagesToInteractions'](_0x29a581,_0x13e95b);return _0x4f81a7&&this['currentInteraction']?this['_resumeStream'](_0x4f81a7):this['currentInteraction']=void 0x0,this;}catch(_0x314661){const _0x2fce9b=new ht('ai-chat-conversation-init-from-id-failed',null,{'message':_0x314661['message'],'conversationId':_0x97b27e});throw _0x2fce9b['stack']=_0x314661['stack'],this['fire']('error',{'error':_0x2fce9b}),_0x2fce9b;}}async['_processMessagesToInteractions'](_0x1ba38e,_0x154e05){let _0x47aab2,_0x2b218e,_0x5be795=!0x1;for(const _0xfbb3c4 of _0x1ba38e)if('user'===_0xfbb3c4['role']){const {contextItems:_0x4c9a97,hasUnmatched:_0x51e7b9}=await this['_extractContextItems'](_0xfbb3c4);_0x5be795=_0x51e7b9;const _0x1a4a66={'isReasoningEnabled':Object['hasOwn'](_0xfbb3c4['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0xfbb3c4['capabilities'],'webSearch')};_0x47aab2=this['createInteraction']({'userMessage':_0xfbb3c4['prompt'],'contextItems':_0x4c9a97,'capabilities':_0x1a4a66,'modelId':_0x154e05,'attributes':_0xfbb3c4['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x47aab2,_0x2b218e=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0xfbb3c4['role']&&_0x47aab2){if('streaming'===_0xfbb3c4['status']){_0x2b218e=_0xfbb3c4['id'];continue;}if('error'===_0xfbb3c4['status'])continue;const _0x2c5782=[];for(const _0x2b276b of _0xfbb3c4['content'])switch(_0x2b276b['type']){case'text':case'modification':{const _0x2bee12=_0x47aab2['getDocumentContext'](),_0x365267=this['_hasSessionMismatch'](_0x2bee12)||_0x5be795;_0x47aab2['currentReply']?.['type']!==_0x2b276b['type']&&(_0x47aab2['currentReply']=_0x47aab2['createReply']({'type':_0x2b276b['type'],'isDone':!0x0,'interactionId':_0x47aab2['id'],'areActionsDisabled':_0x365267,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0x2c5782['length']>0x0&&(_0x47aab2['currentReply']['sources']=_0x2c5782['splice'](0x0))),_0x47aab2['currentReply']['appendContent'](_0x2b276b['content'],_0x2b276b['documentId']);break;}case'url':_0x2c5782['push'](_0x2b276b);break;case'mcp-tool-result':{const {data:_0x233531,attributes:_0x1b82aa}=JSON['parse'](_0x2b276b['content']);_0x47aab2['_handleToolResultData']({'toolName':_0x2b276b['toolName'],'data':_0x233531,'attributes':_0x1b82aa});break;}}'cancelled'===_0xfbb3c4['status']&&this['fire']('error',{'interactionId':_0x47aab2['id'],'error':new ht('ai-request-aborted',this)});}}return{'streamingMessageId':_0x2b218e};}async['_resumeStream'](_0x272315){if(this['currentInteraction'])try{const _0x4efb3c=this['connector']['resumeStream'](this['id'],_0x272315);await this['currentInteraction']['resume'](_0x4efb3c);}catch(_0x4d21d5){_0x4d21d5 instanceof ht&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x4d21d5});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x27cddf){const _0x1736d5=new Map();if(!_0x27cddf['content'])return{'contextItems':_0x1736d5,'hasUnmatched':!0x1};const {contextItem:_0x87e6f8,hasUnmatched:_0x1b7c6a}=await this['chatContext']['populateDocumentsFromMessage'](_0x27cddf['content'],Array['from'](this['_channelsToEditors']['values']()));_0x87e6f8&&_0x1736d5['set'](_0x87e6f8['id'],_0x87e6f8);for(const _0x2daeae of _0x27cddf['content']){if('document'===_0x2daeae['type'])continue;const _0xe9d6d9=await this['chatContext']['populateFromMessage'](_0x2daeae);_0xe9d6d9&&_0x1736d5['set'](_0xe9d6d9['id'],_0xe9d6d9);}return{'contextItems':_0x1736d5,'hasUnmatched':_0x1b7c6a};}async['handleUserInteraction']({userMessage:_0x232f69,attributes:_0x95aa67}){if(!this['isStarted'])throw new ht('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new ht('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x4d91e4=new Map(this['getPendingContextItems']()),_0x2b0409=this['chatCapabilities']['getCapabilitiesConfig'](),_0x3f0fdc=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x232f69,'contextItems':_0x4d91e4,'capabilities':_0x2b0409,'modelId':_0x3f0fdc,'attributes':_0x95aa67,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0xe8d9a2){if(_0xe8d9a2 instanceof ht)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0xe8d9a2});else{const _0x2f293f=As['get'](_0xe8d9a2['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new ht(_0x2f293f,null,{'error':_0xe8d9a2})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x544925,contextItems:_0x32eda6,capabilities:_0x57a03d,modelId:_0x2cdd8d,attributes:_0x5de53c,channelsToEditors:_0x4bb493}){const _0x13bfbe=new AIChatInteraction({'userMessage':_0x544925,'contextItems':_0x32eda6,'capabilities':_0x57a03d,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x2cdd8d,'attributes':_0x5de53c,'channelsToEditors':_0x4bb493});return _0x13bfbe['delegate'](...Is)['to'](this),this['interactions']['push'](_0x13bfbe),this['fire']('interactionCreated',_0x13bfbe),_0x13bfbe;}['getInteraction'](_0x1c16e2){return this['interactions']['find'](_0xf3664=>_0xf3664['id']===_0x1c16e2);}['removeInteraction'](_0x4f78d1){const _0xcad3e9=this['getInteraction'](_0x4f78d1);_0xcad3e9&&(_0xcad3e9['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0xcad3e9),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x5b0d0f=this['lastInteraction'];_0x5b0d0f?.['conversationId']&&_0x5b0d0f['messageId']&&this['connector']['cancelStream'](_0x5b0d0f['conversationId'],_0x5b0d0f['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0x161d7e){this['chatContext']['addCurrentDocumentToContext'](_0x161d7e);}async['updateCurrentDocumentsInContext'](_0x4bfbc2){await this['chatContext']['updateCurrentDocuments'](_0x4bfbc2);}['toggleAddCurrentDocumentOptionVisibility'](_0xf12c42){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0xf12c42);}['_hasSessionMismatch'](_0x272380){return!!_0x272380&&_0x272380['documents']['some'](_0x58fc8a=>{const _0x3a18f2=this['_channelsToEditors']['get'](_0x58fc8a['channelId']);return!_0x3a18f2||_0x58fc8a['sessionId']!==this['_getSessionId'](_0x3a18f2);});}['addSelectionToContext'](_0x53cbb1){this['chatContext']['addSelectionToContext'](_0x53cbb1);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x41a14b){this['chatContext']['addFilesToContext'](_0x41a14b);}['addUrlToContext'](_0x197ea4){this['chatContext']['addUrlToContext'](_0x197ea4);}['addToolItemToContext'](_0x4770ec){this['chatContext']['addToolItemToContext'](_0x4770ec);}['addResourceToContext'](_0xc4b2c2,_0x42d65a){this['chatContext']['addResourceToContext'](_0xc4b2c2,_0x42d65a);}['loadSourceResources'](_0x6a2a79,_0x35ecce,_0x1b88a8){return this['chatContext']['loadSourceResources'](_0x6a2a79,_0x35ecce,_0x1b88a8);}['removeFromContext'](_0x392293){this['chatContext']['removeFromContext'](_0x392293);}['setWebSearch'](_0x4082c7){this['chatCapabilities']['setWebSearch'](_0x4082c7);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x14b9ed){this['chatCapabilities']['setReasoning'](_0x14b9ed);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}['getPendingContextItems'](){return this['chatContext']['getPendingContextItems']();}async['setModel'](_0x35a96e){_0x35a96e?!0x1===await this['chatModels']['isAvailable'](_0x35a96e)&&(wt('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x35a96e}),_0x35a96e=(await this['chatModels']['getAvailableModels']())[0x0]):(wt('ai-chat-conversation-set-model-null',{'conversation':this}),_0x35a96e=(await this['chatModels']['getAvailableModels']())[0x0]),_0x35a96e['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x35a96e,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x35a96e}));}}class AIModels extends Et(){['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x3dc530,config:_0x1bd7f0,locale:_0x231bf3}){super(),this['_connector']=_0x3dc530,this['_config']=_0x1bd7f0,this['_locale']=_0x231bf3;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0x2af06b=await this['getAll']();let _0x3abbfe;return _0x3abbfe=this['_availableModels']?this['_filterModels'](_0x2af06b,this['_availableModels']):_0x2af06b['filter'](_0x794c=>_0x794c['recommended']),_0x3abbfe;}async['getModel'](_0x4ca5b3){const _0x3d2129=await this['getAll']();if(!_0x3d2129['length'])return null;if(_0x4ca5b3){const _0x168043=this['_getModelById'](_0x3d2129,_0x4ca5b3);if(_0x168043)return _0x168043;wt('ai-chat-model-id-unrecognized',{'modelId':_0x4ca5b3,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x26bb2c=await this['getAvailableModels']();if(!_0x26bb2c['length'])return null;if(this['_defaultModelId']){const _0x59ba44=this['_getModelById'](_0x26bb2c,this['_defaultModelId']);if(_0x59ba44)return _0x59ba44;wt('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x26bb2c[0x0]['id']});}return _0x26bb2c[0x0];}async['isAvailable'](_0x5467b6){return(await this['getAvailableModels']())['some'](_0x104e33=>_0x104e33['name']===_0x5467b6['name']&&_0x104e33['provider']===_0x5467b6['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length'])try{const _0x4a72be=this['_locale']['uiLanguage']||'en',_0x55269d=this['_connector']['getModels'](_0x4a72be),_0x2954bf=await _0x55269d['list']();this['_modelList']=_0x2954bf['items']['map'](_0x3d8cb4=>Cs(_0x3d8cb4)?{..._0x3d8cb4,'name':Mi(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x3d8cb4);}catch(_0x323356){throw Ct('ai-models-unable-to-retrieve',{'error':_0x323356}),_0x323356;}return[...this['_modelList']];}['_filterModels'](_0x1c92cf,_0x5891c1){let _0x30e968;if(_0x5891c1){_0x30e968=[];const _0x223654=new Set(),_0x4546d3='string'==typeof _0x5891c1?[_0x5891c1['toLocaleLowerCase']()]:_0x5891c1['map'](_0x52848e=>_0x52848e['toLocaleLowerCase']());for(const _0x1937e2 of _0x4546d3)for(const _0x3f92a1 of _0x1c92cf)!_0x223654['has'](_0x3f92a1['id'])&&this['_isMatchingFilter'](_0x3f92a1,_0x1937e2)&&(_0x30e968['push'](_0x3f92a1),_0x223654['add'](_0x3f92a1['id']));}else _0x30e968=_0x1c92cf;return _0x30e968;}['_isMatchingFilter'](_0x4fc610,_0x3cb899){const _0x58062e=_0x4fc610['id']['toLocaleLowerCase'](),_0x2a904a=_0x4fc610['name']['toLocaleLowerCase'](),_0x4672c8=_0x4fc610['provider']['toLocaleLowerCase']();return _0x58062e===_0x3cb899||_0x2a904a===_0x3cb899||Cs(_0x4fc610)&&'auto'===_0x3cb899||_0x4672c8===_0x3cb899||_0x58062e['startsWith'](_0x3cb899);}['_getModelById'](_0x5a3d8a,_0x3aa6d5){return _0x5a3d8a['find'](_0x34d05d=>Cs(_0x34d05d)&&'auto'===_0x3aa6d5?_0x34d05d:_0x34d05d['id']===_0x3aa6d5)||null;}}function Cs(_0x236433){return _0x236433['id']['startsWith']('agent');}function ms(_0x1cc618){return _0x1cc618?_0x1cc618 instanceof _0x29da5d?[_0x1cc618]:_0x1cc618['editors']&&0x0!==_0x1cc618['editors']['length']?Array['from'](_0x1cc618['editors']):[]:[];}function ps(_0x408ef4){const _0x257d9a=ms(_0x408ef4);if(!_0x257d9a['length'])throw new ht('ai-get-editor-from-context-no-editor');if(0x1===_0x257d9a['length'])return _0x257d9a[0x0];const _0x15bd83=_0x257d9a['find'](_0x51d41f=>_0x51d41f['ui']?.['focusTracker']?.['isFocused']);if(_0x15bd83)return _0x15bd83;const _0x3a5d26=function(_0x262a6b){if(_0x262a6b instanceof _0x29da5d)return;const _0x47fc6b=_0x262a6b;if(!_0x47fc6b['plugins']||!_0x47fc6b['plugins']['has']('AIEditing'))return;const _0x39b028=_0x47fc6b['plugins']['get']('AIEditing');return _0x39b028['getLastContentFocusedEditor']?.();}(_0x408ef4);return _0x3a5d26&&_0x257d9a['includes'](_0x3a5d26)?_0x3a5d26:_0x257d9a[0x0];}function Es({interaction:_0x4c9221,reply:_0x52f13,groups:_0xd6b397,transform:_0x2304cd,documentCompare:_0x5b04b1,documentCompareOptions:_0x115fc0}){const _0xeac71a=_0x4c9221['getDocumentContext']()['documents']['find'](_0x52d8e6=>_0x52d8e6['id']==_0xd6b397[0x0]['documentId']),_0x490bf2=_0xd6b397[0x0]['editor'];if(!_0xeac71a)return[];const _0x1d1ee4=_0xeac71a['content'],_0x3e20af=_0xeac71a['version'],_0x2ec753=_0x52f13['documentContextContent']['get'](_0xd6b397[0x0]['documentId'])['cloneNode'](!0x0);for(const {changes:_0x23585c}of _0xd6b397){const _0x3f821e=_0x23585c['filter'](_0x1aaa21=>'new'!=_0x1aaa21['type'])['map'](_0x11e4a0=>Yi('data-id',_0x11e4a0['id'],_0x2ec753)),_0x12051f=_0x23585c['filter'](_0x37f107=>'removed'!=_0x37f107['type'])['map'](_0x141bab=>_0x141bab['node']['cloneNode'](!0x0));let _0x578cd2=null;if(_0x3f821e['length']){_0x578cd2=_0x3f821e[0x0]['previousSibling'];for(let _0x301bed=0x0;_0x301bed<_0x3f821e['length'];_0x301bed++)_0x369ef0(_0x3f821e[_0x301bed]);}if(_0x12051f['length']){_0x578cd2||(_0x23585c[0x0]['anchorId']?_0x578cd2=Yi('data-id',_0x23585c[0x0]['anchorId'],_0x2ec753):(_0x578cd2=_0x12051f['shift'](),_0x42bbf5(_0x2ec753,_0x578cd2)));for(let _0x250fdb=0x0;_0x250fdb<_0x12051f['length'];_0x250fdb++)_0x1fc186(_0x578cd2,_0x12051f[_0x250fdb]),_0x578cd2=_0x12051f[_0x250fdb];}}const _0x4d2e31=Ki(_0x2ec753),_0x451d7c=_0x5b04b1['getDiff'](_0x1d1ee4,_0x4d2e31,{'targetEditor':_0x490bf2,..._0x115fc0})['getOperations']();if(_0x2304cd){const _0x2b3bac=_0x490bf2['model']['document']['history']['getOperations'](_0x3e20af),_0x50e066={'document':_0x490bf2['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};return _0x144e65(_0x451d7c,_0x2b3bac,_0x50e066)['operationsA'];}return _0x451d7c;}function Ts(_0x274c1d,_0x344ba6){if('marker'!=_0x344ba6['type'])return;const _0x1d9235=_0x274c1d['model']['markers']['get'](_0x344ba6['name']);_0x1d9235&&(_0x344ba6['oldRange']=_0x1d9235['getRange']());}function fs(_0x271847,_0x499934){if(_0x271847['files']['length']>0x0&&_0x499934['filesEnabled']){const _0x4706fe=_0x271847['files']['filter'](_0xf628cb=>_0xf628cb['name']);return _0x4706fe['length']>0x0?{'type':'file','files':_0x4706fe}:null;}if(_0x499934['urlsEnabled']){const _0x3cf5bd=function(_0x87eeb7){const _0x2e0916=_0x87eeb7['trim']();if(/\s/['test'](_0x2e0916))return null;try{const _0x4be3d4=new URL(_0x2e0916);return'http:'!==_0x4be3d4['protocol']&&'https:'!==_0x4be3d4['protocol']?null:_0x4be3d4['toString']();}catch{return null;}}(_0x271847['plainText']);if(_0x3cf5bd)return{'type':'url','url':_0x3cf5bd};}const _0x2aef6f=_0x271847['forceTextAttachment']?0x1:_0x499934['longTextThreshold']??0x1/0x0;if(_0x271847['plainText']['length']>=Math['max'](_0x2aef6f,0x1)&&_0x499934['filesEnabled']){const _0x277839=_0x499934['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x271847['plainText']],_0x277839,{'type':'text/plain'})]};}return null;}class AIChatController extends _0x915a98{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[AIConnector,_0x102c6d];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_aiChatModels']=new AIModels({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x38fe0f=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x1faabb,_0x36b2a8)=>{this['_handleUIUserMessage']({'message':_0x36b2a8});}),this['listenTo'](_0x38fe0f['view'],'change:activeTab',(_0x585897,_0x4471b2,_0x45216e)=>{'chat'!==_0x45216e&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext'](),this['activeConversation']?.['cancelLastInteractionStream']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x54f5e0,_0x3ab023)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x3ab023));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x191931,_0x5c6798)=>{this['activeConversation']?.['addUrlToContext'](_0x5c6798);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x283ed5,_0x5da7a7)=>{const _0x1bee93=this['activeConversation'];if(!_0x1bee93)return;_0x5da7a7['hasDirectory']&&(_0x5da7a7['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+at()}));const _0x4cf9cf=fs(_0x5da7a7,{'pastedTextLabel':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_PASTED_TEXT_NAME'),'longTextThreshold':this['context']['config']['get']('ai.chat.context.paste.textThreshold'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled'),'urlsEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.urls.enabled')});_0x4cf9cf&&(_0x5da7a7['preventDefault'](),'url'===_0x4cf9cf['type']?_0x1bee93['addUrlToContext'](_0x4cf9cf['url']):_0x1bee93['chatContext']['addFilesToContext'](_0x4cf9cf['files'],void 0x0,_0x4cf9cf['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x137a36,_0x36fbed)=>{_0x36fbed['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x31cf84,_0x44972)=>{this['activeConversation']?.['addResourceToContext'](_0x44972['source'],_0x44972['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x4c6628,_0x494269)=>{this['_removeFromContext'](_0x494269);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x3cf2dd,_0x5c28e6)=>{this['activeConversation']?.['loadSourceResources'](_0x5c28e6['sourceId'],_0x5c28e6['query'],_0x5c28e6['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0x2ac2eb,_0x14ad4c)=>{this['activeConversation']?.['setModel'](_0x14ad4c);}),this['listenTo'](this['_aiChatUi'],'like',(_0x18ca5b,{replyId:_0x371058})=>{console['log']('Liked\x20response',_0x371058);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0xf3c15d,{replyId:_0x157fdd})=>{console['log']('Disliked\x20response',_0x157fdd);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x4e463b,_0x4ec526)=>{this['_insertSuggestion'](_0x4ec526);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x4b4750,{replyId:_0x165c39,partIndex:_0x298c10})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x165c39,_0x298c10);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x45fe60,{replyId:_0x34ff9e,partIndex:_0x60dd8e})=>{const _0x37047b=this['_getDocumentRangeForReplyChanges'](_0x34ff9e,_0x60dd8e);if(!_0x37047b)return;const {reply:_0x7e0ea9}=this['getInteractionAndReplyById'](_0x34ff9e);'$graveyard'!=_0x37047b['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x7e0ea9['changeGroups'][_0x60dd8e]['editor'],'ranges':[_0x37047b['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x2cff57,_0x5ff3dd)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x5ff3dd);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x2dc88f,{replyId:_0x34bf74,showDiff:_0xecdb2b})=>{const {interaction:_0x5728fe,reply:_0x2ec75b}=this['getInteractionAndReplyById'](_0x34bf74),_0x3b8b7c=_0x2ec75b['getContentParts']({'showDiff':_0xecdb2b});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x5728fe['id']+':'+_0x2ec75b['id'],'parts':_0x3b8b7c});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x3e836d,{replyId:_0x18bb96,partIndex:_0x9eb084})=>{this['_rejectSuggestion']({'replyId':_0x18bb96,'partIndex':_0x9eb084}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0xa5c24f,_0x2d69e0)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x2d69e0);}),this['on']('replyCreated',(_0x1d01a1,_0x593a65)=>{this['_addFeedItemReply'](_0x593a65);});}['afterInit'](){this['context']instanceof _0x29da5d?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x57355d,_0x51cc1a)=>{_0x51cc1a['on']('ready',()=>{this['_integrateEditor'](_0x51cc1a);});}),this['_initConversation']();}async['_initConversation'](){const _0x35e1f2=this['context']['config']['get']('ai.chat.initialConversation');let _0x346a78=_0x35e1f2;('lastCreated'!=_0x35e1f2||(_0x346a78=await this['_getLastCreatedConversationId'](),_0x346a78))&&('new'==_0x346a78?await this['_startConversationSafely']():await this['loadConversation'](_0x346a78));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x3ae852){this['_closeActiveBalloon'](),(this['context']['plugins']['get'](AITabs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']());try{await this['_aiConnector']['fetchConversation'](_0x3ae852)['getConversation'](),await this['_startConversationSafely']({'id':_0x3ae852}),this['_updateConversationTitle']('\x20'),await this['activeConversation']['load'](_0x3ae852),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x25d6cf){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x3ae852}),this['_logError'](new ht('ai-chat-conversation-not-found',this,{'error':_0x25d6cf}));}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x147718){let _0x52d7bb=null,_0x2b280c=null;this['on']('toolDataReceived',(_0x232ba4,_0x40e199,_0x9ec206)=>{_0x9ec206['id']!==_0x52d7bb&&(_0x52d7bb=_0x9ec206['id'],_0x2b280c=this['_getAIChatFeedAPI'](_0x9ec206)),_0x147718(_0x40e199,_0x2b280c);});}['addCurrentDocumentToChatContext'](){ms(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](Mi(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x365c56){const _0x42e497=this['_aiEditing']['getSelectionText'](_0x365c56);this['activeConversation']?.['addSelectionToContext'](_0x42e497),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x2f352f){await this['_startConversationSafely']({'modelId':_0x2f352f?.['modelId']});}async['sendMessage'](_0x586abf){await this['_handleUIUserMessage'](_0x586abf);}['getGroupId'](){const _0x4ce265=this['context']['config']['get']('collaboration.channelId');if(!_0x4ce265)throw new ht('ai-missing-channel-id',this);return _0x4ce265;}['_handleRemovedConversation'](_0x320cd7){this['activeConversation']['id']===_0x320cd7&&this['_startConversationSafely']();}['_insertSuggestion'](_0x2ffcd2){const _0x4a05f9=this['context']['plugins']['get'](_0x102c6d),{reply:_0x35757b,interaction:_0x2c663a}=this['getInteractionAndReplyById'](_0x2ffcd2['replyId']),_0x585343=void 0x0!==_0x2ffcd2['partIndex']?[_0x35757b['changeGroups'][_0x2ffcd2['partIndex']]]:_0x35757b['changeGroups']['filter'](_0x494720=>'pending'==_0x494720['state']);_0x585343['map'](_0x22fa4b=>_0x35757b['changeGroups']['indexOf'](_0x22fa4b))['forEach'](_0x1bf68f=>{const _0x4a64a4=this['_getDocumentRangeForReplyChanges'](_0x2ffcd2['replyId'],_0x1bf68f);_0x4a64a4&&'$graveyard'!=_0x4a64a4['range']['root']['rootName']?(_0x35757b['setChangeGroupState'](_0x1bf68f,'accepted'),void 0x0!==_0x2ffcd2['partIndex']&&this['_scrollToSuggestionRange'](_0x4a64a4['range'],!0x1,_0x4a64a4['targetEditor'])):_0x35757b['setChangeGroupState'](_0x1bf68f,'outdated');});const _0xe6c70b={},_0x42ca90=_0x585343['reduce']((_0x19d8c3,_0x5958e9)=>('outdated'===_0x5958e9['state']||(_0x19d8c3[_0x5958e9['documentId']]=[..._0x19d8c3[_0x5958e9['documentId']]||[],_0x5958e9],_0xe6c70b[_0x5958e9['documentId']]=[..._0xe6c70b[_0x5958e9['documentId']]||[],_0x35757b['changeGroups']['indexOf'](_0x5958e9)]),_0x19d8c3),{});for(const [_0x5f45f6,_0x12dc74]of Object['entries'](_0x42ca90)){const _0x2e28c0=_0x12dc74[0x0]['editor'];if(!_0x2e28c0['plugins']['has']('TrackChanges')){wt('ai-no-track-changes',{'editor':_0x2e28c0});continue;}const _0xf76acd=Es({'reply':_0x35757b,'interaction':_0x2c663a,'groups':_0x12dc74,'transform':!0x0,'documentCompare':_0x4a05f9,'documentCompareOptions':{'anchor':_0x12dc74[0x0]['rootName'],'markDeletions':!0x0}});let _0x471143;_0x2e28c0['model']['change'](_0x52d95e=>{_0x471143=_0x52d95e['batch'],_0x2e28c0['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0xf76acd),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x471143,{'interactionId':_0x2c663a['id'],'replyId':_0x35757b['id'],'indexes':_0xe6c70b[_0x5f45f6]});}this['_updateRatings'](_0x35757b);}['_applySuggestion'](_0x10b443){const _0x4c42c8=this['context']['plugins']['get'](_0x102c6d),{reply:_0x594d82,interaction:_0x500dba}=this['getInteractionAndReplyById'](_0x10b443['replyId']),_0x4091a4=void 0x0!==_0x10b443['partIndex']?[_0x594d82['changeGroups'][_0x10b443['partIndex']]]:_0x594d82['changeGroups']['filter'](_0x19450a=>'pending'==_0x19450a['state']);_0x4091a4['map'](_0x243346=>_0x594d82['changeGroups']['indexOf'](_0x243346))['forEach'](_0x15deac=>{const _0xde2572=this['_getDocumentRangeForReplyChanges'](_0x10b443['replyId'],_0x15deac);_0xde2572&&'$graveyard'!=_0xde2572['range']['root']['rootName']?(_0x594d82['setChangeGroupState'](_0x15deac,'accepted'),void 0x0!==_0x10b443['partIndex']&&this['_scrollToSuggestionRange'](_0xde2572['range'],!0x1,_0xde2572['targetEditor'])):_0x594d82['setChangeGroupState'](_0x15deac,'outdated');});const _0x36edfa={},_0x3bf1e3=_0x4091a4['reduce']((_0x1ab2bd,_0x263f00)=>('outdated'===_0x263f00['state']||(_0x1ab2bd[_0x263f00['documentId']]=[..._0x1ab2bd[_0x263f00['documentId']]||[],_0x263f00],_0x36edfa[_0x263f00['documentId']]=[..._0x36edfa[_0x263f00['documentId']]||[],_0x594d82['changeGroups']['indexOf'](_0x263f00)]),_0x1ab2bd),{});for(const [_0x3e7ee4,_0x4f7178]of Object['entries'](_0x3bf1e3)){const _0x44ebbb=Es({'reply':_0x594d82,'interaction':_0x500dba,'groups':_0x4f7178,'transform':!0x0,'documentCompare':_0x4c42c8,'documentCompareOptions':{'anchor':_0x4f7178[0x0]['rootName'],'markDeletions':!0x1}});let _0x5ca92c;const _0x3bf89c=_0x4f7178[0x0]['editor'];_0x3bf89c['model']['change'](_0x45ece3=>{_0x5ca92c=_0x45ece3['batch'];for(const _0x461f34 of _0x44ebbb)_0x461f34['baseVersion']=_0x3bf89c['model']['document']['version'],Ts(_0x3bf89c,_0x461f34),_0x45ece3['batch']['addOperation'](_0x461f34),_0x3bf89c['model']['applyOperation'](_0x461f34);}),this['_batchToChanges']['set'](_0x5ca92c,{'interactionId':_0x500dba['id'],'replyId':_0x594d82['id'],'indexes':_0x36edfa[_0x3e7ee4]});}this['_updateRatings'](_0x594d82);}['_rejectSuggestion'](_0x59cc15){const {reply:_0x1a7c93}=this['getInteractionAndReplyById'](_0x59cc15['replyId']);_0x1a7c93['setChangeGroupState'](_0x59cc15['partIndex'],'rejected');}['_openBalloonFor'](_0x3de2f0,_0x1feb2e){if(!this['_hasAIChatBalloon'])return;const {reply:_0x5d98bc}=this['getInteractionAndReplyById'](_0x3de2f0),_0x5d173c=_0x5d98bc['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x5d173c['length'])return;let _0xea9844,_0x1cd2f1;if(void 0x0!==_0x1feb2e?(_0x1cd2f1=_0x5d173c['find'](_0x4af0fd=>_0x4af0fd['index']==_0x1feb2e),_0xea9844=_0x1cd2f1?.['index']):(_0x1cd2f1=_0x5d173c[0x0],_0xea9844=_0x1cd2f1['index']),!_0x1cd2f1)return void _0x5d98bc['setChangeGroupState'](_0x1feb2e??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x3de2f0&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0xea9844)return;const _0x3eab16=this['_getUserPresentableContentPartDocumentRange'](_0x3de2f0,_0x5d98bc,_0x1cd2f1),_0x50feb8=_0x5d98bc['changeGroups']['find'](_0x5b4b63=>_0x5b4b63['index']==_0xea9844)['editor'],_0x51523e=_0x50feb8['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x51523e&&this['_activeBalloon']['close'](),!_0x3eab16)return _0x51523e['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x51523e,this['_currentPreviewedChangeGroup']={'replyId':_0x3de2f0,'partIndex':_0xea9844},this['_scrollToSuggestionRange'](_0x3eab16,!0x0,_0x50feb8);const _0x343586=this['_getPresentableSiblingContentPartIndex'](_0x3de2f0,_0xea9844,'next');_0x51523e['clearContent'](),_0x51523e['updateContent']({'part':_0x1cd2f1,'renderingStrategy':'static'}),_0x51523e['open']({'index':_0xea9844,'title':Mi(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0xea9844+0x1)['toString']()),'showRotator':null!==_0x343586,'ranges':[_0x3eab16],'areActionsDisabled':_0x5d98bc['areActionsDisabled'],'targetEditor':_0x50feb8}),_0x51523e['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x3de2f0,_0xea9844),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x3de2f0,'index':_0xea9844,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x1655d4,_0x1405e3,_0x89c92d){const {reply:_0x1d7aff}=this['getInteractionAndReplyById'](_0x1655d4),_0x4fb874=_0x1d7aff['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x4fb874['length'])return null;const _0x50cf7d='next'==_0x89c92d?0x1:-0x1;function _0x169b13(_0x28f71e){const _0x4689d2=(_0x28f71e+_0x50cf7d+_0x4fb874['length'])%_0x4fb874['length'];return{'siblingIndex':_0x4689d2,'siblingPart':_0x4fb874[_0x4689d2]};}const _0x2b6b86=_0x4fb874['findIndex'](_0x38aebb=>_0x38aebb['index']==_0x1405e3);let {siblingIndex:_0x5e4899,siblingPart:_0x3106d5}=_0x169b13(_0x2b6b86);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x1655d4,_0x1d7aff,_0x3106d5);)if({siblingIndex:_0x5e4899,siblingPart:_0x3106d5}=_0x169b13(_0x5e4899),_0x5e4899===_0x2b6b86)return null;return _0x3106d5['index'];}['_getUserPresentableContentPartDocumentRange'](_0xa34e11,_0x1f3100,_0x2005a5){const _0x3361d4=_0x1f3100['changeGroups'];if(!_0x2005a5['hasChanges'])return null;const _0x408712=_0x3361d4['find'](_0x35d8a6=>_0x35d8a6['index']==_0x2005a5['index']);if('pending'!==_0x408712?.['state'])return null;if('destroyed'===_0x408712?.['editor']['state'])return _0x1f3100['setChangeGroupState'](_0x2005a5['index'],'outdated'),null;const _0x107739=this['_getDocumentRangeForReplyChanges'](_0xa34e11,_0x2005a5['index']);if(!_0x107739)return _0x1f3100['setChangeGroupState'](_0x2005a5['index'],'outdated'),null;const {range:_0x16a138,currentIndex:_0x4c4e44}=_0x107739;return'$graveyard'==_0x16a138['root']['rootName']?(_0x1f3100['setChangeGroupState'](_0x4c4e44,'outdated'),null):_0x107739['range'];}['_getDocumentRangeForReplyChanges'](_0x2e1cee,_0x5c1ac7){const {reply:_0x57af5b,interaction:_0x1c4f11}=this['getInteractionAndReplyById'](_0x2e1cee),_0x5020bc=_0x57af5b['changeGroups']['filter'](_0x423e9f=>'pending'==_0x423e9f['state']),_0x45e470=_0x5020bc['map'](_0x1de1b1=>_0x57af5b['changeGroups']['indexOf'](_0x1de1b1));void 0x0===_0x5c1ac7&&(_0x5c1ac7=_0x45e470[0x0]);const _0x282722=_0x45e470['indexOf'](_0x5c1ac7);if(-0x1==_0x282722)return null;const _0x422034=_0x5020bc[_0x282722],_0x55487b=_0x422034['editor'];if('destroyed'===_0x55487b['state'])return null;const _0x4f64d3=_0x57af5b['documentContextContent']['get'](_0x422034['documentId']),_0x51dea1=new _0x2d0ea8([]),_0x214ac0=new _0x2d0ea8([]);for(const _0x583f35 of _0x422034['changes'])if('removed'!=_0x583f35['type']&&_0x214ac0['children']['push'](_0x583f35['node']['cloneNode'](!0x0)),'new'!=_0x583f35['type']){const _0xe5f08c=_0x1d9b34(_0x3cd596=>Xi(_0x3cd596,'data-id')==_0x583f35['id'],_0x4f64d3,!0x0);_0x51dea1['children']['push'](_0xe5f08c['cloneNode'](!0x0));}if(0x0==_0x51dea1['children']['length']){if(_0x422034['changes'][0x0]['anchorId']){const _0x4486af=Yi('data-id',_0x422034['changes'][0x0]['anchorId'],_0x4f64d3);_0x51dea1['children']['unshift'](_0x4486af['cloneNode'](!0x0)),_0x214ac0['children']['unshift'](_0x4486af['cloneNode'](!0x0)),_0x4486af['nextSibling']&&(_0x51dea1['children']['push'](_0x4486af['nextSibling']['cloneNode'](!0x0)),_0x214ac0['children']['push'](_0x4486af['nextSibling']['cloneNode'](!0x0)));}else{const _0x3cbb32=_0x4f64d3['children'][0x0];if(!_0x3cbb32)return null;_0x51dea1['children']['push'](_0x3cbb32['cloneNode'](!0x0)),_0x214ac0['children']['push'](_0x3cbb32['cloneNode'](!0x0));}}const _0x14021a=_0x1c4f11['getDocumentContext'](),_0x4c20cb=_0x14021a['content']||_0x14021a['documents']['find'](_0x2b8187=>_0x2b8187['id']==_0x422034['documentId'])['content'],_0x59282f=_0x55487b['model']['document']['getRoot'](_0x422034['rootName']),_0xb22206=_0x55487b['data']['parse'](_0x4c20cb,_0x59282f),_0x153431=Ki(_0x51dea1),_0x769105=_0x55487b['data']['parse'](_0x153431,_0x59282f),_0x3b0d33=_0x55487b['data']['parse'](_0x153431,_0x59282f),_0x15d433=_0x55487b['model']['createPositionAt'](_0x769105,0x0),_0x51879d=Ki(_0x214ac0),_0xb3e0c3={'targetEditor':_0x55487b,'anchor':_0x15d433,'markDeletions':!0x1},_0x23b0c2=_0x55487b['plugins']['get'](_0x102c6d)['getDiff'](_0x153431,_0x51879d,_0xb3e0c3)['getOperations']();if(!_0x23b0c2['length'])return null;_0x55487b['model']['change'](_0x453e49=>{for(const _0x719003 of _0x23b0c2)if('remove'==_0x719003['type']){const _0x25e8d6=_0x719003['sourcePosition'],_0x2677ed=_0x719003['howMany'],_0x3f052e=new _0x35b10a(_0x25e8d6,_0x2677ed);_0x453e49['batch']['addOperation'](_0x3f052e),_0x55487b['model']['applyOperation'](_0x3f052e);}else'marker'!==_0x719003['type']&&(_0x719003['baseVersion']=null,_0x719003['isDocumentOperation']=!0x1,_0x453e49['batch']['addOperation'](_0x719003),_0x55487b['model']['applyOperation'](_0x719003));});const _0x2764c8=cs(_0x55487b,_0x23b0c2,_0x769105);us(_0x55487b['model'],_0x2764c8);const _0x25d4bb=_0x2764c8['getFirstRange']()['start']['path']['slice'](),_0x430d0a=_0x2764c8['getFirstRange']()['end']['path']['slice'](),_0x68845=[];let _0x118632=_0x769105,_0x1a6080=_0x3b0d33;for(let _0x283334=0x0;_0x283334<_0x430d0a['length'];_0x283334++){const _0x16ca13=_0x118632['maxOffset']-_0x430d0a[_0x283334];_0x68845[_0x283334]=_0x1a6080['maxOffset']-_0x16ca13,_0x118632=_0x118632['getChildAtOffset'](_0x430d0a[_0x283334]),_0x1a6080=_0x1a6080['getChildAtOffset'](_0x68845[_0x283334]);}const _0x61f3a7=_0x55487b['model']['createRange'](_0x55487b['model']['createPositionFromPath'](_0x3b0d33,_0x25d4bb),_0x55487b['model']['createPositionFromPath'](_0x3b0d33,_0x68845)),_0x2b190b=_0x3b0d33['getChild'](0x0)['getAttribute'](_0x1e6e9f),_0x5a8d39=Array['from'](_0xb22206['getChildren']())['find'](_0x188587=>_0x188587['getAttribute'](_0x1e6e9f)==_0x2b190b)['getPath'](),_0x140472=_0x61f3a7['start']['path']['slice'](),_0xa9f031=_0x61f3a7['end']['path']['slice']();_0x140472[0x0]=_0x5a8d39[0x0]+_0x140472[0x0],_0xa9f031[0x0]=_0x5a8d39[0x0]+_0xa9f031[0x0];let _0x1ca863=_0x55487b['model']['createRange'](_0x55487b['model']['createPositionFromPath'](_0x55487b['model']['document']['getRoot'](_0x422034['rootName']),_0x140472),_0x55487b['model']['createPositionFromPath'](_0x55487b['model']['document']['getRoot'](_0x422034['rootName']),_0xa9f031));const _0x440784=_0x14021a['documents']['find'](_0x28c727=>_0x28c727['id']==_0x422034['documentId'])['version'],_0x4d5ae1=_0x55487b['model']['document']['history']['getOperations'](_0x440784);for(const _0x514748 of _0x4d5ae1)_0x1ca863=_0x245154['_createFromRanges'](_0x1ca863['getTransformedByOperation'](_0x514748));return{'range':_0x1ca863,'currentIndex':_0x5c1ac7,'targetEditor':_0x55487b};}['_integrateEditorBalloon'](_0x24356b){if(!_0x24356b['plugins']['has']('AIChatBalloon'))return;const _0x5b996f=_0x24356b['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x5b996f['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x5b996f,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x1bead2,partIndex:_0xa5f6ff}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x188e19}=this['getInteractionAndReplyById'](_0x1bead2),_0xec3acd=_0x188e19['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0xa5f6ff});_0x5b996f['updateContent']({'part':_0xec3acd[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x5b996f,'applySuggestion',()=>{const {replyId:_0x52ce6c,partIndex:_0x15e45d}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x52ce6c,'partIndex':_0x15e45d}),_0x5b996f['setState']('accepted');}),this['listenTo'](_0x5b996f,'insertSuggestion',()=>{const {replyId:_0x1c42c9,partIndex:_0x3c8701}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x1c42c9,'partIndex':_0x3c8701}),_0x5b996f['setState']('accepted');}),this['listenTo'](_0x5b996f,'rejectSuggestion',()=>{const {replyId:_0x2ae2fb,partIndex:_0x469e5e}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x2ae2fb,'partIndex':_0x469e5e}),_0x5b996f['setState']('rejected');}),this['listenTo'](_0x5b996f,'showNext',()=>{const {replyId:_0x325034,partIndex:_0x1f48a6}=this['_currentPreviewedChangeGroup'],_0x2a494f=this['_getPresentableSiblingContentPartIndex'](_0x325034,_0x1f48a6,'next');null!==_0x2a494f&&this['_openBalloonFor'](_0x325034,_0x2a494f);}),this['listenTo'](_0x5b996f,'showPrevious',()=>{const {replyId:_0x3b4aad,partIndex:_0x5424e9}=this['_currentPreviewedChangeGroup'],_0x1a5e92=this['_getPresentableSiblingContentPartIndex'](_0x3b4aad,_0x5424e9,'previous');null!==_0x1a5e92&&this['_openBalloonFor'](_0x3b4aad,_0x1a5e92);}),this['listenTo'](_0x5b996f,'dialogClosed',(_0x15a1cc,{id:_0x13d818})=>{if('aiChatBalloon'!==_0x13d818)return;const {replyId:_0x60f349,partIndex:_0x17eb14}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x60f349,'index':_0x17eb14,'isActive':!0x1}),this['_activeBalloon']===_0x5b996f&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x20c16f){if(this['_channelsToEditors']['set'](_0x20c16f['config']['get']('collaboration.channelId'),_0x20c16f),this['_integrateEditorBalloon'](_0x20c16f),this['addCurrentDocumentToChatContext'](),_0x20c16f['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x20c16f['plugins']['has']('Undo')){const _0x39b7ae=_0x20c16f['commands']['get']('undo'),_0x36b5ed=_0x20c16f['commands']['get']('redo');this['listenTo'](_0x39b7ae,'revert',(_0x4d99b5,_0x253a7e,_0x5dbaa7)=>{const _0x5e15f6=this['_batchToChanges']['get'](_0x253a7e);if(!_0x5e15f6)return;const _0x3fd38c=this['activeConversation']['getInteraction'](_0x5e15f6['interactionId']),_0x12337d=_0x3fd38c?.['getReply'](_0x5e15f6['replyId']);this['_batchToChanges']['delete'](_0x253a7e),_0x3fd38c&&_0x12337d&&(_0x5e15f6['indexes']['forEach'](_0x2807ab=>_0x12337d['setChangeGroupState'](_0x2807ab,'pending')),this['_batchToChanges']['set'](_0x5dbaa7,_0x5e15f6));}),this['listenTo'](_0x36b5ed,'revert',(_0x35b2ac,_0x361b44,_0x395ac4)=>{const _0x4ffc40=this['_batchToChanges']['get'](_0x361b44);if(!_0x4ffc40)return;const _0x242c1e=this['activeConversation']['getInteraction'](_0x4ffc40['interactionId']),_0x3f6874=_0x242c1e?.['getReply'](_0x4ffc40['replyId']);this['_batchToChanges']['delete'](_0x361b44),_0x242c1e&&_0x3f6874&&(_0x4ffc40['indexes']['forEach'](_0x1db26b=>_0x3f6874['setChangeGroupState'](_0x1db26b,'accepted')),this['_batchToChanges']['set'](_0x395ac4,_0x4ffc40));});}const _0x30105d=_0x20c16f['config']['get']('ai.chat.context');_0x30105d['alwaysAddSelection']&&_0x30105d['document']['enabled']&&this['listenTo'](_0x20c16f['model']['document']['selection'],'change:range',(_0x5a1cc4,_0x34fb34)=>{if(!_0x34fb34['directChange'])return;'chat'===_0x20c16f['plugins']['get']('AITabs')['view']['activeTab']&&(_0x20c16f['model']['hasContent'](_0x20c16f['model']['document']['selection'])?this['addSelectionToChatContext'](_0x20c16f):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x3ae142=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x7de7=await _0x3ae142['getConversations']();return _0x7de7['length']?_0x7de7[0x0]['id']:'new';}catch(_0x3d86b8){return this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':at()}),this['_logError'](new ht('ai-chat-conversation-init-failed',this,{'error':_0x3d86b8})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x108a7b={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x108a7b);}catch(_0xaa3510){this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x108a7b['id']||at()}),console['error'](_0xaa3510),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x263f29,modelId:_0x2564b1}={}){this['_closeActiveBalloon']();let _0x4e657c=_0x2564b1;_0x4e657c||(_0x263f29||!this['activeConversation']?_0x4e657c=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x4e657c=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x400c7b=this['getGroupId'](),_0x2d1d99=_0x263f29||at();let _0x24f3eb;this['activeConversation']=new AIChatConversation({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x4e657c,'conversationId':_0x2d1d99,'group':_0x400c7b,'locale':this['context']['locale'],'isFromHistory':!!_0x263f29,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x3d72c7=>this['_aiEditing']['getSessionId'](_0x3d72c7)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x258e35,_0x261548)=>{this['_aiChatUi']['createConversation'](_0x261548),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x263f29||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x15ae45,_0x3c56be)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x3c56be['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x2980dc=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x2980dc);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x4dcd2d=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x4dcd2d);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x3b6450,_0xbf8312)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0xbf8312,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0x4ac40b,_0x42c4dc)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x42c4dc,{'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',(_0x2947d7,_0x18d083)=>{this['_aiChatUi']['removeFeedInteraction'](_0x18d083['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x37f20d,_0x5e1647,_0x2ba91b)=>{this['_updateConversationTitle'](_0x5e1647,_0x2ba91b);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x207b11,_0xb80528)=>{void 0x0!==_0x24f3eb&&_0x24f3eb!==_0xb80528['id']&&this['_updateReplyContentThrottled']['flush'](),_0x24f3eb=_0xb80528['id'],_0xb80528['isFromHistory']?await this['_updateReplyContent']({'reply':_0xb80528}):await this['_updateReplyContentThrottled']({'reply':_0xb80528});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0xc6fa7b,{reply:_0x486814,index:_0x25c038,state:_0x2a49e0})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x486814['id'],'index':_0x25c038,'state':_0x2a49e0}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x486814['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x25c038&&this['_activeBalloon']?.['setState'](_0x2a49e0);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x26def9,_0x4df8ba)=>{if(this['_aiChatUi']['addContextItem'](_0x4df8ba['contextItem'],_0x4df8ba['isLoading']),'selection'===_0x4df8ba['contextItem']['type']){const _0x28612c=ps(this['context']),_0x55f1dd=[..._0x28612c['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x28612c,'ranges':_0x55f1dd,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x3ab0b,_0x25a9da)=>{this['_aiChatUi']['removeContextItem'](_0x25a9da['uiId']),'current-document'==_0x25a9da['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x25a9da['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x1ddc68,_0x217ad2)=>{this['_aiChatUi']['setContextItemLoading'](_0x217ad2['contextItem']['uiId'],_0x217ad2['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x69b1,_0x3bd866)=>{this['_aiChatUi']['setConversationContext'](_0x3bd866['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x6c200,_0x281d8d)=>{this['_aiChatUi']['setAddContextOptions'](_0x281d8d['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x1b28cf,_0x4ddac5)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x4ddac5['sourceId'],_0x4ddac5['source'],_0x4ddac5['resources'],_0x4ddac5['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x30cdb6,_0x1e7c2f)=>{this['_aiChatUi']['updateResourceState'](_0x1e7c2f['sourceId'],_0x1e7c2f['resourceId'],_0x1e7c2f['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x114309,_0x499190)=>{this['_aiChatUi']['updateCapabilities'](_0x499190);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x6b43ae,_0x53b7c4)=>{const _0x55f306=(await this['_aiChatModels']['getAll']())['find'](_0x355449=>_0x355449['id']===_0x53b7c4['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x55f306,_0x53b7c4['isDisabled']);}),this['listenTo'](this['activeConversation'],'error',(_0x532215,{error:_0xfd25c4,interactionId:_0x4c5537,fileName:_0x127639,url:_0x283e84,sourceId:_0x12e9a8,sourceLabel:_0x14b5e4})=>{const _0x3e4fd3=_0x4c5537?_0x4c5537+':'+at():at();_0xfd25c4['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':Mi(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x3e4fd3}):_0xfd25c4['message']['startsWith']('ai-chat-conversation-init-failed')||_0xfd25c4['message']['startsWith']('ai-chat-conversation-start-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3e4fd3}),this['_logError'](_0xfd25c4)):_0xfd25c4['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x127639),'id':_0x3e4fd3}):_0xfd25c4['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x283e84),'id':_0x3e4fd3}):_0xfd25c4['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x3e4fd3}):_0xfd25c4['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x3e4fd3}):_0xfd25c4['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x12e9a8&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x12e9a8),this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x14b5e4||'source'),'id':_0x3e4fd3}),this['_logError'](_0xfd25c4)):_0xfd25c4['message']['startsWith']('ai-chat-resource-load-failed')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x3e4fd3}),this['_logError'](_0xfd25c4)):_0xfd25c4['message']['startsWith']('ai-chat-invalid-request')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x3e4fd3}),this['_logError'](_0xfd25c4)):_0xfd25c4['message']['startsWith']('ai-chat-context-unsupported-file-type')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x3e4fd3}),this['_logError'](_0xfd25c4)):_0xfd25c4['message']['startsWith']('ai-chat-context-file-too-large')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x3e4fd3}),this['_logError'](_0xfd25c4)):_0xfd25c4['message']['startsWith']('ai-chat-context-file-too-many-pages')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x3e4fd3}),this['_logError'](_0xfd25c4)):_0xfd25c4['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x3e4fd3}),this['_logError'](_0xfd25c4)):(this['_aiChatUi']['addFeedItemError']({'errorMessage':Mi(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x3e4fd3}),this['_logError'](_0xfd25c4));}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x263f29||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x50c169,attributes:_0x1250b4}){if(!this['activeConversation'])throw new ht('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x2d3ed7=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x2d3ed7);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x50c169,'attributes':_0x1250b4});}['_logError'](_0x386c9b){Ct(_0x386c9b['message'],_0x386c9b['data']);}['_removeFromContext'](_0x1ee287){this['activeConversation']?.['removeFromContext'](_0x1ee287);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0x5401cd){const [_0x1527da,_0x45fb5b]=_0x5401cd['split'](':'),_0x54e0f5=this['activeConversation']['getInteraction'](_0x1527da),_0x3ea774=_0x54e0f5['getReply'](_0x45fb5b);return{'interaction':_0x54e0f5,'reply':_0x3ea774};}['_scrollToSuggestionRange'](_0x1a03fc,_0x2c7d1b=!0x1,_0x4f15a4){const _0xe47cfd={'target':_0x4f15a4['editing']['view']['domConverter']['viewRangeToDom'](_0x4f15a4['editing']['mapper']['toViewRange'](_0x1a03fc)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x2c7d1b};_0x2c7d1b&&(_0xe47cfd['alignToTop']=!0x0),Tt(_0xe47cfd);}['_updateConversationTitle'](_0x568c41,_0x14e765=!0x1){this['_aiChatUi']['setConversationTitle'](_0x568c41||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x14e765);}['_addFeedItemReply'](_0x611b1){'text'===_0x611b1['type']?this['_aiChatUi']['addFeedItemAIReply'](_0x611b1):this['_aiChatUi']['addFeedItemAISuggestion'](_0x611b1);}async['_updateReplyContent']({reply:_0x43194d,renderingStrategy:_0x56fb69}){const {id:_0x47c1bf,interactionId:_0x23e69f,isDone:_0x303238,type:_0x39292e,parsedContent:_0x478e0}=_0x43194d,_0x3522d9=_0x23e69f+':'+_0x47c1bf;if('modification'===_0x39292e){const _0x42e4cb=_0x43194d['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x3522d9,'parts':_0x42e4cb,'isDone':_0x303238,'skipLoadingEffects':_0x43194d['isFromHistory']});}else'text'===_0x39292e&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x3522d9,'parsedContent':_0x478e0['get']('text'),'renderingStrategy':_0x56fb69,'isDone':_0x303238});_0x303238&&_0x43194d['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x3522d9,_0x43194d['sources']);}['_updateReplyContentThrottled']=_0x46a184(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x505275=this['activeConversation']?.['lastInteraction'];_0x505275&&(_0x505275['stop'](),this['_aiChatUi']['stopInteraction'](_0x505275)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x30aad1=this['activeConversation']?.['lastInteraction'];if(_0x30aad1){for await(const _0x570202 of _0x30aad1['replies'])this['_aiChatUi']['hasFeedItem'](_0x570202['id'])||this['_addFeedItemReply'](_0x570202),await this['_updateReplyContent']({'reply':_0x570202,'renderingStrategy':'static'});}}['_updateRatings'](_0x13c09d){const _0x18f09a={'positiveCount':_0x13c09d['changeGroups']['filter'](_0x458c4a=>'accepted'===_0x458c4a['state'])['length'],'totalCount':_0x13c09d['changeGroups']['length'],'modificationId':_0x13c09d['id']},_0xc197a0=this['activeConversation']['getInteraction'](_0x13c09d['interactionId'])['messageId'];_0xc197a0&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0xc197a0,_0x18f09a);}['_getAIChatFeedAPI'](_0x5a0db4){const _0x5614af=this['_aiChatUi'],_0x503dba=()=>{_0x5a0db4['resetWebSearchState'](),_0x5a0db4['resetReasoningState'](),_0x5614af['clearLoadingMessage']();},_0x1f0593=()=>{_0x5a0db4['currentReply']&&(_0x5a0db4['currentReply']['done'](),_0x5a0db4['currentReply']=void 0x0);};return{'insertTextReply':(_0x2b3e66,_0x51eb7d)=>{_0x1f0593(),_0x503dba();const _0x43adb7=_0x5a0db4['currentReply']=_0x5a0db4['createReply']({'type':'text','interactionId':_0x5a0db4['id'],'id':_0x51eb7d||at(),'channelsToEditors':this['_channelsToEditors']});return _0x43adb7['appendContent'](_0x2b3e66),_0x1f0593(),_0x43adb7;},'insertCustomElement':async(_0x1d3e06,_0x1d290e)=>(_0x1f0593(),_0x503dba(),_0x5614af['addFeedItemCustomElement'](_0x1d3e06,_0x1d290e||at())),'setLoadingMessage':_0x25b028=>{_0x5614af['setLoadingMessage'](_0x25b028);},'clearLoadingMessage':()=>{_0x5614af['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){ms(this['context'])['find'](_0x2e8677=>'destroyed'!==_0x2e8677['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}}const Rs='ai-selection',bs=['br'];class AIEditing extends _0x915a98{constructor(_0x1ecb88){super(_0x1ecb88),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionIdByEditor']=new WeakMap();['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}['getSessionId'](_0x4458bb){let _0x4f0b13=this['_sessionIdByEditor']['get'](_0x4458bb);return!_0x4f0b13&&(_0x4f0b13=_0x4458bb['plugins']['has']('RealTimeCollaborationClient')&&_0x4458bb['plugins']['get']('RealTimeCollaborationClient')['sessionId']||at(),this['_sessionIdByEditor']['set'](_0x4458bb,_0x4f0b13)),_0x4f0b13;}async['getDocumentData'](){const _0x44244e=ms(this['context']);if(!_0x44244e['length'])throw new ht('ai-get-editor-from-context-no-editor');const _0x1da147=[],_0x435e54=new Set();for(const _0xea140b of _0x44244e){const _0x495087=_0xea140b['config']['get']('roots')||{};for(const _0x764e9f of _0xea140b['model']['document']['getRoots']()){if('$graveyard'===_0x764e9f['rootName'])continue;const _0x316cc2=await this['_getDocumentDataForEditorRoot'](_0xea140b,_0x764e9f,_0x435e54),_0x43237b=_0x495087[_0x764e9f['rootName']];let _0x2b788f;_0x43237b?.['label']?_0x2b788f=_0x43237b['label']:(wt('ai-document-root-missing-label',{'editor':_0xea140b,'rootConfig':_0x43237b}),_0x2b788f=_0x764e9f['rootName']),_0x1da147['push']({'editor':_0xea140b,'rootName':_0x764e9f['rootName'],'content':_0x316cc2['content'],'version':_0x316cc2['version'],'sessionId':this['getSessionId'](_0xea140b),'channelId':_0xea140b['config']['get']('collaboration.channelId'),'selections':_0x316cc2['selections'],'name':_0x2b788f,'description':_0x43237b?.['description']});}}return _0x1da147;}async['_getDocumentDataForEditorRoot'](_0x47eb14,_0x1894c1,_0x10609c){const _0x75b6d9=_0x47eb14['data']['toView'](_0x1894c1,{'convertAiChatSelectionMarker':!0x0}),_0x17072e=new _0x3fd428(_0x47eb14['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x75b6d9,_0x17072e,_0x10609c);let _0x4075e5=await this['_getDocumentDataStringFromView'](_0x75b6d9,_0x47eb14);const _0x577351=this['_getMarkersInDocumentOrder'](_0x47eb14,_0x1894c1),_0x51eb24=[];for(const _0x589251 of _0x577351){const _0x33bf83='<'+_0x589251['name']+':start></'+_0x589251['name']+':start>',_0x332d7e=_0x4075e5['indexOf'](_0x33bf83);_0x4075e5=_0x4075e5['substring'](0x0,_0x332d7e)+_0x4075e5['substring'](_0x332d7e+_0x33bf83['length']);const _0x5409ac='<'+_0x589251['name']+':end></'+_0x589251['name']+':end>',_0xc57e4b=_0x4075e5['indexOf'](_0x5409ac);_0x4075e5=_0x4075e5['substring'](0x0,_0xc57e4b)+_0x4075e5['substring'](_0xc57e4b+_0x5409ac['length']),_0x51eb24['push']({'markerName':_0x589251['name'],'start':_0x332d7e,'end':_0xc57e4b,'htmlFragment':_0x4075e5['substring'](_0x332d7e,_0xc57e4b)});}return{'content':_0x4075e5,'version':_0x47eb14['model']['document']['version'],'selections':_0x51eb24};}['afterInit'](){this['context']instanceof _0x29da5d?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x418366,_0x42db48)=>{_0x42db48['on']('ready',()=>{this['_integrateEditor'](_0x42db48);});});}['_setOutputDataProcessor'](_0x352d8f){this['_outputDataProcessor']=_0x352d8f;}async['_getDocumentDataStringFromView'](_0x2dd7e3,_0x3ed1ae){let _0x467714;if(this['_outputDataProcessor']){const _0xbba7fc=_0x3ed1ae['data']['processor']['domConverter']['viewToDom'](_0x2dd7e3),_0xc00e1b=await this['_outputDataProcessor'](_0xbba7fc);_0x467714=_0x3ed1ae['data']['processor']['htmlWriter']['getHtml'](_0xc00e1b);}else _0x467714=_0x3ed1ae['data']['processor']['toData'](_0x2dd7e3);return _0x467714;}['_integrateEditor'](_0x277b9c){if(!_0x277b9c['config']['get']('collaboration.channelId'))throw new ht('ai-missing-channel-id',_0x277b9c);_0x277b9c['ui']['focusTracker']['on']('change:isFocused',(_0x2cdc16,_0x5a4611,_0x891524)=>{_0x891524&&(this['_lastContentFocusedEditor']=_0x277b9c);}),_0x277b9c['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x277b9c&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x277b9c['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Rs,'view':({markerName:_0x21e986})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x21e986['split'](':')[0x1]],'priority':0xc})}),_0x277b9c['conversion']['for']('dataDowncast')['markerToElement']({'model':Rs+':context','view':(_0x258e1f,{writer:_0x147e5b,options:_0x12a315})=>_0x12a315['convertAiChatSelectionMarker']?_0x147e5b['createUIElement'](_0x258e1f['markerName']+':'+(_0x258e1f['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x4dce13){const _0x4cd961=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x4dce13);const _0x57e2a6=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x4cd961,_0x57e2a6);}['hideFakeVisualSelection'](_0x1183a3){const _0x516e5a=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x1183a3);const _0xd19332=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x516e5a,_0xd19332);}async['modelToDataWithIds'](_0x49c502,_0xfbbaa2){const _0x29ad43=_0xfbbaa2['data']['toView'](_0x49c502),_0x47fca2=new _0x3fd428(_0xfbbaa2['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x29ad43,_0x47fca2),this['_getDocumentDataStringFromView'](_0x29ad43,_0xfbbaa2);}['_setDataIdsOnChildren'](_0x3b8f95,_0xea2a51,_0x2f8c44=new Set()){let _0x3c2eac=!0x1;for(const _0x881484 of _0x3b8f95['getChildren']()){if(!_0x881484['is']('view:element')||bs['includes'](_0x881484['name']))continue;const _0x1d3ce5=_0x881484['is']('view:containerElement'),_0x14509d=_0x881484['is']('view:emptyElement'),_0x5061c4=_0x881484['is']('view:rawElement'),_0xe58978=this['_setDataIdsOnChildren'](_0x881484,_0xea2a51,_0x2f8c44);if(_0x881484['hasAttribute']('data-id')){_0x3c2eac=!0x0,_0x2f8c44['add'](_0x881484['getAttribute']('data-id'));continue;}(_0x1d3ce5||_0x14509d||_0x5061c4||_0xe58978)&&(_0xea2a51['setAttribute']('data-id',this['_nextDataId'](_0x2f8c44),_0x881484),_0x3c2eac=!0x0);}return _0x3c2eac;}['_nextDataId'](_0xfa6458){let _0x4c315f;do{_0x4c315f='';for(let _0x58f243=0x0;_0x58f243<0x4;_0x58f243++)_0x4c315f+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0xfa6458['has'](_0x4c315f));return _0xfa6458['add'](_0x4c315f),_0x4c315f;}['getSelectionText'](_0x4b2207){const _0x3ed7e8=(_0x4b2207?_0x4b2207['model']:ps(this['context'])['model'])['document']['selection'],_0x719d37=[],_0x49a56d=Array['from'](_0x3ed7e8['getRanges']());_0x49a56d['sort']((_0x35a540,_0x14a9d9)=>_0x35a540['start']['isBefore'](_0x14a9d9['start'])?-0x1:0x1);for(const _0x4bdee4 of _0x49a56d)for(const _0x5dc38f of _0x4bdee4['getItems']())_0x5dc38f['is']('$textProxy')?_0x719d37['push'](_0x5dc38f['data']):_0x5dc38f['is']('element')&&_0x719d37['length']>0x0&&'\x20'!==_0x719d37[_0x719d37['length']-0x1]&&_0x719d37['push']('\x20');return _0x719d37['length']?'\x22'+_0x719d37['join']('')['trim']()+'\x22':Mi(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x48372c){for(let _0x369840=0x0;_0x369840<this['_fakeSelections']['length'];_0x369840++)if(this['_fakeSelections'][_0x369840]['id']==_0x48372c)return void this['_fakeSelections']['splice'](_0x369840,0x1);}['_addFakeSelection'](_0x31ac10){this['_removeFakeSelectionById'](_0x31ac10['id']),ft(this['_fakeSelections'],_0x31ac10);}['_refreshFakeSelection'](_0x5b7bd6,_0x562bec){if(_0x5b7bd6==_0x562bec)return;const _0x2e195b=_0x5b7bd6?_0x5b7bd6['editor']:null,_0x2496f7=_0x562bec?_0x562bec['editor']:null,_0x450b5a=(_0x27a17e,_0x165835)=>{const _0x1b400d=_0x165835['model']['markers']['getMarkersGroup'](Rs);for(const _0x3ac5a5 of _0x1b400d)_0x27a17e['removeMarker'](_0x3ac5a5);},_0x440e5f=(_0x384a57,_0x4245fc,_0x32dd6e)=>{const _0x5f1662=_0x4245fc['model'];for(let _0x3c26d0=0x0;_0x3c26d0<_0x32dd6e['ranges']['length'];_0x3c26d0++){let _0x6f11df=_0x32dd6e['ranges'][_0x3c26d0];const _0x24f36a=Rs+':'+_0x32dd6e['id']+':'+_0x3c26d0;if(_0x6f11df['start']['isAtEnd']){const _0x3f0aa=_0x6f11df['start']['getLastMatchingPosition'](({item:_0x42e4c6})=>!_0x5f1662['schema']['isContent'](_0x42e4c6),{'boundaries':_0x6f11df});_0x6f11df=_0x384a57['createRange'](_0x3f0aa,_0x6f11df['end']);}_0x384a57['addMarker'](_0x24f36a,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x6f11df});}};_0x2e195b&&_0x2496f7&&_0x2e195b===_0x2496f7&&_0x562bec?_0x2e195b['model']['change'](_0x14b6cd=>{_0x450b5a(_0x14b6cd,_0x2e195b),_0x440e5f(_0x14b6cd,_0x2496f7,_0x562bec);}):(_0x2e195b&&_0x2e195b['model']['change'](_0x2ffb76=>_0x450b5a(_0x2ffb76,_0x2e195b)),_0x2496f7&&_0x562bec&&_0x2496f7['model']['change'](_0x182e26=>_0x440e5f(_0x182e26,_0x2496f7,_0x562bec)));}['_getMarkersInDocumentOrder'](_0xe089e0,_0x525b21){const _0x1fe895=Array['from'](_0xe089e0['model']['markers']['getMarkersGroup'](Rs+':context'));return(_0x525b21?_0x1fe895['filter'](_0x115ed8=>{const _0x13b14c=_0x115ed8['getRange']();return _0x13b14c&&_0x13b14c['root']['rootName']===_0x525b21['rootName'];}):_0x1fe895)['sort']((_0x40fbf0,_0x381b2c)=>_0x40fbf0['getStart']()['isBefore'](_0x381b2c['getStart']())?-0x1:_0x40fbf0['getStart']()['isAfter'](_0x381b2c['getStart']())?0x1:0x0);}}const Ss=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],Os=[...Ss,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function vs(_0x16e7f3){const _0x24affa=new AbortController();return{'promise':new Promise((_0x2bda44,_0x9a4831)=>{const _0x4b4393=setTimeout(_0x2bda44,_0x16e7f3);_0x24affa['signal']['addEventListener']('abort',()=>{clearTimeout(_0x4b4393),_0x9a4831();});}),'abortController':_0x24affa};}class HTMLStreamer{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x3e80ee){this['options']={'delay':_0x3e80ee?.['delay']??0xa,'textNodeStyle':_0x3e80ee?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x24d52e,targetElement:_0xcb53d,abortSignal:_0x5b4f3b}){this['isStreaming']&&this['stop'](),_0x5b4f3b?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x54dd72(_0x24d52e,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x23195d=0x0;_0x23195d<this['currentIndex'];_0x23195d++)this['nodesList'][_0x23195d]['shouldBeStreamed']=!0x0;do{const _0x31ad63=Date['now'](),_0x439465=this['nodesList'][this['currentIndex']],_0x18b9dd=_0x31ad63-this['lastUpdateTime'];if(_0x439465){_0x439465['shouldBeStreamed']=!0x0;let _0x242a5d=_0x439465['parent'];for(;_0x242a5d;)_0x242a5d['shouldBeStreamed']=!0x0,_0x242a5d=_0x242a5d['parent'];}if(_0x18b9dd<this['options']['delay'])try{const {promise:_0x46dfad,abortController:_0x13290c}=vs(this['options']['delay']-_0x18b9dd);this['timeoutAbortController']=_0x13290c,await _0x46dfad;}catch(_0x18bc68){return;}_0x4f9646(_0xcb53d,'<'+_0xcb53d['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0xcb53d['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:_0x216d25}){Array['from'](_0x216d25['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x582b48=>{_0x582b48['replaceWith'](_0x582b48['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x53fe0e){let _0x1c1251='';if(function(_0x171634){return _0x6b228f(_0x171634);}(_0x53fe0e)){for(const _0x483a28 of _0x53fe0e['children'])_0x1c1251+=this['renderNode'](_0x483a28);}else{if(Ns(_0x53fe0e)){if(!_0x53fe0e['shouldBeStreamed'])return'';const _0x521c18=_0x53fe0e,_0x4ff9a5=Object['entries'](_0x521c18['attribs'])['map'](([_0x1dd052,_0x147e54])=>_0x1dd052+'=\x22'+_0x147e54+'\x22')['join']('\x20');_0x1c1251+='<'+_0x521c18['tagName']+(_0x4ff9a5?'\x20'+_0x4ff9a5:'')+'>';for(const _0x24750b of _0x137a8a(_0x521c18))_0x1c1251+=this['renderNode'](_0x24750b);_0x1c1251+='</'+_0x521c18['tagName']+'>';}else{if(!ys(_0x53fe0e))return'';if(!_0x53fe0e['shouldBeStreamed'])return'';!function(_0x59aceb){if(!_0x59aceb['parent']||!Ns(_0x59aceb['parent']))return!0x1;if(!ks['includes'](_0x59aceb['parent']['tagName']))return!0x1;return!ti(_0x59aceb)['match'](/^\s*[<>]\s*$/);}(_0x53fe0e)?_0x1c1251+=_0x44d9d1(_0x53fe0e):_0x1c1251+=_0x44d9d1(new _0x2fffb9('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x53fe0e]));}}return _0x1c1251;}['getParsedDocumentNodeList'](){const _0x1cca7e=[];return function(_0x923d31,_0x33c92b){const _0x320bd1=_0x3405dd=>{if(_0x33c92b(_0x3405dd),_0x3405dd instanceof _0x25ca24)for(let _0x27580d=0x0;_0x27580d<_0x3405dd['children']['length'];_0x27580d++){const _0x3b678d=_0x3405dd['children'][_0x27580d];_0x320bd1(_0x3b678d);}};for(let _0x5b23d7=0x0;_0x5b23d7<_0x923d31['children']['length'];_0x5b23d7++)_0x320bd1(_0x923d31['children'][_0x5b23d7]);}(this['document'],_0x5bd1e2=>{if(ys(_0x5bd1e2)){const _0x1d9018=this['splitTextNodeIntoWordNodes'](_0x5bd1e2);_0x1d9018['length']&&_0x1cca7e['push'](..._0x1d9018);}_0x5bd1e2['isWordSplitSource']||_0x5bd1e2['isWordSplitResult']||_0x1cca7e['push'](_0x5bd1e2);}),_0x1cca7e;}['splitTextNodeIntoWordNodes'](_0x5016c5){if(_0x5016c5['isWordSplitSource']||_0x5016c5['isWordSplitResult'])return[];const _0x51093c=ti(_0x5016c5)['match'](/(?:\s*\S+\s*)/g),_0x235255=[];if(_0x51093c&&_0x51093c['length']>0x1){for(const _0x524e2c of _0x51093c){const _0x208fed=new _0x57fdbc(_0x524e2c);_0x208fed['isWordSplitResult']=!0x0,_0x29d740(_0x5016c5,_0x208fed),_0x235255['push'](_0x208fed);}_0x5016c5['isWordSplitSource']=!0x0,_0x369ef0(_0x5016c5);}return _0x235255;}}const ks=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function ys(_0x35fedf){return _0x2aa022(_0x35fedf);}function Ns(_0xb6e84d){return _0x13b829(_0xb6e84d);}class AIChatFeedItemView extends Nt{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x5e493f){super();const _0x4f1a10=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new HTMLStreamer(),this['options']=_0x5e493f,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x4f1a10['if']('isDone','ck-ai-chat__feed__item_done'),_0x4f1a10['if']('isVisible','ck-hidden',_0x31ecd2=>!_0x31ecd2),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){this['htmlStreamer']['cleanUpAnimations']({'targetElement':this['element']}),this['element']['querySelectorAll']('[data-id]')['forEach'](_0x24b31b=>{_0x24b31b['removeAttribute']('data-id');}),this['isDone']=!0x0;}async['streamIntoElement'](_0x23895c,_0x51bc99,_0x30091c){await this['htmlStreamer']['stream']({'document':_0x23895c,'targetElement':_0x51bc99,'abortSignal':_0x30091c});}}class AISuggestionHeaderView extends Nt{['showChangesToggleView'];constructor(_0x4663fb,_0x141668){super(_0x4663fb),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new ShowChangesToggleView(_0x4663fb),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+Gi,'label':Mi(_0x4663fb,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x141668['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x631aaa=>_0x631aaa?_0x554737:_0x27d4c5),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0x196fa8=new Lt();_0x196fa8['content']=_0x4c737b,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x141668['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0x196fa8,{'tag':'span','children':[Mi(_0x4663fb,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}}class ShowChangesToggleView extends yt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}}const xs={'accepted':_0x3a0e00,'rejected':_0x2ea868,'outdated':_0x2ea868};class AISuggestionContentPartStateView extends Nt{['stateIconView'];constructor(_0x3eea79){super(_0x3eea79);const _0x4a2bd2=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new StateIconView(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x4a2bd2['to']('state',_0x5ed347=>'ck-ai-suggestion__content-part-state_'+_0x5ed347),_0x4a2bd2['if']('isVisible','ck-hidden',_0x1ec339=>!_0x1ec339)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x4a2bd2['to']('state',_0x1961d4=>{switch(_0x1961d4){case'accepted':return Mi(_0x3eea79,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return Mi(_0x3eea79,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return Mi(_0x3eea79,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x4465d6){this['state']=_0x4465d6;}}class StateIconView extends Lt{constructor(){super(),this['set']('state','accepted'),this['content']=xs[this['state']],this['on']('change:state',()=>{this['content']=xs[this['state']];});}}class AISuggestionContentPartToolbarView extends kt{['_applyButton'];['_suggestButton'];constructor(_0x393058,_0x13d9e0,_0xedac67){super(_0x393058);const _0x22d6c1=Boolean(_0xedac67);this['set']('isEnabled',!_0x22d6c1),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x4e2fb3=[];if(_0x22d6c1){const _0x1fc23a=new yt(_0x393058);_0x1fc23a['set']({'label':Mi(_0x393058,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x5ccdf0}),_0x1fc23a['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x4e2fb3['push'](_0x1fc23a);}else{_0x13d9e0['includes']('applySuggestion')&&(this['_applyButton']=new yt(_0x393058),this['_applyButton']['set']({'label':Mi(_0x393058,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x3a0e00}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x62b24f=>!_0x62b24f),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x4e2fb3['push'](this['_applyButton'])),_0x13d9e0['includes']('insertSuggestion')&&(this['_suggestButton']=new yt(_0x393058),this['_suggestButton']['set']({'label':Mi(_0x393058,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x5e520b}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x4e2fb3['push'](this['_suggestButton']));const _0x38fd5f=new yt(_0x393058);_0x38fd5f['set']({'label':Mi(_0x393058,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x2ea868}),_0x38fd5f['bind']('isEnabled')['to'](this),_0x38fd5f['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x4e2fb3['push'](_0x38fd5f);}this['items']['addMany'](_0x4e2fb3);const _0x3c5844=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x3c5844['if']('isVisible','ck-hidden',_0x41ee70=>!_0x41ee70)]}});}['setButtonsVisibility']({showApplyButton:_0x2815e9,showSuggestButton:_0x2a2e30}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x2815e9),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x2a2e30);}}class AISuggestionContentPartHeaderView extends Nt{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x1e7182,{part:_0x1a3e01,uiIndex:_0x4757cb,availableActions:_0x2bf7d1,areActionsDisabled:_0x1da81c}){super(_0x1e7182),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new AISuggestionContentPartToolbarView(_0x1e7182,_0x2bf7d1,_0x1da81c),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x1a3e01['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x1a3e01['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x1a3e01['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new AISuggestionContentPartStateView(_0x1e7182),this['titleLabelView']=new AISuggestionBodyContentPartTitleLabelView(_0x1e7182,_0x4757cb),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',(_0x4031f2,_0x5caab0,_0x2f8e69,_0x328b6e)=>{'pending'===_0x328b6e?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x2f8e69?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x2f8e69),this['children']['add'](this['stateView']));});}}class AISuggestionBodyContentPartTitleLabelView extends Nt{constructor(_0x430125,_0x1c41bb){super(_0x430125),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[Mi(_0x430125,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x1c41bb['toString']())]});}}class AISuggestionStreamableContentView extends Nt{['htmlStreamer'];constructor(_0xd44b42){super(_0xd44b42),this['htmlStreamer']=new HTMLStreamer(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x19acef,renderingStrategy:_0x5df62c,abortSignal:_0x5f1f78}){const _0x18d3cf=_0x54dd72(_0x19acef['content'],!0x0);for(const _0x65758b of qi(_0x18d3cf))_0x369ef0(_0x65758b);'streaming'===_0x5df62c?await this['htmlStreamer']['stream']({'document':_0x18d3cf,'targetElement':this['element'],'abortSignal':_0x5f1f78}):_0x4f9646(this['element'],'<'+this['element']['tagName']+'>'+Ki(_0x18d3cf)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}}class AISuggestionBodyViewContentPartView extends Nt{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x141511,{part:_0x1767f3,uiIndex:_0x17fa28,areActionsDisabled:_0x509429,availableActions:_0x48735a}){super(_0x141511);const _0x49882d=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1);const _0x4bc706=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x509429;};this['on']('change:state',_0x4bc706),this['on']('change:isDone',_0x4bc706),_0x4bc706(),this['_children']=this['createCollection'](),this['_headerView']=new AISuggestionContentPartHeaderView(_0x141511,{'part':_0x1767f3,'uiIndex':_0x17fa28,'availableActions':_0x48735a,'areActionsDisabled':_0x509429}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Ss)['to'](this),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x141511),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x49882d['to']('state',_0x4f3ebb=>'ck-ai-suggestion__body__content-part_'+_0x4f3ebb),_0x49882d['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x49882d['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x49882d['if']('isVisible','ck-hidden',_0x5c97e6=>!_0x5c97e6)]},'children':this['_children'],'on':{'mouseenter':_0x49882d['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x1767f3['index']});}),'mouseleave':_0x49882d['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x1767f3['index']});}),'click':_0x49882d['to'](_0xf36231=>{const _0x255c42=_0xf36231['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x255c42)&&this['fire']('showChangeInText',{'index':_0x1767f3['index']});})}});}async['updateContent']({part:_0x4b21b1,showUnchangedParts:_0x470ad2=!0x1,abortSignal:_0xda0da3}){this['partDefinition']=_0x4b21b1,this['isVisible']=this['partDefinition']['hasChanges']||_0x470ad2,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x4b21b1,'renderingStrategy':'static','abortSignal':_0xda0da3});}['markAsDone'](){this['isDone']=!0x0;}}class AISkeletonView extends Nt{constructor(_0xec0fc6,_0x314d45){super(_0xec0fc6),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x13cfb9=>!_0x13cfb9)]},'children':this['_createSkeletonItems'](_0x314d45)});}['_createSkeletonItems'](_0x1d5826){const _0x4e4279=['ck','ck-ai-skeleton__item'];return _0x1d5826['map'](_0x2ab296=>{let _0x12a5f5='';switch(_0x2ab296['attributes']['align']){case'right':_0x12a5f5='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x12a5f5='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x12a5f5='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x2ab296['tag'],'attributes':{'class':[..._0x4e4279,_0x2ab296['attributes']['class']?_0x2ab296['attributes']['class']:''],'style':'width:\x20'+_0x2ab296['attributes']['width']+';\x20height:\x20'+_0x2ab296['attributes']['height']+';'+_0x12a5f5}};});}}const Ls={'aiSuggestionBody':[{'tag':'div','attributes':{'width':'50%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'85%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'75%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}}],'aiFeed':[{'tag':'div','attributes':{'width':'100%','height':'72px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}},{'tag':'div','attributes':{'width':'150px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'140px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}}],'aiHistory':Ps(0x5,'100%','44px','right'),'aiChatResources':Ps(0x8,'100%','24px','right'),'aiReviewChecks':[{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}}]};function Ps(_0x5e8cd9,_0x33f37c,_0x24addd,_0x32ef1b){return new Array(_0x5e8cd9)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x33f37c,'height':_0x24addd,'align':_0x32ef1b}}));}class PromiseQueue extends Et(){['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x31ca07){const _0x567c84=this['createTask'](_0x31ca07);return this['queue']['push'](_0x567c84),this['_processQueue'](),_0x567c84['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(_0x2f665d=>{this['once']('_queueEmpty',()=>{_0x2f665d();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x1d0968=this['queue']['shift']();try{await _0x1d0968['callback'](this['_abortController']['signal']),_0x1d0968['resolve']();}catch(_0x4a38c9){_0x1d0968['reject'](_0x4a38c9);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x180844){let _0x39288c,_0x3d1ca6;const _0x2c2898=new Promise((_0x25e825,_0x51e138)=>{_0x39288c=_0x25e825,_0x3d1ca6=_0x51e138;});return{'callback':_0x180844,'resolve':_0x39288c,'reject':_0x3d1ca6,'completePromise':_0x2c2898};}}class AIChatFeedErrorItemView extends AIChatFeedItemView{constructor(_0x457ffc){super(_0x457ffc),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x457ffc['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x2c1b1b){this['element']['innerHTML']=_0x2c1b1b;}}const Ds=['applySuggestion','insertSuggestion'];class AIChatFeedSuggestionItemActionsView extends Nt{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x21c9d5,_0x25250f=[...Ds],_0x1de65c){super(_0x21c9d5);const _0x1a0ae1=this['bindTemplate'],_0x4f2e1d=Boolean(_0x1de65c);if(this['set']('isEnabled',!_0x4f2e1d),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x4f2e1d){const _0x497567=new yt(_0x21c9d5);_0x497567['set']({'label':Mi(_0x21c9d5,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x5ccdf0}),_0x497567['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x59e80f=new Nt(_0x21c9d5);_0x59e80f['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[Mi(_0x21c9d5,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x497567]}]}),this['children']['add'](_0x59e80f);}else this['_applyChangesButton']=new yt(_0x21c9d5),this['_applyChangesButton']['set']({'label':Mi(_0x21c9d5,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x25250f['includes']('applySuggestion'),'class':Ui}),this['_insertSuggestionsButton']=new yt(_0x21c9d5),this['_insertSuggestionsButton']['set']({'label':Mi(_0x21c9d5,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x25250f['includes']('insertSuggestion'),'class':Bi}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x56019e=>{_0x56019e['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',_0x1a0ae1['if']('isVisible','ck-hidden',_0x7cd438=>!_0x7cd438)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0xea3ecd){this['isVisible']=_0xea3ecd;}['_switchButtonLabelsPlurality'](_0x3dc575){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x3dc575?(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=Mi(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}}class AIWebSourcesView extends Nt{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0xe69ddb,_0x3cb1a9){super(_0xe69ddb),this['bodyCollection']=_0x3cb1a9,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',_0x277478=>!_0x277478)]},'children':this['children']});const _0x4f060a=new Nt(this['locale']),_0x2e2e07=new Lt();_0x2e2e07['content']=_0x513748,_0x4f060a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x2e2e07,{'tag':'span','children':[{'text':Mi(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x4f060a),this['_setupBalloonPanel'](_0xe69ddb);}['addSource'](_0x20db83){this['children']['add'](new AIWebSourceView(this['locale'],_0x20db83,this['balloonPanelView']));}['_setupBalloonPanel'](_0x43f31c){this['balloonPanelView']=new zt(_0x43f31c),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}}class AIWebSourceView extends yt{['balloonPanelView'];['source'];constructor(_0x42d6bc,_0x23f425,_0x3c21eb){super(_0x42d6bc),this['source']=_0x23f425,this['balloonPanelView']=_0x3c21eb,this['set']({'label':_0x23f425['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x380825=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x380825['to'](()=>{window['open'](_0x23f425['url'],'_blank');}),'mouseenter':_0x380825['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x380825['to'](()=>{this['_hideTooltip']();})}}),_0x23f425['favicon']){const _0x25718d=new Nt(_0x42d6bc);_0x25718d['setTemplate']({'tag':'img','attributes':{'src':_0x23f425['favicon']||_0x513748,'alt':_0x23f425['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x25718d);}else this['set']('icon',_0x513748);}['_createTooltipContentView'](_0x160b21,_0x12a25b){const _0x6bcb86=new Nt(_0x160b21),_0x4b362d=[];let _0x258531;_0x12a25b?.['favicon']?(_0x258531=new Nt(_0x160b21),_0x258531['setTemplate']({'tag':'img','attributes':{'src':_0x12a25b['favicon'],'alt':_0x12a25b['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x258531=new Lt(),_0x258531['content']=_0x513748,_0x258531['extendTemplate']({'attributes':{'alt':_0x12a25b['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x4b362d['push'](_0x258531);const _0x282658=new Nt(_0x160b21);_0x282658['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x12a25b['url']},'children':[{'text':new URL(_0x12a25b['url'])?.['hostname']}]}),_0x4b362d['push'](_0x282658);const _0x47820c=new Nt(_0x160b21);_0x47820c['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x4b362d});const _0x205d31=new Nt(_0x160b21);return _0x205d31['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x12a25b['title']['length']>0x190?_0x12a25b['title']['substring'](0x0,0x190)+'...':_0x12a25b['title']}]}),_0x6bcb86['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x47820c,_0x205d31]}),_0x6bcb86;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthWest'],zt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}['_hideTooltip'](){this['balloonPanelView']['hide']();}['_updateTooltipContent'](){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0x7d500c=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x7d500c);}}class AISuggestionBodyView extends Nt{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x1902b2(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x38d4d0,_0x15829d){super(_0x38d4d0);const {areActionsDisabled:_0x57e9c2,showUnchangedParts:_0xf400ec,availableActions:_0xf63f11}=_0x15829d;this['_areActionsDisabled']=_0x57e9c2,this['_showUnchangedParts']=_0xf400ec,this['_availableActions']=_0xf63f11,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new AISkeletonView(_0x38d4d0,Ls['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new PromiseQueue(),this['_emptyPartsWarningView']=new AIChatFeedErrorItemView({'id':'empty-parts-warning','initialContent':Mi(_0x38d4d0,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new AIChatFeedSuggestionItemActionsView(_0x38d4d0,_0x15829d['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new AIWebSourcesView(this['locale'],_0x15829d['bodyCollection']),_0x15829d['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Ss)['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body']},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-parts']},'children':this['_children']},this['_emptyPartsWarningView'],this['_actionsView'],this['_sourcesView']]});}['destroy'](){this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),super['destroy']();}get['partsCount'](){return this['_contentPartViews']['length'];}get['_contentPartViews'](){return Array['from'](this['_children'])['filter'](_0xa71cb0=>_0xa71cb0 instanceof AISuggestionBodyViewContentPartView);}async['updateContentParts']({parts:_0xe3f3fc,abortSignal:_0x3b4c28,skipLoadingEffects:_0x5b2a2c}){this['_cachedContentParts']['length']?_0xe3f3fc['forEach'](_0x39244b=>{const _0x2fe008=this['_cachedContentParts']['findIndex'](_0x289161=>_0x289161['index']==_0x39244b['index']);-0x1===_0x2fe008?this['_cachedContentParts']['push'](_0x39244b):this['_cachedContentParts'][_0x2fe008]=_0x39244b;}):this['_cachedContentParts']=_0xe3f3fc;const _0x3f7599=this['_showUnchangedParts']?_0xe3f3fc:_0xe3f3fc['filter'](_0x2d32f6=>_0x2d32f6['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x3f7599['length']>0x1),_0x5b2a2c&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0xdfc56f of _0x3f7599)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x3941d6=>{let _0x329f7e=this['getPartView'](_0xdfc56f['index']);if(!_0x329f7e){if(_0x329f7e=new AISuggestionBodyViewContentPartView(this['locale'],{'part':_0xdfc56f,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x329f7e['delegate'](...Ss)['to'](this),_0x329f7e['bind']('isTrackChangesOn')['to'](this),!_0x5b2a2c&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x3941d6),_0x3941d6['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x329f7e,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x5b2a2c||this['_showSkeletonDebounced']();}await _0x329f7e['updateContent']({'part':_0xdfc56f,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x3941d6}),_0x329f7e['markAsDone']();});return _0x3b4c28?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x10e434,_0x109091){const _0x315533=this['getPartView'](_0x10e434);_0x315533&&(_0x315533['state']=_0x109091),this['hasPendingParts']='pending'==_0x109091||this['_contentPartViews']['some'](_0x4c2b45=>'pending'==_0x4c2b45['state']);}['setPartActive'](_0xac39fc,_0x3ea404){if(!0x1===_0xac39fc){for(const _0x65a57e of this['_contentPartViews'])_0x65a57e['isActive']=!0x1;}else{const _0x9d7bd8=this['getPartView'](_0xac39fc);_0x9d7bd8&&(_0x9d7bd8['isActive']=_0x3ea404);}}['updateSources'](_0x5bea85){_0x5bea85['forEach'](_0x130b80=>this['_sourcesView']['addSource'](_0x130b80)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x275a9c){return this['_contentPartViews']['find'](_0x56ef81=>_0x56ef81['partDefinition']['index']==_0x275a9c)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x4c02f1=!this['_cachedContentParts']['find'](({hasChanges:_0x3f47c0})=>_0x3f47c0),_0x44f322=!!this['_cachedContentParts']['find'](({hasChanges:_0x214085})=>!_0x214085);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x44f322,_0x4c02f1?this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](Mi(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x488abe=>_0x488abe['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x4f1509){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x1eb4a0=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x1eb4a0>0x0){const {promise:_0x23beb8,abortController:_0x45ba8c}=vs(_0x1eb4a0);_0x4f1509?.['addEventListener']('abort',()=>_0x45ba8c['abort']()),await _0x23beb8['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x1a32e7=>_0x1a32e7['partDefinition']['hasChanges'])['length']>0x0;}}class AISuggestionContainerView extends Nt{['bodyView'];['children'];['headerView'];constructor(_0x5e77da,_0x6d9070,_0x10c039){super(_0x5e77da);const {showDiff:_0x3017c3,areActionsDisabled:_0x12ebf6,showUnchangedParts:_0x17f11b,availableActions:_0xa2a285}=_0x6d9070;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new AISuggestionHeaderView(_0x5e77da,{'showDiff':_0x3017c3}),this['headerView']['on']('toggleShowChanges',(_0x4c7a80,_0x11db3c)=>{this['areChangesVisible']=_0x11db3c['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x11db3c['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new AISuggestionBodyView(_0x5e77da,{'areActionsDisabled':_0x12ebf6,'showUnchangedParts':!!_0x17f11b,'availableActions':_0xa2a285,'bodyCollection':_0x10c039}),this['bodyView']['delegate'](...Ss)['to'](this),this['bodyView']['bind']('isTrackChangesOn')['to'](this),this['children']['add'](this['bodyView']),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__container','ck-rounded-corners']},'children':this['children']});}async['updateContent'](_0x42009b){await this['bodyView']['updateContentParts'](_0x42009b);}['updateSources'](_0x424d95){this['bodyView']['updateSources'](_0x424d95);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}}class AIChatFeedSuggestionItemView extends AIChatFeedItemView{['containerView'];constructor(_0x46e748,_0x5c93fc,_0x3bf333){super(_0x5c93fc),this['set']('isTrackChangesOn',!0x1),this['containerView']=new AISuggestionContainerView(_0x46e748,{'showDiff':_0x5c93fc['showDiff'],'areActionsDisabled':_0x5c93fc['areActionsDisabled'],'availableActions':_0x5c93fc['availableActions']},_0x3bf333),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x1e7894,_0x410b47)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x410b47['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',(_0x49f145,{index:_0x193fb0})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x193fb0});}),this['containerView']['on']('applySuggestion',(_0x38c73d,{index:_0x4d7ce4}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x4d7ce4});}),this['containerView']['on']('insertSuggestion',(_0x24f1ca,{index:_0x410719}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x410719});}),this['containerView']['on']('rejectSuggestion',(_0x393add,{index:_0x38ea99})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x38ea99});}),this['containerView']['on']('mouseOverSuggestion',(_0x5de6ef,{index:_0x10bac5})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x10bac5});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x434a67,{index:_0x4d9294})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x4d9294});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x56eae3){await this['containerView']['updateContent'](_0x56eae3);}['updatePartState'](_0x467bfe,_0x57fca0){this['containerView']['bodyView']['updatePartState'](_0x467bfe,_0x57fca0);}['setPartActive'](_0x13a884,_0x55d512){!0x1===_0x13a884?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x13a884,_0x55d512);}['updateSources'](_0x54dd03){this['containerView']['updateSources'](_0x54dd03);}['getPartView'](_0xe4f82f){return this['containerView']['bodyView']['getPartView'](_0xe4f82f);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}}class AIChatFeedReplyItemView extends AIChatFeedItemView{['replyContainer'];['_bodyCollection'];constructor(_0x57e285,_0x38c816,_0x32796c){super(_0x38c816),this['_bodyCollection']=_0x32796c,this['locale']=_0x57e285,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new Nt(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Wi(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x3f7b4d,renderingStrategy:_0x49d93e,abortSignal:_0x4e5342}){'streaming'===_0x49d93e?await this['streamIntoElement'](_0x3f7b4d,this['replyContainer']['element'],_0x4e5342):this['replyContainer']['element']['innerHTML']=_0x44d9d1(_0x3f7b4d);}['updateSources'](_0x5ce3c1){const _0x33cbc8=new AIWebSourcesView(this['locale'],this['_bodyCollection']);_0x33cbc8['children']['addMany'](_0x5ce3c1['map'](_0x42b87b=>new AIWebSourceView(this['locale'],_0x42b87b,_0x33cbc8['balloonPanelView']))),_0x33cbc8['isVisible']=!0x0,this['children']['add'](_0x33cbc8);}}class AISpinnerView extends xt{constructor(_0xf04307=void 0x0){super();const _0x546d6b=_0xf04307?'ck-ai-spinner_'+_0xf04307:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x546d6b]}});}}const Vs={'file':_0x37fe61,'image':_0x265d3f,'document':_0x4c737b,'web-resource':_0x17ea45,'text':_0x37fe61,'selection':_0x581346,'mcp-tool-context':_0x4c737b},Hs='ck-ai-chat-context-chip',Ms='ck-ai-chat-context-chip_wide',Us='ck-ai-chat-context-chip_document',Bs='ck-ai-chat-context-chip__label',Gs='ck-ai-chat-context-chip__type-icon',Fs='ck-ai-chat-context-controls__chip-tooltip',Ws='n';class AIChatContextItemButtonView extends yt{constructor(_0x8f287e,_0x6b6fd7,_0x552c0c,_0xa053ba,_0x36b5ea=!0x1){super(_0x8f287e),this['_isAnimationOnEnterEnabled']=_0xa053ba,this['_initializeProperties'](_0x6b6fd7,_0x552c0c,_0x36b5ea),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'](_0x1b8a15,_0x5c0acb,_0x5332ea){this['set']('label',_0x1b8a15['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x1b8a15['type']),this['set']('id',_0x1b8a15['uiId']),this['set']('readonly',_0x5c0acb),this['set']('isLoading',_0x5332ea);}['_setupTemplate'](){const _0x6875b8=this['_createIconView'](),_0x273b31=this['_createRemoveButton'](),_0x4ec665=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x4ec665),'children':this['_createTemplateChildren'](_0x6875b8,_0x273b31,_0x4ec665)});}['_createTemplateAttributes'](_0x2d1267){return{'class':[Hs,_0x2d1267['if']('itemType',Us,_0x237dcb=>'document'==_0x237dcb),_0x2d1267['if']('itemType',Ms,_0x1e616e=>'selection'==_0x1e616e)],'data-cke-tooltip-text':_0x2d1267['to']('label',Ks),'data-cke-tooltip-position':Ws,'data-cke-tooltip-class':Fs};}['_createTemplateChildren'](_0x13fe84,_0x2b3e5e,_0x2ebe49){const _0xd3a273=this['_createLabelElement'](_0x2ebe49),_0x55cbf4=this['_createLoaderIcon']();return this['readonly']?[_0x13fe84,_0xd3a273]:[_0x13fe84,_0x55cbf4,_0xd3a273,_0x2b3e5e];}['_createLabelElement'](_0x18d681){return{'tag':'span','attributes':{'class':Bs},'children':[{'text':_0x18d681['to']('label')}]};}['_createRemoveButton'](){const _0x9f027=new yt(this['locale']);return _0x9f027['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x59fd32}),this['_setupRemoveButtonEvent'](_0x9f027),_0x9f027;}['_setupRemoveButtonEvent'](_0x1e3438){_0x1e3438['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x2e31b1=this['bindTemplate'],_0x488423=new Lt();return _0x488423['content']=Vs[this['itemType']],_0x488423['extendTemplate']({'attributes':{'class':[Gs,_0x2e31b1['if']('isLoading','ck-hidden',_0x27d0e6=>_0x27d0e6)]}}),_0x488423;}['_handleAnimationEndOnce'](_0x4d7319,_0x435ad5){if(!_0x4d7319)return;const _0x5054b=()=>{_0x435ad5(),_0x4d7319['removeEventListener']('animationend',_0x5054b),_0x4d7319['removeEventListener']('webkitAnimationEnd',_0x5054b);};_0x4d7319['addEventListener']('animationend',_0x5054b),_0x4d7319['addEventListener']('webkitAnimationEnd',_0x5054b);}['_createLoaderIcon'](){const _0x2c0a54=new AISpinnerView('small');return _0x2c0a54['bind']('isVisible')['to'](this,'isLoading',_0x3bd70a=>_0x3bd70a),_0x2c0a54;}}function Ks(_0x4adcae){if(!_0x4adcae)return _0x4adcae;if(_0x4adcae['length']<=0x78)return _0x4adcae;const _0x3f57fb=_0x4adcae['slice'](0x0,0x78),_0xba0b20=_0x3f57fb['lastIndexOf']('\x20');return(_0xba0b20>0x0?_0x3f57fb['slice'](0x0,_0xba0b20):_0x3f57fb)+'…';}const Ys={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},$s='300px';class AIChatChipsOverflowManager{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0xf00c6f,_0x10feb5,_0x292f31,_0x17360a,_0x596a25){this['_locale']=_0xf00c6f,this['_visibleChips']=_0x10feb5,this['_config']={...Ys,..._0x292f31,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x292f31['cssClasses']}},this['_overflowChips']=new _t(),this['_bodyCollection']=_0x17360a,this['_parentView']=_0x596a25||null;}['setContainerElement'](_0xe70b5b){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0xe70b5b,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 _0x24fa7a=[...this['_visibleChips'],...this['_overflowChips']],_0x45617a=this['_createCalculationContainer'](),_0x3c3638=this['_calculateOverflowInContainer'](_0x45617a,_0x24fa7a),_0x1b61ef=_0x45617a['_ancestorsToRestore'];_0x1b61ef&&this['_restoreAncestorVisibility'](_0x1b61ef),_0x45617a['remove'](),this['_applyOverflowResults'](_0x24fa7a,_0x3c3638);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),jt({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x599225=new yt(this['_locale']);_0x599225['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x283e71=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x283e71['push'](this['_config']['cssClasses']['controlsButton']),_0x599225['extendTemplate']({'attributes':{'class':_0x283e71}}),_0x599225;}['_createShowMoreBalloonPanelView'](){const _0x31a579=new zt(this['_locale']);return _0x31a579['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x31a579),_0x31a579;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x558310=>{_0x558310['disableAnimationOnEnter']();});const _0x23774a=new Nt(this['_locale']);_0x23774a['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x23774a);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0x439a83=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0x439a83?'':'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'](_0xe67836){const _0x254ac1=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x395df5=this['_containerElement']?.['classList'];if(_0x395df5){const _0x391dcc=_0x395df5[0x0]||'',_0x212b24=_0xe67836['querySelector']('.'+_0x391dcc),_0x366ce6=_0xe67836['querySelector'](_0x254ac1);return _0x212b24||_0x366ce6||_0xe67836;}return _0xe67836['querySelector'](_0x254ac1)||_0xe67836;}['_calculateContainerWidth'](){const _0x4f35e2=this['_parentView']?.['element']||this['_containerElement'];if(!_0x4f35e2)return $s;const _0x263e60=window['getComputedStyle'](_0x4f35e2)['width'];if('auto'===_0x263e60||'0px'===_0x263e60||!_0x263e60){const _0x392b03=_0x4f35e2['parentElement'];if(_0x392b03){const _0x5b7b38=window['getComputedStyle'](_0x392b03);return'auto'!==_0x5b7b38['width']?_0x5b7b38['width']:$s;}return $s;}return _0x263e60;}['_applyCalculationStyles'](_0x127528,_0x2d560a){this['_config']['cssClasses']['calculationContainer']&&_0x127528['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x127528['style']['width']=_0x2d560a,_0x127528['style']['position']='absolute',_0x127528['style']['top']='-9999px',_0x127528['style']['left']='-9999px',_0x127528['style']['opacity']='0',_0x127528['style']['pointerEvents']='none',_0x127528['style']['zIndex']='-1',_0x127528['style']['visibility']='visible\x20!important',_0x127528['style']['display']='block\x20!important',_0x127528['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x1ca03a){_0x1ca03a['forEach'](({element:_0x3de4bc,originalDisplay:_0x185c7b,originalVisibility:_0x392cee})=>{_0x3de4bc['style']['display']=_0x185c7b,_0x3de4bc['style']['visibility']=_0x392cee;});}['_makeAncestorsVisible'](_0x43136d){const _0x580f2f=[];let _0x532b08=_0x43136d;for(;_0x532b08&&_0x532b08!==document['body'];){const _0x324454=window['getComputedStyle'](_0x532b08);'none'!==_0x324454['display']&&'hidden'!==_0x324454['visibility']||(_0x580f2f['push']({'element':_0x532b08,'originalDisplay':_0x532b08['style']['display'],'originalVisibility':_0x532b08['style']['visibility']}),_0x532b08['style']['display']='block',_0x532b08['style']['visibility']='visible'),_0x532b08=_0x532b08['parentElement'];}return _0x580f2f;}['_createContainerElements'](){let _0x2f308c,_0xdfb8bf;return this['_parentView']?.['element']?(_0x2f308c=this['_parentView']['element']['cloneNode'](!0x0),_0xdfb8bf=this['_findTargetContainer'](_0x2f308c)):(_0x2f308c=document['createElement']('div'),_0xdfb8bf=_0x2f308c),{'calculationContainer':_0x2f308c,'targetContainer':_0xdfb8bf};}['_createCalculationContainer'](){const {calculationContainer:_0x305b54,targetContainer:_0x2a6ca9}=this['_createContainerElements'](),_0x27b3f5=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x305b54,_0x27b3f5);const _0x210c08=this['_parentView']?.['element']||this['_containerElement'],_0x279066=_0x210c08?.['parentElement'];_0x279066?_0x279066['appendChild'](_0x305b54):document['body']['appendChild'](_0x305b54),_0x305b54['_targetContainer']=_0x2a6ca9;const _0xd40fda=this['_makeAncestorsVisible'](_0x279066||null);return _0x305b54['offsetWidth'],_0x305b54['_ancestorsToRestore']=_0xd40fda,_0x305b54;}['_calculateOverflowInContainer'](_0x562403,_0x22b8df){const _0x45da73=_0x562403['_targetContainer']||_0x562403,_0x5d5e5d=[],{rowCount:_0x53ca87}=this['_renderChipsAndCountRows'](_0x45da73,_0x22b8df);if(_0x53ca87<=this['_config']['maxVisibleRows'])return _0x5d5e5d;const _0x1a4291=_0x22b8df['slice']();for(;_0x1a4291['length']>0x0;){if(this['_testButtonFit'](_0x562403,_0x45da73,_0x1a4291)){const _0x4e5ca4=_0x22b8df['filter'](_0x578820=>!_0x1a4291['includes'](_0x578820));_0x5d5e5d['push'](..._0x4e5ca4);break;}if(!_0x1a4291['pop']())break;}return _0x5d5e5d;}['_renderChipsAndCountRows'](_0x265a00,_0x11d99a){_0x265a00['innerHTML']='',_0x11d99a['forEach'](_0x366dd6=>{if(_0x366dd6['element']){const _0x27f61e=_0x366dd6['element']['cloneNode'](!0x0);_0x265a00['appendChild'](_0x27f61e);}}),_0x265a00['offsetWidth'];const _0x4837b1=_0x265a00['children'],_0xdf1330=[];return Array['from'](_0x4837b1)['forEach'](_0x5a9491=>{const _0x4c496c=_0x5a9491['getBoundingClientRect']()['top'];_0xdf1330['some'](_0x5eaeb0=>Math['abs'](_0x5eaeb0-_0x4c496c)<this['_config']['rowDetectionTolerance'])||_0xdf1330['push'](_0x4c496c);}),{'rowCount':_0xdf1330['length']};}['_createMockButton'](){const _0x4d61e3=document['createElement']('button');return _0x4d61e3['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x4d61e3['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x4d61e3['textContent']='+\x201',_0x4d61e3;}['_testButtonFit'](_0x4d504c,_0xb3ed6d,_0x366795){this['_renderChipsAndCountRows'](_0xb3ed6d,_0x366795);const _0x45043e=this['_createMockButton']();_0x4d504c['appendChild'](_0x45043e),_0x4d504c['offsetWidth'];const _0x4da909=[..._0xb3ed6d['children'],_0x45043e],_0x46b88e=[];_0x4da909['forEach'](_0x96d126=>{const _0x50c7cd=_0x96d126['getBoundingClientRect']()['top'];_0x46b88e['some'](_0xbfaff0=>Math['abs'](_0xbfaff0-_0x50c7cd)<this['_config']['rowDetectionTolerance'])||_0x46b88e['push'](_0x50c7cd);});const _0x3e6f0e=_0x46b88e['length'];return _0x45043e['remove'](),_0x3e6f0e<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x1ebf9c,_0x449a87){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x1ebf9c['forEach'](_0xc6f3d4=>{_0x449a87['includes'](_0xc6f3d4)?this['_overflowChips']['add'](_0xc6f3d4):this['_visibleChips']['add'](_0xc6f3d4);});}['_updateOverflowUI'](_0x55bad0){if(_0x55bad0>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x55bad0>0x0&&this['_showMoreButtonView']){const _0x2fe1b2=''+this['_config']['showMoreLabelPrefix']+(_0x55bad0<0x63?_0x55bad0:'99');this['_showMoreButtonView']['label']=_0x2fe1b2;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x230c7e,_0x3fb33f){this['_distributeChips'](_0x230c7e,_0x3fb33f),this['_updateOverflowUI'](_0x3fb33f['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x72eff3=>{_0x72eff3[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 _0x55b3e7=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x55b3e7['width']||0x0===_0x55b3e7['height'])return!0x1;const _0x50e7cf=window['innerHeight']||document['documentElement']['clientHeight'],_0xe810c9=window['innerWidth']||document['documentElement']['clientWidth'],_0x31fe16=0xc8;return _0x55b3e7['bottom']>=-0xc8&&_0x55b3e7['top']<=_0x50e7cf+_0x31fe16&&_0x55b3e7['right']>=-0xc8&&_0x55b3e7['left']<=_0xe810c9+_0x31fe16;}}const qs='ck-ai-chat__feed__context-chips',Qs='ck-ai-chat-context-chips-wrapper',Xs='ck-ai-chat-context-chips-wrapper-balloon',zs='ck-ai-chat-controls-button',js='ck-ai-chat-controls_context_show-more-button',Js='ck-ai-chat-context-controls__show-more-balloon-panel';class AIChatFeedContextChipsView extends Nt{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x818597,_0x591f7e,_0xa0afae){super(_0x818597),this['_bodyCollection']=_0xa0afae,this['_createContextChips'](_0x591f7e);const _0x345e35={'cssClasses':{'showMoreButton':js+'\x20'+Gi,'showMoreBalloon':Js,'overflowContainer':Xs,'controlsButton':zs}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x818597,this['_contextChips'],_0x345e35,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[qs,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':Qs},'children':this['_contextChips']}]});}['render'](){super['render']();const _0xc6854d=this['element']['querySelector']('.'+Qs);_0xc6854d&&(this['_overflowManager']['setContainerElement'](_0xc6854d),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x41c8a5){for(const _0x28e516 of _0x41c8a5){const _0xfbc52c=new AIChatContextItemButtonView(this['locale'],_0x28e516,!0x0,!0x1);this['_contextChips']['add'](_0xfbc52c);}}}class AIChatFeedUserMessageItemView extends AIChatFeedItemView{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x2f8337,_0x565acf,_0x32d74e){super(_0x565acf),this['_locale']=_0x2f8337,this['_bodyCollection']=_0x32d74e,this['_createContextChipsView'](),this['_createMessageContentView'](),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__user-message']}});}['_createContextChipsView'](){this['options']['contextItems']&&this['options']['contextItems']['length']>0x0&&(this['_contextChipsView']=new AIChatFeedContextChipsView(this['_locale'],this['options']['contextItems']['filter'](_0x29cc6c=>!_0x29cc6c['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new Nt(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':['ck-reset_all-excluded','ck-ai-chat__feed__message-content','ck-ai-chat-content']}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}}class AIChatFeedInteractionHeaderView extends AIChatFeedItemView{['capabilities'];constructor(_0x4d1d4d,_0x3f5916){super(_0x3f5916);const {isWebSearchEnabled:_0x41a495,isReasoningEnabled:_0x5c14ee}=_0x3f5916['capabilities'],_0x48139c=[];let _0x211ba4='';_0x41a495&&_0x5c14ee?(_0x211ba4=Mi(_0x4d1d4d,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x48139c['push'](Zs(_0x513748)),_0x48139c['push'](Zs(_0x1374fb))):_0x41a495?(_0x211ba4=Mi(_0x4d1d4d,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x48139c['push'](Zs(_0x513748))):_0x5c14ee&&(_0x211ba4=Mi(_0x4d1d4d,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x48139c['push'](Zs(_0x1374fb))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x211ba4?'':'ck-hidden']}});const _0x2ac229=new Nt();_0x2ac229['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x48139c,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x211ba4]}]}),this['children']['add'](_0x2ac229),this['capabilities']=_0x3f5916['capabilities'];}}function Zs(_0x5cfd6d){const _0x2162dc=new Lt();return _0x2162dc['content']=_0x5cfd6d,_0x2162dc;}const tn=['wheel','touchstart','pointerdown','keydown'],en=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];class ScrollManager{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x1a38ff){this['element']=_0x1a38ff,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0xc336a of tn){const _0x1cc277='keydown'!==_0xc336a;this['element']['addEventListener'](_0xc336a,this['_onUserEvent']['bind'](this),{'passive':_0x1cc277,'signal':this['abortController']['signal']});}}['start']({smooth:_0x4b175e=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x4b175e?'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'](_0xd8d029){if(this['isRunning']){if('keydown'===_0xd8d029['type']){const _0x59d093=_0xd8d029['key'];if(!en['includes'](_0x59d093))return;}_0xd8d029 instanceof WheelEvent?_0xd8d029['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0xf4d91c,scrollHeight:_0xf9bb0e,clientHeight:_0x141bd7}=this['element'];return _0xf9bb0e-_0xf4d91c-_0x141bd7<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}}class AIChatFeedCustomElementView extends AIChatFeedItemView{constructor(_0x107581){super(_0x107581),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}}class AIChatFeedView extends Nt{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x231964,_0x2fc5d8){super(_0x231964),this['_bodyCollection']=_0x2fc5d8,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...Os)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new ScrollManager(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x5785bc,_0x517a33){let _0x36de01;return'ai-reply'===_0x5785bc?_0x36de01=new AIChatFeedReplyItemView(this['locale'],_0x517a33,this['_bodyCollection']):'ai-suggestion-reply'===_0x5785bc?(_0x36de01=new AIChatFeedSuggestionItemView(this['locale'],_0x517a33,this['_bodyCollection']),_0x36de01['bind']('isTrackChangesOn')['to'](this)):_0x36de01='user-message'===_0x5785bc?new AIChatFeedUserMessageItemView(this['locale'],_0x517a33,this['_bodyCollection']):'interaction-header'===_0x5785bc?new AIChatFeedInteractionHeaderView(this['locale'],_0x517a33):'custom-element'===_0x5785bc?new AIChatFeedCustomElementView(_0x517a33):new AIChatFeedErrorItemView(_0x517a33),this['children']['add'](_0x36de01),_0x36de01;}async['updateReplyItem']({id:_0x545af6,parsedContent:_0x32e3cc,renderingStrategy:_0x2b703a,abortSignal:_0x2bb37a}){const _0x36ad2f=this['getItemById'](_0x545af6);if(!(_0x36ad2f instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x36ad2f,'id':_0x545af6,'parsedContent':_0x32e3cc});await _0x36ad2f['updateContent']({'parsedContent':_0x32e3cc,'renderingStrategy':_0x2b703a,'abortSignal':_0x2bb37a});}async['updateWebSources'](_0x46997a,_0x3693d2){const _0x4c0b4b=this['getItemById'](_0x46997a);if(_0x4c0b4b instanceof AIChatFeedSuggestionItemView)_0x4c0b4b['updateSources'](_0x3693d2);else{if(!(_0x4c0b4b instanceof AIChatFeedReplyItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x4c0b4b,'id':_0x46997a,'sources':_0x3693d2});_0x4c0b4b['updateSources'](_0x3693d2);}}async['updateSuggestionItem']({id:_0x4a9e83,parts:_0x1b8ac0,abortSignal:_0x260471,skipLoadingEffects:_0x128f1a}){const _0xf02e22=this['getItemById'](_0x4a9e83);if(!(_0xf02e22 instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0xf02e22,'id':_0x4a9e83,'parts':_0x1b8ac0});await _0xf02e22['updateContent']({'parts':_0x1b8ac0,'abortSignal':_0x260471,'skipLoadingEffects':_0x128f1a});}['updateSuggestionPartState']({id:_0x4b0cd4,index:_0x347941,state:_0x5e3352}){const _0x5bbd05=this['getItemById'](_0x4b0cd4);if(!(_0x5bbd05 instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x4b0cd4});_0x5bbd05['updatePartState'](_0x347941,_0x5e3352);}['setSuggestionPartActive']({id:_0x47b5bf,index:_0x3f9615,isActive:_0x3a01f1}){const _0x1106ee=this['getItemById'](_0x47b5bf);if(!(_0x1106ee instanceof AIChatFeedSuggestionItemView))throw new ht('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x47b5bf});this['children']['filter'](_0x24d52f=>_0x24d52f instanceof AIChatFeedSuggestionItemView)['forEach'](_0x1ca3b0=>{_0x1ca3b0['setPartActive'](!0x1);}),_0x1106ee['setPartActive'](_0x3f9615,_0x3a01f1);}['markItemAsDone'](_0x124138){this['getItemById'](_0x124138)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0x2bd222=>_0x2bd222['options']['id']);}['removeItem'](_0x2d0c7b){this['children']['remove'](this['getItemById'](_0x2d0c7b));}['hasItem'](_0x143960){return!!this['children']['find'](_0x531e75=>_0x531e75['options']['id']['includes'](_0x143960));}['scrollToSuggestion'](_0x1a8192,_0x21c525){const _0x292c9c=this['getItemById'](_0x1a8192);if(!(_0x292c9c instanceof AIChatFeedSuggestionItemView))return void wt('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x1a8192,'partIndex':_0x21c525});const _0x5aa677=_0x292c9c['getPartView'](_0x21c525);_0x5aa677?Rt(_0x5aa677['element'],0x14,this['element']['parentElement'],!0x0,!0x0):wt('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x1a8192,'partIndex':_0x21c525});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x2e8c90=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x2e8c90,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x52bf53=new AISkeletonView(this['locale'],Ls['aiFeed']);return _0x52bf53['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x52bf53;}['_createFeedItems'](){const _0x1754f5=new Nt(this['locale']);return _0x1754f5['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x1754f5;}['_createFeedLoader'](){const _0x458d9c=new Nt(this['locale']);return _0x458d9c['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x54edf0=>!_0x54edf0)]},'children':this['_createLoaderChildren']()}),_0x458d9c;}['_createLoaderChildren'](){const _0xa0af21=new AISpinnerView();return _0xa0af21['isVisible']=!0x0,[_0xa0af21,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x20b75b){const _0x46f18b=this['children']['find'](_0x179483=>_0x179483['options']['id']['includes'](_0x20b75b));if(!_0x46f18b)throw new ht('ai-chat-feed-view-item-not-found',this,{'id':_0x20b75b});return _0x46f18b;}['setLoadingMessage'](_0x4ae20e){this['set']('loadingMessage',_0x4ae20e);}['toggleLoadingSkeleton'](_0x5be181){this['set']('isLoadingSkeletonVisible',_0x5be181);}['startAutoScroll'](_0x86a87e={}){this['scrollManager']['start'](_0x86a87e);}['stopAutoScroll'](){this['scrollManager']['stop']();}}class AIChatPromptSuggestionsListView extends Dt{['filter'](){let _0x47ebbe=0x0;for(const _0xbd529e of this['items'])_0x47ebbe+=_0xbd529e['items']['length'];return{'resultsCount':_0x47ebbe,'totalItemsCount':_0x47ebbe};}}function sn(_0x383644){const _0x366c11=[];let _0x1c1331=!0x1;for(const _0x546052 of Array['from'](_0x383644['items'])){if('file'!==_0x546052['kind'])continue;const _0xb8d3f0=_0x546052['webkitGetAsEntry']();if(_0xb8d3f0?.['isDirectory']){_0x1c1331=!0x0;continue;}const _0x419a97=_0x546052['getAsFile']();_0x419a97&&_0x366c11['push'](_0x419a97);}return{'files':_0x366c11,'hasDirectory':_0x1c1331};}const nn='ck-ai-chat__prompt-input_highlighted';class AIChatPromptInputView extends Pt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x2138d3,_0xd741f8){super(_0x2138d3,{'queryView':{'label':'','creator':Bt,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new AIChatPromptSuggestionsListView(_0x2138d3),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0xd741f8,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',(_0x1a2646,_0x183d2c)=>!_0x1a2646&&!_0x183d2c),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x31be79,_0x1f7d3a)=>{this['isUploadInProgress']||this['isEmpty']||_0x31be79['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x1f7d3a());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x37b1f8=>this['_handlePaste'](_0x37b1f8)),this['element']['addEventListener']('drop',_0x4192f0=>this['_handleDrop'](_0x4192f0));}['_handlePaste'](_0x292c84){const _0xebe155=_0x292c84['clipboardData'];if(!_0xebe155)return;const {files:_0x4693d7,hasDirectory:_0x54dfb8}=sn(_0xebe155),_0x5638eb={'files':_0x4693d7,'plainText':_0xebe155['getData']('text/plain'),'hasDirectory':_0x54dfb8,'forceTextAttachment':!0x1,'preventDefault':()=>_0x292c84['preventDefault']()};this['fire']('promptInputPaste',_0x5638eb);}['_handleDrop'](_0x3e1a5e){const _0x45c0e5=_0x3e1a5e['dataTransfer'];if(!_0x45c0e5)return;const _0xc1961a={'files':[],'plainText':_0x45c0e5['getData']('text/uri-list')||_0x45c0e5['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x3e1a5e['preventDefault']()};this['fire']('promptInputPaste',_0xc1961a);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x5c91eb=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x5c91eb)return this['queryView']['errorText']=Mi(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x454492=_0x40ab4b(_0x5c91eb);this['fire']('sendUserMessage',_0x454492),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x55c420){this['queryView']['fieldView']['set']('placeholder',_0x55c420);}['focus'](_0x353bbc=!0x1){super['focus'](),_0x353bbc&&(this['element']['classList']['contains'](nn)||(this['element']['classList']['add'](nn),setTimeout(()=>{this['element']['classList']['remove'](nn);},0x320)));}['_createSubmitButton'](){const _0x26fdf1=new yt(this['locale']);return _0x26fdf1['set']({'icon':_0x47b078,'label':Mi(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+Ui,'isEnabled':!0x1}),_0x26fdf1['on']('execute',()=>{this['submit']();}),_0x26fdf1;}['setIsUploadInProgress'](_0x4f1502){this['isUploadInProgress']=_0x4f1502;}['_setUpAddContextButtonPositioning'](){const _0x43580a=this['locale'],_0x4a3bc9=()=>{lt['window']['requestAnimationFrame'](()=>{if(ut(this['element'])){const _0xd63c2d=new dt(this['queryView']['fieldView']['element']),_0x2a6f75=new dt(this['_addContextButtonView']['element']),_0x3cb209=_0xd63c2d['width'],_0x1a6f73='rtl'===_0x43580a['uiLanguageDirection']?'right':'left';_0xd63c2d['excludeScrollbarsAndBorders']();const _0x9ca749=_0x3cb209-_0xd63c2d['width']+0x1;this['_addContextButtonView']['element']['style'][_0x1a6f73]='calc('+(_0x3cb209-_0x2a6f75['width']-_0x9ca749)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x4a3bc9),this['on']('render',()=>{_0x4a3bc9(),this['_queryViewResizeObserver']=new bt(this['queryView']['fieldView']['element'],()=>{_0x4a3bc9();});});}}class AIChatDropZoneView extends Nt{constructor(_0x462ed4){super(_0x462ed4);const _0x46044c=new Lt();_0x46044c['content']=_0x37fe61,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0x46044c,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':Mi(_0x462ed4,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x5dda54){let _0x2e0d1f=0x0;_0x5dda54['addEventListener']('dragenter',_0x212203=>{_0x212203['dataTransfer']&&(_0x2e0d1f++,0x1===_0x2e0d1f&&this['fire']('dragEnter'),_0x5dda54['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x5dda54['addEventListener']('dragover',_0x3f76a5=>{_0x3f76a5['dataTransfer']&&_0x3f76a5['preventDefault']();}),_0x5dda54['addEventListener']('dragleave',()=>{--_0x2e0d1f<=0x0&&(_0x2e0d1f=0x0,_0x5dda54['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x5dda54['addEventListener']('drop',_0x215c77=>{_0x215c77['preventDefault'](),_0x2e0d1f=0x0,_0x5dda54['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x215c77);});}['_handleDrop'](_0x588dd3){const _0x530fb8=_0x588dd3['dataTransfer'];if(!_0x530fb8)return;const {files:_0x5efbd4,hasDirectory:_0x55f958}=sn(_0x530fb8),_0x204bb9={'files':_0x5efbd4,'plainText':_0x530fb8['getData']('text/uri-list')||_0x530fb8['getData']('text/plain'),'hasDirectory':_0x55f958,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x204bb9);}}const rn='ck-ai-chat__prompt-capabilities',on='ck-ai-chat-controls-button',an='ck-ai-chat-controls-button--commands',hn='ck-ai-chat-controls__model-selection',cn='ck-ai-chat-controls__model-selection__item-name',ln='ck-ai-chat-controls__model-selection__item-description',un='ck-ai-chat-controls__model-selection__item-capabilities',dn='n';class AIChatPromptCapabilitiesView extends Nt{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x4898d6){super(_0x4898d6),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x449c3a=>'selector'===_0x449c3a),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x326780=>_0x326780?this['_modelSelectionDropdown']['buttonView']['label']:Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x3e0e68=>_0x3e0e68),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x1ef87b=>_0x1ef87b),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x228ee1=>Mi(this['locale'],_0x228ee1?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x8ad520=>_0x8ad520),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x197ebd=>Mi(this['locale'],_0x197ebd?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[rn]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new _t(),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x5cea30,_0x29ded7){if(_0x29ded7)this['set']('modelDisplayMode','hidden');else{const _0x2668c2=0x1===_0x5cea30['length'];this['set']('modelDisplayMode',_0x2668c2?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x5cea30?.['length'])for(const _0x34f018 of _0x5cea30){const _0x4f9ae8=new Zt({'label':_0x34f018['name'],'withText':!0x0,'role':'menuitemradio','id':_0x34f018['id'],'model':_0x34f018});_0x4f9ae8['bind']('isOn')['to'](this,'activeModelId',_0x2a2283=>_0x2a2283===_0x34f018['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x4f9ae8,'labelView':new _n(this['locale'],_0x34f018)});}}['setWebSearch'](_0x179b20){this['set']('webSearchActive',_0x179b20);}['setReasoning'](_0x4a79e1){this['set']('reasoningActive',_0x4a79e1);}['setModel'](_0x557207){if(!_0x557207)return;this['activeModelId']=_0x557207['id'],this['activeModelName']=_0x557207['name']||_0x557207['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x557207['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x557207['name']);const _0x15ed5d=_0x557207['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x15ed5d),this['_webSearchButton']['set']('isVisible',_0x15ed5d);const _0x7c66a2=_0x557207['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x7c66a2),this['_reasoningButton']['set']('isVisible',_0x7c66a2);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x3c52ca){this['set']('modelSelectorEnabled',!0x1),_0x3c52ca&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x55f9af=new yt();return _0x55f9af['set']({'label':Mi(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':_0x513748,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0x55f9af['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x55f9af;}['_createReasoningButton'](){const _0x32e161=new yt();return _0x32e161['set']({'label':Mi(this['locale'],'AI_CHAT_REASONING'),'icon':_0x1374fb,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltipPosition':dn}),_0x32e161['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x32e161;}['_createCommandsButton'](){const _0x3ffdf5=new yt();return _0x3ffdf5['set']({'label':Mi(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x20b2e3,'withText':!0x0,'class':on+'\x20'+Gi,'isToggleable':!0x0,'tooltip':Mi(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':dn}),_0x3ffdf5['extendTemplate']({'attributes':{'class':[an]}}),_0x3ffdf5['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x3ffdf5;}['_createModelSelectionDropdown'](){const _0x151e39=Ft(this['locale']);return _0x151e39['set']({'panelPosition':'ne','class':[hn]}),_0x151e39['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':dn,'class':Gi}),this['listenTo'](_0x151e39,'execute',_0x10c7ba=>{this['fire']('selectModel',_0x10c7ba['source']['model']);}),_0x151e39;}['_createModelNameView'](){const _0x28147d=new In(this['locale']);return _0x28147d['bind']('text')['to'](this,'activeModelName',_0x5960a0=>_0x5960a0??''),_0x28147d['bind']('isVisible')['to'](this,'modelDisplayMode',_0x363616=>'name'===_0x363616),_0x28147d;}}let _n=class ModelButtonLabelView extends Mt{constructor(_0x504b66,_0x52ffe9){super();const _0x1efd9c=this['bindTemplate'],_0x45c5c4=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x1efd9c['to']('style'),'id':_0x1efd9c['to']('id')},'children':[{'tag':'div','attributes':{'class':[cn]},'children':[{'text':_0x1efd9c['to']('text')}]},{'tag':'div','attributes':{'class':[ln]},'children':[{'tag':'span','children':[{'text':_0x52ffe9['description']}]}]},{'tag':'div','attributes':{'class':[un]},'children':_0x45c5c4}]}),_0x45c5c4['addMany'](this['_getCapabilityParts'](_0x504b66,_0x513748,'AI_CHAT_SEARCH_WEB',_0x52ffe9['capabilities']['webSearch']?.['enabled']??!0x1)),_0x45c5c4['addMany'](this['_getCapabilityParts'](_0x504b66,_0x1374fb,'AI_CHAT_REASONING',_0x52ffe9['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x2877b6,_0x5875b5,_0x2fce5d,_0x4c2910){const _0x3b5bf9=new Lt();_0x3b5bf9['content']=_0x5875b5;const _0x448581=new Nt(_0x2877b6);_0x448581['setTemplate']({'tag':'span','children':[{'text':Mi(_0x2877b6,_0x2fce5d)+':\x20'}]});const _0x3529cd=new Nt(_0x2877b6);return _0x3529cd['setTemplate']({'tag':'span','children':[{'text':Mi(_0x2877b6,_0x4c2910?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x3b5bf9,_0x448581,_0x3529cd];}},In=class ModelNameView extends Nt{constructor(_0x28d9d3){super(_0x28d9d3),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x57271b=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x57271b['if']('isVisible','ck-hidden',_0x5da0e4=>!_0x5da0e4)]},'children':[{'text':_0x57271b['to']('text')}]});}};const An='ck-ai-chat-context-controls__url-form',gn='ck-ai-chat-context-controls__url-input-section';class AIChatContextPanelUrlInputView extends Nt{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0x244e5d){super(_0x244e5d),this['focusTracker']=new It(),this['keystrokes']=new At(),this['backButton']=this['_createBackButton'](),this['urlInputField']=this['_createUrlInputField'](),this['confirmButton']=this['_createConfirmButton'](),this['_focusables']=this['createCollection']([this['backButton'],this['urlInputField'],this['confirmButton']]),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift+tab','focusNext':'tab'}}),this['set']('withBackButton',!0x0),this['_setupTemplate'](),this['_setupEventHandlers'](),this['_setupKeystrokes']();}['render'](){super['render'](),this['_focusables']['forEach'](_0x6c6952=>{this['focusTracker']['add'](_0x6c6952['element']),this['keystrokes']['listenTo'](_0x6c6952['element']);}),te({'view':this}),this['focus']();}['destroy'](){super['destroy'](),this['focusTracker']['destroy'](),this['keystrokes']['destroy']();}['focus'](){this['urlInputField']['focus']();}['getValue'](){return this['urlInputField']['fieldView']['element']?.['value']?.['trim']()||'';}['clear'](){this['urlInputField']['fieldView']['element']['value']='',this['urlInputField']['errorText']=null,this['confirmButton']['isEnabled']=!0x1;}['setError'](_0x23e11d){this['urlInputField']['errorText']=_0x23e11d,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x335f35=new yt(this['locale']);return _0x335f35['set']({'icon':_0x5117cf,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0xa5a09e,_0xae4cea,_0x29fc47)=>{_0x335f35['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x29fc47?'':'\x20ck-hidden')]});}),_0x335f35;}['_createUrlInputField'](){const _0x413005=new _0x19464f(this['locale'],_0x537cde);return _0x413005['set']({'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0x413005['fieldView']['set']({'placeholder':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0x413005;}['_createConfirmButton'](){const _0x474ce5=new yt(this['locale']);return _0x474ce5['set']({'icon':_0x17783f,'tooltip':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x474ce5;}['_setupTemplate'](){const _0x14b577=new _0x4fdc86(this['locale'],{'label':Mi(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x14b577['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':An,'tabindex':'-1'},'children':[_0x14b577,{'tag':'div','attributes':{'class':gn},'children':[this['urlInputField'],this['confirmButton']]}]});}['_setupEventHandlers'](){this['backButton']['on']('execute',()=>{this['clear'](),this['fire']('cancel');}),this['urlInputField']['fieldView']['on']('input',()=>{this['clearError'](),this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}),this['on']('submit',_0x4781a5=>{_0x4781a5['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x2c146f,_0xb1ce31)=>{this['clear'](),this['fire']('cancel'),_0xb1ce31();});}['_handleSubmit'](){const _0x58c779=this['getValue']()['trim']();_0x58c779?this['_isValidUrl'](_0x58c779)?(this['clearError'](),this['fire']('submitUrl',_0x58c779)):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](Mi(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x29698b=this['getValue']()['trim'](),_0x3fb59b=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x29698b['length']>0x0&&!_0x3fb59b;}['_isValidUrl'](_0x8bb53){try{return!!new URL(_0x8bb53);}catch{return!0x1;}}}const wn='ck-ai-chat-resources__item',Cn='ck-ai-chat-resources__item--in-context',mn='ck-ai-chat-resources__item-title',pn='ck-ai-chat-resources__item__icon';class AIChatResourceListItemView extends Ht{['resource'];['_titleView'];['_iconView'];constructor(_0x480881,_0x11ebdd){super(_0x480881),this['resource']=_0x11ebdd,this['set']('isInContext',!!_0x11ebdd['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x3abdb3){if(_0x3abdb3['isInContext'])return _0x17783f;switch(_0x3abdb3['type']){case'document':return _0x4c737b;case'web-resource':return _0x17ea45;case'file':case'text':return _0x37fe61;default:return _0x38e8fc;}}['highlightText'](_0x38830e){if(!_0x38830e||''===_0x38830e['trim']())return void this['_titleView']['highlightText'](null);const _0x3a467d=new RegExp(_0x554003(_0x38830e),'gi');this['_titleView']['highlightText'](_0x3a467d);}['updateResourceState'](_0x2b0f90){this['resource']['isInContext']=_0x2b0f90,this['isInContext']=_0x2b0f90,this['_updateIcon']();}['_createTitleView'](){const _0x501992=new _0x5bc622();return _0x501992['text']=this['resource']['label'],_0x501992['extendTemplate']({'tag':'span','attributes':{'class':[mn]}}),_0x501992;}['_createIconView'](){const _0xfee35d=new Lt();return _0xfee35d['content']=this['getResourceIcon'](this['resource']),_0xfee35d;}['_setupTemplate'](){const _0x5cb567=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[wn,_0x5cb567['if']('isVisible','ck-hidden',_0x325327=>!_0x325327),_0x5cb567['if']('isInContext',Cn)]},'children':[{'tag':'div','attributes':{'class':[pn]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x5cb567['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}}const En='ck-ai-chat-resources__list';class AIChatContextResourcesListView extends Dt{['_source'];constructor(_0x329261,_0x15e2f9){super(_0x329261),this['_source']=_0x15e2f9,this['extendTemplate']({'attributes':{'class':[En]}});}['setResources'](_0x34ae76,_0x42abed){this['items']['clear']();let _0x2d0939=_0x34ae76;if(this['_source']['useDefaultFiltering']&&_0x42abed&&''!==_0x42abed['trim']()){const _0x522f0a=new RegExp(_0x42abed['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x2d0939=_0x34ae76['filter'](_0x9ea72a=>_0x522f0a['test'](_0x9ea72a['label']));}for(const _0x1f3c00 of _0x2d0939){const _0x176e13=new AIChatResourceListItemView(this['locale'],_0x1f3c00);_0x176e13['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x1f3c00);}),this['items']['add'](_0x176e13);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x42abed);}['highlightText'](_0x4ea87b){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x259e61=>{_0x259e61['highlightText'](_0x4ea87b);});}['updateResourceState'](_0x1911a7,_0x3999cc){for(const _0x2574e5 of this['items']){const _0x23462e=_0x2574e5;_0x23462e['resource']['id']===_0x1911a7&&_0x23462e['updateResourceState'](_0x3999cc);}}['_handleResourceSelection'](_0x42bfea,_0x3ef41d){this['fire']('addResourceToContext',{'source':_0x42bfea,'resource':_0x3ef41d});}}class AIChatContextResourcesSearchInputView extends _0x19464f{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x140486){const t=_0x140486['t'],_0x37aa21={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x537cde,'label':Mi(_0x140486,'AI_CHAT_SEARCH_RESOURCES')};super(_0x140486,_0x37aa21['creator']),this['label']=_0x37aa21['label'],this['_viewConfig']=_0x37aa21,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x140486,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x10db70){this['fire']('search',_0x10db70);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Lt(),this['iconView']['content']=_0x1491a6,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x3a7443,t){this['resetButtonView']=new yt(_0x3a7443),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x59fd32,'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',_0x2b3434=>!_0x2b3434),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}['_setupEventListeners'](){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}}class AIChatContextResourcesView extends Nt{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x23e799,_0x31aa98){super(_0x23e799),this['_source']=_0x31aa98['source'],this['_searchInputVisibleFrom']=_0x31aa98['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 _0x171c0b([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new AIChatContextResourcesSearchInputView(this['locale']);}['_createSearchSection'](){const _0x1c9f3d=new Nt(this['locale']);return _0x1c9f3d['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0xfe9e67,_0x367a7c)=>{this['loadResources'](_0x367a7c),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x367a7c);}),_0x1c9f3d;}['_createResourcesListView'](){const _0x1e6c99=new AIChatContextResourcesListView(this['locale'],this['_source']);return _0x1e6c99['delegate']('addResourceToContext')['to'](this),_0x1e6c99['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x1e6c99;}['_createSkeletonView'](){const _0x20acd0=new AISkeletonView(this['locale'],Ls['aiChatResources']);return _0x20acd0['bind']('isVisible')['to'](this,'isLoading'),_0x20acd0;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x1c8a5c){const _0x4aaeec=at();this['_latestLoadResourcesUid']=_0x4aaeec,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x1c8a5c,'uid':_0x4aaeec}),this['isLoading']=!0x0;}['setResources'](_0x12f356,_0x1ec733){if(_0x1ec733&&_0x1ec733!==this['_latestLoadResourcesUid'])return;const _0x2b5d3e=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x12f356,_0x2b5d3e),_0x12f356['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x160ff3,_0x150956){this['_resourcesListView']['updateResourceState'](_0x160ff3,_0x150956);}}const Tn='ck-ai-chat-context-controls__source-balloon-panel',fn='ck-button-icon\x20ck-button-back',Rn='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';class AIChatResourcesBalloonView{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x307c3c,_0x3daf34,_0x34255b){this['_locale']=_0x307c3c,this['_bodyCollection']=_0x3daf34,this['_config']=_0x34255b;}['showSourceResourcesBalloon']({source:_0x1e1d55,withBackButton:_0x59b079}){let _0x5d382b=this['_sourceResourceBalloons']['get'](_0x1e1d55['id']);_0x5d382b||(_0x5d382b=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x1e1d55['id'],_0x5d382b),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x5d382b)),this['_addSourceResourceContent']({'balloonPanel':_0x5d382b,'source':_0x1e1d55,'withBackButton':_0x59b079}),_0x5d382b['show']();const _0x3ca042=this['_config']['getTargetElement']();_0x3ca042&&_0x5d382b['pin']({'target':_0x3ca042,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x75858e,_0x28aa9a,_0x1d6323){const _0x5ba1ee=this['_sourceResourceBalloons']['get'](_0x75858e);if(!_0x5ba1ee)return;const _0x305f28=this['_getResourcesViewFromBalloon'](_0x5ba1ee);_0x305f28&&(_0x305f28['setResources'](_0x28aa9a,_0x1d6323),_0x305f28['once']('change:isLoading',()=>{_0x5ba1ee['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x141f5e){const _0x56666b=this['_sourceResourceBalloons']['get'](_0x141f5e);_0x56666b&&requestAnimationFrame(()=>{_0x56666b['hide'](),this['_sourceResourceBalloons']['delete'](_0x141f5e),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x530782 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x530782);}['isAnyResourceBalloonVisible'](){for(const _0x1df467 of this['_sourceResourceBalloons']['values']())if(_0x1df467['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x618f7f,_0xa154e9,_0x8a3be1){const _0x1774ed=this['_sourceResourceBalloons']['get'](_0x618f7f);if(!_0x1774ed||!_0x1774ed['isVisible'])return;const _0x623122=this['_config']['getTargetElement']();if(!_0x623122)return;_0x1774ed['pin']({'target':_0x623122,'limiter':this['_config']['getLimiterElement']()});const _0x3bf467=this['_getResourcesViewFromBalloon'](_0x1774ed);_0x3bf467&&_0x3bf467['updateResourceState'](_0xa154e9,_0x8a3be1);}['destroy'](){for(const _0x4db712 of this['_sourceResourceBalloons']['values']())_0x4db712['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x3bd883=new zt(this['_locale']);return _0x3bd883['extendTemplate']({'attributes':{'class':Tn}}),this['_bodyCollection']['add'](_0x3bd883),_0x3bd883;}['_addSourceResourceContent']({balloonPanel:_0x550ae5,source:_0x20a30b,withBackButton:_0x24beda}){_0x550ae5['content']['clear']();const _0x8b120=this['_createBalloonHeader']({'balloonPanel':_0x550ae5,'source':_0x20a30b,'withBackButton':_0x24beda});_0x550ae5['content']['add'](_0x8b120);const _0x378004=this['_createBalloonResourcesView'](_0x20a30b);_0x550ae5['content']['add'](_0x378004);}['_createBalloonHeader']({balloonPanel:_0x1e0e17,source:_0x5ade10,withBackButton:_0x31f1cd}){const _0x1da15b=new _0x4fdc86(this['_locale'],{'label':_0x5ade10['label'],'class':Rn});return _0x31f1cd&&_0x1da15b['children']['add'](this['_createBackButton'](_0x1e0e17),0x0),_0x1da15b;}['_createBackButton'](_0x2cd727){const _0x6f42f=new yt(this['_locale']);return _0x6f42f['set']({'icon':_0x5117cf,'tooltip':Mi(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':fn}),_0x6f42f['on']('execute',()=>{_0x2cd727['hide'](),this['_config']['onBackToContext']();}),_0x6f42f;}['_createBalloonResourcesView'](_0x1b2ca2){const _0x421f07=new AIChatContextResourcesView(this['_locale'],{'source':_0x1b2ca2,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x421f07['on']('loadSourceResources',(_0xa437c5,_0x464601)=>{this['_config']['onLoadSourceResources'](_0x464601);}),_0x421f07['on']('addResourceToContext',(_0x2345c5,_0x23d982)=>{this['_config']['onResourceSelected'](_0x23d982['source'],_0x23d982['resource']),this['closeSourceResourceBalloon'](_0x1b2ca2['id']);}),_0x421f07;}['_getResourcesViewFromBalloon'](_0x4a48fb){const _0x4f7c9a=_0x4a48fb['content']['get'](0x1);return _0x4f7c9a instanceof AIChatContextResourcesView?_0x4f7c9a:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x4a7834){jt({'emitter':_0x4a7834,'contextElements':[_0x4a7834['element']],'callback':()=>{_0x4a7834['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x4a7834['isVisible']});}}const bn=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],Sn='ck-ai-chat-context-controls',On='ck-ai-chat-context-controls__pending-contexts',vn='ck-ai-chat-context-controls__add-context-balloon-panel',kn='ck-ai-chat-context-controls__add-context-button',yn='ck-ai-chat-context-controls__url-balloon-panel',Nn='ck-ai-chat-context-controls__balloon-button',xn='ck-ai-chat-context-controls__balloon-button-source',Ln='ck-ai-chat-controls-button',Pn='ck-ai-chat-context-chips-wrapper-balloon',Dn='ck-ai-chat-controls_context_show-more-button',Vn='ck-ai-chat-context-controls__show-more-balloon-panel',Hn='ck-ai-chat',Mn=[zt['defaultPositions']['northArrowSouthWest'],zt['defaultPositions']['northArrowSouth'],zt['defaultPositions']['northArrowSouthEast'],zt['defaultPositions']['southArrowNorthWest'],zt['defaultPositions']['southArrowNorth'],zt['defaultPositions']['southArrowNorthEast']];class AIChatContextPanelView extends Nt{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x2c7eb0,_0x379786){super(_0x2c7eb0),this['bodyCollection']=_0x379786['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x2c7eb0),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x2c7eb0),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x2c7eb0),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x2c7eb0,_0x379786);const _0x57433a={'cssClasses':{'showMoreButton':Dn+'\x20'+Gi,'showMoreBalloon':Vn,'overflowContainer':Pn,'controlsButton':Ln}};this['_overflowManager']=new AIChatChipsOverflowManager(_0x2c7eb0,this['_currentContextsChips'],_0x57433a,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'](_0x233f14,_0x4176e6){const _0x46c660=this['_createContextButton'](_0x233f14,'current',!0x0,_0x4176e6);this['_addContextToCollection'](_0x46c660,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0x163eee){this['_removeContextFromCollection'](_0x163eee,this['_currentContextsChips']),this['_removeContextFromCollection'](_0x163eee,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0x37ce45,_0x456c6b){let _0x5baf54=this['_currentContextsChips']['find'](_0x3c2c40=>_0x3c2c40['id']===_0x37ce45);_0x5baf54||(_0x5baf54=this['_overflowManager']['overflowChips']['find'](_0xc2eee6=>_0xc2eee6['id']===_0x37ce45)),_0x5baf54&&(_0x5baf54['isLoading']=_0x456c6b);}['setConversationContext'](_0x304e7d){this['_conversationContextsChips']['clear']();for(const _0x3204a8 of _0x304e7d){const _0x1ae079=this['_createContextButton'](_0x3204a8,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x1ae079,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x460caf,_0x46c832,_0x4ef7c8){this['_resourcesBalloonView']['updateResourceState'](_0x460caf,_0x46c832,_0x4ef7c8);}['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:_0x137373,withBackButton:_0x26c06b}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x137373,'withBackButton':_0x26c06b}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x40f698,_0x3a3d11,_0x46a1c1,_0x26f47d){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x40f698,_0x46a1c1,_0x26f47d);}['closeSourceResourceBalloon'](_0x4e7335){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x4e7335),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x372fbd){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x372fbd),this['_setAddContextButtonEnabled'](_0x372fbd);}['_setAddContextButtonEnabled'](_0x2a1cf1){const _0x56fc7e=!_0x2a1cf1['document']['isHidden']&&_0x2a1cf1['document']['enabled'],_0x940fda=_0x2a1cf1['urls']['enabled'],_0x7f9bb4=_0x2a1cf1['files']['enabled'],_0x3cfd9f=_0x2a1cf1['sources']['length']>0x0,_0x2f525d=_0x2a1cf1['customItems']&&_0x2a1cf1['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x56fc7e||_0x940fda||_0x7f9bb4||_0x3cfd9f||_0x2f525d;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[Sn,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':On},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x3bdaf9){const _0x5c35d5=new yt(_0x3bdaf9);return _0x5c35d5['set']({'label':Mi(_0x3bdaf9,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':Ln+'\x20'+kn+'\x20'+Gi,'icon':_0x3de8dd,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x5c35d5;}['_createAddContextBalloonPanelView'](_0x5abdc4){return this['_createBaseBalloonPanel'](_0x5abdc4,vn);}['_createUrlBalloonPanelView'](_0x1ed6b6){const _0x51228a=this['_createBaseBalloonPanel'](_0x1ed6b6,yn);return this['_addUrlContent'](_0x51228a,_0x1ed6b6),_0x51228a;}['_createResourcesBalloonView'](_0x3679ac,_0x1b46ec){const _0x2691a6={'searchInputVisibleFrom':_0x1b46ec['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});},'onResourceSelected':(_0x147dd5,_0x5697d5)=>{this['fire']('addResourceToContext',{'source':_0x147dd5,'resource':_0x5697d5});},'onLoadSourceResources':_0x2da375=>{this['fire']('loadSourceResources',_0x2da375);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new AIChatResourcesBalloonView(_0x3679ac,_0x1b46ec['bodyCollection'],_0x2691a6);}['_getLimiterElement'](){return this['element']?.['closest']('.'+Hn)||document['body'];}['_createBaseBalloonPanel'](_0x25dbe6,_0x1eb33c){const _0x56829d=new zt(_0x25dbe6);return _0x56829d['extendTemplate']({'attributes':{'class':_0x1eb33c}}),this['bodyCollection']['add'](_0x56829d),_0x56829d;}['_setBalloonPanelContent'](_0x286100,_0x42d722,_0x33d195){if(_0x286100['content']['clear'](),!_0x33d195['document']['isHidden']&&_0x33d195['document']['enabled']){const _0x4a3bf8=this['_createBalloonButton'](_0x42d722,{'label':Mi(_0x42d722,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x4c737b});_0x4a3bf8['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x286100['content']['add'](_0x4a3bf8);}if(_0x33d195['urls']['enabled']){const _0x11ba2e=this['_createBalloonButton'](_0x42d722,{'label':Mi(_0x42d722,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x17ea45});_0x11ba2e['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_urlInputView']['focus']();}),_0x286100['content']['add'](_0x11ba2e);}if(_0x33d195['files']['enabled']){const _0x33bbde=new _0xb65483(_0x42d722);_0x33bbde['set']({'label':Mi(_0x42d722,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0x5a3ed7,'withText':!0x0,'tooltip':!0x0,'class':Nn,'allowMultipleFiles':!0x0}),_0x33bbde['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x33bbde['on']('done',(_0xd0ec8e,_0xabeaf7)=>{this['fire']('addFileToContext',_0xabeaf7);}),_0x33bbde['tooltip']=!0x0,_0x286100['content']['add'](_0x33bbde);}for(const _0x5deb3d of _0x33d195['sources']){const _0x340126=this['_createBalloonButton'](_0x42d722,{'label':_0x5deb3d['label'],'icon':_0x5deb3d['icon']||_0x38e8fc,'type':'source'});_0x286100['content']['add'](_0x340126),_0x340126['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x5deb3d,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x246744 of _0x33d195['customItems']||[]){const _0x257bd9=this['_createBalloonButton'](_0x42d722,{'label':_0x246744['label'],'icon':_0x246744['icon']||_0x38e8fc,'type':'customItem'});_0x286100['content']['add'](_0x257bd9),_0x257bd9['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x246744);});}this['_hasExactlyOneSource']=0x1===_0x286100['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x2860bb,_0x7bae3f){this['_urlInputView']=new AIChatContextPanelUrlInputView(_0x7bae3f),this['_urlInputView']['on']('submitUrl',(_0x463ff8,_0x1ce5e1)=>{this['_handleUrlSubmit'](_0x1ce5e1);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn});}),_0x2860bb['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x200713,_0x4fe700){const _0x11077c='source'===_0x4fe700['type']?new SourcesBalloonButtonView(_0x200713):new yt(_0x200713);return _0x11077c['set']({'label':_0x4fe700['label'],'icon':_0x4fe700['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':Nn}),_0x11077c;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){jt({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x3cb7b1){const _0x340deb=this['_addContextBalloonConfig'];_0x340deb['buttonView']['isOn']=_0x3cb7b1,_0x3cb7b1?_0x340deb['balloonView']['show']():_0x340deb['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x17e98d,buttonView:_0x3b56fb,hideMethod:_0x465bf0}=this['_addContextBalloonConfig'];jt({'emitter':_0x17e98d,'contextElements':[_0x17e98d['element'],_0x3b56fb['element']],'callback':()=>{_0x465bf0();},'activator':()=>_0x3b56fb['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x2ef7c9,_0x3e7470,_0x46df4e=!0x1,_0x2c8f38=!0x1){const _0x177290='conversation'===_0x3e7470||!0x0===_0x2ef7c9['isReadOnly'],_0x15b01d=new AIChatContextItemButtonView(this['locale'],_0x2ef7c9,_0x177290,_0x46df4e,_0x2c8f38);return _0x177290||_0x15b01d['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x15b01d['id']);}),_0x15b01d;}['_addContextToCollection'](_0x29cd35,_0x4aab85){_0x4aab85['add'](_0x29cd35,0x0);}['_removeContextFromCollection'](_0x39ab09,_0x3876ad){const _0xc763b6=_0x3876ad['find'](_0x11a05a=>_0x11a05a['id']===_0x39ab09);_0xc763b6&&_0x3876ad['remove'](_0xc763b6);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':Mn}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x23143c){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x23143c);}}class SourcesBalloonButtonView extends yt{['arrowView'];constructor(_0x25c79a){super(_0x25c79a),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[xn]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x65a0b6=new Lt();return _0x65a0b6['content']=_0x4c5fea,_0x65a0b6['extendTemplate']({'attributes':{'class':xn+'__arrow'}}),_0x65a0b6;}}class AIChatControlsLoaderView extends Nt{['_cancelButtonView'];['_loaderView'];constructor(_0x3d690b){super(_0x3d690b),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 _0x176719=new yt(this['locale']);return _0x176719['set']({'label':Mi(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':Bi+'\x20ck-ai-button-stop-generating','icon':_0x41314d}),_0x176719['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x176719;}['_createLoaderView'](){const _0x1d2df8=new Nt(this['locale']);return _0x1d2df8['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}}]},{'text':Mi(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x1d2df8;}}class AIChatControlsView extends Nt{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0xdefc5a,_0x2fcaec){super(_0xdefc5a),this['_filesEnabled']=_0x2fcaec['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0xdefc5a,{'bodyCollection':_0x2fcaec['bodyCollection'],'searchInputVisibleFrom':_0x2fcaec['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0xdefc5a),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0xdefc5a),this['_loaderView']=this['_createLoaderView'](_0xdefc5a),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0xdefc5a),this['_dropZoneView']=new AIChatDropZoneView(_0xdefc5a),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...bn)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x3d8511=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x3d8511['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x3d8511['if']('isLoading','ck-hidden',_0x41a78b=>_0x41a78b||!this['isModelAvailable']),_0x3d8511['if']('isModelAvailable','ck-hidden',_0x56ab8f=>!_0x56ab8f||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x3d8511['if']('isLoading','ck-hidden',_0x295361=>!_0x295361)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x3d8511['if']('isModelAvailable','ck-hidden',_0x49807a=>_0x49807a)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),jt({'emitter':this['_promptInputView'],'activator':()=>this['isLoading'],'contextElements':()=>[this['element']],'callback':()=>{this['_shouldRestorePromptInputFocus']=!0x1;}}),this['on']('change:isLoading',this['_handlePromptInputFocus'],{'priority':'low'});}['render'](){super['render'](),this['_filesEnabled']&&this['_dropZoneView']['attach'](this['element']);}['_createContextPanelView'](_0x471917,_0x584530){return new AIChatContextPanelView(_0x471917,_0x584530);}['_createPromptInputView'](_0x230e38){return new AIChatPromptInputView(_0x230e38,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x55edb9){return new AIChatPromptCapabilitiesView(_0x55edb9);}['_createLoaderView'](_0x413651){return new AIChatControlsLoaderView(_0x413651);}['_createModelUnavailableMessageView'](_0x40c397){const _0xfb3d5f=new AIChatModelUnavailableMessageView(_0x40c397);return _0xfb3d5f['delegate']('startConversation')['to'](this),_0xfb3d5f;}['_handlePromptInputFocus'](_0x598b47,_0x35bc59,_0x546e6f){_0x546e6f?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x5a55e8,_0x5f3d52){this['_contextPanelView']['addContextItem'](_0x5a55e8,_0x5f3d52);}['removeContextItem'](_0x271972){this['_contextPanelView']['removeContextItem'](_0x271972);}['setContextItemLoading'](_0x1ee54e,_0x319123){this['_contextPanelView']['setContextItemLoading'](_0x1ee54e,_0x319123);}['setIsUploadInProgress'](_0x3b8494){this['_promptInputView']['setIsUploadInProgress'](_0x3b8494);}['setConversationContext'](_0x55a109){this['_contextPanelView']['setConversationContext'](_0x55a109);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x24b183,_0x4b0246,_0x4ee805){this['_contextPanelView']['updateResourceState'](_0x24b183,_0x4b0246,_0x4ee805);}['setWebSearch'](_0x168e1c){this['_promptCapabilitiesView']['setWebSearch'](_0x168e1c);}['setReasoning'](_0x17bc3f){this['_promptCapabilitiesView']['setReasoning'](_0x17bc3f);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0xb0c229){this['_contextPanelView']['setAddContextOptions'](_0xb0c229);}['setInputPlaceholder'](_0x49fe88){this['_promptInputView']['setPlaceholderText'](_0x49fe88);}['setModelList'](_0x5846a2,_0x4e657f){this['_promptCapabilitiesView']['setModelList'](_0x5846a2,_0x4e657f);}['setModel'](_0x530c20){_0x530c20?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x530c20)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x50a4f9){this['_promptCapabilitiesView']['disableModelSelector'](_0x50a4f9);}['populateSourceResourceBalloon'](_0x4f3fbc,_0x3f1f3a,_0x48be3c,_0x3abbef){this['_contextPanelView']['populateSourceResourceBalloon'](_0x4f3fbc,_0x3f1f3a,_0x48be3c,_0x3abbef);}['closeSourceResourceBalloon'](_0x438a86){this['_contextPanelView']['closeSourceResourceBalloon'](_0x438a86);}['focusPromptInput'](_0x30a94a=!0x1){this['_promptInputView']['focus'](_0x30a94a);}['setPromptInputValue'](_0x4aafa9){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x4aafa9;}}class AIChatModelUnavailableMessageView extends Nt{constructor(_0x1f7e3d){super(_0x1f7e3d);const _0x3ae230=new yt(_0x1f7e3d);_0x3ae230['set']({'label':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x3ae230['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':Mi(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x3ae230]}]});}}class AIHeaderView extends _0x4fdc86{['resizeButton'];constructor(_0xe4852e,_0x3a2456){super(_0xe4852e,{'label':_0x3a2456['label'],'class':'ck-ai-header\x20'+_0x3a2456['class'],'icon':_0x3a2456['icon']}),this['set']('isMaximized',!0x1),_0x3a2456['content']&&this['children']['add'](_0x3a2456['content']),_0x3a2456['showResizeButton']&&(this['resizeButton']=Fi(_0xe4852e,this),this['children']['add'](this['resizeButton']));}}class AIDisclaimerView extends Nt{constructor(_0x371987){super(_0x371987),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':Mi(_0x371987,'AI_DISCLAIMER_TEXT')}]}]});}}function Un(_0x1861f9,_0x4cd2a3){const _0x18cb73=new yt(_0x1861f9);return _0x18cb73['set']({'label':Mi(_0x1861f9,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x2f87c6,'class':'ck-ai-chat__start-conversation\x20'+Bi}),_0x18cb73['on']('execute',()=>{_0x4cd2a3['fire']('startConversation');}),_0x18cb73;}class AIChatView extends Nt{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0x3f4df2,_0x41ad59){super(_0x3f4df2),this['_bodyCollection']=new Xt(_0x3f4df2),this['_bodyCollection']['attachToDom']();const _0x3e9d2f=Un(_0x3f4df2,this);this['chatHeader']=new AIHeaderView(_0x3f4df2,{'label':Mi(_0x3f4df2,'AI_CHAT_HEADING'),'icon':_0x51543d,'class':'ck-ai-header_chat','content':_0x3e9d2f,'showResizeButton':_0x41ad59['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new AIChatFeedView(_0x3f4df2,this['_bodyCollection']),this['chatFeed']['delegate'](...Os)['to'](this),this['chatControls']=new AIChatControlsView(_0x3f4df2,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x41ad59['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x41ad59['filesEnabled']}),this['chatControls']['delegate'](...Os)['to'](this),this['chatDisclaimer']=new AIDisclaimerView(_0x3f4df2),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0x3f4df2['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x5d85f2,_0x39c3e2,_0x3769e8,_0x25813f){this['chatControls']['populateSourceResourceBalloon'](_0x5d85f2,_0x39c3e2,_0x3769e8,_0x25813f);}['closeSourceResourceBalloon'](_0x30ba88){this['chatControls']['closeSourceResourceBalloon'](_0x30ba88);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}}class AIChatUI extends _0x915a98{static get['requires'](){return[AITabs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x4ce949){super(_0x4ce949);const _0x5273d0=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue(),this['_view']=new AIChatView(this['context']['locale'],{'showResizeButton':_0x5273d0['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'](_0x5273d0),this['_view']['delegate'](...Os)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x520292,{showDiff:_0x5b97e9})=>{this['showDiff']=_0x5b97e9;}),this['disableControls'](),_0x5273d0['view']['addTab']({'id':'chat','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0x51543d,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x5273d0['view'],'isMaximized',_0x38c6c7=>_0x38c6c7),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x37a757=>_0x37a757),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x2874dc){const _0x4f71eb=this['context']['config']['get']('ai.chat.welcomeMessage')??Mi(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x2874dc['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x4f71eb}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x6c3fe6,staticMessage:_0x53f222}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x6c3fe6,'initialContent':'<p>'+_0x53f222+'</p>'});});}async['addFeedItemUserMessage'](_0x4fd2fc){const _0x557b41=_0x4fd2fc['attributes']?.['displayedPrompt']||_0x4fd2fc['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x4fd2fc['contextItems']['values']()),'initialContent':'<p>'+_0x557b41+'</p>','id':_0x4fd2fc['id']});});}async['addFeedItemError']({errorMessage:_0x39665a,id:_0x3d86dd}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x39665a+'</p>','id':_0x3d86dd});});}async['addFeedItemAIReply'](_0x47fe83){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x47fe83['interactionId']+':'+_0x47fe83['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x15f39e){const _0x16b5f0=ms(this['context']),_0x53720e=_0x16b5f0['map'](_0x46f4cc=>_0x46f4cc['config']['get']('ai.availableReplyActions')||[...Ds]);let _0x10fd3b=_0x53720e['reduce']((_0x3b14c4,_0x153d51)=>_0x3b14c4['filter'](_0x282c7e=>_0x153d51['includes'](_0x282c7e)),_0x53720e[0x0]||[...Ds]);const _0x4902aa=_0x16b5f0['every'](_0x581d65=>_0x581d65['plugins']['has']('TrackChanges')),_0x1a3981=_0x16b5f0['map'](_0x629316=>_0x629316['commands']['get']('trackChanges'));return _0x4902aa?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x1a3981,'value',(..._0x2e4c55)=>_0x2e4c55['some'](_0x1accf6=>_0x1accf6))):_0x10fd3b=_0x10fd3b['filter'](_0x303dc1=>'insertSuggestion'!=_0x303dc1),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x15f39e['interactionId']+':'+_0x15f39e['id'],'areActionsDisabled':_0x15f39e['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x10fd3b}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x2008ab,_0xd91822){return this['_promiseQueue']['enqueue'](async()=>{const _0x5b023f=this['_view']['chatFeed']['children']['last'];if(_0x5b023f instanceof AIChatFeedInteractionHeaderView)return this['_view']['chatFeed']['children']['remove'](_0x5b023f),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x2008ab['id'],'capabilities':{'isWebSearchEnabled':_0x5b023f['capabilities']['isWebSearchEnabled']||_0xd91822['isWebSearchEnabled'],'isReasoningEnabled':_0x5b023f['capabilities']['isReasoningEnabled']||_0xd91822['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x2008ab['id'],'capabilities':_0xd91822});});}async['addFeedItemCustomElement'](_0x22358c,_0xdf97bc){let _0x260630;return await this['_promiseQueue']['enqueue'](async()=>{_0x260630=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x22358c,'id':_0xdf97bc});}),_0x260630;}['removeFeedItem'](_0x15f532){this['_view']['chatFeed']['removeItem'](_0x15f532);}['hasFeedItem'](_0x6d4465){return this['_view']['chatFeed']['hasItem'](_0x6d4465);}['updateFeedInteractionHeader'](_0x3ba9ce){const _0x2ae842=this['_view']['chatFeed']['children']['find'](_0x265042=>_0x265042['options']['id']==_0x3ba9ce['id']&&_0x265042 instanceof AIChatFeedInteractionHeaderView);_0x2ae842&&_0x2ae842['set']('isVisible',_0x3ba9ce['isVisible']);}async['updateFeedItemAIReplyContent'](_0x579e9a){const _0x2eb39b=_0x579e9a['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x474ebe=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x579e9a,'abortSignal':_0x474ebe,'renderingStrategy':_0x2eb39b}),_0x579e9a['isDone']&&this['markFeedItemAsDone'](_0x579e9a['id']);});}['updateFeedItemAIReplySources'](_0x43ef66,_0x5a0e3b){this['_view']['chatFeed']['updateWebSources'](_0x43ef66,_0x5a0e3b);}async['updateFeedItemAIReplySuggestionContent'](_0x4f19af){return this['_promiseQueue']['enqueue'](async _0x21eb98=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x4f19af,'abortSignal':_0x21eb98}),_0x4f19af['isDone']&&this['markFeedItemAsDone'](_0x4f19af['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x6199d2){this['_view']['chatFeed']['updateSuggestionPartState'](_0x6199d2);}['setFeedItemAIReplySuggestionPartActive'](_0x35892a){this['_view']['chatFeed']['setSuggestionPartActive'](_0x35892a);}['markFeedItemAsDone'](_0x568246){this['_view']['chatFeed']['markItemAsDone'](_0x568246);}['removeFeedInteraction'](_0x413c37){this['_view']['chatFeed']['getItemIds']()['filter'](_0x15f1fb=>_0x15f1fb['startsWith'](_0x413c37))['forEach'](_0x3d929e=>this['_view']['chatFeed']['removeItem'](_0x3d929e));}['startInteraction'](){const _0x558cbd=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x558cbd),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x408005){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x17516d=>_0x17516d['startsWith'](_0x408005['id']))['forEach'](_0x1ff729=>this['markFeedItemAsDone'](_0x1ff729)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x512cab,_0x720edf){this['_view']['chatControls']['addContextItem'](_0x512cab,_0x720edf);}['removeContextItem'](_0x29a114){this['_view']['chatControls']['removeContextItem'](_0x29a114);}['setContextItemLoading'](_0x346895,_0x47711a){this['_view']['chatControls']['setContextItemLoading'](_0x346895,_0x47711a);}['setIsUploadInProgress'](_0x3d93e4){this['_view']['chatControls']['setIsUploadInProgress'](_0x3d93e4);}['setConversationContext'](_0x54ad13){this['_view']['chatControls']['setConversationContext'](_0x54ad13);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x58e796,_0x5dbf80,_0x35455b){this['_view']['chatControls']['updateResourceState'](_0x58e796,_0x5dbf80,_0x35455b);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x48da0f){this['_view']['chatControls']['setAddContextOptions'](_0x48da0f);}['updateCapabilities'](_0x5b0380){this['_view']['chatControls']['setWebSearch'](_0x5b0380['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x5b0380['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x5b0380));}['setSelectedModel'](_0x211c37,_0x55258f){this['_view']['chatControls']['setModel'](_0x211c37),_0x55258f&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x5a9007){this['feedItemRenderingStrategy']=_0x5a9007;}['toggleLoadingSkeleton'](_0x5bd0e0){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x5bd0e0);}['resetConversationTitle'](){this['setConversationTitle'](Mi(this['context']['locale'],'AI_CHAT_HEADING'));}['setConversationTitle'](_0x91b7b8,_0x4b1999=!0x1){if(_0x4b1999&&!St()&&_0x91b7b8['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x91b7b8);this['_view']['chatHeader']['label']=_0x91b7b8;}['setLoadingMessage'](_0x44ae78){this['_view']['chatFeed']['setLoadingMessage'](_0x44ae78);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x507298){let _0x5a2e38=0x0;clearInterval(this['_titleAnimationInterval']),this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x507298[_0x5a2e38],_0x5a2e38++,_0x5a2e38===_0x507298['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x3f4ba7){return _0x3f4ba7['isWebSearchEnabled']&&_0x3f4ba7['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x3f4ba7['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x3f4ba7['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):Mi(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0xe6c19e){return _0xe6c19e?_0xe6c19e['isWebSearchEnabled']&&_0xe6c19e['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0xe6c19e['isWebSearchEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0xe6c19e['isReasoningEnabled']?Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):Mi(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x464924,_0x2ac856,_0x5e43bb,_0x1b3127){this['_view']['populateSourceResourceBalloon'](_0x464924,_0x2ac856,_0x5e43bb,_0x1b3127);}['closeSourceResourceBalloon'](_0x30d7b6){this['_view']['closeSourceResourceBalloon'](_0x30d7b6);}['setPromptInputValue'](_0x350da8){this['_view']['chatControls']['setPromptInputValue'](_0x350da8);}['focusPromptInput'](_0x12c6c9=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x12c6c9);}['scrollFeedToSuggestion'](_0x2076af,_0x4aba07){this['_view']['chatFeed']['scrollToSuggestion'](_0x2076af,_0x4aba07);}['startAutoScroll'](_0x559961={}){this['_view']['chatFeed']['startAutoScroll'](_0x559961);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}}class AIChatHistorySectionListView extends Dt{['sections'];constructor(_0x41c892,_0x482d6c){super(_0x41c892),this['sections']=_0x482d6c,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x3e51b4){let _0x1e9a2d=0x0,_0x41b15c=0x0;for(const _0x3756cb of this['sections']){const {resultsCount:_0x53fa64,totalItemsCount:_0x2d6acf}=_0x3756cb['filter'](_0x3e51b4);_0x1e9a2d+=_0x53fa64,_0x41b15c+=_0x2d6acf;}return{'resultsCount':_0x1e9a2d,'totalItemsCount':_0x41b15c};}}class AIChatHistoryListView extends Ht{['title'];['itemsViews'];['_itemsListView'];constructor(_0x47272b,{title:_0x5acae4,items:_0x2c984f}){super(_0x47272b);const _0x4df9d5=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x5acae4,this['itemsViews']=_0x2c984f;const _0x2a147a=new Nt(_0x47272b);_0x2a147a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new Dt(_0x47272b),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x4df9d5['if']('isVisible','ck-hidden',_0x38c1dd=>!_0x38c1dd)]},'children':[_0x2a147a,this['_itemsListView']]});}['filter'](_0xfc9a99){const _0x9758ae=this['itemsViews']['length'];let _0x368216=0x0;for(const _0x268184 of this['itemsViews']){if(_0xfc9a99){const _0x18accf=_0x268184['isMatching'](_0xfc9a99);_0x268184['isVisible']=!!_0x18accf,_0x268184['highlightText'](_0xfc9a99);}else _0x268184['isVisible']=!0x0,_0x268184['highlightText'](null);_0x268184['isVisible']&&_0x368216++;}return this['isVisible']=_0x368216>0x0,{'resultsCount':_0x368216,'totalItemsCount':_0x9758ae};}['getItem'](_0x401899){return this['itemsViews']['find'](_0xd210c1=>_0xd210c1['id']===_0x401899);}['removeItem'](_0x2a49dc){const _0x58cd64=this['itemsViews']['indexOf'](_0x2a49dc);-0x1!==_0x58cd64&&(this['itemsViews']['splice'](_0x58cd64,0x1),this['_itemsListView']['items']['remove'](_0x2a49dc));}}class AIChatHistoryListItemView extends/* #__PURE__ -- @preserve */
|
|
27
|
-
_0x382503(Ht){['id'];static ['LOADING_LABELS']={'remove':'AI_CHAT_HISTORY_LOADING_REMOVING','rename':'AI_CHAT_HISTORY_LOADING_RENAMING','pin':'AI_CHAT_HISTORY_LOADING_PINNING','unpin':'AI_CHAT_HISTORY_LOADING_UNPINNING'};['actions'];['mainContent'];['_titleView'];constructor(_0x1e3c32,_0xa8f2ea){super(_0x1e3c32);const _0xcf5a95=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0xa8f2ea['pinned']),this['set']('loadingState',null),this['set']('title',_0xa8f2ea['title']),this['id']=_0xa8f2ea['id'];const {createdAt:_0x160de3,active:_0x38227f=!0x1}=_0xa8f2ea;this['_titleView']=new _0x5bc622(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x414341=this['_createCheckView'](),_0x5797d7=this['_createPinButtonView'](_0x1e3c32),_0x2b1760=this['_createMenuDropdownView'](),_0x5b84ae=this['_createEditInputView'](_0x1e3c32),_0x3dbdeb=this['_createAcceptEditButtonView'](_0x1e3c32,_0x5b84ae),_0x56eedf=this['_createCancelEditButtonView'](_0x1e3c32);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0x5797d7),this['actions']['add'](_0x2b1760),this['on']('change:isEdit',(_0x2f0dd4,_0x2c36c8,_0x1ac319)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x1ac319?(this['actions']['add'](_0x3dbdeb),this['actions']['add'](_0x56eedf),this['mainContent']['add'](_0x5b84ae),_0x5b84ae['element']['value']=this['title']||'',_0x5b84ae['element']['focus']()):(this['actions']['add'](_0x5797d7),this['actions']['add'](_0x2b1760),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0x38227f?'ck-ai-chat-history__item--active':'',_0xcf5a95['if']('isVisible','ck-hidden',_0x5c7887=>!_0x5c7887),_0xcf5a95['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',_0xcf5a95['if']('loadingState','ck-hidden',_0x596d65=>!!_0x596d65)]},'children':_0x38227f?[_0x414341]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0xcf5a95['if']('loadingState','ck-hidden',_0x4bc988=>!_0x4bc988)]},'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',_0xcf5a95['if']('loadingState','ck-hidden',_0x32d575=>!!_0x32d575)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0xcf5a95['if']('loadingState','ck-hidden',_0x495fc2=>!_0x495fc2)]},'children':[{'text':_0xcf5a95['to']('loadingState',_0x13b5d8=>_0x13b5d8?Mi(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x13b5d8]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0x160de3]}]},{'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'](_0x482e24){this['set']('title',_0x482e24);}['updateLoadingState'](_0x12d28b,_0x478329){this['set']('loadingState',_0x478329?_0x12d28b:null);}['_createCheckView'](){const _0x18e83e=new Lt();return _0x18e83e['set']({'content':_0x17783f}),_0x18e83e;}['_createPinButtonView'](_0x2dd571){const _0x4e339c=new yt(_0x2dd571);return _0x4e339c['set']({'label':Mi(_0x2dd571,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x1b858f,'withText':!0x1,'tooltip':!0x0}),_0x4e339c['bind']('isOn')['to'](this,'pinned'),_0x4e339c['on']('execute',()=>{const _0x4dde72=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x4dde72});}),_0x4e339c;}['_createMenuDropdownView'](){const _0x2897c0=Ft(this['locale']),_0x39b020=_0x2897c0['panelView']['children'];_0x2897c0['buttonView']['set']({'label':Mi(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':_0x4b6af8}),_0x2897c0['panelPosition']='sw';const _0x5149ba=new yt(this['locale']);_0x5149ba['label']=Mi(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x5149ba['withText']=!0x0,_0x5149ba['on']('execute',()=>{this['isEdit']=!0x0;});const _0x5cc69a=new yt(this['locale']);_0x5cc69a['label']=Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x5cc69a['withText']=!0x0,_0x5cc69a['on']('execute',()=>{this['showConfirm'](Mi(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x1b5f4b=new Dt(this['locale']),_0x577207=new Ht(this['locale']);_0x577207['children']['add'](_0x5149ba);const _0x5b7bf2=new Ht(this['locale']);return _0x5b7bf2['children']['add'](_0x5cc69a),_0x1b5f4b['items']['addMany']([_0x577207,_0x5b7bf2]),_0x39b020['add'](_0x1b5f4b),_0x2897c0;}['_createEditInputView'](_0x4fdaa2){const _0x4005a0=new _0x5196ee(_0x4fdaa2),_0x1e2fcd=_0x4005a0['bindTemplate'];return _0x4005a0['extendTemplate']({'on':{'keydown':_0x1e2fcd['to'](_0x59923a=>{'Enter'==_0x59923a['key']&&this['_commitEditInputValue'](_0x4005a0);})}}),_0x4005a0;}['_createAcceptEditButtonView'](_0x3513f9,_0x186a8d){const _0x24e6a8=new yt(_0x3513f9);return _0x24e6a8['set']({'icon':_0x17783f,'withText':!0x1,'tooltip':Mi(_0x3513f9,'AI_CHAT_HISTORY_ACCEPT')}),_0x24e6a8['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x24e6a8['on']('execute',()=>{this['_commitEditInputValue'](_0x186a8d);}),_0x24e6a8;}['_commitEditInputValue'](_0x2eba28){const _0x1d71e6=_0x2eba28['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x1d71e6});}['_createCancelEditButtonView'](_0x4d1723){const _0x1216d8=new yt(_0x4d1723);return _0x1216d8['set']({'icon':_0x59fd32,'withText':!0x1,'tooltip':Mi(_0x4d1723,'AI_CHAT_HISTORY_CANCEL')}),_0x1216d8['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x1216d8['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x1216d8;}['_createSpinnerView'](){const _0x144f60=new AISpinnerView('tiny');return _0x144f60['isVisible']=!0x0,_0x144f60;}['isMatching'](_0x284314){return'string'==typeof this['title']&&this['title']['match'](_0x284314)?{'title':!0x0}:null;}['highlightText'](_0x168c7f){this['_titleView']['highlightText'](_0x168c7f);}}class AIChatHistoryView extends Nt{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x113a92,_0x24e479){super(_0x113a92),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x496aca=Un(_0x113a92,this);this['headerView']=new AIHeaderView(_0x113a92,{'label':Mi(_0x113a92,'AI_CHAT_HISTORY_HEADING'),'icon':_0x17e9ed,'class':'ck-ai-header_history','content':_0x496aca,'showResizeButton':_0x24e479}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new AIChatHistorySectionListView(_0x113a92,[]),this['sectionsView']['delegate'](...Bn)['to'](this),this['mainErrorView']=this['_createErrorView'](),this['skeletonView']=this['_createSkeletonView'](),this['emptyView']=this['_createEmptyStateView'](),this['searchView']=this['_createSearchView'](),this['mainErrorView']['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isMainErrorViewVisible','ck-hidden',_0x1aa602=>!_0x1aa602)]}}),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 _0x517cbc=new _0x590352(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x3c4906=>Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x3c4906),'secondary':Mi(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x12741f=this['_createErrorView']();return _0x12741f['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x526d9c=>!_0x526d9c)]}}),_0x517cbc['on']('render',()=>{_0x517cbc['children']['add'](_0x12741f,0x1);}),_0x517cbc['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x32e1ff=>!_0x32e1ff)]}}),_0x517cbc;}['_createSkeletonView'](){const _0x35f636=new AISkeletonView(this['locale'],Ls['aiHistory']);return _0x35f636['bind']('isVisible')['to'](this,'isLoading'),_0x35f636;}['_createErrorView'](){const _0x1d5e2e=new Nt(this['locale']),_0xe294ea=new yt(this['locale']);_0xe294ea['set']({'withText':!0x1,'icon':_0x59fd32,'class':'ck-ai-notification_error__dismiss-button'}),_0xe294ea['bind']('isVisible')['to'](this,'hasItems',_0x1f5527=>!!_0x1f5527),_0xe294ea['on']('execute',()=>{this['errorMessage']='';});const _0x988b0a=this['bindTemplate'];return _0x1d5e2e['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x988b0a['to']('errorMessage')}]},_0xe294ea]}),_0x1d5e2e;}['_createEmptyStateView'](){const _0x3984d2=new Nt(this['locale']);return _0x3984d2['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x13c6ec=>!_0x13c6ec)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[Mi(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x3984d2;}['_createListItemViews'](_0x43dcd2,_0x48aaf3){const _0x332b76=[];for(const _0x5903de of _0x43dcd2){const _0x2d378b=new AIChatHistoryListItemView(_0x48aaf3,_0x5903de);_0x2d378b['delegate'](...Bn)['to'](this),_0x332b76['push'](_0x2d378b);}return _0x332b76;}['updateHistoryItemsWithCategories'](_0x53d2c9){const _0x2d6a29=this['locale']||'en',_0x3640bd=[];for(const _0x3e1715 of _0x53d2c9){const _0x5250c5=this['_createListItemViews'](_0x3e1715['items'],_0x2d6a29);_0x3640bd['push'](new AIChatHistoryListView(_0x2d6a29,{'title':_0x3e1715['title'],'items':_0x5250c5}));}this['sectionsView']['sections']=_0x3640bd,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x3640bd),this['hasItems']=_0x53d2c9['some'](_0xc967ef=>_0xc967ef['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x8ae8d5){for(const _0x2afc08 of this['sectionsView']['sections']){const _0x220d1f=_0x2afc08['getItem'](_0x8ae8d5);if(_0x220d1f){if(_0x2afc08['removeItem'](_0x220d1f),0x0===_0x2afc08['itemsViews']['length']){const _0x581660=this['sectionsView']['sections']['indexOf'](_0x2afc08);-0x1!==_0x581660&&(this['sectionsView']['sections']['splice'](_0x581660,0x1),this['sectionsView']['items']['remove'](_0x2afc08));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x1bfa8f,_0x131fc5){for(const _0x498f22 of this['sectionsView']['sections']){const _0x594afd=_0x498f22['getItem'](_0x1bfa8f);if(_0x594afd){_0x594afd['updateTitle'](_0x131fc5);break;}}}['updateItemLoadingState'](_0x37bf62,_0xc58629,_0x1565bf){for(const _0x4a633f of this['sectionsView']['sections']){const _0x6225e5=_0x4a633f['getItem'](_0x37bf62);if(_0x6225e5){_0x6225e5['updateLoadingState'](_0xc58629,_0x1565bf);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x2b250f=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x2b250f);}}}const Bn=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];class AIChatHistoryUI extends _0x915a98{static get['requires'](){return[AITabs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x357c8b){super(_0x357c8b);const _0xfb8289=this['context']['plugins']['get']('AITabs');this['_historyView']=new AIChatHistoryView(this['context']['locale'],_0xfb8289['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0xfb8289),this['_historyView']['delegate'](...Bn)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0xfb8289['view'],'isMaximized',_0x4743f9=>_0x4743f9),_0xfb8289['view']['addTab']({'id':'history','buttonLabel':Mi(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x17e9ed,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0xdeea56){this['_historyView']['removeHistoryItem'](_0xdeea56);}['updateItems'](_0x1598c6){this['_historyView']['updateHistoryItemsWithCategories'](_0x1598c6);}['updateItemTitle'](_0xa4e85b,_0x39b99f){this['_historyView']['updateItemTitle'](_0xa4e85b,_0x39b99f);}['updateItemLoadingState'](_0x101711,_0x56f029,_0x31cd3e){this['_historyView']['updateItemLoadingState'](_0x101711,_0x56f029,_0x31cd3e);}['setLoadingSkeleton'](_0x59fc2b){this['_historyView']['isLoading']=_0x59fc2b;}['showError'](_0x4e0b31){this['_historyView']['errorMessage']=_0x4e0b31;}['hideError'](){this['_historyView']['errorMessage']='';}}class AIChatHistoryItem extends ct(){['id'];['createdAt'];constructor({id:_0x44d101,title:_0x5eab25,createdAt:_0x1974cb,updatedAt:_0x5a6285,pinned:_0x4c9af4}){super(),this['id']=_0x44d101,this['createdAt']=new Date(_0x1974cb),this['set']('title',_0x5eab25),this['set']('updatedAt',_0x5a6285?new Date(_0x5a6285):null),this['set']('pinned',_0x4c9af4||!0x1);}['updateTitle'](_0x2d4a4a){this['set']('title',_0x2d4a4a),this['updatedAt']=new Date();}['updatePinned'](_0x447c08){this['set']('pinned',_0x447c08),this['updatedAt']=new Date();}}class AIChatHistoryConversations extends Et(){['items']=[];['connector'];['group'];constructor({connector:_0x204308,group:_0x2270fe}){super(),this['connector']=_0x204308,this['group']=_0x2270fe;}async['init'](){try{const _0xc5877a=this['connector']['fetchConversations'](this['group']),_0x39ee6a=await _0xc5877a['getConversations']();this['loadItems'](_0x39ee6a);}catch(_0x1396ba){this['fire']('error',{'error':_0x1396ba,'operation':'init'});}}['addItem'](_0x4bbe97){this['items']['push'](_0x4bbe97);}async['removeItem'](_0x48e596){const _0x30ce43=this['items']['findIndex'](_0x354785=>_0x354785['id']===_0x48e596);if(-0x1===_0x30ce43)return!0x1;try{return await this['connector']['deleteConversation'](_0x48e596)['execute'](),this['items']['splice'](_0x30ce43,0x1),this['fire']('itemRemoved',{'itemId':_0x48e596}),!0x0;}catch(_0x508981){return this['fire']('error',{'error':_0x508981,'operation':'removeItem','itemId':_0x48e596}),!0x1;}}['getItem'](_0x504f8b){return this['items']['find'](_0x4d82de=>_0x4d82de['id']===_0x504f8b);}async['updateItemTitle'](_0x431195,_0x5bee25){const _0x566de2=this['getItem'](_0x431195);if(!_0x566de2)return!0x1;try{return await this['connector']['updateConversation'](_0x431195,{'title':_0x5bee25})['getResult'](),_0x566de2['updateTitle'](_0x5bee25),this['fire']('itemUpdated',{'itemId':_0x431195,'updates':{'title':_0x5bee25}}),!0x0;}catch(_0xdbe4e4){return this['fire']('error',{'error':_0xdbe4e4,'operation':'updateItemTitle','itemId':_0x431195}),!0x1;}}async['updateItemPinned'](_0x474731,_0x267113){const _0x14d2da=this['getItem'](_0x474731);if(!_0x14d2da)return!0x1;try{return await this['connector']['updateConversation'](_0x474731,{'pinned':_0x267113})['getResult'](),_0x14d2da['updatePinned'](_0x267113),this['fire']('itemUpdated',{'itemId':_0x474731,'updates':{'pinned':_0x267113}}),!0x0;}catch(_0x3518c2){return this['fire']('error',{'error':_0x3518c2,'operation':'updateItemPinned','itemId':_0x474731}),!0x1;}}['loadItems'](_0x1de324){try{this['items']=[],_0x1de324['map'](_0x21eb08=>{this['addItem'](new AIChatHistoryItem(_0x21eb08));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x20cf75){this['fire']('error',{'error':_0x20cf75,'operation':'loadItems'});}}['getItems'](_0x559445={}){const _0x1745be=void 0x0!==_0x559445['pinned']&&_0x559445['pinned'],_0x3411b3=_0x559445['from']?new Date(_0x559445['from']['getFullYear'](),_0x559445['from']['getMonth'](),_0x559445['from']['getDate']()):null,_0x1945df=_0x559445['to']?new Date(_0x559445['to']['getFullYear'](),_0x559445['to']['getMonth'](),_0x559445['to']['getDate']()):null;return this['items']['filter'](_0x52180b=>{if(_0x52180b['pinned']!==_0x1745be)return!0x1;if(_0x1945df){const _0x1eb70c=new Date(_0x52180b['createdAt']['getFullYear'](),_0x52180b['createdAt']['getMonth'](),_0x52180b['createdAt']['getDate']());return _0x3411b3?_0x3411b3['getTime']()===_0x1945df['getTime']()?_0x1eb70c['getTime']()===_0x3411b3['getTime']():_0x1eb70c<_0x1945df&&_0x1eb70c>=_0x3411b3:_0x1eb70c<_0x1945df;}return!0x0;});}}class AIChatHistoryController extends _0x915a98{['_aiConnector'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[AIConnector,AIChatController,AIChatHistoryUI,AITabs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](AIConnector),this['_aiChatHistoryUi']=this['context']['plugins']['get'](AIChatHistoryUI),this['_aiChatController']=this['context']['plugins']['get'](AIChatController);const _0xb52b60=this['context']['plugins']['get'](AITabs);try{const _0x2dc17f=this['_aiChatController']['getGroupId']();this['history']=new AIChatHistoryConversations({'connector':this['_aiConnector'],'group':_0x2dc17f}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x386a0e,_0x1fe8b9)=>{this['_setItemLoading'](_0x1fe8b9['id'],'remove'),this['_handleRemove'](_0x1fe8b9['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x390b79,_0x43be0c)=>{this['_setItemLoading'](_0x43be0c['id'],'rename'),this['_handleEditTitle'](_0x43be0c['id'],_0x43be0c['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x174b2d,_0x26f22a)=>{void 0x0!==_0x26f22a['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x26f22a['itemId'],_0x26f22a['updates']['title']),void 0x0!==_0x26f22a['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x26f22a['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x28a31a,_0x3f04a8)=>{this['_aiChatController']['_handleRemovedConversation'](_0x3f04a8['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x3f04a8['itemId']),this['_clearItemLoading'](_0x3f04a8['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x37eaeb,_0x37b223)=>{this['_handleHistoryErrorUI'](_0x37b223['error'],_0x37b223['operation'],_0x37b223['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x23a3e8,_0x4dd6bd)=>{this['_handleSelectConversation'](_0x4dd6bd['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x51065e,_0x470a95)=>{const _0x50bb39=_0x470a95['pinned']?'pin':'unpin';this['_setItemLoading'](_0x470a95['id'],_0x50bb39),this['_handleTogglePin'](_0x470a95['id'],_0x470a95['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0xb52b60['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0xb52b60['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x4589eb){this['_handleHistoryErrorUI'](_0x4589eb,'init');}}async['_handleEditTitle'](_0x58e2f1,_0x2b29e9){await this['history']['updateItemTitle'](_0x58e2f1,_0x2b29e9);}async['_handleTogglePin'](_0x1734fe,_0x1e1421){await this['history']['updateItemPinned'](_0x1734fe,_0x1e1421);}async['_handleRemove'](_0x43db4c){await this['history']['removeItem'](_0x43db4c);}async['_handleSelectConversation'](_0x342bb7){await this['_aiChatController']['loadConversation'](_0x342bb7);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x4ba2ab=this['_aiChatController']['activeConversation']?.['id'],_0xb82ae4=this['_getCategorizedItems']()['map'](_0x176387=>({'title':_0x176387['title'],'items':_0x176387['items']['map'](_0x10836b=>({'id':_0x10836b['id'],'title':_0x10836b['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x10836b['createdAt'])['toLocaleDateString'](),'active':_0x10836b['id']===_0x4ba2ab,'pinned':_0x10836b['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0xb82ae4);}['_setItemLoading'](_0x42ccb0,_0x38b591){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x42ccb0,_0x38b591,!0x0);}['_clearItemLoading'](_0x270012){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x270012,null,!0x1);}['_handleHistoryErrorUI'](_0x2a74e1,_0x3f7692,_0x113702){const _0x494df4=this['_generateErrorMessage'](_0x3f7692,_0x113702);this['_aiChatHistoryUi']['showError'](_0x494df4),_0x113702&&this['_clearItemLoading'](_0x113702),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x11fcdf,_0x27b50c){const _0x34eadc=_0x27b50c?this['history']['getItem'](_0x27b50c):null,_0x530108=_0x34eadc?.['title']||Mi(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x11fcdf){case'updateItemTitle':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x530108);case'updateItemPinned':{const _0x3db432=Mi(this['context']['locale'],_0x34eadc?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x3db432,_0x530108]);}case'removeItem':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x530108);case'init':case'loadItems':return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return Mi(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x190705=new Date(),_0x951cfd=new Date(_0x190705['getFullYear'](),_0x190705['getMonth'](),_0x190705['getDate']()),_0x30af85=new Date(_0x951cfd);_0x30af85['setDate'](_0x30af85['getDate']()-0x1);const _0x520cd9=new Date(_0x951cfd);_0x520cd9['setDate'](_0x520cd9['getDate']()-0xe);const _0x13f7c8=this['history']['getItems']({'pinned':!0x0}),_0x20592b=this['history']['getItems']({'from':_0x951cfd,'to':_0x951cfd}),_0x3757f0=this['history']['getItems']({'from':_0x30af85,'to':_0x30af85}),_0x17cd47=this['history']['getItems']({'from':_0x520cd9,'to':_0x30af85}),_0x335d05=this['history']['getItems']({'to':_0x520cd9}),_0x4b588a=[];return _0x13f7c8['length']>0x0&&_0x4b588a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x13f7c8}),_0x20592b['length']>0x0&&_0x4b588a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0x20592b}),_0x3757f0['length']>0x0&&_0x4b588a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x3757f0}),_0x17cd47['length']>0x0&&_0x4b588a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x17cd47}),_0x335d05['length']>0x0&&_0x4b588a['push']({'title':Mi(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x335d05}),_0x4b588a;}}class AIChatHistory extends _0x915a98{static get['requires'](){return[AIChatHistoryController,AIChatHistoryUI];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class AIChat extends _0x915a98{static get['requires'](){return[AIChatController,AIEditing,AIChatUI,AIChatHistory];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2f004f){super(_0x2f004f),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}}class AIChatShortcutView extends yt{['id'];constructor(_0x3ffdcd,_0x2df64b){super(_0x3ffdcd);const {id:_0x467214,type:_0x1787c2,icon:_0x39283e}=_0x2df64b;this['id']=_0x467214,this['set']({'label':_0x2df64b['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0x2df64b['id']}}),_0x39283e?this['icon']=_0x39283e:'chat'===_0x1787c2?this['icon']=_0x51543d:'review'===_0x1787c2?this['icon']=_0x2e517:'translate'===_0x1787c2&&(this['icon']=_0x54ca7a);}}class AIChatShortcutsView extends Nt{['listView'];constructor(_0x1ffa29,_0x288c17){super(_0x1ffa29),this['set']('isEnabled',!0x0);const _0xea0eb6=_0x288c17['map'](_0x337f49=>{const _0xda1a90=new Ht(this['locale']),_0x46b687=new AIChatShortcutView(this['locale'],_0x337f49);return _0x46b687['bind']('isEnabled')['to'](this),_0xda1a90['children']['add'](_0x46b687),_0x46b687['delegate']('execute')['to'](this),_0xda1a90;});this['listView']=new Dt(this['locale']),this['listView']['items']['addMany'](_0xea0eb6),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}}const Gn='chat-shortcuts';class AIChatShortcuts extends _0x915a98{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[AIChatUI];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](AIChatUI),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x3d1bb8=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x15c4d5=_0x3d1bb8['activeConversation'];_0x15c4d5['isFromHistory']||this['_injectShortcuts'](_0x15c4d5);}),this['listenTo'](_0x3d1bb8,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x5917c1=['chat','review','translate'];this['_shortcuts']['forEach'](_0x14674b=>{let _0x37d2e0=!0x0;if(_0x14674b['id']&&_0x14674b['label']&&_0x5917c1['includes'](_0x14674b['type'])?'chat'===_0x14674b['type']&&(_0x37d2e0='string'==typeof _0x14674b['prompt']):_0x37d2e0=!0x1,!_0x37d2e0)throw new ht('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x14674b});});}['_injectShortcuts'](_0x11ac00){this['_removeShortcuts'](),this['_shortcutsView']=new AIChatShortcutsView(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],Gn),this['_shortcutsView']['on']('execute',_0xa67953=>{const _0x5c119b=_0xa67953['source']['id'];this['_executeShortcut'](_0x5c119b);}),this['_listenedConversation']=_0x11ac00,this['listenTo'](_0x11ac00,'uploadProgressChanged',(_0x1c585c,_0x44d752)=>{this['_shortcutsView']['isEnabled']=!_0x44d752['isUploadInProgress'];});}['_removeShortcuts'](){const _0x57a061=this['context']['plugins']['get'](AIChatUI);_0x57a061['hasFeedItem'](Gn)&&_0x57a061['removeFeedItem'](Gn),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x167eed){const _0x4c1d7c=this['_shortcuts']['find'](_0x57fdd2=>_0x57fdd2['id']===_0x167eed),_0x329d52=_0x4c1d7c['type'];'chat'===_0x329d52?this['_runChatShortcut'](_0x4c1d7c):'review'===_0x329d52?_0x4c1d7c['commandId']?this['_runReviewShortcut'](_0x4c1d7c):this['_switchTab']('reviewMode'):'translate'===_0x329d52&&(_0x4c1d7c['language']?this['_runTranslateShortcut'](_0x4c1d7c):this['_switchTab']('translate'));}['_switchTab'](_0x52f29e){if(!this['context']['plugins']['has']('AITabs'))throw new ht('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x52f29e});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x52f29e);}async['_runChatShortcut']({prompt:_0x4bff0a,draftMode:_0x4620f5,useWebSearch:_0x19bf66=!0x1,useReasoning:_0x2a3512=!0x1,model:_0x308770}){const _0xaef62c=this['context']['plugins']['get']('AIChatController'),_0x8c002f=_0xaef62c['activeConversation'];let _0x53bed6;_0x53bed6=_0x308770?await _0x8c002f['chatModels']['getModel'](_0x308770):await _0x8c002f['chatModels']['getDefault'](),_0x53bed6&&await _0x8c002f['setModel'](_0x53bed6),_0x8c002f['setWebSearch'](_0x19bf66),_0x8c002f['setReasoning'](_0x2a3512),_0xaef62c['addCurrentDocumentToChatContext'](),_0x4620f5?(this['_aiChatUI']['setPromptInputValue'](_0x4bff0a),this['_aiChatUI']['focusPromptInput'](!0x0)):_0xaef62c['sendMessage']({'message':_0x4bff0a});}['_runReviewShortcut']({commandId:_0x108779,model:_0x577e3a,prompt:_0x1f3ed7,params:_0x4cfeb3}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new ht('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x3113e2={'id':_0x108779,'isCustom':'custom'===_0x108779};_0x577e3a&&_0x1f3ed7&&(_0x3113e2['args']={'model':_0x577e3a,'prompt':_0x1f3ed7}),_0x4cfeb3&&(_0x3113e2['params']=_0x4cfeb3),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x3113e2);}['_runTranslateShortcut']({language:_0x5efde2}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new ht('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x5efde2,'args':{'language':_0x5efde2}});}}class ToggleAICommand extends _0x528875{constructor(_0x180398){super(_0x180398);const _0x59f9b1=_0x180398['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x59f9b1,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x50cb66=this['editor']['plugins']['get']('AITabs')['view'];_0x50cb66['isVisible']=!_0x50cb66['isVisible'];}}class AIToggleButtonUI extends _0x1970fb{static get['requires'](){return[AITabs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3f48ba=this['editor'];_0x3f48ba['commands']['add']('toggleAi',new ToggleAICommand(_0x3f48ba)),_0x3f48ba['ui']['componentFactory']['add']('toggleAi',()=>{const _0x37bc24=this['_createAIUIButton'](yt);return _0x37bc24['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x37bc24;}),_0x3f48ba['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x23ccfb=this['_createAIUIButton'](Yt);return _0x23ccfb['set']({'role':'menuitemcheckbox'}),_0x23ccfb;});}['_createAIUIButton'](_0x336f2f){const _0x1cf356=this['editor'],_0x3b6461=_0x1cf356['commands']['get']('toggleAi'),_0x126e22=new _0x336f2f(_0x1cf356['locale']);return _0x126e22['set']({'label':Mi(_0x1cf356['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x4d8003,'isToggleable':!0x0}),_0x126e22['bind']('isEnabled')['to'](_0x3b6461),_0x126e22['bind']('isOn')['to'](_0x3b6461,'value',_0x31078e=>!!_0x31078e),this['listenTo'](_0x126e22,'execute',()=>{_0x3b6461['execute']();}),_0x126e22;}}const Fn=['applySuggestion','insertSuggestion','showNext','showPrevious'];class AIBalloonView extends Nt{['_errorView'];constructor(_0x3cf159){super(_0x3cf159),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x1f2bbf){this['showError'](_0x1f2bbf);}['showError'](_0x21eeee){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x21eeee,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0xad1f2a=new Nt(this['locale']),_0x502864=new Nt(this['locale']);return _0x502864['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0xad1f2a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x583fa2=>!_0x583fa2)]},'children':[_0x502864]}),_0xad1f2a;}}const Wn=0xa;class AIBalloon extends _0x915a98{static get['requires'](){return[AIEditing];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0x24c6f9){const {id:_0x557796}=this['_currentConfig']??{};this['_currentConfig']=_0x24c6f9,this['_editor']=_0x24c6f9['targetEditor'];const {id:_0x484742}=this['_currentConfig'];this['isOpen']&&_0x557796===_0x484742?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x672d50=this['_editor'];if(!_0x672d50)return;const _0x2324dc=_0x672d50['plugins']['get']('Dialog');_0x2324dc['isOpen']&&this['_currentConfig']&&_0x2324dc['id']===this['_currentConfig']['id']&&_0x2324dc['hide']();}['_updateDialog'](){const _0x314be9=this['_editor']['plugins']['get']('Dialog'),{icon:_0x4f2051,title:_0x37a42d}=this['_currentConfig'];_0x314be9['view']?.['headerView']&&(_0x314be9['view']['headerView']['label']=_0x37a42d,_0x314be9['view']['headerView']['iconView']&&_0x4f2051&&(_0x314be9['view']['headerView']['iconView']['content']=_0x4f2051)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x314be9['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](AIEditing)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0x1c5569=this['_editor']['plugins']['get']('Dialog'),{id:_0x479b86,title:_0x54c2f8,icon:_0x31f24c,class:_0xf46b62,mainView:_0x220ff7}=this['_currentConfig'];_0x220ff7['delegate'](...Fn)['to'](this),_0x1c5569['show']({'title':_0x54c2f8,'icon':_0x31f24c,'hasCloseButton':!0x0,'id':_0x479b86,'position':this['_calculateDialogPosition']['bind'](this),'className':'ck-ai-balloon\x20'+(_0xf46b62||''),'content':_0x220ff7,'onShow':_0x29d036=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x29d036['view']?.['updatePosition']();const _0x46c689=this['_getSelectionElements']();_0x46c689&&_0x46c689[0x0]&&Tt({'target':_0x46c689[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x29d036['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x479b86});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x479b86}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x3ff1a4,_0x9f28a9){if(!_0x9f28a9){const _0x49b0f9=this['_getTargetRootDomRect']();if(!_0x49b0f9)return null;_0x9f28a9=_0x49b0f9;}const _0x30edbb=this['_getSelectionElements']();if(!_0x30edbb||0x0===_0x30edbb['length'])return{'left':Math['round'](_0x9f28a9['left']+_0x9f28a9['width']/0x2-_0x3ff1a4['width']/0x2),'top':Math['round'](_0x9f28a9['top']+_0x9f28a9['height']/0x2-_0x3ff1a4['height']/0x2)};const _0x9a9d20=Math['round'](_0x9f28a9['left']+_0x9f28a9['width']/0x2-_0x3ff1a4['width']/0x2),_0x6be815=_0x30edbb['map'](_0x63d3e3=>new dt(_0x63d3e3)),_0x414be8=_0x3ff1a4['height'];return{'left':_0x9a9d20,'top':this['_calculateOptimalTopPosition'](_0x6be815,_0x414be8,_0x9f28a9)};}['_calculateOptimalTopPosition'](_0x249e72,_0x528507,_0x3f8ca3){const _0x584e3a=new dt(lt['window']),_0x368400=_0x249e72['map'](_0x258674=>_0x258674['getVisible']())['filter'](_0xc5d732=>_0xc5d732),_0x46f4ff=dt['getBoundingRect'](_0x368400);if(!_0x46f4ff)return Math['round'](_0x3f8ca3['top']+_0x3f8ca3['height']/0x2);const _0x63b806=_0x584e3a['getIntersection'](_0x46f4ff);if(!_0x63b806)return Math['round'](_0x3f8ca3['top']+_0x3f8ca3['height']/0x2);const _0x4cba3b=_0x3f8ca3['getVisible'](),_0x12c13d=_0x4cba3b&&_0x46f4ff['height']>_0x4cba3b['height'],_0x564e42=_0x63b806['top'],_0x28dc24=_0x63b806['bottom'];if(_0x12c13d){const _0x4c0273=(_0x4cba3b||_0x584e3a)['height']/0x2-_0x528507/0x2,_0x58dbdb=_0x564e42-Wn-_0x3f8ca3['top'],_0x5e9eb7=_0x3f8ca3['bottom']-_0x28dc24-Wn;return _0x58dbdb>=_0x528507?Math['max'](Wn,_0x564e42-_0x528507-Wn):_0x5e9eb7>=_0x528507?_0x28dc24+Wn:Math['max'](Wn,_0x4c0273);}const _0x24f529=_0x564e42-_0x528507,_0x1fd4ab=_0x3f8ca3['bottom']-_0x28dc24-Wn,_0x164654=_0x564e42-Wn-_0x3f8ca3['top'];let _0x435411;if(_0x1fd4ab>=_0x528507)_0x435411=_0x28dc24+Wn;else{if(_0x164654>=_0x528507)_0x435411=_0x24f529-Wn;else _0x435411=_0x564e42+_0x46f4ff['height']/0x2-_0x528507/0x2;}return _0x435411;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x2bc8cf=this['_editor'];this['listenTo'](_0x2bc8cf['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x15174b,data:{newRange:_0x4a0db0}}of _0x2bc8cf['model']['document']['differ']['getChangedMarkers']())if(_0x15174b['startsWith'](Rs+':')&&(_0x4a0db0&&(_0x4a0db0['start']['isEqual'](_0x4a0db0['end'])||'$graveyard'==_0x4a0db0['root']['rootName'])||null==_0x4a0db0)){const _0x1b2178=Mi(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x1b2178),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x3e2694=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x3e2694['model']['document']);}['_getSelectionElements'](){const _0x408de1=this['_editor'];return _0x2c1711(_0x408de1['editing'],[..._0x408de1['model']['markers']['getMarkersGroup']('ai-selection'),..._0x408de1['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getTargetRootDomRect'](){const _0x19bf73=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];if(!_0x19bf73)return null;const _0x41f3e3=this['_editor'],_0x1266f7=_0x41f3e3['editing']['view']['document']['getRoot'](_0x19bf73['rootName']);if(!_0x1266f7)return null;const _0x18ca46=_0x41f3e3['editing']['view']['domConverter']['mapViewToDom'](_0x1266f7);return _0x18ca46&&_0x18ca46 instanceof HTMLElement?new dt(_0x18ca46):null;}}class AIMiniToolbarView extends kt{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x53e0a3,_0x16d221={}){super(_0x53e0a3),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x16d221};const _0x150399=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x150399?'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'](_0x54631d){this['showChangesButton']['isEnabled']=_0x54631d;}['_setupRatingButtons'](){this['likeButton']=new yt(this['locale']),this['likeButton']['set']({'icon':_0x25d513,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':Gi,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new yt(this['locale']),this['dislikeButton']['set']({'icon':_0x3d94ab,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':Gi,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new yt(this['locale']),this['copyButton']['set']({'icon':_0x380aaa,'label':Mi(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+Gi,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x5427ea=new Lt();_0x5427ea['set']({'content':_0x17783f}),_0x5427ea['extendTemplate']({'attributes':{'class':['ck-ai-mini-toolbar-copy-button__check-mark']}}),this['copyButton']['on']('execute',()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20ck-ai-mini-toolbar-copy-button_copied\x20'+Gi,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+Gi;},0x7d0);}),this['copyButton']['children']['add'](_0x5427ea);}['_setupShowChangesButton'](){this['showChangesButton']=new yt(this['locale']),this['showChangesButton']['set']({'icon':_0x27d4c5,'label':Mi(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':Gi}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x3133ad=>_0x3133ad?_0x554737:_0x27d4c5),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}}class AIChatBalloonView extends AIBalloonView{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x38644,_0x183253){super(_0x38644);const _0x5d84be=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x183253,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new AISuggestionStreamableContentView(_0x38644),this['_partToolbarView']=new AISuggestionContentPartToolbarView(_0x38644,_0x183253['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x183253),this['_stateView']=new AISuggestionContentPartStateView(_0x38644),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new AIMiniToolbarView(_0x38644,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new AIChatBalloonToolbarContainerView(_0x38644,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0xe4b05e,_0x15e860,_0x3fda87,_0x83bf35)=>{let _0x270591,_0x4301ea;'pending'===_0x83bf35?(_0x270591=this['_partToolbarView'],_0x4301ea=this['_stateView']):(_0x270591=this['_stateView'],_0x4301ea=this['_partToolbarView']),this['_stateView']['setState'](_0x3fda87),_0x270591['isVisible']=!0x1,_0x4301ea['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x5d84be['to']('_state',_0x5a080b=>'ck-ai-chat-balloon-main_state_'+_0x5a080b)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x183253);});}['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'](_0x31c682){_0x31c682?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x31c682);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x243185){this['_state']=_0x243185;}['showError'](_0x54fee7){super['showError'](_0x54fee7),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x3a4fd8){super['showBlockingError'](_0x3a4fd8),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x461e39){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x461e39;}['togglePartToolbarEnabled'](_0x3f9408){this['_partToolbarView']['isEnabled']=_0x3f9408;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x434791,showSuggestButton:_0x278910}){_0x434791=_0x434791&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x278910=_0x278910&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x434791,'showSuggestButton':_0x278910});}['_createNextButtonView'](){const _0x4af4f6=new yt(this['locale']);return _0x4af4f6['set']({'icon':_0x5a0e8f,'label':Mi(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x4af4f6['on']('execute',()=>{this['fire']('showNext');}),_0x4af4f6;}['_createPreviousButtonView'](){const _0x4ce178=new yt(this['locale']);return _0x4ce178['set']({'icon':_0xf67768,'label':Mi(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x4ce178['on']('execute',()=>{this['fire']('showPrevious');}),_0x4ce178;}}class AIChatBalloonToolbarContainerView extends Nt{constructor(_0x52fc0c,_0x124b08){super(_0x52fc0c),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x124b08});}}class AIChatBalloon extends _0x1970fb{static get['requires'](){return[Gt,AIBalloon];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x33d7ae){super(_0x33d7ae),this['set']('showDiff',!0x1);}['open'](_0x2302bf){const _0x2203e2=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x2203e2['plugins']['get']('AIBalloon')['open']({..._0x2302bf,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x2302bf['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x2302bf['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x48c256){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x48c256);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x5adb1a){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x5adb1a);}['_createChatBalloonView'](){const _0x457843=this['editor'],_0x32b2d7=_0x457843['plugins']['get']('AIBalloon'),_0x389bcd=_0x457843['commands']['get']('trackChanges');let _0x21c023=_0x457843['config']['get']('ai.availableReplyActions')||[...Ds];_0x457843['plugins']['has']('TrackChanges')||(_0x21c023=_0x21c023['filter'](_0x5be213=>'insertSuggestion'!=_0x5be213));const _0x3b1e59=new AIChatBalloonView(_0x457843['locale'],{'availableActions':_0x21c023,'showApplyButton':!0x0,'showSuggestButton':!!_0x389bcd});return _0x3b1e59['bind']('showDiff')['to'](this),_0x3b1e59['delegate'](...Ss)['to'](this),_0x3b1e59['delegate']('showPrevious','showNext')['to'](this),_0x32b2d7['delegate']('dialogClosed')['to'](this),_0x3b1e59['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x3b1e59['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x3b1e59['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x389bcd&&_0x3b1e59['bind']('isTrackChangesOn')['to'](_0x389bcd,'value'),_0x3b1e59['render'](),_0x3b1e59;}['_toggleRotatorButtonsInDialogHeader'](_0x25b973){const _0xe94eaf=this['editor'],_0x1fcc6d=_0xe94eaf['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x25b973),_0x1fcc6d['has'](this['_chatBalloonView']['previousButtonView'])||(_0x1fcc6d['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0xe94eaf['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x1fcc6d['remove'](this['_chatBalloonView']['previousButtonView']),_0x1fcc6d['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}}class AIEditorIntegration extends _0x1970fb{static get['requires'](){return[AIToggleButtonUI,AIChatBalloon,_0x33a450];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}function Kn(_0x42a005){const {editor:_0x3cc7cc,action:_0x5c6a78,withText:_0x26243c=!0x1,withIcon:_0x59797d=!0x0,isInDropdown:_0x3bc01a=!0x0,shouldPreventFocus:_0x164656=!0x1,actionButtons:_0x3756d9}=_0x42a005;return()=>{const _0x258ab5=_0x3cc7cc['locale'],_0x4ba7cb=new yt(_0x258ab5),_0x398b6e=_0x4ba7cb['bindTemplate'];_0x3bc01a&&_0x4ba7cb['extendTemplate']({'on':{'mouseenter':_0x398b6e['to'](()=>{_0x164656&&_0x164656()||_0x4ba7cb['focus']();})}}),_0x3756d9['push']({'buttonView':_0x4ba7cb,'action':_0x5c6a78});const _0x1bd5b7=_0x5c6a78['icon']??_0x5c6a78['parent']?.['icon'];return _0x4ba7cb['set']({'label':_0x5c6a78['label'],'withText':_0x26243c,'role':'menuitem','icon':_0x59797d?_0x1bd5b7??_0x2e6482:void 0x0,'tooltip':!_0x26243c,'class':'ck-ai-quick-actions-button','isEnabled':_0x5c6a78['isEnabled']}),_0x4ba7cb['on']('execute',()=>{_0x3cc7cc['editing']['view']['focus'](),_0x3cc7cc['commands']['execute']('aiQuickAction',_0x5c6a78);}),_0x4ba7cb;};}class DropdownMenuButtonWithHighlightView extends _0x47a4d8{['arrowView'];constructor(_0x1cde5b,_0x23675b){super(_0x1cde5b,_0x23675b);const _0x374fb3=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',_0x13a8cd=>String(_0x13a8cd)),'data-cke-tooltip-disabled':_0x374fb3['to']('isOn')},'on':{'mouseenter':_0x374fb3['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x3f668f=new Lt();return _0x3f668f['content']=_0x4c5fea,_0x3f668f['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x3f668f;}}class AIQuickActionsFilteredListView extends Dt{['_allListItems'];['_allSearchableItems'];constructor(_0x46b1ce,_0x1832a3,_0x1e756c){super(_0x46b1ce),this['_allListItems']=_0x1832a3,this['_allSearchableItems']=_0x1e756c;}['filter'](_0xf10d38){if(!_0xf10d38)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x442dcc=_0xf10d38['source']['toLowerCase']()['trim'](),_0x12da4b=this['_allSearchableItems']['filter'](_0x2ec2a4=>(_0x2ec2a4['groupLabel']?_0x2ec2a4['label']+'\x20('+_0x2ec2a4['groupLabel']+')':_0x2ec2a4['label'])['toLowerCase']()['includes'](_0x442dcc));return this['items']['clear'](),this['items']['addMany'](_0x12da4b['sort']((_0x5e30ac,_0x36e851)=>{const _0x39d3f2=_0x5e30ac['groupLabel'],_0x545a22=_0x36e851['groupLabel'];return _0x39d3f2||_0x545a22?_0x39d3f2?0x1:-0x1:0x0;})['map'](_0x54356e=>_0x54356e['item'])),this['_highlightQuery'](_0x442dcc,_0x12da4b),{'resultsCount':_0x12da4b['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x400ceb,_0x1d6ab8){if(!_0x400ceb)return;const _0x16ea52=new RegExp(_0x554003(_0x400ceb),'gi');_0x1d6ab8['forEach'](_0x239b29=>{_0x239b29['highlightViews']&&_0x239b29['highlightViews']['forEach'](_0x37f25a=>{'function'==typeof _0x37f25a['highlightText']&&_0x37f25a['highlightText'](_0x16ea52);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x259188=>{_0x259188['highlightViews']&&_0x259188['highlightViews']['forEach'](_0x122662=>{'function'==typeof _0x122662['highlightText']&&_0x122662['highlightText'](null);});});}}const Yn='menu',$n='menuitem';class AIQuickActionsDropdownContentView extends Nt{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x4968f1,_0x336fd9,_0x133fd8,_0x1abf20,_0x274db0=!0x1,_0x549b93=[]){const _0x75ed0=_0x4968f1['locale'];super(_0x75ed0),this['_bodyCollection']=_0x1abf20,this['_hasSearch']=_0x274db0,this['_actionButtons']=_0x549b93;const _0x4806b4=this['_createListItems'](_0x4968f1,_0x336fd9,_0x133fd8);this['optionsListView']=new AIQuickActionsFilteredListView(_0x75ed0,_0x4806b4,this['_allSearchableItems']),this['optionsListView']['role']=Yn,this['optionsListView']['items']['addMany'](_0x4806b4),this['focusTracker']=new It(),this['keystrokes']=new At(),_0x274db0&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x4806b4,this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x274db0&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x1cf9ed=_0x274db0&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x171c0b(_0x1cf9ed),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x75ed0['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x590352(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':Mi(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x4b3565=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x4b3565);}['_createListItems'](_0x1a1c94,_0x160e38,_0x3fcc4f){const _0x216f43=new _0x171c0b();return _0x160e38['forEach'](_0x5c5bdd=>{if('actions'in _0x5c5bdd){const {listItem:_0x172531}=this['_createActionGroupButton'](_0x1a1c94,_0x5c5bdd,_0x3fcc4f);_0x216f43['add'](_0x172531),_0x5c5bdd['actions']['forEach'](_0x58f73=>{const {listItem:_0xf57c97,highlightViews:_0x4bac30}=this['_createSearchResultActionButton'](_0x1a1c94,_0x58f73,_0x5c5bdd['label'],_0x5c5bdd['icon']);this['_allSearchableItems']['push']({'item':_0xf57c97,'label':_0x58f73['label'],'groupLabel':_0x5c5bdd['label'],'highlightViews':_0x4bac30});});}else{const {listItem:_0x428847}=this['_createActionButton'](_0x1a1c94,_0x5c5bdd);_0x216f43['add'](_0x428847);const _0x29386c=_0x428847['children']['first'];if(_0x29386c){const {listItem:_0x427fc5,highlightViews:_0x2c453b}=this['_createSearchResultActionButton'](_0x1a1c94,_0x5c5bdd);this['_allSearchableItems']['push']({'item':_0x427fc5,'label':_0x29386c['label']||'','highlightViews':_0x2c453b});}}}),_0x216f43;}['_createActionButton'](_0x5512cc,_0x4f7a9b,_0x5c5334,_0x2a5856){const _0x872ed8=new Ht(this['locale']);if(_0x5c5334&&_0x2a5856){const _0x10ed1e=new yt(this['locale']),_0x15a140=_0x10ed1e['bindTemplate'],_0x5d61d1=new _0x5bc622();_0x5d61d1['text']=_0x4f7a9b['label'];const _0x3fbb4e=new _0x5bc622();_0x3fbb4e['text']=_0x5c5334;const _0x1e27cd=new Lt();_0x1e27cd['content']=_0x2a5856,_0x1e27cd['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x90ae02=new Nt(this['locale']);_0x90ae02['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x36be17=new Nt(this['locale']);return _0x36be17['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x10ed1e['set']({'label':_0x4f7a9b['label']+'\x20('+_0x5c5334+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x4f7a9b['isEnabled']}),_0x10ed1e['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x15a140['if']('isEnabled','ck-disabled',_0x2412f5=>!_0x2412f5)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x5d61d1,_0x90ae02,_0x1e27cd,_0x3fbb4e,_0x36be17],'on':{'mouseenter':_0x15a140['to'](()=>{this['_isSearchFocused']()||_0x10ed1e['focus']();}),'click':_0x15a140['to'](()=>{_0x10ed1e['fire']('execute');})}}),_0x10ed1e['on']('execute',()=>{_0x10ed1e['isEnabled']&&(_0x5512cc['editing']['view']['focus'](),_0x5512cc['commands']['execute']('aiQuickAction',_0x4f7a9b));}),_0x872ed8['children']['add'](_0x10ed1e),this['_actionButtons']['push']({'buttonView':_0x10ed1e,'action':_0x4f7a9b}),{'listItem':_0x872ed8,'highlightViews':[_0x5d61d1,_0x3fbb4e]};}{const _0x2d39df=new _0x2e8ecb(),_0x3c90a4=new yt(this['locale'],_0x2d39df),_0x3b9303=_0x3c90a4['bindTemplate'],_0x4fd501=_0x4f7a9b['icon']??_0x4f7a9b['parent']?.['icon'],_0x30ef5b=void 0x0!==_0x4f7a9b['icon'];return _0x3c90a4['set']({'label':_0x4f7a9b['label'],'withText':!0x0,'role':'menuitem','icon':_0x30ef5b?_0x4fd501??_0x2e6482:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x4f7a9b['isEnabled']}),_0x3c90a4['extendTemplate']({'on':{'mouseenter':_0x3b9303['to'](()=>{this['_isSearchFocused']()||_0x3c90a4['focus']();})}}),_0x3c90a4['on']('execute',()=>{_0x5512cc['editing']['view']['focus'](),_0x5512cc['commands']['execute']('aiQuickAction',_0x4f7a9b);}),_0x872ed8['children']['add'](_0x3c90a4),this['_actionButtons']['push']({'buttonView':_0x3c90a4,'action':_0x4f7a9b}),{'listItem':_0x872ed8,'highlightViews':[_0x2d39df]};}}['_createSearchResultActionButton'](_0x13f7cd,_0x2b74a7,_0x1a1873,_0xbb472c){return _0x1a1873&&_0xbb472c?this['_createSearchResultGroupedActionButton'](_0x13f7cd,_0x2b74a7,_0x1a1873,_0xbb472c):this['_createSearchResultIndividualActionButton'](_0x13f7cd,_0x2b74a7);}['_createSearchResultGroupedActionButton'](_0x55dea3,_0x45d0d5,_0x360e84,_0x40167a){const _0x23b082=new Ht(this['locale']),_0x54965b=new yt(this['locale']),_0x42e7ae=_0x54965b['bindTemplate'],{view:_0x302a44,highlightView:_0xbbcc1c}=this['_createSearchResultGroupRow'](_0x360e84,_0x40167a),{view:_0x2c10f7,highlightView:_0x2ade1b}=this['_createSearchResultActionRow'](_0x45d0d5['label']),_0x4b9194=this['_createSearchResultContentView'](_0x302a44,_0x2c10f7);return _0x54965b['set']({'label':_0x45d0d5['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':_0x45d0d5['isEnabled']}),_0x54965b['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',_0x42e7ae['if']('isEnabled','ck-disabled',_0x510d5c=>!_0x510d5c)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x4b9194],'on':{'mouseenter':_0x42e7ae['to'](()=>{this['_isSearchFocused']()||_0x54965b['focus']();}),'click':_0x42e7ae['to'](()=>{this['_handleSearchResultButtonClick'](_0x54965b);})}}),this['_setupActionButtonExecution'](_0x54965b,_0x55dea3,_0x45d0d5),_0x23b082['children']['add'](_0x54965b),this['_actionButtons']['push']({'buttonView':_0x54965b,'action':_0x45d0d5}),{'listItem':_0x23b082,'highlightViews':[_0xbbcc1c,_0x2ade1b]};}['_createSearchResultIndividualActionButton'](_0x3b90a4,_0x3263d3){const _0x48660e=new Ht(this['locale']),_0x4903ba=new _0x2e8ecb(),_0x53892c=new yt(this['locale'],_0x4903ba),_0x4dda40=_0x53892c['bindTemplate'];return _0x53892c['set']({'label':_0x3263d3['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x3263d3['isEnabled']}),_0x53892c['extendTemplate']({'on':{'mouseenter':_0x4dda40['to'](()=>{this['_isSearchFocused']()||_0x53892c['focus']();})}}),this['_setupActionButtonExecution'](_0x53892c,_0x3b90a4,_0x3263d3),_0x48660e['children']['add'](_0x53892c),this['_actionButtons']['push']({'buttonView':_0x53892c,'action':_0x3263d3}),{'listItem':_0x48660e,'highlightViews':[_0x4903ba]};}['_createSearchResultGroupRow'](_0x5f28ee,_0x5bbf0e){const _0x55340e=new Nt(this['locale']),_0x7f4b25=new Lt();_0x7f4b25['content']=_0x5bbf0e,_0x7f4b25['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x3bab92=new _0x5bc622();return _0x3bab92['text']=_0x5f28ee,_0x55340e['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x7f4b25,_0x3bab92]}),{'view':_0x55340e,'highlightView':_0x3bab92};}['_createSearchResultActionRow'](_0x57fad4){const _0x587cf6=new Nt(this['locale']),_0x106ee5=new _0x5bc622();return _0x106ee5['text']=_0x57fad4,_0x587cf6['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x106ee5]}),{'view':_0x587cf6,'highlightView':_0x106ee5};}['_createSearchResultContentView'](_0xaf6994,_0x14d57b){const _0x38d7ff=new Nt(this['locale']);return _0x38d7ff['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0xaf6994,_0x14d57b]}),_0x38d7ff;}['_setupActionButtonExecution'](_0x827169,_0xc40800,_0x3a65de){_0x827169['on']('execute',()=>{_0x827169['isEnabled']&&(_0xc40800['editing']['view']['focus'](),_0xc40800['commands']['execute']('aiQuickAction',_0x3a65de));});}['_createActionGroupButton'](_0x2471ef,_0x72cbd5,_0x386d53){const _0x4ee97a=new Ht(this['locale']),_0x1e090d=new _0x2e8ecb(),_0x49b713=new DropdownMenuButtonWithHighlightView(this['locale'],_0x1e090d),_0x9fc08d=_0x49b713['bindTemplate'],_0x40ec33=this['_getPanelKeystroke'](_0x386d53),_0xe5dd23=this['_createGroupActionsList'](_0x2471ef,_0x72cbd5['actions'],_0x386d53);_0x49b713['set']({'label':_0x72cbd5['label'],'withText':!0x0,'role':$n,'icon':_0x72cbd5['icon']??_0x2e6482,'isEnabled':_0x72cbd5['actions']['some'](_0x180d53=>_0x180d53['isEnabled'])}),_0x49b713['extendTemplate']({'on':{'mouseenter':_0x9fc08d['to'](()=>{this['_isSearchFocused']()||_0x49b713['focus']();})}});const _0x600028=new zt(this['locale']);return _0x600028['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x9fc08d['to'](_0x5bed4a=>{this['_handlePanelKeydown'](_0x5bed4a,_0x40ec33,_0x49b713,_0x600028);})}}),_0x49b713['bind']('isOn')['to'](_0x600028,'isVisible'),this['_bodyCollection']['add'](_0x600028),_0x600028['content']['add'](_0xe5dd23),this['_setupGroupMenuBehavior'](_0x49b713,_0x600028),_0x4ee97a['children']['add'](_0x49b713),this['_actionButtons']['push']({'buttonView':_0x49b713,'action':_0x72cbd5}),{'listItem':_0x4ee97a,'highlightView':_0x1e090d};}['_createGroupActionsList'](_0x24a476,_0x155740,_0x511faa){const _0x5b8aa4=new Dt(this['locale']);return _0x5b8aa4['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x155740['forEach'](_0x4dc8bf=>{const _0x3c8a47=new Ht(this['locale']),_0x8e5ef2=Kn({'editor':_0x24a476,'action':_0x4dc8bf,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x3c8a47['children']['add'](_0x8e5ef2),_0x511faa['focusTracker']['add'](_0x8e5ef2),_0x5b8aa4['items']['add'](_0x3c8a47);}),_0x5b8aa4;}['_setupGroupMenuBehavior'](_0x10a111,_0x2694f2){const _0x493ce3=_0x10a111['bindTemplate'],_0x495483=this['_getButtonKeystroke'](_0x10a111);_0x10a111['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x493ce3['to'](()=>{this['_showNestedPanel'](_0x2694f2,_0x10a111);}),'mouseleave':_0x493ce3['to'](_0xdb07b8=>{const _0x400948=_0xdb07b8['relatedTarget'];this['_isMovingToNestedMenu'](_0x400948,_0x2694f2)||this['_hideNestedPanel'](_0x2694f2);}),'keydown':_0x493ce3['to'](_0x6b82ee=>{_0x6b82ee['key']==_0x495483&&(this['_showNestedPanel'](_0x2694f2,_0x10a111),_0x2694f2['content']['get'](0x0)['focus']());})}}),_0x2694f2['on']('render',()=>{_0x2694f2['element']?.['addEventListener']('mouseleave',_0x26602a=>{const _0x15e9d0=_0x26602a['relatedTarget'];_0x10a111['element']?.['contains'](_0x15e9d0)||this['_isMovingToNestedMenu'](_0x15e9d0,_0x2694f2)||this['_hideNestedPanel'](_0x2694f2);});});}['_showNestedPanel'](_0x3e72d2,_0x29dd53){this['_openNestedPanels']['forEach'](_0x170af7=>{_0x170af7!==_0x3e72d2&&_0x170af7['isVisible']&&_0x170af7['hide']();}),_0x3e72d2['show'](),_0x3e72d2['pin']({'positions':[_0x4c80ad['eastSouth']],'target':_0x29dd53['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x3e72d2);}['_hideNestedPanel'](_0x14fd26){_0x14fd26['hide'](),this['_openNestedPanels']['delete'](_0x14fd26);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x35be8d=>_0x35be8d['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x4468b0,_0x401693){if(!_0x4468b0)return!0x1;if(_0x401693['element']?.['contains'](_0x4468b0))return!0x0;const _0x44eadd=_0x4468b0;return _0x44eadd['closest']&&(null!==_0x44eadd['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x44eadd['closest']('.ck-ai-quick-actions-group-list')||null!==_0x44eadd['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'](_0x4d51b2){return'rtl'===_0x4d51b2['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0xd0a7ba){return'rtl'===_0xd0a7ba['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x2e80c0,_0xe958bf,_0x48997b,_0x42229f){_0x2e80c0['key']==_0xe958bf&&(_0x48997b['focus'](),this['_hideNestedPanel'](_0x42229f));}['_handleSearchResultButtonClick'](_0xcea981){_0xcea981['fire']('execute');}}function qn(_0x4242bf){const {editor:_0x23e6c5,content:_0x2b5c07,buttonDefinition:_0x17a083,bodyCollection:_0xf8f655,hasSearch:_0x30458b=!0x1,actionButtons:_0xd3d9e7}=_0x4242bf;return()=>{const _0x477f85=_0x23e6c5['locale'],_0x5a8e1a=_0x23e6c5['commands']['get']('aiQuickAction'),_0x1817a2=Ft(_0x477f85);_0x1817a2['bind']('isEnabled')['to'](_0x5a8e1a),_0x1817a2['buttonView']['set']({'icon':_0x17a083['icon']??_0x2e6482,'label':_0x17a083['label'],'tooltip':!0x0}),_0x1817a2['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x57c336=new AIQuickActionsDropdownContentView(_0x23e6c5,_0x2b5c07,_0x1817a2,_0xf8f655,_0x30458b,_0xd3d9e7);return _0x1817a2['panelView']['children']['add'](_0x57c336),_0x30458b&&_0x1817a2['on']('change:isOpen',(_0x354d7e,_0x2d664d,_0x17dc98)=>{if(_0x17dc98){if(_0x23e6c5['plugins']['has']('AIEditing')){const _0x769d77=_0x23e6c5['plugins']['get'](AIEditing),_0xa599cf=_0x23e6c5['model']['document']['selection'],_0x4fa0df=Array['from'](_0xa599cf['getRanges']());_0x4fa0df['length']>0x0&&_0x769d77['showFakeVisualSelection']({'editor':_0x23e6c5,'ranges':_0x4fa0df,'id':'quick-action','priority':0x14});}}else _0x23e6c5['plugins']['has']('AIEditing')&&_0x23e6c5['plugins']['get'](AIEditing)['hideFakeVisualSelection']('quick-action'),_0x57c336['resetSearch']();}),_0x1817a2;};}const Qn='<task>Explain\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x20plain,\x20simple\x20language.</task><rules>1.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is:-\x20If\x20it\x20looks\x20like\x20a\x20definition\x20explain\x20the\x20concept\x20in\x20simple\x20terms.-\x20If\x20it\x20looks\x20like\x20a\x20description\x20clarify\x20what\x20it\x20is\x20describing\x20and\x20why\x20it\x20matters.-\x20If\x20it\x20contains\x20technical\x20terms\x20or\x20jargon\x20break\x20them\x20down\x20into\x20everyday\x20language.-\x20If\x20it\x20looks\x20instructional\x20restate\x20as\x20clear\x20steps\x20someone\x20can\x20follow.-\x20If\x20it\x20provides\x20examples\x20explain\x20what\x20the\x20example\x20shows\x20and\x20why\x20it\x27s\x20relevant.-\x20If\x20it\x20presents\x20an\x20argument\x20or\x20claim\x20restate\x20the\x20claim\x20neutrally\x20and\x20explain\x20its\x20purpose.-\x20If\x20it\x20is\x20narrative/story-like\x20explain\x20what\x20event\x20or\x20situation\x20is\x20being\x20described.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20explain\x20what\x20the\x20data\x20indicates.-\x20If\x20it\x20is\x20a\x20quotation\x20explain\x20the\x20meaning\x20of\x20the\x20quote\x20in\x20context.-\x20If\x20it\x20compares/contrasts\x20things\x20explain\x20the\x20key\x20differences\x20or\x20similarities\x20simply.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20give\x20a\x20clear,\x20plain-language\x20explanation\x20of\x20its\x20meaning,\x20focusing\x20on\x20usefulness.2.\x20Provide\x20context\x20if\x20the\x20meaning\x20could\x20be\x20unclear\x20without\x20it.\x20(e.g.,\x20explain\x20where\x20such\x20a\x20term\x20might\x20be\x20used,\x20or\x20why\x20it\x20is\x20important).3.\x20Keep\x20the\x20explanation\x20short\x20but\x20complete\x20(2–5\x20sentences).-\x20Avoid\x20overly\x20technical\x20detail\x20unless\x20it\x20is\x20necessary\x20for\x20understanding.4.\x20Do\x20not\x20simply\x20repeat\x20the\x20original\x20text\x20—\x20restate\x20and\x20expand\x20it\x20in\x20plain\x20words.5.\x20If\x20possible,\x20add\x20a\x20short\x20example\x20or\x20analogy\x20to\x20make\x20it\x20easier\x20to\x20understand.6.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20explanation.7.\x20Your\x20explanation\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20explanation,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant,\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Xn='<task>Summarize\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x202–4\x20clear\x20sentences,\x20capturing\x20only\x20the\x20essential\x20meaning.</task><rules>1.\x20Your\x20summary\x20should\x20be\x20short\x20and\x20clear:-\x20Aim\x20for\x202–4\x20sentences\x20unless\x20the\x20text\x20is\x20extremely\x20short.-\x20Focus\x20on\x20capturing\x20the\x20main\x20idea(s)\x20without\x20unnecessary\x20detail.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20summary\x20style:-\x20If\x20it\x20is\x20descriptive\x20condense\x20the\x20description\x20into\x20its\x20core\x20idea.-\x20If\x20it\x20is\x20argumentative\x20or\x20opinion-based\x20summarize\x20the\x20main\x20claim\x20and\x20reasoning\x20neutrally.-\x20If\x20it\x20is\x20narrative/story-like\x20capture\x20the\x20main\x20event\x20or\x20outcome\x20without\x20side\x20details.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20summarize\x20what\x20the\x20data\x20shows\x20in\x20plain\x20language.-\x20If\x20it\x20is\x20instructional\x20restate\x20the\x20overall\x20purpose\x20of\x20the\x20steps\x20without\x20listing\x20every\x20step.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20provide\x20a\x20general\x20concise\x20summary.3.\x20Provide\x20context\x20if\x20necessary\x20for\x20clarity:-\x20Mention\x20the\x20subject\x20or\x20topic\x20explicitly\x20so\x20the\x20summary\x20can\x20stand\x20alone.4.\x20Do\x20not\x20simply\x20copy\x20sentences\x20from\x20the\x20original\x20text\x20—\x20rephrase\x20in\x20plain\x20language.5.\x20Avoid\x20adding\x20new\x20information\x20or\x20interpretation\x20not\x20present\x20in\x20the\x20text.6.\x20Summarize\x20in\x20a\x20way\x20that\x20would\x20make\x20sense\x20to\x20someone\x20who\x20has\x20not\x20read\x20the\x20original\x20text.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20summary.8.\x20Your\x20summary\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20summary,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',zn='<task>Extract\x20and\x20present\x20the\x20key\x20points\x20from\x20the\x20selected\x20part\x20of\x20the\x20document\x20as\x20a\x20concise\x20bulleted\x20list.</task><rules>1.\x20Present\x20the\x20output\x20as\x20a\x20clear,\x20structured\x20list\x20(bullets\x20or\x20numbered).-\x20Each\x20point\x20should\x20be\x20concise\x20(one\x20sentence\x20or\x20less).-\x20Do\x20not\x20merge\x20distinct\x20ideas\x20into\x20one\x20bullet.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20extraction\x20style:-\x20If\x20it\x20is\x20descriptive\x20capture\x20the\x20main\x20attributes\x20or\x20features.-\x20If\x20it\x20is\x20argumentative\x20extract\x20the\x20main\x20claim\x20and\x20supporting\x20reasons\x20separately.-\x20If\x20it\x20is\x20narrative/story-like\x20extract\x20the\x20main\x20events\x20in\x20chronological\x20order.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20highlight\x20the\x20most\x20important\x20facts\x20or\x20numbers.-\x20If\x20it\x20is\x20instructional\x20list\x20the\x20steps\x20or\x20main\x20actions\x20in\x20simplified\x20form-\x20If\x20it\x20provides\x20comparisons\x20extract\x20the\x20contrasted\x20items\x20and\x20their\x20differences/similarities.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20category\x20above\x20extract\x20the\x20main\x20ideas\x20in\x20plain,\x20short\x20statements.3.\x20Keep\x20the\x20list\x20between\x203–7\x20items\x20where\x20possible.-\x20If\x20the\x20text\x20is\x20very\x20short,\x20fewer\x20items\x20are\x20fine.-\x20If\x20it\x20is\x20very\x20long,\x20focus\x20on\x20the\x20most\x20important\x20ideas\x20only.4.\x20Do\x20not\x20copy\x20long\x20text\x20fragments\x20—\x20restate\x20in\x20simple\x20words.5.\x20Do\x20not\x20add\x20interpretation,\x20evaluation,\x20or\x20commentary\x20beyond\x20the\x20text.6.\x20Ensure\x20the\x20list\x20can\x20stand\x20alone\x20without\x20requiring\x20the\x20reader\x20to\x20see\x20the\x20original\x20document.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20key\x20points.8.\x20Your\x20key\x20points\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20key\x20points\x20list,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',jn=/* #__PURE__ -- @preserve */
|
|
28
|
-
((()=>({'chat':'AIChat','action':'AIActions'}))());class AIQuickActionsUI extends _0x1970fb{['_actionButtons']=[];['_menuBarGroupViews']=[];static get['requires'](){return[_0x3d8fbd,AIConnector];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0xd8ddc9=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0xd8ddc9),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x39ba43){return function(_0x42a391){const _0x509bbc=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x42a391['uiLanguage']),_0x5b8dca=_0x509bbc||'English',_0xe2c009=[{'id':'ask-ai','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0xca000},{'id':'chat-commands','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0xca000,'actions':[{'id':'explain','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':Mi(_0x42a391,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':Qn['replace']('%0',_0x5b8dca),'type':'chat'},{'id':'summarize','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':Mi(_0x42a391,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':Xn['replace']('%0',_0x5b8dca),'type':'chat'},{'id':'highlight-key-points','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':Mi(_0x42a391,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':zn['replace']('%0',_0x5b8dca),'type':'chat'}]},{'id':'improve-writing','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x485867},{'id':'continue','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x2a7c57},{'id':'fix-grammar','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x21c1e1},{'id':'adjust-length','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x2a9d0f,'actions':[{'id':'make-shorter','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x4b4d61,'actions':[{'id':'make-tone-casual','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x54ca7a,'actions':[{'id':'translate-to-english','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':Mi(_0x42a391,'AI_QUICK_ACTIONS_OTHER'),'icon':tt,'actions':[]}];return _0xe2c009;}(_0x39ba43);}['_getDefaultAndCustomActions'](){const _0x56d107=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x1101f5=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x265c83=>({..._0x265c83,'type':'chat'===_0x265c83['type']?'chat':'action','icon':void 0x0}));return _0x56d107['find'](_0x3e970f=>'other'===_0x3e970f['id'])['actions']['push'](..._0x1101f5),_0x56d107;}async['_initActionTypeQuickActions'](){try{const _0x6eb5e0=new AIModels({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x18591d=await _0x6eb5e0['getAll'](),_0x324ec9=(await _0x6eb5e0['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x324ec9),this['_enableButtonsByType']('action',_0x5cc1e4=>!!_0x18591d['find'](_0x3aa010=>_0x3aa010['id']===_0x5cc1e4['model'])||void 0x0===_0x5cc1e4['model']);}catch(_0x293558){const _0x3d8f68=new ht('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x293558});Ct(_0x3d8f68['message']);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x169d3d=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x169d3d,'change:isConversationReady',(_0x3a2159,_0x224273,_0x5f3655)=>{_0x5f3655&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x169d3d['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x413d3a,_0x2a972b){this['_quickActionsDefinition']['forEach'](_0xc313bc=>{'actions'in _0xc313bc?_0xc313bc['actions']['forEach'](_0x49ab8d=>{_0x49ab8d['type']===_0x413d3a&&(_0x49ab8d['isEnabled']=_0x2a972b(_0x49ab8d));}):_0xc313bc['type']===_0x413d3a&&(_0xc313bc['isEnabled']=_0x2a972b(_0xc313bc));}),this['_actionButtons']['forEach'](_0x2f8cec=>{if(Jn(_0x2f8cec['action']))return;if(_0x2f8cec['action']['type']!==_0x413d3a)return;const _0x33c61d=_0x2a972b(_0x2f8cec['action']);if(_0x2f8cec['action']['isEnabled']=_0x33c61d,_0x2f8cec['buttonView']['isEnabled']=_0x33c61d,!_0x33c61d&&_0x2f8cec['action']['model']){const _0x3e8f46=new ht('ai-quick-actions-unavailable-model',this,{'actionId':_0x2f8cec['action']['id'],'modelId':_0x2f8cec['action']['model']});Ct(_0x3e8f46['message']);}}),this['_actionButtons']['filter'](_0x1c885e=>Jn(_0x1c885e['action']))['forEach'](_0x1d71cf=>{_0x1d71cf['buttonView']['isEnabled']=_0x1d71cf['action']['actions']['some'](_0x2f6ceb=>_0x2f6ceb['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x3f0c9a,group:_0x587ffc})=>{_0x3f0c9a['isEnabled']=_0x587ffc['actions']['some'](_0x388870=>_0x388870['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x1b7de7){this['_actionButtons']['forEach'](_0x5c154d=>{Jn(_0x5c154d['action'])||'action'===_0x5c154d['action']['type']&&(_0x5c154d['action']['model']||(_0x5c154d['action']['model']=_0x1b7de7));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x1e38ea=new Xt(this['editor']['locale']);_0x1e38ea['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x1e38ea),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x1e38ea);}['_initializeQuickActionsDropdown'](_0x4ba070){const _0x2e8190=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',qn({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x2e6482,'label':Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x4ba070,'hasSearch':_0x2e8190,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x577430){this['_quickActionsDefinition']=_0x577430['map'](_0x50daad=>{if('actions'in _0x50daad){const _0xa7b562=_0x50daad;return{..._0xa7b562,'actions':_0xa7b562['actions']['map'](_0x89f5b3=>{const {actions:_0x56585d,..._0x12fc9f}=_0xa7b562;return{..._0x89f5b3,'isEnabled':!0x1,'parent':_0x12fc9f};})['filter'](_0x5ba35e=>this['_shouldIncludeAction'](_0x5ba35e))};}return{..._0x50daad,'isEnabled':!0x1};})['filter'](_0x4e2c18=>'actions'in _0x4e2c18?_0x4e2c18['actions']['length']>0x0:this['_shouldIncludeAction'](_0x4e2c18));}['_shouldIncludeAction'](_0x5cffbc){const _0x427841=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](jn[_0x5cffbc['type']])&&!_0x427841['includes'](_0x5cffbc['id'])&&!('chat'===_0x5cffbc['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0x2b2ebe){this['_quickActionsDefinition']['forEach'](_0x138c6a=>{if('actions'in _0x138c6a){const _0x16127f=qn({'editor':this['editor'],'content':_0x138c6a['actions'],'buttonDefinition':_0x138c6a,'bodyCollection':_0x2b2ebe,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x138c6a['id'],_0x16127f),_0x138c6a['actions']['forEach'](_0x20bc42=>{const _0x189076=Kn({'editor':this['editor'],'action':_0x20bc42,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x20bc42['id'],_0x189076);});}else{const _0x4b4745=Kn({'editor':this['editor'],'action':_0x138c6a,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x138c6a['id'],_0x4b4745);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x545ee9=>{const _0x5f2937=this['editor']['commands']['get']('aiQuickAction'),_0x10c130=new Kt(_0x545ee9),_0x50fb4f=Mi(_0x545ee9,'AI_QUICK_ACTIONS_HEADING');_0x10c130['buttonView']['set']({'label':_0x50fb4f,'icon':_0x2e6482});const _0x5d99a9=new qt(_0x545ee9);return _0x5d99a9['set']({'ariaLabel':_0x50fb4f,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x591b7e=>{if('actions'in _0x591b7e){const _0x27e71d=_0x591b7e,_0x10083d=new Qt(_0x545ee9,_0x10c130),_0x4f4858=new Kt(_0x545ee9),_0x10949b=new qt(_0x545ee9);_0x4f4858['buttonView']['set']({'label':_0x27e71d['label'],'icon':_0x27e71d['icon']}),_0x27e71d['actions']['forEach'](_0x8f3a6=>{const _0x426865=new Qt(_0x545ee9,_0x4f4858),_0x2944fc=new Yt(_0x545ee9);_0x2944fc['set']({'label':_0x8f3a6['label'],'icon':_0x8f3a6['icon'],'role':'menuitem','isEnabled':_0x8f3a6['isEnabled']}),_0x2944fc['on']('execute',()=>{this['_executeQuickAction'](_0x8f3a6);}),this['_actionButtons']['push']({'buttonView':_0x2944fc,'action':_0x8f3a6}),_0x2944fc['delegate']('execute')['to'](_0x4f4858),_0x426865['children']['add'](_0x2944fc),_0x10949b['items']['add'](_0x426865);}),_0x4f4858['isEnabled']=_0x27e71d['actions']['some'](_0x50fd3c=>_0x50fd3c['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x4f4858,'group':_0x27e71d}),_0x4f4858['panelView']['children']['add'](_0x10949b),_0x10083d['children']['add'](_0x4f4858),_0x5d99a9['items']['add'](_0x10083d);}else{const _0x1c1cd9=_0x591b7e,_0x11ca63=new Qt(_0x545ee9,_0x10c130),_0x558e96=new Yt(_0x545ee9);_0x558e96['set']({'label':_0x1c1cd9['label'],'icon':_0x1c1cd9['icon'],'role':'menuitem','isEnabled':_0x1c1cd9['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x558e96,'action':_0x1c1cd9}),_0x558e96['on']('execute',()=>{this['_executeQuickAction'](_0x1c1cd9);}),_0x558e96['delegate']('execute')['to'](_0x10c130),_0x11ca63['children']['add'](_0x558e96),_0x5d99a9['items']['add'](_0x11ca63);}}),(Object['values'](jn)['some'](_0x537736=>this['editor']['plugins']['has'](_0x537736))?_0x10c130['bind']('isEnabled')['to'](_0x5f2937):_0x10c130['set']({'isEnabled':!0x1}),_0x10c130['panelView']['children']['add'](_0x5d99a9),_0x10c130);});}['_executeQuickAction'](_0x356ba0){const _0x15beb7=this['editor'];_0x15beb7['editing']['view']['focus'](),_0x15beb7['commands']['execute']('aiQuickAction',_0x356ba0);const _0x210120=_0x15beb7['ui']['view']['menuBarView'];_0x210120&&_0x210120['close']&&_0x210120['close']();}}function Jn(_0x54c61d){return'actions'in _0x54c61d;}class AIQuickActionsCommand extends _0x528875{['execute'](_0x4d347b){switch(this['_expandSelectionIfCollapsed'](),_0x4d347b['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x53c731=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x53c731});}this['_handleAIChatAction'](_0x4d347b);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x2e17df=Mi(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new ht('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x2e17df});}this['_handleAIActionsAction'](_0x4d347b);}}async['_handleAIChatAction'](_0x3c1d6f){const _0x36db1e=this['editor']['plugins']['get']('AIChatController'),_0xcafc94=this['editor']['plugins']['get']('AITabs')['view'];if(_0xcafc94['isVisible']||(_0xcafc94['isVisible']=!0x0),'chat'!==_0xcafc94['activeTab']&&_0xcafc94['activateTab']('chat'),'ask-ai'===_0x3c1d6f['id'])_0x36db1e['removeSelectionFromChatContext'](),_0x36db1e['addSelectionToChatContext'](this['editor']),_0x36db1e['focusPromptInput']();else await _0x36db1e['startConversation']({'modelId':_0x3c1d6f['model']}),_0x36db1e['removeSelectionFromChatContext'](),_0x36db1e['addSelectionToChatContext'](this['editor']),_0x36db1e['focusPromptInput'](),await _0x36db1e['sendMessage']({'message':_0x3c1d6f['prompt']||_0x3c1d6f['displayedPrompt']||_0x3c1d6f['label'],'attributes':{'quickActionData':{'id':_0x3c1d6f['id']},'displayedPrompt':_0x3c1d6f['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x21d24e=this['editor'],_0x5b6794=_0x21d24e['model']['document']['selection'];if(!_0x5b6794['isCollapsed'])return;const _0x1ecab1=gt(_0x5b6794['getSelectedBlocks']())||_0x21d24e['model']['schema']['getLimitElement'](_0x5b6794);_0x21d24e['model']['change'](_0x384a7c=>{_0x384a7c['setSelection'](_0x1ecab1,'in');});}['_handleAIActionsActionLabel'](_0x18de37){return _0x18de37['parent']?.['label']&&'other'!==_0x18de37['parent']?.['id']?_0x18de37['parent']['label']+':\x20'+_0x18de37['label']:_0x18de37['label'];}async['_handleAIActionsAction'](_0x436f71){const _0x43bf92=this['editor']['plugins']['get']('AIActions'),_0x32bcd4=_0x436f71['prompt']?{'userMessage':_0x436f71['prompt'],'model':_0x436f71['model']}:{'actionName':_0x436f71['actionName']||_0x436f71['id'],'args':_0x436f71['args']},_0x9faeb5=this['_handleAIActionsActionLabel'](_0x436f71);await _0x43bf92['executeAction'](_0x32bcd4,_0x9faeb5,_0x436f71['icon']);}}class AIQuickActionsEditing extends _0x1970fb{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3bfbda=this['editor'],_0x5280b4=new AIQuickActionsCommand(this['editor']);if(_0x3bfbda['commands']['add']('aiQuickAction',_0x5280b4),_0x3bfbda['plugins']['has']('AIChat')){const _0x556f80=this['editor']['plugins']['get']('AIChatController');_0x3bfbda['model']['document']['selection']['on']('change:range',(_0x24df96,_0x5a5066)=>{_0x5a5066['directChange']&&_0x556f80['removeSelectionFromChatContext']();});}}}class AIActionsReply extends AIReply{['appendContent'](_0x30e8d1,_0x80a815='text'){'modification'===this['type']&&'text'===_0x80a815&&(_0x80a815=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x30e8d1,_0x80a815);}['updateChangeGroups'](_0x17961a){const _0x26f969=this['parsedContent']['get'](_0x17961a)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x17961a,_0x26f969),this['changeGroups']=[],0x0==_0x26f969['childNodes']['length'])return;rs(this['documentContextContent']['get'](_0x17961a),this['parsedMergedContent']['get'](_0x17961a));const _0x26e8a2=this['documentContextContent']['get'](_0x17961a)['children']['map'](_0x44f9ed=>({'node':_0x44f9ed,'id':Xi(_0x44f9ed,'data-id')})),_0x23d416=_0x26f969['children']['map'](_0x4ad64b=>({'node':_0x4ad64b,'id':Xi(_0x4ad64b,'data-id')||at()})),_0x196dbd=_0x3c1d4d(_0x26e8a2,_0x23d416,{'comparator':(_0x158a9a,_0x42b818)=>_0x158a9a['id']==_0x42b818['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x196dbd['length']&&_0x196dbd[_0x196dbd['length']-0x1]['removed'];)_0x196dbd['pop']();}const _0x574a98=_0x196dbd['map'](_0x4e2b56=>{const _0x11c5b7=_0x4e2b56['added']?'new':_0x4e2b56['removed']?'removed':'modified';return{'node':_0x4e2b56['value'][0x0]['node'],'type':_0x11c5b7,'id':_0x4e2b56['value'][0x0]['id']};}),_0x41c007=this['_documentIdToSource']['get'](_0x17961a);this['changeGroups']['push']({'changes':_0x574a98,'state':'pending','index':this['changeGroups']['length'],'editor':_0x41c007['editor'],'rootName':_0x41c007['rootName'],'documentId':_0x17961a});}['_getDifferentChangeGroups'](_0x2dd1f4,_0x56bf5b){return _0x56bf5b;}}class AIActionsInteraction extends AIInteraction{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x1b3fa1){super(_0x1b3fa1),this['content']=_0x1b3fa1['content'],this['version']=_0x1b3fa1['version'],this['editor']=_0x1b3fa1['editor'],this['rootName']=_0x1b3fa1['rootName'],this['actionName']=_0x1b3fa1['actionName'],this['args']=_0x1b3fa1['args'],this['userMessage']=_0x1b3fa1['userMessage'],this['model']=_0x1b3fa1['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':at(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x190cda){const _0x5e0099=this['editor']['config']['get']('collaboration.channelId'),_0xd5c34d=new AIActionsReply({..._0x190cda,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x5e0099,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x5e0099,this['editor']]])});return this['replies']['push'](_0xd5c34d),_0xd5c34d['delegate'](...Is)['to'](this),this['fire']('replyCreated',_0xd5c34d),_0xd5c34d;}}class AIActionsBalloonToolbarView extends kt{constructor(_0x48936e,_0x42dd7d=!0x0,_0x258852=!0x0){super(_0x48936e),this['set']('isEnabled',!0x1),_0x42dd7d&&(this['applyButton']=this['_createButton'](Mi(_0x48936e,'AI_BALLOON_APPLY_BUTTON'),Ui),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x258852&&(this['suggestButton']=this['_createButton'](Mi(_0x48936e,'AI_BALLOON_SUGGEST_BUTTON'),_0x42dd7d?Bi:Ui),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x42dd7d,'showSuggestButton':_0x258852}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x41c8cf,showSuggestButton:_0x39826b}){this['applyButton']&&(this['applyButton']['isVisible']=_0x41c8cf),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x39826b);}['_createButton'](_0x15865f,_0x51beb7){const _0x3dd72c=new yt(this['locale']);return _0x3dd72c['set']({'label':_0x15865f,'class':_0x51beb7,'isVisible':!0x0,'withText':!0x0}),_0x3dd72c;}}class AIActionsBalloonDisclaimerView extends Nt{constructor(_0x57c956){super(_0x57c956),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':Mi(_0x57c956,'AI_DISCLAIMER_TEXT')}]}]});}}class AISuggestionLoaderView extends Nt{constructor(_0x33f3f3){super(_0x33f3f3),this['set']('isVisible',!0x0);const _0x398034=new AISpinnerView('small');_0x398034['isVisible']=!0x0;const _0x2709e2=new Nt(this['locale']);_0x2709e2['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[Mi(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x52ecc7=>!_0x52ecc7)]},'children':[_0x398034,_0x2709e2]});}}class AIActionsBalloonView extends AIBalloonView{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x15292d,_0xf040f8){super(_0x15292d),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0xf040f8,this['_focusTracker']=new It(),this['_keystrokes']=new At(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x171c0b(),this['_addContentWrapper'](_0xf040f8),this['_addDisclaimerView'](),this['_addToolbar'](_0xf040f8),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'](_0xf040f8);});}['render'](){super['render']();for(const _0x4935f0 of this['_focusables'])this['_focusTracker']['add'](_0x4935f0['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy']();}['focus'](_0x2175ed){-0x1===_0x2175ed?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0xe789b6){this['_isLoading']=_0xe789b6;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x51561b){super['showError'](_0x51561b),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x4c39b7){super['showBlockingError'](_0x4c39b7),this['setErrorState']();}['addMiniToolbarItem'](_0x3f1667){this['_miniToolbarView']['items']['has'](_0x3f1667)||this['_miniToolbarView']['items']['add'](_0x3f1667);}['removeMiniToolbarItem'](_0x3e5b7b){this['_miniToolbarView']['items']['has'](_0x3e5b7b)&&this['_miniToolbarView']['items']['remove'](_0x3e5b7b);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x25b6a4,showSuggestButton:_0x55a25b}){_0x25b6a4=_0x25b6a4&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x55a25b=_0x55a25b&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x25b6a4,'showSuggestButton':_0x55a25b});}async['updateContent'](_0x256d3f){await this['_streamableContentView']['update'](_0x256d3f);}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x2d8a86){this['_contentWrapper']=new Nt(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x2d8a86['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new AIActionsBalloonDisclaimerView(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x5cbacb,showSuggestButton:_0x2646ae}){this['_toolbarView']=new AIActionsBalloonToolbarView(this['locale'],_0x5cbacb,_0x2646ae),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',(_0x12805e,_0x506109,_0x310a37)=>!(_0x12805e||_0x506109||_0x310a37)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x5cbacb,'showSuggestButton':_0x2646ae}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0xd446d1){return this['_miniToolbarView']=new AIMiniToolbarView(this['locale'],_0xd446d1),this['_miniToolbarView']['delegate'](...Ss)['to'](this),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['_miniToolbarView']['isShowChangesOn']=!this['_miniToolbarView']['isShowChangesOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':this['_miniToolbarView']['isShowChangesOn']});}),this['_miniToolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',(_0x17b2ed,_0x274407)=>!(_0x17b2ed||_0x274407)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new AISuggestionLoaderView(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new AISuggestionStreamableContentView(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x2db3ab=new yt(this['locale']),_0x46cc96=new yt(this['locale']),_0x4df031=new AIActionsBalloonNavigationCounterView(this['locale']),_0x35ef82=new yt(this['locale']);_0x2db3ab['set']({'icon':et,'label':Mi(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+Gi}),_0x46cc96['set']({'icon':_0x5117cf,'tooltip':Mi(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+Gi}),_0x35ef82['set']({'icon':it,'tooltip':Mi(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+Gi}),_0x2db3ab['bind']('isEnabled')['to'](this,'isBusy',_0x2ba55a=>!_0x2ba55a),_0x2db3ab['on']('execute',()=>{this['fire']('tryAgain');}),_0x46cc96['bind']('isEnabled')['to'](this,'isBusy',_0x199769=>!_0x199769),_0x46cc96['on']('execute',()=>{this['fire']('showPrevious');}),_0x35ef82['bind']('isEnabled')['to'](this,'isBusy',_0x3e10bf=>!_0x3e10bf),_0x35ef82['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x46cc96,this['_navigationCounter']=_0x4df031,this['_navigationNextButton']=_0x35ef82,this['_navigationTryAgainButton']=_0x2db3ab;}['updateMiniToolbarButtons'](_0x14d066,_0x28622c){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x5a27ee=_0x14d066>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x5a27ee){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x2395f8=_0x14d066-_0x28622c;this['_navigationCounter']['setInteractionCount'](_0x2395f8+'/'+_0x14d066),this['_navigationPreviousButton']['isEnabled']=_0x28622c<_0x14d066-0x1,this['_navigationNextButton']['isEnabled']=_0x28622c>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'](_0x5d0fc5){this['_isLoading']=_0x5d0fc5;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_initializeScrollManager'](){const _0x3acba6=this['_getScrollableElement']();_0x3acba6&&!this['_scrollManager']&&(this['_scrollManager']=new ScrollManager(_0x3acba6));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}}class AIActionsBalloonNavigationCounterView extends Nt{constructor(_0x549e42){super(_0x549e42);const _0x22416a=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0x22416a['to']('interactionCount')}]});}['setInteractionCount'](_0x90399f){this['set']('interactionCount',_0x90399f);}}class AIActions extends _0x1970fb{static get['requires'](){return[AIConnector,Gt,AIEditing,AIBalloon,_0x102c6d];}static get['pluginName'](){return'AIActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_aiConnector'];['_interactions']=[];['_currentInteractionIndex']=0x0;['_interactionParams'];['_balloonShowDiff']=!0x1;['_promiseQueue'];['_bodyCollection'];get['_interaction'](){return this['_interactions'][this['_interactions']['length']-0x1];}['_actionsBalloonView'];constructor(_0x24d346){super(_0x24d346),this['_bodyCollection']=new Xt(this['editor']['locale']),this['_bodyCollection']['attachToDom'](),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['set']('isBusy',!0x1),this['_promiseQueue']=new PromiseQueue();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x412705,_0x4a52a5,_0x19a84e){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')){if(this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x187519,anchorData:_0x11408a,root:_0xcac7df}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x412705,_0x187519,_0x11408a,_0xcac7df,_0x4a52a5,_0x19a84e);}}const {modelFragment:_0x527ebf,anchorData:_0x1e1ea5,root:_0x44736a}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x412705,_0x527ebf,_0x1e1ea5,_0x44736a,_0x4a52a5,_0x19a84e);}async['destroy'](){return this['_stopInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}['_createActionsBalloonView'](){const _0x1ac227=this['editor']['plugins']['has']('TrackChanges');let _0x2b3ad6=this['editor']['config']['get']('ai.availableReplyActions')||[...Ds];_0x1ac227||(_0x2b3ad6=_0x2b3ad6['filter'](_0x18a030=>'insertSuggestion'!=_0x18a030));const _0x2a13ec=this['editor']['commands']['get']('trackChanges'),_0x243486=new AIActionsBalloonView(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x1ac227,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x2b3ad6});return _0x243486['bind']('isBusy')['to'](this),_0x2a13ec&&_0x243486['bind']('isTrackChangesOn')['to'](_0x2a13ec,'value'),_0x243486['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0x243486['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0x243486['on']('showNext',()=>{this['_navigateToNext']();}),_0x243486;}['_normalizeSelectionStart'](){const _0x6b5e8e=this['editor']['model'],_0x2de09d=_0x6b5e8e['document']['selection'],_0xa45eb7=_0x2de09d['getFirstRange']();if(!_0xa45eb7||_0xa45eb7['isCollapsed'])return;const _0x3c0a4d=gt(_0x2de09d['getSelectedBlocks']());if(!_0x3c0a4d)return;const _0x13eeb0=_0x6b5e8e['createPositionAt'](_0x3c0a4d,0x0);_0x13eeb0['isAfter'](_0xa45eb7['start'])&&_0x6b5e8e['change'](_0x5a7eeb=>{_0x5a7eeb['setSelection'](_0x5a7eeb['createRange'](_0x13eeb0,_0xa45eb7['end']));});}['_getExecuteDataRegular'](){const _0x477bdf=this['editor']['model']['document']['selection'],_0x574307=_0x477bdf['getFirstRange']()['start']['root'];if(_0x477bdf['isCollapsed']){const _0x336ae0=gt(_0x477bdf['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x477bdf);this['editor']['model']['change'](_0x46e6a3=>{_0x46e6a3['setSelection'](_0x336ae0,'in');});}this['_normalizeSelectionStart']();const _0x16ee1a=_0x477bdf['getFirstRange'](),_0x2ee1e4=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x477bdf),_0x16ee1a['start'],_0x16ee1a['end']);this['_copyMarkersToFragment'](_0x2ee1e4,_0x477bdf,{'isTableSelection':!0x1});const _0x2a6b6e=_0x477bdf['getFirstRange']()['start'],_0x1ee517=new Map();let _0xde15aa=_0x2ee1e4;for(let _0xaef67a=0x0;_0xaef67a<_0x2a6b6e['path']['length'];_0xaef67a++)_0x1ee517['set'](_0xde15aa,_0x2a6b6e['path'][_0xaef67a]),_0xde15aa=_0xde15aa['getChild'](0x0);return{'modelFragment':_0x2ee1e4,'anchorData':_0x1ee517,'root':_0x574307};}['_getExecuteDataInTable'](){const _0x46ed75=this['editor']['model']['document']['selection'],_0x579df9=this['editor']['plugins']['get']('TableSelection'),_0xbaa974=_0x46ed75['getFirstRange']()['start']['root'],_0x5164f6=_0x579df9['getSelectionAsFragment'](),_0x8d58f1=_0x46ed75['getFirstRange']()['start']['parent']['parent'],_0x10f402=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x8d58f1),this['editor']['model']['createPositionAfter'](_0x8d58f1)),_0x148ff8=this['_wrapWithCommonAncestors'](_0x5164f6,_0x10f402['start'],_0x10f402['end']);this['_copyMarkersToFragment'](_0x148ff8,_0x46ed75,{'isTableSelection':!0x0});const _0x1d5a08=_0x46ed75['getFirstRange']()['start'],_0x4da907=new Map();let _0x401a7a=_0x148ff8;for(let _0x2bb2d9=0x0;_0x2bb2d9<_0x1d5a08['path']['length'];_0x2bb2d9++)if(_0x4da907['set'](_0x401a7a,_0x1d5a08['path'][_0x2bb2d9]),_0x2bb2d9<_0x1d5a08['path']['length']-0x1)_0x401a7a=_0x401a7a['getChild'](0x0);else{let _0x2321fe=_0x401a7a['nextSibling'];for(;_0x2321fe;)_0x4da907['set'](_0x2321fe,_0x1d5a08['path'][_0x2bb2d9]),_0x2321fe=_0x2321fe['nextSibling'];}return{'modelFragment':_0x148ff8,'anchorData':_0x4da907,'root':_0xbaa974};}async['_executeAction'](_0x415aae,_0x5d671e,_0x42e30e,_0x19ed20,_0x1e4995,_0x5d7160){const _0x215ad3=this['editor']['plugins']['get'](AIEditing),_0xbdc3b7=this['editor']['plugins']['get'](AIBalloon),_0x48c99b=this['editor']['model']['document']['selection'],_0x1c9041=await _0x215ad3['modelToDataWithIds'](_0x5d671e,this['editor']),_0x48e0df=this['editor']['model']['document']['version'],_0x5264ea=[..._0x48c99b['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0xbdc3b7['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x1e4995,'icon':_0x5d7160||_0x2e6482,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x5264ea,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0xbdc3b7),this['_interactionParams']={'action':_0x415aae,'content':_0x1c9041,'version':_0x48e0df,'aiBalloon':_0xbdc3b7,'modelFragment':_0x5d671e,'anchorData':_0x42e30e,'root':_0x19ed20},this['_setupApplyListeners'](),this['listenTo'](_0xbdc3b7,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0xbdc3b7,'dialogClosed',(_0x399cb9,{id:_0x22e637})=>{if('aiActionsBalloon'===_0x22e637){for(const _0x2ece86 of this['_interactions']){if(0x0===_0x2ece86['replies']['length']||_0x2ece86['stoppedExplicitly'])continue;const _0x269a16=_0x2ece86['replies'][_0x2ece86['replies']['length']-0x1],_0x4b2ba6=_0x269a16['changeGroups'][0x0];_0x4b2ba6&&'pending'===_0x4b2ba6['state']&&_0x269a16['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0xbdc3b7);}}),this['_createInteraction'](_0x1c9041,_0x48e0df,_0xbdc3b7,_0x415aae);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x552fea,anchorData:_0x2c53ce,root:_0x2c242c}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x552fea,_0x2c53ce,_0x2c242c,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x552fea,_0x2c53ce,_0x2c242c,!0x0);});}['_wrapWithCommonAncestors'](_0x3081c5,_0x5a4e9b,_0x4f3612){const _0xe35f03=this['editor']['model']['createRange'](_0x5a4e9b,_0x4f3612)['getCommonAncestor'](),_0x48c106=_0xe35f03['is']('documentFragment')?[]:_0xe35f03['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x48c106['length']){const _0x4b939d=_0x48c106['map'](_0x1631c3=>_0x1631c3['_clone'](!0x1));for(let _0x3b70ec=0x1;_0x3b70ec<_0x4b939d['length'];_0x3b70ec++)_0x4b939d[_0x3b70ec-0x1]['_appendChild'](_0x4b939d[_0x3b70ec]);return _0x4b939d[_0x4b939d['length']-0x1]['_appendChild'](_0x3081c5),new _0x27f90b(_0x4b939d[0x0]);}return _0x3081c5;}['_copyMarkersToFragment'](_0x5cdd14,_0x2c2fc4,_0x52a24f={'isTableSelection':!0x1}){const _0x6a959f=this['editor']['model'],_0x5b5591=Array['from'](_0x2c2fc4['getRanges']()),_0x46481c=_0x2c2fc4['getFirstRange']()['start'];for(const _0x33bb07 of _0x6a959f['markers']){if(_0x33bb07['name']['startsWith'](Rs)||!_0x33bb07['affectsData'])continue;const _0x599ffd=_0x33bb07['getRange']();if(!_0x5b5591['some'](_0x8ee650=>_0x8ee650['containsRange'](_0x599ffd,!0x0)))continue;const _0x3f2365=this['_regularCalculateMarkerPath'](_0x599ffd['start'],_0x46481c,_0x52a24f['isTableSelection']),_0x37196f=this['_regularCalculateMarkerPath'](_0x599ffd['end'],_0x46481c,_0x52a24f['isTableSelection']),_0x2a818c=_0x6a959f['createPositionFromPath'](_0x5cdd14,_0x3f2365),_0x51ef9e=_0x6a959f['createPositionFromPath'](_0x5cdd14,_0x37196f);if(!_0x2a818c['isEqual'](_0x51ef9e)){const _0x7392ce=_0x6a959f['createRange'](_0x2a818c,_0x51ef9e);_0x5cdd14['markers']['set'](_0x33bb07['name'],_0x7392ce);}}}['_regularCalculateMarkerPath'](_0x4eee4a,_0xea7d90,_0x24929c=!0x1){const _0x56bea9=[..._0x4eee4a['path']['slice']()];for(let _0x3396bf=0x0;_0x3396bf<Math['max'](_0xea7d90['path']['length'],_0x4eee4a['path']['length']);_0x3396bf++){const _0x92eb58=_0xea7d90['path'][_0x3396bf]||0x0,_0x51f1a8=(_0x4eee4a['path'][_0x3396bf]||0x0)-_0x92eb58;if(_0x56bea9[_0x3396bf]=_0x51f1a8,0x0!==_0x51f1a8&&!_0x24929c)break;}return _0x56bea9;}async['_createInteraction'](_0x2d8eb3,_0x1db0b4,_0x50abf5,_0x3847eb){const _0x1a340b=this['editor'],_0x59c793=_0x1a340b['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0x3847eb,'content':_0x2d8eb3,'version':_0x1db0b4,'aiBalloon':_0x50abf5,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x59c793});const _0x3effdb=new AIActionsInteraction({'connector':this['_aiConnector'],'locale':_0x1a340b['locale'],'content':_0x2d8eb3,'version':_0x1db0b4,'editor':_0x1a340b,'rootName':_0x59c793['rootName'],..._0x3847eb});this['_interactions']['push'](_0x3effdb);const _0x14698d=(_0x797ec8,_0x4313c0=!0x1,_0xbaf54='streaming')=>this['_promiseQueue']['enqueue'](async _0x15ed38=>{try{const _0x28d75a=os({'changeGroups':_0x797ec8['changeGroups'],'documentContextContent':_0x797ec8['documentContextContent'],'showDiff':_0x4313c0,'trimUnchanged':!0x1});_0x28d75a['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x28d75a[0x0],'renderingStrategy':_0xbaf54,'abortSignal':_0x15ed38});}catch(_0xaa454b){if(this['_isAbortError'](_0xaa454b))return;throw _0xaa454b;}});_0x3effdb['on']('replyCreated',(_0x4a895b,_0xdbafd7)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x14698d(_0xdbafd7)['catch'](_0x5e4498=>{this['_isAbortError'](_0x5e4498)||(console['error']('Error\x20updating\x20content\x20in\x20replyCreated:',_0x5e4498),this['_setErrorState'](_0x3effdb));});}),_0x3effdb['on']('replyContentUpdated',(_0x2440eb,_0x941a58)=>{_0x14698d(_0x941a58)['catch'](_0x1e8d26=>{this['_isAbortError'](_0x1e8d26)||(console['error']('Error\x20updating\x20content\x20in\x20replyContentUpdated:',_0x1e8d26),this['_setErrorState'](_0x3effdb));});}),_0x3effdb['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x25243a){this['_isAbortError'](_0x25243a)||(console['error']('Error\x20clearing\x20loading\x20state\x20in\x20interactionFinished:',_0x25243a),this['_setErrorState'](_0x3effdb));}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x301de9,{showDiff:_0x2a2b0f})=>{try{this['_balloonShowDiff']=_0x2a2b0f;const _0xf1cf2a=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0xf1cf2a&&await _0x14698d(_0xf1cf2a,_0x2a2b0f,'static');}catch(_0x577f0b){this['_isAbortError'](_0x577f0b)||(console['error']('Error\x20updating\x20content\x20in\x20toggleSuggestionDisplayMode:',_0x577f0b),this['_setErrorState'](_0x3effdb));}}),_0x3effdb['on']('replyChangeGroupStateUpdated',()=>{const _0x1b9981={'positiveCount':_0x3effdb['replies']['reduce']((_0x55d92e,_0xbe434b)=>_0x55d92e+_0xbe434b['changeGroups']['filter'](_0x433bfa=>'accepted'===_0x433bfa['state'])['length'],0x0),'totalCount':_0x3effdb['replies']['reduce']((_0x223d2f,_0x1d3b6c)=>_0x223d2f+_0x1d3b6c['changeGroups']['length'],0x0)},_0x2ebdb5=_0x3effdb['actionCallId'],_0x2c79a3=_0x3effdb['actionName'];_0x2c79a3?this['_aiConnector']['upsertAIActionRating'](_0x2c79a3,_0x2ebdb5,_0x1b9981):this['_aiConnector']['upsertCustomAIActionRating'](_0x2ebdb5,_0x1b9981);}),this['_setLoadingState']();try{const _0x3807e0=await _0x3effdb['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x3807e0;}catch(_0x4a8ac9){if(this['_isAbortError'](_0x4a8ac9))return;this['_actionsBalloonView']['hideLoader'](),this['_setErrorState'](_0x3effdb);}}['_applyChanges'](_0xf6fcec,_0x3446d4,_0x1a0cc5,_0x2aad85){const _0x31552a=this['editor'];if(_0x2aad85&&!_0x31552a['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',null);const _0x310727=this['editor']['plugins']['get'](_0x102c6d),_0x3ba4d7=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x3ba4d7||!_0x3ba4d7['replies']['length'])return;const _0x7dbbb4=_0x3ba4d7['replies'][_0x3ba4d7['replies']['length']-0x1],_0x494083=_0x7dbbb4['changeGroups'];_0x7dbbb4['setChangeGroupState'](0x0,'accepted');let _0x3f59c7=Es({'reply':_0x7dbbb4,'interaction':_0x3ba4d7,'groups':_0x494083,'transform':!0x1,'documentCompare':_0x310727,'documentCompareOptions':{'anchor':_0x31552a['model']['createPositionAt'](_0xf6fcec,0x0),'markDeletions':_0x2aad85}});_0x3f59c7=this['_filterOperationsOutsideRange'](_0x3f59c7,_0x3446d4);for(const _0x4e4127 of _0x3f59c7)this['_anchorOperation'](_0x3446d4,_0x4e4127,_0x1a0cc5);const _0x4996cc=_0x3ba4d7['getDocumentContext']()['documents'][0x0]['version'],_0x8888d8=_0x31552a['model']['document']['history']['getOperations'](_0x4996cc),_0x37568b={'document':_0x31552a['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x2914c6=_0x144e65(_0x3f59c7,_0x8888d8,_0x37568b)['operationsA'];_0x31552a['model']['change'](_0x48411a=>{if(_0x48411a['setSelection'](_0x31552a['model']['document']['selection']['focus']),_0x2aad85)_0x31552a['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x2914c6);else{for(const _0xc64070 of _0x2914c6)_0xc64070['baseVersion']=_0x31552a['model']['document']['version'],Ts(_0x31552a,_0xc64070),_0x48411a['batch']['addOperation'](_0xc64070),_0x31552a['model']['applyOperation'](_0xc64070);}}),this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x5ab07e,_0x3cd682){return _0x5ab07e['filter'](_0x41588e=>{if('rename'==_0x41588e['type']){const _0x367efb=_0x41588e['position']['nodeAfter'];return!_0x3cd682['has'](_0x367efb);}if(_0x41588e['type']['indexOf']('Attribute')>-0x1){const _0x4f5b92=_0x41588e['range']['start']['nodeAfter'];return!_0x3cd682['has'](_0x4f5b92);}return!0x0;});}['_anchorOperation'](_0x17631e,_0x489566,_0x3f7393){const _0x5e54fa=_0x489566['clone']();for(const _0x4678fa in _0x489566){const _0x3c0adf=_0x489566[_0x4678fa];_0x3c0adf instanceof _0x245154?_0x489566[_0x4678fa]=new _0x245154(_0x1d3c5b(_0x3c0adf['start']),_0x1d3c5b(_0x3c0adf['end'])):_0x3c0adf instanceof _0x2a81c3&&(_0x489566[_0x4678fa]=_0x1d3c5b(_0x3c0adf));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x5e54fa['type'])){if(_0x5e54fa['isDocumentOperation']=!0x1,_0x5e54fa['baseVersion']=null,'remove'==_0x5e54fa['type']){const _0x1d1f1a=_0x5e54fa['sourcePosition'],_0x4d231b=_0x5e54fa['howMany'];new _0x35b10a(_0x1d1f1a,_0x4d231b)['_execute']();}else _0x5e54fa['_execute']();}function _0x1d3c5b(_0x41ca6d){if('$graveyard'==_0x41ca6d['root']['rootName'])return _0x41ca6d;const _0x364a1a=[];let _0x3279f3=_0x41ca6d['root'];for(let _0x96a552=0x0;_0x96a552<_0x41ca6d['path']['length'];_0x96a552++){const _0x25f1f5=_0x17631e['get'](_0x3279f3)||0x0;_0x364a1a[_0x96a552]=_0x41ca6d['path'][_0x96a552]+_0x25f1f5,_0x3279f3=_0x3279f3['getChildAtOffset'](_0x41ca6d['path'][_0x96a552]);}return new _0x2a81c3(_0x3f7393,_0x364a1a,_0x41ca6d['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x3e0c86,content:_0x45a72f,version:_0x189df9,aiBalloon:_0x539a69}=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'](_0x45a72f,_0x189df9,_0x539a69,_0x3e0c86)['catch'](_0x37c984=>{this['_isAbortError'](_0x37c984)||console['error']('Error\x20refreshing\x20interaction:',_0x37c984);});}['_isAbortError'](_0x473d5f){return!!_0x473d5f['message']&&_0x473d5f['message']['startsWith']('ai-request-aborted');}['_clearInteractionHistory'](){this['_interactions']=[],this['_interactionParams']=void 0x0,this['_currentInteractionIndex']=0x0,this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_stopInteraction'](){this['_interaction']&&this['_interaction']['stop'](),this['_promiseQueue']['abort'](),this['isBusy']=!0x1,this['_interactionParams']&&this['_actionsBalloonView']['stopAutoScroll']();}['_navigateToPrevious'](){const _0x525433=this['_interactions']['length'];this['_currentInteractionIndex']<_0x525433-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x52aa90){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x52aa90;const _0x5cc970=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x5cc970)return;if(_0x5cc970['hasError'])return this['_setErrorState'](_0x5cc970),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x5cc970['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x481674=_0x5cc970['replies'][_0x5cc970['replies']['length']-0x1];if(_0x481674)try{const _0x81b145=os({'changeGroups':_0x481674['changeGroups'],'documentContextContent':_0x481674['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0x391875=>setTimeout(_0x391875,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x81b145[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x89da9e){this['_isAbortError'](_0x89da9e)||console['error']('Error\x20updating\x20content\x20during\x20navigation:',_0x89da9e);}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0x4055e4){const _0x4e8372=Mi(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x4e8372),_0x4055e4['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}['_clearErrorState'](){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async['_clearLoadingState'](){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}}class AIQuickActions extends _0x1970fb{static get['requires'](){return[AIQuickActionsUI,AIQuickActionsEditing,AIActions];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x467cd4){super(_0x467cd4),_0x467cd4['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}}class AIReviewCoreReviewCheckListItemResultsView extends Nt{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x48342b,_0x216ddf){super(_0x48342b),this['id']=_0x216ddf,this['set']('status','pending'),this['set']('changeId',_0x216ddf),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',(_0x2236f2,_0x287e38)=>{_0x287e38&&_0x287e38['target']&&'A'===_0x287e38['target']['tagName']&&_0x287e38['preventDefault'](),this['fire']('activateChange',{'id':_0x216ddf,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x216ddf,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x216ddf,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x56654a=new Nt(this['locale']);return _0x56654a['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x1f8b89=>!_0x1f8b89)]}}),_0x56654a;}['_createAcceptButtonView'](){const _0x2e91d3=new yt(this['locale']);return _0x2e91d3['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x2e91d3['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x5abe79=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x5abe79['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x55d691=>'pending'!==_0x55d691&&'accepted'!==_0x55d691),this['bindTemplate']['if']('status',Bi,_0x14296e=>'pending'===_0x14296e),this['bindTemplate']['if']('status',Gi,_0x1f81cd=>'pending'!==_0x1f81cd),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x4bcd0c=>'accepted'===_0x4bcd0c)]}}),this['on']('change:status',(_0x90d0ab,_0x1520e1,_0x1f54fb)=>{_0x2e91d3['isEnabled']='pending'===_0x1f54fb,'accepted'===_0x1f54fb&&(_0x2e91d3['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x2e91d3['icon']=_0x17783f);}),_0x2e91d3;}['_createDismissButtonView'](){const _0x938070=new yt(this['locale']);return _0x938070['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x938070['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x4b3663=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x4b3663['stopPropagation']();})},'attributes':{'class':[Gi,this['bindTemplate']['if']('status','ck-hidden',_0x2b7ff9=>'pending'!==_0x2b7ff9&&'rejected'!==_0x2b7ff9),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x2b3474=>'pending'===_0x2b3474),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x3f5190=>'rejected'===_0x3f5190)]}}),this['on']('change:status',(_0x25d9d2,_0x1e5be5,_0x264428)=>{_0x938070['isEnabled']='pending'===_0x264428,'rejected'===_0x264428&&(_0x938070['label']=Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x938070['icon']=_0x59fd32);}),_0x938070;}['_createInfoButtonView'](){const _0xb24bad=new yt(this['locale']);return _0xb24bad['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x5ccdf0,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':Gi+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0xb24bad['bind']('isOn')['to'](this,'isInfoToggleOn',_0x42ea02=>_0x42ea02),_0xb24bad['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0xb24bad;}['_createOutdatedButtonView'](){const _0x5c525c=new yt(this['locale']);return _0x5c525c['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':st,'withText':!0x0,'isEnabled':!0x1}),_0x5c525c['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0xff0395=>'outdated'!==_0xff0395)],'disabled':'disabled'}}),_0x5c525c;}}class AIReviewCoreBalloonSuggestionItemView extends zt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x4a2afa,_0x1e5879){super(_0x4a2afa),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']()),_0x1e5879['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x506699){this['resultItemView']['changeId']=_0x506699['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x506699['contentDiffed'];}['showBalloon'](_0xc2951b,_0x4bc507,_0xc7be67,_0x5910ba,_0x2cbb55,_0xf62e07){const _0x3c061f=_0x4bc507();if(!_0x3c061f)return;this['updateContent'](_0xc2951b),this['show']();const _0x4c8eeb=Array['from'](_0x3c061f['getClientRects']())['reverse'](),_0x3c56a4=this['_getPointedRectIndexFromEvent'](_0xc7be67,_0x4c8eeb),_0x4770e0=_0x4c8eeb[_0x3c56a4??0x0];'click'===_0x5910ba?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x4bc507(),_0x3c56a4,_0xc2951b['id'],_0x2cbb55,_0xf62e07)||_0x4770e0})):'hover'===_0x5910ba&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x4bc507(),_0x3c56a4,_0xc2951b['id'])||_0x4770e0}));}['hideBalloon'](){this['hide'](),this['unpin'](),this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetElement']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}['hideDiffInBalloon'](){this['resultItemView']['showDiff']=!0x1;}['showDiffInBalloon'](){this['resultItemView']['showDiff']=!0x0;}['deactivateChange'](){this['fire']('deactivateChange',{'origin':'balloon'});}['_setupClickOutsideHandler'](){jt({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0x493ea6=[this['element']];return this['_pinnedTargetElement']&&_0x493ea6['push'](this['_pinnedTargetElement']),_0x493ea6;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x152d84=new Nt();return this['resultItemView']=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x152d84['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']]}]}),_0x152d84;}['_getBestRectPositionOnClick'](_0x1984d6,_0x5c0daf,_0x501b28,_0x56df9a,_0x1fc1e0){if(!_0x1984d6)return null;const _0x487500=this['position']['replace']('arrow_',''),_0x2e306b=Array['from'](_0x1984d6['getClientRects']());let _0x5118ca,_0x46606d=_0x2e306b['reverse']();return void 0x0!==_0x5c0daf&&this['_isPinnedRectVisible'](_0x46606d[_0x5c0daf],_0x56df9a,_0x1fc1e0)?(_0x5118ca=_0x46606d[_0x5c0daf],this['_pinnedRectIndex']=_0x5c0daf):this['_isPinnedRectVisible'](_0x46606d[0x0],_0x56df9a,_0x1fc1e0)&&void 0x0===_0x5c0daf?_0x5118ca=_0x46606d[0x0]:(_0x46606d='s'==_0x487500[0x0]?[..._0x2e306b]['reverse']():_0x2e306b,_0x46606d['forEach'](_0xdc197d=>{this['_isPinnedRectVisible'](_0xdc197d,_0x56df9a,_0x1fc1e0)&&(_0x5118ca=_0xdc197d);})),this['_pinnedTargetChangeId']=_0x501b28,this['_pinnedTargetElement']=_0x1984d6,_0x5118ca||_0x1984d6['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x595edf,_0x72bc9b,_0xb34084){if(!_0x595edf)return null;const _0x32d251=Array['from'](_0x595edf['getClientRects']())['reverse']();if(void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x72bc9b&&this['_pinnedTargetChangeId']!==_0xb34084)return this['_pinnedRectIndex']=_0x72bc9b,this['_pinnedTargetElement']=_0x595edf,this['_pinnedTargetChangeId']=_0xb34084,_0x32d251[_0x72bc9b];if(void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0xb34084){if(_0x595edf!==this['_pinnedTargetElement'])return Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']];return _0x32d251[this['_pinnedRectIndex']];}return void 0x0!==_0x72bc9b&&this['_pinnedTargetChangeId']!==_0xb34084?(this['_pinnedRectIndex']=_0x72bc9b,this['_pinnedTargetElement']=_0x595edf,this['_pinnedTargetChangeId']=_0xb34084,_0x32d251[_0x72bc9b]):_0x595edf['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x3a708,_0x4ac23f){if(_0x3a708)for(let _0x18b1e6=0x0;_0x18b1e6<_0x4ac23f['length'];_0x18b1e6++){const _0x1c26a9=_0x4ac23f[_0x18b1e6];if(_0x3a708['clientX']>=_0x1c26a9['left']-0x3&&_0x3a708['clientX']<=_0x1c26a9['right']+0x3&&_0x3a708['clientY']>=_0x1c26a9['top']-0x3&&_0x3a708['clientY']<=_0x1c26a9['bottom']+0x3)return _0x18b1e6;}}['_isPinnedRectVisible'](_0x6a26c2,_0x4a3972,_0x382812){const _0x58414b=new dt(_0x6a26c2),_0xbb332f=_0x4a3972||document['documentElement'],_0x1b0ab1=_0x58414b['getIntersection'](Ot(_0x382812)),_0x2e3604=new dt(_0xbb332f)['getIntersection'](_0x58414b);return!!(_0x1b0ab1&&_0x2e3604&&_0x58414b['width']>0x0);}}const Zn=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];class AIReviewCoreUI extends _0x915a98{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[AITabs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x39c560){super(_0x39c560),this['_bodyCollection']=new Xt(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Zn)['to'](this),this['_balloonSuggestionView']=new AIReviewCoreBalloonSuggestionItemView(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x4d9cfd=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x4d9cfd);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0x5cd2cf){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x5c616c=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0x5cd2cf,_0x5c616c);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0xf3bd61){_0xf3bd61&&('error-general'!==_0xf3bd61['status']?'error-chunk'!==_0xf3bd61['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x3681c8){this['_mainView']['addCheckRunResult'](_0x3681c8);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0x93e88d){this['_mainView']['showGeneralReviewCoreErrorView'](_0x93e88d??Mi(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x255269,_0x5ba925){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x255269,_0x5ba925);}['setActiveStateInResults'](_0x1c2b2c){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x327211=>{_0x327211['id']===_0x1c2b2c&&_0x327211['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x3b28a1=>_0x3b28a1['setItemAsInactive']());}['updateChangeState'](_0x1cc520,_0xc627de){'accepted'===_0xc627de||'rejected'===_0xc627de||'outdated'===_0xc627de?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x1cc520,_0xc627de):this['_mainView']['reviewCheckResultsView']['showResult'](_0x1cc520,_0xc627de);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x18036d,_0xd54105,_0x5b6184,_0xf2205,_0x1e6731,_0x51407a){this['_balloonSuggestionView']['showBalloon'](_0x18036d,_0xd54105,_0x5b6184,_0xf2205,_0x1e6731,_0x51407a);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x314e37){const _0x27cccd=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x752584=>_0x752584['id']===_0x314e37);return _0x27cccd?_0x27cccd['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}}class AIReviewCoreGeneralErrorView extends Nt{constructor(_0x4ca4ff){super(_0x4ca4ff),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x10e8a9=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x10e8a9['if']('isVisible','ck-hidden',_0x320f10=>!_0x320f10)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x10e8a9['to']('errorMessage')}]}]});}}class AIReviewCoreView extends Nt{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x13932f,_0x45ba04){super(_0x13932f),this['reviewCoreHeader']=_0x45ba04['header'],this['generalErrorView']=new AIReviewCoreGeneralErrorView(_0x13932f),this['reviewCheckListView']=_0x45ba04['list'],this['reviewCheckListView']['delegate'](...Zn)['to'](this),this['reviewCheckResultsView']=_0x45ba04['results'],this['reviewCheckResultsView']['delegate'](...Zn)['to'](this),this['reviewCompletedView']=_0x45ba04['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'](_0x31cde8){this['reviewCheckResultsView']['addResult'](_0x31cde8),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'](_0x553056){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x553056;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}}class AIReviewCoreFinishReviewButtonView extends yt{constructor(_0x53db86,_0xec2a98){super(_0xec2a98),this['set']({'label':_0x53db86,'withText':!0x0,'class':Ui}),this['on']('execute',()=>{this['fire']('finishReview');});}}class AIReviewCoreUICheckResultsView extends Ht{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x34b3d3,_0x51e098){super(_0x34b3d3),this['_contents']=_0x51e098,this['_resultViews']=new _0x171c0b(),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_acceptAllButtonView']=this['_createAcceptAllButtonView'](),this['_exitReviewButtonView']=this['_createExitReviewButtonView'](),this['_toggleDiffButtonView']=this['_createToggleDiffButtonView'](),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](),this['_resultsHeader']=this['_createResultHeaderView'](),this['_resultsBody']=this['_createResultsBodyView'](),this['_errorMessageView']=this['_createErrorView'](),this['reviewDisclaimer']=new AIDisclaimerView(_0x34b3d3),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0xa74bcf=this['_createCombinedSkeletonLoader'](),_0x2aaa12=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0x2aaa12['if']('isLoading','ck-ai_review__check-run_loading',_0x5e6d4e=>_0x5e6d4e),_0x2aaa12['if']('isResultReady','ck-ai_review__check-run_ready',_0x2644f8=>_0x2644f8),_0x2aaa12['if']('isVisible','ck-hidden',_0x5e2043=>!_0x5e2043)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0xa74bcf,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x24ae88){const _0x16d7eb=new AIReviewCoreReviewCheckListItemResultsView(this['locale'],_0x24ae88['id']);_0x16d7eb['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x16d7eb),_0x16d7eb['resultResponseView']['element']['innerHTML']=_0x24ae88['contentDiffed'];}['hideResult'](_0x5eafc1,_0x3d50ac){if('pending'===_0x3d50ac)return;const _0x5ebacb=this['_resultViews']['find'](_0x1a6951=>_0x1a6951['id']===_0x5eafc1);_0x5ebacb&&(_0x5ebacb['status']=_0x3d50ac,_0x5ebacb['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x13b20e,_0x8145c5){if('pending'!==_0x8145c5)return;const _0x1ae2ab=this['_resultViews']['find'](_0x49c4df=>_0x49c4df['id']===_0x13b20e);_0x1ae2ab&&(_0x1ae2ab['status']=_0x8145c5,_0x1ae2ab['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x52c652,_0x10b81c){this['headerTitle']=_0x52c652,this['headerSubtitle']=_0x10b81c||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new AISkeletonView(this['locale'],Ls['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x20f4bf=new Nt(this['locale']),_0x23902d=[];for(let _0x8d5386=0x0;_0x8d5386<0x10;_0x8d5386++){const _0x3fdce5=this['_createSkeletonLoader']();_0x3fdce5['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0x23902d['push'](_0x3fdce5);}return _0x20f4bf['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x1ad3c7=>!_0x1ad3c7)]},'children':_0x23902d}),_0x20f4bf;}['_createResultsBodyView'](){const _0x8ad0b7=new Nt(this['locale']);return _0x8ad0b7['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x5ab15b=>_0x5ab15b)]},'children':this['_resultViews']}),_0x8ad0b7;}['_createErrorView'](){const _0x961bb5=new Nt(this['locale']),_0x4e9a41=new yt(this['locale']),t=this['locale']['t'];return _0x961bb5['delegate']('retryReview')['to'](this),_0x4e9a41['set']({'label':t('Try\x20again'),'withText':!0x0,'class':Bi+'\x20ck-ai_review__check-run-error-retry-button'}),_0x4e9a41['on']('execute',()=>{this['fire']('retryReview');}),_0x961bb5['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0x5d796b=>!_0x5d796b),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0xe541d5=>'chunk'===_0xe541d5)]},'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',_0xadf45=>'chunk'===_0xadf45)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x286469=>'general'!==_0x286469)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x555bbc=>'chunk'!==_0x555bbc)]},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x4e9a41]}),_0x961bb5;}['_createCancelButtonView'](){const _0x3e51c8=new yt(this['locale']);return _0x3e51c8['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[Bi+'\x20ck-ai-button-stop-generating'],'icon':_0x41314d}),_0x3e51c8['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x2d66dc=>_0x2d66dc),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x5f5aa8=>_0x5f5aa8)]}}),_0x3e51c8['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x3e51c8;}['_createToggleDiffButtonView'](){const _0x3f1320=new yt(this['locale']);_0x3f1320['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x3f1320['bind']('isEnabled')['to'](this,'isError',_0x30a23c=>!_0x30a23c),_0x3f1320['extendTemplate']({'attributes':{'class':[Bi,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x4273fe=>!_0x4273fe),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x33a0ad=>_0x33a0ad)]}});const _0x37ffd4=Mi(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0xb10c10=Mi(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x3f1320['bind']('isOn')['to'](this,'isToggleDiffOn',_0x3dbfd8=>_0x3dbfd8),_0x3f1320['bind']('icon')['to'](this,'isToggleDiffOn',_0x385fb3=>_0x385fb3?nt:rt),_0x3f1320['bind']('label')['to'](this,'isToggleDiffOn',_0x2f9eaf=>_0x2f9eaf?_0x37ffd4:_0xb10c10),_0x3f1320['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x3f1320;}['_createAcceptAllButtonView'](){const _0x166c6a=new yt(this['locale']);return _0x166c6a['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x166c6a['bind']('isEnabled')['to'](this,'isError',_0x100a3f=>!_0x100a3f),_0x166c6a['extendTemplate']({'attributes':{'class':[Ui,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x25a148=>!_0x25a148),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2ff277=>_0x2ff277)]}}),_0x166c6a['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x166c6a;}['_createExitReviewButtonView'](){const _0x3ccb82=new yt(this['locale']);return _0x3ccb82['set']({'label':Mi(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x3ccb82['extendTemplate']({'attributes':{'class':[Gi,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x40f636=>!_0x40f636),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x25e19e=>_0x25e19e)]}}),_0x3ccb82['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x3ccb82;}['_createResultHeaderView'](){const _0x10e0e1=new Nt(this['locale']),_0x23342b=this['_createTitleView']();return _0x10e0e1['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x3fca28=>_0x3fca28)]},'children':[_0x23342b,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x3c5583=>!_0x3c5583)],'title':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x10e0e1;}['_createTitleView'](){const _0x43ed7f=new Nt(this['locale']),_0x17bc04=new AISpinnerView();return _0x17bc04['bind']('isVisible')['to'](this,'isResultReady',_0x5382c8=>!_0x5382c8),_0x43ed7f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0xb0f375=>_0xb0f375)]},'children':[_0x17bc04,{'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')}]}]}]}),_0x43ed7f;}['_createFinishReviewButtonView'](){const _0x3a486b=new AIReviewCoreFinishReviewButtonView(Mi(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x3a486b['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0x13fe64=>!_0x13fe64)]}}),_0x3a486b['delegate']('finishReview')['to'](this),_0x3a486b;}}class AIReviewCoreReviewCompletedView extends Ht{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x46f7b8,_0x603fc5){super(_0x46f7b8),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x603fc5['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x603fc5['headerText']);const _0x3a999b=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x3a999b['if']('isVisible','ck-hidden',_0x3dceb8=>!_0x3dceb8)]},'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':_0x603fc5['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x5817ec){const _0x3f8450=new AIReviewCoreFinishReviewButtonView(_0x5817ec,this['locale']);return _0x3f8450['delegate']('finishReview')['to'](this),_0x3f8450;}['_createResultHeaderView'](_0x1b88e3){const _0x3160f6=new Nt(this['locale']);return _0x3160f6['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x1b88e3},'children':[{'text':_0x1b88e3}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x3160f6;}}class AIReviewCoreFormDropdownView extends Nt{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x6ff8c9,_0x506797){super(_0x6ff8c9),this['_defaultValue']=_0x506797['default']||(_0x506797['data']['length']>0x0?_0x506797['data'][0x0]['id']:''),this['_defaultLabel']=_0x506797['data']['find'](_0x2b40bb=>_0x2b40bb['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=Ft(this['locale']);const _0x82ebb5=this['_prepareListOptions'](_0x506797['data']);Jt(this['_dropdownView'],_0x82ebb5,{'role':'menu','ariaLabel':_0x506797['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x300bbd=>{_0x300bbd['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x32fb15=>{this['formValue']=_0x32fb15['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x32fb15['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'](_0x2bc7ea=[]){const _0x1b5834=new _t();this['resetToDefault']();for(const _0x42780f of _0x2bc7ea){const _0xecb49a=new Zt({'label':_0x42780f['label'],'withText':!0x0,'role':'menuitemradio','id':_0x42780f['id'],'model':_0x42780f});_0xecb49a['bind']('isOn')['to'](this,'formValue',_0x5502ee=>_0x5502ee===_0xecb49a['id']);const _0x3c4496={'type':'button','model':_0xecb49a};_0x1b5834['add'](_0x3c4496);}return _0x1b5834;}}class AIReviewCoreFormManagerView extends Ht{['_formItem']=null;constructor(_0x35d8f3,_0x4b95f2,_0x2ac36b){super(_0x35d8f3),this['argsKey']=_0x4b95f2?.['argsKey'];if('dropdown'===_0x4b95f2['formType'])this['_formItem']=new AIReviewCoreFormDropdownView(this['locale'],_0x4b95f2);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x553b5e=new _0x58d4aa(this['locale'],{'children':[this['_formItem']],'class':[_0x2ac36b?'ck-form__row_with-submit':'']});_0x2ac36b&&_0x553b5e['children']['add'](_0x2ac36b),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x553b5e]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}}class AIReviewCorePromptInputView extends _0x514117{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x1cf7bd){super(_0x1cf7bd),this['set']('isEmpty',!0x0),this['keystrokes']=new At(),this['minRows']=AIReviewCorePromptInputView['MIN_ROWS'],this['maxRows']=AIReviewCorePromptInputView['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}}class AIReviewCoreCustomCheckView extends Nt{['focusTracker']=new It();['keystrokes']=new At();['focusCycler'];['_focusables']=new _0x171c0b();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x314b6b,_0x4efdee,_0x5d50c2=!0x1){super(_0x314b6b),this['_check']=_0x4efdee,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x4efdee['defaultModel']?_0x4efdee['defaultModel']['id']:'',this['_defaultLabel']=_0x4efdee['defaultModel']?_0x4efdee['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new _0x19464f(this['locale'],()=>new AIReviewCorePromptInputView(_0x314b6b)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new _t(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x5d50c2),Jt(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new _0x58d4aa(this['locale'],{'children':[this['promptInputView']]}),new _0x58d4aa(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x214379,_0x6b1b6)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0x6b1b6()):_0x6b1b6();}),this['focusCycler']=new Ut({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),([this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x76017=>{this['_focusables']['add'](_0x76017),this['focusTracker']['add'](_0x76017['element']);}),this['keystrokes']['listenTo'](this['element']));}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x4d0259 of this['_getFormValidators']()){const _0x540278=_0x4d0259();if(_0x540278)return this['promptInputView']['errorText']=_0x540278,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return Mi(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x2c6192=new yt(this['locale']),t=this['locale']['t'];return _0x2c6192['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x2c6192['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x2c6192;}['_createCancelButtonView'](){const _0x18ef17=new yt(this['locale']),t=this['locale']['t'];return _0x18ef17['set']({'label':t('Cancel'),'withText':!0x0,'class':Gi}),_0x18ef17['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x3d1169=>{_0x3d1169['stopPropagation']();})}}),_0x18ef17['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x18ef17;}['_setModelList'](_0xbb1972){this['_modelSelectionDropdownItems']['clear']();const _0x5d184b=this['_check']['models'];if(_0xbb1972)this['set']('modelDisplayMode','hidden');else{const _0x5966c9=0x1===_0x5d184b['length'];this['set']('modelDisplayMode',_0x5966c9?'name':'selector');}if(this['resetToDefault'](),_0x5d184b?.['length']){0x1===_0x5d184b['length']&&this['set']('activeModelName',_0x5d184b[0x0]['name']||_0x5d184b[0x0]['id']);for(const _0x471ef5 of _0x5d184b){const _0x12a1b3=new Zt({'label':_0x471ef5['name'],'withText':!0x0,'role':'menuitemradio','id':_0x471ef5['id'],'model':_0x471ef5});_0x12a1b3['bind']('isOn')['to'](this,'modelId',_0x2098e5=>_0x2098e5===_0x471ef5['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x12a1b3,'labelView':new ModelButtonLabelView(this['locale'],_0x471ef5)});}}}['_createModelSelectionDropdown'](){const _0x5d5482=Ft(this['locale']);return _0x5d5482['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x5d5482['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':Gi}),_0x5d5482['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3a1b6c=>'selector'===_0x3a1b6c),this['listenTo'](_0x5d5482,'execute',_0x11fd1b=>{this['modelId']=_0x11fd1b['source']['model']['id'],_0x5d5482['buttonView']['label']=_0x11fd1b['source']['label'];}),_0x5d5482;}['_createModelNameView'](){const _0x42d86c=new ModelNameView(this['locale']);return _0x42d86c['bind']('text')['to'](this,'activeModelName',_0x3e0ce4=>_0x3e0ce4??''),_0x42d86c['bind']('isVisible')['to'](this,'modelDisplayMode',_0x1898f4=>'name'===_0x1898f4),_0x42d86c;}['_createActionsFooterView'](){const _0x344109=new Nt(this['locale']);return _0x344109['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x344109;}}class ModelNameView extends Nt{constructor(_0xf9c29a){super(_0xf9c29a),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x310705=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x310705['if']('isVisible','ck-hidden',_0x29022a=>!_0x29022a)]},'children':[{'text':_0x310705['to']('text')}]});}}class ModelButtonLabelView extends Mt{constructor(_0x1d53bc,_0x3822d9){super();const _0x57abb2=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x57abb2['to']('style'),'id':_0x57abb2['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x57abb2['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x3822d9['description']||'']}]}]});}}class AIReviewCoreReviewCommandListItemView extends Ht{['_formItemsCollection']=new _0x171c0b();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x4f5fb4,_0x4a8f73,_0x5092f1,_0x1e3050=!0x1){super(_0x4f5fb4),this['_hideModels']=_0x1e3050,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x4a8f73['isParameterized']);const _0x562435=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',_0x95c7a4=>_0x95c7a4),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x4fffe8=>_0x4fffe8)],'style':{'--ck-ai-review-check-list-item-index':_0x5092f1}},'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':_0x4a8f73['title']}]},_0x562435]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x4a8f73['description']?[{'text':_0x4a8f73['description']}]:[]}]}]},..._0x4a8f73['isParameterized']?[this['_createParameterizedView'](_0x4a8f73)]:[],...'custom'===_0x4a8f73['id']?[this['_createCustomView'](_0x4a8f73,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x4a8f73['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x4a8f73['id'],'args':_0x4a8f73['useArgs']?_0x4a8f73['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&jt({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x185158=>{_0x185158['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x10c302=new Lt();return _0x10c302['content']=ot,_0x10c302['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x10c302;}['_createParameterizedView'](_0x58fff1){const _0x2ab3ac=new Nt(),_0x2bd832=this['_createFormView'](_0x58fff1);return _0x2ab3ac['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x25e6dc=>!_0x25e6dc)]},'children':[_0x2bd832]}),_0x2ab3ac;}['_createFormView'](_0x576f87){const _0x5cafa0=new Nt(),_0x992795=Array['isArray'](_0x576f87['options'])?_0x576f87['options']:[],_0x46a756=new yt(this['locale']),t=this['locale']['t'];_0x46a756['set']({'label':t('Submit'),'withText':!0x0,'class':Ui}),_0x46a756['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x2fc236=>{_0x2fc236['stopPropagation']();})}}),_0x46a756['on']('execute',()=>{const _0xc82bf=[],_0xce190a={};this['_formItemsCollection']['forEach'](_0x5adae2=>{_0xc82bf['push'](_0x5adae2['value']),_0x576f87['useArgs']&&_0x576f87['options']&&(_0xce190a[_0x5adae2['argsKey']]=_0x5adae2['value']);}),this['fire']('runReviewCheck',{'id':_0x576f87['id'],'params':_0xc82bf['length']?_0xc82bf:void 0x0,'args':Object['keys'](_0xce190a)['length']?_0xce190a:void 0x0});});const _0x24b210=_0x992795['length'];return _0x992795['forEach']((_0x5cbf1d,_0x3bbe22)=>{const _0x47fc71=_0x3bbe22===_0x24b210-0x1;this['_formItemsCollection']['add'](new AIReviewCoreFormManagerView(this['locale'],_0x5cbf1d,_0x47fc71?_0x46a756:null));}),_0x5cafa0['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x5cafa0;}['_createCustomView'](_0x59d5c9,_0x57e640=!0x1){return this['_customCheckView']=new AIReviewCoreCustomCheckView(this['locale'],_0x59d5c9,_0x57e640),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',_0x418ce4=>!_0x418ce4)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x4cf5bd,_0x54110a,_0x3004d7)=>{_0x3004d7||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}}class AIReviewCoreReviewCheckListView extends Ht{['_checkViews'];constructor(_0x111e9c){super(_0x111e9c),this['_checkViews']=new _0x171c0b(),this['_setupTemplate']();}['setChecks'](_0x34ac85,_0x20d9ad=!0x1){this['_checkViews']['clear']();for(const [_0x2de13d,_0x1a5e01]of _0x34ac85['entries']()){const _0x4dbcc7=new AIReviewCoreReviewCommandListItemView(this['locale'],_0x1a5e01,_0x2de13d,_0x20d9ad);_0x4dbcc7['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0x4dbcc7);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x18f0a7 of this['_checkViews'])_0x18f0a7 instanceof AIReviewCoreReviewCommandListItemView&&_0x18f0a7['resetToDefault']();}['_setupTemplate'](){const _0x163dea=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x163dea['if']('isVisible','ck-hidden',_0x20e66f=>!_0x20e66f)]},'children':this['_checkViews']});}}class AIReviewModeUI extends AIReviewCoreUI{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x1392e8=this['context']['plugins']['get']('AITabs'),_0x570ceb=this['context']['locale'],_0x2ae176=new AIHeaderView(_0x570ceb,{'label':Mi(_0x570ceb,'AI_REVIEW_MODE'),'icon':_0x2e517,'class':'ck-ai-header_review','showResizeButton':_0x1392e8['showResizeButton']});return _0x2ae176['delegate']('resizeTabs')['to'](_0x1392e8),_0x2ae176['bind']('isMaximized')['to'](_0x1392e8['view'],'isMaximized',_0x8ee72a=>_0x8ee72a),new AIReviewCoreView(this['context']['locale'],{'header':_0x2ae176,'list':new AIReviewCoreReviewCheckListView(_0x570ceb),'results':new AIReviewCoreUICheckResultsView(_0x570ceb,{'generalErrorText':Mi(_0x570ceb,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0x570ceb,{'headerText':Mi(_0x570ceb,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':Mi(_0x570ceb,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0x570ceb,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x9af329=this['context']['plugins']['get']('AITabs');_0x9af329['view']['on']('activateTab',(_0x4dfd6e,{newTab:_0x34227d,oldTab:_0x3600c2})=>{'reviewMode'===_0x34227d?this['fire']('getReviewCheckList'):'reviewMode'===_0x3600c2&&this['fire']('leaveReview');}),_0x9af329['view']['addTab']({'id':'reviewMode','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x2e517,'order':0x0,'content':this['_mainView']});}}const tr='review-',er=['softBreak'],ir=['htmlScript','htmlStyle','htmlCustomElement'];class AIReviewCoreEditing extends _0x915a98{static get['requires'](){return[_0x102c6d,AIEditing];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x2ff1df){super(_0x2ff1df),this['_domEmitter']=new(vt())(),this['_eventEmitter']=new(Et())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x457d57=_0x2b6c09=>this['_scheduleAttachReviewEditingToEditor'](_0x2b6c09);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x29da5d)return void _0x457d57(this['context']);const _0x2771ef=this['context'];for(const _0x314440 of _0x2771ef['editors'])_0x457d57(_0x314440);this['listenTo'](_0x2771ef['editors'],'add',(_0x39cf2f,_0x23c4f6)=>{_0x457d57(_0x23c4f6);}),this['listenTo'](_0x2771ef['editors'],'remove',(_0x5b2140,_0xa52b73)=>{for(const [_0x14dce5,_0x477f3b]of this['_markers'])_0x477f3b['editor']===_0xa52b73&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x14dce5,'changeId':_0x477f3b['groupId']}),this['_markers']['delete'](_0x14dce5));});}['_scheduleAttachReviewEditingToEditor'](_0x328f35){const _0x58c989=()=>{'destroyed'!==_0x328f35['state']&&_0x328f35['conversion']&&this['_attachReviewEditingToEditor'](_0x328f35);};if('ready'===_0x328f35['state'])return void _0x58c989();const _0x2984e8=()=>{this['stopListening'](_0x328f35,'ready',_0x2984e8),_0x58c989();};this['listenTo'](_0x328f35,'ready',_0x2984e8);}['_attachReviewEditingToEditor'](_0x157ffe){this['_reviewEditingAttachedEditors']['has'](_0x157ffe)||(_0x157ffe['conversion']['for']('editingDowncast')['markerToElement']({'model':tr+'insert','view':(_0x31f9b0,{writer:_0x201eb2})=>{const _0x33f2e2=this['_markers']['get'](_0x31f9b0['markerName']),_0x500a74={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x33f2e2?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x31f9b0['markerName']};return _0x201eb2['createUIElement']('span',_0x500a74,function(_0x157654){const _0x4b43d3=this['toDomElement'](_0x157654);return _0x4b43d3['innerHTML']=_0x33f2e2?.['content']?.['asString']||'',_0x4b43d3;});}}),_0x157ffe['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-only','view':_0x2e8395=>{const _0x160432=this['_markers']['get'](_0x2e8395['markerName']),_0x1ef022=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x160432?.['id']||'')&&_0x1ef022['push']('ck-ai_review__change_active'),{'classes':_0x1ef022,'attributes':{'data-marker-id':_0x2e8395['markerName']}};}}),_0x157ffe['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-context','view':_0x59c4f1=>{const _0x107d26=this['_markers']['get'](_0x59c4f1['markerName']),_0x53518e=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x107d26?.['id']||'')&&_0x53518e['push']('ck-ai_review__change_active'),{'classes':_0x53518e,'attributes':{'data-marker-id':_0x59c4f1['markerName']}};}}),_0x157ffe['conversion']['for']('editingDowncast')['markerToHighlight']({'model':tr+'remove-text','view':_0x2c6e66=>{const _0x5eadc2=this['_markers']['get'](_0x2c6e66['markerName']),_0x3a104c=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x5eadc2?.['id']||'')&&_0x3a104c['push']('ck-ai_review__change_active'),{'classes':_0x3a104c,'attributes':{'data-marker-id':_0x2c6e66['markerName']}};}}),_0x157ffe['conversion']['for']('dataDowncast')['markerToElement']({'model':tr+'suggestion-context','view':(_0xe2e37c,{writer:_0x25a435})=>_0x25a435['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0xe2e37c['isOpening']?'start':'end')})}),_0x157ffe['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x1e6e9f,'view':_0xc48546}),this['_updateMouseMarkerInteractionListeners'](_0x157ffe),this['listenTo'](_0x157ffe,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x157ffe),{'priority':'lowest'}),this['listenTo'](_0x157ffe,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x157ffe),{'priority':'lowest'}),_0x157ffe['model']['document']['registerPostFixer'](_0x2f5807=>this['_validateMarkers'](_0x157ffe,_0x2f5807)),_0x157ffe['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x157ffe)),this['_reviewEditingAttachedEditors']['add'](_0x157ffe));}['_updateMouseMarkerInteractionListeners'](_0x699ddb){let _0x209dfc=this['_boundEditables']['get'](_0x699ddb);_0x209dfc||(_0x209dfc=new Map(),this['_boundEditables']['set'](_0x699ddb,_0x209dfc));const _0x201a0b=new Set(_0x699ddb['ui']['getEditableElementsNames']());for(const _0x1620b6 of _0x201a0b){if(_0x209dfc['has'](_0x1620b6))continue;const _0x28fcdb=_0x699ddb['ui']['getEditableElement'](_0x1620b6);_0x209dfc['set'](_0x1620b6,_0x28fcdb),this['_attachMouseMarkerInteractionListeners'](_0x28fcdb);}for(const [_0x356492,_0x2b40f9]of _0x209dfc)_0x201a0b['has'](_0x356492)||(_0x209dfc['delete'](_0x356492),this['_domEmitter']['stopListening'](_0x2b40f9));}['_attachMouseMarkerInteractionListeners'](_0x1737e4){this['_domEmitter']['listenTo'](_0x1737e4,'mouseup',(_0x854251,_0xba9b7a)=>{const _0x15e0c2=_0xba9b7a['target'],_0x15e8d3=this['_findMarkerElement'](_0x15e0c2);if(!_0x15e8d3)return;const _0x2f8c2d=_0x15e8d3['getAttribute']('data-marker-id'),_0x5cf2e1=_0x2f8c2d['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x2f8c2d,'changeId':_0x5cf2e1,'markerElement':()=>this['_findMarkerElementById'](_0x2f8c2d),'domEvent':_0xba9b7a});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x1737e4,'mouseover',(_0x11dc1d,_0x5081ed)=>{const _0x434321=_0x5081ed['target'],_0xabf6f2=_0x5081ed['relatedTarget'];let _0x50dfd8=this['_findMarkerElement'](_0x434321);if(!_0x50dfd8&&_0xabf6f2&&(_0x50dfd8=this['_findMarkerElement'](_0xabf6f2)),!_0x50dfd8)return;const _0x234731=_0x50dfd8['getAttribute']('data-marker-id'),_0x261fcd=_0x234731['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x261fcd,'markerElement':()=>this['_findMarkerElementById'](_0x234731),'domEvent':_0x5081ed});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x1902b2((_0xffdcf,_0x5a0a8e)=>{const _0x239048=_0x5a0a8e['target'];if(this['_findMarkerElement'](_0x239048))return;_0x239048['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x5cca39=this['context']['plugins']['get']('AIEditing'),_0x2aedd9=ms(this['context']);if(!_0x2aedd9['length'])throw new ht('ai-get-editor-from-context-no-editor',this);const _0x371a52=new Set(),_0x500ae1=[],_0x479697=new Map();for(const _0x223172 of _0x2aedd9)for(const _0x57bb11 of _0x223172['model']['document']['getRoots']()){if('$graveyard'===_0x57bb11['rootName'])continue;const _0x3974b9=this['_buildDocumentDataSliceForRoot'](_0x223172,_0x57bb11,_0x5cca39,_0x371a52);_0x500ae1['push'](_0x3974b9['content']);for(const [_0x564753,_0x166260]of _0x3974b9['elements'])_0x479697['set'](_0x564753,_0x166260);}return{'elements':_0x479697,'content':_0x500ae1['join']('')};}['_buildDocumentDataSliceForRoot'](_0x2d53a1,_0x3e7fbe,_0x330a6d,_0x579161){const _0x32bba1=_0x2d53a1['model'],_0x305fc5=new _0x27f90b();for(const _0x51e675 of _0x3e7fbe['getChildren']())_0x305fc5['_appendChild'](_0x51e675['_clone'](!0x0));for(const _0x209830 of _0x32bba1['markers']){const _0x392ee3=_0x209830['getRange']();_0x392ee3&&_0x392ee3['root']['rootName']===_0x3e7fbe['rootName']&&_0x305fc5['markers']['set'](_0x209830['name'],this['_changeRangeOwnerDocument'](_0x392ee3['clone'](),_0x305fc5));}const _0x5ace96=new Map(),_0x21246c=_0x32bba1['document']['version'],_0x44c794=new _0x46f40e({'ignoreElementEnd':!0x0,'startPosition':_0x32bba1['createPositionAt'](_0x305fc5,0x0)});for(const {item:_0x2fda59}of _0x44c794){if(_0x2fda59['is']('element')&&_0x2fda59['name']&&ir['includes'](_0x2fda59['name'])){const _0x4f6240=this['_upsertDataId'](_0x2fda59,()=>_0x330a6d['_nextDataId'](_0x579161));_0x579161['add'](_0x4f6240);}if(!_0x2fda59['is']('$textProxy'))continue;const _0x37b37f=_0x2fda59['parent'];if(!_0x37b37f||!_0x37b37f['is']('element'))continue;const _0x16d500=this['_upsertDataId'](_0x37b37f,()=>_0x330a6d['_nextDataId'](_0x579161));_0x579161['add'](_0x16d500);for(const _0xc45dbb of _0x37b37f['getChildren']())_0xc45dbb['is']('element')&&(_0xc45dbb['name']&&er['includes'](_0xc45dbb['name'])||_0x579161['add'](this['_upsertDataId'](_0xc45dbb,()=>_0x330a6d['_nextDataId'](_0x579161))));let _0x216f5b=_0x37b37f;for(;_0x216f5b['parent']&&!_0x216f5b['parent']['is']('documentFragment');)_0x216f5b=_0x216f5b['parent'],_0x216f5b['hasAttribute'](_0x1e6e9f)&&_0x216f5b['_removeAttribute'](_0x1e6e9f);_0x5ace96['set'](_0x16d500,{'editor':_0x2d53a1,'rootName':_0x3e7fbe['rootName'],'path':_0x37b37f['getPath'](),'documentVersion':_0x21246c,'getContent':this['_createGetContentUsingDataIdFn'](_0x216f5b['_clone'](!0x0),_0x16d500,_0x2d53a1['data'])}),_0x44c794['jumpTo'](_0x32bba1['createPositionAfter'](_0x37b37f));}return{'content':_0x2d53a1['data']['processor']['toData'](_0x2d53a1['data']['toView'](_0x305fc5)),'elements':_0x5ace96};}['diffContent'](_0x28d5ef,_0xf24364,_0x24826a,_0x4242a7=!0x1){const {contentInitial:_0x6e6e6,contentNew:_0x164193}=this['_neutralizeChangesOnUnsupportedElements'](_0xf24364,_0x24826a),_0x1df6fb=[],_0x594fe4=_0x28d5ef['data']['parse'](_0x164193,'$documentFragment'),_0x12407a=_0x28d5ef['data']['parse'](_0x6e6e6,'$documentFragment'),_0xc68581=_0x28d5ef['model']['createPositionAt'](_0x12407a,0x0);if(this['_haveSingleTopLevelElement'](_0x594fe4)){if(!this['_hasSameTopLevelElement'](_0x12407a,_0x594fe4))return _0x1df6fb;}else{const _0x317fe1=_0x28d5ef['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x12407a,_0x317fe1)||!this['_haveOnlyInlineContent'](_0x594fe4,_0x317fe1))return _0x1df6fb;}const _0x53fb93=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x6e6e6,_0x164193,{'targetEditor':_0x28d5ef,'anchor':_0xc68581,'markDeletions':!0x0})['getOperations']()['filter'](_0x42146f=>'insert'===_0x42146f['type']||'marker'===_0x42146f['type']&&_0x42146f['name']['startsWith']('$markedRemove')),_0x40ee36=this['_groupAdjacentOperations'](_0x53fb93),_0x1bafd0=[];if(_0x4242a7){if(_0x40ee36['length']){const _0x40bbe1=_0x40ee36[0x0]['operations'][0x0],_0x1a4765='insert'===_0x40bbe1['type']?_0x40bbe1['position']:_0x40bbe1['newRange']['start'],_0x1311a0=this['_getPositionLimitingRange'](_0x1a4765,_0x28d5ef,'inside'),_0x531eea=_0x1311a0?_0x594fe4['getChild'](0x0)['getChildren']():_0x594fe4['getChildren'](),_0x19960a=_0x1311a0||_0x28d5ef['model']['createRangeIn'](_0x12407a),_0x26be5c=[new _0x45d78f('$markedRemove:synthetic'+at(),null,_0x19960a,_0x28d5ef['model']['document']['model']['markers'],!0x0,_0x28d5ef['model']['document']['version']+0x1),new _0x5ea33c(_0x19960a['end'],_0x531eea,_0x28d5ef['model']['document']['version']+0x2)];_0x1bafd0['push']({'operations':_0x26be5c,'operationsIsolated':_0x26be5c,'groupOffset':0x0});}}else _0x1bafd0['push'](..._0x40ee36);let _0x4f5055=0x0;return _0x28d5ef['model']['change'](_0x271d42=>{for(let _0xdce4b7=0x0;_0xdce4b7<_0x1bafd0['length'];_0xdce4b7++){const _0x21b1ae=_0x1bafd0[_0xdce4b7],_0x49a778=_0x271d42['createDocumentFragment']();for(const _0x3bd118 of _0x12407a['getChildren']())_0x271d42['append'](_0x3bd118['_clone'](!0x0),_0x49a778);for(const _0x476744 of _0x21b1ae['operationsIsolated'])if('insert'===_0x476744['type']){const _0x1e2513=_0x476744;_0x1e2513['baseVersion']=null,_0x1e2513['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x1e2513,_0x49a778),_0x271d42['batch']['addOperation'](_0x476744),_0x28d5ef['model']['applyOperation'](_0x476744);const _0xd39c45='suggestion:insertion:id:authorId:'+_0x4f5055++,_0x458693=_0x28d5ef['model']['createRange'](_0x1e2513['position'],_0x1e2513['position']['getShiftedBy'](_0x1e2513['howMany']));_0x49a778['markers']['set'](_0xd39c45,_0x458693);}else{if('marker'===_0x476744['type']&&_0x476744['name']['startsWith']('$markedRemove')){const _0x3291f9=_0x476744,_0x5b0d0b='suggestion:deletion:id:authorId:'+_0x4f5055++;this['_changeOperationOwnerDocument'](_0x3291f9,_0x49a778),_0x49a778['markers']['set'](_0x5b0d0b,_0x3291f9['newRange']);}}if(_0x4242a7)_0x1df6fb['push']({..._0x21b1ae,'context':this['_createGetContentFn'](_0x12407a,_0x28d5ef['data']),'content':this['_createGetContentFn'](_0x12407a,_0x28d5ef['data'])});else{const _0xa663bc=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x21b1ae['operationsIsolated'][0x0]),_0x49a778),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x21b1ae['operationsIsolated'][_0x21b1ae['operationsIsolated']['length']-0x1]),_0x49a778),_0x28d5ef);_0x49a778['markers']['set'](tr+'suggestion-context',new _0x245154(_0xa663bc['start'],_0xa663bc['end'])),_0x1df6fb['push']({..._0x21b1ae,'context':this['_createGetContextFn'](_0x49a778,_0x28d5ef['data'],{'ellipsisBefore':_0xa663bc['hasContentBefore'],'ellipsisAfter':_0xa663bc['hasContentAfter']}),'content':this['_createGetContentFn'](_0x49a778,_0x28d5ef['data'])});}}}),_0x1df6fb;}['markChangePositionInEditorContent'](_0x350904,_0x54d742){if(!_0x350904['length'])return;const _0x27d0fa=_0x350904[0x0]['parent']['id'],_0x153131=_0x54d742['elements']['get'](_0x27d0fa);if(!_0x153131)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x27d0fa);const _0x1c7a76=_0x153131['path'],_0x4ba418=_0x153131['editor'],_0x3f68ac=_0x4ba418['model']['document']['getRoot'](_0x153131['rootName']);if(!_0x3f68ac)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x153131['rootName']);const _0x18a9a7=_0x4ba418['model']['document']['history']['getOperations'](_0x153131['documentVersion']),_0x1ab057=[];for(const _0x14dbd0 of _0x350904){const _0x365a93=_0x14dbd0['operationsIsolated']['map'](_0x36166f=>this['_translateOperationToEditorContent'](_0x36166f,_0x1c7a76,_0x3f68ac));if(!_0x365a93||!_0x365a93['length'])continue;const _0x79cbed=_0x365a93['every'](_0x416cfd=>'marker'===_0x416cfd['type']&&_0x416cfd['name']['startsWith']('$markedRemove')),_0x6845e2={'document':_0x4ba418['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x32083e=_0x144e65(_0x365a93,_0x18a9a7,_0x6845e2)['operationsA'];for(const _0x5105a1 of _0x32083e)if('insert'===_0x5105a1['type']){const _0x10b511=_0x5105a1,_0x3c5fd7=_0x10b511['nodes'];_0x4ba418['model']['change'](_0x3c897f=>{const _0x4a95d2=_0x3c897f['createDocumentFragment']();for(const _0x14d69c of _0x3c5fd7)_0x3c897f['append'](_0x14d69c['_clone'](!0x0),_0x4a95d2);_0x1ab057['push']({'start':_0x10b511['position'],'end':_0x10b511['position'],'type':'insert','groupId':_0x14dbd0['id'],'content':{'asString':this['_createGetContentFn'](_0x4a95d2,_0x4ba418['data'])(),'asFragment':_0x4a95d2}});});}else{if('marker'===_0x5105a1['type']&&_0x5105a1['name']['startsWith']('$markedRemove')){const _0x1e481b=_0x5105a1;let _0xd37edd='remove-text';if(_0x79cbed){const _0x2dd8cd=this['_findAdjacentContextDistance'](_0x1e481b['newRange']['start'],'backward',_0x4ba418['model']['schema']),_0x91b6ad=this['_findAdjacentContextDistance'](_0x1e481b['newRange']['end'],'forward',_0x4ba418['model']['schema']);if(_0x2dd8cd||_0x91b6ad){const _0x2cdb8c=_0x1e481b['newRange']['start']['getShiftedBy'](-_0x2dd8cd),_0x2e557a=_0x1e481b['newRange']['end']['getShiftedBy'](_0x91b6ad);_0x1ab057['push']({'start':_0x2cdb8c,'end':_0x2e557a,'groupId':_0x14dbd0['id'],'type':'remove-context'});}else _0xd37edd='remove-only';}_0x1ab057['push']({'start':_0x1e481b['newRange']['start'],'end':_0x1e481b['newRange']['end'],'groupId':_0x14dbd0['id'],'type':_0xd37edd});}}}this['_insertMarkers'](_0x1ab057,_0x4ba418);}['clearAllMarkers'](){const _0xddf47c=new Map();for(const _0x498bea of this['_markers']['keys']()){const _0x35ce72=this['_markers']['get'](_0x498bea);_0x35ce72?.['editor']&&(_0xddf47c['has'](_0x35ce72['editor'])||_0xddf47c['set'](_0x35ce72['editor'],[]),_0xddf47c['get'](_0x35ce72['editor'])['push'](_0x498bea));}for(const [_0x123e6f,_0x10d719]of _0xddf47c)_0x123e6f['model']['change'](_0x32804d=>{for(const _0xece2c3 of _0x10d719)_0x123e6f['model']['markers']['get'](_0xece2c3)&&_0x32804d['removeMarker'](_0xece2c3);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x52a39f of ms(this['context']))_0x52a39f['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x2c20ef of ms(this['context']))_0x2c20ef['disableReadOnlyMode']('ai-review');}['applyChange'](_0x1b85d5){const _0x3fd605=_0x1b85d5['map'](_0x28c48d=>this['_getMarkersDataForGroup'](_0x28c48d))['flat'](),_0x200f14=new Map();for(const _0x228c7f of _0x3fd605)_0x200f14['has'](_0x228c7f['editor'])||_0x200f14['set'](_0x228c7f['editor'],[]),_0x200f14['get'](_0x228c7f['editor'])['push'](_0x228c7f);for(const [_0x3927a4,_0x20f2ee]of _0x200f14){const _0x270876=_0x3927a4['model'];_0x270876['change'](_0x12b7f9=>{for(const _0x612708 of _0x20f2ee){const _0x1ff557=_0x3927a4['model']['markers']['get'](_0x612708['id']);if(_0x1ff557){if('insert'===_0x612708['type']){if(!_0x612708['content'])continue;_0x270876['insertContent'](_0x612708['content']['asFragment']||null,_0x1ff557['getRange']()['start']);}else'remove-text'!==_0x612708['type']&&'remove-only'!==_0x612708['type']||_0x270876['deleteContent'](_0x270876['createSelection'](_0x1ff557['getRange']()));_0x12b7f9['removeMarker'](_0x612708['id']),this['_markers']['delete'](_0x612708['id']);}}});}}['rejectChange'](_0x7c369f){const _0x5183bf=this['_getMarkersDataForGroup'](_0x7c369f),_0x5eeb82=new Map();for(const _0x4192f4 of _0x5183bf)_0x5eeb82['has'](_0x4192f4['editor'])||_0x5eeb82['set'](_0x4192f4['editor'],[]),_0x5eeb82['get'](_0x4192f4['editor'])['push'](_0x4192f4);for(const [_0x10d82d,_0x49cf50]of _0x5eeb82)_0x10d82d['model']['change'](_0x4cf6c2=>{for(const _0x4775ed of _0x49cf50)_0x4cf6c2['removeMarker'](_0x4775ed['id']),this['_markers']['delete'](_0x4775ed['id']);});}['getEditor'](){return ps(this['context']);}['getEditors'](){return ms(this['context']);}['getEditorForChange'](_0x1e6b2d){const _0x54ad56=this['_getMarkersDataForGroup'](_0x1e6b2d);return _0x54ad56[0x0]?.['editor'];}['getMarkerElementForChange'](_0x2b5591){const _0x5df7cd=Array['from'](this['_markers']['values']())['filter'](_0x5a17e3=>_0x5a17e3['groupId']===_0x2b5591);if(!_0x5df7cd['length'])return null;const _0x21b973=0x1===_0x5df7cd['length']?_0x5df7cd[0x0]:this['_sortMarkers'](_0x5df7cd)[0x0],_0x29b580=_0x21b973['editor']['model']['markers']['get'](_0x21b973['id']);if(!_0x29b580)return null;return{'modelRange':_0x29b580['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x21b973['id'])};}['getContentElementForChange'](_0x3f1e38){const _0x40d7db=Array['from'](this['_markers']['values']())['filter'](_0x2ad7aa=>_0x2ad7aa['groupId']===_0x3f1e38);if(!_0x40d7db['length'])return null;const _0x5099fb=0x1===_0x40d7db['length']?_0x40d7db[0x0]:this['_sortMarkers'](_0x40d7db)[0x0],_0x74c914=_0x5099fb['editor'],_0x4241e0=_0x74c914['model']['markers']['get'](_0x5099fb['id']);if(!_0x4241e0)return null;const _0x414596=_0x4241e0['getRange'](),_0x2959a6=_0x74c914['editing']['view']['getDomRoot'](_0x414596['root']['rootName'])||_0x74c914['editing']['view']['getDomRoot']();if(!_0x2959a6||!_0x414596)return null;let _0x462e14=_0x414596['start']['parent'];for(;_0x462e14['parent']&&!_0x462e14['parent']['is']('rootElement');)_0x462e14=_0x462e14['parent'];if(!_0x462e14||!_0x462e14['name'])return null;const _0x299054=_0x2959a6['querySelector']('[data-marker-id=\x22'+_0x5099fb['id']+'\x22]');if(!_0x299054)return null;let _0x4f36af=null;_0x74c914['model']['change'](_0x23ea92=>{_0x4f36af=_0x23ea92['createDocumentFragment'](),_0x23ea92['append'](_0x462e14['_clone'](!0x0),_0x4f36af);});const _0x3b2e80=_0x74c914['data']['toView'](_0x4f36af)['getChild'](0x0);return _0x299054['closest'](_0x3b2e80['name']);}['reactivateMarkers'](_0x38cd83){const _0x2ddf3a=this['_getMarkersDataForGroup'](_0x38cd83);if(!_0x2ddf3a['length'])return;const _0x304218=Array['from'](this['_activeMarkers'])['sort'](),_0x2c4cc9=Array['from'](new Set(_0x2ddf3a['map'](_0x49be75=>_0x49be75['id'])))['sort']();_0x304218['join']('|')!==_0x2c4cc9['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x38cd83));}['setMarkersInElementAsActive'](_0x3b19d6){const _0x130b56=this['_getMarkersDataForGroup'](_0x3b19d6);if(!_0x130b56['length'])return;const _0x2dab5d=_0x130b56[0x0]['editor'],_0x7d8334=new Set(_0x130b56['map'](_0x8485aa=>_0x8485aa['id'])),_0x5a3944=Array['from'](_0x7d8334['values']())['map'](_0x542bf0=>_0x2dab5d['model']['markers']['get'](_0x542bf0))['filter'](_0x592ec7=>!!_0x592ec7);_0x7d8334['forEach'](_0x2cd74c=>{this['_activeMarkers']['add'](_0x2cd74c);}),_0x2dab5d['model']['change'](()=>{_0x5a3944['forEach'](_0x37e3ec=>{_0x2dab5d['editing']['reconvertMarker'](_0x37e3ec);});});}['setAllMarkersAsInactive'](){const _0x26b7c4=Array['from'](this['_activeMarkers']);if(!_0x26b7c4['length'])return;this['_activeMarkers']['clear']();const _0x349842=new Map();for(const _0x2985ff of _0x26b7c4){const _0x5c2a77=this['_markers']['get'](_0x2985ff);if(!_0x5c2a77)continue;const _0x4e4955=_0x5c2a77['editor'],_0x5a9a94=_0x4e4955['model']['markers']['get'](_0x2985ff);_0x5a9a94&&(_0x349842['has'](_0x4e4955)||_0x349842['set'](_0x4e4955,[]),_0x349842['get'](_0x4e4955)['push'](_0x5a9a94));}for(const [_0x3a0357,_0xad2d26]of _0x349842)_0x3a0357['model']['change'](()=>{_0xad2d26['forEach'](_0x5427c8=>{_0x3a0357['editing']['reconvertMarker'](_0x5427c8);});});}['_getPositionLimitingRange'](_0x1a8e82,_0x5ec838,_0xe145e9='outside'){if(!_0x1a8e82)return null;let _0x275537=_0x1a8e82['parent'];for(;_0x275537&&_0x275537['parent']&&!_0x275537['parent']['is']('rootElement')&&!_0x5ec838['model']['schema']['isLimit'](_0x275537)&&!_0x5ec838['model']['schema']['isBlock'](_0x275537);)_0x275537=_0x275537['parent'];if(!_0x275537||!_0x275537['name']||_0x275537['is']('rootElement'))return null;let _0x228c80=null;return _0x5ec838['model']['change'](_0xc80c30=>{_0x228c80='inside'===_0xe145e9?_0xc80c30['createRangeIn'](_0x275537):_0xc80c30['createRangeOn'](_0x275537);}),_0x228c80;}['_validateMarkers'](_0x1c17cf,_0x510896){const _0x149ca3=Array['from'](this['_markers']['keys']()),_0x2d1aaa=new Map();for(const _0x38ac2b of _0x149ca3){const _0x5ba18d=_0x1c17cf['model']['markers']['get'](_0x38ac2b);if(!_0x5ba18d)continue;const _0x23e885=_0x5ba18d['getStart']()['root']['rootName']+':'+_0x5ba18d['getStart']()['path'][0x0];_0x2d1aaa['has'](_0x23e885)||_0x2d1aaa['set'](_0x23e885,[]),_0x2d1aaa['get'](_0x23e885)['push'](_0x5ba18d);}const _0x4115b5=new Set();for(const _0x5c4e94 of _0x1c17cf['model']['document']['differ']['getChanges']()){let _0x2e45b1='',_0x2b873c=null;if('insert'===_0x5c4e94['type'])_0x2b873c=new _0x245154(_0x5c4e94['position'],_0x5c4e94['position']['getShiftedBy'](_0x5c4e94['length'])),_0x2e45b1=_0x5c4e94['position']['root']['rootName']+':'+_0x5c4e94['position']['path'][0x0];else{if('remove'!==_0x5c4e94['type'])continue;_0x2b873c=new _0x245154(_0x5c4e94['position']),_0x2e45b1=_0x5c4e94['position']['root']['rootName']+':'+_0x5c4e94['position']['path'][0x0];}const _0x468ea3=_0x2d1aaa['get'](_0x2e45b1)||[];if(_0x468ea3['length']){for(const _0x531156 of _0x468ea3)if(_0x2b873c['root']['rootName']===_0x531156['getRange']()['root']['rootName']&&('insert'!==_0x5c4e94['type']||!_0x2b873c['containsRange'](_0x531156['getRange']()))&&(_0x2b873c['isIntersecting'](_0x531156['getRange']())||_0x2b873c['start']['isTouching'](_0x531156['getRange']()['end'])||_0x2b873c['end']['isTouching'](_0x531156['getRange']()['start']))){const _0x37f696=this['_parseMarkerName'](_0x531156['name']);Array['from'](this['_markers']['values']())['filter'](_0x2e19aa=>_0x2e19aa['groupId']===_0x37f696['groupId'])['forEach'](_0x5cb89f=>_0x4115b5['add'](_0x5cb89f['id']));}}}if(_0x4115b5['size']){for(const _0x5d4509 of _0x4115b5)_0x510896['removeMarker'](_0x5d4509);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x4882a9){for(const {name:_0xc981cc,data:_0x537b36}of _0x4882a9['model']['document']['differ']['getChangedMarkers']()){if(!_0xc981cc['startsWith'](tr))continue;const _0x19e113=_0x537b36['oldRange'],_0x3d5c53=_0x537b36['newRange'],_0x568315=_0x19e113&&'$graveyard'===_0x19e113['root']['rootName'],_0x4b00f6=_0x3d5c53&&'$graveyard'===_0x3d5c53['root']['rootName'];if(_0x568315&&_0x4b00f6)continue;const _0x475842=this['_parseMarkerName'](_0xc981cc);this['_markers']['get'](_0xc981cc)&&(_0x4b00f6||!_0x3d5c53?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xc981cc,'changeId':_0x475842['groupId']}):_0x568315&&_0x3d5c53&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0xc981cc,'changeId':_0x475842['groupId']}));}}['_parseMarkerName'](_0x4f7819){const _0x34dfcd=_0x4f7819['split'](':'),_0x174dfe=(_0x34dfcd[0x1]||'')['split']('_');return{'prefix':_0x34dfcd[0x0],'groupId':_0x174dfe[0x0],'suffix':_0x174dfe[0x1]};}['_translateOperationToEditorContent'](_0x4ade33,_0x249540,_0x3c5045){if('insert'===_0x4ade33['type']){const _0xcb2db0=_0x4ade33;return new _0x5ea33c(this['_changePosition'](_0x249540['concat'](_0xcb2db0['position']['offset']),_0x3c5045),_0xcb2db0['nodes'],_0xcb2db0['baseVersion']);}if('marker'===_0x4ade33['type']&&_0x4ade33['name']['startsWith']('$markedRemove')){const _0x3c85b8=_0x4ade33;return new _0x45d78f(_0x3c85b8['name'],_0x3c85b8['oldRange'],this['_changeRange'](_0x3c85b8['newRange'],_0x249540['concat'](_0x3c85b8['newRange']['start']['offset']),_0x249540['concat'](_0x3c85b8['newRange']['end']['offset']),_0x3c5045),_0x3c85b8['_markers'],_0x3c85b8['affectsData'],_0x3c85b8['baseVersion']);}return _0x4ade33;}['_groupAdjacentOperations'](_0x432f3f){if(!_0x432f3f['length'])return[];const _0x5c3604=[];let _0x3ec9ab=0x0,_0x17bca4=0x0,_0x3cf0ad=[];for(let _0x22f884=0x0;_0x22f884<=_0x432f3f['length'];_0x22f884++){const _0x1a93fe=_0x432f3f[_0x22f884],_0x4f5763=_0x432f3f[_0x22f884-0x1];!_0x1a93fe||_0x4f5763&&!this['_getOperationEnd'](_0x4f5763)['isTouching'](this['_getOperationStart'](_0x1a93fe))?(_0x5c3604['push']({'operations':_0x3cf0ad,'operationsIsolated':_0x3cf0ad['map'](_0x1b780d=>this['_shiftOperation'](_0x1b780d['clone'](),-_0x17bca4)),'groupOffset':_0x3ec9ab}),_0x3cf0ad=_0x1a93fe?[_0x1a93fe]:[],_0x17bca4+=_0x3ec9ab,_0x3ec9ab=0x0):_0x3cf0ad['push'](_0x1a93fe),_0x1a93fe&&'insert'===_0x1a93fe['type']&&(_0x3ec9ab+=_0x1a93fe['howMany']);}return _0x5c3604;}['_findAdjacentContextDistance'](_0x375cfc,_0x357576,_0x3cbfb0,_0x485d8d=0x1){const _0x3395ae=new _0x46f40e({'startPosition':_0x375cfc,'direction':_0x357576});let _0xd0008a=0x0;for(let _0x55ba6b=0x0;_0x55ba6b<_0x485d8d;_0x55ba6b++){let _0x2c2c09=0x0,_0x3d2a99=!0x1,_0x39f80c='forward'===_0x357576?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x119b43}of _0x3395ae)if(_0x119b43['is']('$textProxy')){const _0x10ffe4=_0x39f80c['exec'](_0x119b43['data']);if(_0x10ffe4&&_0x10ffe4['length']){if(_0x2c2c09+='forward'===_0x357576?_0x10ffe4['index']+_0x10ffe4[0x0]['length']:_0x119b43['data']['length']-_0x10ffe4['index'],_0x10ffe4[0x0]['length']!==_0x119b43['data']['length'])break;_0x3d2a99=!0x0,_0x39f80c='forward'===_0x357576?/^\w+/:/\w+$/;}else{if(_0x3d2a99)break;_0x2c2c09+=_0x119b43['offsetSize'];}}else{if(_0x119b43['is']('element')){_0x3cbfb0['isInline'](_0x119b43)&&!_0x3d2a99&&(_0x2c2c09+=0x1);break;}}_0xd0008a+=_0x2c2c09,_0x3395ae['jumpTo'](_0x375cfc['getShiftedBy']('forward'===_0x357576?_0xd0008a:-_0xd0008a));}return _0xd0008a;}['_getChangeContext'](_0x4df7d1,_0x5cba33,_0x1fc496){const _0x4d5200=_0x1fc496['model']['schema'],_0x49e2da=this['_findAdjacentContextDistance'](_0x4df7d1,'backward',_0x4d5200,0x6),_0x51c068=this['_findAdjacentContextDistance'](_0x5cba33,'forward',_0x4d5200,0x6),_0x2775e5=_0x4df7d1['getShiftedBy'](-_0x49e2da),_0x4367f9=_0x5cba33['getShiftedBy'](_0x51c068);return{'start':_0x2775e5,'end':_0x4367f9,'hasContentBefore':!_0x2775e5['isAtStart'],'hasContentAfter':!_0x4367f9['isAtEnd']};}['_insertMarkers'](_0x494f59,_0x4252b2){const _0x4be327=this['context']['plugins']['get']('AIEditing'),_0x252284=new Set();_0x4252b2['model']['change'](_0x45d718=>{for(const _0xc09ded of _0x494f59){const _0x146a33=''+tr+_0xc09ded['type']+':'+_0xc09ded['groupId']+'_'+_0x4be327['_nextDataId'](_0x252284);this['_markers']['set'](_0x146a33,{'id':_0x146a33,'groupId':_0xc09ded['groupId'],'type':_0xc09ded['type'],'content':_0xc09ded['content'],'editor':_0x4252b2}),_0x45d718['addMarker'](_0x146a33,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x45d718['createRange'](_0xc09ded['start'],_0xc09ded['end'])});}});}['_createGetContextFn'](_0x50fcb8,_0x5e0d75,_0x3d8414){let _0x53519f='';return()=>{if(!_0x53519f){const _0x5db0c2=_0x5e0d75['toView'](_0x50fcb8,{'showSuggestionHighlights':!0x0});let _0x5d39d0=_0x5db0c2['getChild'](0x0);if(_0x5d39d0['is']('containerElement')||(_0x5d39d0=_0x5db0c2),!_0x5d39d0)return'';let _0x15ee69=!0x1;const _0x2d853f=[];for(const _0x17a00e of _0x5d39d0['getChildren']())_0x17a00e['is']('element','span')&&_0x17a00e['hasClass']('ck-ai_review-marker_context-end')&&(_0x15ee69=!0x1),_0x15ee69&&_0x2d853f['push'](_0x17a00e),_0x17a00e['is']('element','span')&&_0x17a00e['hasClass']('ck-ai_review-marker_context-start')&&(_0x15ee69=!0x0);_0x5d39d0['_removeChildren'](0x0,_0x5d39d0['childCount']),_0x3d8414?.['ellipsisBefore']&&_0x5d39d0['_appendChild']('…'),_0x5d39d0['_appendChild'](_0x2d853f),_0x3d8414?.['ellipsisAfter']&&_0x5d39d0['_appendChild']('…');const _0x6dc12f=_0x5e0d75['htmlProcessor']['domConverter']['viewToDom'](_0x5db0c2),_0x487bfd=_0x5e0d75['htmlProcessor']['htmlWriter']['getHtml'](_0x6dc12f);_0x53519f=this['_removeUnsupportedElements'](_0x487bfd);}return _0x53519f;};}['_createGetContentFn'](_0x25cbb8,_0xe18304){let _0x1da285='';return()=>(_0x1da285||(_0x1da285=this['_removeUnsupportedElements'](_0xe18304['stringify'](_0x25cbb8,{'showSuggestionHighlights':!0x0}))),_0x1da285);}['_createGetContentUsingDataIdFn'](_0x11a9ba,_0x591f99,_0x46ef4c){let _0x2db7ed='';return()=>{if(!_0x2db7ed){const _0x30eeb1=_0x46ef4c['toView'](new _0x27f90b(_0x11a9ba)),_0x5180a8=_0x46ef4c['htmlProcessor']['domConverter']['viewToDom'](_0x30eeb1)['querySelector']('[data-id=\x22'+_0x591f99+'\x22]');_0x2db7ed=_0x5180a8?.['outerHTML']||'';}return _0x2db7ed;};}['_removeUnsupportedElements'](_0x547cee){if(!_0x547cee)return'';const _0x2a94d5=Wi(_0x547cee,{'decodeEntities':!0x1}),_0xfb0957=qi(_0x2a94d5);if(!_0xfb0957['length'])return _0x547cee;for(const _0x25ccbc of _0xfb0957)_0x369ef0(_0x25ccbc);return Ki(_0x2a94d5,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x2ba9cc,_0xb5dbee){const _0x3c516b=Wi(_0x2ba9cc,{'decodeEntities':!0x1}),_0x50f240=Wi(_0xb5dbee,{'decodeEntities':!0x1}),_0x15ec82=qi(_0x3c516b),_0x348bce=qi(_0x50f240);if(!_0x15ec82['length']&&!_0x348bce['length'])return{'contentInitial':_0x2ba9cc,'contentNew':_0xb5dbee};const _0x3a1efd=new Map();for(const _0x5ca358 of _0x15ec82)_0x3a1efd['set'](Xi(_0x5ca358,'data-id'),_0x5ca358);for(const _0x58c346 of _0x348bce){const _0x1857db=Xi(_0x58c346,'data-id'),_0x413c12=_0x1857db?_0x3a1efd['get'](_0x1857db):void 0x0;_0x413c12?_0x151bb7(_0x58c346,_0x54dd72(_0x413c12,!0x0)):_0x369ef0(_0x58c346);}return{'contentInitial':Ki(_0x3c516b,{'encodeEntities':!0x1}),'contentNew':Ki(_0x50f240,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x46da71,_0x299df5=0x5){let _0x5e9572=_0x46da71,_0x2b9f21=null;for(let _0x541236=0x0;_0x541236<_0x299df5&&_0x5e9572;_0x541236++){if(!_0x5e9572['className']){_0x5e9572=_0x5e9572['parentElement'];continue;}if(!(''+_0x5e9572['className'])['includes']('ck-ai_review-marker_')){_0x5e9572=_0x5e9572['parentElement'];continue;}if(!_0x5e9572['getAttribute']('data-marker-id'))break;_0x2b9f21=_0x5e9572;break;}return _0x2b9f21;}['_findMarkerElementById'](_0x36ee24){const _0x2a6214=this['_markers']['get'](_0x36ee24);if(!_0x2a6214)return null;const _0x3ec740=_0x2a6214['editor']['model']['markers']['get'](_0x36ee24);return _0x3ec740?_0x57da19(_0x2a6214['editor']['editing'],_0x3ec740):null;}['_getMarkersDataForGroup'](_0x836457){return Array['from'](this['_markers']['values']())['filter'](_0x24fdd8=>_0x24fdd8['groupId']===_0x836457);}['_getOperationStart'](_0xc5a26f){return'insert'===_0xc5a26f['type']?_0xc5a26f['position']:_0xc5a26f['newRange']['start'];}['_getOperationEnd'](_0x1f37e2,_0x4c5467=!0x1){return'insert'===_0x1f37e2['type']?_0x4c5467?_0x1f37e2['position']:_0x1f37e2['position']['getShiftedBy'](_0x1f37e2['howMany']):_0x1f37e2['newRange']['end'];}['_shiftOperation'](_0x56bc62,_0x119295){return'insert'===_0x56bc62['type']?_0x56bc62['position']=_0x56bc62['position']['getShiftedBy'](_0x119295):'marker'===_0x56bc62['type']&&_0x56bc62['newRange']&&(_0x56bc62['newRange']=new _0x245154(_0x56bc62['newRange']['start']['getShiftedBy'](_0x119295),_0x56bc62['newRange']['end']['getShiftedBy'](_0x119295))),_0x56bc62;}['_changeOperationOwnerDocument'](_0x251c65,_0x14b558){'insert'===_0x251c65['type']?_0x251c65['position']=this['_changePositionOwnerDocument'](_0x251c65['position'],_0x14b558):'marker'===_0x251c65['type']&&_0x251c65['newRange']&&(_0x251c65['newRange']=this['_changeRangeOwnerDocument'](_0x251c65['newRange'],_0x14b558));}['_changePositionOwnerDocument'](_0x4d61df,_0x148e2f){return new _0x2a81c3(_0x148e2f,_0x4d61df['path']);}['_changeRangeOwnerDocument'](_0x26054e,_0x29c23d){return new _0x245154(this['_changePositionOwnerDocument'](_0x26054e['start'],_0x29c23d),this['_changePositionOwnerDocument'](_0x26054e['end'],_0x29c23d));}['_changePosition'](_0x4a17bd,_0x149ea7){return new _0x2a81c3(_0x149ea7,[..._0x4a17bd]);}['_changeRange'](_0x544f9c,_0x3c4516,_0x30e64a,_0x3a1f32){return new _0x245154(this['_changePosition'](_0x3c4516,_0x3a1f32),this['_changePosition'](_0x30e64a,_0x3a1f32));}['_sortMarkers'](_0x110300){const _0x465e72=_0x59a79f=>{switch(_0x59a79f){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x110300['sort']((_0x42e386,_0x50e943)=>_0x465e72(_0x42e386['type'])-_0x465e72(_0x50e943['type']));}['_hasSameTopLevelElement'](_0x1ce299,_0x537ec2){const _0x3ebb85=_0x1ce299['getChild'](0x0),_0x427dd9=_0x537ec2['getChild'](0x0);return!(!_0x3ebb85||!_0x427dd9)&&((!_0x3ebb85['is']('element')||!_0x427dd9['is']('element')||_0x3ebb85['name']===_0x427dd9['name'])&&!(_0x3ebb85['is']('element')&&!_0x427dd9['is']('element')||!_0x3ebb85['is']('element')&&_0x427dd9['is']('element')));}['_haveSingleTopLevelElement'](_0x30a974){return 0x1===_0x30a974['childCount'];}['_haveOnlyInlineContent'](_0x481bdc,_0x1d87ab){for(const _0x47abc2 of _0x481bdc['getChildren']())if(_0x47abc2['is']('element')&&!_0x1d87ab['isInline'](_0x47abc2))return!0x1;return!0x0;}['_upsertDataId'](_0x550599,_0x3acb32){let _0x425949=_0x550599['getAttribute'](_0x1e6e9f);return _0x425949||(_0x425949=_0x3acb32(),_0x550599['_setAttribute'](_0x1e6e9f,_0x425949)),_0x425949;}}class AIReviewCheckResult extends Et(){['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x3b9f06,contentNew:_0x26da73,contentInitial:_0x651539,documentVersion:_0x5dc12a}){super(),this['id']=_0x3b9f06,this['contentNew']=_0x26da73,this['contentInitial']=_0x651539,this['documentVersion']=_0x5dc12a;}}class AIReviewCheckResultChange extends ct(){['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x449598,_0x16a8a4,_0x3f8ef1){super(),this['id']=_0x449598,this['parent']=_0x3f8ef1,this['_data']=_0x16a8a4,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations'];}get['operationsIsolated'](){return this['_data']['operationsIsolated'];}}class AIReviewCheckRun extends ct(){['id']=at();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x3ffa5f,_0x52c21e,_0x4e86b3,_0x3df08e,_0x1a1dde){super(),this['_sourceCheck']=_0x52c21e,this['_documentData']=_0x3ffa5f,this['_aiConnector']=_0x4e86b3,this['_reviewParams']=_0x3df08e,this['_reviewArgs']=_0x1a1dde,this['on']('change:status',(_0x585a1c,_0x4bda34,_0xa1114)=>{'aborted'==_0xa1114&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0xa1114,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x15b232=>'pending'===_0x15b232['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x53e188){this['_documentData']=_0x53e188;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x172d1a=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x11e3fd of _0x172d1a)'unmodified'!==_0x11e3fd['data']['operation']&&('error'!==_0x11e3fd['data']['operation']?'review-metadata'!==_0x11e3fd['event']?this['_addReviewCheckResult'](_0x11e3fd['data']['dataId'],_0x11e3fd['data']['textDelta']):this['callId']=_0x11e3fd['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(_0x4077b0){this['_currentError']=_0x4077b0,_0x4077b0 instanceof Error&&_0x4077b0['message']['includes']('ai-request-aborted')?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x3dadf0,_0x1941be){const _0x24713f=this['_results']['get'](_0x3dadf0);if(!_0x24713f)return;if(0x0===_0x1941be['length'])return;const _0xe01333=[];_0x1941be['forEach']((_0x30d9db,_0x5cc50a)=>{const _0x1cad38=new AIReviewCheckResultChange(_0x24713f['id']+'-'+_0x5cc50a,_0x30d9db,_0x24713f);_0x1cad38['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x1cad38,'status':_0x1cad38['status']});}),_0x1cad38['on']('change:isActivated',()=>{_0x1cad38['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x1cad38}):this['fire']('reviewCheckResultDeactivated',{'change':_0x1cad38});}),this['_changes']['push'](_0x1cad38),_0xe01333['push'](_0x1cad38);}),this['fire']('reviewCheckResultReady',{'changes':_0xe01333,'result':_0x24713f,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x7aecda){const _0x4d96c3=this['_changes']['find'](_0x56c2b5=>_0x56c2b5['id']===_0x7aecda);return!(!_0x4d96c3||'pending'!==_0x4d96c3['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x312808=>!0x0===_0x312808['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x306c7c=>'pending'===_0x306c7c['status']);}['getChangeById'](_0x8754c8){return this['_changes']['find'](_0x2e8251=>_0x2e8251['id']===_0x8754c8);}['markAllChangesAsAccepted'](){for(const _0x4905ea of this['_changes'])'pending'===_0x4905ea['status']&&(_0x4905ea['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0xa4c9f5){const _0x4fc308=this['_changes']['find'](_0x2f6049=>_0x2f6049['id']===_0xa4c9f5);_0x4fc308&&'pending'===_0x4fc308['status']&&(_0x4fc308['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x15314a){const _0x248613=this['_changes']['find'](_0x28f050=>_0x28f050['id']===_0x15314a);_0x248613&&'pending'===_0x248613['status']&&(_0x248613['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x3c73f4){const _0x57af1c=this['_changes']['find'](_0x413e75=>_0x413e75['id']===_0x3c73f4);_0x57af1c&&'pending'===_0x57af1c['status']&&(_0x57af1c['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x959e06){const _0x4d109c=this['_changes']['find'](_0x300d06=>_0x300d06['id']===_0x959e06);_0x4d109c&&'outdated'===_0x4d109c['status']&&(_0x4d109c['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x1ee38b){this['_changes']['filter'](_0x34572a=>_0x34572a['isActivated']&&_0x34572a['id']!==_0x1ee38b)['forEach'](_0x31fe90=>{_0x31fe90['isActivated']=!0x1;});const _0x2e6948=this['_changes']['find'](_0x152004=>_0x152004['id']===_0x1ee38b);_0x2e6948&&'pending'===_0x2e6948['status']&&(_0x2e6948['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x4015e2=>_0x4015e2['isActivated'])['forEach'](_0x4e69f3=>{_0x4e69f3['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x4c34c9){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x45a1ab;if(_0x4c34c9){const _0x38c5e8=this['_changes']['find'](_0x49a97e=>_0x49a97e['id']===_0x4c34c9);if(_0x38c5e8&&_0x38c5e8['isRated'])return;_0x38c5e8&&(_0x45a1ab=_0x38c5e8['parent']['id'],_0x38c5e8['isRated']=!0x0);}const _0x191731={'positiveCount':this['_changes']['filter'](_0x3013da=>'accepted'===_0x3013da['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x191731,this['callId'],_0x45a1ab);}['_addReviewCheckResult'](_0x23bcfd,_0x5ad2a8){const _0x5cdcd0=this['_documentData']['elements']['get'](_0x23bcfd);if(!_0x5cdcd0)return;const _0x43099f=_0x5cdcd0['getContent']();if(_0x43099f===_0x5ad2a8)return;const _0x4e893e=new AIReviewCheckResult({'id':_0x23bcfd,'contentInitial':_0x43099f,'contentNew':_0x5ad2a8,'documentVersion':_0x5cdcd0['documentVersion']});this['_results']['set'](_0x4e893e['id'],_0x4e893e),this['fire']('reviewCheckResultAdded',{'result':_0x4e893e,'source':this,'editor':_0x5cdcd0['editor']});}['_checkIfFinished'](){'finished'===this['status']&&(this['_changes']['filter'](_0x304e23=>'pending'===_0x304e23['status'])['length']>0x0&&(this['status']='ready')),'ready'===this['status']&&(0x0===this['_changes']['filter'](_0x47f7fb=>'pending'===_0x47f7fb['status'])['length']&&(this['status']='finished'));}}class AIReviewSystemCheckRun extends AIReviewCheckRun{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x15d5a0=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x2b9f15=0x0;_0x2b9f15<this['_reviewParams']['length'];_0x2b9f15++){if(!this['_reviewParams'][_0x2b9f15]||!this['_sourceCheck']['options'][_0x2b9f15])continue;const _0x3f751c=this['_sourceCheck']['options'][_0x2b9f15],_0xd6245b=_0x3f751c['data']?.['find'](_0x3413d8=>_0x3413d8['id']===this['_reviewParams'][_0x2b9f15]);_0xd6245b&&_0x15d5a0['push'](_0xd6245b['label']);}return _0x15d5a0['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x3a149e,_0x3dceac,_0x1e9504){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x3dceac,_0x3a149e,_0x1e9504);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}}class AIReviewCoreController extends _0x915a98{['_aiConnector'];['_aiReviewCoreUi'];['_aiReviewCoreEditing'];['_availableReviewChecks'];['_currentReviewCheckRun'];['_changeActivationSource']=null;static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_initRequiredPlugins'](),this['_initAvailableReviewChecks'](),this['_initUIListeners']();}async['_initAvailableReviewChecks'](){this['_availableReviewChecks']=await this['_getReviewChecks'](),this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}['_initUIListeners'](){this['listenTo'](this['_aiReviewCoreUi'],'getReviewCheckList',()=>{this['_availableReviewChecks']&&this['_aiReviewCoreUi']['setAvailableChecks'](this['_availableReviewChecks']);}),this['listenTo'](this['_aiReviewCoreUi'],'runReviewCheck',(_0x1de4be,_0xdb10ee)=>this['runCheck'](_0xdb10ee)),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 _0x409b7f=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x409b7f['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x409b7f['map'](_0x246f5c=>_0x246f5c['id']));const _0x3e6c9d=this['_currentReviewCheckRun'];_0x3e6c9d['markAllChangesAsAccepted'](),_0x3e6c9d['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0xb632d6,_0x13b288)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x13b288['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x13b288['id']]),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x13b288['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x13b288['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x3142ae,_0xfaca2d)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0xfaca2d['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0xfaca2d['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0xfaca2d['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0xfaca2d['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0xc9cc7c,_0x3a9438)=>{this['_onActivateChange'](_0x3a9438);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x3d2c30,_0x30b3e1)=>{this['_onDeactivateChange'](_0x30b3e1);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x56d700,_0x2475bb)=>{this['_onChangeMarkerClicked'](_0x56d700,_0x2475bb);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x6156b4,_0x3372d2)=>{this['_onChangeMarkerHovered'](_0x6156b4,_0x3372d2);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x316b0b,_0x34ddc6)=>{this['_onChangeMarkerRemoved'](_0x316b0b,_0x34ddc6);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x255da4,_0x5eebc7)=>{this['_onChangeMarkerRestored'](_0x255da4,_0x5eebc7);});}async['runCheck'](_0x3eaa3d){if(!this['_availableReviewChecks'])return;const _0x138d6f=this['_availableReviewChecks']['find'](_0x2984cb=>_0x2984cb['id']===_0x3eaa3d['id']);if(_0x138d6f){this['_onReviewCheckRun'](_0x3eaa3d),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x3eaa3d,_0x138d6f),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x27742a,_0x2ee198)=>{switch(_0x2ee198['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x2ee198);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new ht('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x2ee198['status']&&'error-chunk'!==_0x2ee198['status']&&'error-general'!==_0x2ee198['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x363edb,_0x290105)=>{if(!this['_currentReviewCheckRun'])throw new ht('ai-review-mode-no-current-check-run',this);const _0x5b59fa=this['_diffContent'](_0x290105['editor'],_0x290105['result']['contentInitial'],_0x290105['result']['contentNew']);_0x290105['source']['addResultChanges'](_0x290105['result']['id'],_0x5b59fa);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x3552ae,_0x2de068)=>{for(const _0x576f08 of _0x2de068['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x576f08);this['_markChangePositionInEditorContent'](_0x2de068['changes'],_0x2de068['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x1c50ed,_0x5edb57)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x5edb57['change']['id'],_0x5edb57['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x3e2faa,_0x1ea58b)=>{this['_onReviewCheckResultActivated'](_0x1ea58b);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x5edb1d){_0x5edb1d instanceof Error&&_0x5edb1d['message']['includes']('ai-request-aborted')||(_0x5edb1d instanceof ht?this['_logError'](_0x5edb1d):this['_logError'](new ht('ai-review-mode-check-run-failed',this,void 0x0,_0x5edb1d)));}}else this['_logError'](new ht('ai-review-mode-source-check-not-found',this,{'checkId':_0x3eaa3d['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return this['_availableReviewChecks']??[];}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0xde812c,_0x3298b9){return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x3298b9,this['_aiConnector'],_0xde812c['params'],_0xde812c['args']);}['_onChangeMarkerRemoved'](_0x14bc8d,_0x5e5d7a){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x5e5d7a['changeId']);}['_onChangeMarkerRestored'](_0xc77ab6,_0x39da3f){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x39da3f['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector');}['_onReviewRunLeave'](_0xe4e7c5=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0xe4e7c5&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x29b55f of this['_aiReviewCoreEditing']['getEditors']())_0x29b55f['editing']['view']['change'](_0x32c4fa=>{for(const _0x3817b4 of _0x29b55f['editing']['view']['document']['getRoots']())_0x32c4fa['removeClass']('ck-ai_review-diff',_0x3817b4),_0x32c4fa['removeClass']('ck-ai_review-highlights',_0x3817b4),_0x32c4fa['removeClass']('ck-ai-translate-mode-content',_0x3817b4);});}['_logError'](_0x4d24b4,_0x7ad3da=!0x1){Ct(_0x4d24b4['message']),_0x7ad3da||(_0x4d24b4['message']['startsWith']('ai-review-mode-models-unable-to-retrieve')?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']());}['_scrollToChange'](_0x8ec438){if('content'===this['_changeActivationSource']){const _0x3365bf=this['_aiReviewCoreUi']['getChangeElement'](_0x8ec438);_0x3365bf&&Rt(_0x3365bf['closest']('.ck-ai_review__check-run-result')||_0x3365bf);}else{if('panel'===this['_changeActivationSource']){const _0x2ed73f=this['_getChangeContentElement'](_0x8ec438);if(!_0x2ed73f)return;Tt({'target':_0x2ed73f,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}}class AIReviewCustomCheckRun extends AIReviewCheckRun{['_prompt'];['_model'];constructor(_0x561e5f,_0x4db9df,_0x47df4b,_0x3c6708,_0x58a949){super(_0x47df4b,_0x3c6708,_0x58a949),this['_prompt']=_0x561e5f,this['_model']=_0x4db9df;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x5adeeb,_0x2a15e3,_0x45f017){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x2a15e3,_0x5adeeb,_0x45f017);}}class AIReviewCheck{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x474e2e){this['id']=_0x474e2e['id'],this['commandId']=_0x474e2e['commandId'],this['title']=_0x474e2e['title'],this['description']=_0x474e2e['description'],this['isParameterized']=_0x474e2e['isParameterized'],this['useArgs']=_0x474e2e['useArgs'],this['options']=_0x474e2e['options'],this['args']=_0x474e2e['args'];}}class AIReviewCheckExtra extends AIReviewCheck{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0x38c55d,_0x548c78,_0x496721){super(_0x38c55d),this['prompt']=_0x38c55d['prompt'],this['model']=_0x38c55d['model'],this['model']?this['_defaultModel']=_0x548c78['find'](_0xb3ed55=>_0xb3ed55['id']===this['model'])||null:this['_defaultModel']=_0x496721;}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewExtraCheckRun extends AIReviewCustomCheckRun{get['subTitle'](){return'';}set['prompt'](_0x11abb5){this['_prompt']=_0x11abb5;}set['model'](_0x518cc0){this['_model']=_0x518cc0;}}class AIReviewCoreCheckRegistry extends _0x915a98{static get['requires'](){return[AIConnector];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}}const sr=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}];class AIReviewCheckList extends ct(){['_checks']=[];['setupChecks'](_0x2bcf28){this['_checks']=_0x2bcf28['map'](_0x5548bd=>new AIReviewCheck(_0x5548bd));}get['checks'](){return this['_checks'];}['getCheckById'](_0x56e7a3){return this['checks']['find'](_0x1c535b=>_0x1c535b['id']===_0x56e7a3);}['removeCheckById'](_0x148ff5){this['_checks']=this['_checks']['filter'](_0x4d1c77=>_0x4d1c77['id']!==_0x148ff5);}}class AIReviewCheckCustom extends AIReviewCheck{['_models']=[];['_defaultModel']=null;constructor(_0x340aa7,_0x283466,_0x11b155){super(_0x340aa7),this['_models']=_0x283466,this['_defaultModel']=_0x11b155;}get['models'](){return this['_models'];}get['defaultModel'](){return this['_defaultModel'];}}class AIReviewModeCheckList extends AIReviewCheckList{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0xc3a1a2,_0x194ffc,_0x2c6e4c){super(),this['_allModels']=_0xc3a1a2,this['_recommendedModels']=_0x194ffc,this['_defaultModel']=_0x2c6e4c;}get['allModels'](){return this['_allModels'];}['setupChecks'](_0x1c1d00){this['_checks']=_0x1c1d00['map'](_0x1a4a23=>!0x0===_0x1a4a23['isExtra']?new AIReviewCheckExtra(_0x1a4a23,this['_allModels'],this['_defaultModel']):'custom'===_0x1a4a23['id']?new AIReviewCheckCustom(_0x1a4a23,this['_recommendedModels'],this['_defaultModel']):new AIReviewCheck(_0x1a4a23));}}class AIReviewModeCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x645632){super(_0x645632),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x191e79=>({'id':_0x191e79['id'],'commandId':_0x191e79['id'],'title':_0x191e79['label'],'description':_0x191e79['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x191e79['prompt'],'model':_0x191e79['model']}));}async['_loadChecksList'](){const _0xfa30cb=[...sr,...this['getExtraChecks']()]['map'](_0x2a1b52=>_0x2a1b52['isExtra']?_0x2a1b52:this['_translateReviewCheck'](_0x2a1b52)),_0x13435c=await this['_getModels'](),_0x1c443d=new AIReviewModeCheckList(_0x13435c['all'],_0x13435c['recommended'],_0x13435c['default']);return _0x1c443d['setupChecks'](_0xfa30cb),_0x1c443d;}async['_getModels'](){const _0x46b304=this['context']['plugins']['get']('AIConnector');try{const _0x101c4e=new AIModels({'connector':_0x46b304,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x270bb7={'all':await _0x101c4e['getAll'](),'recommended':await _0x101c4e['getAvailableModels'](),'default':await _0x101c4e['getDefault']()};return this['_modelsLoadError']=null,_0x270bb7;}catch(_0x181114){return this['_modelsLoadError']=new ht('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x181114),Ct(this['_modelsLoadError']['message']),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x34301c){const _0x34b55f='AI_REVIEW_CHECK_'+_0x34301c['id']['toUpperCase']()['replaceAll']('-','_'),_0xa3f44c={..._0x34301c,'title':this['_translate'](_0x34b55f+'_TITLE',_0x34301c['title']),'description':this['_translate'](_0x34b55f+'_DESCRIPTION',_0x34301c['description'])};return _0x34301c['options']&&(_0xa3f44c['options']=_0x34301c['options']['map'](_0x43c1de=>({..._0x43c1de,'label':this['_translate'](_0x34b55f+'_OPTIONS_LABEL',_0x43c1de['label']||''),'data':_0x43c1de['data']?_0x43c1de['data']['map'](_0x5d4369=>({..._0x5d4369,'label':this['_translate'](_0x34b55f+'_OPTIONS_DATA_'+_0x5d4369['id']['toUpperCase'](),_0x5d4369['label'])})):void 0x0}))),_0xa3f44c;}['_translate'](_0x3ad1a9,_0x1633b9){const _0x2c1952=Mi(this['context']['locale'],_0x3ad1a9);return _0x2c1952===_0x3ad1a9?_0x1633b9:_0x2c1952;}}class AIReviewModeController extends AIReviewCoreController{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[AIReviewModeCheckRegistry];}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0x4b6da4){super(_0x4b6da4),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',sr['map'](_0x39be87=>_0x39be87['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x8813ef,_0x2355a3)=>{this['_isDiffOn']=_0x2355a3['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x829601,_0x5e196a){if(_0x829601['isCustom'])return new AIReviewCustomCheckRun(_0x829601['args']['prompt'],_0x829601['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x5e196a,this['_aiConnector']);if(_0x5e196a['isExtra']){const _0x4286eb=_0x5e196a;return new AIReviewExtraCheckRun(_0x829601['args']?.['prompt']??_0x4286eb['prompt'],_0x829601['args']?.['model']??_0x4286eb['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x5e196a,this['_aiConnector']);}return new AIReviewSystemCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x5e196a,this['_aiConnector'],_0x829601['params'],_0x829601['args']);}['_onReviewCheckResultActivated'](_0x535450){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x535450['change']['id']),this['_scrollToChange'](_0x535450['change']['id']);const _0x1edf3f=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x535450['change']['id']);if(!_0x1edf3f)return;const _0x46f62d=this['_aiReviewCoreEditing']['getEditorForChange'](_0x535450['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x535450['change'],()=>_0x1edf3f['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x46f62d,_0x1edf3f['modelRange']['root']['rootName']),_0x46f62d?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x535450['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x34cfd0){this['_currentReviewCheckRun']&&'click'===_0x34cfd0['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x34cfd0['id']));}['_onDeactivateChange'](_0xf0782){this['_currentReviewCheckRun']&&'balloon'===_0xf0782['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x23f85c,_0x299fa6){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x299fa6['changeId']);const _0x47aab3=this['_currentReviewCheckRun']['getChangeById'](_0x299fa6['changeId']);if(!_0x47aab3)return;const _0x47150=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x299fa6['changeId']),_0x53f48f=this['_aiReviewCoreEditing']['getEditorForChange'](_0x299fa6['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x47aab3,_0x299fa6['markerElement'],_0x299fa6['domEvent'],'click',this['_getBalloonDomRoot'](_0x53f48f,_0x47150?.['modelRange']['root']['rootName']),_0x53f48f?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0x365c7f,_0x2531c2){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x4a93cd=this['_currentReviewCheckRun']['getChangeById'](_0x2531c2['changeId']);if(!_0x4a93cd)return;const _0x36e23b=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x2531c2['changeId']),_0x410620=this['_aiReviewCoreEditing']['getEditorForChange'](_0x2531c2['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x4a93cd,_0x2531c2['markerElement'],_0x2531c2['domEvent'],'hover',this['_getBalloonDomRoot'](_0x410620,_0x36e23b?.['modelRange']['root']['rootName']),_0x410620?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){if(!this['_currentReviewCheckRun'])return;this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']();}['_getChangeContentElement'](_0x853974){const _0x1212e8=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x853974);return _0x1212e8?_0x1212e8['getElement']():null;}['_markChangePositionInEditorContent'](_0x9696cd,_0x5276a4){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x9696cd,_0x5276a4);}['_diffContent'](_0x5e9c48,_0x264247,_0x258ea5){return this['_aiReviewCoreEditing']['diffContent'](_0x5e9c48,_0x264247,_0x258ea5,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x2db15a){_0x2db15a?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0x270b45 of this['_aiReviewCoreEditing']['getEditors']())_0x270b45['editing']['view']['change'](_0x3c2885=>{for(const _0x325870 of _0x270b45['editing']['view']['document']['getRoots']()){for(const _0x219c44 of _0x325870['getClassNames']())_0x219c44['startsWith']('ck-ai_review-')&&_0x3c2885['removeClass'](_0x219c44,_0x325870);_0x3c2885['addClass'](_0x2db15a?'ck-ai_review-diff':'ck-ai_review-highlights',_0x325870);}});}['_getBalloonDomRoot'](_0x1244cc,_0x4091ad){const _0x4d616a=_0x1244cc['editing']['view'];if(_0x4091ad){const _0x48f1ce=_0x4d616a['getDomRoot'](_0x4091ad);if(_0x48f1ce)return _0x48f1ce;}return _0x4d616a['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x1fe0bf=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0xcca775=await _0x1fe0bf['getChecksList']();_0x1fe0bf['modelsLoadError']&&this['_logError'](_0x1fe0bf['modelsLoadError']);let _0x15e7eb=_0xcca775['checks'];const _0x47fe75=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x47fe75,_0x15e7eb),this['_usesAvailableCommandsConfig']&&(_0x15e7eb=_0x47fe75['map'](_0x860109=>_0x15e7eb['find'](_0x597563=>_0x597563['id']===_0x860109))['filter'](_0x506891=>!!_0x506891)),this['_filterChecksWithMissingModel'](_0x15e7eb);}['_logWarningForNonExistentChecks'](_0x1a6eb6,_0x39be9d){const _0xfb67c0=_0x1a6eb6['filter'](_0x40c23=>!_0x39be9d['some'](_0x4f2198=>_0x4f2198['id']===_0x40c23));if(_0xfb67c0['length']){const _0x28d5c6=new ht('ai-review-mode-non-existent-commands-used',this,{'commandIds':_0xfb67c0['join'](',\x20')});wt(_0x28d5c6['message']);}}['_filterChecksWithMissingModel'](_0x3d2df5){const _0x2382d7=[];return _0x3d2df5['forEach'](_0x400faf=>{(_0x400faf instanceof AIReviewCheckExtra&&!_0x400faf['defaultModel']||_0x400faf instanceof AIReviewCheckCustom&&!_0x400faf['models']['length'])&&_0x2382d7['push'](_0x400faf['id']);}),_0x2382d7['length']&&_0x2382d7['forEach'](_0x597db1=>{_0x3d2df5=_0x3d2df5['filter'](_0x10966c=>_0x10966c['id']!==_0x597db1);const _0x1f85e=new ht('ai-review-mode-command-unavailable-due-to-missing-model',this,{'commandId':_0x597db1});Ct(_0x1f85e['message']);}),_0x3d2df5;}}class AIRunResult{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x46ef69){this['_editor']=_0x46ef69['editor'],this['_rootName']=_0x46ef69['rootName'],this['_channelId']=_0x46ef69['channelId'],this['_sessionId']=_0x46ef69['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'](_0x4d57e2){this['_documentVersion']=_0x4d57e2;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x374f97){this['_contentRawOld']=_0x374f97;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x5c00e7){this['_contentRawNew']=_0x5c00e7;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x1e2876){this['_error']=_0x1e2876;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x96418d){return _0x96418d['replace'](/ data-id="[a-z0-9]+"/g,'');}}class AIReviewRunResult extends AIRunResult{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x3a0b4b){this['_affectedBlocks']=_0x3a0b4b;}}class AIGateway extends _0x915a98{static get['pluginName'](){return'AIGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['apply'](_0x121cd2,_0xfbcc86){if('completed'!==_0x121cd2['status'])throw new ht('ai-gateway-apply-invalid-status',this,{'status':_0x121cd2['status']});const _0x3b4a54=_0x121cd2['editor'];if('suggest'===_0xfbcc86&&!_0x3b4a54['plugins']['has']('TrackChanges'))throw new ht('ai-no-track-changes',this);const _0x5b407f='suggest'===_0xfbcc86,_0x2eae63=this['context']['plugins']['get'](_0x102c6d),_0x390948=_0x3b4a54['model']['createPositionAt'](_0x3b4a54['model']['document']['getRoot'](),0x0),_0x29f7cc=_0x2eae63['getDiff'](_0x121cd2['contentRawOld'],_0x121cd2['contentRawNew'],{'anchor':_0x390948,'markDeletions':_0x5b407f,'targetEditor':_0x3b4a54}),_0x225661=_0x3b4a54['model']['document']['history']['getOperations'](_0x121cd2['documentVersion']),_0x1d3b85={'document':_0x3b4a54['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x58ab59=_0x144e65(_0x29f7cc['getOperations'](),_0x225661,_0x1d3b85)['operationsA'];_0x3b4a54['model']['change'](_0x494a08=>{if(_0x5b407f)_0x3b4a54['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x58ab59);else{for(const _0x957b61 of _0x58ab59)_0x957b61['baseVersion']=_0x3b4a54['model']['document']['version'],Ts(_0x3b4a54,_0x957b61),_0x494a08['batch']['addOperation'](_0x957b61),_0x3b4a54['model']['applyOperation'](_0x957b61);}});}['mergeChangesIntoContent'](_0x15c083,_0x4cc884,_0x4427c8){const _0x5e5308=new AIResponseParser(),_0x2e8a33=new AIResponseApplier();let _0x4239f7=_0x5e5308['parseAndNormalizeHTML'](_0x4cc884);for(const _0x3b0db6 of _0x15c083)try{const _0x12e06c=_0x5e5308['parseAndNormalizeHTML'](_0x3b0db6['content']);_0x4239f7=_0x2e8a33['merge'](_0x12e06c,_0x4239f7,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0xebd5f3){throw new ht('ai-gateway-merge-failed',this,{..._0x3b0db6},_0xebd5f3);}return as(_0x4427c8,_0x5e5308['parseAndNormalizeHTML'](_0x4cc884),_0x4239f7,!0x1,!0x1)['content'];}}class AIReviewGateway extends _0x915a98{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[AIReviewCoreEditing,AIReviewModeCheckRegistry,AIConnector,AIEditing,AIGateway];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){const _0x3bd0f1=this['context']['plugins']['get']('AIReviewModeCheckRegistry');return(await _0x3bd0f1['getChecksList']())['checks']['map'](_0x22758a=>{const _0x3f2f09={'id':_0x22758a['id'],'title':_0x22758a['title'],'description':_0x22758a['description']};return'custom'!==_0x22758a['id']&&_0x22758a['options']?.['length']&&(_0x3f2f09['parameters']=_0x22758a['options'][0x0]['data']['map'](_0x3691a7=>({..._0x3691a7}))),_0x3f2f09;});}async['getAvailableModels'](){const _0x4c5261=this['context']['plugins']['get']('AIConnector');return new AIModels({'connector':_0x4c5261,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}async['runReview'](_0x4c497f,_0x306932){return await this['_runReviewCheck'](_0x4c497f,()=>this['_createReviewCheckRun'](_0x4c497f,_0x306932?.['parameterId']),_0x306932?.['signal']);}async['runCustomReview'](_0x5b2943,_0x376ca8){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x5b2943,_0x376ca8?.['model']),_0x376ca8?.['signal']);}['applyReview'](_0x4fdcf0,_0x19379c){this['context']['plugins']['get']('AIGateway')['apply'](_0x4fdcf0,_0x19379c);}async['_runReviewCheck'](_0x2d6114,_0x4cfd00,_0x3f4c47){const _0x40e91a=ps(this['context']),_0x343506=new AIReviewRunResult({'editor':_0x40e91a,'rootName':_0x40e91a['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x40e91a['plugins']['get']('AIEditing')['getSessionId'](_0x40e91a)});let _0x4a2d79,_0x3c798a;if(_0x3f4c47){if(_0x3f4c47['aborted'])return _0x343506['abort'](),_0x343506;const _0x11aa40=()=>{_0x343506['error']||(_0x343506['abort'](),_0x4a2d79&&_0x4a2d79['abort']());};_0x3f4c47['addEventListener']('abort',_0x11aa40),_0x3c798a=()=>_0x3f4c47['removeEventListener']('abort',_0x11aa40);}try{_0x4a2d79=await _0x4cfd00(),_0x343506['contentRawOld']=_0x4a2d79['documentData']['content'],_0x343506['documentVersion']=Array['from'](_0x4a2d79['documentData']['elements'])['find'](([,_0x166c40])=>_0x166c40['rootName']===_0x343506['rootName'])?.[0x1]['documentVersion']??0x1,_0x4a2d79['on']('reviewCheckRunUpdated',(_0x3cec36,_0xf37734)=>{'aborted'===_0xf37734['status']?_0x343506['abort']():'error-general'!==_0xf37734['status']&&'error-chunk'!==_0xf37734['status']||(_0x343506['error']=this['_normalizeError'](_0xf37734['error'],'ai-reviewgateway-review-command-run-failed',{'checkId':_0x2d6114}));}),'aborted'!==_0x343506['status']&&await _0x4a2d79['start']();}catch(_0x20f8a1){_0x343506['error']=this['_normalizeError'](_0x20f8a1,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x2d6114});}finally{_0x3c798a&&_0x3c798a();}if(!_0x4a2d79||'aborted'===_0x343506['status']||'error'===_0x343506['status'])return _0x343506;_0x343506['affectedBlocks']=_0x4a2d79['results']['map'](_0x5d8099=>({'id':_0x5d8099['id'],'content':_0x5d8099['contentNew']}));try{_0x343506['contentRawNew']=Ki(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x343506['affectedBlocks'],_0x343506['contentRawOld'],_0x343506['editor']));}catch(_0x28be07){_0x343506['error']=this['_normalizeError'](_0x28be07,'ai-reviewgateway-review-command-run-failed',{'checkId':_0x2d6114});}return _0x343506;}async['_createReviewCheckRun'](_0x37a729,_0x30a359){const _0x4f65bb=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x2fbaca=>_0x2fbaca['id']===_0x37a729);if(!_0x4f65bb)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x37a729});if(_0x4f65bb instanceof AIReviewCheckCustom)throw new ht('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x37a729});const _0x37222c=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x20e15f=this['context']['plugins']['get']('AIConnector');if(_0x4f65bb instanceof AIReviewCheckExtra){if(!_0x4f65bb['defaultModel']?.['id'])throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x37a729});return new AIReviewExtraCheckRun(_0x4f65bb['prompt'],_0x4f65bb['defaultModel']['id'],_0x37222c,_0x4f65bb,_0x20e15f);}return new AIReviewSystemCheckRun(_0x37222c,_0x4f65bb,_0x20e15f,_0x30a359?[_0x30a359]:void 0x0);}async['_createCustomReviewCheckRun'](_0x125344,_0x14a1db,_0x1ff13c){const _0x1e82ef=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x55b1bd=>_0x55b1bd['id']===_0x125344);if(!_0x1e82ef)throw new ht('ai-reviewgateway-unknown-command',this,{'checkId':_0x125344});if(!(_0x1e82ef instanceof AIReviewCheckCustom))throw new ht('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x125344});const _0x29d3a5=_0x1ff13c??_0x1e82ef['defaultModel']?.['id'];if(!_0x14a1db)throw new ht('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x125344});if(!_0x29d3a5)throw new ht('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x125344});return new AIReviewCustomCheckRun(_0x14a1db,_0x29d3a5,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x1e82ef,this['context']['plugins']['get']('AIConnector'));}['_normalizeError'](_0x42b951,_0x487330,_0x5d8bfe){let _0x1bfe0b=_0x42b951;return _0x42b951 instanceof ht||(_0x1bfe0b=new ht(_0x487330,this,_0x5d8bfe,_0x42b951)),_0x1bfe0b;}}class AIReviewMode extends _0x915a98{static get['requires'](){return[AIReviewModeController,AIReviewModeUI,AIReviewCoreEditing,AIReviewGateway];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x1e65f9,_0x386878){if(this['assertStartReviewPreconditions'](_0x1e65f9)instanceof AIReviewCheckCustom)throw new ht('ai-reviewmode-not-a-system-command',this,{'commandId':_0x1e65f9});const _0x58da83=this['context']['plugins']['get']('AIReviewModeController');await _0x58da83['runCheck']({'id':_0x1e65f9,'params':_0x386878?.['parameterId']?[_0x386878['parameterId']]:void 0x0});}async['startCustomReview'](_0x18b1de,_0x1589fc){if(!_0x18b1de)throw new ht('ai-reviewmode-missing-custom-command-prompt',this);const _0x3a0073=sr['find'](_0x168cd6=>'custom'===_0x168cd6['commandId'])['id'],_0x5438c2=this['assertStartReviewPreconditions'](_0x3a0073),_0x51a1ef=_0x1589fc?.['model']??_0x5438c2['defaultModel']?.['id'];if(!_0x51a1ef)throw new ht('ai-reviewmode-missing-custom-command-model',this);const _0x37f345=this['context']['plugins']['get']('AIReviewModeController');await _0x37f345['runCheck']({'id':_0x3a0073,'isCustom':!0x0,'args':{'prompt':_0x18b1de,'model':_0x51a1ef}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0x3c17b1=>{const _0x38789d={'id':_0x3c17b1['id'],'title':_0x3c17b1['title'],'description':_0x3c17b1['description']};return'custom'!==_0x3c17b1['id']&&_0x3c17b1['options']?.['length']&&(_0x38789d['parameters']=_0x3c17b1['options'][0x0]['data']['map'](_0x15dc9a=>({..._0x15dc9a}))),_0x38789d;});}['assertStartReviewPreconditions'](_0x46c108){const _0x55ac34=this['context']['plugins']['get']('AIReviewModeController');if(_0x55ac34['getCurrentCheckRun']())throw new ht('ai-reviewmode-review-already-running',this);const _0x37a034=_0x55ac34['getAvailableChecks']()['find'](_0x3a6014=>_0x3a6014['id']===_0x46c108);if(!_0x37a034)throw new ht('ai-reviewmode-unknown-command',this,{'commandId':_0x46c108});const _0x593cf1=this['context']['plugins']['get']('AITabs')['view'];return _0x593cf1['isVisible']=!0x0,_0x593cf1['activateTab']('reviewMode'),_0x37a034;}}class AITranslateCheckRun extends AIReviewSystemCheckRun{['_title'];constructor(_0x51f2f9,_0x40ada7,_0x43dc78,_0x58593c,_0x296712,_0x3a5b13){super(_0x51f2f9,_0x40ada7,_0x43dc78,_0x296712,_0x3a5b13),this['_title']=_0x58593c;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}}class AITranslateCheck extends AIReviewCheck{get['apiId'](){return'translate';}}class AITranslateCheckList extends AIReviewCheckList{['setupChecks'](_0x11d63b){this['_checks']=_0x11d63b['map'](_0x58f1b0=>new AITranslateCheck(_0x58f1b0));}}const nr=[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}];class AITranslateCheckRegistry extends AIReviewCoreCheckRegistry{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x1ad2c1){super(_0x1ad2c1),this['context']['config']['define']('ai.translate.languages',nr);}async['_loadChecksList'](){const _0x4fd65a=[],_0x5aaa6c=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x267c79 of _0x5aaa6c)_0x4fd65a['push']({'title':_0x267c79['label'],'id':_0x267c79['id'],'commandId':_0x267c79['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x267c79['id']}});const _0x7be7f5=new AITranslateCheckList();return _0x7be7f5['setupChecks'](this['_translateChecks'](_0x4fd65a)),_0x7be7f5;}['_translateChecks'](_0x5fd8a4){const _0x1d2329=this['context']['locale'];return _0x5fd8a4['map'](_0x152f28=>{const _0x5872cd='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x152f28['title']['toUpperCase']()['replaceAll']('-','_'),_0x180b59=Mi(_0x1d2329,_0x5872cd);return{..._0x152f28,'title':_0x180b59===_0x5872cd?_0x152f28['title']:_0x180b59};});}}class AITranslateController extends AIReviewCoreController{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[AITranslateCheckRegistry];}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x6d21b0,_0x750cb1){return new AITranslateCheckRun(this['_aiReviewCoreEditing']['getDocumentData'](),_0x750cb1,this['_aiConnector'],Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x6d21b0['params'],_0x6d21b0['args']);}['_onReviewCheckResultActivated'](_0x1a7060){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x1a7060['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x1a7060['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x5f08ff){this['_currentReviewCheckRun']&&('hover'===_0x5f08ff['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x5f08ff['id'])),'click'===_0x5f08ff['uiInteraction']&&this['_scrollToChange'](_0x5f08ff['id']));}['_onDeactivateChange'](_0x5b0d5d){this['_currentReviewCheckRun']&&'panel'===_0x5b0d5d['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x38aec9,_0x3dc941){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x3dc941['changeId']),this['_scrollToChange'](_0x3dc941['changeId']));}['_onChangeMarkerHovered'](_0x2db3be,_0x49e05a){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x49e05a['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x49e05a['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x28b04f){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x28b04f);}['_markChangePositionInEditorContent'](_0x4ea033,_0x33b58d){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x4ea033,_0x33b58d);}['_diffContent'](_0x1e91d3,_0x331d81,_0x54ec3b){return this['_aiReviewCoreEditing']['diffContent'](_0x1e91d3,_0x331d81,_0x54ec3b,!0x0);}['_onReviewCheckRun'](){for(const _0x4a0ec8 of this['_aiReviewCoreEditing']['getEditors']())_0x4a0ec8['editing']['view']['change'](_0x3127f0=>{for(const _0x2aacb3 of _0x4a0ec8['editing']['view']['document']['getRoots']())_0x3127f0['addClass']('ck-ai-translate-mode-content',_0x2aacb3);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}}class AITranslateCheckResultsView extends AIReviewCoreUICheckResultsView{constructor(_0x20a5a8,_0x6ada3a){super(_0x20a5a8,_0x6ada3a),this['on']('set:isLoading',(_0x43b406,_0x4b5d5e,_0x53fae7)=>{_0x53fae7&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0xb09dab,_0x18c2dc,_0x183640)=>{_0x183640&&(this['headerTitle']=Mi(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x270227=super['_createAcceptAllButtonView']();return _0x270227['set']('label',Mi(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x270227;}['_createExitReviewButtonView'](){const _0x2ffe1e=super['_createExitReviewButtonView']();return _0x2ffe1e['set']('label',Mi(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x2ffe1e;}}class AITranslateCheckListView extends AIReviewCoreReviewCheckListView{['_setupTemplate'](){const _0xd5f5d0=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0xd5f5d0['if']('isVisible','ck-hidden',_0x533ec0=>!_0x533ec0)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':Mi(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0xd5f5d0['if']('isVisible','ck-hidden',_0x2baa8e=>!_0x2baa8e)]},'children':this['_checkViews']}]});}}class AITranslateUI extends AIReviewCoreUI{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0x506f7c=this['context']['plugins']['get']('AITabs'),_0xb39293=this['context']['locale'],_0x430009=new AIHeaderView(_0xb39293,{'label':Mi(_0xb39293,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x54ca7a,'class':'ck-ai-header_review-translate','showResizeButton':_0x506f7c['showResizeButton']});_0x430009['delegate']('resizeTabs')['to'](_0x506f7c),_0x430009['bind']('isMaximized')['to'](_0x506f7c['view'],'isMaximized',_0x3f5eb2=>_0x3f5eb2);const _0x4c8622=new AIReviewCoreView(_0xb39293,{'header':_0x430009,'list':new AITranslateCheckListView(_0xb39293),'results':new AITranslateCheckResultsView(_0xb39293,{'generalErrorText':Mi(_0xb39293,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new AIReviewCoreReviewCompletedView(_0xb39293,{'headerText':Mi(_0xb39293,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':Mi(_0xb39293,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':Mi(_0xb39293,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x4c8622['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x4c8622;}['registerTab'](){const _0x86fc7a=this['context']['plugins']['get']('AITabs');_0x86fc7a['view']['on']('activateTab',(_0x1e14d4,{newTab:_0x40613c,oldTab:_0x547bb7})=>{'translate'===_0x40613c?this['fire']('getReviewCheckList'):'translate'===_0x547bb7&&this['fire']('leaveReview');}),_0x86fc7a['view']['addTab']({'id':'translate','buttonLabel':Mi(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x54ca7a,'order':0x0,'content':this['_mainView']});}}class AITranslate extends _0x915a98{static get['requires'](){return[AITranslateController,AITranslateUI,AIReviewCoreEditing];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{AIActions,AIAdapter,AIAssistant,AIAssistantUI,AIBalloon,AIChat,AIChatController,AIChatFeedCustomElementView,AIChatHistory,AIChatHistoryController,AIChatHistoryUI,AIChatInteraction,AIChatShortcuts,AIChatUI,AIConnector,AIEditing,AIEditorIntegration,AIGateway,AIInteraction,AIQuickActions,AIQuickActionsUI,AIReply,AIRequestError,AIReviewCheck,AIReviewCheckResult,AIReviewCheckResultChange,AIReviewCheckRun,AIReviewGateway,AIReviewMode,AIReviewCoreController as AIReviewModeController,AIReviewCoreEditing as AIReviewModeEditing,AIReviewModeUI,AIReviewRunResult,AIRunResult,AITabs,AITabsMainView,AITabsView,AITextAdapter,AIToggleButtonUI,AITranslate,AITranslateController,AITranslateUI,AWSTextAdapter,OpenAITextAdapter,ShowAIAssistantCommand,ToggleAICommand,Fi as createResizeButton,Di as getDefaultAICommands};
|
|
23
|
+
import{Command as _0xfa3ed0,ContextPlugin as _0x2d0760,Editor as _0x1a88b7,Plugin as _0x3f2605}from'@ckeditor/ckeditor5-core';import{IconAI as _0x2b8e87,IconAIAdjustLength as _0x523c75,IconAIAskAI as _0x5d2792,IconAIChangeTone as _0x5ed96b,IconAIChat as _0xc2f0bc,IconAIChatCommands as _0x332587,IconAIContinueWriting as _0x347ec9,IconAIGrammarCheck as _0x8854c0,IconAIHistory as _0x811149,IconAIImproveWriting as _0x32f401,IconAIOther as _0x5e2869,IconAIQuickActions as _0x4d468f,IconAIReview as _0x1c0339,IconAITranslate as _0x3ba0ab,IconBoxWithCheck as _0x99610,IconBoxWithCross as _0x4fad88,IconBoxWithMarker as _0x4b673d,IconBrowseFiles as _0xc00b77,IconBulb as _0x430e8f,IconCancel as _0x556600,IconCheck as _0x7ff926,IconChevronDown as _0x54ab4a,IconChevronRight as _0x5a1275,IconChevronUp as _0x1ce84,IconCopy as _0x152bd7,IconDocument as _0x5549b7,IconDocumentOutline as _0x2ce4a4,IconDropdownArrow as _0x10b8ad,IconError as _0xaff5dd,IconEye as _0x3654b6,IconEyeCrossedOut as _0x5cd5d8,IconFileUpload as _0x5807c5,IconImage as _0x566c8e,IconInfo as _0x220b4a,IconLink as _0x368e79,IconLoupe as _0x104c6b,IconMagicWand as _0xadf67a,IconMaximize as _0x2c8240,IconMinimize as _0x1c55e4,IconNextArrow as _0x21ac75,IconOutdated as _0x21ac9b,IconPaperClip as _0x2d6983,IconPin as _0x352d08,IconPlus as _0x94b997,IconPreviousArrow as _0x432064,IconRefresh as _0x2cd711,IconRobotPencil as _0x2c8e44,IconSelection as _0x129906,IconShowChangesOff as _0x3b4365,IconShowChangesOn as tt,IconStop as et,IconSubmit as it,IconThreeHorizontalDots as st,IconThumbDown as nt,IconThumbUp as rt,IconWeb as ot}from'@ckeditor/ckeditor5-icons';import{CKEditorError as at,Collection as ht,DomEmitterMixin as ct,EmitterMixin as lt,FocusTracker as ut,KeystrokeHandler as dt,ObservableMixin as _t,Rect as gt,ResizeObserver as At,_isMotionReduced as It,first as pt,getConstrainedViewportRect as mt,global as Et,insertToPriorityArray as Tt,isVisible as wt,logError as Ct,logWarning as ft,scrollAncestorsToShowTarget as bt,scrollViewportToShowTarget as St,toArray as Rt,uid as Ot,version as vt}from'@ckeditor/ckeditor5-utils';import{AutocompleteView as kt,BalloonPanelView as Nt,BalloonToolbar as yt,BodyCollection as xt,ButtonLabelView as Lt,ButtonLabelWithHighlightView as Dt,ButtonView as Pt,Dialog as Ht,DialogViewPosition as Mt,DropdownMenuPanelPositioningFunctions as Vt,FileDialogButtonView as Ut,FocusCycler as Bt,FormHeaderView as Gt,FormRowView as Ft,HighlightedTextView as Kt,IconView as Wt,InputTextView as Yt,LabeledFieldView as $t,ListItemButtonView as qt,ListItemGroupView as Qt,ListItemView as Xt,ListView as zt,MenuBarMenuListItemButtonView as jt,MenuBarMenuListItemView as Jt,MenuBarMenuListView as Zt,MenuBarMenuView as te,SearchTextView as _0x1cff6c,SpinnerView as _0xc9ae37,TextareaView as _0x52eb0a,ToolbarView as _0x177211,UIModel as _0x53b316,View as _0x1e8352,ViewCollection as _0x14141a,addListToDropdown as _0x11b460,addMenuToDropdown as _0x214d8b,clickOutsideHandler as _0x262419,createDropdown as _0x312ca1,createLabeledInputText as _0x691176,createLabeledTextarea as _0x4650d6,submitHandler as _0x1597e8}from'@ckeditor/ckeditor5-ui';import{ClipboardMarkersUtils as _0xbf70bd,ClipboardPipeline as _0x43cfcc}from'@ckeditor/ckeditor5-clipboard';import{InsertOperation as _0x491445,MarkerOperation as _0x43f670,Matcher as _0x2896fa,ModelDocumentFragment as _0x500fd6,ModelPosition as _0x34d4d5,ModelRange as _0x15a2ab,ModelTreeWalker as _0x134ed6,ViewDataTransfer as _0x3d6f97,ViewDocumentDomEventData as _0x4f9ee5,ViewDowncastWriter as _0x333da2,ViewUpcastWriter as _0xb269fb,_DetachOperation as _0x39d5b2,_insertIntoModelNodeList as _0x48ea58,_removeFromModelNodeList as _0x1c6fac,transformOperationSets as _0x30647f}from'@ckeditor/ckeditor5-engine';import{cloneDeep as _0x35eb29,debounce as _0x173d8f,escape as _0x9a78d5,escapeRegExp as _0xc078db,throttle as _0x43472a,unescape as _0x1c7478}from'es-toolkit/compat';import{createParser as _0x4e09d9}from'eventsource-parser';import{CloudServices as _0x433de6}from'@ckeditor/ckeditor5-cloud-services';import{ConfirmMixin as _0x21e0c7,DATA_ID_MODEL_ATTRIBUTE as _0x2be158,DATA_ID_VIEW_ATTRIBUTE as _0x2e258d,DocumentCompare as _0x5b6f61,SuggestionsConversion as _0x4e8e72,fixElementSuggestionRange as _0x4777b9,getAllMarkersDomElementsSorted as _0x33b883,getMarkerDomElement as _0xee7c03}from'@ckeditor/ckeditor5-collaboration-core';import{parseDocument as _0x1f0f5e}from'htmlparser2';import{append as _0x4f0c18,appendChild as _0x3e294c,find as _0x2e1a4a,findAll as _0x269094,findOne as _0x36c87f,getChildren as ti,getParent as _0x4812a4,isComment as _0x1a5d2e,isTag as _0x3dcf78,prepend as _0xe4cd1,prependChild as _0x5e9666,removeElement as _0x5d7a74,replaceElement as _0xf9e0b3,textContent as _0x475662}from'domutils';import _0x5286d3 from'dom-serializer';import{Document as _0x4e2431,Element as _0x19163f,NodeWithChildren as _0x2a712f,Text as _0x297122,cloneNode as _0x5c7833,isDocument as _0x149981,isText as _0x59e3a7}from'domhandler';import{MarkdownGfmMdToHtml as _0x2c4472,MarkdownGfmMdToHtmlDefaultPlugins as _0x1a3c76}from'@ckeditor/ckeditor5-markdown-gfm';import _0x32bbb3 from'rehype-sanitize';import _0x488cd9 from'morphdom';import{diffArrays as _0x4c3236}from'diff';const Ci='_ungrouppedCommands';function fi(_0x51c915,_0x27baa1){const _0x424c51=(0x0,_0x27baa1['t'])('Other');return _0x51c915['length']?'groupId'in _0x51c915[0x0]?_0x51c915:[{'groupId':Ci,'groupLabel':_0x424c51,'order':0x1/0x0,'commands':_0x51c915}]:[{'groupId':Ci,'groupLabel':_0x424c51,'order':0x1/0x0,'commands':[]}];}const bi=globalThis['DataTransfer'],Si='ai-ui';var Ri=class extends _0x3f2605{static get['pluginName'](){return'AIAssistantEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const {editor:_0x167ccb}=this,_0x415dd5=['ck-fake-ai-selection'];_0x167ccb['config']['get']('ai.assistant.useTheme')&&_0x415dd5['push']('ck-ai-assistant-ui_theme'),_0x167ccb['conversion']['for']('editingDowncast')['markerToHighlight']({'model':Si,'view':{'classes':_0x415dd5,'priority':0xc}}),_0x167ccb['conversion']['for']('editingDowncast')['markerToElement']({'model':Si,'view':(_0x2d9849,{writer:_0x5ef519})=>{if(!_0x2d9849['markerRange']['isCollapsed'])return null;const _0x1437a8=_0x5ef519['createUIElement']('span');return _0x5ef519['addClass'](['ck-fake-ai-selection','ck-fake-ai-selection_collapsed'],_0x1437a8),_0x1437a8;}});}['afterInit'](){!async function(_0x4d0b29){const _0x12ab98='nA7yurgOHbZvDplRkJscdICm86oPWx92f1qF0LaSX3NGwTMK4jVtYUBQi5zheE',_0x43651e=0x78de0,_0x19c90b=window['Date']['now'](),_0xf4261c=_0x4d0b29['editor'],_0x4a2c60=new window['Promise'](_0x1472a6=>{_0xf4261c['once']('ready',_0x1472a6);}),_0xf980cd={'kty':'EC','use':'sig','crv':'P-256','x':'iCjOCvDFI6lQHHT18jVwRfkfHQ2a_MymT35LQVoFSAI','y':'kXIyJ4evtCEFRmxKSUpK9fDW459vXOvVrhf6uQAeOio','alg':'ES256'},_0x5dc9a9=_0xf4261c['config']['get']('licenseKey');async function _0xea2b66(){let _0x2582aa,_0x1bc52d=null,_0x20e796=null;try{return'GPL'==_0x5dc9a9?'NotAllowed':(_0x2582aa=_0x1118f3(),_0x2582aa?(_0x2582aa['usageEndpoint']&&(_0x20e796=_0x27bc4a(_0x2582aa['usageEndpoint'],_0x2582aa['jti'])),await _0x5b9f70()?_0x577d36()?_0x163c1a()?'Expired':_0x2c067b()?('evaluation'==_0x2582aa['licenseType']&&(_0x1bc52d=_0x574f6e('EvaluationLimit')),await _0x56cef9()):'DomainLimit':'NotAllowed':'Invalid'):'Invalid');}catch{return'Invalid';}function _0x163c1a(){const _0x45456e=['evaluation','trial']['includes'](_0x2582aa['licenseType'])?_0x19c90b/0x3e8:0xe10*_0x43651e;return _0x2582aa['exp']<_0x45456e;}function _0x577d36(){const _0x5ab470=_0x2582aa['features'];return!!_0x5ab470&&(!!_0x5ab470['includes']('*')||!!_0x5ab470['includes']('AI'));}function _0x2c067b(){const _0x5a3034=_0x2582aa['licensedHosts'];if(!_0x5a3034||0x0==_0x5a3034['length'])return!0x0;const {hostname:_0x54e890}=new URL(window['location']['href']);if(_0x5a3034['includes'](_0x54e890))return!0x0;const _0x2f2338=_0x54e890['split']('.');return _0x5a3034['filter'](_0x166c41=>_0x166c41['includes']('*'))['map'](_0x2004fb=>_0x2004fb['split']('.'))['filter'](_0x3cf93a=>_0x3cf93a['length']<=_0x2f2338['length'])['map'](_0x19ba59=>Array(_0x2f2338['length']-_0x19ba59['length'])['fill']('*'===_0x19ba59[0x0]?'*':'')['concat'](_0x19ba59))['some'](_0x4d2ef5=>_0x2f2338['every']((_0x1d1b9d,_0x5e4d5e)=>_0x4d2ef5[_0x5e4d5e]===_0x1d1b9d||'*'===_0x4d2ef5[_0x5e4d5e]));}function _0x56cef9(){return _0x1bc52d&&_0x20e796?new window['Promise']((_0x67592f,_0x3716f5)=>{_0x1bc52d['then'](_0x67592f,_0x3716f5),_0x20e796['then'](_0x3921fe=>{'Valid'!=_0x3921fe&&_0x67592f(_0x3921fe);},_0x3716f5);}):_0x1bc52d||_0x20e796||'Valid';}}function _0x27bc4a(_0x9c63e3,_0x435b31){return new window['Promise'](_0x26b761=>{if(_0x2a4ff8())return _0x26b761('Valid');_0x468361(),_0xf4261c['decorate']('_sendUsageRequest');let _0x5ce1dd=!0x1;const _0x4831e0=Ot();function _0x599b26(_0x45856e){return!!_0x45856e&&('object'==typeof _0x45856e||'function'==typeof _0x45856e)&&'function'==typeof _0x45856e['then']&&'function'==typeof _0x45856e['catch'];}function _0x135ef5(_0x4a2591){_0x3257e2(_0x4a2591)['then'](_0x51c6f0=>_0x51c6f0&&'ok'==_0x51c6f0['status']?_0x3e1ce0(_0x4a5b9c(_0x4831e0+_0x435b31))!=_0x51c6f0['verification']?'UsageLimit':'Valid':'UsageLimit')['then'](_0x15191d=>(_0x5072c6(),_0x15191d),()=>{const _0x40b22f=_0x149b56();return null==_0x40b22f?(_0x5072c6(),'Valid'):_0x19c90b-_0x40b22f>0x240c8400?'UsageLimit':'Valid';})['then'](_0x26b761)['catch'](()=>{_0x26b761('UsageLimit');});const _0x4c20a2=0x36ee80;function _0x5072c6(){const _0x229949='llct-'+_0x3e1ce0(_0x4a5b9c(_0x9c63e3)),_0x41b4b5=_0x3ab932(_0x3e1ce0(window['Math']['ceil'](_0x19c90b/_0x4c20a2)));window['localStorage']['setItem'](_0x229949,_0x41b4b5);}function _0x149b56(){const _0x38d11d='llct-'+_0x3e1ce0(_0x4a5b9c(_0x9c63e3)),_0x2c1475=window['localStorage']['getItem'](_0x38d11d);return _0x2c1475?window['parseInt'](_0x3ab932(_0x2c1475),0x10)*_0x4c20a2:null;}function _0x3257e2(_0x1a876a){return new window['Promise']((_0x48d719,_0x162f93)=>{_0x1a876a['then'](_0x48d719,_0x162f93),window['setTimeout'](_0x162f93,0x1d4c0);});}}_0xf4261c['on']('_sendUsageRequest',(_0x1ff141,_0x26fc93)=>{if(_0x26fc93[0x0]!=_0x9c63e3)return _0x26b761('UsageLimit');_0x26fc93[0x1]={..._0x26fc93[0x1],'requestId':_0x4831e0};},{'priority':'high'}),_0xf4261c['on']('_sendUsageRequest',_0x1f524b=>{_0x599b26(_0x1f524b['return'])&&(_0x5ce1dd=!0x0,_0x135ef5(_0x1f524b['return']));},{'priority':'low'}),_0x4a2c60['then'](()=>{_0x5ce1dd||_0x26b761('UsageLimit');});});function _0x2a4ff8(){return'auto'==_0xf4261c['editing']['view']['_overlayModeHint'];}function _0x468361(){_0xf4261c['editing']['view']['_overlayModeHint']='auto';}}function _0x574f6e(_0xb7e971){const _0x596593=[new window['Promise'](_0x4411e7=>setTimeout(_0x4411e7,0x93ecc)),_0x4a2c60['then'](()=>new window['Promise'](_0x5e470f=>{let _0x2a9b69=0x0;_0xf4261c['model']['on']('applyOperation',(_0x2084eb,_0xc3a7a1)=>{_0xc3a7a1[0x0]['isDocumentOperation']&&_0x2a9b69++,0x5e8==_0x2a9b69&&(_0x5e470f(),_0x2084eb['off']());});}))];return window['Promise']['race'](_0x596593)['then'](()=>_0xb7e971);}async function _0x30ff62(){await _0x4a2c60,_0xf4261c['model']['change']=_0x2456ba,_0xf4261c['model']['enqueueChange']=_0x2456ba,_0xf4261c['enableReadOnlyMode']('model');}function _0x177682(_0x407e32){const _0x228f99=_0x2d4af9();_0xf4261c[_0x228f99]='aiLicenseKey'+_0x407e32,'Valid'!=_0x407e32&&_0x30ff62();}function _0x2d4af9(){const _0x444157=window['String'](window['performance']['now']())['replace']('.','');let _0x147ef4='n';for(let _0x460869=0x0;_0x460869<_0x444157['length'];_0x460869+=0x2){let _0x320ba7=window['parseInt'](_0x444157['substring'](_0x460869,_0x460869+0x2));_0x320ba7>=0x3e&&(_0x320ba7-=0x3e),_0x147ef4+=_0x12ab98[_0x320ba7];}return _0x147ef4;}function _0x1118f3(){const _0x443c3c=_0x5dc9a9['split']('.');if(0x3!=_0x443c3c['length'])return null;return _0x54c45f(_0x443c3c[0x1]);function _0x54c45f(_0x2e1655){const _0x15b47a=_0x3619b3(_0x2e1655);return _0x15b47a&&_0x5a2f48()?_0x15b47a:null;function _0x5a2f48(){const _0x224c70=_0x15b47a['jti'],_0x51083f=window['parseInt'](_0x224c70['substring'](_0x224c70['length']-0x8),0x10),_0x29a329={..._0x15b47a,'jti':_0x224c70['substring'](0x0,_0x224c70['length']-0x8)};return delete _0x29a329['vc'],_0x4a5b9c(_0x29a329)==_0x51083f;}}}async function _0x5b9f70(){let _0x1db805=!0x0;try{const [_0x1cc495,_0x588c75,_0x4e117d]=_0x5dc9a9['split']('.');return _0x5cc5fb(_0x1cc495),await _0x28e7a8(_0x1cc495,_0x588c75,_0x4e117d),_0x1db805;}catch{return!0x1;}function _0x5cc5fb(_0x3395e8){const _0x572fb0=_0x3619b3(_0x3395e8);_0x572fb0&&'ES256'==_0x572fb0['alg']||(_0x1db805=!0x1);}async function _0x28e7a8(_0xc0b7ed,_0x2dae33,_0x8a983a){const _0x2da780=window['Uint8Array']['from'](_0x119ed7(_0x8a983a),_0x3576a0=>_0x3576a0['charCodeAt'](0x0)),_0x471db4=new window['TextEncoder']()['encode'](_0xc0b7ed+'.'+_0x2dae33),_0x2af36f=window['crypto']['subtle'];if(!_0x2af36f)return;const _0x3d84c1=await _0x2af36f['importKey']('jwk',_0xf980cd,{'name':'ECDSA','namedCurve':'P-256'},!0x1,['verify']);await _0x2af36f['verify']({'name':'ECDSA','hash':{'name':'SHA-256'}},_0x3d84c1,_0x2da780,_0x471db4)||(_0x1db805=!0x1);}}function _0x3619b3(_0x5b1c3){return _0x5b1c3['startsWith']('ey')?JSON['parse'](_0x119ed7(_0x5b1c3)):null;}function _0x119ed7(_0x3c80a7){return window['atob'](_0x3c80a7['replace'](/-/g,'+')['replace'](/_/g,'/'));}function _0x4a5b9c(_0x573187){let _0x57e90c=0x1505;function _0x427cf3(_0x2bb1c2){for(let _0x388bed=0x0;_0x388bed<_0x2bb1c2['length'];_0x388bed++){const _0x11a830=_0x2bb1c2['charCodeAt'](_0x388bed);_0x57e90c=(_0x57e90c<<0x5)+_0x57e90c+_0x11a830,_0x57e90c&=_0x57e90c;}}function _0x712a38(_0xec80bd){Array['isArray'](_0xec80bd)?_0xec80bd['forEach'](_0x712a38):_0xec80bd&&'object'==typeof _0xec80bd?Object['entries'](_0xec80bd)['sort']()['forEach'](([_0x1fb7e1,_0x33c418])=>{_0x427cf3(_0x1fb7e1),_0x712a38(_0x33c418);}):_0x427cf3(window['String'](_0xec80bd));}return _0x712a38(_0x573187),_0x57e90c>>>0x0;}function _0x3e1ce0(_0x4ecc27){return _0x4ecc27['toString'](0x10)['padStart'](0x8,'0');}function _0x3ab932(_0x3ca6e7){return _0x3ca6e7['split']('')['reverse']()['join']('');}function _0x2456ba(){}_0x177682(await _0xea2b66());}(this);}['showFakeVisualSelection'](){const _0x489221=this['editor']['model'];_0x489221['change'](_0x501d85=>{const _0x31ccdc=_0x489221['document']['selection']['getRanges']();let _0x437c84=0x0;for(const _0x30ac93 of _0x31ccdc){const _0x1dad0a=Si+':'+_0x437c84;if(_0x489221['markers']['has'](_0x1dad0a))_0x501d85['updateMarker'](_0x1dad0a,{'range':_0x30ac93});else{if(_0x30ac93['start']['isAtEnd']){const _0x455535=_0x30ac93['start']['getLastMatchingPosition'](({item:_0x4b1a15})=>!_0x489221['schema']['isContent'](_0x4b1a15),{'boundaries':_0x30ac93});_0x501d85['addMarker'](_0x1dad0a,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x501d85['createRange'](_0x455535,_0x30ac93['end'])});}else _0x501d85['addMarker'](_0x1dad0a,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x30ac93});}_0x437c84++;}});}['hideFakeVisualSelection'](){const _0x48accc=this['editor']['model'],_0x3ec2f3=Array['from'](this['editor']['model']['markers']['getMarkersGroup'](Si));_0x3ec2f3['length']&&_0x48accc['change'](_0x1d595b=>{_0x3ec2f3['forEach'](_0x4e9e5a=>{_0x1d595b['removeMarker'](_0x4e9e5a);});});}['insertContent'](_0x1a9360,_0x5475b3){const _0x4396da=this['_getAISelection'](),_0x66f989=_0x5475b3||_0x4396da['getFirstRange']();this['editor']['model']['canEditAt'](_0x66f989)&&this['editor']['model']['change'](_0x59dbdf=>{this['hideFakeVisualSelection'](),_0x5475b3||this['_resetContentOfSelectedTableCells'](_0x59dbdf,_0x4396da),this['_pasteHTMLUsingClipboard']({'insertAt':_0x66f989,'writer':_0x59dbdf,'html':_0x1a9360});});}['insertContentBelow'](_0x14d4cd){const {model:_0x1d1bb4}=this['editor'],_0x360f92=this['_getAISelection']();_0x1d1bb4['change'](()=>{const _0x5cb132=this['_prepareTableInsertBelowPosition'](_0x14d4cd,_0x360f92)||this['_getDefaultInsertBelowPosition'](_0x360f92);this['insertContent'](_0x14d4cd,_0x5cb132);});}['_getAISelection'](){const _0x22ae36=this['editor']['model'],_0x10885b=Array['from'](_0x22ae36['markers']['getMarkersGroup'](Si))['map'](_0x29dcaa=>_0x29dcaa['getRange']());return _0x22ae36['createSelection'](_0x10885b);}['_pasteHTMLUsingClipboard']({writer:_0x3ac3f9,html:_0x1c779c,insertAt:_0xdeb250}){const {view:_0x5f59b7}=this['editor']['editing'],_0x237a7a=this['editor']['plugins']['get'](_0x43cfcc),_0x11bdb4=new bi();_0x11bdb4['setData']('text/html',_0x1c779c);const _0x360d1b=new _0x4f9ee5(_0x5f59b7,new ClipboardEvent('paste',{'clipboardData':_0x11bdb4}),{'dataTransfer':new _0x3d6f97(_0x11bdb4)});_0x3ac3f9['setSelection'](_0xdeb250);const _0x116c4c=(_0x18d425,_0x255e93)=>{_0x255e93['resultRange']&&_0x3ac3f9['setSelection'](_0x255e93['resultRange']);};_0x237a7a['once']('contentInsertion',_0x116c4c,{'priority':'lowest'}),_0x5f59b7['document']['fire']('paste',_0x360d1b),_0x237a7a['off']('contentInsertion',_0x116c4c);}['_getDefaultInsertBelowPosition'](_0x102df6){const {model:_0x4b2466}=this['editor'],_0x3a4110=Array['from'](_0x102df6['getSelectedBlocks']());return _0x3a4110['length']?_0x4b2466['createPositionAfter'](_0x3a4110['pop']()):_0x102df6['getLastPosition']();}['_prepareTableInsertBelowPosition'](_0xdc4547,_0x1cc305){const {model:_0x1d1679,plugins:_0x500173}=this['editor'];if(_0x500173['has']('TableUtils')){const _0x56a957=_0x500173['get']('TableUtils')['getSelectedTableCells'](_0x1cc305);if(_0x56a957['length']){const _0x531abc=this['_getTableRowCountFromContent'](_0xdc4547),_0x2c48d0=this['_createEmptyTableRows'](_0x56a957,_0x531abc);return _0x1d1679['createPositionAt'](_0x2c48d0,0x0);}}return null;}['_getTableRowCountFromContent'](_0x231b0a){const _0x25cd4e=this['editor']['plugins']['get']('TableUtils'),_0x19585e=this['editor']['data']['parse'](_0x231b0a,'$documentFragment'),_0x1f7b9c=Array['from'](_0x19585e['getChildren']())['filter'](_0xeca336=>_0xeca336['is']('element','table'));let _0x1f96af=0x0;return _0x1f7b9c['forEach'](_0x5e95fa=>{_0x1f96af+=_0x25cd4e['getRows'](_0x5e95fa);}),_0x1f96af;}['_createEmptyTableRows'](_0x5b6424,_0x2d306c){const _0x339a21=this['editor']['plugins']['get']('TableUtils'),_0xd61e46=_0x339a21['getRowIndexes'](_0x5b6424),_0xeb5bd3=_0x339a21['getColumnIndexes'](_0x5b6424),_0x391aae=_0xd61e46['last']+0x1,_0x292003=_0xeb5bd3['first'],_0x577afa=_0x5b6424[0x0]['findAncestor']('table');for(let _0x4d8ad9=0x0;_0x4d8ad9<_0x2d306c;_0x4d8ad9++)_0x339a21['insertRows'](_0x577afa,{'at':_0x391aae});return _0x577afa['getChild'](_0x391aae)['getChild'](_0x292003);}['_resetContentOfSelectedTableCells'](_0x1910ed,_0x21c686){const {plugins:_0x53e928}=this['editor'],{model:_0x52fb9d}=_0x1910ed;_0x53e928['has']('TableUtils')&&_0x53e928['get']('TableUtils')['getSelectedTableCells'](_0x21c686)['length']&&_0x52fb9d['deleteContent'](_0x21c686);}},Oi=class extends _0x3f2605{static get['pluginName'](){return'AIAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['afterInit'](){if(!this['textAdapter'])throw new at('aiadapter-text-adapter-not-set',null);}},vi=class extends Error{constructor(_0x399f7c){super(_0x399f7c),this['name']='AIRequestError';}};function ki(_0x5c465e,_0x604d0d,_0x1436c7){const t=_0x5c465e['t'];switch(_0x604d0d){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',_0x1436c7);case'Error\x20during\x20AI\x20content\x20generation:\x20%0':return t('Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x1436c7);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'},_0x1436c7);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 _0x604d0d;}}var Ni=class extends _0xfa3ed0{['_commandDefinitions'];constructor(_0x50b653,_0x18695b){super(_0x50b653),this['_commandDefinitions']=_0x18695b,this['set']('enabledCommandsIds',[]),this['on']('change:_hasContext',(_0x941946,_0x2e6d4f,_0x5ecb08)=>{this['isEnabled']&&(this['enabledCommandsIds']=yi(this['_commandDefinitions'],_0x5ecb08));}),this['set']('_hasContext',!0x1),this['on']('change:isEnabled',(_0x44dbad,_0x17b978,_0x3cab85)=>{this['enabledCommandsIds']=_0x3cab85?yi(this['_commandDefinitions'],this['_hasContext']):[];});}['refresh'](){const _0x3fb8e0=this['editor']['model'];this['_hasContext']=function(_0x54b0f9){const _0x449b78=_0x54b0f9['document']['selection'];return _0x449b78['isCollapsed']?0x0!==[..._0x449b78['getSelectedBlocks']()]['length']&&![..._0x449b78['getSelectedBlocks']()][0x0]['isEmpty']:!!_0x54b0f9['hasContent'](_0x449b78['getFirstRange']());}(_0x3fb8e0);const _0x43809f=_0x3fb8e0['document']['selection'],_0x1d5d8e=this['editor']['config']['get']('ai.assistant.disabledElements');for(const _0x1b2533 of _0x43809f['getRanges']())for(const _0x3bba0a of _0x1b2533['getItems']())if(_0x3bba0a['is']('element')&&_0x1d5d8e['includes'](_0x3bba0a['name']))return void(this['isEnabled']=!0x1);this['isEnabled']=!0x0;}['execute'](_0x1c943a='',_0x5e31c8='',_0x2d2a4a='custom'){this['editor']['plugins']['get'](Qi)['showUI'](_0x1c943a,_0x5e31c8,_0x2d2a4a);}};function yi(_0x5eaa87,_0x4e6f73){const _0x2269e4=new Set();for(const _0x4dccab of _0x5eaa87['values']())(_0x4e6f73||!0x1===_0x4dccab['requiresContent'])&&_0x2269e4['add'](_0x4dccab['id']);return Array['from'](_0x2269e4);}const xi=new RegExp(/^(.*?)<[a-zA-Z][a-zA-Z0-9_\-.]*[ >]/,'is'),Li=/* #__PURE__ -- @preserve */
|
|
24
|
+
_t();var Di=class extends Li{['editor'];['textAdapter'];['view'];['_sanitizationContainer'];['_domParser'];['_xmlSerializer'];constructor(_0xf517c,_0x3a8bf3,_0x50a994){super(),this['editor']=_0xf517c,this['textAdapter']=_0x3a8bf3,this['_sanitizationContainer']=document['createElement']('div'),this['_domParser']=new DOMParser(),this['_xmlSerializer']=new XMLSerializer(),this['view']=_0x50a994,this['set']({'initialContext':'','currentContext':'','currentResponse':'','previousContext':void 0x0,'previousQuery':void 0x0,'previousLabel':void 0x0,'isProcessing':!0x1}),this['on']('set:currentContext',(_0xe92feb,_0x575f7e,_0x391cac)=>{this['view']['value']=this['_sanitizeHTML'](_0x391cac);}),this['listenTo'](this['view'],'submitPrompt',(_0x471d12,_0x1b3660)=>{const _0x1fdb6b=this['currentContext']||this['initialContext'];this['_handleQuery'](_0x1b3660,_0x1fdb6b,'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:_0x3463be,query:_0x2fe571,htmlContent:_0x131180,label:_0x7a6a88,mainActionLabel:_0x10bf8b}){this['view']['prompt']=_0x7a6a88,this['view']['mainAction']=_0x10bf8b,this['initialContext']=_0x131180,_0x2fe571&&(this['view']['isRendered']?this['_handleQuery'](_0x2fe571,_0x131180,_0x3463be,_0x7a6a88):this['view']['once']('render',()=>{this['_handleQuery'](_0x2fe571,_0x131180,_0x3463be,_0x7a6a88);}));}['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'](_0x1bb273,_0x345f86,_0x48a327,_0x5b1d9d){return this['isProcessing']=!0x0,this['view']['startProcessing'](),this['previousContext']=_0x345f86,this['previousQuery']=_0x1bb273,this['previousLabel']=_0x5b1d9d||_0x1bb273,this['previousActionId']=_0x48a327,new Promise(_0x5bb079=>{this['textAdapter']['makeRequest']({'query':_0x1bb273,'context':_0x345f86,'onData':_0x15688a=>{this['currentResponse']=_0x15688a,this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse']);},'actionId':_0x48a327})['then'](()=>{!this['currentContext']&&this['currentResponse']&&(this['currentContext']=this['_parseAndNormalizeContent'](this['currentResponse'],!0x0));})['catch'](_0x31af54=>{_0x31af54 instanceof vi?this['view']['handleError'](_0x31af54['message']):this['view']['handleError'](),_0x5bb079();})['finally'](()=>{this['stopProcessing'](),_0x5bb079();});});}['_parseAndNormalizeContent'](_0x3d0009,_0x2774d7=!0x1){const _0x2cb7a8=xi['exec'](_0x3d0009);_0x3d0009=_0x2cb7a8?_0x3d0009['substring'](_0x2cb7a8[0x1]['length']):_0x3d0009['length']<0x64&&!_0x2774d7?'':this['_stripMarkdownSyntax'](_0x3d0009);const _0x4d7d8a=this['_domParser']['parseFromString'](_0x3d0009,'text/html');if(_0x2cb7a8){const _0x266cd4=Array['from'](_0x4d7d8a['body']['childNodes']);_0x266cd4['reverse']();for(const _0x4a7c85 of _0x266cd4){if(_0x4a7c85['nodeType']==Node['ELEMENT_NODE'])break;_0x4a7c85['remove']();}}const _0x258696=this['editor']['data']['processor']['toView'](this['_xmlSerializer']['serializeToString'](_0x4d7d8a['body']));this['_isH1TagSupportEnabled']()||this['_normalizeResponseHeadings'](_0x258696);const _0x3a4e8d=this['editor']['config']['get']('ai.assistant.preserveComments'),_0x4d8d40=this['editor']['data']['toModel'](_0x258696);return _0x3a4e8d||_0x4d8d40['markers']['clear'](),this['editor']['data']['stringify'](_0x4d8d40);}['_normalizeResponseHeadings'](_0x409600){const _0x390aee=new _0xb269fb(this['editor']['editing']['view']['document']),_0x4b8063=new _0x2896fa({'name':/^h[1-5]$/}),_0x2b9754=[];let _0x57d000=!0x1;for(const _0x262ce4 of _0x409600)_0x262ce4['is']('element')&&_0x4b8063['match'](_0x262ce4)&&(_0x2b9754['push'](_0x262ce4),'h1'==_0x262ce4['name']&&(_0x57d000=!0x0));if(_0x57d000){for(const _0xf41a81 of _0x2b9754)_0x390aee['rename']('h'+(parseInt(_0xf41a81['name'][0x1])+0x1),_0xf41a81);}}['_isH1TagSupportEnabled'](){const {data:_0x12a87f,editing:_0x567503}=this['editor'],_0x37bd38=_0x12a87f['htmlProcessor']['toView']('<h1></h1>'),_0x1a1bbf=_0x12a87f['toView'](_0x12a87f['toModel'](_0x37bd38));return!!_0x567503['view']['domConverter']['viewToDom'](_0x1a1bbf)['querySelector']('h1');}['_sanitizeHTML'](_0x4511f2){return this['editor']['editing']['view']['domConverter']['setContentOf'](this['_sanitizationContainer'],_0x4511f2),this['_sanitizationContainer']['innerHTML'];}['_stripMarkdownSyntax'](_0x56f5f5){const _0x20cf91=_0x56f5f5['trim']();return _0x20cf91['startsWith']('```html')?_0x20cf91['endsWith']('```')?_0x20cf91['substring'](0x7,_0x20cf91['length']-0x3):_0x20cf91['substring'](0x7):_0x56f5f5;}};const Pi={'REPLACE':'replace','INSERT':'insert'};var Hi=class extends _0x177211{constructor(_0x4410cd){super(_0x4410cd),this['set']('isVisible',!0x1),this['set']('mainAction',Pi['REPLACE']),this['replaceButton']=this['_createButton']('','ck-button-action'),this['replaceButton']['bind']('label')['to'](this,'mainAction',_0x44a93a=>ki(_0x4410cd,'AI_'+_0x44a93a['toUpperCase']()+'_CONTENT')),this['insertButton']=this['_createButton'](ki(_0x4410cd,'Insert\x20below')),this['tryAgainButton']=this['_createButton'](ki(_0x4410cd,'Try\x20again')),this['stopButton']=this['_createButton'](ki(_0x4410cd,'Stop'));const _0x25fd13=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-form__toolbar',_0x25fd13['if']('isVisible','ck-hidden',_0xbaa153=>!_0xbaa153)]}}),this['items']['addMany']([this['replaceButton'],this['insertButton'],this['tryAgainButton'],this['stopButton']]);}['_createButton'](_0x6eae87,_0x4ba7b6){const _0x159c06=new Pt(this['locale']);return _0x159c06['set']({'label':_0x6eae87,'class':_0x4ba7b6||'','isVisible':!0x0,'withText':!0x0}),_0x159c06;}},Mi=class extends _0x1e8352{['contentFieldView'];['copyButtonView'];constructor(_0x2be18a,_0x2dbdb5=''){super(_0x2be18a),this['set']({'value':null,'isVisible':!0x1,'isProcessing':!0x1});const _0x5ee4e1=this['bindTemplate'];this['contentFieldView']=new Vi(_0x2be18a,_0x2dbdb5),this['copyButtonView']=this['_createCopyButton'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area-wrapper',_0x5ee4e1['if']('isVisible','ck-hidden',_0x1fa8ba=>!_0x1fa8ba)],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form__content-area',_0x5ee4e1['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 _0x49956e=!0x1;this['on']('change:value',(_0x39fa87,_0x4537a6,_0x530d9f)=>{const _0x431f43=!this['contentFieldView']['element']['querySelector']('.ck-ai-form__loader');this['contentFieldView']['setContent'](_0x530d9f),this['isProcessing']&&_0x431f43&&!_0x49956e&&this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':'smooth'});}),this['on']('change:isProcessing',(_0x17ac17,_0x4f6152,_0x32d835)=>{_0x49956e=!0x1,_0x32d835?(this['value']=null,this['contentFieldView']['appendLoader']()):this['value']||this['contentFieldView']['setContent']('');}),this['listenTo'](this['element'],'wheel',()=>{_0x49956e=!0x0;}),this['listenTo'](this['element'],'mousedown',()=>{_0x49956e=!0x0;});}['focus'](){this['element']['focus']();}['_createCopyButton'](){const _0x192e31=this['locale'],_0x55a2da=new Pt(this['locale']),_0x251a43='ck-ai-form__copy-button';return _0x55a2da['set']({'label':ki(_0x192e31,'Copy'),'icon':_0x152bd7,'class':_0x251a43,'tooltip':!0x0}),_0x55a2da['bind']('isVisible')['to'](this,'value',_0x268718=>!!_0x268718),_0x55a2da['bind']('isEnabled')['to'](this,'isProcessing',_0x3d4a18=>!_0x3d4a18),_0x55a2da['on']('execute',()=>{this['_copyHTMLToClipboard'](this['contentFieldView']['element']),_0x55a2da['icon']=_0x7ff926,_0x55a2da['class']=_0x251a43+'\x20ck-ai-form__copy-button--copied',this['focus'](),setTimeout(()=>{_0x55a2da['icon']=_0x152bd7,_0x55a2da['class']=_0x251a43;},0x3e8);}),_0x55a2da;}['_copyHTMLToClipboard'](_0x50ef49){const {window:_0x3f2224,document:_0x4010c5}=Et;if(_0x3f2224['ClipboardItem']){const {Blob:_0x390e73,ClipboardItem:_0x14570a}=_0x3f2224,_0x3cbb5f=[new _0x14570a({'text/html':new _0x390e73([_0x50ef49['innerHTML']],{'type':'text/html'}),'text/plain':new _0x390e73([_0x50ef49['textContent']||''],{'type':'text/plain'})})];navigator['clipboard']['write'](_0x3cbb5f);}else{const _0x49a2f5=_0x4010c5['createElement']('div');_0x49a2f5['style']['position']='absolute',_0x49a2f5['style']['left']='-9999px',_0x49a2f5['innerHTML']='<span>[</span>'+_0x50ef49['innerHTML']+'<span>]</span>',_0x4010c5['body']['appendChild'](_0x49a2f5);const _0x78bbad=_0x4010c5['createRange']();_0x78bbad['setStartAfter'](_0x49a2f5['firstElementChild']),_0x78bbad['setEndBefore'](_0x49a2f5['lastElementChild']);const _0x4c065e=_0x3f2224['getSelection']();_0x4c065e['removeAllRanges'](),_0x4c065e['addRange'](_0x78bbad),_0x4010c5['execCommand']('copy'),_0x49a2f5['remove']();}}},Vi=class extends _0x1e8352{constructor(_0x53acb8,_0x113d94=''){super(_0x53acb8),this['loaderView']=this['_createLoader'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content',_0x113d94,'ck-reset_all-excluded','ck-ai-form__content-field']}});}['setContent'](_0x137c9c){this['element']['innerHTML']=_0x137c9c;}['appendLoader'](){this['element']['appendChild'](this['loaderView']['element']);}['_createLoader'](){const _0x2fd397=new _0x1e8352(),_0x52350e=this['locale'],_0x31d5d6=new _0xc9ae37();return _0x31d5d6['isVisible']=!0x0,_0x2fd397['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__loader']},'children':[_0x31d5d6,{'text':ki(_0x52350e,'AI\x20is\x20writing...')}]}),_0x2fd397['render'](),_0x2fd397;}},Ui=class extends _0x1e8352{constructor(_0x481269,_0x20bc6a=''){super(_0x481269);const _0x578b5f=new Wt(),_0x35028f=this['bindTemplate'];this['set']('text',_0x20bc6a),_0x578b5f['content']=_0xaff5dd,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form__error']},'children':[_0x578b5f,{'text':_0x35028f['to']('text')}]});}},Bi=class extends kt{['submitButtonView'];['showHistoryButtonView'];constructor(_0x41f260,_0x202318){super(_0x41f260,_0x202318),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',(_0x2fb792,_0x2acf55)=>{_0x2fb792['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x2acf55());});}['_createSubmitButton'](){const _0x5b5c64=new Pt(this['locale']),_0x335e40=this['locale'];return _0x5b5c64['set']({'icon':it,'label':ki(_0x335e40,'Submit'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-form__submit'}),_0x5b5c64['on']('execute',()=>{this['submit']();}),_0x5b5c64['bind']('isEnabled')['to'](this['queryView']['fieldView'],'isEmpty',this,'isEnabled',(_0x5d8826,_0x25827a)=>!_0x5d8826&&_0x25827a),_0x5b5c64;}['_createShowHistoryButton'](){const _0x1ab154=new Pt(this['locale']),_0x5ac98b=this['resultsView'],_0x535b0d=this['locale'];_0x1ab154['set']({'label':ki(_0x535b0d,'History'),'withText':!0x1,'icon':_0x811149,'tooltip':!0x0,'tooltipPosition':'sw','class':'ck-ai-form__toggle-history'}),_0x1ab154['bind']('isOn')['to'](_0x5ac98b,'isVisible'),_0x1ab154['bind']('isEnabled')['to'](this,'isEnabled'),_0x1ab154['on']('execute',()=>{_0x5ac98b['isVisible']=!_0x5ac98b['isVisible'],_0x5ac98b['isVisible']?this['filteredView']['focus']():this['focus']();});const _0x2a8941=()=>{Et['window']['requestAnimationFrame'](()=>{if(wt(this['element'])){const _0x12f24e=new gt(this['queryView']['fieldView']['element']),_0x1e4f5a=_0x12f24e['width'],_0x121f41='rtl'===_0x535b0d['uiLanguageDirection']?'left':'right';_0x12f24e['excludeScrollbarsAndBorders'](),_0x1ab154['element']['style'][_0x121f41]=_0x1e4f5a-_0x12f24e['width']+0x1+'px';}});};return this['queryView']['fieldView']['on']('update',_0x2a8941),this['on']('render',_0x2a8941),_0x1ab154;}['submit'](){const _0x2f74b2=this['queryView']['fieldView']['element']['value'];this['fire']('submit',_0x2f74b2);}['focus'](_0x3572b1){-0x1===_0x3572b1?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}},Gi=class extends zt{['historyGroupView'];['clearHistoryButton'];constructor(_0x5dc426){super(_0x5dc426),this['clearHistoryButton']=this['_createClearHistoryButton'](),this['historyGroupView']=new Qt(),this['historyGroupView']['children']['add'](this['clearHistoryButton'],0x1),this['historyGroupView']['label']=ki(_0x5dc426,'Prompt\x20history'),this['historyGroupView']['items']['delegate']('execute')['to'](this),this['items']['add'](this['historyGroupView']);}['filter'](){let _0x34565d=0x0;for(const _0x8c6016 of this['items'])_0x34565d+=_0x8c6016['items']['length'];return{'resultsCount':_0x34565d,'totalItemsCount':_0x34565d};}['_createClearHistoryButton'](){const _0x468512=this['locale'],_0x945dd8=new Pt(this['locale']);return _0x945dd8['set']({'label':'('+ki(_0x468512,'Clear')+')','withText':!0x0}),_0x945dd8['on']('execute',()=>this['fire']('clearHistory')),_0x945dd8;}},Fi=class extends Xt{constructor(_0x5df78c){super();const _0x10411f=new Lt(),_0xb8b95f=new Pt(this['locale'],_0x10411f);this['children']['add'](_0xb8b95f),_0xb8b95f['set']({'label':_0x5df78c['prompt'],'withText':!0x0}),_0xb8b95f['on']('execute',()=>{this['fire']('execute',{'value':_0x1c7478(_0x5df78c['prompt'])});});}};const Ki='CKEditor/AIFormView/PromptHistory';var Wi=class extends ht{constructor(){super(),this['_loadFromSessionStorage'](),this['on']('add',(_0x257513,_0x1f4e87)=>{const _0x247222=Yi(_0x1f4e87['prompt']);for(const _0x4e5670 of this)if(_0x4e5670!=_0x1f4e87&&Yi(_0x4e5670['prompt'])===_0x247222){this['remove'](_0x4e5670);break;}this['length']>0x14&&this['remove'](this['last']),this['_saveToSessionStorage']();}),this['on']('remove',()=>{this['_saveToSessionStorage']();});}['_loadFromSessionStorage'](){const _0x2769cc=sessionStorage['getItem'](Ki)||'[]';this['addMany'](JSON['parse'](_0x2769cc));}['_saveToSessionStorage'](){sessionStorage['setItem'](Ki,JSON['stringify'](this['map'](_0x2f8051=>_0x2f8051)));}};function Yi(_0x111db9){return _0x111db9['toLowerCase']()['trim']();}var $i=class extends _0x1e8352{['focusTracker'];['keystrokes'];['contentArea'];['toolbar'];['promptView'];['errorView'];['_focusables'];['focusCycler'];['_promptHistory'];constructor(_0x3dce78,_0x1a6d94,_0x544364=''){super(_0x3dce78),this['set']('isEnabled',!0x0),this['set']('isProcessing',!0x1),this['set']('prompt',''),this['set']('value',''),this['set']('isError',!0x1),this['set']('mainAction',Pi['REPLACE']),this['_promptHistory']=new Wi(),this['errorView']=new Ui(_0x3dce78),this['contentArea']=new Mi(_0x3dce78,_0x544364),this['contentArea']['bind']('isProcessing')['to'](this),this['contentArea']['bind']('value')['to'](this),this['toolbar']=this['_createToolbar'](),this['toolbar']['bind']('mainAction')['to'](this),this['promptView']=this['_createPromptView'](),this['focusTracker']=new ut(),this['keystrokes']=new dt(),this['_focusables']=this['createCollection']([this['contentArea'],this['contentArea']['copyButtonView'],this['toolbar'],this['promptView']]),this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['focusCycler']['chain'](this['promptView']['focusCycler']),this['promptView']['queryView']['fieldView']['bind']('value')['to'](this,'prompt');const _0x316dee=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-form',_0x1a6d94],'tabindex':'-1'},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-form-content']},'children':[{'tag':'div','attributes':{'class':[_0x316dee['if']('isError','ck-hidden',_0x273bf4=>!_0x273bf4)]},'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'](_0x167bfc=0x1){-0x1===_0x167bfc?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 _0x53477a=this['locale'],_0x5158d1=new Bi(_0x53477a,{'queryView':{'label':ki(_0x53477a,'Ask\x20AI\x20to\x20edit\x20or\x20generate'),'creator':_0x4650d6,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':ki(_0x53477a,'Empty\x20history'),'secondary':ki(_0x53477a,'Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.')}}},'filteredView':this['_createHistoryView'](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x5158d1['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x366216,_0x229ba8)=>_0x366216&&!_0x229ba8),this['listenTo'](_0x5158d1,'submit',(_0x2ab5a6,_0x5660f5)=>{this['prompt']=_0x5660f5;const _0x35a8b9=_0x9a78d5(_0x5660f5);this['fire']('submitPrompt',_0x35a8b9),_0x5660f5['trim']()&&this['_promptHistory']['add']({'prompt':_0x35a8b9},0x0);},{'priority':'high'}),_0x5158d1;}['_createHistoryView'](){const _0x2daec2=new Gi(this['locale']);return _0x2daec2['historyGroupView']['items']['bindTo'](this['_promptHistory'])['as'](Fi),_0x2daec2['on']('clearHistory',()=>{this['_promptHistory']['clear'](),this['promptView']['search'](''),this['promptView']['focus']();}),_0x2daec2;}['_createToolbar'](){const _0x2e0e6e=new Hi(this['locale']);return _0x2e0e6e['replaceButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x4c38bc,_0x3fbca7,_0x27f057)=>_0x4c38bc&&!_0x3fbca7&&!!_0x27f057),_0x2e0e6e['replaceButton']['delegate']('execute')['to'](this,'replaceContent'),_0x2e0e6e['insertButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',this,'value',(_0x2909af,_0x586428,_0x48d20b)=>_0x2909af&&!_0x586428&&!!_0x48d20b),_0x2e0e6e['insertButton']['delegate']('execute')['to'](this,'insertContentBelow'),_0x2e0e6e['tryAgainButton']['bind']('isEnabled')['to'](this,'isEnabled',this,'isProcessing',(_0x575723,_0x5b04c5)=>_0x575723&&!_0x5b04c5),_0x2e0e6e['tryAgainButton']['delegate']('execute')['to'](this,'tryAgainEvent'),_0x2e0e6e['stopButton']['bind']('isEnabled')['to'](this,'isProcessing'),_0x2e0e6e['stopButton']['delegate']('execute')['to'](this,'stopProcessing'),_0x2e0e6e;}['startProcessing'](){this['value']='',this['isError']=!0x1,this['isProcessing']=!0x0,this['contentArea']['isVisible']=!0x0,this['toolbar']['isVisible']=!0x0,this['contentArea']['focus']();}['finishProcessing'](){const _0x31fabd=this['locale'];this['isProcessing']=!0x1,this['prompt']='',this['promptView']['reset'](),this['value']&&(this['promptView']['queryView']['label']=ki(_0x31fabd,'Ask\x20AI\x20to\x20improve\x20generated\x20text'));}['handleError'](_0x24aaeb){const _0x5e7efb=this['locale'];this['finishProcessing'](),this['isError']=!0x0,this['errorView']['text']=_0x24aaeb||ki(_0x5e7efb,'AI_ERROR_FAILED'),this['value']||(this['contentArea']['isVisible']=!0x1);}};const qi=globalThis['DataTransfer'];var Qi=class extends _0x3f2605{['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[_0xbf70bd,Ri,Oi,Ht];}constructor(_0x315c22){super(_0x315c22),_0x315c22['config']['define']('ai.assistant.disabledElements',['media','rawHtml','tableOfContents']),_0x315c22['config']['define']('ai.assistant.contentAreaCssClass',''),_0x315c22['config']['define']('ai.assistant.useTheme',!0x0),this['_uiCssClasses']='ck-ai-assistant-ui'+(_0x315c22['config']['get']('ai.assistant.useTheme')?'\x20ck-ai-assistant-ui_theme':'');}['init'](){const {editor:_0x32bc47}=this;this['_aiAdapter']=_0x32bc47['plugins']['get'](Oi),this['_dialog']=_0x32bc47['plugins']['get'](Ht),this['_formView']=null,this['_commandDefinitions']=this['_getResolvedCommandsDefinitions']();const _0x48420a=new Ni(_0x32bc47,Array['from'](this['_commandDefinitions']['values']()));_0x32bc47['commands']['add']('showAIAssistant',_0x48420a),_0x32bc47['ui']['componentFactory']['add']('aiCommands',_0x225163=>{const _0x260e4f=_0x312ca1(_0x225163);return _0x260e4f['set']({'class':'ck-ai-commands-dropdown\x20'+this['_uiCssClasses']}),_0x260e4f['buttonView']['set']({'label':ki(_0x225163,'AI\x20Commands'),'icon':_0xadf67a,'tooltip':!0x0}),_0x260e4f['on']('execute',_0x370cd8=>this['_onExecute'](_0x370cd8['source']['id'])),_0x214d8b(_0x260e4f,_0x32bc47['ui']['view']['body'],function(_0x49337b){const _0x575bff=zi(_0x49337b,fi(_0x49337b['config']['get']('ai.assistant.commands'),_0x49337b['locale']))['filter'](_0x42982a=>_0x42982a['commands']['length']);return 0x1===_0x575bff['length']?zi(_0x49337b,_0x575bff[0x0]['commands'])['map'](_0x379110=>({'id':_0x379110['id'],'label':_0x379110['label']})):_0x575bff['map'](_0x422c76=>{const {groupId:_0x804942,groupLabel:_0x4b0df1,commands:_0x3be82a}=_0x422c76,_0x407bc7=zi(_0x49337b,_0x3be82a)['map'](_0x8b9404=>({'id':_0x8b9404['id'],'label':_0x8b9404['label']}));return{'id':_0x804942,'menu':_0x4b0df1||_0x804942,'children':_0x407bc7};});}(_0x32bc47),{'ariaLabel':ki(_0x225163,'AI\x20Commands')}),_0x260e4f['menuView']['menuPanelClass']='ck-ai-commands-dropdown\x20'+this['_uiCssClasses'],_0x48420a['on']('change:enabledCommandsIds',_0x5d4d91),_0x260e4f['menuView']['once']('render',_0x5d4d91),_0x260e4f;function _0x5d4d91(){_0x260e4f['isEnabled']=_0x48420a['enabledCommandsIds']['length']>0x0;for(const _0x50a11f of _0x260e4f['menuView']['buttons'])_0x50a11f['isEnabled']=_0x48420a['enabledCommandsIds']['includes'](_0x50a11f['id']);}}),_0x32bc47['ui']['componentFactory']['add']('menuBar:aiCommands',_0x206595=>{const _0x2938df=new te(_0x206595);_0x2938df['buttonView']['set']({'label':ki(_0x206595,'AI\x20Commands'),'icon':_0xadf67a}),_0x2938df['bind']('isEnabled')['to'](_0x48420a,'enabledCommandsIds',_0x5982d5=>_0x5982d5['length']>0x0);const _0x2ea8cf=fi(_0x32bc47['config']['get']('ai.assistant.commands'),_0x206595);return this['_populateMenuBarMenu'](_0x48420a,_0x2938df,_0x2ea8cf,_0x5be391=>this['_onExecute'](_0x5be391)),_0x2938df;}),_0x32bc47['ui']['componentFactory']['add']('aiAssistant',()=>{const _0x5e5be5=this['_createAIAssistantUIButton'](Pt);return _0x5e5be5['set']({'tooltip':!0x0,'class':'ck-ai-assistant-button\x20'+this['_uiCssClasses']}),_0x5e5be5;}),_0x32bc47['ui']['componentFactory']['add']('menuBar:aiAssistant',()=>{const _0x26eeeb=this['_createAIAssistantUIButton'](jt);return _0x26eeeb['set']({'role':'menuitemcheckbox'}),_0x26eeeb;}),this['licenseKey']=this['editor']['config']['get']('licenseKey');const _0x3dbb4d=this['editor'];this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x446964;for(const _0x42175f in _0x3dbb4d){const _0xddeec2=_0x42175f,_0x95f122=_0x3dbb4d[_0xddeec2];if('aiLicenseKeyValid'==_0x95f122||'aiLicenseKeyInvalid'==_0x95f122||'aiLicenseKeyExpired'==_0x95f122||'aiLicenseKeyDomainLimit'==_0x95f122||'aiLicenseKeyNotAllowed'==_0x95f122||'aiLicenseKeyEvaluationLimit'==_0x95f122||'aiLicenseKeyUsageLimit'==_0x95f122){delete _0x3dbb4d[_0xddeec2],_0x446964=_0x95f122,clearInterval(this['_licenseKeyCheckInterval']),this['_licenseKeyCheckInterval']=void 0x0;break;}}'aiLicenseKeyInvalid'==_0x446964&&_0x3dbb4d['_showLicenseError']('invalid'),'aiLicenseKeyExpired'==_0x446964&&_0x3dbb4d['_showLicenseError']('expired'),'aiLicenseKeyDomainLimit'==_0x446964&&_0x3dbb4d['_showLicenseError']('domainLimit'),'aiLicenseKeyNotAllowed'==_0x446964&&_0x3dbb4d['_showLicenseError']('featureNotAllowed','AIAssistant'),'aiLicenseKeyEvaluationLimit'==_0x446964&&_0x3dbb4d['_showLicenseError']('evaluationLimit'),'aiLicenseKeyUsageLimit'==_0x446964&&_0x3dbb4d['_showLicenseError']('usageLimit');},0x3e8);}['destroy'](){super['destroy'](),this['_licenseKeyCheckInterval']&&clearInterval(this['_licenseKeyCheckInterval']);}['showUI'](_0x17317e='',_0x38d885='',_0x24dce7='custom'){const _0x56ccc3=this['editor'],_0x187ed5=_0x56ccc3['editing']['view'],_0x539143=_0x56ccc3['plugins']['get'](Ri),_0x15b7c1=_0x56ccc3['plugins']['get'](_0xbf70bd);_0x539143['showFakeVisualSelection']();const _0x7e2a54=new qi(),_0x3d9e33=new ClipboardEvent('copy',{'clipboardData':_0x7e2a54}),_0xcf6edd=new _0x3d6f97(_0x7e2a54),_0x233a9d=new _0x4f9ee5(_0x187ed5,_0x3d9e33,{'dataTransfer':_0xcf6edd});_0x15b7c1['_forceMarkersCopy']('comment',()=>{_0x187ed5['document']['fire']('copy',_0x233a9d);}),this['_formView']||(this['_initView'](),this['_aiAssistantController']=new Di(_0x56ccc3,this['_aiAdapter']['textAdapter'],this['_formView']));let _0x2f4d1=_0xcf6edd['getData']('text/html');const _0x2d1048=_0x56ccc3['model']['document']['selection'],_0x383706=Array['from'](_0x2d1048['getRanges']());0x1===_0x383706['length']&&_0x383706[0x0]['isFlat']&&!_0x2d1048['getSelectedElement']()&&''!==_0x2f4d1['replace'](/ /g,'')['trim']()&&(_0x2f4d1='<p>'+_0x2f4d1+'</p>'),this['_aiAssistantController']['updateView']({'actionId':_0x24dce7,'query':_0x17317e,'htmlContent':_0x2f4d1,'label':_0x38d885,'mainActionLabel':Pi[_0x56ccc3['model']['document']['selection']['isCollapsed']?'INSERT':'REPLACE']}),'aiAssistant'!==this['_dialog']['id']?this['_dialog']['show']({'id':'aiAssistant','icon':_0x2c8e44,'title':ki(this['editor']['locale'],'AI\x20Assistant'),'content':this['_formView'],'position':Mt['EDITOR_TOP_SIDE'],'onShow':()=>{this['_formView']['focus']();},'onHide':()=>{this['_aiAssistantController']['reset'](),_0x539143['hideFakeVisualSelection']();}}):this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}['hideUI'](){this['_dialog']['hide']();}['_getResolvedCommandsDefinitions'](){const _0x1c70d4=new Map(),_0x5129ec=fi(this['editor']['config']['get']('ai.assistant.commands'),this['editor']['locale']);for(const _0x362ebb of _0x5129ec)for(const _0x46a298 of _0x362ebb['commands'])_0x1c70d4['set'](_0x46a298['id'],{..._0x46a298,'groupId':_0x362ebb['groupId'],'groupLabel':_0x362ebb['groupLabel']||_0x362ebb['groupId']});return _0x1c70d4;}['_createAIAssistantUIButton'](_0x2903eb){const _0x355eac=this['editor'],_0x606ffe=_0x355eac['commands']['get']('showAIAssistant'),_0x3c213f=new _0x2903eb(_0x355eac['locale']);return _0x3c213f['set']({'label':ki(_0x355eac['locale'],'AI\x20Assistant'),'icon':_0x2c8e44,'isToggleable':!0x0}),_0x3c213f['bind']('isEnabled')['to'](_0x606ffe),_0x3c213f['bind']('isOn')['to'](this['_dialog'],'id',_0xea3b94=>'aiAssistant'===_0xea3b94),this['listenTo'](_0x3c213f,'execute',()=>{_0x3c213f['isOn']?this['hideUI']():_0x606ffe['execute']();}),_0x3c213f;}['_initView'](){const _0x15d188=this['editor']['plugins']['get'](Ri);this['_formView']=new $i(this['editor']['locale'],this['_uiCssClasses'],this['editor']['config']['get']('ai.assistant.contentAreaCssClass')),this['_formView']['on']('change:value',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['_formView']['promptView']['queryView']['fieldView']['on']('update',()=>{this['_dialog']['view']['wasMoved']||this['_dialog']['view']['updatePosition']();}),this['listenTo'](this['_formView'],'replaceContent',()=>{_0x15d188['insertContent'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['listenTo'](this['_formView'],'insertContentBelow',()=>{_0x15d188['insertContentBelow'](this['_aiAssistantController']['currentContext']),this['hideUI']();}),this['_initAriaAiStatusChangeAnnouncements']();}['_initAriaAiStatusChangeAnnouncements'](){const {locale:_0xb45e38,ui:{ariaLiveAnnouncer:_0x20e6cd}}=this['editor'];this['_formView']['contentArea']['on']('change:isProcessing',(_0x2a3d1e,_0x3609ea,_0x12f5a2)=>{const _0x5ac2f1=this['_aiAssistantController']['currentContext'];_0x12f5a2?_0x20e6cd['announce'](ki(_0xb45e38,'AI\x20is\x20writing')):_0x5ac2f1&&_0x20e6cd['announce'](ki(_0xb45e38,'Generated\x20content:\x20%0',_0x5ac2f1),{'politeness':'polite','isUnsafeHTML':!0x0});}),this['_formView']['on']('change:isError',(_0x1696d9,_0x52efef,_0x2b0d51)=>{if(_0x2b0d51){const _0x16291d=this['_formView']['errorView']['text'];_0x20e6cd['announce'](ki(_0xb45e38,'Error\x20during\x20AI\x20content\x20generation:\x20%0',_0x16291d));}});}['_onExecute'](_0x34ee91){const _0x4bee5a=this['_commandDefinitions']['get'](_0x34ee91),_0x2d183c=this['editor'],_0x403cfb=_0x2d183c['model']['document']['selection'],_0x538e31=_0x2d183c['commands']['get']('showAIAssistant'),_0x1fdcdf=_0x2d183c['plugins']['get'](Ri),_0x58ef9e=''+('_ungrouppedCommands'!==_0x4bee5a['groupId']?_0x4bee5a['groupLabel']+':\x20':'')+_0x4bee5a['label'];if(!0x1!==_0x4bee5a['requiresContent']&&_0x403cfb['isCollapsed']){const _0x243335=pt(_0x403cfb['getSelectedBlocks']())||_0x2d183c['model']['schema']['getLimitElement'](_0x403cfb);_0x2d183c['model']['change'](_0x6bf989=>{_0x6bf989['setSelection'](_0x243335,'in');});}_0x1fdcdf['showFakeVisualSelection'](),_0x538e31['execute'](_0x4bee5a['prompt'],_0x58ef9e,'command:'+_0x34ee91);}['_populateMenuBarMenu'](_0x4408bb,_0x5562cc,_0x25d631,_0x157811){const _0x2b9eb7=this['editor'],_0x118232=_0x2b9eb7['locale'],_0x54ce22=new Zt(_0x118232),_0x33148d=zi(_0x2b9eb7,_0x25d631)['filter'](_0x26a1dc=>_0x26a1dc['commands']['length']);0x1===_0x33148d['length']?this['_getMenuBarGroupButtons']({'command':_0x4408bb,'commands':_0x33148d[0x0]['commands'],'parentMenuView':_0x5562cc,'onExecute':_0x157811})['forEach'](_0x4580a4=>_0x54ce22['items']['add'](_0x4580a4)):_0x33148d['forEach'](({groupId:_0x152da8,groupLabel:_0x1bac98,commands:_0x12a6b9})=>{const _0x569820=new Jt(_0x118232,_0x5562cc),_0x16da71=new te(_0x118232),_0x1d79e5=new Zt(_0x118232),_0x1727ae=this['_getMenuBarGroupButtons']({'command':_0x4408bb,'commands':_0x12a6b9,'parentMenuView':_0x16da71,'onExecute':_0x157811});_0x16da71['buttonView']['set']({'label':_0x1bac98||_0x152da8}),_0x16da71['delegate']('execute')['to'](_0x5562cc),_0x1d79e5['items']['addMany'](_0x1727ae),_0x16da71['panelView']['children']['add'](_0x1d79e5),_0x569820['children']['add'](_0x16da71),_0x54ce22['items']['add'](_0x569820);}),_0x5562cc['panelView']['children']['add'](_0x54ce22);}['_getMenuBarGroupButtons']({command:_0x271549,commands:_0x1fea07,parentMenuView:_0x185445,onExecute:_0x537b91}){const _0xaade19=this['editor'],_0x35a0c1=_0xaade19['locale'];return zi(_0xaade19,_0x1fea07)['map'](_0x4cb1c2=>{const _0x3a5e0f=new Jt(_0x35a0c1,_0x185445),_0x20c7a0=new jt(_0x35a0c1);return _0x20c7a0['set']({'label':_0x4cb1c2['label']}),_0x20c7a0['delegate']('execute')['to'](_0x185445),_0x20c7a0['on']('execute',()=>_0x537b91(_0x4cb1c2['id'])),_0x20c7a0['bind']('isEnabled')['to'](_0x271549,'enabledCommandsIds',_0x29900d=>_0x29900d['includes'](_0x4cb1c2['id'])),_0x3a5e0f['children']['add'](_0x20c7a0),_0x3a5e0f;});}};function Xi(_0x1023a1,_0x46ba88){return void 0x0!==_0x1023a1['order']&&void 0x0===_0x46ba88['order']?0x1:void 0x0===_0x1023a1['order']&&void 0x0!==_0x46ba88['order']?-0x1:void 0x0!==_0x1023a1['order']&&void 0x0!==_0x46ba88['order']?_0x1023a1['order']-_0x46ba88['order']:0x0;}function zi(_0xc653c3,_0x1a1d87){_0x1a1d87['sort'](Xi);const _0x41bb21={},_0x42179d=[];for(const _0x5d3786 of _0x1a1d87)if(void 0x0!==_0x5d3786['order']){if(_0x5d3786['order']in _0x41bb21)throw new at('ai-commands-config-order-collision',_0xc653c3,{'conflictingDefinitions':[_0x5d3786,_0x41bb21[_0x5d3786['order']]]});_0x41bb21[_0x5d3786['order']]=_0x5d3786,_0x42179d['splice'](_0x5d3786['order'],0x0,_0x5d3786);}else _0x42179d['push'](_0x5d3786);return _0x42179d;}var ji=class extends _0x3f2605{static get['requires'](){return[Qi,Ri];}static get['pluginName'](){return'AIAssistant';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xf1f0d8){super(_0xf1f0d8);const _0x72323a=_0xf1f0d8['config'],_0x5754af=_0xf1f0d8['locale'];_0x72323a['define']('ai.assistant.preserveComments',!0x0),_0x72323a['define']('ai.assistant.commands',Ji(_0x5754af)),_0x72323a['define']('ai.assistant.extraCommandGroups',[]),_0x72323a['define']('ai.assistant.removeCommands',[]);let _0x475b0e=fi(_0x72323a['get']('ai.assistant.commands'),_0x5754af);const _0x1b8562=_0x72323a['get']('ai.assistant.extraCommandGroups'),_0x19d97c=_0x72323a['get']('ai.assistant.removeCommands');_0x1b8562['forEach'](_0x437eaa=>{const _0x226dd9=_0x475b0e['find'](_0x365e6a=>_0x365e6a['groupId']===_0x437eaa['groupId']);_0x226dd9?_0x226dd9['commands']=_0x226dd9['commands']['concat'](_0x437eaa['commands']):_0x475b0e['push'](_0x437eaa);}),_0x475b0e=_0x475b0e['filter'](_0x20a8f4=>!_0x19d97c['includes'](_0x20a8f4['groupId'])),_0x475b0e['forEach'](_0x5e3aeb=>{_0x5e3aeb['commands']=_0x5e3aeb['commands']['filter'](_0x1fa30a=>!_0x19d97c['includes'](_0x1fa30a['id']));}),_0x72323a['set']('ai.assistant.commands',_0x475b0e);}};function Ji(_0x162822){return[{'groupId':'editOrReview','groupLabel':ki(_0x162822,'Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':ki(_0x162822,'Improve\x20writing'),'prompt':'Fix\x20spelling\x20mistakes,\x20use\x20proper\x20grammar\x20and\x20apply\x20good\x20writing\x20practices.\x20Do\x20not\x20lose\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':ki(_0x162822,'Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':ki(_0x162822,'Make\x20longer'),'prompt':'Improve\x20this\x20content\x20by\x20using\x20descriptive\x20language\x20and\x20inserting\x20more\x20information\x20and\x20more\x20detailed\x20explanations.'},{'id':'simplifyLanguage','label':ki(_0x162822,'Simplify\x20language'),'prompt':'Simplify\x20the\x20writing\x20style\x20of\x20this\x20content\x20and\x20reduce\x20the\x20complexity,\x20so\x20that\x20the\x20content\x20is\x20easy\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':ki(_0x162822,'Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':ki(_0x162822,'Summarize'),'prompt':'Summarize\x20this\x20content\x20into\x20one\x20paragraph\x20of\x20text.\x20Include\x20only\x20the\x20key\x20ideas\x20and\x20conclusions.\x20Keep\x20it\x20short.\x20Do\x20not\x20keep\x20original\x20text\x20formatting.'},{'id':'continue','label':ki(_0x162822,'Continue'),'prompt':'Start\x20with\x20the\x20provided\x20content\x20and\x20write\x20at\x20the\x20end\x20of\x20it\x20continuing\x20this\x20topic.\x20Keep\x20the\x20added\x20part\x20short.'}]},{'groupId':'changeTone','groupLabel':ki(_0x162822,'Change\x20tone'),'commands':[{'id':'professional','label':ki(_0x162822,'Professional'),'prompt':'Improve\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':ki(_0x162822,'Casual'),'prompt':'Improve\x20using\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':ki(_0x162822,'Direct'),'prompt':'Improve\x20using\x20direct\x20language,\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':ki(_0x162822,'Confident'),'prompt':'Improve\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':ki(_0x162822,'Friendly'),'prompt':'Improve\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':ki(_0x162822,'Change\x20style'),'commands':[{'id':'business','label':ki(_0x162822,'Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':ki(_0x162822,'Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':ki(_0x162822,'Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'poetic','label':ki(_0x162822,'Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]},{'groupId':'translate','groupLabel':ki(_0x162822,'Translate'),'commands':[{'id':'translateEnglish','label':ki(_0x162822,'English'),'prompt':'Translate\x20the\x20content\x20to\x20English\x20language.'},{'id':'translateSpanish','label':ki(_0x162822,'Spanish'),'prompt':'Translate\x20the\x20content\x20to\x20Spanish\x20language.'},{'id':'translatePortuguese','label':ki(_0x162822,'Portuguese'),'prompt':'Translate\x20the\x20content\x20to\x20Portuguese\x20language.'},{'id':'translateGerman','label':ki(_0x162822,'German'),'prompt':'Translate\x20the\x20content\x20to\x20German\x20language.'},{'id':'translateFrench','label':ki(_0x162822,'French'),'prompt':'Translate\x20the\x20content\x20to\x20French\x20language.'},{'id':'translateChinese','label':ki(_0x162822,'Simplified\x20Chinese'),'prompt':'Translate\x20the\x20content\x20to\x20Simplified\x20Chinese\x20language.'},{'id':'translateHindi','label':ki(_0x162822,'Hindi'),'prompt':'Translate\x20the\x20content\x20to\x20Hindi\x20language.'},{'id':'translateArabic','label':ki(_0x162822,'Arabic'),'prompt':'Translate\x20the\x20content\x20to\x20Arabic\x20language.'}]}];}var Zi=class extends _0x3f2605{['abortController'];static get['requires'](){return[Oi];}constructor(_0x13c0e7){super(_0x13c0e7),this['abortController']=new AbortController();}['init'](){this['editor']['plugins']['get'](Oi)['textAdapter']=this;}['abort'](){this['abortController']['signal']['aborted']||(this['abortController']['abort'](),this['abortController']=new AbortController());}async['makeRequest'](_0x1e7e4c){return this['sendRequest'](_0x1e7e4c)['catch'](_0x59598c=>{if(_0x59598c instanceof vi)return Promise['reject'](_0x59598c);if('AbortError'==_0x59598c['name'])return Promise['resolve']();throw console['error'](_0x59598c),new at('aitextadapter-send-request-failed',null);});}async['_prepareRequestHeaders'](_0x257a62,_0x1a6a60){const _0xf20497=this['editor']['locale'],_0x98fac9={'Content-Type':'application/json'};if('object'==typeof _0x257a62)Object['assign'](_0x98fac9,_0x257a62);else{if(_0x257a62)try{const _0xdc1df8=await _0x257a62(_0x1a6a60);Object['assign'](_0x98fac9,_0xdc1df8);}catch{return Promise['reject'](new vi(ki(_0xf20497,'AI_ERROR_GET_HEADERS')));}}return _0x98fac9;}async['_prepareRequestParameters'](_0x157866,_0x33f870){const _0x15846e=this['editor']['locale'];if('object'==typeof _0x157866)return _0x157866;try{return await _0x157866(_0x33f870);}catch{return Promise['reject'](new vi(ki(_0x15846e,'AI_ERROR_GET_PARAMETERS')));}}},ts=class extends Zi{['_apiUrl'];['_requestHeaders'];['_requestParameters'];static get['pluginName'](){return'OpenAITextAdapter';}constructor(_0xaf9ef3){super(_0xaf9ef3),_0xaf9ef3['config']['define']('ai.assistant.adapter.openAI.apiUrl','https://api.openai.com/v1/chat/completions'),_0xaf9ef3['config']['get']('ai.assistant.adapter.openAI.requestParameters')||_0xaf9ef3['config']['define']('ai.assistant.adapter.openAI.requestParameters',{'model':'gpt-4o','temperature':0x1,'top_p':0x1,'stream':!0x0}),this['_apiUrl']=_0xaf9ef3['config']['get']('ai.assistant.adapter.openAI.apiUrl'),this['_requestHeaders']=_0xaf9ef3['config']['get']('ai.assistant.adapter.openAI.requestHeaders')||{},this['_requestParameters']=_0xaf9ef3['config']['get']('ai.assistant.adapter.openAI.requestParameters');}async['sendRequest']({query:_0x4aaec7,context:_0x631a36,onData:_0x41e170,actionId:_0x5ccc08}){const _0x358090=this['editor']['locale'],_0x541e14=await this['prepareMessages'](_0x4aaec7,_0x631a36,_0x5ccc08),_0x329d46=await this['_prepareRequestHeaders'](this['_requestHeaders'],_0x5ccc08),_0x1f5dd5=await this['_prepareRequestParameters'](this['_requestParameters'],_0x5ccc08),_0x409575={'messages':_0x541e14,..._0x1f5dd5},_0x529015={'method':'POST','headers':_0x329d46,'body':JSON['stringify'](_0x409575),'signal':this['abortController']['signal']},_0x449cd8=await fetch(this['_apiUrl'],_0x529015);if(_0x449cd8['ok'])return _0x1f5dd5['stream']?await this['_readStreamableResponse'](_0x449cd8,_0x41e170):await this['_readStaticResponse'](_0x449cd8,_0x41e170),Promise['resolve']();{const _0x7b78b3=await _0x449cd8['text']();return _0x7b78b3['includes']('context_length_exceeded')?Promise['reject'](new vi(ki(_0x358090,'AI_ERROR_CONTEXT_LENGTH'))):_0x7b78b3['includes']('Moderation')?Promise['reject'](new vi(ki(_0x358090,'AI_ERROR_MODERATION'))):Promise['reject'](new Error(_0x7b78b3));}}async['prepareMessages'](_0x3a9713,_0x296725,_0x2befb2){let _0x3e90dc,_0xade6cb;return _0x296725?(_0x3e90dc='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.',_0xade6cb='Instruction:\x0a'+_0x3a9713+'\x0aYou\x20must\x20keep\x20the\x20text\x20formatting.\x0a\x0aContent:\x0a'+_0x296725):(_0x3e90dc='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.',_0xade6cb=_0x3a9713),[{'role':'system','content':_0x3e90dc},{'role':'user','content':_0xade6cb}];}async['_readStreamableResponse'](_0x1a23fd,_0x402a63){const _0x4a1b3a=_0x1a23fd['body']['getReader'](),_0x2fe097=new TextDecoder();let _0x49da85='',_0x1a85fc='',_0x360897='',_0x43ea3e=!0x1;for(;!_0x43ea3e;){const {done:_0x2b75b6,value:_0x19d958}=await _0x4a1b3a['read'](),_0x145e8a=_0x49da85+_0x2fe097['decode'](_0x19d958);let _0x2fbaa4='';_0x43ea3e=_0x2b75b6;try{_0x2fbaa4=this['_cleanUpData'](_0x145e8a),_0x49da85='';}catch{_0x49da85=_0x145e8a;continue;}_0x1a85fc+=_0x2fbaa4,!_0x43ea3e&&this['_isBufferIncomplete'](_0x1a85fc)||_0x1a85fc&&(_0x360897+=_0x1a85fc,_0x1a85fc='',_0x402a63(_0x360897));}return Promise['resolve']();}async['_readStaticResponse'](_0x3f911d,_0x353777){return _0x353777((await _0x3f911d['json']())['choices'][0x0]['message']['content']),Promise['resolve']();}['_isBufferIncomplete'](_0x533a24){const _0x154398=_0x533a24['split']('<')['length']!==_0x533a24['split']('>')['length'],_0x6866f7=_0x533a24['length']<0x1e;return _0x154398&&_0x6866f7;}['_cleanUpData'](_0x2e90ab){return _0x2e90ab['split'](/\n(?![^{]*\})/g)['map'](_0x2d01a3=>_0x2d01a3['replace']('data:\x20',''))['filter'](_0x4ab0fb=>_0x4ab0fb&&_0x4ab0fb['length']>0x0&&'[DONE]'!==_0x4ab0fb)['map'](_0x4ecc79=>{const {choices:_0x51aecd}=JSON['parse'](_0x4ecc79);if(_0x51aecd[0x0]?.['delta']?.['content'])return _0x51aecd[0x0]['delta']['content'];})['filter'](_0x490ae2=>_0x490ae2)['join']('');}},es=class extends Zi{static get['pluginName'](){return'AWSTextAdapter';}['init'](){super['init'](),ft('ai-aws-adapter-not-supported');}async['sendRequest'](_0x5b3e99){throw Ct('ai-aws-adapter-not-supported'),new vi(ki(this['editor']['locale'],'AI_ERROR_AWS_NOT_SUPPORTED'));}},is=class extends Pt{constructor(_0x311f6f,_0x20bbe6={}){super(_0x311f6f),this['isToggleable']=!0x0,this['set']('side',_0x20bbe6['side']||'top');const _0x4e63cc=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-tab-button',...Rt(_0x20bbe6['class']||[]),_0x4e63cc['to']('side',_0x402559=>'ck-tab-button_'+_0x402559),_0x4e63cc['to']('class')]}});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ss=class extends _0x1e8352{['children'];constructor(_0x6480b7,_0x248b11={}){super(_0x6480b7);const _0x6d836f=this['bindTemplate'];this['set']('isVisible',!0x1),this['set']('class',''),this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-tab-panel',...Rt(_0x248b11['class']||[]),_0x6d836f['to']('class'),_0x6d836f['if']('isVisible','ck-hidden',_0x1c2357=>!_0x1c2357)]},'children':this['children']});}['show'](){this['set']('isVisible',!0x0);}['hide'](){this['set']('isVisible',!0x1);}},ns=class extends _0x1e8352{['buttonViews']=this['createCollection']();['panelViews']=this['createCollection']();['_tabs']=new Map();constructor(_0x68f47e,_0x385795={}){super(_0x68f47e),this['set']('class',void 0x0),this['set']('activeTab',null),this['set']('side',_0x385795['side']||'top'),this['set']('isMaximized',!0x1),this['set']('collapsible',_0x385795['collapsible']||!0x1),this['set']('isCollapsed',!0x1),this['set']('_isMaximizedActive',!0x1),this['bind']('_isMaximizedActive')['to'](this,'isMaximized',this,'isCollapsed',(_0xdafc5d,_0x5df4b1)=>_0xdafc5d&&!_0x5df4b1);const _0x48e1e0=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset','ck-tabs',...Rt(_0x385795['class']||[]),_0x48e1e0['to']('side',_0x578197=>'ck-tabs_'+_0x578197),_0x48e1e0['to']('class'),_0x48e1e0['if']('_isMaximizedActive','ck-ai-tabs_maximized'),_0x48e1e0['if']('isCollapsed','ck-ai-tabs_collapsed')],'tabindex':'0'},'children':[{'tag':'div','attributes':{'class':['ck','ck-tabs__buttons-container',_0x48e1e0['to']('side',_0xf92be8=>'ck-tabs__buttons-container_'+_0xf92be8)]},'children':this['buttonViews']},{'tag':'div','attributes':{'class':['ck','ck-tabs__panels-container',_0x48e1e0['to']('side',_0x4de016=>'ck-tabs__panels-container_'+_0x4de016)]},'children':this['panelViews']},...Rt(_0x385795['children']||[])]});}['getTabIds'](){return[...this['_tabs']['keys']()];}['getTab'](_0x4246b9){const _0x3df236=this['_tabs']['get'](_0x4246b9);return _0x3df236||null;}['addTab'](_0x1945e7){const _0xfe44f6=this['_setupButton']({'id':_0x1945e7['id'],'label':_0x1945e7['buttonLabel'],'icon':_0x1945e7['buttonIcon'],'order':_0x1945e7['order']}),_0x178370=new ss(this['locale']);return _0x178370['render'](),_0x1945e7['content']&&_0x178370['children']['add'](_0x1945e7['content']),this['panelViews']['add'](_0x178370),this['_tabs']['set'](_0x1945e7['id'],{'button':_0xfe44f6,'panel':_0x178370,'order':void 0x0!==_0x1945e7['order']?_0x1945e7['order']:null}),this['fire']('addTab:'+_0x1945e7['id'],{'id':_0x1945e7['id'],'button':_0xfe44f6,'panel':_0x178370}),null===this['activeTab']?this['activateTab'](_0x1945e7['id']):this['_hidePanel'](_0x1945e7['id']),{'button':_0xfe44f6,'panel':_0x178370};}['activateTab'](_0x12f43a){if(null!==_0x12f43a&&!this['getTab'](_0x12f43a))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x12f43a});if(this['isCollapsed']=!0x1,this['activeTab']===_0x12f43a)return;const _0x4cadfa=this['activeTab'];this['activeTab']&&this['_hidePanel'](this['activeTab']),this['activeTab']=_0x12f43a,_0x12f43a&&this['_showPanel'](_0x12f43a),this['fire']('activateTab:'+_0x12f43a,{'newTab':_0x12f43a,'oldTab':_0x4cadfa});}['toggleTabPanel'](_0x54908a){this['activeTab']===_0x54908a?this['collapsible']&&(this['isCollapsed']=!this['isCollapsed']):this['activateTab'](_0x54908a);}['showTab'](_0x2831ef){if(!this['getTab'](_0x2831ef))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x2831ef});this['_showPanel'](_0x2831ef),this['_showButton'](_0x2831ef),this['fire']('show:'+_0x2831ef,_0x2831ef);}['hideTab'](_0x5f46ba){if(!this['getTab'](_0x5f46ba))throw new at('ui-tabsview-tab-not-found',{'tabs':this,'tabId':_0x5f46ba});const _0x515cc9=this['activeTab'];this['_hidePanel'](_0x5f46ba),this['_hideButton'](_0x5f46ba);const _0xd2cab0=this['getTabIds']();_0x515cc9===_0x5f46ba&&_0xd2cab0['length']>0x1&&this['activateTab'](_0xd2cab0['find'](_0x570fe4=>_0x570fe4!==_0x5f46ba)),this['fire']('hide:'+_0x5f46ba,_0x5f46ba);}['_getPanel'](_0x44725e){const _0xe481d0=this['_tabs']['get'](_0x44725e);return _0xe481d0?_0xe481d0['panel']:null;}['_showPanel'](_0x12e83b){null!==this['activeTab']&&this['activeTab']!==_0x12e83b||this['_getPanel'](_0x12e83b)['show']();}['_hidePanel'](_0x28d04c){const _0x4154c6=this['_getPanel'](_0x28d04c);_0x4154c6['isVisible']&&(this['activeTab']===_0x28d04c&&(this['activeTab']=null),_0x4154c6['hide']());}['_getButton'](_0x58c58a){const _0x122da8=this['_tabs']['get'](_0x58c58a);return _0x122da8?_0x122da8['button']:null;}['_showButton'](_0x3a949a){this['_getButton'](_0x3a949a)['show']();}['_hideButton'](_0x5ca291){this['_getButton'](_0x5ca291)['hide']();}['_setupButton'](_0x5a98da){const _0x72e424=new is(this['locale'],{'side':this['side']}),_0x3b5c65=this['buttonViews'];if(_0x72e424['set']({'label':_0x5a98da['label'],'icon':_0x5a98da['icon'],'tooltip':!0x0,'withText':!0x0}),_0x72e424['bind']('isOn')['to'](this,'activeTab',this,'isCollapsed',(_0x4480fa,_0x1142ec)=>_0x4480fa===_0x5a98da['id']&&!_0x1142ec),_0x72e424['bind']('side')['to'](this,'side'),_0x5a98da['order']){const _0x39b783=[...this['_tabs']]['reduce']((_0x45944c,_0x3891e2)=>{const _0x57b1f2=_0x3891e2[0x0],{order:_0x1a5bdc}=_0x3891e2[0x1];return!_0x1a5bdc||_0x1a5bdc>_0x5a98da['order']?_0x45944c:_0x1a5bdc>=_0x45944c['order']?{'id':_0x57b1f2,'order':_0x1a5bdc}:_0x45944c;},{'id':'','order':0x0}),_0xfa87a6=_0x3b5c65['getIndex'](this['_getButton'](_0x39b783['id']));_0x3b5c65['add'](_0x72e424,_0xfa87a6+0x1);}else _0x3b5c65['add'](_0x72e424);return _0x72e424['on']('execute',()=>{this['toggleTabPanel'](_0x5a98da['id']);}),_0x72e424;}};const rs=['overlay','sidebar','custom'],os=['left','right'];var as=class extends ns{constructor(_0x59a353,_0x527a6d={}){super(_0x59a353,_0x527a6d),this['set']('type',_0x527a6d['type']||'sidebar'),this['set']('side',_0x527a6d['side']||'right'),this['set']('isVisible',_0x527a6d['visibleByDefault']??!0x0);const _0x58fe1=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':['ck-ai-tabs',_0x58fe1['if']('type','ck-ai-tabs__overlay',_0xf963a1=>'overlay'===_0xf963a1),_0x58fe1['if']('type','ck-ai-tabs__sidebar',_0x5b020d=>'sidebar'===_0x5b020d),_0x58fe1['if']('isVisible','ck-hidden',_0xc94279=>!_0xc94279)]}}),this['buttonViews']['on']('add',(_0x584614,_0x3f3e5)=>{_0x3f3e5['set']('withText',!0x1);});}},hs=class extends _0x2d0760{['view'];['container']=null;['showResizeButton']=!0x0;static get['pluginName'](){return'AITabs';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x277bea){if(super(_0x277bea),!this['context']['config']['get']('ai.container'))throw new at('ai-tabs-configuration-not-found');this['context']['config']['define']('ai.container.visibleByDefault',!0x0),this['context']['config']['define']('ai.container.collapsible',!0x1);const _0x547104=this['context']['config']['get']('ai.container');if(this['set']('side','right'),void 0x0!==_0x547104['showResizeButton']&&(this['showResizeButton']=_0x547104['showResizeButton']),'sidebar'!==_0x547104['type']&&'overlay'!==_0x547104['type']||_0x547104['side']&&(this['side']=_0x547104['side']),'sidebar'===_0x547104['type']){if(this['container']=_0x547104['element'],this['set']('type','sidebar'),!this['container'])throw new at('ai-tabs-sidebar-container-element-not-found');}else'overlay'===_0x547104['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':_0x547104['visibleByDefault'],'collapsible':_0x547104['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 _0x1a88b7&&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'](_0x420286){if(_0x420286&&this['type']!==_0x420286){if(!rs['includes'](_0x420286))throw new at('ai-tabs-unsupported-ui-type');this['type']=_0x420286;}}['switchSide'](_0x5d41fc){if(_0x5d41fc&&this['side']!==_0x5d41fc){if(!os['includes'](_0x5d41fc))throw new at('ai-tabs-unsupported-ui-side');this['side']=_0x5d41fc;}}['destroy'](){super['destroy'](),this['view']['destroy'](),this['view']['element']&&this['view']['element']['remove']();}},cs=class extends _0x2d0760{['_apiUrl'];get['_apiUrlV11'](){return this['_apiUrl']['replace'](/\/v1$/,'/v1.1');}['_token'];['_decoder'];['_responseCache'];static get['requires'](){return[_0x433de6];}static get['pluginName'](){return'AIConnector';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x32abdd){if(super(_0x32abdd),this['context']['config']['define']('ai.serviceUrl','https://ai.cke-cs.com/v1'),this['_apiUrl']=this['context']['config']['get']('ai.serviceUrl')['replace'](/\/+$/,''),!this['_apiUrl']['endsWith']('/v1'))throw new at('ai-service-url-invalid-version',this,{'serviceUrl':this['_apiUrl']});this['_token']=null,this['_decoder']=new TextDecoder(),this['_responseCache']=new Map();}['init'](){const _0x489ac4=this['context']['plugins']['get'](_0x433de6);if(!_0x489ac4['token'])throw new at('ai-missing-token',this);this['_token']=_0x489ac4['token'];}['startConversation'](_0x20545f,_0x3801a0){const _0x352c63=this['_sendApiRequest']('/conversations','POST',{'id':_0x20545f,'group':_0x3801a0});return{'getConversation':async()=>(await _0x352c63['request'])['json'](),'abortController':_0x352c63['abortController']};}['queryAssistant']({message:_0x4d7861,conversationId:_0x13f52b,parts:_0xfafee,capabilities:_0x35faf0,model:_0xca2de,attributes:_0x1478f9}){const _0x74afc9={'prompt':_0x4d7861,'content':_0xfafee,'model':_0xca2de,..._0x35faf0&&{'capabilities':_0x35faf0},..._0x1478f9&&{'attributes':_0x1478f9}},_0x422dc4=this['_sendApiRequest']('/conversations/'+_0x13f52b+'/messages','POST',_0x74afc9,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x2eb5aa=(await _0x422dc4['request'])['body'];return this['_getStreamReader'](_0x2eb5aa);},'abortController':_0x422dc4['abortController']};}['executeCustomAction']({content:_0x17eb51,message:_0x806d10,model:_0x502ff6,outputFormat:_0x534771}){const _0x234fe1={'content':[{'type':'text','content':_0x17eb51}],'prompt':_0x806d10,'model':_0x502ff6,'outputFormat':_0x534771},_0xf09049=this['_sendApiRequest']('/actions/custom/calls','POST',_0x234fe1);return{'getStream':async()=>{const _0x3b1238=(await _0xf09049['request'])['body'];return this['_getStreamReader'](_0x3b1238);},'abortController':_0xf09049['abortController']};}['executeAction']({actionName:_0x3b2657,content:_0x131f4c,args:_0xefa341}){const _0x3afd36={'content':[{'type':'text','content':_0x131f4c}],'args':_0xefa341},_0x3af2f7=this['_sendApiRequest']('/actions/system/'+_0x3b2657+'/calls','POST',_0x3afd36);return{'getStream':async()=>{const _0x20231b=(await _0x3af2f7['request'])['body'];return this['_getStreamReader'](_0x20231b);},'abortController':_0x3af2f7['abortController']};}['uploadFile'](_0xe7f2e,_0x4ecc30,_0x25a511){const _0xf67ef3=new FormData();_0xf67ef3['append']('file',_0x4ecc30,_0x4ecc30['name']),_0x25a511&&_0xf67ef3['append']('attributes',JSON['stringify'](_0x25a511));const _0x526969=this['_sendApiRequest']('/conversations/'+_0xe7f2e+'/files','POST',_0xf67ef3);return{'getId':async()=>(await _0x526969['request'])['json'](),'abortController':_0x526969['abortController']};}['uploadDocuments'](_0x547686,_0x4b8399){const _0x4a72f9={'documents':_0x4b8399['map'](_0x816c13=>({'content':_0x816c13['content'],'attributes':{'version':_0x816c13['version'],'sessionId':_0x816c13['sessionId'],'channelId':_0x816c13['channelId'],'rootName':_0x816c13['rootName'],'selections':_0x816c13['selections']},...void 0x0!==_0x816c13['name']?{'name':_0x816c13['name']}:{},...void 0x0!==_0x816c13['description']?{'description':_0x816c13['description']}:{}}))},_0x2990eb=this['_sendApiRequest']('/conversations/'+_0x547686+'/documents/batch','POST',_0x4a72f9);return{'getIds':async()=>(await _0x2990eb['request'])['json'](),'abortController':_0x2990eb['abortController']};}['fetchDocuments'](_0x1b288d,_0x22a96a){const _0x518015=new URLSearchParams();_0x518015['append']('documentIds',_0x22a96a['join'](','));const _0x391b08=this['_sendApiRequest']('/conversations/'+_0x1b288d+'/documents/batch?'+_0x518015['toString'](),'GET');return{'getDocuments':async()=>(await _0x391b08['request'])['json'](),'abortController':_0x391b08['abortController']};}['fetchConversations'](_0xd21373,_0xe37ea1={}){const _0x75cccb=new URLSearchParams();_0x75cccb['append']('group',_0xd21373),_0x75cccb['append']('excludeEmpty',!0x1!==_0xe37ea1['excludeEmpty']?'true':'false'),_0x75cccb['append']('limit',_0xe37ea1['limit']?_0xe37ea1['limit']['toString']():'100'),_0x75cccb['append']('sortBy',_0xe37ea1['sortBy']?_0xe37ea1['sortBy']:'createdAt'),_0x75cccb['append']('order',_0xe37ea1['order']?_0xe37ea1['order']:'desc');const _0xe33d5a=this['_sendApiRequest']('/conversations?'+_0x75cccb['toString'](),'GET');return{'getConversations':async()=>(await(await _0xe33d5a['request'])['json']())['items'],'abortController':_0xe33d5a['abortController']};}['deleteConversation'](_0x437e4a){const _0x4eb436=this['_sendApiRequest']('/conversations/'+_0x437e4a,'DELETE');return{'execute':async()=>{await _0x4eb436['request'];},'abortController':_0x4eb436['abortController']};}['updateConversation'](_0x4a4451,_0x22359d){const _0x315d16=this['_sendApiRequest']('/conversations/'+_0x4a4451,'PATCH',_0x22359d);return{'getResult':async()=>(await _0x315d16['request'],_0x22359d),'abortController':_0x315d16['abortController']};}['fetchConversation'](_0x1e8e06){const _0x14e80c=this['_sendApiRequest']('/conversations/'+_0x1e8e06,'GET');return{'getConversation':async()=>(await _0x14e80c['request'])['json'](),'abortController':_0x14e80c['abortController']};}['fetchConversationMessages'](_0x43a105){const _0x135ff0=this['_sendApiRequest']('/conversations/'+_0x43a105+'/messages','GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getMessages':async()=>(await(await _0x135ff0['request'])['json']())['items'],'abortController':_0x135ff0['abortController']};}['uploadUrl'](_0x2b92a3,_0x17ada9,_0x45bdbc){const _0x2ff4aa=this['_sendApiRequest']('/conversations/'+_0x2b92a3+'/web-resources','POST',{'url':_0x17ada9,'attributes':_0x45bdbc});return{'getId':async()=>(await _0x2ff4aa['request'])['json'](),'abortController':_0x2ff4aa['abortController']};}['getModels'](_0x3b0dc6='en'){const _0x45c789=new URLSearchParams();_0x45c789['append']('language',_0x3b0dc6);const _0x5a822b='/models/1?'+_0x45c789['toString'](),_0x2aef99=this['_sendApiRequest'](_0x5a822b,'GET',void 0x0,{'useCache':!0x0});return{'list':async()=>await(await _0x2aef99['request'])['json'](),'abortController':_0x2aef99['abortController']};}['deleteFile'](_0x50ee4a,_0x18a43d){const _0x168180=this['_sendApiRequest']('/conversations/'+_0x50ee4a+'/files/'+_0x18a43d,'DELETE');return{'execute':async()=>{await _0x168180['request'];},'abortController':_0x168180['abortController']};}['deleteDocument'](_0x49d531,_0x3ad488){const _0xe3720d=this['_sendApiRequest']('/conversations/'+_0x49d531+'/documents/'+_0x3ad488,'DELETE');return{'execute':async()=>{await _0xe3720d['request'];},'abortController':_0xe3720d['abortController']};}['deleteWebResource'](_0x400626,_0x11dc4b){const _0x5e27d0=this['_sendApiRequest']('/conversations/'+_0x400626+'/web-resources/'+_0x11dc4b,'DELETE');return{'execute':async()=>{await _0x5e27d0['request'];},'abortController':_0x5e27d0['abortController']};}['cancelStream'](_0x175d9b,_0x22b531){const _0xf2b84d=this['_sendApiRequest']('/conversations/'+_0x175d9b+'/messages/'+_0x22b531+'/stream','DELETE',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'execute':async()=>{await _0xf2b84d['request'];},'abortController':_0xf2b84d['abortController']};}['resumeStream'](_0x3ea3aa,_0x26ecdd,_0x564956='0-0'){const _0x4f0cc6=new URLSearchParams({'lastEventId':_0x564956}),_0x283077=this['_sendApiRequest']('/conversations/'+_0x3ea3aa+'/messages/'+_0x26ecdd+'/stream?'+_0x4f0cc6['toString'](),'GET',void 0x0,{'apiUrl':this['_apiUrlV11']});return{'getStream':async()=>{const _0x473038=await _0x283077['request'];return this['_getStreamReader'](_0x473038['body']);},'abortController':_0x283077['abortController']};}['callSystemReview']({reviewName:_0x3d531e,content:_0x5a0c85,args:_0x27d98e}){const _0x19983a=this['_sendApiRequest']('/reviews/system/'+_0x3d531e+'/calls','POST',{'content':[{'type':'text','content':_0x5a0c85}],'args':_0x27d98e});return{'getStream':async()=>{const _0x16ef67=(await _0x19983a['request'])['body'];return this['_getStreamReader'](_0x16ef67);},'abortController':_0x19983a['abortController']};}['processDocument']({document:_0x1ff371,prompt:_0x2fcbb7,model:_0x47a575}){const _0x2ac148=this['_sendApiRequest']('/documents/process','POST',{'document':_0x1ff371,'prompt':_0x2fcbb7,'model':_0x47a575});return{'getResult':async()=>(await _0x2ac148['request'])['json'](),'abortController':_0x2ac148['abortController']};}['callCustomReview']({content:_0x2b20be,prompt:_0x109981,model:_0xb0dd5e}){const _0x2b13d4=this['_sendApiRequest']('/reviews/custom/calls','POST',{'content':[{'type':'text','content':_0x2b20be}],'prompt':_0x109981,'model':_0xb0dd5e});return{'getStream':async()=>{const _0x3db22e=(await _0x2b13d4['request'])['body'];return this['_getStreamReader'](_0x3db22e);},'abortController':_0x2b13d4['abortController']};}['upsertAIChatRating'](_0x3bd46f,_0x51b4b7,_0x44fd81){const _0x34742d=this['_sendApiRequest']('/conversations/'+_0x3bd46f+'/messages/'+_0x51b4b7+'/ratings','PUT',{'positiveCount':_0x44fd81['positiveCount'],'totalCount':_0x44fd81['totalCount'],'modificationId':_0x44fd81['modificationId']});return{'execute':async()=>{await _0x34742d['request'];},'abortController':_0x34742d['abortController']};}['upsertAIActionRating'](_0x4d5910,_0x35d475,_0x35da17){const _0x4437db=this['_sendApiRequest']('/actions/system/'+_0x4d5910+'/calls/'+_0x35d475+'/ratings','PUT',{'positiveCount':_0x35da17['positiveCount'],'totalCount':_0x35da17['totalCount']});return{'execute':async()=>{await _0x4437db['request'];},'abortController':_0x4437db['abortController']};}['upsertCustomAIActionRating'](_0x7f6c67,_0x17dc4c){const _0x22f25b=this['_sendApiRequest']('/actions/custom/calls/'+_0x7f6c67+'/ratings','PUT',{'positiveCount':_0x17dc4c['positiveCount'],'totalCount':_0x17dc4c['totalCount']});return{'execute':async()=>{await _0x22f25b['request'];},'abortController':_0x22f25b['abortController']};}['upsertAIReviewRating'](_0x3fe24b,_0x2a7732,_0x525120,_0x187f2a){const _0x305d52=this['_sendApiRequest']('/reviews/system/'+_0x3fe24b+'/calls/'+_0x2a7732+'/ratings','PUT',{'positiveCount':_0x525120['positiveCount'],'totalCount':_0x525120['totalCount'],'dataId':_0x187f2a});return{'execute':async()=>{await _0x305d52['request'];},'abortController':_0x305d52['abortController']};}['upsertCustomAIReviewRating'](_0x386f82,_0x2b06ad,_0x2a1d7a){const _0x312f54=this['_sendApiRequest']('/reviews/custom/calls/'+_0x386f82+'/ratings','PUT',{'positiveCount':_0x2b06ad['positiveCount'],'totalCount':_0x2b06ad['totalCount'],'dataId':_0x2a1d7a});return{'execute':async()=>{await _0x312f54['request'];},'abortController':_0x312f54['abortController']};}['_sendApiRequest'](_0x4e3421,_0x353faa,_0x4897b7,_0x108ac7={}){const {useCache:_0x5d8c29=!0x1,apiUrl:_0x134cad=this['_apiUrl']}=_0x108ac7,_0x47e93f=new AbortController(),_0x1b0908=_0x5d8c29?_0x353faa+':'+_0x4e3421:null;if(_0x1b0908){const _0x2ec56a=this['_responseCache']['get'](_0x1b0908);if(_0x2ec56a)return{'request':_0x2ec56a['then'](_0x243ac8=>_0x243ac8['clone']()),'abortController':_0x47e93f};}const _0x404c20=_0x4897b7 instanceof FormData,_0x11138c={'Authorization':'Bearer\x20'+this['_token']?.['value'],'X-Editor-Version':vt};_0x4897b7&&!_0x404c20&&(_0x11138c['Content-Type']='application/json');const _0x54d56a={'method':_0x353faa,'headers':_0x11138c,'signal':_0x47e93f['signal']};_0x4897b7&&(_0x54d56a['body']=_0x404c20?_0x4897b7:JSON['stringify'](_0x4897b7));const _0x3d84dc=fetch(''+_0x134cad+_0x4e3421,_0x54d56a)['catch'](_0x2ccac1=>{_0x1b0908&&this['_responseCache']['delete'](_0x1b0908),this['_handleError'](_0x2ccac1);})['then'](_0xd321f4=>_0xd321f4['ok']?_0xd321f4:_0xd321f4['json']()['then'](_0x196b5b=>{throw _0x1b0908&&this['_responseCache']['delete'](_0x1b0908),{'url':_0x134cad,'path':_0x4e3421,'method':_0x353faa,'body':_0x4897b7,'status':(_0xd321f4||{})['status'],'statusText':(_0xd321f4||{})['statusText'],'code':_0x196b5b['code'],'message':_0x196b5b['message'],'traceId':_0x196b5b['traceId']};}));return _0x1b0908&&this['_responseCache']['set'](_0x1b0908,_0x3d84dc['then'](_0x9964c=>_0x9964c['clone']())),{'request':_0x3d84dc,'abortController':_0x47e93f};}async*['_getStreamReader'](_0x44f8b7){const _0x750df5=[],_0x123c9c=_0x44f8b7['getReader'](),_0x588546=_0x4e09d9({'onError':_0x533e75=>{this['_handleError'](_0x533e75);},'onEvent':_0x5800cd=>{_0x5800cd['data']=JSON['parse'](_0x5800cd['data']),_0x750df5['push'](_0x5800cd);}});try{let _0x18388d=!0x1;for(;!_0x18388d;){const {done:_0x3197f6,value:_0x28c3c2}=await _0x123c9c['read']();_0x3197f6&&(_0x18388d=!0x0),_0x588546['feed'](this['_decoder']['decode'](_0x28c3c2,{'stream':!0x0})),yield*_0x750df5,_0x750df5['length']=0x0;}}catch(_0x31dcda){this['_handleError'](_0x31dcda);}finally{_0x123c9c['releaseLock'](),_0x588546['reset']();}}['_handleError'](_0x437da8){if(_0x437da8 instanceof at)throw _0x437da8;if(_0x437da8 instanceof Error&&'AbortError'===_0x437da8['name'])throw new at('ai-request-aborted',this,{'originalError':_0x437da8});throw new at('ai-request-failed',this,{'originalError':_0x437da8});}};function ls(_0x1b7eea,_0x2a66c1,_0xcc27b2){const t=_0x1b7eea['t'];switch(_0x2a66c1){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'},_0xcc27b2);case'AI_SUGGESTION_CONTENT_PART_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECTED','string':'Change\x20was\x20rejected'});case'AI_SUGGESTION_CONTENT_PART_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_OUTDATED','string':'Change\x20is\x20outdated'});case'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED':return t({'id':'AI_SUGGESTION_CONTENT_PART_ALREADY_APPLIED','string':'Change\x20is\x20already\x20applied'});case'AI_SUGGESTION_CONTENT_PART_APPLY':return t({'id':'AI_SUGGESTION_CONTENT_PART_APPLY','string':'Apply\x20change'});case'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION':return t({'id':'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION','string':'Add\x20as\x20suggestion'});case'AI_SUGGESTION_CONTENT_PART_REJECT':return t({'id':'AI_SUGGESTION_CONTENT_PART_REJECT','string':'Reject\x20change'});case'AI_SUGGESTION_CONTENT_PART_REMOVED':return t({'id':'AI_SUGGESTION_CONTENT_PART_REMOVED','string':'Removed\x20content.\x20Use\x20\x22Show\x20details\x22\x20to\x20learn\x20more.'});case'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED','string':'Approved'});case'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED','string':'Rejected'});case'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED':return t({'id':'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED','string':'Outdated'});case'AI_DISCLAIMER_TEXT':return t({'id':'AI_DISCLAIMER_TEXT','string':'AI\x20can\x20make\x20mistakes.\x20Please\x20double-check\x20responses.'});case'AI_TABS_LABEL_MAXIMIZE':return t({'id':'AI_TABS_LABEL_MAXIMIZE','string':'Maximize'});case'AI_TABS_LABEL_MINIMIZE':return t({'id':'AI_TABS_LABEL_MINIMIZE','string':'Minimize'});case'AI_CHAT_HEADING':return t({'id':'AI_CHAT_HEADING','string':'Chat'});case'AI_CHAT_SOURCES_HEADER':return t({'id':'AI_CHAT_SOURCES_HEADER','string':'Sources'});case'AI_CHAT_UNTITLED_CONVERSATION':return t({'id':'AI_CHAT_UNTITLED_CONVERSATION','string':'Untitled\x20conversation'});case'AI_CHAT_LABEL_NEW_CHAT':return t({'id':'AI_CHAT_LABEL_NEW_CHAT','string':'New\x20chat'});case'AI_CHAT_STOP_GENERATING':return t({'id':'AI_CHAT_STOP_GENERATING','string':'Stop\x20generating'});case'AI_CHAT_IS_WRITING':return t({'id':'AI_CHAT_IS_WRITING','string':'AI\x20is\x20writing...'});case'AI_CHAT_PROMPT_EMPTY_ERROR':return t({'id':'AI_CHAT_PROMPT_EMPTY_ERROR','string':'This\x20field\x20cannot\x20be\x20empty.'});case'AI_CHAT_LABEL_SUBMIT':return t({'id':'AI_CHAT_LABEL_SUBMIT','string':'Submit'});case'AI_CHAT_WELCOME_MESSAGE':return t({'id':'AI_CHAT_WELCOME_MESSAGE','string':'Hi!\x20I\x20can\x20help\x20you\x20draft,\x20rewrite,\x20and\x20improve\x20your\x20text,\x20explore\x20ideas,\x20research\x20topics,\x20and\x20solve\x20problems.\x20How\x20can\x20I\x20help\x20right\x20now?'});case'AI_CHAT_ABORTED_MESSAGE':return t({'id':'AI_CHAT_ABORTED_MESSAGE','string':'Response\x20stopped.'});case'AI_CHAT_GENERIC_ERROR':return t({'id':'AI_CHAT_GENERIC_ERROR','string':'Something\x20went\x20wrong\x20while\x20processing\x20your\x20request.\x20Please\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_START_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_START_CONVERSATION','string':'Unable\x20to\x20start\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION':return t({'id':'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION','string':'Unable\x20to\x20load\x20chosen\x20conversation.\x20Please\x20make\x20sure\x20you\x20are\x20online\x20and\x20try\x20again.'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE','string':'Failed\x20to\x20upload\x20files:\x20%0.\x20Please\x20try\x20again.'},_0xcc27b2);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.'},_0xcc27b2);case'AI_CHAT_RESOURCE_LOAD_FAILED':return t({'id':'AI_CHAT_RESOURCE_LOAD_FAILED','string':'Failed\x20to\x20load\x20resource.\x20Please\x20try\x20again.'});case'AI_CHAT_CONTEXT_CURRENT_DOCUMENT':return t({'id':'AI_CHAT_CONTEXT_CURRENT_DOCUMENT','string':'Current\x20document'});case'AI_CHAT_CONTEXT_PASTED_TEXT_NAME':return t({'id':'AI_CHAT_CONTEXT_PASTED_TEXT_NAME','string':'Pasted\x20Text'});case'AI_CHAT_DROP_ZONE_HINT':return t({'id':'AI_CHAT_DROP_ZONE_HINT','string':'Drop\x20files\x20here\x20to\x20add\x20to\x20the\x20chat'});case'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT','string':'Remove\x20from\x20context'});case'AI_CHAT_CONTEXT_ADD_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_ADD_CONTEXT','string':'Add\x20context'});case'AI_CHAT_CONTEXT_URL_LABEL':return t({'id':'AI_CHAT_CONTEXT_URL_LABEL','string':'URL'});case'AI_CHAT_CONTEXT_FILE_LABEL':return t({'id':'AI_CHAT_CONTEXT_FILE_LABEL','string':'File'});case'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL':return t({'id':'AI_CHAT_CONTEXT_CURRENT_CONTEXT_LABEL','string':'Current\x20context'});case'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL':return t({'id':'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL','string':'Selected\x20content'});case'AI_CHAT_SEARCH_WEB':return t({'id':'AI_CHAT_SEARCH_WEB','string':'Web\x20search'});case'AI_CHAT_ENABLE_WEB_SEARCH':return t({'id':'AI_CHAT_ENABLE_WEB_SEARCH','string':'Enable\x20web\x20search'});case'AI_CHAT_DISABLE_WEB_SEARCH':return t({'id':'AI_CHAT_DISABLE_WEB_SEARCH','string':'Disable\x20web\x20search'});case'AI_CHAT_REASONING':return t({'id':'AI_CHAT_REASONING','string':'Reasoning'});case'AI_CHAT_ENABLE_REASONING':return t({'id':'AI_CHAT_ENABLE_REASONING','string':'Enable\x20reasoning'});case'AI_CHAT_DISABLE_REASONING':return t({'id':'AI_CHAT_DISABLE_REASONING','string':'Disable\x20reasoning'});case'AI_CHAT_COMMANDS':return t({'id':'AI_CHAT_COMMANDS','string':'Commands'});case'AI_CHAT_SEARCH_RESOURCES':return t({'id':'AI_CHAT_SEARCH_RESOURCES','string':'Search\x20resources'});case'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT':return t({'id':'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT','string':'Back\x20to\x20context\x20options'});case'AI_CHAT_CONTEXT_URL_ADD_URL':return t({'id':'AI_CHAT_CONTEXT_URL_ADD_URL','string':'Add\x20URL'});case'AI_CHAT_CONTEXT_URL_PLACEHOLDER':return t({'id':'AI_CHAT_CONTEXT_URL_PLACEHOLDER','string':'Add\x20URL...'});case'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL':return t({'id':'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL','string':'Failed\x20to\x20upload\x20URL:\x20%0.\x20Please\x20try\x20again.'},_0xcc27b2);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'},_0xcc27b2);case'AI_CHAT_SUGGESTION_ACTION_SUGGEST':return t({'id':'AI_CHAT_SUGGESTION_ACTION_SUGGEST','string':'Suggest'},_0xcc27b2);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'},_0xcc27b2);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.'},_0xcc27b2);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.'},_0xcc27b2);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.'},_0xcc27b2);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.'},_0xcc27b2);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'},_0xcc27b2);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.'},_0xcc27b2);case'AI_QUICK_ACTIONS_OTHER':return t({'id':'AI_QUICK_ACTIONS_OTHER','string':'Other'});case'AI_ACTIONS_GENERIC_ERROR':return t({'id':'AI_ACTIONS_GENERIC_ERROR','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20response.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_BALLOON_SELECTION_REMOVED_ERROR':return t({'id':'AI_BALLOON_SELECTION_REMOVED_ERROR','string':'Changes\x20cannot\x20be\x20applied.\x20The\x20original\x20content\x20no\x20longer\x20exists.'});case'AI_REVIEW_MODE_STOP_GENERATING':return t({'id':'AI_REVIEW_MODE_STOP_GENERATING','string':'Stop\x20generating'});case'AI_REVIEW_MODE_HIDE_CHANGES':return t({'id':'AI_REVIEW_MODE_HIDE_CHANGES','string':'Hide\x20changes'});case'AI_REVIEW_MODE_SHOW_CHANGES':return t({'id':'AI_REVIEW_MODE_SHOW_CHANGES','string':'Show\x20changes'});case'AI_REVIEW_MODE_ACCEPT_ALL':return t({'id':'AI_REVIEW_MODE_ACCEPT_ALL','string':'Accept\x20all'});case'AI_REVIEW_MODE_EXIT_REVIEW':return t({'id':'AI_REVIEW_MODE_EXIT_REVIEW','string':'Exit\x20review'});case'AI_REVIEW_MODE_ACCEPT_CHANGE':return t({'id':'AI_REVIEW_MODE_ACCEPT_CHANGE','string':'Accept'});case'AI_REVIEW_MODE_DISMISS_CHANGE':return t({'id':'AI_REVIEW_MODE_DISMISS_CHANGE','string':'Dismiss'});case'AI_REVIEW_MODE_LEARN_MORE':return t({'id':'AI_REVIEW_MODE_LEARN_MORE','string':'Learn\x20more'});case'AI_REVIEW_MODE_COMPLETED_TEXT':return t({'id':'AI_REVIEW_MODE_COMPLETED_TEXT','string':'There\x27s\x20nothing\x20left\x20to\x20review.'});case'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT':return t({'id':'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20changes\x20to\x20suggest.'});case'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL','string':'Finish\x20Review'});case'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE':return t({'id':'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE','string':'Review\x20complete.\x20Finish\x20when\x20ready.'});case'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE':return t({'id':'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE','string':'AI\x20Review\x20initialized\x20with\x20errors.\x20Some\x20features\x20may\x20not\x20be\x20available\x20or\x20work\x20properly.'});case'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20the\x20whole\x20review\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE':return t({'id':'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE','string':'Not\x20everything\x20went\x20through,\x20but\x20the\x20completed\x20items\x20are\x20listed\x20below.'});case'AI_REVIEW_MODE':return t({'id':'AI_REVIEW_MODE','string':'Review'});case'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR':return t({'id':'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR','string':'Prompt\x20must\x20not\x20be\x20empty'});case'AI_REVIEW_CHECK_CUSTOM_TITLE':return t({'id':'AI_REVIEW_CHECK_CUSTOM_TITLE','string':'Custom\x20command'});case'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CUSTOM_DESCRIPTION','string':'Enter\x20a\x20custom\x20command\x20for\x20a\x20specific\x20review.'});case'AI_REVIEW_CHECK_CORRECTNESS_TITLE':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_TITLE','string':'Proofread'});case'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CORRECTNESS_DESCRIPTION','string':'Check\x20the\x20text\x20for\x20errors\x20in\x20grammar,\x20spelling,\x20and\x20punctuation.'});case'AI_REVIEW_CHECK_CLARITY_TITLE':return t({'id':'AI_REVIEW_CHECK_CLARITY_TITLE','string':'Improve\x20clarity'});case'AI_REVIEW_CHECK_CLARITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_CLARITY_DESCRIPTION','string':'Improve\x20the\x20logical\x20structure\x20and\x20precision\x20for\x20clearer\x20message.'});case'AI_REVIEW_CHECK_READABILITY_TITLE':return t({'id':'AI_REVIEW_CHECK_READABILITY_TITLE','string':'Improve\x20readability'});case'AI_REVIEW_CHECK_READABILITY_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_READABILITY_DESCRIPTION','string':'Adjust\x20sentence\x20structure\x20and\x20word\x20choice\x20for\x20an\x20easier\x20read.'});case'AI_REVIEW_CHECK_MAKE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TITLE','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_DESCRIPTION','string':'Shorten\x20or\x20lengthen\x20the\x20text\x20as\x20needed.'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_LABEL','string':'Adjust\x20length'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_LONGER','string':'Longer'});case'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER':return t({'id':'AI_REVIEW_CHECK_MAKE_OPTIONS_DATA_SHORTER','string':'Shorter'});case'AI_REVIEW_CHECK_MAKE_TONE_TITLE':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_TITLE','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_DESCRIPTION','string':'Modify\x20the\x20text\x20to\x20a\x20desired\x20tone\x20and\x20style.'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_LABEL','string':'Adjust\x20tone\x20and\x20style'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CASUAL','string':'Casual'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_DIRECT','string':'Direct'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_FRIENDLY','string':'Friendly'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_CONFIDENT','string':'Confident'});case'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL':return t({'id':'AI_REVIEW_CHECK_MAKE_TONE_OPTIONS_DATA_PROFESSIONAL','string':'Professional'});case'AI_REVIEW_CHECK_TRANSLATE_TITLE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_TITLE','string':'Translate'});case'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_DESCRIPTION','string':'Translate\x20the\x20text\x20into\x20another\x20language.'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_LABEL','string':'Select\x20language'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ENGLISH','string':'English'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_SPANISH','string':'Spanish'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_FRENCH','string':'French'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_GERMAN','string':'German'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_CHINESE','string':'Chinese\x20(Simplified)'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_JAPANESE','string':'Japanese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_RUSSIAN','string':'Russian'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_PORTUGUESE','string':'Portuguese'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_KOREAN','string':'Korean'});case'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN':return t({'id':'AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_ITALIAN','string':'Italian'});case'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED','string':'Accepted'});case'AI_REVIEW_MODE_CHECK_STATUS_REJECTED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_REJECTED','string':'Dismissed'});case'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED':return t({'id':'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED','string':'Outdated'});case'AI_TOGGLE_BUTTON_LABEL':return t({'id':'AI_TOGGLE_BUTTON_LABEL','string':'AI'});case'AI_TRANSLATE_ACCEPT_ALL':return t({'id':'AI_TRANSLATE_ACCEPT_ALL','string':'Accept\x20translation'});case'AI_TRANSLATE_FINISH_HEADER_TITLE':return t({'id':'AI_TRANSLATE_FINISH_HEADER_TITLE','string':'Translation\x20complete.\x20Finish\x20when\x20ready.'});case'AI_TRANSLATE_EMPTY_RESULTS_TEXT':return t({'id':'AI_TRANSLATE_EMPTY_RESULTS_TEXT','string':'There\x20are\x20no\x20translations\x20to\x20review.'});case'AI_TRANSLATE_FINISH_BUTTON_LABEL':return t({'id':'AI_TRANSLATE_FINISH_BUTTON_LABEL','string':'Finish\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE','string':'Content\x20Translation'});case'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION':return t({'id':'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION','string':'A\x20dedicated\x20mode\x20for\x20translating\x20the\x20entire\x20text.'});case'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE','string':'Translating\x20to'});case'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE':return t({'id':'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE','string':'Translated\x20to'});case'AI_TRANSLATE_GENERAL_ERROR_MESSAGE':return t({'id':'AI_TRANSLATE_GENERAL_ERROR_MESSAGE','string':'Sorry,\x20we\x20couldn\x27t\x20generate\x20translations\x20properly.\x20Please\x20try\x20again\x20in\x20a\x20moment.'});case'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE','string':'This\x20conversation\x20is\x20loaded\x20from\x20chat\x20history\x20from\x20a\x20previous\x20session,\x20so\x20you\x20can’t\x20apply,\x20reject,\x20or\x20suggest\x20changes.'});case'AI_SUGGESTION_DISABLED_FEED_MESSAGE':return t({'id':'AI_SUGGESTION_DISABLED_FEED_MESSAGE','string':'Actions\x20aren’t\x20available\x20for\x20changes\x20from\x20a\x20previous\x20session.'});default:return _0x2a66c1;}}function us(_0x53dc6a){return _0x53dc6a?_0x53dc6a instanceof _0x1a88b7?[_0x53dc6a]:_0x53dc6a['editors']&&0x0!==_0x53dc6a['editors']['length']?Array['from'](_0x53dc6a['editors']):[]:[];}function ds(_0x416d38){const _0x1bf42c=us(_0x416d38);if(!_0x1bf42c['length'])throw new at('ai-get-editor-from-context-no-editor');if(0x1===_0x1bf42c['length'])return _0x1bf42c[0x0];const _0x1d8447=_0x1bf42c['find'](_0x4b7a7b=>_0x4b7a7b['ui']?.['focusTracker']?.['isFocused']);if(_0x1d8447)return _0x1d8447;const _0x446cb0=function(_0x97b8fa){if(_0x97b8fa instanceof _0x1a88b7)return;const _0x1504ee=_0x97b8fa;if(!_0x1504ee['plugins']||!_0x1504ee['plugins']['has']('AIEditing'))return;return _0x1504ee['plugins']['get']('AIEditing')['getLastContentFocusedEditor']?.();}(_0x416d38);return _0x446cb0&&_0x1bf42c['includes'](_0x446cb0)?_0x446cb0:_0x1bf42c[0x0];}const _s='ai-selection',gs=['br'];var As=class extends _0x2d0760{constructor(_0x131d45){super(_0x131d45),this['context']['config']['define']('ai.models.showModelSelector',!0x0);}['_outputDataProcessor'];['_fakeSelections']=[];['_sessionIdByEditor']=new WeakMap();['_lastContentFocusedEditor'];static get['pluginName'](){return'AIEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['getLastContentFocusedEditor'](){return this['_lastContentFocusedEditor'];}['getSessionId'](_0x3a6b1a){let _0x559c94=this['_sessionIdByEditor']['get'](_0x3a6b1a);return _0x559c94||(_0x559c94=_0x3a6b1a['plugins']['has']('RealTimeCollaborationClient')&&_0x3a6b1a['plugins']['get']('RealTimeCollaborationClient')['sessionId']||Ot(),this['_sessionIdByEditor']['set'](_0x3a6b1a,_0x559c94)),_0x559c94;}async['getDocumentData'](){const _0x53e690=us(this['context']);if(!_0x53e690['length'])throw new at('ai-get-editor-from-context-no-editor');const _0x3f8b24=[],_0x4f9a8e=new Set();for(const _0x1c3e8e of _0x53e690){const _0x150e8a=_0x1c3e8e['config']['get']('roots')||{};for(const _0x1e1e0d of _0x1c3e8e['model']['document']['getRoots']()){if('$graveyard'===_0x1e1e0d['rootName'])continue;const _0x1d60b8=await this['_getDocumentDataForEditorRoot'](_0x1c3e8e,_0x1e1e0d,_0x4f9a8e),_0x4e40c8=_0x150e8a[_0x1e1e0d['rootName']],_0xbf7ead=_0x1e1e0d['getAttribute']('$description')??_0x4e40c8?.['description'];let _0x344669=_0x1e1e0d['getAttribute']('$title')??_0x4e40c8?.['title'];_0x344669||(_0x344669=_0x1e1e0d['getAttribute']('$rootEditableOptions')?.['label']??_0x4e40c8?.['label']),_0x344669||(ft('ai-document-root-missing-title',{'editor':_0x1c3e8e,'rootName':_0x1e1e0d['rootName']}),_0x344669=_0x1e1e0d['rootName']),_0x3f8b24['push']({'editor':_0x1c3e8e,'rootName':_0x1e1e0d['rootName'],'content':_0x1d60b8['content'],'version':_0x1d60b8['version'],'sessionId':this['getSessionId'](_0x1c3e8e),'channelId':_0x1c3e8e['config']['get']('collaboration.channelId'),'selections':_0x1d60b8['selections'],'name':_0x344669,'description':_0xbf7ead});}}return _0x3f8b24;}async['_getDocumentDataForEditorRoot'](_0x519181,_0x22e1ae,_0x32b274){const _0x48a9ae=_0x519181['data']['toView'](_0x22e1ae,{'convertAiChatSelectionMarker':!0x0}),_0xa159c2=new _0x333da2(_0x519181['editing']['view']['document']);this['_setDataIdsOnChildren'](_0x48a9ae,_0xa159c2,_0x32b274);let _0x5c1ef5=await this['_getDocumentDataStringFromView'](_0x48a9ae,_0x519181);const _0x51bc6f=this['_getMarkersInDocumentOrder'](_0x519181,_0x22e1ae),_0x28b48f=[];for(const _0x261094 of _0x51bc6f){const _0x3c9060='<'+_0x261094['name']+':start></'+_0x261094['name']+':start>',_0x403de0=_0x5c1ef5['indexOf'](_0x3c9060);_0x5c1ef5=_0x5c1ef5['substring'](0x0,_0x403de0)+_0x5c1ef5['substring'](_0x403de0+_0x3c9060['length']);const _0x169e71='<'+_0x261094['name']+':end></'+_0x261094['name']+':end>',_0x2b8324=_0x5c1ef5['indexOf'](_0x169e71);_0x5c1ef5=_0x5c1ef5['substring'](0x0,_0x2b8324)+_0x5c1ef5['substring'](_0x2b8324+_0x169e71['length']),_0x28b48f['push']({'markerName':_0x261094['name'],'start':_0x403de0,'end':_0x2b8324,'htmlFragment':_0x5c1ef5['substring'](_0x403de0,_0x2b8324)});}return{'content':_0x5c1ef5,'version':_0x519181['model']['document']['version'],'selections':_0x28b48f};}['afterInit'](){this['context']instanceof _0x1a88b7?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x2137e0,_0x239764)=>{_0x239764['on']('ready',()=>{this['_integrateEditor'](_0x239764);});});}['_setOutputDataProcessor'](_0xfe1642){this['_outputDataProcessor']=_0xfe1642;}async['_getDocumentDataStringFromView'](_0x4ef524,_0x429e15){let _0x585cc1;if(this['_outputDataProcessor']){const _0x384cc0=_0x429e15['data']['processor']['domConverter']['viewToDom'](_0x4ef524),_0x5d2b40=await this['_outputDataProcessor'](_0x384cc0);_0x585cc1=_0x429e15['data']['processor']['htmlWriter']['getHtml'](_0x5d2b40);}else _0x585cc1=_0x429e15['data']['processor']['toData'](_0x4ef524);return _0x585cc1;}['_integrateEditor'](_0x21292b){if(!_0x21292b['config']['get']('collaboration.channelId'))throw new at('ai-missing-channel-id',_0x21292b);_0x21292b['ui']['focusTracker']['on']('change:isFocused',(_0x571c61,_0x43d039,_0x57efd2)=>{_0x57efd2&&(this['_lastContentFocusedEditor']=_0x21292b);}),_0x21292b['on']('destroy',()=>{this['_lastContentFocusedEditor']===_0x21292b&&(this['_lastContentFocusedEditor']=void 0x0);}),_0x21292b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':_s,'view':({markerName:_0x398660})=>({'classes':['ck-ai-assistant-ui_theme','ck-fake-ai-selection','ck-fake-ai-selection-'+_0x398660['split'](':')[0x1]],'priority':0xc})}),_0x21292b['conversion']['for']('dataDowncast')['markerToElement']({'model':_s+':context','view':(_0x481394,{writer:_0xc2a3a3,options:_0x24a800})=>_0x24a800['convertAiChatSelectionMarker']?_0xc2a3a3['createUIElement'](_0x481394['markerName']+':'+(_0x481394['isOpening']?'start':'end')):null});}['showFakeVisualSelection'](_0x3848fc){const _0x3623b0=this['_fakeSelections'][0x0]||null;this['_addFakeSelection'](_0x3848fc);const _0xc2ed78=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x3623b0,_0xc2ed78);}['hideFakeVisualSelection'](_0x436e56){const _0x1b48cc=this['_fakeSelections'][0x0]||null;this['_removeFakeSelectionById'](_0x436e56);const _0x3cd9b3=this['_fakeSelections'][0x0]||null;this['_refreshFakeSelection'](_0x1b48cc,_0x3cd9b3);}async['modelToDataWithIds'](_0xd8f480,_0x4a124c){const _0x365bea=_0x4a124c['data']['toView'](_0xd8f480),_0x33306d=new _0x333da2(_0x4a124c['editing']['view']['document']);return this['_setDataIdsOnChildren'](_0x365bea,_0x33306d),this['_getDocumentDataStringFromView'](_0x365bea,_0x4a124c);}['_setDataIdsOnChildren'](_0x48bd68,_0x5d9677,_0x5006f7=new Set()){let _0x28c3dc=!0x1;for(const _0x54ac41 of _0x48bd68['getChildren']()){if(!_0x54ac41['is']('view:element')||gs['includes'](_0x54ac41['name']))continue;const _0x4cad87=_0x54ac41['is']('view:containerElement'),_0x545e64=_0x54ac41['is']('view:emptyElement'),_0x5ab30b=_0x54ac41['is']('view:rawElement'),_0x46e611=this['_setDataIdsOnChildren'](_0x54ac41,_0x5d9677,_0x5006f7);_0x54ac41['hasAttribute']('data-id')?(_0x28c3dc=!0x0,_0x5006f7['add'](_0x54ac41['getAttribute']('data-id'))):(_0x4cad87||_0x545e64||_0x5ab30b||_0x46e611)&&(_0x5d9677['setAttribute']('data-id',this['_nextDataId'](_0x5006f7),_0x54ac41),_0x28c3dc=!0x0);}return _0x28c3dc;}['_nextDataId'](_0x41d393){let _0x5430f6;do{_0x5430f6='';for(let _0x5c7fb3=0x0;_0x5c7fb3<0x4;_0x5c7fb3++)_0x5430f6+=String['fromCharCode'](0x61+Math['floor'](0x1a*Math['random']()));}while(_0x41d393['has'](_0x5430f6));return _0x41d393['add'](_0x5430f6),_0x5430f6;}['getSelectionText'](_0xc7ad08){const _0x4d72d4=(_0xc7ad08?_0xc7ad08['model']:ds(this['context'])['model'])['document']['selection'],_0x52c7cb=[],_0x48f033=Array['from'](_0x4d72d4['getRanges']());_0x48f033['sort']((_0x4ee9ab,_0x4e325d)=>_0x4ee9ab['start']['isBefore'](_0x4e325d['start'])?-0x1:0x1);for(const _0x27cffe of _0x48f033)for(const _0x16b5ac of _0x27cffe['getItems']())_0x16b5ac['is']('$textProxy')?_0x52c7cb['push'](_0x16b5ac['data']):_0x16b5ac['is']('element')&&_0x52c7cb['length']>0x0&&'\x20'!==_0x52c7cb[_0x52c7cb['length']-0x1]&&_0x52c7cb['push']('\x20');return _0x52c7cb['length']?'\x22'+_0x52c7cb['join']('')['trim']()+'\x22':ls(this['context']['locale'],'AI_CHAT_CONTEXT_DOCUMENT_SELECTION_LABEL');}['_removeFakeSelectionById'](_0x734f9e){for(let _0x470127=0x0;_0x470127<this['_fakeSelections']['length'];_0x470127++)if(this['_fakeSelections'][_0x470127]['id']==_0x734f9e)return void this['_fakeSelections']['splice'](_0x470127,0x1);}['_addFakeSelection'](_0x56032b){this['_removeFakeSelectionById'](_0x56032b['id']),Tt(this['_fakeSelections'],_0x56032b);}['_refreshFakeSelection'](_0x623140,_0x2deec6){if(_0x623140==_0x2deec6)return;const _0x55da1e=_0x623140?_0x623140['editor']:null,_0x4b3bb9=_0x2deec6?_0x2deec6['editor']:null,_0x2e5756=(_0x55765c,_0xec6a9e)=>{const _0x125022=_0xec6a9e['model']['markers']['getMarkersGroup'](_s);for(const _0xd93874 of _0x125022)_0x55765c['removeMarker'](_0xd93874);},_0x31c087=(_0x4d4c3d,_0x186949,_0x299d03)=>{const _0x441ed7=_0x186949['model'];for(let _0x17d0ea=0x0;_0x17d0ea<_0x299d03['ranges']['length'];_0x17d0ea++){let _0x483a05=_0x299d03['ranges'][_0x17d0ea];const _0xce13c1=_s+':'+_0x299d03['id']+':'+_0x17d0ea;if(_0x483a05['start']['isAtEnd']){const _0x2409f2=_0x483a05['start']['getLastMatchingPosition'](({item:_0x443dde})=>!_0x441ed7['schema']['isContent'](_0x443dde),{'boundaries':_0x483a05});_0x483a05=_0x4d4c3d['createRange'](_0x2409f2,_0x483a05['end']);}_0x4d4c3d['addMarker'](_0xce13c1,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x483a05});}};_0x55da1e&&_0x4b3bb9&&_0x55da1e===_0x4b3bb9&&_0x2deec6?_0x55da1e['model']['change'](_0x5f4ac4=>{_0x2e5756(_0x5f4ac4,_0x55da1e),_0x31c087(_0x5f4ac4,_0x4b3bb9,_0x2deec6);}):(_0x55da1e&&_0x55da1e['model']['change'](_0x851908=>_0x2e5756(_0x851908,_0x55da1e)),_0x4b3bb9&&_0x2deec6&&_0x4b3bb9['model']['change'](_0x353825=>_0x31c087(_0x353825,_0x4b3bb9,_0x2deec6)));}['_getMarkersInDocumentOrder'](_0x1b7447,_0xb26a38){const _0x3071ed=Array['from'](_0x1b7447['model']['markers']['getMarkersGroup'](_s+':context'));return(_0xb26a38?_0x3071ed['filter'](_0x5a56c5=>{const _0x3998fe=_0x5a56c5['getRange']();return _0x3998fe&&_0x3998fe['root']['rootName']===_0xb26a38['rootName'];}):_0x3071ed)['sort']((_0x1388fe,_0xccfb6b)=>_0x1388fe['getStart']()['isBefore'](_0xccfb6b['getStart']())?-0x1:_0x1388fe['getStart']()['isAfter'](_0xccfb6b['getStart']())?0x1:0x0);}};function Is(_0x4ccfbd,_0x21c5a4){return _0x1f0f5e(_0x4ccfbd,_0x21c5a4);}function ps(_0x40dc4c,_0x29b334){return _0x5286d3(_0x40dc4c,_0x29b334);}function ms(_0x18a14b,_0x4d8002,_0x494f72){const _0x589051=null!==_0x4d8002?_0x5a354a=>_0x5a354a['attribs'][_0x18a14b]===_0x4d8002:_0x4f5a68=>Boolean(_0x4f5a68['attribs'][_0x18a14b]);return _0x36c87f(_0x36d631=>_0x3dcf78(_0x36d631)&&_0x589051(_0x36d631),_0x494f72);}function Es(_0x2e1e8e,_0x5993e7,_0x385f5a){const _0x202b7d=null!==_0x5993e7?_0x4f6fe6=>_0x4f6fe6['attribs'][_0x2e1e8e]===_0x5993e7:_0x2ce3f6=>Boolean(_0x2ce3f6['attribs'][_0x2e1e8e]);return _0x269094(_0x1e311e=>_0x3dcf78(_0x1e311e)&&_0x202b7d(_0x1e311e),_0x385f5a);}function Ts(_0x580be1){return _0x269094(_0x43d2db=>_0x3dcf78(_0x43d2db)&&function(_0x413393){const _0x251e0b=_0x413393['toLowerCase']();return'script'===_0x251e0b||'style'===_0x251e0b||_0x251e0b['includes']('-');}(_0x43d2db['name']),_0x580be1);}function ws(_0x35d1f1){return _0x2e1a4a(_0x3d6f4e=>_0x1a5d2e(_0x3d6f4e),_0x35d1f1,!0x0,0x1/0x0);}function Cs(_0x4a6be5,_0x513b0a){return _0x4a6be5&&_0x3dcf78(_0x4a6be5)?_0x4a6be5['attribs'][_0x513b0a]:null;}function fs(_0x162793,_0x1f9a78,_0xf242e1){_0x3dcf78(_0x162793)&&(null===_0xf242e1?delete _0x162793['attribs'][_0x1f9a78]:_0x162793['attribs'][_0x1f9a78]=_0xf242e1);}function bs(_0x5b6d80,_0x35313a,_0x1d265d){const _0x152342=_0x35313a['cloneNode'](!0x0);'beforebegin'===_0x1d265d?_0xe4cd1(_0x5b6d80,_0x152342):'afterbegin'===_0x1d265d?_0x5e9666(_0x5b6d80,_0x152342):'beforeend'===_0x1d265d?_0x3e294c(_0x5b6d80,_0x152342):'afterend'===_0x1d265d&&_0x4f0c18(_0x5b6d80,_0x152342);}function Ss(_0x2e1217){const _0x2ead6c=[];let _0x55e68b=_0x2e1217;for(;_0x55e68b;)_0x55e68b=_0x4812a4(_0x55e68b),_0x55e68b&&_0x2ead6c['push'](_0x55e68b);return _0x2ead6c;}function Rs(_0x16b577){return _0x16b577['replace'](/^\s+/gm,'')['replace'](/\s+$/gm,'')['replace'](/\n*/g,'')['replace'](/\s+/g,'\x20')['replace'](/>\s*</g,'><');}function Os(_0x6f653f){let _0x3c58dd=0x0;for(;_0x6f653f['parentNode'];)_0x6f653f=_0x6f653f['parentNode'],_0x3c58dd++;return _0x3c58dd;}function vs(_0x1f7e5e){const _0x4028fc=[];let _0x22047c=_0x1f7e5e['nextSibling'];for(;_0x22047c;)_0x4028fc['push'](_0x22047c),_0x22047c=_0x22047c['nextSibling'];_0x4028fc['forEach'](_0x317c38=>{_0x5d7a74(_0x317c38);});}function ks({documentSuggestions:_0x211427,transform:_0x13c082,documentCompare:_0x586358,documentCompareOptions:_0x2ec5a4}){const _0x1e3133=new Map();for(const [_0x11ac94,{groups:_0x2bc416,documentContext:_0xb999f2,documentContent:_0x26120e,editor:_0x2fbafa}]of _0x211427){const _0x42f0a7=_0xb999f2['content'],_0x573f57=_0xb999f2['version'],_0x1c043c=_0x26120e['cloneNode'](!0x0);for(const {changes:_0x3e615f}of _0x2bc416){const _0x58ea8f=_0x3e615f['filter'](_0x13e130=>'new'!=_0x13e130['type'])['map'](_0x4e23ed=>ms('data-id',_0x4e23ed['id'],_0x1c043c)),_0x2a654b=_0x3e615f['filter'](_0x30338a=>'removed'!=_0x30338a['type'])['map'](_0xd944e4=>_0xd944e4['node']['cloneNode'](!0x0));let _0x1310c9=null;if(_0x58ea8f['length']){_0x1310c9=_0x58ea8f[0x0]['previousSibling'];for(let _0x2898a0=0x0;_0x2898a0<_0x58ea8f['length'];_0x2898a0++)_0x5d7a74(_0x58ea8f[_0x2898a0]);}if(_0x2a654b['length']){_0x1310c9||(_0x3e615f[0x0]['anchorId']?_0x1310c9=ms('data-id',_0x3e615f[0x0]['anchorId'],_0x1c043c):(_0x1310c9=_0x2a654b['shift'](),_0x5e9666(_0x1c043c,_0x1310c9)));for(let _0x24303e=0x0;_0x24303e<_0x2a654b['length'];_0x24303e++)_0x4f0c18(_0x1310c9,_0x2a654b[_0x24303e]),_0x1310c9=_0x2a654b[_0x24303e];}}const _0x194920=ps(_0x1c043c),_0x129a3d=_0x586358['getDiff'](_0x42f0a7,_0x194920,{'targetEditor':_0x2fbafa,'anchor':_0xb999f2['rootName'],..._0x2ec5a4})['getOperations']();if(_0x13c082){const _0x9ac09d=_0x2fbafa['model']['document']['history']['getOperations'](_0x573f57),_0x184e0d={'document':_0x2fbafa['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1};_0x1e3133['set'](_0x11ac94,_0x30647f(_0x129a3d,_0x9ac09d,_0x184e0d)['operationsA']);}else _0x1e3133['set'](_0x11ac94,_0x129a3d);}return _0x1e3133;}function Ns(_0x37ba1f,_0x36fcc5){if('marker'!=_0x36fcc5['type'])return;const _0x32fb86=_0x37ba1f['model']['markers']['get'](_0x36fcc5['name']);_0x32fb86&&(_0x36fcc5['oldRange']=_0x32fb86['getRange']());}const ys=/* #__PURE__ -- @preserve */
|
|
25
|
+
_t();var xs=class extends ys{['_generateUid'];['_uidCounter']=0x0;['_touchedNodesState']={'newIds':[],'modifiedIds':[],'removedIds':[],'invalidIds':[],'lastTouchedId':null,'rescuedNewIds':new Set()};['_existingDataIds']=new Set();['_referencedExistingIds']=new Set();constructor(_0x2bd4be){super(),this['_generateUid']=_0x2bd4be||(()=>'e'+String(this['_uidCounter']++));}['merge'](_0x34c156,_0x32c0ad,_0x49985e){this['_uidCounter']=0x0;const _0x362d28=_0x34c156['cloneNode'](!0x0);Ps(_0x32c0ad,_0x362d28);const _0x28015f=_0x362d28['childNodes'],_0xeb4141=Array['from'](_0x28015f)['filter'](_0x22114d=>!(0x3===_0x22114d['nodeType']&&''===ps(_0x22114d)['trim']())),_0x5ac7b6=_0xeb4141['length'];this['_existingDataIds']=new Set(Es('data-id',null,_0x32c0ad)['map'](_0x2787cb=>Cs(_0x2787cb,'data-id'))['filter'](_0xf89b98=>!!_0xf89b98));for(const _0x5ef3a7 of _0xeb4141)_0x5ef3a7&&_0x3dcf78(_0x5ef3a7)&&void 0x0===_0x5ef3a7['attribs']['data-id']&&fs(_0x5ef3a7,'data-id','new-element');if(Es('data-id',null,_0x362d28)['forEach'](_0x44fc1d=>{const _0xf9f7ae=Cs(_0x44fc1d,'data-id');'new-element'===_0xf9f7ae||this['_existingDataIds']['has'](_0xf9f7ae)||fs(_0x44fc1d,'data-id','new-element');}),0x0===_0x32c0ad['childNodes']['length']){const _0x306297=[];return Es('data-id','new-element',_0x362d28)['forEach'](_0x178451=>{const _0x1f9aa2=this['_generateUid']();fs(_0x178451,'data-id',_0x1f9aa2),_0x306297['push'](_0x1f9aa2);}),this['_removeSpecialComments'](_0x362d28),{'parsedContent':_0x362d28,'newNodeIds':_0x306297,'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 _0x418d1d=-0x1,_0x3fd43a=!0x1;for(let _0xf92eeb=0x0;_0xf92eeb<_0x5ac7b6;_0xf92eeb++){const _0x41f06f=_0xeb4141[_0xf92eeb],_0x31bf18=_0xeb4141[_0xf92eeb+0x1];if(this['_isNewNode'](_0x41f06f)){if(-0x1===_0x418d1d&&(_0x418d1d=_0xf92eeb),this['_markWrappedElements'](_0x41f06f),!this['_isNewNode'](_0x31bf18)){const [_0x556b32,_0x466737]=this['_findReferenceNode'](_0x41f06f,_0x3fd43a,_0x32c0ad);if(_0x556b32){const _0x22b8ab=Array['from'](_0xeb4141)['slice'](_0x418d1d,_0xf92eeb+0x1);this['_insertNodes'](_0x556b32,_0x22b8ab,_0x466737),_0x418d1d=-0x1;}}}else{if(this['_isExistingContentComment'](_0x41f06f))_0x3fd43a=!0x0;else{if(this['_isExistingNode'](_0x41f06f)){const _0xe53deb=Cs(_0x41f06f,'data-id');if(_0xe53deb&&this['_existingDataIds']['has'](_0xe53deb)){this['_referencedExistingIds']['add'](_0xe53deb);const _0x1eb21b=ms('data-id',_0xe53deb,_0x32c0ad);this['_replaceNode'](_0x1eb21b,_0x41f06f);}}else{if(Ls(_0x41f06f)){const _0x54342d=Ds(_0x41f06f);ms('data-id',_0x54342d,_0x362d28)||this['_touchedNodesState']['removedIds']['push'](_0x54342d);}}}}}for(const _0x593c70 of this['_touchedNodesState']['removedIds']){const _0x1a3ba0=ms('data-id',_0x593c70,_0x32c0ad);_0x1a3ba0&&(this['_rescueUnwrappedElements'](_0x1a3ba0),this['_removeNode'](_0x1a3ba0,_0x593c70,_0x49985e));}if(Es('data-id','new-element',_0x32c0ad)['forEach'](_0x494d5e=>{const _0xf43808=this['_getUid'](_0x494d5e);fs(_0x494d5e,'data-id',_0xf43808),this['_touchedNodesState']['newIds']['push'](_0xf43808);}),this['_removeSpecialComments'](_0x32c0ad),_0x49985e&&_0x49985e['cutAfterUnstable']){const _0xc9f540=this['_findLastConfirmationPoint'](_0xeb4141),_0x4dac8a=this['_getLastStableElement'](_0x32c0ad,_0xc9f540);this['_markUnstableElements'](_0x32c0ad,_0x4dac8a);}if(this['_processWrappedElements'](_0x32c0ad,_0x49985e),_0x49985e&&_0x49985e['cutAfterUnstable']&&this['_touchedNodesState']['lastTouchedId']){const _0x242a83=Es('data-id',this['_touchedNodesState']['lastTouchedId'],_0x32c0ad);let _0x116d5c=_0x242a83[_0x242a83['length']-0x1];for(;_0x116d5c;)vs(_0x116d5c),_0x116d5c=_0x116d5c['parentNode'];}return{'parsedContent':_0x32c0ad,'newNodeIds':this['_touchedNodesState']['newIds'],'modifiedNodeIds':this['_touchedNodesState']['modifiedIds'],'removedNodeIds':this['_touchedNodesState']['removedIds']};}['_insertNodes'](_0x2cc776,_0x331b64,_0x4910d0){for(const _0x3ce015 of _0x331b64){const _0x5a6d6e=this['_getUid'](_0x3ce015);fs(_0x3ce015,'data-id',_0x5a6d6e),this['_touchedNodesState']['newIds']['push'](_0x5a6d6e),this['_touchedNodesState']['lastTouchedId']=_0x5a6d6e;}const _0x2a9467='afterbegin'===_0x4910d0||'afterend'===_0x4910d0?_0x331b64['reverse']():_0x331b64;for(const _0x579178 of _0x2a9467)bs(_0x2cc776,_0x579178,_0x4910d0);}['_replaceNode'](_0x1c0802,_0x239a27){if(!_0x1c0802)return;if(_0x5aee8b=_0x239a27,Rs(ps(_0x1c0802))===Rs(ps(_0x5aee8b)))return;var _0x5aee8b;const _0x17f66c=Cs(_0x1c0802,'data-id');this['_touchedNodesState']['modifiedIds']['push'](_0x17f66c),this['_touchedNodesState']['lastTouchedId']=_0x17f66c,_0xf9e0b3(_0x1c0802,_0x239a27['cloneNode'](!0x0));}['_removeNode'](_0x9fb21d,_0xd42ce1,_0x4c5aa3){if(_0x4c5aa3&&_0x4c5aa3['replaceRemovedWith']){this['_touchedNodesState']['lastTouchedId']=_0xd42ce1;const _0x5b687d=_0x4c5aa3['replaceRemovedWith']['cloneNode'](!0x0);fs(_0x5b687d,'data-id',_0xd42ce1),fs(_0x5b687d,'data-removed','true'),_0xf9e0b3(_0x9fb21d,_0x5b687d);}else _0x5d7a74(_0x9fb21d);}['_findReferenceNode'](_0xe71978,_0x103eb3,_0x280c40){const _0x7b5907=this['_findPrevElementWithDataId'](_0xe71978,!0x1);if(_0x7b5907){const _0x25f53c=Ds(_0x7b5907),_0x4f0c74=ms('data-id',_0x25f53c,_0x280c40);if(_0x4f0c74)return[_0x4f0c74,'afterend'];this['_touchedNodesState']['invalidIds']['push'](_0x25f53c);}const _0x33bbb1=this['_findNextElementWithDataId'](_0xe71978,!0x1);if(_0x33bbb1){const _0x3db1e5=Ds(_0x33bbb1),_0x4015c9=ms('data-id',_0x3db1e5,_0x280c40);if(_0x4015c9)return[_0x4015c9,'beforebegin'];this['_touchedNodesState']['invalidIds']['push'](_0x3db1e5);}return _0x103eb3?_0xe71978['nextSibling']?this['_findFallbackReferenceNode'](_0xe71978,_0x280c40):[_0x280c40['childNodes'][_0x280c40['childNodes']['length']-0x1],'afterend']:[_0x280c40['childNodes'][0x0],'beforebegin'];}['_findFallbackReferenceNode'](_0x2dd884,_0x39ee4f){const _0x29a332=[],_0x323ac7=this['_findPrevElementWithDataId'](_0x2dd884,!0x0);if(_0x323ac7){const _0x41d11f=ms('data-id',Ds(_0x323ac7),_0x39ee4f);_0x41d11f&&_0x29a332['push']([_0x41d11f,'afterend']);}const _0x16178a=this['_findNextElementWithDataId'](_0x2dd884,!0x0);if(_0x16178a){const _0x1781f2=ms('data-id',Ds(_0x16178a),_0x39ee4f);_0x1781f2&&_0x29a332['push']([_0x1781f2,'beforebegin']);}return _0x29a332['length']>0x1?Os(_0x29a332[0x0][0x0])<=Os(_0x29a332[0x1][0x0])?_0x29a332[0x0]:_0x29a332[0x1]:0x1===_0x29a332['length']?_0x29a332[0x0]:[_0x39ee4f['lastChild'],'afterend'];}['_findNextElementWithDataId'](_0x389bf6,_0x117252){let _0x53dfa9=_0x389bf6['nextSibling'],_0x3d1987=null,_0x5a0793=!0x1;for(;_0x53dfa9;){if(_0x1a5d2e(_0x53dfa9)){if(Ls(_0x53dfa9)&&(_0x3d1987=_0x53dfa9),this['_isExistingContentComment'](_0x53dfa9)&&_0x117252&&!_0x5a0793){_0x5a0793=!0x0,_0x53dfa9=_0x53dfa9['nextSibling'];continue;}break;}const _0x4c1d78=Cs(_0x53dfa9,'data-id');if(_0x4c1d78&&'new-element'!==_0x4c1d78&&this['_existingDataIds']['has'](_0x4c1d78)){_0x3d1987=_0x53dfa9;break;}_0x53dfa9=_0x53dfa9['nextSibling'];}return _0x3d1987;}['_findPrevElementWithDataId'](_0x28abb8,_0x56e10d){let _0x4a9977=_0x28abb8['previousSibling'],_0x20a971=null,_0x4ad5b1=!0x1;for(;_0x4a9977;){if(_0x1a5d2e(_0x4a9977)){if(Ls(_0x4a9977)&&(_0x20a971=_0x4a9977),this['_isExistingContentComment'](_0x4a9977)&&_0x56e10d&&!_0x4ad5b1){_0x4ad5b1=!0x0,_0x4a9977=_0x4a9977['previousSibling'];continue;}break;}const _0x230d5c=Cs(_0x4a9977,'data-id');if(_0x230d5c&&'new-element'!==_0x230d5c&&this['_existingDataIds']['has'](_0x230d5c)){_0x20a971=_0x4a9977;break;}_0x4a9977=_0x4a9977['previousSibling'];}return _0x20a971;}['_markWrappedElements'](_0x84fc9f){_0x3dcf78(_0x84fc9f)&&Es('data-id',null,_0x84fc9f)['forEach'](_0x4e063c=>{this['_isExistingNode'](_0x4e063c)&&(fs(_0x4e063c,'data-wrapped-id',Cs(_0x4e063c,'data-id')),fs(_0x4e063c,'data-id',null));});}['_processWrappedElements'](_0x50bf29,_0x577161){Es('data-wrapped-id',null,_0x50bf29)['forEach'](_0x8adadd=>{const _0x36e241=Cs(_0x8adadd,'data-wrapped-id');if(this['_hasUnstableParent'](_0x8adadd))return;const _0x23d1c0=ms('data-id',_0x36e241,_0x50bf29);fs(_0x8adadd,'data-id',_0x36e241),_0x23d1c0&&(this['_removeNode'](_0x23d1c0,_0x36e241,_0x577161),this['_touchedNodesState']['removedIds']['push'](_0x36e241),this['_touchedNodesState']['lastTouchedId']=_0x36e241);});}['_hasUnstableParent'](_0x29135a){let _0x1ebdca=_0x29135a['parentNode'];for(;_0x1ebdca;){if(Cs(_0x1ebdca,'data-unstable'))return!0x0;_0x1ebdca=_0x1ebdca['parentNode'];}return!0x1;}['_rescueUnwrappedElements'](_0x50fc31){const _0xd8c22d=new Set(this['_touchedNodesState']['removedIds']),_0x294228=new Set(this['_touchedNodesState']['newIds']);Es('data-id',null,_0x50fc31)['forEach'](_0x313a89=>{const _0x55e886=Cs(_0x313a89,'data-id'),_0x435302=!!_0x55e886&&this['_referencedExistingIds']['has'](_0x55e886),_0x54075f=!!_0x55e886&&_0x294228['has'](_0x55e886);if(!_0x55e886||!_0x435302&&!_0x54075f)return;if(_0xd8c22d['has'](_0x55e886))return;let _0x84f16e=_0x313a89['parentNode'],_0x597354=!0x1;for(;_0x84f16e;){if(_0x84f16e===_0x50fc31){_0x597354=!0x0;break;}const _0x28d3b7=Cs(_0x84f16e,'data-id');if(_0x28d3b7&&(this['_referencedExistingIds']['has'](_0x28d3b7)||_0x294228['has'](_0x28d3b7)))return;_0x84f16e=_0x84f16e['parentNode'];}if(_0x597354){if(_0xe4cd1(_0x50fc31,_0x313a89),_0x435302){const _0x115843=this['_generateUid'](),_0x162d6d=this['_touchedNodesState']['modifiedIds']['indexOf'](_0x55e886);-0x1!==_0x162d6d&&this['_touchedNodesState']['modifiedIds']['splice'](_0x162d6d,0x1),fs(_0x313a89,'data-unwrapped-id',_0x55e886),fs(_0x313a89,'data-id',_0x115843),this['_touchedNodesState']['newIds']['push'](_0x115843),this['_touchedNodesState']['rescuedNewIds']['add'](_0x115843),this['_touchedNodesState']['lastTouchedId']=_0x115843;}else this['_touchedNodesState']['rescuedNewIds']['add'](_0x55e886),this['_touchedNodesState']['lastTouchedId']=_0x55e886;}});}['_getUid'](_0x49a76a){return this['_isExistingNode'](_0x49a76a)?Cs(_0x49a76a,'data-id'):this['_generateUid']();}['_removeSpecialComments'](_0x5eecd9){ws(_0x5eecd9)['filter'](_0xa37131=>Ls(_0xa37131)||this['_isExistingContentComment'](_0xa37131))['forEach'](_0x2e8e29=>{_0x5d7a74(_0x2e8e29);});}['_findLastConfirmationPoint'](_0x145b5b){let _0x5e372a=null,_0x13c349=null,_0x1a3d5c=null,_0x257ee4=null;const _0x562869=_0x44ca68=>{_0x44ca68&&(_0x5e372a=_0x44ca68),_0x1a3d5c=null,_0x257ee4=null;};for(let _0x9fafa=0x0;_0x9fafa<_0x145b5b['length'];_0x9fafa++){const _0xa24daa=_0x145b5b[_0x9fafa];if(this['_isExistingContentComment'](_0xa24daa)){_0x562869(_0x13c349);continue;}if(_0x3dcf78(_0xa24daa)){const _0x405c8c=Cs(_0xa24daa,'data-id'),_0x41039a=_0x9fafa===_0x145b5b['length']-0x1;if(_0x405c8c&&'new-element'!==_0x405c8c&&this['_touchedNodesState']['modifiedIds']['includes'](_0x405c8c)&&!_0x41039a){_0x562869(_0x405c8c),_0x13c349=_0x405c8c;continue;}}let _0x3c12b0=null;const _0x246246=Ds(_0xa24daa);if(_0x246246&&this['_touchedNodesState']['rescuedNewIds']['has'](_0x246246))_0x13c349=_0x246246;else{if(_0x246246&&this['_touchedNodesState']['newIds']['includes'](_0x246246))_0x3c12b0='N';else{if(!Ls(_0xa24daa))continue;_0x3c12b0='R';}_0x3c12b0===_0x257ee4||null===_0x257ee4?_0x257ee4=_0x3c12b0:null!==_0x1a3d5c?(_0x562869(_0x13c349),_0x257ee4=_0x3c12b0):(_0x1a3d5c=_0x257ee4,_0x257ee4=_0x3c12b0),_0x13c349=_0x246246;}}const _0x34c2c4=_0x145b5b[_0x145b5b['length']-0x1];return _0x34c2c4&&!_0x3dcf78(_0x34c2c4)&&!Ls(_0x34c2c4)&&_0x13c349&&_0x562869(_0x13c349),_0x5e372a;}['_getLastStableElement'](_0x41badb,_0x53fc14){if(!_0x53fc14)return null;const _0xc51366=ms('data-id',_0x53fc14,_0x41badb);if(!_0xc51366)return null;const _0x5580f2=[_0xc51366,...Ss(_0xc51366)]['at'](-0x2);if(_0x5580f2===_0xc51366)return _0xc51366;let _0x426dd2=_0x5580f2['previousSibling'];for(;_0x426dd2&&!_0x3dcf78(_0x426dd2);)_0x426dd2=_0x426dd2['previousSibling'];return _0x426dd2;}['_markUnstableElements'](_0x919bed,_0x38a7e7){const _0x2f82fb=new Set([...this['_touchedNodesState']['newIds'],...this['_touchedNodesState']['modifiedIds'],...this['_touchedNodesState']['removedIds']]);let _0x32013f=_0x38a7e7?_0x38a7e7['nextSibling']:_0x919bed['firstChild'];for(;_0x32013f;)_0x3dcf78(_0x32013f)&&(_0x2f82fb['has'](Cs(_0x32013f,'data-id'))||Es('data-id',null,_0x32013f)['some'](_0x40d96a=>_0x2f82fb['has'](Cs(_0x40d96a,'data-id'))))&&fs(_0x32013f,'data-unstable','true'),_0x32013f=_0x32013f['nextSibling'];}['_isNewNode'](_0x368414){return Boolean('new-element'===Cs(_0x368414,'data-id'));}['_isExistingNode'](_0x3b377d){return Boolean((Cs(_0x3b377d,'data-id')||'')['length']>0x0&&'new-element'!==Cs(_0x3b377d,'data-id'));}['_isExistingContentComment'](_0x19a569){return Boolean(_0x1a5d2e(_0x19a569)&&ps(_0x19a569)['match'](/\s*existing[\s*-](content|document)\s*/g));}};function Ls(_0x394b85){return!!_0x394b85&&Boolean(_0x1a5d2e(_0x394b85)&&ps(_0x394b85)['match'](/removed[\s*-]data-id="[^"]+"/));}function Ds(_0x1164d9){if(!_0x1164d9)return null;if(_0x3dcf78(_0x1164d9))return Cs(_0x1164d9,'data-id')??null;if(_0x1a5d2e(_0x1164d9)){const _0x3bd4b3=ps(_0x1164d9)['match'](/removed[\s*-]data-id="([^"]+)"/);if(_0x3bd4b3&&_0x3bd4b3[0x1])return _0x3bd4b3[0x1];}return null;}function Ps(_0x1d6649,_0x2d33dc){const _0x491c93=new Map();for(const _0x76396f of Ts(_0x1d6649))_0x491c93['set'](Cs(_0x76396f,'data-id'),_0x76396f);const _0x8056f2=new Set();for(const _0x150e0f of Ts(_0x2d33dc)){const _0x2b332e=Cs(_0x150e0f,'data-id'),_0x463cfd=_0x2b332e?_0x491c93['get'](_0x2b332e):void 0x0;_0x463cfd?(_0xf9e0b3(_0x150e0f,_0x5c7833(_0x463cfd,!0x0)),_0x8056f2['add'](_0x2b332e)):_0x5d7a74(_0x150e0f);}for(const _0x2422f1 of ws(_0x2d33dc))Ls(_0x2422f1)&&_0x491c93['has'](Ds(_0x2422f1))&&_0x5d7a74(_0x2422f1);const _0xcf8f9f=new Set(Es('data-id',null,_0x2d33dc)['map'](_0x40eaec=>Cs(_0x40eaec,'data-id')));for(const [_0xbd1127,_0xb5964]of _0x491c93){if(_0x8056f2['has'](_0xbd1127))continue;let _0x5c3228=_0xb5964['parent'],_0x11e035=null;for(;_0x5c3228&&_0x3dcf78(_0x5c3228);){const _0xef32a5=Cs(_0x5c3228,'data-id');if(_0xef32a5&&_0xcf8f9f['has'](_0xef32a5)){_0x11e035=_0xef32a5;break;}_0x5c3228=_0x5c3228['parent'];}if(!_0x11e035)continue;const _0x59fd0c=ms('data-id',_0x11e035,_0x2d33dc);_0x59fd0c&&_0x3e294c(_0x59fd0c,_0x5c7833(_0xb5964,!0x0));}}const Hs=/* #__PURE__ -- @preserve */
|
|
26
|
+
_t();var Ms=class extends Hs{['_m2html'];constructor(){super();const _0x4cad8f=Object['entries'](_0x1a3c76),_0x39e31f=_0x4cad8f['findIndex'](([_0x55a1af])=>'rehypeDomRaw'===_0x55a1af);if(-0x1===_0x39e31f)throw new at('ai-response-parser-unable-to-set-up-parser');_0x4cad8f['splice'](_0x39e31f+0x1,0x0,['rehypeSanitize',_0x32bbb3]),this['_m2html']=new _0x2c4472({'plugins':Object['fromEntries'](_0x4cad8f)});}['convertMarkdownToHTML'](_0x2346b){const _0x33833e=this['_m2html']['parse'](_0x2346b);return this['parseAndNormalizeHTML'](_0x33833e);}['parseAndNormalizeHTML'](_0x5a842e){return this['_parseHTML'](_0x5a842e);}['_parseHTML'](_0x3ace27){const _0x5a2c83=Is('<dummy>'+_0x3ace27['replace'](/<[^>]*?$/g,'')+'</dummy>');return Vs(_0x5a2c83),_0x5a2c83['children']=_0x5a2c83['children'][0x0]['children'],_0x5a2c83;}};function Vs(_0x353919){for(const _0x2ca863 of _0x353919['children'])_0x3dcf78(_0x2ca863)?'pre'!==_0x2ca863['name']&&Vs(_0x2ca863):_0x59e3a7(_0x2ca863)&&(_0x2ca863['data']=_0x2ca863['data']['replace'](/^\t+/gm,'\x20')['replace'](/\n*/g,'')['replace'](/[ \t\r\f\v]+/g,'\x20'));}function Us({changeGroups:_0x2d3292,documentContextContent:_0x2a25eb,showDiff:_0x5ac40e,trimUnchanged:_0x357bca=!0x0}){return _0x2d3292['map'](_0x2bf8dd=>{if(!_0x2bf8dd['editor']||'destroyed'===_0x2bf8dd['editor']['state'])return null;const _0x241815=new _0x4e2431([]),_0x182b7d=new _0x4e2431([]),_0x314ece=new Set();for(const _0x2921cb of _0x2bf8dd['changes'])'new'==_0x2921cb['type']&&Es('data-id',null,_0x2921cb['node'])['forEach'](_0x518408=>{_0x314ece['add'](Cs(_0x518408,'data-id'));});for(const _0x52cc0e of _0x2bf8dd['changes'])if('removed'!=_0x52cc0e['type']?_0x182b7d['children']['push'](_0x52cc0e['node']['cloneNode'](!0x0)):_0x5ac40e||_0x314ece['has'](_0x52cc0e['id'])||_0x182b7d['children']['push'](_0x52cc0e['node']['cloneNode'](!0x0)),'new'!=_0x52cc0e['type']&&(_0x5ac40e||'removed'!=_0x52cc0e['type'])){const _0x5cfea0=_0x36c87f(_0x9a52e4=>Cs(_0x9a52e4,'data-id')==_0x52cc0e['id'],_0x2a25eb['get'](_0x2bf8dd['documentId']),!0x0);_0x5cfea0&&_0x241815['children']['push'](_0x5cfea0['cloneNode'](!0x0));}const {content:_0x1ea9c7,hasChanges:_0x59b963}=Bs(_0x2bf8dd['editor'],_0x241815,_0x182b7d,_0x5ac40e,_0x357bca);return{'type':_0x2bf8dd['changes'][0x0]['type'],'index':_0x2bf8dd['index'],'content':_0x1ea9c7,'hasChanges':_0x59b963};})['filter'](_0x182fcb=>null!==_0x182fcb);}function Bs(_0x7addf8,_0x47ea3e,_0x484dc2,_0xc1b2cb,_0x92ba12=!0x0){const _0x5c3a79=_0x7addf8['plugins']['get']('DocumentCompare'),_0x36e50f=ps(_0x47ea3e),_0x3712d8=ps(_0x484dc2),_0xc5be75=_0x7addf8['data']['parse'](_0x36e50f,'$root'),_0x464829=_0x7addf8['model']['createPositionAt'](_0xc5be75,0x0),_0x1f065f=_0x5c3a79['getDiff'](_0x36e50f,_0x3712d8,{'anchor':_0x464829,'markDeletions':_0xc1b2cb,'targetEditor':_0x7addf8})['getOperations']();if(0x0==_0x1f065f['length'])return{'content':_0x47ea3e['cloneNode'](!0x0),'hasChanges':!0x1};if(_0xc1b2cb?function(_0x54328f,_0x156285,_0x1cfc6a){if(0x0==_0x54328f['length'])return;const _0x3a5c6b=_0x1cfc6a['plugins']['get']('DocumentCompare'),_0x363be0=_0x1cfc6a['plugins']['get']('SuggestionsConversion');_0x1cfc6a['model']['change'](_0x5f5453=>{const _0x22d6f0=new Set();for(let _0x166f41=0x0;_0x166f41<_0x54328f['length'];_0x166f41++){const _0x4247ef=_0x54328f[_0x166f41];if(_0x4247ef['baseVersion']=null,_0x4247ef['isDocumentOperation']=!0x1,_0x3a5c6b['isMarkedRemoveOperation'](_0x4247ef)){const _0x3daf78=_0x4777b9(_0x4247ef['newRange'],_0x1cfc6a['model']),_0x2876d9='suggestion:deletion:'+Ot()+':$aiSuggestion';_0x156285['markers']['set'](_0x2876d9,_0x3daf78);}else switch(_0x4247ef['type']){case'rename':{if(_0x4247ef['oldName']==_0x4247ef['newName'])break;_0x5f5453['batch']['addOperation'](_0x4247ef),_0x1cfc6a['model']['applyOperation'](_0x4247ef);const _0x576b49='$elementName',_0x32e8bb=_0x4247ef['position'],_0x57bf5a=_0x1cfc6a['model']['createRange'](_0x32e8bb,_0x1cfc6a['model']['createPositionAt'](_0x32e8bb['nodeAfter'],'end')),_0x4cd179='suggestion:attribute:'+_0x576b49+':'+Ot()+':$aiSuggestion';_0x156285['markers']['set'](_0x4cd179,_0x57bf5a);break;}case'addAttribute':case'removeAttribute':case'changeAttribute':{if(_0x4247ef['oldValue']==_0x4247ef['newValue'])break;_0x5f5453['batch']['addOperation'](_0x4247ef),_0x1cfc6a['model']['applyOperation'](_0x4247ef);const _0xadd11d=_0x4247ef['key'];if(!_0x363be0['isRegisteredAttribute'](_0xadd11d))break;const _0xe93bff=_0x4777b9(_0x4247ef['range'],_0x1cfc6a['model']),_0x19f3ea='suggestion:attribute:'+_0xadd11d+':'+Ot()+':$aiSuggestion';_0x156285['markers']['set'](_0x19f3ea,_0xe93bff);break;}case'insert':{if(_0x5f5453['batch']['addOperation'](_0x4247ef),_0x1cfc6a['model']['applyOperation'](_0x4247ef),Gs(_0x156285,_0x4247ef),_0x54328f[_0x166f41+0x1]&&'move'==_0x54328f[_0x166f41+0x1]['type'])break;const _0x5af56b=_0x4247ef['position'],_0x29b055=_0x4247ef['howMany'],_0x1e07d3=_0x4777b9(_0x1cfc6a['model']['createRange'](_0x5af56b,_0x5af56b['getShiftedBy'](_0x29b055)),_0x1cfc6a['model']),_0x23e8fd='suggestion:insertion:'+Ot()+':$aiSuggestion';_0x156285['markers']['set'](_0x23e8fd,_0x1e07d3);break;}case'split':{_0x5f5453['batch']['addOperation'](_0x4247ef),_0x1cfc6a['model']['applyOperation'](_0x4247ef),Gs(_0x156285,_0x4247ef);const _0x15ffa9=_0x4247ef['splitPosition'],_0x7d6994=_0x4247ef['moveTargetPosition'],_0x598eb7=_0x1cfc6a['model']['createRange'](_0x15ffa9,_0x7d6994),_0x330a0a='suggestion:insertion:'+Ot()+':$aiSuggestion';_0x156285['markers']['set'](_0x330a0a,_0x598eb7);break;}case'move':{_0x5f5453['batch']['addOperation'](_0x4247ef),_0x1cfc6a['model']['applyOperation'](_0x4247ef),Gs(_0x156285,_0x4247ef);const _0xc1cb7a=_0x4247ef['getMovedRangeStart'](),_0x184a5c=_0x4247ef['howMany'];for(let _0x324de1=0x0;_0x324de1<_0x184a5c;_0x324de1++){const _0x1e9b68=_0xc1cb7a['getShiftedBy'](_0x324de1)['nodeAfter'];_0x22d6f0['add'](_0x1e9b68);}break;}case'remove':{const _0x2aee4e=_0x4247ef['sourcePosition'],_0x3e6f03=_0x4247ef['howMany'],_0x197577=new _0x39d5b2(_0x2aee4e,_0x3e6f03);_0x5f5453['batch']['addOperation'](_0x197577),_0x1cfc6a['model']['applyOperation'](_0x197577),Gs(_0x156285,_0x4247ef);break;}}}for(const _0x4de346 of _0x22d6f0){const _0x152391=_0x1cfc6a['model']['createRangeOn'](_0x4de346),_0x24e219='suggestion:formatBlock:$fakeWrap:'+Ot()+':$aiSuggestion';_0x156285['markers']['set'](_0x24e219,_0x4777b9(_0x152391,_0x1cfc6a['model']));}});}(_0x1f065f,_0xc5be75,_0x7addf8):_0x7addf8['model']['change'](_0x11f657=>{for(const _0xdd19a3 of _0x1f065f)if('remove'==_0xdd19a3['type']){const _0x57ab84=_0xdd19a3['sourcePosition'],_0x348822=_0xdd19a3['howMany'],_0x5c7c97=new _0x39d5b2(_0x57ab84,_0x348822);_0x11f657['batch']['addOperation'](_0x5c7c97),_0x7addf8['model']['applyOperation'](_0x5c7c97),Gs(_0xc5be75,_0xdd19a3);}else{if('marker'==_0xdd19a3['type']){const _0xbce551=_0xdd19a3['name'],_0x3b1615=_0xdd19a3['newRange'];null!==_0x3b1615?_0xc5be75['markers']['set'](_0xbce551,_0x3b1615):_0xc5be75['markers']['delete'](_0xbce551);}else _0xdd19a3['baseVersion']=null,_0xdd19a3['isDocumentOperation']=!0x1,_0x11f657['batch']['addOperation'](_0xdd19a3),_0x7addf8['model']['applyOperation'](_0xdd19a3),Gs(_0xc5be75,_0xdd19a3);}}),_0x92ba12){const _0x56c28d=Fs(_0x7addf8,_0x1f065f,_0xc5be75);Ws(_0x7addf8['model'],_0x56c28d),function(_0x579e7c,_0x2e0da2){const _0x459ee7=_0x2e0da2['getFirstRange']()['start'];let _0x317449=_0x2e0da2['getFirstRange']()['end'];const _0xb9ff5a=_0x459ee7['root'];(_0x317449['textNode']||_0x317449['nodeAfter']&&_0x317449['nodeAfter']['is']('$text'))&&(_0x48ea58(_0x317449,'...'),qs(_0xb9ff5a,_0x317449,0x3),_0x317449=_0x317449['getShiftedBy'](0x3)),(_0x459ee7['textNode']||_0x459ee7['nodeBefore']&&_0x459ee7['nodeBefore']['is']('$text'))&&(_0x48ea58(_0x459ee7,'...'),qs(_0xb9ff5a,_0x459ee7,0x3),_0x459ee7['parent']==_0x317449['parent']&&(_0x317449=_0x317449['getShiftedBy'](0x3)));const _0xcd9602=_0x579e7c['createRange'](_0x579e7c['createPositionAt'](_0xb9ff5a,0x0),_0x459ee7),_0x51349e=_0x579e7c['createRange'](_0x317449,_0x579e7c['createPositionAt'](_0xb9ff5a,'end')),_0x4bf4a9=[..._0xcd9602['getMinimalFlatRanges'](),..._0x51349e['getMinimalFlatRanges']()];_0x4bf4a9['reverse']();for(const _0x1d06dd of _0x4bf4a9)_0x1c6fac(_0x1d06dd),$s(_0xb9ff5a,_0x1d06dd);}(_0x7addf8['model'],_0x56c28d);}return{'content':Is(_0x7addf8['data']['stringify'](_0xc5be75,{'showSuggestionHighlights':!0x0})),'hasChanges':!0x0};}function Gs(_0x19d828,_0x56d593){for(const [_0x338d82,_0x291360]of _0x19d828['markers']){const _0x4c38ef=_0x15a2ab['_createFromRanges'](_0x291360['getTransformedByOperation'](_0x56d593));_0x4c38ef['root']==_0x19d828?_0x19d828['markers']['set'](_0x338d82,_0x4c38ef):_0x19d828['markers']['delete'](_0x338d82);}}function Fs(_0x5c2fdd,_0x37c3fa,_0x4cb102){const _0x35383c=_0x5c2fdd['plugins']['get']('DocumentCompare');let _0x42813a=_0x5c2fdd['model']['createPositionAt'](_0x4cb102,Number['POSITIVE_INFINITY']),_0x4e9b2c=_0x5c2fdd['model']['createPositionAt'](_0x4cb102,0x0);for(const _0x218303 of _0x37c3fa){let _0x15af75,_0x257f9f;if(_0x35383c['isMarkedRemoveOperation'](_0x218303))_0x15af75=_0x218303['newRange']['start'],_0x257f9f=_0x218303['newRange']['end'];else switch(_0x42813a=Ks(_0x42813a,_0x218303),_0x4e9b2c=Ks(_0x4e9b2c,_0x218303),_0x218303['type']){case'rename':_0x15af75=_0x218303['position'],_0x257f9f=_0x15af75['getShiftedBy'](0x1);break;case'addAttribute':case'removeAttribute':case'changeAttribute':_0x15af75=_0x218303['range']['start'],_0x257f9f=_0x218303['range']['end'];break;case'insert':_0x15af75=_0x218303['position'],_0x257f9f=_0x15af75['getShiftedBy'](_0x218303['howMany']);break;case'split':_0x15af75=_0x218303['splitPosition'],_0x257f9f=_0x218303['moveTargetPosition'];break;case'merge':{const _0x1ebea9=_0x218303['targetPosition']['path']['slice'](0x0,-0x1);_0x15af75=_0x5c2fdd['model']['createPositionFromPath'](_0x4cb102,_0x1ebea9),_0x257f9f=_0x15af75['getShiftedBy'](0x1);break;}case'move':case'remove':{const _0x5e6977=_0x218303['howMany'],_0x11f87f=_0x218303['sourcePosition']['_getTransformedByInsertion'](_0x218303['targetPosition'],_0x5e6977),_0x1ee73a=_0x218303['getMovedRangeStart']();'remove'==_0x218303['type']?(_0x15af75=_0x11f87f,_0x257f9f=_0x11f87f):(_0x15af75=_0x1ee73a,_0x257f9f=_0x1ee73a['getShiftedBy'](_0x5e6977));break;}}_0x15af75&&_0x15af75['isBefore'](_0x42813a)&&(_0x42813a=_0x15af75['clone'](),_0x42813a['stickiness']='toNone'),_0x257f9f&&_0x257f9f['isAfter'](_0x4e9b2c)&&(_0x4e9b2c=_0x257f9f['clone'](),_0x4e9b2c['stickiness']='toNone');}return _0x5c2fdd['model']['createSelection'](_0x5c2fdd['model']['createRange'](_0x42813a,_0x4e9b2c));}function Ks(_0x5b5fa3,_0x2affe7){return'move'!=_0x2affe7['type']&&'remove'!=_0x2affe7['type']||_0x2affe7['sourceRange']['containsPosition'](_0x5b5fa3)&&((_0x5b5fa3=_0x2affe7['sourcePosition']['clone']())['stickiness']='toNone'),_0x5b5fa3['getTransformedByOperation'](_0x2affe7);}function Ws(_0x13e74e,_0x2ae690){Ys(_0x13e74e,_0x2ae690,'forward');const _0xb4d639=_0x2ae690['getFirstRange']();_0x2ae690['setTo']([]),_0x2ae690['setTo'](_0xb4d639,{'backward':!0x0}),Ys(_0x13e74e,_0x2ae690,'backward');}function Ys(_0x19e1d0,_0xf986e2,_0x128519){let _0x1fe8b3=0x14;for(;_0x1fe8b3;){_0x19e1d0['modifySelection'](_0xf986e2,{'unit':'word','direction':_0x128519}),_0x1fe8b3--;const _0x5ae1b8=_0xf986e2['focus']['forward'==_0x128519?'nodeBefore':'nodeAfter'];if(_0x5ae1b8&&_0x5ae1b8['is']('element')&&_0x19e1d0['schema']['isBlock'](_0x5ae1b8)&&_0x19e1d0['schema']['isObject'](_0x5ae1b8))break;}}function $s(_0x5693d5,_0x545aee){for(const [_0x49ca3b,_0x26c531]of _0x5693d5['markers']){const _0x25de34=_0x26c531['_getTransformedByDeletion'](_0x545aee['start'],_0x545aee['end']['offset']-_0x545aee['start']['offset']);null!=_0x25de34?_0x5693d5['markers']['set'](_0x49ca3b,_0x25de34):_0x5693d5['markers']['delete'](_0x49ca3b);}}function qs(_0x29df19,_0x2c6687,_0xb0ef61){for(let [_0x2736dd,_0x4b6428]of _0x29df19['markers'])_0x4b6428=_0x4b6428['_getTransformedByInsertion'](_0x2c6687,_0xb0ef61,!0x1)[0x0],_0x29df19['markers']['set'](_0x2736dd,_0x4b6428);}const Qs=/* #__PURE__ -- @preserve */
|
|
27
|
+
lt();var Xs=class extends Qs{['_connector'];['_config'];['_locale'];['_modelList']=[];['_modelsRequest']=null;constructor({connector:_0x483318,config:_0x1239b2,locale:_0x256e5b}){super(),this['_connector']=_0x483318,this['_config']=_0x1239b2,this['_locale']=_0x256e5b;}get['_availableModels'](){return this['_config']?.['displayedModels'];}get['_defaultModelId'](){return this['_config']?.['defaultModelId'];}async['getAll'](){return this['_modelsRequest']||(this['_modelsRequest']=this['_retrieveModels']()),this['_modelsRequest'];}async['getAvailableModels'](){const _0x542ef6=await this['getAll']();let _0x4f1c1a;return _0x4f1c1a=this['_availableModels']?this['_filterModels'](_0x542ef6,this['_availableModels']):_0x542ef6['filter'](_0xb6113=>_0xb6113['recommended']),_0x4f1c1a;}async['getModel'](_0x436b52){const _0x399f45=await this['getAll']();if(!_0x399f45['length'])return null;if(_0x436b52){const _0x36b190=this['_getModelById'](_0x399f45,_0x436b52);if(_0x36b190)return _0x36b190;ft('ai-chat-model-id-unrecognized',{'modelId':_0x436b52,'fallBackModelId':this['_defaultModelId']});}return this['getDefault']();}async['getDefault'](){const _0x2a8175=await this['getAvailableModels']();if(!_0x2a8175['length'])return null;if(this['_defaultModelId']){const _0x347581=this['_getModelById'](_0x2a8175,this['_defaultModelId']);if(_0x347581)return _0x347581;ft('ai-chat-default-model-id-unrecognized',{'defaultModelId':this['_defaultModelId'],'fallBackModelId':_0x2a8175[0x0]['id']});}return _0x2a8175[0x0];}async['isAvailable'](_0xaaf99a){return(await this['getAvailableModels']())['some'](_0xd806c1=>_0xd806c1['name']===_0xaaf99a['name']&&_0xd806c1['provider']===_0xaaf99a['provider']);}async['_retrieveModels'](){if(!this['_modelList']['length']){const _0x3c3b42=this['_locale']['uiLanguage']||'en',_0xe319b5=await this['_connector']['getModels'](_0x3c3b42)['list']();this['_modelList']=_0xe319b5['items']['map'](_0x31cedb=>zs(_0x31cedb)?{..._0x31cedb,'name':ls(this['_locale'],'AI_MODEL_NAME_AUTO')}:_0x31cedb);}return[...this['_modelList']];}['_filterModels'](_0x183372,_0x1e7387){let _0x255fe2;if(_0x1e7387){_0x255fe2=[];const _0x444136=new Set(),_0x2f1c9d='string'==typeof _0x1e7387?[_0x1e7387['toLocaleLowerCase']()]:_0x1e7387['map'](_0x32206d=>_0x32206d['toLocaleLowerCase']());for(const _0xd922ab of _0x2f1c9d)for(const _0x642c4f of _0x183372)!_0x444136['has'](_0x642c4f['id'])&&this['_isMatchingFilter'](_0x642c4f,_0xd922ab)&&(_0x255fe2['push'](_0x642c4f),_0x444136['add'](_0x642c4f['id']));}else _0x255fe2=_0x183372;return _0x255fe2;}['_isMatchingFilter'](_0x31dbe2,_0x4fc5a9){const _0x2d6a47=_0x31dbe2['id']['toLocaleLowerCase'](),_0x549101=_0x31dbe2['name']['toLocaleLowerCase'](),_0x2c9798=_0x31dbe2['provider']['toLocaleLowerCase']();return _0x2d6a47===_0x4fc5a9||_0x549101===_0x4fc5a9||zs(_0x31dbe2)&&'auto'===_0x4fc5a9||_0x2c9798===_0x4fc5a9||_0x2d6a47['startsWith'](_0x4fc5a9);}['_getModelById'](_0x23b248,_0x5b82f9){return _0x23b248['find'](_0x5c6e46=>zs(_0x5c6e46)&&'auto'===_0x5b82f9?_0x5c6e46:_0x5c6e46['id']===_0x5b82f9)||null;}};function zs(_0x259965){return _0x259965['id']['startsWith']('agent');}function js(_0x219bc3,_0x204891){for(const _0x15d21c of _0x219bc3)'noop'!==_0x15d21c['type']&&(_0x15d21c['_aiSource']=_0x204891);}var Js=class extends _0x2d0760{static get['pluginName'](){return'AIGateway';}static get['requires'](){return[_0x5b6f61];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return new Xs({'connector':this['context']['plugins']['get']('AIConnector'),'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']})['getAll']();}['apply'](_0x21010b,_0xeddbb6){if('completed'!==_0x21010b['status'])throw new at('ai-gateway-apply-invalid-status',this,{'status':_0x21010b['status']});const _0x50ac9a=_0x21010b['editor'],{applyMethod:_0x5bff5f}=_0xeddbb6;if('suggest'===_0x5bff5f&&!_0x50ac9a['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',this);const _0x404dd1='suggest'===_0x5bff5f,_0x5a7086=this['context']['plugins']['get'](_0x5b6f61),_0x5828cb=_0x50ac9a['model']['createPositionAt'](_0x50ac9a['model']['document']['getRoot'](),0x0),_0x2c7c40=_0x5a7086['getDiff'](_0x21010b['contentRawOld'],_0x21010b['contentRawNew'],{'anchor':_0x5828cb,'markDeletions':_0x404dd1,'targetEditor':_0x50ac9a}),_0x140eea=_0x50ac9a['model']['document']['history']['getOperations'](_0x21010b['documentVersion']),_0x497f27={'document':_0x50ac9a['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1},_0x1b867d=_0x30647f(_0x2c7c40['getOperations'](),_0x140eea,_0x497f27)['operationsA'];js(_0x1b867d,_0xeddbb6['aiSource']??'api'),_0x50ac9a['model']['change'](_0x3b8363=>{if(_0x404dd1)_0x50ac9a['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x1b867d);else{for(const _0x315ed7 of _0x1b867d)_0x315ed7['baseVersion']=_0x50ac9a['model']['document']['version'],Ns(_0x50ac9a,_0x315ed7),_0x3b8363['batch']['addOperation'](_0x315ed7),_0x50ac9a['model']['applyOperation'](_0x315ed7);}});}['mergeChangesIntoContent'](_0x26fcaa,_0x5f492e,_0x2d767b){const _0xbe204e=new Ms(),_0x4e6202=new xs();let _0x3a27ed=_0xbe204e['parseAndNormalizeHTML'](_0x5f492e);for(const _0x3d81cd of _0x26fcaa)try{const _0x58cb4e=_0xbe204e['parseAndNormalizeHTML'](_0x3d81cd['content']);_0x3a27ed=_0x4e6202['merge'](_0x58cb4e,_0x3a27ed,{'cutAfterUnstable':!0x1,'replaceRemovedWith':void 0x0})['parsedContent'];}catch(_0x234a2a){throw new at('ai-gateway-merge-failed',this,{..._0x3d81cd},_0x234a2a);}return Bs(_0x2d767b,_0xbe204e['parseAndNormalizeHTML'](_0x5f492e),_0x3a27ed,!0x1,!0x1)['content'];}},Zs=class{['_editor'];['_rootName'];['_channelId'];['_sessionId'];['_documentVersion'];['_contentRawOld'];['_contentRawNew'];['_error'];['_isAborted']=!0x1;constructor(_0x591ba3){this['_editor']=_0x591ba3['editor'],this['_rootName']=_0x591ba3['rootName'],this['_channelId']=_0x591ba3['channelId'],this['_sessionId']=_0x591ba3['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'](_0x124e60){this['_documentVersion']=_0x124e60;}get['contentRawOld'](){return this['_contentRawOld'];}set['contentRawOld'](_0x50df98){this['_contentRawOld']=_0x50df98;}get['contentRawNew'](){return this['_contentRawNew'];}set['contentRawNew'](_0x135227){this['_contentRawNew']=_0x135227;}get['contentOld'](){return this['_dropDataIds'](this['_contentRawOld']||'');}get['contentNew'](){return this['_dropDataIds'](this['_contentRawNew']||'');}get['error'](){return this['_error'];}set['error'](_0x4a5417){this['_error']=_0x4a5417;}['abort'](){this['_isAborted']=!0x0;}['_dropDataIds'](_0x3a5b3f){return _0x3a5b3f['replace'](/ data-id="[a-z0-9]+"/g,'');}},tn=class extends Zs{['_summary']='';get['summary'](){return this['_summary'];}set['summary'](_0x4d65e4){this['_summary']=_0x4d65e4;}},en=class extends _0x2d0760{static get['pluginName'](){return'AIDocumentProcessingGateway';}static get['requires'](){return[cs,As,Js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['processDocument'](_0x156378,_0x2e0a08){if(!_0x156378)throw new at('ai-documentprocessinggateway-missing-prompt',this);const _0x2c7c72=await this['context']['plugins']['get'](As)['getDocumentData']();if(!_0x2c7c72[0x0])throw new at('ai-documentprocessinggateway-missing-document',this);const _0x1855c6=new tn({'editor':_0x2c7c72[0x0]['editor'],'rootName':_0x2c7c72[0x0]['rootName'],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x2c7c72[0x0]['sessionId']});if(_0x1855c6['contentRawOld']=_0x2c7c72[0x0]['content'],_0x1855c6['documentVersion']=_0x2c7c72[0x0]['version'],_0x2e0a08?.['signal']?.['aborted'])return _0x1855c6['abort'](),_0x1855c6;const _0x531f8b=this['context']['plugins']['get']('AIConnector')['processDocument']({'document':_0x1855c6['contentRawOld'],'prompt':_0x156378,'model':_0x2e0a08['model']});let _0x37da4e;if(_0x2e0a08?.['signal']){if(_0x2e0a08['signal']['aborted'])return _0x531f8b['abortController']['abort'](),_0x1855c6['abort'](),_0x1855c6;const _0x3a5d14=_0x2e0a08['signal'],_0x499293=()=>_0x531f8b['abortController']['abort']();_0x3a5d14['addEventListener']('abort',_0x499293),_0x37da4e=()=>_0x3a5d14['removeEventListener']('abort',_0x499293);}try{const _0x36730d=await _0x531f8b['getResult']();if(!(_0x36730d&&_0x36730d['document']&&_0x36730d['document']['length']>0x0))throw new at('ai-documentprocessinggateway-empty-reply',this);_0x1855c6['contentRawNew']=_0x36730d['document'],_0x1855c6['summary']=_0x36730d['summary']||'';}catch(_0x7b17e){_0x7b17e instanceof Error&&_0x7b17e['message']['includes']('ai-request-aborted')?_0x1855c6['abort']():_0x1855c6['error']=_0x7b17e instanceof at?_0x7b17e:new at('ai-documentprocessinggateway-run-failed',this,{},_0x7b17e);}finally{_0x37da4e&&_0x37da4e();}return _0x1855c6;}['applyResult'](_0x106de2,_0x1c7626){this['context']['plugins']['get']('AIGateway')['apply'](_0x106de2,_0x1c7626);}};function sn(_0x1a0e3f){return _0x1a0e3f instanceof Error&&('AbortError'===_0x1a0e3f['name']||('AICoreError'===_0x1a0e3f['name']?!0x0===_0x1a0e3f['isAbort']:_0x1a0e3f['message']['startsWith']('ai-request-aborted')));}var nn=class extends Error{['code'];['severity'];['type'];['context'];['isAbort'];constructor(_0x27a440){super(_0x27a440['code'],_0x27a440['cause']instanceof Error?{'cause':_0x27a440['cause']}:void 0x0),this['name']='AICoreError',this['code']=_0x27a440['code'],this['severity']=_0x27a440['severity']??'error',this['type']=_0x27a440['type']??'system',this['context']=_0x27a440['context'],this['isAbort']=_0x27a440['isAbort']??sn(_0x27a440['cause']);}},rn=class extends _0x2d0760{static get['pluginName'](){return'AIErrorSink';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['createReporter'](_0x2b66b9){return new on(this,_0x2b66b9);}},on=class{['_sink'];['_component'];constructor(_0x2e071f,_0x212458){this['_sink']=_0x2e071f,this['_component']=_0x212458;}['logError'](_0x2bfc2c,_0x5a7e00={}){this['_emit'](_0x2bfc2c,_0x5a7e00),this['_defaultLog'](_0x2bfc2c);}['reportError'](_0x5671b8,_0x19d073={}){this['_emit'](_0x5671b8,_0x19d073);}['_emit'](_0x556605,_0x207da9){sn(_0x556605)||this['_sink']['fire']('error',{'error':_0x556605,'component':this['_component'],'context':_0x207da9['context']});}['_defaultLog'](_0x5bedda){if(!sn(_0x5bedda)){if(_0x5bedda instanceof nn){if('user'===_0x5bedda['type']||'network'===_0x5bedda['type'])return;if('warning'===_0x5bedda['severity'])return void console['warn'](this['_component'],_0x5bedda);}console['error'](this['_component'],_0x5bedda);}}};const an='ck-ai-button-primary',hn='ck-ai-button-secondary',cn='ck-ai-button-tertiary';function ln(_0x20dbd0,_0x154130){const _0x4d2af3=new Pt(_0x20dbd0),_0x5e2635=ls(_0x20dbd0,'AI_TABS_LABEL_MINIMIZE'),_0x3d811e=ls(_0x20dbd0,'AI_TABS_LABEL_MAXIMIZE');return _0x4d2af3['set']({'withText':!0x1,'icon':_0x2c8240,'tooltip':!0x0,'class':'ck-ai-tabs__resize\x20'+cn}),_0x4d2af3['bind']('label')['to'](_0x154130,'isMaximized',_0x5726aa=>_0x5726aa?_0x5e2635:_0x3d811e),_0x4d2af3['bind']('icon')['to'](_0x154130,'isMaximized',_0xbe9519=>_0xbe9519?_0x1c55e4:_0x2c8240),_0x4d2af3['bind']('isOn')['to'](_0x154130,'isMaximized'),_0x4d2af3['on']('execute',()=>{_0x154130['fire']('resizeTabs');}),_0x4d2af3;}function un(_0x5a379b){const _0x514f15=new xt(_0x5a379b);return _0x514f15['attachToDom'](),_0x514f15['bodyCollectionContainer']['classList']['add']('ck-ai-body'),_0x514f15;}const dn=/* #__PURE__ -- @preserve */
|
|
28
|
+
_t();var _n=class extends dn{['id'];['interactionId'];['type'];['content']=new Map();['sources']=[];['parsedContent']=new Map();['parsedMergedContent']=new Map();['changeGroups']=[];['areActionsDisabled']=!0x1;['isFromHistory']=!0x1;['documentContextContent'];['_documentIdToSource']=new Map();['aiResponseParser'];['aiResponseApplier'];['locale'];['cachedSuggestionContentParts']={'withDiff':[],'withoutDiff':[]};constructor({type:_0x238599,isDone:_0x1002ac=!0x1,isComplete:_0xa243aa,interactionId:_0x33a41d,areActionsDisabled:_0x55632d,isFromHistory:_0x1af900=!0x1,documentContextContent:_0x3eb1a7,locale:_0x30ffcb,id:_0x3631e1,channelsToEditors:_0x390b6d}){super(),this['id']=_0x3631e1||Ot(),this['interactionId']=_0x33a41d,this['type']=_0x238599,this['areActionsDisabled']=!!_0x55632d,this['isFromHistory']=_0x1af900,this['locale']=_0x30ffcb,this['aiResponseParser']=new Ms(),this['aiResponseApplier']=new xs(),this['documentContextContent']=new Map(_0x3eb1a7?.['map'](_0x398a52=>[_0x398a52['id'],Is(_0x398a52['content'])])||[]),this['_documentIdToSource']=new Map(_0x3eb1a7?.['map'](_0x4f92c0=>[_0x4f92c0['id'],{'editor':_0x390b6d['get'](_0x4f92c0['channelId']),'rootName':_0x4f92c0['rootName']}])||[]),this['set']('isDone',_0x1002ac),this['set']('isComplete',_0xa243aa??_0x1002ac),'text'===this['type']&&this['content']['set']('text','');}['appendContent'](_0x4328b2,_0x5d2875){const _0x54416e='text'===this['type']?'text':_0x5d2875;this['content']['has'](_0x54416e)||this['content']['set'](_0x54416e,''),this['content']['set'](_0x54416e,this['content']['get'](_0x54416e)+_0x4328b2),this['onContentChange'](_0x54416e);}['done'](_0x4a675f=!0x0){this['isComplete']=_0x4a675f,this['isDone']||(this['set']('isDone',!0x0),this['onContentChange']());}['destroy'](){this['stopListening']();}['setChangeGroupState'](_0x22d39c,_0x94c6b7){this['changeGroups'][_0x22d39c]['state']=_0x94c6b7,this['fire']('replyChangeGroupStateUpdated',{'reply':this,'index':_0x22d39c,'state':_0x94c6b7});}['getContentParts']({showDiff:_0xde0875,groupIndex:_0x480c76}){const _0x3d741b=this['_getCachedContentParts'](_0xde0875,_0x480c76);if(_0x3d741b)return _0x3d741b;let _0x6b569a=[];if(void 0x0===_0x480c76)_0x6b569a=this['changeGroups'];else{const _0x59f0f2=this['changeGroups']['find'](({index:_0x392009})=>_0x392009===_0x480c76);if(!_0x59f0f2)throw new at('ai-reply-get-content-parts-group-not-found',null,{'aiReply':this,'groupIndex':_0x480c76});_0x6b569a=[_0x59f0f2];}const _0xe02da1=Us({'showDiff':_0xde0875,'changeGroups':_0x6b569a,'documentContextContent':this['documentContextContent']});return this['_setCachedContentParts'](_0xde0875,_0xe02da1),_0xe02da1;}['_getCachedContentParts'](_0x17b490,_0x54d352){const _0x1de790=_0x17b490?'withDiff':'withoutDiff';if(!this['cachedSuggestionContentParts'][_0x1de790]['length'])return null;const _0x5ede49=this['cachedSuggestionContentParts'][_0x1de790];if(void 0x0===_0x54d352)return _0x5ede49['length']>0x0&&_0x5ede49['length']!==this['changeGroups']['length']?(this['_setCachedContentParts'](_0x17b490,null),null):_0x35eb29(_0x5ede49);{const _0xdacaba=_0x5ede49['find'](({index:_0x2aea21})=>_0x2aea21===_0x54d352);if(_0xdacaba)return[_0x35eb29(_0xdacaba)];}return null;}['_setCachedContentParts'](_0x3e4fdc,_0x207d8a){const _0xe047d4=_0x3e4fdc?'withDiff':'withoutDiff';_0x207d8a?_0x207d8a['forEach'](_0x345fe9=>{const _0x2614f8=this['cachedSuggestionContentParts'][_0xe047d4],_0x1b0cef=_0x2614f8['find'](({index:_0x2ebb2c})=>_0x2ebb2c===_0x345fe9['index']);if(_0x1b0cef){const _0x247547=_0x2614f8['indexOf'](_0x1b0cef);_0x2614f8['splice'](_0x247547,0x1,_0x345fe9);}else _0x2614f8['push'](_0x345fe9);}):this['cachedSuggestionContentParts'][_0xe047d4]['length']=0x0;}['onContentChange'](_0x27ec3b){if('modification'===this['type']){if(_0x27ec3b)this['parsedContent']['set'](_0x27ec3b,this['aiResponseParser']['parseAndNormalizeHTML'](this['content']['get'](_0x27ec3b)));else{for(const [_0x5a83c8,_0x587251]of this['content'])this['parsedContent']['set'](_0x5a83c8,this['aiResponseParser']['parseAndNormalizeHTML'](_0x587251));}const _0x571879=this['changeGroups'];for(const _0x106cbb of this['content']['keys']())this['updateChangeGroups'](_0x106cbb);const _0xca1491=this['_getDifferentChangeGroups'](_0x571879,this['changeGroups']);(_0xca1491['length']||this['isDone'])&&(this['fire']('replyContentUpdated',this,_0xca1491),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'](_0x24f974,_0x1d16c3){const _0x2efe6d=[];for(const _0x2dd538 of _0x1d16c3){const _0x4e09d4=_0x24f974[_0x2dd538['index']];_0x4e09d4?_0x4e09d4['changes']['length']!==_0x2dd538['changes']['length']?_0x2efe6d['push'](_0x2dd538):_0x4e09d4['changes']['forEach']((_0x44a2fd,_0x2283a2)=>{const _0x591b41=_0x2dd538['changes'][_0x2283a2];_0x44a2fd['id']!==_0x591b41['id']&&_0x2efe6d['push'](_0x2dd538);}):_0x2efe6d['push'](_0x2dd538);}return _0x2efe6d;}['updateChangeGroups'](_0x2373c9){const _0x2ac5c8=this['documentContextContent']['get'](_0x2373c9),_0x1b8164=this['parsedContent']['get'](_0x2373c9);if(!_0x2ac5c8||!_0x1b8164)return;const _0xe7284c=new _0x19163f('p',{},[new _0x19163f('span',{'style':'color:\x20#808080;\x20font-style:\x20italic'},[new _0x297122(ls(this['locale'],'AI_SUGGESTION_CONTENT_PART_REMOVED'))])]),_0x2ee918=this['aiResponseApplier']['merge'](_0x1b8164,_0x2ac5c8['cloneNode'](!0x0),{'cutAfterUnstable':!this['isDone']||!this['isComplete'],'replaceRemovedWith':_0xe7284c});this['parsedMergedContent']['set'](_0x2373c9,_0x2ee918['parsedContent']);let _0x513892=[];if(_0x269094(_0x4744f4=>{const _0x24ff6a=Cs(_0x4744f4,'data-id');if(!_0x24ff6a||!_0x264fe0(_0x24ff6a))return!0x1;const _0x346560=[_0x4744f4,...Ss(_0x4744f4)]['at'](-0x2);if(_0x4744f4!=_0x346560){const _0x54d835=Cs(_0x346560,'data-id');_0x264fe0(_0x54d835)||(_0x513892['push']({'node':_0x346560,'id':_0x54d835,'type':'modified'}),_0x2ee918['modifiedNodeIds']['push'](_0x54d835));}else _0x2ee918['modifiedNodeIds']['includes'](_0x24ff6a)?_0x513892['push']({'node':_0x4744f4,'type':'modified','id':_0x24ff6a}):_0x2ee918['newNodeIds']['includes'](_0x24ff6a)?_0x513892['push']({'node':_0x4744f4,'type':'new','id':_0x24ff6a,'anchorId':Cs(_0x4744f4['previousSibling'],'data-id')}):_0x513892['push']({'node':_0x4744f4,'type':'removed','id':_0x24ff6a});return!0x0;},this['parsedMergedContent']['get'](_0x2373c9)),_0x513892=_0x513892['filter'](({node:_0x223079})=>[...Ss(_0x223079),_0x223079]['every'](_0x439634=>!Cs(_0x439634,'data-unstable'))),this['changeGroups']=this['changeGroups']['filter'](_0x3b0ac9=>_0x3b0ac9['documentId']!==_0x2373c9),0x0==_0x513892['length'])return;const _0x5c6884=[[_0x513892[0x0]]];for(let _0x2cebc0=0x1;_0x2cebc0<_0x513892['length'];_0x2cebc0++){const _0xe3dd68=_0x5c6884[_0x5c6884['length']-0x1],_0x38eaf0=_0xe3dd68[_0xe3dd68['length']-0x1];_0x513892[_0x2cebc0]['node']['previousSibling']==_0x38eaf0['node']&&'modified'!=_0x513892[_0x2cebc0]['type']&&'modified'!=_0x38eaf0['type']?_0xe3dd68['push'](_0x513892[_0x2cebc0]):_0x5c6884['push']([_0x513892[_0x2cebc0]]);}for(const _0x246765 of _0x5c6884){const _0x5d2a83=_0x246765[0x0],_0x1a9385=_0x246765[_0x246765['length']-0x1],_0x3accb2=_0x3f6c21(_0x5d2a83['node']['previousSibling']);_0x3accb2&&_0x246765['unshift'](_0x3accb2);const _0x3b1bf0=_0x3f6c21(_0x1a9385['node']['nextSibling']);_0x3b1bf0&&_0x246765['push'](_0x3b1bf0);}Es('data-wrapped-id',null,this['parsedMergedContent']['get'](_0x2373c9))['forEach'](_0x2c11f4=>{fs(_0x2c11f4,'data-wrapped-id',null);});const _0x10c740=new Map();Es('data-unwrapped-id',null,this['parsedMergedContent']['get'](_0x2373c9))['forEach'](_0x17f42f=>{const _0x5b0a38=Cs(_0x17f42f,'data-unwrapped-id'),_0x4f269f=Cs(_0x17f42f,'data-id');_0x10c740['set'](_0x4f269f,_0x5b0a38),fs(_0x17f42f,'data-id',_0x5b0a38),fs(_0x17f42f,'data-unwrapped-id',null);});for(const _0x30b7ae of _0x513892){const _0xe3b15b=_0x10c740['get'](_0x30b7ae['id']);_0xe3b15b&&(_0x30b7ae['id']=_0xe3b15b);}this['changeGroups']['push'](..._0x5c6884['map']((_0x260c55,_0x18d049)=>({'changes':_0x260c55,'state':'pending','index':_0x18d049,'editor':this['_documentIdToSource']['get'](_0x2373c9)['editor'],'rootName':this['_documentIdToSource']['get'](_0x2373c9)['rootName'],'documentId':_0x2373c9})));const _0x932cc4=Array['from'](this['documentContextContent']['keys']());function _0x264fe0(_0x47fdf4){return _0x2ee918['modifiedNodeIds']['includes'](_0x47fdf4)||_0x2ee918['newNodeIds']['includes'](_0x47fdf4)||_0x2ee918['removedNodeIds']['includes'](_0x47fdf4);}function _0x3f6c21(_0x12077f){if(_0x12077f&&Cs(_0x12077f,'data-id')&&!Cs(_0x12077f,'data-unstable')){const _0x41ee79=Cs(_0x12077f,'data-id');if(!_0x264fe0(_0x41ee79))return{'node':_0x12077f,'type':'context','id':_0x41ee79};}return null;}this['changeGroups']['sort']((_0x47fcb6,_0x1846f1)=>_0x932cc4['indexOf'](_0x47fcb6['documentId'])-_0x932cc4['indexOf'](_0x1846f1['documentId'])),this['changeGroups']['forEach']((_0x2461f2,_0x4aa5d6)=>{_0x2461f2['index']=_0x4aa5d6;});}};const gn=/* #__PURE__ -- @preserve */
|
|
29
|
+
lt(),An=['interactionCreated','interactionStarted','interactionStopped','interactionFinished','interactionDestroyed','replyCreated','replyContentUpdated','replyChangeGroupStateUpdated','setConversationTitle','webSearchStarted','webSearchFinished','reasoningStarted','reasoningFinished','toolDataReceived','error'];var In=class extends gn{['id'];['replies']=[];['currentReply'];['messageId'];['actionCallId'];['currentRequest'];['connector'];['isStopped']=!0x1;['isDestroyed']=!0x1;['locale'];['_isReasoning']=!0x1;['_isWebSearching']=!0x1;['_channelsToEditors'];constructor({connector:_0x3efed2,locale:_0x426a5f,channelsToEditors:_0x1fdf1f}){super(),this['id']=Ot(),this['connector']=_0x3efed2,this['isStopped']=!0x0,this['locale']=_0x426a5f,this['_channelsToEditors']=_0x1fdf1f||new Map();}async['start'](){await this['_run']();}async['resume'](_0x388f5c){await this['_run'](_0x388f5c);}async['_run'](_0xff4678){const _0x31e126=[];let _0x524c8a,_0x577f64,_0x19ae6d,_0x6c6af7=!0x1;this['isStopped']=!0x1;try{this['currentRequest']=_0xff4678||await this['sendRequest'](),this['fire']('interactionStarted',this);const _0x5ce13a=await this['currentRequest']['getStream']();for await(const _0x3535e3 of _0x5ce13a){if(this['isStopped'])return;if('error'==_0x3535e3['event'])return void this['fire']('error',{'error':new at('ai-chat-interaction-error',this)});switch(_0x3535e3['event']){case'message-metadata':this['messageId']=_0x3535e3['data']['messageId'];break;case'action-metadata':this['actionCallId']=_0x3535e3['data']['callId'];break;case'conversation-title':this['setConversationTitle'](_0x3535e3['data']['conversationTitle'],!0x0);break;case'source':_0x31e126['push'](_0x3535e3['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'](),_0x524c8a='modification-delta'==_0x3535e3['event']?'modification':'text',_0x577f64='modification-delta'==_0x3535e3['event']?_0x3535e3['data']['id']:void 0x0,this['currentReply']&&this['currentReply']['type']!=_0x524c8a&&(this['currentReply']['done'](),this['currentReply']=void 0x0),this['currentReply']||(this['currentReply']=this['createReply']({'type':_0x524c8a,'interactionId':this['id'],'id':_0x577f64,'channelsToEditors':this['_channelsToEditors'],...'modification-delta'==_0x3535e3['event']&&{'documentId':_0x3535e3['data']['documentId']}}),'modification'==_0x524c8a&&(this['currentReply']['sources']=_0x31e126['splice'](0x0))),this['currentReply']['appendContent'](_0x3535e3['data']['textDelta'],_0x3535e3['data']['documentId']);break;case'mcp-tool-result':_0x19ae6d=JSON['parse'](_0x3535e3['data']['result']),this['_handleToolResultData']({'toolName':_0x3535e3['data']['toolName'],'data':_0x19ae6d['data'],'attributes':_0x19ae6d['attributes']});break;case'mcp-tool-notification':this['_handleToolNotificationData']({'toolName':_0x3535e3['data']['toolName'],'data':_0x3535e3['data']['data']});}}_0x6c6af7=!0x0;}finally{this['isStopped']||(this['currentReply']&&_0x31e126['length']>0x0&&(this['currentReply']['sources']=_0x31e126['splice'](0x0)),this['_finalizeInteraction'](_0x6c6af7),this['fire']('interactionFinished',this));}}['stop'](){this['isStopped']||(this['_finalizeInteraction'](),this['fire']('interactionStopped',this));}['getReply'](_0x559ec0){return this['replies']['find'](_0x116c40=>_0x116c40['id']===_0x559ec0);}['destroy'](){this['isDestroyed']||(this['stop'](),this['replies']['forEach'](_0x58eedd=>_0x58eedd['destroy']()),this['replies']=[],this['isDestroyed']=!0x0,this['fire']('interactionDestroyed',this),this['stopListening']());}['createReply'](_0xa4546a){const _0x49d36f=this['getDocumentContext'](),_0x51b2c5=new _n({'locale':this['locale'],'documentContextContent':_0x49d36f?.['documents'],..._0xa4546a});return this['replies']['push'](_0x51b2c5),_0x51b2c5['delegate'](...An)['to'](this),this['fire']('replyCreated',_0x51b2c5),_0x51b2c5;}['setConversationTitle'](_0x398dbf,_0x415098=!0x1){this['fire']('setConversationTitle',_0x398dbf,_0x415098);}['resetWebSearchState'](){this['_isWebSearching']&&(this['_isWebSearching']=!0x1,this['fire']('webSearchFinished',this));}['resetReasoningState'](){this['_isReasoning']&&(this['_isReasoning']=!0x1,this['fire']('reasoningFinished',this));}['_handleToolResultData'](_0x34cabf){this['fire']('toolDataReceived',{'type':'result','toolName':_0x34cabf['toolName'],'data':structuredClone(_0x34cabf['data']||{}),'attributes':structuredClone(_0x34cabf['attributes']||{})},this);}['_handleToolNotificationData'](_0x269fb6){this['fire']('toolDataReceived',{'type':'notification','toolName':_0x269fb6['toolName'],'data':structuredClone(_0x269fb6['data'])},this);}['_finalizeInteraction'](_0x293fef=!0x1){this['isStopped']=!0x0,this['currentRequest']&&this['currentRequest']['abortController']['abort'](),this['currentReply']&&this['currentReply']['done'](_0x293fef),this['currentRequest']=this['currentReply']=void 0x0;}};const pn=new Map([['usage-limits-exceeded','ai-usage-limits-exceeded'],['rate-limits-exceeded','ai-rate-limits-exceeded'],['invalid-content-type','ai-invalid-content-type'],['invalid-request-data','ai-chat-invalid-request'],['model-already-set','ai-chat-model-already-set'],['model-not-found','ai-chat-model-not-found'],['unsafe-content-detected','ai-chat-unsafe-content-detected'],['unsupported-content-type','ai-chat-unsupported-content-type'],['content-too-large','ai-chat-content-too-large'],['unsupported-file-type','ai-chat-context-unsupported-file-type'],['file-too-large','ai-chat-context-file-too-large'],['file-too-many-pages','ai-chat-context-file-too-many-pages'],['form-data-size-limits-exceeded','ai-chat-context-form-data-size-limits-exceeded']]),mn=/* #__PURE__ -- @preserve */
|
|
30
|
+
_t(),En=['contextItemAdded','contextItemRemoved','contextItemLoadingEnded','contextSent','error','addContextOptionsChanged','sourceResourcesLoaded','resourceStateChanged','uploadProgressChanged'];var Tn=class AIChatContext extends mn{['_connector'];['_config'];['_ownerId'];constructor({connector:_0x4086aa,config:_0x25eed8,ownerId:_0x12e31c}){super(),this['_connector']=_0x4086aa,this['_config']=_0x25eed8,this['_ownerId']=_0x12e31c;}['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'](_0x13bcb3,_0x370044){const _0x37759a=new Map(),{contextItem:_0x3b27dd,hasUnmatched:_0x4bbf8f}=await this['_populateDocumentContextItem'](_0x13bcb3,_0x370044);_0x3b27dd&&_0x37759a['set'](_0x3b27dd['id'],_0x3b27dd);for(const _0x4602d9 of _0x13bcb3){if('document'===_0x4602d9['type'])continue;const _0x4c0557=await this['_createContextItemFromContent'](_0x4602d9);this['_addToConversationContextItem'](_0x4c0557),_0x37759a['set'](_0x4c0557['id'],_0x4c0557);}return{'contextItems':_0x37759a,'hasUnmatched':_0x4bbf8f};}async['_populateDocumentContextItem'](_0x4240f2,_0x2e567f){const _0x3badf8=_0x4240f2['filter'](_0x3e804e=>'document'===_0x3e804e['type']);if(0x0===_0x3badf8['length'])return{'hasUnmatched':!0x1};const _0xda889d=_0x3badf8['map'](_0xb2f93c=>_0xb2f93c['id']),_0x533b09=await this['_connector']['fetchDocuments'](this['_ownerId'],_0xda889d)['getDocuments'](),_0x4c5b0a=new Map(_0x533b09['map'](_0x225095=>[_0x225095['id'],_0x225095])),_0x30478d=[];let _0x5811e9=!0x1;for(const _0x49771b of _0x3badf8){const _0x5dda8f=_0x4c5b0a['get'](_0x49771b['id']);_0x5dda8f&&(this['_matchDocumentToRoot'](_0x5dda8f,_0x2e567f)||(_0x5811e9=!0x0),_0x30478d['push']({'id':_0x5dda8f['id'],'content':_0x5dda8f['content'],'version':_0x5dda8f['attributes']?.['version']??0x0,'sessionId':_0x5dda8f['attributes']?.['sessionId']??null,'selection':[],'channelId':_0x5dda8f['attributes']?.['channelId']??_0x2e567f[0x0]?.['config']['get']('collaboration.channelId')??'','rootName':_0x5dda8f['attributes']?.['rootName']??_0x2e567f[0x0]?.['model']['document']['getRoots']()[0x0]['rootName']??''}));}const _0x2edb7b={'id':'current-document','uiId':'current-document','label':'Current\x20document','type':'document','hidden':this['_conversationContextItems']['has']('current-document'),'documents':_0x30478d};return this['_addToConversationContextItem'](_0x2edb7b),this['toggleAddCurrentDocumentOptionVisibility'](),{'contextItem':_0x2edb7b,'hasUnmatched':_0x5811e9};}['_matchDocumentToRoot'](_0x1acd91,_0x3df302){const _0x65e6fd=_0x1acd91['attributes']?.['channelId'],_0x1cc46f=_0x1acd91['attributes']?.['rootName'];if(_0x65e6fd&&_0x1cc46f){for(const _0x78e90b of _0x3df302)if(_0x78e90b['config']['get']('collaboration.channelId')===_0x65e6fd){for(const _0x1789c6 of _0x78e90b['model']['document']['getRoots']())if('$graveyard'!==_0x1789c6['rootName']&&_0x1789c6['rootName']===_0x1cc46f)return{'editor':_0x78e90b,'rootName':_0x1789c6['rootName']};}}}async['_createContextItemFromContent'](_0x1538b2){return'mcp-tool-context'===_0x1538b2['type']?{'id':_0x1538b2['id'],'uiId':_0x1538b2['id'],'label':_0x1538b2['data']?.['label']||_0x1538b2['id'],'type':'mcp-tool-context','mcpServerName':_0x1538b2['mcpServerName'],'toolName':_0x1538b2['toolName'],'data':_0x1538b2['data']||{}}:{'id':_0x1538b2['id'],'uiId':_0x1538b2['id'],'label':_0x1538b2['attributes']?.['label']||_0x1538b2['name']||_0x1538b2['url']||_0x1538b2['id'],'type':_0x1538b2['type'],..._0x1538b2?.['attributes']?.['resourceId']?{'resourceId':_0x1538b2['attributes']?.['resourceId']}:{}};}['getSentContextItems'](){return new Map(this['_conversationContextItems']);}['removeFromContext'](_0x3ba3cb){this['_pendingContextItems']['get'](_0x3ba3cb)?.['isReadOnly']||this['_removeContextItem'](_0x3ba3cb);}['clearPendingContextItems'](){if(0x0===this['_pendingContextItems']['size'])return;for(const _0xbc1451 of this['_pendingContextItems']['values']())this['_removeContextItem'](_0xbc1451['uiId']);const _0x301754=this['_conversationContextItems']['get']('current-document')||this['_pendingContextItems']['get']('current-document');_0x301754&&this['_addContextItem']({..._0x301754,'isReadOnly':!0x0,'hidden':!0x0});}['addToConversationContext'](_0x3526a0){for(const _0x514cf0 of _0x3526a0['values']())this['_addToConversationContextItem'](_0x514cf0);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'](_0x5edf9e){return Array['from'](_0x5edf9e['values']())['flatMap'](_0x203b51=>this['_mapContextItemToRequestData'](_0x203b51));}async['addFilesToContext'](_0x51217d,_0x586b32,_0x4e2be0='file'){const _0x1603d3='files-'+Ot();this['_startUploadOperation'](_0x1603d3);try{await Promise['all'](_0x51217d['map'](async _0x14f37b=>{const _0x4a60ac='file-'+Ot(),_0x3aea2c=_0x9a78d5(_0x14f37b['name']),_0x290c47='file'===_0x4e2be0&&_0x14f37b['type']['startsWith']('image/')?'image':_0x4e2be0;try{this['_addContextItem']({'type':_0x290c47,'label':_0x586b32?.['label']||_0x3aea2c,'uiId':_0x4a60ac,'resourceId':_0x586b32?.['resourceId']},!0x0);const _0x5e7fc2=this['_connector']['uploadFile'](this['_ownerId'],_0x14f37b,_0x586b32);this['_ongoingUploads']['set'](_0x4a60ac,_0x5e7fc2['abortController']);const {id:_0x2820b4}=await _0x5e7fc2['getId']();this['_ongoingUploads']['delete'](_0x4a60ac),this['_finishContextItemLoading']({'type':_0x290c47,'id':_0x2820b4,'label':_0x586b32?.['label']||_0x3aea2c,'uiId':_0x4a60ac,'resourceId':_0x586b32?.['resourceId']},!0x1);}catch(_0xdccd26){if(this['_ongoingUploads']['delete'](_0x4a60ac),!sn(_0xdccd26)){const _0x44d74b=new nn({'code':pn['get'](_0xdccd26['code'])||'ai-chat-file-upload-failed','cause':_0xdccd26,'context':{'fileName':_0x3aea2c}});this['fire']('error',{'error':_0x44d74b});}this['_removeContextItem'](_0x4a60ac);}}));}finally{this['_finishUploadOperation'](_0x1603d3);}}['addCurrentDocumentToContext'](_0x3bf271){if(this['isCurrentDocumentInContext']()||!this['_addContextOptionsState']['document']['enabled'])return;const _0x1a921c={'type':'document','uiId':'current-document','label':_0x3bf271,'isReadOnly':this['_conversationContextItems']['has']('current-document'),'hidden':this['_conversationContextItems']['has']('current-document')};this['_addContextItem'](_0x1a921c);}async['updateCurrentDocuments'](_0x44655b){const _0x486e9f=this['_pendingContextItems']['get']('current-document');if(!_0x486e9f||!_0x44655b['length']||_0x44655b['every'](_0x599ced=>!_0x599ced['content']))return;_0x44655b['length']>0x1&&_0x44655b['some'](_0x3d2047=>!_0x3d2047['description'])&&ft('ai-chat-documents-missing-description');try{const _0x8eed9d=await this['_connector']['uploadDocuments'](this['_ownerId'],_0x44655b)['getIds']();if(_0x8eed9d['length']!==_0x44655b['length']||_0x8eed9d['some'](_0x9e594=>!_0x9e594?.['id'])){const _0x53e705=new at('ai-chat-document-upload-reply-mismatch',null);return void this['fire']('error',{'error':_0x53e705});}_0x486e9f['documents']=_0x44655b['map']((_0x30c3a3,_0x145eee)=>{return{'id':_0x8eed9d[_0x145eee]['id'],'content':_0x30c3a3['content'],'version':_0x30c3a3['version'],'sessionId':_0x30c3a3['sessionId'],'selection':(_0x6be76b=_0x30c3a3['selections'],_0x6be76b?_0x6be76b['map'](_0xb9dde9=>({'start':_0xb9dde9['start'],'end':_0xb9dde9['end']})):[]),'channelId':_0x30c3a3['channelId'],'rootName':_0x30c3a3['rootName']};var _0x6be76b;});}catch(_0x45404b){const _0x470c0f=new nn({'code':'ai-chat-document-upload-failed','type':'network','cause':_0x45404b});this['fire']('error',{'error':_0x470c0f});}}['addSelectionToContext'](_0x2632d5){this['_addContextItem']({'type':'selection','label':_0x2632d5,'uiId':'selection','content':_0x2632d5});}['removeSelectionFromContext'](){this['_removeContextItem']('selection');}async['addUrlToContext'](_0x150ba7,_0x583287){const _0x4ff531='url-'+Ot();this['_startUploadOperation'](_0x4ff531);const _0x53c7f8='url-'+Ot();try{this['_addContextItem']({'type':'web-resource','label':_0x583287?.['label']||_0x150ba7,'uiId':_0x53c7f8,'resourceId':_0x583287?.['resourceId']},!0x0);const _0x1b20af=this['_connector']['uploadUrl'](this['_ownerId'],_0x150ba7,_0x583287);this['_ongoingUploads']['set'](_0x53c7f8,_0x1b20af['abortController']);const {id:_0x5c5255}=await _0x1b20af['getId']();this['_ongoingUploads']['delete'](_0x53c7f8),this['_finishContextItemLoading']({'type':'web-resource','id':_0x5c5255,'label':_0x583287?.['label']||_0x150ba7,'uiId':_0x53c7f8,'resourceId':_0x583287?.['resourceId']},!0x1);}catch(_0x47fdf){this['_ongoingUploads']['delete'](_0x53c7f8),sn(_0x47fdf)||this['fire']('error',{'error':new at('ai-chat-url-upload-failed',this,{'url':_0x150ba7,'originalError':_0x47fdf}),'url':_0x150ba7}),this['_removeContextItem'](_0x53c7f8);}finally{this['_finishUploadOperation'](_0x4ff531);}}['addToolItemToContext'](_0x2d2b43){_0x2d2b43['id']=_0x2d2b43['id']??Ot()['substring'](0x0,0x15),this['_pendingContextItems']['set'](_0x2d2b43['uiId'],_0x2d2b43),this['fire']('contextItemAdded',{'contextItem':_0x2d2b43,'isLoading':!0x1});}async['loadSourceResources'](_0xae7bf4,_0xf71043,_0x4ef15b){const _0x14e9b5=this['_addContextOptionsState']['sources']['find'](_0x1a888d=>_0x1a888d['id']===_0xae7bf4);if(!_0x14e9b5)return this['fire']('error',{'error':new at('ai-chat-source-not-found',this,{'sourceId':_0xae7bf4}),'sourceId':_0xae7bf4}),[];try{const _0x387dcd=(await _0x14e9b5['getResources'](_0xf71043))['map'](_0x38d473=>{const _0xc5b532=this['_isResourceInContext'](_0x38d473['id']);return{..._0x38d473,'isInContext':_0xc5b532};});return _0x14e9b5['resources']=_0x387dcd,this['fire']('sourceResourcesLoaded',{'sourceId':_0xae7bf4,'source':_0x14e9b5,'resources':_0x387dcd,'uid':_0x4ef15b}),_0x387dcd;}catch(_0x4c4f64){return this['fire']('error',{'error':new at('ai-chat-source-resources-load-failed',this,{'sourceId':_0xae7bf4,'originalError':_0x4c4f64}),'sourceId':_0xae7bf4,'sourceLabel':_0x14e9b5['label']}),[];}}async['addResourceToContext'](_0x3a693f,_0x4a9f37){if(this['_isResourceInContext'](_0x4a9f37['id']))return;let _0x1660d0=_0x4a9f37['data'];if(!_0x1660d0&&_0x3a693f['getData'])try{_0x1660d0=await _0x3a693f['getData'](_0x4a9f37['id']);}catch(_0x2d43b0){return void this['fire']('error',{'error':new at('ai-chat-resource-load-failed',this,{'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id'],'originalError':_0x2d43b0}),'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id']});}if(_0x1660d0)switch(_0x4a9f37['type']){case'web-resource':if('string'!=typeof _0x1660d0)return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id'],'expectedType':'string','actualType':typeof _0x1660d0}),'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id']});await this['addUrlToContext'](_0x1660d0,{'label':_0x4a9f37['label'],'resourceId':_0x4a9f37['id']});break;case'file':if(!(_0x1660d0 instanceof File))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id'],'expectedType':'File','actualType':typeof _0x1660d0}),'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id']});await this['addFilesToContext']([_0x1660d0],{'label':_0x4a9f37['label'],'resourceId':_0x4a9f37['id']});break;case'text':if('object'!=typeof _0x1660d0||!('content'in _0x1660d0)||!('type'in _0x1660d0))return void this['fire']('error',{'error':new at('ai-chat-context-invalid-data',this,{'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id'],'expectedType':'object\x20with\x20content\x20and\x20type\x20properties','actualType':typeof _0x1660d0}),'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id']});_0x1660d0=AIChatContext['_convertTextResourceToFile'](_0x1660d0,_0x4a9f37['label']),await this['addFilesToContext']([_0x1660d0],{'label':_0x4a9f37['label'],'resourceId':_0x4a9f37['id']},'text');break;case'mcp-tool-context':break;default:this['fire']('error',{'error':new at('ai-chat-context-unsupported-type',this,{'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id'],'resourceType':_0x4a9f37['type']}),'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id']});}else this['fire']('error',{'error':new at('ai-chat-resource-no-data',this,{'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id']}),'resourceId':_0x4a9f37['id'],'sourceId':_0x3a693f['id']});}['toggleAddCurrentDocumentOptionVisibility'](_0x44c9da){if(void 0x0!==_0x44c9da)this['_addContextOptionsState']['document']['isHidden']=!_0x44c9da;else{const _0x513811=this['isCurrentDocumentInContext']()||this['isCurrentDocumentInConversation']();this['_addContextOptionsState']['document']['isHidden']=_0x513811;}this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}static['_convertTextResourceToFile'](_0x2429a3,_0x51d410){switch(_0x2429a3['type']){case'markdown':return new File([_0x2429a3['content']],_0x51d410,{'type':'text/markdown'});case'html':return new File([_0x2429a3['content']],_0x51d410,{'type':'text/html'});default:return new File([_0x2429a3['content']],_0x51d410,{'type':'text/plain'});}}static['_mapContextItemToRequestData'](_0x3f860b){switch(_0x3f860b['type']){case'file':case'image':case'text':return[{'type':'file','id':_0x3f860b['id']}];case'web-resource':return[{'type':'web-resource','id':_0x3f860b['id']}];case'document':return _0x3f860b['documents']?.['length']?_0x3f860b['documents']['map'](_0x118d9e=>({'type':'document','id':_0x118d9e['id'],..._0x118d9e['selection']?.['length']&&{'selection':_0x118d9e['selection']}})):[];case'mcp-tool-context':{const _0x5e6605=_0x3f860b;return[{'type':'mcp-tool-context','mcpServerName':_0x5e6605['mcpServerName'],'toolName':_0x5e6605['toolName'],'data':{..._0x5e6605['data'],'label':_0x5e6605['label']||_0x5e6605['data']?.['label']||_0x5e6605['id']},'id':_0x5e6605['id']}];}default:return[];}}['_addContextItem'](_0x2c86a7,_0x442f3e=!0x1){if(this['_pendingContextItems']['set'](_0x2c86a7['uiId'],_0x2c86a7),_0x2c86a7['hidden']||this['fire']('contextItemAdded',{'contextItem':_0x2c86a7,'isLoading':_0x442f3e}),'current-document'===_0x2c86a7['uiId']&&this['toggleAddCurrentDocumentOptionVisibility'](),_0x2c86a7['resourceId']){const _0x361261=this['_findSourceIdsByResourceId'](_0x2c86a7['resourceId']);_0x361261&&_0x361261['forEach'](_0x2fcad7=>{this['_updateResourceInContextState'](_0x2fcad7,_0x2c86a7['resourceId'],!0x0);});}}['_removeContextItem'](_0x3a70df){const _0x13df19=this['_pendingContextItems']['get'](_0x3a70df),_0x3cc84d=this['_ongoingUploads']['get'](_0x3a70df);if(_0x3cc84d&&(_0x3cc84d['abort'](),this['_ongoingUploads']['delete'](_0x3a70df)),_0x13df19?.['resourceId']){const _0x40189a=this['_findSourceIdsByResourceId'](_0x13df19['resourceId']);_0x40189a&&_0x40189a['forEach'](_0x3871ee=>{this['_updateResourceInContextState'](_0x3871ee,_0x13df19['resourceId'],!0x1);});}this['_pendingContextItems']['delete'](_0x3a70df),this['fire']('contextItemRemoved',{'uiId':_0x3a70df,'type':_0x13df19?.['type']}),'current-document'===_0x3a70df&&this['toggleAddCurrentDocumentOptionVisibility']();}['_finishContextItemLoading'](_0x421be1,_0x5d1e4c){if(this['_pendingContextItems']['has'](_0x421be1['uiId'])&&(this['_pendingContextItems']['set'](_0x421be1['uiId'],_0x421be1),this['fire']('contextItemLoadingEnded',{'contextItem':_0x421be1,'isLoading':_0x5d1e4c}),_0x421be1['resourceId'])){const _0x1f98e3=this['_findSourceIdsByResourceId'](_0x421be1['resourceId']);_0x1f98e3&&_0x1f98e3['forEach'](_0x39dc8c=>{this['_updateResourceInContextState'](_0x39dc8c,_0x421be1['resourceId'],!0x0);});}}['_addToConversationContextItem'](_0x42183e){this['_conversationContextItems']['set'](_0x42183e['uiId'],_0x42183e);}['_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'](_0x57a847=>({..._0x57a847,'enabled':!0x0}))??[]},this['fire']('addContextOptionsChanged',{'options':this['_addContextOptionsState']});}['_getCustomSourcesInitialState'](){return this['_config']?.['sources']?.['map'](_0x1d8b04=>({..._0x1d8b04,'resources':[]}))??[];}['_isResourceInContext'](_0x3f5b64){for(const _0x7d5a09 of this['_pendingContextItems']['values']())if(_0x7d5a09['resourceId']===_0x3f5b64)return!0x0;for(const _0x3abee3 of this['_conversationContextItems']['values']())if(_0x3abee3['resourceId']===_0x3f5b64)return!0x0;return!0x1;}['_findSourceIdsByResourceId'](_0x2a37df){const _0x4bd0d0=[];for(const _0x2fa0e5 of this['_addContextOptionsState']['sources'])_0x2fa0e5['resources']['find'](_0x2a3153=>_0x2a3153['id']===_0x2a37df)&&_0x4bd0d0['push'](_0x2fa0e5['id']);return 0x0===_0x4bd0d0['length']?null:_0x4bd0d0;}['_updateResourceInContextState'](_0x12b24d,_0x566550,_0x5f5710){const _0x538ddd=this['_addContextOptionsState']['sources']['find'](_0x1aa672=>_0x1aa672['id']===_0x12b24d);if(!_0x538ddd)return;const _0x1cf0ee=_0x538ddd['resources']['find'](_0xe7e944=>_0xe7e944['id']===_0x566550);_0x1cf0ee&&(_0x1cf0ee['isInContext']=_0x5f5710,this['fire']('resourceStateChanged',{'sourceId':_0x12b24d,'resourceId':_0x566550,'isInContext':_0x5f5710}));}['_startUploadOperation'](_0x55e7e9){this['_ongoingUploadOperations']['set'](_0x55e7e9,!0x0),this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x0});}['_finishUploadOperation'](_0x21d741){this['_ongoingUploadOperations']['delete'](_0x21d741),0x0===this['_ongoingUploadOperations']['size']&&this['fire']('uploadProgressChanged',{'isUploadInProgress':!0x1});}};const wn=/* #__PURE__ -- @preserve */
|
|
31
|
+
lt(),Cn=['capabilitiesUpdated'];var fn=class extends wn{['_isWebSearchEnabled'];['_isReasoningEnabled'];constructor(){super(),this['_isWebSearchEnabled']=!0x1,this['_isReasoningEnabled']=!0x1;}['init'](){this['reset']();}['reset'](){this['setWebSearch'](!0x1),this['setReasoning'](!0x1);}['getCapabilitiesConfig'](){return{'isWebSearchEnabled':this['_isWebSearchEnabled'],'isReasoningEnabled':this['_isReasoningEnabled']};}static['getCapabilitiesRequestData'](_0x28f320){const _0x2fad58={};return _0x28f320&&_0x28f320['isWebSearchEnabled']&&(_0x2fad58['webSearch']={}),_0x28f320&&_0x28f320['isReasoningEnabled']&&(_0x2fad58['reasoning']={}),_0x2fad58;}['toggleWebSearch'](){this['setWebSearch'](!this['_isWebSearchEnabled']);}['toggleReasoning'](){this['setReasoning'](!this['_isReasoningEnabled']);}['setWebSearch'](_0x379a79){_0x379a79!==this['_isWebSearchEnabled']&&(this['_isWebSearchEnabled']=_0x379a79,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}['setReasoning'](_0x28c525){_0x28c525!==this['_isReasoningEnabled']&&(this['_isReasoningEnabled']=_0x28c525,this['fire']('capabilitiesUpdated',this['getCapabilitiesConfig']()));}},bn=class extends In{['userMessage'];['conversationId'];['contextItems']=new Map();['capabilities'];['model'];['attributes'];constructor(_0x1a94f8){super(_0x1a94f8),this['conversationId']=_0x1a94f8['conversationId'],this['contextItems']=_0x1a94f8['contextItems'],this['capabilities']=_0x1a94f8['capabilities'],this['userMessage']=_0x1a94f8['userMessage'],this['model']=_0x1a94f8['model'],this['attributes']=_0x1a94f8['attributes'];}async['sendRequest'](){return this['connector']['queryAssistant']({'message':this['userMessage'],'conversationId':this['conversationId'],'parts':Tn['mapContextItemsToRequestData'](this['contextItems']),'capabilities':fn['getCapabilitiesRequestData'](this['capabilities']),'model':this['model'],'attributes':this['attributes']});}['getDocumentContext'](){return this['contextItems']['get']('current-document');}};const Sn=/* #__PURE__ -- @preserve */
|
|
32
|
+
lt();var Rn=class extends Sn{['id'];['isStarted']=!0x1;['isFromHistory'];['interactions']=[];['currentInteraction'];['selectedModel'];['connector'];['options'];['_channelsToEditors'];['_getSessionId'];constructor(_0x3e25e4){super(),this['options']=_0x3e25e4,this['connector']=_0x3e25e4['connector'],this['chatModels']=_0x3e25e4['chatModels'],this['id']=_0x3e25e4['conversationId'],this['isFromHistory']=_0x3e25e4['isFromHistory'],this['_channelsToEditors']=_0x3e25e4['channelsToEditors'],this['_getSessionId']=_0x3e25e4['getSessionId'];}async['init'](_0x471c6a){try{this['chatContext']=new Tn({'connector':this['connector'],'config':_0x471c6a,'ownerId':this['id']}),this['chatContext']['delegate'](...En)['to'](this),this['chatContext']['init'](),this['chatCapabilities']=new fn(),this['chatCapabilities']['delegate'](...Cn)['to'](this),this['chatCapabilities']['init']();const _0x49b89f=await this['chatModels']['getAvailableModels']();this['fire']('conversationInitialized',{'availableModels':_0x49b89f});const _0x44c7f9=await this['chatModels']['getModel'](this['options']['selectedModelId']);_0x44c7f9&&await this['setModel'](_0x44c7f9);}catch(_0x16494e){const _0x6dfd27=new nn({'code':'ai-chat-conversation-init-failed','cause':_0x16494e,'type':'network'});this['fire']('error',{'error':_0x6dfd27});}}async['start'](){if(this['isStarted'])throw new at('ai-chat-conversation-already-started',null,{'conversation':this});if(!this['selectedModel'])throw new at('ai-chat-conversation-start-no-model-selected',null,{'conversation':this});try{const {id:_0x1a1b7e}=await this['connector']['startConversation'](this['id'],this['options']['group'])['getConversation']();this['id']=_0x1a1b7e,this['isStarted']=!0x0,this['fire']('conversationStarted',{'conversationId':this['id'],'selectedModel':this['selectedModel']});}catch(_0x4602a7){const _0x2841ef=new nn({'code':'ai-chat-conversation-start-failed','cause':_0x4602a7,'type':'network','context':{'conversationId':this['id']}});throw this['fire']('error',{'error':_0x2841ef}),_0x2841ef;}}async['load'](_0xd15ff2){try{const _0x1080dd=await this['connector']['fetchConversation'](_0xd15ff2)['getConversation'](),_0x36029b=await this['connector']['fetchConversationMessages'](_0xd15ff2)['getMessages'](),_0x452f44=_0x36029b[0x0]['model'];this['isStarted']=!0x0,this['id']=_0x1080dd['id'],'title'in _0x1080dd?this['fire']('setConversationTitle',_0x1080dd['title'],!this['isFromHistory']):this['fire']('setConversationTitle','',!this['isFromHistory']);const _0x39bdb7=(await this['chatModels']['getAll']())['find'](_0x2182e7=>_0x2182e7['id']['toLowerCase']()===_0x452f44['toLowerCase']());this['selectedModel']=_0x39bdb7,this['fire']('modelSelected',{'selectedModel':_0x39bdb7,'isDisabled':!0x0});const {streamingMessageId:_0x415ea3}=await this['_processMessagesToInteractions'](_0x36029b,_0x452f44);return _0x415ea3&&this['currentInteraction']?this['_resumeStream'](_0x415ea3):this['currentInteraction']=void 0x0,this;}catch(_0x4e6b62){const _0x10ff59=new nn({'code':'ai-chat-conversation-init-from-id-failed','cause':_0x4e6b62,'type':'network','context':{'conversationId':_0xd15ff2}});throw this['fire']('error',{'error':_0x10ff59}),_0x10ff59;}}async['_processMessagesToInteractions'](_0x4fd3ab,_0xdd61ed){let _0x30c67b,_0x41f5e6,_0x160cba=!0x1;for(const _0x3c5b08 of _0x4fd3ab)if('user'===_0x3c5b08['role']){const {contextItems:_0x13fdd9,hasUnmatched:_0x49793c}=await this['_extractContextItems'](_0x3c5b08);_0x160cba=_0x49793c;const _0x1c23e7={'isReasoningEnabled':Object['hasOwn'](_0x3c5b08['capabilities'],'reasoning'),'isWebSearchEnabled':Object['hasOwn'](_0x3c5b08['capabilities'],'webSearch')};_0x30c67b=this['createInteraction']({'userMessage':_0x3c5b08['prompt'],'contextItems':_0x13fdd9,'capabilities':_0x1c23e7,'modelId':_0xdd61ed,'attributes':_0x3c5b08['attributes'],'channelsToEditors':this['_channelsToEditors']}),this['currentInteraction']=_0x30c67b,_0x41f5e6=void 0x0,this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}else{if('assistant'===_0x3c5b08['role']&&_0x30c67b){if('streaming'===_0x3c5b08['status']){_0x41f5e6=_0x3c5b08['id'];continue;}if('error'===_0x3c5b08['status'])continue;const _0xcbf59=[];for(const _0x476001 of _0x3c5b08['content'])switch(_0x476001['type']){case'text':case'modification':{const _0x39570d=_0x30c67b['getDocumentContext'](),_0x48aacf=this['_hasSessionMismatch'](_0x39570d)||_0x160cba;_0x30c67b['currentReply']?.['type']!==_0x476001['type']&&(_0x30c67b['currentReply']=_0x30c67b['createReply']({'type':_0x476001['type'],'isDone':!0x0,'interactionId':_0x30c67b['id'],'areActionsDisabled':_0x48aacf,'isFromHistory':!0x0,'channelsToEditors':this['_channelsToEditors']}),_0xcbf59['length']>0x0&&(_0x30c67b['currentReply']['sources']=_0xcbf59['splice'](0x0))),_0x30c67b['currentReply']['appendContent'](_0x476001['content'],_0x476001['documentId']);break;}case'url':_0xcbf59['push'](_0x476001);break;case'mcp-tool-result':{const {data:_0x6a1feb,attributes:_0x173072}=JSON['parse'](_0x476001['content']);_0x30c67b['_handleToolResultData']({'toolName':_0x476001['toolName'],'data':_0x6a1feb,'attributes':_0x173072});break;}}'cancelled'===_0x3c5b08['status']&&this['fire']('error',{'interactionId':_0x30c67b['id'],'error':new at('ai-request-aborted',this)});}}return{'streamingMessageId':_0x41f5e6};}async['_resumeStream'](_0x4c4a4a){if(this['currentInteraction'])try{const _0x55c57c=this['connector']['resumeStream'](this['id'],_0x4c4a4a);await this['currentInteraction']['resume'](_0x55c57c);}catch(_0x4fb4da){_0x4fb4da instanceof at&&this['fire']('error',{'interactionId':this['currentInteraction']?.['id'],'error':_0x4fb4da});}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}async['_extractContextItems'](_0x353343){return _0x353343['content']?this['chatContext']['populateFromMessage'](_0x353343['content'],Array['from'](this['_channelsToEditors']['values']())):{'contextItems':new Map(),'hasUnmatched':!0x1};}async['handleUserInteraction']({userMessage:_0x590959,attributes:_0x540f46}){if(!this['isStarted'])throw new at('ai-chat-handle-user-conversation-not-initialized',null,{'conversation':this});if(this['currentInteraction'])throw new at('ai-chat-handle-user-interaction-already-in-progress',null,{'conversation':this});try{const _0x5a8cfb=new Map(this['getPendingContextItems']()),_0x52a17a=this['chatCapabilities']['getCapabilitiesConfig'](),_0x3e408c=this['selectedModel']['id'];this['currentInteraction']=this['createInteraction']({'userMessage':_0x590959,'contextItems':_0x5a8cfb,'capabilities':_0x52a17a,'modelId':_0x3e408c,'attributes':_0x540f46,'channelsToEditors':this['_channelsToEditors']}),await this['currentInteraction']['start'](),this['chatContext']['addToConversationContext'](this['currentInteraction']['contextItems']);}catch(_0x1ca19f){if(_0x1ca19f instanceof at)this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':_0x1ca19f});else{const _0x2393ad=pn['get'](_0x1ca19f['code'])||'ai-chat-handle-user-interaction-start-failed';this['fire']('error',{'interactionId':this['currentInteraction']?this['currentInteraction']['id']:void 0x0,'error':new at(_0x2393ad,null,{'error':_0x1ca19f})});}}finally{this['currentInteraction']?.['stop'](),this['currentInteraction']=void 0x0;}}['createInteraction']({userMessage:_0x5cc90b,contextItems:_0x908cfd,capabilities:_0x17871d,modelId:_0x8c4b6b,attributes:_0x40adc7,channelsToEditors:_0x402625}){const _0x226ddb=new bn({'userMessage':_0x5cc90b,'contextItems':_0x908cfd,'capabilities':_0x17871d,'conversationId':this['id'],'connector':this['connector'],'locale':this['options']['locale'],'model':_0x8c4b6b,'attributes':_0x40adc7,'channelsToEditors':_0x402625});return _0x226ddb['delegate'](...An)['to'](this),this['interactions']['push'](_0x226ddb),this['fire']('interactionCreated',_0x226ddb),_0x226ddb;}['getInteraction'](_0x2a717e){return this['interactions']['find'](_0xdcdcf4=>_0xdcdcf4['id']===_0x2a717e);}['removeInteraction'](_0x360235){const _0x5eeea3=this['getInteraction'](_0x360235);_0x5eeea3&&(_0x5eeea3['destroy'](),this['interactions']['splice'](this['interactions']['indexOf'](_0x5eeea3),0x1));}get['lastInteraction'](){return this['interactions'][this['interactions']['length']-0x1];}['cancelLastInteractionStream'](){const _0x42fecb=this['lastInteraction'];_0x42fecb?.['conversationId']&&_0x42fecb['messageId']&&this['connector']['cancelStream'](_0x42fecb['conversationId'],_0x42fecb['messageId'])['execute']()['catch'](()=>{});}['addCurrentDocumentToContext'](_0xe403b5){this['chatContext']['addCurrentDocumentToContext'](_0xe403b5);}async['updateCurrentDocumentsInContext'](_0x2a2f3d){await this['chatContext']['updateCurrentDocuments'](_0x2a2f3d);}['toggleAddCurrentDocumentOptionVisibility'](_0x13eb53){this['chatContext']['toggleAddCurrentDocumentOptionVisibility'](_0x13eb53);}['_hasSessionMismatch'](_0x488d0f){return!!_0x488d0f&&_0x488d0f['documents']['some'](_0x15097=>{const _0x467aaa=this['_channelsToEditors']['get'](_0x15097['channelId']);return!_0x467aaa||_0x15097['sessionId']!==this['_getSessionId'](_0x467aaa);});}['addSelectionToContext'](_0x1c90d7){this['chatContext']['addSelectionToContext'](_0x1c90d7);}['removeSelectionFromContext'](){this['chatContext']['removeSelectionFromContext']();}['addFilesToContext'](_0x5210ed){this['chatContext']['addFilesToContext'](_0x5210ed);}['addUrlToContext'](_0x22c479){this['chatContext']['addUrlToContext'](_0x22c479);}['addToolItemToContext'](_0x1a24c6){this['chatContext']['addToolItemToContext'](_0x1a24c6);}['addResourceToContext'](_0x4e1a14,_0x26e1e8){this['chatContext']['addResourceToContext'](_0x4e1a14,_0x26e1e8);}['loadSourceResources'](_0x5d131c,_0x3e6de7,_0x961617){return this['chatContext']['loadSourceResources'](_0x5d131c,_0x3e6de7,_0x961617);}['removeFromContext'](_0x58aed2){this['chatContext']['removeFromContext'](_0x58aed2);}['setWebSearch'](_0x115828){this['chatCapabilities']['setWebSearch'](_0x115828);}['toggleWebSearch'](){this['chatCapabilities']['toggleWebSearch']();}['setReasoning'](_0x27b8db){this['chatCapabilities']['setReasoning'](_0x27b8db);}['toggleReasoning'](){this['chatCapabilities']['toggleReasoning']();}['isCurrentDocumentInContext'](){return this['chatContext']['isCurrentDocumentInContext']();}['isCurrentDocumentInConversation'](){return this['chatContext']['isCurrentDocumentInConversation']();}['isSelectionInContext'](){return this['chatContext']['isSelectionInContext']();}['getPendingContextItems'](){return this['chatContext']['getPendingContextItems']();}async['setModel'](_0x59b110){_0x59b110?!0x1===await this['chatModels']['isAvailable'](_0x59b110)&&(ft('ai-chat-conversation-set-model-not-available',{'conversation':this,'model':_0x59b110}),_0x59b110=(await this['chatModels']['getAvailableModels']())[0x0]):(ft('ai-chat-conversation-set-model-null',{'conversation':this}),_0x59b110=(await this['chatModels']['getAvailableModels']())[0x0]),_0x59b110['id']!==this['selectedModel']?.['id']&&(this['selectedModel']=_0x59b110,this['chatCapabilities']['reset'](),this['fire']('modelSelected',{'selectedModel':_0x59b110}));}};function On({groups:_0x3b947b,documentContextContent:_0x38b29e,documents:_0x5033cb}){const _0x3d5f9f=new Map();for(const _0x44fc6f of _0x3b947b){const {documentId:_0x5672dc}=_0x44fc6f,_0x10e98f=_0x3d5f9f['get'](_0x5672dc);if(_0x10e98f)_0x10e98f['groups']['push'](_0x44fc6f),_0x10e98f['indexes']['push'](_0x44fc6f['index']);else{const _0xc3e32a=_0x5033cb['find'](_0x27f696=>_0x27f696['id']===_0x5672dc),_0x27505d=_0x38b29e['get'](_0x5672dc);if(!_0xc3e32a||!_0x27505d)continue;_0x3d5f9f['set'](_0x5672dc,{'groups':[_0x44fc6f],'documentContext':_0xc3e32a,'documentContent':_0x27505d,'editor':_0x44fc6f['editor'],'indexes':[_0x44fc6f['index']]});}}return _0x3d5f9f;}function vn(_0x259264,_0x14ff7c){const _0x3bea42=_0x259264['files']['length']>0x0&&_0x259264['files']['every'](_0x28edbd=>_0x28edbd['type']['startsWith']('image/')),_0x5f3fa6=_0x259264['plainText']['trim']()['length']>0x0;if(_0x259264['files']['length']>0x0&&_0x14ff7c['filesEnabled']&&(!_0x3bea42||!_0x5f3fa6)){const _0x43ddd7=_0x259264['files']['filter'](_0x4052db=>_0x4052db['name']);return _0x43ddd7['length']>0x0?{'type':'file','files':_0x43ddd7}:null;}if(_0x14ff7c['urlsEnabled']){const _0xed7cce=function(_0x1f3d26){const _0x37db86=_0x1f3d26['trim']();if(/\s/['test'](_0x37db86))return null;try{const _0x164b5d=new URL(_0x37db86);return'http:'!==_0x164b5d['protocol']&&'https:'!==_0x164b5d['protocol']?null:_0x164b5d['toString']();}catch{return null;}}(_0x259264['plainText']);if(_0xed7cce)return{'type':'url','url':_0xed7cce};}const _0x2ac029=_0x259264['forceTextAttachment']?0x1:_0x14ff7c['longTextThreshold']??0x1/0x0;if(_0x259264['plainText']['length']>=Math['max'](_0x2ac029,0x1)&&_0x14ff7c['filesEnabled']){const _0x453f3f=_0x14ff7c['pastedTextLabel']+'.txt';return{'type':'text','files':[new File([_0x259264['plainText']],_0x453f3f,{'type':'text/plain'})]};}return null;}var kn=class extends _0x2d0760{['activeConversation'];['_aiEditing'];['_aiConnector'];['_aiChatUi'];['_aiChatModels'];['_hasAIChatBalloon']=!0x1;['_activeBalloon'];['_reporter'];['_batchToChanges']=new Map();['_currentPreviewedChangeGroup']=null;['_bodyCollection'];['_channelsToEditors']=new Map();static get['requires'](){return[cs,rn,_0x5b6f61];}static get['pluginName'](){return'AIChatController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['set']('isConversationReady',!0x1),this['_bodyCollection']=un(this['context']['locale']),this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_aiChatUi']=this['context']['plugins']['get']('AIChatUI'),this['_aiEditing']=this['context']['plugins']['get']('AIEditing'),this['_reporter']=this['context']['plugins']['get'](rn)['createReporter']('aichat'),this['_aiChatModels']=new Xs({'connector':this['_aiConnector'],'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']});const _0x1c38f7=this['context']['plugins']['get']('AITabs');this['listenTo'](this['_aiChatUi'],'startConversation',()=>{this['_startConversationSafely']();}),this['listenTo'](this['_aiChatUi'],'sendUserMessage',(_0x5929b4,_0x38edea)=>{this['_handleUIUserMessage']({'message':_0x38edea});}),this['listenTo'](_0x1c38f7['view'],'change:activeTab',(_0x581aaa,_0x4bfb74,_0x4864d5)=>{'chat'!==_0x4864d5&&this['removeSelectionFromChatContext']();}),this['listenTo'](this['_aiChatUi'],'abortPromptStream',async()=>{await this['_stopLastInteraction'](),await this['_flushLastInteractionUI'](),this['removeSelectionFromChatContext'](),this['activeConversation']?.['cancelLastInteractionStream']();}),this['listenTo'](this['_aiChatUi'],'addDocumentToContext',()=>{this['addCurrentDocumentToChatContext']();}),this['listenTo'](this['_aiChatUi'],'addFileToContext',(_0x3ad354,_0x339125)=>{this['activeConversation']?.['addFilesToContext'](Array['from'](_0x339125));}),this['listenTo'](this['_aiChatUi'],'addUrlToContext',(_0x574c9f,_0x854ecc)=>{this['activeConversation']?.['addUrlToContext'](_0x854ecc);}),this['listenTo'](this['_aiChatUi'],'promptInputPaste',(_0x433d23,_0x19237f)=>{const _0x2ab422=this['activeConversation'];if(!_0x2ab422)return;_0x19237f['hasDirectory']&&(_0x19237f['preventDefault'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FOLDER_NOT_SUPPORTED'),'id':'folder-error-'+Ot()}));const _0x454ecb=vn(_0x19237f,{'pastedTextLabel':ls(this['context']['locale'],'AI_CHAT_CONTEXT_PASTED_TEXT_NAME'),'longTextThreshold':this['context']['config']['get']('ai.chat.context.paste.textThreshold'),'filesEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.files.enabled'),'urlsEnabled':!0x1!==this['context']['config']['get']('ai.chat.context.urls.enabled')});_0x454ecb&&(_0x19237f['preventDefault'](),'url'===_0x454ecb['type']?_0x2ab422['addUrlToContext'](_0x454ecb['url']):_0x2ab422['chatContext']['addFilesToContext'](_0x454ecb['files'],void 0x0,_0x454ecb['type']));}),this['listenTo'](this['_aiChatUi'],'executeCustomItemCallback',(_0x52521e,_0x3b2b51)=>{_0x3b2b51['callback'](this['context']);}),this['listenTo'](this['_aiChatUi'],'addResourceToContext',(_0x40db81,_0x4f13fa)=>{this['activeConversation']?.['addResourceToContext'](_0x4f13fa['source'],_0x4f13fa['resource']);}),this['listenTo'](this['_aiChatUi'],'removeContextItem',(_0x738355,_0x493ed9)=>{this['_removeFromContext'](_0x493ed9);}),this['listenTo'](this['_aiChatUi'],'loadSourceResources',(_0x4eefc9,_0x19b817)=>{this['activeConversation']?.['loadSourceResources'](_0x19b817['sourceId'],_0x19b817['query'],_0x19b817['uid']);}),this['listenTo'](this['_aiChatUi'],'toggleWebSearch',()=>{this['_toggleWebSearch']();}),this['listenTo'](this['_aiChatUi'],'toggleReasoning',()=>{this['_toggleReasoning']();}),this['listenTo'](this['_aiChatUi'],'selectModel',(_0xe586bd,_0x1a4730)=>{this['activeConversation']?.['setModel'](_0x1a4730);}),this['listenTo'](this['_aiChatUi'],'like',(_0x190658,{replyId:_0x347a18})=>{console['log']('Liked\x20response',_0x347a18);}),this['listenTo'](this['_aiChatUi'],'dislike',(_0x19ac6f,{replyId:_0x31a4db})=>{console['log']('Disliked\x20response',_0x31a4db);}),this['listenTo'](this['_aiChatUi'],'insertSuggestion',(_0x4080ce,_0x28ccce)=>{this['_insertSuggestion'](_0x28ccce);}),this['listenTo'](this['_aiChatUi'],'showChangeInText',(_0x2994f1,{replyId:_0x291f2f,partIndex:_0x3d6709})=>{this['_aiChatBalloonShowDiff']=this['_aiChatUi']['showDiff'],this['_openBalloonFor'](_0x291f2f,_0x3d6709);}),this['listenTo'](this['_aiChatUi'],'mouseOverSuggestion',(_0x17df66,{replyId:_0x1f0a86,partIndex:_0x29b656})=>{const _0x1a038a=this['_getDocumentRangeForReplyChanges'](_0x1f0a86,_0x29b656);if(!_0x1a038a)return;const {reply:_0x802134}=this['getInteractionAndReplyById'](_0x1f0a86);'$graveyard'!=_0x1a038a['range']['root']['rootName']&&this['_aiEditing']['showFakeVisualSelection']({'editor':_0x802134['changeGroups'][_0x29b656]['editor'],'ranges':[_0x1a038a['range']],'id':'change-area','priority':0xa});}),this['listenTo'](this['_aiChatUi'],'mouseLeaveSuggestion',()=>{this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['listenTo'](this['_aiChatUi'],'applySuggestion',(_0x1808f3,_0x3ddcce)=>{this['_aiEditing']['hideFakeVisualSelection']('change-area'),this['_applySuggestion'](_0x3ddcce);}),this['listenTo'](this['_aiChatUi'],'toggleSuggestionDisplayMode',async(_0x311ce0,{replyId:_0x5b5bcb,showDiff:_0x403518})=>{const {interaction:_0x11cde0,reply:_0x309bbd}=this['getInteractionAndReplyById'](_0x5b5bcb),_0x4fd81a=_0x309bbd['getContentParts']({'showDiff':_0x403518});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x11cde0['id']+':'+_0x309bbd['id'],'parts':_0x4fd81a});}),this['listenTo'](this['_aiChatUi'],'rejectSuggestion',(_0x3f8e32,{replyId:_0x2109fe,partIndex:_0x2f13d7})=>{this['_rejectSuggestion']({'replyId':_0x2109fe,'partIndex':_0x2f13d7}),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['set']('_aiChatBalloonShowDiff',!0x1),this['on']('interactionCreated',(_0x2f555f,_0x9660d9)=>{this['_aiChatUi']['addFeedItemUserMessage'](_0x9660d9);}),this['on']('replyCreated',(_0x32923d,_0x36d67b)=>{this['_addFeedItemReply'](_0x36d67b);});}['afterInit'](){this['context']instanceof _0x1a88b7?this['_integrateEditor'](this['context']):this['listenTo'](this['context']['editors'],'add',(_0x231c05,_0x404468)=>{_0x404468['on']('ready',()=>{this['_integrateEditor'](_0x404468);});}),this['_initConversation']();}async['_initConversation'](){const _0x54f028=this['context']['config']['get']('ai.chat.initialConversation');let _0x2a6e6b=_0x54f028;('lastCreated'!=_0x54f028||(_0x2a6e6b=await this['_getLastCreatedConversationId'](),_0x2a6e6b))&&('new'==_0x2a6e6b?await this['_startConversationSafely']():await this['loadConversation'](_0x2a6e6b));}async['destroy'](){return await this['_stopLastInteraction'](),this['_bodyCollection']['detachFromDom'](),super['destroy']();}async['loadConversation'](_0x58d23e){this['_closeActiveBalloon'](),this['context']['plugins']['get'](hs)['view']['activateTab']('chat'),this['_aiChatUi']['setFeedItemRenderingStrategy']('static'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x0),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();try{this['_aiChatUi']['emptyConversationTitle'](),await this['_aiConnector']['fetchConversation'](_0x58d23e)['getConversation'](),await this['_startConversationSafely']({'id':_0x58d23e}),await this['activeConversation']['load'](_0x58d23e),this['_aiChatUi']['enableControls'](),this['activeConversation']['isCurrentDocumentInConversation']()&&this['addCurrentDocumentToChatContext']();}catch(_0x279a81){this['_aiChatUi']['resetConversationTitle'](),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':_0x58d23e}),this['_reporter']['logError'](new at('ai-chat-conversation-not-found',this,void 0x0,_0x279a81),{'context':{'operation':'load-conversation'}});}finally{this['_aiChatUi']['startAutoScroll']({'smooth':!0x1}),this['_aiChatUi']['setFeedItemRenderingStrategy']('streaming'),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1);}}['registerToolDataCallback'](_0x2735de){let _0x330899=null,_0x460cdc=null;this['on']('toolDataReceived',(_0x23b533,_0x5e12d5,_0x3aba4f)=>{_0x3aba4f['id']!==_0x330899&&(_0x330899=_0x3aba4f['id'],_0x460cdc=this['_getAIChatFeedAPI'](_0x3aba4f)),_0x2735de(_0x5e12d5,_0x460cdc);});}['addCurrentDocumentToChatContext'](){us(this['context'])['length']&&this['activeConversation']?.['addCurrentDocumentToContext'](ls(this['context']['locale'],'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'));}async['addSelectionToChatContext'](_0x4341d3){const _0x1312a0=this['_aiEditing']['getSelectionText'](_0x4341d3);this['activeConversation']?.['addSelectionToContext'](_0x1312a0),this['addCurrentDocumentToChatContext']();}['removeSelectionFromChatContext'](){this['activeConversation']?.['removeSelectionFromContext']();}['focusPromptInput'](){this['_aiChatUi']['focusPromptInput']();}async['startConversation'](_0x55e6a4){await this['_startConversationSafely']({'modelId':_0x55e6a4?.['modelId']});}async['sendMessage'](_0x49f0a2){await this['_handleUIUserMessage'](_0x49f0a2);}['getGroupId'](){const _0x55e058=this['context']['config']['get']('collaboration.channelId');if(!_0x55e058)throw new at('ai-missing-channel-id',this);return _0x55e058;}['_handleRemovedConversation'](_0x3bf186){this['activeConversation']['id']===_0x3bf186&&this['_startConversationSafely']();}['_prepareDocumentSuggestions'](_0x5ac525){const {reply:_0x3760d9,interaction:_0x265306}=this['getInteractionAndReplyById'](_0x5ac525['replyId']),_0x3e9625=void 0x0!==_0x5ac525['partIndex']?[_0x3760d9['changeGroups'][_0x5ac525['partIndex']]]:_0x3760d9['changeGroups']['filter'](_0x176af2=>'pending'==_0x176af2['state']);return _0x3e9625['map'](_0x46e98e=>_0x3760d9['changeGroups']['indexOf'](_0x46e98e))['forEach'](_0x20f1e3=>{const _0x330293=this['_getDocumentRangeForReplyChanges'](_0x5ac525['replyId'],_0x20f1e3);_0x330293&&'$graveyard'!=_0x330293['range']['root']['rootName']?(_0x3760d9['setChangeGroupState'](_0x20f1e3,'accepted'),void 0x0!==_0x5ac525['partIndex']&&this['_scrollToSuggestionRange'](_0x330293['range'],!0x1,_0x330293['targetEditor'])):_0x3760d9['setChangeGroupState'](_0x20f1e3,'outdated');}),On({'groups':_0x3e9625['filter'](_0x4edf7b=>'accepted'===_0x4edf7b['state']),'documentContextContent':_0x3760d9['documentContextContent'],'documents':_0x265306['getDocumentContext']()?.['documents']??[]});}['_insertSuggestion'](_0x4a39ac){const _0x1ba79a=this['context']['plugins']['get'](_0x5b6f61),{reply:_0x510b94,interaction:_0x333fc7}=this['getInteractionAndReplyById'](_0x4a39ac['replyId']),_0x2c4d8e=this['_prepareDocumentSuggestions'](_0x4a39ac),_0x186ef5=ks({'documentSuggestions':_0x2c4d8e,'transform':!0x0,'documentCompare':_0x1ba79a,'documentCompareOptions':{'markDeletions':!0x0}});for(const [_0x5d4bcb,_0x1f68f9]of _0x186ef5){const {editor:_0x39d3bd,indexes:_0x5c4176}=_0x2c4d8e['get'](_0x5d4bcb);if(!_0x39d3bd['plugins']['has']('TrackChanges')){ft('ai-no-track-changes',{'editor':_0x39d3bd});continue;}let _0x487cda;js(_0x1f68f9,'chat'),_0x39d3bd['model']['change'](_0x5eeee7=>{_0x487cda=_0x5eeee7['batch'],_0x39d3bd['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x1f68f9),this['_aiEditing']['hideFakeVisualSelection']('change-area');}),this['_batchToChanges']['set'](_0x487cda,{'interactionId':_0x333fc7['id'],'replyId':_0x510b94['id'],'indexes':_0x5c4176});}this['_updateRatings'](_0x510b94);}['_applySuggestion'](_0x5090d1){const _0x71ed99=this['context']['plugins']['get'](_0x5b6f61),{reply:_0x26fb86,interaction:_0x400df5}=this['getInteractionAndReplyById'](_0x5090d1['replyId']),_0x5c1678=this['_prepareDocumentSuggestions'](_0x5090d1),_0x3f7dc8=ks({'documentSuggestions':_0x5c1678,'transform':!0x0,'documentCompare':_0x71ed99,'documentCompareOptions':{'markDeletions':!0x1}});for(const [_0x32d287,_0x3441d8]of _0x3f7dc8){const {editor:_0x36630f,indexes:_0x50dbfa}=_0x5c1678['get'](_0x32d287);let _0x5d5926;js(_0x3441d8,'chat');try{_0x36630f['model']['change'](_0x351da2=>{_0x5d5926=_0x351da2['batch'];for(const _0x35ba45 of _0x3441d8)_0x35ba45['baseVersion']=_0x36630f['model']['document']['version'],Ns(_0x36630f,_0x35ba45),_0x351da2['batch']['addOperation'](_0x35ba45),_0x36630f['model']['applyOperation'](_0x35ba45);}),this['_batchToChanges']['set'](_0x5d5926,{'interactionId':_0x400df5['id'],'replyId':_0x26fb86['id'],'indexes':_0x50dbfa});}catch(_0x14616f){throw this['_reporter']['logError'](new nn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x14616f})),_0x14616f;}}this['_updateRatings'](_0x26fb86);}['_rejectSuggestion'](_0x43f390){const {reply:_0x44d7cb}=this['getInteractionAndReplyById'](_0x43f390['replyId']);_0x44d7cb['setChangeGroupState'](_0x43f390['partIndex'],'rejected');}['_openBalloonFor'](_0x517851,_0x1f7f00){if(!this['_hasAIChatBalloon'])return;const {reply:_0x5060d8}=this['getInteractionAndReplyById'](_0x517851),_0x358115=_0x5060d8['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(!_0x358115['length'])return;let _0x26e687,_0x593de0;if(void 0x0!==_0x1f7f00?(_0x593de0=_0x358115['find'](_0x45d97a=>_0x45d97a['index']==_0x1f7f00),_0x26e687=_0x593de0?.['index']):(_0x593de0=_0x358115[0x0],_0x26e687=_0x593de0['index']),!_0x593de0)return void _0x5060d8['setChangeGroupState'](_0x1f7f00??0x0,'outdated');if(this['_currentPreviewedChangeGroup']?.['replyId']==_0x517851&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x26e687)return;const _0x301256=this['_getUserPresentableContentPartDocumentRange'](_0x517851,_0x5060d8,_0x593de0),_0x28e54e=_0x5060d8['changeGroups']['find'](_0x5967c9=>_0x5967c9['index']==_0x26e687)['editor'],_0x19c987=_0x28e54e['plugins']['get']('AIChatBalloon');if(this['_activeBalloon']&&this['_activeBalloon']!==_0x19c987&&this['_activeBalloon']['close'](),!_0x301256)return _0x19c987['close'](),void(this['_activeBalloon']=void 0x0);this['_activeBalloon']=_0x19c987,this['_currentPreviewedChangeGroup']={'replyId':_0x517851,'partIndex':_0x26e687},this['_scrollToSuggestionRange'](_0x301256,!0x0,_0x28e54e);const _0x3731e4=this['_getPresentableSiblingContentPartIndex'](_0x517851,_0x26e687,'next');_0x19c987['clearContent'](),_0x19c987['updateContent']({'part':_0x593de0,'renderingStrategy':'static'}),_0x19c987['open']({'index':_0x26e687,'title':ls(this['context']['locale'],'AI_BALLOON_HEADER_TITLE',(_0x26e687+0x1)['toString']()),'showRotator':null!==_0x3731e4,'ranges':[_0x301256],'areActionsDisabled':_0x5060d8['areActionsDisabled'],'targetEditor':_0x28e54e}),_0x19c987['setState']('pending'),this['_aiChatUi']['scrollFeedToSuggestion'](_0x517851,_0x26e687),this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x517851,'index':_0x26e687,'isActive':!0x0});}['_closeActiveBalloon'](){this['_activeBalloon']?.['close'](),this['_activeBalloon']=void 0x0,this['_currentPreviewedChangeGroup']=null;}['_getPresentableSiblingContentPartIndex'](_0x18a8fb,_0x338c22,_0x2ececd){const {reply:_0x28c17a}=this['getInteractionAndReplyById'](_0x18a8fb),_0x256d54=_0x28c17a['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff']});if(0x1==_0x256d54['length'])return null;const _0x559b28='next'==_0x2ececd?0x1:-0x1;function _0x3fb6aa(_0x4032af){const _0x118b45=(_0x4032af+_0x559b28+_0x256d54['length'])%_0x256d54['length'];return{'siblingIndex':_0x118b45,'siblingPart':_0x256d54[_0x118b45]};}const _0x3f8c2f=_0x256d54['findIndex'](_0x1a2e61=>_0x1a2e61['index']==_0x338c22);let {siblingIndex:_0xf5705d,siblingPart:_0xc0e91d}=_0x3fb6aa(_0x3f8c2f);for(;!this['_getUserPresentableContentPartDocumentRange'](_0x18a8fb,_0x28c17a,_0xc0e91d);)if({siblingIndex:_0xf5705d,siblingPart:_0xc0e91d}=_0x3fb6aa(_0xf5705d),_0xf5705d===_0x3f8c2f)return null;return _0xc0e91d['index'];}['_getUserPresentableContentPartDocumentRange'](_0x5b77b7,_0x57bf2b,_0x2e3905){const _0x4ff6f0=_0x57bf2b['changeGroups'];if(!_0x2e3905['hasChanges'])return null;const _0x440ee4=_0x4ff6f0['find'](_0x597b4c=>_0x597b4c['index']==_0x2e3905['index']);if('pending'!==_0x440ee4?.['state'])return null;if(!_0x440ee4?.['editor']||'destroyed'===_0x440ee4['editor']['state'])return _0x57bf2b['setChangeGroupState'](_0x2e3905['index'],'outdated'),null;const _0x1fd2c1=this['_getDocumentRangeForReplyChanges'](_0x5b77b7,_0x2e3905['index']);if(!_0x1fd2c1)return _0x57bf2b['setChangeGroupState'](_0x2e3905['index'],'outdated'),null;const {range:_0x5c2b76,currentIndex:_0x3bf623}=_0x1fd2c1;return'$graveyard'==_0x5c2b76['root']['rootName']?(_0x57bf2b['setChangeGroupState'](_0x3bf623,'outdated'),null):_0x1fd2c1['range'];}['_getDocumentRangeForReplyChanges'](_0x90ff2a,_0x2d428b){const {reply:_0xa201a5,interaction:_0x4aa2e3}=this['getInteractionAndReplyById'](_0x90ff2a),_0x54d2cc=_0xa201a5['changeGroups']['filter'](_0x5df534=>'pending'==_0x5df534['state']),_0xa6bd56=_0x54d2cc['map'](_0x430edc=>_0xa201a5['changeGroups']['indexOf'](_0x430edc));void 0x0===_0x2d428b&&(_0x2d428b=_0xa6bd56[0x0]);const _0x285e44=_0xa6bd56['indexOf'](_0x2d428b);if(-0x1==_0x285e44)return null;const _0x4f7525=_0x54d2cc[_0x285e44],_0x5b26c3=_0x4f7525['editor'];if(!_0x5b26c3||'destroyed'===_0x5b26c3['state'])return null;const _0x576d78=_0xa201a5['documentContextContent']['get'](_0x4f7525['documentId']),_0x163982=new _0x4e2431([]),_0x158b12=new _0x4e2431([]);for(const _0x1c785a of _0x4f7525['changes'])if('removed'!=_0x1c785a['type']&&_0x158b12['children']['push'](_0x1c785a['node']['cloneNode'](!0x0)),'new'!=_0x1c785a['type']){const _0x270128=_0x36c87f(_0x4133ec=>Cs(_0x4133ec,'data-id')==_0x1c785a['id'],_0x576d78,!0x0);_0x163982['children']['push'](_0x270128['cloneNode'](!0x0));}if(0x0==_0x163982['children']['length']){if(_0x4f7525['changes'][0x0]['anchorId']){const _0xffdde1=ms('data-id',_0x4f7525['changes'][0x0]['anchorId'],_0x576d78);_0x163982['children']['unshift'](_0xffdde1['cloneNode'](!0x0)),_0x158b12['children']['unshift'](_0xffdde1['cloneNode'](!0x0)),_0xffdde1['nextSibling']&&(_0x163982['children']['push'](_0xffdde1['nextSibling']['cloneNode'](!0x0)),_0x158b12['children']['push'](_0xffdde1['nextSibling']['cloneNode'](!0x0)));}else{const _0x1de685=_0x576d78['children'][0x0];if(!_0x1de685)return null;_0x163982['children']['push'](_0x1de685['cloneNode'](!0x0)),_0x158b12['children']['push'](_0x1de685['cloneNode'](!0x0));}}const _0x1b2fb2=_0x4aa2e3['getDocumentContext'](),_0x1dff9f=_0x1b2fb2['documents']['find'](_0x10b4bd=>_0x10b4bd['id']==_0x4f7525['documentId'])['content'],_0xc4e86f=_0x5b26c3['model']['document']['getRoot'](_0x4f7525['rootName']),_0x349852=_0x5b26c3['data']['parse'](_0x1dff9f,_0xc4e86f),_0x51762b=ps(_0x163982),_0x52faee=_0x5b26c3['data']['parse'](_0x51762b,_0xc4e86f),_0x53a12c=_0x5b26c3['data']['parse'](_0x51762b,_0xc4e86f),_0x3bbfdc=_0x5b26c3['model']['createPositionAt'](_0x52faee,0x0),_0x38d125=ps(_0x158b12),_0x4dfb76={'targetEditor':_0x5b26c3,'anchor':_0x3bbfdc,'markDeletions':!0x1},_0x470463=_0x5b26c3['plugins']['get'](_0x5b6f61)['getDiff'](_0x51762b,_0x38d125,_0x4dfb76)['getOperations']();if(!_0x470463['length'])return null;_0x5b26c3['model']['change'](_0x2c0752=>{for(const _0x57a612 of _0x470463)if('remove'==_0x57a612['type']){const _0x4d852a=_0x57a612['sourcePosition'],_0x571a6e=_0x57a612['howMany'],_0x2891da=new _0x39d5b2(_0x4d852a,_0x571a6e);_0x2c0752['batch']['addOperation'](_0x2891da),_0x5b26c3['model']['applyOperation'](_0x2891da);}else'marker'!==_0x57a612['type']&&(_0x57a612['baseVersion']=null,_0x57a612['isDocumentOperation']=!0x1,_0x2c0752['batch']['addOperation'](_0x57a612),_0x5b26c3['model']['applyOperation'](_0x57a612));});const _0x48e400=Fs(_0x5b26c3,_0x470463,_0x52faee);Ws(_0x5b26c3['model'],_0x48e400);const _0x88a24e=_0x48e400['getFirstRange']()['start']['path']['slice'](),_0x280f66=_0x48e400['getFirstRange']()['end']['path']['slice'](),_0x18e414=[];let _0x1b19e0=_0x52faee,_0xb2870c=_0x53a12c;for(let _0x104aa1=0x0;_0x104aa1<_0x280f66['length'];_0x104aa1++){const _0x315c2d=_0x1b19e0['maxOffset']-_0x280f66[_0x104aa1];_0x18e414[_0x104aa1]=_0xb2870c['maxOffset']-_0x315c2d,_0x1b19e0=_0x1b19e0['getChildAtOffset'](_0x280f66[_0x104aa1]),_0xb2870c=_0xb2870c['getChildAtOffset'](_0x18e414[_0x104aa1]);}const _0x4ff9dc=_0x5b26c3['model']['createRange'](_0x5b26c3['model']['createPositionFromPath'](_0x53a12c,_0x88a24e),_0x5b26c3['model']['createPositionFromPath'](_0x53a12c,_0x18e414)),_0x59b421=_0x53a12c['getChild'](0x0)['getAttribute'](_0x2be158),_0x477e27=Array['from'](_0x349852['getChildren']())['find'](_0x148971=>_0x148971['getAttribute'](_0x2be158)==_0x59b421)['getPath'](),_0x19991a=_0x4ff9dc['start']['path']['slice'](),_0x5bf69b=_0x4ff9dc['end']['path']['slice']();_0x19991a[0x0]=_0x477e27[0x0]+_0x19991a[0x0],_0x5bf69b[0x0]=_0x477e27[0x0]+_0x5bf69b[0x0];let _0x14f12b=_0x5b26c3['model']['createRange'](_0x5b26c3['model']['createPositionFromPath'](_0x5b26c3['model']['document']['getRoot'](_0x4f7525['rootName']),_0x19991a),_0x5b26c3['model']['createPositionFromPath'](_0x5b26c3['model']['document']['getRoot'](_0x4f7525['rootName']),_0x5bf69b));const _0x232962=_0x1b2fb2['documents']['find'](_0x193164=>_0x193164['id']==_0x4f7525['documentId'])['version'],_0x1c0f27=_0x5b26c3['model']['document']['history']['getOperations'](_0x232962);for(const _0x195b1c of _0x1c0f27)_0x14f12b=_0x15a2ab['_createFromRanges'](_0x14f12b['getTransformedByOperation'](_0x195b1c));return{'range':_0x14f12b,'currentIndex':_0x2d428b,'targetEditor':_0x5b26c3};}['_integrateEditorBalloon'](_0x8f3fee){if(!_0x8f3fee['plugins']['has']('AIChatBalloon'))return;const _0x234c52=_0x8f3fee['plugins']['get']('AIChatBalloon');this['_hasAIChatBalloon']=!0x0,_0x234c52['bind']('showDiff')['to'](this,'_aiChatBalloonShowDiff'),this['listenTo'](_0x234c52,'toggleSuggestionDisplayMode',()=>{const {replyId:_0x551689,partIndex:_0x4826df}=this['_currentPreviewedChangeGroup'];this['_aiChatBalloonShowDiff']=!this['_aiChatBalloonShowDiff'];const {reply:_0x292114}=this['getInteractionAndReplyById'](_0x551689),_0x49ceec=_0x292114['getContentParts']({'showDiff':this['_aiChatBalloonShowDiff'],'groupIndex':_0x4826df});_0x234c52['updateContent']({'part':_0x49ceec[0x0],'renderingStrategy':'static','keepErrors':!0x0});}),this['listenTo'](_0x234c52,'applySuggestion',()=>{const {replyId:_0x26a80e,partIndex:_0x5588e1}=this['_currentPreviewedChangeGroup'];this['_applySuggestion']({'replyId':_0x26a80e,'partIndex':_0x5588e1}),_0x234c52['setState']('accepted');}),this['listenTo'](_0x234c52,'insertSuggestion',()=>{const {replyId:_0x5be388,partIndex:_0x18d0e4}=this['_currentPreviewedChangeGroup'];this['_insertSuggestion']({'replyId':_0x5be388,'partIndex':_0x18d0e4}),_0x234c52['setState']('accepted');}),this['listenTo'](_0x234c52,'rejectSuggestion',()=>{const {replyId:_0x44c426,partIndex:_0x144bca}=this['_currentPreviewedChangeGroup'];this['_rejectSuggestion']({'replyId':_0x44c426,'partIndex':_0x144bca}),_0x234c52['setState']('rejected');}),this['listenTo'](_0x234c52,'showNext',()=>{const {replyId:_0xf9b151,partIndex:_0x499754}=this['_currentPreviewedChangeGroup'],_0x2d9117=this['_getPresentableSiblingContentPartIndex'](_0xf9b151,_0x499754,'next');null!==_0x2d9117&&this['_openBalloonFor'](_0xf9b151,_0x2d9117);}),this['listenTo'](_0x234c52,'showPrevious',()=>{const {replyId:_0x1b6b2b,partIndex:_0x30e555}=this['_currentPreviewedChangeGroup'],_0x1546d9=this['_getPresentableSiblingContentPartIndex'](_0x1b6b2b,_0x30e555,'previous');null!==_0x1546d9&&this['_openBalloonFor'](_0x1b6b2b,_0x1546d9);}),this['listenTo'](_0x234c52,'dialogClosed',(_0x281b48,{id:_0x23ac13})=>{if('aiChatBalloon'!==_0x23ac13)return;const {replyId:_0x12d9de,partIndex:_0x3c9723}=this['_currentPreviewedChangeGroup'];this['_currentPreviewedChangeGroup']=null,this['_aiChatUi']['setFeedItemAIReplySuggestionPartActive']({'id':_0x12d9de,'index':_0x3c9723,'isActive':!0x1}),this['_activeBalloon']===_0x234c52&&(this['_activeBalloon']=void 0x0);});}['_integrateEditor'](_0x49570d){if(this['_channelsToEditors']['set'](_0x49570d['config']['get']('collaboration.channelId'),_0x49570d),this['_integrateEditorBalloon'](_0x49570d),this['addCurrentDocumentToChatContext'](),_0x49570d['once']('destroy',()=>{this['_checkRemoveCurrentDocumentFromChatContext']();}),_0x49570d['plugins']['has']('Undo')){const _0x45f62a=_0x49570d['commands']['get']('undo'),_0x1f3333=_0x49570d['commands']['get']('redo');this['listenTo'](_0x45f62a,'revert',(_0x18cb5e,_0x3eede5,_0x519152)=>{const _0x1e3d45=this['_batchToChanges']['get'](_0x3eede5);if(!_0x1e3d45)return;const _0x4c280e=this['activeConversation']['getInteraction'](_0x1e3d45['interactionId']),_0x5e87a4=_0x4c280e?.['getReply'](_0x1e3d45['replyId']);this['_batchToChanges']['delete'](_0x3eede5),_0x4c280e&&_0x5e87a4&&(_0x1e3d45['indexes']['forEach'](_0x213167=>_0x5e87a4['setChangeGroupState'](_0x213167,'pending')),this['_batchToChanges']['set'](_0x519152,_0x1e3d45));}),this['listenTo'](_0x1f3333,'revert',(_0x2977f5,_0x50bea8,_0x2685f2)=>{const _0x694f9e=this['_batchToChanges']['get'](_0x50bea8);if(!_0x694f9e)return;const _0x2eb425=this['activeConversation']['getInteraction'](_0x694f9e['interactionId']),_0x3f8997=_0x2eb425?.['getReply'](_0x694f9e['replyId']);this['_batchToChanges']['delete'](_0x50bea8),_0x2eb425&&_0x3f8997&&(_0x694f9e['indexes']['forEach'](_0x627244=>_0x3f8997['setChangeGroupState'](_0x627244,'accepted')),this['_batchToChanges']['set'](_0x2685f2,_0x694f9e));});}const _0xf15faa=_0x49570d['config']['get']('ai.chat.context');_0xf15faa['alwaysAddSelection']&&_0xf15faa['document']['enabled']&&this['listenTo'](_0x49570d['model']['document']['selection'],'change:range',(_0x2b9be1,_0x5d7c5c)=>{_0x5d7c5c['directChange']&&'chat'===_0x49570d['plugins']['get']('AITabs')['view']['activeTab']&&(_0x49570d['model']['hasContent'](_0x49570d['model']['document']['selection'])?this['addSelectionToChatContext'](_0x49570d):this['removeSelectionFromChatContext']());});}async['_getLastCreatedConversationId'](){const _0x3d8027=this['_aiConnector']['fetchConversations'](this['getGroupId'](),{'limit':0x1,'sortBy':'createdAt'});try{const _0x559b78=await _0x3d8027['getConversations']();return _0x559b78['length']?_0x559b78[0x0]['id']:'new';}catch(_0xb41f1){return this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_LOAD_CONVERSATION'),'id':Ot()}),this['_reporter']['logError'](new at('ai-chat-conversation-init-failed',this,{'error':_0xb41f1})),this['_aiChatUi']['toggleLoadingSkeleton'](!0x1),this['_aiChatUi']['disableControls'](),null;}}async['_startConversationSafely'](_0x5d9312={}){this['set']('isConversationReady',!0x1);try{await this['_handleStartConversation'](_0x5d9312);}catch(_0x5dffd4){this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x5d9312['id']||Ot()}),this['_reporter']['logError'](_0x5dffd4),this['activeConversation']=void 0x0,this['_aiChatUi']['disableControls']();}}async['_handleStartConversation']({id:_0x12e449,modelId:_0x37e529}={}){this['_closeActiveBalloon']();let _0x73fa44=_0x37e529;_0x73fa44||(_0x12e449||!this['activeConversation']?_0x73fa44=this['context']['config']['get']('ai.models.defaultModelId'):this['_aiChatUi']['isModelAvailable']&&(_0x73fa44=this['activeConversation']['selectedModel']['id'])),this['activeConversation']&&this['stopListening'](this['activeConversation']),await this['_stopLastInteraction']();const _0x1c7f6d=this['getGroupId'](),_0xa17409=_0x12e449||Ot();let _0x33b865;this['activeConversation']=new Rn({'connector':this['_aiConnector'],'chatModels':this['_aiChatModels'],'selectedModelId':_0x73fa44,'conversationId':_0xa17409,'group':_0x1c7f6d,'locale':this['context']['locale'],'isFromHistory':!!_0x12e449,'channelsToEditors':this['_channelsToEditors'],'getSessionId':_0x43de44=>this['_aiEditing']['getSessionId'](_0x43de44)}),this['activeConversation']['delegate']('toolDataReceived','interactionCreated','interactionStarted','replyCreated')['to'](this),this['listenTo'](this['activeConversation'],'conversationInitialized',(_0x25b978,_0x5648c4)=>{this['_aiChatUi']['createConversation'](_0x5648c4),this['_aiChatUi']['resetMessageInput'](),this['_aiChatUi']['clearPendingContextUI'](),this['_aiChatUi']['clearConversationContextUI'](),_0x12e449||(this['_aiChatUi']['resetConversationTitle'](),this['addCurrentDocumentToChatContext']());}),this['listenTo'](this['activeConversation'],'uploadProgressChanged',(_0x2da3f1,_0x4821c0)=>{this['_aiChatUi']['setIsUploadInProgress'](_0x4821c0['isUploadInProgress']);}),this['listenTo'](this['activeConversation'],'webSearchStarted',()=>{const _0x74ac4e=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});this['_aiChatUi']['setLoadingMessage'](_0x74ac4e);}),this['listenTo'](this['activeConversation'],'reasoningStarted',()=>{const _0x4c3935=this['_aiChatUi']['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x0});this['_aiChatUi']['setLoadingMessage'](_0x4c3935);}),this['listenTo'](this['activeConversation'],'webSearchFinished',(_0x1e389a,_0x330f3e)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x330f3e,{'isWebSearchEnabled':!0x0,'isReasoningEnabled':!0x1});}),this['listenTo'](this['activeConversation'],'reasoningFinished',(_0xe13049,_0x24eb4c)=>{this['_aiChatUi']['addFeedInteractionHeader'](_0x24eb4c,{'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',(_0x49eba1,_0x90364c)=>{this['_aiChatUi']['removeFeedInteraction'](_0x90364c['id']);}),this['listenTo'](this['activeConversation'],'setConversationTitle',(_0x18d7a2,_0x3e4758,_0x53d437)=>{this['_updateConversationTitle'](_0x3e4758,_0x53d437);}),this['listenTo'](this['activeConversation'],'replyContentUpdated',async(_0x38b132,_0x57219e)=>{void 0x0!==_0x33b865&&_0x33b865!==_0x57219e['id']&&this['_updateReplyContentThrottled']['flush'](),_0x33b865=_0x57219e['id'],_0x57219e['isFromHistory']?await this['_updateReplyContent']({'reply':_0x57219e}):await this['_updateReplyContentThrottled']({'reply':_0x57219e});}),this['listenTo'](this['activeConversation'],'replyChangeGroupStateUpdated',(_0x28126d,{reply:_0x126357,index:_0x5c510e,state:_0x4169b4})=>{this['_aiChatUi']['updateFeedItemAIReplySuggestionPartState']({'id':_0x126357['id'],'index':_0x5c510e,'state':_0x4169b4}),this['_currentPreviewedChangeGroup']?.['replyId']['includes'](_0x126357['id'])&&this['_currentPreviewedChangeGroup']?.['partIndex']==_0x5c510e&&this['_activeBalloon']?.['setState'](_0x4169b4);}),this['listenTo'](this['activeConversation'],'contextItemAdded',(_0x35f630,_0x55c3ad)=>{if(this['_aiChatUi']['addContextItem'](_0x55c3ad['contextItem'],_0x55c3ad['isLoading']),'selection'===_0x55c3ad['contextItem']['type']){const _0x1936ca=ds(this['context']),_0x143c2e=[..._0x1936ca['model']['document']['selection']['getRanges']()];this['_aiEditing']['showFakeVisualSelection']({'editor':_0x1936ca,'ranges':_0x143c2e,'id':'context','priority':0x1});}}),this['listenTo'](this['activeConversation'],'contextItemRemoved',(_0x5d4ad1,_0x136adf)=>{this['_aiChatUi']['removeContextItem'](_0x136adf['uiId']),'current-document'==_0x136adf['uiId']&&this['removeSelectionFromChatContext'](),'selection'===_0x136adf['type']&&this['_aiEditing']['hideFakeVisualSelection']('context');}),this['listenTo'](this['activeConversation'],'contextItemLoadingEnded',(_0x38e45b,_0x176ec0)=>{this['_aiChatUi']['setContextItemLoading'](_0x176ec0['contextItem']['uiId'],_0x176ec0['isLoading']);}),this['listenTo'](this['activeConversation'],'contextSent',(_0x4b0e11,_0x186816)=>{this['_aiChatUi']['setConversationContext'](_0x186816['contextItems']);}),this['listenTo'](this['activeConversation'],'addContextOptionsChanged',(_0x41d671,_0x1bdca5)=>{this['_aiChatUi']['setAddContextOptions'](_0x1bdca5['options']);}),this['listenTo'](this['activeConversation'],'sourceResourcesLoaded',(_0x20fcaf,_0x567c81)=>{this['_aiChatUi']['populateSourceResourceBalloon'](_0x567c81['sourceId'],_0x567c81['source'],_0x567c81['resources'],_0x567c81['uid']);}),this['listenTo'](this['activeConversation'],'resourceStateChanged',(_0x40b619,_0x376aa2)=>{this['_aiChatUi']['updateResourceState'](_0x376aa2['sourceId'],_0x376aa2['resourceId'],_0x376aa2['isInContext']);}),this['listenTo'](this['activeConversation'],'capabilitiesUpdated',(_0x3fb121,_0x57e83d)=>{this['_aiChatUi']['updateCapabilities'](_0x57e83d);}),this['listenTo'](this['activeConversation'],'modelSelected',async(_0x277be6,_0x1657ca)=>{try{const _0x8ff9be=(await this['_aiChatModels']['getAll']())['find'](_0xc2c94d=>_0xc2c94d['id']===_0x1657ca['selectedModel']?.['id'])||null;this['_aiChatUi']['setSelectedModel'](_0x8ff9be,_0x1657ca['isDisabled']);}catch(_0x10c43e){this['_reporter']['logError'](new nn({'code':'ai-chat-models-unable-to-retrieve','type':'network','cause':_0x10c43e}),{'context':{'operation':'model-selected'}});}}),this['listenTo'](this['activeConversation'],'error',(_0x2518e8,{error:_0x1b12a5,interactionId:_0x43b616,fileName:_0x18aae1,url:_0x4e0782,sourceId:_0x2af05e,sourceLabel:_0x514cd0})=>{const _0x3ae3d5=_0x43b616?_0x43b616+':'+Ot():Ot();this['_reporter']['reportError'](_0x1b12a5),_0x1b12a5['message']['startsWith']('ai-request-aborted')?this['_aiChatUi']['addFeedItemStaticMessage']({'staticMessage':ls(this['context']['locale'],'AI_CHAT_ABORTED_MESSAGE'),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-conversation-init-failed')||_0x1b12a5['message']['startsWith']('ai-chat-conversation-start-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_UNABLE_TO_START_CONVERSATION'),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-file-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_FILE',_0x18aae1),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-url-upload-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_UPLOAD_URL',_0x4e0782),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-context-invalid-data')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_INVALID_DATA'),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-context-unsupported-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_TYPE'),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-source-resources-load-failed')?(_0x2af05e&&this['_aiChatUi']['closeSourceResourceBalloon'](_0x2af05e),this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNABLE_TO_LOAD_RESOURCES',_0x514cd0||'source'),'id':_0x3ae3d5})):_0x1b12a5['message']['startsWith']('ai-chat-resource-load-failed')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_RESOURCE_LOAD_FAILED'),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-invalid-request')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_INVALID_REQUEST'),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-context-unsupported-file-type')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_UNSUPPORTED_FILE_TYPE'),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-context-file-too-large')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_LARGE'),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-context-file-too-many-pages')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FILE_TOO_MANY_PAGES'),'id':_0x3ae3d5}):_0x1b12a5['message']['startsWith']('ai-chat-context-form-data-size-limits-exceeded')?this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_CONTEXT_FORM_DATA_SIZE_LIMITS_EXCEEDED'),'id':_0x3ae3d5}):this['_aiChatUi']['addFeedItemError']({'errorMessage':ls(this['context']['locale'],'AI_CHAT_GENERIC_ERROR'),'id':_0x3ae3d5});}),await this['activeConversation']['init'](this['context']['config']['get']('ai.chat.context')),_0x12e449||(await this['activeConversation']['start'](),this['_aiChatUi']['enableControls']()),this['set']('isConversationReady',!0x0);}async['_handleUIUserMessage']({message:_0x3bb621,attributes:_0x5d1841}){if(!this['activeConversation'])throw new at('ai-chat-controller-no-active-conversation');if(this['activeConversation']['isCurrentDocumentInContext']()){const _0x1d80a0=await this['_aiEditing']['getDocumentData']();await this['activeConversation']['updateCurrentDocumentsInContext'](_0x1d80a0);}this['activeConversation']['id']&&this['activeConversation']['isStarted']&&await this['activeConversation']['handleUserInteraction']({'userMessage':_0x3bb621,'attributes':_0x5d1841});}['_removeFromContext'](_0xb59716){this['activeConversation']?.['removeFromContext'](_0xb59716);}['_toggleWebSearch'](){this['activeConversation']?.['toggleWebSearch']();}['_toggleReasoning'](){this['activeConversation']?.['toggleReasoning']();}['getInteractionAndReplyById'](_0xbde829){const [_0x38d510,_0x533e9d]=_0xbde829['split'](':'),_0x482610=this['activeConversation']['getInteraction'](_0x38d510);return{'interaction':_0x482610,'reply':_0x482610['getReply'](_0x533e9d)};}['_scrollToSuggestionRange'](_0x57e2cd,_0x4cfd24=!0x1,_0x6d8e1f){const _0x3f1389={'target':_0x6d8e1f['editing']['view']['domConverter']['viewRangeToDom'](_0x6d8e1f['editing']['mapper']['toViewRange'](_0x57e2cd)),'viewportOffset':{'top':0x96,'left':0x0,'bottom':0x32,'right':0x0},'ancestorOffset':0x14,'alignToTop':_0x4cfd24};_0x4cfd24&&(_0x3f1389['alignToTop']=!0x0),St(_0x3f1389);}['_updateConversationTitle'](_0x5e0f6b,_0x465bfc=!0x1){this['_aiChatUi']['setConversationTitle'](_0x5e0f6b||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),_0x465bfc);}['_addFeedItemReply'](_0xcb67c4){'text'===_0xcb67c4['type']?this['_aiChatUi']['addFeedItemAIReply'](_0xcb67c4):this['_aiChatUi']['addFeedItemAISuggestion'](_0xcb67c4);}async['_updateReplyContent']({reply:_0x4e5ccd,renderingStrategy:_0x14b447}){const {id:_0x56f79d,interactionId:_0x326ba2,isDone:_0x6b9b64,type:_0x3eda24,parsedContent:_0x120e87}=_0x4e5ccd,_0x2a25d4=_0x326ba2+':'+_0x56f79d;if('modification'===_0x3eda24){const _0xdf56f2=_0x4e5ccd['getContentParts']({'showDiff':this['_aiChatUi']['showDiff']});await this['_aiChatUi']['updateFeedItemAIReplySuggestionContent']({'id':_0x2a25d4,'parts':_0xdf56f2,'isDone':_0x6b9b64,'skipLoadingEffects':_0x4e5ccd['isFromHistory']});}else'text'===_0x3eda24&&await this['_aiChatUi']['updateFeedItemAIReplyContent']({'id':_0x2a25d4,'parsedContent':_0x120e87['get']('text'),'renderingStrategy':_0x14b447,'isDone':_0x6b9b64});_0x6b9b64&&_0x4e5ccd['sources']['length']>0x0&&this['_aiChatUi']['updateFeedItemAIReplySources'](_0x2a25d4,_0x4e5ccd['sources']);}['_updateReplyContentThrottled']=_0x43472a(this['_updateReplyContent']['bind'](this),0xc8);async['_stopLastInteraction'](){const _0x66a4e6=this['activeConversation']?.['lastInteraction'];_0x66a4e6&&(_0x66a4e6['stop'](),this['_aiChatUi']['stopInteraction'](_0x66a4e6)),this['_updateReplyContentThrottled']['cancel']();}async['_flushLastInteractionUI'](){const _0x4d85ad=this['activeConversation']?.['lastInteraction'];if(_0x4d85ad){for await(const _0x36f233 of _0x4d85ad['replies'])this['_aiChatUi']['hasFeedItem'](_0x36f233['id'])||this['_addFeedItemReply'](_0x36f233),await this['_updateReplyContent']({'reply':_0x36f233,'renderingStrategy':'static'});}}['_updateRatings'](_0x431e2c){const _0x3e1c20={'positiveCount':_0x431e2c['changeGroups']['filter'](_0x23449c=>'accepted'===_0x23449c['state'])['length'],'totalCount':_0x431e2c['changeGroups']['length'],'modificationId':_0x431e2c['id']},_0x515c78=this['activeConversation']['getInteraction'](_0x431e2c['interactionId'])['messageId'];_0x515c78&&this['_aiConnector']['upsertAIChatRating'](this['activeConversation']['id'],_0x515c78,_0x3e1c20);}['_getAIChatFeedAPI'](_0x155f7a){const _0x5a5b43=this['_aiChatUi'],_0x519b66=()=>{_0x155f7a['resetWebSearchState'](),_0x155f7a['resetReasoningState'](),_0x5a5b43['clearLoadingMessage']();},_0x3a026f=()=>{_0x155f7a['currentReply']&&(_0x155f7a['currentReply']['done'](),_0x155f7a['currentReply']=void 0x0);};return{'insertTextReply':(_0x4ec3b4,_0x32d546)=>{_0x3a026f(),_0x519b66();const _0x1b60bf=_0x155f7a['currentReply']=_0x155f7a['createReply']({'type':'text','interactionId':_0x155f7a['id'],'id':_0x32d546||Ot(),'channelsToEditors':this['_channelsToEditors']});return _0x1b60bf['appendContent'](_0x4ec3b4),_0x3a026f(),_0x1b60bf;},'insertCustomElement':async(_0x18da5d,_0x204213)=>(_0x3a026f(),_0x519b66(),_0x5a5b43['addFeedItemCustomElement'](_0x18da5d,_0x204213||Ot())),'setLoadingMessage':_0x4e900f=>{_0x5a5b43['setLoadingMessage'](_0x4e900f);},'clearLoadingMessage':()=>{_0x5a5b43['clearLoadingMessage']();}};}['_checkRemoveCurrentDocumentFromChatContext'](){us(this['context'])['find'](_0x3bf73f=>'destroyed'!==_0x3bf73f['state'])||(this['activeConversation']?.['removeFromContext']('current-document'),this['activeConversation']?.['toggleAddCurrentDocumentOptionVisibility'](!0x1));}};const Nn=['showChangeInText','insertSuggestion','applySuggestion','rejectSuggestion','mouseOverSuggestion','mouseLeaveSuggestion','toggleSuggestionDisplayMode','like','dislike'],yn=[...Nn,'startConversation','sendUserMessage','promptInputPaste','abortPromptStream','addDocumentToContext','addFileToContext','addUrlToContext','executeCustomItemCallback','addResourceToContext','removeContextItem','loadSourceResources','toggleWebSearch','toggleReasoning','selectModel'];function xn(_0x1eabf9){const _0x2f54b2=new AbortController();return{'promise':new Promise((_0x334f0a,_0x551e28)=>{const _0x48c22c=setTimeout(_0x334f0a,_0x1eabf9);_0x2f54b2['signal']['addEventListener']('abort',()=>{clearTimeout(_0x48c22c),_0x551e28();});}),'abortController':_0x2f54b2};}var Ln=class{['options'];['isStreaming']=!0x1;['document']=null;['nodesList']=[];['currentIndex']=0x0;['timeoutAbortController']=null;['lastUpdateTime']=0x0;constructor(_0x485099){this['options']={'delay':_0x485099?.['delay']??0xa,'textNodeStyle':_0x485099?.['textNodeStyle']??'animation:\x20ck-html-streamer-fade-in\x20.3s'};}async['stream']({document:_0x143215,targetElement:_0x478147,abortSignal:_0x2c57d8}){this['isStreaming']&&this['stop'](),_0x2c57d8?.['addEventListener']('abort',this['stop']['bind'](this)),this['document']=_0x5c7833(_0x143215,!0x0),this['nodesList']=this['getParsedDocumentNodeList'](),this['isStreaming']=!0x0,this['currentIndex']>this['nodesList']['length']&&(this['currentIndex']=this['nodesList']['length']);for(let _0x436ca4=0x0;_0x436ca4<this['currentIndex'];_0x436ca4++)this['nodesList'][_0x436ca4]['shouldBeStreamed']=!0x0;do{const _0x8b711f=Date['now'](),_0x586f4b=this['nodesList'][this['currentIndex']],_0x34cf56=_0x8b711f-this['lastUpdateTime'];if(_0x586f4b){_0x586f4b['shouldBeStreamed']=!0x0;let _0x810d5a=_0x586f4b['parent'];for(;_0x810d5a;)_0x810d5a['shouldBeStreamed']=!0x0,_0x810d5a=_0x810d5a['parent'];}if(_0x34cf56<this['options']['delay'])try{const {promise:_0x328221,abortController:_0x2fe3c}=xn(this['options']['delay']-_0x34cf56);this['timeoutAbortController']=_0x2fe3c,await _0x328221;}catch(_0x33ea95){return;}_0x488cd9(_0x478147,'<'+_0x478147['tagName']+'>'+this['renderNode'](this['document'])+'</'+_0x478147['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:_0x21b0aa}){Array['from'](_0x21b0aa['querySelectorAll']('span[data-ck-html-streamer-word-chunk]'))['reverse']()['forEach'](_0x4325ae=>{_0x4325ae['replaceWith'](_0x4325ae['childNodes'][0x0]);});}['stop'](){this['isStreaming']=!0x1,this['timeoutAbortController']&&(this['timeoutAbortController']['abort'](),this['timeoutAbortController']=null);}['renderNode'](_0x22c996){let _0x154de3='';if(function(_0x531d9c){return _0x149981(_0x531d9c);}(_0x22c996)){for(const _0x698685 of _0x22c996['children'])_0x154de3+=this['renderNode'](_0x698685);}else{if(Hn(_0x22c996)){if(!_0x22c996['shouldBeStreamed'])return'';const _0x42a0b0=_0x22c996,_0x5ba020=Object['entries'](_0x42a0b0['attribs'])['map'](([_0x56ceec,_0x1dbb08])=>_0x56ceec+'=\x22'+_0x1dbb08+'\x22')['join']('\x20');_0x154de3+='<'+_0x42a0b0['tagName']+(_0x5ba020?'\x20'+_0x5ba020:'')+'>';for(const _0x416092 of ti(_0x42a0b0))_0x154de3+=this['renderNode'](_0x416092);_0x154de3+='</'+_0x42a0b0['tagName']+'>';}else{if(!Pn(_0x22c996))return'';if(!_0x22c996['shouldBeStreamed'])return'';!function(_0x384ebe){return!(!_0x384ebe['parent']||!Hn(_0x384ebe['parent']))&&(!!Dn['includes'](_0x384ebe['parent']['tagName'])&&!_0x475662(_0x384ebe)['match'](/^\s*[<>]\s*$/));}(_0x22c996)?_0x154de3+=_0x5286d3(_0x22c996):_0x154de3+=_0x5286d3(new _0x19163f('span',{'data-ck-html-streamer-word-chunk':'','style':this['options']['textNodeStyle']},[_0x22c996]));}}return _0x154de3;}['getParsedDocumentNodeList'](){const _0x56892b=[];return function(_0x46c238,_0x4b9858){const _0x382507=_0x8f365c=>{if(_0x4b9858(_0x8f365c),_0x8f365c instanceof _0x2a712f)for(let _0x330ea2=0x0;_0x330ea2<_0x8f365c['children']['length'];_0x330ea2++){const _0x44b806=_0x8f365c['children'][_0x330ea2];_0x382507(_0x44b806);}};for(let _0x2ac3a5=0x0;_0x2ac3a5<_0x46c238['children']['length'];_0x2ac3a5++)_0x382507(_0x46c238['children'][_0x2ac3a5]);}(this['document'],_0x2e16f2=>{if(Pn(_0x2e16f2)){const _0x4f2ce8=this['splitTextNodeIntoWordNodes'](_0x2e16f2);_0x4f2ce8['length']&&_0x56892b['push'](..._0x4f2ce8);}_0x2e16f2['isWordSplitSource']||_0x2e16f2['isWordSplitResult']||_0x56892b['push'](_0x2e16f2);}),_0x56892b;}['splitTextNodeIntoWordNodes'](_0x4f8038){if(_0x4f8038['isWordSplitSource']||_0x4f8038['isWordSplitResult'])return[];const _0x26c974=_0x475662(_0x4f8038)['match'](/(?:\s*\S+\s*)/g),_0x16e49a=[];if(_0x26c974&&_0x26c974['length']>0x1){for(const _0x5bc93a of _0x26c974){const _0x1dd468=new _0x297122(_0x5bc93a);_0x1dd468['isWordSplitResult']=!0x0,_0xe4cd1(_0x4f8038,_0x1dd468),_0x16e49a['push'](_0x1dd468);}_0x4f8038['isWordSplitSource']=!0x0,_0x5d7a74(_0x4f8038);}return _0x16e49a;}};const Dn=['p','li','td','th','span','h1','h2','h3','h4','h5','h6','b','strong','i','em','mark','del','ins','sup','sub','a','code','div'];function Pn(_0x1d2835){return _0x59e3a7(_0x1d2835);}function Hn(_0x5560dc){return _0x3dcf78(_0x5560dc);}function Mn(_0x1ab558,_0x1be7b4){_0x1ab558['cleanUpAnimations']({'targetElement':_0x1be7b4}),_0x1be7b4['querySelectorAll']('[data-id]')['forEach'](_0x4a9998=>{_0x4a9998['removeAttribute']('data-id');});}var Vn=class extends _0x1e8352{['options'];['content']='';['htmlStreamer'];['children'];constructor(_0x4345e3){super();const _0x201565=this['bindTemplate'];this['set']('isDone',!0x1),this['set']('isVisible',!0x0),this['htmlStreamer']=new Ln(),this['options']=_0x4345e3,this['children']=this['createCollection'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__item',_0x201565['if']('isDone','ck-ai-chat__feed__item_done'),_0x201565['if']('isVisible','ck-hidden',_0xf0e0eb=>!_0xf0e0eb),'ck-ai-chat__feed__text-item'],'data-cke-ai-id':this['options']['id']},'children':this['children']});}['markAsDone'](){Mn(this['htmlStreamer'],this['element']),this['isDone']=!0x0;}async['streamIntoElement'](_0x46bfe8,_0xe52d45,_0x1944cd){await this['htmlStreamer']['stream']({'document':_0x46bfe8,'targetElement':_0xe52d45,'abortSignal':_0x1944cd});}},Un=class extends _0x1e8352{['showChangesToggleView'];constructor(_0x270e04,_0x22f069){super(_0x270e04),this['set']('isShowChangesToggleVisible',!0x0),this['showChangesToggleView']=new Bn(_0x270e04),this['showChangesToggleView']['set']({'class':'ck-ai-suggestion__header__show-changes-toggle\x20ck-ai-chat-controls-button\x20'+cn,'label':ls(_0x270e04,'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':!0x0}),this['showChangesToggleView']['isOn']=_0x22f069['showDiff'],this['showChangesToggleView']['bind']('isVisible')['to'](this,'isShowChangesToggleVisible'),this['showChangesToggleView']['bind']('icon')['to'](this['showChangesToggleView'],'isOn',_0x8af1b=>_0x8af1b?tt:_0x3b4365),this['showChangesToggleView']['on']('execute',()=>{this['showChangesToggleView']['isOn']=!this['showChangesToggleView']['isOn'],this['fire']('toggleShowChanges',{'isOn':this['showChangesToggleView']['isOn']});});const _0xe2fe1f=new Wt();_0xe2fe1f['content']=_0x5549b7,this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__header',!0x1===_0x22f069['showHeader']?'ck-hidden':null]['filter'](Boolean)},'children':[_0xe2fe1f,{'tag':'span','children':[ls(_0x270e04,'AI_SUGGESTION_HEADER_TITLE')]},this['showChangesToggleView']]});}},Bn=class extends Pt{['render'](){super['render'](),this['children']['remove'](this['iconView']),this['children']['add'](this['iconView']);}};const Gn={'accepted':_0x99610,'rejected':_0x4fad88,'outdated':_0x4fad88};var Fn=class extends _0x1e8352{['stateIconView'];constructor(_0x5ed82f){super(_0x5ed82f);const _0x59b8e3=this['bindTemplate'];this['set']('state','accepted'),this['set']('isVisible',!0x0),this['stateIconView']=new Kn(),this['stateIconView']['bind']('state')['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__content-part-state',_0x59b8e3['to']('state',_0x1b0c29=>'ck-ai-suggestion__content-part-state_'+_0x1b0c29),_0x59b8e3['if']('isVisible','ck-hidden',_0x182c5d=>!_0x182c5d)]},'children':[{'tag':'span','attributes':{'class':['ck-ai-suggestion__content-part-state__label']},'children':[{'text':_0x59b8e3['to']('state',_0x5954a1=>{switch(_0x5954a1){case'accepted':return ls(_0x5ed82f,'AI_SUGGESTION_CONTENT_PART_STATE_ACCEPTED');case'rejected':return ls(_0x5ed82f,'AI_SUGGESTION_CONTENT_PART_STATE_REJECTED');case'outdated':return ls(_0x5ed82f,'AI_SUGGESTION_CONTENT_PART_STATE_OUTDATED');}})}]},this['stateIconView']]});}['setState'](_0x1cacee){this['state']=_0x1cacee;}},Kn=class extends Wt{constructor(){super(),this['set']('state','accepted'),this['content']=Gn[this['state']],this['on']('change:state',()=>{this['content']=Gn[this['state']];});}},Wn=class extends _0x177211{['_applyButton'];['_suggestButton'];constructor(_0x254b87,_0x53b60b,_0x5af9f0){super(_0x254b87);const _0x408415=Boolean(_0x5af9f0);this['set']('isEnabled',!_0x408415),this['set']('isVisible',!0x0),this['set']('isTrackChangesOn',!0x1),this['class']='ck-ai-suggestion-content-part-toolbar';const _0x1c6e22=[];if(_0x408415){const _0x35079d=new Pt(_0x254b87);_0x35079d['set']({'label':ls(_0x254b87,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x220b4a}),_0x35079d['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}}),_0x1c6e22['push'](_0x35079d);}else{_0x53b60b['includes']('applySuggestion')&&(this['_applyButton']=new Pt(_0x254b87),this['_applyButton']['set']({'label':ls(_0x254b87,'AI_SUGGESTION_CONTENT_PART_APPLY'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x99610}),this['_applyButton']['bind']('isEnabled')['to'](this),this['_applyButton']['bind']('isVisible')['to'](this,'isTrackChangesOn',_0x5ad7fb=>!_0x5ad7fb),this['_applyButton']['on']('execute',()=>{this['fire']('applySuggestion');}),_0x1c6e22['push'](this['_applyButton'])),_0x53b60b['includes']('insertSuggestion')&&(this['_suggestButton']=new Pt(_0x254b87),this['_suggestButton']['set']({'label':ls(_0x254b87,'AI_SUGGESTION_CONTENT_PART_ADD_SUGGESTION'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4b673d}),this['_suggestButton']['bind']('isEnabled')['to'](this),this['_suggestButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),_0x1c6e22['push'](this['_suggestButton']));const _0x5e2f16=new Pt(_0x254b87);_0x5e2f16['set']({'label':ls(_0x254b87,'AI_SUGGESTION_CONTENT_PART_REJECT'),'tooltip':!0x0,'tooltipPosition':'n','withText':!0x1,'icon':_0x4fad88}),_0x5e2f16['bind']('isEnabled')['to'](this),_0x5e2f16['on']('execute',()=>{this['fire']('rejectSuggestion');}),_0x1c6e22['push'](_0x5e2f16);}this['items']['addMany'](_0x1c6e22);const _0x30fb80=this['bindTemplate'];this['extendTemplate']({'attributes':{'class':[_0x30fb80['if']('isVisible','ck-hidden',_0x1599f2=>!_0x1599f2)]}});}['setButtonsVisibility']({showApplyButton:_0x194fca,showSuggestButton:_0x23a085}){this['_applyButton']&&(this['_applyButton']['isVisible']=_0x194fca),this['_suggestButton']&&(this['_suggestButton']['isVisible']=_0x23a085);}},Yn=class extends _0x1e8352{['toolbarView'];['stateView'];['titleLabelView'];['children'];constructor(_0x32fec3,{part:_0x2548e9,uiIndex:_0x10b5cf,availableActions:_0x57567d,areActionsDisabled:_0x431565}){super(_0x32fec3),this['set']('isEnabled',!0x0),this['set']('state','pending'),this['set']('isTrackChangesOn',!0x1),this['toolbarView']=new Wn(_0x32fec3,_0x57567d,_0x431565),this['toolbarView']['on']('rejectSuggestion',()=>{this['fire']('rejectSuggestion',{'index':_0x2548e9['index']});}),this['toolbarView']['on']('insertSuggestion',()=>{this['fire']('insertSuggestion',{'index':_0x2548e9['index']});}),this['toolbarView']['on']('applySuggestion',()=>{this['fire']('applySuggestion',{'index':_0x2548e9['index']});}),this['toolbarView']['bind']('isEnabled','isTrackChangesOn')['to'](this),this['stateView']=new Fn(_0x32fec3),this['titleLabelView']=new $n(_0x32fec3,_0x10b5cf),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',(_0x27514f,_0x267cd5,_0x303af4,_0x443470)=>{'pending'===_0x443470?this['children']['remove'](this['toolbarView']):this['children']['remove'](this['stateView']),'pending'===_0x303af4?this['children']['add'](this['toolbarView']):(this['stateView']['setState'](_0x303af4),this['children']['add'](this['stateView']));});}},$n=class extends _0x1e8352{constructor(_0x2b2002,_0x13b2ed){super(_0x2b2002),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__body__content-part__title__label']},'children':[ls(_0x2b2002,'AI_SUGGESTION_CONTENT_PART_TITLE',_0x13b2ed['toString']())]});}},qn=class extends _0x1e8352{['htmlStreamer'];constructor(_0x55b55b){super(_0x55b55b),this['htmlStreamer']=new Ln(),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai-suggestion-streamable-content']}});}async['update']({part:_0x3b7bea,renderingStrategy:_0x4942d0,abortSignal:_0x214263}){const _0x4c0760=_0x5c7833(_0x3b7bea['content'],!0x0);for(const _0x1aa798 of Ts(_0x4c0760))_0x5d7a74(_0x1aa798);'streaming'===_0x4942d0?await this['htmlStreamer']['stream']({'document':_0x4c0760,'targetElement':this['element'],'abortSignal':_0x214263}):_0x488cd9(this['element'],'<'+this['element']['tagName']+'>'+ps(_0x4c0760)+'</'+this['element']['tagName']+'>',{'childrenOnly':!0x0});}['clear'](){this['htmlStreamer']['reset'](),this['element']['innerHTML']='',this['element']['scrollTop']=0x0;}['cleanUpStreamingArtifacts'](){Mn(this['htmlStreamer'],this['element']);}},Qn=class extends _0x1e8352{['_children'];['_headerView'];['_streamableContentView'];constructor(_0x1750d0,{part:_0x11831b,uiIndex:_0x555896,areActionsDisabled:_0x76b371,availableActions:_0x76fb94}){super(_0x1750d0);const _0x51b378=this['bindTemplate'];this['set']('state','pending'),this['set']('isDone',!0x1),this['set']('isVisible',!0x1),this['set']('isActive',!0x1),this['set']('isEnabled',!0x1),this['set']('isTrackChangesOn',!0x1);const _0x5679ff=()=>{this['isEnabled']=this['isDone']&&'pending'==this['state']&&!_0x76b371;};this['on']('change:state',_0x5679ff),this['on']('change:isDone',_0x5679ff),_0x5679ff(),this['_children']=this['createCollection'](),this['_headerView']=new Yn(_0x1750d0,{'part':_0x11831b,'uiIndex':_0x555896,'availableActions':_0x76fb94,'areActionsDisabled':_0x76b371}),this['_headerView']['bind']('isEnabled','state','isTrackChangesOn')['to'](this),this['_headerView']['delegate'](...Nn)['to'](this),this['_streamableContentView']=new qn(_0x1750d0),this['_children']['addMany']([this['_headerView'],this['_streamableContentView']]),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-part',_0x51b378['to']('state',_0x3fa11d=>'ck-ai-suggestion__body__content-part_'+_0x3fa11d),_0x51b378['if']('isEnabled','ck-ai-suggestion__body__content-part_enabled'),_0x51b378['if']('isActive','ck-ai-suggestion__body__content-part_active'),_0x51b378['if']('isVisible','ck-hidden',_0x19f6ad=>!_0x19f6ad)]},'children':this['_children'],'on':{'mouseenter':_0x51b378['to'](()=>{this['isEnabled']&&this['fire']('mouseOverSuggestion',{'index':_0x11831b['index']});}),'mouseleave':_0x51b378['to'](()=>{this['isEnabled']&&this['fire']('mouseLeaveSuggestion',{'index':_0x11831b['index']});}),'click':_0x51b378['to'](_0xcf45c1=>{const _0x57c504=_0xcf45c1['target'];this['isEnabled']&&!this['_headerView']['toolbarView']['element']['contains'](_0x57c504)&&this['fire']('showChangeInText',{'index':_0x11831b['index']});})}});}async['updateContent']({part:_0x548b2a,showUnchangedParts:_0x42b3d9=!0x1,abortSignal:_0xccc84d}){this['partDefinition']=_0x548b2a,this['isVisible']=this['partDefinition']['hasChanges']||_0x42b3d9,this['isVisible']&&await this['_streamableContentView']['update']({'part':_0x548b2a,'renderingStrategy':'static','abortSignal':_0xccc84d});}['markAsDone'](){this['isDone']=!0x0;}},Xn=class extends _0x1e8352{constructor(_0x144652,_0x5a6488){super(_0x144652),this['set']('isVisible',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-skeleton',this['bindTemplate']['if']('isVisible','ck-hidden',_0x30fe06=>!_0x30fe06)]},'children':this['_createSkeletonItems'](_0x5a6488)});}['_createSkeletonItems'](_0x3d1572){const _0x30fed6=['ck','ck-ai-skeleton__item'];return _0x3d1572['map'](_0x320176=>{let _0x1670d1='';switch(_0x320176['attributes']['align']){case'right':_0x1670d1='margin-left:\x20auto;\x20margin-right:\x200;\x20text-align:\x20right;';break;case'center':_0x1670d1='margin-left:\x20auto;\x20margin-right:\x20auto;\x20text-align:\x20center;';break;case'left':_0x1670d1='margin-left:\x200;\x20margin-right:\x20auto;\x20text-align:\x20left;';}return{'tag':_0x320176['tag'],'attributes':{'class':[..._0x30fed6,_0x320176['attributes']['class']?_0x320176['attributes']['class']:''],'style':'width:\x20'+_0x320176['attributes']['width']+';\x20height:\x20'+_0x320176['attributes']['height']+';'+_0x1670d1}};});}};const zn={'aiSuggestionBody':[{'tag':'div','attributes':{'width':'50%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'85%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'75%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}}],'aiFeed':[{'tag':'div','attributes':{'width':'100%','height':'72px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}},{'tag':'div','attributes':{'width':'150px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'140px','align':'right'}},{'tag':'div','attributes':{'width':'250px','height':'40px','align':'right'}},{'tag':'div','attributes':{'width':'100%','height':'88px','align':'right'}}],'aiHistory':jn(0x5,'100%','44px','right'),'aiChatResources':jn(0x8,'100%','24px','right'),'aiReviewChecks':[{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'100%','height':'24px','align':'left'}},{'tag':'div','attributes':{'width':'128px','height':'24px','align':'left'}}]};function jn(_0x339f45,_0x1b6b4a,_0x27fccf,_0x5a2246){return new Array(_0x339f45)['fill'](null)['map'](()=>({'tag':'div','attributes':{'width':_0x1b6b4a,'height':_0x27fccf,'align':_0x5a2246}}));}const Jn=/* #__PURE__ -- @preserve */
|
|
33
|
+
lt();var Zn=class extends Jn{['queue']=[];['isProcessing']=!0x1;['_abortController'];async['enqueue'](_0x42623e){const _0x6fd28e=this['createTask'](_0x42623e);return this['queue']['push'](_0x6fd28e),this['_processQueue'](),_0x6fd28e['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(_0xcb074a=>{this['once']('_queueEmpty',()=>{_0xcb074a();});}):Promise['resolve']();}async['_processQueue'](){if(!this['isProcessing']){this['_abortController']=new AbortController(),this['isProcessing']=!0x0;try{for(;this['queue']['length']&&this['isProcessing'];){const _0x1a9307=this['queue']['shift']();try{await _0x1a9307['callback'](this['_abortController']['signal']),_0x1a9307['resolve']();}catch(_0x48c5b2){_0x1a9307['reject'](_0x48c5b2);}}}finally{this['isProcessing']=!0x1,this['_abortController']=void 0x0;}this['fire']('_queueEmpty');}}['createTask'](_0x566c04){let _0x20cbe0,_0x2202ff;const _0x330134=new Promise((_0x151e5d,_0x497576)=>{_0x20cbe0=_0x151e5d,_0x2202ff=_0x497576;});return{'callback':_0x566c04,'resolve':_0x20cbe0,'reject':_0x2202ff,'completePromise':_0x330134};}},tr=class extends Vn{constructor(_0x385a60){super(_0x385a60),this['extendTemplate']({'attributes':{'class':['ck-ai-notification','warning'===_0x385a60['level']?'ck-ai-notification_warning':'ck-ai-notification_error']}});}['render'](){super['render'](),this['setContent'](this['options']['initialContent']),this['markAsDone']();}['setContent'](_0x155e75){this['element']['innerHTML']=_0x155e75;}};const er=['applySuggestion','insertSuggestion'];var ir=class extends _0x1e8352{['_applyChangesButton'];['_insertSuggestionsButton'];['children'];constructor(_0x4a47ee,_0x9d8c35=[...er],_0x403016){super(_0x4a47ee);const _0x222b3c=this['bindTemplate'],_0x333148=Boolean(_0x403016);if(this['set']('isEnabled',!_0x333148),this['set']('isVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),_0x333148){const _0x21f1a3=new Pt(_0x4a47ee);_0x21f1a3['set']({'label':ls(_0x4a47ee,'AI_SUGGESTION_DISABLED_TOOLTIP_MESSAGE'),'tooltip':!0x0,'withText':!0x1,'icon':_0x220b4a}),_0x21f1a3['extendTemplate']({'attributes':{'data-cke-tooltip-class':'ck-ai-suggestion-content-part-disabled-actions-tooltip'}});const _0x64fb72=new _0x1e8352(_0x4a47ee);_0x64fb72['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat__feed__suggestion__actions__info'},'children':[{'tag':'p','children':[ls(_0x4a47ee,'AI_SUGGESTION_DISABLED_FEED_MESSAGE'),_0x21f1a3]}]}),this['children']['add'](_0x64fb72);}else this['_applyChangesButton']=new Pt(_0x4a47ee),this['_applyChangesButton']['set']({'label':ls(_0x4a47ee,'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),'withText':!0x0,'type':'button','isVisible':_0x9d8c35['includes']('applySuggestion'),'class':an}),this['_insertSuggestionsButton']=new Pt(_0x4a47ee),this['_insertSuggestionsButton']['set']({'label':ls(_0x4a47ee,'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL'),'withText':!0x0,'type':'button','isVisible':_0x9d8c35['includes']('insertSuggestion'),'class':hn}),this['_insertSuggestionsButton']['on']('execute',()=>{this['fire']('insertSuggestion');}),this['_applyChangesButton']['on']('execute',()=>{this['fire']('applySuggestion');}),[this['_applyChangesButton'],this['_insertSuggestionsButton']]['forEach'](_0x5ba1ab=>{_0x5ba1ab['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',_0x222b3c['if']('isVisible','ck-hidden',_0x36184a=>!_0x36184a)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_applyChangesButton']&&(this['_applyChangesButton']['isVisible']=!this['isTrackChangesOn']);});}['updateVisibility'](_0x505484){this['isVisible']=_0x505484;}['_switchButtonLabelsPlurality'](_0x20adf3){this['_applyChangesButton']&&this['_insertSuggestionsButton']&&(_0x20adf3?(this['_applyChangesButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY_ALL'),this['_insertSuggestionsButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST_ALL')):(this['_applyChangesButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_APPLY'),this['_insertSuggestionsButton']['label']=ls(this['locale'],'AI_CHAT_SUGGESTION_ACTION_SUGGEST')));}},sr=class extends _0x1e8352{['children'];['balloonPanelView'];['bodyCollection'];constructor(_0x2f55ca,_0x90a152){super(_0x2f55ca),this['bodyCollection']=_0x90a152,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',_0x10d2f4=>!_0x10d2f4)]},'children':this['children']});const _0x801da7=new _0x1e8352(this['locale']),_0x44a9dd=new Wt();_0x44a9dd['content']=ot,_0x801da7['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-sources__header']},'children':[_0x44a9dd,{'tag':'span','children':[{'text':ls(this['locale'],'AI_CHAT_SOURCES_HEADER')}]}]}),this['children']['add'](_0x801da7),this['_setupBalloonPanel'](_0x2f55ca);}['addSource'](_0x5913fc){this['children']['add'](new nr(this['locale'],_0x5913fc,this['balloonPanelView']));}['_setupBalloonPanel'](_0x3e09c2){this['balloonPanelView']=new Nt(_0x3e09c2),this['balloonPanelView']['extendTemplate']({'attributes':{'class':['ck-ai-web-source__tooltip-balloon']}}),this['bodyCollection']['add'](this['balloonPanelView']);}},nr=class extends Pt{['balloonPanelView'];['source'];constructor(_0x3fc9e3,_0x2a81c3,_0x3bf54e){super(_0x3fc9e3),this['source']=_0x2a81c3,this['balloonPanelView']=_0x3bf54e,this['set']({'label':_0x2a81c3['title'],'class':['ck\x20ck-ai-web-source'],'withText':!0x0});const _0x48b2f8=this['bindTemplate'];if(this['extendTemplate']({'on':{'click':_0x48b2f8['to'](()=>{window['open'](_0x2a81c3['url'],'_blank');}),'mouseenter':_0x48b2f8['to'](()=>{this['_showTooltip']();}),'mouseleave':_0x48b2f8['to'](()=>{this['_hideTooltip']();})}}),_0x2a81c3['favicon']){const _0x3034b8=new _0x1e8352(_0x3fc9e3);_0x3034b8['setTemplate']({'tag':'img','attributes':{'src':_0x2a81c3['favicon']||ot,'alt':_0x2a81c3['title'],'class':['ck-ai-web-source__image']}}),this['children']['add'](_0x3034b8);}else this['set']('icon',ot);}['_createTooltipContentView'](_0x356808,_0x4c0863){const _0x13027f=new _0x1e8352(_0x356808),_0x455d15=[];let _0x11eeb9;_0x4c0863?.['favicon']?(_0x11eeb9=new _0x1e8352(_0x356808),_0x11eeb9['setTemplate']({'tag':'img','attributes':{'src':_0x4c0863['favicon'],'alt':_0x4c0863['title'],'class':['ck-ai-web-source__tooltip-image']}})):(_0x11eeb9=new Wt(),_0x11eeb9['content']=ot,_0x11eeb9['extendTemplate']({'attributes':{'alt':_0x4c0863['title'],'class':['ck-ai-web-source__tooltip-image']}})),_0x455d15['push'](_0x11eeb9);const _0x181deb=new _0x1e8352(_0x356808);_0x181deb['setTemplate']({'tag':'a','attributes':{'class':['ck-ai-web-source__tooltip-url'],'href':_0x4c0863['url']},'children':[{'text':new URL(_0x4c0863['url'])?.['hostname']}]}),_0x455d15['push'](_0x181deb);const _0x5b9779=new _0x1e8352(_0x356808);_0x5b9779['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-web-source__tooltip-row']},'children':_0x455d15});const _0xe882b8=new _0x1e8352(_0x356808);return _0xe882b8['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-web-source__tooltip-row','ck-ai-web-source__tooltip-title']},'children':[{'text':_0x4c0863['title']['length']>0x190?_0x4c0863['title']['substring'](0x0,0x190)+'...':_0x4c0863['title']}]}),_0x13027f['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-web-source__tooltip']},'children':[_0x5b9779,_0xe882b8]}),_0x13027f;}['_showTooltip'](){this['_updateTooltipContent'](),this['balloonPanelView']['pin']({'target':this['element'],'positions':[Nt['defaultPositions']['northArrowSouth'],Nt['defaultPositions']['northArrowSouthWest'],Nt['defaultPositions']['northArrowSouthEast']],'limiter':document['querySelector']('.ck-ai-chat')}),this['balloonPanelView']['show']();}['_hideTooltip'](){this['balloonPanelView']['hide']();}['_updateTooltipContent'](){this['balloonPanelView']['content']['get'](0x0)?.['destroy'](),this['balloonPanelView']['content']['clear']();const _0x1679e1=this['_createTooltipContentView'](this['locale'],this['source']);this['balloonPanelView']['content']['add'](_0x1679e1);}},rr=class extends _0x1e8352{['_actionsView'];['_sourcesView'];['_children'];['_skeletonView'];['_showSkeletonDebounced']=_0x173d8f(()=>{this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now']();},0x3e8);['_skeletonShownAt']=null;['_areActionsDisabled'];['_showUnchangedParts'];['_updateContentPartsPromiseQueue'];['_emptyPartsWarningView'];['_availableActions'];['_cachedContentParts']=[];constructor(_0x16cba0,_0x4733bd){super(_0x16cba0);const {areActionsDisabled:_0x248566,showUnchangedParts:_0x265814,availableActions:_0x25f88d}=_0x4733bd;this['_areActionsDisabled']=_0x248566,this['_showUnchangedParts']=_0x265814,this['_availableActions']=_0x25f88d,this['set']('hasPendingParts',!0x1),this['set']('isTrackChangesOn',!0x1),this['_children']=this['createCollection'](),this['_skeletonView']=new Xn(_0x16cba0,zn['aiSuggestionBody']),this['_skeletonView']['isVisible']=!0x0,this['_skeletonShownAt']=Date['now'](),this['_children']['add'](this['_skeletonView']),this['_updateContentPartsPromiseQueue']=new Zn(),this['_emptyPartsWarningView']=new tr({'id':'empty-parts-warning','initialContent':ls(_0x16cba0,'AI_SUGGESTION_EMPTY_PART_WARNING'),'level':'warning'}),this['_emptyPartsWarningView']['isVisible']=!0x1,this['_actionsView']=new ir(_0x16cba0,_0x4733bd['availableActions'],this['_areActionsDisabled']),this['_actionsView']['bind']('isTrackChangesOn')['to'](this),this['_sourcesView']=new sr(this['locale'],_0x4733bd['bodyCollection']),_0x4733bd['areActionsDisabled']?this['_actionsView']['isEnabled']=!0x1:this['_actionsView']['bind']('isEnabled')['to'](this,'hasPendingParts'),this['_actionsView']['delegate'](...Nn)['to'](this),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body']},'children':[{'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__body__content-parts']},'children':this['_children']},this['_emptyPartsWarningView'],this['_actionsView'],this['_sourcesView']]});}['destroy'](){this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),super['destroy']();}get['partsCount'](){return this['_contentPartViews']['length'];}get['_contentPartViews'](){return Array['from'](this['_children'])['filter'](_0x3d35e8=>_0x3d35e8 instanceof Qn);}async['updateContentParts']({parts:_0x43d0cc,abortSignal:_0x2412da,skipLoadingEffects:_0x2e4705}){this['_cachedContentParts']['length']?_0x43d0cc['forEach'](_0x1da6e5=>{const _0x581763=this['_cachedContentParts']['findIndex'](_0x1b93d8=>_0x1b93d8['index']==_0x1da6e5['index']);-0x1===_0x581763?this['_cachedContentParts']['push'](_0x1da6e5):this['_cachedContentParts'][_0x581763]=_0x1da6e5;}):this['_cachedContentParts']=_0x43d0cc;const _0x16d713=this['_showUnchangedParts']?_0x43d0cc:_0x43d0cc['filter'](_0x578d27=>_0x578d27['hasChanges']);this['_actionsView']['_switchButtonLabelsPlurality'](_0x16d713['length']>0x1),_0x2e4705&&(this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1);for(const _0x805b33 of _0x16d713)this['_updateContentPartsPromiseQueue']['enqueue'](async _0x37cdfb=>{let _0x28f5e8=this['getPartView'](_0x805b33['index']);if(!_0x28f5e8){if(_0x28f5e8=new Qn(this['locale'],{'part':_0x805b33,'uiIndex':this['_contentPartViews']['length']+0x1,'areActionsDisabled':this['_areActionsDisabled'],'availableActions':this['_availableActions']}),_0x28f5e8['delegate'](...Nn)['to'](this),_0x28f5e8['bind']('isTrackChangesOn')['to'](this),!_0x2e4705&&(this['_showSkeletonDebounced']['cancel'](),await this['_awaitMinimumSkeletonDisplayTime'](_0x37cdfb),_0x37cdfb['aborted']))return;this['_skeletonView']['isVisible']=!0x1,this['_children']['add'](_0x28f5e8,this['_children']['length']-0x1),this['hasPendingParts']=!0x0,_0x2e4705||this['_showSkeletonDebounced']();}await _0x28f5e8['updateContent']({'part':_0x805b33,'showUnchangedParts':this['_showUnchangedParts'],'abortSignal':_0x37cdfb}),_0x28f5e8['markAsDone']();});return _0x2412da?.['addEventListener']('abort',()=>{this['_updateContentPartsPromiseQueue']['abort'](),this['_showSkeletonDebounced']['cancel'](),this['_skeletonView']['isVisible']=!0x1;}),this['_updateContentPartsPromiseQueue']['queueEmptyPromise'];}['updatePartState'](_0x161166,_0x2f4a14){const _0x179a82=this['getPartView'](_0x161166);_0x179a82&&(_0x179a82['state']=_0x2f4a14),this['hasPendingParts']='pending'==_0x2f4a14||this['_contentPartViews']['some'](_0x37629d=>'pending'==_0x37629d['state']);}['setPartActive'](_0x49e1a7,_0x46d56c){if(!0x1===_0x49e1a7){for(const _0x3336f5 of this['_contentPartViews'])_0x3336f5['isActive']=!0x1;}else{const _0x1154d9=this['getPartView'](_0x49e1a7);_0x1154d9&&(_0x1154d9['isActive']=_0x46d56c);}}['updateSources'](_0x250835){_0x250835['forEach'](_0x3e71c2=>this['_sourcesView']['addSource'](_0x3e71c2)),this['_sourcesView']['isVisible']=!0x0;}['getPartView'](_0x321f45){return this['_contentPartViews']['find'](_0x18826a=>_0x18826a['partDefinition']['index']==_0x321f45)??null;}['markAsDone'](){if(!this['_showUnchangedParts']){const _0x9863f9=!this['_cachedContentParts']['find'](({hasChanges:_0x18d018})=>_0x18d018),_0x35d27c=!!this['_cachedContentParts']['find'](({hasChanges:_0x1ea8b4})=>!_0x1ea8b4);this['_emptyPartsWarningView']['isVisible']=0x0==this['_contentPartViews']['length']||_0x35d27c,_0x9863f9?this['_emptyPartsWarningView']['setContent'](ls(this['locale'],'AI_SUGGESTION_NO_PARTS_WARNING')):this['_emptyPartsWarningView']['setContent'](ls(this['locale'],'AI_SUGGESTION_EMPTY_PART_WARNING'));}this['_contentPartViews']['forEach'](_0x6d9b03=>_0x6d9b03['markAsDone']()),this['_skeletonView']['isVisible']=!0x1,this['_showSkeletonDebounced']['cancel'](),this['_actionsView']['updateVisibility'](this['hasNonEmptyParts']);}async['_awaitMinimumSkeletonDisplayTime'](_0x38d234){if(!this['_skeletonView']['isVisible']||null===this['_skeletonShownAt'])return;const _0x904cc8=0x3e8-(Date['now']()-this['_skeletonShownAt']);if(this['_skeletonShownAt']=null,_0x904cc8>0x0){const {promise:_0x5d6df9,abortController:_0x43addf}=xn(_0x904cc8);_0x38d234?.['addEventListener']('abort',()=>_0x43addf['abort']()),await _0x5d6df9['catch'](()=>{});}}get['hasNonEmptyParts'](){return this['_contentPartViews']['filter'](_0x3c8803=>_0x3c8803['partDefinition']['hasChanges'])['length']>0x0;}},or=class extends _0x1e8352{['bodyView'];['children'];['headerView'];constructor(_0x2da491,_0x21a5f5,_0x3a0576){super(_0x2da491);const {showDiff:_0xaeebff,areActionsDisabled:_0x2eddc0,showUnchangedParts:_0x3d39cf,availableActions:_0x32ca07}=_0x21a5f5;this['set']('isTrackChangesOn',!0x1),this['set']('areChangesVisible',!0x1),this['children']=this['createCollection'](),this['headerView']=new Un(_0x2da491,{'showDiff':_0xaeebff}),this['headerView']['on']('toggleShowChanges',(_0x3fcc0e,_0x3c99bc)=>{this['areChangesVisible']=_0x3c99bc['isOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':_0x3c99bc['isOn']});}),this['children']['add'](this['headerView']),this['bodyView']=new rr(_0x2da491,{'areActionsDisabled':_0x2eddc0,'showUnchangedParts':!!_0x3d39cf,'availableActions':_0x32ca07,'bodyCollection':_0x3a0576}),this['bodyView']['delegate'](...Nn)['to'](this),this['bodyView']['bind']('isTrackChangesOn')['to'](this),this['children']['add'](this['bodyView']),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__container','ck-rounded-corners']},'children':this['children']});}async['updateContent'](_0x223db4){await this['bodyView']['updateContentParts'](_0x223db4);}['updateSources'](_0x144798){this['bodyView']['updateSources'](_0x144798);}['markAsDone'](){this['bodyView']['markAsDone'](),this['headerView']&&(this['headerView']['isShowChangesToggleVisible']=this['bodyView']['hasNonEmptyParts']);}},ar=class extends Vn{['containerView'];constructor(_0x1e83e8,_0x27a4b3,_0x49fc1c){super(_0x27a4b3),this['set']('isTrackChangesOn',!0x1),this['containerView']=new or(_0x1e83e8,{'showDiff':_0x27a4b3['showDiff'],'areActionsDisabled':_0x27a4b3['areActionsDisabled'],'availableActions':_0x27a4b3['availableActions']},_0x49fc1c),this['containerView']['on']('toggleSuggestionDisplayMode',(_0x19b312,_0x2d0265)=>{this['fire']('toggleSuggestionDisplayMode',{'replyId':this['options']['id'],'showDiff':_0x2d0265['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',(_0x3fb726,{index:_0x33fd47})=>{this['fire']('showChangeInText',{'replyId':this['options']['id'],'partIndex':_0x33fd47});}),this['containerView']['on']('applySuggestion',(_0x2d16bc,{index:_0x31041f}={})=>{this['fire']('applySuggestion',{'replyId':this['options']['id'],'partIndex':_0x31041f});}),this['containerView']['on']('insertSuggestion',(_0x255703,{index:_0x2d54ec}={})=>{this['fire']('insertSuggestion',{'replyId':this['options']['id'],'partIndex':_0x2d54ec});}),this['containerView']['on']('rejectSuggestion',(_0x268d49,{index:_0x533095})=>{this['fire']('rejectSuggestion',{'replyId':this['options']['id'],'partIndex':_0x533095});}),this['containerView']['on']('mouseOverSuggestion',(_0x3ed947,{index:_0x3bbe88})=>{this['fire']('mouseOverSuggestion',{'replyId':this['options']['id'],'partIndex':_0x3bbe88});}),this['containerView']['on']('mouseLeaveSuggestion',(_0x416f2f,{index:_0x1b4382})=>{this['fire']('mouseLeaveSuggestion',{'replyId':this['options']['id'],'partIndex':_0x1b4382});}),this['children']['addMany']([this['containerView']]),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-suggestion']}});}async['updateContent'](_0x4cb114){await this['containerView']['updateContent'](_0x4cb114);}['updatePartState'](_0x1f6d63,_0xf48f60){this['containerView']['bodyView']['updatePartState'](_0x1f6d63,_0xf48f60);}['setPartActive'](_0x2319cf,_0x5e95ed){!0x1===_0x2319cf?this['containerView']['bodyView']['setPartActive'](!0x1):this['containerView']['bodyView']['setPartActive'](_0x2319cf,_0x5e95ed);}['updateSources'](_0x4a2bc9){this['containerView']['updateSources'](_0x4a2bc9);}['getPartView'](_0x197161){return this['containerView']['bodyView']['getPartView'](_0x197161);}['markAsDone'](){super['markAsDone'](),this['containerView']['markAsDone']();}},hr=class extends Vn{['replyContainer'];['_bodyCollection'];constructor(_0x27e879,_0x1bbdca,_0x5b06c8){super(_0x1bbdca),this['_bodyCollection']=_0x5b06c8,this['locale']=_0x27e879,this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__ai-reply']}}),this['replyContainer']=new _0x1e8352(),this['replyContainer']['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all-excluded','ck-ai-chat__feed__ai-reply-container','ck-ai-chat-content']}}),this['children']['add'](this['replyContainer']);}async['render'](){super['render'](),this['options']['initialContent']&&(await this['updateContent']({'parsedContent':Is(this['options']['initialContent']),'renderingStrategy':'static'}),this['markAsDone']());}async['updateContent']({parsedContent:_0x413d82,renderingStrategy:_0x3091d1,abortSignal:_0x54ad73}){'streaming'===_0x3091d1?await this['streamIntoElement'](_0x413d82,this['replyContainer']['element'],_0x54ad73):this['replyContainer']['element']['innerHTML']=_0x5286d3(_0x413d82);}['updateSources'](_0x2bd1dc){const _0x25427e=new sr(this['locale'],this['_bodyCollection']);_0x25427e['children']['addMany'](_0x2bd1dc['map'](_0x34f626=>new nr(this['locale'],_0x34f626,_0x25427e['balloonPanelView']))),_0x25427e['isVisible']=!0x0,this['children']['add'](_0x25427e);}},cr=class extends _0xc9ae37{constructor(_0x562e3a=void 0x0){super();const _0x32abe7=_0x562e3a?'ck-ai-spinner_'+_0x562e3a:'';this['extendTemplate']({'tag':'span','attributes':{'class':['ck-ai-spinner',_0x32abe7]}});}};const lr={'file':_0x5807c5,'image':_0x566c8e,'document':_0x5549b7,'web-resource':_0x368e79,'text':_0x5807c5,'selection':_0x129906,'mcp-tool-context':_0x5549b7},ur='ck-ai-chat-context-chip',dr='ck-ai-chat-context-chip_wide',_r='ck-ai-chat-context-chip_document',gr='ck-ai-chat-context-chip__label',Ar='ck-ai-chat-context-chip__type-icon',Ir='ck-ai-chat-context-controls__chip-tooltip',pr='n';var mr=class extends Pt{constructor(_0x14a6d0,_0x201571,_0x20de77,_0x16e10b,_0x320e83=!0x1){super(_0x14a6d0),this['_isAnimationOnEnterEnabled']=_0x16e10b,this['_initializeProperties'](_0x201571,_0x20de77,_0x320e83),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'](_0x3d90ec,_0x300f85,_0x1e525a){this['set']('label',_0x3d90ec['label']),this['set']('tooltip',!0x0),this['set']('itemType',_0x3d90ec['type']),this['set']('id',_0x3d90ec['uiId']),this['set']('readonly',_0x300f85),this['set']('isLoading',_0x1e525a);}['_setupTemplate'](){const _0x1daa3f=this['_createIconView'](),_0x352082=this['_createRemoveButton'](),_0x3161f6=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':this['_createTemplateAttributes'](_0x3161f6),'children':this['_createTemplateChildren'](_0x1daa3f,_0x352082,_0x3161f6)});}['_createTemplateAttributes'](_0x3d9432){return{'class':[ur,_0x3d9432['if']('itemType',_r,_0x5754b0=>'document'==_0x5754b0),_0x3d9432['if']('itemType',dr,_0x323bb9=>'selection'==_0x323bb9)],'data-cke-tooltip-text':_0x3d9432['to']('label',Er),'data-cke-tooltip-position':pr,'data-cke-tooltip-class':Ir};}['_createTemplateChildren'](_0x329cfb,_0x51ecc3,_0x1f1e88){const _0x1d4ec5=this['_createLabelElement'](_0x1f1e88),_0x3caf5c=this['_createLoaderIcon']();return this['readonly']?[_0x329cfb,_0x1d4ec5]:[_0x329cfb,_0x3caf5c,_0x1d4ec5,_0x51ecc3];}['_createLabelElement'](_0x925168){return{'tag':'span','attributes':{'class':gr},'children':[{'text':_0x925168['to']('label')}]};}['_createRemoveButton'](){const _0x5a5cc6=new Pt(this['locale']);return _0x5a5cc6['set']({'label':ls(this['locale'],'AI_CHAT_CONTEXT_REMOVE_FROM_CONTEXT'),'icon':_0x556600}),this['_setupRemoveButtonEvent'](_0x5a5cc6),_0x5a5cc6;}['_setupRemoveButtonEvent'](_0x361856){_0x361856['on']('execute',()=>{this['fire']('removeContextItemChip',this['id']);});}['_createIconView'](){const _0x2f14a1=this['bindTemplate'],_0x568bd9=new Wt();return _0x568bd9['content']=lr[this['itemType']],_0x568bd9['extendTemplate']({'attributes':{'class':[Ar,_0x2f14a1['if']('isLoading','ck-hidden',_0x105d67=>_0x105d67)]}}),_0x568bd9;}['_handleAnimationEndOnce'](_0x484ee7,_0x1e6644){if(!_0x484ee7)return;const _0x29652d=()=>{_0x1e6644(),_0x484ee7['removeEventListener']('animationend',_0x29652d),_0x484ee7['removeEventListener']('webkitAnimationEnd',_0x29652d);};_0x484ee7['addEventListener']('animationend',_0x29652d),_0x484ee7['addEventListener']('webkitAnimationEnd',_0x29652d);}['_createLoaderIcon'](){const _0xd632cc=new cr('small');return _0xd632cc['bind']('isVisible')['to'](this,'isLoading',_0x31e315=>_0x31e315),_0xd632cc;}};function Er(_0x1a5292){if(!_0x1a5292)return _0x1a5292;if(_0x1a5292['length']<=0x78)return _0x1a5292;const _0x5a3ff3=_0x1a5292['slice'](0x0,0x78),_0x24a552=_0x5a3ff3['lastIndexOf']('\x20');return(_0x24a552>0x0?_0x5a3ff3['slice'](0x0,_0x24a552):_0x5a3ff3)+'…';}const Tr={'maxVisibleRows':0x2,'rowDetectionTolerance':0x5,'showMoreLabelPrefix':'+\x20','viewportOffset':{'top':0x64,'bottom':0xa}},wr='300px';var Cr=class{['_locale'];['_config'];['_visibleChips'];['_overflowChips'];['_showMoreButtonView']=null;['_showMoreBalloonPanelView']=null;['_containerElement']=null;['_bodyCollection'];['_parentView']=null;['_intersectionObserver']=null;['_pendingCalculation']=!0x1;constructor(_0xd90cb3,_0x3d9ea9,_0x120798,_0x2f67f8,_0x4984bc){this['_locale']=_0xd90cb3,this['_visibleChips']=_0x3d9ea9,this['_config']={...Tr,..._0x120798,'cssClasses':{'controlsButton':'','calculationContainer':'ck-calculation-container',..._0x120798['cssClasses']}},this['_overflowChips']=new ht(),this['_bodyCollection']=_0x2f67f8,this['_parentView']=_0x4984bc||null;}['setContainerElement'](_0x58b2bf){this['_intersectionObserver']&&(this['_intersectionObserver']['disconnect'](),this['_intersectionObserver']=null),this['_containerElement']=_0x58b2bf,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 _0x1b2dfd=[...this['_visibleChips'],...this['_overflowChips']],_0x9246ca=this['_createCalculationContainer'](),_0x5a9492=this['_calculateOverflowInContainer'](_0x9246ca,_0x1b2dfd),_0x4df12e=_0x9246ca['_ancestorsToRestore'];_0x4df12e&&this['_restoreAncestorVisibility'](_0x4df12e),_0x9246ca['remove'](),this['_applyOverflowResults'](_0x1b2dfd,_0x5a9492);}['_createShowMoreButton'](){this['_showMoreButtonView']=this['_createShowMoreButtonView'](),this['_showMoreBalloonPanelView']=this['_createShowMoreBalloonPanelView'](),this['_showMoreButtonView']['render'](),this['_containerElement']['appendChild'](this['_showMoreButtonView']['element']),this['_showMoreButtonView']['on']('execute',()=>{this['_handleShowMoreButtonClick']();}),_0x262419({'emitter':this['_showMoreBalloonPanelView'],'contextElements':[this['_showMoreBalloonPanelView']['element'],this['_showMoreButtonView']['element']],'callback':()=>this['hideBalloonPanel'](),'activator':()=>this['_showMoreButtonView']['isOn']});}['_createShowMoreButtonView'](){const _0x1cc7c4=new Pt(this['_locale']);_0x1cc7c4['set']({'label':'','withText':!0x0,'isToggleable':!0x0});const _0x2e6e24=[this['_config']['cssClasses']['showMoreButton']];return this['_config']['cssClasses']['controlsButton']&&_0x2e6e24['push'](this['_config']['cssClasses']['controlsButton']),_0x1cc7c4['extendTemplate']({'attributes':{'class':_0x2e6e24}}),_0x1cc7c4;}['_createShowMoreBalloonPanelView'](){const _0x527c6d=new Nt(this['_locale']);return _0x527c6d['extendTemplate']({'attributes':{'class':this['_config']['cssClasses']['showMoreBalloon']}}),this['_bodyCollection']['add'](_0x527c6d),_0x527c6d;}['_updateBalloonContent'](){if(this['_showMoreBalloonPanelView']&&(this['_showMoreBalloonPanelView']['content']['clear'](),this['_overflowChips']['length']>0x0)){this['_overflowChips']['forEach'](_0x43a4fd=>{_0x43a4fd['disableAnimationOnEnter']();});const _0x217d2c=new _0x1e8352(this['_locale']);_0x217d2c['setTemplate']({'tag':'div','attributes':{'class':this['_config']['cssClasses']['overflowContainer']},'children':this['_overflowChips']}),this['_showMoreBalloonPanelView']['content']['add'](_0x217d2c);}}['_handleShowMoreButtonClick'](){this['_showMoreButtonView']['isOn']?this['hideBalloonPanel']():this['showBalloonPanel']();}['_updateShowMoreButtonVisibility'](){const _0xbf09ca=this['_overflowChips']['length']>0x0;this['_showMoreButtonView']?.['element']&&(this['_showMoreButtonView']['element']['style']['display']=_0xbf09ca?'':'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'](_0x5b5d58){const _0x2d6d06=this['_containerElement']?.['tagName']['toLowerCase']()||'div',_0x8b910e=this['_containerElement']?.['classList'];if(_0x8b910e){const _0x46f588=_0x8b910e[0x0]||'',_0x5a8cc7=_0x5b5d58['querySelector']('.'+_0x46f588),_0x438abe=_0x5b5d58['querySelector'](_0x2d6d06);return _0x5a8cc7||_0x438abe||_0x5b5d58;}return _0x5b5d58['querySelector'](_0x2d6d06)||_0x5b5d58;}['_calculateContainerWidth'](){const _0x13d70c=this['_parentView']?.['element']||this['_containerElement'];if(!_0x13d70c)return wr;const _0x314f5a=window['getComputedStyle'](_0x13d70c)['width'];if('auto'===_0x314f5a||'0px'===_0x314f5a||!_0x314f5a){const _0x3ebb67=_0x13d70c['parentElement'];if(_0x3ebb67){const _0x43d17e=window['getComputedStyle'](_0x3ebb67);return'auto'!==_0x43d17e['width']?_0x43d17e['width']:wr;}return wr;}return _0x314f5a;}['_applyCalculationStyles'](_0x5c752d,_0x38aa8d){this['_config']['cssClasses']['calculationContainer']&&_0x5c752d['classList']['add'](this['_config']['cssClasses']['calculationContainer']),_0x5c752d['style']['width']=_0x38aa8d,_0x5c752d['style']['position']='absolute',_0x5c752d['style']['top']='-9999px',_0x5c752d['style']['left']='-9999px',_0x5c752d['style']['opacity']='0',_0x5c752d['style']['pointerEvents']='none',_0x5c752d['style']['zIndex']='-1',_0x5c752d['style']['visibility']='visible\x20!important',_0x5c752d['style']['display']='block\x20!important',_0x5c752d['style']['boxSizing']='border-box';}['_restoreAncestorVisibility'](_0x1986d0){_0x1986d0['forEach'](({element:_0x16c7ae,originalDisplay:_0x13b6f3,originalVisibility:_0x32c171})=>{_0x16c7ae['style']['display']=_0x13b6f3,_0x16c7ae['style']['visibility']=_0x32c171;});}['_makeAncestorsVisible'](_0x5c3939){const _0x103bb9=[];let _0x982422=_0x5c3939;for(;_0x982422&&_0x982422!==document['body'];){const _0x3172df=window['getComputedStyle'](_0x982422);'none'!==_0x3172df['display']&&'hidden'!==_0x3172df['visibility']||(_0x103bb9['push']({'element':_0x982422,'originalDisplay':_0x982422['style']['display'],'originalVisibility':_0x982422['style']['visibility']}),_0x982422['style']['display']='block',_0x982422['style']['visibility']='visible'),_0x982422=_0x982422['parentElement'];}return _0x103bb9;}['_createContainerElements'](){let _0x232032,_0x6a75fc;return this['_parentView']?.['element']?(_0x232032=this['_parentView']['element']['cloneNode'](!0x0),_0x6a75fc=this['_findTargetContainer'](_0x232032)):(_0x232032=document['createElement']('div'),_0x6a75fc=_0x232032),{'calculationContainer':_0x232032,'targetContainer':_0x6a75fc};}['_createCalculationContainer'](){const {calculationContainer:_0x3d5818,targetContainer:_0x43eeed}=this['_createContainerElements'](),_0x2b8798=this['_calculateContainerWidth']();this['_applyCalculationStyles'](_0x3d5818,_0x2b8798);const _0x3df47c=(this['_parentView']?.['element']||this['_containerElement'])?.['parentElement'];_0x3df47c?_0x3df47c['appendChild'](_0x3d5818):document['body']['appendChild'](_0x3d5818),_0x3d5818['_targetContainer']=_0x43eeed;const _0x484e6a=this['_makeAncestorsVisible'](_0x3df47c||null);return _0x3d5818['offsetWidth'],_0x3d5818['_ancestorsToRestore']=_0x484e6a,_0x3d5818;}['_calculateOverflowInContainer'](_0x22cbd6,_0x41b624){const _0x43cc65=_0x22cbd6['_targetContainer']||_0x22cbd6,_0xf53ffc=[],{rowCount:_0x206f60}=this['_renderChipsAndCountRows'](_0x43cc65,_0x41b624);if(_0x206f60<=this['_config']['maxVisibleRows'])return _0xf53ffc;const _0x23aff8=_0x41b624['slice']();for(;_0x23aff8['length']>0x0;){if(this['_testButtonFit'](_0x22cbd6,_0x43cc65,_0x23aff8)){const _0x393ae2=_0x41b624['filter'](_0x1468c6=>!_0x23aff8['includes'](_0x1468c6));_0xf53ffc['push'](..._0x393ae2);break;}if(!_0x23aff8['pop']())break;}return _0xf53ffc;}['_renderChipsAndCountRows'](_0x2e4def,_0xdf55ea){_0x2e4def['innerHTML']='',_0xdf55ea['forEach'](_0x1bf261=>{if(_0x1bf261['element']){const _0x2b1b69=_0x1bf261['element']['cloneNode'](!0x0);_0x2e4def['appendChild'](_0x2b1b69);}}),_0x2e4def['offsetWidth'];const _0xfd3906=_0x2e4def['children'],_0x4e26e1=[];return Array['from'](_0xfd3906)['forEach'](_0x448499=>{const _0x384711=_0x448499['getBoundingClientRect']()['top'];_0x4e26e1['some'](_0x1f3d97=>Math['abs'](_0x1f3d97-_0x384711)<this['_config']['rowDetectionTolerance'])||_0x4e26e1['push'](_0x384711);}),{'rowCount':_0x4e26e1['length']};}['_createMockButton'](){const _0x2434d8=document['createElement']('button');return _0x2434d8['className']=this['_config']['cssClasses']['showMoreButton'],this['_config']['cssClasses']['controlsButton']&&_0x2434d8['classList']['add'](this['_config']['cssClasses']['controlsButton']),_0x2434d8['textContent']='+\x201',_0x2434d8;}['_testButtonFit'](_0x5007fa,_0x2634b0,_0x3497f1){this['_renderChipsAndCountRows'](_0x2634b0,_0x3497f1);const _0x3387d5=this['_createMockButton']();_0x5007fa['appendChild'](_0x3387d5),_0x5007fa['offsetWidth'];const _0xea6caf=[..._0x2634b0['children'],_0x3387d5],_0x442ecb=[];_0xea6caf['forEach'](_0x14700a=>{const _0x308d64=_0x14700a['getBoundingClientRect']()['top'];_0x442ecb['some'](_0x544fdf=>Math['abs'](_0x544fdf-_0x308d64)<this['_config']['rowDetectionTolerance'])||_0x442ecb['push'](_0x308d64);});const _0x48f2d4=_0x442ecb['length'];return _0x3387d5['remove'](),_0x48f2d4<=this['_config']['maxVisibleRows'];}['_distributeChips'](_0x42e934,_0x2db90f){this['_visibleChips']['clear'](),this['_overflowChips']['clear'](),_0x42e934['forEach'](_0x519368=>{_0x2db90f['includes'](_0x519368)?this['_overflowChips']['add'](_0x519368):this['_visibleChips']['add'](_0x519368);});}['_updateOverflowUI'](_0x47ec05){if(_0x47ec05>0x0&&!this['_showMoreButtonView']&&this['_createShowMoreButton'](),_0x47ec05>0x0&&this['_showMoreButtonView']){const _0x561bf9=''+this['_config']['showMoreLabelPrefix']+(_0x47ec05<0x63?_0x47ec05:'99');this['_showMoreButtonView']['label']=_0x561bf9;}this['_updateBalloonContent'](),this['_updateShowMoreButtonVisibility'](),this['_repinBalloonPanel']();}['_applyOverflowResults'](_0x31ceb8,_0x4ec5be){this['_distributeChips'](_0x31ceb8,_0x4ec5be),this['_updateOverflowUI'](_0x4ec5be['length']);}['_setupVisibilityObserver'](){this['_containerElement']&&'undefined'!=typeof IntersectionObserver&&(this['_intersectionObserver']=new IntersectionObserver(_0x4ac293=>{_0x4ac293[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 _0x203769=this['_containerElement']['getBoundingClientRect']();if(0x0===_0x203769['width']||0x0===_0x203769['height'])return!0x1;const _0x304699=window['innerHeight']||document['documentElement']['clientHeight'],_0x792b6c=window['innerWidth']||document['documentElement']['clientWidth'];return _0x203769['bottom']>=-0xc8&&_0x203769['top']<=_0x304699+0xc8&&_0x203769['right']>=-0xc8&&_0x203769['left']<=_0x792b6c+0xc8;}};const fr='ck-ai-chat__feed__context-chips',br='ck-ai-chat-context-chips-wrapper',Sr='ck-ai-chat-context-chips-wrapper-balloon',Rr='ck-ai-chat-controls-button',Or='ck-ai-chat-controls_context_show-more-button',vr='ck-ai-chat-context-controls__show-more-balloon-panel';var kr=class extends _0x1e8352{['_contextChips']=this['createCollection']();['_overflowManager'];['_bodyCollection'];constructor(_0x157a5c,_0x52df76,_0x153daa){super(_0x157a5c),this['_bodyCollection']=_0x153daa,this['_createContextChips'](_0x52df76);const _0x4f4ee3={'cssClasses':{'showMoreButton':Or+'\x20'+cn,'showMoreBalloon':vr,'overflowContainer':Sr,'controlsButton':Rr}};this['_overflowManager']=new Cr(_0x157a5c,this['_contextChips'],_0x4f4ee3,this['_bodyCollection'],this),this['setTemplate']({'tag':'div','attributes':{'class':[fr,'ck','ck-reset_all']},'children':[{'tag':'div','attributes':{'class':br},'children':this['_contextChips']}]});}['render'](){super['render']();const _0x374791=this['element']['querySelector']('.'+br);_0x374791&&(this['_overflowManager']['setContainerElement'](_0x374791),this['_overflowManager']['reorganizeChips']());}['destroy'](){super['destroy'](),this['_overflowManager']['destroy']();}['_createContextChips'](_0x13225f){for(const _0xfd3343 of _0x13225f){const _0x31f164=new mr(this['locale'],_0xfd3343,!0x0,!0x1);this['_contextChips']['add'](_0x31f164);}}},Nr=class extends Vn{['_contextChipsView']=null;['_locale'];['_bodyCollection'];['_messageContentView'];constructor(_0x45bece,_0x1de19b,_0xae0dcd){super(_0x1de19b),this['_locale']=_0x45bece,this['_bodyCollection']=_0xae0dcd,this['_createContextChipsView'](),this['_createMessageContentView'](),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__user-message']}});}['_createContextChipsView'](){this['options']['contextItems']&&this['options']['contextItems']['length']>0x0&&(this['_contextChipsView']=new kr(this['_locale'],this['options']['contextItems']['filter'](_0x271c92=>!_0x271c92['hidden']),this['_bodyCollection']),this['_contextChipsView']['extendTemplate']({'attributes':{'class':'ck-ai-chat__feed__context-chips'}}),this['children']['add'](this['_contextChipsView']));}['_createMessageContentView'](){this['_messageContentView']=new _0x1e8352(this['_locale']),this['_messageContentView']['setTemplate']({'tag':'div','attributes':{'class':['ck-reset_all-excluded','ck-ai-chat__feed__message-content','ck-ai-chat-content']}}),this['children']['add'](this['_messageContentView']);}['render'](){super['render'](),this['_messageContentView']['element']['innerHTML']=this['options']['initialContent'],this['markAsDone']();}},yr=class extends Vn{['capabilities'];constructor(_0x6368e2,_0x6df30d){super(_0x6df30d);const {isWebSearchEnabled:_0x1185d5,isReasoningEnabled:_0x4de76d}=_0x6df30d['capabilities'],_0x3f8f92=[];let _0x5768f8='';_0x1185d5&&_0x4de76d?(_0x5768f8=ls(_0x6368e2,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH_REASONING'),_0x3f8f92['push'](xr(ot)),_0x3f8f92['push'](xr(_0x430e8f))):_0x1185d5?(_0x5768f8=ls(_0x6368e2,'AI_CHAT_FEED_REPLY_ITEM_USED_WEB_SEARCH'),_0x3f8f92['push'](xr(ot))):_0x4de76d&&(_0x5768f8=ls(_0x6368e2,'AI_CHAT_FEED_REPLY_ITEM_USED_REASONING'),_0x3f8f92['push'](xr(_0x430e8f))),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__interaction-header',_0x5768f8?'':'ck-hidden']}});const _0x189c37=new _0x1e8352();_0x189c37['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__interaction-header__capabilities']},'children':[..._0x3f8f92,{'tag':'span','attributes':{'class':['ck-ai-chat__feed__interaction-header__capabilities__text']},'children':[_0x5768f8]}]}),this['children']['add'](_0x189c37),this['capabilities']=_0x6df30d['capabilities'];}};function xr(_0x3372b8){const _0xe844fe=new Wt();return _0xe844fe['content']=_0x3372b8,_0xe844fe;}const Lr=['wheel','touchstart','pointerdown','keydown'],Dr=['ArrowUp','ArrowDown','PageUp','PageDown','Home','End','\x20'];var Pr=class{['element'];['animationFrameId'];['isRunning'];['abortController'];['isUserPaused'];['scrollBehavior'];constructor(_0x3827fc){this['element']=_0x3827fc,this['animationFrameId']=null,this['isRunning']=!0x1,this['abortController']=new AbortController(),this['isUserPaused']=!0x1,this['scrollBehavior']='smooth';for(const _0x5c644d of Lr){const _0x2467bb='keydown'!==_0x5c644d;this['element']['addEventListener'](_0x5c644d,this['_onUserEvent']['bind'](this),{'passive':_0x2467bb,'signal':this['abortController']['signal']});}}['start']({smooth:_0x5930af=!0x0}={}){this['isRunning']||(this['isRunning']=!0x0,this['isUserPaused']=!0x1,this['scrollBehavior']=_0x5930af?'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'](_0x267c74){if(this['isRunning']){if('keydown'===_0x267c74['type']){const _0x1e4673=_0x267c74['key'];if(!Dr['includes'](_0x1e4673))return;}_0x267c74 instanceof WheelEvent?_0x267c74['deltaY']<0x0?this['isUserPaused']=!0x0:this['isUserPaused']=!this['_isAtBottom']():this['isUserPaused']=!0x0;}}['_isAtBottom'](){const {scrollTop:_0x2ae15c,scrollHeight:_0x3b4363,clientHeight:_0x5db154}=this['element'];return _0x3b4363-_0x2ae15c-_0x5db154<=0x5;}['_rafUpdate'](){this['isRunning']&&(this['isUserPaused']||this['element']['scrollTo']({'top':this['element']['scrollHeight'],'behavior':this['scrollBehavior']}),this['animationFrameId']=requestAnimationFrame(this['_rafUpdate']['bind'](this)));}},Hr=class extends Vn{constructor(_0x1cf5a4){super(_0x1cf5a4),this['extendTemplate']({'attributes':{'class':['ck-ai-chat__feed__custom-element']}});}async['render'](){super['render'](),'string'==typeof this['options']['content']?this['element']['innerHTML']=this['options']['content']:this['element']['appendChild'](this['options']['content']);}},Mr=class extends _0x1e8352{['children'];['scrollManager'];['_bodyCollection'];constructor(_0x82a40d,_0x1adf7b){super(_0x82a40d),this['_bodyCollection']=_0x1adf7b,this['set']('loadingMessage',''),this['set']('isLoadingSkeletonVisible',!0x1),this['set']('isTrackChangesOn',!0x1),this['children']=this['createCollection'](),this['children']['delegate'](...yn)['to'](this),this['_setupTemplate']();}['render'](){super['render'](),this['scrollManager']=new Pr(this['element']);}['destroy'](){super['destroy'](),this['scrollManager']['destroy']();}['clear'](){this['children']['clear']();}['addItem'](_0x6d6d76,_0xc08b28){let _0x3bdb9c;return'ai-reply'===_0x6d6d76?_0x3bdb9c=new hr(this['locale'],_0xc08b28,this['_bodyCollection']):'ai-suggestion-reply'===_0x6d6d76?(_0x3bdb9c=new ar(this['locale'],_0xc08b28,this['_bodyCollection']),_0x3bdb9c['bind']('isTrackChangesOn')['to'](this)):_0x3bdb9c='user-message'===_0x6d6d76?new Nr(this['locale'],_0xc08b28,this['_bodyCollection']):'interaction-header'===_0x6d6d76?new yr(this['locale'],_0xc08b28):'custom-element'===_0x6d6d76?new Hr(_0xc08b28):new tr(_0xc08b28),this['children']['add'](_0x3bdb9c),_0x3bdb9c;}async['updateReplyItem']({id:_0x597bec,parsedContent:_0x2735ce,renderingStrategy:_0x41483f,abortSignal:_0x209779}){const _0x1b0b6b=this['getItemById'](_0x597bec);if(!(_0x1b0b6b instanceof hr))throw new at('ai-chat-feed-view-item-not-a-reply-item',null,{'itemView':_0x1b0b6b,'id':_0x597bec,'parsedContent':_0x2735ce});await _0x1b0b6b['updateContent']({'parsedContent':_0x2735ce,'renderingStrategy':_0x41483f,'abortSignal':_0x209779});}async['updateWebSources'](_0x235aa0,_0x2290d9){const _0x2eac88=this['getItemById'](_0x235aa0);if(_0x2eac88 instanceof ar)_0x2eac88['updateSources'](_0x2290d9);else{if(!(_0x2eac88 instanceof hr))throw new at('ai-chat-feed-view-item-not-a-suggestion-or-reply-item',null,{'itemView':_0x2eac88,'id':_0x235aa0,'sources':_0x2290d9});_0x2eac88['updateSources'](_0x2290d9);}}async['updateSuggestionItem']({id:_0x5e8062,parts:_0x19d277,abortSignal:_0xd09def,skipLoadingEffects:_0x28d045}){const _0x28d840=this['getItemById'](_0x5e8062);if(!(_0x28d840 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',null,{'itemView':_0x28d840,'id':_0x5e8062,'parts':_0x19d277});await _0x28d840['updateContent']({'parts':_0x19d277,'abortSignal':_0xd09def,'skipLoadingEffects':_0x28d045});}['updateSuggestionPartState']({id:_0x5e588b,index:_0x239520,state:_0x4441d5}){const _0x5a28d4=this['getItemById'](_0x5e588b);if(!(_0x5a28d4 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x5e588b});_0x5a28d4['updatePartState'](_0x239520,_0x4441d5);}['setSuggestionPartActive']({id:_0x98e5f8,index:_0x9bce2f,isActive:_0x1c6970}){const _0x5f5a39=this['getItemById'](_0x98e5f8);if(!(_0x5f5a39 instanceof ar))throw new at('ai-chat-feed-view-item-not-a-suggestion-item',this,{'id':_0x98e5f8});this['children']['filter'](_0x265141=>_0x265141 instanceof ar)['forEach'](_0x2f1313=>{_0x2f1313['setPartActive'](!0x1);}),_0x5f5a39['setPartActive'](_0x9bce2f,_0x1c6970);}['markItemAsDone'](_0x3a99a0){this['getItemById'](_0x3a99a0)['markAsDone']();}['getItemIds'](){return this['children']['map'](_0xdd1f0b=>_0xdd1f0b['options']['id']);}['removeItem'](_0x436f27){this['children']['remove'](this['getItemById'](_0x436f27));}['hasItem'](_0x3b3df4){return!!this['children']['find'](_0x230660=>_0x230660['options']['id']['includes'](_0x3b3df4));}['scrollToSuggestion'](_0x3a08d0,_0x1e014f){const _0x2ec611=this['getItemById'](_0x3a08d0);if(!(_0x2ec611 instanceof ar))return void ft('ck-ai-chat-feed-view-scroll-to-suggestion-invalid-item',{'replyId':_0x3a08d0,'partIndex':_0x1e014f});const _0x3ebf6c=_0x2ec611['getPartView'](_0x1e014f);_0x3ebf6c?bt(_0x3ebf6c['element'],0x14,this['element']['parentElement'],!0x0,!0x0):ft('ck-ai-chat-feed-view-scroll-to-suggestion-part-view-not-found',{'replyId':_0x3a08d0,'partIndex':_0x1e014f});}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed']},'children':this['_createTemplateChildren']()});}['_createTemplateChildren'](){const _0x904b15=this['_createSkeletonLoader']();return[this['_createFeedItems'](),_0x904b15,this['_createFeedLoader']()];}['_createSkeletonLoader'](){const _0x1c27b3=new Xn(this['locale'],zn['aiFeed']);return _0x1c27b3['bind']('isVisible')['to'](this,'isLoadingSkeletonVisible'),_0x1c27b3;}['_createFeedItems'](){const _0x41c977=new _0x1e8352(this['locale']);return _0x41c977['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__feed__items',this['bindTemplate']['if']('isLoadingSkeletonVisible','ck-hidden')]},'children':this['children']}),_0x41c977;}['_createFeedLoader'](){const _0x3ca591=new _0x1e8352(this['locale']);return _0x3ca591['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat__loader',this['bindTemplate']['if']('loadingMessage','ck-hidden',_0x102c6a=>!_0x102c6a)]},'children':this['_createLoaderChildren']()}),_0x3ca591;}['_createLoaderChildren'](){const _0x559913=new cr();return _0x559913['isVisible']=!0x0,[_0x559913,{'tag':'span','attributes':{'class':['ck','ck-ai-chat__loader-text']},'children':[{'text':this['bindTemplate']['to']('loadingMessage')}]}];}['getItemById'](_0x5140d4){const _0x426341=this['children']['find'](_0x39a285=>_0x39a285['options']['id']['includes'](_0x5140d4));if(!_0x426341)throw new at('ai-chat-feed-view-item-not-found',this,{'id':_0x5140d4});return _0x426341;}['setLoadingMessage'](_0x5e391f){this['set']('loadingMessage',_0x5e391f);}['toggleLoadingSkeleton'](_0x226501){this['set']('isLoadingSkeletonVisible',_0x226501);}['startAutoScroll'](_0x25a98e={}){this['scrollManager']['start'](_0x25a98e);}['stopAutoScroll'](){this['scrollManager']['stop']();}},Vr=class extends zt{['filter'](){let _0x5047a2=0x0;for(const _0x5c9f87 of this['items'])_0x5047a2+=_0x5c9f87['items']['length'];return{'resultsCount':_0x5047a2,'totalItemsCount':_0x5047a2};}};function Ur(_0x4f0fc2){const _0x55b713=[];let _0x45949b=!0x1;for(const _0x291e9d of Array['from'](_0x4f0fc2['items'])){if('file'!==_0x291e9d['kind'])continue;if(_0x291e9d['webkitGetAsEntry']()?.['isDirectory']){_0x45949b=!0x0;continue;}const _0x289a39=_0x291e9d['getAsFile']();_0x289a39&&_0x55b713['push'](_0x289a39);}return{'files':_0x55b713,'hasDirectory':_0x45949b};}const Br='ck-ai-chat__prompt-input_highlighted';var Gr=class AIChatPromptInputView extends kt{['submitButtonView'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;['_addContextButtonView'];['_queryViewResizeObserver'];constructor(_0x7c0d30,_0x17f91b){super(_0x7c0d30,{'queryView':{'label':'','creator':_0x4650d6,'showIcon':!0x1,'showResetButton':!0x1},'filteredView':new Vr(_0x7c0d30),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1}),this['set']('isEmpty',!0x0),this['set']('isUploadInProgress',!0x1),this['_addContextButtonView']=_0x17f91b,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',(_0x2ae90e,_0xb55b45)=>!_0x2ae90e&&!_0xb55b45),this['focusableChildren']['add'](this['submitButtonView']);}['render'](){super['render'](),this['queryView']['fieldWrapperChildren']['add'](this['submitButtonView']),this['keystrokes']['set']('enter',(_0x5ebe61,_0x23b310)=>{this['isUploadInProgress']||this['isEmpty']||_0x5ebe61['target']==this['queryView']['fieldView']['element']&&(this['submit'](),_0x23b310());}),this['queryView']['fieldView']['on']('update',()=>{this['isEmpty']=''===this['queryView']['fieldView']['element']['value']?.['trim']();}),this['queryView']['fieldView']['element']['addEventListener']('paste',_0x2b1c22=>this['_handlePaste'](_0x2b1c22)),this['element']['addEventListener']('drop',_0x122d94=>this['_handleDrop'](_0x122d94));}['_handlePaste'](_0x2dc3b6){const _0x5f504b=_0x2dc3b6['clipboardData'];if(!_0x5f504b)return;const {files:_0x164d5d,hasDirectory:_0x430a1c}=Ur(_0x5f504b),_0x2e1637={'files':_0x164d5d,'plainText':_0x5f504b['getData']('text/plain'),'hasDirectory':_0x430a1c,'forceTextAttachment':!0x1,'preventDefault':()=>_0x2dc3b6['preventDefault']()};this['fire']('promptInputPaste',_0x2e1637);}['_handleDrop'](_0x428771){const _0x4ed348=_0x428771['dataTransfer'];if(!_0x4ed348)return;const _0x3052c7={'files':[],'plainText':_0x4ed348['getData']('text/uri-list')||_0x4ed348['getData']('text/plain'),'hasDirectory':!0x1,'forceTextAttachment':!0x1,'preventDefault':()=>_0x428771['preventDefault']()};this['fire']('promptInputPaste',_0x3052c7);}['destroy'](){super['destroy'](),this['_queryViewResizeObserver']&&this['_queryViewResizeObserver']['destroy']();}['submit'](){const _0x249e15=this['queryView']['fieldView']['element']['value']?.['trim']();if(!_0x249e15)return this['queryView']['errorText']=ls(this['locale'],'AI_CHAT_PROMPT_EMPTY_ERROR'),void(this['queryView']['fieldView']['hasError']=!0x0);this['queryView']['fieldView']['hasError']=!0x1;const _0x4b88d2=_0x9a78d5(_0x249e15);this['fire']('sendUserMessage',_0x4b88d2),this['queryView']['fieldView']['reset']();}['setPlaceholderText'](_0x3a41e1){this['queryView']['fieldView']['set']('placeholder',_0x3a41e1);}['focus'](_0x5c98cd=!0x1){super['focus'](),_0x5c98cd&&(this['element']['classList']['contains'](Br)||(this['element']['classList']['add'](Br),setTimeout(()=>{this['element']['classList']['remove'](Br);},0x320)));}['_createSubmitButton'](){const _0x4a6201=new Pt(this['locale']);return _0x4a6201['set']({'icon':it,'label':ls(this['locale'],'AI_CHAT_LABEL_SUBMIT'),'isVisible':!0x0,'tooltip':!0x0,'class':'ck-ai-chat__prompt-submit-button\x20'+an,'isEnabled':!0x1}),_0x4a6201['on']('execute',()=>{this['submit']();}),_0x4a6201;}['setIsUploadInProgress'](_0x386de3){this['isUploadInProgress']=_0x386de3;}['_setUpAddContextButtonPositioning'](){const _0x2fef20=this['locale'],_0x2423ff=()=>{Et['window']['requestAnimationFrame'](()=>{if(wt(this['element'])){const _0x39cb2a=new gt(this['queryView']['fieldView']['element']),_0x21441a=new gt(this['_addContextButtonView']['element']),_0x548c31=_0x39cb2a['width'],_0x4ea3c3='rtl'===_0x2fef20['uiLanguageDirection']?'right':'left';_0x39cb2a['excludeScrollbarsAndBorders']();const _0x264d8b=_0x548c31-_0x39cb2a['width']+0x1;this['_addContextButtonView']['element']['style'][_0x4ea3c3]='calc('+(_0x548c31-_0x21441a['width']-_0x264d8b)+'px\x20-\x20var(--ck-spacing-tiny))';}});};this['queryView']['fieldView']['on']('update',_0x2423ff),this['on']('render',()=>{_0x2423ff(),this['_queryViewResizeObserver']=new At(this['queryView']['fieldView']['element'],()=>{_0x2423ff();});});}},Fr=class extends _0x1e8352{constructor(_0x3bd2de){super(_0x3bd2de);const _0xc138bb=new Wt();_0xc138bb['content']=_0x5807c5,this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls__drop-overlay']},'children':[_0xc138bb,{'tag':'span','attributes':{'class':['ck-ai-chat-controls__drop-overlay__label']},'children':[{'text':ls(_0x3bd2de,'AI_CHAT_DROP_ZONE_HINT')}]}]});}['attach'](_0x42e33d){let _0x5348f6=0x0;_0x42e33d['addEventListener']('dragenter',_0x4b0502=>{_0x4b0502['dataTransfer']&&(_0x5348f6++,0x1===_0x5348f6&&this['fire']('dragEnter'),_0x42e33d['classList']['add']('ck-ai-chat-controls_drag-over'));}),_0x42e33d['addEventListener']('dragover',_0x28dfe1=>{_0x28dfe1['dataTransfer']&&_0x28dfe1['preventDefault']();}),_0x42e33d['addEventListener']('dragleave',()=>{--_0x5348f6<=0x0&&(_0x5348f6=0x0,_0x42e33d['classList']['remove']('ck-ai-chat-controls_drag-over'));}),_0x42e33d['addEventListener']('drop',_0x288953=>{_0x288953['preventDefault'](),_0x5348f6=0x0,_0x42e33d['classList']['remove']('ck-ai-chat-controls_drag-over'),this['_handleDrop'](_0x288953);});}['_handleDrop'](_0x3fd453){const _0x1d6a4b=_0x3fd453['dataTransfer'];if(!_0x1d6a4b)return;const {files:_0x39846e,hasDirectory:_0x440d46}=Ur(_0x1d6a4b),_0x364ec6={'files':_0x39846e,'plainText':_0x1d6a4b['getData']('text/uri-list')||_0x1d6a4b['getData']('text/plain'),'hasDirectory':_0x440d46,'forceTextAttachment':!0x0,'preventDefault':()=>{}};this['fire']('promptInputPaste',_0x364ec6);}};const Kr='ck-ai-chat__prompt-capabilities',Wr='ck-ai-chat-controls-button',Yr='ck-ai-chat-controls-button--commands',$r='ck-ai-chat-controls__model-selection',qr='ck-ai-chat-controls__model-selection__item-name',Qr='ck-ai-chat-controls__model-selection__item-description',Xr='ck-ai-chat-controls__model-selection__item-capabilities',zr='n';var jr=class extends _0x1e8352{['_webSearchButton'];['_reasoningButton'];['_commandsButton'];['_modelSelectionDropdown'];['_modelSelectionDropdownItems'];['_modelNameView'];constructor(_0x33bfe2){super(_0x33bfe2),this['set']('webSearchActive',!0x1),this['set']('reasoningActive',!0x1),this['set']('modelDisplayMode','selector'),this['set']('modelSelectorEnabled',!0x0),this['set']('activeModelId',null),this['set']('activeModelName',null),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelNameView']=this['_createModelNameView'](),this['_webSearchButton']=this['_createWebSearchButton'](),this['_reasoningButton']=this['_createReasoningButton'](),this['_commandsButton']=this['_createCommandsButton'](),this['_modelSelectionDropdown']['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x4c43ee=>'selector'===_0x4c43ee),this['_modelSelectionDropdown']['buttonView']['bind']('tooltip')['to'](this,'modelSelectorEnabled',_0x1ec566=>_0x1ec566?this['_modelSelectionDropdown']['buttonView']['label']:ls(this['locale'],'AI_CHAT_MODEL_SELECTOR_DISABLED_TOOLTIP')),this['_modelSelectionDropdown']['bind']('isEnabled')['to'](this,'modelSelectorEnabled',_0x3180b4=>_0x3180b4),this['_webSearchButton']['bind']('isOn')['to'](this,'webSearchActive',_0x104ce3=>_0x104ce3),this['_webSearchButton']['bind']('tooltip')['to'](this,'webSearchActive',_0x50778d=>ls(this['locale'],_0x50778d?'AI_CHAT_DISABLE_WEB_SEARCH':'AI_CHAT_ENABLE_WEB_SEARCH')),this['_reasoningButton']['bind']('isOn')['to'](this,'reasoningActive',_0x4aaf12=>_0x4aaf12),this['_reasoningButton']['bind']('tooltip')['to'](this,'reasoningActive',_0x3e0257=>ls(this['locale'],_0x3e0257?'AI_CHAT_DISABLE_REASONING':'AI_CHAT_ENABLE_REASONING')),this['setTemplate']({'tag':'div','attributes':{'class':[Kr]},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],this['_webSearchButton'],this['_reasoningButton'],this['_commandsButton']]}),this['_modelSelectionDropdownItems']=new ht(),_0x11b460(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']);}['setModelList'](_0x4e3ad7,_0x2a928c){if(_0x2a928c)this['set']('modelDisplayMode','hidden');else{const _0x28ed5b=0x1===_0x4e3ad7['length'];this['set']('modelDisplayMode',_0x28ed5b?'name':'selector');}if(this['_modelSelectionDropdownItems']['clear'](),_0x4e3ad7?.['length'])for(const _0x186663 of _0x4e3ad7){const _0x39f0c7=new _0x53b316({'label':_0x186663['name'],'withText':!0x0,'role':'menuitemradio','id':_0x186663['id'],'model':_0x186663});_0x39f0c7['bind']('isOn')['to'](this,'activeModelId',_0x39e824=>_0x39e824===_0x186663['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x39f0c7,'labelView':new Jr(this['locale'],_0x186663)});}}['setWebSearch'](_0x3bcb8c){this['set']('webSearchActive',_0x3bcb8c);}['setReasoning'](_0x3591b5){this['set']('reasoningActive',_0x3591b5);}['setModel'](_0x4006a3){if(!_0x4006a3)return;this['activeModelId']=_0x4006a3['id'],this['activeModelName']=_0x4006a3['name']||_0x4006a3['id'],this['_modelSelectionDropdown']['buttonView']['set']('label',_0x4006a3['name']),this['_modelSelectionDropdown']['buttonView']['set']('tooltip',_0x4006a3['name']);const _0x450137=_0x4006a3['capabilities']['webSearch']?.['enabled']??!0x1;this['set']('webSearchActive',!0x1),this['_webSearchButton']['set']('isOn',!0x1),this['_webSearchButton']['set']('isEnabled',_0x450137),this['_webSearchButton']['set']('isVisible',_0x450137);const _0x1d36d7=_0x4006a3['capabilities']['reasoning']?.['enabled']??!0x1;this['set']('reasoningActive',!0x1),this['_reasoningButton']['set']('isOn',!0x1),this['_reasoningButton']['set']('isEnabled',_0x1d36d7),this['_reasoningButton']['set']('isVisible',_0x1d36d7);}['enableModelSelector'](){this['set']('modelSelectorEnabled',!0x0);}['disableModelSelector'](_0x2f33c2){this['set']('modelSelectorEnabled',!0x1),_0x2f33c2&&this['set']('modelDisplayMode','hidden');}['_createWebSearchButton'](){const _0x499ecc=new Pt();return _0x499ecc['set']({'label':ls(this['locale'],'AI_CHAT_SEARCH_WEB'),'icon':ot,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x499ecc['on']('execute',()=>{this['fire']('toggleWebSearch');}),_0x499ecc;}['_createReasoningButton'](){const _0x347dae=new Pt();return _0x347dae['set']({'label':ls(this['locale'],'AI_CHAT_REASONING'),'icon':_0x430e8f,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltipPosition':zr}),_0x347dae['on']('execute',()=>{this['fire']('toggleReasoning');}),_0x347dae;}['_createCommandsButton'](){const _0x5d83f7=new Pt();return _0x5d83f7['set']({'label':ls(this['locale'],'AI_CHAT_COMMANDS'),'icon':_0x2b8e87,'withText':!0x0,'class':Wr+'\x20'+cn,'isToggleable':!0x0,'tooltip':ls(this['locale'],'AI_CHAT_COMMANDS'),'tooltipPosition':zr}),_0x5d83f7['extendTemplate']({'attributes':{'class':[Yr]}}),_0x5d83f7['on']('execute',()=>{console['log']('Commands\x20are\x20not\x20implemented\x20yet.'),alert('Commands\x20are\x20not\x20implemented\x20yet.');}),_0x5d83f7;}['_createModelSelectionDropdown'](){const _0x5074b1=_0x312ca1(this['locale']);return _0x5074b1['set']({'panelPosition':'ne','class':[$r]}),_0x5074b1['buttonView']['set']({'label':ls(this['locale'],'AI_CHAT_MODEL_SELECTOR_ENABLED_TOOLTIP'),'withText':!0x0,'tooltip':!0x0,'tooltipPosition':zr,'class':cn}),this['listenTo'](_0x5074b1,'execute',_0x2c0827=>{this['fire']('selectModel',_0x2c0827['source']['model']);}),_0x5074b1;}['_createModelNameView'](){const _0x3cfd44=new Zr(this['locale']);return _0x3cfd44['bind']('text')['to'](this,'activeModelName',_0x5670b3=>_0x5670b3??''),_0x3cfd44['bind']('isVisible')['to'](this,'modelDisplayMode',_0x338631=>'name'===_0x338631),_0x3cfd44;}},Jr=class extends Lt{constructor(_0x16b1de,_0x3a71f9){super();const _0x219cce=this['bindTemplate'],_0x3eb794=this['createCollection']();this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x219cce['to']('style'),'id':_0x219cce['to']('id')},'children':[{'tag':'div','attributes':{'class':[qr]},'children':[{'text':_0x219cce['to']('text')}]},{'tag':'div','attributes':{'class':[Qr]},'children':[{'tag':'span','children':[{'text':_0x3a71f9['description']}]}]},{'tag':'div','attributes':{'class':[Xr]},'children':_0x3eb794}]}),_0x3eb794['addMany'](this['_getCapabilityParts'](_0x16b1de,ot,'AI_CHAT_SEARCH_WEB',_0x3a71f9['capabilities']['webSearch']?.['enabled']??!0x1)),_0x3eb794['addMany'](this['_getCapabilityParts'](_0x16b1de,_0x430e8f,'AI_CHAT_REASONING',_0x3a71f9['capabilities']['reasoning']?.['enabled']??!0x1));}['_getCapabilityParts'](_0x2a9ed2,_0x4402ed,_0x12fafe,_0x59adcc){const _0x3b7e20=new Wt();_0x3b7e20['content']=_0x4402ed;const _0x2ade8e=new _0x1e8352(_0x2a9ed2);_0x2ade8e['setTemplate']({'tag':'span','children':[{'text':ls(_0x2a9ed2,_0x12fafe)+':\x20'}]});const _0x24dbf1=new _0x1e8352(_0x2a9ed2);return _0x24dbf1['setTemplate']({'tag':'span','children':[{'text':ls(_0x2a9ed2,_0x59adcc?'AI_CHAT_CAPABILITIES_YES':'AI_CHAT_CAPABILITIES_NO')}]}),[_0x3b7e20,_0x2ade8e,_0x24dbf1];}},Zr=class extends _0x1e8352{constructor(_0x3f4d23){super(_0x3f4d23),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x8c3bc6=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-chat-controls__model-name',_0x8c3bc6['if']('isVisible','ck-hidden',_0x42e130=>!_0x42e130)]},'children':[{'text':_0x8c3bc6['to']('text')}]});}};const to='ck-ai-chat-context-controls__url-form',eo='ck-ai-chat-context-controls__url-input-section';var io=class extends _0x1e8352{['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['urlInputField'];['backButton'];['confirmButton'];constructor(_0xaa91ef){super(_0xaa91ef),this['focusTracker']=new ut(),this['keystrokes']=new dt(),this['backButton']=this['_createBackButton'](),this['urlInputField']=this['_createUrlInputField'](),this['confirmButton']=this['_createConfirmButton'](),this['_focusables']=this['createCollection']([this['backButton'],this['urlInputField'],this['confirmButton']]),this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift+tab','focusNext':'tab'}}),this['set']('withBackButton',!0x0),this['_setupTemplate'](),this['_setupEventHandlers'](),this['_setupKeystrokes']();}['render'](){super['render'](),this['_focusables']['forEach'](_0x44cf66=>{this['focusTracker']['add'](_0x44cf66['element']),this['keystrokes']['listenTo'](_0x44cf66['element']);}),_0x1597e8({'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'](_0x1234f7){this['urlInputField']['errorText']=_0x1234f7,this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}['clearError'](){this['urlInputField']['errorText']=null,this['_updateConfirmButtonState']();}['_createBackButton'](){const _0x47114e=new Pt(this['locale']);return _0x47114e['set']({'icon':_0x432064,'tooltip':ls(this['locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':['ck-button-icon\x20ck-button-back']}),this['on']('change:withBackButton',(_0x3eb3c4,_0x237cfb,_0x37aad7)=>{_0x47114e['set']({'class':['ck-button-icon\x20ck-button-back'+(_0x37aad7?'':'\x20ck-hidden')]});}),_0x47114e;}['_createUrlInputField'](){const _0xcae92a=new $t(this['locale'],_0x691176);return _0xcae92a['set']({'label':ls(this['locale'],'AI_CHAT_CONTEXT_URL_LABEL'),'class':'ck-labeled-field-view_empty'}),_0xcae92a['fieldView']['set']({'placeholder':ls(this['locale'],'AI_CHAT_CONTEXT_URL_PLACEHOLDER')}),_0xcae92a;}['_createConfirmButton'](){const _0x59e93c=new Pt(this['locale']);return _0x59e93c['set']({'icon':_0x7ff926,'tooltip':ls(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'tooltipPosition':'n','class':'ck-button-icon','type':'submit','isEnabled':!0x1}),_0x59e93c;}['_setupTemplate'](){const _0x19c233=new Gt(this['locale'],{'label':ls(this['locale'],'AI_CHAT_CONTEXT_URL_ADD_URL'),'class':'ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_context-url'});_0x19c233['children']['add'](this['backButton'],0x0),this['setTemplate']({'tag':'form','attributes':{'class':to,'tabindex':'-1'},'children':[_0x19c233,{'tag':'div','attributes':{'class':eo},'children':[this['urlInputField'],this['confirmButton']]}]});}['_setupEventHandlers'](){this['backButton']['on']('execute',()=>{this['clear'](),this['fire']('cancel');}),this['urlInputField']['fieldView']['on']('input',()=>{this['clearError'](),this['_updateConfirmButtonState'](),this['fire']('refreshBalloon');}),this['on']('submit',_0x258be1=>{_0x258be1['stop'](),this['_handleSubmit']();});}['_setupKeystrokes'](){this['keystrokes']['set']('esc',(_0x3d261b,_0xbb0a2e)=>{this['clear'](),this['fire']('cancel'),_0xbb0a2e();});}['_handleSubmit'](){const _0x10f532=this['getValue']()['trim']();_0x10f532?this['_isValidUrl'](_0x10f532)?(this['clearError'](),this['fire']('submitUrl',_0x10f532)):this['setError'](ls(this['locale'],'AI_CHAT_CONTEXT_URL_INVALID_ERROR')):this['setError'](ls(this['locale'],'AI_CHAT_CONTEXT_URL_EMPTY_ERROR'));}['_updateConfirmButtonState'](){const _0x3f2554=this['getValue']()['trim'](),_0x28cf6f=!!this['urlInputField']['errorText'];this['confirmButton']['isEnabled']=_0x3f2554['length']>0x0&&!_0x28cf6f;}['_isValidUrl'](_0x3066dc){try{return!!new URL(_0x3066dc);}catch{return!0x1;}}};const so='ck-ai-chat-resources__item',no='ck-ai-chat-resources__item--in-context',ro='ck-ai-chat-resources__item-title',oo='ck-ai-chat-resources__item__icon';var ao=class extends Xt{['resource'];['_titleView'];['_iconView'];constructor(_0x39030e,_0x515f07){super(_0x39030e),this['resource']=_0x515f07,this['set']('isInContext',!!_0x515f07['isInContext']),this['_titleView']=this['_createTitleView'](),this['_iconView']=this['_createIconView'](),this['_setupTemplate']();}['render'](){super['render']();}['getResourceIcon'](_0x3304fe){if(_0x3304fe['isInContext'])return _0x7ff926;switch(_0x3304fe['type']){case'document':return _0x5549b7;case'web-resource':return _0x368e79;case'file':case'text':return _0x5807c5;default:return _0x2ce4a4;}}['highlightText'](_0x36b23c){if(!_0x36b23c||''===_0x36b23c['trim']())return void this['_titleView']['highlightText'](null);const _0xfcc08b=new RegExp(_0xc078db(_0x36b23c),'gi');this['_titleView']['highlightText'](_0xfcc08b);}['updateResourceState'](_0x45dbc3){this['resource']['isInContext']=_0x45dbc3,this['isInContext']=_0x45dbc3,this['_updateIcon']();}['_createTitleView'](){const _0x5bcd83=new Kt();return _0x5bcd83['text']=this['resource']['label'],_0x5bcd83['extendTemplate']({'tag':'span','attributes':{'class':[ro]}}),_0x5bcd83;}['_createIconView'](){const _0x44e6e8=new Wt();return _0x44e6e8['content']=this['getResourceIcon'](this['resource']),_0x44e6e8;}['_setupTemplate'](){const _0x3e2d3=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':[so,_0x3e2d3['if']('isVisible','ck-hidden',_0xbe9a89=>!_0xbe9a89),_0x3e2d3['if']('isInContext',no)]},'children':[{'tag':'div','attributes':{'class':[oo]},'children':[this['_iconView']]},this['_titleView']],'on':{'click':_0x3e2d3['to']('execute')}});}['_updateIcon'](){this['_iconView']['content']=this['getResourceIcon'](this['resource']);}};const ho='ck-ai-chat-resources__list';var co=class extends zt{['_source'];constructor(_0x145d75,_0x191cd0){super(_0x145d75),this['_source']=_0x191cd0,this['extendTemplate']({'attributes':{'class':[ho]}});}['setResources'](_0x8418,_0x57b702){this['items']['clear']();let _0x576bda=_0x8418;if(this['_source']['useDefaultFiltering']&&_0x57b702&&''!==_0x57b702['trim']()){const _0xe82833=new RegExp(_0x57b702['replace'](/[.*+?^${}()|[\]\\]/g,'\x5c$&'),'gi');_0x576bda=_0x8418['filter'](_0x4a98dd=>_0xe82833['test'](_0x4a98dd['label']));}for(const _0x3d40b9 of _0x576bda){const _0x5e232d=new ao(this['locale'],_0x3d40b9);_0x5e232d['on']('execute',()=>{this['_handleResourceSelection'](this['_source'],_0x3d40b9);}),this['items']['add'](_0x5e232d);}this['_source']['useDefaultFiltering']&&this['highlightText'](_0x57b702);}['highlightText'](_0x44fe3c){this['_source']['useDefaultFiltering']&&this['items']['forEach'](_0x14773f=>{_0x14773f['highlightText'](_0x44fe3c);});}['updateResourceState'](_0x487412,_0x143996){for(const _0x3ff5a3 of this['items']){const _0x204bfb=_0x3ff5a3;_0x204bfb['resource']['id']===_0x487412&&_0x204bfb['updateResourceState'](_0x143996);}}['_handleResourceSelection'](_0x2c78b7,_0x59a467){this['fire']('addResourceToContext',{'source':_0x2c78b7,'resource':_0x59a467});}},lo=class extends $t{['iconView'];['resetButtonView'];['_viewConfig'];constructor(_0x577cff){const t=_0x577cff['t'],_0x3eb186={'showResetButton':!0x0,'showIcon':!0x0,'creator':_0x691176,'label':ls(_0x577cff,'AI_CHAT_SEARCH_RESOURCES')};super(_0x577cff,_0x3eb186['creator']),this['label']=_0x3eb186['label'],this['_viewConfig']=_0x3eb186,this['_viewConfig']['showIcon']&&this['_setupSearchIcon'](),this['_viewConfig']['showResetButton']&&this['_setupResetButton'](_0x577cff,t),this['_setupEventListeners']();}['reset'](){this['fieldView']['reset'](),this['_viewConfig']['showResetButton']&&this['resetButtonView']&&(this['resetButtonView']['isVisible']=!0x1),this['search']('');}['search'](_0x85c6f6){this['fire']('search',_0x85c6f6);}['getQuery'](){return this['fieldView']['element']?.['value']||'';}['_setupSearchIcon'](){this['iconView']=new Wt(),this['iconView']['content']=_0x104c6b,this['fieldWrapperChildren']['add'](this['iconView'],0x0),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-icon'}});}['_setupResetButton'](_0x1febc2,t){this['resetButtonView']=new Pt(_0x1febc2),this['resetButtonView']['set']({'label':t('Clear'),'icon':_0x556600,'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',_0x3b88a1=>!_0x3b88a1),this['fieldWrapperChildren']['add'](this['resetButtonView']),this['extendTemplate']({'attributes':{'class':'ck-search__query_with-reset'}});}['_setupEventListeners'](){this['listenTo'](this['fieldView'],'input',()=>{this['search'](this['fieldView']['element']['value']);}),this['bind']('isEnabled')['to'](this);}},uo=class extends _0x1e8352{['_searchView'];['_searchSection'];['_searchInputVisibleFrom'];['_resourcesListView'];['_skeletonLoader'];['_source'];['children'];['_latestLoadResourcesUid']=null;constructor(_0x35599c,_0x41e12b){super(_0x35599c),this['_source']=_0x41e12b['source'],this['_searchInputVisibleFrom']=_0x41e12b['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 _0x14141a([this['_skeletonLoader'],this['_resourcesListView']]),this['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-chat-resources'},'children':this['children']});}['_createSearchView'](){return new lo(this['locale']);}['_createSearchSection'](){const _0x1c9d45=new _0x1e8352(this['locale']);return _0x1c9d45['setTemplate']({'tag':'div','attributes':{'class':'ck\x20ck-search'},'children':[this['_searchView']]}),this['_searchView']['on']('search',(_0x1eea6c,_0x2e9558)=>{this['loadResources'](_0x2e9558),this['_source']['useDefaultFiltering']&&this['_resourcesListView']['highlightText'](_0x2e9558);}),_0x1c9d45;}['_createResourcesListView'](){const _0x47464e=new co(this['locale'],this['_source']);return _0x47464e['delegate']('addResourceToContext')['to'](this),_0x47464e['extendTemplate']({'attributes':{'class':this['bindTemplate']['if']('isLoading','ck-hidden')}}),_0x47464e;}['_createSkeletonView'](){const _0x285c62=new Xn(this['locale'],zn['aiChatResources']);return _0x285c62['bind']('isVisible')['to'](this,'isLoading'),_0x285c62;}['render'](){super['render'](),this['loadResources']('');}['loadResources'](_0x2869ab){const _0x70db7c=Ot();this['_latestLoadResourcesUid']=_0x70db7c,this['fire']('loadSourceResources',{'sourceId':this['_source']['id'],'query':_0x2869ab,'uid':_0x70db7c}),this['isLoading']=!0x0;}['setResources'](_0x41bdd5,_0x4ff9f8){if(_0x4ff9f8&&_0x4ff9f8!==this['_latestLoadResourcesUid'])return;const _0x409635=this['_source']['useDefaultFiltering']?this['_searchView']['getQuery']():'';this['_resourcesListView']['setResources'](_0x41bdd5,_0x409635),_0x41bdd5['length']>=this['_searchInputVisibleFrom']&&!this['children']['has'](this['_searchSection'])&&this['children']['add'](this['_searchSection'],0x0),requestAnimationFrame(()=>{this['isLoading']=!0x1;});}['updateResourceState'](_0x287d78,_0x30b6b0){this['_resourcesListView']['updateResourceState'](_0x287d78,_0x30b6b0);}};const _o='ck-ai-chat-context-controls__source-balloon-panel',go='ck-button-icon\x20ck-button-back',Ao='ck-ai-header\x20ck-ai-header_small\x20ck-ai-header_source';var Io=class{['_sourceResourceBalloons']=new Map();['_bodyCollection'];['_locale'];['_config'];constructor(_0x2685f8,_0x36cf03,_0x72818b){this['_locale']=_0x2685f8,this['_bodyCollection']=_0x36cf03,this['_config']=_0x72818b;}['showSourceResourcesBalloon']({source:_0x4e34ce,withBackButton:_0x5ce896}){let _0x58a2b6=this['_sourceResourceBalloons']['get'](_0x4e34ce['id']);_0x58a2b6||(_0x58a2b6=this['_createSourceResourceBalloonPanel'](),this['_sourceResourceBalloons']['set'](_0x4e34ce['id'],_0x58a2b6),this['_setupSingleResourceBalloonClickOutsideHandler'](_0x58a2b6)),this['_addSourceResourceContent']({'balloonPanel':_0x58a2b6,'source':_0x4e34ce,'withBackButton':_0x5ce896}),_0x58a2b6['show']();const _0x58df2f=this['_config']['getTargetElement']();_0x58df2f&&_0x58a2b6['pin']({'target':_0x58df2f,'limiter':this['_config']['getLimiterElement']()});}['populateSourceResourceBalloon'](_0x41d1b9,_0x571f0c,_0x4bea74){const _0x1b6869=this['_sourceResourceBalloons']['get'](_0x41d1b9);if(!_0x1b6869)return;const _0x474896=this['_getResourcesViewFromBalloon'](_0x1b6869);_0x474896&&(_0x474896['setResources'](_0x571f0c,_0x4bea74),_0x474896['once']('change:isLoading',()=>{_0x1b6869['pin']({'target':this['_config']['getTargetElement'](),'limiter':this['_config']['getLimiterElement']()});}));}['closeSourceResourceBalloon'](_0x1c8189){const _0x43c792=this['_sourceResourceBalloons']['get'](_0x1c8189);_0x43c792&&requestAnimationFrame(()=>{_0x43c792['hide'](),this['_sourceResourceBalloons']['delete'](_0x1c8189),this['_config']['onBalloonClosed']();});}['closeAll'](){for(const _0x5de334 of Array['from'](this['_sourceResourceBalloons']['keys']()))this['closeSourceResourceBalloon'](_0x5de334);}['isAnyResourceBalloonVisible'](){for(const _0x3180f8 of this['_sourceResourceBalloons']['values']())if(_0x3180f8['isVisible'])return!0x0;return!0x1;}['updateResourceState'](_0x1b74e5,_0x43efc9,_0x541e6b){const _0x1a8cab=this['_sourceResourceBalloons']['get'](_0x1b74e5);if(!_0x1a8cab||!_0x1a8cab['isVisible'])return;const _0x2155ba=this['_config']['getTargetElement']();if(!_0x2155ba)return;_0x1a8cab['pin']({'target':_0x2155ba,'limiter':this['_config']['getLimiterElement']()});const _0xb2e1e0=this['_getResourcesViewFromBalloon'](_0x1a8cab);_0xb2e1e0&&_0xb2e1e0['updateResourceState'](_0x43efc9,_0x541e6b);}['destroy'](){for(const _0x383998 of this['_sourceResourceBalloons']['values']())_0x383998['destroy']();this['_sourceResourceBalloons']['clear']();}['_createSourceResourceBalloonPanel'](){const _0x3892b8=new Nt(this['_locale']);return _0x3892b8['extendTemplate']({'attributes':{'class':_o}}),this['_bodyCollection']['add'](_0x3892b8),_0x3892b8;}['_addSourceResourceContent']({balloonPanel:_0x7cdda8,source:_0x24c0b7,withBackButton:_0x277ad5}){_0x7cdda8['content']['clear']();const _0x1e7c67=this['_createBalloonHeader']({'balloonPanel':_0x7cdda8,'source':_0x24c0b7,'withBackButton':_0x277ad5});_0x7cdda8['content']['add'](_0x1e7c67);const _0x251e11=this['_createBalloonResourcesView'](_0x24c0b7);_0x7cdda8['content']['add'](_0x251e11);}['_createBalloonHeader']({balloonPanel:_0x3dd3a4,source:_0xdccca0,withBackButton:_0x583c59}){const _0x4917ca=new Gt(this['_locale'],{'label':_0xdccca0['label'],'class':Ao});return _0x583c59&&_0x4917ca['children']['add'](this['_createBackButton'](_0x3dd3a4),0x0),_0x4917ca;}['_createBackButton'](_0x2f4254){const _0x4ab366=new Pt(this['_locale']);return _0x4ab366['set']({'icon':_0x432064,'tooltip':ls(this['_locale'],'AI_CHAT_CONTEXT_URL_BACK_TO_CONTEXT'),'tooltipPosition':'n','class':go}),_0x4ab366['on']('execute',()=>{_0x2f4254['hide'](),this['_config']['onBackToContext']();}),_0x4ab366;}['_createBalloonResourcesView'](_0x4869b7){const _0x50b34a=new uo(this['_locale'],{'source':_0x4869b7,'searchInputVisibleFrom':this['_config']['searchInputVisibleFrom']});return _0x50b34a['on']('loadSourceResources',(_0x42ab99,_0x4eefa1)=>{this['_config']['onLoadSourceResources'](_0x4eefa1);}),_0x50b34a['on']('addResourceToContext',(_0xd28781,_0x2db85a)=>{this['_config']['onResourceSelected'](_0x2db85a['source'],_0x2db85a['resource']),this['closeSourceResourceBalloon'](_0x4869b7['id']);}),_0x50b34a;}['_getResourcesViewFromBalloon'](_0xb3dd92){const _0x26c8c2=_0xb3dd92['content']['get'](0x1);return _0x26c8c2 instanceof uo?_0x26c8c2:null;}['_setupSingleResourceBalloonClickOutsideHandler'](_0x1c24bd){_0x262419({'emitter':_0x1c24bd,'contextElements':[_0x1c24bd['element']],'callback':()=>{_0x1c24bd['hide'](),this['_config']['onBalloonClosed']();},'activator':()=>_0x1c24bd['isVisible']});}};const po=['addDocumentToContext','addFileToContext','addUrlToContext','addResourceToContext','removeContextItem','loadSourceResources','executeCustomItemCallback'],mo='ck-ai-chat-context-controls',Eo='ck-ai-chat-context-controls__pending-contexts',To='ck-ai-chat-context-controls__add-context-balloon-panel',wo='ck-ai-chat-context-controls__add-context-button',Co='ck-ai-chat-context-controls__url-balloon-panel',fo='ck-ai-chat-context-controls__balloon-button',bo='ck-ai-chat-context-controls__balloon-button-source',So='ck-ai-chat-controls-button',Ro='ck-ai-chat-context-chips-wrapper-balloon',Oo='ck-ai-chat-controls_context_show-more-button',vo='ck-ai-chat-context-controls__show-more-balloon-panel',ko='ck-ai-chat',No=[Nt['defaultPositions']['northArrowSouthWest'],Nt['defaultPositions']['northArrowSouth'],Nt['defaultPositions']['northArrowSouthEast'],Nt['defaultPositions']['southArrowNorthWest'],Nt['defaultPositions']['southArrowNorth'],Nt['defaultPositions']['southArrowNorthEast']];var yo=class extends _0x1e8352{['addContextButtonView'];['_currentContextsChips']=this['createCollection']();['_conversationContextsChips']=this['createCollection']();['_overflowManager'];['_addContextBalloonPanelView'];['_urlBalloonPanelView'];['_urlInputView'];['_resourcesBalloonView'];['_addContextBalloonConfig'];['_hasExactlyOneSource']=!0x1;['bodyCollection'];constructor(_0x28a6b0,_0x46b49a){super(_0x28a6b0),this['bodyCollection']=_0x46b49a['bodyCollection'],this['_currentContextsChips']=this['createCollection'](),this['_conversationContextsChips']=this['createCollection'](),this['addContextButtonView']=this['_createAddContextButtonView'](_0x28a6b0),this['_addContextBalloonPanelView']=this['_createAddContextBalloonPanelView'](_0x28a6b0),this['_urlBalloonPanelView']=this['_createUrlBalloonPanelView'](_0x28a6b0),this['_resourcesBalloonView']=this['_createResourcesBalloonView'](_0x28a6b0,_0x46b49a);const _0x5db13f={'cssClasses':{'showMoreButton':Oo+'\x20'+cn,'showMoreBalloon':vo,'overflowContainer':Ro,'controlsButton':So}};this['_overflowManager']=new Cr(_0x28a6b0,this['_currentContextsChips'],_0x5db13f,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'](_0x22a2e0,_0x327b62){const _0xd4b01c=this['_createContextButton'](_0x22a2e0,'current',!0x0,_0x327b62);this['_addContextToCollection'](_0xd4b01c,this['_currentContextsChips']),this['_overflowManager']['reorganizeChips']();}['removeContextItem'](_0xc5144d){this['_removeContextFromCollection'](_0xc5144d,this['_currentContextsChips']),this['_removeContextFromCollection'](_0xc5144d,this['_overflowManager']['overflowChips']),this['_overflowManager']['reorganizeChips']();}['setContextItemLoading'](_0xdd51d8,_0x4362a5){let _0x28c1ea=this['_currentContextsChips']['find'](_0x372b31=>_0x372b31['id']===_0xdd51d8);_0x28c1ea||(_0x28c1ea=this['_overflowManager']['overflowChips']['find'](_0x34c4d8=>_0x34c4d8['id']===_0xdd51d8)),_0x28c1ea&&(_0x28c1ea['isLoading']=_0x4362a5);}['setConversationContext'](_0x4c39ba){this['_conversationContextsChips']['clear']();for(const _0x239708 of _0x4c39ba){const _0x2fc84c=this['_createContextButton'](_0x239708,'conversation',!0x1,!0x1);this['_addContextToCollection'](_0x2fc84c,this['_conversationContextsChips']);}}['clearCurrentContextItems'](){this['_currentContextsChips']['clear'](),this['_overflowManager']['clear']();}['clearConversationContextItems'](){this['_conversationContextsChips']['clear']();}['updateResourceState'](_0x30acb2,_0x4ae881,_0x26f343){this['_resourcesBalloonView']['updateResourceState'](_0x30acb2,_0x4ae881,_0x26f343);}['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:_0x200a0b,withBackButton:_0x939cfa}){this['_resourcesBalloonView']['showSourceResourcesBalloon']({'source':_0x200a0b,'withBackButton':_0x939cfa}),this['addContextButtonView']['isOn']=!0x0;}['populateSourceResourceBalloon'](_0x442f1f,_0x252fab,_0x1883b5,_0x43f3f7){this['_resourcesBalloonView']['populateSourceResourceBalloon'](_0x442f1f,_0x1883b5,_0x43f3f7);}['closeSourceResourceBalloon'](_0x394f21){this['_resourcesBalloonView']['closeSourceResourceBalloon'](_0x394f21),this['addContextButtonView']['isOn']=!0x1;}['setAddContextOptions'](_0x56ea1b){this['_setBalloonPanelContent'](this['_addContextBalloonPanelView'],this['locale'],_0x56ea1b),this['_setAddContextButtonEnabled'](_0x56ea1b);}['_setAddContextButtonEnabled'](_0x130fba){const _0x1d0a54=!_0x130fba['document']['isHidden']&&_0x130fba['document']['enabled'],_0x522c7d=_0x130fba['urls']['enabled'],_0x4f8aa8=_0x130fba['files']['enabled'],_0x49a1d1=_0x130fba['sources']['length']>0x0,_0x425c1f=_0x130fba['customItems']&&_0x130fba['customItems']['length']>0x0;this['addContextButtonView']['isEnabled']=_0x1d0a54||_0x522c7d||_0x4f8aa8||_0x49a1d1||_0x425c1f;}['_setupTemplate'](){this['setTemplate']({'tag':'div','attributes':{'class':[mo,'ck-reset_all-excluded']},'children':[{'tag':'div','attributes':{'class':Eo},'children':this['_currentContextsChips']}]});}['_bindEventHandlers'](){this['addContextButtonView']['on']('execute',()=>{this['_handleAddContextButtonClick']();});}['_createAddContextButtonView'](_0x49ff6a){const _0x5a1ff9=new Pt(_0x49ff6a);return _0x5a1ff9['set']({'label':ls(_0x49ff6a,'AI_CHAT_CONTEXT_ADD_CONTEXT'),'class':So+'\x20'+wo+'\x20'+cn,'icon':_0x2d6983,'isToggleable':!0x0,'tooltip':!0x0,'tooltipPosition':'sw'}),_0x5a1ff9;}['_createAddContextBalloonPanelView'](_0x528ae5){return this['_createBaseBalloonPanel'](_0x528ae5,To);}['_createUrlBalloonPanelView'](_0x39cb7f){const _0x30f810=this['_createBaseBalloonPanel'](_0x39cb7f,Co);return this['_addUrlContent'](_0x30f810,_0x39cb7f),_0x30f810;}['_createResourcesBalloonView'](_0x94918b,_0x24163b){const _0x35e5e7={'searchInputVisibleFrom':_0x24163b['searchInputVisibleFrom'],'onBackToContext':()=>{this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});},'onResourceSelected':(_0x513c0d,_0x319a5b)=>{this['fire']('addResourceToContext',{'source':_0x513c0d,'resource':_0x319a5b});},'onLoadSourceResources':_0x4dc831=>{this['fire']('loadSourceResources',_0x4dc831);},'onBalloonClosed':()=>{this['addContextButtonView']['isOn']=!0x1;},'getLimiterElement':()=>this['_getLimiterElement'](),'getTargetElement':()=>this['addContextButtonView']['element']};return new Io(_0x94918b,_0x24163b['bodyCollection'],_0x35e5e7);}['_getLimiterElement'](){return this['element']?.['closest']('.'+ko)||document['body'];}['_createBaseBalloonPanel'](_0x488993,_0x2bb800){const _0x22aab7=new Nt(_0x488993);return _0x22aab7['extendTemplate']({'attributes':{'class':_0x2bb800}}),this['bodyCollection']['add'](_0x22aab7),_0x22aab7;}['_setBalloonPanelContent'](_0x1f83cb,_0x28eb68,_0x4a49f6){if(_0x1f83cb['content']['clear'](),!_0x4a49f6['document']['isHidden']&&_0x4a49f6['document']['enabled']){const _0x5d7b9a=this['_createBalloonButton'](_0x28eb68,{'label':ls(_0x28eb68,'AI_CHAT_CONTEXT_CURRENT_DOCUMENT'),'icon':_0x5549b7});_0x5d7b9a['on']('execute',()=>{this['fire']('addDocumentToContext'),this['hideAddContextBalloonPanel']();}),_0x1f83cb['content']['add'](_0x5d7b9a);}if(_0x4a49f6['urls']['enabled']){const _0x1d500c=this['_createBalloonButton'](_0x28eb68,{'label':ls(_0x28eb68,'AI_CHAT_CONTEXT_URL_LABEL'),'icon':_0x368e79});_0x1d500c['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['showUrlBalloonPanel'](),this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_urlInputView']['focus']();}),_0x1f83cb['content']['add'](_0x1d500c);}if(_0x4a49f6['files']['enabled']){const _0x2b3b85=new Ut(_0x28eb68);_0x2b3b85['set']({'label':ls(_0x28eb68,'AI_CHAT_CONTEXT_FILE_LABEL'),'icon':_0xc00b77,'withText':!0x0,'tooltip':!0x0,'class':fo,'allowMultipleFiles':!0x0}),_0x2b3b85['on']('execute',()=>{this['hideAddContextBalloonPanel']();}),_0x2b3b85['on']('done',(_0x57e6d4,_0x2c5c33)=>{this['fire']('addFileToContext',_0x2c5c33);}),_0x2b3b85['tooltip']=!0x0,_0x1f83cb['content']['add'](_0x2b3b85);}for(const _0x1b8dca of _0x4a49f6['sources']){const _0x5511de=this['_createBalloonButton'](_0x28eb68,{'label':_0x1b8dca['label'],'icon':_0x1b8dca['icon']||_0x2ce4a4,'type':'source'});_0x1f83cb['content']['add'](_0x5511de),_0x5511de['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['_showSourceResourcesBalloon']({'source':_0x1b8dca,'withBackButton':!this['_hasExactlyOneSource']});});}for(const _0x587e14 of _0x4a49f6['customItems']||[]){const _0x55898e=this['_createBalloonButton'](_0x28eb68,{'label':_0x587e14['label'],'icon':_0x587e14['icon']||_0x2ce4a4,'type':'customItem'});_0x1f83cb['content']['add'](_0x55898e),_0x55898e['on']('execute',()=>{this['hideAddContextBalloonPanel'](),this['fire']('executeCustomItemCallback',_0x587e14);});}this['_hasExactlyOneSource']=0x1===_0x1f83cb['content']['length'],this['_urlInputView']['withBackButton']=!this['_hasExactlyOneSource'];}['_addUrlContent'](_0x1f4ed0,_0x40bcbb){this['_urlInputView']=new io(_0x40bcbb),this['_urlInputView']['on']('submitUrl',(_0x15814c,_0xbb13ab)=>{this['_handleUrlSubmit'](_0xbb13ab);}),this['_urlInputView']['on']('cancel',()=>{this['hideUrlBalloonPanel'](),this['_hasExactlyOneSource']||(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}));}),this['_urlInputView']['on']('refreshBalloon',()=>{this['_urlBalloonPanelView']['isVisible']&&this['_urlBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No});}),_0x1f4ed0['content']['add'](this['_urlInputView']);}['_createBalloonButton'](_0x4589c8,_0x423f17){const _0x55edf3='source'===_0x423f17['type']?new xo(_0x4589c8):new Pt(_0x4589c8);return _0x55edf3['set']({'label':_0x423f17['label'],'icon':_0x423f17['icon'],'withText':!0x0,'tooltip':!0x0,'tooltipPosition':'sw','class':fo}),_0x55edf3;}['_setupAllBalloonClickOutsideHandlers'](){this['_setupAddContextBalloonClickOutsideHandler'](),this['_setupUrlBalloonClickOutsideHandler']();}['_setupUrlBalloonClickOutsideHandler'](){_0x262419({'emitter':this['_urlBalloonPanelView'],'contextElements':[this['_urlBalloonPanelView']['element']],'callback':()=>{this['hideUrlBalloonPanel']();},'activator':()=>this['_urlBalloonPanelView']['isVisible']});}['_toggleAddContextBalloon'](_0x376b51){const _0x2bde53=this['_addContextBalloonConfig'];_0x2bde53['buttonView']['isOn']=_0x376b51,_0x376b51?_0x2bde53['balloonView']['show']():_0x2bde53['balloonView']['hide']();}['_setupAddContextBalloonClickOutsideHandler'](){const {balloonView:_0x43f134,buttonView:_0x168df9,hideMethod:_0x3634d1}=this['_addContextBalloonConfig'];_0x262419({'emitter':_0x43f134,'contextElements':[_0x43f134['element'],_0x168df9['element']],'callback':()=>{_0x3634d1();},'activator':()=>_0x168df9['isOn']&&!this['_urlBalloonPanelView']['isVisible']&&!this['_resourcesBalloonView']['isAnyResourceBalloonVisible']()});}['_createContextButton'](_0x2723a6,_0x28d65b,_0x1b94cc=!0x1,_0x331abc=!0x1){const _0x177214='conversation'===_0x28d65b||!0x0===_0x2723a6['isReadOnly'],_0x77dcb6=new mr(this['locale'],_0x2723a6,_0x177214,_0x1b94cc,_0x331abc);return _0x177214||_0x77dcb6['on']('removeContextItemChip',()=>{this['fire']('removeContextItem',_0x77dcb6['id']);}),_0x77dcb6;}['_addContextToCollection'](_0x1a5db6,_0x3d9f1d){_0x3d9f1d['add'](_0x1a5db6,0x0);}['_removeContextFromCollection'](_0x1b59a2,_0x25aee6){const _0x3a5d2b=_0x25aee6['find'](_0x46a400=>_0x46a400['id']===_0x1b59a2);_0x3a5d2b&&_0x25aee6['remove'](_0x3a5d2b);}['_handleAddContextButtonClick'](){this['addContextButtonView']['isOn']?this['hideAddContextBalloonPanel']():(this['showAddContextBalloonPanel'](),this['_addContextBalloonPanelView']['pin']({'target':this['addContextButtonView']['element'],'limiter':this['_getLimiterElement'](),'positions':No}),this['_hasExactlyOneSource']&&this['_addContextBalloonPanelView']['content']['get'](0x0)?.['fire']('execute'));}['_handleUrlSubmit'](_0x47e4fa){this['_urlInputView']['clear'](),this['hideUrlBalloonPanel'](),this['fire']('addUrlToContext',_0x47e4fa);}},xo=class extends Pt{['arrowView'];constructor(_0x223945){super(_0x223945),this['set']({'withText':!0x0,'role':'menuitem'}),this['arrowView']=this['_createArrowView'](),this['extendTemplate']({'attributes':{'class':[bo]}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x530ff0=new Wt();return _0x530ff0['content']=_0x10b8ad,_0x530ff0['extendTemplate']({'attributes':{'class':bo+'__arrow'}}),_0x530ff0;}},Lo=class extends _0x1e8352{['_cancelButtonView'];['_loaderView'];constructor(_0x56fcd3){super(_0x56fcd3),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 _0x5c5c0e=new Pt(this['locale']);return _0x5c5c0e['set']({'label':ls(this['locale'],'AI_CHAT_STOP_GENERATING'),'withText':!0x0,'class':hn+'\x20ck-ai-button-stop-generating','icon':et}),_0x5c5c0e['on']('execute',()=>{this['fire']('abortPromptStream');}),_0x5c5c0e;}['_createLoaderView'](){const _0x23b222=new _0x1e8352(this['locale']);return _0x23b222['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon']},'children':[{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}},{'tag':'div','attributes':{'class':['ck-ai-chat-controls-loader-icon-dot']}}]},{'text':ls(this['locale'],'AI_CHAT_IS_WRITING')}]}),_0x23b222;}},Do=class extends _0x1e8352{['_contextPanelView'];['_promptInputView'];['_dropZoneView'];['_promptCapabilitiesView'];['_loaderView'];['_modelUnavailableMessageView'];['_shouldRestorePromptInputFocus'];['_filesEnabled'];constructor(_0x19c92b,_0x2204d1){super(_0x19c92b),this['_filesEnabled']=_0x2204d1['filesEnabled'],this['_contextPanelView']=this['_createContextPanelView'](_0x19c92b,{'bodyCollection':_0x2204d1['bodyCollection'],'searchInputVisibleFrom':_0x2204d1['contextResourcesSearchInputVisibleFrom']}),this['_promptInputView']=this['_createPromptInputView'](_0x19c92b),this['_promptCapabilitiesView']=this['_createPromptCapabilitiesView'](_0x19c92b),this['_loaderView']=this['_createLoaderView'](_0x19c92b),this['_modelUnavailableMessageView']=this['_createModelUnavailableMessageView'](_0x19c92b),this['_dropZoneView']=new Fr(_0x19c92b),this['_shouldRestorePromptInputFocus']=!0x1,this['_promptInputView']['delegate']('sendUserMessage','promptInputPaste')['to'](this),this['_dropZoneView']['delegate']('promptInputPaste')['to'](this),this['_dropZoneView']['on']('dragEnter',()=>this['_contextPanelView']['hideAllBalloons']()),this['_loaderView']['delegate']('abortPromptStream')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleWebSearch')['to'](this),this['_promptCapabilitiesView']['delegate']('toggleReasoning')['to'](this),this['_promptCapabilitiesView']['delegate']('selectModel')['to'](this),this['_contextPanelView']['delegate'](...po)['to'](this),this['set']('isModelAvailable',!0x0),this['set']('isDisabled',!0x1);const _0x276d90=this['bindTemplate'];this['setTemplate']({'tag':'form','attributes':{'class':['ck','ck-ai-chat-controls',_0x276d90['if']('isDisabled','ck-ai-chat-controls-disabled')]},'children':[{'tag':'div','attributes':{'class':[_0x276d90['if']('isLoading','ck-hidden',_0x25f192=>_0x25f192||!this['isModelAvailable']),_0x276d90['if']('isModelAvailable','ck-hidden',_0x1b9e8e=>!_0x1b9e8e||this['isLoading'])]},'children':[this['_contextPanelView'],this['_promptInputView'],this['_promptCapabilitiesView']]},{'tag':'div','attributes':{'class':[_0x276d90['if']('isLoading','ck-hidden',_0x1fde5e=>!_0x1fde5e)]},'children':[this['_loaderView']]},{'tag':'div','attributes':{'class':[_0x276d90['if']('isModelAvailable','ck-hidden',_0x48c951=>_0x48c951)]},'children':[this['_modelUnavailableMessageView']]},this['_dropZoneView']]}),_0x262419({'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'](_0x1a2875,_0x551cc2){return new yo(_0x1a2875,_0x551cc2);}['_createPromptInputView'](_0x4d4ef2){return new Gr(_0x4d4ef2,this['_contextPanelView']['addContextButtonView']);}['_createPromptCapabilitiesView'](_0x472b2d){return new jr(_0x472b2d);}['_createLoaderView'](_0x5cd2da){return new Lo(_0x5cd2da);}['_createModelUnavailableMessageView'](_0x34a40e){const _0x1b26ba=new Po(_0x34a40e);return _0x1b26ba['delegate']('startConversation')['to'](this),_0x1b26ba;}['_handlePromptInputFocus'](_0x1e242f,_0x360dae,_0x4c7625){_0x4c7625?this['_shouldRestorePromptInputFocus']=!0x0:this['_shouldRestorePromptInputFocus']&&this['_promptInputView']['focus']();}['addContextItem'](_0x295a16,_0x2a5b7f){this['_contextPanelView']['addContextItem'](_0x295a16,_0x2a5b7f);}['removeContextItem'](_0x11e8b8){this['_contextPanelView']['removeContextItem'](_0x11e8b8);}['setContextItemLoading'](_0x32b2df,_0x3abcbd){this['_contextPanelView']['setContextItemLoading'](_0x32b2df,_0x3abcbd);}['setIsUploadInProgress'](_0x486cea){this['_promptInputView']['setIsUploadInProgress'](_0x486cea);}['setConversationContext'](_0x5dc6de){this['_contextPanelView']['setConversationContext'](_0x5dc6de);}['clearPendingContextUI'](){this['_contextPanelView']['clearCurrentContextItems']();}['clearConversationContextUI'](){this['_contextPanelView']['clearConversationContextItems']();}['updateResourceState'](_0x54c43c,_0x59ccf7,_0x24a076){this['_contextPanelView']['updateResourceState'](_0x54c43c,_0x59ccf7,_0x24a076);}['setWebSearch'](_0xe3044a){this['_promptCapabilitiesView']['setWebSearch'](_0xe3044a);}['setReasoning'](_0x4b64b9){this['_promptCapabilitiesView']['setReasoning'](_0x4b64b9);}['resetMessageInput'](){this['_promptInputView']['reset']();}['setAddContextOptions'](_0x45d7fd){this['_contextPanelView']['setAddContextOptions'](_0x45d7fd);}['setInputPlaceholder'](_0x1aa75b){this['_promptInputView']['setPlaceholderText'](_0x1aa75b);}['setModelList'](_0x2f6e41,_0x4d424a){this['_promptCapabilitiesView']['setModelList'](_0x2f6e41,_0x4d424a);}['setModel'](_0x520ca9){_0x520ca9?(this['isModelAvailable']=!0x0,this['_promptCapabilitiesView']['setModel'](_0x520ca9)):this['isModelAvailable']=!0x1;}['enableModelSelector'](){this['_promptCapabilitiesView']['enableModelSelector']();}['disableModelSelector'](_0x3b3db9){this['_promptCapabilitiesView']['disableModelSelector'](_0x3b3db9);}['populateSourceResourceBalloon'](_0x17e3d6,_0x1fa9aa,_0x27386a,_0x1df4d4){this['_contextPanelView']['populateSourceResourceBalloon'](_0x17e3d6,_0x1fa9aa,_0x27386a,_0x1df4d4);}['closeSourceResourceBalloon'](_0x26b42b){this['_contextPanelView']['closeSourceResourceBalloon'](_0x26b42b);}['focusPromptInput'](_0x32e831=!0x1){this['_promptInputView']['focus'](_0x32e831);}['setPromptInputValue'](_0x38ed95){this['_promptInputView']['queryView']['fieldView']['reset'](),this['_promptInputView']['queryView']['fieldView']['value']=_0x38ed95;}},Po=class extends _0x1e8352{constructor(_0x382e72){super(_0x382e72);const _0x393bb7=new Pt(_0x382e72);_0x393bb7['set']({'label':ls(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_BUTTON'),'withText':!0x0,'class':['ck-ai-chat-controls__start-new-chat-button'],'tooltip':''}),_0x393bb7['delegate']('execute')['to'](this,'startConversation'),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-controls-model-unavailable-message']},'children':[{'tag':'p','children':[{'text':ls(this['locale'],'AI_CHAT_MODEL_UNAVAILABLE_MESSAGE_TEXT')+'\x20'},_0x393bb7]}]});}},Ho=class extends Gt{['resizeButton'];constructor(_0x1c1ac7,_0x4bf17e){super(_0x1c1ac7,{'label':_0x4bf17e['label'],'class':'ck-ai-header\x20'+_0x4bf17e['class'],'icon':_0x4bf17e['icon']}),this['set']('isMaximized',!0x1),_0x4bf17e['content']&&this['children']['add'](_0x4bf17e['content']),_0x4bf17e['showResizeButton']&&(this['resizeButton']=ln(_0x1c1ac7,this),this['children']['add'](this['resizeButton']));}},Mo=class extends _0x1e8352{constructor(_0x4b0c02){super(_0x4b0c02),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-disclaimer__content']},'children':[{'text':ls(_0x4b0c02,'AI_DISCLAIMER_TEXT')}]}]});}};function Vo(_0x31842d,_0x3e741c){const _0x499ee7=new Pt(_0x31842d);return _0x499ee7['set']({'label':ls(_0x31842d,'AI_CHAT_LABEL_NEW_CHAT'),'withText':!0x0,'icon':_0x94b997,'class':'ck-ai-chat__start-conversation\x20'+hn}),_0x499ee7['on']('execute',()=>{_0x3e741c['fire']('startConversation');}),_0x499ee7;}var Uo=class extends _0x1e8352{['chatHeader'];['chatFeed'];['chatControls'];['chatDisclaimer'];['_bodyCollection'];constructor(_0xc99431,_0x2b7997){super(_0xc99431),this['_bodyCollection']=un(_0xc99431);const _0xd0853a=Vo(_0xc99431,this);this['chatHeader']=new Ho(_0xc99431,{'label':ls(_0xc99431,'AI_CHAT_HEADING'),'icon':_0xc2f0bc,'class':'ck-ai-header_chat','content':_0xd0853a,'showResizeButton':_0x2b7997['showResizeButton']}),this['chatHeader']['delegate']('resizeTabs')['to'](this),this['chatFeed']=new Mr(_0xc99431,this['_bodyCollection']),this['chatFeed']['delegate'](...yn)['to'](this),this['chatControls']=new Do(_0xc99431,{'bodyCollection':this['_bodyCollection'],'contextResourcesSearchInputVisibleFrom':_0x2b7997['contextResourcesSearchInputVisibleFrom'],'filesEnabled':_0x2b7997['filesEnabled']}),this['chatControls']['delegate'](...yn)['to'](this),this['chatDisclaimer']=new Mo(_0xc99431),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-chat','ck-rounded-corners'],'dir':_0xc99431['uiLanguageDirection']},'children':[this['chatHeader'],this['chatFeed'],this['chatControls'],this['chatDisclaimer']]});}['populateSourceResourceBalloon'](_0x103851,_0x39d4f9,_0x57cd12,_0x8f6ab9){this['chatControls']['populateSourceResourceBalloon'](_0x103851,_0x39d4f9,_0x57cd12,_0x8f6ab9);}['closeSourceResourceBalloon'](_0x5dae36){this['chatControls']['closeSourceResourceBalloon'](_0x5dae36);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}},Bo=class extends _0x2d0760{static get['requires'](){return[hs];}['_view'];static get['pluginName'](){return'AIChatUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['feedItemRenderingStrategy']='streaming';['showDiff']=!0x0;['_promiseQueue'];['_interactionPromiseResolver'];['_titleAnimationInterval']=void 0x0;['_isTrackChangesCommandValueBound']=!0x1;constructor(_0x1b3df9){super(_0x1b3df9);const _0x1656c9=this['context']['plugins']['get']('AITabs');this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn(),this['_view']=new Uo(this['context']['locale'],{'showResizeButton':_0x1656c9['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'](_0x1656c9),this['_view']['delegate'](...yn)['to'](this),this['_view']['on']('toggleSuggestionDisplayMode',(_0x4f30b3,{showDiff:_0x5d8887})=>{this['showDiff']=_0x5d8887;}),this['disableControls'](),_0x1656c9['view']['addTab']({'id':'chat','buttonLabel':ls(this['context']['locale'],'AI_CHAT_HEADING'),'buttonIcon':_0xc2f0bc,'order':0x0,'content':this['_view']}),this['_view']['chatHeader']['bind']('isMaximized')['to'](_0x1656c9['view'],'isMaximized',_0x533f14=>_0x533f14),this['_view']['chatControls']['bind']('isLoading')['to'](this,'isBusy',_0x3a2a18=>_0x3a2a18),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']()),this['bind']('isModelAvailable')['to'](this['_view']['chatControls'],'isModelAvailable');}['destroy'](){super['destroy'](),this['_titleAnimationInterval']&&clearInterval(this['_titleAnimationInterval']);}['createConversation'](_0x50b1b1){const _0x17e58f=this['context']['config']['get']('ai.chat.welcomeMessage')??ls(this['context']['locale'],'AI_CHAT_WELCOME_MESSAGE');this['_view']['chatFeed']['clear'](),this['_view']['chatControls']['enableModelSelector'](),this['_view']['chatControls']['setModelList'](_0x50b1b1['availableModels'],!this['context']['config']['get']('ai.models.showModelSelector')),this['addFeedItemStaticMessage']({'id':'conversation-start','staticMessage':_0x17e58f}),this['fire']('conversationCreated');}async['addFeedItemStaticMessage']({id:_0x349ade,staticMessage:_0x487ebc}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x349ade,'initialContent':'<p>'+_0x487ebc+'</p>'});});}async['addFeedItemUserMessage'](_0x12887c){const _0x30173d=_0x12887c['attributes']?.['displayedPrompt']||_0x12887c['userMessage'];return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('user-message',{'contextItems':Array['from'](_0x12887c['contextItems']['values']()),'initialContent':'<p>'+_0x30173d+'</p>','id':_0x12887c['id']});});}async['addFeedItemError']({errorMessage:_0x4c91ae,id:_0x4a6047}){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('error-message',{'initialContent':'<p>'+_0x4c91ae+'</p>','id':_0x4a6047});});}async['addFeedItemAIReply'](_0x4b5cfc){return this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-reply',{'id':_0x4b5cfc['interactionId']+':'+_0x4b5cfc['id']}),this['clearLoadingMessage']();});}async['addFeedItemAISuggestion'](_0x2dad06){const _0x4eecb0=us(this['context']),_0x3a9070=_0x4eecb0['map'](_0x584632=>_0x584632['config']['get']('ai.availableReplyActions')||[...er]);let _0x2d536d=_0x3a9070['reduce']((_0x186143,_0x1bdc32)=>_0x186143['filter'](_0x527c3d=>_0x1bdc32['includes'](_0x527c3d)),_0x3a9070[0x0]||[...er]);const _0x537403=_0x4eecb0['every'](_0x3be90f=>_0x3be90f['plugins']['has']('TrackChanges')),_0x4ec45e=_0x4eecb0['map'](_0x19844b=>_0x19844b['commands']['get']('trackChanges'));return _0x537403?this['_isTrackChangesCommandValueBound']||(this['_isTrackChangesCommandValueBound']=!0x0,this['_view']['chatFeed']['bind']('isTrackChangesOn')['toMany'](_0x4ec45e,'value',(..._0x5ead18)=>_0x5ead18['some'](_0x57e7bc=>_0x57e7bc))):_0x2d536d=_0x2d536d['filter'](_0x1bac41=>'insertSuggestion'!=_0x1bac41),this['_promiseQueue']['enqueue'](async()=>{this['_view']['chatFeed']['addItem']('ai-suggestion-reply',{'id':_0x2dad06['interactionId']+':'+_0x2dad06['id'],'areActionsDisabled':_0x2dad06['areActionsDisabled'],'showDiff':this['showDiff'],'availableActions':_0x2d536d}),this['clearLoadingMessage']();});}async['addFeedInteractionHeader'](_0x4352bd,_0x2909a1){return this['_promiseQueue']['enqueue'](async()=>{const _0xb95479=this['_view']['chatFeed']['children']['last'];if(_0xb95479 instanceof yr)return this['_view']['chatFeed']['children']['remove'](_0xb95479),void this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x4352bd['id'],'capabilities':{'isWebSearchEnabled':_0xb95479['capabilities']['isWebSearchEnabled']||_0x2909a1['isWebSearchEnabled'],'isReasoningEnabled':_0xb95479['capabilities']['isReasoningEnabled']||_0x2909a1['isReasoningEnabled']}});this['_view']['chatFeed']['addItem']('interaction-header',{'id':_0x4352bd['id'],'capabilities':_0x2909a1});});}async['addFeedItemCustomElement'](_0x5ceb9b,_0x4cae3b){let _0xc9d1f;return await this['_promiseQueue']['enqueue'](async()=>{_0xc9d1f=this['_view']['chatFeed']['addItem']('custom-element',{'content':_0x5ceb9b,'id':_0x4cae3b});}),_0xc9d1f;}['removeFeedItem'](_0x5790d8){this['_view']['chatFeed']['removeItem'](_0x5790d8);}['hasFeedItem'](_0xe30e05){return this['_view']['chatFeed']['hasItem'](_0xe30e05);}['updateFeedInteractionHeader'](_0x14ac06){const _0x366ba6=this['_view']['chatFeed']['children']['find'](_0x5b74d6=>_0x5b74d6['options']['id']==_0x14ac06['id']&&_0x5b74d6 instanceof yr);_0x366ba6&&_0x366ba6['set']('isVisible',_0x14ac06['isVisible']);}async['updateFeedItemAIReplyContent'](_0x3b8618){const _0x425c2c=_0x3b8618['renderingStrategy']||this['feedItemRenderingStrategy'];return this['_promiseQueue']['enqueue'](async _0x34ccb0=>{await this['_view']['chatFeed']['updateReplyItem']({..._0x3b8618,'abortSignal':_0x34ccb0,'renderingStrategy':_0x425c2c}),_0x3b8618['isDone']&&this['markFeedItemAsDone'](_0x3b8618['id']);});}['updateFeedItemAIReplySources'](_0x9fbb23,_0x5e05d2){this['_view']['chatFeed']['updateWebSources'](_0x9fbb23,_0x5e05d2);}async['updateFeedItemAIReplySuggestionContent'](_0x3f5679){return this['_promiseQueue']['enqueue'](async _0x11923c=>{await this['_view']['chatFeed']['updateSuggestionItem']({..._0x3f5679,'abortSignal':_0x11923c}),_0x3f5679['isDone']&&this['markFeedItemAsDone'](_0x3f5679['id']);});}['updateFeedItemAIReplySuggestionPartState'](_0x13d867){this['_view']['chatFeed']['updateSuggestionPartState'](_0x13d867);}['setFeedItemAIReplySuggestionPartActive'](_0x9737e2){this['_view']['chatFeed']['setSuggestionPartActive'](_0x9737e2);}['markFeedItemAsDone'](_0x1d5a16){this['_view']['chatFeed']['markItemAsDone'](_0x1d5a16);}['removeFeedInteraction'](_0x1a6fba){this['_view']['chatFeed']['getItemIds']()['filter'](_0x494717=>_0x494717['startsWith'](_0x1a6fba))['forEach'](_0x44f530=>this['_view']['chatFeed']['removeItem'](_0x44f530));}['startInteraction'](){const _0x361e03=this['prepareLoadingMessage']({'isWebSearchEnabled':!0x1,'isReasoningEnabled':!0x1});this['setLoadingMessage'](_0x361e03),this['_view']['chatControls']['disableModelSelector'](!this['context']['config']['get']('ai.models.showModelSelector')),this['isBusy']=!0x0,this['_view']['chatFeed']['startAutoScroll']();}['stopInteraction'](_0x305cc5){this['_promiseQueue']['abort'](),this['_view']['chatFeed']['getItemIds']()['filter'](_0x814266=>_0x814266['startsWith'](_0x305cc5['id']))['forEach'](_0x6f231b=>this['markFeedItemAsDone'](_0x6f231b)),this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();}async['finishInteraction'](){return this['_promiseQueue']['queueEmptyPromise']['then'](()=>{this['isBusy']=!0x1,this['clearLoadingMessage'](),this['_view']['chatFeed']['stopAutoScroll']();});}['addContextItem'](_0x2a9b4c,_0x1deb7e){this['_view']['chatControls']['addContextItem'](_0x2a9b4c,_0x1deb7e);}['removeContextItem'](_0x470b58){this['_view']['chatControls']['removeContextItem'](_0x470b58);}['setContextItemLoading'](_0x11a95e,_0x3ebe5b){this['_view']['chatControls']['setContextItemLoading'](_0x11a95e,_0x3ebe5b);}['setIsUploadInProgress'](_0x40cf19){this['_view']['chatControls']['setIsUploadInProgress'](_0x40cf19);}['setConversationContext'](_0x43dcfd){this['_view']['chatControls']['setConversationContext'](_0x43dcfd);}['clearPendingContextUI'](){this['_view']['chatControls']['clearPendingContextUI']();}['clearConversationContextUI'](){this['_view']['chatControls']['clearConversationContextUI']();}['updateResourceState'](_0x307c0,_0x4a3c75,_0x525bba){this['_view']['chatControls']['updateResourceState'](_0x307c0,_0x4a3c75,_0x525bba);}['resetMessageInput'](){this['_view']['chatControls']['resetMessageInput'](),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder']());}['setAddContextOptions'](_0x41bb49){this['_view']['chatControls']['setAddContextOptions'](_0x41bb49);}['updateCapabilities'](_0x54467a){this['_view']['chatControls']['setWebSearch'](_0x54467a['isWebSearchEnabled']),this['_view']['chatControls']['setReasoning'](_0x54467a['isReasoningEnabled']),this['_view']['chatControls']['setInputPlaceholder'](this['_getInputPlaceholder'](_0x54467a));}['setSelectedModel'](_0x4c7e21,_0x26dee9){this['_view']['chatControls']['setModel'](_0x4c7e21),_0x26dee9&&this['_view']['chatControls']['disableModelSelector'](!0x1);}['setFeedItemRenderingStrategy'](_0x37645d){this['feedItemRenderingStrategy']=_0x37645d;}['toggleLoadingSkeleton'](_0x549669){this['_view']['chatFeed']['toggleLoadingSkeleton'](_0x549669);}['resetConversationTitle'](){this['setConversationTitle'](ls(this['context']['locale'],'AI_CHAT_HEADING'));}['emptyConversationTitle'](){this['setConversationTitle']('');}['setConversationTitle'](_0x51f01c,_0x4ba115=!0x1){if(clearInterval(this['_titleAnimationInterval']),_0x4ba115&&!It()&&_0x51f01c['length'])return this['_view']['chatHeader']['label']='',void this['_animateConversationTitle'](_0x51f01c);this['_view']['chatHeader']['label']=_0x51f01c;}['setLoadingMessage'](_0x5acdee){this['_view']['chatFeed']['setLoadingMessage'](_0x5acdee);}['clearLoadingMessage'](){this['_view']['chatFeed']['setLoadingMessage']('');}['_animateConversationTitle'](_0x507119){let _0x1d387b=0x0;this['_titleAnimationInterval']=setInterval(()=>{this['_view']['chatHeader']['label']=this['_view']['chatHeader']['label']+_0x507119[_0x1d387b],_0x1d387b++,_0x1d387b===_0x507119['length']&&clearInterval(this['_titleAnimationInterval']);},0x1e);}['prepareLoadingMessage'](_0x27bb48){return _0x27bb48['isWebSearchEnabled']&&_0x27bb48['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH_REASONING'):_0x27bb48['isWebSearchEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_WEBSEARCH'):_0x27bb48['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REASONING'):ls(this['context']['locale'],'AI_CHAT_FEED_LOADING_MESSAGE_REGULAR');}['_getInputPlaceholder'](_0x40e3c8){return _0x40e3c8?_0x40e3c8['isWebSearchEnabled']&&_0x40e3c8['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH_REASONING'):_0x40e3c8['isWebSearchEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_WEBSEARCH'):_0x40e3c8['isReasoningEnabled']?ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REASONING'):ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR'):ls(this['context']['locale'],'AI_CHAT_PROMPT_INPUT_PLACEHOLDER_REGULAR');}['populateSourceResourceBalloon'](_0x494112,_0x2a73a2,_0x17339e,_0x4320b4){this['_view']['populateSourceResourceBalloon'](_0x494112,_0x2a73a2,_0x17339e,_0x4320b4);}['closeSourceResourceBalloon'](_0x28cdb9){this['_view']['closeSourceResourceBalloon'](_0x28cdb9);}['setPromptInputValue'](_0x2221cf){this['_view']['chatControls']['setPromptInputValue'](_0x2221cf);}['focusPromptInput'](_0x50aaad=!0x1){this['_view']['chatControls']['focusPromptInput'](_0x50aaad);}['scrollFeedToSuggestion'](_0xf3af5a,_0x4f6439){this['_view']['chatFeed']['scrollToSuggestion'](_0xf3af5a,_0x4f6439);}['startAutoScroll'](_0x263f41={}){this['_view']['chatFeed']['startAutoScroll'](_0x263f41);}['disableControls'](){this['_view']['chatControls']['isDisabled']=!0x0;}['enableControls'](){this['_view']['chatControls']['isDisabled']=!0x1;}},Go=class extends zt{['sections'];constructor(_0x27d487,_0x2e6d56){super(_0x27d487),this['sections']=_0x2e6d56,this['items']['addMany'](this['sections']),this['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__sections']}});}['filter'](_0x802fe1){let _0x32e1dc=0x0,_0x586e51=0x0;for(const _0x47f15f of this['sections']){const {resultsCount:_0x391516,totalItemsCount:_0x43d04c}=_0x47f15f['filter'](_0x802fe1);_0x32e1dc+=_0x391516,_0x586e51+=_0x43d04c;}return{'resultsCount':_0x32e1dc,'totalItemsCount':_0x586e51};}},Fo=class extends Xt{['title'];['itemsViews'];['_itemsListView'];constructor(_0x95b82c,{title:_0x34d23c,items:_0xc717f0}){super(_0x95b82c);const _0x5aebeb=this['bindTemplate'];this['set']('isVisible',!0x0),this['title']=_0x34d23c,this['itemsViews']=_0xc717f0;const _0x9d480a=new _0x1e8352(_0x95b82c);_0x9d480a['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__section-title']},'children':[this['title']]}),this['_itemsListView']=new zt(_0x95b82c),this['_itemsListView']['items']['addMany'](this['itemsViews']),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__section',_0x5aebeb['if']('isVisible','ck-hidden',_0x502fc4=>!_0x502fc4)]},'children':[_0x9d480a,this['_itemsListView']]});}['filter'](_0x190c5d){const _0x44feac=this['itemsViews']['length'];let _0x1e73d9=0x0;for(const _0x3e8ec2 of this['itemsViews'])_0x190c5d?(_0x3e8ec2['isVisible']=!!_0x3e8ec2['isMatching'](_0x190c5d),_0x3e8ec2['highlightText'](_0x190c5d)):(_0x3e8ec2['isVisible']=!0x0,_0x3e8ec2['highlightText'](null)),_0x3e8ec2['isVisible']&&_0x1e73d9++;return this['isVisible']=_0x1e73d9>0x0,{'resultsCount':_0x1e73d9,'totalItemsCount':_0x44feac};}['getItem'](_0x6d1d71){return this['itemsViews']['find'](_0x42e748=>_0x42e748['id']===_0x6d1d71);}['removeItem'](_0x19efee){const _0x38215d=this['itemsViews']['indexOf'](_0x19efee);-0x1!==_0x38215d&&(this['itemsViews']['splice'](_0x38215d,0x1),this['_itemsListView']['items']['remove'](_0x19efee));}};const Ko=/* #__PURE__ -- @preserve */
|
|
34
|
+
_0x21e0c7(Xt);var Wo=class AIChatHistoryListItemView extends Ko{['id'];static ['LOADING_LABELS']={'remove':'AI_CHAT_HISTORY_LOADING_REMOVING','rename':'AI_CHAT_HISTORY_LOADING_RENAMING','pin':'AI_CHAT_HISTORY_LOADING_PINNING','unpin':'AI_CHAT_HISTORY_LOADING_UNPINNING'};['actions'];['mainContent'];['_titleView'];constructor(_0x2049f1,_0x2f6c78){super(_0x2049f1);const _0x47f4d1=this['bindTemplate'];this['set']('isEdit',!0x1),this['set']('isVisible',!0x0),this['set']('pinned',!!_0x2f6c78['pinned']),this['set']('loadingState',null),this['set']('title',_0x2f6c78['title']),this['id']=_0x2f6c78['id'];const {createdAt:_0xf531d9,active:_0xfefdce=!0x1}=_0x2f6c78;this['_titleView']=new Kt(),this['_titleView']['bind']('text')['to'](this,'title'),this['_titleView']['extendTemplate']({'attributes':{'class':['ck-ai-chat-history__item-title']}});const _0x36ee2a=this['_createCheckView'](),_0xb6c976=this['_createPinButtonView'](_0x2049f1),_0x392abb=this['_createMenuDropdownView'](),_0x4143ab=this['_createEditInputView'](_0x2049f1),_0x74372a=this['_createAcceptEditButtonView'](_0x2049f1,_0x4143ab),_0x1746e1=this['_createCancelEditButtonView'](_0x2049f1);this['actions']=this['createCollection'](),this['mainContent']=this['createCollection'](),this['mainContent']['add'](this['_titleView']),this['actions']['add'](_0xb6c976),this['actions']['add'](_0x392abb),this['on']('change:isEdit',(_0x4b9ead,_0x426087,_0x4615bf)=>{this['actions']['clear'](),this['mainContent']['clear'](),_0x4615bf?(this['actions']['add'](_0x74372a),this['actions']['add'](_0x1746e1),this['mainContent']['add'](_0x4143ab),_0x4143ab['element']['value']=this['title']||'',_0x4143ab['element']['focus']()):(this['actions']['add'](_0xb6c976),this['actions']['add'](_0x392abb),this['mainContent']['add'](this['_titleView']));}),this['setTemplate']({'tag':'li','attributes':{'class':['ck-ai-chat-history__item',_0xfefdce?'ck-ai-chat-history__item--active':'',_0x47f4d1['if']('isVisible','ck-hidden',_0x2438c3=>!_0x2438c3),_0x47f4d1['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',_0x47f4d1['if']('loadingState','ck-hidden',_0x4b497d=>!!_0x4b497d)]},'children':_0xfefdce?[_0x36ee2a]:[]},{'tag':'div','attributes':{'class':['ck-ai-loader',_0x47f4d1['if']('loadingState','ck-hidden',_0x1f5cd5=>!_0x1f5cd5)]},'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',_0x47f4d1['if']('loadingState','ck-hidden',_0x5c4758=>!!_0x5c4758)]},'children':this['mainContent']},{'tag':'div','attributes':{'class':['ck-ai-loader__text',_0x47f4d1['if']('loadingState','ck-hidden',_0x61603d=>!_0x61603d)]},'children':[{'text':_0x47f4d1['to']('loadingState',_0x33ce2c=>_0x33ce2c?ls(this['locale'],AIChatHistoryListItemView['LOADING_LABELS'][_0x33ce2c]):'')}]}]},{'tag':'span','attributes':{'class':['ck-ai-chat-history__item-date']},'children':[_0xf531d9]}]},{'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'](_0x58dcb1){this['set']('title',_0x58dcb1);}['updateLoadingState'](_0x3b5f30,_0x2fd60e){this['set']('loadingState',_0x2fd60e?_0x3b5f30:null);}['_createCheckView'](){const _0x46923e=new Wt();return _0x46923e['set']({'content':_0x7ff926}),_0x46923e;}['_createPinButtonView'](_0x1db133){const _0xa6eaea=new Pt(_0x1db133);return _0xa6eaea['set']({'label':ls(_0x1db133,'AI_CHAT_HISTORY_PIN_BUTTON'),'icon':_0x352d08,'withText':!0x1,'tooltip':!0x0}),_0xa6eaea['bind']('isOn')['to'](this,'pinned'),_0xa6eaea['on']('execute',()=>{const _0x11da5e=!this['pinned'];this['fire']('setConversationPinned',{'id':this['id'],'pinned':_0x11da5e});}),_0xa6eaea;}['_createMenuDropdownView'](){const _0x5a6312=_0x312ca1(this['locale']),_0x124279=_0x5a6312['panelView']['children'];_0x5a6312['buttonView']['set']({'label':ls(this['locale'],'AI_CHAT_HISTORY_SHOW_MORE_ITEMS'),'icon':st}),_0x5a6312['panelPosition']='sw';const _0x2ed8fb=new Pt(this['locale']);_0x2ed8fb['label']=ls(this['locale'],'AI_CHAT_HISTORY_EDIT_NAME'),_0x2ed8fb['withText']=!0x0,_0x2ed8fb['on']('execute',()=>{this['isEdit']=!0x0;});const _0x2e5f71=new Pt(this['locale']);_0x2e5f71['label']=ls(this['locale'],'AI_CHAT_HISTORY_REMOVE'),_0x2e5f71['withText']=!0x0,_0x2e5f71['on']('execute',()=>{this['showConfirm'](ls(this['locale'],'AI_CHAT_HISTORY_REMOVE_CONFIRM'),this['element'])['then'](()=>{this['fire']('removeConversation',{'id':this['id']});});});const _0x50051c=new zt(this['locale']),_0xc20406=new Xt(this['locale']);_0xc20406['children']['add'](_0x2ed8fb);const _0xd09d31=new Xt(this['locale']);return _0xd09d31['children']['add'](_0x2e5f71),_0x50051c['items']['addMany']([_0xc20406,_0xd09d31]),_0x124279['add'](_0x50051c),_0x5a6312;}['_createEditInputView'](_0x8e5f72){const _0x51cd8a=new Yt(_0x8e5f72),_0x395898=_0x51cd8a['bindTemplate'];return _0x51cd8a['extendTemplate']({'on':{'keydown':_0x395898['to'](_0x3ef27f=>{'Enter'==_0x3ef27f['key']&&this['_commitEditInputValue'](_0x51cd8a);})}}),_0x51cd8a;}['_createAcceptEditButtonView'](_0x40fe19,_0x1d261a){const _0x31b236=new Pt(_0x40fe19);return _0x31b236['set']({'icon':_0x7ff926,'withText':!0x1,'tooltip':ls(_0x40fe19,'AI_CHAT_HISTORY_ACCEPT')}),_0x31b236['extendTemplate']({'attributes':{'class':['ck-confirm-view-submit']}}),_0x31b236['on']('execute',()=>{this['_commitEditInputValue'](_0x1d261a);}),_0x31b236;}['_commitEditInputValue'](_0x53c8e9){const _0x5452a6=_0x53c8e9['element']['value']||'';this['isEdit']=!0x1,this['fire']('editConversationTitle',{'id':this['id'],'title':_0x5452a6});}['_createCancelEditButtonView'](_0x32b149){const _0x3661c3=new Pt(_0x32b149);return _0x3661c3['set']({'icon':_0x556600,'withText':!0x1,'tooltip':ls(_0x32b149,'AI_CHAT_HISTORY_CANCEL')}),_0x3661c3['extendTemplate']({'attributes':{'class':['ck-confirm-view-cancel']}}),_0x3661c3['on']('execute',()=>{this['isEdit']=!0x1,this['fire']('edit:cancel');}),_0x3661c3;}['_createSpinnerView'](){const _0x3132b6=new cr('tiny');return _0x3132b6['isVisible']=!0x0,_0x3132b6;}['isMatching'](_0x18f22e){return'string'==typeof this['title']&&this['title']['match'](_0x18f22e)?{'title':!0x0}:null;}['highlightText'](_0x1bf5bf){this['_titleView']['highlightText'](_0x1bf5bf);}},Yo=class extends _0x1e8352{['headerView'];['searchView'];['mainErrorView'];['skeletonView'];['emptyView'];['sectionsView'];constructor(_0x5279b7,_0x11bd93){super(_0x5279b7),this['set']('hasItems',!0x1),this['set']('isLoading',!0x0),this['set']('errorMessage',''),this['set']('isSearchViewVisible',!0x1),this['set']('isEmptyViewVisible',!0x1),this['set']('isMainErrorViewVisible',!0x1);const _0x54fb8b=Vo(_0x5279b7,this);this['headerView']=new Ho(_0x5279b7,{'label':ls(_0x5279b7,'AI_CHAT_HISTORY_HEADING'),'icon':_0x811149,'class':'ck-ai-header_history','content':_0x54fb8b,'showResizeButton':_0x11bd93}),this['headerView']['delegate']('resizeTabs')['to'](this),this['sectionsView']=new Go(_0x5279b7,[]),this['sectionsView']['delegate'](...$o)['to'](this),this['mainErrorView']=this['_createErrorView'](),this['skeletonView']=this['_createSkeletonView'](),this['emptyView']=this['_createEmptyStateView'](),this['searchView']=this['_createSearchView'](),this['mainErrorView']['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isMainErrorViewVisible','ck-hidden',_0x13a3f8=>!_0x13a3f8)]}}),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 _0x4275eb=new _0x1cff6c(this['locale'],{'filteredView':this['sectionsView'],'queryView':{'label':ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_LABEL')},'infoView':{'text':{'notFound':{'primary':_0x36aa4a=>ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_PRIMARY',_0x36aa4a),'secondary':ls(this['locale'],'AI_CHAT_HISTORY_SEARCH_NOT_FOUND_SECONDARY')}}}}),_0x56192d=this['_createErrorView']();return _0x56192d['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('errorMessage','ck-hidden',_0x6451ea=>!_0x6451ea)]}}),_0x4275eb['on']('render',()=>{_0x4275eb['children']['add'](_0x56192d,0x1);}),_0x4275eb['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isSearchViewVisible','ck-hidden',_0x3be090=>!_0x3be090)]}}),_0x4275eb;}['_createSkeletonView'](){const _0x500ef4=new Xn(this['locale'],zn['aiHistory']);return _0x500ef4['bind']('isVisible')['to'](this,'isLoading'),_0x500ef4;}['_createErrorView'](){const _0x1ff729=new _0x1e8352(this['locale']),_0x4731c8=new Pt(this['locale']);_0x4731c8['set']({'withText':!0x1,'icon':_0x556600,'class':'ck-ai-notification_error__dismiss-button'}),_0x4731c8['bind']('isVisible')['to'](this,'hasItems',_0x425b1c=>!!_0x425b1c),_0x4731c8['on']('execute',()=>{this['errorMessage']='';});const _0x3ddce8=this['bindTemplate'];return _0x1ff729['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-notification','ck-ai-notification_error']},'children':[{'tag':'p','children':[{'text':_0x3ddce8['to']('errorMessage')}]},_0x4731c8]}),_0x1ff729;}['_createEmptyStateView'](){const _0x4686ab=new _0x1e8352(this['locale']);return _0x4686ab['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-history__empty',this['bindTemplate']['if']('isEmptyViewVisible','ck-hidden',_0x3a1864=>!_0x3a1864)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-chat-history__empty-message']},'children':[ls(this['locale'],'AI_CHAT_HISTORY_EMPTY_MESSAGE')]}]}),_0x4686ab;}['_createListItemViews'](_0x3fe131,_0xd1a741){const _0x3fe1b=[];for(const _0xa63026 of _0x3fe131){const _0x4f0653=new Wo(_0xd1a741,_0xa63026);_0x4f0653['delegate'](...$o)['to'](this),_0x3fe1b['push'](_0x4f0653);}return _0x3fe1b;}['updateHistoryItemsWithCategories'](_0x39aa38){const _0x1f227f=this['locale']||'en',_0x2b3bf8=[];for(const _0x5d27a4 of _0x39aa38){const _0x3e8706=this['_createListItemViews'](_0x5d27a4['items'],_0x1f227f);_0x2b3bf8['push'](new Fo(_0x1f227f,{'title':_0x5d27a4['title'],'items':_0x3e8706}));}this['sectionsView']['sections']=_0x2b3bf8,this['sectionsView']['items']['clear'](),this['sectionsView']['items']['addMany'](_0x2b3bf8),this['hasItems']=_0x39aa38['some'](_0x3fbe1c=>_0x3fbe1c['items']['length']>0x0),this['_refreshSearch']();}['removeHistoryItem'](_0x1e845b){for(const _0x124a08 of this['sectionsView']['sections']){const _0x5ab576=_0x124a08['getItem'](_0x1e845b);if(_0x5ab576){if(_0x124a08['removeItem'](_0x5ab576),0x0===_0x124a08['itemsViews']['length']){const _0x4fa710=this['sectionsView']['sections']['indexOf'](_0x124a08);-0x1!==_0x4fa710&&(this['sectionsView']['sections']['splice'](_0x4fa710,0x1),this['sectionsView']['items']['remove'](_0x124a08));}this['hasItems']=this['sectionsView']['sections']['length']>0x0,this['_refreshSearch']();break;}}}['updateItemTitle'](_0x238260,_0xc755e6){for(const _0x4b11ef of this['sectionsView']['sections']){const _0x5011da=_0x4b11ef['getItem'](_0x238260);if(_0x5011da){_0x5011da['updateTitle'](_0xc755e6);break;}}}['updateItemLoadingState'](_0x13d8ee,_0x5a4200,_0x2e3a15){for(const _0x3befa3 of this['sectionsView']['sections']){const _0x58936e=_0x3befa3['getItem'](_0x13d8ee);if(_0x58936e){_0x58936e['updateLoadingState'](_0x5a4200,_0x2e3a15);break;}}}['_refreshSearch'](){if(this['hasItems']){const _0x333652=this['searchView']['queryView']['fieldView']?.['element']?.['value']||'';this['searchView']['search'](_0x333652);}}};const $o=['showConversationHistory','removeConversation','editConversationTitle','setConversationPinned','selectConversation','startConversation'];var qo=class extends _0x2d0760{static get['requires'](){return[hs];}['_historyView'];static get['pluginName'](){return'AIChatHistoryUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x49d0d4){super(_0x49d0d4);const _0x18a0f7=this['context']['plugins']['get']('AITabs');this['_historyView']=new Yo(this['context']['locale'],_0x18a0f7['showResizeButton']),this['_historyView']['delegate']('resizeTabs')['to'](_0x18a0f7),this['_historyView']['delegate'](...$o)['to'](this),this['_historyView']['headerView']['bind']('isMaximized')['to'](_0x18a0f7['view'],'isMaximized',_0x29afc1=>_0x29afc1),_0x18a0f7['view']['addTab']({'id':'history','buttonLabel':ls(this['context']['locale'],'AI_CHAT_HISTORY_HEADING'),'buttonIcon':_0x811149,'order':0x0,'content':this['_historyView']});}['removeHistoryItem'](_0x186bb5){this['_historyView']['removeHistoryItem'](_0x186bb5);}['updateItems'](_0x304dea){this['_historyView']['updateHistoryItemsWithCategories'](_0x304dea);}['updateItemTitle'](_0x3041fe,_0x1c02e8){this['_historyView']['updateItemTitle'](_0x3041fe,_0x1c02e8);}['updateItemLoadingState'](_0x41fe76,_0x536ae6,_0x41e3e5){this['_historyView']['updateItemLoadingState'](_0x41fe76,_0x536ae6,_0x41e3e5);}['setLoadingSkeleton'](_0x269d9e){this['_historyView']['isLoading']=_0x269d9e;}['showError'](_0x19e93e){this['_historyView']['errorMessage']=_0x19e93e;}['hideError'](){this['_historyView']['errorMessage']='';}};const Qo=/* #__PURE__ -- @preserve */
|
|
35
|
+
_t();var Xo=class extends Qo{['id'];['createdAt'];constructor({id:_0x4855c9,title:_0x130710,createdAt:_0x5e5597,updatedAt:_0x5d57f6,pinned:_0x37b9f9}){super(),this['id']=_0x4855c9,this['createdAt']=new Date(_0x5e5597),this['set']('title',_0x130710),this['set']('updatedAt',_0x5d57f6?new Date(_0x5d57f6):null),this['set']('pinned',_0x37b9f9||!0x1);}['updateTitle'](_0x3c1815){this['set']('title',_0x3c1815),this['updatedAt']=new Date();}['updatePinned'](_0xdec3a6){this['set']('pinned',_0xdec3a6),this['updatedAt']=new Date();}};const zo=/* #__PURE__ -- @preserve */
|
|
36
|
+
lt();var jo=class extends zo{['items']=[];['connector'];['group'];constructor({connector:_0x23a0bc,group:_0x54d82a}){super(),this['connector']=_0x23a0bc,this['group']=_0x54d82a;}async['init'](){try{const _0x2c749a=await this['connector']['fetchConversations'](this['group'])['getConversations']();this['loadItems'](_0x2c749a);}catch(_0x54874f){this['fire']('error',{'error':_0x54874f,'operation':'init'});}}['addItem'](_0x49138d){this['items']['push'](_0x49138d);}async['removeItem'](_0xa2063b){const _0x3ed2ba=this['items']['findIndex'](_0x4f500d=>_0x4f500d['id']===_0xa2063b);if(-0x1===_0x3ed2ba)return!0x1;try{return await this['connector']['deleteConversation'](_0xa2063b)['execute'](),this['items']['splice'](_0x3ed2ba,0x1),this['fire']('itemRemoved',{'itemId':_0xa2063b}),!0x0;}catch(_0x4132b4){return this['fire']('error',{'error':_0x4132b4,'operation':'removeItem','itemId':_0xa2063b}),!0x1;}}['getItem'](_0x643125){return this['items']['find'](_0x10fce9=>_0x10fce9['id']===_0x643125);}async['updateItemTitle'](_0x5a8c15,_0x34a06c){const _0x2e766d=this['getItem'](_0x5a8c15);if(!_0x2e766d)return!0x1;try{return await this['connector']['updateConversation'](_0x5a8c15,{'title':_0x34a06c})['getResult'](),_0x2e766d['updateTitle'](_0x34a06c),this['fire']('itemUpdated',{'itemId':_0x5a8c15,'updates':{'title':_0x34a06c}}),!0x0;}catch(_0x1bd4ee){return this['fire']('error',{'error':_0x1bd4ee,'operation':'updateItemTitle','itemId':_0x5a8c15}),!0x1;}}async['updateItemPinned'](_0x88e54c,_0x2ef4a3){const _0x2bbaa8=this['getItem'](_0x88e54c);if(!_0x2bbaa8)return!0x1;try{return await this['connector']['updateConversation'](_0x88e54c,{'pinned':_0x2ef4a3})['getResult'](),_0x2bbaa8['updatePinned'](_0x2ef4a3),this['fire']('itemUpdated',{'itemId':_0x88e54c,'updates':{'pinned':_0x2ef4a3}}),!0x0;}catch(_0x404e56){return this['fire']('error',{'error':_0x404e56,'operation':'updateItemPinned','itemId':_0x88e54c}),!0x1;}}['loadItems'](_0x129038){try{this['items']=[],_0x129038['map'](_0x430bff=>{this['addItem'](new Xo(_0x430bff));}),this['fire']('itemsLoaded',{'items':[...this['items']]});}catch(_0x2c53d5){this['fire']('error',{'error':_0x2c53d5,'operation':'loadItems'});}}['getItems'](_0x2a9e14={}){const _0x451176=void 0x0!==_0x2a9e14['pinned']&&_0x2a9e14['pinned'],_0x58a1a0=_0x2a9e14['from']?new Date(_0x2a9e14['from']['getFullYear'](),_0x2a9e14['from']['getMonth'](),_0x2a9e14['from']['getDate']()):null,_0x48582c=_0x2a9e14['to']?new Date(_0x2a9e14['to']['getFullYear'](),_0x2a9e14['to']['getMonth'](),_0x2a9e14['to']['getDate']()):null;return this['items']['filter'](_0x325733=>{if(_0x325733['pinned']!==_0x451176)return!0x1;if(_0x48582c){const _0x2307bf=new Date(_0x325733['createdAt']['getFullYear'](),_0x325733['createdAt']['getMonth'](),_0x325733['createdAt']['getDate']());return _0x58a1a0?_0x58a1a0['getTime']()===_0x48582c['getTime']()?_0x2307bf['getTime']()===_0x58a1a0['getTime']():_0x2307bf<_0x48582c&&_0x2307bf>=_0x58a1a0:_0x2307bf<_0x48582c;}return!0x0;});}},Jo=class extends _0x2d0760{['_aiConnector'];['_reporter'];['_aiChatHistoryUi'];['_aiChatController'];static get['requires'](){return[cs,rn,kn,qo,hs];}static get['pluginName'](){return'AIChatHistoryController';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiConnector']=this['context']['plugins']['get'](cs),this['_aiChatHistoryUi']=this['context']['plugins']['get'](qo),this['_aiChatController']=this['context']['plugins']['get'](kn),this['_reporter']=this['context']['plugins']['get'](rn)['createReporter']('aichathistory');const _0x1fae6b=this['context']['plugins']['get'](hs);try{const _0x293d01=this['_aiChatController']['getGroupId']();this['history']=new jo({'connector':this['_aiConnector'],'group':_0x293d01}),this['listenTo'](this['_aiChatHistoryUi'],'removeConversation',(_0x235962,_0x3f935a)=>{this['_setItemLoading'](_0x3f935a['id'],'remove'),this['_handleRemove'](_0x3f935a['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'editConversationTitle',(_0x50ee3e,_0x19aba9)=>{this['_setItemLoading'](_0x19aba9['id'],'rename'),this['_handleEditTitle'](_0x19aba9['id'],_0x19aba9['title']);}),this['listenTo'](this['history'],'itemUpdated',(_0x3c2812,_0x58f7db)=>{void 0x0!==_0x58f7db['updates']['title']&&this['_aiChatHistoryUi']['updateItemTitle'](_0x58f7db['itemId'],_0x58f7db['updates']['title']),void 0x0!==_0x58f7db['updates']['pinned']&&this['_updateHistoryItemsUI'](),this['_clearItemLoading'](_0x58f7db['itemId']);}),this['listenTo'](this['history'],'itemRemoved',(_0x340a86,_0x17267b)=>{this['_aiChatController']['_handleRemovedConversation'](_0x17267b['itemId']),this['_aiChatHistoryUi']['removeHistoryItem'](_0x17267b['itemId']),this['_clearItemLoading'](_0x17267b['itemId']);}),this['listenTo'](this['history'],'itemsLoaded',()=>{this['_updateHistoryItemsUI']();}),this['listenTo'](this['history'],'error',(_0x59cdfc,_0x42dbab)=>{this['_handleHistoryErrorUI'](_0x42dbab['error'],_0x42dbab['operation'],_0x42dbab['itemId']);}),this['listenTo'](this['_aiChatHistoryUi'],'selectConversation',(_0x491556,_0x38087d)=>{this['_handleSelectConversation'](_0x38087d['id']);}),this['listenTo'](this['_aiChatHistoryUi'],'setConversationPinned',(_0x2ba522,_0x1eb019)=>{const _0x416b4f=_0x1eb019['pinned']?'pin':'unpin';this['_setItemLoading'](_0x1eb019['id'],_0x416b4f),this['_handleTogglePin'](_0x1eb019['id'],_0x1eb019['pinned']);}),this['listenTo'](this['_aiChatHistoryUi'],'startConversation',()=>{this['_aiChatController']['startConversation'](),_0x1fae6b['view']['activateTab']('chat');}),this['listenTo'](this['_aiChatController'],'change:activeConversation',()=>{this['_updateHistoryItemsUI']();}),_0x1fae6b['view']['on']('activateTab:history',()=>{this['_showConversationHistory']();});}catch(_0x3353cf){this['_handleHistoryErrorUI'](_0x3353cf,'init');}}async['_handleEditTitle'](_0x21991c,_0x31ab05){await this['history']['updateItemTitle'](_0x21991c,_0x31ab05);}async['_handleTogglePin'](_0x465e59,_0x54b9f7){await this['history']['updateItemPinned'](_0x465e59,_0x54b9f7);}async['_handleRemove'](_0x4b3d84){await this['history']['removeItem'](_0x4b3d84);}async['_handleSelectConversation'](_0x4ee3ec){await this['_aiChatController']['loadConversation'](_0x4ee3ec);}async['_showConversationHistory'](){this['_aiChatHistoryUi']['showError'](''),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x0),await this['history']['init'](),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_updateHistoryItemsUI'](){const _0x1bf32c=this['_aiChatController']['activeConversation']?.['id'],_0x58bbd3=this['_getCategorizedItems']()['map'](_0x1ad9e1=>({'title':_0x1ad9e1['title'],'items':_0x1ad9e1['items']['map'](_0x1a73cc=>({'id':_0x1a73cc['id'],'title':_0x1a73cc['title']||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION'),'createdAt':new Date(_0x1a73cc['createdAt'])['toLocaleDateString'](),'active':_0x1a73cc['id']===_0x1bf32c,'pinned':_0x1a73cc['pinned']}))}));this['_aiChatHistoryUi']['updateItems'](_0x58bbd3);}['_setItemLoading'](_0x2dda62,_0x3cb332){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x2dda62,_0x3cb332,!0x0);}['_clearItemLoading'](_0x3d30a1){this['_aiChatHistoryUi']['updateItemLoadingState'](_0x3d30a1,null,!0x1);}['_handleHistoryErrorUI'](_0x2e4f06,_0x43fa9e,_0x1cf3e4){const _0x214f40=this['_generateErrorMessage'](_0x43fa9e,_0x1cf3e4);this['_aiChatHistoryUi']['showError'](_0x214f40),this['_reporter']['reportError'](_0x2e4f06,{'context':{'operation':_0x43fa9e}}),_0x1cf3e4&&this['_clearItemLoading'](_0x1cf3e4),this['_aiChatHistoryUi']['setLoadingSkeleton'](!0x1);}['_generateErrorMessage'](_0x5a1afd,_0xcdc5d3){const _0x780ab2=_0xcdc5d3?this['history']['getItem'](_0xcdc5d3):null,_0x4c8a4b=_0x780ab2?.['title']||ls(this['context']['locale'],'AI_CHAT_UNTITLED_CONVERSATION');switch(_0x5a1afd){case'updateItemTitle':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_TITLE',_0x4c8a4b);case'updateItemPinned':{const _0x62ab29=ls(this['context']['locale'],_0x780ab2?.['pinned']?'AI_CHAT_HISTORY_UNPIN_ACTION':'AI_CHAT_HISTORY_PIN_ACTION');return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_UPDATE_PINNED',[_0x62ab29,_0x4c8a4b]);}case'removeItem':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_REMOVE_ITEM',_0x4c8a4b);case'init':case'loadItems':return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_LOAD_ITEMS');default:return ls(this['context']['locale'],'AI_CHAT_HISTORY_ERROR_GENERIC');}}['_getCategorizedItems'](){const _0x2fac0c=new Date(),_0x1e211a=new Date(_0x2fac0c['getFullYear'](),_0x2fac0c['getMonth'](),_0x2fac0c['getDate']()),_0x22f03f=new Date(_0x1e211a);_0x22f03f['setDate'](_0x22f03f['getDate']()-0x1);const _0x1e8d5d=new Date(_0x1e211a);_0x1e8d5d['setDate'](_0x1e8d5d['getDate']()-0xe);const _0x192871=this['history']['getItems']({'pinned':!0x0}),_0xa7eda5=this['history']['getItems']({'from':_0x1e211a,'to':_0x1e211a}),_0x5df32d=this['history']['getItems']({'from':_0x22f03f,'to':_0x22f03f}),_0x18324b=this['history']['getItems']({'from':_0x1e8d5d,'to':_0x22f03f}),_0x1f626c=this['history']['getItems']({'to':_0x1e8d5d}),_0x17a7e9=[];return _0x192871['length']>0x0&&_0x17a7e9['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_PINNED'),'items':_0x192871}),_0xa7eda5['length']>0x0&&_0x17a7e9['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_TODAY'),'items':_0xa7eda5}),_0x5df32d['length']>0x0&&_0x17a7e9['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_YESTERDAY'),'items':_0x5df32d}),_0x18324b['length']>0x0&&_0x17a7e9['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LAST_14_DAYS'),'items':_0x18324b}),_0x1f626c['length']>0x0&&_0x17a7e9['push']({'title':ls(this['context']['locale'],'AI_CHAT_HISTORY_CATEGORY_LATER'),'items':_0x1f626c}),_0x17a7e9;}},Zo=class extends _0x2d0760{static get['requires'](){return[Jo,qo];}static get['pluginName'](){return'AIChatHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ta=class extends _0x2d0760{static get['requires'](){return[kn,As,Bo,Zo,en];}static get['pluginName'](){return'AIChat';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xa2202){super(_0xa2202),this['context']['config']['define']('ai.chat.context',{'document':{'enabled':!0x0},'urls':{'enabled':!0x0},'files':{'enabled':!0x0},'sources':[],'alwaysAddSelection':!0x1,'paste':{'textThreshold':0x5dc}}),this['context']['config']['define']('ai.chat.initialConversation','new');}},ea=class extends Pt{['id'];constructor(_0x4090f7,_0xab5346){super(_0x4090f7);const {id:_0x58419d,type:_0x4cd1cd,icon:_0x4ed603}=_0xab5346;this['id']=_0x58419d,this['set']({'label':_0xab5346['label'],'withText':!0x0,'class':'ck-ai-chat-shortcut'}),this['extendTemplate']({'attributes':{'data-cke-ai-shortcut-id':_0xab5346['id']}}),_0x4ed603?this['icon']=_0x4ed603:'chat'===_0x4cd1cd?this['icon']=_0xc2f0bc:'review'===_0x4cd1cd?this['icon']=_0x1c0339:'translate'===_0x4cd1cd&&(this['icon']=_0x3ba0ab);}},ia=class extends _0x1e8352{['listView'];constructor(_0x4ea029,_0x33ced0){super(_0x4ea029),this['set']('isEnabled',!0x0);const _0x569413=_0x33ced0['map'](_0x50abf5=>{const _0x46c256=new Xt(this['locale']),_0x43c126=new ea(this['locale'],_0x50abf5);return _0x43c126['bind']('isEnabled')['to'](this),_0x46c256['children']['add'](_0x43c126),_0x43c126['delegate']('execute')['to'](this),_0x46c256;});this['listView']=new zt(this['locale']),this['listView']['items']['addMany'](_0x569413),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-shortcuts']},'children':[this['listView']]});}};const sa='chat-shortcuts';var na=class extends _0x2d0760{['_shortcuts'];['_shortcutsView'];['_aiChatUI'];['_listenedConversation'];static get['requires'](){return[Bo];}static get['pluginName'](){return'AIChatShortcuts';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_aiChatUI']=this['context']['plugins']['get'](Bo),this['_shortcuts']=this['context']['config']['get']('ai.chat.shortcuts')??[];const _0x1a3c16=this['context']['plugins']['get']('AIChatController');this['_shortcuts']['length']&&(this['_validateShortcuts'](),this['_aiChatUI']['on']('conversationCreated',()=>{const _0x269173=_0x1a3c16['activeConversation'];_0x269173['isFromHistory']||this['_injectShortcuts'](_0x269173);}),this['listenTo'](_0x1a3c16,'interactionStarted',()=>{this['_removeShortcuts']();}));}['_validateShortcuts'](){const _0x44046e=['chat','review','translate'];this['_shortcuts']['forEach'](_0x7bd72a=>{let _0x4029da=!0x0;if(_0x7bd72a['id']&&_0x7bd72a['label']&&_0x44046e['includes'](_0x7bd72a['type'])?'chat'===_0x7bd72a['type']&&(_0x4029da='string'==typeof _0x7bd72a['prompt']):_0x4029da=!0x1,!_0x4029da)throw new at('ai-chat-shortcuts-invalid-config',this['context'],{'shortcut':_0x7bd72a});});}['_injectShortcuts'](_0x3cbd31){this['_removeShortcuts'](),this['_shortcutsView']=new ia(this['context']['locale'],this['_shortcuts']),this['_shortcutsView']['render'](),this['_aiChatUI']['addFeedItemCustomElement'](this['_shortcutsView']['element'],sa),this['_shortcutsView']['on']('execute',_0x5ac3dd=>{const _0x446d73=_0x5ac3dd['source']['id'];this['_executeShortcut'](_0x446d73);}),this['_listenedConversation']=_0x3cbd31,this['listenTo'](_0x3cbd31,'uploadProgressChanged',(_0x515997,_0x1ce8c6)=>{this['_shortcutsView']['isEnabled']=!_0x1ce8c6['isUploadInProgress'];});}['_removeShortcuts'](){const _0x50bce4=this['context']['plugins']['get'](Bo);_0x50bce4['hasFeedItem'](sa)&&_0x50bce4['removeFeedItem'](sa),this['_listenedConversation']&&(this['stopListening'](this['_listenedConversation'],'uploadProgressChanged'),this['_listenedConversation']=void 0x0),this['_shortcutsView']?.['destroy']();}['_executeShortcut'](_0x2008b4){const _0xcb8533=this['_shortcuts']['find'](_0x55b42e=>_0x55b42e['id']===_0x2008b4),_0x41937f=_0xcb8533['type'];'chat'===_0x41937f?this['_runChatShortcut'](_0xcb8533):'review'===_0x41937f?_0xcb8533['commandId']?this['_runReviewShortcut'](_0xcb8533):this['_switchTab']('reviewMode'):'translate'===_0x41937f&&(_0xcb8533['language']?this['_runTranslateShortcut'](_0xcb8533):this['_switchTab']('translate'));}['_switchTab'](_0x448935){if(!this['context']['plugins']['has']('AITabs'))throw new at('ai-chat-shortcuts-ai-tabs-not-found',this['context'],{'tabName':_0x448935});this['context']['plugins']['get']('AITabs')['view']['activateTab'](_0x448935);}async['_runChatShortcut']({prompt:_0x5d726a,draftMode:_0x5e1453,useWebSearch:_0x3f3484=!0x1,useReasoning:_0x3ba380=!0x1,model:_0x713e5e}){const _0x5483d4=this['context']['plugins']['get']('AIChatController'),_0x2a1590=_0x5483d4['activeConversation'];let _0x4082d7;_0x4082d7=_0x713e5e?await _0x2a1590['chatModels']['getModel'](_0x713e5e):await _0x2a1590['chatModels']['getDefault'](),_0x4082d7&&await _0x2a1590['setModel'](_0x4082d7),_0x2a1590['setWebSearch'](_0x3f3484),_0x2a1590['setReasoning'](_0x3ba380),_0x5483d4['addCurrentDocumentToChatContext'](),_0x5e1453?(this['_aiChatUI']['setPromptInputValue'](_0x5d726a),this['_aiChatUI']['focusPromptInput'](!0x0)):_0x5483d4['sendMessage']({'message':_0x5d726a});}['_runReviewShortcut']({commandId:_0x48d8df,model:_0x403194,prompt:_0x429b42,params:_0x787fb}){if(!this['context']['plugins']['has']('AIReviewModeUI'))throw new at('ai-chat-shortcuts-review-mode-not-found',this['context']);this['_switchTab']('reviewMode');const _0x4e4862={'id':_0x48d8df,'isCustom':'custom'===_0x48d8df};_0x403194&&_0x429b42&&(_0x4e4862['args']={'model':_0x403194,'prompt':_0x429b42}),_0x787fb&&(_0x4e4862['params']=_0x787fb),this['context']['plugins']['get']('AIReviewModeUI')['fire']('runReviewCheck',_0x4e4862);}['_runTranslateShortcut']({language:_0x26610a}){if(!this['context']['plugins']['has']('AITranslateUI'))throw new at('ai-chat-shortcuts-translate-not-found',this['context']);this['_switchTab']('translate'),this['context']['plugins']['get']('AITranslateUI')['fire']('runReviewCheck',{'id':_0x26610a,'args':{'language':_0x26610a}});}},ra=class extends _0xfa3ed0{constructor(_0x451647){super(_0x451647);const _0x573b2d=_0x451647['plugins']['get']('AITabs')['view'];this['bind']('value')['to'](_0x573b2d,'isVisible'),this['isEnabled']=!0x0;}['execute'](){const _0x5df21e=this['editor']['plugins']['get']('AITabs')['view'];_0x5df21e['isVisible']=!_0x5df21e['isVisible'];}},oa=class extends _0x3f2605{static get['requires'](){return[hs];}static get['pluginName'](){return'AIToggleButtonUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x204776=this['editor'];_0x204776['commands']['add']('toggleAi',new ra(_0x204776)),_0x204776['ui']['componentFactory']['add']('toggleAi',()=>{const _0x16b1c4=this['_createAIUIButton'](Pt);return _0x16b1c4['set']({'tooltip':!0x0,'class':'ck-ai-toggle-button'}),_0x16b1c4;}),_0x204776['ui']['componentFactory']['add']('menuBar:toggleAi',()=>{const _0x1ce052=this['_createAIUIButton'](jt);return _0x1ce052['set']({'role':'menuitemcheckbox'}),_0x1ce052;});}['_createAIUIButton'](_0x3a5768){const _0x531f2c=this['editor'],_0x466e15=_0x531f2c['commands']['get']('toggleAi'),_0x3a27c1=new _0x3a5768(_0x531f2c['locale']);return _0x3a27c1['set']({'label':ls(_0x531f2c['locale'],'AI_TOGGLE_BUTTON_LABEL'),'icon':_0x5d2792,'isToggleable':!0x0}),_0x3a27c1['bind']('isEnabled')['to'](_0x466e15),_0x3a27c1['bind']('isOn')['to'](_0x466e15,'value',_0x45fcfe=>!!_0x45fcfe),this['listenTo'](_0x3a27c1,'execute',()=>{_0x466e15['execute']();}),_0x3a27c1;}};const aa=['applySuggestion','insertSuggestion','showNext','showPrevious'];var ha=class extends _0x1e8352{['_errorView'];constructor(_0x2c7b06){super(_0x2c7b06),this['set']('_errorMessage',''),this['set']('_isErrorVisible',!0x1);}['showBlockingError'](_0x45617f){this['showError'](_0x45617f);}['showError'](_0x15f8d3){this['_errorView']||(this['_errorView']=this['_createErrorView']()),this['_errorMessage']=_0x15f8d3,this['_isErrorVisible']=!0x0;}['hideError'](){this['_isErrorVisible']=!0x1;}['_createErrorView'](){const _0x24a03e=new _0x1e8352(this['locale']),_0x2cdc3f=new _0x1e8352(this['locale']);return _0x2cdc3f['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__error-text']},'children':[{'text':this['bindTemplate']['to']('_errorMessage')}]}),_0x24a03e['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__error','ck-ai-balloon-error',this['bindTemplate']['if']('_isErrorVisible','ck-hidden',_0x2b035c=>!_0x2b035c)]},'children':[_0x2cdc3f]}),_0x24a03e;}};const ca=0xa;var la=class extends _0x2d0760{static get['requires'](){return[As];}static get['pluginName'](){return'AIBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['isOpen']=!0x1;['_currentConfig'];['_editor'];['_isUpdatingMarkers']=!0x1;['open'](_0xa405dc){const {id:_0x255aee}=this['_currentConfig']??{};this['_currentConfig']=_0xa405dc,this['_editor']=_0xa405dc['targetEditor'];const {id:_0x1a2e6e}=this['_currentConfig'];this['isOpen']&&_0x255aee===_0x1a2e6e?this['_updateDialog']():this['_showDialog']();}['close'](){const _0x7baeec=this['_editor'];if(!_0x7baeec)return;const _0x45bd54=_0x7baeec['plugins']['get']('Dialog');_0x45bd54['isOpen']&&this['_currentConfig']&&_0x45bd54['id']===this['_currentConfig']['id']&&_0x45bd54['hide']();}['_updateDialog'](){const _0x15575e=this['_editor']['plugins']['get']('Dialog'),{icon:_0x253906,title:_0x1ac9f9}=this['_currentConfig'];_0x15575e['view']?.['headerView']&&(_0x15575e['view']['headerView']['label']=_0x1ac9f9,_0x15575e['view']['headerView']['iconView']&&_0x253906&&(_0x15575e['view']['headerView']['iconView']['content']=_0x253906)),this['_isUpdatingMarkers']=!0x0,this['_showFakeVisualSelection'](),this['_isUpdatingMarkers']=!0x1,_0x15575e['view']?.['updatePosition']();}['_showFakeVisualSelection'](){this['context']['plugins']['get'](As)['showFakeVisualSelection']({'editor':this['_editor'],'ranges':this['_currentConfig']['ranges'],'id':'balloon','priority':0x64}),window['getSelection']()?.['removeAllRanges']();}['_hideFakeVisualSelection'](){this['context']['plugins']['get'](As)['hideFakeVisualSelection']('balloon');}['_showDialog'](){const _0xa7fc90=this['_editor']['plugins']['get']('Dialog'),{id:_0x5cb1e1,title:_0x195b59,icon:_0x2176eb,class:_0x172b5b,mainView:_0x328297}=this['_currentConfig'];_0x328297['delegate'](...aa)['to'](this),_0xa7fc90['show']({'title':_0x195b59,'icon':_0x2176eb,'hasCloseButton':!0x0,'id':_0x5cb1e1,'position':this['_calculateDialogPosition']['bind'](this),'getRootName':this['_getCurrentDomRootName']['bind'](this),'className':'ck-ai-balloon\x20'+(_0x172b5b||''),'content':_0x328297,'onShow':_0x45e2d7=>{this['_showFakeVisualSelection'](),this['_setupFakeVisualSelectionMarkerRemovalListener'](),_0x45e2d7['view']?.['updatePosition']();const _0x258a4e=this['_getSelectionElements']();_0x258a4e&&_0x258a4e[0x0]&&St({'target':_0x258a4e[0x0],'ancestorOffset':0x14,'alignToTop':!0x0,'viewportOffset':{'top':0x14,'bottom':0x14,'left':0x0,'right':0x0}}),this['isOpen']=!0x0,_0x45e2d7['once']('hide',()=>{this['fire']('beforeDialogClosed',{'id':_0x5cb1e1});},{'priority':'high'});},'onHide':()=>{this['_hideFakeVisualSelection'](),this['_cleanupFakeVisualSelectionMarkerRemovalListener'](),this['fire']('dialogClosed',{'id':_0x5cb1e1}),this['isOpen']=!0x1;}});}['_calculateDialogPosition'](_0x1dd2be,_0x4014a1,_0x34c426){if(!_0x34c426)return null;const _0x3b14e2=this['_getSelectionElements']();if(!_0x3b14e2||0x0===_0x3b14e2['length'])return{'left':Math['round'](_0x34c426['left']+_0x34c426['width']/0x2-_0x1dd2be['width']/0x2),'top':Math['round'](_0x34c426['top']+_0x34c426['height']/0x2-_0x1dd2be['height']/0x2)};const _0x2b5d46=Math['round'](_0x34c426['left']+_0x34c426['width']/0x2-_0x1dd2be['width']/0x2),_0x1921c7=_0x3b14e2['map'](_0x10c4fc=>new gt(_0x10c4fc)),_0x49fa61=_0x1dd2be['height'];return{'left':_0x2b5d46,'top':this['_calculateOptimalTopPosition'](_0x1921c7,_0x49fa61,_0x34c426)};}['_calculateOptimalTopPosition'](_0x173c5b,_0x8ac65e,_0x370929){const _0x14aa2f=new gt(Et['window']),_0x2d0263=_0x173c5b['map'](_0x23d7b2=>_0x23d7b2['getVisible']())['filter'](_0x354519=>_0x354519),_0x4dfd36=gt['getBoundingRect'](_0x2d0263);if(!_0x4dfd36)return Math['round'](_0x370929['top']+_0x370929['height']/0x2);const _0x6c97b7=_0x14aa2f['getIntersection'](_0x4dfd36);if(!_0x6c97b7)return Math['round'](_0x370929['top']+_0x370929['height']/0x2);const _0x59f4c0=_0x370929['getVisible'](),_0x40f5ba=_0x59f4c0&&_0x4dfd36['height']>_0x59f4c0['height'],_0x2caa9f=_0x6c97b7['top'],_0x41ae53=_0x6c97b7['bottom'];if(_0x40f5ba){const _0x4974fe=(_0x59f4c0||_0x14aa2f)['height']/0x2-_0x8ac65e/0x2,_0x350ff8=_0x2caa9f-ca-_0x370929['top'],_0x286b33=_0x370929['bottom']-_0x41ae53-ca;return _0x350ff8>=_0x8ac65e?Math['max'](ca,_0x2caa9f-_0x8ac65e-ca):_0x286b33>=_0x8ac65e?_0x41ae53+ca:Math['max'](ca,_0x4974fe);}const _0x3514f1=_0x2caa9f-_0x8ac65e,_0x164ce7=_0x370929['bottom']-_0x41ae53-ca,_0x2d5c6=_0x2caa9f-ca-_0x370929['top'];let _0x3effdf;return _0x3effdf=_0x164ce7>=_0x8ac65e?_0x41ae53+ca:_0x2d5c6>=_0x8ac65e?_0x3514f1-ca:_0x2caa9f+_0x4dfd36['height']/0x2-_0x8ac65e/0x2,_0x3effdf;}['_setupFakeVisualSelectionMarkerRemovalListener'](){const _0x3826ca=this['_editor'];this['listenTo'](_0x3826ca['model']['document'],'change',()=>{if(!this['_isUpdatingMarkers']){for(const {name:_0x39d5d1,data:{newRange:_0x47e07e}}of _0x3826ca['model']['document']['differ']['getChangedMarkers']())if(_0x39d5d1['startsWith']('ai-selection:')&&(_0x47e07e&&(_0x47e07e['start']['isEqual'](_0x47e07e['end'])||'$graveyard'==_0x47e07e['root']['rootName'])||null==_0x47e07e)){const _0x41b96d=ls(this['context']['locale'],'AI_BALLOON_SELECTION_REMOVED_ERROR');this['_currentConfig']['mainView']['showBlockingError'](_0x41b96d),this['fire']('selectionRemoved');}}});}['_cleanupFakeVisualSelectionMarkerRemovalListener'](){const _0x504e4b=this['_editor'];this['_currentConfig']['mainView']['hideError'](),this['stopListening'](_0x504e4b['model']['document']);}['_getSelectionElements'](){const _0x4e6fd2=this['_editor'];return _0x33b883(_0x4e6fd2['editing'],[..._0x4e6fd2['model']['markers']['getMarkersGroup']('ai-selection'),..._0x4e6fd2['model']['markers']['getMarkersGroup']('ai-balloon-selection')]);}['_getCurrentDomRootName'](){const _0x4d89ad=this['_currentConfig']?.['ranges']?.[0x0]?.['root'];return _0x4d89ad&&_0x4d89ad['rootName']?_0x4d89ad['rootName']:null;}},ua=class extends _0x177211{['copyButton'];['likeButton'];['dislikeButton'];['showChangesButton'];['_config'];constructor(_0x3c7d86,_0x5a7336={}){super(_0x3c7d86),this['set']('isEnabled',!0x0),this['set']('isShowChangesOn',!0x1),this['_config']={'showCopy':!0x1,'showLike':!0x1,'showDislike':!0x1,..._0x5a7336};const _0x2874ee=!(this['_config']['showCopy']||this['_config']['showChanges']||this['_config']['showLike']||this['_config']['showDislike']||this['_config']['customView']?.['length']);this['class']=_0x2874ee?'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'](_0x59c153){this['showChangesButton']['isEnabled']=_0x59c153;}['_setupRatingButtons'](){this['likeButton']=new Pt(this['locale']),this['likeButton']['set']({'icon':rt,'label':ls(this['locale'],'AI_MINI_TOOLBAR_LIKE'),'class':cn,'tooltip':!0x0}),this['likeButton']['bind']('isEnabled')['to'](this),this['likeButton']['on']('execute',()=>{this['fire']('like');}),this['dislikeButton']=new Pt(this['locale']),this['dislikeButton']['set']({'icon':nt,'label':ls(this['locale'],'AI_MINI_TOOLBAR_DISLIKE'),'class':cn,'tooltip':!0x0}),this['dislikeButton']['bind']('isEnabled')['to'](this),this['dislikeButton']['on']('execute',()=>{this['fire']('dislike');});}['_setupCopyButton'](){this['copyButton']=new Pt(this['locale']),this['copyButton']['set']({'icon':_0x152bd7,'label':ls(this['locale'],'AI_MINI_TOOLBAR_COPY'),'class':'ck-ai-mini-toolbar-copy-button\x20'+cn,'tooltip':!0x0}),this['copyButton']['bind']('isEnabled')['to'](this);const _0x7d8d06=new Wt();_0x7d8d06['set']({'content':_0x7ff926}),_0x7d8d06['extendTemplate']({'attributes':{'class':['ck-ai-mini-toolbar-copy-button__check-mark']}}),this['copyButton']['on']('execute',()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20ck-ai-mini-toolbar-copy-button_copied\x20'+cn,setTimeout(()=>{this['copyButton']['class']='ck-ai-mini-toolbar-copy-button\x20'+cn;},0x7d0);}),this['copyButton']['children']['add'](_0x7d8d06);}['_setupShowChangesButton'](){this['showChangesButton']=new Pt(this['locale']),this['showChangesButton']['set']({'icon':_0x3b4365,'label':ls(this['locale'],'AI_SUGGESTION_BUTTON_SHOW_CHANGES'),'withText':'full'==this['_config']['showChanges'],'tooltip':'full'!=this['_config']['showChanges'],'class':cn}),this['showChangesButton']['bind']('isOn')['to'](this,'isShowChangesOn'),this['showChangesButton']['bind']('isEnabled')['to'](this),this['showChangesButton']['bind']('icon')['to'](this,'isShowChangesOn',_0x54615a=>_0x54615a?tt:_0x3b4365),this['showChangesButton']['on']('execute',()=>{this['fire']('toggleShowChanges');});}},da=class extends ha{['children'];['nextButtonView'];['previousButtonView'];['focusCycler'];['_focusables'];['_focusTracker'];['_keystrokes'];['_config'];['_streamableContentView'];['_toolbarContainerView'];['_partToolbarView'];['_stateView'];['_miniToolbarView'];constructor(_0x5b84c0,_0x447521){super(_0x5b84c0);const _0x34c1a4=this['bindTemplate'];this['set']('showDiff',!0x1),this['set']('_state','pending'),this['_focusTracker']=new ut(),this['_keystrokes']=new dt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_config']=_0x447521,this['nextButtonView']=this['_createNextButtonView'](),this['previousButtonView']=this['_createPreviousButtonView'](),this['_streamableContentView']=new qn(_0x5b84c0),this['_partToolbarView']=new Wn(_0x5b84c0,_0x447521['availableActions']),this['_partToolbarView']['delegate']('applySuggestion','insertSuggestion','rejectSuggestion')['to'](this),this['_togglePartToolbarButtonsVisibility'](_0x447521),this['_stateView']=new Fn(_0x5b84c0),this['_stateView']['isVisible']=!0x1,this['_miniToolbarView']=new ua(_0x5b84c0,{'showChanges':'full'}),this['_miniToolbarView']['bind']('isShowChangesOn')['to'](this,'showDiff'),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['fire']('toggleSuggestionDisplayMode');}),this['_toolbarContainerView']=new _a(_0x5b84c0,[this['_partToolbarView'],this['_stateView'],this['_miniToolbarView']]),this['children']=this['createCollection']([this['_streamableContentView'],this['_toolbarContainerView']]),this['on']('change:_state',(_0x200a30,_0x178f26,_0x197aac,_0x4f066c)=>{let _0xe0a778,_0x2c4541;'pending'===_0x4f066c?(_0xe0a778=this['_partToolbarView'],_0x2c4541=this['_stateView']):(_0xe0a778=this['_stateView'],_0x2c4541=this['_partToolbarView']),this['_stateView']['setState'](_0x197aac),_0xe0a778['isVisible']=!0x1,_0x2c4541['isVisible']=!0x0;}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-chat-balloon-main',_0x34c1a4['to']('_state',_0x241634=>'ck-ai-chat-balloon-main_state_'+_0x241634)]},'children':this['children']}),this['on']('change:isTrackChangesOn',()=>{this['_togglePartToolbarButtonsVisibility'](_0x447521);});}['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'](_0x185957){_0x185957?.['keepErrors']||this['hideError'](),await this['_streamableContentView']['update'](_0x185957);}['clearContent'](){this['_streamableContentView']['clear']();}['setState'](_0x36dd49){this['_state']=_0x36dd49;}['showError'](_0x263a9a){super['showError'](_0x263a9a),this['children']['has'](this['_errorView'])||this['children']['add'](this['_errorView'],0x0);}['hideError'](){this['_isErrorVisible']&&(super['hideError'](),this['togglePartToolbarEnabled'](!0x0));}['showBlockingError'](_0x59bee9){super['showBlockingError'](_0x59bee9),this['togglePartToolbarEnabled'](!0x1);}['toggleRotatorButtonsVisibility'](_0x51ea74){this['nextButtonView']['isVisible']=this['previousButtonView']['isVisible']=_0x51ea74;}['togglePartToolbarEnabled'](_0x56a57b){this['_partToolbarView']['isEnabled']=_0x56a57b;}['_togglePartToolbarButtonsVisibility']({showApplyButton:_0x454638,showSuggestButton:_0x2841b2}){_0x454638=_0x454638&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0x2841b2=_0x2841b2&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_partToolbarView']['setButtonsVisibility']({'showApplyButton':_0x454638,'showSuggestButton':_0x2841b2});}['_createNextButtonView'](){const _0x5a9608=new Pt(this['locale']);return _0x5a9608['set']({'icon':_0x54ab4a,'label':ls(this['locale'],'AI_BALLOON_NEXT_LABEL'),'isVisible':!0x0}),_0x5a9608['on']('execute',()=>{this['fire']('showNext');}),_0x5a9608;}['_createPreviousButtonView'](){const _0x9b62bb=new Pt(this['locale']);return _0x9b62bb['set']({'icon':_0x1ce84,'label':ls(this['locale'],'AI_BALLOON_PREVIOUS_LABEL'),'isVisible':!0x0}),_0x9b62bb['on']('execute',()=>{this['fire']('showPrevious');}),_0x9b62bb;}},_a=class extends _0x1e8352{constructor(_0x94f569,_0x318ee6){super(_0x94f569),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-chat-balloon__toolbar-container']},'children':_0x318ee6});}},ga=class extends _0x3f2605{static get['requires'](){return[Ht,la];}static get['pluginName'](){return'AIChatBalloon';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_chatBalloonView'];constructor(_0x431ed5){super(_0x431ed5),this['set']('showDiff',!0x1);}['open'](_0x1f47c8){const _0x3e591e=this['editor'];this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),_0x3e591e['plugins']['get']('AIBalloon')['open']({..._0x1f47c8,'id':'aiChatBalloon','class':'ck-ai-chat-balloon','mainView':this['_chatBalloonView']}),this['_toggleRotatorButtonsInDialogHeader'](_0x1f47c8['showRotator']),this['_chatBalloonView']['togglePartToolbarEnabled'](!_0x1f47c8['areActionsDisabled']),this['_restoreDefaultViewFocus']();}['close'](){this['editor']['plugins']['get']('AIBalloon')['close']();}['updateContent'](_0x4614c2){return this['_chatBalloonView']||(this['_chatBalloonView']=this['_createChatBalloonView']()),this['_chatBalloonView']['updateContent'](_0x4614c2);}['clearContent'](){this['_chatBalloonView']&&this['_chatBalloonView']['clearContent']();}['setState'](_0x16f4a0){this['_chatBalloonView']&&this['_chatBalloonView']['setState'](_0x16f4a0);}['_createChatBalloonView'](){const _0x3a3e5c=this['editor'],_0x4bcc43=_0x3a3e5c['plugins']['get']('AIBalloon'),_0x20bd35=_0x3a3e5c['commands']['get']('trackChanges');let _0x5ec18c=_0x3a3e5c['config']['get']('ai.availableReplyActions')||[...er];_0x3a3e5c['plugins']['has']('TrackChanges')||(_0x5ec18c=_0x5ec18c['filter'](_0x4017f7=>'insertSuggestion'!=_0x4017f7));const _0x161b1c=new da(_0x3a3e5c['locale'],{'availableActions':_0x5ec18c,'showApplyButton':!0x0,'showSuggestButton':!!_0x20bd35});return _0x161b1c['bind']('showDiff')['to'](this),_0x161b1c['delegate'](...Nn)['to'](this),_0x161b1c['delegate']('showPrevious','showNext')['to'](this),_0x4bcc43['delegate']('dialogClosed')['to'](this),_0x161b1c['on']('applySuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x161b1c['on']('insertSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x161b1c['on']('rejectSuggestion',this['_restoreDefaultViewFocus']['bind'](this)),_0x20bd35&&_0x161b1c['bind']('isTrackChangesOn')['to'](_0x20bd35,'value'),_0x161b1c['render'](),_0x161b1c;}['_toggleRotatorButtonsInDialogHeader'](_0x2cc8a2){const _0xf364c7=this['editor'],_0x1b2e09=_0xf364c7['plugins']['get']('Dialog')['view']['headerView']['children'];this['_chatBalloonView']['toggleRotatorButtonsVisibility'](_0x2cc8a2),_0x1b2e09['has'](this['_chatBalloonView']['previousButtonView'])||(_0x1b2e09['addMany']([this['_chatBalloonView']['previousButtonView'],this['_chatBalloonView']['nextButtonView']],0x0),_0xf364c7['plugins']['get']('AIBalloon')['once']('beforeDialogClosed',()=>{_0x1b2e09['remove'](this['_chatBalloonView']['previousButtonView']),_0x1b2e09['remove'](this['_chatBalloonView']['nextButtonView']);}));}['_restoreDefaultViewFocus'](){this['_chatBalloonView']['focus']();}},Aa=class extends _0x3f2605{static get['requires'](){return[oa,ga,_0x4e8e72];}static get['pluginName'](){return'AIEditorIntegration';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};function Ia(_0x2c0d0e){const {editor:_0x1ce236,action:_0x68ca15,withText:_0x436756=!0x1,withIcon:_0x4fd9a9=!0x0,isInDropdown:_0x563092=!0x0,shouldPreventFocus:_0x43b5bf=!0x1,actionButtons:_0x4ebaa1}=_0x2c0d0e;return()=>{const _0x28526f=_0x1ce236['locale'],_0x4a7af3=new Pt(_0x28526f),_0x59fa21=_0x4a7af3['bindTemplate'];_0x563092&&_0x4a7af3['extendTemplate']({'on':{'mouseenter':_0x59fa21['to'](()=>{_0x43b5bf&&_0x43b5bf()||_0x4a7af3['focus']();})}}),_0x4ebaa1['push']({'buttonView':_0x4a7af3,'action':_0x68ca15});const _0x5752f6=_0x68ca15['icon']??_0x68ca15['parent']?.['icon'];return _0x4a7af3['set']({'label':_0x68ca15['label'],'withText':_0x436756,'role':'menuitem','icon':_0x4fd9a9?_0x5752f6??_0x4d468f:void 0x0,'tooltip':!_0x436756,'class':'ck-ai-quick-actions-button','isEnabled':_0x68ca15['isEnabled']}),_0x4a7af3['on']('execute',()=>{_0x1ce236['editing']['view']['focus'](),_0x1ce236['commands']['execute']('aiQuickAction',_0x68ca15);}),_0x4a7af3;};}var pa=class extends qt{['arrowView'];constructor(_0x157006,_0x5863ea){super(_0x157006,_0x5863ea);const _0x5f41ed=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',_0x289c89=>String(_0x289c89)),'data-cke-tooltip-disabled':_0x5f41ed['to']('isOn')},'on':{'mouseenter':_0x5f41ed['to']('mouseenter')}});}['render'](){super['render'](),this['children']['add'](this['arrowView']);}['_createArrowView'](){const _0x548007=new Wt();return _0x548007['content']=_0x10b8ad,_0x548007['extendTemplate']({'attributes':{'class':'ck-dropdown-menu-list__nested-menu__button__arrow'}}),_0x548007;}},ma=class extends zt{['_allListItems'];['_allSearchableItems'];constructor(_0x2a94ee,_0x2e60da,_0x48c38){super(_0x2a94ee),this['_allListItems']=_0x2e60da,this['_allSearchableItems']=_0x48c38;}['filter'](_0x5d29d8){if(!_0x5d29d8)return this['items']['clear'](),this['items']['addMany'](this['_allListItems']),this['_clearHighlight'](),{'resultsCount':this['_allListItems']['length'],'totalItemsCount':this['_allListItems']['length']};const _0x55e3a1=_0x5d29d8['source']['toLowerCase']()['trim'](),_0x37a04=this['_allSearchableItems']['filter'](_0x1f0ae5=>(_0x1f0ae5['groupLabel']?_0x1f0ae5['label']+'\x20('+_0x1f0ae5['groupLabel']+')':_0x1f0ae5['label'])['toLowerCase']()['includes'](_0x55e3a1));return this['items']['clear'](),this['items']['addMany'](_0x37a04['sort']((_0x2e98a1,_0x10e500)=>{const _0x5eda7f=_0x2e98a1['groupLabel'],_0x34c498=_0x10e500['groupLabel'];return _0x5eda7f||_0x34c498?_0x5eda7f?0x1:-0x1:0x0;})['map'](_0x47c8e6=>_0x47c8e6['item'])),this['_highlightQuery'](_0x55e3a1,_0x37a04),{'resultsCount':_0x37a04['length'],'totalItemsCount':this['_allSearchableItems']['length']};}['_highlightQuery'](_0x157990,_0x93f6a1){if(!_0x157990)return;const _0x441f38=new RegExp(_0xc078db(_0x157990),'gi');_0x93f6a1['forEach'](_0x308701=>{_0x308701['highlightViews']&&_0x308701['highlightViews']['forEach'](_0xa833fc=>{'function'==typeof _0xa833fc['highlightText']&&_0xa833fc['highlightText'](_0x441f38);});});}['_clearHighlight'](){this['_allSearchableItems']['forEach'](_0x3b034f=>{_0x3b034f['highlightViews']&&_0x3b034f['highlightViews']['forEach'](_0x20d88b=>{'function'==typeof _0x20d88b['highlightText']&&_0x20d88b['highlightText'](null);});});}};const Ea='menu',Ta='menuitem';var wa=class extends _0x1e8352{['_bodyCollection'];['optionsListView'];['_searchTextView']=null;['_allSearchableItems']=[];['children'];['focusTracker'];['keystrokes'];['_focusables'];['focusCycler'];['_openNestedPanels']=new Set();['_hasSearch'];['_actionButtons'];constructor(_0x4747b9,_0x15cf10,_0xf3a708,_0x5e9785,_0x1ec8a3=!0x1,_0x45bb6a=[]){const _0x5950ae=_0x4747b9['locale'];super(_0x5950ae),this['_bodyCollection']=_0x5e9785,this['_hasSearch']=_0x1ec8a3,this['_actionButtons']=_0x45bb6a;const _0x256e2d=this['_createListItems'](_0x4747b9,_0x15cf10,_0xf3a708);this['optionsListView']=new ma(_0x5950ae,_0x256e2d,this['_allSearchableItems']),this['optionsListView']['role']=Ea,this['optionsListView']['items']['addMany'](_0x256e2d),this['focusTracker']=new ut(),this['keystrokes']=new dt(),_0x1ec8a3&&(this['_searchTextView']=this['_createSearchTextView']()),this['_focusables']=_0x256e2d,this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes']}),_0x1ec8a3&&this['_searchTextView']&&this['focusCycler']['chain'](this['_searchTextView']['focusCycler']);const _0x3a0570=_0x1ec8a3&&this['_searchTextView']?[this['_searchTextView']]:[this['optionsListView']];this['children']=new _0x14141a(_0x3a0570),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions','ck-rounded-corners'],'dir':_0x5950ae['uiLanguageDirection']},'children':this['children']});}['_createSearchTextView'](){return new _0x1cff6c(this['locale'],{'filteredView':this['optionsListView'],'queryView':{'label':ls(this['locale'],'AI_QUICK_ACTIONS_SEARCH')},'class':'ck-ai-quick-actions-search','infoView':{'text':{'notFound':{'primary':ls(this['locale'],'AI_QUICK_ACTIONS_SEARCH_NOT_FOUND')}}}});}['_isSearchFocused'](){if(!this['_hasSearch']||!this['_searchTextView']||!this['_searchTextView']['queryView']['fieldView']['element'])return!0x1;const _0x4e75a0=this['_searchTextView']['queryView']['fieldView']['element']['ownerDocument']?.['activeElement'];return this['_searchTextView']['queryView']['fieldView']['element']['contains'](_0x4e75a0);}['_createListItems'](_0x232678,_0x4b8857,_0x4518ec){const _0x197162=new _0x14141a();return _0x4b8857['forEach'](_0x1643f3=>{if('actions'in _0x1643f3){const {listItem:_0x5710ef}=this['_createActionGroupButton'](_0x232678,_0x1643f3,_0x4518ec);_0x197162['add'](_0x5710ef),_0x1643f3['actions']['forEach'](_0x4e1992=>{const {listItem:_0x596a44,highlightViews:_0x4c4acc}=this['_createSearchResultActionButton'](_0x232678,_0x4e1992,_0x1643f3['label'],_0x1643f3['icon']);this['_allSearchableItems']['push']({'item':_0x596a44,'label':_0x4e1992['label'],'groupLabel':_0x1643f3['label'],'highlightViews':_0x4c4acc});});}else{const {listItem:_0x30544e}=this['_createActionButton'](_0x232678,_0x1643f3);_0x197162['add'](_0x30544e);const _0x54611b=_0x30544e['children']['first'];if(_0x54611b){const {listItem:_0x2bff33,highlightViews:_0x50fa1a}=this['_createSearchResultActionButton'](_0x232678,_0x1643f3);this['_allSearchableItems']['push']({'item':_0x2bff33,'label':_0x54611b['label']||'','highlightViews':_0x50fa1a});}}}),_0x197162;}['_createActionButton'](_0x1638a6,_0x371ac9,_0x3b8ebf,_0x31e172){const _0x3b493c=new Xt(this['locale']);if(_0x3b8ebf&&_0x31e172){const _0x43cc91=new Pt(this['locale']),_0x28b3a7=_0x43cc91['bindTemplate'],_0x35a43c=new Kt();_0x35a43c['text']=_0x371ac9['label'];const _0x3edf92=new Kt();_0x3edf92['text']=_0x3b8ebf;const _0x2390dc=new Wt();_0x2390dc['content']=_0x31e172,_0x2390dc['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x5adbd8=new _0x1e8352(this['locale']);_0x5adbd8['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__open-paren'},'children':[{'text':'\x20('}]});const _0x4036d0=new _0x1e8352(this['locale']);return _0x4036d0['setTemplate']({'tag':'span','attributes':{'class':'ck-ai-quick-actions-button_with-group__close-paren'},'children':[{'text':')'}]}),_0x43cc91['set']({'label':_0x371ac9['label']+'\x20('+_0x3b8ebf+')','withText':!0x0,'role':'menuitem','class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-button_with-group','tooltip':!0x1,'isEnabled':_0x371ac9['isEnabled']}),_0x43cc91['setTemplate']({'tag':'button','attributes':{'class':['ck','ck-button','ck-button_with-text','ck-ai-quick-actions-button','ck-ai-quick-actions-button_with-group',_0x28b3a7['if']('isEnabled','ck-disabled',_0x4d47d3=>!_0x4d47d3)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x35a43c,_0x5adbd8,_0x2390dc,_0x3edf92,_0x4036d0],'on':{'mouseenter':_0x28b3a7['to'](()=>{this['_isSearchFocused']()||_0x43cc91['focus']();}),'click':_0x28b3a7['to'](()=>{_0x43cc91['fire']('execute');})}}),_0x43cc91['on']('execute',()=>{_0x43cc91['isEnabled']&&(_0x1638a6['editing']['view']['focus'](),_0x1638a6['commands']['execute']('aiQuickAction',_0x371ac9));}),_0x3b493c['children']['add'](_0x43cc91),this['_actionButtons']['push']({'buttonView':_0x43cc91,'action':_0x371ac9}),{'listItem':_0x3b493c,'highlightViews':[_0x35a43c,_0x3edf92]};}{const _0x532e73=new Dt(),_0x49789c=new Pt(this['locale'],_0x532e73),_0xc6e2a2=_0x49789c['bindTemplate'],_0x37a1bf=_0x371ac9['icon']??_0x371ac9['parent']?.['icon'],_0x24b331=void 0x0!==_0x371ac9['icon'];return _0x49789c['set']({'label':_0x371ac9['label'],'withText':!0x0,'role':'menuitem','icon':_0x24b331?_0x37a1bf??_0x4d468f:void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button','isEnabled':_0x371ac9['isEnabled']}),_0x49789c['extendTemplate']({'on':{'mouseenter':_0xc6e2a2['to'](()=>{this['_isSearchFocused']()||_0x49789c['focus']();})}}),_0x49789c['on']('execute',()=>{_0x1638a6['editing']['view']['focus'](),_0x1638a6['commands']['execute']('aiQuickAction',_0x371ac9);}),_0x3b493c['children']['add'](_0x49789c),this['_actionButtons']['push']({'buttonView':_0x49789c,'action':_0x371ac9}),{'listItem':_0x3b493c,'highlightViews':[_0x532e73]};}}['_createSearchResultActionButton'](_0x2629de,_0x440496,_0x319016,_0x432125){return _0x319016&&_0x432125?this['_createSearchResultGroupedActionButton'](_0x2629de,_0x440496,_0x319016,_0x432125):this['_createSearchResultIndividualActionButton'](_0x2629de,_0x440496);}['_createSearchResultGroupedActionButton'](_0xcf4b23,_0xe5d12e,_0x42ac71,_0x40602f){const _0x44e3a2=new Xt(this['locale']),_0x5c4e2a=new Pt(this['locale']),_0x1201e4=_0x5c4e2a['bindTemplate'],{view:_0xddbe56,highlightView:_0x256cfd}=this['_createSearchResultGroupRow'](_0x42ac71,_0x40602f),{view:_0x479fb0,highlightView:_0x57eb46}=this['_createSearchResultActionRow'](_0xe5d12e['label']),_0x27f727=this['_createSearchResultContentView'](_0xddbe56,_0x479fb0);return _0x5c4e2a['set']({'label':_0xe5d12e['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':_0xe5d12e['isEnabled']}),_0x5c4e2a['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',_0x1201e4['if']('isEnabled','ck-disabled',_0x13ee3d=>!_0x13ee3d)],'type':'button','role':'menuitem','tabindex':'-1'},'children':[_0x27f727],'on':{'mouseenter':_0x1201e4['to'](()=>{this['_isSearchFocused']()||_0x5c4e2a['focus']();}),'click':_0x1201e4['to'](()=>{this['_handleSearchResultButtonClick'](_0x5c4e2a);})}}),this['_setupActionButtonExecution'](_0x5c4e2a,_0xcf4b23,_0xe5d12e),_0x44e3a2['children']['add'](_0x5c4e2a),this['_actionButtons']['push']({'buttonView':_0x5c4e2a,'action':_0xe5d12e}),{'listItem':_0x44e3a2,'highlightViews':[_0x256cfd,_0x57eb46]};}['_createSearchResultIndividualActionButton'](_0x5a5932,_0x15e9d4){const _0x203f84=new Xt(this['locale']),_0x357580=new Dt(),_0x2052ba=new Pt(this['locale'],_0x357580),_0x2fdecb=_0x2052ba['bindTemplate'];return _0x2052ba['set']({'label':_0x15e9d4['label'],'withText':!0x0,'role':'menuitem','icon':void 0x0,'tooltip':!0x1,'class':'ck-ai-quick-actions-button\x20ck-ai-quick-actions-search-result-button','isEnabled':_0x15e9d4['isEnabled']}),_0x2052ba['extendTemplate']({'on':{'mouseenter':_0x2fdecb['to'](()=>{this['_isSearchFocused']()||_0x2052ba['focus']();})}}),this['_setupActionButtonExecution'](_0x2052ba,_0x5a5932,_0x15e9d4),_0x203f84['children']['add'](_0x2052ba),this['_actionButtons']['push']({'buttonView':_0x2052ba,'action':_0x15e9d4}),{'listItem':_0x203f84,'highlightViews':[_0x357580]};}['_createSearchResultGroupRow'](_0x12bdb0,_0x19ff80){const _0x308126=new _0x1e8352(this['locale']),_0x1a0b8e=new Wt();_0x1a0b8e['content']=_0x19ff80,_0x1a0b8e['extendTemplate']({'attributes':{'class':'ck-ai-quick-actions-button__group-icon'}});const _0x273b06=new Kt();return _0x273b06['text']=_0x12bdb0,_0x308126['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__group-row'},'children':[_0x1a0b8e,_0x273b06]}),{'view':_0x308126,'highlightView':_0x273b06};}['_createSearchResultActionRow'](_0x4e2d00){const _0x4e02f2=new _0x1e8352(this['locale']),_0x261f3d=new Kt();return _0x261f3d['text']=_0x4e2d00,_0x4e02f2['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__action-row'},'children':[_0x261f3d]}),{'view':_0x4e02f2,'highlightView':_0x261f3d};}['_createSearchResultContentView'](_0x530170,_0x4540a6){const _0x491002=new _0x1e8352(this['locale']);return _0x491002['setTemplate']({'tag':'div','attributes':{'class':'ck-ai-quick-actions-search-result__content'},'children':[_0x530170,_0x4540a6]}),_0x491002;}['_setupActionButtonExecution'](_0x6d9099,_0x1a111e,_0x2bfc44){_0x6d9099['on']('execute',()=>{_0x6d9099['isEnabled']&&(_0x1a111e['editing']['view']['focus'](),_0x1a111e['commands']['execute']('aiQuickAction',_0x2bfc44));});}['_createActionGroupButton'](_0x3a3ebe,_0x4f2b1b,_0x229bf1){const _0x2be337=new Xt(this['locale']),_0x1731d3=new Dt(),_0x1af85b=new pa(this['locale'],_0x1731d3),_0x1339ae=_0x1af85b['bindTemplate'],_0x2ee112=this['_getPanelKeystroke'](_0x229bf1),_0x369e05=this['_createGroupActionsList'](_0x3a3ebe,_0x4f2b1b['actions'],_0x229bf1);_0x1af85b['set']({'label':_0x4f2b1b['label'],'withText':!0x0,'role':Ta,'icon':_0x4f2b1b['icon']??_0x4d468f,'isEnabled':_0x4f2b1b['actions']['some'](_0x2aa4e2=>_0x2aa4e2['isEnabled'])}),_0x1af85b['extendTemplate']({'on':{'mouseenter':_0x1339ae['to'](()=>{this['_isSearchFocused']()||_0x1af85b['focus']();})}});const _0x3868b8=new Nt(this['locale']);return _0x3868b8['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-panel','ck-dropdown-menu__nested-menu__panel']},'on':{'keydown':_0x1339ae['to'](_0x2f1416=>{this['_handlePanelKeydown'](_0x2f1416,_0x2ee112,_0x1af85b,_0x3868b8);})}}),_0x1af85b['bind']('isOn')['to'](_0x3868b8,'isVisible'),this['_bodyCollection']['add'](_0x3868b8),_0x3868b8['content']['add'](_0x369e05),this['_setupGroupMenuBehavior'](_0x1af85b,_0x3868b8),_0x2be337['children']['add'](_0x1af85b),this['_actionButtons']['push']({'buttonView':_0x1af85b,'action':_0x4f2b1b}),{'listItem':_0x2be337,'highlightView':_0x1731d3};}['_createGroupActionsList'](_0x3ff18a,_0x114ae0,_0x561c49){const _0x335c47=new zt(this['locale']);return _0x335c47['extendTemplate']({'attributes':{'class':['ck','ck-reset_all','ck-ai-quick-actions-group-list','ck-dropdown-menu-list']}}),_0x114ae0['forEach'](_0x27f5af=>{const _0x4914d7=new Xt(this['locale']),_0xbb5964=Ia({'editor':_0x3ff18a,'action':_0x27f5af,'withText':!0x0,'withIcon':!0x1,'isInDropdown':!0x0,'shouldPreventFocus':()=>this['_isSearchFocused'](),'actionButtons':this['_actionButtons']})();_0x4914d7['children']['add'](_0xbb5964),_0x561c49['focusTracker']['add'](_0xbb5964),_0x335c47['items']['add'](_0x4914d7);}),_0x335c47;}['_setupGroupMenuBehavior'](_0x5caf6f,_0x1db09a){const _0x3c57c6=_0x5caf6f['bindTemplate'],_0x56af16=this['_getButtonKeystroke'](_0x5caf6f);_0x5caf6f['extendTemplate']({'attributes':{'class':['ck-ai-quick-actions-group-button']},'on':{'mouseenter':_0x3c57c6['to'](()=>{this['_showNestedPanel'](_0x1db09a,_0x5caf6f);}),'mouseleave':_0x3c57c6['to'](_0x998f46=>{const _0x261f4e=_0x998f46['relatedTarget'];this['_isMovingToNestedMenu'](_0x261f4e,_0x1db09a)||this['_hideNestedPanel'](_0x1db09a);}),'keydown':_0x3c57c6['to'](_0x58b4b5=>{_0x58b4b5['key']==_0x56af16&&(this['_showNestedPanel'](_0x1db09a,_0x5caf6f),_0x1db09a['content']['get'](0x0)['focus']());})}}),_0x1db09a['on']('render',()=>{_0x1db09a['element']?.['addEventListener']('mouseleave',_0x3f3597=>{const _0x178be2=_0x3f3597['relatedTarget'];_0x5caf6f['element']?.['contains'](_0x178be2)||this['_isMovingToNestedMenu'](_0x178be2,_0x1db09a)||this['_hideNestedPanel'](_0x1db09a);});});}['_showNestedPanel'](_0x3f6982,_0x18f0d7){this['_openNestedPanels']['forEach'](_0x228323=>{_0x228323!==_0x3f6982&&_0x228323['isVisible']&&_0x228323['hide']();}),_0x3f6982['show'](),_0x3f6982['pin']({'positions':[Vt['eastSouth']],'target':_0x18f0d7['element'],'fitInViewport':!0x0}),this['_openNestedPanels']['add'](_0x3f6982);}['_hideNestedPanel'](_0x4911ec){_0x4911ec['hide'](),this['_openNestedPanels']['delete'](_0x4911ec);}['_hideAllNestedPanels'](){this['_openNestedPanels']['forEach'](_0x244caf=>_0x244caf['hide']()),this['_openNestedPanels']['clear']();}['_isMovingToNestedMenu'](_0x265ac0,_0x34beae){if(!_0x265ac0)return!0x1;if(_0x34beae['element']?.['contains'](_0x265ac0))return!0x0;const _0x1a422c=_0x265ac0;return _0x1a422c['closest']&&(null!==_0x1a422c['closest']('.ck-ai-quick-actions-group-panel')||null!==_0x1a422c['closest']('.ck-ai-quick-actions-group-list')||null!==_0x1a422c['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'](_0x30540b){return'rtl'===_0x30540b['locale']['uiLanguageDirection']?'ArrowRight':'ArrowLeft';}['_getButtonKeystroke'](_0x4a652d){return'rtl'===_0x4a652d['locale']['uiLanguageDirection']?'ArrowLeft':'ArrowRight';}['_handlePanelKeydown'](_0x39db2e,_0x4825fb,_0x21657d,_0x17650e){_0x39db2e['key']==_0x4825fb&&(_0x21657d['focus'](),this['_hideNestedPanel'](_0x17650e));}['_handleSearchResultButtonClick'](_0x439047){_0x439047['fire']('execute');}};function Ca(_0x6f0fa4){const {editor:_0x4a8494,content:_0x3e5aa7,buttonDefinition:_0x1a5175,bodyCollection:_0x574cd2,hasSearch:_0xeebfa5=!0x1,actionButtons:_0x58893e}=_0x6f0fa4;return()=>{const _0x2e7b49=_0x4a8494['locale'],_0x505d15=_0x4a8494['commands']['get']('aiQuickAction'),_0x1cf3e9=_0x312ca1(_0x2e7b49);_0x1cf3e9['bind']('isEnabled')['to'](_0x505d15),_0x1cf3e9['buttonView']['set']({'icon':_0x1a5175['icon']??_0x4d468f,'label':_0x1a5175['label'],'tooltip':!0x0}),_0x1cf3e9['set']({'class':'ck-ai-quick-actions-dropdown'});const _0x15d236=new wa(_0x4a8494,_0x3e5aa7,_0x1cf3e9,_0x574cd2,_0xeebfa5,_0x58893e);return _0x1cf3e9['panelView']['children']['add'](_0x15d236),_0xeebfa5&&_0x1cf3e9['on']('change:isOpen',(_0x4e3ce6,_0x3259ce,_0x18d4c8)=>{if(_0x18d4c8){if(_0x4a8494['plugins']['has']('AIEditing')){const _0x2eb877=_0x4a8494['plugins']['get'](As),_0x413b7a=_0x4a8494['model']['document']['selection'],_0x85f190=Array['from'](_0x413b7a['getRanges']());_0x85f190['length']>0x0&&_0x2eb877['showFakeVisualSelection']({'editor':_0x4a8494,'ranges':_0x85f190,'id':'quick-action','priority':0x14});}}else _0x4a8494['plugins']['has']('AIEditing')&&_0x4a8494['plugins']['get'](As)['hideFakeVisualSelection']('quick-action'),_0x15d236['resetSearch']();}),_0x1cf3e9;};}const fa='<task>Explain\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x20plain,\x20simple\x20language.</task><rules>1.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is:-\x20If\x20it\x20looks\x20like\x20a\x20definition\x20explain\x20the\x20concept\x20in\x20simple\x20terms.-\x20If\x20it\x20looks\x20like\x20a\x20description\x20clarify\x20what\x20it\x20is\x20describing\x20and\x20why\x20it\x20matters.-\x20If\x20it\x20contains\x20technical\x20terms\x20or\x20jargon\x20break\x20them\x20down\x20into\x20everyday\x20language.-\x20If\x20it\x20looks\x20instructional\x20restate\x20as\x20clear\x20steps\x20someone\x20can\x20follow.-\x20If\x20it\x20provides\x20examples\x20explain\x20what\x20the\x20example\x20shows\x20and\x20why\x20it\x27s\x20relevant.-\x20If\x20it\x20presents\x20an\x20argument\x20or\x20claim\x20restate\x20the\x20claim\x20neutrally\x20and\x20explain\x20its\x20purpose.-\x20If\x20it\x20is\x20narrative/story-like\x20explain\x20what\x20event\x20or\x20situation\x20is\x20being\x20described.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20explain\x20what\x20the\x20data\x20indicates.-\x20If\x20it\x20is\x20a\x20quotation\x20explain\x20the\x20meaning\x20of\x20the\x20quote\x20in\x20context.-\x20If\x20it\x20compares/contrasts\x20things\x20explain\x20the\x20key\x20differences\x20or\x20similarities\x20simply.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20give\x20a\x20clear,\x20plain-language\x20explanation\x20of\x20its\x20meaning,\x20focusing\x20on\x20usefulness.2.\x20Provide\x20context\x20if\x20the\x20meaning\x20could\x20be\x20unclear\x20without\x20it.\x20(e.g.,\x20explain\x20where\x20such\x20a\x20term\x20might\x20be\x20used,\x20or\x20why\x20it\x20is\x20important).3.\x20Keep\x20the\x20explanation\x20short\x20but\x20complete\x20(2–5\x20sentences).-\x20Avoid\x20overly\x20technical\x20detail\x20unless\x20it\x20is\x20necessary\x20for\x20understanding.4.\x20Do\x20not\x20simply\x20repeat\x20the\x20original\x20text\x20—\x20restate\x20and\x20expand\x20it\x20in\x20plain\x20words.5.\x20If\x20possible,\x20add\x20a\x20short\x20example\x20or\x20analogy\x20to\x20make\x20it\x20easier\x20to\x20understand.6.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20explanation.7.\x20Your\x20explanation\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20explanation,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant,\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',ba='<task>Summarize\x20the\x20selected\x20part\x20of\x20the\x20document\x20in\x202–4\x20clear\x20sentences,\x20capturing\x20only\x20the\x20essential\x20meaning.</task><rules>1.\x20Your\x20summary\x20should\x20be\x20short\x20and\x20clear:-\x20Aim\x20for\x202–4\x20sentences\x20unless\x20the\x20text\x20is\x20extremely\x20short.-\x20Focus\x20on\x20capturing\x20the\x20main\x20idea(s)\x20without\x20unnecessary\x20detail.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20summary\x20style:-\x20If\x20it\x20is\x20descriptive\x20condense\x20the\x20description\x20into\x20its\x20core\x20idea.-\x20If\x20it\x20is\x20argumentative\x20or\x20opinion-based\x20summarize\x20the\x20main\x20claim\x20and\x20reasoning\x20neutrally.-\x20If\x20it\x20is\x20narrative/story-like\x20capture\x20the\x20main\x20event\x20or\x20outcome\x20without\x20side\x20details.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20summarize\x20what\x20the\x20data\x20shows\x20in\x20plain\x20language.-\x20If\x20it\x20is\x20instructional\x20restate\x20the\x20overall\x20purpose\x20of\x20the\x20steps\x20without\x20listing\x20every\x20step.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20of\x20the\x20categories\x20above\x20provide\x20a\x20general\x20concise\x20summary.3.\x20Provide\x20context\x20if\x20necessary\x20for\x20clarity:-\x20Mention\x20the\x20subject\x20or\x20topic\x20explicitly\x20so\x20the\x20summary\x20can\x20stand\x20alone.4.\x20Do\x20not\x20simply\x20copy\x20sentences\x20from\x20the\x20original\x20text\x20—\x20rephrase\x20in\x20plain\x20language.5.\x20Avoid\x20adding\x20new\x20information\x20or\x20interpretation\x20not\x20present\x20in\x20the\x20text.6.\x20Summarize\x20in\x20a\x20way\x20that\x20would\x20make\x20sense\x20to\x20someone\x20who\x20has\x20not\x20read\x20the\x20original\x20text.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20summary.8.\x20Your\x20summary\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20summary,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Sa='<task>Extract\x20and\x20present\x20the\x20key\x20points\x20from\x20the\x20selected\x20part\x20of\x20the\x20document\x20as\x20a\x20concise\x20bulleted\x20list.</task><rules>1.\x20Present\x20the\x20output\x20as\x20a\x20clear,\x20structured\x20list\x20(bullets\x20or\x20numbered).-\x20Each\x20point\x20should\x20be\x20concise\x20(one\x20sentence\x20or\x20less).-\x20Do\x20not\x20merge\x20distinct\x20ideas\x20into\x20one\x20bullet.2.\x20Identify\x20what\x20type\x20of\x20text\x20it\x20is\x20and\x20adapt\x20the\x20extraction\x20style:-\x20If\x20it\x20is\x20descriptive\x20capture\x20the\x20main\x20attributes\x20or\x20features.-\x20If\x20it\x20is\x20argumentative\x20extract\x20the\x20main\x20claim\x20and\x20supporting\x20reasons\x20separately.-\x20If\x20it\x20is\x20narrative/story-like\x20extract\x20the\x20main\x20events\x20in\x20chronological\x20order.-\x20If\x20it\x20is\x20data-driven\x20(stats,\x20figures,\x20facts)\x20highlight\x20the\x20most\x20important\x20facts\x20or\x20numbers.-\x20If\x20it\x20is\x20instructional\x20list\x20the\x20steps\x20or\x20main\x20actions\x20in\x20simplified\x20form-\x20If\x20it\x20provides\x20comparisons\x20extract\x20the\x20contrasted\x20items\x20and\x20their\x20differences/similarities.-\x20If\x20it\x20does\x20not\x20fit\x20any\x20category\x20above\x20extract\x20the\x20main\x20ideas\x20in\x20plain,\x20short\x20statements.3.\x20Keep\x20the\x20list\x20between\x203–7\x20items\x20where\x20possible.-\x20If\x20the\x20text\x20is\x20very\x20short,\x20fewer\x20items\x20are\x20fine.-\x20If\x20it\x20is\x20very\x20long,\x20focus\x20on\x20the\x20most\x20important\x20ideas\x20only.4.\x20Do\x20not\x20copy\x20long\x20text\x20fragments\x20—\x20restate\x20in\x20simple\x20words.5.\x20Do\x20not\x20add\x20interpretation,\x20evaluation,\x20or\x20commentary\x20beyond\x20the\x20text.6.\x20Ensure\x20the\x20list\x20can\x20stand\x20alone\x20without\x20requiring\x20the\x20reader\x20to\x20see\x20the\x20original\x20document.7.\x20Use\x20the\x20context\x20of\x20the\x20whole\x20document,\x20but\x20focus\x20on\x20the\x20selected\x20part\x20when\x20creating\x20your\x20key\x20points.8.\x20Your\x20key\x20points\x20should\x20be\x20written\x20in\x20%0\x20language.</rules><output>For\x20this\x20response:\x20reply\x20with\x20only\x20the\x20text\x20key\x20points\x20list,\x20nothing\x20else.</output><scope>These\x20instructions\x20apply\x20to\x20this\x20response\x20only.\x20In\x20follow-up\x20messages,\x20respond\x20normally\x20as\x20a\x20helpful\x20assistant\x20that\x20can\x20make\x20document\x20modifications\x20with\x20no\x20restrictions.</scope>',Ra=/* #__PURE__ -- @preserve */
|
|
37
|
+
((()=>({'chat':'AIChat','action':'AIActions'}))());var Oa=class AIQuickActionsUI extends _0x3f2605{['_actionButtons']=[];['_menuBarGroupViews']=[];['_reporter'];static get['requires'](){return[yt,cs,rn];}static get['pluginName'](){return'AIQuickActionsUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){this['_reporter']=this['editor']['plugins']['get'](rn)['createReporter']('aiquickactions');const _0x505a8=this['_getDefaultAndCustomActions']();this['_prepareQuickActionsDefinition'](_0x505a8),this['_initializeQuickActionsComponentsAndCommands'](),this['_initActionTypeQuickActions'](),this['_initChatTypeQuickActions']();}static['getDefaultQuickActions'](_0x35af5c){return function(_0x31657c){const _0x385b2d=new Intl['DisplayNames'](['en'],{'type':'language'})['of'](_0x31657c['uiLanguage'])||'English';return[{'id':'ask-ai','label':ls(_0x31657c,'AI_QUICK_ACTIONS_ASK_AI'),'type':'chat','icon':_0x332587},{'id':'chat-commands','label':ls(_0x31657c,'AI_QUICK_ACTIONS_CHAT_COMMANDS'),'icon':_0x332587,'actions':[{'id':'explain','label':ls(_0x31657c,'AI_QUICK_ACTIONS_EXPLAIN'),'displayedPrompt':ls(_0x31657c,'AI_QUICK_ACTIONS_EXPLAIN'),'prompt':fa['replace']('%0',_0x385b2d),'type':'chat'},{'id':'summarize','label':ls(_0x31657c,'AI_QUICK_ACTIONS_SUMMARIZE'),'displayedPrompt':ls(_0x31657c,'AI_QUICK_ACTIONS_SUMMARIZE'),'prompt':ba['replace']('%0',_0x385b2d),'type':'chat'},{'id':'highlight-key-points','label':ls(_0x31657c,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'displayedPrompt':ls(_0x31657c,'AI_QUICK_ACTIONS_HIGHLIGHT_KEY_POINTS'),'prompt':Sa['replace']('%0',_0x385b2d),'type':'chat'}]},{'id':'improve-writing','label':ls(_0x31657c,'AI_QUICK_ACTIONS_IMPROVE_WRITING'),'type':'action','icon':_0x32f401},{'id':'continue','label':ls(_0x31657c,'AI_QUICK_ACTIONS_CONTINUE_WRITING'),'type':'action','icon':_0x347ec9},{'id':'fix-grammar','label':ls(_0x31657c,'AI_QUICK_ACTIONS_FIX_GRAMMAR_SPELLING'),'type':'action','icon':_0x8854c0},{'id':'adjust-length','label':ls(_0x31657c,'AI_QUICK_ACTIONS_ADJUST_LENGTH'),'icon':_0x523c75,'actions':[{'id':'make-shorter','label':ls(_0x31657c,'AI_QUICK_ACTIONS_MAKE_SHORTER'),'type':'action'},{'id':'make-longer','label':ls(_0x31657c,'AI_QUICK_ACTIONS_MAKE_LONGER'),'type':'action'}]},{'id':'change-tone','label':ls(_0x31657c,'AI_QUICK_ACTIONS_CHANGE_TONE'),'icon':_0x5ed96b,'actions':[{'id':'make-tone-casual','label':ls(_0x31657c,'AI_QUICK_ACTIONS_MORE_CASUAL'),'type':'action'},{'id':'make-tone-direct','label':ls(_0x31657c,'AI_QUICK_ACTIONS_MORE_DIRECT'),'type':'action'},{'id':'make-tone-friendly','label':ls(_0x31657c,'AI_QUICK_ACTIONS_MORE_FRIENDLY'),'type':'action'},{'id':'make-tone-confident','label':ls(_0x31657c,'AI_QUICK_ACTIONS_MORE_CONFIDENT'),'type':'action'},{'id':'make-tone-professional','label':ls(_0x31657c,'AI_QUICK_ACTIONS_MORE_PROFESSIONAL'),'type':'action'}]},{'id':'translate','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE'),'icon':_0x3ba0ab,'actions':[{'id':'translate-to-english','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_ENGLISH'),'type':'action','actionName':'translate','args':{'language':'english'}},{'id':'translate-to-chinese','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_CHINESE'),'type':'action','actionName':'translate','args':{'language':'chinese'}},{'id':'translate-to-spanish','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_SPANISH'),'type':'action','actionName':'translate','args':{'language':'spanish'}},{'id':'translate-to-german','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_GERMAN'),'type':'action','actionName':'translate','args':{'language':'german'}},{'id':'translate-to-french','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_FRENCH'),'type':'action','actionName':'translate','args':{'language':'french'}},{'id':'translate-to-japanese','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_JAPANESE'),'type':'action','actionName':'translate','args':{'language':'japanese'}},{'id':'translate-to-portuguese','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_PORTUGUESE'),'type':'action','actionName':'translate','args':{'language':'portuguese'}},{'id':'translate-to-korean','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_KOREAN'),'type':'action','actionName':'translate','args':{'language':'korean'}},{'id':'translate-to-italian','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_ITALIAN'),'type':'action','actionName':'translate','args':{'language':'italian'}},{'id':'translate-to-russian','label':ls(_0x31657c,'AI_QUICK_ACTIONS_TRANSLATE_RUSSIAN'),'type':'action','actionName':'translate','args':{'language':'russian'}}]},{'id':'other','label':ls(_0x31657c,'AI_QUICK_ACTIONS_OTHER'),'icon':_0x5e2869,'actions':[]}];}(_0x35af5c);}['_getDefaultAndCustomActions'](){const _0x3f8117=AIQuickActionsUI['getDefaultQuickActions'](this['editor']['locale']),_0x20fb6e=(this['editor']['config']['get']('ai.quickActions.extraCommands')||[])['map'](_0x3cb8f3=>({..._0x3cb8f3,'type':'chat'===_0x3cb8f3['type']?'chat':'action','icon':void 0x0}));return _0x3f8117['find'](_0x738e93=>'other'===_0x738e93['id'])['actions']['push'](..._0x20fb6e),_0x3f8117;}async['_initActionTypeQuickActions'](){try{const _0x4f66d1=new Xs({'connector':this['editor']['plugins']['get']('AIConnector'),'config':this['editor']['config']['get']('ai.models'),'locale':this['editor']['locale']}),_0x341f12=await _0x4f66d1['getAll'](),_0x1df851=(await _0x4f66d1['getDefault']())?.['id'];this['_assignDefaultModelToCustomActions'](_0x1df851),this['_enableButtonsByType']('action',_0x4e711e=>!!_0x341f12['find'](_0x897386=>_0x897386['id']===_0x4e711e['model'])||void 0x0===_0x4e711e['model']);}catch(_0x340d2d){const _0x3bf9a8=new at('ai-quick-actions-models-unable-to-retrieve',this,{'error':_0x340d2d});this['_reporter']['logError'](_0x3bf9a8);}}['_initChatTypeQuickActions'](){if(!this['editor']['plugins']['has']('AIChatController'))return;const _0x1cd066=this['editor']['plugins']['get']('AIChatController');this['listenTo'](_0x1cd066,'change:isConversationReady',(_0x19fb3b,_0x3a37fe,_0x20e3b8)=>{_0x20e3b8&&this['_enableButtonsByType']('chat',()=>!0x0);}),_0x1cd066['isConversationReady']&&this['_enableButtonsByType']('chat',()=>!0x0);}['_enableButtonsByType'](_0x2e1dda,_0x12b3fe){this['_quickActionsDefinition']['forEach'](_0x36dd3a=>{'actions'in _0x36dd3a?_0x36dd3a['actions']['forEach'](_0x1e5dda=>{_0x1e5dda['type']===_0x2e1dda&&(_0x1e5dda['isEnabled']=_0x12b3fe(_0x1e5dda));}):_0x36dd3a['type']===_0x2e1dda&&(_0x36dd3a['isEnabled']=_0x12b3fe(_0x36dd3a));}),this['_actionButtons']['forEach'](_0x5ebdbc=>{if(va(_0x5ebdbc['action']))return;if(_0x5ebdbc['action']['type']!==_0x2e1dda)return;const _0xef763b=_0x12b3fe(_0x5ebdbc['action']);if(_0x5ebdbc['action']['isEnabled']=_0xef763b,_0x5ebdbc['buttonView']['isEnabled']=_0xef763b,!_0xef763b&&_0x5ebdbc['action']['model']){const _0x292674=new at('ai-quick-actions-unavailable-model',this,{'actionId':_0x5ebdbc['action']['id'],'modelId':_0x5ebdbc['action']['model']});this['_reporter']['logError'](_0x292674);}}),this['_actionButtons']['filter'](_0x2c94b5=>va(_0x2c94b5['action']))['forEach'](_0x537fa4=>{_0x537fa4['buttonView']['isEnabled']=_0x537fa4['action']['actions']['some'](_0x44961a=>_0x44961a['isEnabled']);}),this['_menuBarGroupViews']['forEach'](({view:_0x27d236,group:_0x3fc85c})=>{_0x27d236['isEnabled']=_0x3fc85c['actions']['some'](_0x45bc79=>_0x45bc79['isEnabled']);});}['_assignDefaultModelToCustomActions'](_0x1ec85f){this['_actionButtons']['forEach'](_0x1ae258=>{va(_0x1ae258['action'])||'action'===_0x1ae258['action']['type']&&(_0x1ae258['action']['model']||(_0x1ae258['action']['model']=_0x1ec85f));});}['_initializeQuickActionsComponentsAndCommands'](){const _0x23a4be=new xt(this['editor']['locale']);_0x23a4be['attachToDom'](),this['_initializeQuickActionsDropdown'](_0x23a4be),this['_initializeQuickActionsMenuBar'](),this['_initializeQuickActionsComponents'](_0x23a4be);}['_initializeQuickActionsDropdown'](_0x201252){const _0x3aa5e6=this['editor']['config']['get']('ai.quickActions.isSearchEnabled')??!0x0;this['editor']['ui']['componentFactory']['add']('aiQuickActions',Ca({'editor':this['editor'],'content':this['_quickActionsDefinition'],'buttonDefinition':{'icon':_0x4d468f,'label':ls(this['editor']['locale'],'AI_QUICK_ACTIONS_HEADING')},'bodyCollection':_0x201252,'hasSearch':_0x3aa5e6,'actionButtons':this['_actionButtons']}));}['_prepareQuickActionsDefinition'](_0x5dc29d){this['_quickActionsDefinition']=_0x5dc29d['map'](_0x5f2e38=>{if('actions'in _0x5f2e38){const _0x2c1935=_0x5f2e38;return{..._0x2c1935,'actions':_0x2c1935['actions']['map'](_0x2570fd=>{const {actions:_0xe340d7,..._0x52b6f0}=_0x2c1935;return{..._0x2570fd,'isEnabled':!0x1,'parent':_0x52b6f0};})['filter'](_0x3f4f9a=>this['_shouldIncludeAction'](_0x3f4f9a))};}return{..._0x5f2e38,'isEnabled':!0x1};})['filter'](_0x2d38cc=>'actions'in _0x2d38cc?_0x2d38cc['actions']['length']>0x0:this['_shouldIncludeAction'](_0x2d38cc));}['_shouldIncludeAction'](_0x4dda62){const _0x1ca47f=this['editor']['config']['get']('ai.quickActions.removeCommands')||[];return this['editor']['plugins']['has'](Ra[_0x4dda62['type']])&&!_0x1ca47f['includes'](_0x4dda62['id'])&&!('chat'===_0x4dda62['type']&&!0x1===this['editor']['config']['get']('ai.chat.context.document.enabled'));}['_initializeQuickActionsComponents'](_0xdcff31){this['_quickActionsDefinition']['forEach'](_0x269001=>{if('actions'in _0x269001){const _0x2ef00c=Ca({'editor':this['editor'],'content':_0x269001['actions'],'buttonDefinition':_0x269001,'bodyCollection':_0xdcff31,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x269001['id'],_0x2ef00c),_0x269001['actions']['forEach'](_0x52447a=>{const _0x2a2c80=Ia({'editor':this['editor'],'action':_0x52447a,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x52447a['id'],_0x2a2c80);});}else{const _0x5db7c7=Ia({'editor':this['editor'],'action':_0x269001,'withText':!0x1,'withIcon':!0x0,'isInDropdown':!0x1,'actionButtons':this['_actionButtons']});this['editor']['ui']['componentFactory']['add'](_0x269001['id'],_0x5db7c7);}});}['_initializeQuickActionsMenuBar'](){this['editor']['ui']['componentFactory']['add']('menuBar:aiQuickActions',_0x5d561d=>{const _0x21e76d=this['editor']['commands']['get']('aiQuickAction'),_0x177459=new te(_0x5d561d),_0x4513fa=ls(_0x5d561d,'AI_QUICK_ACTIONS_HEADING');_0x177459['buttonView']['set']({'label':_0x4513fa,'icon':_0x4d468f});const _0x4ce72f=new Zt(_0x5d561d);return _0x4ce72f['set']({'ariaLabel':_0x4513fa,'role':'menu'}),this['_quickActionsDefinition']['forEach'](_0x31fdc5=>{if('actions'in _0x31fdc5){const _0x4afcf2=_0x31fdc5,_0x524fdb=new Jt(_0x5d561d,_0x177459),_0x45ae47=new te(_0x5d561d),_0x42bf44=new Zt(_0x5d561d);_0x45ae47['buttonView']['set']({'label':_0x4afcf2['label'],'icon':_0x4afcf2['icon']}),_0x4afcf2['actions']['forEach'](_0xc3044e=>{const _0x561f05=new Jt(_0x5d561d,_0x45ae47),_0x236963=new jt(_0x5d561d);_0x236963['set']({'label':_0xc3044e['label'],'icon':_0xc3044e['icon'],'role':'menuitem','isEnabled':_0xc3044e['isEnabled']}),_0x236963['on']('execute',()=>{this['_executeQuickAction'](_0xc3044e);}),this['_actionButtons']['push']({'buttonView':_0x236963,'action':_0xc3044e}),_0x236963['delegate']('execute')['to'](_0x45ae47),_0x561f05['children']['add'](_0x236963),_0x42bf44['items']['add'](_0x561f05);}),_0x45ae47['isEnabled']=_0x4afcf2['actions']['some'](_0xdaf9a7=>_0xdaf9a7['isEnabled']),this['_menuBarGroupViews']['push']({'view':_0x45ae47,'group':_0x4afcf2}),_0x45ae47['panelView']['children']['add'](_0x42bf44),_0x524fdb['children']['add'](_0x45ae47),_0x4ce72f['items']['add'](_0x524fdb);}else{const _0x1c4d43=_0x31fdc5,_0x5762c0=new Jt(_0x5d561d,_0x177459),_0x3f7121=new jt(_0x5d561d);_0x3f7121['set']({'label':_0x1c4d43['label'],'icon':_0x1c4d43['icon'],'role':'menuitem','isEnabled':_0x1c4d43['isEnabled']}),this['_actionButtons']['push']({'buttonView':_0x3f7121,'action':_0x1c4d43}),_0x3f7121['on']('execute',()=>{this['_executeQuickAction'](_0x1c4d43);}),_0x3f7121['delegate']('execute')['to'](_0x177459),_0x5762c0['children']['add'](_0x3f7121),_0x4ce72f['items']['add'](_0x5762c0);}}),Object['values'](Ra)['some'](_0x12bd18=>this['editor']['plugins']['has'](_0x12bd18))?_0x177459['bind']('isEnabled')['to'](_0x21e76d):_0x177459['set']({'isEnabled':!0x1}),_0x177459['panelView']['children']['add'](_0x4ce72f),_0x177459;});}['_executeQuickAction'](_0x54b436){const _0x5248e0=this['editor'];_0x5248e0['editing']['view']['focus'](),_0x5248e0['commands']['execute']('aiQuickAction',_0x54b436);const _0x13d3eb=_0x5248e0['ui']['view']['menuBarView'];_0x13d3eb&&_0x13d3eb['close']&&_0x13d3eb['close']();}};function va(_0x137e23){return'actions'in _0x137e23;}function ka(_0x8fc06b,_0x8562e9){const _0x476054=_0x8fc06b['plugins']['get']('AITabs')['view'];_0x476054['isVisible']=!0x0,_0x476054['activateTab'](_0x8562e9);}var Na=class extends _0xfa3ed0{['execute'](_0x3f3fc3){switch(this['_expandSelectionIfCollapsed'](),_0x3f3fc3['type']){case'chat':if(!this['editor']['plugins']['has']('AIChat')){const _0x1f75ee=ls(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIChat');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x1f75ee});}this['_handleAIChatAction'](_0x3f3fc3);break;case'action':if(!this['editor']['plugins']['has']('AIActions')){const _0x1764dd=ls(this['editor']['locale'],'AI_QUICK_ACTIONS_PLUGIN_NOT_FOUND','AIActions');throw new at('ai-quick-actions-plugin-not-found',this['editor'],{'errorMessage':_0x1764dd});}this['_handleAIActionsAction'](_0x3f3fc3);}}async['_handleAIChatAction'](_0x1bfdc4){const _0x453662=this['editor']['plugins']['get']('AIChatController');if(ka(this['editor'],'chat'),'ask-ai'===_0x1bfdc4['id'])_0x453662['removeSelectionFromChatContext'](),_0x453662['addSelectionToChatContext'](this['editor']),_0x453662['focusPromptInput']();else await _0x453662['startConversation']({'modelId':_0x1bfdc4['model']}),_0x453662['removeSelectionFromChatContext'](),_0x453662['addSelectionToChatContext'](this['editor']),_0x453662['focusPromptInput'](),await _0x453662['sendMessage']({'message':_0x1bfdc4['prompt']||_0x1bfdc4['displayedPrompt']||_0x1bfdc4['label'],'attributes':{'quickActionData':{'id':_0x1bfdc4['id']},'displayedPrompt':_0x1bfdc4['displayedPrompt']}});}['_expandSelectionIfCollapsed'](){const _0x3252cb=this['editor'],_0x420ef8=_0x3252cb['model']['document']['selection'];if(!_0x420ef8['isCollapsed'])return;const _0xb8ae45=pt(_0x420ef8['getSelectedBlocks']())||_0x3252cb['model']['schema']['getLimitElement'](_0x420ef8);_0x3252cb['model']['change'](_0x2fc82e=>{_0x2fc82e['setSelection'](_0xb8ae45,'in');});}['_handleAIActionsActionLabel'](_0x98d21d){return _0x98d21d['parent']?.['label']&&'other'!==_0x98d21d['parent']?.['id']?_0x98d21d['parent']['label']+':\x20'+_0x98d21d['label']:_0x98d21d['label'];}async['_handleAIActionsAction'](_0x5d6471){const _0x9b7a51=this['editor']['plugins']['get']('AIActions'),_0x3718c8=_0x5d6471['prompt']?{'userMessage':_0x5d6471['prompt'],'model':_0x5d6471['model']}:{'actionName':_0x5d6471['actionName']||_0x5d6471['id'],'args':_0x5d6471['args']},_0x4152f0=this['_handleAIActionsActionLabel'](_0x5d6471);await _0x9b7a51['executeAction'](_0x3718c8,_0x4152f0,_0x5d6471['icon']);}},ya=class extends _0x3f2605{static get['pluginName'](){return'AIQuickActionsEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x489ba5=this['editor'],_0x530125=new Na(this['editor']);if(_0x489ba5['commands']['add']('aiQuickAction',_0x530125),_0x489ba5['plugins']['has']('AIChat')){const _0x1796dd=this['editor']['plugins']['get']('AIChatController');_0x489ba5['model']['document']['selection']['on']('change:range',(_0x2703cd,_0x530113)=>{_0x530113['directChange']&&_0x1796dd['removeSelectionFromChatContext']();});}}},xa=class extends _n{['appendContent'](_0x35ecc0,_0x504f4b='text'){'modification'===this['type']&&'text'===_0x504f4b&&(_0x504f4b=this['documentContextContent']['keys']()['next']()['value']),super['appendContent'](_0x35ecc0,_0x504f4b);}['updateChangeGroups'](_0x367275){const _0x2d32d5=this['parsedContent']['get'](_0x367275)['cloneNode'](!0x0);if(this['parsedMergedContent']['set'](_0x367275,_0x2d32d5),this['changeGroups']=[],0x0==_0x2d32d5['childNodes']['length'])return;Ps(this['documentContextContent']['get'](_0x367275),this['parsedMergedContent']['get'](_0x367275));const _0x41410c=_0x4c3236(this['documentContextContent']['get'](_0x367275)['children']['map'](_0x4a3a57=>({'node':_0x4a3a57,'id':Cs(_0x4a3a57,'data-id')})),_0x2d32d5['children']['map'](_0x297c03=>({'node':_0x297c03,'id':Cs(_0x297c03,'data-id')||Ot()})),{'comparator':(_0x2d0813,_0x248bf4)=>_0x2d0813['id']==_0x248bf4['id'],'oneChangePerToken':!0x0});if(!this['isDone']||!this['isComplete']){for(;_0x41410c['length']&&_0x41410c[_0x41410c['length']-0x1]['removed'];)_0x41410c['pop']();}const _0x1587df=_0x41410c['map'](_0x1465f7=>{const _0x11ad3e=_0x1465f7['added']?'new':_0x1465f7['removed']?'removed':'modified';return{'node':_0x1465f7['value'][0x0]['node'],'type':_0x11ad3e,'id':_0x1465f7['value'][0x0]['id']};}),_0x427f12=this['_documentIdToSource']['get'](_0x367275);this['changeGroups']['push']({'changes':_0x1587df,'state':'pending','index':this['changeGroups']['length'],'editor':_0x427f12['editor'],'rootName':_0x427f12['rootName'],'documentId':_0x367275});}['_getDifferentChangeGroups'](_0x2d0f67,_0x29f10b){return _0x29f10b;}},La=class extends In{['content'];['version'];['editor'];['rootName'];['actionName'];['args'];['userMessage'];['model'];['hasError']=!0x1;['stoppedExplicitly']=!0x1;constructor(_0x384b9a){super(_0x384b9a),this['content']=_0x384b9a['content'],this['version']=_0x384b9a['version'],this['editor']=_0x384b9a['editor'],this['rootName']=_0x384b9a['rootName'],this['actionName']=_0x384b9a['actionName'],this['args']=_0x384b9a['args'],this['userMessage']=_0x384b9a['userMessage'],this['model']=_0x384b9a['model'],this['on']('interactionStopped',()=>{this['stoppedExplicitly']=!0x0;});}async['sendRequest'](){return this['actionName']?this['connector']['executeAction']({'content':this['content'],'actionName':this['actionName'],'args':this['args']}):this['connector']['executeCustomAction']({'content':this['content'],'message':this['userMessage'],'model':this['model'],'outputFormat':'html'});}['getDocumentContext'](){return{'type':'document','documents':[{'id':this['id'],'content':this['content'],'version':this['version'],'rootName':this['rootName'],'sessionId':Ot(),'channelId':this['editor']['config']['get']('collaboration.channelId')}],'label':'Current\x20document','uiId':'current-document'};}['createReply'](_0x358691){const _0x46042b=this['editor']['config']['get']('collaboration.channelId'),_0xb9808f=new xa({..._0x358691,'locale':this['locale'],'documentContextContent':[{'id':this['id'],'content':this['content'],'channelId':_0x46042b,'rootName':this['rootName']}],'channelsToEditors':new Map([[_0x46042b,this['editor']]])});return this['replies']['push'](_0xb9808f),_0xb9808f['delegate'](...An)['to'](this),this['fire']('replyCreated',_0xb9808f),_0xb9808f;}},Da=class extends _0x177211{constructor(_0x2b1f45,_0x459ff5=!0x0,_0x16707d=!0x0){super(_0x2b1f45),this['set']('isEnabled',!0x1),_0x459ff5&&(this['applyButton']=this['_createButton'](ls(_0x2b1f45,'AI_BALLOON_APPLY_BUTTON'),an),this['applyButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['applyButton'])),_0x16707d&&(this['suggestButton']=this['_createButton'](ls(_0x2b1f45,'AI_BALLOON_SUGGEST_BUTTON'),_0x459ff5?hn:an),this['suggestButton']['bind']('isEnabled')['to'](this),this['items']['add'](this['suggestButton'])),this['setButtonsVisibility']({'showApplyButton':_0x459ff5,'showSuggestButton':_0x16707d}),this['extendTemplate']({'attributes':{'class':['ck-ai-balloon__toolbar']}});}['setButtonsVisibility']({showApplyButton:_0x1a9af7,showSuggestButton:_0x579916}){this['applyButton']&&(this['applyButton']['isVisible']=_0x1a9af7),this['suggestButton']&&(this['suggestButton']['isVisible']=_0x579916);}['_createButton'](_0x5bca21,_0x20bf44){const _0x496acc=new Pt(this['locale']);return _0x496acc['set']({'label':_0x5bca21,'class':_0x20bf44,'isVisible':!0x0,'withText':!0x0}),_0x496acc;}},Pa=class extends _0x1e8352{constructor(_0x1eab1b){super(_0x1eab1b),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-balloon__disclaimer']},'children':[{'tag':'p','attributes':{'class':['ck','ck-ai-balloon__disclaimer-content']},'children':[{'text':ls(_0x1eab1b,'AI_DISCLAIMER_TEXT')}]}]});}},Ha=class extends _0x1e8352{constructor(_0x5de04f){super(_0x5de04f),this['set']('isVisible',!0x0);const _0x49b44f=new cr('small');_0x49b44f['isVisible']=!0x0;const _0x42d30a=new _0x1e8352(this['locale']);_0x42d30a['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai-suggestion__loader-text']},'children':[ls(this['locale'],'AI_CHAT_IS_WRITING')]}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai-suggestion__loader',this['bindTemplate']['if']('isVisible','ck-hidden',_0x54c0f9=>!_0x54c0f9)]},'children':[_0x49b44f,_0x42d30a]});}},Ma=class extends ha{['focusCycler'];['_config'];['_contentWrapper'];['_streamableContentView'];['_toolbarView'];['_miniToolbarView'];['_loaderView'];['_disclaimerView'];['_focusTracker'];['_keystrokes'];['_dialogContent'];['_focusables'];['_scrollManager'];['_miniToolbarResizeObserver'];['_navigationPreviousButton'];['_navigationNextButton'];['_navigationTryAgainButton'];['_navigationCounter'];constructor(_0x10d6f8,_0x43f090){super(_0x10d6f8),this['set']('isBusy',!0x1),this['set']('isTrackChangesOn',!0x1),this['set']('_isLoading',!0x1),this['set']('_hasError',!0x1),this['_config']=_0x43f090,this['_focusTracker']=new ut(),this['_keystrokes']=new dt(),this['_focusables']=this['createCollection'](),this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['_focusTracker'],'keystrokeHandler':this['_keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}),this['_dialogContent']=new _0x14141a(),this['_addContentWrapper'](_0x43f090),this['_addDisclaimerView'](),this['_addToolbar'](_0x43f090),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'](_0x43f090);}),this['on']('render',()=>{this['_setupMiniToolbarPositioning']();});}['render'](){super['render']();for(const _0x2eb34c of this['_focusables'])this['_focusTracker']['add'](_0x2eb34c['element']);this['_keystrokes']['listenTo'](this['element']),this['_initializeScrollManager']();}['destroy'](){super['destroy'](),this['_scrollManager']&&this['_scrollManager']['destroy'](),this['_miniToolbarResizeObserver']&&this['_miniToolbarResizeObserver']['destroy']();}['focus'](_0x463ca1){-0x1===_0x463ca1?this['focusCycler']['focusLast']():this['focusCycler']['focusFirst']();}['setIsLoading'](_0x3a71ab){this['_isLoading']=_0x3a71ab;}['setErrorState'](){this['_hasError']=!0x0,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x1);}['clearErrorState'](){this['_hasError']=!0x1,this['_miniToolbarView']['toggleShowChangesEnabled'](!0x0);}['showError'](_0x4bf02c){super['showError'](_0x4bf02c),this['_dialogContent']['has'](this['_errorView'])||this['_dialogContent']['add'](this['_errorView'],0x0);}['hideError'](){super['hideError'](),this['clearErrorState']();}['showBlockingError'](_0x5ea90c){super['showBlockingError'](_0x5ea90c),this['setErrorState']();}['addMiniToolbarItem'](_0x1fc4a5){this['_miniToolbarView']['items']['has'](_0x1fc4a5)||this['_miniToolbarView']['items']['add'](_0x1fc4a5);}['removeMiniToolbarItem'](_0x5af243){this['_miniToolbarView']['items']['has'](_0x5af243)&&this['_miniToolbarView']['items']['remove'](_0x5af243);}['showLoader'](){this['_loaderView']&&(this['_isLoading']=!0x0);}['hideLoader'](){this['_loaderView']&&(this['_isLoading']=!0x1);}['_toggleToolbarButtonsVisibility']({showApplyButton:_0x2a9e21,showSuggestButton:_0xd43358}){_0x2a9e21=_0x2a9e21&&!this['isTrackChangesOn']&&this['_config']['availableActions']['includes']('applySuggestion'),_0xd43358=_0xd43358&&this['_config']['availableActions']['includes']('insertSuggestion'),this['_toolbarView']['setButtonsVisibility']({'showApplyButton':_0x2a9e21,'showSuggestButton':_0xd43358});}async['updateContent'](_0x5aec37){await this['_streamableContentView']['update'](_0x5aec37);}['finalizeContent'](){this['_streamableContentView']['cleanUpStreamingArtifacts']();}['clearContent'](){this['_streamableContentView']['clear']();}['_addContentWrapper'](_0x43ec30){this['_contentWrapper']=new _0x1e8352(this['locale']),this['_contentWrapper']['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content']},'children':[{'tag':'div','attributes':{'class':['ck-ai-actions-balloon-content-wrapper']},'children':[this['_createLoaderView'](),this['_createStreamableContentView']()]},this['_createMiniToolbar'](_0x43ec30['miniToolbarConfig'])]}),this['_dialogContent']['add'](this['_contentWrapper']);}['_addDisclaimerView'](){this['_disclaimerView']=new Pa(this['locale']),this['_dialogContent']['add'](this['_disclaimerView']);}['_addToolbar']({showApplyButton:_0x416aba,showSuggestButton:_0x14f45a}){this['_toolbarView']=new Da(this['locale'],_0x416aba,_0x14f45a),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',(_0x880efd,_0x47d7b3,_0xc3126f)=>!(_0x880efd||_0x47d7b3||_0xc3126f)),this['_toggleToolbarButtonsVisibility']({'showApplyButton':_0x416aba,'showSuggestButton':_0x14f45a}),this['_dialogContent']['add'](this['_toolbarView']);}['_createMiniToolbar'](_0x26567e){return this['_miniToolbarView']=new ua(this['locale'],_0x26567e),this['_miniToolbarView']['delegate'](...Nn)['to'](this),this['_miniToolbarView']['on']('toggleShowChanges',()=>{this['_miniToolbarView']['isShowChangesOn']=!this['_miniToolbarView']['isShowChangesOn'],this['fire']('toggleSuggestionDisplayMode',{'showDiff':this['_miniToolbarView']['isShowChangesOn']});}),this['_miniToolbarView']['bind']('isEnabled')['to'](this,'isBusy',this,'_isLoading',(_0x55b624,_0x45748b)=>!(_0x55b624||_0x45748b)),this['_miniToolbarView'];}['_createLoaderView'](){return this['_loaderView']=new Ha(this['locale']),this['_loaderView']['bind']('isVisible')['to'](this,'_isLoading'),this['_loaderView'];}['_createStreamableContentView'](){return this['_streamableContentView']=new qn(this['locale']),this['_streamableContentView'];}['_setupMiniToolbarButtons'](){const _0x40e9f2=new Pt(this['locale']),_0x501282=new Pt(this['locale']),_0x4b4645=new Va(this['locale']),_0x52f595=new Pt(this['locale']);_0x40e9f2['set']({'icon':_0x2cd711,'label':ls(this['locale'],'AI_ACTIONS_TRY_AGAIN'),'tooltip':!0x0,'class':'ck-ai-custom-action-button\x20'+cn}),_0x501282['set']({'icon':_0x432064,'tooltip':ls(this['locale'],'AI_ACTIONS_PREVIOUS_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-previous-button\x20'+cn}),_0x52f595['set']({'icon':_0x21ac75,'tooltip':ls(this['locale'],'AI_ACTIONS_NEXT_INTERACTION'),'class':'ck-ai-navigation-button\x20ck-ai-next-button\x20'+cn}),_0x40e9f2['bind']('isEnabled')['to'](this,'isBusy',_0x17ae7d=>!_0x17ae7d),_0x40e9f2['on']('execute',()=>{this['fire']('tryAgain');}),_0x501282['bind']('isEnabled')['to'](this,'isBusy',_0x585159=>!_0x585159),_0x501282['on']('execute',()=>{this['fire']('showPrevious');}),_0x52f595['bind']('isEnabled')['to'](this,'isBusy',_0x25f4c4=>!_0x25f4c4),_0x52f595['on']('execute',()=>{this['fire']('showNext');}),this['_navigationPreviousButton']=_0x501282,this['_navigationCounter']=_0x4b4645,this['_navigationNextButton']=_0x52f595,this['_navigationTryAgainButton']=_0x40e9f2;}['updateMiniToolbarButtons'](_0x54abc2,_0xa3f3d){this['_navigationPreviousButton']||this['_setupMiniToolbarButtons']();const _0x1e6649=_0x54abc2>0x1;if(this['addMiniToolbarItem'](this['_navigationTryAgainButton']),_0x1e6649){this['addMiniToolbarItem'](this['_navigationPreviousButton']),this['addMiniToolbarItem'](this['_navigationCounter']),this['addMiniToolbarItem'](this['_navigationNextButton']);const _0x443ca5=_0x54abc2-_0xa3f3d;this['_navigationCounter']['setInteractionCount'](_0x443ca5+'/'+_0x54abc2),this['_navigationPreviousButton']['isEnabled']=_0xa3f3d<_0x54abc2-0x1,this['_navigationNextButton']['isEnabled']=_0xa3f3d>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'](_0x2ee416){this['_isLoading']=_0x2ee416;}['resetShowChangesButton'](){this['_miniToolbarView']['isShowChangesOn']=!0x1;}['_setupMiniToolbarPositioning'](){const _0x54e448=this['_streamableContentView']['element'],_0x22109e=this['_miniToolbarView']['element'],_0x375741=()=>{Et['window']['requestAnimationFrame'](()=>{const _0x2e559d=_0x54e448['offsetWidth']-_0x54e448['clientWidth'];_0x22109e['style']['right']='calc('+_0x2e559d+'px\x20+\x20var(--ck-spacing-large))';});};_0x375741(),this['_miniToolbarResizeObserver']=new At(_0x54e448,()=>{_0x375741();});}['_initializeScrollManager'](){const _0x3e6e70=this['_getScrollableElement']();_0x3e6e70&&!this['_scrollManager']&&(this['_scrollManager']=new Pr(_0x3e6e70));}['_getScrollableElement'](){return this['_streamableContentView']['element'];}},Va=class extends _0x1e8352{constructor(_0x1d0c93){super(_0x1d0c93);const _0xd4ebea=this['bindTemplate'];this['set']('interactionCount','1/1'),this['setTemplate']({'tag':'span','attributes':{'class':['ck-ai-interaction-counter']},'children':[{'text':_0xd4ebea['to']('interactionCount')}]});}['setInteractionCount'](_0x5b88ed){this['set']('interactionCount',_0x5b88ed);}},Ua=class extends _0x3f2605{static get['requires'](){return[cs,rn,Ht,As,la,_0x5b6f61];}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(_0x1b4887){super(_0x1b4887),this['_aiConnector']=this['editor']['plugins']['get']('AIConnector'),this['_reporter']=this['editor']['plugins']['get'](rn)['createReporter']('aiactions'),this['set']('isBusy',!0x1),this['_promiseQueue']=new Zn();}['stopInteraction'](){this['_stopInteraction']();}async['executeAction'](_0x4ada1a,_0x5ba204,_0x210441){if(this['_stopInteraction'](),this['editor']['plugins']['has']('TableSelection')&&this['editor']['plugins']['get']('TableSelection')['getSelectedTableCells']()){const {modelFragment:_0x3dbed6,anchorData:_0x535ab9,root:_0x2a861a}=this['_getExecuteDataInTable']();return this['_executeAction'](_0x4ada1a,_0x3dbed6,_0x535ab9,_0x2a861a,_0x5ba204,_0x210441);}const {modelFragment:_0x4f40c8,anchorData:_0x3a6e02,root:_0x13e041}=this['_getExecuteDataRegular']();return this['_executeAction'](_0x4ada1a,_0x4f40c8,_0x3a6e02,_0x13e041,_0x5ba204,_0x210441);}async['destroy'](){return this['_stopInteraction'](),super['destroy']();}['_createActionsBalloonView'](){const _0x4a638a=this['editor']['plugins']['has']('TrackChanges');let _0x3661b9=this['editor']['config']['get']('ai.availableReplyActions')||[...er];_0x4a638a||(_0x3661b9=_0x3661b9['filter'](_0x54c9d6=>'insertSuggestion'!=_0x54c9d6));const _0x29dba4=this['editor']['commands']['get']('trackChanges'),_0xba3f2e=new Ma(this['editor']['locale'],{'showApplyButton':!0x0,'showSuggestButton':_0x4a638a,'miniToolbarConfig':{'showChanges':'icon'},'availableActions':_0x3661b9});return _0xba3f2e['bind']('isBusy')['to'](this),_0x29dba4&&_0xba3f2e['bind']('isTrackChangesOn')['to'](_0x29dba4,'value'),_0xba3f2e['on']('tryAgain',()=>{this['_refreshInteraction']();}),_0xba3f2e['on']('showPrevious',()=>{this['_navigateToPrevious']();}),_0xba3f2e['on']('showNext',()=>{this['_navigateToNext']();}),_0xba3f2e;}['_normalizeSelectionStart'](){const _0x3bd339=this['editor']['model'],_0x17c094=_0x3bd339['document']['selection'],_0x3497e8=_0x17c094['getFirstRange']();if(!_0x3497e8||_0x3497e8['isCollapsed'])return;const _0x260c7f=pt(_0x17c094['getSelectedBlocks']());if(!_0x260c7f)return;const _0x346b2e=_0x3bd339['createPositionAt'](_0x260c7f,0x0);_0x346b2e['isAfter'](_0x3497e8['start'])&&_0x3bd339['change'](_0x4ed1cb=>{_0x4ed1cb['setSelection'](_0x4ed1cb['createRange'](_0x346b2e,_0x3497e8['end']));});}['_getExecuteDataRegular'](){const _0x2d843f=this['editor']['model']['document']['selection'],_0x245d2d=_0x2d843f['getFirstRange']()['start']['root'];if(_0x2d843f['isCollapsed']){const _0x5708bf=pt(_0x2d843f['getSelectedBlocks']())||this['editor']['model']['schema']['getLimitElement'](_0x2d843f);this['editor']['model']['change'](_0x3e28c5=>{_0x3e28c5['setSelection'](_0x5708bf,'in');});}this['_normalizeSelectionStart']();const _0x45785b=_0x2d843f['getFirstRange'](),_0x203beb=this['_wrapWithCommonAncestors'](this['editor']['model']['getSelectedContent'](_0x2d843f),_0x45785b['start'],_0x45785b['end']);this['_copyMarkersToFragment'](_0x203beb,_0x2d843f,{'isTableSelection':!0x1});const _0x5a0985=_0x2d843f['getFirstRange']()['start'],_0x52d4fb=new Map();let _0x42f0f7=_0x203beb;for(let _0xc246d2=0x0;_0xc246d2<_0x5a0985['path']['length'];_0xc246d2++)_0x52d4fb['set'](_0x42f0f7,_0x5a0985['path'][_0xc246d2]),_0x42f0f7=_0x42f0f7['getChild'](0x0);return{'modelFragment':_0x203beb,'anchorData':_0x52d4fb,'root':_0x245d2d};}['_getExecuteDataInTable'](){const _0xc8b43e=this['editor']['model']['document']['selection'],_0x1f96d7=this['editor']['plugins']['get']('TableSelection'),_0x59c296=_0xc8b43e['getFirstRange']()['start']['root'],_0x271097=_0x1f96d7['getSelectionAsFragment'](),_0x2a54f0=_0xc8b43e['getFirstRange']()['start']['parent']['parent'],_0x5b58ec=this['editor']['model']['createRange'](this['editor']['model']['createPositionBefore'](_0x2a54f0),this['editor']['model']['createPositionAfter'](_0x2a54f0)),_0x1273c8=this['_wrapWithCommonAncestors'](_0x271097,_0x5b58ec['start'],_0x5b58ec['end']);this['_copyMarkersToFragment'](_0x1273c8,_0xc8b43e,{'isTableSelection':!0x0});const _0xb48120=_0xc8b43e['getFirstRange']()['start'],_0x125d65=new Map();let _0x4efafa=_0x1273c8;for(let _0x2e6ce0=0x0;_0x2e6ce0<_0xb48120['path']['length'];_0x2e6ce0++)if(_0x125d65['set'](_0x4efafa,_0xb48120['path'][_0x2e6ce0]),_0x2e6ce0<_0xb48120['path']['length']-0x1)_0x4efafa=_0x4efafa['getChild'](0x0);else{let _0x4f3312=_0x4efafa['nextSibling'];for(;_0x4f3312;)_0x125d65['set'](_0x4f3312,_0xb48120['path'][_0x2e6ce0]),_0x4f3312=_0x4f3312['nextSibling'];}return{'modelFragment':_0x1273c8,'anchorData':_0x125d65,'root':_0x59c296};}async['_executeAction'](_0x2c8448,_0x293f9a,_0x1801a5,_0x52ce71,_0x3d85ca,_0x18b26f){const _0x425caa=this['editor']['plugins']['get'](As),_0x458b1c=this['editor']['plugins']['get'](la),_0x524104=this['editor']['model']['document']['selection'],_0x19a008=await _0x425caa['modelToDataWithIds'](_0x293f9a,this['editor']),_0xdcea1d=this['editor']['model']['document']['version'],_0x5d7a50=[..._0x524104['getRanges']()];return this['_actionsBalloonView']||(this['_actionsBalloonView']=this['_createActionsBalloonView']()),this['_clearInteractionHistory'](),this['_clearErrorState'](),this['_balloonShowDiff']=!0x1,this['_actionsBalloonView']['resetShowChangesButton'](),this['_actionsBalloonView']['clearContent'](),_0x458b1c['open']({'targetEditor':this['editor'],'index':0x3e8*Math['random']()%0x3e8,'title':_0x3d85ca,'icon':_0x18b26f||_0x4d468f,'mainView':this['_actionsBalloonView'],'class':'ck-ai-actions-balloon','ranges':_0x5d7a50,'id':'aiActionsBalloon'}),this['_setLoadingState'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x458b1c),this['_interactionParams']={'action':_0x2c8448,'content':_0x19a008,'version':_0xdcea1d,'aiBalloon':_0x458b1c,'modelFragment':_0x293f9a,'anchorData':_0x1801a5,'root':_0x52ce71},this['_setupApplyListeners'](),this['listenTo'](_0x458b1c,'selectionRemoved',()=>{this['_stopInteraction'](),this['_actionsBalloonView']['disableMiniToolbarButtons']();}),this['listenTo'](_0x458b1c,'dialogClosed',(_0x5ab191,{id:_0xf35cfd})=>{if('aiActionsBalloon'===_0xf35cfd){for(const _0x9db083 of this['_interactions']){if(0x0===_0x9db083['replies']['length']||_0x9db083['stoppedExplicitly'])continue;const _0x4fbe15=_0x9db083['replies'][_0x9db083['replies']['length']-0x1],_0x39e648=_0x4fbe15['changeGroups'][0x0];_0x39e648&&'pending'===_0x39e648['state']&&_0x4fbe15['setChangeGroupState'](0x0,'rejected');}this['_stopInteraction'](),this['_clearInteractionHistory'](),this['stopListening'](this['_actionsBalloonView']),this['stopListening'](_0x458b1c);}}),this['_createInteraction'](_0x19a008,_0xdcea1d,_0x458b1c,_0x2c8448);}['_setupApplyListeners'](){if(!this['_interactionParams'])return;const {modelFragment:_0x36ed17,anchorData:_0xcb39c4,root:_0x39855d}=this['_interactionParams'];this['listenTo'](this['_actionsBalloonView'],'applySuggestion',()=>{this['_applyChanges'](_0x36ed17,_0xcb39c4,_0x39855d,!0x1);}),this['listenTo'](this['_actionsBalloonView'],'insertSuggestion',()=>{this['_applyChanges'](_0x36ed17,_0xcb39c4,_0x39855d,!0x0);});}['_wrapWithCommonAncestors'](_0x21f557,_0x27812d,_0x2ac529){const _0x56e0b4=this['editor']['model']['createRange'](_0x27812d,_0x2ac529)['getCommonAncestor'](),_0x6810f9=_0x56e0b4['is']('documentFragment')?[]:_0x56e0b4['getAncestors']({'includeSelf':!0x0})['slice'](0x1);if(_0x6810f9['length']){const _0x1be7df=_0x6810f9['map'](_0x3b5bdb=>_0x3b5bdb['_clone'](!0x1));for(let _0x4b2608=0x1;_0x4b2608<_0x1be7df['length'];_0x4b2608++)_0x1be7df[_0x4b2608-0x1]['_appendChild'](_0x1be7df[_0x4b2608]);return _0x1be7df[_0x1be7df['length']-0x1]['_appendChild'](_0x21f557),new _0x500fd6(_0x1be7df[0x0]);}return _0x21f557;}['_copyMarkersToFragment'](_0x43fce3,_0x4020c7,_0x56cb65={'isTableSelection':!0x1}){const _0x3c6f7e=this['editor']['model'],_0x1f8573=Array['from'](_0x4020c7['getRanges']()),_0x32b71b=_0x4020c7['getFirstRange']()['start'];for(const _0x1c0867 of _0x3c6f7e['markers']){if(_0x1c0867['name']['startsWith']('ai-selection')||!_0x1c0867['affectsData'])continue;const _0xd9d450=_0x1c0867['getRange']();if(!_0x1f8573['some'](_0x5cc7cc=>_0x5cc7cc['containsRange'](_0xd9d450,!0x0)))continue;const _0x16e1ae=this['_regularCalculateMarkerPath'](_0xd9d450['start'],_0x32b71b,_0x56cb65['isTableSelection']),_0x4e8953=this['_regularCalculateMarkerPath'](_0xd9d450['end'],_0x32b71b,_0x56cb65['isTableSelection']),_0xe7ae0=_0x3c6f7e['createPositionFromPath'](_0x43fce3,_0x16e1ae),_0x27817a=_0x3c6f7e['createPositionFromPath'](_0x43fce3,_0x4e8953);if(!_0xe7ae0['isEqual'](_0x27817a)){const _0x4b9419=_0x3c6f7e['createRange'](_0xe7ae0,_0x27817a);_0x43fce3['markers']['set'](_0x1c0867['name'],_0x4b9419);}}}['_regularCalculateMarkerPath'](_0x59a059,_0x37efc7,_0x5e2529=!0x1){const _0x2b68d9=[..._0x59a059['path']['slice']()];for(let _0x698f0=0x0;_0x698f0<Math['max'](_0x37efc7['path']['length'],_0x59a059['path']['length']);_0x698f0++){const _0x32436f=_0x37efc7['path'][_0x698f0]||0x0,_0xc77e00=(_0x59a059['path'][_0x698f0]||0x0)-_0x32436f;if(_0x2b68d9[_0x698f0]=_0xc77e00,0x0!==_0xc77e00&&!_0x5e2529)break;}return _0x2b68d9;}async['_createInteraction'](_0x3eb6e9,_0x5ebb58,_0x271f09,_0xf0af45){const _0x426af9=this['editor'],_0x1bdcc7=_0x426af9['model']['document']['selection']['getFirstRange']()['start']['root'];this['_interactionParams']||(this['_interactionParams']={'action':_0xf0af45,'content':_0x3eb6e9,'version':_0x5ebb58,'aiBalloon':_0x271f09,'modelFragment':this['editor']['model']['getSelectedContent'](this['editor']['model']['document']['selection']),'anchorData':new Map(),'root':_0x1bdcc7});const _0x4c4d4d=new La({'connector':this['_aiConnector'],'locale':_0x426af9['locale'],'content':_0x3eb6e9,'version':_0x5ebb58,'editor':_0x426af9,'rootName':_0x1bdcc7['rootName'],..._0xf0af45});this['_interactions']['push'](_0x4c4d4d);const _0x1021ea=(_0x132e4d,_0x36aa22=!0x1,_0xea723e='streaming')=>{const {isDone:_0x48473b}=_0x132e4d;return this['_promiseQueue']['enqueue'](async _0x5dba6b=>{try{const _0x279f9a=Us({'changeGroups':_0x132e4d['changeGroups'],'documentContextContent':_0x132e4d['documentContextContent'],'showDiff':_0x36aa22,'trimUnchanged':!0x1});_0x279f9a['length']&&await this['_actionsBalloonView']['updateContent']({'part':_0x279f9a[0x0],'renderingStrategy':_0xea723e,'abortSignal':_0x5dba6b}),_0x48473b&&this['_actionsBalloonView']['finalizeContent']();}catch(_0x2c6a1c){if(sn(_0x2c6a1c))return;throw _0x2c6a1c;}});};_0x4c4d4d['on']('replyCreated',(_0x248ce6,_0x2852a2)=>{this['_actionsBalloonView']['hideLoader'](),this['_actionsBalloonView']['startAutoScroll'](),_0x1021ea(_0x2852a2)['catch'](_0xf11957=>{this['_reporter']['logError'](_0xf11957,{'context':{'operation':'reply-create'}}),this['_setErrorState'](_0x4c4d4d,_0xf11957);});}),_0x4c4d4d['on']('replyContentUpdated',(_0x25b44c,_0x54cd77)=>{_0x1021ea(_0x54cd77)['catch'](_0x5e7fcd=>{this['_reporter']['logError'](_0x5e7fcd,{'context':{'operation':'reply-update'}}),this['_setErrorState'](_0x4c4d4d,_0x5e7fcd);});}),_0x4c4d4d['on']('interactionFinished',async()=>{try{await this['_clearLoadingState'](),this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),await this['_promiseQueue']['queueEmptyPromise'];}catch(_0x1464a8){this['_reporter']['logError'](_0x1464a8,{'context':{'operation':'interaction-finish'}}),this['_setErrorState'](_0x4c4d4d,_0x1464a8);}finally{this['_actionsBalloonView']['stopAutoScroll']();}}),this['listenTo'](this['_actionsBalloonView'],'toggleSuggestionDisplayMode',async(_0x2f84ac,{showDiff:_0x4351df})=>{try{this['_balloonShowDiff']=_0x4351df;const _0xdc2628=this['_interaction']['replies'][this['_interaction']['replies']['length']-0x1];_0xdc2628&&await _0x1021ea(_0xdc2628,_0x4351df,'static');}catch(_0x48226f){this['_reporter']['logError'](_0x48226f,{'context':{'operation':'toggle-suggestion-display'}}),this['_setErrorState'](_0x4c4d4d,_0x48226f);}}),_0x4c4d4d['on']('replyChangeGroupStateUpdated',()=>{const _0x1a819c={'positiveCount':_0x4c4d4d['replies']['reduce']((_0x423d2d,_0x15f8ad)=>_0x423d2d+_0x15f8ad['changeGroups']['filter'](_0x56e3b9=>'accepted'===_0x56e3b9['state'])['length'],0x0),'totalCount':_0x4c4d4d['replies']['reduce']((_0x3f494a,_0x42180f)=>_0x3f494a+_0x42180f['changeGroups']['length'],0x0)},_0x48fad9=_0x4c4d4d['actionCallId'],_0x45e54b=_0x4c4d4d['actionName'];_0x45e54b?this['_aiConnector']['upsertAIActionRating'](_0x45e54b,_0x48fad9,_0x1a819c):this['_aiConnector']['upsertCustomAIActionRating'](_0x48fad9,_0x1a819c);}),this['_setLoadingState']();try{const _0x3de024=await _0x4c4d4d['start']();return this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']),_0x3de024;}catch(_0x1e15c2){sn(_0x1e15c2)||this['_actionsBalloonView']['hideLoader'](),this['_reporter']['logError'](_0x1e15c2,{'context':{'operation':'create-interaction'}}),this['_setErrorState'](_0x4c4d4d,_0x1e15c2);}}['_applyChanges'](_0x54526f,_0x1aef83,_0xffa261,_0x17c9f2){const _0x322c4b=this['editor'];if(_0x17c9f2&&!_0x322c4b['plugins']['has']('TrackChanges'))throw new at('ai-no-track-changes',null);const _0x10c4da=this['editor']['plugins']['get'](_0x5b6f61),_0x25be9d=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x25be9d||!_0x25be9d['replies']['length'])return;const _0x22de5e=_0x25be9d['replies'][_0x25be9d['replies']['length']-0x1];_0x22de5e['setChangeGroupState'](0x0,'accepted');const _0x4b3b19=ks({'documentSuggestions':On({'groups':[_0x22de5e['changeGroups'][0x0]],'documentContextContent':_0x22de5e['documentContextContent'],'documents':_0x25be9d['getDocumentContext']()['documents']}),'transform':!0x1,'documentCompare':_0x10c4da,'documentCompareOptions':{'anchor':_0x322c4b['model']['createPositionAt'](_0x54526f,0x0),'markDeletions':_0x17c9f2}})['values']()['next']()['value']??[],_0x51df6a=this['_filterOperationsOutsideRange'](_0x4b3b19,_0x1aef83);for(const _0x4ad69b of _0x51df6a)this['_anchorOperation'](_0x1aef83,_0x4ad69b,_0xffa261);const _0x5245a8=_0x25be9d['getDocumentContext']()['documents'][0x0]['version'],_0x1513d0=_0x30647f(_0x51df6a,_0x322c4b['model']['document']['history']['getOperations'](_0x5245a8),{'document':_0x322c4b['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];js(_0x1513d0,'quickActions');try{_0x322c4b['model']['change'](_0x3ba1f1=>{if(_0x3ba1f1['setSelection'](_0x322c4b['model']['document']['selection']['focus']),_0x17c9f2)_0x322c4b['plugins']['get']('TrackChangesEditing')['_applyOperationsAsSuggestions'](_0x1513d0);else{for(const _0x508288 of _0x1513d0)_0x508288['baseVersion']=_0x322c4b['model']['document']['version'],Ns(_0x322c4b,_0x508288),_0x3ba1f1['batch']['addOperation'](_0x508288),_0x322c4b['model']['applyOperation'](_0x508288);}});}catch(_0x3c3245){throw this['_reporter']['logError'](new nn({'code':'ai-applying-suggestion-failed','type':'runtime','cause':_0x3c3245})),_0x3c3245;}this['editor']['plugins']['get']('AIBalloon')['close']();}['_filterOperationsOutsideRange'](_0x4be77d,_0x2959c4){return _0x4be77d['filter'](_0x4310a0=>{if('rename'==_0x4310a0['type']){const _0x2a458f=_0x4310a0['position']['nodeAfter'];return!_0x2959c4['has'](_0x2a458f);}if(_0x4310a0['type']['indexOf']('Attribute')>-0x1){const _0x428064=_0x4310a0['range']['start']['nodeAfter'];return!_0x2959c4['has'](_0x428064);}return!0x0;});}['_anchorOperation'](_0x509a8b,_0x40fe9f,_0x2afed6){const _0x1a7d58=_0x40fe9f['clone']();for(const _0x53c44e in _0x40fe9f){const _0x9aa023=_0x40fe9f[_0x53c44e];_0x9aa023 instanceof _0x15a2ab?_0x40fe9f[_0x53c44e]=new _0x15a2ab(_0x337aa9(_0x9aa023['start']),_0x337aa9(_0x9aa023['end'])):_0x9aa023 instanceof _0x34d4d5&&(_0x40fe9f[_0x53c44e]=_0x337aa9(_0x9aa023));}if(['insert','move','remove','reinsert','split','merge']['includes'](_0x1a7d58['type'])){if(_0x1a7d58['isDocumentOperation']=!0x1,_0x1a7d58['baseVersion']=null,'remove'==_0x1a7d58['type']){const _0x4582ba=_0x1a7d58['sourcePosition'],_0x5930f3=_0x1a7d58['howMany'];new _0x39d5b2(_0x4582ba,_0x5930f3)['_execute']();}else _0x1a7d58['_execute']();}function _0x337aa9(_0x2f6826){if('$graveyard'==_0x2f6826['root']['rootName'])return _0x2f6826;const _0x1e6b2a=[];let _0x221254=_0x2f6826['root'];for(let _0x410d37=0x0;_0x410d37<_0x2f6826['path']['length'];_0x410d37++){const _0x4c2b0c=_0x509a8b['get'](_0x221254)||0x0;_0x1e6b2a[_0x410d37]=_0x2f6826['path'][_0x410d37]+_0x4c2b0c,_0x221254=_0x221254['getChildAtOffset'](_0x2f6826['path'][_0x410d37]);}return new _0x34d4d5(_0x2afed6,_0x1e6b2a,_0x2f6826['stickiness']);}}['_refreshInteraction'](){if(!this['_interactionParams'])return;this['_interactions']['length']>0x0&&this['_stopInteraction'](),this['_currentInteractionIndex']=0x0,this['_balloonShowDiff']=!0x1;const {action:_0x130a61,content:_0x7b7bf4,version:_0x52faf7,aiBalloon:_0x40b3e7}=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'](_0x7b7bf4,_0x52faf7,_0x40b3e7,_0x130a61)['catch'](_0x56234e=>{this['_reporter']['logError'](_0x56234e,{'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 _0x421594=this['_interactions']['length'];this['_currentInteractionIndex']<_0x421594-0x1&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']+0x1);}['_navigateToNext'](){this['_currentInteractionIndex']>0x0&&this['_displayInteractionAtIndex'](this['_currentInteractionIndex']-0x1);}async['_displayInteractionAtIndex'](_0x5755b8){if(!this['_interactionParams'])return;this['_currentInteractionIndex']=_0x5755b8;const _0x257079=this['_interactions'][this['_interactions']['length']-0x1-this['_currentInteractionIndex']];if(!_0x257079)return;if(_0x257079['hasError'])return this['_setErrorState'](_0x257079),void this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);if(!_0x257079['replies']['length'])return;this['_actionsBalloonView']['hideError'](),this['_interactionParams']&&this['_clearErrorState']();const _0x8af096=_0x257079['replies'][_0x257079['replies']['length']-0x1];if(_0x8af096)try{const _0x41befc=Us({'changeGroups':_0x8af096['changeGroups'],'documentContextContent':_0x8af096['documentContextContent'],'showDiff':this['_balloonShowDiff'],'trimUnchanged':!0x1});await new Promise(_0xb55e1=>setTimeout(_0xb55e1,0x32)),await this['_actionsBalloonView']['updateContent']({'part':_0x41befc[0x0],'renderingStrategy':'static','abortSignal':new AbortController()['signal']});}catch(_0x2c38f1){this['_reporter']['logError'](_0x2c38f1,{'context':{'operation':'navigation-update'}});}this['_actionsBalloonView']['updateMiniToolbarButtons'](this['_interactions']['length'],this['_currentInteractionIndex']);}['_setLoadingState'](){this['_actionsBalloonView']['setIsLoading'](!0x0),this['isBusy']=!0x0;}async['_setErrorState'](_0xf3087f,_0x435035){if(void 0x0!==_0x435035&&sn(_0x435035))return;const _0x47a7f8=ls(this['editor']['locale'],'AI_ACTIONS_GENERIC_ERROR');this['_actionsBalloonView']['showError'](_0x47a7f8),_0xf3087f['hasError']=!0x0,await this['_promiseQueue']['queueEmptyPromise'],this['_actionsBalloonView']['setErrorState'](),this['_actionsBalloonView']['toggleIsLoading'](!0x0);}['_clearErrorState'](){this['_actionsBalloonView']['hideError'](),this['_actionsBalloonView']['toggleIsLoading'](!0x1);}async['_clearLoadingState'](){await this['_promiseQueue']['queueEmptyPromise'],this['isBusy']=!0x1,this['_actionsBalloonView']['setIsLoading'](!0x1);}},Ba=class extends _0x3f2605{static get['requires'](){return[Oa,ya,Ua];}static get['pluginName'](){return'AIQuickActions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2c162a){super(_0x2c162a),_0x2c162a['config']['define']('ai.quickActions',{'extraCommands':[],'removeCommands':[],'isSearchEnabled':!0x0});}},Ga=class extends _0x1e8352{['resultResponseView'];['acceptButtonView'];['dismissButtonView'];['infoButtonView'];['outdatedButtonView'];constructor(_0x5efbe5,_0x2aa52c){super(_0x5efbe5),this['id']=_0x2aa52c,this['set']('status','pending'),this['set']('changeId',_0x2aa52c),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',(_0x2fc4f6,_0x1a6a9e)=>{_0x1a6a9e&&_0x1a6a9e['target']&&'A'===_0x1a6a9e['target']['tagName']&&_0x1a6a9e['preventDefault'](),this['fire']('activateChange',{'id':_0x2aa52c,'source':this,'uiInteraction':'click'});}),this['on']('mouseover',()=>{this['fire']('activateChange',{'id':_0x2aa52c,'source':this,'uiInteraction':'hover'});}),this['on']('mouseout',()=>{this['fire']('deactivateChange',{'origin':'panel','id':_0x2aa52c,'source':this});});}['setItemAsActive'](){this['isActive']=!0x0;}['setItemAsInactive'](){this['isActive']=!0x1;}['_createResultResponseView'](){const _0x369e38=new _0x1e8352(this['locale']);return _0x369e38['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-content','ck-reset_all-excluded','ck-ai_review__check-run-result-response',this['bindTemplate']['if']('showDiff','ck-hidden',_0x449242=>!_0x449242)]}}),_0x369e38;}['_createAcceptButtonView'](){const _0x1e4197=new Pt(this['locale']);return _0x1e4197['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_ACCEPT_CHANGE'),'withText':!0x0}),_0x1e4197['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x55a27d=>{this['fire']('acceptChange',{'id':this['changeId']}),_0x55a27d['stopPropagation']();})},'attributes':{'class':[this['bindTemplate']['if']('status','ck-hidden',_0x484cb3=>'pending'!==_0x484cb3&&'accepted'!==_0x484cb3),this['bindTemplate']['if']('status',hn,_0x38f301=>'pending'===_0x38f301),this['bindTemplate']['if']('status',cn,_0x793b2c=>'pending'!==_0x793b2c),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x3020be=>'accepted'===_0x3020be)]}}),this['on']('change:status',(_0x3b8510,_0x13db90,_0xe53259)=>{_0x1e4197['isEnabled']='pending'===_0xe53259,'accepted'===_0xe53259&&(_0x1e4197['label']=ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_ACCEPTED'),_0x1e4197['icon']=_0x7ff926);}),_0x1e4197;}['_createDismissButtonView'](){const _0x4cdc10=new Pt(this['locale']);return _0x4cdc10['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_DISMISS_CHANGE'),'withText':!0x0}),_0x4cdc10['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1d7a27=>{this['fire']('dismissChange',{'id':this['changeId']}),_0x1d7a27['stopPropagation']();})},'attributes':{'class':[cn,this['bindTemplate']['if']('status','ck-hidden',_0xda997d=>'pending'!==_0xda997d&&'rejected'!==_0xda997d),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-dismiss-button',_0x4b1a76=>'pending'===_0x4b1a76),this['bindTemplate']['if']('status','ck-ai_review__check-run-result-status-button',_0x1c108c=>'rejected'===_0x1c108c)]}}),this['on']('change:status',(_0x95c92d,_0x37ac87,_0x2b2329)=>{_0x4cdc10['isEnabled']='pending'===_0x2b2329,'rejected'===_0x2b2329&&(_0x4cdc10['label']=ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_REJECTED'),_0x4cdc10['icon']=_0x556600);}),_0x4cdc10;}['_createInfoButtonView'](){const _0xa1a198=new Pt(this['locale']);return _0xa1a198['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_LEARN_MORE'),'icon':_0x220b4a,'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox','class':cn+'\x20ck-ai_review__check-run-result-info-button\x20ck-hidden'}),_0xa1a198['bind']('isOn')['to'](this,'isInfoToggleOn',_0x4b415e=>_0x4b415e),_0xa1a198['on']('execute',()=>{this['isInfoToggleOn']=!this['isInfoToggleOn'];}),_0xa1a198;}['_createOutdatedButtonView'](){const _0x2a3edd=new Pt(this['locale']);return _0x2a3edd['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_CHECK_STATUS_OUTDATED'),'icon':_0x21ac9b,'withText':!0x0,'isEnabled':!0x1}),_0x2a3edd['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-result-status-button',this['bindTemplate']['if']('status','ck-hidden',_0x1f693d=>'outdated'!==_0x1f693d)],'disabled':'disabled'}}),_0x2a3edd;}},Fa=class extends Nt{['resultItemView'];['_pinnedRectIndex']=void 0x0;['_pinnedTargetElement']=void 0x0;['_pinnedTargetChangeId']=void 0x0;constructor(_0x2eeaf8,_0x1c920d){super(_0x2eeaf8),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']()),_0x1c920d['add'](this);}['render'](){super['render'](),this['_setupClickOutsideHandler']();}['updateContent'](_0x413aff){this['resultItemView']['changeId']=_0x413aff['id'],this['resultItemView']['resultResponseView']['element']['innerHTML']=_0x413aff['contentDiffed'];}['showBalloon'](_0x2f9733,_0x2b5c36,_0x119400,_0x296682,_0x355ba8,_0x39dc10){const _0x418ae4=_0x2b5c36();if(!_0x418ae4)return;this['updateContent'](_0x2f9733),this['show']();const _0x6437f5=Array['from'](_0x418ae4['getClientRects']())['reverse'](),_0x336f63=this['_getPointedRectIndexFromEvent'](_0x119400,_0x6437f5),_0x1c6967=_0x6437f5[_0x336f63??0x0];'click'===_0x296682?(this['isDiffActive']=!0x0,this['pin']({'target':()=>this['_getBestRectPositionOnClick'](_0x2b5c36(),_0x336f63,_0x2f9733['id'],_0x355ba8,_0x39dc10)||_0x1c6967})):'hover'===_0x296682&&(this['isDiffActive']=!0x1,this['pin']({'target':()=>this['_getBestRectPositionOnHover'](_0x2b5c36(),_0x336f63,_0x2f9733['id'])||_0x1c6967}));}['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'](){_0x262419({'emitter':this,'activator':()=>this['isVisible'],'contextElements':()=>{const _0xeb1436=[this['element']];return this['_pinnedTargetElement']&&_0xeb1436['push'](this['_pinnedTargetElement']),_0xeb1436;},'callback':()=>{this['hide'](),this['unpin'](),this['deactivateChange'](),this['_pinnedTargetElement']=void 0x0,this['_pinnedRectIndex']=void 0x0,this['_pinnedTargetChangeId']=void 0x0;}});}['_createContentView'](){const _0x554617=new _0x1e8352();return this['resultItemView']=new Ga(this['locale'],''),this['resultItemView']['resultResponseView']['extendTemplate']({'attributes':{'class':['ck-content']}}),this['resultItemView']['delegate']('acceptChange','dismissChange')['to'](this),_0x554617['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']]}]}),_0x554617;}['_getBestRectPositionOnClick'](_0x25303a,_0x4b7aa5,_0xe2311b,_0x2dc099,_0x5c5c72){if(!_0x25303a)return null;const _0x1974c9=this['position']['replace']('arrow_',''),_0x17b104=Array['from'](_0x25303a['getClientRects']());let _0x466235,_0x383832=_0x17b104['reverse']();return void 0x0!==_0x4b7aa5&&this['_isPinnedRectVisible'](_0x383832[_0x4b7aa5],_0x2dc099,_0x5c5c72)?(_0x466235=_0x383832[_0x4b7aa5],this['_pinnedRectIndex']=_0x4b7aa5):this['_isPinnedRectVisible'](_0x383832[0x0],_0x2dc099,_0x5c5c72)&&void 0x0===_0x4b7aa5?_0x466235=_0x383832[0x0]:(_0x383832='s'==_0x1974c9[0x0]?[..._0x17b104]['reverse']():_0x17b104,_0x383832['forEach'](_0x17feaf=>{this['_isPinnedRectVisible'](_0x17feaf,_0x2dc099,_0x5c5c72)&&(_0x466235=_0x17feaf);})),this['_pinnedTargetChangeId']=_0xe2311b,this['_pinnedTargetElement']=_0x25303a,_0x466235||_0x25303a['getBoundingClientRect']();}['_getBestRectPositionOnHover'](_0x7184c3,_0x434eb2,_0x4675eb){if(!_0x7184c3)return null;const _0x39f73e=Array['from'](_0x7184c3['getClientRects']())['reverse']();return void 0x0===this['_pinnedRectIndex']&&void 0x0!==_0x434eb2&&this['_pinnedTargetChangeId']!==_0x4675eb?(this['_pinnedRectIndex']=_0x434eb2,this['_pinnedTargetElement']=_0x7184c3,this['_pinnedTargetChangeId']=_0x4675eb,_0x39f73e[_0x434eb2]):void 0x0!==this['_pinnedRectIndex']&&this['_pinnedTargetChangeId']===_0x4675eb?_0x7184c3!==this['_pinnedTargetElement']?Array['from'](this['_pinnedTargetElement']['getClientRects']())['reverse']()[this['_pinnedRectIndex']]:_0x39f73e[this['_pinnedRectIndex']]:void 0x0!==_0x434eb2&&this['_pinnedTargetChangeId']!==_0x4675eb?(this['_pinnedRectIndex']=_0x434eb2,this['_pinnedTargetElement']=_0x7184c3,this['_pinnedTargetChangeId']=_0x4675eb,_0x39f73e[_0x434eb2]):_0x7184c3['getBoundingClientRect']();}['_getPointedRectIndexFromEvent'](_0x128959,_0x14560f){if(_0x128959)for(let _0x52206a=0x0;_0x52206a<_0x14560f['length'];_0x52206a++){const _0x1ae139=_0x14560f[_0x52206a];if(_0x128959['clientX']>=_0x1ae139['left']-0x3&&_0x128959['clientX']<=_0x1ae139['right']+0x3&&_0x128959['clientY']>=_0x1ae139['top']-0x3&&_0x128959['clientY']<=_0x1ae139['bottom']+0x3)return _0x52206a;}}['_isPinnedRectVisible'](_0x33ac5e,_0xf2f2a7,_0x1abc05){const _0x1f5988=new gt(_0x33ac5e),_0x2e5f25=_0xf2f2a7||document['documentElement'],_0x241eb5=_0x1f5988['getIntersection'](mt(_0x1abc05)),_0xc4abaf=new gt(_0x2e5f25)['getIntersection'](_0x1f5988);return!!(_0x241eb5&&_0xc4abaf&&_0x1f5988['width']>0x0);}};const Ka=['getReviewCheckList','runReviewCheck','abortReviewStream','toggleDiff','acceptAllChanges','leaveReviewCoreResultList','activateChange','deactivateChange','acceptChange','dismissChange','learnMore','finishReview','retryReview'];var Wa=class extends _0x2d0760{['_mainView'];['_balloonSuggestionView'];['_bodyCollection'];static get['requires'](){return[hs];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x241005){super(_0x241005),this['_bodyCollection']=un(this['context']['locale']),this['_mainView']=this['createMainView'](),this['_mainView']['delegate'](...Ka)['to'](this),this['_balloonSuggestionView']=new Fa(this['context']['locale'],this['_bodyCollection']),this['_balloonSuggestionView']['delegate']('acceptChange','dismissChange','deactivateChange')['to'](this);}['init'](){const _0x4d28d6=this['context']['plugins']['get']('AITabs');this['registerTab'](_0x4d28d6);}['destroy'](){this['_bodyCollection']['detachFromDom'](),super['destroy']();}['setAvailableChecks'](_0xe5f25a){if(!this['_mainView']['reviewCheckListView']['hasChecks']()){const _0x606b12=!this['context']['config']['get']('ai.models.showModelSelector');this['_mainView']['reviewCheckListView']['setChecks'](_0xe5f25a,_0x606b12);}this['_mainView']['showReviewCheckListView']();}['showReviewCheckList'](){this['fire']('getReviewCheckList');}['showCheckRunResults'](_0x34d258){_0x34d258&&('error-general'!==_0x34d258['status']?'error-chunk'!==_0x34d258['status']?this['_mainView']['showReviewCheckResultsView']():this['showChunkErrorView']():this['showGeneralResultsErrorView']());}['showCheckRunResult'](_0x446373){this['_mainView']['addCheckRunResult'](_0x446373);}['showGeneralResultsErrorView'](){this['_mainView']['showGeneralResultsErrorView']();}['showGeneralReviewCoreErrorView'](_0xbd8c89){this['_mainView']['showGeneralReviewCoreErrorView'](_0xbd8c89??ls(this['context']['locale'],'AI_REVIEW_INITIALIZATION_ERROR_MESSAGE'));}['showChunkErrorView'](){this['_mainView']['showChunkErrorView']();}['setCheckResultTitle'](_0x1decc9,_0x2a4e85){this['_mainView']['reviewCheckResultsView']['setTitle'](_0x1decc9,_0x2a4e85);}['setActiveStateInResults'](_0x58049c){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x470498=>{_0x470498['id']===_0x58049c&&_0x470498['setItemAsActive']();});}['resetActiveStateInResults'](){this['_mainView']['reviewCheckResultsView']['getResults']()['forEach'](_0x8d9a2e=>_0x8d9a2e['setItemAsInactive']());}['updateChangeState'](_0x4432fa,_0x15f9ae){'accepted'===_0x15f9ae||'rejected'===_0x15f9ae||'outdated'===_0x15f9ae?this['_mainView']['reviewCheckResultsView']['hideResult'](_0x4432fa,_0x15f9ae):this['_mainView']['reviewCheckResultsView']['showResult'](_0x4432fa,_0x15f9ae);}['showReviewCompletedView'](){this['_mainView']['showReviewCompletedView']();}['showActionsWhenResultIsReady'](){this['_mainView']['showActionsWhenResultIsReady']();}['showNoChangesView'](){this['_mainView']['showNoChangesView']();}['hideActionsWhenResultIsReady'](){this['_mainView']['hideActionsWhenResultIsReady']();}['showChangeBalloon'](_0x487be2,_0x559885,_0x3abe54,_0x32e156,_0x349490,_0x41a9d3){this['_balloonSuggestionView']['showBalloon'](_0x487be2,_0x559885,_0x3abe54,_0x32e156,_0x349490,_0x41a9d3);}['hideChangeBalloon'](){this['_balloonSuggestionView']['hideBalloon']();}['hideDiffInBalloon'](){this['_balloonSuggestionView']['hideDiffInBalloon']();}['showDiffInBalloon'](){this['_balloonSuggestionView']['showDiffInBalloon']();}['getChangeElement'](_0x16963a){const _0x392a12=this['_mainView']['reviewCheckResultsView']['getResults']()['find'](_0x4cf1a2=>_0x4cf1a2['id']===_0x16963a);return _0x392a12?_0x392a12['element']:null;}['deactivateChange'](){this['_balloonSuggestionView']['deactivateChange']();}},Ya=class extends _0x1e8352{constructor(_0x55462e){super(_0x55462e),this['set']('isVisible',!0x1),this['set']('errorMessage','');const _0x219cb3=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__general-error-container',_0x219cb3['if']('isVisible','ck-hidden',_0x398350=>!_0x398350)]},'children':[{'tag':'p','attributes':{'class':'ck\x20ck-ai-notification\x20ck-ai-notification_error'},'children':[{'text':_0x219cb3['to']('errorMessage')}]}]});}},$a=class extends _0x1e8352{['reviewCoreHeader'];['generalErrorView'];['reviewCheckListView'];['reviewCheckResultsView'];['reviewCompletedView'];constructor(_0x1a0c6f,_0x48f369){super(_0x1a0c6f),this['reviewCoreHeader']=_0x48f369['header'],this['generalErrorView']=new Ya(_0x1a0c6f),this['reviewCheckListView']=_0x48f369['list'],this['reviewCheckListView']['delegate'](...Ka)['to'](this),this['reviewCheckResultsView']=_0x48f369['results'],this['reviewCheckResultsView']['delegate'](...Ka)['to'](this),this['reviewCompletedView']=_0x48f369['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'](_0xed1a5a){this['reviewCheckResultsView']['addResult'](_0xed1a5a),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'](_0x115fba){this['generalErrorView']['set']('isVisible',!0x0),this['generalErrorView']['errorMessage']=_0x115fba;}['showGeneralResultsErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showGeneralErrorMessage']();}['showChunkErrorView'](){this['reviewCheckResultsView']['set']('isLoading',!0x1),this['showActionsWhenResultIsReady'](),this['reviewCheckResultsView']['showChunkErrorMessage']();}},qa=class extends Pt{constructor(_0x46d3df,_0x22dfd3){super(_0x22dfd3),this['set']({'label':_0x46d3df,'withText':!0x0,'class':an}),this['on']('execute',()=>{this['fire']('finishReview');});}},Qa=class extends Xt{['_resultViews'];['_resultsHeader'];['_resultsBody'];['reviewDisclaimer'];['_cancelButtonView'];['_acceptAllButtonView'];['_exitReviewButtonView'];['_toggleDiffButtonView'];['_errorMessageView'];['_finishReviewButtonView'];['_contents'];constructor(_0x3cba01,_0x2dbf2d){super(_0x3cba01),this['_contents']=_0x2dbf2d,this['_resultViews']=new _0x14141a(),this['_cancelButtonView']=this['_createCancelButtonView'](),this['_acceptAllButtonView']=this['_createAcceptAllButtonView'](),this['_exitReviewButtonView']=this['_createExitReviewButtonView'](),this['_toggleDiffButtonView']=this['_createToggleDiffButtonView'](),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](),this['_resultsHeader']=this['_createResultHeaderView'](),this['_resultsBody']=this['_createResultsBodyView'](),this['_errorMessageView']=this['_createErrorView'](),this['reviewDisclaimer']=new Mo(_0x3cba01),this['set']('isLoading',!0x1),this['set']('isToggleDiffOn',!0x1),this['set']('isResultReady',!0x1),this['set']('headerTitle',''),this['set']('headerSubtitle',''),this['set']('isError',!0x1),this['set']('showErrorMessage',!0x1),this['set']('errorType','general'),this['set']('isCompleted',!0x1);const _0xa6ed59=this['_createCombinedSkeletonLoader'](),_0xaf8bc2=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run',_0xaf8bc2['if']('isLoading','ck-ai_review__check-run_loading',_0x4dc51b=>_0x4dc51b),_0xaf8bc2['if']('isResultReady','ck-ai_review__check-run_ready',_0x283e8f=>_0x283e8f),_0xaf8bc2['if']('isVisible','ck-hidden',_0x10eb40=>!_0x10eb40)]},'children':[this['_resultsHeader'],this['_errorMessageView'],this['_resultsBody'],_0xa6ed59,this['reviewDisclaimer']]});}['clearResults'](){this['_resultViews']['clear'](),this['_resultsBody']['element']&&(this['_resultsBody']['element']['scrollTop']=0x0);}['getResults'](){return this['_resultViews'];}['addResult'](_0x1b1cb4){const _0x22a686=new Ga(this['locale'],_0x1b1cb4['id']);_0x22a686['delegate']('acceptChange','dismissChange','activateChange','deactivateChange')['to'](this),this['_resultViews']['add'](_0x22a686),_0x22a686['resultResponseView']['element']['innerHTML']=_0x1b1cb4['contentDiffed'];}['hideResult'](_0x44bc10,_0x2814ed){if('pending'===_0x2814ed)return;const _0xf688df=this['_resultViews']['find'](_0x357216=>_0x357216['id']===_0x44bc10);_0xf688df&&(_0xf688df['status']=_0x2814ed,_0xf688df['element']?.['classList']['add']('ck-ai_review__check-run-result_grayout'));}['showResult'](_0x128fe5,_0x2f00ba){if('pending'!==_0x2f00ba)return;const _0x5c896e=this['_resultViews']['find'](_0x4b4254=>_0x4b4254['id']===_0x128fe5);_0x5c896e&&(_0x5c896e['status']=_0x2f00ba,_0x5c896e['element']?.['classList']['remove']('ck-ai_review__check-run-result_grayout'));}['setTitle'](_0x1aa5d0,_0x6a195d){this['headerTitle']=_0x1aa5d0,this['headerSubtitle']=_0x6a195d||'';}['showChunkErrorMessage'](){this['errorType']='chunk',this['showErrorMessage']=!0x0;}['showGeneralErrorMessage'](){this['isError']=!0x0,this['errorType']='general',this['showErrorMessage']=!0x0;}['resetErrorState'](){this['isError']=!0x1,this['errorType']='general',this['showErrorMessage']=!0x1;}['_createSkeletonLoader'](){return new Xn(this['locale'],zn['aiReviewChecks']);}['_createCombinedSkeletonLoader'](){const _0x18dfb1=new _0x1e8352(this['locale']),_0xd24b53=[];for(let _0x296f1b=0x0;_0x296f1b<0x10;_0x296f1b++){const _0x49209d=this['_createSkeletonLoader']();_0x49209d['extendTemplate']({'attributes':{'class':['ck-ai_review__check-run-skeleton-item']}}),_0xd24b53['push'](_0x49209d);}return _0x18dfb1['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-skeleton-container',this['bindTemplate']['if']('isLoading','ck-hidden',_0x42c066=>!_0x42c066)]},'children':_0xd24b53}),_0x18dfb1;}['_createResultsBodyView'](){const _0x168587=new _0x1e8352(this['locale']);return _0x168587['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-container','ck-reset_all-excluded',this['bindTemplate']['if']('isLoading','ck-hidden',_0x24e5eb=>_0x24e5eb)]},'children':this['_resultViews']}),_0x168587;}['_createErrorView'](){const _0x27abcd=new _0x1e8352(this['locale']),_0x208a6c=new Pt(this['locale']),t=this['locale']['t'];return _0x27abcd['delegate']('retryReview')['to'](this),_0x208a6c['set']({'label':t('Try\x20again'),'withText':!0x0,'class':hn+'\x20ck-ai_review__check-run-error-retry-button'}),_0x208a6c['on']('execute',()=>{this['fire']('retryReview');}),_0x27abcd['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-error-container',this['bindTemplate']['if']('showErrorMessage','ck-hidden',_0xb80a6c=>!_0xb80a6c),this['bindTemplate']['if']('errorType','ck-ai_review__check-run-error-container_border-bottom',_0x52931a=>'chunk'===_0x52931a)]},'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',_0x4947bd=>'chunk'===_0x4947bd)]},'children':[{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x497c6a=>'general'!==_0x497c6a)]},'children':[{'text':this['_contents']['generalErrorText']}]},{'tag':'p','attributes':{'class':['ck-ai-notification__content',this['bindTemplate']['if']('errorType','ck-hidden',_0x2bceea=>'chunk'!==_0x2bceea)]},'children':[{'text':ls(this['locale'],'AI_REVIEW_MODE_CHUNK_ERROR_MESSAGE')}]}]},_0x208a6c]}),_0x27abcd;}['_createCancelButtonView'](){const _0x1c0ea7=new Pt(this['locale']);return _0x1c0ea7['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_STOP_GENERATING'),'withText':!0x0,'class':[hn+'\x20ck-ai-button-stop-generating'],'icon':et}),_0x1c0ea7['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isResultReady','ck-hidden',_0x56ce71=>_0x56ce71),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x4af7dc=>_0x4af7dc)]}}),_0x1c0ea7['on']('execute',()=>{this['fire']('abortReviewStream');}),_0x1c0ea7;}['_createToggleDiffButtonView'](){const _0x4df376=new Pt(this['locale']);_0x4df376['set']({'tooltip':!0x0,'isToggleable':!0x0,'role':'menuitemcheckbox'}),_0x4df376['bind']('isEnabled')['to'](this,'isError',_0x341508=>!_0x341508),_0x4df376['extendTemplate']({'attributes':{'class':[hn,'ck-ai_review__check-run-toggle-diff-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x271fee=>!_0x271fee),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x553f6c=>_0x553f6c)]}});const _0x1e6b2=ls(this['locale'],'AI_REVIEW_MODE_HIDE_CHANGES'),_0x5a8e69=ls(this['locale'],'AI_REVIEW_MODE_SHOW_CHANGES');return _0x4df376['bind']('isOn')['to'](this,'isToggleDiffOn',_0x383fe1=>_0x383fe1),_0x4df376['bind']('icon')['to'](this,'isToggleDiffOn',_0x411ac8=>_0x411ac8?_0x3654b6:_0x5cd5d8),_0x4df376['bind']('label')['to'](this,'isToggleDiffOn',_0x460cd9=>_0x460cd9?_0x1e6b2:_0x5a8e69),_0x4df376['on']('execute',()=>{this['isToggleDiffOn']=!this['isToggleDiffOn'],this['fire']('toggleDiff',{'on':this['isToggleDiffOn']});}),_0x4df376;}['_createAcceptAllButtonView'](){const _0x400080=new Pt(this['locale']);return _0x400080['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_ACCEPT_ALL'),'withText':!0x0}),_0x400080['bind']('isEnabled')['to'](this,'isError',_0xee333b=>!_0xee333b),_0x400080['extendTemplate']({'attributes':{'class':[an,'ck-ai_review__check-run-accept-all-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x5dd0f7=>!_0x5dd0f7),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x35d616=>_0x35d616)]}}),_0x400080['on']('execute',()=>{this['fire']('acceptAllChanges');}),_0x400080;}['_createExitReviewButtonView'](){const _0x4ad239=new Pt(this['locale']);return _0x4ad239['set']({'label':ls(this['locale'],'AI_REVIEW_MODE_EXIT_REVIEW'),'withText':!0x0}),_0x4ad239['extendTemplate']({'attributes':{'class':[cn,'ck-ai_review__check-run-exit-button',this['bindTemplate']['if']('isResultReady','ck-hidden',_0x30442f=>!_0x30442f),this['bindTemplate']['if']('isCompleted','ck-hidden',_0x386cd9=>_0x386cd9)]}}),_0x4ad239['on']('execute',()=>{this['fire']('leaveReviewCoreResultList');}),_0x4ad239;}['_createResultHeaderView'](){const _0x5c22ba=new _0x1e8352(this['locale']),_0x3756aa=this['_createTitleView']();return _0x5c22ba['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header',this['bindTemplate']['if']('isCompleted','ck-ai_review__review-completed-header',_0x270373=>_0x270373)]},'children':[_0x3756aa,{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2bc4c3=>!_0x2bc4c3)],'title':ls(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')},'children':[{'text':ls(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE')}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-buttons']},'children':[this['_cancelButtonView'],this['_acceptAllButtonView'],this['_exitReviewButtonView'],this['_toggleDiffButtonView'],this['_finishReviewButtonView']]}]}),_0x5c22ba;}['_createTitleView'](){const _0x7be038=new _0x1e8352(this['locale']),_0x4dc006=new cr();return _0x4dc006['bind']('isVisible')['to'](this,'isResultReady',_0x159e5e=>!_0x159e5e),_0x7be038['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-run-results-header-title-wrapper',this['bindTemplate']['if']('isCompleted','ck-hidden',_0x2a8d60=>_0x2a8d60)]},'children':[_0x4dc006,{'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')}]}]}]}),_0x7be038;}['_createFinishReviewButtonView'](){const _0x397003=new qa(ls(this['locale'],'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL'),this['locale']);return _0x397003['extendTemplate']({'attributes':{'class':[this['bindTemplate']['if']('isCompleted','ck-hidden',_0xdbfbff=>!_0xdbfbff)]}}),_0x397003['delegate']('finishReview')['to'](this),_0x397003;}},Xa=class extends Xt{['_resultsHeader'];['_finishReviewButtonView'];constructor(_0x509f4c,_0x557ea8){super(_0x509f4c),this['_finishReviewButtonView']=this['_createFinishReviewButtonView'](_0x557ea8['buttonText']),this['_resultsHeader']=this['_createResultHeaderView'](_0x557ea8['headerText']);const _0x237831=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed',_0x237831['if']('isVisible','ck-hidden',_0x50d1db=>!_0x50d1db)]},'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':_0x557ea8['emptyResultsText']}]}]}]});}['_createFinishReviewButtonView'](_0x67d375){const _0x3d5db8=new qa(_0x67d375,this['locale']);return _0x3d5db8['delegate']('finishReview')['to'](this),_0x3d5db8;}['_createResultHeaderView'](_0x55a3f0){const _0x379644=new _0x1e8352(this['locale']);return _0x379644['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header']},'children':[{'tag':'span','attributes':{'class':['ck-ai_review__review-completed-header-title'],'title':_0x55a3f0},'children':[{'text':_0x55a3f0}]},{'tag':'div','attributes':{'class':['ck-ai_review__review-completed-header-buttons']},'children':[this['_finishReviewButtonView']]}]}),_0x379644;}},za=class extends _0x1e8352{['_dropdownView'];['_defaultValue'];['_defaultLabel'];constructor(_0x4dba17,_0x139fb1){super(_0x4dba17),this['_defaultValue']=_0x139fb1['default']||(_0x139fb1['data']['length']>0x0?_0x139fb1['data'][0x0]['id']:''),this['_defaultLabel']=_0x139fb1['data']['find'](_0x304cfd=>_0x304cfd['id']===this['_defaultValue'])?.['label']||'',this['set']('formValue',''),this['_dropdownView']=_0x312ca1(this['locale']);const _0x2a14a2=this['_prepareListOptions'](_0x139fb1['data']);_0x11b460(this['_dropdownView'],_0x2a14a2,{'role':'menu','ariaLabel':_0x139fb1['label']}),this['_dropdownView']['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0}),this['_dropdownView']['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x13a663=>{_0x13a663['stopPropagation']();})}}),this['listenTo'](this['_dropdownView'],'execute',_0x120214=>{this['formValue']=_0x120214['source']['model']['id'],this['_dropdownView']['buttonView']['label']=_0x120214['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'](_0x1e363f=[]){const _0x1d8b2f=new ht();this['resetToDefault']();for(const _0x1ceba4 of _0x1e363f){const _0x5791e7=new _0x53b316({'label':_0x1ceba4['label'],'withText':!0x0,'role':'menuitemradio','id':_0x1ceba4['id'],'model':_0x1ceba4});_0x5791e7['bind']('isOn')['to'](this,'formValue',_0xc5ec05=>_0xc5ec05===_0x5791e7['id']);const _0x234475={'type':'button','model':_0x5791e7};_0x1d8b2f['add'](_0x234475);}return _0x1d8b2f;}},ja=class extends Xt{['_formItem']=null;constructor(_0x43b6bc,_0x3beb5b,_0x3f0111){if(super(_0x43b6bc),this['argsKey']=_0x3beb5b?.['argsKey'],'dropdown'===_0x3beb5b['formType'])this['_formItem']=new za(this['locale'],_0x3beb5b);this['set']('value',''),this['bind']('value')['to'](this['_formItem'],'formValue');const _0x4f806c=new Ft(this['locale'],{'children':[this['_formItem']],'class':[_0x3f0111?'ck-form__row_with-submit':'']});_0x3f0111&&_0x4f806c['children']['add'](_0x3f0111),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-ai_review__form-item','ck-reset_all']},'children':[_0x4f806c]});}['resetToDefault'](){this['_formItem']['resetToDefault']();}},Ja=class AIReviewCorePromptInputView extends _0x52eb0a{['keystrokes'];static ['MIN_ROWS']=0x1;static ['MAX_ROWS']=0xc;constructor(_0x37a3bd){super(_0x37a3bd),this['set']('isEmpty',!0x0),this['keystrokes']=new dt(),this['minRows']=AIReviewCorePromptInputView['MIN_ROWS'],this['maxRows']=AIReviewCorePromptInputView['MAX_ROWS'],this['extendTemplate']({'attributes':{'id':'ai-review-prompt-input','class':['ck','ck-review__prompt-input']}});}['render'](){super['render'](),this['on']('update',()=>{this['isEmpty']=''===this['element']['value']?.['trim']();}),this['keystrokes']['listenTo'](this['element']);}},Za=class extends _0x1e8352{['focusTracker']=new ut();['keystrokes']=new dt();['focusCycler'];['_focusables']=new _0x14141a();['submitButtonView'];['cancelButtonView'];['promptInputView'];['actionsFooterView'];['_modelSelectionDropdown'];['_modelNameView'];['_modelSelectionDropdownItems'];['_check'];['_defaultValue'];['_defaultLabel'];constructor(_0x3ab2c5,_0x41e829,_0x2a7b70=!0x1){super(_0x3ab2c5),this['_check']=_0x41e829,this['set']('prompt',''),this['set']('modelId',''),this['set']('modelDisplayMode','selector'),this['set']('activeModelName',null),this['_defaultValue']=_0x41e829['defaultModel']?_0x41e829['defaultModel']['id']:'',this['_defaultLabel']=_0x41e829['defaultModel']?_0x41e829['defaultModel']['name']:'',this['submitButtonView']=this['_createSubmitButtonView'](),this['cancelButtonView']=this['_createCancelButtonView'](),(this['promptInputView']=new $t(this['locale'],()=>new Ja(_0x3ab2c5)),this['promptInputView']['fieldView']['bind']('value')['to'](this,'prompt'),this['promptInputView']['fieldView']['on']('input',()=>{this['prompt']=this['promptInputView']['fieldView']['element']['value'];}),this['_modelSelectionDropdown']=this['_createModelSelectionDropdown'](),this['_modelSelectionDropdownItems']=new ht(),this['_modelNameView']=this['_createModelNameView'](),this['_setModelList'](_0x2a7b70),_0x11b460(this['_modelSelectionDropdown'],this['_modelSelectionDropdownItems']),this['actionsFooterView']=this['_createActionsFooterView'](),this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions']},'children':[new Ft(this['locale'],{'children':[this['promptInputView']]}),new Ft(this['locale'],{'children':[this['actionsFooterView']]})]}),this['promptInputView']['fieldView']['keystrokes']['set']('Enter',(_0x132972,_0xfd8d6f)=>{this['_isValid']()?(this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0}),_0xfd8d6f()):_0xfd8d6f();}),this['focusCycler']=new Bt({'focusables':this['_focusables'],'focusTracker':this['focusTracker'],'keystrokeHandler':this['keystrokes'],'actions':{'focusPrevious':'shift\x20+\x20tab','focusNext':'tab'}}));}['render'](){super['render'](),[this['promptInputView'],this['_modelSelectionDropdown'],this['cancelButtonView'],this['submitButtonView']]['forEach'](_0x5471c5=>{this['_focusables']['add'](_0x5471c5),this['focusTracker']['add'](_0x5471c5['element']);}),this['keystrokes']['listenTo'](this['element']);}get['modelDefaultValue'](){return this['_defaultValue'];}get['modelDefaultLabel'](){return this['_defaultLabel'];}['resetToDefault'](){this['prompt']='',this['modelId']=this['modelDefaultValue'],this['_modelSelectionDropdown']['buttonView']['label']=this['modelDefaultLabel'],this['resetFormValidationStatus']();}['resetFormValidationStatus'](){this['promptInputView']['errorText']='';}['_isValid'](){this['resetFormValidationStatus']();for(const _0x46fdc8 of this['_getFormValidators']()){const _0x1f48bb=_0x46fdc8();if(_0x1f48bb)return this['promptInputView']['errorText']=_0x1f48bb,!0x1;}return!0x0;}['_getFormValidators'](){return[()=>{if(0x0===this['promptInputView']['fieldView']['value']?.['trim']()['length'])return ls(this['locale'],'AI_REVIEW_MODE_PROMPT_EMPTY_ERROR');}];}['_createSubmitButtonView'](){const _0x194be9=new Pt(this['locale']),t=this['locale']['t'];return _0x194be9['set']({'label':t('Submit'),'withText':!0x0,'class':an}),_0x194be9['on']('execute',()=>{this['_isValid']()&&this['fire']('runReviewCheck',{'id':'custom','args':{'prompt':this['prompt'],'model':this['modelId']},'isCustom':!0x0});}),_0x194be9;}['_createCancelButtonView'](){const _0x42021f=new Pt(this['locale']),t=this['locale']['t'];return _0x42021f['set']({'label':t('Cancel'),'withText':!0x0,'class':cn}),_0x42021f['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x377f4e=>{_0x377f4e['stopPropagation']();})}}),_0x42021f['on']('execute',()=>{this['resetToDefault'](),this['fire']('closeCustomCheck');}),_0x42021f;}['_setModelList'](_0x2bd228){this['_modelSelectionDropdownItems']['clear']();const _0x39482a=this['_check']['models'];if(_0x2bd228)this['set']('modelDisplayMode','hidden');else{const _0xccc421=0x1===_0x39482a['length'];this['set']('modelDisplayMode',_0xccc421?'name':'selector');}if(this['resetToDefault'](),_0x39482a?.['length']){0x1===_0x39482a['length']&&this['set']('activeModelName',_0x39482a[0x0]['name']||_0x39482a[0x0]['id']);for(const _0x2f85fa of _0x39482a){const _0x40c7b1=new _0x53b316({'label':_0x2f85fa['name'],'withText':!0x0,'role':'menuitemradio','id':_0x2f85fa['id'],'model':_0x2f85fa});_0x40c7b1['bind']('isOn')['to'](this,'modelId',_0xf00eb=>_0xf00eb===_0x2f85fa['id']),this['_modelSelectionDropdownItems']['add']({'type':'button','model':_0x40c7b1,'labelView':new eh(this['locale'],_0x2f85fa)});}}}['_createModelSelectionDropdown'](){const _0x226746=_0x312ca1(this['locale']);return _0x226746['set']({'panelPosition':'se','class':'ck-ai_review__check-list-item-model-dropdown'}),_0x226746['buttonView']['set']({'label':this['_defaultLabel'],'withText':!0x0,'tooltip':!0x0,'class':cn}),_0x226746['buttonView']['bind']('isVisible')['to'](this,'modelDisplayMode',_0x3bcd09=>'selector'===_0x3bcd09),this['listenTo'](_0x226746,'execute',_0x60c8b9=>{this['modelId']=_0x60c8b9['source']['model']['id'],_0x226746['buttonView']['label']=_0x60c8b9['source']['label'];}),_0x226746;}['_createModelNameView'](){const _0x31293f=new th(this['locale']);return _0x31293f['bind']('text')['to'](this,'activeModelName',_0x511ef1=>_0x511ef1??''),_0x31293f['bind']('isVisible')['to'](this,'modelDisplayMode',_0x2646f6=>'name'===_0x2646f6),_0x31293f;}['_createActionsFooterView'](){const _0x581027=new _0x1e8352(this['locale']);return _0x581027['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-custom-actions-footer']},'children':[this['_modelSelectionDropdown'],this['_modelNameView'],{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-custom-actions-buttons']},'children':[this['cancelButtonView'],this['submitButtonView']]}]}),_0x581027;}},th=class extends _0x1e8352{constructor(_0x442e58){super(_0x442e58),this['set']('text',void 0x0),this['set']('isVisible',!0x0);const _0x514ff3=this['bindTemplate'];this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-ai_review__check-list-item-model-name',_0x514ff3['if']('isVisible','ck-hidden',_0x2a9562=>!_0x2a9562)]},'children':[{'text':_0x514ff3['to']('text')}]});}},eh=class extends Lt{constructor(_0x5cdbb1,_0x39b3d4){super();const _0x157feb=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-button__label'],'style':_0x157feb['to']('style'),'id':_0x157feb['to']('id')},'children':[{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-name']},'children':[{'tag':'span','children':[{'text':_0x157feb['to']('text')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-model-dropdown-description']},'children':[{'tag':'span','children':[_0x39b3d4['description']||'']}]}]});}},ih=class extends Xt{['_formItemsCollection']=new _0x14141a();['_customCheckView']=null;['_hideModels']=!0x1;constructor(_0x3a7c41,_0x106c80,_0x2f5f9c,_0x5e9c88=!0x1){super(_0x3a7c41),this['_hideModels']=_0x5e9c88,this['set']('isParametrizedViewOpen',!0x1),this['set']('isListItemRendered',!0x1),this['set']('isItemParametrized',_0x106c80['isParameterized']);const _0x41c405=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',_0x11d0d9=>_0x11d0d9),this['bindTemplate']['if']('isListItemRendered','ck-ai_review__check-list-item_rendered',_0x444619=>_0x444619)],'style':{'--ck-ai-review-check-list-item-index':_0x2f5f9c}},'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':_0x106c80['title']}]},_0x41c405]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-description']},'children':_0x106c80['description']?[{'text':_0x106c80['description']}]:[]}]}]},..._0x106c80['isParameterized']?[this['_createParameterizedView'](_0x106c80)]:[],...'custom'===_0x106c80['id']?[this['_createCustomView'](_0x106c80,this['_hideModels'])]:[]]}),this['on']('click',()=>{_0x106c80['isParameterized']?this['isParametrizedViewOpen']=!0x0:this['fire']('runReviewCheck',{'id':_0x106c80['id'],'args':_0x106c80['useArgs']?_0x106c80['args']:void 0x0});}),requestAnimationFrame(()=>{this['isListItemRendered']=!0x0;});}['render'](){super['render'](),this['isItemParametrized']&&_0x262419({'emitter':this,'activator':()=>!0x0===this['isParametrizedViewOpen'],'contextElements':[this['element']],'callback':()=>{this['isParametrizedViewOpen']=!0x1;}});}['resetToDefault'](){this['isParametrizedViewOpen']=!0x1,this['_formItemsCollection']['forEach'](_0x19810b=>{_0x19810b['resetToDefault']();}),this['_customCheckView']&&this['_customCheckView']['resetToDefault']();}['_createIconView'](){const _0x22542a=new Wt();return _0x22542a['content']=_0x5a1275,_0x22542a['extendTemplate']({'attributes':{'class':['ck-ai_review__check-list-item-title-icon']}}),_0x22542a;}['_createParameterizedView'](_0x5441e0){const _0x175d1f=new _0x1e8352(),_0x2e850a=this['_createFormView'](_0x5441e0);return _0x175d1f['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized',this['bindTemplate']['if']('isParametrizedViewOpen','ck-hidden',_0x581799=>!_0x581799)]},'children':[_0x2e850a]}),_0x175d1f;}['_createFormView'](_0x3aabee){const _0x4f577=new _0x1e8352(),_0x3bb488=Array['isArray'](_0x3aabee['options'])?_0x3aabee['options']:[],_0x2c6301=new Pt(this['locale']),t=this['locale']['t'];_0x2c6301['set']({'label':t('Submit'),'withText':!0x0,'class':an}),_0x2c6301['extendTemplate']({'on':{'click':this['bindTemplate']['to'](_0x1639d0=>{_0x1639d0['stopPropagation']();})}}),_0x2c6301['on']('execute',()=>{const _0x42894a=[],_0x270f95={};this['_formItemsCollection']['forEach'](_0xc27b59=>{_0x42894a['push'](_0xc27b59['value']),_0x3aabee['useArgs']&&_0x3aabee['options']&&(_0x270f95[_0xc27b59['argsKey']]=_0xc27b59['value']);}),this['fire']('runReviewCheck',{'id':_0x3aabee['id'],'params':_0x42894a['length']?_0x42894a:void 0x0,'args':Object['keys'](_0x270f95)['length']?_0x270f95:void 0x0});});const _0x4171f4=_0x3bb488['length'];return _0x3bb488['forEach']((_0x3f3ebd,_0x2d0b57)=>{const _0xfc45e3=_0x2d0b57===_0x4171f4-0x1;this['_formItemsCollection']['add'](new ja(this['locale'],_0x3f3ebd,_0xfc45e3?_0x2c6301:null));}),_0x4f577['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list-item-parameterized-form']},'children':this['_formItemsCollection']}),_0x4f577;}['_createCustomView'](_0x1922e6,_0x536f09=!0x1){return this['_customCheckView']=new Za(this['locale'],_0x1922e6,_0x536f09),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',_0x5cb05b=>!_0x5cb05b)]}}),this['_customCheckView']['delegate']('runReviewCheck')['to'](this),this['listenTo'](this['_customCheckView'],'closeCustomCheck',()=>{this['isParametrizedViewOpen']=!0x1;}),this['on']('change:isParametrizedViewOpen',(_0x28c26c,_0x2fef5d,_0x1b6ffb)=>{_0x1b6ffb||this['_customCheckView']['resetFormValidationStatus']();}),this['_customCheckView'];}},sh=class extends Xt{['_checkViews'];constructor(_0x3e73aa){super(_0x3e73aa),this['_checkViews']=new _0x14141a(),this['_setupTemplate']();}['setChecks'](_0x4e60b9,_0x38c2a7=!0x1){this['_checkViews']['clear']();for(const [_0x19d736,_0x32bd3b]of _0x4e60b9['entries']()){const _0xdc22bb=new ih(this['locale'],_0x32bd3b,_0x19d736,_0x38c2a7);_0xdc22bb['delegate']('runReviewCheck')['to'](this),this['_checkViews']['add'](_0xdc22bb);}}['hasChecks'](){return this['_checkViews']['length']>0x0;}['resetAllParameterizedChecks'](){for(const _0x324265 of this['_checkViews'])_0x324265 instanceof ih&&_0x324265['resetToDefault']();}['_setupTemplate'](){const _0x21eb96=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x21eb96['if']('isVisible','ck-hidden',_0x19012c=>!_0x19012c)]},'children':this['_checkViews']});}},nh=class extends Wa{static get['pluginName'](){return'AIReviewModeUI';}['createMainView'](){const _0x21ae58=this['context']['plugins']['get']('AITabs'),_0x5eace9=this['context']['locale'],_0x14a686=new Ho(_0x5eace9,{'label':ls(_0x5eace9,'AI_REVIEW_MODE'),'icon':_0x1c0339,'class':'ck-ai-header_review','showResizeButton':_0x21ae58['showResizeButton']});return _0x14a686['delegate']('resizeTabs')['to'](_0x21ae58),_0x14a686['bind']('isMaximized')['to'](_0x21ae58['view'],'isMaximized',_0x2137a9=>_0x2137a9),new $a(this['context']['locale'],{'header':_0x14a686,'list':new sh(_0x5eace9),'results':new Qa(_0x5eace9,{'generalErrorText':ls(_0x5eace9,'AI_REVIEW_MODE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x5eace9,{'headerText':ls(_0x5eace9,'AI_REVIEW_MODE_FINISH_REVIEW_HEADER_TITLE'),'emptyResultsText':ls(_0x5eace9,'AI_REVIEW_MODE_EMPTY_RESULTS_TEXT'),'buttonText':ls(_0x5eace9,'AI_REVIEW_MODE_FINISH_REVIEW_BUTTON_LABEL')})});}['registerTab'](){const _0x5a95c8=this['context']['plugins']['get']('AITabs');_0x5a95c8['view']['on']('activateTab',(_0x521915,{newTab:_0x4374bc,oldTab:_0x162ffc})=>{'reviewMode'===_0x4374bc?this['fire']('getReviewCheckList'):'reviewMode'===_0x162ffc&&this['fire']('leaveReview');}),_0x5a95c8['view']['addTab']({'id':'reviewMode','buttonLabel':ls(this['context']['locale'],'AI_REVIEW_MODE'),'buttonIcon':_0x1c0339,'order':0x0,'content':this['_mainView']});}};const rh='review-',oh=['softBreak'],ah=['htmlScript','htmlStyle','htmlCustomElement'];var hh=class extends _0x2d0760{static get['requires'](){return[_0x5b6f61,As];}static get['pluginName'](){return'AIReviewCoreEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_markers']=new Map();['_activeMarkers']=new Set();['_domEmitter'];['_eventEmitter'];['_reviewEditingAttachedEditors']=new WeakSet();['_boundEditables']=new WeakMap();constructor(_0x33a427){super(_0x33a427),this['_domEmitter']=new(ct())(),this['_eventEmitter']=new(lt())();}get['emitter'](){return this['_eventEmitter'];}['afterInit'](){const _0x4e72fc=_0x813b96=>this['_scheduleAttachReviewEditingToEditor'](_0x813b96);if(this['_registerGlobalBalloonBlurHandler'](),this['context']instanceof _0x1a88b7)return void _0x4e72fc(this['context']);const _0x1765c6=this['context'];for(const _0x3e032d of _0x1765c6['editors'])_0x4e72fc(_0x3e032d);this['listenTo'](_0x1765c6['editors'],'add',(_0x17f3fb,_0x10ff05)=>{_0x4e72fc(_0x10ff05);}),this['listenTo'](_0x1765c6['editors'],'remove',(_0x4f23aa,_0x4f8359)=>{for(const [_0xc2fce8,_0x330030]of this['_markers'])_0x330030['editor']===_0x4f8359&&(this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0xc2fce8,'changeId':_0x330030['groupId']}),this['_markers']['delete'](_0xc2fce8));});}['_scheduleAttachReviewEditingToEditor'](_0x22e446){const _0x3be24e=()=>{'destroyed'!==_0x22e446['state']&&_0x22e446['conversion']&&this['_attachReviewEditingToEditor'](_0x22e446);};if('ready'===_0x22e446['state'])return void _0x3be24e();const _0x258b50=()=>{this['stopListening'](_0x22e446,'ready',_0x258b50),_0x3be24e();};this['listenTo'](_0x22e446,'ready',_0x258b50);}['_attachReviewEditingToEditor'](_0x432e19){this['_reviewEditingAttachedEditors']['has'](_0x432e19)||(_0x432e19['conversion']['for']('editingDowncast')['markerToElement']({'model':rh+'insert','view':(_0x11c66a,{writer:_0xeb45f1})=>{const _0x3d4917=this['_markers']['get'](_0x11c66a['markerName']),_0x5f2871={'class':'ck-ai_review-marker_add'+(this['_activeMarkers']['has'](_0x3d4917?.['id']||'')?'\x20ck-ai_review__change_active':''),'data-marker-id':_0x11c66a['markerName']};return _0xeb45f1['createUIElement']('span',_0x5f2871,function(_0x558341){const _0x488695=this['toDomElement'](_0x558341);return _0x488695['innerHTML']=_0x3d4917?.['content']?.['asString']||'',_0x488695;});}}),_0x432e19['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-only','view':_0x5f0381=>{const _0x2b17c1=this['_markers']['get'](_0x5f0381['markerName']),_0x509767=['ck-ai_review-marker_strikethrough'];return this['_activeMarkers']['has'](_0x2b17c1?.['id']||'')&&_0x509767['push']('ck-ai_review__change_active'),{'classes':_0x509767,'attributes':{'data-marker-id':_0x5f0381['markerName']}};}}),_0x432e19['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-context','view':_0x158712=>{const _0x335089=this['_markers']['get'](_0x158712['markerName']),_0x441b18=['ck-ai_review-marker_underline'];return this['_activeMarkers']['has'](_0x335089?.['id']||'')&&_0x441b18['push']('ck-ai_review__change_active'),{'classes':_0x441b18,'attributes':{'data-marker-id':_0x158712['markerName']}};}}),_0x432e19['conversion']['for']('editingDowncast')['markerToHighlight']({'model':rh+'remove-text','view':_0xc4783f=>{const _0x5734d0=this['_markers']['get'](_0xc4783f['markerName']),_0xb8de3=['ck-ai_review-marker_hide'];return this['_activeMarkers']['has'](_0x5734d0?.['id']||'')&&_0xb8de3['push']('ck-ai_review__change_active'),{'classes':_0xb8de3,'attributes':{'data-marker-id':_0xc4783f['markerName']}};}}),_0x432e19['conversion']['for']('dataDowncast')['markerToElement']({'model':rh+'suggestion-context','view':(_0x5dd532,{writer:_0x5f2f9b})=>_0x5f2f9b['createRawElement']('span',{'class':'ck-ai_review-marker_context-'+(_0x5dd532['isOpening']?'start':'end')})}),_0x432e19['conversion']['for']('downcast')['attributeToAttribute']({'model':_0x2be158,'view':_0x2e258d}),this['_updateMouseMarkerInteractionListeners'](_0x432e19),this['listenTo'](_0x432e19,'addRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x432e19),{'priority':'lowest'}),this['listenTo'](_0x432e19,'detachRoot',()=>this['_updateMouseMarkerInteractionListeners'](_0x432e19),{'priority':'lowest'}),_0x432e19['model']['document']['registerPostFixer'](_0x203281=>this['_validateMarkers'](_0x432e19,_0x203281)),_0x432e19['model']['document']['on']('change',()=>this['_handleMarkerChanges'](_0x432e19)),this['_reviewEditingAttachedEditors']['add'](_0x432e19));}['_updateMouseMarkerInteractionListeners'](_0x32671c){let _0x2d538d=this['_boundEditables']['get'](_0x32671c);_0x2d538d||(_0x2d538d=new Map(),this['_boundEditables']['set'](_0x32671c,_0x2d538d));const _0x51b412=new Set(_0x32671c['ui']['getEditableElementsNames']());for(const _0x3a32a8 of _0x51b412){if(_0x2d538d['has'](_0x3a32a8))continue;const _0xf12355=_0x32671c['ui']['getEditableElement'](_0x3a32a8);_0x2d538d['set'](_0x3a32a8,_0xf12355),this['_attachMouseMarkerInteractionListeners'](_0xf12355);}for(const [_0x41e695,_0x425aa1]of _0x2d538d)_0x51b412['has'](_0x41e695)||(_0x2d538d['delete'](_0x41e695),this['_domEmitter']['stopListening'](_0x425aa1));}['_attachMouseMarkerInteractionListeners'](_0x2bc8ab){this['_domEmitter']['listenTo'](_0x2bc8ab,'mouseup',(_0x431f2a,_0x2eb495)=>{const _0x36891e=_0x2eb495['target'],_0x359c77=this['_findMarkerElement'](_0x36891e);if(!_0x359c77)return;const _0x2dae03=_0x359c77['getAttribute']('data-marker-id'),_0x4de5d5=_0x2dae03['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerClicked',{'markerId':_0x2dae03,'changeId':_0x4de5d5,'markerElement':()=>this['_findMarkerElementById'](_0x2dae03),'domEvent':_0x2eb495});},{'usePassive':!0x0,'priority':'highest'}),this['_domEmitter']['listenTo'](_0x2bc8ab,'mouseover',(_0x2e1211,_0x4c330e)=>{const _0xd08555=_0x4c330e['target'],_0x56b1cd=_0x4c330e['relatedTarget'];let _0x3f163d=this['_findMarkerElement'](_0xd08555);if(!_0x3f163d&&_0x56b1cd&&(_0x3f163d=this['_findMarkerElement'](_0x56b1cd)),!_0x3f163d)return;const _0xde7063=_0x3f163d['getAttribute']('data-marker-id'),_0x142dfc=_0xde7063['split'](':')['pop']()?.['split']('_')[0x0];this['_eventEmitter']['fire']('changeMarkerHovered',{'changeId':_0x142dfc,'markerElement':()=>this['_findMarkerElementById'](_0xde7063),'domEvent':_0x4c330e});});}['_registerGlobalBalloonBlurHandler'](){this['_domEmitter']['listenTo'](document,'mouseover',_0x173d8f((_0xfca66a,_0x527a19)=>{const _0xf05d13=_0x527a19['target'];this['_findMarkerElement'](_0xf05d13)||_0xf05d13['closest']('.ck-reset.ck-ai_review-balloon-panel-suggestion')||this['_eventEmitter']['fire']('changeMarkerBlurred');},0xc8));}['getDocumentData'](){const _0x5bd463=this['context']['plugins']['get']('AIEditing'),_0x3b7e9c=us(this['context']);if(!_0x3b7e9c['length'])throw new at('ai-get-editor-from-context-no-editor',this);const _0x9d2d3a=new Set(),_0xb0ac66=[],_0x52dd71=new Map();for(const _0x28d450 of _0x3b7e9c)for(const _0x4182f2 of _0x28d450['model']['document']['getRoots']()){if('$graveyard'===_0x4182f2['rootName'])continue;const _0xdbb344=this['_buildDocumentDataSliceForRoot'](_0x28d450,_0x4182f2,_0x5bd463,_0x9d2d3a);_0xb0ac66['push'](_0xdbb344['content']);for(const [_0x3c6982,_0x25b859]of _0xdbb344['elements'])_0x52dd71['set'](_0x3c6982,_0x25b859);}return{'elements':_0x52dd71,'content':_0xb0ac66['join']('')};}['_buildDocumentDataSliceForRoot'](_0x28ead3,_0x3c4ce4,_0x244d7b,_0x55cf69){const _0xef65a9=_0x28ead3['model'],_0x3de1c6=new _0x500fd6();for(const _0x2b7c6f of _0x3c4ce4['getChildren']())_0x3de1c6['_appendChild'](_0x2b7c6f['_clone'](!0x0));for(const _0x576553 of _0xef65a9['markers']){const _0x2015b0=_0x576553['getRange']();_0x2015b0&&_0x2015b0['root']['rootName']===_0x3c4ce4['rootName']&&_0x3de1c6['markers']['set'](_0x576553['name'],this['_changeRangeOwnerDocument'](_0x2015b0['clone'](),_0x3de1c6));}const _0x281dce=new Map(),_0x4ddb36=_0xef65a9['document']['version'],_0x454e58=new _0x134ed6({'ignoreElementEnd':!0x0,'startPosition':_0xef65a9['createPositionAt'](_0x3de1c6,0x0)});for(const {item:_0x2d8a3c}of _0x454e58){if(_0x2d8a3c['is']('element')&&_0x2d8a3c['name']&&ah['includes'](_0x2d8a3c['name'])){const _0x2d49c3=this['_upsertDataId'](_0x2d8a3c,()=>_0x244d7b['_nextDataId'](_0x55cf69));_0x55cf69['add'](_0x2d49c3);}if(!_0x2d8a3c['is']('$textProxy'))continue;const _0x1f472a=_0x2d8a3c['parent'];if(!_0x1f472a||!_0x1f472a['is']('element'))continue;const _0x2ecffe=this['_upsertDataId'](_0x1f472a,()=>_0x244d7b['_nextDataId'](_0x55cf69));_0x55cf69['add'](_0x2ecffe);for(const _0x469052 of _0x1f472a['getChildren']())_0x469052['is']('element')&&(_0x469052['name']&&oh['includes'](_0x469052['name'])||_0x55cf69['add'](this['_upsertDataId'](_0x469052,()=>_0x244d7b['_nextDataId'](_0x55cf69))));let _0x233613=_0x1f472a;for(;_0x233613['parent']&&!_0x233613['parent']['is']('documentFragment');)_0x233613=_0x233613['parent'],_0x233613['hasAttribute'](_0x2be158)&&_0x233613['_removeAttribute'](_0x2be158);_0x281dce['set'](_0x2ecffe,{'editor':_0x28ead3,'rootName':_0x3c4ce4['rootName'],'path':_0x1f472a['getPath'](),'documentVersion':_0x4ddb36,'getContent':this['_createGetContentUsingDataIdFn'](_0x233613['_clone'](!0x0),_0x2ecffe,_0x28ead3['data'])}),_0x454e58['jumpTo'](_0xef65a9['createPositionAfter'](_0x1f472a));}return{'content':_0x28ead3['data']['processor']['toData'](_0x28ead3['data']['toView'](_0x3de1c6)),'elements':_0x281dce};}['diffContent'](_0x3c4d60,_0x657c4c,_0x5e1073,_0x10661d=!0x1){const {contentInitial:_0x1ba659,contentNew:_0x58d783}=this['_neutralizeChangesOnUnsupportedElements'](_0x657c4c,_0x5e1073),_0x3b93a8=[],_0x43532b=_0x3c4d60['data']['parse'](_0x58d783,'$documentFragment'),_0x2a6ae5=_0x3c4d60['data']['parse'](_0x1ba659,'$documentFragment'),_0x5500b7=_0x3c4d60['model']['createPositionAt'](_0x2a6ae5,0x0);if(this['_haveSingleTopLevelElement'](_0x43532b)){if(!this['_hasSameTopLevelElement'](_0x2a6ae5,_0x43532b))return _0x3b93a8;}else{const _0x21be52=_0x3c4d60['model']['schema'];if(!this['_haveOnlyInlineContent'](_0x2a6ae5,_0x21be52)||!this['_haveOnlyInlineContent'](_0x43532b,_0x21be52))return _0x3b93a8;}const _0x4a61dd=this['context']['plugins']['get']('DocumentCompare')['getDiff'](_0x1ba659,_0x58d783,{'targetEditor':_0x3c4d60,'anchor':_0x5500b7,'markDeletions':!0x0})['getOperations']()['filter'](_0x56bced=>'insert'===_0x56bced['type']||'marker'===_0x56bced['type']&&_0x56bced['name']['startsWith']('$markedRemove')),_0x2e3942=this['_groupAdjacentOperations'](_0x4a61dd),_0x27a5b8=[];if(_0x10661d){if(_0x2e3942['length']){const _0x6e6815=_0x2e3942[0x0]['operations'][0x0],_0x89e022='insert'===_0x6e6815['type']?_0x6e6815['position']:_0x6e6815['newRange']['start'],_0x3017f5=this['_getPositionLimitingRange'](_0x89e022,_0x3c4d60,'inside'),_0x1c3a5d=_0x3017f5?_0x43532b['getChild'](0x0)['getChildren']():_0x43532b['getChildren'](),_0x30eca6=_0x3017f5||_0x3c4d60['model']['createRangeIn'](_0x2a6ae5),_0x5e4b14=[new _0x43f670('$markedRemove:synthetic'+Ot(),null,_0x30eca6,_0x3c4d60['model']['document']['model']['markers'],!0x0,_0x3c4d60['model']['document']['version']+0x1),new _0x491445(_0x30eca6['end'],_0x1c3a5d,_0x3c4d60['model']['document']['version']+0x2)];_0x27a5b8['push']({'operations':_0x5e4b14,'operationsIsolated':_0x5e4b14,'groupOffset':0x0});}}else _0x27a5b8['push'](..._0x2e3942);let _0x49daf3=0x0;return _0x3c4d60['model']['change'](_0x114dff=>{for(let _0x4a07cb=0x0;_0x4a07cb<_0x27a5b8['length'];_0x4a07cb++){const _0x229690=_0x27a5b8[_0x4a07cb],_0x6bff3c=_0x114dff['createDocumentFragment']();for(const _0x87848f of _0x2a6ae5['getChildren']())_0x114dff['append'](_0x87848f['_clone'](!0x0),_0x6bff3c);for(const _0x19687b of _0x229690['operationsIsolated'])if('insert'===_0x19687b['type']){const _0x3c07e7=_0x19687b;_0x3c07e7['baseVersion']=null,_0x3c07e7['isDocumentOperation']=!0x1,this['_changeOperationOwnerDocument'](_0x3c07e7,_0x6bff3c),_0x114dff['batch']['addOperation'](_0x19687b),_0x3c4d60['model']['applyOperation'](_0x19687b);const _0x5340b1='suggestion:insertion:id:authorId:'+_0x49daf3++,_0x4378ff=_0x3c4d60['model']['createRange'](_0x3c07e7['position'],_0x3c07e7['position']['getShiftedBy'](_0x3c07e7['howMany']));_0x6bff3c['markers']['set'](_0x5340b1,_0x4378ff);}else{if('marker'===_0x19687b['type']&&_0x19687b['name']['startsWith']('$markedRemove')){const _0x89f974=_0x19687b,_0x2f7b36='suggestion:deletion:id:authorId:'+_0x49daf3++;this['_changeOperationOwnerDocument'](_0x89f974,_0x6bff3c),_0x6bff3c['markers']['set'](_0x2f7b36,_0x89f974['newRange']);}}if(_0x10661d)_0x3b93a8['push']({..._0x229690,'context':this['_createGetContentFn'](_0x2a6ae5,_0x3c4d60['data']),'content':this['_createGetContentFn'](_0x2a6ae5,_0x3c4d60['data'])});else{const _0x2b738b=this['_getChangeContext'](this['_changePositionOwnerDocument'](this['_getOperationStart'](_0x229690['operationsIsolated'][0x0]),_0x6bff3c),this['_changePositionOwnerDocument'](this['_getOperationEnd'](_0x229690['operationsIsolated'][_0x229690['operationsIsolated']['length']-0x1]),_0x6bff3c),_0x3c4d60);_0x6bff3c['markers']['set'](rh+'suggestion-context',new _0x15a2ab(_0x2b738b['start'],_0x2b738b['end'])),_0x3b93a8['push']({..._0x229690,'context':this['_createGetContextFn'](_0x6bff3c,_0x3c4d60['data'],{'ellipsisBefore':_0x2b738b['hasContentBefore'],'ellipsisAfter':_0x2b738b['hasContentAfter']}),'content':this['_createGetContentFn'](_0x6bff3c,_0x3c4d60['data'])});}}}),_0x3b93a8;}['markChangePositionInEditorContent'](_0x46a814,_0x583467){if(!_0x46a814['length'])return;const _0x3657b8=_0x46a814[0x0]['parent']['id'],_0x50dce5=_0x583467['elements']['get'](_0x3657b8);if(!_0x50dce5)return void console['warn']('No\x20element\x20found\x20for\x20ID:\x20'+_0x3657b8);const _0x354441=_0x50dce5['path'],_0x56f84d=_0x50dce5['editor'],_0x5cc6ad=_0x56f84d['model']['document']['getRoot'](_0x50dce5['rootName']);if(!_0x5cc6ad)return void console['warn']('No\x20model\x20root\x20found\x20for\x20name:\x20'+_0x50dce5['rootName']);const _0x1bf8bd=_0x56f84d['model']['document']['history']['getOperations'](_0x50dce5['documentVersion']),_0x467be2=[];for(const _0xa73a49 of _0x46a814){const _0x1498b1=_0xa73a49['operationsIsolated']['map'](_0x11fb6e=>this['_translateOperationToEditorContent'](_0x11fb6e,_0x354441,_0x5cc6ad));if(!_0x1498b1||!_0x1498b1['length'])continue;const _0x292048=_0x1498b1['every'](_0x1d9764=>'marker'===_0x1d9764['type']&&_0x1d9764['name']['startsWith']('$markedRemove')),_0x12508f=_0x30647f(_0x1498b1,_0x1bf8bd,{'document':_0x56f84d['model']['document'],'useRelations':!0x1,'padWithNoOps':!0x1})['operationsA'];for(const _0x5b2949 of _0x12508f)if('insert'===_0x5b2949['type']){const _0x527e67=_0x5b2949,_0x4bebf7=_0x527e67['nodes'];_0x56f84d['model']['change'](_0x49bba6=>{const _0x3bd704=_0x49bba6['createDocumentFragment']();for(const _0x4eb03c of _0x4bebf7)_0x49bba6['append'](_0x4eb03c['_clone'](!0x0),_0x3bd704);_0x467be2['push']({'start':_0x527e67['position'],'end':_0x527e67['position'],'type':'insert','groupId':_0xa73a49['id'],'content':{'asString':this['_createGetContentFn'](_0x3bd704,_0x56f84d['data'])(),'asFragment':_0x3bd704}});});}else{if('marker'===_0x5b2949['type']&&_0x5b2949['name']['startsWith']('$markedRemove')){const _0x2ff1ec=_0x5b2949;let _0x2adbe6='remove-text';if(_0x292048){const _0x2c8924=this['_findAdjacentContextDistance'](_0x2ff1ec['newRange']['start'],'backward',_0x56f84d['model']['schema']),_0x273c3e=this['_findAdjacentContextDistance'](_0x2ff1ec['newRange']['end'],'forward',_0x56f84d['model']['schema']);if(_0x2c8924||_0x273c3e){const _0x17d606=_0x2ff1ec['newRange']['start']['getShiftedBy'](-_0x2c8924),_0x17bd95=_0x2ff1ec['newRange']['end']['getShiftedBy'](_0x273c3e);_0x467be2['push']({'start':_0x17d606,'end':_0x17bd95,'groupId':_0xa73a49['id'],'type':'remove-context'});}else _0x2adbe6='remove-only';}_0x467be2['push']({'start':_0x2ff1ec['newRange']['start'],'end':_0x2ff1ec['newRange']['end'],'groupId':_0xa73a49['id'],'type':_0x2adbe6});}}}this['_insertMarkers'](_0x467be2,_0x56f84d);}['clearAllMarkers'](){const _0x439899=new Map();for(const _0x4ed7c7 of this['_markers']['keys']()){const _0x37c9a0=this['_markers']['get'](_0x4ed7c7);_0x37c9a0?.['editor']&&(_0x439899['has'](_0x37c9a0['editor'])||_0x439899['set'](_0x37c9a0['editor'],[]),_0x439899['get'](_0x37c9a0['editor'])['push'](_0x4ed7c7));}for(const [_0x3f0d3c,_0x235faf]of _0x439899)_0x3f0d3c['model']['change'](_0x188f18=>{for(const _0x56c2ef of _0x235faf)_0x3f0d3c['model']['markers']['get'](_0x56c2ef)&&_0x188f18['removeMarker'](_0x56c2ef);});this['_markers']['clear'](),this['_activeMarkers']['clear']();}['switchToReadOnly'](){for(const _0x400516 of us(this['context']))_0x400516['enableReadOnlyMode']('ai-review');}['switchToEdit'](){for(const _0x4da671 of us(this['context']))_0x4da671['disableReadOnlyMode']('ai-review');}['applyChange'](_0x2d36be,_0x3bff0a=null){const _0x35ef74=_0x2d36be['map'](_0x5c6eb4=>this['_getMarkersDataForGroup'](_0x5c6eb4))['flat'](),_0x34e01d=new Map();for(const _0x26df3a of _0x35ef74)_0x34e01d['has'](_0x26df3a['editor'])||_0x34e01d['set'](_0x26df3a['editor'],[]),_0x34e01d['get'](_0x26df3a['editor'])['push'](_0x26df3a);for(const [_0x7f7ff5,_0x3b3b77]of _0x34e01d){const _0x463b1e=_0x7f7ff5['model'],_0x3b85f0=_0x7f7ff5['plugins']['has']('TrackChangesEditing')?_0x7f7ff5['plugins']['get']('TrackChangesEditing'):null,_0x18aadb=_0x3bff0a&&_0x3b85f0?new Set(_0x3b85f0['getSuggestions']()['map'](_0x1209b9=>_0x1209b9['id'])):null;_0x463b1e['change'](_0x433ce5=>{const _0x1a3eaf=_0x433ce5['batch']['operations']['length'];for(const _0x28dcc5 of _0x3b3b77){const _0x371a8f=_0x7f7ff5['model']['markers']['get'](_0x28dcc5['id']);if(_0x371a8f){if('insert'===_0x28dcc5['type']){if(!_0x28dcc5['content'])continue;_0x463b1e['insertContent'](_0x28dcc5['content']['asFragment']||null,_0x371a8f['getRange']()['start']);}else'remove-text'!==_0x28dcc5['type']&&'remove-only'!==_0x28dcc5['type']||_0x463b1e['deleteContent'](_0x463b1e['createSelection'](_0x371a8f['getRange']()));_0x433ce5['removeMarker'](_0x28dcc5['id']),this['_markers']['delete'](_0x28dcc5['id']);}}if(_0x3bff0a&&(js(_0x433ce5['batch']['operations']['slice'](_0x1a3eaf),_0x3bff0a),_0x3b85f0)){for(const _0xe35e15 of _0x3b85f0['getSuggestions']())_0x18aadb['has'](_0xe35e15['id'])||_0xe35e15['setAttribute']('@ai',{'type':_0x3bff0a});}});}}['rejectChange'](_0x283e78){const _0x7c0df=this['_getMarkersDataForGroup'](_0x283e78),_0x9ab516=new Map();for(const _0x37113e of _0x7c0df)_0x9ab516['has'](_0x37113e['editor'])||_0x9ab516['set'](_0x37113e['editor'],[]),_0x9ab516['get'](_0x37113e['editor'])['push'](_0x37113e);for(const [_0x6e6efb,_0x32f690]of _0x9ab516)_0x6e6efb['model']['change'](_0x40f193=>{for(const _0x580dee of _0x32f690)_0x40f193['removeMarker'](_0x580dee['id']),this['_markers']['delete'](_0x580dee['id']);});}['getEditor'](){return ds(this['context']);}['getEditors'](){return us(this['context']);}['getEditorForChange'](_0x436272){return this['_getMarkersDataForGroup'](_0x436272)[0x0]?.['editor'];}['getMarkerElementForChange'](_0x308e2e){const _0x375f32=Array['from'](this['_markers']['values']())['filter'](_0x51aadd=>_0x51aadd['groupId']===_0x308e2e);if(!_0x375f32['length'])return null;const _0x54414f=0x1===_0x375f32['length']?_0x375f32[0x0]:this['_sortMarkers'](_0x375f32)[0x0],_0x98a2e7=_0x54414f['editor']['model']['markers']['get'](_0x54414f['id']);return _0x98a2e7?{'modelRange':_0x98a2e7['getRange'](),'getElement':()=>this['_findMarkerElementById'](_0x54414f['id'])}:null;}['getContentElementForChange'](_0x26de34){const _0x498e4f=Array['from'](this['_markers']['values']())['filter'](_0x2b4484=>_0x2b4484['groupId']===_0x26de34);if(!_0x498e4f['length'])return null;const _0x4a6525=0x1===_0x498e4f['length']?_0x498e4f[0x0]:this['_sortMarkers'](_0x498e4f)[0x0],_0x588c90=_0x4a6525['editor'],_0x508846=_0x588c90['model']['markers']['get'](_0x4a6525['id']);if(!_0x508846)return null;const _0x5311bc=_0x508846['getRange'](),_0x5698de=_0x588c90['editing']['view']['getDomRoot'](_0x5311bc['root']['rootName'])||_0x588c90['editing']['view']['getDomRoot']();if(!_0x5698de||!_0x5311bc)return null;let _0x51b856=_0x5311bc['start']['parent'];for(;_0x51b856['parent']&&!_0x51b856['parent']['is']('rootElement');)_0x51b856=_0x51b856['parent'];if(!_0x51b856||!_0x51b856['name'])return null;const _0x109b71=_0x5698de['querySelector']('[data-marker-id=\x22'+_0x4a6525['id']+'\x22]');if(!_0x109b71)return null;let _0x1d813d=null;_0x588c90['model']['change'](_0x458131=>{_0x1d813d=_0x458131['createDocumentFragment'](),_0x458131['append'](_0x51b856['_clone'](!0x0),_0x1d813d);});const _0x55e17e=_0x588c90['data']['toView'](_0x1d813d)['getChild'](0x0);return _0x109b71['closest'](_0x55e17e['name']);}['reactivateMarkers'](_0x296b56){const _0x24a1df=this['_getMarkersDataForGroup'](_0x296b56);if(!_0x24a1df['length'])return;const _0x55e6e8=Array['from'](this['_activeMarkers'])['sort'](),_0xdcdd41=Array['from'](new Set(_0x24a1df['map'](_0x42c329=>_0x42c329['id'])))['sort']();_0x55e6e8['join']('|')!==_0xdcdd41['join']('|')&&(this['setAllMarkersAsInactive'](),this['setMarkersInElementAsActive'](_0x296b56));}['setMarkersInElementAsActive'](_0xf3df0e){const _0x444ed7=this['_getMarkersDataForGroup'](_0xf3df0e);if(!_0x444ed7['length'])return;const _0x5df169=_0x444ed7[0x0]['editor'],_0x15fc19=new Set(_0x444ed7['map'](_0x3a509f=>_0x3a509f['id'])),_0x1fa0ea=Array['from'](_0x15fc19['values']())['map'](_0x4b528a=>_0x5df169['model']['markers']['get'](_0x4b528a))['filter'](_0x36ffe3=>!!_0x36ffe3);_0x15fc19['forEach'](_0xaae37f=>{this['_activeMarkers']['add'](_0xaae37f);}),_0x5df169['model']['change'](()=>{_0x1fa0ea['forEach'](_0x3d313b=>{_0x5df169['editing']['reconvertMarker'](_0x3d313b);});});}['setAllMarkersAsInactive'](){const _0x1fe22=Array['from'](this['_activeMarkers']);if(!_0x1fe22['length'])return;this['_activeMarkers']['clear']();const _0x3b73bc=new Map();for(const _0x370c54 of _0x1fe22){const _0x57d647=this['_markers']['get'](_0x370c54);if(!_0x57d647)continue;const _0x300bf6=_0x57d647['editor'],_0x44b8f7=_0x300bf6['model']['markers']['get'](_0x370c54);_0x44b8f7&&(_0x3b73bc['has'](_0x300bf6)||_0x3b73bc['set'](_0x300bf6,[]),_0x3b73bc['get'](_0x300bf6)['push'](_0x44b8f7));}for(const [_0x395660,_0x9797e3]of _0x3b73bc)_0x395660['model']['change'](()=>{_0x9797e3['forEach'](_0x4b2059=>{_0x395660['editing']['reconvertMarker'](_0x4b2059);});});}['_getPositionLimitingRange'](_0x456ce8,_0x5323ea,_0x1d4455='outside'){if(!_0x456ce8)return null;let _0x26ad8a=_0x456ce8['parent'];for(;_0x26ad8a&&_0x26ad8a['parent']&&!_0x26ad8a['parent']['is']('rootElement')&&!_0x5323ea['model']['schema']['isLimit'](_0x26ad8a)&&!_0x5323ea['model']['schema']['isBlock'](_0x26ad8a);)_0x26ad8a=_0x26ad8a['parent'];if(!_0x26ad8a||!_0x26ad8a['name']||_0x26ad8a['is']('rootElement'))return null;let _0x91db23=null;return _0x5323ea['model']['change'](_0x4170f1=>{_0x91db23='inside'===_0x1d4455?_0x4170f1['createRangeIn'](_0x26ad8a):_0x4170f1['createRangeOn'](_0x26ad8a);}),_0x91db23;}['_validateMarkers'](_0x5db234,_0x43a96d){const _0xda6da=Array['from'](this['_markers']['keys']()),_0x20ead0=new Map();for(const _0x3d92b3 of _0xda6da){const _0x47abfc=_0x5db234['model']['markers']['get'](_0x3d92b3);if(!_0x47abfc)continue;const _0x3fec5f=_0x47abfc['getStart']()['root']['rootName']+':'+_0x47abfc['getStart']()['path'][0x0];_0x20ead0['has'](_0x3fec5f)||_0x20ead0['set'](_0x3fec5f,[]),_0x20ead0['get'](_0x3fec5f)['push'](_0x47abfc);}const _0x20b104=new Set();for(const _0x419624 of _0x5db234['model']['document']['differ']['getChanges']()){let _0x28da2e='',_0x509719=null;if('insert'===_0x419624['type'])_0x509719=new _0x15a2ab(_0x419624['position'],_0x419624['position']['getShiftedBy'](_0x419624['length'])),_0x28da2e=_0x419624['position']['root']['rootName']+':'+_0x419624['position']['path'][0x0];else{if('remove'!==_0x419624['type'])continue;_0x509719=new _0x15a2ab(_0x419624['position']),_0x28da2e=_0x419624['position']['root']['rootName']+':'+_0x419624['position']['path'][0x0];}const _0x85fa03=_0x20ead0['get'](_0x28da2e)||[];if(_0x85fa03['length']){for(const _0x49a36e of _0x85fa03)if(_0x509719['root']['rootName']===_0x49a36e['getRange']()['root']['rootName']&&('insert'!==_0x419624['type']||!_0x509719['containsRange'](_0x49a36e['getRange']()))&&(_0x509719['isIntersecting'](_0x49a36e['getRange']())||_0x509719['start']['isTouching'](_0x49a36e['getRange']()['end'])||_0x509719['end']['isTouching'](_0x49a36e['getRange']()['start']))){const _0x463c4e=this['_parseMarkerName'](_0x49a36e['name']);Array['from'](this['_markers']['values']())['filter'](_0x192f3a=>_0x192f3a['groupId']===_0x463c4e['groupId'])['forEach'](_0x511b21=>_0x20b104['add'](_0x511b21['id']));}}}if(_0x20b104['size']){for(const _0x483e9d of _0x20b104)_0x43a96d['removeMarker'](_0x483e9d);return!0x0;}return!0x1;}['_handleMarkerChanges'](_0x504359){for(const {name:_0x449183,data:_0x243710}of _0x504359['model']['document']['differ']['getChangedMarkers']()){if(!_0x449183['startsWith'](rh))continue;const _0x462702=_0x243710['oldRange'],_0x309480=_0x243710['newRange'],_0x153ed0=_0x462702&&'$graveyard'===_0x462702['root']['rootName'],_0x2d4e9a=_0x309480&&'$graveyard'===_0x309480['root']['rootName'];if(_0x153ed0&&_0x2d4e9a)continue;const _0x15d07f=this['_parseMarkerName'](_0x449183);this['_markers']['get'](_0x449183)&&(_0x2d4e9a||!_0x309480?this['_eventEmitter']['fire']('changeMarkerRemoved',{'markerId':_0x449183,'changeId':_0x15d07f['groupId']}):_0x153ed0&&_0x309480&&this['_eventEmitter']['fire']('changeMarkerRestored',{'markerId':_0x449183,'changeId':_0x15d07f['groupId']}));}}['_parseMarkerName'](_0x1bd352){const _0x44f1dc=_0x1bd352['split'](':'),_0x53c59b=(_0x44f1dc[0x1]||'')['split']('_');return{'prefix':_0x44f1dc[0x0],'groupId':_0x53c59b[0x0],'suffix':_0x53c59b[0x1]};}['_translateOperationToEditorContent'](_0x1dd4ba,_0x5cb6e5,_0x168f38){if('insert'===_0x1dd4ba['type']){const _0x5e2051=_0x1dd4ba;return new _0x491445(this['_changePosition'](_0x5cb6e5['concat'](_0x5e2051['position']['offset']),_0x168f38),_0x5e2051['nodes'],_0x5e2051['baseVersion']);}if('marker'===_0x1dd4ba['type']&&_0x1dd4ba['name']['startsWith']('$markedRemove')){const _0x19b6b0=_0x1dd4ba;return new _0x43f670(_0x19b6b0['name'],_0x19b6b0['oldRange'],this['_changeRange'](_0x19b6b0['newRange'],_0x5cb6e5['concat'](_0x19b6b0['newRange']['start']['offset']),_0x5cb6e5['concat'](_0x19b6b0['newRange']['end']['offset']),_0x168f38),_0x19b6b0['_markers'],_0x19b6b0['affectsData'],_0x19b6b0['baseVersion']);}return _0x1dd4ba;}['_groupAdjacentOperations'](_0x53a66f){if(!_0x53a66f['length'])return[];const _0x34a6cd=[];let _0x5ecd98=0x0,_0x1b0af3=0x0,_0x12f65f=[];for(let _0x19e126=0x0;_0x19e126<=_0x53a66f['length'];_0x19e126++){const _0x18f07c=_0x53a66f[_0x19e126],_0x118dd7=_0x53a66f[_0x19e126-0x1];!_0x18f07c||_0x118dd7&&!this['_getOperationEnd'](_0x118dd7)['isTouching'](this['_getOperationStart'](_0x18f07c))?(_0x34a6cd['push']({'operations':_0x12f65f,'operationsIsolated':_0x12f65f['map'](_0x7f9cb9=>this['_shiftOperation'](_0x7f9cb9['clone'](),-_0x1b0af3)),'groupOffset':_0x5ecd98}),_0x12f65f=_0x18f07c?[_0x18f07c]:[],_0x1b0af3+=_0x5ecd98,_0x5ecd98=0x0):_0x12f65f['push'](_0x18f07c),_0x18f07c&&'insert'===_0x18f07c['type']&&(_0x5ecd98+=_0x18f07c['howMany']);}return _0x34a6cd;}['_findAdjacentContextDistance'](_0x5b1874,_0x4149b1,_0x524964,_0xc36f8=0x1){const _0x542fcd=new _0x134ed6({'startPosition':_0x5b1874,'direction':_0x4149b1});let _0x289485=0x0;for(let _0x36a80d=0x0;_0x36a80d<_0xc36f8;_0x36a80d++){let _0x26aa30=0x0,_0x920c3a=!0x1,_0x14f9be='forward'===_0x4149b1?/^\W*\w+/:/\w+\W*$/;for(const {item:_0x269f53}of _0x542fcd)if(_0x269f53['is']('$textProxy')){const _0x3142f7=_0x14f9be['exec'](_0x269f53['data']);if(_0x3142f7&&_0x3142f7['length']){if(_0x26aa30+='forward'===_0x4149b1?_0x3142f7['index']+_0x3142f7[0x0]['length']:_0x269f53['data']['length']-_0x3142f7['index'],_0x3142f7[0x0]['length']!==_0x269f53['data']['length'])break;_0x920c3a=!0x0,_0x14f9be='forward'===_0x4149b1?/^\w+/:/\w+$/;}else{if(_0x920c3a)break;_0x26aa30+=_0x269f53['offsetSize'];}}else{if(_0x269f53['is']('element')){_0x524964['isInline'](_0x269f53)&&!_0x920c3a&&(_0x26aa30+=0x1);break;}}_0x289485+=_0x26aa30,_0x542fcd['jumpTo'](_0x5b1874['getShiftedBy']('forward'===_0x4149b1?_0x289485:-_0x289485));}return _0x289485;}['_getChangeContext'](_0x50952b,_0x4f0303,_0x17c3a9){const _0x2f5510=_0x17c3a9['model']['schema'],_0x32c383=this['_findAdjacentContextDistance'](_0x50952b,'backward',_0x2f5510,0x6),_0x116418=this['_findAdjacentContextDistance'](_0x4f0303,'forward',_0x2f5510,0x6),_0x3d36b6=_0x50952b['getShiftedBy'](-_0x32c383),_0x258a63=_0x4f0303['getShiftedBy'](_0x116418);return{'start':_0x3d36b6,'end':_0x258a63,'hasContentBefore':!_0x3d36b6['isAtStart'],'hasContentAfter':!_0x258a63['isAtEnd']};}['_insertMarkers'](_0x17a4f3,_0x2e1ff6){const _0x23b9be=this['context']['plugins']['get']('AIEditing'),_0x2614a0=new Set();_0x2e1ff6['model']['change'](_0x4ec75a=>{for(const _0x505e7b of _0x17a4f3){const _0x2c8623=''+rh+_0x505e7b['type']+':'+_0x505e7b['groupId']+'_'+_0x23b9be['_nextDataId'](_0x2614a0);this['_markers']['set'](_0x2c8623,{'id':_0x2c8623,'groupId':_0x505e7b['groupId'],'type':_0x505e7b['type'],'content':_0x505e7b['content'],'editor':_0x2e1ff6}),_0x4ec75a['addMarker'](_0x2c8623,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x4ec75a['createRange'](_0x505e7b['start'],_0x505e7b['end'])});}});}['_createGetContextFn'](_0x1e345e,_0x5f5897,_0x1f296a){let _0x2f6542='';return()=>{if(!_0x2f6542){const _0x1290ae=_0x5f5897['toView'](_0x1e345e,{'showSuggestionHighlights':!0x0});let _0x5c87b1=_0x1290ae['getChild'](0x0);if(_0x5c87b1['is']('containerElement')||(_0x5c87b1=_0x1290ae),!_0x5c87b1)return'';let _0x138f35=!0x1;const _0x5171ba=[];for(const _0x4fb4f0 of _0x5c87b1['getChildren']())_0x4fb4f0['is']('element','span')&&_0x4fb4f0['hasClass']('ck-ai_review-marker_context-end')&&(_0x138f35=!0x1),_0x138f35&&_0x5171ba['push'](_0x4fb4f0),_0x4fb4f0['is']('element','span')&&_0x4fb4f0['hasClass']('ck-ai_review-marker_context-start')&&(_0x138f35=!0x0);_0x5c87b1['_removeChildren'](0x0,_0x5c87b1['childCount']),_0x1f296a?.['ellipsisBefore']&&_0x5c87b1['_appendChild']('…'),_0x5c87b1['_appendChild'](_0x5171ba),_0x1f296a?.['ellipsisAfter']&&_0x5c87b1['_appendChild']('…');const _0x3f4c4c=_0x5f5897['htmlProcessor']['domConverter']['viewToDom'](_0x1290ae),_0x3a38bf=_0x5f5897['htmlProcessor']['htmlWriter']['getHtml'](_0x3f4c4c);_0x2f6542=this['_removeUnsupportedElements'](_0x3a38bf);}return _0x2f6542;};}['_createGetContentFn'](_0x20920c,_0x1be5cd){let _0x5de27a='';return()=>(_0x5de27a||(_0x5de27a=this['_removeUnsupportedElements'](_0x1be5cd['stringify'](_0x20920c,{'showSuggestionHighlights':!0x0}))),_0x5de27a);}['_createGetContentUsingDataIdFn'](_0x4f52ff,_0x30795b,_0x4f632c){let _0x29493d='';return()=>{if(!_0x29493d){const _0x4b8f87=_0x4f632c['toView'](new _0x500fd6(_0x4f52ff));_0x29493d=_0x4f632c['htmlProcessor']['domConverter']['viewToDom'](_0x4b8f87)['querySelector']('[data-id=\x22'+_0x30795b+'\x22]')?.['outerHTML']||'';}return _0x29493d;};}['_removeUnsupportedElements'](_0x5e13e5){if(!_0x5e13e5)return'';const _0x1de26d=Is(_0x5e13e5,{'decodeEntities':!0x1}),_0x1eb713=Ts(_0x1de26d);if(!_0x1eb713['length'])return _0x5e13e5;for(const _0x3d4867 of _0x1eb713)_0x5d7a74(_0x3d4867);return ps(_0x1de26d,{'encodeEntities':!0x1});}['_neutralizeChangesOnUnsupportedElements'](_0x4beebc,_0xe4d058){const _0x2f7a9a=Is(_0x4beebc,{'decodeEntities':!0x1}),_0x1a43b0=Is(_0xe4d058,{'decodeEntities':!0x1}),_0x4a11b3=Ts(_0x2f7a9a),_0x2e8917=Ts(_0x1a43b0);if(!_0x4a11b3['length']&&!_0x2e8917['length'])return{'contentInitial':_0x4beebc,'contentNew':_0xe4d058};const _0x3a76cf=new Map();for(const _0x1f827c of _0x4a11b3)_0x3a76cf['set'](Cs(_0x1f827c,'data-id'),_0x1f827c);for(const _0x47eac1 of _0x2e8917){const _0x2a96da=Cs(_0x47eac1,'data-id'),_0x15b0d6=_0x2a96da?_0x3a76cf['get'](_0x2a96da):void 0x0;_0x15b0d6?_0xf9e0b3(_0x47eac1,_0x5c7833(_0x15b0d6,!0x0)):_0x5d7a74(_0x47eac1);}return{'contentInitial':ps(_0x2f7a9a,{'encodeEntities':!0x1}),'contentNew':ps(_0x1a43b0,{'encodeEntities':!0x1})};}['_findMarkerElement'](_0x437bd3,_0x1b0001=0x5){let _0x5f0af0=_0x437bd3,_0x3f366f=null;for(let _0x542448=0x0;_0x542448<_0x1b0001&&_0x5f0af0;_0x542448++)if(_0x5f0af0['className']){if((''+_0x5f0af0['className'])['includes']('ck-ai_review-marker_')){if(!_0x5f0af0['getAttribute']('data-marker-id'))break;_0x3f366f=_0x5f0af0;break;}_0x5f0af0=_0x5f0af0['parentElement'];}else _0x5f0af0=_0x5f0af0['parentElement'];return _0x3f366f;}['_findMarkerElementById'](_0x409e52){const _0x723c49=this['_markers']['get'](_0x409e52);if(!_0x723c49)return null;const _0xc7391f=_0x723c49['editor']['model']['markers']['get'](_0x409e52);return _0xc7391f?_0xee7c03(_0x723c49['editor']['editing'],_0xc7391f):null;}['_getMarkersDataForGroup'](_0x354b85){return Array['from'](this['_markers']['values']())['filter'](_0x1c20e3=>_0x1c20e3['groupId']===_0x354b85);}['_getOperationStart'](_0x3b4c07){return'insert'===_0x3b4c07['type']?_0x3b4c07['position']:_0x3b4c07['newRange']['start'];}['_getOperationEnd'](_0x23baa6,_0x414370=!0x1){return'insert'===_0x23baa6['type']?_0x414370?_0x23baa6['position']:_0x23baa6['position']['getShiftedBy'](_0x23baa6['howMany']):_0x23baa6['newRange']['end'];}['_shiftOperation'](_0x1aef50,_0x362c05){return'insert'===_0x1aef50['type']?_0x1aef50['position']=_0x1aef50['position']['getShiftedBy'](_0x362c05):'marker'===_0x1aef50['type']&&_0x1aef50['newRange']&&(_0x1aef50['newRange']=new _0x15a2ab(_0x1aef50['newRange']['start']['getShiftedBy'](_0x362c05),_0x1aef50['newRange']['end']['getShiftedBy'](_0x362c05))),_0x1aef50;}['_changeOperationOwnerDocument'](_0x2a342b,_0x41a8ba){'insert'===_0x2a342b['type']?_0x2a342b['position']=this['_changePositionOwnerDocument'](_0x2a342b['position'],_0x41a8ba):'marker'===_0x2a342b['type']&&_0x2a342b['newRange']&&(_0x2a342b['newRange']=this['_changeRangeOwnerDocument'](_0x2a342b['newRange'],_0x41a8ba));}['_changePositionOwnerDocument'](_0x1cb0e1,_0x27ba8a){return new _0x34d4d5(_0x27ba8a,_0x1cb0e1['path']);}['_changeRangeOwnerDocument'](_0x223e89,_0x2eee31){return new _0x15a2ab(this['_changePositionOwnerDocument'](_0x223e89['start'],_0x2eee31),this['_changePositionOwnerDocument'](_0x223e89['end'],_0x2eee31));}['_changePosition'](_0x307033,_0x1d108e){return new _0x34d4d5(_0x1d108e,[..._0x307033]);}['_changeRange'](_0x5ca3cd,_0x54e19e,_0x4d1e6b,_0x3d5391){return new _0x15a2ab(this['_changePosition'](_0x54e19e,_0x3d5391),this['_changePosition'](_0x4d1e6b,_0x3d5391));}['_sortMarkers'](_0x814710){const _0x5b4ef9=_0x2ce25d=>{switch(_0x2ce25d){case'insert':return 0x0;case'remove-context':return 0x1;case'remove-only':return 0x2;case'remove-text':return 0x3;}};return _0x814710['sort']((_0x52cb0e,_0x672bf3)=>_0x5b4ef9(_0x52cb0e['type'])-_0x5b4ef9(_0x672bf3['type']));}['_hasSameTopLevelElement'](_0x13b40e,_0x476fb4){const _0xd3fdfc=_0x13b40e['getChild'](0x0),_0xcc27a6=_0x476fb4['getChild'](0x0);return!(!_0xd3fdfc||!_0xcc27a6)&&((!_0xd3fdfc['is']('element')||!_0xcc27a6['is']('element')||_0xd3fdfc['name']===_0xcc27a6['name'])&&!(_0xd3fdfc['is']('element')&&!_0xcc27a6['is']('element')||!_0xd3fdfc['is']('element')&&_0xcc27a6['is']('element')));}['_haveSingleTopLevelElement'](_0x36d645){return 0x1===_0x36d645['childCount'];}['_haveOnlyInlineContent'](_0x500b05,_0x307aee){for(const _0x503ecc of _0x500b05['getChildren']())if(_0x503ecc['is']('element')&&!_0x307aee['isInline'](_0x503ecc))return!0x1;return!0x0;}['_upsertDataId'](_0x57a098,_0x17dc63){let _0x592e96=_0x57a098['getAttribute'](_0x2be158);return _0x592e96||(_0x592e96=_0x17dc63(),_0x57a098['_setAttribute'](_0x2be158,_0x592e96)),_0x592e96;}};const ch=/* #__PURE__ -- @preserve */
|
|
38
|
+
lt();var lh=class extends ch{['id'];['contentNew'];['contentInitial'];['documentVersion'];constructor({id:_0x11e750,contentNew:_0x35d3f2,contentInitial:_0xb50b1f,documentVersion:_0x2f4fc6}){super(),this['id']=_0x11e750,this['contentNew']=_0x35d3f2,this['contentInitial']=_0xb50b1f,this['documentVersion']=_0x2f4fc6;}};const uh=/* #__PURE__ -- @preserve */
|
|
39
|
+
_t();var dh=class extends uh{['id'];['parent'];['_data'];['_editorOperations']=[];constructor(_0x351086,_0x4c93eb,_0x28e2a3){super(),this['id']=_0x351086,this['parent']=_0x28e2a3,this['_data']=_0x4c93eb,this['set']('isActivated',!0x1),this['set']('isRated',!0x1),this['set']('status','pending'),this['on']('change:status',()=>{'pending'!==this['status']&&this['isActivated']&&(this['isActivated']=!0x1);});}get['contentDiffed'](){return this['_data']['context']();}get['operations'](){return this['_data']['operations']['slice']();}get['operationsIsolated'](){return this['_data']['operationsIsolated']['slice']();}};const _h=/* #__PURE__ -- @preserve */
|
|
40
|
+
_t();var gh=class extends _h{['id']=Ot();['callId'];['_results']=new Map();['_changes']=[];['_sourceCheck'];['_documentData'];['_aiConnector'];['_reviewParams'];['_reviewArgs'];['_activeRequest']=null;['_currentError'];['_wasAborted']=!0x1;constructor(_0x5a93ed,_0x5f140d,_0x504a2b,_0x445c1b,_0x124a98){super(),this['_sourceCheck']=_0x5f140d,this['_documentData']=_0x5a93ed,this['_aiConnector']=_0x504a2b,this['_reviewParams']=_0x445c1b,this['_reviewArgs']=_0x124a98,this['on']('change:status',(_0x25c3fd,_0x460960,_0x7e6f01)=>{'aborted'==_0x7e6f01&&(this['_wasAborted']=!0x0),this['fire']('reviewCheckRunUpdated',{'status':_0x7e6f01,'run':this,'error':this['_currentError']});}),this['set']('status','initialized');}get['documentData'](){return this['_documentData'];}get['processedResultsCount'](){return this['_results']['size'];}get['title'](){return this['_sourceCheck']['title'];}get['subTitle'](){return'';}get['reviewName'](){return this['_sourceCheck']['id'];}get['hasModifications'](){return!this['_changes']['every'](_0x1683cd=>'pending'===_0x1683cd['status']);}get['currentError'](){return this['_currentError'];}get['results'](){return Array['from'](this['_results']['values']());}['updateDocumentData'](_0x38b9c7){this['_documentData']=_0x38b9c7;}async['start'](){this['status']='loading',this['_currentError']=void 0x0;try{this['_activeRequest']=this['_createApiRequest']();const _0x934163=await this['_activeRequest']['getStream']();this['status']='data';for await(const _0x4d92d2 of _0x934163)'unmodified'!==_0x4d92d2['data']['operation']&&('error'!==_0x4d92d2['data']['operation']?'review-metadata'!==_0x4d92d2['event']?this['_addReviewCheckResult'](_0x4d92d2['data']['dataId'],_0x4d92d2['data']['textDelta']):this['callId']=_0x4d92d2['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(_0x463b38){this['_currentError']=_0x463b38,sn(_0x463b38)?this['status']='aborted':this['status']='error-general';}finally{this['_activeRequest']=null;}}async['restart'](){this['_results']['clear'](),this['_changes']['length']=0x0,this['_currentError']=void 0x0,await this['start']();}['addResultChanges'](_0x1cfdbe,_0x45be11){const _0x49ade9=this['_results']['get'](_0x1cfdbe);if(!_0x49ade9)return;if(0x0===_0x45be11['length'])return;const _0x18a30d=[];_0x45be11['forEach']((_0x23b697,_0x5acd08)=>{const _0x24f689=new dh(_0x49ade9['id']+'-'+_0x5acd08,_0x23b697,_0x49ade9);_0x24f689['on']('change:status',()=>{this['fire']('reviewCheckResultChangeStatusUpdated',{'change':_0x24f689,'status':_0x24f689['status']});}),_0x24f689['on']('change:isActivated',()=>{_0x24f689['isActivated']?this['fire']('reviewCheckResultActivated',{'change':_0x24f689}):this['fire']('reviewCheckResultDeactivated',{'change':_0x24f689});}),this['_changes']['push'](_0x24f689),_0x18a30d['push'](_0x24f689);}),this['fire']('reviewCheckResultReady',{'changes':_0x18a30d,'result':_0x49ade9,'source':this});}['abort'](){this['_activeRequest']&&(this['_activeRequest']['abortController']['abort'](),this['_activeRequest']=null,this['status']='aborted');}['isChangeActive'](_0x5c5e15){const _0x47c2a9=this['_changes']['find'](_0x2771ce=>_0x2771ce['id']===_0x5c5e15);return!(!_0x47c2a9||'pending'!==_0x47c2a9['status']);}['isAnyChangeActivated'](){return this['_changes']['some'](_0x270455=>!0x0===_0x270455['isActivated']);}['getActiveChanges'](){return this['_changes']['filter'](_0x3f1cbb=>'pending'===_0x3f1cbb['status']);}['getChangeById'](_0x426f49){return this['_changes']['find'](_0x5ee179=>_0x5ee179['id']===_0x426f49);}['markAllChangesAsAccepted'](){for(const _0x933374 of this['_changes'])'pending'===_0x933374['status']&&(_0x933374['status']='accepted');this['_checkIfFinished']();}['markChangeAsAccepted'](_0x2adc5d){const _0x599839=this['_changes']['find'](_0x534856=>_0x534856['id']===_0x2adc5d);_0x599839&&'pending'===_0x599839['status']&&(_0x599839['status']='accepted'),this['_checkIfFinished']();}['markChangeAsRejected'](_0x468870){const _0xf3b5fa=this['_changes']['find'](_0x2ca780=>_0x2ca780['id']===_0x468870);_0xf3b5fa&&'pending'===_0xf3b5fa['status']&&(_0xf3b5fa['status']='rejected'),this['_checkIfFinished']();}['markChangeAsOutdated'](_0x31177f){const _0x338e9b=this['_changes']['find'](_0x4daa1e=>_0x4daa1e['id']===_0x31177f);_0x338e9b&&'pending'===_0x338e9b['status']&&(_0x338e9b['status']='outdated'),this['_checkIfFinished']();}['markChangeAsPending'](_0x48b273){const _0x23e4cd=this['_changes']['find'](_0x51f3ae=>_0x51f3ae['id']===_0x48b273);_0x23e4cd&&'outdated'===_0x23e4cd['status']&&(_0x23e4cd['status']='pending'),this['_checkIfFinished']();}['activateChange'](_0x13450a){this['_changes']['filter'](_0x5bbe5c=>_0x5bbe5c['isActivated']&&_0x5bbe5c['id']!==_0x13450a)['forEach'](_0x3639d3=>{_0x3639d3['isActivated']=!0x1;});const _0x3b58d2=this['_changes']['find'](_0x355832=>_0x355832['id']===_0x13450a);_0x3b58d2&&'pending'===_0x3b58d2['status']&&(_0x3b58d2['isActivated']=!0x0);}['deactivateChange'](){this['_changes']['filter'](_0x4c3c94=>_0x4c3c94['isActivated'])['forEach'](_0x5d96c4=>{_0x5d96c4['isActivated']=!0x1;});}['forceReadyState'](){this['status']='ready';}async['sendRating'](_0x5158ca){if('initialized'===this['status']||'loading'===this['status']||'data'===this['status']||this['_wasAborted'])return;if(!this['callId']||0x0===this['_changes']['length'])return;let _0x11b93e;if(_0x5158ca){const _0x24ec47=this['_changes']['find'](_0x22ab26=>_0x22ab26['id']===_0x5158ca);if(_0x24ec47&&_0x24ec47['isRated'])return;_0x24ec47&&(_0x11b93e=_0x24ec47['parent']['id'],_0x24ec47['isRated']=!0x0);}const _0x245b42={'positiveCount':this['_changes']['filter'](_0x38e32c=>'accepted'===_0x38e32c['status'])['length'],'totalCount':this['_changes']['length']};this['_sendRatingRequest'](_0x245b42,this['callId'],_0x11b93e);}['_addReviewCheckResult'](_0x3882cb,_0x1563f9){const _0x30f979=this['_documentData']['elements']['get'](_0x3882cb);if(!_0x30f979)return;const _0x1d9363=_0x30f979['getContent']();if(_0x1d9363===_0x1563f9)return;const _0x3ed2a2=new lh({'id':_0x3882cb,'contentInitial':_0x1d9363,'contentNew':_0x1563f9,'documentVersion':_0x30f979['documentVersion']});this['_results']['set'](_0x3ed2a2['id'],_0x3ed2a2),this['fire']('reviewCheckResultAdded',{'result':_0x3ed2a2,'source':this,'editor':_0x30f979['editor']});}['_checkIfFinished'](){'finished'===this['status']&&this['_changes']['filter'](_0x1cf4ce=>'pending'===_0x1cf4ce['status'])['length']>0x0&&(this['status']='ready'),'ready'===this['status']&&0x0===this['_changes']['filter'](_0x2083da=>'pending'===_0x2083da['status'])['length']&&(this['status']='finished');}},Ah=class extends gh{get['subTitle'](){if(!this['_reviewParams']||0x0===this['_reviewParams']['length'])return'';const _0x2e7374=[];if(this['_reviewParams']['length']>0x0&&this['_sourceCheck']['options'])for(let _0x1d2b97=0x0;_0x1d2b97<this['_reviewParams']['length'];_0x1d2b97++){if(!this['_reviewParams'][_0x1d2b97]||!this['_sourceCheck']['options'][_0x1d2b97])continue;const _0x38a0da=this['_sourceCheck']['options'][_0x1d2b97]['data']?.['find'](_0x2280ee=>_0x2280ee['id']===this['_reviewParams'][_0x1d2b97]);_0x38a0da&&_0x2e7374['push'](_0x38a0da['label']);}return _0x2e7374['join'](',\x20');}get['reviewName'](){return this['_composeReviewName']();}['_createApiRequest'](){return this['_aiConnector']['callSystemReview']({'reviewName':this['_composeReviewName'](),'content':this['_documentData']['content'],'args':this['_reviewArgs']});}['_sendRatingRequest'](_0x3dbed5,_0x35d787,_0x1ec0c7){return this['_aiConnector']['upsertAIReviewRating'](this['reviewName'],_0x35d787,_0x3dbed5,_0x1ec0c7);}['_composeReviewName'](){return!this['_reviewParams']||0x0===this['_reviewParams']['length']||this['_sourceCheck']['useArgs']?this['_sourceCheck']['apiId']:[this['_sourceCheck']['apiId'],...this['_reviewParams']]['join']('-');}},Ih=class extends _0x2d0760{['_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',(_0x2c543b,_0xb9ee37)=>this['runCheck'](_0xb9ee37)),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 _0x1f5254=this['_currentReviewCheckRun']['getActiveChanges']();if(!_0x1f5254['length'])return;this['_aiReviewCoreEditing']['applyChange'](_0x1f5254['map'](_0x4191fa=>_0x4191fa['id']),this['_aiSource']);const _0x1a8bbf=this['_currentReviewCheckRun'];_0x1a8bbf['markAllChangesAsAccepted'](),_0x1a8bbf['sendRating']();}),this['listenTo'](this['_aiReviewCoreUi'],'acceptChange',(_0x2c5791,_0x27d37e)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x27d37e['id'])&&(this['_aiReviewCoreEditing']['applyChange']([_0x27d37e['id']],this['_aiSource']),this['_currentReviewCheckRun']['markChangeAsAccepted'](_0x27d37e['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x27d37e['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'dismissChange',(_0x23b930,_0x48e19e)=>{this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['isChangeActive'](_0x48e19e['id'])&&(this['_aiReviewCoreEditing']['rejectChange'](_0x48e19e['id']),this['_currentReviewCheckRun']['markChangeAsRejected'](_0x48e19e['id']),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_currentReviewCheckRun']['sendRating'](_0x48e19e['id']));}),this['listenTo'](this['_aiReviewCoreUi'],'retryReview',async()=>{this['_currentReviewCheckRun']&&(this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_currentReviewCheckRun']['updateDocumentData'](this['_aiReviewCoreEditing']['getDocumentData']()),await this['_currentReviewCheckRun']['restart']());}),this['listenTo'](this['_aiReviewCoreUi'],'activateChange',(_0x4fad5e,_0xc08e0a)=>{this['_onActivateChange'](_0xc08e0a);}),this['listenTo'](this['_aiReviewCoreUi'],'deactivateChange',(_0x55ff8f,_0x47175d)=>{this['_onDeactivateChange'](_0x47175d);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerClicked',(_0x6f5f1b,_0x792346)=>{this['_onChangeMarkerClicked'](_0x6f5f1b,_0x792346);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerHovered',(_0x3bc73c,_0xc7d8bb)=>{this['_onChangeMarkerHovered'](_0x3bc73c,_0xc7d8bb);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerBlurred',()=>{this['_onChangeMarkerBlurred']();}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRemoved',(_0x579f7e,_0x29341f)=>{this['_onChangeMarkerRemoved'](_0x579f7e,_0x29341f);}),this['listenTo'](this['_aiReviewCoreEditing']['emitter'],'changeMarkerRestored',(_0x3b8835,_0x5b8ed3)=>{this['_onChangeMarkerRestored'](_0x3b8835,_0x5b8ed3);});}async['runCheck'](_0x24694d){if(!this['_availableReviewChecks'])return;const _0x2893af=this['_availableReviewChecks']['find'](_0x204fae=>_0x204fae['id']===_0x24694d['id']);if(_0x2893af){this['_onReviewCheckRun'](_0x24694d),this['_aiReviewCoreEditing']['switchToReadOnly'](),this['_currentReviewCheckRun']=this['_createReviewCheckRun'](_0x24694d,_0x2893af),this['_aiReviewCoreUi']['setCheckResultTitle'](this['_currentReviewCheckRun']['title'],this['_currentReviewCheckRun']['subTitle']),this['_currentReviewCheckRun']['on']('reviewCheckRunUpdated',(_0x179342,_0x381f18)=>{switch(_0x381f18['status']){case'data':case'loading':this['_aiReviewCoreUi']['showCheckRunResults'](_0x381f18);break;case'finished':this['_onCheckRunFinished']();break;case'ready':this['_aiReviewCoreUi']['showActionsWhenResultIsReady']();break;case'unmodified':this['_aiReviewCoreUi']['showNoChangesView']();break;case'error-general':this['_aiReviewCoreUi']['showGeneralResultsErrorView'](),this['_logError'](new at('ai-review-mode-check-run-general-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'error-chunk':this['_aiReviewCoreUi']['showChunkErrorView'](),this['_logError'](new at('ai-review-mode-check-run-chunk-error',this,void 0x0,this['_currentReviewCheckRun']?.['currentError']));break;case'aborted':this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['processedResultsCount']>0x0?setTimeout(()=>{this['_currentReviewCheckRun']?.['forceReadyState']();},0x0):this['_onReviewRunLeave'](!0x0);}'ready'!==_0x381f18['status']&&'error-chunk'!==_0x381f18['status']&&'error-general'!==_0x381f18['status']||this['_currentReviewCheckRun']?.['sendRating']();}),this['_currentReviewCheckRun']['on']('reviewCheckResultAdded',(_0x53215c,_0xbfaccd)=>{if(!this['_currentReviewCheckRun'])throw new at('ai-review-mode-no-current-check-run',this);const _0x40dace=this['_diffContent'](_0xbfaccd['editor'],_0xbfaccd['result']['contentInitial'],_0xbfaccd['result']['contentNew']);_0xbfaccd['source']['addResultChanges'](_0xbfaccd['result']['id'],_0x40dace);}),this['_currentReviewCheckRun']['on']('reviewCheckResultReady',(_0x4239f5,_0x122665)=>{for(const _0x41b3d3 of _0x122665['changes'])this['_aiReviewCoreUi']['showCheckRunResult'](_0x41b3d3);this['_markChangePositionInEditorContent'](_0x122665['changes'],_0x122665['source']['documentData']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultChangeStatusUpdated',(_0x3420cf,_0x2a650c)=>{this['_aiReviewCoreUi']['updateChangeState'](_0x2a650c['change']['id'],_0x2a650c['status']);}),this['_currentReviewCheckRun']['on']('reviewCheckResultActivated',(_0x1facb9,_0x16bf95)=>{this['_onReviewCheckResultActivated'](_0x16bf95);}),this['_currentReviewCheckRun']['on']('reviewCheckResultDeactivated',()=>{this['_onReviewCheckResultDeactivated']();});try{await this['_currentReviewCheckRun']['start']();}catch(_0x1b497f){if(sn(_0x1b497f))return;_0x1b497f instanceof at?this['_logError'](_0x1b497f):this['_logError'](new at('ai-review-mode-check-run-failed',this,void 0x0,_0x1b497f));}}else this['_logError'](new at('ai-review-mode-source-check-not-found',this,{'checkId':_0x24694d['id']}));}['abort'](){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['abort']();}['getAvailableChecks'](){return(this['_availableReviewChecks']??[])['slice']();}['getCurrentCheckRun'](){return this['_currentReviewCheckRun'];}['_createReviewCheckRun'](_0x5d1773,_0x53c4e5){return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x53c4e5,this['_aiConnector'],_0x5d1773['params'],_0x5d1773['args']);}['_onChangeMarkerRemoved'](_0x129b9e,_0x3064c1){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsOutdated'](_0x3064c1['changeId']);}['_onChangeMarkerRestored'](_0x430ed6,_0x3b69c8){this['_currentReviewCheckRun']&&this['_currentReviewCheckRun']['markChangeAsPending'](_0x3b69c8['changeId']);}['_onCheckRunFinished'](){this['_aiReviewCoreUi']['showReviewCompletedView']();}['_initRequiredPlugins'](){this['_aiConnector']=this['context']['plugins']['get']('AIConnector'),this['_reporter']=this['context']['plugins']['get'](rn)['createReporter']('aireview');}['_onReviewRunLeave'](_0x318aab=!0x1){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['hasModifications']||this['_currentReviewCheckRun']['sendRating'](),this['_currentReviewCheckRun']['stopListening'](),this['_currentReviewCheckRun']['abort'](),this['_currentReviewCheckRun']=void 0x0),_0x318aab&&this['_aiReviewCoreUi']['showReviewCheckList'](),this['_aiReviewCoreEditing']['clearAllMarkers'](),this['_aiReviewCoreEditing']['switchToEdit'](),this['_changeActivationSource']=null;for(const _0x548940 of this['_aiReviewCoreEditing']['getEditors']())_0x548940['editing']['view']['change'](_0xbe21a3=>{for(const _0x5dfd1c of _0x548940['editing']['view']['document']['getRoots']())_0xbe21a3['removeClass']('ck-ai_review-diff',_0x5dfd1c),_0xbe21a3['removeClass']('ck-ai_review-highlights',_0x5dfd1c),_0xbe21a3['removeClass']('ck-ai-translate-mode-content',_0x5dfd1c);});}['_logError'](_0x322e04){this['_reporter']['logError'](_0x322e04),'ai-review-mode-models-unable-to-retrieve'===function(_0x4e9654){return _0x4e9654 instanceof nn?_0x4e9654['code']:_0x4e9654 instanceof Error?_0x4e9654['message']['match'](/^\S+/)?.[0x0]:void 0x0;}(_0x322e04)?this['_aiReviewCoreUi']['showGeneralReviewCoreErrorView']():this['_aiReviewCoreUi']['showGeneralResultsErrorView']();}['_scrollToChange'](_0x27fabe){if('content'===this['_changeActivationSource']){const _0x3f5114=this['_aiReviewCoreUi']['getChangeElement'](_0x27fabe);_0x3f5114&&bt(_0x3f5114['closest']('.ck-ai_review__check-run-result')||_0x3f5114);}else{if('panel'===this['_changeActivationSource']){const _0x4e8f70=this['_getChangeContentElement'](_0x27fabe);if(!_0x4e8f70)return;St({'target':_0x4e8f70,'viewportOffset':{'top':0x55,'left':0x0,'bottom':0x0,'right':0x0},'ancestorOffset':0x14,'alignToTop':!0x0});}}}},ph=class extends gh{['_prompt'];['_model'];constructor(_0xb01e02,_0xb3b192,_0x5772c9,_0x17c07b,_0x56a144){super(_0x5772c9,_0x17c07b,_0x56a144),this['_prompt']=_0xb01e02,this['_model']=_0xb3b192;}get['subTitle'](){return this['_prompt'];}['_createApiRequest'](){return this['_aiConnector']['callCustomReview']({'content':this['_documentData']['content'],'prompt':this['_prompt'],'model':this['_model']});}['_sendRatingRequest'](_0x57585d,_0x56f661,_0x208676){return this['_aiConnector']['upsertCustomAIReviewRating'](_0x56f661,_0x57585d,_0x208676);}},mh=class{['id'];['commandId'];['title'];['description'];['isParameterized'];['useArgs'];['options'];['args'];get['apiId'](){return this['commandId'];}constructor(_0x21960c){this['id']=_0x21960c['id'],this['commandId']=_0x21960c['commandId'],this['title']=_0x21960c['title'],this['description']=_0x21960c['description'],this['isParameterized']=_0x21960c['isParameterized'],this['useArgs']=_0x21960c['useArgs'],this['options']=_0x21960c['options'],this['args']=_0x21960c['args'];}},Eh=class extends mh{['isExtra']=!0x0;['prompt'];['model'];['_defaultModel']=null;constructor(_0xc6829e,_0xe7eeaa,_0x24ffdd){super(_0xc6829e),this['prompt']=_0xc6829e['prompt'],this['model']=_0xc6829e['model'],this['model']?this['_defaultModel']=_0xe7eeaa['find'](_0x3b05ab=>_0x3b05ab['id']===this['model'])||null:this['_defaultModel']=_0x24ffdd;}get['defaultModel'](){return this['_defaultModel'];}},Th=class extends ph{get['subTitle'](){return'';}set['prompt'](_0x58c8fd){this['_prompt']=_0x58c8fd;}set['model'](_0x2e2404){this['_model']=_0x2e2404;}},wh=class extends _0x2d0760{static get['requires'](){return[cs,rn];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['_cache'];['_reporter'];['init'](){this['_reporter']=this['context']['plugins']['get'](rn)['createReporter']('aireview');}['getChecksList'](){return this['_cache']||(this['_cache']=this['_loadChecksList']()),this['_cache'];}};const Ch=[{'id':'custom','commandId':'custom','title':'Custom\x20command','description':'Type\x20a\x20custom\x20command\x20to\x20review\x20the\x20content\x20exactly\x20as\x20you\x20need.','isParameterized':!0x0},{'id':'correctness','commandId':'correctness','title':'Correctness','description':'Ensure\x20the\x20text\x20is\x20factually\x20accurate\x20and\x20free\x20of\x20errors.','isParameterized':!0x1},{'id':'clarity','commandId':'clarity','title':'Clarity','description':'Improve\x20the\x20clarity\x20and\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'readability','commandId':'readability','title':'Readability','description':'Enhance\x20the\x20overall\x20readability\x20of\x20the\x20text.','isParameterized':!0x1},{'id':'length','commandId':'make','title':'Adjust\x20length','description':'Refine\x20text\x20length\x20to\x20match\x20your\x20needs.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20length','default':'longer','data':[{'label':'Longer','id':'longer'},{'label':'Shorter','id':'shorter'}]}]},{'id':'tone','commandId':'make-tone','title':'Adjust\x20tone\x20and\x20style','description':'Choose\x20tone\x20and\x20style\x20to\x20change\x20content\x20as\x20you\x20need.','isParameterized':!0x0,'options':[{'formType':'dropdown','label':'Adjust\x20tone\x20and\x20style','default':'casual','data':[{'label':'Casual','id':'casual'},{'label':'Direct','id':'direct'},{'label':'Friendly','id':'friendly'},{'label':'Confident','id':'confident'},{'label':'Professional','id':'professional'}]}]}],fh=/* #__PURE__ -- @preserve */
|
|
41
|
+
_t();var bh=class extends fh{['_checks']=[];['setupChecks'](_0x3185d9){this['_checks']=_0x3185d9['map'](_0x1ace49=>new mh(_0x1ace49));}get['checks'](){return this['_checks']['slice']();}['getCheckById'](_0x18e1cf){return this['checks']['find'](_0x124aca=>_0x124aca['id']===_0x18e1cf);}['removeCheckById'](_0x4d429c){this['_checks']=this['_checks']['filter'](_0x53580d=>_0x53580d['id']!==_0x4d429c);}},Sh=class extends mh{['_models']=[];['_defaultModel']=null;constructor(_0x521066,_0x4abe10,_0x1e4b12){super(_0x521066),this['_models']=_0x4abe10,this['_defaultModel']=_0x1e4b12;}get['models'](){return this['_models']['slice']();}get['defaultModel'](){return this['_defaultModel'];}},Rh=class extends bh{['_allModels']=[];['_recommendedModels']=[];['_defaultModel']=null;constructor(_0x4a760c,_0x51e436,_0x4524e6){super(),this['_allModels']=_0x4a760c,this['_recommendedModels']=_0x51e436,this['_defaultModel']=_0x4524e6;}get['allModels'](){return this['_allModels']['slice']();}['setupChecks'](_0x28ea90){this['_checks']=_0x28ea90['map'](_0x46c8fa=>!0x0===_0x46c8fa['isExtra']?new Eh(_0x46c8fa,this['_allModels'],this['_defaultModel']):'custom'===_0x46c8fa['id']?new Sh(_0x46c8fa,this['_recommendedModels'],this['_defaultModel']):new mh(_0x46c8fa));}},Oh=class extends wh{static get['pluginName'](){return'AIReviewModeCheckRegistry';}['_modelsLoadError']=null;constructor(_0x30d15c){super(_0x30d15c),this['context']['config']['define']('ai.review.extraCommands',[]);}get['modelsLoadError'](){return this['_modelsLoadError'];}['getExtraChecks'](){return this['context']['config']['get']('ai.review.extraCommands')['map'](_0x43cf27=>({'id':_0x43cf27['id'],'commandId':_0x43cf27['id'],'title':_0x43cf27['label'],'description':_0x43cf27['description'],'isParameterized':!0x1,'isExtra':!0x0,'prompt':_0x43cf27['prompt'],'model':_0x43cf27['model']}));}async['_loadChecksList'](){const _0x17825b=[...Ch,...this['getExtraChecks']()]['map'](_0x24b69d=>_0x24b69d['isExtra']?_0x24b69d:this['_translateReviewCheck'](_0x24b69d)),_0x23c4e6=await this['_getModels'](),_0x44a0c0=new Rh(_0x23c4e6['all'],_0x23c4e6['recommended'],_0x23c4e6['default']);return _0x44a0c0['setupChecks'](_0x17825b),_0x44a0c0;}async['_getModels'](){const _0x4d5eca=this['context']['plugins']['get']('AIConnector');try{const _0x7556f8=new Xs({'connector':_0x4d5eca,'config':this['context']['config']['get']('ai.models'),'locale':this['context']['locale']}),_0x1cdd98={'all':await _0x7556f8['getAll'](),'recommended':await _0x7556f8['getAvailableModels'](),'default':await _0x7556f8['getDefault']()};return this['_modelsLoadError']=null,_0x1cdd98;}catch(_0x12b1b6){return this['_modelsLoadError']=new at('ai-review-mode-models-unable-to-retrieve',this,void 0x0,_0x12b1b6),this['_reporter']['logError'](this['_modelsLoadError'],{'context':{'operation':'load-review-models'}}),{'all':[],'recommended':[],'default':null};}}['_translateReviewCheck'](_0x2b44ed){const _0x54b29e='AI_REVIEW_CHECK_'+_0x2b44ed['commandId']['toUpperCase']()['replaceAll']('-','_'),_0x598899={..._0x2b44ed,'title':this['_translate'](_0x54b29e+'_TITLE',_0x2b44ed['title']),'description':this['_translate'](_0x54b29e+'_DESCRIPTION',_0x2b44ed['description'])};return _0x2b44ed['options']&&(_0x598899['options']=_0x2b44ed['options']['map'](_0x2900bb=>({..._0x2900bb,'label':this['_translate'](_0x54b29e+'_OPTIONS_LABEL',_0x2900bb['label']||''),'data':_0x2900bb['data']?_0x2900bb['data']['map'](_0x27219e=>({..._0x27219e,'label':this['_translate'](_0x54b29e+'_OPTIONS_DATA_'+_0x27219e['id']['toUpperCase'](),_0x27219e['label'])})):void 0x0}))),_0x598899;}['_translate'](_0x4002bb,_0x441a1d){const _0x3e0a90=ls(this['context']['locale'],_0x4002bb);return _0x3e0a90===_0x4002bb?_0x441a1d:_0x3e0a90;}},vh=class extends Ih{static get['pluginName'](){return'AIReviewModeController';}static get['requires'](){return[rn,Oh];}get['_aiSource'](){return'review';}['_isDiffOn']=!0x1;['_usesAvailableCommandsConfig'];constructor(_0xe78e4c){super(_0xe78e4c),this['_usesAvailableCommandsConfig']=Boolean(this['context']['config']['get']('ai.review.availableCommands')),this['context']['config']['define']('ai.review.availableCommands',Ch['map'](_0x5d699c=>_0x5d699c['id']));}['init'](){super['init'](),this['listenTo'](this['_aiReviewCoreUi'],'toggleDiff',(_0x2a11d2,_0x95777)=>{this['_isDiffOn']=_0x95777['on'],this['_onDiffChange'](this['_isDiffOn']);});}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AIReviewModeUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x565ded,_0x301d39){if(_0x565ded['isCustom'])return new ph(_0x565ded['args']['prompt'],_0x565ded['args']['model'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x301d39,this['_aiConnector']);if(_0x301d39['isExtra']){const _0x538558=_0x301d39;return new Th(_0x565ded['args']?.['prompt']??_0x538558['prompt'],_0x565ded['args']?.['model']??_0x538558['defaultModel']['id'],this['_aiReviewCoreEditing']['getDocumentData'](),_0x301d39,this['_aiConnector']);}return new Ah(this['_aiReviewCoreEditing']['getDocumentData'](),_0x301d39,this['_aiConnector'],_0x565ded['params'],_0x565ded['args']);}['_onReviewCheckResultActivated'](_0x51369a){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x51369a['change']['id']),this['_scrollToChange'](_0x51369a['change']['id']);const _0x366ec9=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x51369a['change']['id']);if(!_0x366ec9)return;const _0x4629ec=this['_aiReviewCoreEditing']['getEditorForChange'](_0x51369a['change']['id'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x51369a['change'],()=>_0x366ec9['getElement'](),void 0x0,'click',this['_getBalloonDomRoot'](_0x4629ec,_0x366ec9['modelRange']['root']['rootName']),_0x4629ec?.['ui']?.['viewportOffset']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x51369a['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreUi']['resetActiveStateInResults'](),this['_aiReviewCoreUi']['hideChangeBalloon'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']();}['_onActivateChange'](_0x162391){this['_currentReviewCheckRun']&&'click'===_0x162391['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x162391['id']));}['_onDeactivateChange'](_0x136e90){this['_currentReviewCheckRun']&&'balloon'===_0x136e90['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x1fd71c,_0x5890cb){if(!this['_currentReviewCheckRun'])return;this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5890cb['changeId']);const _0x4adbfe=this['_currentReviewCheckRun']['getChangeById'](_0x5890cb['changeId']);if(!_0x4adbfe)return;const _0x433e17=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x5890cb['changeId']),_0x57f19d=this['_aiReviewCoreEditing']['getEditorForChange'](_0x5890cb['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x4adbfe,_0x5890cb['markerElement'],_0x5890cb['domEvent'],'click',this['_getBalloonDomRoot'](_0x57f19d,_0x433e17?.['modelRange']['root']['rootName']),_0x57f19d?.['ui']?.['viewportOffset']);}['_onChangeMarkerHovered'](_0xc6ab6c,_0x2e45aa){if(!this['_currentReviewCheckRun'])return;if(this['_currentReviewCheckRun']['isAnyChangeActivated']())return;const _0x58182f=this['_currentReviewCheckRun']['getChangeById'](_0x2e45aa['changeId']);if(!_0x58182f)return;const _0x33822b=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0x2e45aa['changeId']),_0x26b5fa=this['_aiReviewCoreEditing']['getEditorForChange'](_0x2e45aa['changeId'])??this['_aiReviewCoreEditing']['getEditor']();this['_aiReviewCoreUi']['showChangeBalloon'](_0x58182f,_0x2e45aa['markerElement'],_0x2e45aa['domEvent'],'hover',this['_getBalloonDomRoot'](_0x26b5fa,_0x33822b?.['modelRange']['root']['rootName']),_0x26b5fa?.['ui']?.['viewportOffset']);}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&(this['_currentReviewCheckRun']['isAnyChangeActivated']()||this['_aiReviewCoreUi']['hideChangeBalloon']());}['_getChangeContentElement'](_0xfd9215){const _0x16f29f=this['_aiReviewCoreEditing']['getMarkerElementForChange'](_0xfd9215);return _0x16f29f?_0x16f29f['getElement']():null;}['_markChangePositionInEditorContent'](_0x3f9728,_0x4c48ee){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x3f9728,_0x4c48ee);}['_diffContent'](_0x119df2,_0x2237b3,_0x5eaa68){return this['_aiReviewCoreEditing']['diffContent'](_0x119df2,_0x2237b3,_0x5eaa68,!0x1);}['_onReviewCheckRun'](){this['_onDiffChange'](this['_isDiffOn']);}['_onDiffChange'](_0x279ad1){_0x279ad1?this['_aiReviewCoreUi']['hideDiffInBalloon']():this['_aiReviewCoreUi']['showDiffInBalloon']();for(const _0xbc4349 of this['_aiReviewCoreEditing']['getEditors']())_0xbc4349['editing']['view']['change'](_0x3c8d02=>{for(const _0x301c26 of _0xbc4349['editing']['view']['document']['getRoots']()){for(const _0x3b77a9 of _0x301c26['getClassNames']())_0x3b77a9['startsWith']('ck-ai_review-')&&_0x3c8d02['removeClass'](_0x3b77a9,_0x301c26);_0x3c8d02['addClass'](_0x279ad1?'ck-ai_review-diff':'ck-ai_review-highlights',_0x301c26);}});}['_getBalloonDomRoot'](_0x52d0ea,_0x4ca404){const _0x43a4e1=_0x52d0ea['editing']['view'];if(_0x4ca404){const _0x433350=_0x43a4e1['getDomRoot'](_0x4ca404);if(_0x433350)return _0x433350;}return _0x43a4e1['getDomRoot']()??void 0x0;}async['_getReviewChecks'](){const _0x1533a5=this['context']['plugins']['get']('AIReviewModeCheckRegistry'),_0x261a0f=await _0x1533a5['getChecksList']();_0x1533a5['modelsLoadError']&&this['_logError'](_0x1533a5['modelsLoadError']);let _0x1dc00e=_0x261a0f['checks'];const _0x28ceb9=this['context']['config']['get']('ai.review.availableCommands');return this['_logWarningForNonExistentChecks'](_0x28ceb9,_0x1dc00e),this['_usesAvailableCommandsConfig']&&(_0x1dc00e=_0x28ceb9['map'](_0x5c7c5f=>_0x1dc00e['find'](_0x15a13c=>_0x15a13c['id']===_0x5c7c5f))['filter'](_0x2f043a=>!!_0x2f043a)),this['_filterChecksWithMissingModel'](_0x1dc00e);}['_logWarningForNonExistentChecks'](_0xef1d6e,_0x428bd2){const _0x4ec951=_0xef1d6e['filter'](_0x46dada=>!_0x428bd2['some'](_0x22c367=>_0x22c367['id']===_0x46dada));_0x4ec951['length']&&this['_reporter']['logError'](new nn({'code':'ai-review-mode-non-existent-commands-used','severity':'warning','context':{'commandIds':_0x4ec951['join'](',\x20')}}));}['_filterChecksWithMissingModel'](_0x36b766){const _0x33c3fb=[];return _0x36b766['forEach'](_0x429cb2=>{(_0x429cb2 instanceof Eh&&!_0x429cb2['defaultModel']||_0x429cb2 instanceof Sh&&!_0x429cb2['models']['length'])&&_0x33c3fb['push'](_0x429cb2['id']);}),_0x33c3fb['length']&&_0x33c3fb['forEach'](_0x1ae2f6=>{_0x36b766=_0x36b766['filter'](_0x1b1a71=>_0x1b1a71['id']!==_0x1ae2f6),this['_reporter']['logError'](new nn({'code':'ai-review-mode-command-unavailable-due-to-missing-model','context':{'commandId':_0x1ae2f6}}));}),_0x36b766;}};function kh(_0x3ac73b,_0x6fcaf2,_0x218166,_0x1d925d){return _0x3ac73b instanceof at?_0x3ac73b:new at(_0x6fcaf2,_0x218166,_0x1d925d,_0x3ac73b);}var Nh=class extends Zs{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks']['slice']();}set['affectedBlocks'](_0x514a77){this['_affectedBlocks']=_0x514a77;}},yh=class extends _0x2d0760{static get['pluginName'](){return'AIReviewGateway';}static get['requires'](){return[hh,Oh,cs,As,Js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['getAllCommands'](){return(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['map'](_0x53bc09=>{const _0x41024e={'id':_0x53bc09['id'],'title':_0x53bc09['title'],'description':_0x53bc09['description']};return'custom'!==_0x53bc09['id']&&_0x53bc09['options']?.['length']&&(_0x41024e['parameters']=_0x53bc09['options'][0x0]['data']['map'](_0xaeeb68=>({..._0xaeeb68}))),_0x41024e;});}async['getAvailableModels'](){return this['context']['plugins']['get']('AIGateway')['getAvailableModels']();}async['runReview'](_0x47e42c,_0x1af19c){return await this['_runReviewCheck'](_0x47e42c,()=>this['_createReviewCheckRun'](_0x47e42c,_0x1af19c?.['parameterId']),_0x1af19c?.['signal']);}async['runCustomReview'](_0x383b2,_0x3b29d5){return await this['_runReviewCheck']('custom',()=>this['_createCustomReviewCheckRun']('custom',_0x383b2,_0x3b29d5?.['model']),_0x3b29d5?.['signal']);}['applyReview'](_0x114f46,_0x19441d){this['context']['plugins']['get']('AIGateway')['apply'](_0x114f46,{'applyMethod':_0x19441d,'aiSource':'review'});}async['_runReviewCheck'](_0x31c64e,_0x38b533,_0x12db48){const _0x36c45a=ds(this['context']),_0x1bb6dd=new Nh({'editor':_0x36c45a,'rootName':_0x36c45a['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x36c45a['plugins']['get']('AIEditing')['getSessionId'](_0x36c45a)});let _0x474ff4,_0x8a01f0;if(_0x12db48){if(_0x12db48['aborted'])return _0x1bb6dd['abort'](),_0x1bb6dd;const _0x1f5804=()=>{_0x1bb6dd['error']||(_0x1bb6dd['abort'](),_0x474ff4&&_0x474ff4['abort']());};_0x12db48['addEventListener']('abort',_0x1f5804),_0x8a01f0=()=>_0x12db48['removeEventListener']('abort',_0x1f5804);}try{_0x474ff4=await _0x38b533(),_0x1bb6dd['contentRawOld']=_0x474ff4['documentData']['content'],_0x1bb6dd['documentVersion']=Array['from'](_0x474ff4['documentData']['elements'])['find'](([,_0xcd05e4])=>_0xcd05e4['rootName']===_0x1bb6dd['rootName'])?.[0x1]['documentVersion']??0x1,_0x474ff4['on']('reviewCheckRunUpdated',(_0x4b9ced,_0x32f4d1)=>{'aborted'===_0x32f4d1['status']?_0x1bb6dd['abort']():'error-general'!==_0x32f4d1['status']&&'error-chunk'!==_0x32f4d1['status']||(_0x1bb6dd['error']=kh(_0x32f4d1['error'],'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x31c64e}));}),'aborted'!==_0x1bb6dd['status']&&await _0x474ff4['start']();}catch(_0x1cd567){_0x1bb6dd['error']=kh(_0x1cd567,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x31c64e});}finally{_0x8a01f0&&_0x8a01f0();}if(!_0x474ff4||'aborted'===_0x1bb6dd['status']||'error'===_0x1bb6dd['status'])return _0x1bb6dd;_0x1bb6dd['affectedBlocks']=_0x474ff4['results']['map'](_0x3d5d1d=>({'id':_0x3d5d1d['id'],'content':_0x3d5d1d['contentNew']}));try{_0x1bb6dd['contentRawNew']=ps(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x1bb6dd['affectedBlocks'],_0x1bb6dd['contentRawOld'],_0x1bb6dd['editor']));}catch(_0x5d1629){_0x1bb6dd['error']=kh(_0x5d1629,'ai-reviewgateway-review-command-run-failed',this,{'checkId':_0x31c64e});}return _0x1bb6dd;}async['_createReviewCheckRun'](_0x41b683,_0x2bf8e1){const _0x1ff521=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x54c133=>_0x54c133['id']===_0x41b683);if(!_0x1ff521)throw new at('ai-reviewgateway-unknown-command',this,{'checkId':_0x41b683});if(_0x1ff521 instanceof Sh)throw new at('ai-reviewgateway-not-a-system-command',this,{'checkId':_0x41b683});const _0x4764dc=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x6c9e29=this['context']['plugins']['get']('AIConnector');if(_0x1ff521 instanceof Eh){if(!_0x1ff521['defaultModel']?.['id'])throw new at('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x41b683});return new Th(_0x1ff521['prompt'],_0x1ff521['defaultModel']['id'],_0x4764dc,_0x1ff521,_0x6c9e29);}return new Ah(_0x4764dc,_0x1ff521,_0x6c9e29,_0x2bf8e1?[_0x2bf8e1]:void 0x0);}async['_createCustomReviewCheckRun'](_0x537bad,_0x343296,_0x30c550){const _0x1ba0ad=(await this['context']['plugins']['get']('AIReviewModeCheckRegistry')['getChecksList']())['checks']['find'](_0x15be9f=>_0x15be9f['id']===_0x537bad);if(!_0x1ba0ad)throw new at('ai-reviewgateway-unknown-command',this,{'checkId':_0x537bad});if(!(_0x1ba0ad instanceof Sh))throw new at('ai-reviewgateway-not-a-custom-command',this,{'checkId':_0x537bad});const _0x414d02=_0x30c550??_0x1ba0ad['defaultModel']?.['id'];if(!_0x343296)throw new at('ai-reviewgateway-missing-custom-command-prompt',this,{'checkId':_0x537bad});if(!_0x414d02)throw new at('ai-reviewgateway-missing-custom-command-model',this,{'checkId':_0x537bad});return new ph(_0x343296,_0x414d02,this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x1ba0ad,this['context']['plugins']['get']('AIConnector'));}},xh=class extends _0x2d0760{static get['requires'](){return[vh,nh,hh,yh];}static get['pluginName'](){return'AIReviewMode';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startReview'](_0x4c878e,_0x150b86){if(this['assertStartReviewPreconditions'](_0x4c878e)instanceof Sh)throw new at('ai-reviewmode-not-a-system-command',this,{'commandId':_0x4c878e});ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x4c878e,'params':_0x150b86?.['parameterId']?[_0x150b86['parameterId']]:void 0x0});}async['startCustomReview'](_0x39cfc6,_0x32c9e6){if(!_0x39cfc6)throw new at('ai-reviewmode-missing-custom-command-prompt',this);const _0x303e92=Ch['find'](_0x9a586=>'custom'===_0x9a586['commandId'])['id'],_0x46e8f0=this['assertStartReviewPreconditions'](_0x303e92),_0x595373=_0x32c9e6?.['model']??_0x46e8f0['defaultModel']?.['id'];if(!_0x595373)throw new at('ai-reviewmode-missing-custom-command-model',this);ka(this['context'],'reviewMode'),await this['context']['plugins']['get']('AIReviewModeController')['runCheck']({'id':_0x303e92,'isCustom':!0x0,'args':{'prompt':_0x39cfc6,'model':_0x595373}});}['getAvailableCommands'](){return this['context']['plugins']['get']('AIReviewModeController')['getAvailableChecks']()['map'](_0xd7d565=>{const _0x2413cd={'id':_0xd7d565['id'],'title':_0xd7d565['title'],'description':_0xd7d565['description']};return'custom'!==_0xd7d565['id']&&_0xd7d565['options']?.['length']&&(_0x2413cd['parameters']=_0xd7d565['options'][0x0]['data']['map'](_0x1b2208=>({..._0x1b2208}))),_0x2413cd;});}['assertStartReviewPreconditions'](_0x1162c8){const _0x23c75f=this['context']['plugins']['get']('AIReviewModeController');if(_0x23c75f['getCurrentCheckRun']())throw new at('ai-reviewmode-review-already-running',this);const _0x41753b=_0x23c75f['getAvailableChecks']()['find'](_0x3f24a2=>_0x3f24a2['id']===_0x1162c8);if(!_0x41753b)throw new at('ai-reviewmode-unknown-command',this,{'commandId':_0x1162c8});return _0x41753b;}},Lh=class extends Ah{['_title'];constructor(_0x347695,_0x20491b,_0xaf5533,_0x4eee41,_0x32a8e0,_0x728e2b){super(_0x347695,_0x20491b,_0xaf5533,_0x32a8e0,_0x728e2b),this['_title']=_0x4eee41;}get['title'](){return this['_title'];}get['subTitle'](){return this['_sourceCheck']['title'];}},Dh=class extends mh{get['apiId'](){return'translate';}},Ph=class extends bh{['setupChecks'](_0x348ddf){this['_checks']=_0x348ddf['map'](_0x50236c=>new Dh(_0x50236c));}};const Hh=[{'label':'English','id':'english'},{'label':'Spanish','id':'spanish'},{'label':'French','id':'french'},{'label':'German','id':'german'},{'label':'Chinese\x20(Simplified)','id':'chinese'},{'label':'Japanese','id':'japanese'},{'label':'Russian','id':'russian'},{'label':'Portuguese','id':'portuguese'},{'label':'Korean','id':'korean'},{'label':'Italian','id':'italian'}];var Mh=class extends wh{static get['pluginName'](){return'AITranslateCheckRegistry';}constructor(_0x4bb257){super(_0x4bb257),this['context']['config']['define']('ai.translate.languages',Hh);}async['_loadChecksList'](){const _0x4383ba=[],_0x1cbfcd=this['context']['config']['get']('ai.translate.languages')||[];for(const _0x438958 of _0x1cbfcd)_0x4383ba['push']({'title':_0x438958['label'],'id':_0x438958['id'],'commandId':_0x438958['id'],'description':'','isParameterized':!0x1,'useArgs':!0x0,'args':{'language':_0x438958['id']}});const _0x53d843=new Ph();return _0x53d843['setupChecks'](this['_translateChecks'](_0x4383ba)),_0x53d843;}['_translateChecks'](_0x2691bd){const _0x389548=this['context']['locale'];return _0x2691bd['map'](_0x423964=>{const _0x59644c='AI_REVIEW_CHECK_TRANSLATE_OPTIONS_DATA_'+_0x423964['title']['toUpperCase']()['replaceAll']('-','_'),_0x3aed66=ls(_0x389548,_0x59644c);return{..._0x423964,'title':_0x3aed66===_0x59644c?_0x423964['title']:_0x3aed66};});}},Vh=class extends Ih{static get['pluginName'](){return'AITranslateController';}static get['requires'](){return[rn,Mh];}get['_aiSource'](){return'translate';}['_onCheckRunFinished'](){this['_onReviewRunLeave'](!0x0);}['_initRequiredPlugins'](){super['_initRequiredPlugins'](),this['_aiReviewCoreUi']=this['context']['plugins']['get']('AITranslateUI'),this['_aiReviewCoreEditing']=this['context']['plugins']['get']('AIReviewCoreEditing');}['_createReviewCheckRun'](_0x3f3e1d,_0x366940){return new Lh(this['_aiReviewCoreEditing']['getDocumentData'](),_0x366940,this['_aiConnector'],ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),_0x3f3e1d['params'],_0x3f3e1d['args']);}['_onReviewCheckResultActivated'](_0x1fd246){this['_aiReviewCoreUi']['setActiveStateInResults'](_0x1fd246['change']['id']),this['_aiReviewCoreEditing']['setMarkersInElementAsActive'](_0x1fd246['change']['id']);}['_onReviewCheckResultDeactivated'](){this['_aiReviewCoreEditing']['setAllMarkersAsInactive'](),this['_aiReviewCoreUi']['resetActiveStateInResults']();}['_onActivateChange'](_0x4590f4){this['_currentReviewCheckRun']&&('hover'===_0x4590f4['uiInteraction']&&(this['_changeActivationSource']='panel',this['_currentReviewCheckRun']['activateChange'](_0x4590f4['id'])),'click'===_0x4590f4['uiInteraction']&&this['_scrollToChange'](_0x4590f4['id']));}['_onDeactivateChange'](_0x173cab){this['_currentReviewCheckRun']&&'panel'===_0x173cab['origin']&&this['_currentReviewCheckRun']['deactivateChange']();}['_onChangeMarkerClicked'](_0x4c1360,_0x5ee532){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x5ee532['changeId']),this['_scrollToChange'](_0x5ee532['changeId']));}['_onChangeMarkerHovered'](_0x3fbf6c,_0x165bd9){this['_currentReviewCheckRun']&&(this['_changeActivationSource']='content',this['_currentReviewCheckRun']['activateChange'](_0x165bd9['changeId']),this['_aiReviewCoreEditing']['reactivateMarkers'](_0x165bd9['changeId']));}['_onChangeMarkerBlurred'](){this['_currentReviewCheckRun']&&'content'===this['_changeActivationSource']&&(this['_currentReviewCheckRun']['deactivateChange'](),this['_aiReviewCoreEditing']['setAllMarkersAsInactive']());}['_getChangeContentElement'](_0x4de7fe){return this['_aiReviewCoreEditing']['getContentElementForChange'](_0x4de7fe);}['_markChangePositionInEditorContent'](_0x172396,_0x19afc3){this['_aiReviewCoreEditing']['markChangePositionInEditorContent'](_0x172396,_0x19afc3);}['_diffContent'](_0x1fe7df,_0x51fca6,_0x3fd443){return this['_aiReviewCoreEditing']['diffContent'](_0x1fe7df,_0x51fca6,_0x3fd443,!0x0);}['_onReviewCheckRun'](){for(const _0x28dfbc of this['_aiReviewCoreEditing']['getEditors']())_0x28dfbc['editing']['view']['change'](_0x2adedc=>{for(const _0x24e360 of _0x28dfbc['editing']['view']['document']['getRoots']())_0x2adedc['addClass']('ck-ai-translate-mode-content',_0x24e360);});}async['_getReviewChecks'](){return(await this['context']['plugins']['get']('AITranslateCheckRegistry')['getChecksList']())['checks'];}},Uh=class extends Qa{constructor(_0x158a35,_0x1885f3){super(_0x158a35,_0x1885f3),this['on']('set:isLoading',(_0x17258c,_0x571125,_0x2c00b4)=>{_0x2c00b4&&(this['headerTitle']=ls(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_LOADING_TITLE'));}),this['on']('set:isResultReady',(_0x5f41d2,_0x2be37f,_0x5207c6)=>{_0x5207c6&&(this['headerTitle']=ls(this['locale'],'AI_TRANSLATE_CHECK_RESULTS_READY_TITLE'));});}['_createAcceptAllButtonView'](){const _0x431692=super['_createAcceptAllButtonView']();return _0x431692['set']('label',ls(this['locale'],'AI_TRANSLATE_ACCEPT_ALL')),_0x431692;}['_createExitReviewButtonView'](){const _0x4b58e5=super['_createExitReviewButtonView']();return _0x4b58e5['set']('label',ls(this['locale'],'AI_CHAT_HISTORY_CANCEL')),_0x4b58e5;}},Bh=class extends sh{['_setupTemplate'](){const _0x19ac2d=this['bindTemplate'];this['setTemplate']({'tag':'div','attributes':{'class':['ck-ai-translate__check-list-wrapper',_0x19ac2d['if']('isVisible','ck-hidden',_0x2a35f7=>!_0x2a35f7)]},'children':[{'tag':'div','attributes':{'class':['ck-ai-translate__check-list-header']},'children':[{'tag':'h2','children':[{'text':ls(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_TITLE')}]},{'tag':'p','children':[{'text':ls(this['locale'],'AI_TRANSLATE_CHECK_LIST_HEADER_DESCRIPTION')}]}]},{'tag':'div','attributes':{'class':['ck-ai_review__check-list',_0x19ac2d['if']('isVisible','ck-hidden',_0x43ee9f=>!_0x43ee9f)]},'children':this['_checkViews']}]});}},Gh=class extends Wa{static get['pluginName'](){return'AITranslateUI';}['createMainView'](){const _0xde7c47=this['context']['plugins']['get']('AITabs'),_0x5d8ff1=this['context']['locale'],_0x548eee=new Ho(_0x5d8ff1,{'label':ls(_0x5d8ff1,'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'icon':_0x3ba0ab,'class':'ck-ai-header_review-translate','showResizeButton':_0xde7c47['showResizeButton']});_0x548eee['delegate']('resizeTabs')['to'](_0xde7c47),_0x548eee['bind']('isMaximized')['to'](_0xde7c47['view'],'isMaximized',_0x21c749=>_0x21c749);const _0x2d70e9=new $a(_0x5d8ff1,{'header':_0x548eee,'list':new Bh(_0x5d8ff1),'results':new Uh(_0x5d8ff1,{'generalErrorText':ls(_0x5d8ff1,'AI_TRANSLATE_GENERAL_ERROR_MESSAGE')}),'completed':new Xa(_0x5d8ff1,{'headerText':ls(_0x5d8ff1,'AI_TRANSLATE_FINISH_HEADER_TITLE'),'emptyResultsText':ls(_0x5d8ff1,'AI_TRANSLATE_EMPTY_RESULTS_TEXT'),'buttonText':ls(_0x5d8ff1,'AI_TRANSLATE_FINISH_BUTTON_LABEL')})});return _0x2d70e9['extendTemplate']({'attributes':{'class':'ck-ai-translate-mode'}}),_0x2d70e9;}['registerTab'](){const _0x42d957=this['context']['plugins']['get']('AITabs');_0x42d957['view']['on']('activateTab',(_0x14ea89,{newTab:_0x5ec31c,oldTab:_0x3a88de})=>{'translate'===_0x5ec31c?this['fire']('getReviewCheckList'):'translate'===_0x3a88de&&this['fire']('leaveReview');}),_0x42d957['view']['addTab']({'id':'translate','buttonLabel':ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),'buttonIcon':_0x3ba0ab,'order':0x0,'content':this['_mainView']});}},Fh=class extends Zs{['_affectedBlocks']=[];get['affectedBlocks'](){return this['_affectedBlocks'];}set['affectedBlocks'](_0x2f3899){this['_affectedBlocks']=_0x2f3899;}},Kh=class extends _0x2d0760{static get['pluginName'](){return'AITranslateGateway';}static get['requires'](){return[hh,cs,As,Js];}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['runTranslate'](_0x4381ea,_0x132df2){return await this['_runTranslateCheck'](_0x4381ea,()=>this['_createTranslateCheckRun'](_0x4381ea),_0x132df2?.['signal']);}['applyTranslate'](_0xbc967c,_0x4c8387){this['context']['plugins']['get']('AIGateway')['apply'](_0xbc967c,_0x4c8387);}async['_runTranslateCheck'](_0x5c8a5f,_0x1b0323,_0x5bcda7){const _0x3fc3e0=ds(this['context']),_0x33f9fe=new Fh({'editor':_0x3fc3e0,'rootName':_0x3fc3e0['model']['document']['getRootNames']()[0x0],'channelId':this['context']['config']['get']('collaboration.channelId'),'sessionId':_0x3fc3e0['plugins']['get']('AIEditing')['getSessionId'](_0x3fc3e0)});let _0x35ea88,_0xe2c882;if(_0x5bcda7){if(_0x5bcda7['aborted'])return _0x33f9fe['abort'](),_0x33f9fe;const _0x16d601=()=>{_0x33f9fe['error']||(_0x33f9fe['abort'](),_0x35ea88&&_0x35ea88['abort']());};_0x5bcda7['addEventListener']('abort',_0x16d601),_0xe2c882=()=>_0x5bcda7['removeEventListener']('abort',_0x16d601);}try{_0x35ea88=await _0x1b0323(),_0x33f9fe['contentRawOld']=_0x35ea88['documentData']['content'],_0x33f9fe['documentVersion']=Array['from'](_0x35ea88['documentData']['elements'])['find'](([,_0x4c7c8a])=>_0x4c7c8a['rootName']===_0x33f9fe['rootName'])?.[0x1]['documentVersion']??0x1,_0x35ea88['on']('reviewCheckRunUpdated',(_0x3efcde,_0x4a9b56)=>{'aborted'===_0x4a9b56['status']?_0x33f9fe['abort']():'error-general'!==_0x4a9b56['status']&&'error-chunk'!==_0x4a9b56['status']||(_0x33f9fe['error']=kh(_0x4a9b56['error'],'ai-translategateway-translation-run-failed',this,{'language':_0x5c8a5f}));}),'aborted'!==_0x33f9fe['status']&&await _0x35ea88['start']();}catch(_0x405f74){_0x33f9fe['error']=kh(_0x405f74,'ai-translategateway-translation-run-failed',this,{'language':_0x5c8a5f});}finally{_0xe2c882&&_0xe2c882();}if(!_0x35ea88||'aborted'===_0x33f9fe['status']||'error'===_0x33f9fe['status'])return _0x33f9fe;_0x33f9fe['affectedBlocks']=_0x35ea88['results']['map'](_0x1d847d=>({'id':_0x1d847d['id'],'content':_0x1d847d['contentNew']}));try{_0x33f9fe['contentRawNew']=ps(this['context']['plugins']['get']('AIGateway')['mergeChangesIntoContent'](_0x33f9fe['affectedBlocks'],_0x33f9fe['contentRawOld'],_0x33f9fe['editor']));}catch(_0x37fa50){_0x33f9fe['error']=kh(_0x37fa50,'ai-translategateway-translation-run-failed',this,{'language':_0x5c8a5f});}return _0x33f9fe;}async['_createTranslateCheckRun'](_0x3be81e){const _0x532a2c=this['context']['plugins']['get']('AIReviewCoreEditing')['getDocumentData'](),_0x6a45e7=this['context']['plugins']['get']('AIConnector');return new Lh(_0x532a2c,new Dh({'id':_0x3be81e,'commandId':_0x3be81e,'title':_0x3be81e,'description':'','isParameterized':!0x1}),_0x6a45e7,ls(this['context']['locale'],'AI_REVIEW_CHECK_TRANSLATE_TITLE'),void 0x0,{'language':_0x3be81e});}},Wh=class extends _0x2d0760{static get['requires'](){return[Vh,Gh,hh,Kh];}static get['pluginName'](){return'AITranslate';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}async['startTranslate'](_0x501b3b){const _0x5678da=this['assertStartTranslatePreconditions'](_0x501b3b);ka(this['context'],'translate'),await this['context']['plugins']['get']('AITranslateController')['runCheck']({'id':_0x5678da['id'],'args':_0x5678da['useArgs']?_0x5678da['args']:void 0x0});}['getAvailableLanguages'](){return this['context']['plugins']['get']('AITranslateController')['getAvailableChecks']()['map'](_0x2b5e66=>({'id':_0x2b5e66['id'],'label':_0x2b5e66['title']}));}['assertStartTranslatePreconditions'](_0x3666f3){const _0x1a700c=this['context']['plugins']['get']('AITranslateController');if(_0x1a700c['getCurrentCheckRun']())throw new at('ai-translate-translation-already-running',this);const _0x2508fa=_0x1a700c['getAvailableChecks']()['find'](_0x247994=>_0x247994['id']===_0x3666f3);if(!_0x2508fa)throw new at('ai-translate-unknown-language',this,{'languageId':_0x3666f3});return _0x2508fa;}};export{Ua as AIActions,Oi as AIAdapter,ji as AIAssistant,Qi as AIAssistantUI,la as AIBalloon,ta as AIChat,kn as AIChatController,Hr as AIChatFeedCustomElementView,Zo as AIChatHistory,Jo as AIChatHistoryController,qo as AIChatHistoryUI,bn as AIChatInteraction,na as AIChatShortcuts,Bo as AIChatUI,cs as AIConnector,nn as AICoreError,en as AIDocumentProcessingGateway,tn as AIDocumentProcessingRunResult,As as AIEditing,Aa as AIEditorIntegration,on as AIErrorReporter,rn as AIErrorSink,Js as AIGateway,In as AIInteraction,Ba as AIQuickActions,Oa as AIQuickActionsUI,_n as AIReply,vi as AIRequestError,mh as AIReviewCheck,lh as AIReviewCheckResult,dh as AIReviewCheckResultChange,gh as AIReviewCheckRun,yh as AIReviewGateway,xh as AIReviewMode,Ih as AIReviewModeController,hh as AIReviewModeEditing,nh as AIReviewModeUI,Nh as AIReviewRunResult,Zs as AIRunResult,hs as AITabs,as as AITabsMainView,ns as AITabsView,Zi as AITextAdapter,oa as AIToggleButtonUI,Wh as AITranslate,Vh as AITranslateController,Kh as AITranslateGateway,Fh as AITranslateRunResult,Gh as AITranslateUI,es as AWSTextAdapter,ts as OpenAITextAdapter,Ni as ShowAIAssistantCommand,ra as ToggleAICommand,ln as createResizeButton,Ji as getDefaultAICommands,js as markOperationsAsAI};
|