jodit-pro 4.11.29 → 4.12.3
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/es2015/jodit.css +1 -1
- package/es2015/jodit.fat.min.js +8 -11
- package/es2015/jodit.js +86 -5
- package/es2015/jodit.min.js +4 -4
- package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
- package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.js +161 -29
- package/es2015/plugins/ai-assistant-pro/ai-assistant-pro.min.js +4 -7
- package/es2015/plugins/autocomplete/autocomplete.js +1 -1
- package/es2015/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es2015/plugins/backup/backup.css +1 -1
- package/es2015/plugins/backup/backup.js +1 -1
- package/es2015/plugins/backup/backup.min.js +1 -1
- package/es2015/plugins/button-generator/button-generator.css +1 -1
- package/es2015/plugins/button-generator/button-generator.js +1 -1
- package/es2015/plugins/button-generator/button-generator.min.js +1 -1
- package/es2015/plugins/change-case/change-case.js +1 -1
- package/es2015/plugins/change-case/change-case.min.js +1 -1
- package/es2015/plugins/color-picker/color-picker.css +1 -1
- package/es2015/plugins/color-picker/color-picker.js +1 -1
- package/es2015/plugins/color-picker/color-picker.min.js +1 -1
- package/es2015/plugins/emoji/emoji.css +1 -1
- package/es2015/plugins/emoji/emoji.js +1 -1
- package/es2015/plugins/emoji/emoji.min.js +1 -1
- package/es2015/plugins/export-docs/export-docs.js +1 -1
- package/es2015/plugins/export-docs/export-docs.min.js +1 -1
- package/es2015/plugins/finder/finder.css +1 -1
- package/es2015/plugins/finder/finder.js +2 -2
- package/es2015/plugins/finder/finder.min.js +2 -2
- package/es2015/plugins/google-maps/google-maps.css +1 -1
- package/es2015/plugins/google-maps/google-maps.js +1 -1
- package/es2015/plugins/google-maps/google-maps.min.js +1 -1
- package/es2015/plugins/google-search/google-search.js +1 -1
- package/es2015/plugins/google-search/google-search.min.js +1 -1
- package/es2015/plugins/highlight-signature/highlight-signature.js +1 -1
- package/es2015/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es2015/plugins/iframe-editor/iframe-editor.css +1 -1
- package/es2015/plugins/iframe-editor/iframe-editor.js +1 -1
- package/es2015/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es2015/plugins/keyboard/keyboard.css +1 -1
- package/es2015/plugins/keyboard/keyboard.js +1 -1
- package/es2015/plugins/keyboard/keyboard.min.js +1 -1
- package/es2015/plugins/mobile-view/mobile-view.js +1 -1
- package/es2015/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es2015/plugins/page-break/page-break.js +1 -1
- package/es2015/plugins/page-break/page-break.min.js +1 -1
- package/es2015/plugins/paste-code/paste-code.css +1 -1
- package/es2015/plugins/paste-code/paste-code.js +1 -1
- package/es2015/plugins/paste-code/paste-code.min.js +1 -1
- package/es2015/plugins/paste-from-word/paste-from-word.js +1 -1
- package/es2015/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es2015/plugins/show-blocks/show-blocks.js +1 -1
- package/es2015/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es2015/plugins/style/style.css +1 -1
- package/es2015/plugins/style/style.js +1 -1
- package/es2015/plugins/style/style.min.js +1 -1
- package/es2015/plugins/templates/templates.css +1 -1
- package/es2015/plugins/templates/templates.js +1 -1
- package/es2015/plugins/templates/templates.min.js +1 -1
- package/es2015/plugins/todo-list/todo-list.css +1 -1
- package/es2015/plugins/todo-list/todo-list.js +1 -1
- package/es2015/plugins/todo-list/todo-list.min.js +1 -1
- package/es2015/plugins/translate/translate.css +1 -1
- package/es2015/plugins/translate/translate.js +1 -1
- package/es2015/plugins/translate/translate.min.js +1 -1
- package/es2015/plugins/tune-block/tune-block.css +1 -1
- package/es2015/plugins/tune-block/tune-block.js +1 -1
- package/es2015/plugins/tune-block/tune-block.min.js +1 -1
- package/es2018/jodit.fat.min.js +10 -13
- package/es2018/jodit.min.js +4 -4
- package/es2018/plugins/ai-assistant-pro/ai-assistant-pro.min.js +5 -8
- package/es2018/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es2018/plugins/backup/backup.min.js +1 -1
- package/es2018/plugins/button-generator/button-generator.min.js +1 -1
- package/es2018/plugins/change-case/change-case.min.js +1 -1
- package/es2018/plugins/color-picker/color-picker.min.js +1 -1
- package/es2018/plugins/emoji/emoji.min.js +1 -1
- package/es2018/plugins/export-docs/export-docs.min.js +1 -1
- package/es2018/plugins/finder/finder.min.js +2 -2
- package/es2018/plugins/google-maps/google-maps.min.js +1 -1
- package/es2018/plugins/google-search/google-search.min.js +1 -1
- package/es2018/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es2018/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es2018/plugins/keyboard/keyboard.min.js +1 -1
- package/es2018/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es2018/plugins/page-break/page-break.min.js +1 -1
- package/es2018/plugins/paste-code/paste-code.min.js +1 -1
- package/es2018/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es2018/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es2018/plugins/style/style.min.js +1 -1
- package/es2018/plugins/templates/templates.min.js +1 -1
- package/es2018/plugins/todo-list/todo-list.min.js +1 -1
- package/es2018/plugins/translate/translate.min.js +1 -1
- package/es2018/plugins/tune-block/tune-block.min.js +1 -1
- package/es2021/jodit.css +1 -1
- package/es2021/jodit.fat.min.js +12 -15
- package/es2021/jodit.js +86 -5
- package/es2021/jodit.min.js +5 -5
- package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
- package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.js +154 -29
- package/es2021/plugins/ai-assistant-pro/ai-assistant-pro.min.js +5 -8
- package/es2021/plugins/autocomplete/autocomplete.js +1 -1
- package/es2021/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es2021/plugins/backup/backup.css +1 -1
- package/es2021/plugins/backup/backup.js +1 -1
- package/es2021/plugins/backup/backup.min.js +1 -1
- package/es2021/plugins/button-generator/button-generator.css +1 -1
- package/es2021/plugins/button-generator/button-generator.js +1 -1
- package/es2021/plugins/button-generator/button-generator.min.js +1 -1
- package/es2021/plugins/change-case/change-case.js +1 -1
- package/es2021/plugins/change-case/change-case.min.js +1 -1
- package/es2021/plugins/color-picker/color-picker.css +1 -1
- package/es2021/plugins/color-picker/color-picker.js +1 -1
- package/es2021/plugins/color-picker/color-picker.min.js +1 -1
- package/es2021/plugins/emoji/emoji.css +1 -1
- package/es2021/plugins/emoji/emoji.js +1 -1
- package/es2021/plugins/emoji/emoji.min.js +1 -1
- package/es2021/plugins/export-docs/export-docs.js +1 -1
- package/es2021/plugins/export-docs/export-docs.min.js +1 -1
- package/es2021/plugins/finder/finder.css +1 -1
- package/es2021/plugins/finder/finder.js +2 -2
- package/es2021/plugins/finder/finder.min.js +2 -2
- package/es2021/plugins/google-maps/google-maps.css +1 -1
- package/es2021/plugins/google-maps/google-maps.js +1 -1
- package/es2021/plugins/google-maps/google-maps.min.js +1 -1
- package/es2021/plugins/google-search/google-search.js +1 -1
- package/es2021/plugins/google-search/google-search.min.js +1 -1
- package/es2021/plugins/highlight-signature/highlight-signature.js +1 -1
- package/es2021/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es2021/plugins/iframe-editor/iframe-editor.css +1 -1
- package/es2021/plugins/iframe-editor/iframe-editor.js +1 -1
- package/es2021/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es2021/plugins/keyboard/keyboard.css +1 -1
- package/es2021/plugins/keyboard/keyboard.js +1 -1
- package/es2021/plugins/keyboard/keyboard.min.js +1 -1
- package/es2021/plugins/mobile-view/mobile-view.js +1 -1
- package/es2021/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es2021/plugins/page-break/page-break.js +1 -1
- package/es2021/plugins/page-break/page-break.min.js +1 -1
- package/es2021/plugins/paste-code/paste-code.css +1 -1
- package/es2021/plugins/paste-code/paste-code.js +1 -1
- package/es2021/plugins/paste-code/paste-code.min.js +1 -1
- package/es2021/plugins/paste-from-word/paste-from-word.js +1 -1
- package/es2021/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es2021/plugins/show-blocks/show-blocks.js +1 -1
- package/es2021/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es2021/plugins/style/style.css +1 -1
- package/es2021/plugins/style/style.js +1 -1
- package/es2021/plugins/style/style.min.js +1 -1
- package/es2021/plugins/templates/templates.css +1 -1
- package/es2021/plugins/templates/templates.js +1 -1
- package/es2021/plugins/templates/templates.min.js +1 -1
- package/es2021/plugins/todo-list/todo-list.css +1 -1
- package/es2021/plugins/todo-list/todo-list.js +1 -1
- package/es2021/plugins/todo-list/todo-list.min.js +1 -1
- package/es2021/plugins/translate/translate.css +1 -1
- package/es2021/plugins/translate/translate.js +1 -1
- package/es2021/plugins/translate/translate.min.js +1 -1
- package/es2021/plugins/tune-block/tune-block.css +1 -1
- package/es2021/plugins/tune-block/tune-block.js +1 -1
- package/es2021/plugins/tune-block/tune-block.min.js +1 -1
- package/es2021.en/jodit.css +1 -1
- package/es2021.en/jodit.fat.min.js +9 -12
- package/es2021.en/jodit.js +86 -5
- package/es2021.en/jodit.min.js +5 -5
- package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
- package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.js +154 -29
- package/es2021.en/plugins/ai-assistant-pro/ai-assistant-pro.min.js +26 -29
- package/es2021.en/plugins/autocomplete/autocomplete.js +1 -1
- package/es2021.en/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es2021.en/plugins/backup/backup.css +1 -1
- package/es2021.en/plugins/backup/backup.js +1 -1
- package/es2021.en/plugins/backup/backup.min.js +1 -1
- package/es2021.en/plugins/button-generator/button-generator.css +1 -1
- package/es2021.en/plugins/button-generator/button-generator.js +1 -1
- package/es2021.en/plugins/button-generator/button-generator.min.js +1 -1
- package/es2021.en/plugins/change-case/change-case.js +1 -1
- package/es2021.en/plugins/change-case/change-case.min.js +1 -1
- package/es2021.en/plugins/color-picker/color-picker.css +1 -1
- package/es2021.en/plugins/color-picker/color-picker.js +1 -1
- package/es2021.en/plugins/color-picker/color-picker.min.js +1 -1
- package/es2021.en/plugins/emoji/emoji.css +1 -1
- package/es2021.en/plugins/emoji/emoji.js +1 -1
- package/es2021.en/plugins/emoji/emoji.min.js +1 -1
- package/es2021.en/plugins/export-docs/export-docs.js +1 -1
- package/es2021.en/plugins/export-docs/export-docs.min.js +1 -1
- package/es2021.en/plugins/finder/finder.css +1 -1
- package/es2021.en/plugins/finder/finder.js +2 -2
- package/es2021.en/plugins/finder/finder.min.js +2 -2
- package/es2021.en/plugins/google-maps/google-maps.css +1 -1
- package/es2021.en/plugins/google-maps/google-maps.js +1 -1
- package/es2021.en/plugins/google-maps/google-maps.min.js +1 -1
- package/es2021.en/plugins/google-search/google-search.js +1 -1
- package/es2021.en/plugins/google-search/google-search.min.js +1 -1
- package/es2021.en/plugins/highlight-signature/highlight-signature.js +1 -1
- package/es2021.en/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es2021.en/plugins/iframe-editor/iframe-editor.css +1 -1
- package/es2021.en/plugins/iframe-editor/iframe-editor.js +1 -1
- package/es2021.en/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es2021.en/plugins/keyboard/keyboard.css +1 -1
- package/es2021.en/plugins/keyboard/keyboard.js +1 -1
- package/es2021.en/plugins/keyboard/keyboard.min.js +1 -1
- package/es2021.en/plugins/mobile-view/mobile-view.js +1 -1
- package/es2021.en/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es2021.en/plugins/page-break/page-break.js +1 -1
- package/es2021.en/plugins/page-break/page-break.min.js +1 -1
- package/es2021.en/plugins/paste-code/paste-code.css +1 -1
- package/es2021.en/plugins/paste-code/paste-code.js +1 -1
- package/es2021.en/plugins/paste-code/paste-code.min.js +1 -1
- package/es2021.en/plugins/paste-from-word/paste-from-word.js +1 -1
- package/es2021.en/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es2021.en/plugins/show-blocks/show-blocks.js +1 -1
- package/es2021.en/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es2021.en/plugins/style/style.css +1 -1
- package/es2021.en/plugins/style/style.js +1 -1
- package/es2021.en/plugins/style/style.min.js +1 -1
- package/es2021.en/plugins/templates/templates.css +1 -1
- package/es2021.en/plugins/templates/templates.js +1 -1
- package/es2021.en/plugins/templates/templates.min.js +1 -1
- package/es2021.en/plugins/todo-list/todo-list.css +1 -1
- package/es2021.en/plugins/todo-list/todo-list.js +1 -1
- package/es2021.en/plugins/todo-list/todo-list.min.js +1 -1
- package/es2021.en/plugins/translate/translate.css +1 -1
- package/es2021.en/plugins/translate/translate.js +1 -1
- package/es2021.en/plugins/translate/translate.min.js +1 -1
- package/es2021.en/plugins/tune-block/tune-block.css +1 -1
- package/es2021.en/plugins/tune-block/tune-block.js +1 -1
- package/es2021.en/plugins/tune-block/tune-block.min.js +1 -1
- package/es5/jodit.css +2 -2
- package/es5/jodit.fat.min.js +2 -2
- package/es5/jodit.js +89 -5
- package/es5/jodit.min.css +2 -2
- package/es5/jodit.min.js +2 -2
- package/es5/plugins/ai-assistant-pro/ai-assistant-pro.css +1 -1
- package/es5/plugins/ai-assistant-pro/ai-assistant-pro.js +174 -26
- package/es5/plugins/ai-assistant-pro/ai-assistant-pro.min.js +2 -2
- package/es5/plugins/autocomplete/autocomplete.js +1 -1
- package/es5/plugins/autocomplete/autocomplete.min.js +1 -1
- package/es5/plugins/backup/backup.css +1 -1
- package/es5/plugins/backup/backup.js +1 -1
- package/es5/plugins/backup/backup.min.js +1 -1
- package/es5/plugins/button-generator/button-generator.css +1 -1
- package/es5/plugins/button-generator/button-generator.js +1 -1
- package/es5/plugins/button-generator/button-generator.min.js +1 -1
- package/es5/plugins/change-case/change-case.js +1 -1
- package/es5/plugins/change-case/change-case.min.js +1 -1
- package/es5/plugins/color-picker/color-picker.css +1 -1
- package/es5/plugins/color-picker/color-picker.js +1 -1
- package/es5/plugins/color-picker/color-picker.min.js +1 -1
- package/es5/plugins/emoji/emoji.css +1 -1
- package/es5/plugins/emoji/emoji.js +1 -1
- package/es5/plugins/emoji/emoji.min.js +1 -1
- package/es5/plugins/export-docs/export-docs.js +1 -1
- package/es5/plugins/export-docs/export-docs.min.js +1 -1
- package/es5/plugins/finder/finder.css +1 -1
- package/es5/plugins/finder/finder.js +2 -2
- package/es5/plugins/finder/finder.min.js +2 -2
- package/es5/plugins/google-maps/google-maps.css +1 -1
- package/es5/plugins/google-maps/google-maps.js +1 -1
- package/es5/plugins/google-maps/google-maps.min.js +1 -1
- package/es5/plugins/google-search/google-search.js +1 -1
- package/es5/plugins/google-search/google-search.min.js +1 -1
- package/es5/plugins/highlight-signature/highlight-signature.js +1 -1
- package/es5/plugins/highlight-signature/highlight-signature.min.js +1 -1
- package/es5/plugins/iframe-editor/iframe-editor.css +1 -1
- package/es5/plugins/iframe-editor/iframe-editor.js +1 -1
- package/es5/plugins/iframe-editor/iframe-editor.min.js +1 -1
- package/es5/plugins/keyboard/keyboard.css +1 -1
- package/es5/plugins/keyboard/keyboard.js +1 -1
- package/es5/plugins/keyboard/keyboard.min.js +1 -1
- package/es5/plugins/mobile-view/mobile-view.js +1 -1
- package/es5/plugins/mobile-view/mobile-view.min.js +1 -1
- package/es5/plugins/page-break/page-break.js +1 -1
- package/es5/plugins/page-break/page-break.min.js +1 -1
- package/es5/plugins/paste-code/paste-code.css +1 -1
- package/es5/plugins/paste-code/paste-code.js +1 -1
- package/es5/plugins/paste-code/paste-code.min.js +1 -1
- package/es5/plugins/paste-from-word/paste-from-word.js +1 -1
- package/es5/plugins/paste-from-word/paste-from-word.min.js +1 -1
- package/es5/plugins/show-blocks/show-blocks.js +1 -1
- package/es5/plugins/show-blocks/show-blocks.min.js +1 -1
- package/es5/plugins/style/style.css +1 -1
- package/es5/plugins/style/style.js +1 -1
- package/es5/plugins/style/style.min.js +1 -1
- package/es5/plugins/templates/templates.css +1 -1
- package/es5/plugins/templates/templates.js +1 -1
- package/es5/plugins/templates/templates.min.js +1 -1
- package/es5/plugins/todo-list/todo-list.css +1 -1
- package/es5/plugins/todo-list/todo-list.js +1 -1
- package/es5/plugins/todo-list/todo-list.min.js +1 -1
- package/es5/plugins/translate/translate.css +1 -1
- package/es5/plugins/translate/translate.js +1 -1
- package/es5/plugins/translate/translate.min.js +1 -1
- package/es5/plugins/tune-block/tune-block.css +1 -1
- package/es5/plugins/tune-block/tune-block.js +1 -1
- package/es5/plugins/tune-block/tune-block.min.js +1 -1
- package/es5/polyfills.fat.min.js +1 -1
- package/es5/polyfills.js +1 -1
- package/es5/polyfills.min.js +1 -1
- package/esm/plugins/ai-assistant-pro/config.js +1 -1
- package/esm/plugins/ai-assistant-pro/tools/add-html/definition.d.ts +10 -0
- package/esm/plugins/ai-assistant-pro/tools/add-html/definition.js +1 -0
- package/esm/plugins/ai-assistant-pro/tools/add-html/executor.d.ts +13 -0
- package/esm/plugins/ai-assistant-pro/tools/add-html/executor.js +1 -0
- package/esm/plugins/ai-assistant-pro/tools/add-html/index.d.ts +9 -0
- package/esm/plugins/ai-assistant-pro/tools/add-html/index.js +1 -0
- package/esm/plugins/ai-assistant-pro/tools/index.js +1 -1
- package/esm/plugins/ai-assistant-pro/tools/read-blocks/executor.js +1 -1
- package/esm/plugins/ai-assistant-pro/ui/message-list/message-list.d.ts +4 -1
- package/esm/plugins/ai-assistant-pro/ui/message-list/message-list.js +1 -1
- package/esm/plugins/ai-assistant-pro/ui/permission-request/permission-request.js +2 -5
- package/esm/plugins/finder/ui/item/item.js +2 -2
- package/esm/plugins/license/helpers/helpers.js +1 -1
- package/esm/typings.d.ts +1 -0
- package/package.json +1 -1
- package/types/plugins/ai-assistant-pro/tools/add-html/definition.d.ts +10 -0
- package/types/plugins/ai-assistant-pro/tools/add-html/executor.d.ts +13 -0
- package/types/plugins/ai-assistant-pro/tools/add-html/index.d.ts +9 -0
- package/types/plugins/ai-assistant-pro/ui/message-list/message-list.d.ts +4 -1
- package/types/typings.d.ts +1 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* jodit-pro - PRO Version of Jodit Editor
|
|
3
3
|
* Author: Chupurnov Valerii <chupurnov@gmail.com>
|
|
4
|
-
* Version: v4.
|
|
4
|
+
* Version: v4.12.3
|
|
5
5
|
* Url: https://xdsoft.net/jodit/pro/
|
|
6
6
|
* License(s): SEE LICENSE IN LICENSE.md
|
|
7
7
|
*/
|
|
8
8
|
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var u=t();for(var n in u)("object"==typeof exports?exports:e)[n]=u[n]}}(self,function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[830],{94668:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> \x3c!-- Plus icon with document/context --\x3e <path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z"/> </svg>'},86428:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> \x3c!-- Background rounded rect --\x3e <rect x="1" y="1" width="22" height="22" rx="3"/> \x3c!-- Letter A - outer shape --\x3e <polygon points="8,5 2,19 5,19 6.5,16 11.5,16 13,19 16,19 10,5" fill="white"/> \x3c!-- Letter A - inner triangle (hole) --\x3e <polygon points="9,9 7.5,13 10.5,13" fill="currentColor"/> \x3c!-- Letter I --\x3e <rect x="17" y="5" width="3" height="14" fill="white"/> </svg>'},75966:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"> \x3c!-- Wand handle - diagonal line --\x3e <rect x="12" y="10" width="13" height="3.5" rx="0.5" transform="rotate(45 12 12)"/> \x3c!-- Wand tip - diamond --\x3e <rect x="3" y="3" width="6" height="6" rx="1" transform="rotate(45 6 6)"/> \x3c!-- Large sparkle - top --\x3e <polygon points="15,0 16,4 15,8 14,4"/> <polygon points="11,4 15,5 19,4 15,3"/> \x3c!-- Medium sparkle - left --\x3e <polygon points="1,11 2,14 1,17 0,14"/> <polygon points="-2,14 1,15 4,14 1,13"/> \x3c!-- Small sparkle - middle --\x3e <polygon points="8,14 8.5,16 8,18 7.5,16"/> <polygon points="6,16 8,16.5 10,16 8,15.5"/> </svg>'},83207:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M9 18l6-6-6-6"/> </svg>'},99219:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <line x1="22" y1="2" x2="11" y2="13"></line> <polygon points="22 2 15 22 11 13 2 9 22 2"></polygon> </svg>'},63674:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/> </svg>'},4133:function(e){e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M13 2L4 14h6l-1 8 9-12h-6z"/> </svg>'},62357:function(e,t,u){"use strict";u.d(t,{UIRange:function(){return F}});var n=u(82749),s=u(56075),i=u(11886),r=u(31635),o=u(65478),a=u(21537),l=u(67510);class F extends l.UIInput{className(){return"UIRange"}appendUIRange(){let e=this.j.create.div(this.getFullElName("slider"));this.container.appendChild(e);let t=this.j.create.div(this.getFullElName("handle"));e.appendChild(t);let u=this.j.create.div(this.getFullElName("log")),n=this.getElm("label");n&&n.appendChild(u)}onDragStart(e){this.startValue=parseFloat(this.value)||0,this.startX=e.clientX;let t=this.getElm("slider");(0,a.assert)(null!=t,"slider element does not exists"),this.width=t.offsetWidth,this.j.e.on(this.j.ow,"mousemove",this.onDrag)}onDrag(e){let{min:t,max:u,step:n=1}=this.state,s=(e.clientX-this.startX)/this.width*(this.state.max-this.state.min),i=this.startValue+s;i<t&&(i=t),i>u&&(i=u),i=Math.round(i/n)*n,this.value=i.toFixed(10)}onDragEnd(){this.j.e.off(this.j.ow,"mousemove",this.onDrag)}onChangeSelfValue(){let e=this.getElm("handle"),t=parseFloat(this.value)||0;(0,a.assert)(null!=e,"Handle element does not exist"),(0,a.css)(e,{left:(t-this.state.min)/(this.state.max-this.state.min)*100+"%"});let u=this.getElm("log");(0,a.assert)(null!=u,"log element does not exist"),u.innerText=t.toString()}destruct(){return this.onDragEnd(),super.destruct()}constructor(e,t){super(e,(0,i._)((0,s._)({},t),{type:"hidden"})),(0,n._)(this,"state",(0,i._)((0,s._)({},l.UIInput.defaultState),{min:0,max:100,step:1})),(0,n._)(this,"startValue",0),(0,n._)(this,"startX",0),(0,n._)(this,"width",100),Object.assign(this.state,t),this.appendUIRange(),this.onChangeSelfValue()}}(0,r.__decorate)([(0,o.watch)(["handle:mousedown","handle:touchstart"])],F.prototype,"onDragStart",null),(0,r.__decorate)([o.autobind],F.prototype,"onDrag",null),(0,r.__decorate)([(0,o.watch)(["j.ow:mouseup","j.ow:touchend"])],F.prototype,"onDragEnd",null),(0,r.__decorate)([(0,o.watch)(":change")],F.prototype,"onChangeSelfValue",null),F=(0,r.__decorate)([o.component],F)},41810:function(e,t,u){"use strict";u.r(t),u.d(t,{aiAssistantPro:function(){return y}});var n=u(77688),s=u(82749),i=u(56075),r=u(11886),o=u(31635);u(66645);var a=u(86449),l=u(21020),F=u(46166),c=u(62895),h=u(55487),d=u(27769),p=u(58579),A=u(63805),C=u(82758),E=u(65478),D=u(580),g=u(21537),f=u(50911),m=u(2692),B=u(18549),v=u(54747);class y extends f.Plugin{get state(){return this.stateManager.state}get toolRegistry(){return new h.ToolRegistry(this.j)}get permissionManager(){return new l.PermissionManager(this.j,this.toolRegistry)}get apiClient(){return new a.APIClient(this.j,this.toolRegistry)}get storage(){let{storage:e,storageKey:t,maxConversations:u}=this.j.o.aiAssistantPro;if("string"==typeof e){let n=(0,c.createStorageProvider)(e,t);return new c.WebStorageConversationStorage(n,u)}return e}get stateManager(){return new F.StateManager(this.j)}get mainPanel(){return new d.UIMainPanel(this.j,this.stateManager.state,this.j.o.aiAssistantPro,e=>{let t=this.stateManager.getCurrentConversation();t&&this.stateManager.setCurrentConversation((0,i._)({},t,e))})}get dialog(){let e=this.j.dlg({resizable:this.j.o.aiAssistantPro.resizable,eventEmmiter:this.j.e});return e.e.on(e,"afterClose",()=>{this.j.e.fire("closeAIAssistantPro.ai-assistant-pro")}),e}setupTextAutocomplete(){let{textAutocompleteEnabled:e,textAutocompleteApiRequest:t,textAutocompleteMinQueryLength:u,textAutocompleteMaxSuggestions:s,textAutocompleteDebounceMs:o,textAutocompleteCacheTTL:a,textAutocompleteCacheMaxSize:l}=this.j.o.aiAssistantPro;if(!e||!t)return;this.j.o.autocomplete=(0,r._)((0,i._)({},this.j.o.autocomplete),{displayMode:"inline"});let F=this.textAutocompleteCache,c=null;this.textAutocompleteSource=e=>{if(e.length<u)return[];let i=`${e}:${s}`;if(a>0){let e=F.get(i);if(e&&Date.now()-e.ts<a)return e.data.map(e=>({value:e,title:e}))}c&&clearTimeout(c);let r=new AbortController;return new Promise(u=>{c=setTimeout(()=>(0,n._)(function*(){try{let n=yield t(e,s,r.signal);if(Array.isArray(n)){let e=n.slice(0,s);if(a>0){if(F.size>=l){let e=F.keys().next().value;null!=e&&F.delete(e)}F.set(i,{ts:Date.now(),data:e})}u(e.map(e=>({value:e,title:e})));return}u([])}catch(e){u([])}})(),o)})},this.j.e.fire("registerAutocompleteSource",this.textAutocompleteSource)}afterInit(){(0,D.extendLang)(A),this.setupEventListeners(),this.setupTextAutocomplete(),this.j.async.promise(e=>{let{initiallyOpened:t,persistOpenState:u}=this.j.o.aiAssistantPro,n=t;u?this.storage.getGlobalSettings().then(e=>{if((null==e?void 0:e.isOpen)!=null&&(n=e.isOpen),n)return this.openAssistant()}).catch(()=>null).finally(()=>e(void 0)):e(void 0)}).catch(()=>null)}__loadData(){return this.__initedPromise?this.__initedPromise:this.isDestructed?Promise.reject():(this.__initedPromise=this.j.async.promise(e=>{this.loadInitialData().then(e)}).catch(()=>null),this.__initedPromise)}loadInitialData(){return(0,n._)(function*(){this.mainPanel.setMod("ready",!0),yield(0,p.loadInitialData)(this.j,this.storage,this.stateManager),yield this.restorePendingToolCalls()}).call(this)}restorePendingToolCalls(){return(0,n._)(function*(){let e=this.stateManager.getCurrentConversation();if(!e)return;let t=(0,p.findMessagesWithPendingToolCalls)(e);if(0!==t.length)for(let e of t)yield this.handleToolCalls(e.id)}).call(this)}setupEventListeners(){this.j.e.on("selectConversation.ai-assistant-pro",e=>(0,n._)(function*(){try{yield this.__loadData(),yield(0,p.handleConversationSelect)(e,this.storage,this.stateManager)}catch(e){C.IS_PROD}}).call(this)),this.j.e.on("newConversation.ai-assistant-pro",()=>(0,n._)(function*(){yield this.__loadData();let e=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature);this.stateManager.setCurrentConversation(e)}).call(this)),this.j.e.on("deleteConversation.ai-assistant-pro",e=>(0,n._)(function*(){yield this.__loadData(),yield this.deleteConversation(e)}).call(this)),this.j.e.on("renameConversation.ai-assistant-pro",(e,t)=>(0,n._)(function*(){yield this.__loadData(),yield this.renameConversation(e,t)}).call(this)),this.j.e.on("backToList.ai-assistant-pro",()=>(0,n._)(function*(){yield this.__loadData(),yield(0,p.handleBackToList)(this.storage,this.stateManager)}).call(this)),this.j.e.on("removeContext.ai-assistant-pro",e=>(0,n._)(function*(){yield this.__loadData(),this.stateManager.removeSelectionContext(e)}).call(this)),this.j.e.on("approveToolCall.ai-assistant-pro",(e,t)=>(0,n._)(function*(){try{yield this.__loadData();let u=yield(0,p.handleToolApproval)(e,t,this.stateManager,this.permissionManager,this.storage);if(u){let e=this.stateManager.getCurrentConversation();if(!e)return;let t=e.messages.find(e=>{var t;return null==(t=e.toolCalls)?void 0:t.some(e=>e.id===u.id)});if(!t)return;yield this.executeToolCall(t.id,u)}}catch(e){if((0,g.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:String(e))}}).call(this)),this.j.e.on("denyToolCall.ai-assistant-pro",e=>(0,n._)(function*(){yield this.__loadData(),yield(0,p.handleToolDenial)(this.j,e,this.stateManager,this.storage)}).call(this)),this.j.e.on("abortRequest.ai-assistant-pro",()=>(0,n._)(function*(){yield this.__loadData(),this.apiClient.abort(),this.stateManager.setLoading(!1)}).call(this))}__applyTheme(){(0,p.applyTheme)(this.j,this.stateManager.state.theme,this.stateManager.state.displayMode,this.mainPanel.container,this.dialog)}openAssistant(){return(0,n._)(function*(){if(this.stateManager.isOpen()){this.stateManager.close(),yield this.__closeInContainer();return}yield this.__loadData(),this.isDestructed||(this.stateManager.open(),yield this.__openInContainer(),this.j.o.aiAssistantPro.includeSelectionByDefault&&!this.j.s.isCollapsed()&&this.addCurrentSelectionToContext())}).call(this)}__openInContainer(){return(0,n._)(function*(){let{resizable:e,allowClose:t,flightPanelHeight:u}=this.j.o.aiAssistantPro,{displayMode:n="right",panelWidth:s,panelHeight:i}=this.stateManager.state;switch(this.__applyTheme(),this.mainPanel.setMod("displayMode",n),this.mainPanel.setMod("allowClose",t),this.mainPanel.setParentView("dialog"===n||"flight"===n?this.dialog:this.j),this.__openedMode=n,n){case"dialog":this.dialog.setSize(s,i).open().setContent(this.mainPanel.container);break;case"flight":B.UIFlightPosition.install(this.mainPanel,this.j.container,{panelHeight:u,containerClassName:this.getFullElName("flight-container")});break;default:e&&(v.UIResize.remove(this.mainPanel),v.UIResize.install(this.mainPanel,(0,p.invertMode)(n),{handleClassName:this.getFullElName("ai-assistent-resize-handle"),onResize:({newSize:e})=>{let t="left"===n||"right"===n?e:s,u="top"===n||"bottom"===n?e:i;return this.stateManager.state.panelWidth=t,this.stateManager.state.panelHeight=u,!0}})),this.j.currentPlace.slots[n].appendChild(this.mainPanel.container),(0,p.resizeInPanelView)(this.j,n,s,i)}}).call(this)}__onResizeInPanelView(){let{displayMode:e,panelWidth:t,panelHeight:u}=this.stateManager.state;(0,p.resizeInPanelView)(this.j,e,t,u)}__closeInContainer(){return(0,n._)(function*(){let{displayMode:e}=yield this.stateManager.state;switch(this.__openedMode!==e&&"dialog"===this.__openedMode&&this.dialog.close(),this.__openedMode!==e&&"flight"===this.__openedMode&&this.__closeFlightMode(),e){case"dialog":this.dialog.close();break;case"flight":this.__closeFlightMode();break;default:this.mainPanel.container.remove()}}).call(this)}__closeFlightMode(){B.UIFlightPosition.remove(this.mainPanel)}__onSavedStateChange(){var e;let t=this.stateManager.state;return this.storage.saveGlobalSettings((0,i._)({displayMode:t.displayMode,panelWidth:t.panelWidth,panelHeight:t.panelHeight,theme:t.theme,defaultModel:t.defaultModel,defaultTemperature:t.defaultTemperature,currentConversationId:null==(e=t.currentConversation)?void 0:e.id},this.j.o.aiAssistantPro.persistOpenState?{isOpen:t.isOpen}:{}))}closeAssistant(){return(0,n._)(function*(){this.stateManager.isOpen()&&(yield this.__loadData(),this.stateManager.close(),this.__closeInContainer())}).call(this)}addCurrentSelectionToContext(){return(0,n._)(function*(){yield this.__loadData();let e=(0,p.getCurrentSelectionContext)(this.j);e&&this.stateManager.addSelectionContext(e)}).call(this)}executeQuickCommand(e){return(0,n._)(function*(){let t,{quickCommandsSilentMode:u,quickCommandsDisplayMode:n}=this.j.o.aiAssistantPro,s=this.j.o.aiAssistant;if(s&&s[e]&&(0,g.isString)(s[e])&&(t=s[e]),!t)return void this.j.e.fire("error",`Command not found: ${e}`);let i=this.j.s.isCollapsed()?this.j.value:this.j.s.html;if(!i)return;let r=(null==s?void 0:s.aiCommonPrefixPrompt)||"",o=(null==s?void 0:s.aiCommonSuffixPrompt)||"",a=`${r}${t}${o}
|
|
9
9
|
|
|
10
|
-
${i}`.trim();u?yield this.__executeQuickCommandSilent(a,i):yield this.__executeQuickCommandWithPanel(a,n)}).call(this)}__executeQuickCommandSilent(e,t){return(0,n._)(function*(){yield this.__loadData(),this.j.progressbar.show().progress(100);try{let t=(0,p.createUserMessage)(e),u=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature,[t]),n=yield this.apiClient.sendRequest(u.id,u.messages,null,[],u.options);if("final"===n.mode){let e=n.response.content;e&&this.j.s.insertHTML(e)}}catch(e){(0,g.isAbortError)(e)||this.j.e.fire("error",e)}finally{this.j.progressbar.hide()}}).call(this)}__executeQuickCommandWithPanel(e,t){return(0,n._)(function*(){yield this.__loadData();let u=this.stateManager.state.displayMode;this.stateManager.state.displayMode=t;let n=(0,p.getCurrentSelectionContext)(this.j);n&&this.stateManager.addSelectionContext(n),this.stateManager.isOpen()||(yield this.openAssistant()),yield this.sendMessage(e),this.stateManager.state.displayMode=u}).call(this)}sendMessage(e){return(0,n._)(function*(){yield this.__loadData();let t=this.stateManager.getCurrentConversation(),u=this.stateManager.getEditingMessageId();if(u&&t){let e=t.messages.findIndex(e=>e.id===u);if(-1!==e){let u=t.messages.slice(0,e),n=(0,r._)((0,i._)({},t),{messages:u,updatedAt:Date.now()});this.stateManager.setCurrentConversation(n),yield this.storage.save(n),this.stateManager.clearEditingMessage(),t=n}}t||(t=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(t));let n=null;e.trim()&&(n=(0,p.createUserMessage)(e),t.title||(t=(0,r._)((0,i._)({},t),{title:e})),t=(0,r._)((0,i._)({},t),{updated:Date.now(),messages:[...t.messages,n]})),this.stateManager.setCurrentConversation((0,i._)({},t)),n&&this.j.e.fire("messageSent.ai-assistant-pro",n),this.stateManager.setLoading(!0),this.stateManager.clearError();try{yield this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(e){if((0,g.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:String(e))}finally{this.stateManager.setLoading(!1)}}).call(this)}sendRequestToAI(e=0){return(0,n._)(function*(){let t,u,n=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(e>=n)throw Error(`Max recursion depth ${n} reached for tool calls`);let s=this.stateManager.getCurrentConversation();if(!s)return;let r=(0,p.findParentMessageId)(s),[o]=yield Promise.all([this.apiClient.sendRequest(s.id,s.messages,r,this.stateManager.getSelectionContexts(),s.options),this.storage.save(s)]);if("stream"===o.mode){let e=yield(0,p.processStreamingResponse)(this.stateManager,o,s);t=e.aiMessage,u=e.index,s=e.conversation}else{let e=(0,p.processFinalResponse)(o,s);t=e.aiMessage,u=e.index,s=e.conversation}s=yield(0,p.processArtifacts)(this.j,t,s,u),this.j.e.fire("messageReceived.ai-assistant-pro",t),this.stateManager.setCurrentConversation((0,i._)({},s)),yield this.storage.save(s),yield this.handleToolCalls(t.id,e)}).call(this)}deleteConversation(e){return(0,n._)(function*(){yield this.__loadData(),yield(0,p.deleteConversationWithCleanup)(this.j,e,this.storage,this.stateManager,this.permissionManager)}).call(this)}renameConversation(e,t){return(0,n._)(function*(){var u;let n=yield this.storage.get(e);if(!n)return;let s=(0,r._)((0,i._)({},n),{title:t,updated:Date.now()});yield this.storage.save(s),(null==(u=this.state.currentConversation)?void 0:u.id)===e&&this.stateManager.setCurrentConversation(s);let o=yield this.storage.list();this.stateManager.setConversations(o)}).call(this)}searchConversations(e){return(0,n._)(function*(){yield this.__loadData(),yield(0,p.handleConversationSearch)(e,this.storage,this.stateManager)}).call(this)}handleToolCalls(e,t=0){return(0,n._)(function*(){let u=this.stateManager.getCurrentConversation();if(!u)return;let n=u.messages.find(t=>t.id===e);if(!n)return;let s=n.toolCalls;if(!s||0===s.length)return;let i=s.filter(e=>!(0,p.isTerminalToolCallStatus)(e.status));if(0===i.length)return;let{approved:r,needsPermission:o}=this.permissionManager.filterToolCalls(i,u.permissions);for(let u of(this.stateManager.setPendingToolCalls(o),r))yield this.executeToolCall(e,u,t)}).call(this)}executeToolCall(e,t,u=0){return(0,n._)(function*(){let n=this.stateManager.getCurrentConversation();if(!n)return;let s=yield(0,p.executeToolCall)(this.j,t,this.toolRegistry),o=n.messages.findIndex(t=>t.id===e);if(-1===o)return;let a=n.messages[o],l=n.messages.slice();l[o]=(0,p.updateToolCallInMessage)(a,s),n=(0,r._)((0,i._)({},n),{messages:l,updated:Date.now()}),this.stateManager.setCurrentConversation(n),(0,p.areAllToolCallsExecuted)(n)&&(yield this.sendRequestToAI(u+1))}).call(this)}copyMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.find(t=>t.id===e);if(u)try{yield navigator.clipboard.writeText(u.content),this.j.message.success("Message copied to clipboard")}catch(e){this.j.e.fire("error",Error("Failed to copy message"))}}).call(this)}restartFromMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.findIndex(t=>t.id===e);if(-1===u)return;let n=t.messages[u];if("user"!==n.role)return;yield this.__loadData();let s=t.messages.slice(0,u),o=(0,r._)((0,i._)({},t),{messages:s,updatedAt:Date.now()});this.stateManager.setCurrentConversation(o),yield this.storage.save(o),yield this.sendMessage(n.content)}).call(this)}editMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.find(t=>t.id===e);u&&"user"===u.role&&(this.stateManager.setEditingMessageId(e),this.mainPanel.inputArea.setValue(u.content),this.mainPanel.inputArea.focus())}).call(this)}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}deleteMessage(e){return(0,n._)(function*(){yield this.__loadData();let t=this.stateManager.getCurrentConversation();if(!t||-1===t.messages.findIndex(t=>t.id===e))return;let u=t.messages.filter(t=>t.id!==e),n=(0,r._)((0,i._)({},t),{messages:u,updatedAt:Date.now()});this.stateManager.setCurrentConversation(n),yield this.storage.save(n)}).call(this)}beforeDestruct(){var e,t,u,n,s,i,r,o;this.textAutocompleteSource&&(this.j.e.fire("unregisterAutocompleteSource",this.textAutocompleteSource),this.textAutocompleteSource=null),this.textAutocompleteCache.clear(),this.__closeFlightMode(),null==(e=(0,E.cached)(this,"toolRegistry"))||e.destruct(),null==(t=(0,E.cached)(this,"permissionManager"))||t.destruct(),null==(u=(0,E.cached)(this,"apiClient"))||u.destruct(),null==(n=(0,E.cached)(this,"stateManager"))||n.destruct(),null==(s=(0,E.cached)(this,"mainPanel"))||s.destruct(),null==(i=(0,E.cached)(this,"dialog"))||i.destruct(),null==(o=(0,E.cached)(this,"storage"))||null==(r=o.close)||r.call(o)}constructor(...e){super(...e),(0,s._)(this,"buttons",[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}]),(0,s._)(this,"textAutocompleteSource",null),(0,s._)(this,"textAutocompleteCache",new Map),(0,s._)(this,"__initedPromise",null),(0,s._)(this,"__openedMode",null)}}(0,s._)(y,"requires",["license","autocomplete"]),(0,o.__decorate)([E.cache],y.prototype,"toolRegistry",null),(0,o.__decorate)([E.cache],y.prototype,"permissionManager",null),(0,o.__decorate)([E.cache],y.prototype,"apiClient",null),(0,o.__decorate)([E.cache],y.prototype,"storage",null),(0,o.__decorate)([E.cache],y.prototype,"stateManager",null),(0,o.__decorate)([E.cache],y.prototype,"mainPanel",null),(0,o.__decorate)([E.cache],y.prototype,"dialog",null),(0,o.__decorate)([(0,E.watch)("state.theme")],y.prototype,"__applyTheme",null),(0,o.__decorate)([(0,E.watch)(":openAIAssistantPro.ai-assistant-pro")],y.prototype,"openAssistant",null),(0,o.__decorate)([(0,E.watch)([":resize","state.panelWidth","state.panelHeight"])],y.prototype,"__onResizeInPanelView",null),(0,o.__decorate)([(0,E.watch)(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),(0,E.debounce)()],y.prototype,"__onSavedStateChange",null),(0,o.__decorate)([(0,E.watch)(":closeAIAssistantPro.ai-assistant-pro")],y.prototype,"closeAssistant",null),(0,o.__decorate)([(0,E.watch)(":addContextToAIAssistant.ai-assistant-pro")],y.prototype,"addCurrentSelectionToContext",null),(0,o.__decorate)([(0,E.watch)(":executeQuickCommand.ai-assistant-pro")],y.prototype,"executeQuickCommand",null),(0,o.__decorate)([(0,E.watch)(":sendMessage.ai-assistant-pro")],y.prototype,"sendMessage",null),(0,o.__decorate)([(0,E.watch)(":searchConversations.ai-assistant-pro")],y.prototype,"searchConversations",null),(0,o.__decorate)([(0,E.watch)(":copyMessage.ai-assistant-pro")],y.prototype,"copyMessage",null),(0,o.__decorate)([(0,E.watch)(":restartFromMessage.ai-assistant-pro")],y.prototype,"restartFromMessage",null),(0,o.__decorate)([(0,E.watch)(":editMessage.ai-assistant-pro")],y.prototype,"editMessage",null),(0,o.__decorate)([(0,E.watch)(":cancelEditMessage.ai-assistant-pro")],y.prototype,"cancelEditMessage",null),(0,o.__decorate)([(0,E.watch)(":deleteMessage.ai-assistant-pro")],y.prototype,"deleteMessage",null),y=(0,o.__decorate)([E.component],y),m.JoditPro.plugins.add("aiAssistantPro",y)},66645:function(e,t,u){"use strict";var n,s=u(77688),i=u(56075),r=u(11886),o=u(47373),a=u(94668),l=u.n(a),F=u(86428),c=u.n(F),h=u(75966),d=u.n(h),p=u(83207),A=u.n(p),C=u(99219),E=u.n(C),D=u(63674),g=u.n(D),f=u(4133),m=u.n(f),B=u(94454),v=u(53835),y=u(6441),x=u(12153),_=u(31974),w=u(72573);x.Icon.set("ai-assistant-pro",c()).set("ai-commands-pro",d()).set("ai-add-context",l()).set("send",E()).set("tool-bolt",m()).set("chevron-right",A()).set("shield",g()),y.Config.prototype.aiAssistantPro={displayMode:"right",panelWidth:400,panelHeight:500,flightPanelHeight:250,dialogFullSize:!1,resizable:!0,apiMode:"incremental",apiRequest:null,maxRetries:3,requestTimeout:3e5,retryDelay:1e3,maxRecursionToolCallDepth:1e3,enabledTools:(0,v.getToolNames)(),customTools:[],toolPermissions:{},autoApproveTools:["readDocument","readBlocks","readSelection","insertHTML"],alwaysDenyTools:[],defaultPermissionScope:"conversation",storage:"indexedDB",maxConversations:50,storageKey:"jodit-ai-assistant-pro",showConversationList:!0,enableMarkdown:!0,enableCodeHighlight:!0,maxMessageHeight:400,placeholderText:"Ask AI assistant...",sendShortcut:"Ctrl+Enter",showTimestamps:!0,formatTimestamp:(e,t)=>{let u=new Date(e),n=new Date().getTime()-u.getTime();return n<6e4?t("Just now"):n<36e5?t("%dm ago",Math.floor(n/6e4)):n<864e5?t("%dh ago",Math.floor(n/36e5)):u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},formatMessageContent:(e,t)=>w.marked.parse(e,{breaks:!0,gfm:!0}),showAvatars:!0,showTypingIndicator:!0,includeSelectionByDefault:!0,maxContextRanges:5,showContextPreview:!0,sendOnEnter:!0,instructions:void 0,includeEditorMetadata:!1,autoOpen:!0,rememberLastConversation:!0,autoFocusInput:!0,closeAfterInsert:!1,enableSoundNotifications:!1,debug:!1,textAutocompleteEnabled:!1,textAutocompleteApiRequest:null,textAutocompleteMinQueryLength:3,textAutocompleteMaxSuggestions:3,textAutocompleteDebounceMs:500,textAutocompleteCacheTTL:3e4,textAutocompleteCacheMaxSize:50,quickCommandsSilentMode:!1,quickCommandsDisplayMode:"flight",showCopyMessageAction:!0,showRestartMessageAction:!0,showEditMessageAction:!0,showDeleteMessageAction:!0,dialogSettings:{},allowEditDialogSettings:!1,allowEditDisplayMode:!0,allowEditPanelWidth:!0,initiallyOpened:!1,allowClose:!0,persistOpenState:!0,theme:"parent",allowEditTheme:!0,uploadBase64Artifact(e,t){return(0,s._)(function*(){if("image"===e.type&&e.data&&"base64"===e.data.kind)try{let u=(0,o.base64ToFile)(e.data.base64,e.id,e.mimeType),n=yield t.uploader.upload([u]);return(0,r._)((0,i._)({},e),{data:{kind:"url",url:n.baseurl+n.files[0]},metadata:(0,r._)((0,i._)({},e.metadata),{filename:n.files[0]})})}catch(e){t.e.fire("error",e)}return e})()},getAIProviderOptions(e,t){return(0,B.getAIProviderOptions)(e,t)},registerAIProvider(e,t){(0,B.registerAIProvider)(e,t)}},y.Config.prototype.controls.aiAssistantPro={icon:"ai-assistant-pro",tooltip:"AI Assistant",hotkeys:["ctrl+shift+a","cmd+shift+a"],exec(e){e.e.fire("openAIAssistantPro.ai-assistant-pro")},isDisabled(e){return!e.o.aiAssistantPro.apiRequest},getLabel(e){return e.o.aiAssistantPro.apiRequest?"AI Assistant":"AI Assistant (not configured)"}},y.Config.prototype.controls.aiAddContext={icon:"ai-add-context",tooltip:"Add to AI Context",exec(e){e.e.fire("addContextToAIAssistant")},isDisabled(e){return!e.o.aiAssistantPro.apiRequest||e.s.isCollapsed()}},y.Config.prototype.controls.aiCommandsPro={icon:"ai-commands-pro",tooltip:"AI Commands",isDisabled(e){return!e.o.aiAssistantPro.apiRequest},list:_.aiAssitentCommands,exec(e,t,{control:u}){e.e.fire("executeQuickCommand.ai-assistant-pro",u.name)}};let b=(null==(n=y.Config.prototype.tuneBlock)?void 0:n.popup)||{},k={};["p","h1","h2","h3","h4","h5","h6","div","section","article","pre","blockquote","ul","ol","li","table","tr","td","th","img","figure"].forEach(e=>{let t=b[e]||["tune.up","tune.remove","tune.down"];k[e]=[...t,"|","aiAddContext"]}),y.Config.prototype.tuneBlock&&(y.Config.prototype.tuneBlock.popup=(0,i._)({},b,k))},6689:function(e,t,u){"use strict";u.d(t,{throwIfAborted:function(){return s}});var n=u(93661);function s(e){if(e.aborted)throw(0,n.abort)()}},61872:function(e,t,u){"use strict";u.d(t,{processArtifacts:function(){return F},processFinalResponse:function(){return l},processStreamingResponse:function(){return a}});var n=u(89929),s=u(77688),i=u(56075),r=u(11886),o=u(61558);function a(e,t,u){return(0,s._)(function*(){let s=(0,o.createAIMessage)(),a=-1;var l,F=!1,c=!1;try{for(var h,d=(0,n._)(t.stream);F=!(h=yield d.next()).done;F=!1){let t=h.value;switch(t.type){case"created":s=(0,r._)((0,i._)({},s),{id:t.response.responseId,content:""}),a=u.messages.length;break;case"text-delta":s=(0,r._)((0,i._)({},s),{content:s.content+t.delta});break;case"completed":s=(0,r._)((0,i._)({},s),{id:t.response.responseId,toolCalls:t.response.toolCalls||[],artifacts:t.response.artifacts||[]});break;case"error":{let e=(0,o.createErrorMessage)(t.error);s=(0,r._)((0,i._)({},s),{id:e.id,content:e.content})}}if(s.id){let t=u.messages.slice();t[a>=0?a:u.messages.length]=s,u=(0,r._)((0,i._)({},u),{messages:t,updated:Date.now()}),e.setCurrentConversation(u)}}}catch(e){c=!0,l=e}finally{try{F&&null!=d.return&&(yield d.return())}finally{if(c)throw l}}return{aiMessage:s,index:a,conversation:u}})()}function l(e,t){let u=(0,r._)((0,i._)({},(0,o.createAIMessage)()),{id:e.response.responseId,content:e.response.content,toolCalls:e.response.toolCalls||[],artifacts:e.response.artifacts||[]}),n=t.messages.slice();return n.push(u),{aiMessage:u,index:(t=(0,r._)((0,i._)({},t),{messages:n,updated:Date.now()})).messages.length-1,conversation:t}}function F(e,t,u,n){return(0,s._)(function*(){if(t.artifacts&&t.artifacts.length>0){let s=u.messages.slice();return s[n]=(0,r._)((0,i._)({},s[n]),{artifacts:yield(0,o.uploadArtifacts)(e,t.artifacts)}),(0,r._)((0,i._)({},u),{messages:s,updated:Date.now()})}return u})()}},49459:function(e,t,u){"use strict";function n(e,t,u={}){let s=e[t];if("string"!=typeof s||!u.allowEmpty&&""===s)throw Error(`Parameter "${t}" is required and must be a${u.allowEmpty?"":" non-empty"} string`);return s}u.d(t,{requireString:function(){return n}})},44526:function(e,t,u){"use strict";u.d(t,{resolveBlock:function(){return s}});var n=u(22732);function s(e,{selector:t,index:u,requireExactlyOne:i=!1}={}){let r=null!=t&&""!==t.trim(),o=null!=u;if(i&&r===o)throw Error("Either index or selector must be provided, but not both");if(!r&&!o)throw Error("Block identifier is required");if(r){if("string"!=typeof t)throw Error("Selector must be a string");let u=e.editor.querySelector(t);if(!u)throw Error(`No element found matching selector "${t}"`);if(!n.Dom.isElement(u))throw Error(`Selector "${t}" does not point to an element node`);return{element:u,identifier:`with selector "${t}"`}}if("number"!=typeof u)throw Error("Block index must be a number");let a=Array.from(e.editor.children);if(u<0||u>=a.length)throw Error(`Block index ${u} is out of range. Document has ${a.length} blocks`);let l=a[u];if(!n.Dom.isElement(l))throw Error(`Block at index ${u} is not a valid element`);return{element:l,identifier:`at index ${u}`}}},70308:function(e,t,u){"use strict";u.d(t,{areAllToolCallsExecuted:function(){return a},createNewConversation:function(){return s},findMessagesWithPendingToolCalls:function(){return l},findParentMessageId:function(){return i},isTerminalToolCallStatus:function(){return o}});var n=u(21064);function s(e,t,u,i=[]){let r=e.o.aiAssistantPro,o={id:(0,n.generateConversationId)(),created:Date.now(),updated:Date.now(),messages:i,permissions:[],options:{model:null!=t?t:r.defaultModel,temperature:null!=u?u:r.defaultTemperature}};return e.e.fire("conversationCreated.ai-assistant-pro",o),o}function i(e){for(let t=e.messages.length-1;t>=0;t--){let u=e.messages[t];if("assistant"===u.role&&!u.id.startsWith("error_"))return u.id}return null}let r=new Set(["executed","denied","error"]);function o(e){return r.has(e)}function a(e){let t=e.messages[e.messages.length-1];return!!(null==t?void 0:t.toolCalls)&&t.toolCalls.every(e=>o(e.status))}function l(e){return e.messages.filter(e=>e.toolCalls&&e.toolCalls.length>0&&e.toolCalls.some(e=>!o(e.status)))}},473:function(e,t,u){"use strict";u.d(t,{handleBackToList:function(){return c},handleConversationSearch:function(){return h},handleConversationSelect:function(){return F},handleToolApproval:function(){return a},handleToolDenial:function(){return l}});var n=u(77688),s=u(56075),i=u(11886),r=u(79078),o=u(82758);function a(e,t,u,r,o){return(0,n._)(function*(){let n=u.getPendingToolCalls().find(t=>t.id===e);if(!n)return null;let a=r.grantPermission(n.name,t),l=u.getCurrentConversation();return l&&(l.permissions.push(a),yield o.save(l)),u.removePendingToolCall(e),(0,i._)((0,s._)({},n),{status:"approved"})})()}function l(e,t,u,o){return(0,n._)(function*(){let n=u.getPendingToolCalls().find(e=>e.id===t);if(!n)return;let a=u.getCurrentConversation();if(!a)return;let l=a.messages.findIndex(e=>{var u;return null==(u=e.toolCalls)?void 0:u.find(e=>e.id===t)});if(-1===l)return;let F=a.messages[l],c=(0,i._)((0,s._)({},n),{result:{error:"Tool call denied by user."},status:"denied"}),h=(0,r.updateToolCallInMessage)(F,c),d=[...a.messages];d[l]=h,a=(0,i._)((0,s._)({},a),{messages:d,updated:Date.now()}),u.setCurrentConversation(a),yield o.save(a),e.e.fire("toolCallDenied.ai-assistant-pro",n),u.removePendingToolCall(t)})()}function F(e,t,u){return(0,n._)(function*(){try{u.setLoading(!0);let n=yield t.get(e);if(!n)throw Error("Conversation not found: "+e);u.setCurrentConversation((0,s._)({},n))}catch(e){o.IS_PROD}finally{u.setLoading(!1)}})()}function c(e,t){return(0,n._)(function*(){t.setView("conversationList");try{t.setLoading(!0);let u=yield e.list().catch(()=>[]);t.setConversations(u)}finally{t.setLoading(!1)}})()}function h(e,t,u){return(0,n._)(function*(){u.setLoading(!0);try{let n=yield t.list(e||void 0);u.setConversations(n),u.setView("conversationList")}finally{u.setLoading(!1)}})()}},58579:function(e,t,u){"use strict";u.d(t,{applyTheme:function(){return F.applyTheme},areAllToolCallsExecuted:function(){return s.areAllToolCallsExecuted},createNewConversation:function(){return s.createNewConversation},createUserMessage:function(){return r.createUserMessage},deleteConversationWithCleanup:function(){return l.deleteConversationWithCleanup},executeToolCall:function(){return c.executeToolCall},findMessagesWithPendingToolCalls:function(){return s.findMessagesWithPendingToolCalls},findParentMessageId:function(){return s.findParentMessageId},getCurrentSelectionContext:function(){return a.getCurrentSelectionContext},handleBackToList:function(){return i.handleBackToList},handleConversationSearch:function(){return i.handleConversationSearch},handleConversationSelect:function(){return i.handleConversationSelect},handleToolApproval:function(){return i.handleToolApproval},handleToolDenial:function(){return i.handleToolDenial},invertMode:function(){return o.invertMode},isTerminalToolCallStatus:function(){return s.isTerminalToolCallStatus},loadInitialData:function(){return l.loadInitialData},processArtifacts:function(){return n.processArtifacts},processFinalResponse:function(){return n.processFinalResponse},processStreamingResponse:function(){return n.processStreamingResponse},resizeInPanelView:function(){return o.resizeInPanelView},updateToolCallInMessage:function(){return c.updateToolCallInMessage}});var n=u(61872),s=u(70308),i=u(473),r=u(61558),o=u(71050),a=u(15927),l=u(56110),F=u(53014),c=u(79078)},61558:function(e,t,u){"use strict";u.d(t,{createAIMessage:function(){return r},createErrorMessage:function(){return o},createUserMessage:function(){return i},uploadArtifacts:function(){return a}});var n=u(77688),s=u(21064);function i(e){return{id:(0,s.generateMessageId)(),role:"user",content:e,timestamp:Date.now()}}function r(){return{id:"",role:"assistant",content:"",artifacts:[],timestamp:Date.now(),toolCalls:[]}}function o(e){return{id:"error_"+(0,s.generateMessageId)(),role:"assistant",content:`❌ Error: ${e.message}`,timestamp:Date.now(),toolCalls:[],artifacts:[]}}function a(e,t){return(0,n._)(function*(){if(!t||0===t.length)return t;let u=e.o.aiAssistantPro.uploadBase64Artifact;return u?Promise.all(t.map(t=>(0,n._)(function*(){var n;return null!=(n=u(t,e))?n:t})())):t})()}},71050:function(e,t,u){"use strict";u.d(t,{invertMode:function(){return s},resizeInPanelView:function(){return i}});var n=u(41180);function s(e){switch(e){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top"}}function i(e,t,u,i){var r,o,a,l;if("dialog"===t||"flight"===t)return;("left"===t||"right"===t)&&(null==(a=e.currentPlace.slots[s(t)])||a.style.setProperty(`--jd-slot-${s(t)}-width`,"auto"),null==(l=e.currentPlace.slots[t])||l.style.setProperty(`--jd-slot-${t}-width`,`${u}px`));let F=null!=(r=(0,n.css)(e.currentPlace.workplace,"height"))?r:0;null==(o=e.currentPlace.slots[t])||o.style.setProperty("min-height",`${Math.min(F,i)}px`)}},15927:function(e,t,u){"use strict";function n(e){if(e.s.isCollapsed())return null;let t=e.s.html,u=e.s.range;return{html:t,rangeInfo:{startContainer:u.startContainer.nodeName,startOffset:u.startOffset,endContainer:u.endContainer.nodeName,endOffset:u.endOffset}}}u.d(t,{getCurrentSelectionContext:function(){return n}})},56110:function(e,t,u){"use strict";u.d(t,{deleteConversationWithCleanup:function(){return i},loadInitialData:function(){return r}});var n=u(77688),s=u(82758);function i(e,t,u,s,i){return(0,n._)(function*(){try{s.setLoading(!0),yield u.delete(t),s.removeConversation(t),i.clearConversationPermissions(t);let n=s.getCurrentConversation();(null==n?void 0:n.id)===t&&s.setCurrentConversation(null);let r=yield u.list();s.setConversations(r),s.setView(0===r.length?"welcome":"conversationList"),e.e.fire("conversationDeleted.ai-assistant-pro",t)}catch(t){e.alert(e.i18n("Failed to delete conversation")+": "+((null==t?void 0:t.message)||"Unknown error"))}finally{s.setLoading(!1)}})()}function r(e,t,u){return(0,n._)(function*(){u.setLoading(!0);try{let[s,i]=yield Promise.all([t.list().catch(()=>[]),t.getGlobalSettings().catch(()=>null)]);if(u.setConversations(s),i&&u.setSavedState(i),0===s.length)u.setView("welcome");else if(e.o.aiAssistantPro.rememberLastConversation&&(null==i?void 0:i.currentConversationId)){var n;let e=null!=(n=s.find(e=>e.id===i.currentConversationId))?n:s[0],r=yield t.get(e.id);r?u.setCurrentConversation(r):u.setView("conversationList")}else u.setView("conversationList")}catch(e){s.IS_PROD,u.setView("welcome")}finally{u.setLoading(!1)}})()}},53014:function(e,t,u){"use strict";u.d(t,{applyTheme:function(){return i}});let n=["jodit_theme_dark","jodit-ai-assistant-pro_theme_dark","jodit-dialog_theme_dark"],s=["jodit_theme_light","jodit-ai-assistant-pro_theme_light","jodit-dialog_theme_light"];function i(e,t,u,i,r){let o;if(null==i||i.classList.remove(...n),null==i||i.classList.remove(...s),"dialog"===u){let e=null==r?void 0:r.container;null==e||e.classList.remove(...n),null==e||e.classList.remove(...s)}if(o="dark"===t?n:s,null==i||i.classList.add(...o),"dialog"===u){let e=null==r?void 0:r.container;null==e||e.classList.add(...o)}}},79078:function(e,t,u){"use strict";u.d(t,{executeToolCall:function(){return r},updateToolCallInMessage:function(){return o}});var n=u(77688),s=u(56075),i=u(11886);function r(e,t,u){return(0,n._)(function*(){let n;try{let e=new AbortController().signal,r=yield u.executeTool(t.name,t.arguments,e);n=(0,i._)((0,s._)({},t),{result:{result:r},status:"executed"})}catch(u){n=(0,i._)((0,s._)({},t),{result:{error:u instanceof Error?u.message:String(u)},status:"error"}),e.e.fire("toolCallFailed.ai-assistant-pro",n)}return e.e.fire("toolCallExecuted.ai-assistant-pro",n,{toolCallId:n.id,result:n.result}),n})()}function o(e,t){var u,n;let r=null==(n=e.toolCalls)?void 0:n.findIndex(e=>e.id===t.id);if(null==r||-1===r)return e;let o=[...null!=(u=null==e?void 0:e.toolCalls)?u:[]];return o[r]=t,(0,i._)((0,s._)({},e),{toolCalls:o})}},86449:function(e,t,u){"use strict";u.d(t,{APIClient:function(){return l}});var n=u(77688),s=u(82749),i=u(56075),r=u(11886),o=u(82758),a=u(21537);class l{sendRequest(e,t,u,s,i){return(0,n._)(function*(){let{apiRequest:n,requestTimeout:r,maxRetries:l}=this.jodit.o.aiAssistantPro;if(!n)throw Error("AI Assistant Pro callback is not configured");let F=new AbortController;this.abortControllers.add(F);try{let c=this.buildRequestContext(e,t,u,s,i),h=null;for(let e=0;l>=e;e++)try{if(F.signal.aborted)throw(0,a.abort)();let e=setTimeout(()=>{F.abort()},r);try{let t=yield n(c,F.signal);return clearTimeout(e),this.validateResponse(t),t}catch(t){throw clearTimeout(e),t}}catch(t){if(h=t,o.IS_PROD,l>e){let t=this.calculateRetryDelay(e);yield this.sleep(t)}else throw t}throw h||Error("API request failed after all retries")}finally{this.abortControllers.delete(F)}}).call(this)}abort(){this.abortControllers.forEach(e=>{e.abort()}),this.abortControllers.clear()}isInProgress(){return this.abortControllers.size>0}buildRequestContext(e,t,u,n,s){let o,{apiMode:a,instructions:l}=this.jodit.o.aiAssistantPro,F={mode:a,conversationId:e,tools:this.toolRegistry.getAllTools(),selectionContexts:n,conversationOptions:s,instructions:l};if("full"===a)o=t;else if(u){let e=t.findIndex(e=>e.id===u);o=-1!==e?t.slice(e+1):t,F=(0,r._)((0,i._)({},F),{parentMessageId:u})}else o=t;return(0,r._)((0,i._)({},F),{messages:this.expandToolMessages(o,t.find(e=>e.id===u))})}expandToolMessages(e,t){let u=[];for(let t of e)u.push(t),this.expandToolResultsMessage(t,u);return t&&this.expandToolResultsMessage(t,u),u}expandToolResultsMessage(e,t){if(e.toolCalls&&e.toolCalls.length>0)for(let n of e.toolCalls){var u;let s=null!=(u=n.result)?u:{error:"result not found"};if(t.find(e=>e.id===`${n.id}-result`))continue;let i={id:`${n.id}-result`,role:"tool",content:s.error?`Error: ${s.error}`:JSON.stringify(s.result),timestamp:e.timestamp,toolResults:[{toolCallId:n.id,result:s}]};t.push(i)}}validateResponse(e){if("final"!==e.mode)return;let t=e.response;if(!t)throw Error("API returned empty response");if(!t.responseId)throw Error("API response missing responseId");if(void 0===t.content)throw Error("API response missing content");if(void 0===t.finished)throw Error("API response missing finished flag");if(t.toolCalls){if(!Array.isArray(t.toolCalls))throw Error("API response toolCalls must be an array");t.toolCalls.forEach((e,t)=>{if(!e.id)throw Error(`Tool call at index ${t} is missing id`);if(!e.name)throw Error(`Tool call at index ${t} is missing name`);if(!e.arguments||"object"!=typeof e.arguments)throw Error(`Tool call at index ${t} has invalid arguments`)})}}calculateRetryDelay(e){let{retryDelay:t}=this.jodit.o.aiAssistantPro;return t*Math.pow(2,e)+Math.random()*t}sleep(e){return new Promise(t=>setTimeout(t,e))}destruct(){this.abort()}constructor(e,t){(0,s._)(this,"jodit",void 0),(0,s._)(this,"toolRegistry",void 0),(0,s._)(this,"abortControllers",void 0),this.jodit=e,this.toolRegistry=t,this.abortControllers=new Set}}},47373:function(e,t,u){"use strict";function n(e,t,u="image/png"){let s=atob(e),i=s.length,r=new Uint8Array(i);for(let e=0;i>e;e++)r[e]=s.charCodeAt(e);return new File([new Blob([r],{type:u})],t,{type:u})}u.d(t,{base64ToFile:function(){return n}})},21020:function(e,t,u){"use strict";u.d(t,{PermissionManager:function(){return r}});var n=u(82749),s=u(56075),i=u(11886);class r{requiresPermission(e){let{autoApproveTools:t,alwaysDenyTools:u}=this.jodit.o.aiAssistantPro;if(u.includes(e))return!0;if(t.includes(e))return!1;let n=this.toolRegistry.getTool(e);return!n||n.requiresPermission}isAutoDenied(e){let{alwaysDenyTools:t}=this.jodit.o.aiAssistantPro;return t.includes(e)}isAutoApproved(e){let{autoApproveTools:t}=this.jodit.o.aiAssistantPro;return t.includes(e)}checkPermission(e,t){if(this.isAutoApproved(e))return{toolName:e,granted:!0,grantedAt:Date.now(),scope:"once"};if(this.isAutoDenied(e))return null;let u=this.permanentPermissions.get(e);return u&&u.granted?u:t.find(t=>t.toolName===e&&t.granted)||null}grantPermission(e,t){let u={toolName:e,granted:!0,grantedAt:Date.now(),scope:t};return"forever"===t&&(this.permanentPermissions.set(e,u),this.savePermanentPermissions()),u}denyPermission(e){return{toolName:e,granted:!1,grantedAt:Date.now(),scope:"once"}}filterToolCalls(e,t){let u=[],n=[],r=[];for(let o of e){if(this.isAutoDenied(o.name)){r.push((0,i._)((0,s._)({},o),{status:"denied"}));continue}if(this.isAutoApproved(o.name)){u.push((0,i._)((0,s._)({},o),{status:"approved"}));continue}let e=this.checkPermission(o.name,t);e&&e.granted?u.push((0,i._)((0,s._)({},o),{status:"approved"})):this.requiresPermission(o.name)?(this.jodit.e.fire("permissionRequested.ai-assistant-pro",o.name),n.push((0,i._)((0,s._)({},o),{status:"pending"}))):u.push((0,i._)((0,s._)({},o),{status:"approved"}))}return{approved:u,needsPermission:n,denied:r}}clearConversationPermissions(e){}loadPermanentPermissions(){try{let e=localStorage.getItem(this.PERMANENT_PERMISSIONS_KEY);e&&JSON.parse(e).forEach(e=>{"forever"===e.scope&&e.granted&&this.permanentPermissions.set(e.toolName,e)})}catch(e){}}savePermanentPermissions(){try{let e=Array.from(this.permanentPermissions.values());localStorage.setItem(this.PERMANENT_PERMISSIONS_KEY,JSON.stringify(e))}catch(e){}}clearPermanentPermissions(){this.permanentPermissions.clear(),localStorage.removeItem(this.PERMANENT_PERMISSIONS_KEY)}getPermanentPermissions(){return Array.from(this.permanentPermissions.values())}revokePermanentPermission(e){this.permanentPermissions.delete(e),this.savePermanentPermissions()}destruct(){this.permanentPermissions.clear()}constructor(e,t){(0,n._)(this,"jodit",void 0),(0,n._)(this,"toolRegistry",void 0),(0,n._)(this,"permanentPermissions",void 0),(0,n._)(this,"PERMANENT_PERMISSIONS_KEY",void 0),this.jodit=e,this.toolRegistry=t,this.permanentPermissions=new Map,this.PERMANENT_PERMISSIONS_KEY="jodit-permissions.ai-assistant-pro",this.loadPermanentPermissions()}}},46166:function(e,t,u){"use strict";u.d(t,{StateManager:function(){return r}});var n=u(82749),s=u(56075),i=u(11886);class r{createInitialState(){return{isOpen:!1,currentView:"welcome",currentConversation:null,conversations:[],isLoading:!1,error:null,pendingToolCalls:[],selectionContexts:[],abortController:null,editingMessageId:null,theme:this.jodit.o.aiAssistantPro.theme||"parent",displayMode:this.jodit.o.aiAssistantPro.displayMode,panelWidth:this.jodit.o.aiAssistantPro.panelWidth,panelHeight:this.jodit.o.aiAssistantPro.panelHeight,defaultModel:this.jodit.o.aiAssistantPro.defaultModel,defaultTemperature:this.jodit.o.aiAssistantPro.defaultTemperature}}open(){this.state.isOpen=!0,this.jodit.e.fire("open.ai-assistant-pro",this.state.currentConversation)}close(){this.state.isOpen=!1,this.jodit.e.fire("close.ai-assistant-pro")}isOpen(){return this.state.isOpen}setView(e){this.state.currentView=e,this.jodit.e.fire("viewChanged.ai-assistant-pro",e)}getView(){return this.state.currentView}setConversations(e){this.state.conversations=e}setSavedState(e){e.theme&&(this.state.theme=e.theme),e.displayMode&&(this.state.displayMode=e.displayMode),e.panelWidth&&(this.state.panelWidth=e.panelWidth),e.panelHeight&&(this.state.panelHeight=e.panelHeight),e.defaultModel&&(this.state.defaultModel=e.defaultModel),e.defaultTemperature&&(this.state.defaultTemperature=e.defaultTemperature)}getConversations(){return this.state.conversations}setCurrentConversation(e){if(this.state.currentConversation===e)throw Error("Conversation is already current");this.state.currentConversation=e||null,e&&(this.setView("conversation"),this.jodit.e.fire("conversationSwitched.ai-assistant-pro",e))}getCurrentConversation(){return this.state.currentConversation}removeConversation(e){let t=this.state.conversations.filter(t=>t.id!==e);this.setConversations(t)}setLoading(e){this.state.isLoading=e}isLoading(){return this.state.isLoading}setError(e){this.state.error=e,e&&this.jodit.e.fire("error.ai-assistant-pro",Error(e))}getError(){return this.state.error}clearError(){this.setError(null)}setPendingToolCalls(e){this.state.pendingToolCalls=e}getPendingToolCalls(){return this.state.pendingToolCalls}addPendingToolCall(e){let t=[...this.state.pendingToolCalls,e];this.setPendingToolCalls(t)}removePendingToolCall(e){let t=this.state.pendingToolCalls.filter(t=>t.id!==e);this.setPendingToolCalls(t)}updateToolCallStatus(e,t){let u=this.state.pendingToolCalls.map(u=>u.id===e?(0,i._)((0,s._)({},u),{status:t}):u);this.setPendingToolCalls(u)}setSelectionContexts(e){this.state.selectionContexts=e}getSelectionContexts(){return this.state.selectionContexts}addSelectionContext(e){let{maxContextRanges:t}=this.jodit.o.aiAssistantPro,u=[...this.state.selectionContexts,e];u.length>t&&(u=u.slice(-t)),this.setSelectionContexts(u),this.jodit.e.fire("contextAdded.ai-assistant-pro",e)}removeSelectionContext(e){let t=this.state.selectionContexts.filter((t,u)=>u!==e);this.setSelectionContexts(t),this.jodit.e.fire("contextRemoved.ai-assistant-pro",e)}clearSelectionContexts(){this.setSelectionContexts([])}setAbortController(e){this.state.abortController=e}getAbortController(){return this.state.abortController}setEditingMessageId(e){this.state.editingMessageId=e}getEditingMessageId(){return this.state.editingMessageId}isEditingMessage(){return null!=this.state.editingMessageId}clearEditingMessage(){this.setEditingMessageId(null)}reset(){this.state=this.createInitialState()}destruct(){this.state.abortController&&this.state.abortController.abort(),this.reset()}constructor(e){(0,n._)(this,"jodit",void 0),(0,n._)(this,"state",void 0),this.jodit=e,this.state=this.createInitialState()}}},62895:function(e,t,u){"use strict";u.d(t,{WebStorageConversationStorage:function(){return n.WebStorageConversationStorage},createStorageProvider:function(){return n.createStorageProvider}});var n=u(21064)},21064:function(e,t,u){"use strict";u.d(t,{WebStorageConversationStorage:function(){return o},createStorageProvider:function(){return a},generateConversationId:function(){return l},generateMessageId:function(){return F}});var n=u(77688),s=u(82749),i=u(56075),r=u(97333);class o{close(){return this.storage.close()}getConversationKey(e){return`conv:${e}`}getAllKeys(){return(0,n._)(function*(){let e=yield this.storage.get("__conversation_index__");return e&&Array.isArray(e)?e:[]}).call(this)}updateIndex(e){return(0,n._)(function*(){yield this.storage.set("__conversation_index__",e)}).call(this)}addToIndex(e){return(0,n._)(function*(){let t=yield this.getAllKeys();t.includes(e)||(t.push(e),yield this.updateIndex(t))}).call(this)}removeFromIndex(e){return(0,n._)(function*(){let t=(yield this.getAllKeys()).filter(t=>t!==e);yield this.updateIndex(t)}).call(this)}list(e){return(0,n._)(function*(){try{let n=yield this.getAllKeys(),s=[],i=null==e?void 0:e.toLowerCase().trim();for(let e of n){var t,u;let n=yield this.get(e);if(n){if(i){let e=null==(u=n.title)?void 0:u.toLowerCase().includes(i),t=!e&&n.messages.some(e=>e.content.toLowerCase().includes(i));if(!e&&!t)continue}s.push({id:n.id,title:null!=(t=n.title)?t:"",created:n.created,updated:n.updated,messageCount:n.messages.length})}}return s.sort((e,t)=>t.updated-e.updated),s}catch(e){return[]}}).call(this)}get(e){return(0,n._)(function*(){try{let t=this.getConversationKey(e);return(yield this.storage.get(t))||null}catch(e){return null}}).call(this)}save(e){return(0,n._)(function*(){try{if(0===e.messages.length)throw Error("Conversation must have at least one message.");let t=yield this.getAllKeys();t.length>=this.maxConversations&&!t.includes(e.id)&&(yield this.evictOldest());let u=this.getConversationKey(e.id);yield this.storage.set(u,e),yield this.addToIndex(e.id)}catch(t){if((null==t?void 0:t.name)==="QuotaExceededError"||(null==t?void 0:t.code)===22||(null==t?void 0:t.code)===1014){yield this.evictOldest();try{let t=this.getConversationKey(e.id);yield this.storage.set(t,e),yield this.addToIndex(e.id)}catch(e){throw Error("Storage quota exceeded. Please delete some conversations.")}}else throw Error(`Failed to save conversation: ${(null==t?void 0:t.message)||"Unknown error"}`)}}).call(this)}delete(e){return(0,n._)(function*(){try{let t=this.getConversationKey(e);yield this.storage.delete(t),yield this.removeFromIndex(e)}catch(e){}}).call(this)}clear(){return(0,n._)(function*(){try{for(let e of yield this.getAllKeys()){let t=this.getConversationKey(e);yield this.storage.delete(t)}yield this.updateIndex([])}catch(e){}}).call(this)}evictOldest(){return(0,n._)(function*(){try{let e=yield this.list();if(0===e.length)return;e.sort((e,t)=>e.updated-t.updated);let t=e[0];yield this.delete(t.id)}catch(e){}}).call(this)}getGlobalSettings(){return(0,n._)(function*(){try{return(yield this.storage.get("global-settings"))||null}catch(e){return null}}).call(this)}saveGlobalSettings(e){return(0,n._)(function*(){try{let t=yield this.getGlobalSettings(),u=(0,i._)({},t,e);yield this.storage.set("global-settings",u)}catch(e){throw Error("Failed to save global settings")}}).call(this)}constructor(e,t){(0,s._)(this,"storage",void 0),(0,s._)(this,"maxConversations",void 0),this.storage=e,this.maxConversations=t}}function a(e,t){return r.AsyncStorage.makeStorage(e,t)}function l(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function F(){return`msg_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}},55487:function(e,t,u){"use strict";u.d(t,{ToolRegistry:function(){return o}});var n=u(77688),s=u(82749),i=u(56075),r=u(53835);class o{registerBuiltInTools(e){e.forEach(e=>{let t=r.BUILT_IN_TOOLS[e];t&&this.tools.set(e,t)})}registerCustomTools(e){e.forEach(e=>{this.validateToolDefinition(e),this.tools.set(e.name,e)})}validateToolDefinition(e){if(!e.name||"string"!=typeof e.name)throw Error("Tool must have a valid name");if(!e.description||"string"!=typeof e.description)throw Error(`Tool "${e.name}" must have a description`);if(!Array.isArray(e.parameters))throw Error(`Tool "${e.name}" must have a parameters array`);if("function"!=typeof e.execute)throw Error(`Tool "${e.name}" must have an execute function`);e.parameters.forEach(t=>{if(!t.name||"string"!=typeof t.name)throw Error(`Tool "${e.name}" has a parameter without a valid name`);if(!t.type)throw Error(`Tool "${e.name}" parameter "${t.name}" must have a type`);if("boolean"!=typeof t.required)throw Error(`Tool "${e.name}" parameter "${t.name}" must specify if it's required`)})}getAllTools(){return Array.from(this.tools.values())}getTool(e){return this.tools.get(e)}hasTool(e){return this.tools.has(e)}getToolNames(){return Array.from(this.tools.keys())}executeTool(e,t,u){return(0,n._)(function*(){let n=this.getTool(e);if(!n)throw Error(`Tool "${e}" not found`);let s=this.applyDefaults(n,t);this.validateArguments(n,s);try{return yield n.execute(this.jodit,s,u)}catch(e){if((null==e?void 0:e.name)==="AbortError"||u.aborted)throw Error("Tool execution was aborted");throw e}}).call(this)}validateArguments(e,t){let u=Object.keys(t);for(let t of e.parameters.filter(e=>e.required).map(e=>e.name))if(!u.includes(t))throw Error(`Tool "${e.name}" requires parameter "${t}"`);for(let[u,n]of Object.entries(t)){let t=e.parameters.find(e=>e.name===u);if(!t){this.jodit.o.aiAssistantPro.debug;continue}let s=Array.isArray(n)?"array":"object"==typeof n&&null!=n?"object":typeof n;if(t.type!==s&&!("number"===t.type&&"string"===s&&!isNaN(Number(n))))throw Error(`Tool "${e.name}" parameter "${u}" expects type "${t.type}" but got "${s}"`);if(t.enum&&t.enum.length>0&&!t.enum.includes(n))throw Error(`Tool "${e.name}" parameter "${u}" must be one of: ${t.enum.join(", ")}`)}}applyDefaults(e,t){let u=(0,i._)({},t);for(let t of e.parameters)void 0===u[t.name]&&void 0!==t.default&&(u[t.name]=t.default);return u}destruct(){this.tools.clear()}constructor(e){(0,s._)(this,"jodit",void 0),(0,s._)(this,"tools",void 0),this.jodit=e,this.tools=new Map,this.registerBuiltInTools(e.o.aiAssistantPro.enabledTools||[]),this.registerCustomTools(e.o.aiAssistantPro.customTools||[])}}},26612:function(e){e.exports={"AI Assistant":"AI Assistant","AI Assistant Pro":"AI Assistant Pro","Welcome to AI Assistant":"Welcome to AI Assistant","Start your first conversation":"Start your first conversation","Tip: Select text in editor to add context":"Tip: Select text in editor to add context","New Chat":"New Chat","Search conversations...":"Search conversations...","No conversations yet":"No conversations yet","Ask me anything...":"Ask me anything...","Ask a follow-up...":"Ask a follow-up...","Reply...":"Reply...","Type your message...":"Type your message...",Send:"Send",Cancel:"Cancel",Retry:"Retry",Insert:"Insert",Copy:"Copy",Edit:"Edit",Delete:"Delete",New:"New",Back:"Back","Permission Required":"Permission Required",Approve:"Approve",Deny:"Deny",Once:"Once","This conversation":"This conversation",Always:"Always","The AI wants to execute:":"The AI wants to execute:","This will modify your document content.":"This will modify your document content.","Executing...":"Executing...","Completed successfully":"Completed successfully",Failed:"Failed","Pending approval":"Pending approval","Denied by user":"Denied by user","Tool Result":"Tool Result","Tool Execution Error":"Tool Execution Error",Context:"Context",Contexts:"Contexts","Add to AI Context":"Add to AI Context",Remove:"Remove","Clear all":"Clear all","An error occurred":"An error occurred","Request failed":"Request failed","Connection error":"Connection error","AI Assistant is not configured":"AI Assistant is not configured","Thinking...":"Thinking...","Generating response...":"Generating response...",insertHTML:"Insert HTML",readDocument:"Read Document",readBlock:"Read Block",replaceInDocument:"Replace in Document",replaceInBlock:"Replace in Block",getSelection:"Get Selection","Just now":"Just now",Conversation:"Conversation","New Conversation":"New Conversation",Yesterday:"Yesterday","Delete conversation":"Delete conversation","Are you sure you want to delete this conversation?":"Are you sure you want to delete this conversation?","Failed to delete conversation":"Failed to delete conversation"}},63805:function(e,t,u){"use strict";u.r(t),u.d(t,{en:function(){return s.a},ru:function(){return r.a}});var n=u(26612),s=u.n(n),i=u(55790),r=u.n(i)},55790:function(e){e.exports={"AI Assistant":"AI Ассистент","AI Assistant Pro":"AI Ассистент Pro","Welcome to AI Assistant":"Добро пожаловать в AI Ассистент","Start your first conversation":"Начните первый диалог","Tip: Select text in editor to add context":"Подсказка: Выделите текст в редакторе для добавления контекста","New chat":"Новый чат","Search conversations...":"Поиск диалогов...","No conversations yet":"Пока нет диалогов","Ask me anything...":"Спросите меня о чем угодно...","Ask a follow-up...":"Задайте дополнительный вопрос...","Reply...":"Ответить...","Type your message...":"Введите ваше сообщение...",Send:"Отправить",Cancel:"Отмена",Retry:"Повторить",Insert:"Вставить",Copy:"Копировать",Edit:"Редактировать",Delete:"Удалить",New:"Новый",Back:"Назад","Permission Required":"Требуется разрешение",Approve:"Разрешить",Deny:"Отклонить",Once:"Один раз","This conversation":"Этот диалог",Always:"Всегда","The AI wants to execute:":"AI хочет выполнить:","This will modify your document content.":"Это изменит содержимое вашего документа.","Executing...":"Выполняется...","Completed successfully":"Успешно выполнено",Failed:"Ошибка","Pending approval":"Ожидает разрешения","Denied by user":"Отклонено пользователем","Tool Result":"Результат инструмента","Tool Execution Error":"Ошибка выполнения инструмента",Context:"Контекст",Contexts:"Контексты","Add to AI Context":"Добавить в контекст AI",Remove:"Удалить","Clear all":"Очистить все","An error occurred":"Произошла ошибка","Request failed":"Запрос не выполнен","Connection error":"Ошибка соединения","AI Assistant is not configured":"AI Ассистент не настроен","Thinking...":"Думаю...","Generating response...":"Генерирую ответ...",insertHTML:"Вставить HTML",readDocument:"Прочитать документ",readBlock:"Прочитать блок",replaceInDocument:"Заменить в документе",replaceInBlock:"Заменить в блоке",getSelection:"Получить выделение","Just now":"Только что",Conversation:"Диалог","New Conversation":"Новый диалог",Yesterday:"Вчера","Delete conversation":"Удалить диалог","Are you sure you want to delete this conversation?":"Вы уверены, что хотите удалить этот диалог?","Failed to delete conversation":"Не удалось удалить диалог",Settings:"Настройки","General Settings":"Общие настройки","Conversation Settings":"Настройки диалога","Display Mode":"Режим отображения","Panel Width":"Ширина панели",Theme:"Тема",Model:"Модель",Temperature:"Температура",Close:"Закрыть",Dialog:"Модальное окно",Left:"Левая панель",Right:"Правая панель",Top:"Верхняя панель",Bottom:"Нижняя панель",Inherit:"Наследовать от редактора",Light:"Светлая тема",Dark:"Тёмная тема","%dm ago":"%dм назад","%dh ago":"%dч назад"}},94454:function(e,t,u){"use strict";u.d(t,{getAIProviderOptions:function(){return n.getAIProviderOptions},registerAIProvider:function(){return n.registerAIProvider}}),u(82923);var n=u(58211)},82923:function(e,t,u){"use strict";var n=u(89929),s=u(77688),i=u(86127),r=u(56075),o=u(11886),a=u(25415),l=u(58211),F=u(54079);(0,l.registerAIProvider)("jodit-ai-adapter",e=>{var t;let u=e.url.replace(/\/+$/,""),l=null!=(t=e.provider)?t:"openai",c=!1!==e.stream;return{apiMode:"incremental",maxRetries:0,textAutocompleteEnabled:!0,textAutocompleteApiRequest:(t,n,i)=>(0,s._)(function*(){var s;let r=new F.Ajax({url:`${u}/ai/autocomplete?query=${encodeURIComponent(t)}&key=${encodeURIComponent(e.apiKey)}`,method:"POST",contentType:"application/json",data:{provider:l,context:{maxSuggestions:n}}});i.addEventListener("abort",()=>r.abort(),{once:!0});let o=yield r.send(),a=yield o.json();return a.success&&(null==(s=a.result)?void 0:s.suggestions)?a.result.suggestions:[]})(),apiRequest:(t,h)=>(0,s._)(function*(){let s=new F.Ajax({url:`${u}/ai/request?key=${encodeURIComponent(e.apiKey)}`,method:"POST",contentType:"application/json",data:{provider:l,context:c?(0,o._)((0,r._)({},t),{metadata:(0,o._)((0,r._)({},t.metadata),{stream:!0})}):t}});if(h&&h.addEventListener("abort",()=>s.abort(),{once:!0}),!c){let e=yield s.send();return{mode:"final",response:(yield e.json()).result}}let d=s.stream();return{mode:"stream",stream:(0,a._)(function*(){var e,t=!1,u=!1;try{for(var s,r=(0,n._)(d);t=!(s=yield(0,i._)(r.next())).done;t=!1){let e=s.value;yield JSON.parse(e)}}catch(t){u=!0,e=t}finally{try{t&&null!=r.return&&(yield(0,i._)(r.return()))}finally{if(u)throw e}}})()}})()}})},58211:function(e,t,u){"use strict";u.d(t,{getAIProviderOptions:function(){return s},registerAIProvider:function(){return i}});let n=new Map;function s(e,t){let u=n.get(e);if(!u)throw Error(`AI provider "${e}" is not registered. Available providers: ${[...n.keys()].join(", ")}`);return u(t)}function i(e,t){n.set(e,t)}},73943:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="applyFormat",s="Apply or remove inline formatting to the current selection (bold, italic, underline, etc.) or to a specific block",i=[{name:"element",type:"string",description:'HTML element to wrap selection (e.g., "strong", "em", "u", "span")',required:!1},{name:"attributes",type:"object",description:'Attributes to apply (e.g., {"className": "highlight"}, {"style": {"color": "red"}})',required:!1},{name:"remove",type:"boolean",description:"If true, remove the formatting instead of applying it",required:!1,default:!1},{name:"blockIndex",type:"number",description:"Zero-based index of the block to format (if not using current selection)",required:!1},{name:"selector",type:"string",description:"CSS selector to find the block to format (if not using current selection)",required:!1}],r=!0},19127:function(e,t,u){"use strict";u.d(t,{execute:function(){return a}});var n=u(77688),s=u(56075),i=u(11886),r=u(6689),o=u(44526);function a(e,t,u){return(0,n._)(function*(){let{element:n,attributes:a,remove:l,blockIndex:F,selector:c}=t;if((0,r.throwIfAborted)(u),!n&&!a)throw Error('Either "element" or "attributes" must be provided');if(e.s.restore(),void 0!==F||c){let{element:t}=(0,o.resolveBlock)(e,{selector:c,index:F});e.s.select(t)}if(e.s.isCollapsed())throw Error("No selection found. Please select text to format");try{let t={};return n&&(t.element=n),a&&(t.attributes=a),l?e.s.commitStyle((0,i._)((0,s._)({},t),{mode:"remove"})):e.s.commitStyle(t),e.synchronizeValues(),{success:!0,message:l?"Formatting removed successfully":"Formatting applied successfully"}}catch(e){throw Error(`Failed to ${l?"remove":"apply"} formatting: ${e.message}`)}})()}},39296:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(73943),r=u(19127);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},53835:function(e,t,u){"use strict";u.d(t,{BUILT_IN_TOOLS:function(){return h},getToolNames:function(){return d}});var n=u(39296),s=u(16745),i=u(78717),r=u(5618),o=u(90991),a=u(2020),l=u(12570),F=u(95323),c=u(97603);let h={readDocument:r.default,readBlocks:i.default,readSelection:o.default,writeDocument:c.default,replaceSelection:F.default,replaceBlock:a.default,replaceInDocument:l.default,insertHTML:s.default,applyFormat:n.default};function d(){return Object.keys(h)}},56732:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="insertHTML",s="Insert or replace HTML content at the current cursor position in the editor",i=[{name:"html",type:"string",description:"HTML content to insert",required:!0},{name:"replace",type:"boolean",description:"If true, replaces current selection. If false, inserts at cursor",required:!1,default:!1}],r=!0},39592:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html",{allowEmpty:!0}),{replace:r}=t;if(!n.trim())return{success:!0,message:"Nothing to insert: HTML is empty"};(0,s.throwIfAborted)(u);try{return e.s.focus(),r&&!e.s.isCollapsed()&&e.s.remove(),e.s.insertHTML(n),e.synchronizeValues(),{success:!0,message:`Inserted ${n.length} characters of HTML`}}catch(e){throw Error(`Failed to insert HTML: ${(null==e?void 0:e.message)||"Unknown error"}`)}})()}},16745:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(56732),r=u(39592);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},75352:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readBlocks",s="Read blocks from the editor with optional filtering and pagination",i=[{name:"offset",type:"number",description:"Number of blocks to skip from the beginning (default: 0)",required:!1,default:0},{name:"limit",type:"number",description:"Maximum number of blocks to return (default: all)",required:!1},{name:"query",type:"string",description:"Filter blocks by text content",required:!1}],r=!1},91140:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(22732);function r(e,t,u){return(0,n._)(function*(){let{offset:n,limit:r,query:o}=t;(0,s.throwIfAborted)(u);let a=[];Array.from(e.editor.children).forEach((e,t)=>{i.Dom.isElement(e)&&a.push({blockIndex:t,tagName:e.tagName.toLowerCase(),content:e.innerHTML,textContent:e.textContent||"",classList:Array.from(e.classList)})});let l=a;if(o&&"string"==typeof o){let e=o.toLowerCase();l=a.filter(t=>t.textContent.toLowerCase().includes(e))}let F=Math.max(0,Math.min("number"==typeof n?n:0,l.length)),c=void 0!==r?Math.min(F+r,l.length):l.length;return{blocks:l.slice(F,c),total:a.length,offset:F,limit:void 0!==r?r:void 0}})()}},78717:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(75352),r=u(91140);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},93809:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readDocument",s="Read the entire content of the editor document in HTML format",i=[{name:"start",type:"number",description:"Start character position (default: 0)",required:!1,default:0},{name:"end",type:"number",description:"End character position (default: length of document)",required:!1},{name:"aroundSelection",type:"boolean",description:"If true, return only the maximum block around the current selection",required:!1,default:!1}],r=!1},28157:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(22732);function r(e,t,u){return(0,n._)(function*(){let{start:n,end:r,aroundSelection:o}=t;(0,s.throwIfAborted)(u);let a=e.value,l=a.length;if(o&&!e.s.isCollapsed()){let t=e.s.range.commonAncestorContainer;for(;t&&t!==e.editor;){if(i.Dom.isElement(t)&&t.parentNode===e.editor){a=t.outerHTML;break}t=t.parentNode}return{html:a,length:l}}let F=void 0!==r?Math.min(r,l):l,c=Math.max(0,Math.min("number"==typeof n?n:0,l));return(c>0||l>F)&&(a=a.substring(c,F)),{html:a,length:l,start:c,end:F}})()}},5618:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(93809),r=u(28157);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},52826:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readSelection",s="Get information about the current selection including HTML content and optional context",i=[{name:"contextCharsBefore",type:"number",description:"Number of characters to include before the selection",required:!1,default:0},{name:"contextCharsAfter",type:"number",description:"Number of characters to include after the selection",required:!1,default:0}],r=!1},85130:function(e,t,u){"use strict";u.d(t,{execute:function(){return i}});var n=u(77688),s=u(6689);function i(e,t,u){return(0,n._)(function*(){let{contextCharsBefore:n,contextCharsAfter:i}=t;if((0,s.throwIfAborted)(u),e.s.restore(),e.s.isCollapsed())return{hasSelection:!1};let r=e.s.html,o=e.s.range,a=o.toString(),l={hasSelection:!0,html:r,text:a,startContainer:o.startContainer.nodeName,endContainer:o.endContainer.nodeName};if(n>0||i>0){let t=e.editor.textContent||"",u=t.substring(0,t.indexOf(a)),s=t.substring(t.indexOf(a)+a.length);n>0&&(l.contextBefore=u.slice(-n)),i>0&&(l.contextAfter=s.slice(0,i))}return l})()}},90991:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(52826),r=u(85130);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},96675:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceBlock",s="Replace a specific block in the document by its index or CSS selector with new HTML content",i=[{name:"index",type:"number",description:"Zero-based index of the block to replace (use either index or selector, not both)",required:!1},{name:"selector",type:"string",description:'CSS selector to find the block to replace (e.g., "h1", ".my-class", "#my-id"). Use either selector or index, not both',required:!1},{name:"html",type:"string",description:"HTML content for the new block",required:!0}],r=!0},3091:function(e,t,u){"use strict";u.d(t,{execute:function(){return a}});var n=u(77688),s=u(6689),i=u(49459),r=u(44526),o=u(22732);function a(e,t,u){return(0,n._)(function*(){let{index:n,selector:a}=t,l=(0,i.requireString)(t,"html");if((0,s.throwIfAborted)(u),void 0===n&&!a||void 0!==n&&a)throw Error("Either index or selector must be provided, but not both");let{element:F,identifier:c}=(0,r.resolveBlock)(e,{selector:a,index:n,requireExactlyOne:!0});try{var h;let t=e.createInside.div();t.innerHTML=l;let u=t.firstChild;if(!u||!o.Dom.isElement(u))throw Error("Invalid HTML: must contain at least one element");return null==(h=F.parentNode)||h.replaceChild(u,F),e.synchronizeValues(),{success:!0,message:`Block ${c} replaced successfully`}}catch(e){throw Error(`Failed to replace block ${c}: ${e.message}`)}})()}},2020:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(96675),r=u(3091);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},62553:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceInDocument",s="Find and replace text or HTML patterns throughout the entire document",i=[{name:"search",type:"string",description:"Text or pattern to search for",required:!0},{name:"replace",type:"string",description:"Replacement text or HTML",required:!0},{name:"useRegex",type:"boolean",description:"If true, treats search as a regular expression",required:!1,default:!1},{name:"useSelector",type:"string",description:"CSS selector to narrow down the search scope to specific elements",required:!1}],r=!0},56293:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"search"),r=(0,i.requireString)(t,"replace",{allowEmpty:!0}),{useRegex:o,useSelector:a}=t;(0,s.throwIfAborted)(u);try{let t;e.s.focus(),e.s.save();let i=0;if(a){let l=function(e,t,u,n,i,r){let o=e.editor.querySelectorAll(i);if(0===o.length)return{replacements:0,message:`No elements found matching selector "${i}"`};let a=0;return o.forEach(e=>{(0,s.throwIfAborted)(r);let i=e.innerHTML,o=i;if(n)try{let e=RegExp(t,"g");i=i.replace(e,()=>(a++,u))}catch(e){throw Error(`Invalid regex pattern: ${(null==e?void 0:e.message)||"Unknown error"}`)}else{let e=t.length,n=0;for(;-1!==(n=i.indexOf(t,n));)(0,s.throwIfAborted)(r),i=i.substring(0,n)+u+i.substring(n+e),n+=u.length,a++}i!==o&&(e.innerHTML=i)}),a>0&&(e.synchronizeValues(),e.s.restore()),{replacements:a}}(e,n,r,o,a,u);i=l.replacements,t=l.message}else i=function(e,t,u,n,i,r){let o=0,a=t;if(i)try{let e=RegExp(u,"g");a=a.replace(e,()=>(o++,n))}catch(e){throw Error(`Invalid regex pattern: ${(null==e?void 0:e.message)||"Unknown error"}`)}else{let e=u.length,t=0;for(;-1!==(t=a.indexOf(u,t));)(0,s.throwIfAborted)(r),a=a.substring(0,t)+n+a.substring(t+e),t+=n.length,o++}return o>0&&(e.value=a,e.s.restore(),e.synchronizeValues()),o}(e,e.value,n,r,o,u);return{replacements:i,message:t||(i>0?`Replaced ${i} occurrence(s)`:"No matches found")}}catch(t){throw e.s.restore(),Error(`Failed to replace in document: ${(null==t?void 0:t.message)||"Unknown error"}`)}})()}},12570:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(62553),r=u(56293);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},70750:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceSelection",s="Replace the current selection with new HTML content",i=[{name:"html",type:"string",description:"HTML content to insert in place of the selection",required:!0},{name:"collapseToEnd",type:"boolean",description:"Move cursor to the end of the inserted content",required:!1,default:!0}],r=!0},36142:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html"),{collapseToEnd:r}=t;(0,s.throwIfAborted)(u);try{if(e.s.restore(),e.s.insertHTML(n),r){let t=e.s.range;t.collapse(!1),e.s.selectRange(t)}return e.e.fire("change"),{success:!0,message:"Selection replaced successfully"}}catch(e){throw Error(`Failed to replace selection: ${e.message}`)}})()}},95323:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(70750),r=u(36142);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},90022:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="writeDocument",s="Write (replace) the entire document content with new HTML",i=[{name:"html",type:"string",description:"HTML content to set as the document",required:!0}],r=!0},79766:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html",{allowEmpty:!0});(0,s.throwIfAborted)(u);try{return e.s.focus(),e.value=n,e.synchronizeValues(),{success:!0,message:`Document content was replaced with provided HTML(${n.length} characters)`}}catch(e){throw Error(`Failed to replace HTML: ${(null==e?void 0:e.message)||"Unknown error"}`)}})()}},97603:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(90022),r=u(79766);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},80453:function(e,t,u){"use strict";u.d(t,{UIConversationListItem:function(){return l}});var n=u(82749),s=u(31635),i=u(65478),r=u(67510),o=u(62843),a=u(80870);class l extends r.UIElement{className(){return"UIConversationListItem"}render(){return'<div class="jodit-ui-conversation-list__item"></div>'}setActive(e){this.isActive=e,this.updateContent()}updateContent(){let e=this.container;e.innerHTML="",e.setAttribute("data-id",this.conversation.id),this.isActive?e.classList.add("jodit-ui-conversation-list__item_active"):e.classList.remove("jodit-ui-conversation-list__item_active");let t=this.j.c.div("jodit-ui-conversation-list__item-avatar");t.textContent="AI",e.appendChild(t);let u=this.j.c.div("jodit-ui-conversation-list__item-wrapper"),n=this.j.c.div("jodit-ui-conversation-list__item-content"),s=this.j.c.div("jodit-ui-conversation-list__item-title");if(s.textContent=this.conversation.title,this.titleElement=s,n.appendChild(s),this.opts.showTimestamps){let e=this.j.c.div("jodit-ui-conversation-list__item-meta");e.textContent=this.opts.formatTimestamp(this.conversation.updated,this.j.i18n.bind(this.j)),n.appendChild(e)}if(u.appendChild(n),this.conversation.messageCount>0){let e=this.j.c.div("jodit-ui-conversation-list__item-badge");e.textContent=String(this.conversation.messageCount),u.appendChild(e)}e.appendChild(u),this.actionsButton||(this.actionsButton=new o.UIButton(this.j,{icon:{name:"dots"},tooltip:"Actions",name:"conversationActions",size:"tiny"}),this.actionsButton.container.classList.add("jodit-ui-conversation-list__item-actions"),this.actionsButton.onAction(e=>{e.stopPropagation(),this.showActionsMenu(e)})),e.appendChild(this.actionsButton.container)}onClick(){this.isRenaming||this.j.e.fire("selectConversation.ai-assistant-pro",this.conversation.id)}showActionsMenu(e){if(!this.contextMenu||!this.actionsButton)return;let t=this.actionsButton.container.getBoundingClientRect();this.contextMenu.show(t.left,t.bottom,[{title:"Rename",icon:"pencil",exec:()=>{this.startInlineRename()}},{title:"Delete",icon:"bin",exec:()=>{this.onDelete()}}]),e.stopPropagation()}startInlineRename(){if(this.isRenaming||!this.titleElement)return;this.isRenaming=!0;let e=this.titleElement,t=this.conversation.title,u=this.j.c.element("input");u.type="text",u.value=t,u.className="jodit-ui-conversation-list__item-title-input",e.textContent="",e.appendChild(u),u.focus(),u.select();let n=()=>{if(!this.isRenaming)return;let n=u.value.trim();this.isRenaming=!1,n&&n!==t?(e.textContent=n,this.j.e.fire("renameConversation.ai-assistant-pro",this.conversation.id,n)):e.textContent=t};this.j.e.on(u,"blur",n),this.j.e.on(u,"keydown",n=>{"Enter"===n.key&&(n.preventDefault(),u.blur()),"Escape"===n.key&&(this.isRenaming=!1,e.textContent=t)}),this.j.e.on(u,"click",e=>{e.stopPropagation()})}onDelete(){this.j.e.fire("deleteConversation.ai-assistant-pro",this.conversation.id)}destruct(){var e,t;null==(e=this.actionsButton)||e.destruct(),null==(t=this.contextMenu)||t.destruct(),super.destruct()}constructor(e,t,u=!1,s){super(e),(0,n._)(this,"opts",void 0),(0,n._)(this,"conversation",void 0),(0,n._)(this,"isActive",void 0),(0,n._)(this,"actionsButton",void 0),(0,n._)(this,"contextMenu",void 0),(0,n._)(this,"titleElement",void 0),(0,n._)(this,"isRenaming",void 0),this.opts=s,this.actionsButton=null,this.contextMenu=null,this.titleElement=null,this.isRenaming=!1,this.conversation=t,this.isActive=u,this.contextMenu=new a.ContextMenu(this.j),this.updateContent()}}(0,s.__decorate)([(0,i.watch)("container:click")],l.prototype,"onClick",null),(0,s.__decorate)([i.autobind],l.prototype,"showActionsMenu",null),(0,s.__decorate)([i.autobind],l.prototype,"startInlineRename",null),(0,s.__decorate)([i.autobind],l.prototype,"onDelete",null),l=(0,s.__decorate)([i.component],l)},68365:function(e,t,u){"use strict";u.d(t,{UIConversationList:function(){return F}});var n=u(82749),s=u(31635),i=u(31356),r=u(80453),o=u(65478),a=u(80256),l=u(62405);class F extends l.UIGroup{className(){return"UIConversationList"}render(){return`<div class="&__container">
|
|
10
|
+
${i}`.trim();u?yield this.__executeQuickCommandSilent(a,i):yield this.__executeQuickCommandWithPanel(a,n)}).call(this)}__executeQuickCommandSilent(e,t){return(0,n._)(function*(){yield this.__loadData(),this.j.progressbar.show().progress(100);try{let t=(0,p.createUserMessage)(e),u=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature,[t]),n=yield this.apiClient.sendRequest(u.id,u.messages,null,[],u.options);if("final"===n.mode){let e=n.response.content;e&&this.j.s.insertHTML(e)}}catch(e){(0,g.isAbortError)(e)||this.j.e.fire("error",e)}finally{this.j.progressbar.hide()}}).call(this)}__executeQuickCommandWithPanel(e,t){return(0,n._)(function*(){yield this.__loadData();let u=this.stateManager.state.displayMode;this.stateManager.state.displayMode=t;let n=(0,p.getCurrentSelectionContext)(this.j);n&&this.stateManager.addSelectionContext(n),this.stateManager.isOpen()||(yield this.openAssistant()),yield this.sendMessage(e),this.stateManager.state.displayMode=u}).call(this)}sendMessage(e){return(0,n._)(function*(){yield this.__loadData();let t=this.stateManager.getCurrentConversation(),u=this.stateManager.getEditingMessageId();if(u&&t){let e=t.messages.findIndex(e=>e.id===u);if(-1!==e){let u=t.messages.slice(0,e),n=(0,r._)((0,i._)({},t),{messages:u,updatedAt:Date.now()});this.stateManager.setCurrentConversation(n),yield this.storage.save(n),this.stateManager.clearEditingMessage(),t=n}}t||(t=(0,p.createNewConversation)(this.j,this.state.defaultModel,this.state.defaultTemperature),this.stateManager.setCurrentConversation(t));let n=null;e.trim()&&(n=(0,p.createUserMessage)(e),t.title||(t=(0,r._)((0,i._)({},t),{title:e})),t=(0,r._)((0,i._)({},t),{updated:Date.now(),messages:[...t.messages,n]})),this.stateManager.setCurrentConversation((0,i._)({},t)),n&&this.j.e.fire("messageSent.ai-assistant-pro",n),this.stateManager.setLoading(!0),this.stateManager.clearError();try{yield this.sendRequestToAI(0),this.stateManager.clearSelectionContexts()}catch(e){if((0,g.isAbortError)(e))return;this.stateManager.setError(e instanceof Error?e.message:String(e))}finally{this.stateManager.setLoading(!1)}}).call(this)}sendRequestToAI(e=0){return(0,n._)(function*(){let t,u,n=this.j.o.aiAssistantPro.maxRecursionToolCallDepth;if(e>=n)throw Error(`Max recursion depth ${n} reached for tool calls`);let s=this.stateManager.getCurrentConversation();if(!s)return;let r=(0,p.findParentMessageId)(s),[o]=yield Promise.all([this.apiClient.sendRequest(s.id,s.messages,r,this.stateManager.getSelectionContexts(),s.options),this.storage.save(s)]);if("stream"===o.mode){let e=yield(0,p.processStreamingResponse)(this.stateManager,o,s);t=e.aiMessage,u=e.index,s=e.conversation}else{let e=(0,p.processFinalResponse)(o,s);t=e.aiMessage,u=e.index,s=e.conversation}s=yield(0,p.processArtifacts)(this.j,t,s,u),this.j.e.fire("messageReceived.ai-assistant-pro",t),this.stateManager.setCurrentConversation((0,i._)({},s)),yield this.storage.save(s),yield this.handleToolCalls(t.id,e)}).call(this)}deleteConversation(e){return(0,n._)(function*(){yield this.__loadData(),yield(0,p.deleteConversationWithCleanup)(this.j,e,this.storage,this.stateManager,this.permissionManager)}).call(this)}renameConversation(e,t){return(0,n._)(function*(){var u;let n=yield this.storage.get(e);if(!n)return;let s=(0,r._)((0,i._)({},n),{title:t,updated:Date.now()});yield this.storage.save(s),(null==(u=this.state.currentConversation)?void 0:u.id)===e&&this.stateManager.setCurrentConversation(s);let o=yield this.storage.list();this.stateManager.setConversations(o)}).call(this)}searchConversations(e){return(0,n._)(function*(){yield this.__loadData(),yield(0,p.handleConversationSearch)(e,this.storage,this.stateManager)}).call(this)}handleToolCalls(e,t=0){return(0,n._)(function*(){let u=this.stateManager.getCurrentConversation();if(!u)return;let n=u.messages.find(t=>t.id===e);if(!n)return;let s=n.toolCalls;if(!s||0===s.length)return;let i=s.filter(e=>!(0,p.isTerminalToolCallStatus)(e.status));if(0===i.length)return;let{approved:r,needsPermission:o}=this.permissionManager.filterToolCalls(i,u.permissions);for(let u of(this.stateManager.setPendingToolCalls(o),r))yield this.executeToolCall(e,u,t)}).call(this)}executeToolCall(e,t,u=0){return(0,n._)(function*(){let n=this.stateManager.getCurrentConversation();if(!n)return;let s=yield(0,p.executeToolCall)(this.j,t,this.toolRegistry),o=n.messages.findIndex(t=>t.id===e);if(-1===o)return;let a=n.messages[o],l=n.messages.slice();l[o]=(0,p.updateToolCallInMessage)(a,s),n=(0,r._)((0,i._)({},n),{messages:l,updated:Date.now()}),this.stateManager.setCurrentConversation(n),(0,p.areAllToolCallsExecuted)(n)&&(yield this.sendRequestToAI(u+1))}).call(this)}copyMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.find(t=>t.id===e);if(u)try{yield navigator.clipboard.writeText(u.content),this.j.message.success("Message copied to clipboard")}catch(e){this.j.e.fire("error",Error("Failed to copy message"))}}).call(this)}restartFromMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.findIndex(t=>t.id===e);if(-1===u)return;let n=t.messages[u];if("user"!==n.role)return;yield this.__loadData();let s=t.messages.slice(0,u),o=(0,r._)((0,i._)({},t),{messages:s,updatedAt:Date.now()});this.stateManager.setCurrentConversation(o),yield this.storage.save(o),yield this.sendMessage(n.content)}).call(this)}editMessage(e){return(0,n._)(function*(){let t=this.stateManager.getCurrentConversation();if(!t)return;let u=t.messages.find(t=>t.id===e);u&&"user"===u.role&&(this.stateManager.setEditingMessageId(e),this.mainPanel.inputArea.setValue(u.content),this.mainPanel.inputArea.focus())}).call(this)}cancelEditMessage(){this.stateManager.isEditingMessage()&&(this.stateManager.clearEditingMessage(),this.mainPanel.inputArea.setValue(""))}deleteMessage(e){return(0,n._)(function*(){yield this.__loadData();let t=this.stateManager.getCurrentConversation();if(!t||-1===t.messages.findIndex(t=>t.id===e))return;let u=t.messages.filter(t=>t.id!==e),n=(0,r._)((0,i._)({},t),{messages:u,updatedAt:Date.now()});this.stateManager.setCurrentConversation(n),yield this.storage.save(n)}).call(this)}beforeDestruct(){var e,t,u,n,s,i,r,o;this.textAutocompleteSource&&(this.j.e.fire("unregisterAutocompleteSource",this.textAutocompleteSource),this.textAutocompleteSource=null),this.textAutocompleteCache.clear(),this.__closeFlightMode(),null==(e=(0,E.cached)(this,"toolRegistry"))||e.destruct(),null==(t=(0,E.cached)(this,"permissionManager"))||t.destruct(),null==(u=(0,E.cached)(this,"apiClient"))||u.destruct(),null==(n=(0,E.cached)(this,"stateManager"))||n.destruct(),null==(s=(0,E.cached)(this,"mainPanel"))||s.destruct(),null==(i=(0,E.cached)(this,"dialog"))||i.destruct(),null==(o=(0,E.cached)(this,"storage"))||null==(r=o.close)||r.call(o)}constructor(...e){super(...e),(0,s._)(this,"buttons",[{name:"aiAssistantPro",group:"insert"},{name:"aiCommandsPro",group:"insert"}]),(0,s._)(this,"textAutocompleteSource",null),(0,s._)(this,"textAutocompleteCache",new Map),(0,s._)(this,"__initedPromise",null),(0,s._)(this,"__openedMode",null)}}(0,s._)(y,"requires",["license","autocomplete"]),(0,o.__decorate)([E.cache],y.prototype,"toolRegistry",null),(0,o.__decorate)([E.cache],y.prototype,"permissionManager",null),(0,o.__decorate)([E.cache],y.prototype,"apiClient",null),(0,o.__decorate)([E.cache],y.prototype,"storage",null),(0,o.__decorate)([E.cache],y.prototype,"stateManager",null),(0,o.__decorate)([E.cache],y.prototype,"mainPanel",null),(0,o.__decorate)([E.cache],y.prototype,"dialog",null),(0,o.__decorate)([(0,E.watch)("state.theme")],y.prototype,"__applyTheme",null),(0,o.__decorate)([(0,E.watch)(":openAIAssistantPro.ai-assistant-pro")],y.prototype,"openAssistant",null),(0,o.__decorate)([(0,E.watch)([":resize","state.panelWidth","state.panelHeight"])],y.prototype,"__onResizeInPanelView",null),(0,o.__decorate)([(0,E.watch)(["state.isOpen","state.displayMode","state.panelWidth","state.panelHeight","state.theme","state.defaultModel","state.defaultTemperature","state.currentConversation"]),(0,E.debounce)()],y.prototype,"__onSavedStateChange",null),(0,o.__decorate)([(0,E.watch)(":closeAIAssistantPro.ai-assistant-pro")],y.prototype,"closeAssistant",null),(0,o.__decorate)([(0,E.watch)(":addContextToAIAssistant.ai-assistant-pro")],y.prototype,"addCurrentSelectionToContext",null),(0,o.__decorate)([(0,E.watch)(":executeQuickCommand.ai-assistant-pro")],y.prototype,"executeQuickCommand",null),(0,o.__decorate)([(0,E.watch)(":sendMessage.ai-assistant-pro")],y.prototype,"sendMessage",null),(0,o.__decorate)([(0,E.watch)(":searchConversations.ai-assistant-pro")],y.prototype,"searchConversations",null),(0,o.__decorate)([(0,E.watch)(":copyMessage.ai-assistant-pro")],y.prototype,"copyMessage",null),(0,o.__decorate)([(0,E.watch)(":restartFromMessage.ai-assistant-pro")],y.prototype,"restartFromMessage",null),(0,o.__decorate)([(0,E.watch)(":editMessage.ai-assistant-pro")],y.prototype,"editMessage",null),(0,o.__decorate)([(0,E.watch)(":cancelEditMessage.ai-assistant-pro")],y.prototype,"cancelEditMessage",null),(0,o.__decorate)([(0,E.watch)(":deleteMessage.ai-assistant-pro")],y.prototype,"deleteMessage",null),y=(0,o.__decorate)([E.component],y),m.JoditPro.plugins.add("aiAssistantPro",y)},66645:function(e,t,u){"use strict";var n,s=u(77688),i=u(56075),r=u(11886),o=u(47373),a=u(94668),l=u.n(a),F=u(86428),c=u.n(F),h=u(75966),d=u.n(h),p=u(83207),A=u.n(p),C=u(99219),E=u.n(C),D=u(63674),g=u.n(D),f=u(4133),m=u.n(f),B=u(94454),v=u(53835),y=u(6441),x=u(12153),_=u(31974),w=u(72573);x.Icon.set("ai-assistant-pro",c()).set("ai-commands-pro",d()).set("ai-add-context",l()).set("send",E()).set("tool-bolt",m()).set("chevron-right",A()).set("shield",g()),y.Config.prototype.aiAssistantPro={displayMode:"right",panelWidth:400,panelHeight:500,flightPanelHeight:250,dialogFullSize:!1,resizable:!0,apiMode:"incremental",apiRequest:null,maxRetries:3,requestTimeout:3e5,retryDelay:1e3,maxRecursionToolCallDepth:1e3,enabledTools:(0,v.getToolNames)(),customTools:[],toolPermissions:{},autoApproveTools:["readDocument","readBlocks","readSelection","insertHTML","addHTML"],alwaysDenyTools:[],defaultPermissionScope:"conversation",storage:"indexedDB",maxConversations:50,storageKey:"jodit-ai-assistant-pro",showConversationList:!0,enableMarkdown:!0,enableCodeHighlight:!0,maxMessageHeight:400,placeholderText:"Ask AI assistant...",sendShortcut:"Ctrl+Enter",showTimestamps:!0,formatTimestamp:(e,t)=>{let u=new Date(e),n=new Date().getTime()-u.getTime();return n<6e4?t("Just now"):n<36e5?t("%dm ago",Math.floor(n/6e4)):n<864e5?t("%dh ago",Math.floor(n/36e5)):u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})},formatMessageContent:(e,t)=>w.marked.parse(e,{breaks:!0,gfm:!0}),showAvatars:!0,showTypingIndicator:!0,includeSelectionByDefault:!0,maxContextRanges:5,showContextPreview:!0,sendOnEnter:!0,instructions:void 0,includeEditorMetadata:!1,autoOpen:!0,rememberLastConversation:!0,autoFocusInput:!0,closeAfterInsert:!1,enableSoundNotifications:!1,debug:!1,textAutocompleteEnabled:!1,textAutocompleteApiRequest:null,textAutocompleteMinQueryLength:3,textAutocompleteMaxSuggestions:3,textAutocompleteDebounceMs:500,textAutocompleteCacheTTL:3e4,textAutocompleteCacheMaxSize:50,quickCommandsSilentMode:!1,quickCommandsDisplayMode:"flight",showCopyMessageAction:!0,showRestartMessageAction:!0,showEditMessageAction:!0,showDeleteMessageAction:!0,dialogSettings:{},allowEditDialogSettings:!1,allowEditDisplayMode:!0,allowEditPanelWidth:!0,initiallyOpened:!1,allowClose:!0,persistOpenState:!0,theme:"parent",allowEditTheme:!0,uploadBase64Artifact(e,t){return(0,s._)(function*(){if("image"===e.type&&e.data&&"base64"===e.data.kind)try{let u=(0,o.base64ToFile)(e.data.base64,e.id,e.mimeType),n=yield t.uploader.upload([u]);return(0,r._)((0,i._)({},e),{data:{kind:"url",url:n.baseurl+n.files[0]},metadata:(0,r._)((0,i._)({},e.metadata),{filename:n.files[0]})})}catch(e){t.e.fire("error",e)}return e})()},getAIProviderOptions(e,t){return(0,B.getAIProviderOptions)(e,t)},registerAIProvider(e,t){(0,B.registerAIProvider)(e,t)}},y.Config.prototype.controls.aiAssistantPro={icon:"ai-assistant-pro",tooltip:"AI Assistant",hotkeys:["ctrl+shift+a","cmd+shift+a"],exec(e){e.e.fire("openAIAssistantPro.ai-assistant-pro")},isDisabled(e){return!e.o.aiAssistantPro.apiRequest},getLabel(e){return e.o.aiAssistantPro.apiRequest?"AI Assistant":"AI Assistant (not configured)"}},y.Config.prototype.controls.aiAddContext={icon:"ai-add-context",tooltip:"Add to AI Context",exec(e){e.e.fire("addContextToAIAssistant")},isDisabled(e){return!e.o.aiAssistantPro.apiRequest||e.s.isCollapsed()}},y.Config.prototype.controls.aiCommandsPro={icon:"ai-commands-pro",tooltip:"AI Commands",isDisabled(e){return!e.o.aiAssistantPro.apiRequest},list:_.aiAssitentCommands,exec(e,t,{control:u}){e.e.fire("executeQuickCommand.ai-assistant-pro",u.name)}};let b=(null==(n=y.Config.prototype.tuneBlock)?void 0:n.popup)||{},k={};["p","h1","h2","h3","h4","h5","h6","div","section","article","pre","blockquote","ul","ol","li","table","tr","td","th","img","figure"].forEach(e=>{let t=b[e]||["tune.up","tune.remove","tune.down"];k[e]=[...t,"|","aiAddContext"]}),y.Config.prototype.tuneBlock&&(y.Config.prototype.tuneBlock.popup=(0,i._)({},b,k))},6689:function(e,t,u){"use strict";u.d(t,{throwIfAborted:function(){return s}});var n=u(93661);function s(e){if(e.aborted)throw(0,n.abort)()}},61872:function(e,t,u){"use strict";u.d(t,{processArtifacts:function(){return F},processFinalResponse:function(){return l},processStreamingResponse:function(){return a}});var n=u(89929),s=u(77688),i=u(56075),r=u(11886),o=u(61558);function a(e,t,u){return(0,s._)(function*(){let s=(0,o.createAIMessage)(),a=-1;var l,F=!1,c=!1;try{for(var h,d=(0,n._)(t.stream);F=!(h=yield d.next()).done;F=!1){let t=h.value;switch(t.type){case"created":s=(0,r._)((0,i._)({},s),{id:t.response.responseId,content:""}),a=u.messages.length;break;case"text-delta":s=(0,r._)((0,i._)({},s),{content:s.content+t.delta});break;case"completed":s=(0,r._)((0,i._)({},s),{id:t.response.responseId,toolCalls:t.response.toolCalls||[],artifacts:t.response.artifacts||[]});break;case"error":{let e=(0,o.createErrorMessage)(t.error);s=(0,r._)((0,i._)({},s),{id:e.id,content:e.content})}}if(s.id){let t=u.messages.slice();t[a>=0?a:u.messages.length]=s,u=(0,r._)((0,i._)({},u),{messages:t,updated:Date.now()}),e.setCurrentConversation(u)}}}catch(e){c=!0,l=e}finally{try{F&&null!=d.return&&(yield d.return())}finally{if(c)throw l}}return{aiMessage:s,index:a,conversation:u}})()}function l(e,t){let u=(0,r._)((0,i._)({},(0,o.createAIMessage)()),{id:e.response.responseId,content:e.response.content,toolCalls:e.response.toolCalls||[],artifacts:e.response.artifacts||[]}),n=t.messages.slice();return n.push(u),{aiMessage:u,index:(t=(0,r._)((0,i._)({},t),{messages:n,updated:Date.now()})).messages.length-1,conversation:t}}function F(e,t,u,n){return(0,s._)(function*(){if(t.artifacts&&t.artifacts.length>0){let s=u.messages.slice();return s[n]=(0,r._)((0,i._)({},s[n]),{artifacts:yield(0,o.uploadArtifacts)(e,t.artifacts)}),(0,r._)((0,i._)({},u),{messages:s,updated:Date.now()})}return u})()}},49459:function(e,t,u){"use strict";function n(e,t,u={}){let s=e[t];if("string"!=typeof s||!u.allowEmpty&&""===s)throw Error(`Parameter "${t}" is required and must be a${u.allowEmpty?"":" non-empty"} string`);return s}u.d(t,{requireString:function(){return n}})},44526:function(e,t,u){"use strict";u.d(t,{resolveBlock:function(){return s}});var n=u(22732);function s(e,{selector:t,index:u,requireExactlyOne:i=!1}={}){let r=null!=t&&""!==t.trim(),o=null!=u;if(i&&r===o)throw Error("Either index or selector must be provided, but not both");if(!r&&!o)throw Error("Block identifier is required");if(r){if("string"!=typeof t)throw Error("Selector must be a string");let u=e.editor.querySelector(t);if(!u)throw Error(`No element found matching selector "${t}"`);if(!n.Dom.isElement(u))throw Error(`Selector "${t}" does not point to an element node`);return{element:u,identifier:`with selector "${t}"`}}if("number"!=typeof u)throw Error("Block index must be a number");let a=Array.from(e.editor.children);if(u<0||u>=a.length)throw Error(`Block index ${u} is out of range. Document has ${a.length} blocks`);let l=a[u];if(!n.Dom.isElement(l))throw Error(`Block at index ${u} is not a valid element`);return{element:l,identifier:`at index ${u}`}}},70308:function(e,t,u){"use strict";u.d(t,{areAllToolCallsExecuted:function(){return a},createNewConversation:function(){return s},findMessagesWithPendingToolCalls:function(){return l},findParentMessageId:function(){return i},isTerminalToolCallStatus:function(){return o}});var n=u(21064);function s(e,t,u,i=[]){let r=e.o.aiAssistantPro,o={id:(0,n.generateConversationId)(),created:Date.now(),updated:Date.now(),messages:i,permissions:[],options:{model:null!=t?t:r.defaultModel,temperature:null!=u?u:r.defaultTemperature}};return e.e.fire("conversationCreated.ai-assistant-pro",o),o}function i(e){for(let t=e.messages.length-1;t>=0;t--){let u=e.messages[t];if("assistant"===u.role&&!u.id.startsWith("error_"))return u.id}return null}let r=new Set(["executed","denied","error"]);function o(e){return r.has(e)}function a(e){let t=e.messages[e.messages.length-1];return!!(null==t?void 0:t.toolCalls)&&t.toolCalls.every(e=>o(e.status))}function l(e){return e.messages.filter(e=>e.toolCalls&&e.toolCalls.length>0&&e.toolCalls.some(e=>!o(e.status)))}},473:function(e,t,u){"use strict";u.d(t,{handleBackToList:function(){return c},handleConversationSearch:function(){return h},handleConversationSelect:function(){return F},handleToolApproval:function(){return a},handleToolDenial:function(){return l}});var n=u(77688),s=u(56075),i=u(11886),r=u(79078),o=u(82758);function a(e,t,u,r,o){return(0,n._)(function*(){let n=u.getPendingToolCalls().find(t=>t.id===e);if(!n)return null;let a=r.grantPermission(n.name,t),l=u.getCurrentConversation();return l&&(l.permissions.push(a),yield o.save(l)),u.removePendingToolCall(e),(0,i._)((0,s._)({},n),{status:"approved"})})()}function l(e,t,u,o){return(0,n._)(function*(){let n=u.getPendingToolCalls().find(e=>e.id===t);if(!n)return;let a=u.getCurrentConversation();if(!a)return;let l=a.messages.findIndex(e=>{var u;return null==(u=e.toolCalls)?void 0:u.find(e=>e.id===t)});if(-1===l)return;let F=a.messages[l],c=(0,i._)((0,s._)({},n),{result:{error:"Tool call denied by user."},status:"denied"}),h=(0,r.updateToolCallInMessage)(F,c),d=[...a.messages];d[l]=h,a=(0,i._)((0,s._)({},a),{messages:d,updated:Date.now()}),u.setCurrentConversation(a),yield o.save(a),e.e.fire("toolCallDenied.ai-assistant-pro",n),u.removePendingToolCall(t)})()}function F(e,t,u){return(0,n._)(function*(){try{u.setLoading(!0);let n=yield t.get(e);if(!n)throw Error("Conversation not found: "+e);u.setCurrentConversation((0,s._)({},n))}catch(e){o.IS_PROD}finally{u.setLoading(!1)}})()}function c(e,t){return(0,n._)(function*(){t.setView("conversationList");try{t.setLoading(!0);let u=yield e.list().catch(()=>[]);t.setConversations(u)}finally{t.setLoading(!1)}})()}function h(e,t,u){return(0,n._)(function*(){u.setLoading(!0);try{let n=yield t.list(e||void 0);u.setConversations(n),u.setView("conversationList")}finally{u.setLoading(!1)}})()}},58579:function(e,t,u){"use strict";u.d(t,{applyTheme:function(){return F.applyTheme},areAllToolCallsExecuted:function(){return s.areAllToolCallsExecuted},createNewConversation:function(){return s.createNewConversation},createUserMessage:function(){return r.createUserMessage},deleteConversationWithCleanup:function(){return l.deleteConversationWithCleanup},executeToolCall:function(){return c.executeToolCall},findMessagesWithPendingToolCalls:function(){return s.findMessagesWithPendingToolCalls},findParentMessageId:function(){return s.findParentMessageId},getCurrentSelectionContext:function(){return a.getCurrentSelectionContext},handleBackToList:function(){return i.handleBackToList},handleConversationSearch:function(){return i.handleConversationSearch},handleConversationSelect:function(){return i.handleConversationSelect},handleToolApproval:function(){return i.handleToolApproval},handleToolDenial:function(){return i.handleToolDenial},invertMode:function(){return o.invertMode},isTerminalToolCallStatus:function(){return s.isTerminalToolCallStatus},loadInitialData:function(){return l.loadInitialData},processArtifacts:function(){return n.processArtifacts},processFinalResponse:function(){return n.processFinalResponse},processStreamingResponse:function(){return n.processStreamingResponse},resizeInPanelView:function(){return o.resizeInPanelView},updateToolCallInMessage:function(){return c.updateToolCallInMessage}});var n=u(61872),s=u(70308),i=u(473),r=u(61558),o=u(71050),a=u(15927),l=u(56110),F=u(53014),c=u(79078)},61558:function(e,t,u){"use strict";u.d(t,{createAIMessage:function(){return r},createErrorMessage:function(){return o},createUserMessage:function(){return i},uploadArtifacts:function(){return a}});var n=u(77688),s=u(21064);function i(e){return{id:(0,s.generateMessageId)(),role:"user",content:e,timestamp:Date.now()}}function r(){return{id:"",role:"assistant",content:"",artifacts:[],timestamp:Date.now(),toolCalls:[]}}function o(e){return{id:"error_"+(0,s.generateMessageId)(),role:"assistant",content:`❌ Error: ${e.message}`,timestamp:Date.now(),toolCalls:[],artifacts:[]}}function a(e,t){return(0,n._)(function*(){if(!t||0===t.length)return t;let u=e.o.aiAssistantPro.uploadBase64Artifact;return u?Promise.all(t.map(t=>(0,n._)(function*(){var n;return null!=(n=u(t,e))?n:t})())):t})()}},71050:function(e,t,u){"use strict";u.d(t,{invertMode:function(){return s},resizeInPanelView:function(){return i}});var n=u(41180);function s(e){switch(e){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top"}}function i(e,t,u,i){var r,o,a,l;if("dialog"===t||"flight"===t)return;("left"===t||"right"===t)&&(null==(a=e.currentPlace.slots[s(t)])||a.style.setProperty(`--jd-slot-${s(t)}-width`,"auto"),null==(l=e.currentPlace.slots[t])||l.style.setProperty(`--jd-slot-${t}-width`,`${u}px`));let F=null!=(r=(0,n.css)(e.currentPlace.workplace,"height"))?r:0;null==(o=e.currentPlace.slots[t])||o.style.setProperty("min-height",`${Math.min(F,i)}px`)}},15927:function(e,t,u){"use strict";function n(e){if(e.s.isCollapsed())return null;let t=e.s.html,u=e.s.range;return{html:t,rangeInfo:{startContainer:u.startContainer.nodeName,startOffset:u.startOffset,endContainer:u.endContainer.nodeName,endOffset:u.endOffset}}}u.d(t,{getCurrentSelectionContext:function(){return n}})},56110:function(e,t,u){"use strict";u.d(t,{deleteConversationWithCleanup:function(){return i},loadInitialData:function(){return r}});var n=u(77688),s=u(82758);function i(e,t,u,s,i){return(0,n._)(function*(){try{s.setLoading(!0),yield u.delete(t),s.removeConversation(t),i.clearConversationPermissions(t);let n=s.getCurrentConversation();(null==n?void 0:n.id)===t&&s.setCurrentConversation(null);let r=yield u.list();s.setConversations(r),s.setView(0===r.length?"welcome":"conversationList"),e.e.fire("conversationDeleted.ai-assistant-pro",t)}catch(t){e.alert(e.i18n("Failed to delete conversation")+": "+((null==t?void 0:t.message)||"Unknown error"))}finally{s.setLoading(!1)}})()}function r(e,t,u){return(0,n._)(function*(){u.setLoading(!0);try{let[s,i]=yield Promise.all([t.list().catch(()=>[]),t.getGlobalSettings().catch(()=>null)]);if(u.setConversations(s),i&&u.setSavedState(i),0===s.length)u.setView("welcome");else if(e.o.aiAssistantPro.rememberLastConversation&&(null==i?void 0:i.currentConversationId)){var n;let e=null!=(n=s.find(e=>e.id===i.currentConversationId))?n:s[0],r=yield t.get(e.id);r?u.setCurrentConversation(r):u.setView("conversationList")}else u.setView("conversationList")}catch(e){s.IS_PROD,u.setView("welcome")}finally{u.setLoading(!1)}})()}},53014:function(e,t,u){"use strict";u.d(t,{applyTheme:function(){return i}});let n=["jodit_theme_dark","jodit-ai-assistant-pro_theme_dark","jodit-dialog_theme_dark"],s=["jodit_theme_light","jodit-ai-assistant-pro_theme_light","jodit-dialog_theme_light"];function i(e,t,u,i,r){let o;if(null==i||i.classList.remove(...n),null==i||i.classList.remove(...s),"dialog"===u){let e=null==r?void 0:r.container;null==e||e.classList.remove(...n),null==e||e.classList.remove(...s)}if(o="dark"===t?n:s,null==i||i.classList.add(...o),"dialog"===u){let e=null==r?void 0:r.container;null==e||e.classList.add(...o)}}},79078:function(e,t,u){"use strict";u.d(t,{executeToolCall:function(){return r},updateToolCallInMessage:function(){return o}});var n=u(77688),s=u(56075),i=u(11886);function r(e,t,u){return(0,n._)(function*(){let n;try{let e=new AbortController().signal,r=yield u.executeTool(t.name,t.arguments,e);n=(0,i._)((0,s._)({},t),{result:{result:r},status:"executed"})}catch(u){n=(0,i._)((0,s._)({},t),{result:{error:u instanceof Error?u.message:String(u)},status:"error"}),e.e.fire("toolCallFailed.ai-assistant-pro",n)}return e.e.fire("toolCallExecuted.ai-assistant-pro",n,{toolCallId:n.id,result:n.result}),n})()}function o(e,t){var u,n;let r=null==(n=e.toolCalls)?void 0:n.findIndex(e=>e.id===t.id);if(null==r||-1===r)return e;let o=[...null!=(u=null==e?void 0:e.toolCalls)?u:[]];return o[r]=t,(0,i._)((0,s._)({},e),{toolCalls:o})}},86449:function(e,t,u){"use strict";u.d(t,{APIClient:function(){return l}});var n=u(77688),s=u(82749),i=u(56075),r=u(11886),o=u(82758),a=u(21537);class l{sendRequest(e,t,u,s,i){return(0,n._)(function*(){let{apiRequest:n,requestTimeout:r,maxRetries:l}=this.jodit.o.aiAssistantPro;if(!n)throw Error("AI Assistant Pro callback is not configured");let F=new AbortController;this.abortControllers.add(F);try{let c=this.buildRequestContext(e,t,u,s,i),h=null;for(let e=0;l>=e;e++)try{if(F.signal.aborted)throw(0,a.abort)();let e=setTimeout(()=>{F.abort()},r);try{let t=yield n(c,F.signal);return clearTimeout(e),this.validateResponse(t),t}catch(t){throw clearTimeout(e),t}}catch(t){if(h=t,o.IS_PROD,l>e){let t=this.calculateRetryDelay(e);yield this.sleep(t)}else throw t}throw h||Error("API request failed after all retries")}finally{this.abortControllers.delete(F)}}).call(this)}abort(){this.abortControllers.forEach(e=>{e.abort()}),this.abortControllers.clear()}isInProgress(){return this.abortControllers.size>0}buildRequestContext(e,t,u,n,s){let o,{apiMode:a,instructions:l}=this.jodit.o.aiAssistantPro,F={mode:a,conversationId:e,tools:this.toolRegistry.getAllTools(),selectionContexts:n,conversationOptions:s,instructions:l};if("full"===a)o=t;else if(u){let e=t.findIndex(e=>e.id===u);o=-1!==e?t.slice(e+1):t,F=(0,r._)((0,i._)({},F),{parentMessageId:u})}else o=t;return(0,r._)((0,i._)({},F),{messages:this.expandToolMessages(o,t.find(e=>e.id===u))})}expandToolMessages(e,t){let u=[];for(let t of e)u.push(t),this.expandToolResultsMessage(t,u);return t&&this.expandToolResultsMessage(t,u),u}expandToolResultsMessage(e,t){if(e.toolCalls&&e.toolCalls.length>0)for(let n of e.toolCalls){var u;let s=null!=(u=n.result)?u:{error:"result not found"};if(t.find(e=>e.id===`${n.id}-result`))continue;let i={id:`${n.id}-result`,role:"tool",content:s.error?`Error: ${s.error}`:JSON.stringify(s.result),timestamp:e.timestamp,toolResults:[{toolCallId:n.id,result:s}]};t.push(i)}}validateResponse(e){if("final"!==e.mode)return;let t=e.response;if(!t)throw Error("API returned empty response");if(!t.responseId)throw Error("API response missing responseId");if(void 0===t.content)throw Error("API response missing content");if(void 0===t.finished)throw Error("API response missing finished flag");if(t.toolCalls){if(!Array.isArray(t.toolCalls))throw Error("API response toolCalls must be an array");t.toolCalls.forEach((e,t)=>{if(!e.id)throw Error(`Tool call at index ${t} is missing id`);if(!e.name)throw Error(`Tool call at index ${t} is missing name`);if(!e.arguments||"object"!=typeof e.arguments)throw Error(`Tool call at index ${t} has invalid arguments`)})}}calculateRetryDelay(e){let{retryDelay:t}=this.jodit.o.aiAssistantPro;return t*Math.pow(2,e)+Math.random()*t}sleep(e){return new Promise(t=>setTimeout(t,e))}destruct(){this.abort()}constructor(e,t){(0,s._)(this,"jodit",void 0),(0,s._)(this,"toolRegistry",void 0),(0,s._)(this,"abortControllers",void 0),this.jodit=e,this.toolRegistry=t,this.abortControllers=new Set}}},47373:function(e,t,u){"use strict";function n(e,t,u="image/png"){let s=atob(e),i=s.length,r=new Uint8Array(i);for(let e=0;i>e;e++)r[e]=s.charCodeAt(e);return new File([new Blob([r],{type:u})],t,{type:u})}u.d(t,{base64ToFile:function(){return n}})},21020:function(e,t,u){"use strict";u.d(t,{PermissionManager:function(){return r}});var n=u(82749),s=u(56075),i=u(11886);class r{requiresPermission(e){let{autoApproveTools:t,alwaysDenyTools:u}=this.jodit.o.aiAssistantPro;if(u.includes(e))return!0;if(t.includes(e))return!1;let n=this.toolRegistry.getTool(e);return!n||n.requiresPermission}isAutoDenied(e){let{alwaysDenyTools:t}=this.jodit.o.aiAssistantPro;return t.includes(e)}isAutoApproved(e){let{autoApproveTools:t}=this.jodit.o.aiAssistantPro;return t.includes(e)}checkPermission(e,t){if(this.isAutoApproved(e))return{toolName:e,granted:!0,grantedAt:Date.now(),scope:"once"};if(this.isAutoDenied(e))return null;let u=this.permanentPermissions.get(e);return u&&u.granted?u:t.find(t=>t.toolName===e&&t.granted)||null}grantPermission(e,t){let u={toolName:e,granted:!0,grantedAt:Date.now(),scope:t};return"forever"===t&&(this.permanentPermissions.set(e,u),this.savePermanentPermissions()),u}denyPermission(e){return{toolName:e,granted:!1,grantedAt:Date.now(),scope:"once"}}filterToolCalls(e,t){let u=[],n=[],r=[];for(let o of e){if(this.isAutoDenied(o.name)){r.push((0,i._)((0,s._)({},o),{status:"denied"}));continue}if(this.isAutoApproved(o.name)){u.push((0,i._)((0,s._)({},o),{status:"approved"}));continue}let e=this.checkPermission(o.name,t);e&&e.granted?u.push((0,i._)((0,s._)({},o),{status:"approved"})):this.requiresPermission(o.name)?(this.jodit.e.fire("permissionRequested.ai-assistant-pro",o.name),n.push((0,i._)((0,s._)({},o),{status:"pending"}))):u.push((0,i._)((0,s._)({},o),{status:"approved"}))}return{approved:u,needsPermission:n,denied:r}}clearConversationPermissions(e){}loadPermanentPermissions(){try{let e=localStorage.getItem(this.PERMANENT_PERMISSIONS_KEY);e&&JSON.parse(e).forEach(e=>{"forever"===e.scope&&e.granted&&this.permanentPermissions.set(e.toolName,e)})}catch(e){}}savePermanentPermissions(){try{let e=Array.from(this.permanentPermissions.values());localStorage.setItem(this.PERMANENT_PERMISSIONS_KEY,JSON.stringify(e))}catch(e){}}clearPermanentPermissions(){this.permanentPermissions.clear(),localStorage.removeItem(this.PERMANENT_PERMISSIONS_KEY)}getPermanentPermissions(){return Array.from(this.permanentPermissions.values())}revokePermanentPermission(e){this.permanentPermissions.delete(e),this.savePermanentPermissions()}destruct(){this.permanentPermissions.clear()}constructor(e,t){(0,n._)(this,"jodit",void 0),(0,n._)(this,"toolRegistry",void 0),(0,n._)(this,"permanentPermissions",void 0),(0,n._)(this,"PERMANENT_PERMISSIONS_KEY",void 0),this.jodit=e,this.toolRegistry=t,this.permanentPermissions=new Map,this.PERMANENT_PERMISSIONS_KEY="jodit-permissions.ai-assistant-pro",this.loadPermanentPermissions()}}},46166:function(e,t,u){"use strict";u.d(t,{StateManager:function(){return r}});var n=u(82749),s=u(56075),i=u(11886);class r{createInitialState(){return{isOpen:!1,currentView:"welcome",currentConversation:null,conversations:[],isLoading:!1,error:null,pendingToolCalls:[],selectionContexts:[],abortController:null,editingMessageId:null,theme:this.jodit.o.aiAssistantPro.theme||"parent",displayMode:this.jodit.o.aiAssistantPro.displayMode,panelWidth:this.jodit.o.aiAssistantPro.panelWidth,panelHeight:this.jodit.o.aiAssistantPro.panelHeight,defaultModel:this.jodit.o.aiAssistantPro.defaultModel,defaultTemperature:this.jodit.o.aiAssistantPro.defaultTemperature}}open(){this.state.isOpen=!0,this.jodit.e.fire("open.ai-assistant-pro",this.state.currentConversation)}close(){this.state.isOpen=!1,this.jodit.e.fire("close.ai-assistant-pro")}isOpen(){return this.state.isOpen}setView(e){this.state.currentView=e,this.jodit.e.fire("viewChanged.ai-assistant-pro",e)}getView(){return this.state.currentView}setConversations(e){this.state.conversations=e}setSavedState(e){e.theme&&(this.state.theme=e.theme),e.displayMode&&(this.state.displayMode=e.displayMode),e.panelWidth&&(this.state.panelWidth=e.panelWidth),e.panelHeight&&(this.state.panelHeight=e.panelHeight),e.defaultModel&&(this.state.defaultModel=e.defaultModel),e.defaultTemperature&&(this.state.defaultTemperature=e.defaultTemperature)}getConversations(){return this.state.conversations}setCurrentConversation(e){if(this.state.currentConversation===e)throw Error("Conversation is already current");this.state.currentConversation=e||null,e&&(this.setView("conversation"),this.jodit.e.fire("conversationSwitched.ai-assistant-pro",e))}getCurrentConversation(){return this.state.currentConversation}removeConversation(e){let t=this.state.conversations.filter(t=>t.id!==e);this.setConversations(t)}setLoading(e){this.state.isLoading=e}isLoading(){return this.state.isLoading}setError(e){this.state.error=e,e&&this.jodit.e.fire("error.ai-assistant-pro",Error(e))}getError(){return this.state.error}clearError(){this.setError(null)}setPendingToolCalls(e){this.state.pendingToolCalls=e}getPendingToolCalls(){return this.state.pendingToolCalls}addPendingToolCall(e){let t=[...this.state.pendingToolCalls,e];this.setPendingToolCalls(t)}removePendingToolCall(e){let t=this.state.pendingToolCalls.filter(t=>t.id!==e);this.setPendingToolCalls(t)}updateToolCallStatus(e,t){let u=this.state.pendingToolCalls.map(u=>u.id===e?(0,i._)((0,s._)({},u),{status:t}):u);this.setPendingToolCalls(u)}setSelectionContexts(e){this.state.selectionContexts=e}getSelectionContexts(){return this.state.selectionContexts}addSelectionContext(e){let{maxContextRanges:t}=this.jodit.o.aiAssistantPro,u=[...this.state.selectionContexts,e];u.length>t&&(u=u.slice(-t)),this.setSelectionContexts(u),this.jodit.e.fire("contextAdded.ai-assistant-pro",e)}removeSelectionContext(e){let t=this.state.selectionContexts.filter((t,u)=>u!==e);this.setSelectionContexts(t),this.jodit.e.fire("contextRemoved.ai-assistant-pro",e)}clearSelectionContexts(){this.setSelectionContexts([])}setAbortController(e){this.state.abortController=e}getAbortController(){return this.state.abortController}setEditingMessageId(e){this.state.editingMessageId=e}getEditingMessageId(){return this.state.editingMessageId}isEditingMessage(){return null!=this.state.editingMessageId}clearEditingMessage(){this.setEditingMessageId(null)}reset(){this.state=this.createInitialState()}destruct(){this.state.abortController&&this.state.abortController.abort(),this.reset()}constructor(e){(0,n._)(this,"jodit",void 0),(0,n._)(this,"state",void 0),this.jodit=e,this.state=this.createInitialState()}}},62895:function(e,t,u){"use strict";u.d(t,{WebStorageConversationStorage:function(){return n.WebStorageConversationStorage},createStorageProvider:function(){return n.createStorageProvider}});var n=u(21064)},21064:function(e,t,u){"use strict";u.d(t,{WebStorageConversationStorage:function(){return o},createStorageProvider:function(){return a},generateConversationId:function(){return l},generateMessageId:function(){return F}});var n=u(77688),s=u(82749),i=u(56075),r=u(97333);class o{close(){return this.storage.close()}getConversationKey(e){return`conv:${e}`}getAllKeys(){return(0,n._)(function*(){let e=yield this.storage.get("__conversation_index__");return e&&Array.isArray(e)?e:[]}).call(this)}updateIndex(e){return(0,n._)(function*(){yield this.storage.set("__conversation_index__",e)}).call(this)}addToIndex(e){return(0,n._)(function*(){let t=yield this.getAllKeys();t.includes(e)||(t.push(e),yield this.updateIndex(t))}).call(this)}removeFromIndex(e){return(0,n._)(function*(){let t=(yield this.getAllKeys()).filter(t=>t!==e);yield this.updateIndex(t)}).call(this)}list(e){return(0,n._)(function*(){try{let n=yield this.getAllKeys(),s=[],i=null==e?void 0:e.toLowerCase().trim();for(let e of n){var t,u;let n=yield this.get(e);if(n){if(i){let e=null==(u=n.title)?void 0:u.toLowerCase().includes(i),t=!e&&n.messages.some(e=>e.content.toLowerCase().includes(i));if(!e&&!t)continue}s.push({id:n.id,title:null!=(t=n.title)?t:"",created:n.created,updated:n.updated,messageCount:n.messages.length})}}return s.sort((e,t)=>t.updated-e.updated),s}catch(e){return[]}}).call(this)}get(e){return(0,n._)(function*(){try{let t=this.getConversationKey(e);return(yield this.storage.get(t))||null}catch(e){return null}}).call(this)}save(e){return(0,n._)(function*(){try{if(0===e.messages.length)throw Error("Conversation must have at least one message.");let t=yield this.getAllKeys();t.length>=this.maxConversations&&!t.includes(e.id)&&(yield this.evictOldest());let u=this.getConversationKey(e.id);yield this.storage.set(u,e),yield this.addToIndex(e.id)}catch(t){if((null==t?void 0:t.name)==="QuotaExceededError"||(null==t?void 0:t.code)===22||(null==t?void 0:t.code)===1014){yield this.evictOldest();try{let t=this.getConversationKey(e.id);yield this.storage.set(t,e),yield this.addToIndex(e.id)}catch(e){throw Error("Storage quota exceeded. Please delete some conversations.")}}else throw Error(`Failed to save conversation: ${(null==t?void 0:t.message)||"Unknown error"}`)}}).call(this)}delete(e){return(0,n._)(function*(){try{let t=this.getConversationKey(e);yield this.storage.delete(t),yield this.removeFromIndex(e)}catch(e){}}).call(this)}clear(){return(0,n._)(function*(){try{for(let e of yield this.getAllKeys()){let t=this.getConversationKey(e);yield this.storage.delete(t)}yield this.updateIndex([])}catch(e){}}).call(this)}evictOldest(){return(0,n._)(function*(){try{let e=yield this.list();if(0===e.length)return;e.sort((e,t)=>e.updated-t.updated);let t=e[0];yield this.delete(t.id)}catch(e){}}).call(this)}getGlobalSettings(){return(0,n._)(function*(){try{return(yield this.storage.get("global-settings"))||null}catch(e){return null}}).call(this)}saveGlobalSettings(e){return(0,n._)(function*(){try{let t=yield this.getGlobalSettings(),u=(0,i._)({},t,e);yield this.storage.set("global-settings",u)}catch(e){throw Error("Failed to save global settings")}}).call(this)}constructor(e,t){(0,s._)(this,"storage",void 0),(0,s._)(this,"maxConversations",void 0),this.storage=e,this.maxConversations=t}}function a(e,t){return r.AsyncStorage.makeStorage(e,t)}function l(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}function F(){return`msg_${Date.now()}_${Math.random().toString(36).substring(2,11)}`}},55487:function(e,t,u){"use strict";u.d(t,{ToolRegistry:function(){return o}});var n=u(77688),s=u(82749),i=u(56075),r=u(53835);class o{registerBuiltInTools(e){e.forEach(e=>{let t=r.BUILT_IN_TOOLS[e];t&&this.tools.set(e,t)})}registerCustomTools(e){e.forEach(e=>{this.validateToolDefinition(e),this.tools.set(e.name,e)})}validateToolDefinition(e){if(!e.name||"string"!=typeof e.name)throw Error("Tool must have a valid name");if(!e.description||"string"!=typeof e.description)throw Error(`Tool "${e.name}" must have a description`);if(!Array.isArray(e.parameters))throw Error(`Tool "${e.name}" must have a parameters array`);if("function"!=typeof e.execute)throw Error(`Tool "${e.name}" must have an execute function`);e.parameters.forEach(t=>{if(!t.name||"string"!=typeof t.name)throw Error(`Tool "${e.name}" has a parameter without a valid name`);if(!t.type)throw Error(`Tool "${e.name}" parameter "${t.name}" must have a type`);if("boolean"!=typeof t.required)throw Error(`Tool "${e.name}" parameter "${t.name}" must specify if it's required`)})}getAllTools(){return Array.from(this.tools.values())}getTool(e){return this.tools.get(e)}hasTool(e){return this.tools.has(e)}getToolNames(){return Array.from(this.tools.keys())}executeTool(e,t,u){return(0,n._)(function*(){let n=this.getTool(e);if(!n)throw Error(`Tool "${e}" not found`);let s=this.applyDefaults(n,t);this.validateArguments(n,s);try{return yield n.execute(this.jodit,s,u)}catch(e){if((null==e?void 0:e.name)==="AbortError"||u.aborted)throw Error("Tool execution was aborted");throw e}}).call(this)}validateArguments(e,t){let u=Object.keys(t);for(let t of e.parameters.filter(e=>e.required).map(e=>e.name))if(!u.includes(t))throw Error(`Tool "${e.name}" requires parameter "${t}"`);for(let[u,n]of Object.entries(t)){let t=e.parameters.find(e=>e.name===u);if(!t){this.jodit.o.aiAssistantPro.debug;continue}let s=Array.isArray(n)?"array":"object"==typeof n&&null!=n?"object":typeof n;if(t.type!==s&&!("number"===t.type&&"string"===s&&!isNaN(Number(n))))throw Error(`Tool "${e.name}" parameter "${u}" expects type "${t.type}" but got "${s}"`);if(t.enum&&t.enum.length>0&&!t.enum.includes(n))throw Error(`Tool "${e.name}" parameter "${u}" must be one of: ${t.enum.join(", ")}`)}}applyDefaults(e,t){let u=(0,i._)({},t);for(let t of e.parameters)void 0===u[t.name]&&void 0!==t.default&&(u[t.name]=t.default);return u}destruct(){this.tools.clear()}constructor(e){(0,s._)(this,"jodit",void 0),(0,s._)(this,"tools",void 0),this.jodit=e,this.tools=new Map,this.registerBuiltInTools(e.o.aiAssistantPro.enabledTools||[]),this.registerCustomTools(e.o.aiAssistantPro.customTools||[])}}},26612:function(e){e.exports={"AI Assistant":"AI Assistant","AI Assistant Pro":"AI Assistant Pro","Welcome to AI Assistant":"Welcome to AI Assistant","Start your first conversation":"Start your first conversation","Tip: Select text in editor to add context":"Tip: Select text in editor to add context","New Chat":"New Chat","Search conversations...":"Search conversations...","No conversations yet":"No conversations yet","Ask me anything...":"Ask me anything...","Ask a follow-up...":"Ask a follow-up...","Reply...":"Reply...","Type your message...":"Type your message...",Send:"Send",Cancel:"Cancel",Retry:"Retry",Insert:"Insert",Copy:"Copy",Edit:"Edit",Delete:"Delete",New:"New",Back:"Back","Permission Required":"Permission Required",Approve:"Approve",Deny:"Deny",Once:"Once","This conversation":"This conversation",Always:"Always","The AI wants to execute:":"The AI wants to execute:","This will modify your document content.":"This will modify your document content.","Executing...":"Executing...","Completed successfully":"Completed successfully",Failed:"Failed","Pending approval":"Pending approval","Denied by user":"Denied by user","Tool Result":"Tool Result","Tool Execution Error":"Tool Execution Error",Context:"Context",Contexts:"Contexts","Add to AI Context":"Add to AI Context",Remove:"Remove","Clear all":"Clear all","An error occurred":"An error occurred","Request failed":"Request failed","Connection error":"Connection error","AI Assistant is not configured":"AI Assistant is not configured","Thinking...":"Thinking...","Generating response...":"Generating response...",insertHTML:"Insert HTML",readDocument:"Read Document",readBlock:"Read Block",replaceInDocument:"Replace in Document",replaceInBlock:"Replace in Block",getSelection:"Get Selection","Just now":"Just now",Conversation:"Conversation","New Conversation":"New Conversation",Yesterday:"Yesterday","Delete conversation":"Delete conversation","Are you sure you want to delete this conversation?":"Are you sure you want to delete this conversation?","Failed to delete conversation":"Failed to delete conversation"}},63805:function(e,t,u){"use strict";u.r(t),u.d(t,{en:function(){return s.a},ru:function(){return r.a}});var n=u(26612),s=u.n(n),i=u(55790),r=u.n(i)},55790:function(e){e.exports={"AI Assistant":"AI Ассистент","AI Assistant Pro":"AI Ассистент Pro","Welcome to AI Assistant":"Добро пожаловать в AI Ассистент","Start your first conversation":"Начните первый диалог","Tip: Select text in editor to add context":"Подсказка: Выделите текст в редакторе для добавления контекста","New chat":"Новый чат","Search conversations...":"Поиск диалогов...","No conversations yet":"Пока нет диалогов","Ask me anything...":"Спросите меня о чем угодно...","Ask a follow-up...":"Задайте дополнительный вопрос...","Reply...":"Ответить...","Type your message...":"Введите ваше сообщение...",Send:"Отправить",Cancel:"Отмена",Retry:"Повторить",Insert:"Вставить",Copy:"Копировать",Edit:"Редактировать",Delete:"Удалить",New:"Новый",Back:"Назад","Permission Required":"Требуется разрешение",Approve:"Разрешить",Deny:"Отклонить",Once:"Один раз","This conversation":"Этот диалог",Always:"Всегда","The AI wants to execute:":"AI хочет выполнить:","This will modify your document content.":"Это изменит содержимое вашего документа.","Executing...":"Выполняется...","Completed successfully":"Успешно выполнено",Failed:"Ошибка","Pending approval":"Ожидает разрешения","Denied by user":"Отклонено пользователем","Tool Result":"Результат инструмента","Tool Execution Error":"Ошибка выполнения инструмента",Context:"Контекст",Contexts:"Контексты","Add to AI Context":"Добавить в контекст AI",Remove:"Удалить","Clear all":"Очистить все","An error occurred":"Произошла ошибка","Request failed":"Запрос не выполнен","Connection error":"Ошибка соединения","AI Assistant is not configured":"AI Ассистент не настроен","Thinking...":"Думаю...","Generating response...":"Генерирую ответ...",insertHTML:"Вставить HTML",readDocument:"Прочитать документ",readBlock:"Прочитать блок",replaceInDocument:"Заменить в документе",replaceInBlock:"Заменить в блоке",getSelection:"Получить выделение","Just now":"Только что",Conversation:"Диалог","New Conversation":"Новый диалог",Yesterday:"Вчера","Delete conversation":"Удалить диалог","Are you sure you want to delete this conversation?":"Вы уверены, что хотите удалить этот диалог?","Failed to delete conversation":"Не удалось удалить диалог",Settings:"Настройки","General Settings":"Общие настройки","Conversation Settings":"Настройки диалога","Display Mode":"Режим отображения","Panel Width":"Ширина панели",Theme:"Тема",Model:"Модель",Temperature:"Температура",Close:"Закрыть",Dialog:"Модальное окно",Left:"Левая панель",Right:"Правая панель",Top:"Верхняя панель",Bottom:"Нижняя панель",Inherit:"Наследовать от редактора",Light:"Светлая тема",Dark:"Тёмная тема","%dm ago":"%dм назад","%dh ago":"%dч назад"}},94454:function(e,t,u){"use strict";u.d(t,{getAIProviderOptions:function(){return n.getAIProviderOptions},registerAIProvider:function(){return n.registerAIProvider}}),u(82923);var n=u(58211)},82923:function(e,t,u){"use strict";var n=u(89929),s=u(77688),i=u(86127),r=u(56075),o=u(11886),a=u(25415),l=u(58211),F=u(54079);(0,l.registerAIProvider)("jodit-ai-adapter",e=>{var t;let u=e.url.replace(/\/+$/,""),l=null!=(t=e.provider)?t:"openai",c=!1!==e.stream;return{apiMode:"incremental",maxRetries:0,textAutocompleteEnabled:!0,textAutocompleteApiRequest:(t,n,i)=>(0,s._)(function*(){var s;let r=new F.Ajax({url:`${u}/ai/autocomplete?query=${encodeURIComponent(t)}&key=${encodeURIComponent(e.apiKey)}`,method:"POST",contentType:"application/json",data:{provider:l,context:{maxSuggestions:n}}});i.addEventListener("abort",()=>r.abort(),{once:!0});let o=yield r.send(),a=yield o.json();return a.success&&(null==(s=a.result)?void 0:s.suggestions)?a.result.suggestions:[]})(),apiRequest:(t,h)=>(0,s._)(function*(){let s=new F.Ajax({url:`${u}/ai/request?key=${encodeURIComponent(e.apiKey)}`,method:"POST",contentType:"application/json",data:{provider:l,context:c?(0,o._)((0,r._)({},t),{metadata:(0,o._)((0,r._)({},t.metadata),{stream:!0})}):t}});if(h&&h.addEventListener("abort",()=>s.abort(),{once:!0}),!c){let e=yield s.send();return{mode:"final",response:(yield e.json()).result}}let d=s.stream();return{mode:"stream",stream:(0,a._)(function*(){var e,t=!1,u=!1;try{for(var s,r=(0,n._)(d);t=!(s=yield(0,i._)(r.next())).done;t=!1){let e=s.value;yield JSON.parse(e)}}catch(t){u=!0,e=t}finally{try{t&&null!=r.return&&(yield(0,i._)(r.return()))}finally{if(u)throw e}}})()}})()}})},58211:function(e,t,u){"use strict";u.d(t,{getAIProviderOptions:function(){return s},registerAIProvider:function(){return i}});let n=new Map;function s(e,t){let u=n.get(e);if(!u)throw Error(`AI provider "${e}" is not registered. Available providers: ${[...n.keys()].join(", ")}`);return u(t)}function i(e,t){n.set(e,t)}},65374:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="addHTML",s="Add HTML content to the beginning or end of the document",i=[{name:"html",type:"string",description:"HTML content to add",required:!0},{name:"position",type:"string",description:'Where to add: "start" adds at the beginning of the document, "end" appends to the end',required:!1,default:"end"}],r=!0},686:function(e,t,u){"use strict";u.d(t,{execute:function(){return o}});var n=u(77688),s=u(6689),i=u(49459),r=u(22732);function o(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html",{allowEmpty:!0}),{position:o="end"}=t;if(!n.trim())return{success:!0,message:"Nothing to add: HTML is empty"};(0,s.throwIfAborted)(u);try{let t=e.createInside.fragment(),u=e.createInside.div();for(u.innerHTML=n;u.firstChild;)t.appendChild(u.firstChild);return"start"===o?r.Dom.prepend(e.editor,t):r.Dom.append(e.editor,t),e.synchronizeValues(),{success:!0,message:`Added ${n.length} characters of HTML at the ${"start"===o?"beginning":"end"} of the document`}}catch(e){throw Error(`Failed to add HTML: ${(null==e?void 0:e.message)||"Unknown error"}`)}})()}},78907:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(65374),r=u(686);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},73943:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="applyFormat",s="Apply or remove inline formatting to the current selection (bold, italic, underline, etc.) or to a specific block",i=[{name:"element",type:"string",description:'HTML element to wrap selection (e.g., "strong", "em", "u", "span")',required:!1},{name:"attributes",type:"object",description:'Attributes to apply (e.g., {"className": "highlight"}, {"style": {"color": "red"}})',required:!1},{name:"remove",type:"boolean",description:"If true, remove the formatting instead of applying it",required:!1,default:!1},{name:"blockIndex",type:"number",description:"Zero-based index of the block to format (if not using current selection)",required:!1},{name:"selector",type:"string",description:"CSS selector to find the block to format (if not using current selection)",required:!1}],r=!0},19127:function(e,t,u){"use strict";u.d(t,{execute:function(){return a}});var n=u(77688),s=u(56075),i=u(11886),r=u(6689),o=u(44526);function a(e,t,u){return(0,n._)(function*(){let{element:n,attributes:a,remove:l,blockIndex:F,selector:c}=t;if((0,r.throwIfAborted)(u),!n&&!a)throw Error('Either "element" or "attributes" must be provided');if(e.s.restore(),void 0!==F||c){let{element:t}=(0,o.resolveBlock)(e,{selector:c,index:F});e.s.select(t)}if(e.s.isCollapsed())throw Error("No selection found. Please select text to format");try{let t={};return n&&(t.element=n),a&&(t.attributes=a),l?e.s.commitStyle((0,i._)((0,s._)({},t),{mode:"remove"})):e.s.commitStyle(t),e.synchronizeValues(),{success:!0,message:l?"Formatting removed successfully":"Formatting applied successfully"}}catch(e){throw Error(`Failed to ${l?"remove":"apply"} formatting: ${e.message}`)}})()}},39296:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(73943),r=u(19127);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},53835:function(e,t,u){"use strict";u.d(t,{BUILT_IN_TOOLS:function(){return d},getToolNames:function(){return p}});var n=u(78907),s=u(39296),i=u(16745),r=u(78717),o=u(5618),a=u(90991),l=u(2020),F=u(12570),c=u(95323),h=u(97603);let d={readDocument:o.default,readBlocks:r.default,readSelection:a.default,writeDocument:h.default,replaceSelection:c.default,replaceBlock:l.default,replaceInDocument:F.default,insertHTML:i.default,addHTML:n.default,applyFormat:s.default};function p(){return Object.keys(d)}},56732:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="insertHTML",s="Insert or replace HTML content at the current cursor position in the editor",i=[{name:"html",type:"string",description:"HTML content to insert",required:!0},{name:"replace",type:"boolean",description:"If true, replaces current selection. If false, inserts at cursor",required:!1,default:!1}],r=!0},39592:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html",{allowEmpty:!0}),{replace:r}=t;if(!n.trim())return{success:!0,message:"Nothing to insert: HTML is empty"};(0,s.throwIfAborted)(u);try{return e.s.focus(),r&&!e.s.isCollapsed()&&e.s.remove(),e.s.insertHTML(n),e.synchronizeValues(),{success:!0,message:`Inserted ${n.length} characters of HTML`}}catch(e){throw Error(`Failed to insert HTML: ${(null==e?void 0:e.message)||"Unknown error"}`)}})()}},16745:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(56732),r=u(39592);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},75352:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readBlocks",s="Read blocks from the editor with optional filtering and pagination",i=[{name:"offset",type:"number",description:"Number of blocks to skip from the beginning (default: 0)",required:!1,default:0},{name:"limit",type:"number",description:"Maximum number of blocks to return (default: all)",required:!1},{name:"query",type:"string",description:"Filter blocks by text content",required:!1}],r=!1},91140:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(22732);function r(e,t,u){return(0,n._)(function*(){let{offset:n,limit:r,query:o}=t;(0,s.throwIfAborted)(u);let a=[];Array.from(e.editor.children).forEach((e,t)=>{i.Dom.isElement(e)&&a.push({blockIndex:t,tagName:e.tagName.toLowerCase(),content:e.innerHTML,textContent:e.textContent||"",classList:Array.from(e.classList)})});let l=a;if(o&&"string"==typeof o){let e=o.toLowerCase();l=a.filter(t=>t.textContent.toLowerCase().includes(e)||t.tagName.includes(e)||t.content.toLowerCase().includes(e))}let F=Math.max(0,Math.min("number"==typeof n?n:0,l.length)),c=void 0!==r?Math.min(F+r,l.length):l.length;return{blocks:l.slice(F,c),total:a.length,offset:F,limit:void 0!==r?r:void 0}})()}},78717:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(75352),r=u(91140);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},93809:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readDocument",s="Read the entire content of the editor document in HTML format",i=[{name:"start",type:"number",description:"Start character position (default: 0)",required:!1,default:0},{name:"end",type:"number",description:"End character position (default: length of document)",required:!1},{name:"aroundSelection",type:"boolean",description:"If true, return only the maximum block around the current selection",required:!1,default:!1}],r=!1},28157:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(22732);function r(e,t,u){return(0,n._)(function*(){let{start:n,end:r,aroundSelection:o}=t;(0,s.throwIfAborted)(u);let a=e.value,l=a.length;if(o&&!e.s.isCollapsed()){let t=e.s.range.commonAncestorContainer;for(;t&&t!==e.editor;){if(i.Dom.isElement(t)&&t.parentNode===e.editor){a=t.outerHTML;break}t=t.parentNode}return{html:a,length:l}}let F=void 0!==r?Math.min(r,l):l,c=Math.max(0,Math.min("number"==typeof n?n:0,l));return(c>0||l>F)&&(a=a.substring(c,F)),{html:a,length:l,start:c,end:F}})()}},5618:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(93809),r=u(28157);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},52826:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="readSelection",s="Get information about the current selection including HTML content and optional context",i=[{name:"contextCharsBefore",type:"number",description:"Number of characters to include before the selection",required:!1,default:0},{name:"contextCharsAfter",type:"number",description:"Number of characters to include after the selection",required:!1,default:0}],r=!1},85130:function(e,t,u){"use strict";u.d(t,{execute:function(){return i}});var n=u(77688),s=u(6689);function i(e,t,u){return(0,n._)(function*(){let{contextCharsBefore:n,contextCharsAfter:i}=t;if((0,s.throwIfAborted)(u),e.s.restore(),e.s.isCollapsed())return{hasSelection:!1};let r=e.s.html,o=e.s.range,a=o.toString(),l={hasSelection:!0,html:r,text:a,startContainer:o.startContainer.nodeName,endContainer:o.endContainer.nodeName};if(n>0||i>0){let t=e.editor.textContent||"",u=t.substring(0,t.indexOf(a)),s=t.substring(t.indexOf(a)+a.length);n>0&&(l.contextBefore=u.slice(-n)),i>0&&(l.contextAfter=s.slice(0,i))}return l})()}},90991:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(52826),r=u(85130);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},96675:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceBlock",s="Replace a specific block in the document by its index or CSS selector with new HTML content",i=[{name:"index",type:"number",description:"Zero-based index of the block to replace (use either index or selector, not both)",required:!1},{name:"selector",type:"string",description:'CSS selector to find the block to replace (e.g., "h1", ".my-class", "#my-id"). Use either selector or index, not both',required:!1},{name:"html",type:"string",description:"HTML content for the new block",required:!0}],r=!0},3091:function(e,t,u){"use strict";u.d(t,{execute:function(){return a}});var n=u(77688),s=u(6689),i=u(49459),r=u(44526),o=u(22732);function a(e,t,u){return(0,n._)(function*(){let{index:n,selector:a}=t,l=(0,i.requireString)(t,"html");if((0,s.throwIfAborted)(u),void 0===n&&!a||void 0!==n&&a)throw Error("Either index or selector must be provided, but not both");let{element:F,identifier:c}=(0,r.resolveBlock)(e,{selector:a,index:n,requireExactlyOne:!0});try{var h;let t=e.createInside.div();t.innerHTML=l;let u=t.firstChild;if(!u||!o.Dom.isElement(u))throw Error("Invalid HTML: must contain at least one element");return null==(h=F.parentNode)||h.replaceChild(u,F),e.synchronizeValues(),{success:!0,message:`Block ${c} replaced successfully`}}catch(e){throw Error(`Failed to replace block ${c}: ${e.message}`)}})()}},2020:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(96675),r=u(3091);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},62553:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceInDocument",s="Find and replace text or HTML patterns throughout the entire document",i=[{name:"search",type:"string",description:"Text or pattern to search for",required:!0},{name:"replace",type:"string",description:"Replacement text or HTML",required:!0},{name:"useRegex",type:"boolean",description:"If true, treats search as a regular expression",required:!1,default:!1},{name:"useSelector",type:"string",description:"CSS selector to narrow down the search scope to specific elements",required:!1}],r=!0},56293:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"search"),r=(0,i.requireString)(t,"replace",{allowEmpty:!0}),{useRegex:o,useSelector:a}=t;(0,s.throwIfAborted)(u);try{let t;e.s.focus(),e.s.save();let i=0;if(a){let l=function(e,t,u,n,i,r){let o=e.editor.querySelectorAll(i);if(0===o.length)return{replacements:0,message:`No elements found matching selector "${i}"`};let a=0;return o.forEach(e=>{(0,s.throwIfAborted)(r);let i=e.innerHTML,o=i;if(n)try{let e=RegExp(t,"g");i=i.replace(e,()=>(a++,u))}catch(e){throw Error(`Invalid regex pattern: ${(null==e?void 0:e.message)||"Unknown error"}`)}else{let e=t.length,n=0;for(;-1!==(n=i.indexOf(t,n));)(0,s.throwIfAborted)(r),i=i.substring(0,n)+u+i.substring(n+e),n+=u.length,a++}i!==o&&(e.innerHTML=i)}),a>0&&(e.synchronizeValues(),e.s.restore()),{replacements:a}}(e,n,r,o,a,u);i=l.replacements,t=l.message}else i=function(e,t,u,n,i,r){let o=0,a=t;if(i)try{let e=RegExp(u,"g");a=a.replace(e,()=>(o++,n))}catch(e){throw Error(`Invalid regex pattern: ${(null==e?void 0:e.message)||"Unknown error"}`)}else{let e=u.length,t=0;for(;-1!==(t=a.indexOf(u,t));)(0,s.throwIfAborted)(r),a=a.substring(0,t)+n+a.substring(t+e),t+=n.length,o++}return o>0&&(e.value=a,e.s.restore(),e.synchronizeValues()),o}(e,e.value,n,r,o,u);return{replacements:i,message:t||(i>0?`Replaced ${i} occurrence(s)`:"No matches found")}}catch(t){throw e.s.restore(),Error(`Failed to replace in document: ${(null==t?void 0:t.message)||"Unknown error"}`)}})()}},12570:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(62553),r=u(56293);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},70750:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="replaceSelection",s="Replace the current selection with new HTML content",i=[{name:"html",type:"string",description:"HTML content to insert in place of the selection",required:!0},{name:"collapseToEnd",type:"boolean",description:"Move cursor to the end of the inserted content",required:!1,default:!0}],r=!0},36142:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html"),{collapseToEnd:r}=t;(0,s.throwIfAborted)(u);try{if(e.s.restore(),e.s.insertHTML(n),r){let t=e.s.range;t.collapse(!1),e.s.selectRange(t)}return e.e.fire("change"),{success:!0,message:"Selection replaced successfully"}}catch(e){throw Error(`Failed to replace selection: ${e.message}`)}})()}},95323:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(70750),r=u(36142);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},90022:function(e,t,u){"use strict";u.r(t),u.d(t,{description:function(){return s},name:function(){return n},parameters:function(){return i},requiresPermission:function(){return r}});let n="writeDocument",s="Write (replace) the entire document content with new HTML",i=[{name:"html",type:"string",description:"HTML content to set as the document",required:!0}],r=!0},79766:function(e,t,u){"use strict";u.d(t,{execute:function(){return r}});var n=u(77688),s=u(6689),i=u(49459);function r(e,t,u){return(0,n._)(function*(){let n=(0,i.requireString)(t,"html",{allowEmpty:!0});(0,s.throwIfAborted)(u);try{return e.s.focus(),e.value=n,e.synchronizeValues(),{success:!0,message:`Document content was replaced with provided HTML(${n.length} characters)`}}catch(e){throw Error(`Failed to replace HTML: ${(null==e?void 0:e.message)||"Unknown error"}`)}})()}},97603:function(e,t,u){"use strict";var n=u(56075),s=u(11886),i=u(90022),r=u(79766);t.default=(0,s._)((0,n._)({},i),{execute:r.execute})},80453:function(e,t,u){"use strict";u.d(t,{UIConversationListItem:function(){return l}});var n=u(82749),s=u(31635),i=u(65478),r=u(67510),o=u(62843),a=u(80870);class l extends r.UIElement{className(){return"UIConversationListItem"}render(){return'<div class="jodit-ui-conversation-list__item"></div>'}setActive(e){this.isActive=e,this.updateContent()}updateContent(){let e=this.container;e.innerHTML="",e.setAttribute("data-id",this.conversation.id),this.isActive?e.classList.add("jodit-ui-conversation-list__item_active"):e.classList.remove("jodit-ui-conversation-list__item_active");let t=this.j.c.div("jodit-ui-conversation-list__item-avatar");t.textContent="AI",e.appendChild(t);let u=this.j.c.div("jodit-ui-conversation-list__item-wrapper"),n=this.j.c.div("jodit-ui-conversation-list__item-content"),s=this.j.c.div("jodit-ui-conversation-list__item-title");if(s.textContent=this.conversation.title,this.titleElement=s,n.appendChild(s),this.opts.showTimestamps){let e=this.j.c.div("jodit-ui-conversation-list__item-meta");e.textContent=this.opts.formatTimestamp(this.conversation.updated,this.j.i18n.bind(this.j)),n.appendChild(e)}if(u.appendChild(n),this.conversation.messageCount>0){let e=this.j.c.div("jodit-ui-conversation-list__item-badge");e.textContent=String(this.conversation.messageCount),u.appendChild(e)}e.appendChild(u),this.actionsButton||(this.actionsButton=new o.UIButton(this.j,{icon:{name:"dots"},tooltip:"Actions",name:"conversationActions",size:"tiny"}),this.actionsButton.container.classList.add("jodit-ui-conversation-list__item-actions"),this.actionsButton.onAction(e=>{e.stopPropagation(),this.showActionsMenu(e)})),e.appendChild(this.actionsButton.container)}onClick(){this.isRenaming||this.j.e.fire("selectConversation.ai-assistant-pro",this.conversation.id)}showActionsMenu(e){if(!this.contextMenu||!this.actionsButton)return;let t=this.actionsButton.container.getBoundingClientRect();this.contextMenu.show(t.left,t.bottom,[{title:"Rename",icon:"pencil",exec:()=>{this.startInlineRename()}},{title:"Delete",icon:"bin",exec:()=>{this.onDelete()}}]),e.stopPropagation()}startInlineRename(){if(this.isRenaming||!this.titleElement)return;this.isRenaming=!0;let e=this.titleElement,t=this.conversation.title,u=this.j.c.element("input");u.type="text",u.value=t,u.className="jodit-ui-conversation-list__item-title-input",e.textContent="",e.appendChild(u),u.focus(),u.select();let n=()=>{if(!this.isRenaming)return;let n=u.value.trim();this.isRenaming=!1,n&&n!==t?(e.textContent=n,this.j.e.fire("renameConversation.ai-assistant-pro",this.conversation.id,n)):e.textContent=t};this.j.e.on(u,"blur",n),this.j.e.on(u,"keydown",n=>{"Enter"===n.key&&(n.preventDefault(),u.blur()),"Escape"===n.key&&(this.isRenaming=!1,e.textContent=t)}),this.j.e.on(u,"click",e=>{e.stopPropagation()})}onDelete(){this.j.e.fire("deleteConversation.ai-assistant-pro",this.conversation.id)}destruct(){var e,t;null==(e=this.actionsButton)||e.destruct(),null==(t=this.contextMenu)||t.destruct(),super.destruct()}constructor(e,t,u=!1,s){super(e),(0,n._)(this,"opts",void 0),(0,n._)(this,"conversation",void 0),(0,n._)(this,"isActive",void 0),(0,n._)(this,"actionsButton",void 0),(0,n._)(this,"contextMenu",void 0),(0,n._)(this,"titleElement",void 0),(0,n._)(this,"isRenaming",void 0),this.opts=s,this.actionsButton=null,this.contextMenu=null,this.titleElement=null,this.isRenaming=!1,this.conversation=t,this.isActive=u,this.contextMenu=new a.ContextMenu(this.j),this.updateContent()}}(0,s.__decorate)([(0,i.watch)("container:click")],l.prototype,"onClick",null),(0,s.__decorate)([i.autobind],l.prototype,"showActionsMenu",null),(0,s.__decorate)([i.autobind],l.prototype,"startInlineRename",null),(0,s.__decorate)([i.autobind],l.prototype,"onDelete",null),l=(0,s.__decorate)([i.component],l)},68365:function(e,t,u){"use strict";u.d(t,{UIConversationList:function(){return F}});var n=u(82749),s=u(31635),i=u(31356),r=u(80453),o=u(65478),a=u(80256),l=u(62405);class F extends l.UIGroup{className(){return"UIConversationList"}render(){return`<div class="&__container">
|
|
11
11
|
<div class="&__header"></div>
|
|
12
12
|
<div class="&__search">
|
|
13
13
|
<div class="&__search-loader"></div>
|
|
@@ -35,7 +35,7 @@ ${i}`.trim();u?yield this.__executeQuickCommandSilent(a,i):yield this.__executeQ
|
|
|
35
35
|
<div class="&__loading-spinner"></div>
|
|
36
36
|
</div>
|
|
37
37
|
<div class="&__footer"></div>
|
|
38
|
-
</div>`}addResize(){}afterRender(){this.content=this.getElm("content"),this.headerContextMenu=new C.ContextMenu(this.j),this.createComponents(),this.createHeaderButtons(),this.setupConversationRenameHandler(),this.__updateView("welcome")}__onChangeView(){return(0,n._)(function*(){this.__updateView(this.state.currentView,this.state.currentConversation)}).call(this)}createComponents(){this.welcomeScreen=new c.UIWelcomeScreen(this.j),this.conversationList=new r.UIConversationList(this.j,this.options),this.messageList=new a.UIMessageList(this.j,this.options),this.inputArea=new o.UIInputArea(this.j,this.options),this.getElm("footer").appendChild(this.inputArea.container)}createHeaderButtons(){let e=this.getElm("header-left"),t=this.getElm("header-right"),u=new A.UIButton(this.j,{icon:{name:"angle-left"},size:"small",variant:"initial"});u.container.classList.add(this.getFullElName("back-button")),this.j.e.on(u,"click",()=>{this.j.e.fire("backToList.ai-assistant-pro")}),e.appendChild(u.container),this.conversationActionsButton=new A.UIButton(this.j,{icon:{name:"dots"},size:"small",tooltip:"Conversation actions",variant:"initial"}),this.conversationActionsButton.container.classList.add(this.getFullElName("conversation-actions-button")),this.conversationActionsButton.onAction(this.showConversationActionsMenu),t.appendChild(this.conversationActionsButton.container);let n=new A.UIButton(this.j,{icon:{name:"plus"},size:"small",tooltip:"New chat",variant:"initial"});if(n.container.classList.add(this.getFullElName("new-button")),this.j.e.on(n,"click",()=>{this.j.e.fire("newConversation.ai-assistant-pro")}),t.appendChild(n.container),this.shouldShowSettings()&&(this.settingsButton=new F.UISettingsButton(this.j,this.state,this.options,()=>this.state.currentConversation,this.updateConversation),this.settingsButton.container.classList.add(this.getFullElName("settings-button")),t.appendChild(this.settingsButton.container)),"dialog"===this.mods.displayMode||!1===this.mods.allowClose)return;let s=new A.UIButton(this.j,{icon:{name:"cancel"},size:"small",tooltip:"Close",variant:"initial"});s.container.classList.add(this.getFullElName("close-button")),this.j.e.on(s,"click",()=>{this.j.e.fire("closeAIAssistantPro.ai-assistant-pro")}),t.appendChild(s.container)}setupConversationRenameHandler(){}showConversationActionsMenu(e){if(!this.headerContextMenu||!this.state.currentConversation)return;let t=this.state.currentConversation,u=[{title:"Rename",icon:"pencil",exec:()=>{this.showRenamePrompt(t.id,t.title||this.j.i18n("Conversation"))}},{title:"Delete",icon:"bin",exec:()=>{this.j.e.fire("deleteConversation.ai-assistant-pro",t.id)}}],n=this.conversationActionsButton.container.getBoundingClientRect();this.headerContextMenu.show(n.left,n.bottom,u),e.stopPropagation()}showRenamePrompt(e,t){if(this.isEditingTitle)return;this.isEditingTitle=!0;let u=this.getElm("header-title"),n=this.j.c.element("input");n.type="text",n.value=t,n.className=this.getFullElName("header-title-input"),u.textContent="",u.appendChild(n),n.focus(),n.select();let s=()=>{let s=n.value.trim();this.isEditingTitle=!1,s&&s!==t?(this.j.e.fire("renameConversation.ai-assistant-pro",e,s),u.textContent=s):u.textContent=t};this.j.e.on(n,"blur",s),this.j.e.on(n,"keydown",e=>{"Enter"===e.key&&(e.preventDefault(),n.blur()),"Escape"===e.key&&(this.isEditingTitle=!1,u.textContent=t)})}isFlightMode(){return"flight"===this.mods.displayMode}shouldShowSettings(){let e=this.options,t=e.allowEditDisplayMode||e.allowEditPanelWidth,u=e.allowEditDialogSettings;return t||u}__updateView(e,t=null){var u;null==(u=this.settingsButton)||u.update();let n=this.getElm("header-title");this.setMod("view",e);let s=this.isFlightMode();switch(e){case"welcome":n.textContent=this.j.i18n("AI Assistant"),d.Dom.safeRemove(this.conversationList.container),d.Dom.safeRemove(this.messageList.container),this.content.appendChild(this.welcomeScreen.container),this.inputArea.focus();break;case"conversationList":n.textContent=this.j.i18n("AI Assistant"),d.Dom.safeRemove(this.welcomeScreen.container),d.Dom.safeRemove(this.messageList.container),this.conversationList.container.isConnected||this.content.appendChild(this.conversationList.container);break;case"conversation":n.textContent=s?this.j.i18n("AI Assistant"):(null==t?void 0:t.title)||this.j.i18n("Conversation"),d.Dom.safeRemove(this.welcomeScreen.container),d.Dom.safeRemove(this.conversationList.container),this.messageList.container.isConnected||this.content.appendChild(this.messageList.container),t&&this.messageList.setMessages(t.messages),this.inputArea.focus()}}onChangeCurrentConversation(){let{currentConversation:e}=this.state;e&&(this.conversationList.setActiveConversation(e.id),this.messageList.setMessages(e.messages))}onChangeConversations(){this.conversationList.setConversations(this.state.conversations)}onChangeSelectionContexts(){this.inputArea.setContexts(this.state.selectionContexts)}onChangeLoading(){this.inputArea.setLoading(this.state.isLoading)}onChangePendingToolCalls(){this.state.pendingToolCalls&&this.state.pendingToolCalls.length>0?this.showPermissionRequest(this.state.pendingToolCalls[0]):this.hidePermissionRequest()}showPermissionRequest(e){this.permissionRequest||(this.permissionRequest=new l.UIPermissionRequest(this.j,this.options)),this.permissionRequest.setToolCall(e);let t=this.getElm("footer");t.contains(this.permissionRequest.container)||t.insertBefore(this.permissionRequest.container,this.inputArea.container)}hidePermissionRequest(){this.permissionRequest&&this.permissionRequest.container.parentNode&&this.permissionRequest.container.parentNode.removeChild(this.permissionRequest.container)}destruct(){var e,t,u,n,s,i,r,o;null==(e=this.welcomeScreen)||e.destruct(),null==(t=this.conversationList)||t.destruct(),null==(u=this.messageList)||u.destruct(),null==(n=this.inputArea)||n.destruct(),null==(s=this.permissionRequest)||s.destruct(),null==(i=this.settingsButton)||i.destruct(),null==(r=this.conversationActionsButton)||r.destruct(),null==(o=this.headerContextMenu)||o.destruct(),super.destruct()}constructor(e,t,u,n){super(e),(0,s._)(this,"state",void 0),(0,s._)(this,"options",void 0),(0,s._)(this,"updateConversation",void 0),(0,s._)(this,"permissionRequest",void 0),(0,s._)(this,"settingsButton",void 0),(0,s._)(this,"content",void 0),(0,s._)(this,"isEditingTitle",void 0),(0,s._)(this,"conversationActionsButton",void 0),(0,s._)(this,"headerContextMenu",void 0),this.state=t,this.options=u,this.updateConversation=n,this.permissionRequest=null,this.settingsButton=null,this.isEditingTitle=!1,this.conversationActionsButton=null,this.headerContextMenu=null}}(0,i.__decorate)([(0,h.hook)("ready")],E.prototype,"afterRender",null),(0,i.__decorate)([(0,h.watch)(["state.currentView","state.currentConversation"])],E.prototype,"__onChangeView",null),(0,i.__decorate)([h.autobind],E.prototype,"showConversationActionsMenu",null),(0,i.__decorate)([h.autobind],E.prototype,"showRenamePrompt",null),(0,i.__decorate)([(0,h.watch)("state.currentConversation")],E.prototype,"onChangeCurrentConversation",null),(0,i.__decorate)([(0,h.watch)("state.conversations")],E.prototype,"onChangeConversations",null),(0,i.__decorate)([(0,h.watch)("state.selectionContexts")],E.prototype,"onChangeSelectionContexts",null),(0,i.__decorate)([(0,h.watch)("state.isLoading")],E.prototype,"onChangeLoading",null),(0,i.__decorate)([(0,h.watch)("state.pendingToolCalls")],E.prototype,"onChangePendingToolCalls",null),E=(0,i.__decorate)([h.component],E)},81835:function(e,t,u){"use strict";u.d(t,{UIArtifact:function(){return a}});var n=u(82749),s=u(31635),i=u(65478),r=u(29960),o=u(67510);class a extends o.UIElement{className(){return"UIArtifact"}onReady(){this.renderArtifact()}renderArtifact(){let e=this.container;e.innerHTML="",(0,r.attr)(e,{"data-type":this.artifact.type,"data-status":this.artifact.status});let t=this.createStatusIndicator();if(e.appendChild(t),"pending"===this.artifact.status||"generating"===this.artifact.status)return void this.renderLoading();if("failed"===this.artifact.status)return void this.renderError();switch(this.artifact.type){case"image":this.renderImage();break;case"audio":this.renderAudio();break;case"file":this.renderFile();break;case"json":this.renderJSON();break;default:this.renderOther()}}createStatusIndicator(){let e=this.j.c.div(this.getFullElName("status"));e.setAttribute("data-status",this.artifact.status);let t=this.j.c.span(this.getFullElName("status-icon")),u=this.j.c.span(this.getFullElName("status-text"));switch(this.artifact.status){case"pending":t.textContent="⏳",u.textContent=this.j.i18n("Pending");break;case"generating":t.textContent="\uD83D\uDD04",u.textContent=this.j.i18n("Generating...");break;case"ready":t.textContent="✅",u.textContent=this.j.i18n("Ready");break;case"failed":t.textContent="❌",u.textContent=this.j.i18n("Failed")}return e.appendChild(t),e.appendChild(u),e}renderLoading(){let e=this.j.c.div(this.getFullElName("loader")),t=this.j.c.div(this.getFullElName("spinner")),u=this.j.c.div(this.getFullElName("loader-message"));u.textContent=this.j.i18n("Generating artifact..."),e.appendChild(t),e.appendChild(u),this.container.appendChild(e)}renderError(){var e;let t=this.j.c.div(this.getFullElName("error")),u=this.j.c.div(this.getFullElName("error-icon"));u.textContent="❌";let n=this.j.c.div(this.getFullElName("error-message"));n.textContent=(null==(e=this.artifact.metadata)?void 0:e.error)||this.j.i18n("Failed to generate artifact"),t.appendChild(u),t.appendChild(n),this.container.appendChild(t)}renderImage(){var e,t;if(!this.artifact.data)return;let u=this.j.c.div(this.getFullElName("content")),n=this.j.c.element("img",{class:this.getFullElName("image")});if("url"===this.artifact.data.kind)n.src=this.artifact.data.url;else if("base64"===this.artifact.data.kind){let e=this.artifact.mimeType||"image/png";n.src=`data:${e};base64,${this.artifact.data.base64}`}if(n.alt=(null==(e=this.artifact.metadata)?void 0:e.alt)||"AI Generated Image",u.appendChild(n),null==(t=this.artifact.metadata)?void 0:t.caption){let e=this.j.c.div(this.getFullElName("caption"));e.textContent=this.artifact.metadata.caption,u.appendChild(e)}this.container.appendChild(u)}renderAudio(){if(!this.artifact.data)return;let e=this.j.c.div(this.getFullElName("content")),t=this.j.c.element("audio",{class:this.getFullElName("audio"),controls:"controls"});if("url"===this.artifact.data.kind)t.src=this.artifact.data.url;else if("base64"===this.artifact.data.kind){let e=this.artifact.mimeType||"audio/mpeg";t.src=`data:${e};base64,${this.artifact.data.base64}`}e.appendChild(t),this.container.appendChild(e)}renderFile(){var e,t,u;if(!this.artifact.data)return;let n=this.j.c.div(this.getFullElName("content")),s=this.j.c.div(this.getFullElName("file-card")),i=this.j.c.div(this.getFullElName("file-icon"));i.textContent="\uD83D\uDCC4";let r=this.j.c.div(this.getFullElName("file-info")),o=this.j.c.div(this.getFullElName("file-name"));o.textContent=(null==(e=this.artifact.metadata)?void 0:e.filename)||"download.file";let a=this.j.c.div(this.getFullElName("file-size"));(null==(t=this.artifact.metadata)?void 0:t.size)&&(a.textContent=this.formatFileSize(this.artifact.metadata.size)),r.appendChild(o),r.appendChild(a);let l=this.j.c.element("a",{class:this.getFullElName("download-btn"),download:(null==(u=this.artifact.metadata)?void 0:u.filename)||"download.file"});if(l.textContent=this.j.i18n("Download"),"url"===this.artifact.data.kind)l.href=this.artifact.data.url;else if("base64"===this.artifact.data.kind){let e=this.artifact.mimeType||"application/octet-stream";l.href=`data:${e};base64,${this.artifact.data.base64}`}s.appendChild(i),s.appendChild(r),s.appendChild(l),n.appendChild(s),this.container.appendChild(n)}renderJSON(){let e;if(!this.artifact.data)return;let t=this.j.c.div(this.getFullElName("content")),u=this.j.c.element("pre",{class:this.getFullElName("json")}),n=this.j.c.element("code");if("url"===this.artifact.data.kind)n.textContent=this.j.i18n("JSON data at URL");else if("base64"===this.artifact.data.kind)try{let t=atob(this.artifact.data.base64);e=JSON.parse(t),n.textContent=JSON.stringify(e,null,2)}catch(e){n.textContent=this.j.i18n("Invalid JSON data")}u.appendChild(n),t.appendChild(u),this.container.appendChild(t)}renderOther(){let e=this.j.c.div(this.getFullElName("content")),t=this.j.c.div(this.getFullElName("placeholder")),u=this.j.c.div(this.getFullElName("placeholder-icon"));u.textContent="\uD83D\uDCE6";let n=this.j.c.div(this.getFullElName("placeholder-text"));n.textContent=this.j.i18n("Unknown artifact type"),t.appendChild(u),t.appendChild(n),e.appendChild(t),this.container.appendChild(e)}formatFileSize(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(2)} KB`:e<0x40000000?`${(e/1048576).toFixed(2)} MB`:`${(e/0x40000000).toFixed(2)} GB`}updateArtifact(e){this.artifact=e,this.renderArtifact()}constructor(e,t){super(e),(0,n._)(this,"artifact",void 0),this.artifact=t}}(0,s.__decorate)([(0,i.hook)("ready")],a.prototype,"onReady",null),a=(0,s.__decorate)([i.component],a)},51359:function(e,t,u){"use strict";u.d(t,{UIMessageListItem:function(){return h}});var n=u(82749),s=u(31635),i=u(81835),r=u(65478),o=u(67510),a=u(62843),l=u(62405),F=u(12153),c=u(80870);class h extends o.UIElement{className(){return"UIMessageListItem"}render(){return`<div class="${this.getFullElName("message")}"></div>`}onReady(){this.updateContent(),this.contextMenu=new c.ContextMenu(this.j)}updateContent(){let e=this.container;e.innerHTML="",e.setAttribute("data-message-id",this.message.id),e.setAttribute("data-role",this.message.role);let t=this.j.c.div(this.getFullElName("message-bubble"));t.classList.add(this.getFullElName("message-bubble",this.message.role,!0));let u=this.j.c.div(this.getFullElName("message-content"));if(u.innerHTML=this.formatMessageContent(this.message.content),t.appendChild(u),this.opts.showTimestamps){let e=this.j.c.div(this.getFullElName("message-timestamp"));e.textContent=this.formatTimestamp(this.message.timestamp),t.appendChild(e)}let n=this.j.c.div(this.getFullElName("message-actions"));if(this.renderActionsButton(n),t.appendChild(n),e.appendChild(t),this.message.toolCalls&&this.message.toolCalls.length>0){let t=this.j.c.div(this.getFullElName("tool-calls"));e.appendChild(t),this.message.toolCalls.forEach(e=>{let u=this.createToolCallElement(e);t.appendChild(u)})}this.message.artifacts&&this.message.artifacts.length>0&&this.renderArtifacts()}renderActionsButton(e){let t=this.opts;(t.showCopyMessageAction||t.showRestartMessageAction||t.showEditMessageAction||t.showDeleteMessageAction)&&(this.actionsButton=new a.UIButton(this.j,{icon:{name:"dots"},tooltip:"Message actions",name:"messageActions",size:"tiny"}),this.actionsButton.onAction(e=>{this.showActionsMenu(e)}),e.appendChild(this.actionsButton.container))}showActionsMenu(e){if(!this.contextMenu||!this.actionsButton)return;let t=this.j,u=t.o.aiAssistantPro,n=[];u.showCopyMessageAction&&n.push({title:"Copy message",icon:"copy",exec:()=>{this.j.e.fire("copyMessage.ai-assistant-pro",this.message.id)}}),"user"===this.message.role&&(u.showRestartMessageAction&&n.push({title:"Restart from here",icon:"update",exec:()=>{this.j.e.fire("restartFromMessage.ai-assistant-pro",this.message.id)}}),u.showEditMessageAction&&n.push({title:"Edit message",icon:"pencil",exec:()=>{this.j.e.fire("editMessage.ai-assistant-pro",this.message.id)}})),u.showDeleteMessageAction&&n.push({title:"Delete message",icon:"bin",exec:()=>{t.confirm("Are you sure you want to delete this message?","Delete message",e=>{e&&this.j.e.fire("deleteMessage.ai-assistant-pro",this.message.id)})}});let s=this.actionsButton.container.getBoundingClientRect();this.contextMenu.show(s.left,s.bottom,n),e.stopPropagation()}renderArtifacts(){if(!this.message.artifacts||0===this.message.artifacts.length)return;let e=this.j.c.div(this.getFullElName("artifacts"));this.container.appendChild(e),this.artifactGroup||(this.artifactGroup=new l.UIGroup(this.j),this.artifactGroup.container.className="jodit-ui-artifact-group"),this.artifactGroup.clear(),this.message.artifacts.forEach(e=>{let t=new i.UIArtifact(this.j,e);this.artifactGroup.append(t)}),e.appendChild(this.artifactGroup.container)}createToolCallElement(e){let t=this.j.c.div(this.getFullElName("tool-call"));t.setAttribute("data-tool-id",e.id),t.setAttribute("data-status",e.status);let u=this.j.c.div(this.getFullElName("tool-header")),n=this.j.c.div(this.getFullElName("tool-icon"));n.classList.add(this.getFullElName("tool-icon",e.status,!0)),n.innerHTML=F.Icon.get("tool-bolt")||"";let s=this.j.c.div(this.getFullElName("tool-name"));s.textContent=this.j.i18n(e.name);let i=this.j.c.div(this.getFullElName("tool-status"));i.textContent=this.getToolStatusText(e.status||"unknown"),u.appendChild(n),u.appendChild(s),u.appendChild(i),t.appendChild(u);let r=this.createExpandableSection("Arguments",JSON.stringify(e.arguments||{},null,2));if(t.appendChild(r),e.result){let u=e.result.error?`Error: ${e.result.error}`:e.result.result||"",n=this.createExpandableSection("Result","string"==typeof u?u:JSON.stringify(u,null,2));t.appendChild(n)}return t}createExpandableSection(e,t){let u=this.j.c.div(this.getFullElName("tool-expandable")),n=this.j.c.element("button",{type:"button",class:this.getFullElName("tool-expandable-toggle")}),s=this.j.c.span(this.getFullElName("tool-expandable-chevron"));s.innerHTML=F.Icon.get("chevron-right")||"";let i=this.j.c.span();i.textContent=this.j.i18n(e),n.appendChild(s),n.appendChild(i);let r=this.j.c.element("pre",{class:this.getFullElName("tool-expandable-content")});return r.textContent=t,r.style.display="none",this.j.e.on(n,"click",()=>{"none"!==r.style.display?(r.style.display="none",n.classList.remove("expanded")):(r.style.display="block",n.classList.add("expanded"))}),u.appendChild(n),u.appendChild(r),u}getToolStatusText(e){return({pending:"pending",approved:"approved",denied:"denied",executing:"running",executed:"done",error:"error"})[e]||e}formatMessageContent(e){return(0,this.opts.formatMessageContent)(e,this.message.role,this.j.i18n.bind(this.j))}formatTimestamp(e){return(0,this.opts.formatTimestamp)(e,this.j.i18n.bind(this.j))}updateMessage(e){this.message=e,this.updateContent()}destruct(){var e,t,u;null==(e=this.actionsButton)||e.destruct(),null==(t=this.contextMenu)||t.destruct(),null==(u=this.artifactGroup)||u.destruct(),super.destruct()}constructor(e,t,u){super(e),(0,n._)(this,"message",void 0),(0,n._)(this,"opts",void 0),(0,n._)(this,"artifactGroup",void 0),(0,n._)(this,"actionsButton",void 0),(0,n._)(this,"contextMenu",void 0),this.message=t,this.opts=u,this.artifactGroup=null,this.actionsButton=null,this.contextMenu=null}}(0,s.__decorate)([(0,r.hook)("ready")],h.prototype,"onReady",null),h=(0,s.__decorate)([r.component],h)},86563:function(e,t,u){"use strict";u.d(t,{UIMessageList:function(){return l}});var n=u(82749),s=u(31635),i=u(51359),r=u(65478),o=u(62405),a=u(31356);class l extends o.UIGroup{className(){return"UIMessageList"}render(){return'<div class="&__scroll-container"></div>'}afterRender(){this.scrollContainer=this.container}onUserScroll(){if(!this.scrollContainer)return;let{scrollTop:e,scrollHeight:t,clientHeight:u}=this.scrollContainer;this.autoScrollEnabled=t-e-u<10}onMessageSent(){this.autoScrollEnabled=!0,this.scrollToBottom()}appendChildToContainer(e){this.scrollContainer&&this.scrollContainer.appendChild(e)}setMessages(e){let t=this.messages.slice();this.messages=e.slice(),this.updateMessageList(t),this.scrollToBottom()}updateMessageList(e){let t=a.ListReconciler.reconcile(e,this.messages,{getId:e=>e.id,isEqual:(e,t)=>e.id===t.id&&e.content===t.content&&e.timestamp===t.timestamp&&JSON.stringify(e.artifacts)===JSON.stringify(t.artifacts)&&JSON.stringify(e.toolCalls)===JSON.stringify(t.toolCalls),preserveOrder:!0});t.toRemove.forEach(e=>{let t=this.messageItems.get(e.id);t&&(-1!==this.elements.indexOf(t)&&(this.remove(t),t.destruct()),this.messageItems.delete(e.id))}),t.toUpdate.forEach(({newItem:e,index:t})=>{let u=this.messageItems.get(e.id);u&&(u.updateMessage(e),this.elements.indexOf(u)!==t&&t<this.elements.length&&(this.remove(u),this.append(u,t)))}),t.toCreate.forEach(e=>{let t=new i.UIMessageListItem(this.j,e,this.params);this.messageItems.set(e.id,t);let u=this.messages.indexOf(e);this.append(t,u)})}scrollToBottom(){!this.j.isDestructed&&this.autoScrollEnabled&&(this.container.scrollTop=this.container.scrollHeight)}destruct(){this.messageItems.clear(),this.messages=[],super.destruct()}constructor(e,t){super(e),(0,n._)(this,"params",void 0),(0,n._)(this,"messages",void 0),(0,n._)(this,"messageItems",void 0),(0,n._)(this,"scrollContainer",void 0),(0,n._)(this,"autoScrollEnabled",void 0),this.params=t,this.messages=[],this.messageItems=new Map,this.autoScrollEnabled=!0}}(0,s.__decorate)([(0,r.hook)("ready")],l.prototype,"afterRender",null),(0,s.__decorate)([(0,r.watch)(["scrollContainer:wheel","scrollContainer:scroll","scrollContainer:touchmove"]),(0,r.throttle)(e=>e.defaultTimeout)],l.prototype,"onUserScroll",null),(0,s.__decorate)([(0,r.watch)(":messageSent.ai-assistant-pro")],l.prototype,"onMessageSent",null),(0,s.__decorate)([r.autobind],l.prototype,"setMessages",null),(0,s.__decorate)([(0,r.throttle)(e=>2*e.defaultTimeout)],l.prototype,"scrollToBottom",null),l=(0,s.__decorate)([r.component],l)},93677:function(e,t,u){"use strict";u.d(t,{UIPermissionRequest:function(){return F}});var n=u(82749),s=u(31635),i=u(65478),r=u(67510),o=u(62843),a=u(12234),l=u(12153);class F extends r.UIElement{className(){return"UIPermissionRequest"}setToolCall(e){this.toolCall=e,this.updateContent()}setParentView(e){var t,u,n;return null==(t=this.scopeSelect)||t.setParentView(e),null==(u=this.approveButton)||u.setParentView(e),null==(n=this.denyButton)||n.setParentView(e),super.setParentView(e)}render(){return`<div class="&__container">
|
|
38
|
+
</div>`}addResize(){}afterRender(){this.content=this.getElm("content"),this.headerContextMenu=new C.ContextMenu(this.j),this.createComponents(),this.createHeaderButtons(),this.setupConversationRenameHandler(),this.__updateView("welcome")}__onChangeView(){return(0,n._)(function*(){this.__updateView(this.state.currentView,this.state.currentConversation)}).call(this)}createComponents(){this.welcomeScreen=new c.UIWelcomeScreen(this.j),this.conversationList=new r.UIConversationList(this.j,this.options),this.messageList=new a.UIMessageList(this.j,this.options),this.inputArea=new o.UIInputArea(this.j,this.options),this.getElm("footer").appendChild(this.inputArea.container)}createHeaderButtons(){let e=this.getElm("header-left"),t=this.getElm("header-right"),u=new A.UIButton(this.j,{icon:{name:"angle-left"},size:"small",variant:"initial"});u.container.classList.add(this.getFullElName("back-button")),this.j.e.on(u,"click",()=>{this.j.e.fire("backToList.ai-assistant-pro")}),e.appendChild(u.container),this.conversationActionsButton=new A.UIButton(this.j,{icon:{name:"dots"},size:"small",tooltip:"Conversation actions",variant:"initial"}),this.conversationActionsButton.container.classList.add(this.getFullElName("conversation-actions-button")),this.conversationActionsButton.onAction(this.showConversationActionsMenu),t.appendChild(this.conversationActionsButton.container);let n=new A.UIButton(this.j,{icon:{name:"plus"},size:"small",tooltip:"New chat",variant:"initial"});if(n.container.classList.add(this.getFullElName("new-button")),this.j.e.on(n,"click",()=>{this.j.e.fire("newConversation.ai-assistant-pro")}),t.appendChild(n.container),this.shouldShowSettings()&&(this.settingsButton=new F.UISettingsButton(this.j,this.state,this.options,()=>this.state.currentConversation,this.updateConversation),this.settingsButton.container.classList.add(this.getFullElName("settings-button")),t.appendChild(this.settingsButton.container)),"dialog"===this.mods.displayMode||!1===this.mods.allowClose)return;let s=new A.UIButton(this.j,{icon:{name:"cancel"},size:"small",tooltip:"Close",variant:"initial"});s.container.classList.add(this.getFullElName("close-button")),this.j.e.on(s,"click",()=>{this.j.e.fire("closeAIAssistantPro.ai-assistant-pro")}),t.appendChild(s.container)}setupConversationRenameHandler(){}showConversationActionsMenu(e){if(!this.headerContextMenu||!this.state.currentConversation)return;let t=this.state.currentConversation,u=[{title:"Rename",icon:"pencil",exec:()=>{this.showRenamePrompt(t.id,t.title||this.j.i18n("Conversation"))}},{title:"Delete",icon:"bin",exec:()=>{this.j.e.fire("deleteConversation.ai-assistant-pro",t.id)}}],n=this.conversationActionsButton.container.getBoundingClientRect();this.headerContextMenu.show(n.left,n.bottom,u),e.stopPropagation()}showRenamePrompt(e,t){if(this.isEditingTitle)return;this.isEditingTitle=!0;let u=this.getElm("header-title"),n=this.j.c.element("input");n.type="text",n.value=t,n.className=this.getFullElName("header-title-input"),u.textContent="",u.appendChild(n),n.focus(),n.select();let s=()=>{let s=n.value.trim();this.isEditingTitle=!1,s&&s!==t?(this.j.e.fire("renameConversation.ai-assistant-pro",e,s),u.textContent=s):u.textContent=t};this.j.e.on(n,"blur",s),this.j.e.on(n,"keydown",e=>{"Enter"===e.key&&(e.preventDefault(),n.blur()),"Escape"===e.key&&(this.isEditingTitle=!1,u.textContent=t)})}isFlightMode(){return"flight"===this.mods.displayMode}shouldShowSettings(){let e=this.options,t=e.allowEditDisplayMode||e.allowEditPanelWidth,u=e.allowEditDialogSettings;return t||u}__updateView(e,t=null){var u;null==(u=this.settingsButton)||u.update();let n=this.getElm("header-title");this.setMod("view",e);let s=this.isFlightMode();switch(e){case"welcome":n.textContent=this.j.i18n("AI Assistant"),d.Dom.safeRemove(this.conversationList.container),d.Dom.safeRemove(this.messageList.container),this.content.appendChild(this.welcomeScreen.container),this.inputArea.focus();break;case"conversationList":n.textContent=this.j.i18n("AI Assistant"),d.Dom.safeRemove(this.welcomeScreen.container),d.Dom.safeRemove(this.messageList.container),this.conversationList.container.isConnected||this.content.appendChild(this.conversationList.container);break;case"conversation":n.textContent=s?this.j.i18n("AI Assistant"):(null==t?void 0:t.title)||this.j.i18n("Conversation"),d.Dom.safeRemove(this.welcomeScreen.container),d.Dom.safeRemove(this.conversationList.container),this.messageList.container.isConnected||this.content.appendChild(this.messageList.container),t&&this.messageList.setMessages(t.messages),this.inputArea.focus()}}onChangeCurrentConversation(){let{currentConversation:e}=this.state;e&&(this.conversationList.setActiveConversation(e.id),this.messageList.setMessages(e.messages))}onChangeConversations(){this.conversationList.setConversations(this.state.conversations)}onChangeSelectionContexts(){this.inputArea.setContexts(this.state.selectionContexts)}onChangeLoading(){this.inputArea.setLoading(this.state.isLoading)}onChangePendingToolCalls(){this.state.pendingToolCalls&&this.state.pendingToolCalls.length>0?this.showPermissionRequest(this.state.pendingToolCalls[0]):this.hidePermissionRequest()}showPermissionRequest(e){this.permissionRequest||(this.permissionRequest=new l.UIPermissionRequest(this.j,this.options)),this.permissionRequest.setToolCall(e);let t=this.getElm("footer");t.contains(this.permissionRequest.container)||t.insertBefore(this.permissionRequest.container,this.inputArea.container)}hidePermissionRequest(){this.permissionRequest&&this.permissionRequest.container.parentNode&&this.permissionRequest.container.parentNode.removeChild(this.permissionRequest.container)}destruct(){var e,t,u,n,s,i,r,o;null==(e=this.welcomeScreen)||e.destruct(),null==(t=this.conversationList)||t.destruct(),null==(u=this.messageList)||u.destruct(),null==(n=this.inputArea)||n.destruct(),null==(s=this.permissionRequest)||s.destruct(),null==(i=this.settingsButton)||i.destruct(),null==(r=this.conversationActionsButton)||r.destruct(),null==(o=this.headerContextMenu)||o.destruct(),super.destruct()}constructor(e,t,u,n){super(e),(0,s._)(this,"state",void 0),(0,s._)(this,"options",void 0),(0,s._)(this,"updateConversation",void 0),(0,s._)(this,"permissionRequest",void 0),(0,s._)(this,"settingsButton",void 0),(0,s._)(this,"content",void 0),(0,s._)(this,"isEditingTitle",void 0),(0,s._)(this,"conversationActionsButton",void 0),(0,s._)(this,"headerContextMenu",void 0),this.state=t,this.options=u,this.updateConversation=n,this.permissionRequest=null,this.settingsButton=null,this.isEditingTitle=!1,this.conversationActionsButton=null,this.headerContextMenu=null}}(0,i.__decorate)([(0,h.hook)("ready")],E.prototype,"afterRender",null),(0,i.__decorate)([(0,h.watch)(["state.currentView","state.currentConversation"])],E.prototype,"__onChangeView",null),(0,i.__decorate)([h.autobind],E.prototype,"showConversationActionsMenu",null),(0,i.__decorate)([h.autobind],E.prototype,"showRenamePrompt",null),(0,i.__decorate)([(0,h.watch)("state.currentConversation")],E.prototype,"onChangeCurrentConversation",null),(0,i.__decorate)([(0,h.watch)("state.conversations")],E.prototype,"onChangeConversations",null),(0,i.__decorate)([(0,h.watch)("state.selectionContexts")],E.prototype,"onChangeSelectionContexts",null),(0,i.__decorate)([(0,h.watch)("state.isLoading")],E.prototype,"onChangeLoading",null),(0,i.__decorate)([(0,h.watch)("state.pendingToolCalls")],E.prototype,"onChangePendingToolCalls",null),E=(0,i.__decorate)([h.component],E)},81835:function(e,t,u){"use strict";u.d(t,{UIArtifact:function(){return a}});var n=u(82749),s=u(31635),i=u(65478),r=u(29960),o=u(67510);class a extends o.UIElement{className(){return"UIArtifact"}onReady(){this.renderArtifact()}renderArtifact(){let e=this.container;e.innerHTML="",(0,r.attr)(e,{"data-type":this.artifact.type,"data-status":this.artifact.status});let t=this.createStatusIndicator();if(e.appendChild(t),"pending"===this.artifact.status||"generating"===this.artifact.status)return void this.renderLoading();if("failed"===this.artifact.status)return void this.renderError();switch(this.artifact.type){case"image":this.renderImage();break;case"audio":this.renderAudio();break;case"file":this.renderFile();break;case"json":this.renderJSON();break;default:this.renderOther()}}createStatusIndicator(){let e=this.j.c.div(this.getFullElName("status"));e.setAttribute("data-status",this.artifact.status);let t=this.j.c.span(this.getFullElName("status-icon")),u=this.j.c.span(this.getFullElName("status-text"));switch(this.artifact.status){case"pending":t.textContent="⏳",u.textContent=this.j.i18n("Pending");break;case"generating":t.textContent="\uD83D\uDD04",u.textContent=this.j.i18n("Generating...");break;case"ready":t.textContent="✅",u.textContent=this.j.i18n("Ready");break;case"failed":t.textContent="❌",u.textContent=this.j.i18n("Failed")}return e.appendChild(t),e.appendChild(u),e}renderLoading(){let e=this.j.c.div(this.getFullElName("loader")),t=this.j.c.div(this.getFullElName("spinner")),u=this.j.c.div(this.getFullElName("loader-message"));u.textContent=this.j.i18n("Generating artifact..."),e.appendChild(t),e.appendChild(u),this.container.appendChild(e)}renderError(){var e;let t=this.j.c.div(this.getFullElName("error")),u=this.j.c.div(this.getFullElName("error-icon"));u.textContent="❌";let n=this.j.c.div(this.getFullElName("error-message"));n.textContent=(null==(e=this.artifact.metadata)?void 0:e.error)||this.j.i18n("Failed to generate artifact"),t.appendChild(u),t.appendChild(n),this.container.appendChild(t)}renderImage(){var e,t;if(!this.artifact.data)return;let u=this.j.c.div(this.getFullElName("content")),n=this.j.c.element("img",{class:this.getFullElName("image")});if("url"===this.artifact.data.kind)n.src=this.artifact.data.url;else if("base64"===this.artifact.data.kind){let e=this.artifact.mimeType||"image/png";n.src=`data:${e};base64,${this.artifact.data.base64}`}if(n.alt=(null==(e=this.artifact.metadata)?void 0:e.alt)||"AI Generated Image",u.appendChild(n),null==(t=this.artifact.metadata)?void 0:t.caption){let e=this.j.c.div(this.getFullElName("caption"));e.textContent=this.artifact.metadata.caption,u.appendChild(e)}this.container.appendChild(u)}renderAudio(){if(!this.artifact.data)return;let e=this.j.c.div(this.getFullElName("content")),t=this.j.c.element("audio",{class:this.getFullElName("audio"),controls:"controls"});if("url"===this.artifact.data.kind)t.src=this.artifact.data.url;else if("base64"===this.artifact.data.kind){let e=this.artifact.mimeType||"audio/mpeg";t.src=`data:${e};base64,${this.artifact.data.base64}`}e.appendChild(t),this.container.appendChild(e)}renderFile(){var e,t,u;if(!this.artifact.data)return;let n=this.j.c.div(this.getFullElName("content")),s=this.j.c.div(this.getFullElName("file-card")),i=this.j.c.div(this.getFullElName("file-icon"));i.textContent="\uD83D\uDCC4";let r=this.j.c.div(this.getFullElName("file-info")),o=this.j.c.div(this.getFullElName("file-name"));o.textContent=(null==(e=this.artifact.metadata)?void 0:e.filename)||"download.file";let a=this.j.c.div(this.getFullElName("file-size"));(null==(t=this.artifact.metadata)?void 0:t.size)&&(a.textContent=this.formatFileSize(this.artifact.metadata.size)),r.appendChild(o),r.appendChild(a);let l=this.j.c.element("a",{class:this.getFullElName("download-btn"),download:(null==(u=this.artifact.metadata)?void 0:u.filename)||"download.file"});if(l.textContent=this.j.i18n("Download"),"url"===this.artifact.data.kind)l.href=this.artifact.data.url;else if("base64"===this.artifact.data.kind){let e=this.artifact.mimeType||"application/octet-stream";l.href=`data:${e};base64,${this.artifact.data.base64}`}s.appendChild(i),s.appendChild(r),s.appendChild(l),n.appendChild(s),this.container.appendChild(n)}renderJSON(){let e;if(!this.artifact.data)return;let t=this.j.c.div(this.getFullElName("content")),u=this.j.c.element("pre",{class:this.getFullElName("json")}),n=this.j.c.element("code");if("url"===this.artifact.data.kind)n.textContent=this.j.i18n("JSON data at URL");else if("base64"===this.artifact.data.kind)try{let t=atob(this.artifact.data.base64);e=JSON.parse(t),n.textContent=JSON.stringify(e,null,2)}catch(e){n.textContent=this.j.i18n("Invalid JSON data")}u.appendChild(n),t.appendChild(u),this.container.appendChild(t)}renderOther(){let e=this.j.c.div(this.getFullElName("content")),t=this.j.c.div(this.getFullElName("placeholder")),u=this.j.c.div(this.getFullElName("placeholder-icon"));u.textContent="\uD83D\uDCE6";let n=this.j.c.div(this.getFullElName("placeholder-text"));n.textContent=this.j.i18n("Unknown artifact type"),t.appendChild(u),t.appendChild(n),e.appendChild(t),this.container.appendChild(e)}formatFileSize(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(2)} KB`:e<0x40000000?`${(e/1048576).toFixed(2)} MB`:`${(e/0x40000000).toFixed(2)} GB`}updateArtifact(e){this.artifact=e,this.renderArtifact()}constructor(e,t){super(e),(0,n._)(this,"artifact",void 0),this.artifact=t}}(0,s.__decorate)([(0,i.hook)("ready")],a.prototype,"onReady",null),a=(0,s.__decorate)([i.component],a)},51359:function(e,t,u){"use strict";u.d(t,{UIMessageListItem:function(){return h}});var n=u(82749),s=u(31635),i=u(81835),r=u(65478),o=u(67510),a=u(62843),l=u(62405),F=u(12153),c=u(80870);class h extends o.UIElement{className(){return"UIMessageListItem"}render(){return`<div class="${this.getFullElName("message")}"></div>`}onReady(){this.updateContent(),this.contextMenu=new c.ContextMenu(this.j)}updateContent(){let e=this.container;e.innerHTML="",e.setAttribute("data-message-id",this.message.id),e.setAttribute("data-role",this.message.role);let t=this.j.c.div(this.getFullElName("message-bubble"));t.classList.add(this.getFullElName("message-bubble",this.message.role,!0));let u=this.j.c.div(this.getFullElName("message-content"));if(u.innerHTML=this.formatMessageContent(this.message.content),t.appendChild(u),this.opts.showTimestamps){let e=this.j.c.div(this.getFullElName("message-timestamp"));e.textContent=this.formatTimestamp(this.message.timestamp),t.appendChild(e)}let n=this.j.c.div(this.getFullElName("message-actions"));if(this.renderActionsButton(n),t.appendChild(n),e.appendChild(t),this.message.toolCalls&&this.message.toolCalls.length>0){let t=this.j.c.div(this.getFullElName("tool-calls"));e.appendChild(t),this.message.toolCalls.forEach(e=>{let u=this.createToolCallElement(e);t.appendChild(u)})}this.message.artifacts&&this.message.artifacts.length>0&&this.renderArtifacts()}renderActionsButton(e){let t=this.opts;(t.showCopyMessageAction||t.showRestartMessageAction||t.showEditMessageAction||t.showDeleteMessageAction)&&(this.actionsButton=new a.UIButton(this.j,{icon:{name:"dots"},tooltip:"Message actions",name:"messageActions",size:"tiny"}),this.actionsButton.onAction(e=>{this.showActionsMenu(e)}),e.appendChild(this.actionsButton.container))}showActionsMenu(e){if(!this.contextMenu||!this.actionsButton)return;let t=this.j,u=t.o.aiAssistantPro,n=[];u.showCopyMessageAction&&n.push({title:"Copy message",icon:"copy",exec:()=>{this.j.e.fire("copyMessage.ai-assistant-pro",this.message.id)}}),"user"===this.message.role&&(u.showRestartMessageAction&&n.push({title:"Restart from here",icon:"update",exec:()=>{this.j.e.fire("restartFromMessage.ai-assistant-pro",this.message.id)}}),u.showEditMessageAction&&n.push({title:"Edit message",icon:"pencil",exec:()=>{this.j.e.fire("editMessage.ai-assistant-pro",this.message.id)}})),u.showDeleteMessageAction&&n.push({title:"Delete message",icon:"bin",exec:()=>{t.confirm("Are you sure you want to delete this message?","Delete message",e=>{e&&this.j.e.fire("deleteMessage.ai-assistant-pro",this.message.id)})}});let s=this.actionsButton.container.getBoundingClientRect();this.contextMenu.show(s.left,s.bottom,n),e.stopPropagation()}renderArtifacts(){if(!this.message.artifacts||0===this.message.artifacts.length)return;let e=this.j.c.div(this.getFullElName("artifacts"));this.container.appendChild(e),this.artifactGroup||(this.artifactGroup=new l.UIGroup(this.j),this.artifactGroup.container.className="jodit-ui-artifact-group"),this.artifactGroup.clear(),this.message.artifacts.forEach(e=>{let t=new i.UIArtifact(this.j,e);this.artifactGroup.append(t)}),e.appendChild(this.artifactGroup.container)}createToolCallElement(e){let t=this.j.c.div(this.getFullElName("tool-call"));t.setAttribute("data-tool-id",e.id),t.setAttribute("data-status",e.status);let u=this.j.c.div(this.getFullElName("tool-header")),n=this.j.c.div(this.getFullElName("tool-icon"));n.classList.add(this.getFullElName("tool-icon",e.status,!0)),n.innerHTML=F.Icon.get("tool-bolt")||"";let s=this.j.c.div(this.getFullElName("tool-name"));s.textContent=this.j.i18n(e.name);let i=this.j.c.div(this.getFullElName("tool-status"));i.textContent=this.getToolStatusText(e.status||"unknown"),u.appendChild(n),u.appendChild(s),u.appendChild(i),t.appendChild(u);let r=this.createExpandableSection("Arguments",JSON.stringify(e.arguments||{},null,2));if(t.appendChild(r),e.result){let u=e.result.error?`Error: ${e.result.error}`:e.result.result||"",n=this.createExpandableSection("Result","string"==typeof u?u:JSON.stringify(u,null,2));t.appendChild(n)}return t}createExpandableSection(e,t){let u=this.j.c.div(this.getFullElName("tool-expandable")),n=this.j.c.element("button",{type:"button",class:this.getFullElName("tool-expandable-toggle")}),s=this.j.c.span(this.getFullElName("tool-expandable-chevron"));s.innerHTML=F.Icon.get("chevron-right")||"";let i=this.j.c.span();i.textContent=this.j.i18n(e),n.appendChild(s),n.appendChild(i);let r=this.j.c.element("pre",{class:this.getFullElName("tool-expandable-content")});return r.textContent=t,r.style.display="none",this.j.e.on(n,"click",()=>{"none"!==r.style.display?(r.style.display="none",n.classList.remove("expanded")):(r.style.display="block",n.classList.add("expanded"))}),u.appendChild(n),u.appendChild(r),u}getToolStatusText(e){return({pending:"pending",approved:"approved",denied:"denied",executing:"running",executed:"done",error:"error"})[e]||e}formatMessageContent(e){return(0,this.opts.formatMessageContent)(e,this.message.role,this.j.i18n.bind(this.j))}formatTimestamp(e){return(0,this.opts.formatTimestamp)(e,this.j.i18n.bind(this.j))}updateMessage(e){this.message=e,this.updateContent()}destruct(){var e,t,u;null==(e=this.actionsButton)||e.destruct(),null==(t=this.contextMenu)||t.destruct(),null==(u=this.artifactGroup)||u.destruct(),super.destruct()}constructor(e,t,u){super(e),(0,n._)(this,"message",void 0),(0,n._)(this,"opts",void 0),(0,n._)(this,"artifactGroup",void 0),(0,n._)(this,"actionsButton",void 0),(0,n._)(this,"contextMenu",void 0),this.message=t,this.opts=u,this.artifactGroup=null,this.actionsButton=null,this.contextMenu=null}}(0,s.__decorate)([(0,r.hook)("ready")],h.prototype,"onReady",null),h=(0,s.__decorate)([r.component],h)},86563:function(e,t,u){"use strict";u.d(t,{UIMessageList:function(){return l}});var n=u(82749),s=u(31635),i=u(51359),r=u(65478),o=u(62405),a=u(31356);class l extends o.UIGroup{className(){return"UIMessageList"}render(){return'<div class="&__scroll-container"></div>'}afterRender(){this.scrollContainer=this.container}onUserScroll(){if(!this.scrollContainer)return;let{scrollTop:e,scrollHeight:t,clientHeight:u}=this.scrollContainer;this.autoScrollEnabled=t-e-u<10}onMessageSent(){this.autoScrollEnabled=!0,this.scrollToBottom()}appendChildToContainer(e){this.scrollContainer&&this.scrollContainer.appendChild(e)}setMessages(e){let t=this.messages.slice();this.messages=e.slice(),this.updateMessageList(t),this.scrollToBottom()}updateMessageList(e){let t=a.ListReconciler.reconcile(e,this.messages,{getId:e=>e.id,isEqual:(e,t)=>e.id===t.id&&e.content===t.content&&e.timestamp===t.timestamp&&JSON.stringify(e.artifacts)===JSON.stringify(t.artifacts)&&JSON.stringify(e.toolCalls)===JSON.stringify(t.toolCalls),preserveOrder:!0});t.toRemove.forEach(e=>{let t=this.messageItems.get(e.id);t&&(-1!==this.elements.indexOf(t)&&(this.remove(t),t.destruct()),this.messageItems.delete(e.id))}),t.toUpdate.forEach(({newItem:e,index:t})=>{let u=this.messageItems.get(e.id);u&&(u.updateMessage(e),this.elements.indexOf(u)!==t&&t<this.elements.length&&(this.remove(u),this.append(u,t)))}),t.toCreate.forEach(e=>{let t=new i.UIMessageListItem(this.j,e,this.params);this.messageItems.set(e.id,t);let u=this.messages.indexOf(e);this.append(t,u)})}scrollToBottom(){!this.j.isDestructed&&this.autoScrollEnabled&&this.container.scrollTo({top:this.container.scrollHeight,behavior:"smooth"})}destruct(){this.messageItems.clear(),this.messages=[],super.destruct()}constructor(e,t){super(e),(0,n._)(this,"params",void 0),(0,n._)(this,"messages",void 0),(0,n._)(this,"messageItems",void 0),(0,n._)(this,"scrollContainer",void 0),(0,n._)(this,"autoScrollEnabled",void 0),this.params=t,this.messages=[],this.messageItems=new Map,this.autoScrollEnabled=!0}}(0,s.__decorate)([(0,r.hook)("ready")],l.prototype,"afterRender",null),(0,s.__decorate)([(0,r.watch)(["scrollContainer:wheel","scrollContainer:touchmove"]),(0,r.throttle)(e=>e.defaultTimeout)],l.prototype,"onUserScroll",null),(0,s.__decorate)([(0,r.watch)(":messageSent.ai-assistant-pro")],l.prototype,"onMessageSent",null),(0,s.__decorate)([r.autobind],l.prototype,"setMessages",null),(0,s.__decorate)([(0,r.throttle)(e=>2*e.defaultTimeout)],l.prototype,"scrollToBottom",null),l=(0,s.__decorate)([r.component],l)},93677:function(e,t,u){"use strict";u.d(t,{UIPermissionRequest:function(){return F}});var n=u(82749),s=u(31635),i=u(65478),r=u(67510),o=u(62843),a=u(12234),l=u(12153);class F extends r.UIElement{className(){return"UIPermissionRequest"}setToolCall(e){this.toolCall=e,this.updateContent()}setParentView(e){var t,u,n;return null==(t=this.scopeSelect)||t.setParentView(e),null==(u=this.approveButton)||u.setParentView(e),null==(n=this.denyButton)||n.setParentView(e),super.setParentView(e)}render(){return`<div class="&__container">
|
|
39
39
|
<div class="&__header">
|
|
40
40
|
<div class="&__icon"></div>
|
|
41
41
|
<div class="&__title">~Permission Required~</div>
|
|
@@ -45,10 +45,7 @@ ${i}`.trim();u?yield this.__executeQuickCommandSilent(a,i):yield this.__executeQ
|
|
|
45
45
|
<div class="&__actions-buttons"></div>
|
|
46
46
|
<div class="&__actions-scope"></div>
|
|
47
47
|
</div>
|
|
48
|
-
</div>`}afterRender(){let e=this.getElm("icon");e&&(e.innerHTML=l.Icon.get("shield")||""),this.createControls(),this.updateContent()}createControls(){let e=this.getElm("actions-buttons"),t=this.getElm("actions-scope");this.denyButton=new o.UIButton(this.j,{text:this.j.i18n("Deny"),variant:"initial",size:"small",name:"deny-permission"}),this.j.e.on(this.denyButton,"click",this.onDeny),this.approveButton=new o.UIButton(this.j,{text:this.j.i18n("Allow"),variant:"initial",size:"small",name:"approve-permission"}),this.j.e.on(this.approveButton,"click",this.onApprove),this.scopeSelect=new a.UISelect(this.j,{name:"permission-scope",options:[{value:"once",text:this.j.i18n("Once")},{value:"conversation",text:this.j.i18n("This conversation")},{value:"forever",text:this.j.i18n("Always")}]}),this.scopeSelect.value=this.state.defaultPermissionScope,e.appendChild(this.denyButton.container),e.appendChild(this.approveButton.container),t.appendChild(this.scopeSelect.container)}updateContent(){this.toolCall&&(this.getElm("tool-info").innerHTML=`
|
|
49
|
-
<div class="${this.getFullElName("tool-name")}">${this.j.i18n(this.toolCall.name)}</div>
|
|
50
|
-
<div class="${this.getFullElName("tool-args")}">${this.formatArguments(this.toolCall.arguments)}</div>
|
|
51
|
-
`)}formatArguments(e){return Object.entries(e).map(([e,t])=>`${e}: ${JSON.stringify(t)}`).join(", ")}onApprove(){var e;let t=null==(e=this.scopeSelect)?void 0:e.value;this.j.e.fire("approveToolCall.ai-assistant-pro",this.toolCall.id,t)}onDeny(){this.j.e.fire("denyToolCall.ai-assistant-pro",this.toolCall.id)}destruct(){var e,t,u;null==(e=this.scopeSelect)||e.destruct(),null==(t=this.approveButton)||t.destruct(),null==(u=this.denyButton)||u.destruct(),super.destruct()}constructor(e,t){super(e),(0,n._)(this,"state",void 0),(0,n._)(this,"toolCall",void 0),(0,n._)(this,"scopeSelect",void 0),(0,n._)(this,"approveButton",void 0),(0,n._)(this,"denyButton",void 0),this.state=t,this.scopeSelect=null,this.approveButton=null,this.denyButton=null}}(0,s.__decorate)([(0,i.hook)("ready")],F.prototype,"afterRender",null),(0,s.__decorate)([i.autobind],F.prototype,"onApprove",null),(0,s.__decorate)([i.autobind],F.prototype,"onDeny",null),F=(0,s.__decorate)([i.component],F)},48705:function(e,t,u){"use strict";u.d(t,{UISettingsButton:function(){return n.UISettingsButton}});var n=u(76697)},76697:function(e,t,u){"use strict";u.d(t,{UISettingsButton:function(){return F}});var n=u(82749),s=u(31635),i=u(79455),r=u(87325),o=u(37133),a=u(48538),l=u(78644);class F extends a.UIElement{className(){return"UISettingsButton"}setParentView(e){var t,u;return null==(t=this.settingsPopup)||t.setParentView(e),null==(u=this.button)||u.setParentView(e),super.setParentView(e)}onChangeOptionsClosePopup(e){this.closeCallback()}openSettingsPopup(){return this.settingsPopup||(this.settingsPopup=new i.UISettingsPopup(this.jodit,this.extraState,this.options,this.getConversation,this.updateConversation)),this.settingsPopup.update(),this.settingsPopup}constructor(e,t,u,s,i){super(e),(0,n._)(this,"extraState",void 0),(0,n._)(this,"options",void 0),(0,n._)(this,"getConversation",void 0),(0,n._)(this,"updateConversation",void 0),(0,n._)(this,"closeCallback",void 0),(0,n._)(this,"settingsPopup",void 0),(0,n._)(this,"button",void 0),this.extraState=t,this.options=u,this.getConversation=s,this.updateConversation=i,this.closeCallback=()=>{},this.settingsPopup=null,this.button=new l.ToolbarButton(this.jodit,{name:"settings",tooltip:"Settings",popup:(e,t,u)=>(this.closeCallback=u,this.openSettingsPopup())}),this.button.state.variant="initial",this.button.state.size="small",this.container.appendChild(this.button.container)}}(0,s.__decorate)([(0,o.watch)("extraState.displayMode")],F.prototype,"onChangeOptionsClosePopup",null),F=(0,s.__decorate)([r.component],F)},16015:function(e,t,u){"use strict";u.d(t,{UIDialogSettings:function(){return h}});var n=u(77688),s=u(82749),i=u(56075),r=u(11886),o=u(31635),a=u(65478),l=u(67510),F=u(12234),c=u(62357);class h extends l.UIElement{className(){return"UIDialogSettings"}setParentView(e){var t,u;return null==(t=this.modelSelect)||t.setParentView(e),null==(u=this.temperatureInput)||u.setParentView(e),super.setParentView(e)}build(){return(0,n._)(function*(){var e,t,u,n,s;let i=this.container,r=this.getConversation().options||{};if(this.options.dialogSettings.models&&this.options.dialogSettings.models.length>0){let u=this.parseModels(this.options.dialogSettings.models),n=null!=(e=null!=(t=r.model)?t:this.state.defaultModel)?e:u[0].value;this.modelSelect=new F.UISelect(this.j,{label:"Model",name:"model",value:n,options:u,onChange:this.onModelChange.bind(this)}),i.appendChild(this.modelSelect.container)}if(this.options.dialogSettings.temperature){this.temperatureInput=new c.UIRange(this.j,{label:"Temperature",name:"temperature",min:this.options.dialogSettings.temperature.min,max:this.options.dialogSettings.temperature.max,value:null!=(u=null!=(n=r.temperature)?n:this.state.defaultTemperature)?u:.5,onChange:this.onTemperatureChange.bind(this)});let e=this.temperatureInput.nativeInput;e&&e.setAttribute("step",String(null!=(s=this.options.dialogSettings.temperature.step)?s:.1)),i.appendChild(this.temperatureInput.container)}}).call(this)}parseModels(e){return 0===e.length?[]:"object"==typeof e[0]&&"title"in e[0]?e.map(e=>({text:e.title,value:e.value})):e.map(e=>({text:e,value:e}))}onModelChange(){return(0,n._)(function*(){if(!this.modelSelect)return;let e=this.modelSelect.value;this.updateConversation({options:(0,r._)((0,i._)({},this.getConversation().options),{model:e})}),this.state.defaultModel=e}).call(this)}onTemperatureChange(){return(0,n._)(function*(){if(!this.temperatureInput)return;let e=parseFloat(this.temperatureInput.value);this.updateConversation({options:(0,r._)((0,i._)({},this.getConversation().options),{temperature:e})}),this.state.defaultTemperature=e}).call(this)}onDefaultModelChange(){this.modelSelect&&this.state.defaultModel&&(this.modelSelect.value=this.state.defaultModel)}onDefaultTemperatureChange(){this.temperatureInput&&void 0!==this.state.defaultTemperature&&(this.temperatureInput.value=String(this.state.defaultTemperature))}destruct(){var e;null==(e=this.modelSelect)||e.destruct(),super.destruct()}constructor(e,t,u,n,i){super(e),(0,s._)(this,"getConversation",void 0),(0,s._)(this,"updateConversation",void 0),(0,s._)(this,"state",void 0),(0,s._)(this,"options",void 0),(0,s._)(this,"modelSelect",void 0),(0,s._)(this,"temperatureInput",void 0),this.getConversation=t,this.updateConversation=u,this.state=n,this.options=i,this.modelSelect=null,this.temperatureInput=null,this.build()}}(0,o.__decorate)([(0,a.watch)("state.defaultModel")],h.prototype,"onDefaultModelChange",null),(0,o.__decorate)([(0,a.watch)("state.defaultTemperature")],h.prototype,"onDefaultTemperatureChange",null),h=(0,o.__decorate)([a.component],h)},71102:function(e,t,u){"use strict";u.d(t,{UIGlobalSettings:function(){return F}});var n=u(77688),s=u(82749),i=u(31635),r=u(65478),o=u(67510),a=u(80256),l=u(12234);class F extends o.UIElement{className(){return"UIGlobalSettings"}setParentView(e){var t,u,n;return null==(t=this.displayModeSelect)||t.setParentView(e),null==(u=this.panelWidthInput)||u.setParentView(e),null==(n=this.themeSelect)||n.setParentView(e),super.setParentView(e)}build(){return(0,n._)(function*(){var e,t,u,n,s,i;let r=this.container;this.options.allowEditDisplayMode&&(this.displayModeSelect=new l.UISelect(this.j,{label:"Display Mode",name:"displayMode",value:null!=(e=null==(t=this.state)?void 0:t.displayMode)?e:"right",options:[{text:"Dialog",value:"dialog"},{text:"Flight",value:"flight"},{text:"Left",value:"left"},{text:"Right",value:"right"},{text:"Top",value:"top"},{text:"Bottom",value:"bottom"}],onChange:()=>{this.onDisplayModeChange()}}),r.appendChild(this.displayModeSelect.container)),this.options.allowEditPanelWidth&&(this.panelWidthInput=new a.UIInput(this.j,{label:"Panel Width",name:"panelWidth",type:"number",value:String(null!=(u=null==(n=this.state)?void 0:n.panelWidth)?u:400),onChange:()=>{this.onPanelWidthChange()}}),this.panelWidthInput.nativeInput.setAttribute("min","200"),this.panelWidthInput.nativeInput.setAttribute("max","800"),this.panelWidthInput.nativeInput.setAttribute("step","10"),r.appendChild(this.panelWidthInput.container)),this.options.allowEditTheme&&(this.themeSelect=new l.UISelect(this.j,{label:"Theme",name:"theme",value:null!=(s=null==(i=this.state)?void 0:i.theme)?s:"parent",options:[{text:"Inherit",value:"parent"},{text:"Light",value:"light"},{text:"Dark",value:"dark"}],onChange:()=>{this.onThemeChange()}}),r.appendChild(this.themeSelect.container))}).call(this)}onDisplayModeChange(){return(0,n._)(function*(){this.displayModeSelect&&(this.state.displayMode=this.displayModeSelect.value,this.j.async.setTimeout(()=>(0,n._)(function*(){this.j.e.fire("closeAIAssistantPro.ai-assistant-pro"),yield this.j.async.requestIdlePromise(),this.j.e.fire("openAIAssistantPro.ai-assistant-pro")}).call(this),100))}).call(this)}onPanelWidthChange(){return(0,n._)(function*(){if(!this.panelWidthInput)return;let e=parseInt(this.panelWidthInput.value,10);isNaN(e)||e<200||e>800||(this.state.panelWidth=e)}).call(this)}onThemeChange(){return(0,n._)(function*(){this.themeSelect&&(this.state.theme=this.themeSelect.value)}).call(this)}destruct(){var e,t,u;null==(e=this.displayModeSelect)||e.destruct(),null==(t=this.panelWidthInput)||t.destruct(),null==(u=this.themeSelect)||u.destruct(),super.destruct()}onStateDisplayModeChange(){this.displayModeSelect&&(this.displayModeSelect.value=this.state.displayMode)}onStatePanelWidthChange(){this.panelWidthInput&&this.panelWidthInput.value!==String(this.state.panelWidth)&&(this.panelWidthInput.value=String(this.state.panelWidth))}onStateThemeChange(){this.themeSelect&&(this.themeSelect.value=this.state.theme)}constructor(e,t,u){super(e),(0,s._)(this,"state",void 0),(0,s._)(this,"options",void 0),(0,s._)(this,"displayModeSelect",void 0),(0,s._)(this,"panelWidthInput",void 0),(0,s._)(this,"themeSelect",void 0),this.state=t,this.options=u,this.displayModeSelect=null,this.panelWidthInput=null,this.themeSelect=null,this.build()}}(0,i.__decorate)([(0,r.watch)("state.displayMode")],F.prototype,"onStateDisplayModeChange",null),(0,i.__decorate)([(0,r.watch)("state.panelWidth")],F.prototype,"onStatePanelWidthChange",null),(0,i.__decorate)([(0,r.watch)("state.theme")],F.prototype,"onStateThemeChange",null),F=(0,i.__decorate)([r.component],F)},79455:function(e,t,u){"use strict";u.d(t,{UISettingsPopup:function(){return F}});var n=u(77688),s=u(82749),i=u(31635),r=u(16015),o=u(71102),a=u(65478),l=u(67510);class F extends l.UIElement{className(){return"UISettingsPopup"}onChangeTheme(){return(0,n._)(function*(){var e,t,u;let n=(null==(e=this.state)?void 0:e.theme)&&(null==(t=this.state)?void 0:t.theme)!=="parent"?null==(u=this.state)?void 0:u.theme:this.j.o.theme;this.container.classList.remove("jodit_theme_dark","jodit_theme_light"),this.container.classList.add("jodit_theme_"+n)}).call(this)}update(){var e,t;return null==(e=this.dialogSettings)||e.update(),null==(t=this.globalSettings)||t.update(),this.updateContent(),super.update()}setParentView(e){var t,u;return null==(t=this.globalSettings)||t.setParentView(e),null==(u=this.dialogSettings)||u.setParentView(e),super.setParentView(e)}render(){return`<div class="&__container">
|
|
48
|
+
</div>`}afterRender(){let e=this.getElm("icon");e&&(e.innerHTML=l.Icon.get("shield")||""),this.createControls(),this.updateContent()}createControls(){let e=this.getElm("actions-buttons"),t=this.getElm("actions-scope");this.denyButton=new o.UIButton(this.j,{text:this.j.i18n("Deny"),variant:"initial",size:"small",name:"deny-permission"}),this.j.e.on(this.denyButton,"click",this.onDeny),this.approveButton=new o.UIButton(this.j,{text:"Allow",variant:"initial",size:"small",name:"approve-permission"}),this.j.e.on(this.approveButton,"click",this.onApprove),this.scopeSelect=new a.UISelect(this.j,{name:"permission-scope",options:[{value:"once",text:this.j.i18n("Once")},{value:"conversation",text:this.j.i18n("This conversation")},{value:"forever",text:this.j.i18n("Always")}]}),this.scopeSelect.value=this.state.defaultPermissionScope,e.appendChild(this.denyButton.container),e.appendChild(this.approveButton.container),t.appendChild(this.scopeSelect.container)}updateContent(){if(!this.toolCall)return;let e=this.getElm("tool-info");e.innerHTML="";let t=this.j.c.div(this.getFullElName("tool-name"));t.textContent=this.j.i18n(this.toolCall.name);let u=this.j.c.div(this.getFullElName("tool-args"));u.textContent=this.formatArguments(this.toolCall.arguments),e.appendChild(t),e.appendChild(u)}formatArguments(e){return Object.entries(e).map(([e,t])=>`${e}: ${JSON.stringify(t)}`).join(", ")}onApprove(){var e;let t=null==(e=this.scopeSelect)?void 0:e.value;this.j.e.fire("approveToolCall.ai-assistant-pro",this.toolCall.id,t)}onDeny(){this.j.e.fire("denyToolCall.ai-assistant-pro",this.toolCall.id)}destruct(){var e,t,u;null==(e=this.scopeSelect)||e.destruct(),null==(t=this.approveButton)||t.destruct(),null==(u=this.denyButton)||u.destruct(),super.destruct()}constructor(e,t){super(e),(0,n._)(this,"state",void 0),(0,n._)(this,"toolCall",void 0),(0,n._)(this,"scopeSelect",void 0),(0,n._)(this,"approveButton",void 0),(0,n._)(this,"denyButton",void 0),this.state=t,this.scopeSelect=null,this.approveButton=null,this.denyButton=null}}(0,s.__decorate)([(0,i.hook)("ready")],F.prototype,"afterRender",null),(0,s.__decorate)([i.autobind],F.prototype,"onApprove",null),(0,s.__decorate)([i.autobind],F.prototype,"onDeny",null),F=(0,s.__decorate)([i.component],F)},48705:function(e,t,u){"use strict";u.d(t,{UISettingsButton:function(){return n.UISettingsButton}});var n=u(76697)},76697:function(e,t,u){"use strict";u.d(t,{UISettingsButton:function(){return F}});var n=u(82749),s=u(31635),i=u(79455),r=u(87325),o=u(37133),a=u(48538),l=u(78644);class F extends a.UIElement{className(){return"UISettingsButton"}setParentView(e){var t,u;return null==(t=this.settingsPopup)||t.setParentView(e),null==(u=this.button)||u.setParentView(e),super.setParentView(e)}onChangeOptionsClosePopup(e){this.closeCallback()}openSettingsPopup(){return this.settingsPopup||(this.settingsPopup=new i.UISettingsPopup(this.jodit,this.extraState,this.options,this.getConversation,this.updateConversation)),this.settingsPopup.update(),this.settingsPopup}constructor(e,t,u,s,i){super(e),(0,n._)(this,"extraState",void 0),(0,n._)(this,"options",void 0),(0,n._)(this,"getConversation",void 0),(0,n._)(this,"updateConversation",void 0),(0,n._)(this,"closeCallback",void 0),(0,n._)(this,"settingsPopup",void 0),(0,n._)(this,"button",void 0),this.extraState=t,this.options=u,this.getConversation=s,this.updateConversation=i,this.closeCallback=()=>{},this.settingsPopup=null,this.button=new l.ToolbarButton(this.jodit,{name:"settings",tooltip:"Settings",popup:(e,t,u)=>(this.closeCallback=u,this.openSettingsPopup())}),this.button.state.variant="initial",this.button.state.size="small",this.container.appendChild(this.button.container)}}(0,s.__decorate)([(0,o.watch)("extraState.displayMode")],F.prototype,"onChangeOptionsClosePopup",null),F=(0,s.__decorate)([r.component],F)},16015:function(e,t,u){"use strict";u.d(t,{UIDialogSettings:function(){return h}});var n=u(77688),s=u(82749),i=u(56075),r=u(11886),o=u(31635),a=u(65478),l=u(67510),F=u(12234),c=u(62357);class h extends l.UIElement{className(){return"UIDialogSettings"}setParentView(e){var t,u;return null==(t=this.modelSelect)||t.setParentView(e),null==(u=this.temperatureInput)||u.setParentView(e),super.setParentView(e)}build(){return(0,n._)(function*(){var e,t,u,n,s;let i=this.container,r=this.getConversation().options||{};if(this.options.dialogSettings.models&&this.options.dialogSettings.models.length>0){let u=this.parseModels(this.options.dialogSettings.models),n=null!=(e=null!=(t=r.model)?t:this.state.defaultModel)?e:u[0].value;this.modelSelect=new F.UISelect(this.j,{label:"Model",name:"model",value:n,options:u,onChange:this.onModelChange.bind(this)}),i.appendChild(this.modelSelect.container)}if(this.options.dialogSettings.temperature){this.temperatureInput=new c.UIRange(this.j,{label:"Temperature",name:"temperature",min:this.options.dialogSettings.temperature.min,max:this.options.dialogSettings.temperature.max,value:null!=(u=null!=(n=r.temperature)?n:this.state.defaultTemperature)?u:.5,onChange:this.onTemperatureChange.bind(this)});let e=this.temperatureInput.nativeInput;e&&e.setAttribute("step",String(null!=(s=this.options.dialogSettings.temperature.step)?s:.1)),i.appendChild(this.temperatureInput.container)}}).call(this)}parseModels(e){return 0===e.length?[]:"object"==typeof e[0]&&"title"in e[0]?e.map(e=>({text:e.title,value:e.value})):e.map(e=>({text:e,value:e}))}onModelChange(){return(0,n._)(function*(){if(!this.modelSelect)return;let e=this.modelSelect.value;this.updateConversation({options:(0,r._)((0,i._)({},this.getConversation().options),{model:e})}),this.state.defaultModel=e}).call(this)}onTemperatureChange(){return(0,n._)(function*(){if(!this.temperatureInput)return;let e=parseFloat(this.temperatureInput.value);this.updateConversation({options:(0,r._)((0,i._)({},this.getConversation().options),{temperature:e})}),this.state.defaultTemperature=e}).call(this)}onDefaultModelChange(){this.modelSelect&&this.state.defaultModel&&(this.modelSelect.value=this.state.defaultModel)}onDefaultTemperatureChange(){this.temperatureInput&&void 0!==this.state.defaultTemperature&&(this.temperatureInput.value=String(this.state.defaultTemperature))}destruct(){var e;null==(e=this.modelSelect)||e.destruct(),super.destruct()}constructor(e,t,u,n,i){super(e),(0,s._)(this,"getConversation",void 0),(0,s._)(this,"updateConversation",void 0),(0,s._)(this,"state",void 0),(0,s._)(this,"options",void 0),(0,s._)(this,"modelSelect",void 0),(0,s._)(this,"temperatureInput",void 0),this.getConversation=t,this.updateConversation=u,this.state=n,this.options=i,this.modelSelect=null,this.temperatureInput=null,this.build()}}(0,o.__decorate)([(0,a.watch)("state.defaultModel")],h.prototype,"onDefaultModelChange",null),(0,o.__decorate)([(0,a.watch)("state.defaultTemperature")],h.prototype,"onDefaultTemperatureChange",null),h=(0,o.__decorate)([a.component],h)},71102:function(e,t,u){"use strict";u.d(t,{UIGlobalSettings:function(){return F}});var n=u(77688),s=u(82749),i=u(31635),r=u(65478),o=u(67510),a=u(80256),l=u(12234);class F extends o.UIElement{className(){return"UIGlobalSettings"}setParentView(e){var t,u,n;return null==(t=this.displayModeSelect)||t.setParentView(e),null==(u=this.panelWidthInput)||u.setParentView(e),null==(n=this.themeSelect)||n.setParentView(e),super.setParentView(e)}build(){return(0,n._)(function*(){var e,t,u,n,s,i;let r=this.container;this.options.allowEditDisplayMode&&(this.displayModeSelect=new l.UISelect(this.j,{label:"Display Mode",name:"displayMode",value:null!=(e=null==(t=this.state)?void 0:t.displayMode)?e:"right",options:[{text:"Dialog",value:"dialog"},{text:"Flight",value:"flight"},{text:"Left",value:"left"},{text:"Right",value:"right"},{text:"Top",value:"top"},{text:"Bottom",value:"bottom"}],onChange:()=>{this.onDisplayModeChange()}}),r.appendChild(this.displayModeSelect.container)),this.options.allowEditPanelWidth&&(this.panelWidthInput=new a.UIInput(this.j,{label:"Panel Width",name:"panelWidth",type:"number",value:String(null!=(u=null==(n=this.state)?void 0:n.panelWidth)?u:400),onChange:()=>{this.onPanelWidthChange()}}),this.panelWidthInput.nativeInput.setAttribute("min","200"),this.panelWidthInput.nativeInput.setAttribute("max","800"),this.panelWidthInput.nativeInput.setAttribute("step","10"),r.appendChild(this.panelWidthInput.container)),this.options.allowEditTheme&&(this.themeSelect=new l.UISelect(this.j,{label:"Theme",name:"theme",value:null!=(s=null==(i=this.state)?void 0:i.theme)?s:"parent",options:[{text:"Inherit",value:"parent"},{text:"Light",value:"light"},{text:"Dark",value:"dark"}],onChange:()=>{this.onThemeChange()}}),r.appendChild(this.themeSelect.container))}).call(this)}onDisplayModeChange(){return(0,n._)(function*(){this.displayModeSelect&&(this.state.displayMode=this.displayModeSelect.value,this.j.async.setTimeout(()=>(0,n._)(function*(){this.j.e.fire("closeAIAssistantPro.ai-assistant-pro"),yield this.j.async.requestIdlePromise(),this.j.e.fire("openAIAssistantPro.ai-assistant-pro")}).call(this),100))}).call(this)}onPanelWidthChange(){return(0,n._)(function*(){if(!this.panelWidthInput)return;let e=parseInt(this.panelWidthInput.value,10);isNaN(e)||e<200||e>800||(this.state.panelWidth=e)}).call(this)}onThemeChange(){return(0,n._)(function*(){this.themeSelect&&(this.state.theme=this.themeSelect.value)}).call(this)}destruct(){var e,t,u;null==(e=this.displayModeSelect)||e.destruct(),null==(t=this.panelWidthInput)||t.destruct(),null==(u=this.themeSelect)||u.destruct(),super.destruct()}onStateDisplayModeChange(){this.displayModeSelect&&(this.displayModeSelect.value=this.state.displayMode)}onStatePanelWidthChange(){this.panelWidthInput&&this.panelWidthInput.value!==String(this.state.panelWidth)&&(this.panelWidthInput.value=String(this.state.panelWidth))}onStateThemeChange(){this.themeSelect&&(this.themeSelect.value=this.state.theme)}constructor(e,t,u){super(e),(0,s._)(this,"state",void 0),(0,s._)(this,"options",void 0),(0,s._)(this,"displayModeSelect",void 0),(0,s._)(this,"panelWidthInput",void 0),(0,s._)(this,"themeSelect",void 0),this.state=t,this.options=u,this.displayModeSelect=null,this.panelWidthInput=null,this.themeSelect=null,this.build()}}(0,i.__decorate)([(0,r.watch)("state.displayMode")],F.prototype,"onStateDisplayModeChange",null),(0,i.__decorate)([(0,r.watch)("state.panelWidth")],F.prototype,"onStatePanelWidthChange",null),(0,i.__decorate)([(0,r.watch)("state.theme")],F.prototype,"onStateThemeChange",null),F=(0,i.__decorate)([r.component],F)},79455:function(e,t,u){"use strict";u.d(t,{UISettingsPopup:function(){return F}});var n=u(77688),s=u(82749),i=u(31635),r=u(16015),o=u(71102),a=u(65478),l=u(67510);class F extends l.UIElement{className(){return"UISettingsPopup"}onChangeTheme(){return(0,n._)(function*(){var e,t,u;let n=(null==(e=this.state)?void 0:e.theme)&&(null==(t=this.state)?void 0:t.theme)!=="parent"?null==(u=this.state)?void 0:u.theme:this.j.o.theme;this.container.classList.remove("jodit_theme_dark","jodit_theme_light"),this.container.classList.add("jodit_theme_"+n)}).call(this)}update(){var e,t;return null==(e=this.dialogSettings)||e.update(),null==(t=this.globalSettings)||t.update(),this.updateContent(),super.update()}setParentView(e){var t,u;return null==(t=this.globalSettings)||t.setParentView(e),null==(u=this.dialogSettings)||u.setParentView(e),super.setParentView(e)}render(){return`<div class="&__container">
|
|
52
49
|
<div class="&__header">
|
|
53
50
|
<h3 class="&__title">~Settings~</h3>
|
|
54
51
|
</div>
|