@ckeditor/ckeditor5-ai 0.0.0-nightly-20230927.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +18 -0
  3. package/README.md +15 -0
  4. package/build/ai.js +4 -0
  5. package/ckeditor5-metadata.json +23 -0
  6. package/lang/contexts.json +43 -0
  7. package/package.json +43 -0
  8. package/src/aiassistant.d.ts +128 -0
  9. package/src/aiassistant.js +23 -0
  10. package/src/aiassistantediting.d.ts +44 -0
  11. package/src/aiassistantediting.js +23 -0
  12. package/src/aiassistantui.d.ts +41 -0
  13. package/src/aiassistantui.js +23 -0
  14. package/src/aiconnector.d.ts +40 -0
  15. package/src/aiconnector.js +23 -0
  16. package/src/augmentation.d.ts +26 -0
  17. package/src/augmentation.js +23 -0
  18. package/src/index.d.ts +9 -0
  19. package/src/index.js +23 -0
  20. package/src/ui/aiassistantcontroller.d.ts +59 -0
  21. package/src/ui/aiassistantcontroller.js +23 -0
  22. package/src/ui/dropdown/aicommandslistview.d.ts +22 -0
  23. package/src/ui/dropdown/aicommandslistview.js +23 -0
  24. package/src/ui/dropdown/buttonlabelwithhighlightview.d.ts +29 -0
  25. package/src/ui/dropdown/buttonlabelwithhighlightview.js +23 -0
  26. package/src/ui/form/aiformcontentarea.d.ts +70 -0
  27. package/src/ui/form/aiformcontentarea.js +23 -0
  28. package/src/ui/form/aiformerrorview.d.ts +26 -0
  29. package/src/ui/form/aiformerrorview.js +23 -0
  30. package/src/ui/form/aiformpromptview.d.ts +46 -0
  31. package/src/ui/form/aiformpromptview.js +23 -0
  32. package/src/ui/form/aiformtextareaview.d.ts +31 -0
  33. package/src/ui/form/aiformtextareaview.js +23 -0
  34. package/src/ui/form/aiformtoolbarview.d.ts +41 -0
  35. package/src/ui/form/aiformtoolbarview.js +23 -0
  36. package/src/ui/form/aiformview.d.ts +125 -0
  37. package/src/ui/form/aiformview.js +23 -0
  38. package/src/ui/form/aihistorylistitemview.d.ts +18 -0
  39. package/src/ui/form/aihistorylistitemview.js +23 -0
  40. package/src/ui/form/aihistorylistview.d.ts +35 -0
  41. package/src/ui/form/aihistorylistview.js +23 -0
  42. package/src/ui/form/prompthistory.d.ts +20 -0
  43. package/src/ui/form/prompthistory.js +23 -0
  44. package/src/ui/showaiassistantcommand.d.ts +26 -0
  45. package/src/ui/showaiassistantcommand.js +23 -0
  46. package/theme/ai-dropdown.css +37 -0
  47. package/theme/ai-form.css +201 -0
  48. package/theme/ai.css +96 -0
  49. package/theme/icons/copy.svg +1 -0
  50. package/theme/icons/error.svg +3 -0
  51. package/theme/icons/magic-wand.svg +7 -0
  52. package/theme/icons/robot-pencil.svg +9 -0
  53. package/theme/icons/submit.svg +3 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ Changelog
2
+ =========
3
+
4
+ All changes in the package are documented at https://github.com/ckeditor/ckeditor5/blob/master/CHANGELOG.md.
package/LICENSE.md ADDED
@@ -0,0 +1,18 @@
1
+ Software License Agreement
2
+ ==========================
3
+
4
+ **CKEditor&nbsp;5 AI feature** (https://ckeditor.com/ckeditor-5/)<br>
5
+ Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
+
7
+ CKEditor&nbsp;5 AI feature is licensed under a commercial license and is protected by copyright law.
8
+ For more details about available licensing options please contact us at sales@cksource.com.
9
+
10
+ Sources of Intellectual Property Included in CKEditor&nbsp;5 AI
11
+ ---------------------------------------------------------------
12
+
13
+ Where not otherwise indicated, all CKEditor&nbsp;5 AI feature content is authored by CKSource engineers and consists of CKSource-owned intellectual property.
14
+
15
+ Trademarks
16
+ ----------
17
+
18
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # CKEditor&nbsp;5 AI
2
+
3
+ [![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-ai.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-ai)
4
+
5
+ ## License
6
+
7
+ **CKEditor&nbsp;5 AI**<br>
8
+ Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
9
+
10
+ CKEditor&nbsp;5 AI is licensed under a commercial license and is protected by copyright law.
11
+ For more details about available licensing options please contact us at sales@cksource.com.
12
+
13
+ ### Trademarks
14
+
15
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
package/build/ai.js ADDED
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */(()=>{var t={488:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var o=i(758),n=i.n(o)()((function(t){return t[1]}));n.push([t.id,":root{--ck-ai-dropdown-view-width:250px;--ck-ai-dropdown-view-list-max-height:250px}.ck.ck-ai-commands-search{width:var(--ck-ai-dropdown-view-width)}.ck.ck-ai-commands-search>.ck-labeled-field-view{padding:var(--ck-spacing-large)}.ck.ck-ai-commands-search>.ck-labeled-field-view .ck-input{min-width:unset}.ck.ck-ai-commands-search>.ck-search__results{border-top:1px solid var(--ck-color-base-border)}.ck.ck-ai-commands-search .ck-list{max-height:var(--ck-ai-dropdown-view-list-max-height);overflow:auto}",""]);const s=n},243:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var o=i(758),n=i.n(o)()((function(t){return t[1]}));n.push([t.id,":root{--ck-ai-form-view-width:470px;--ck-ai-form-content-height:126px;--ck-ai-form-content-background:#fafafa;--ck-ai-form-history-font-size:.9em;--ck-ai-form-error-background:#fcc}.ck .ck-ai-form{width:var(--ck-ai-form-view-width)}@media screen and (max-width:600px){.ck .ck-ai-form{--ck-ai-form-view-width:350px}}.ck .ck-ai-form .ck-ai-form-content{padding:var(--ck-spacing-large);width:100%}.ck .ck-ai-form .ck-ai-form-content .ck-input{width:100%}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area-wrapper{border:1px solid var(--ck-color-base-border);border-radius:2px;max-height:var(--ck-ai-form-content-height);overflow-y:auto;width:100%}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area-wrapper:focus{border:var(--ck-focus-ring);box-shadow:var(--ck-focus-outer-shadow),0 0;outline:none}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area{background-color:var(--ck-ai-form-content-background);display:flex}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area.ck-ai-form__content-area--processing{--ck-color-text:var(--ck-color-input-disabled-text);background-color:var(--ck-color-input-disabled-background)}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area .ck-ai-form__content-field{box-sizing:content-box;min-height:calc(var(--ck-line-height-base)*var(--ck-font-size-base));padding:var(--ck-spacing-tiny) var(--ck-spacing-medium);padding-right:0;white-space:normal;width:100%}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area .ck-ai-form__content-field>*{color:inherit;white-space:normal}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area .ck-spinner-container{margin-right:var(--ck-spacing-medium)}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area .ck-ai-form__copy-button-wrapper{display:flex;flex-direction:column-reverse;padding-left:2px}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area .ck-ai-form__copy-button{bottom:1px;min-height:unset;min-width:unset;padding:4px;position:sticky;right:1px}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area .ck-ai-form__copy-button svg{--ck-icon-size:16px}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__content-area .ck-ai-form__copy-button.ck-ai-form__copy-button--copied{color:inherit}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__toolbar{border:none;margin-bottom:calc(var(--ck-spacing-medium)*2);margin-top:var(--ck-spacing-medium);padding:0}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__loader{align-items:center;display:flex}.ck .ck-ai-form .ck-ai-form-content .ck-ai-form__loader .ck-spinner{box-sizing:border-box}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete{display:flex;justify-content:space-between}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete>.ck-labeled-field-view{flex-grow:1}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete>.ck.ck-button{margin-left:var(--ck-spacing-medium)}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete>.ck-labeled-field-view .ck-button{bottom:var(--ck-spacing-small);font-size:var(--ck-font-size-tiny);min-height:unset;min-width:unset;padding:4px;position:absolute;right:var(--ck-spacing-medium);top:var(--ck-spacing-small)}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete .ck-textarea{padding-right:30px}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete .ck-search__results .ck-list .ck-list__group{grid-column-gap:0;grid-row-gap:0;display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete .ck-search__results .ck-list .ck-list__group>span{grid-area:1/1/2/2}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete .ck-search__results .ck-list .ck-list__group>.ck-button{background:none;font-size:var(--ck-ai-form-history-font-size);grid-area:1/2/2/3;justify-self:start;min-height:auto;padding:0}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete .ck-search__results .ck-list .ck-list__group>.ck-button:hover .ck-button__label{text-decoration:underline}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete .ck-search__results .ck-list .ck-list__group>.ck-list{grid-area:2/1/3/3}.ck .ck-ai-form .ck-ai-form-content .ck-autocomplete .ck-search__results .ck-list .ck-list__group>.ck-list .ck-list__item .ck-button .ck-button__label{font-size:var(--ck-ai-form-history-font-size);line-height:var(--ck-line-height-base);max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ck .ck-ai-form .ck-ai-form__error{align-items:center;background-color:var(--ck-ai-form-error-background);border-radius:2px;color:var(--ck-color-base-text);display:flex;justify-content:center;margin-bottom:var(--ck-spacing-medium);padding:var(--ck-spacing-medium)}",""]);const s=n},692:(t,e,i)=>{"use strict";i.d(e,{Z:()=>s});var o=i(758),n=i.n(o)()((function(t){return t[1]}));n.push([t.id,".ck-ai-assistant-button.ck-ai-theme_violet,.ck-ai-commands-dropdown.ck-ai-theme_violet,.ck-ai-form.ck-ai-theme_violet{--ck-color-button-default-hover-background:#f3ecff;--ck-color-button-default-active-background:#f3ecff;--ck-color-button-on-background:#f3ecff;--ck-color-button-on-hover-background:#e8dff7;--ck-color-button-on-active-background:#f3ecff;--ck-color-button-on-disabled-background:#f3ecff;--ck-color-button-on-color:#743ccd;--ck-color-button-action-background:#743ccd;--ck-color-button-action-hover-background:#6c34c9;--ck-color-button-action-active-background:#6c34c9;--ck-color-button-action-disabled-background:#ba9de6;--ck-color-list-button-hover-background:#f3ecff;--ck-ai-form-content-background:#f9f9f9}.ck-ai-assistant-button.ck-ai-theme_violet .ck-ai-form__submit,.ck-ai-commands-dropdown.ck-ai-theme_violet .ck-ai-form__submit,.ck-ai-form.ck-ai-theme_violet .ck-ai-form__submit{border-color:var(--ck-color-button-action-background);color:var(--ck-color-button-action-background)}.ck-ai-assistant-button.ck-ai-theme_violet .ck-ai-form__submit.ck-disabled,.ck-ai-commands-dropdown.ck-ai-theme_violet .ck-ai-form__submit.ck-disabled,.ck-ai-form.ck-ai-theme_violet .ck-ai-form__submit.ck-disabled{border-color:#ba9de6}.ck-ai-assistant-button.ck-ai-theme_violet:hover,.ck-ai-commands-dropdown.ck-ai-theme_violet>.ck-button:hover{color:var(--ck-color-button-on-color)}.ck .ck-fake-ai-selection{background:var(--ck-color-link-fake-selection)}.ck .ck-fake-ai-selection_collapsed{border-right:1px solid var(--ck-color-base-text);height:100%;margin-right:-1px;outline:1px solid hsla(0,0%,100%,.5)}.ck.ck-content.ck-ai-form__content-field h2{font-size:1.3em}.ck.ck-content.ck-ai-form__content-field h3{font-size:1.2em}.ck.ck-content.ck-ai-form__content-field h4,.ck.ck-content.ck-ai-form__content-field h5,.ck.ck-content.ck-ai-form__content-field h6{font-size:1.1em}.ck.ck-content.ck-ai-form__content-field h2,.ck.ck-content.ck-ai-form__content-field h3,.ck.ck-content.ck-ai-form__content-field h4,.ck.ck-content.ck-ai-form__content-field h5,.ck.ck-content.ck-ai-form__content-field h6,.ck.ck-content.ck-ai-form__content-field ol,.ck.ck-content.ck-ai-form__content-field p,.ck.ck-content.ck-ai-form__content-field ul{line-height:1.7em;margin-block-end:.5em;margin-block-start:.5em}.ck.ck-content.ck-ai-form__content-field>:first-child{margin-top:0}.ck.ck-content.ck-ai-form__content-field>:last-child{margin-bottom:0}",""]);const s=n},758:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i=t(e);return e[2]?"@media ".concat(e[2]," {").concat(i,"}"):i})).join("")},e.i=function(t,i,o){"string"==typeof t&&(t=[[null,t,""]]);var n={};if(o)for(var s=0;s<this.length;s++){var r=this[s][0];null!=r&&(n[r]=!0)}for(var a=0;a<t.length;a++){var c=[].concat(t[a]);o&&n[c[0]]||(i&&(c[2]?c[2]="".concat(i," and ").concat(c[2]):c[2]=i),e.push(c))}},e}},278:(t,e,i)=>{"use strict";var o,n=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},s=function(){var t={};return function(e){if(void 0===t[e]){var i=document.querySelector(e);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}t[e]=i}return t[e]}}(),r=[];function a(t){for(var e=-1,i=0;i<r.length;i++)if(r[i].identifier===t){e=i;break}return e}function c(t,e){for(var i={},o=[],n=0;n<t.length;n++){var s=t[n],c=e.base?s[0]+e.base:s[0],l=i[c]||0,u="".concat(c," ").concat(l);i[c]=l+1;var d=a(u),h={css:s[1],media:s[2],sourceMap:s[3]};-1!==d?(r[d].references++,r[d].updater(h)):r.push({identifier:u,updater:k(h,e),references:1}),o.push(u)}return o}function l(t){var e=document.createElement("style"),o=t.attributes||{};if(void 0===o.nonce){var n=i.nc;n&&(o.nonce=n)}if(Object.keys(o).forEach((function(t){e.setAttribute(t,o[t])})),"function"==typeof t.insert)t.insert(e);else{var r=s(t.insert||"head");if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(e)}return e}var u,d=(u=[],function(t,e){return u[t]=e,u.filter(Boolean).join("\n")});function h(t,e,i,o){var n=i?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(t.styleSheet)t.styleSheet.cssText=d(e,n);else{var s=document.createTextNode(n),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(s,r[e]):t.appendChild(s)}}function m(t,e,i){var o=i.css,n=i.media,s=i.sourceMap;if(n?t.setAttribute("media",n):t.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleSheet)t.styleSheet.cssText=o;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(o))}}var f=null,p=0;function k(t,e){var i,o,n;if(e.singleton){var s=p++;i=f||(f=l(e)),o=h.bind(null,i,s,!1),n=h.bind(null,i,s,!0)}else i=l(e),o=m.bind(null,i,e),n=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(i)};return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else n()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=n());var i=c(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var o=0;o<i.length;o++){var n=a(i[o]);r[n].references--}for(var s=c(t,e),l=0;l<i.length;l++){var u=a(i[l]);0===r[u].references&&(r[u].updater(),r.splice(u,1))}i=s}}}},704:(t,e,i)=>{t.exports=i(79)("./src/core.js")},492:(t,e,i)=>{t.exports=i(79)("./src/engine.js")},273:(t,e,i)=>{t.exports=i(79)("./src/ui.js")},209:(t,e,i)=>{t.exports=i(79)("./src/utils.js")},79:t=>{"use strict";t.exports=CKEditor5.dll}},e={};function i(o){var n=e[o];if(void 0!==n)return n.exports;var s=e[o]={id:o,exports:{}};return t[o](s,s.exports,i),s.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nc=void 0;var o={};(()=>{"use strict";i.r(o),i.d(o,{AIAssistant:()=>Jt});var t=i(209),e=i(704),n=i(273);const s=["schema","editingDowncast","markerToElement","getFirstRange","conversion","editor","setSelection","start","markers","createRange","ai-ui","change","from","toView","getLastMatchingPosition","insertContent","createPositionAfter","model","data","for","has","selection","toModel","end","pluginName","markerToHighlight","removeMarker","ck-fake-ai-selection","ck-fake-ai-selection_collapsed","hideFakeVisualSelection","updateMarker","document","insertContentBelow","init","isContent"];var r,a;r=s,a=180,function(t){for(;--t;)r.push(r.shift())}(++a);const c=function(t,e){return s[t-=0]},l=c("0x5");class u extends e.Plugin{static get[c("0x13")](){return"AIAssistantEditing"}[c("0x1c")](){const{editor:t}=this;t[c("0x22")][c("0xe")](c("0x1f"))[c("0x14")]({model:l,view:{classes:[c("0x16")]}}),t[c("0x22")].for("editingDowncast")[c("0x20")]({model:l,view:{name:"span",classes:["ck-fake-ai-selection",c("0x17")]}})}showFakeVisualSelection(){const t=this[c("0x0")][c("0xc")];t[c("0x6")]((e=>{const i=t[c("0x1a")].selection[c("0x21")]();if(t[c("0x3")][c("0xf")](l))e[c("0x19")](l,{range:i});else if(i[c("0x2")].isAtEnd){const o=i[c("0x2")][c("0x9")]((({item:e})=>!t[c("0x1e")][c("0x1d")](e)),{boundaries:i});e.addMarker(l,{usingOperation:!1,affectsData:!1,range:e[c("0x4")](o,i[c("0x12")])})}else e.addMarker(l,{usingOperation:!1,affectsData:!1,range:i})}))}[c("0x18")](){this[c("0x0")][c("0xc")][c("0x6")]((t=>{t[c("0x15")](l)}))}[c("0xa")](t,e){const i=this.editor[c("0xd")].processor[c("0x8")](t),o=this[c("0x0")][c("0xd")][c("0x11")](i);this[c("0x0")][c("0xc")][c("0x6")]((t=>{const i=this[c("0x0")].model[c("0xa")](o,e);t[c("0x1")](i)}))}[c("0x1b")](t){const e=Array[c("0x7")](this[c("0x0")][c("0xc")][c("0x1a")][c("0x10")].getSelectedBlocks()),i=this[c("0x0")][c("0xc")][c("0xb")](e.pop());this.insertContent(t,i)}}const d=["isLimit","editor","getRanges","execute","selection","schema","isEnabled","refresh","get","getItems","model","document"];var h,m;h=d,m=399,function(t){for(;--t;)h.push(h.shift())}(++m);const f=function(t,e){return d[t-=0]};class p extends e.Command{[f("0x4")](){const t=this[f("0xa")][f("0x7")],e=t[f("0x2")],i=t[f("0x8")][f("0x1")];for(const t of i[f("0xb")]())for(const i of t[f("0x6")]())if(e.isObject(i)||e[f("0x9")](i))return void(this[f("0x3")]=!1);this[f("0x3")]=!0}[f("0x0")](t="",e=""){this[f("0xa")].plugins[f("0x5")](Ft).showUI(t,e,this[f("0xa")][f("0x7")][f("0x8")][f("0x1")])}}const k=["view","finishProcessing","isProcessing","set","submitPrompt","listenTo","render","_handlePrompt","AbortError","connector","processPrompt","handleError","previousContext","destroy","previousPrompt","finally","value"];var g,x;g=k,x=146,function(t){for(;--t;)g.push(g.shift())}(++x);const w=function(t,e){return k[t-=0]};class b extends((0,t.ObservableMixin)()){constructor(t,e,i,o){super(),this[w("0x10")]=t,this[w("0x7")]=e,this[w("0xa")]({previousPrompt:void 0,previousContext:void 0,isProcessing:!1}),o&&this[w("0x7")].once(w("0xd"),(()=>{this[w("0xe")](o,i)})),this.listenTo(this[w("0x7")],w("0xb"),((t,e)=>{const o=this[w("0x7")].value||i;this._handlePrompt(e,o)})),this[w("0xc")](this.view,"tryAgainEvent",(()=>{this._handlePrompt(this[w("0x4")],this[w("0x2")])})),this[w("0xc")](this[w("0x7")],"stopProcessing",(()=>{this[w("0x9")]=!1,this[w("0x10")].abort(),this[w("0x7")][w("0x8")]()}))}[w("0x3")](){this.stopListening()}async _handlePrompt(t,e){return this.isProcessing=!0,this[w("0x7")].startProcessing(),this.previousPrompt=t,this[w("0x2")]=e,new Promise((i=>{this[w("0x10")][w("0x0")](t,e,(t=>this._updateValue(t))).catch((t=>{w("0xf")!==t.name&&this[w("0x7")][w("0x1")](),i()}))[w("0x5")]((()=>{this.isProcessing=!1,this.view[w("0x8")]()}))}))}_updateValue(t){this[w("0x7")][w("0x6")]=""+t}}class v extends n.ToolbarView{constructor(t){super(t);const e=t.t;this.set("isVisible",!1),this.replaceButton=this._createButton(e("Replace"),"ck-button-action"),this.insertButton=this._createButton(e("Insert below")),this.tryAgainButton=this._createButton(e("Try again")),this.stopButton=this._createButton(e("Stop"));const i=this.bindTemplate;this.extendTemplate({attributes:{class:["ck-ai-form__toolbar",i.if("isVisible","ck-hidden",(t=>!t))]}}),this.items.addMany([this.replaceButton,this.insertButton,this.tryAgainButton,this.stopButton])}_createButton(t,e){const i=new n.ButtonView(this.locale);return i.set({label:t,class:e||"",isVisible:!0,withText:!0}),i}}const _='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M5 2.801a.7.7 0 0 0-.7.7v11.5a.8.8 0 0 1-1.6 0v-11.5a2.3 2.3 0 0 1 2.3-2.3h6.5a.8.8 0 0 1 0 1.6H5Zm.7 3.7a2.3 2.3 0 0 1 2.3-2.3h7a2.3 2.3 0 0 1 2.3 2.3v10a2.3 2.3 0 0 1-2.3 2.3H8a2.3 2.3 0 0 1-2.3-2.3v-10Zm2.3-.7a.7.7 0 0 0-.7.7v10a.7.7 0 0 0 .7.7h7a.7.7 0 0 0 .7-.7v-10a.7.7 0 0 0-.7-.7H8Z"/></svg>';class y extends n.View{constructor(t){super(t),this.set({value:null,isVisible:!1,isProcessing:!1});const e=this.bindTemplate;this.contentFieldView=new C(t),this.copyButtonView=this._createCopyButton(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-ai-form__content-area-wrapper",e.if("isVisible","ck-hidden",(t=>!t))],tabindex:"-1"},children:[{tag:"div",attributes:{class:["ck","ck-ai-form__content-area",e.if("isProcessing","ck-ai-form__content-area--processing")]},children:[this.contentFieldView,{tag:"div",attributes:{class:["ck","ck-ai-form__copy-button-wrapper"]},children:[this.copyButtonView]}]}]})}render(){super.render(),this.value&&this.contentFieldView.setContent(this.value),this.on("change:value",((t,e,i)=>{this.contentFieldView.setContent(i),this.isProcessing&&this.value&&this.element.scrollTo({top:this.element.scrollHeight,behavior:"smooth"})})),this.on("change:isProcessing",((t,e,i)=>{i?(this.value=null,this.contentFieldView.appendLoader()):this.value||this.contentFieldView.setContent("")}))}focus(){this.element.focus()}_createCopyButton(){const t=this.locale.t,i=new n.ButtonView(this.locale),o="ck-ai-form__copy-button";return i.set({label:t("Copy"),icon:_,class:o,tooltip:!0}),i.bind("isVisible").to(this,"value",(t=>!!t)),i.bind("isEnabled").to(this,"isProcessing",(t=>!t)),i.on("execute",(()=>{this._copyHTMLToClipboard(this.contentFieldView.element),i.icon=e.icons.check,i.class=o+" ck-ai-form__copy-button--copied",this.focus(),setTimeout((()=>{i.icon=_,i.class=o}),1e3)})),i}_copyHTMLToClipboard(e){const{window:i,document:o}=t.global;if(i.ClipboardItem){const{Blob:t,ClipboardItem:o}=i,n=[new o({"text/html":new t([e.innerHTML],{type:"text/html"}),"text/plain":new t([e.textContent||""],{type:"text/plain"})})];navigator.clipboard.write(n)}else{const t=o.createElement("div");t.style.position="absolute",t.style.left="-9999px",t.innerHTML=e.innerHTML,o.body.appendChild(t);const n=o.createRange();n.selectNodeContents(t);const s=i.getSelection();s.removeAllRanges(),s.addRange(n),o.execCommand("copy"),t.remove()}}}class C extends n.View{constructor(t){super(t),this.loaderView=this._createLoader(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-reset_all-excluded","ck-ai-form__content-field"]}})}setContent(t){this.element.innerHTML=t}appendLoader(){this.element.appendChild(this.loaderView.element)}_createLoader(){const t=new n.View,e=this.locale.t,i=new n.SpinnerView;return i.isVisible=!0,t.setTemplate({tag:"div",attributes:{class:["ck","ck-ai-form__loader"]},children:[i,{text:e("AI is writing...")}]}),t.render(),t}}const V=["bindTemplate","ck-ai-form__error","text","set"];var L,T;L=V,T=496,function(t){for(;--t;)L.push(L.shift())}(++T);const A=function(t,e){return V[t-=0]};class I extends n.View{constructor(t,e=""){super(t);const i=new n.IconView,o=this[A("0x0")];this[A("0x3")]("text",e),i.content='<svg width="21" height="20" viewBox="0 0 21 20" xmlns="http://www.w3.org/2000/svg">\n\t<path fill-rule="evenodd" clip-rule="evenodd" d="M9.4607 4.82501C9.92258 4.02501 11.0773 4.02501 11.5392 4.82501L16.8219 13.975C17.2838 14.775 16.7064 15.775 15.7827 15.775H5.21717C4.29341 15.775 3.71606 14.775 4.17794 13.975L9.4607 4.82501ZM9.76538 8.02501C9.76538 7.85932 9.8997 7.72501 10.0654 7.72501H10.9654C11.1311 7.72501 11.2654 7.85932 11.2654 8.02501V11.425C11.2654 11.5907 11.1311 11.725 10.9654 11.725H10.0654C9.8997 11.725 9.76538 11.5907 9.76538 11.425V8.02501ZM10.0654 12.725C9.8997 12.725 9.76538 12.8593 9.76538 13.025V13.925C9.76538 14.0907 9.8997 14.225 10.0654 14.225H10.9654C11.1311 14.225 11.2654 14.0907 11.2654 13.925V13.025C11.2654 12.8593 11.1311 12.725 10.9654 12.725H10.0654Z" />\n</svg>\n',this.setTemplate({tag:"div",attributes:{class:["ck",A("0x1")]},children:[i,{text:o.to(A("0x2"))}]})}}const S=function(t){return function(e){return null==t?void 0:t[e]}};const B=S({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});const M="object"==typeof global&&global&&global.Object===Object&&global;var P="object"==typeof self&&self&&self.Object===Object&&self;const E=(M||P||Function("return this")()).Symbol;const H=function(t,e){for(var i=-1,o=null==t?0:t.length,n=Array(o);++i<o;)n[i]=e(t[i],i,t);return n};const j=Array.isArray;var O=Object.prototype,R=O.hasOwnProperty,F=O.toString,N=E?E.toStringTag:void 0;const Z=function(t){var e=R.call(t,N),i=t[N];try{t[N]=void 0;var o=!0}catch(t){}var n=F.call(t);return o&&(e?t[N]=i:delete t[N]),n};var U=Object.prototype.toString;const K=function(t){return U.call(t)};var z=E?E.toStringTag:void 0;const q=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":z&&z in Object(t)?Z(t):K(t)};const D=function(t){return null!=t&&"object"==typeof t};const G=function(t){return"symbol"==typeof t||D(t)&&"[object Symbol]"==q(t)};var J=E?E.prototype:void 0,W=J?J.toString:void 0;const Y=function t(e){if("string"==typeof e)return e;if(j(e))return H(e,t)+"";if(G(e))return W?W.call(e):"";var i=e+"";return"0"==i&&1/e==-Infinity?"-0":i};const X=function(t){return null==t?"":Y(t)};var $=/[&<>"']/g,Q=RegExp($.source);const tt=function(t){return(t=X(t))&&Q.test(t)?t.replace($,B):t};class et extends n.AutocompleteView{constructor(t,e){super(t,e),this.queryView.fieldView.minRows=1,this.queryView.fieldView.maxRows=3,this.submitButtonView=this._createSubmitButton(),this.showHistoryButtonView=this._createShowHistoryButton(),this.focusableChildren.add(this.showHistoryButtonView,1),this.focusableChildren.add(this.submitButtonView)}render(){super.render(),this.queryView.fieldWrapperChildren.add(this.showHistoryButtonView),this.children.add(this.submitButtonView),this.keystrokes.set("enter",((t,e)=>{t.target==this.queryView.fieldView.element&&(this.submit(),e())}))}_createSubmitButton(){const t=new n.ButtonView(this.locale),e=this.locale.t;return t.set({icon:'<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">\n\t<path d="M15.875 4.41895C15.875 4.00473 15.5392 3.66895 15.125 3.66895C14.7108 3.66895 14.375 4.00473 14.375 4.41895V11.6689L6.81789 11.6682L9.14889 9.71422C9.30139 9.58638 9.39686 9.4032 9.41431 9.20498C9.43175 9.00675 9.36973 8.80972 9.24189 8.65722C9.11406 8.50472 8.93088 8.40925 8.73266 8.39181C8.53443 8.37436 8.33739 8.43638 8.18489 8.56422L4.39289 11.7462C4.25851 11.859 4.16791 12.0153 4.13685 12.1879C4.10579 12.3606 4.13624 12.5387 4.22289 12.6912C4.26918 12.8013 4.3412 12.8987 4.43289 12.9752L8.22089 16.1552C8.37326 16.2832 8.57022 16.3454 8.76845 16.3281C8.96667 16.3109 9.14993 16.2156 9.27789 16.0632C9.40586 15.9109 9.46806 15.7139 9.45081 15.5157C9.43355 15.3174 9.33826 15.1342 9.18589 15.0062L6.99689 13.1692L14.625 13.1689C15.3154 13.1689 15.875 12.6093 15.875 11.9189V4.41895Z"/>\n</svg>\n',label:e("Submit"),isVisible:!0,tooltip:!0,class:"ck-ai-form__submit"}),t.on("execute",(()=>{this.submit()})),t.bind("isEnabled").to(this.queryView.fieldView,"isEmpty",this,"isEnabled",((t,e)=>!t&&e)),t}_createShowHistoryButton(){const i=new n.ButtonView(this.locale),o=this.resultsView,s=this.locale.t;i.set({label:s("History"),withText:!1,icon:e.icons.history,tooltip:!0,tooltipPosition:"sw",class:"ck-ai-form__toggle-history"}),i.bind("isOn").to(o,"isVisible"),i.on("execute",(()=>{o.isVisible=!o.isVisible,o.isVisible?this.filteredView.focus():this.focus()}));const r=()=>{t.global.window.requestAnimationFrame((()=>{const e=new t.Rect(this.queryView.fieldView.element),o=e.width;e.excludeScrollbarsAndBorders(),i.element.style.right=o-e.width+1+"px"}))};return this.queryView.fieldView.on("update",r),this.on("render",r),i}submit(){const t=this.queryView.fieldView.element.value;this.fire("submit",tt(t))}focus(t){-1===t?this.focusCycler.focusLast():this.focusCycler.focusFirst()}}class it extends n.ListView{constructor(t){super(t);const e=t.t;this.clearHistoryButton=this._createClearHistoryButton(),this.historyGroupView=new n.ListItemGroupView,this.historyGroupView.children.add(this.clearHistoryButton,1),this.historyGroupView.label=e("Prompt history"),this.historyGroupView.items.delegate("execute").to(this),this.items.add(this.historyGroupView)}filter(){let t=0;for(const e of this.items)t+=e.items.length;return{resultsCount:t,totalItemsCount:t}}_createClearHistoryButton(){const t=this.locale.t,e=new n.ButtonView(this.locale);return e.set({label:"("+t("Clear")+")",withText:!0}),e.on("execute",(()=>this.fire("clearHistory"))),e}}const ot=["bindTemplate","extendTemplate","ck-button__label","set"];var nt,st;nt=ot,st=373,function(t){for(;--t;)nt.push(nt.shift())}(++st);const rt=function(t,e){return ot[t-=0]};class at extends n.HighlightedTextView{constructor(){super(),this[rt("0x2")]({style:void 0,text:void 0,id:void 0});const t=this[rt("0x3")];this[rt("0x0")]({attributes:{class:[rt("0x1")],style:t.to("style"),id:t.to("id")}})}}const ct=S({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var lt=/&(?:amp|lt|gt|quot|#39);/g,ut=RegExp(lt.source);const dt=function(t){return(t=X(t))&&ut.test(t)?t.replace(lt,ct):t},ht=["locale","children","fire","prompt","execute","add"];var mt,ft;mt=ht,ft=403,function(t){for(;--t;)mt.push(mt.shift())}(++ft);const pt=function(t,e){return ht[t-=0]};class kt extends n.ListItemView{constructor(t){super();const e=new at,i=new n.ButtonView(this[pt("0x5")],e);this[pt("0x0")][pt("0x4")](i),i.set({label:t[pt("0x2")],withText:!0}),i.on(pt("0x3"),(()=>{this[pt("0x1")]("execute",{value:dt(t[pt("0x2")])})}))}}const gt=["addMany","getItem","parse","_saveToSessionStorage","last","length","remove","add","setItem","trim","toLowerCase"];var xt,wt;xt=gt,wt=453,function(t){for(;--t;)xt.push(xt.shift())}(++wt);const bt=function(t,e){return gt[t-=0]},vt="CKEditor/AIFormView/PromptHistory";class _t extends t.Collection{constructor(){super(),this._loadFromSessionStorage(),this.on(bt("0x5"),((t,e)=>{const i=yt(e.prompt);for(const t of this)if(t!=e&&yt(t.prompt)===i){this.remove(t);break}this[bt("0x3")]>20&&this[bt("0x4")](this[bt("0x2")]),this[bt("0x1")]()})),this.on(bt("0x4"),(()=>{this[bt("0x1")]()}))}_loadFromSessionStorage(){const t=sessionStorage[bt("0xa")](vt)||"[]";this[bt("0x9")](JSON[bt("0x0")](t))}[bt("0x1")](){sessionStorage[bt("0x6")](vt,JSON.stringify(this.map((t=>t))))}}function yt(t){return t[bt("0x8")]()[bt("0x7")]()}const Ct='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t<path d="M9.60909 2.65998C10.0294 2.41684 10.3122 1.9624 10.3122 1.44191C10.3122 0.665287 9.68256 0.0357056 8.90598 0.0357056C8.12941 0.0357056 7.49977 0.665287 7.49977 1.44191C7.49977 1.9624 7.78255 2.41684 8.20288 2.65998V3.55123H3.28115C2.11618 3.55123 1.17184 4.4956 1.17184 5.66054V15.9727C1.17184 17.1377 2.11618 18.082 3.28115 18.082H8.96467L8.91065 16.9254L9.09039 16.6758H3.28115C2.89287 16.6758 2.57805 16.361 2.57805 15.9727V5.66054C2.57805 5.27222 2.89287 4.95743 3.28115 4.95743H14.5308C14.9191 4.95743 15.2339 5.27222 15.2339 5.66054V8.14542L15.5918 7.64846C15.8698 7.26252 16.2359 6.97909 16.6401 6.80711V5.66054C16.6401 4.4956 15.6958 3.55123 14.5308 3.55123H9.60909V2.65998Z" />\n\t<path d="M5.62483 10.8166C6.14255 10.8166 6.5623 10.1871 6.5623 9.41043C6.5623 8.6338 6.14255 8.00422 5.62483 8.00422C5.10712 8.00422 4.68736 8.6338 4.68736 9.41043C4.68736 10.1871 5.10712 10.8166 5.62483 10.8166Z" />\n\t<path d="M13.1246 9.41043C13.1246 10.1871 12.7048 10.8166 12.1871 10.8166C11.6694 10.8166 11.2497 10.1871 11.2497 9.41043C11.2497 8.6338 11.6694 8.00422 12.1871 8.00422C12.7048 8.00422 13.1246 8.6338 13.1246 9.41043Z" />\n\t<path d="M0.937472 8.00422C0.419757 8.00422 0 8.42394 0 8.94169V10.8166C0 11.3344 0.419757 11.7541 0.937472 11.7541V8.00422Z" />\n\t<path d="M6.1283 12.5093C6.48784 12.2696 6.97361 12.3668 7.2133 12.7263C7.48481 13.1336 8.11961 13.4326 8.90598 13.4326C9.69235 13.4326 10.3272 13.1336 10.5987 12.7263C10.8384 12.3668 11.3241 12.2696 11.6837 12.5093C12.0432 12.749 12.1403 13.2348 11.9007 13.5943C11.2347 14.5933 9.99456 14.9974 8.90598 14.9974C7.8174 14.9974 6.57727 14.5933 5.9113 13.5943C5.67161 13.2348 5.76876 12.749 6.1283 12.5093Z" />\n\t<path d="M16.9868 8.91014L16.3646 9.77394L19.2439 11.8479L19.8661 10.9841C20.0952 10.666 20.0231 10.2225 19.705 9.99342L17.9774 8.74907C17.6594 8.51998 17.2159 8.5921 16.9868 8.91014Z" />\n\t<path d="M11.6347 19.9512C11.4211 20.0106 11.2059 19.8618 11.1861 19.641L10.9724 17.2602L15.9498 10.3498L18.8291 12.4237L13.8517 19.3341L11.6347 19.9512Z" />\n</svg>\n';class Vt extends n.View{constructor(e,i){super(e);const o=this.locale.t;this.set("isProcessing",!1),this.set("prompt",i),this.set("value",""),this.set("isError",!1),this._promptHistory=new _t,this.errorView=new I(e),this.header=new n.FormHeaderView(e,{label:o("AI Assistant"),icon:Ct}),this.contentArea=new y(e),this.contentArea.bind("isProcessing").to(this),this.contentArea.bind("value").to(this),this.toolbar=this._createToolbar(),this.promptView=this._createPromptView(),this.focusTracker=new t.FocusTracker,this.keystrokes=new t.KeystrokeHandler,this._focusables=this.createCollection([this.contentArea,this.contentArea.copyButtonView,this.toolbar,this.promptView]),this._focusCycler=new n.FocusCycler({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.promptView.focusCycler.on("forwardCycle",(t=>{this._focusCycler.focusNext(),t.stop()})),this.promptView.focusCycler.on("backwardCycle",(t=>{this._focusCycler.focusPrevious(),t.stop()}));const s=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-ai-form","ck-ai-theme_violet"],tabindex:"-1"},children:[this.header,{tag:"div",attributes:{class:["ck","ck-ai-form-content"]},children:[{tag:"div",attributes:{class:[s.if("isError","ck-hidden",(t=>!t))]},children:[this.errorView]},this.contentArea,this.toolbar,this.promptView]}]})}render(){super.render(),this.focusTracker.add(this.contentArea.element),this.focusTracker.add(this.contentArea.copyButtonView.element),this.focusTracker.add(this.toolbar.element),this.focusTracker.add(this.promptView.element),this.keystrokes.listenTo(this.element)}focus(){this._focusCycler.focusFirst()}_createPromptView(){const t=this.locale.t,e=new et(this.locale,{queryView:{label:t("Ask AI to edit or generate"),creator:n.createLabeledTextarea,showIcon:!1,showResetButton:!1},infoView:{text:{noSearchableItems:{primary:t("Empty history"),secondary:t("Ask AI and your prompts will be listed here for you to use later.")}}},filteredView:this._createHistoryView(),queryMinChars:1/0,resetOnBlur:!1});return e.bind("isEnabled").to(this,"isProcessing",(t=>!t)),this.listenTo(e,"submit",((t,e)=>{this.prompt=e,this.fire("submitPrompt",this.prompt),e.trim()&&this._promptHistory.add({prompt:e.trim()},0)}),{priority:"high"}),e}_createHistoryView(){const t=new it(this.locale);return t.historyGroupView.items.bindTo(this._promptHistory).as(kt),t.on("clearHistory",(()=>{this._promptHistory.clear(),this.promptView.search(""),this.promptView.focus()})),t}_createToolbar(){const t=new v(this.locale);return t.replaceButton.bind("isEnabled").to(this,"isProcessing",this,"value",((t,e)=>!t&&!!e)),t.replaceButton.on("execute",(()=>{this.fire("replaceContent",this.value)})),t.insertButton.bind("isEnabled").to(this,"isProcessing",this,"value",((t,e)=>!t&&!!e)),t.insertButton.on("execute",(()=>{this.fire("insertContentBelow",this.value)})),t.tryAgainButton.bind("isEnabled").to(this,"isProcessing",(t=>!t)),t.tryAgainButton.on("execute",(()=>{this.fire("tryAgainEvent")})),t.stopButton.bind("isEnabled").to(this,"isProcessing"),t.stopButton.on("execute",(()=>{this.fire("stopProcessing")})),t}startProcessing(){this.value="",this.isError=!1,this.isProcessing=!0,this.contentArea.isVisible=!0,this.toolbar.isVisible=!0,this.contentArea.focus()}finishProcessing(){const t=this.locale.t;this.isProcessing=!1,this.prompt="",this.promptView.reset(),this.value&&(this.promptView.queryView.label=t("Ask AI to improve generated text"))}handleError(){const t=this.locale.t;this.finishProcessing(),this.isError=!0,this.errorView.text=t("Failed to communicate with the AI service"),this.value||(this.contentArea.isVisible=!1)}}const Lt=["label","length","match","first","highlightText","filter","children","isVisible","items"];var Tt,At;Tt=Lt,At=346,function(t){for(;--t;)Tt.push(Tt.shift())}(++At);const It=function(t,e){return Lt[t-=0]};class St extends n.ListView{[It("0x1")](t){let e=0,i=0;for(const o of this.items){const n=o;for(const o of n[It("0x4")]){const n=o[It("0x2")][It("0x8")],s=n.labelView;t?(o[It("0x3")]=!!n[It("0x5")][It("0x7")](t),o.isVisible&&(s[It("0x0")](t),i++)):(o[It("0x3")]=!0,s[It("0x0")](null),i++),e++}n[It("0x3")]=!!n.items[It("0x1")]((t=>t.isVisible))[It("0x6")]}return{resultsCount:i,totalItemsCount:e}}}var Bt=i(278),Mt=i.n(Bt),Pt=i(692),Et={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Mt()(Pt.Z,Et);Pt.Z.locals;var Ht=i(488),jt={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Mt()(Ht.Z,jt);Ht.Z.locals;var Ot=i(243),Rt={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};Mt()(Ot.Z,Rt);Ot.Z.locals;class Ft extends e.Plugin{static get pluginName(){return"AIAssistantUI"}static get requires(){return[u,"AIConnector",n.ContextualBalloon]}init(){const{editor:t}=this,e=t.t;this._aiConnector=t.plugins.get("AIConnector"),this._balloon=t.plugins.get(n.ContextualBalloon),this._formView=null,this.set("_isUIVisible",!1),this.set("_isSelectionCollapsed",!1),t.commands.add("showAIAssistant",new p(t));const i=t.commands.get("showAIAssistant"),o=t.plugins.get(u);t.ui.componentFactory.add("aiCommands",(s=>{const r=(0,n.createDropdown)(s);r.set({class:"ck-ai-commands-dropdown ck-ai-theme_violet"});const a=new n.SearchTextView(s,{filteredView:Nt(t,((t,e)=>{i.execute(t,e)})),queryView:{label:e("Search AI command")},class:"ck-ai-commands-search",infoView:{text:{notFound:{primary:e("No commands found")},noSearchableItems:{primary:e("No commands available")}}}});return r.bind("isEnabled").to(i,"isEnabled",this,"_isSelectionCollapsed",((t,e)=>t&&!e)),r.panelView.children.add(a),r.buttonView.set({label:e("AI Commands"),icon:'<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M15.3459 9.42231C15.3946 9.29064 15.5809 9.29064 15.6296 9.42231L16.1785 10.9056C16.1938 10.947 16.2264 10.9797 16.2678 10.995L17.7512 11.5439C17.8828 11.5926 17.8828 11.7788 17.7512 11.8276L16.2678 12.3764C16.2264 12.3918 16.1938 12.4244 16.1785 12.4658L15.6296 13.9491C15.5809 14.0808 15.3946 14.0808 15.3459 13.9491L14.797 12.4658C14.7817 12.4244 14.7491 12.3918 14.7077 12.3764L13.2243 11.8276C13.0927 11.7788 13.0927 11.5926 13.2243 11.5439L14.7077 10.995C14.7491 10.9797 14.7817 10.947 14.797 10.9056L15.3459 9.42231Z" />\n<path d="M16.306 1.74168C16.3547 1.61001 16.541 1.61001 16.5897 1.74168L17.1386 3.22501C17.1539 3.26641 17.1865 3.29905 17.2279 3.31436L18.7112 3.86325C18.8429 3.91197 18.8429 4.09821 18.7112 4.14693L17.2279 4.69581C17.1865 4.71113 17.1539 4.74377 17.1386 4.78517L16.5897 6.26849C16.541 6.40017 16.3547 6.40017 16.306 6.26849L15.7571 4.78517C15.7418 4.74377 15.7092 4.71113 15.6678 4.69581L14.1844 4.14693C14.0528 4.09821 14.0528 3.91197 14.1844 3.86325L15.6678 3.31436C15.7092 3.29905 15.7418 3.26641 15.7571 3.22501L16.306 1.74168Z" />\n<path d="M7.66528 1.74168C7.714 1.61001 7.90024 1.61001 7.94896 1.74168L8.49784 3.22501C8.51316 3.26641 8.5458 3.29905 8.5872 3.31436L10.0705 3.86325C10.2022 3.91197 10.2022 4.09821 10.0705 4.14693L8.5872 4.69581C8.5458 4.71113 8.51316 4.74377 8.49784 4.78517L7.94896 6.26849C7.90024 6.40017 7.714 6.40017 7.66528 6.26849L7.1164 4.78517C7.10108 4.74377 7.06844 4.71113 7.02704 4.69581L5.54371 4.14693C5.41204 4.09821 5.41204 3.91197 5.54371 3.86325L7.02704 3.31436C7.06844 3.29905 7.10108 3.26641 7.1164 3.22501L7.66528 1.74168Z" />\n<path d="M14.7196 7.94607C14.7981 7.86827 14.8606 7.77595 14.9036 7.67442C14.9466 7.5729 14.9691 7.46418 14.97 7.35455C14.9709 7.24493 14.95 7.13656 14.9087 7.0357C14.8673 6.93484 14.8062 6.8435 14.729 6.76694L12.786 4.82855C12.7095 4.7513 12.6181 4.69023 12.5173 4.64886C12.4164 4.60749 12.308 4.58663 12.1984 4.5875C12.0888 4.58837 11.9801 4.61095 11.8785 4.65392C11.777 4.6969 11.6847 4.75943 11.6069 4.8379L10.0621 6.37704L13.1771 9.49197L14.7185 7.94607L14.7196 7.94607Z" />\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.4712 14.9565C1.09626 15.3314 1.09626 15.9393 1.4712 16.3142L3.23481 18.0778C3.60975 18.4528 4.21764 18.4528 4.59257 18.0778L12.4269 10.2435L9.30551 7.12216L1.4712 14.9565ZM10.4099 10.2455L9.28888 9.12449L2.80995 15.6034L3.93096 16.7244L10.4099 10.2455Z" />\n</svg>\n',tooltip:!0}),r.on("change:isOpen",((t,e,i)=>{i?o.showFakeVisualSelection():this._formView||o.hideFakeVisualSelection()})),r})),t.ui.componentFactory.add("aiAssistant",(t=>{const o=new n.ButtonView(t);return o.set({label:e("AI Assistant"),tooltip:e("AI Assistant"),icon:Ct,class:"ck-ai-assistant-button ck-ai-theme_violet"}),o.bind("isEnabled").to(i),o.bind("isOn").to(this,"_isUIVisible"),this.listenTo(o,"execute",(()=>i.execute())),o})),this.listenTo(this.editor.model.document,"change",(()=>{const t=this.editor.model.document.selection;this._isSelectionCollapsed=t.isCollapsed}))}afterInit(){!function(t){function i(t){return t.map((t=>String.fromCharCode(t))).join("")}(t=>{const o=[1,85,78,115,198,255,50,112,83,87,161],n=[127,34,6,211,167,86,146,199,132,160,18];function s(t){return function(t,e){const o=function(t){const e=atob(t),[o,n]=e[i([115,112,108,105,116])](i([45]));try{if(atob(n))return atob(o)}catch(t){}return e}(t),n=Array[i([102,114,111,109])](function(t){const e=new Uint8Array(t[i([108,101,110,103,116,104])]);for(let o=0;o<t[i([108,101,110,103,116,104])];o++)e[o]=t[i([99,104,97,114,67,111,100,101,65,116])](o);return e}(o)),s=n[i([112,111,112])](),r=n[i([112,111,112])]();return function(t){let e="";for(const o of t)e+=String[i([102,114,111,109,67,104,97,114,67,111,100,101])](o);return e}(function(t,e,o){const n={};n[i([110,117,109,98,101,114,79,102,82,111,117,110,100,115])]={16:10,24:12,32:14},n[i([114,99,111,110])]=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],n[i([83])]=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],n[i([84,49])]=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],n[i([84,50])]=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],n[i([84,51])]=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],n[i([84,52])]=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],n[i([85,49])]=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],n[i([85,50])]=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],n[i([85,51])]=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],n[i([85,52])]=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];const s=new Uint8Array(16);for(let t=15;t>=0;--t)s[t]=o%256,o=parseInt(o/256);let r=null,a=16;const c=new Uint8Array(e),l=[],u=[];!function(){const t=n[i([110,117,109,98,101,114,79,102,82,111,117,110,100,115])][c[i([108,101,110,103,116,104])]];for(let e=0;e<=t;e++)l[i([112,117,115,104])]([0,0,0,0]),u[i([112,117,115,104])]([0,0,0,0]);const e=4*(t+1),o=c[i([108,101,110,103,116,104])]/4,s=d(c);let r;for(let e=0;e<o;e++)r=e>>2,l[r][e%4]=s[e],u[t-r][e%4]=s[e];let a,h=0,m=o;for(;m<e;){a=s[o-1],s[0]^=n[i([83])][a>>16&255]<<24^n[i([83])][a>>8&255]<<16^n[i([83])][255&a]<<8^n[i([83])][a>>24&255]^n[i([114,99,111,110])][h]<<24,h+=1;for(let t=1;t<o/2;t++)s[t]^=s[t-1];a=s[o/2-1],s[o/2]^=n[i([83])][255&a]^n[i([83])][a>>8&255]<<8^n[i([83])][a>>16&255]<<16^n[i([83])][a>>24&255]<<24;for(let t=o/2+1;t<o;t++)s[t]^=s[t-1];let r,c,d=0;for(;d<o&&m<e;)r=m>>2,c=m%4,l[r][c]=s[d],u[t-r][c]=s[d++],m++}for(let e=1;e<t;e++)for(let t=0;t<4;t++)a=u[e][t],u[e][t]=n[i([85,49])][a>>24&255]^n[i([85,50])][a>>16&255]^n[i([85,51])][a>>8&255]^n[i([85,52])][255&a]}();for(let e=0;e<t[i([108,101,110,103,116,104])];e++)16===a&&(r=m(s),a=0,h(s)),t[e]^=r[a++];return t;function d(t){const e=[];for(let o=0;o<t[i([108,101,110,103,116,104])];o+=4)e[i([112,117,115,104])](t[o]<<24|t[o+1]<<16|t[o+2]<<8|t[o+3]);return e}function h(t){for(let e=15;e>=0;e--){if(255!==t[e]){t[e]++;break}t[e]=0}}function m(t){const e=l[i([108,101,110,103,116,104])]-1,o=[0,0,0,0];let s=d(t);for(let t=0;t<4;t++)s[t]^=l[0][t];for(let t=1;t<e;t++){for(let e=0;e<4;e++)o[e]=n[i([84,49])][s[e]>>24&255]^n[i([84,50])][s[(e+1)%4]>>16&255]^n[i([84,51])][s[(e+2)%4]>>8&255]^n[i([84,52])][255&s[(e+3)%4]]^l[t][e];s=o[i([115,108,105,99,101])]()}const r=new Uint8Array(16);let a;for(let t=0;t<4;t++)a=l[e][t],r[4*t]=255&(n[i([83])][s[t]>>24&255]^a>>24),r[4*t+1]=255&(n[i([83])][s[(t+1)%4]>>16&255]^a>>16),r[4*t+2]=255&(n[i([83])][s[(t+2)%4]>>8&255]^a>>8),r[4*t+3]=255&(n[i([83])][255&s[(t+3)%4]]^a);return r}}(n,e,r+256*s))}(t,new Uint8Array([...o,29,221,175,90,231,133,239,240,75,180,...n]))}const r=function(){const t=[{[i([105,100])]:1,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([67,111,109,109,101,110,116,115]),[i([112,108,117,103,105,110,78,97,109,101])]:i([67,111,109,109,101,110,116,115,82,101,112,111,115,105,116,111,114,121]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([108,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101]),[i([99,104,101,99,107,65,108,115,111])]:[{[i([105,100])]:2,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([84,114,97,99,107,32,67,104,97,110,103,101,115]),[i([112,108,117,103,105,110,78,97,109,101])]:i([84,114,97,99,107,67,104,97,110,103,101,115,69,100,105,116,105,110,103]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([108,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101,70,111,114,84,114,97,99,107,67,104,97,110,103,101,115]),[i([111,112,116,105,111,110,115])]:{[i([97,105,119,115,103,105,99])]:!0,[i([97,105,116,99,100,103,105,108])]:!0,[i([97,105,114,118,105,105,108])]:!0}}],[i([111,112,116,105,111,110,115])]:{[i([97,105,119,115,103,105,99])]:!0,[i([97,105,116,99,100,103,105,108])]:!0,[i([97,105,114,118,105,105,108])]:!0}},{[i([105,100])]:3,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([80,97,103,105,110,97,116,105,111,110]),[i([112,108,117,103,105,110,78,97,109,101])]:i([80,97,103,105,110,97,116,105,111,110,76,111,111,107,117,112]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([112,97,103,105,110,97,116,105,111,110,76,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101])},{[i([105,100])]:4,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([82,101,118,105,115,105,111,110,32,72,105,115,116,111,114,121]),[i([112,108,117,103,105,110,78,97,109,101])]:i([82,101,118,105,115,105,111,110,115,82,101,112,111,115,105,116,111,114,121]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([108,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101,70,111,114,82,101,118,105,115,105,111,110,72,105,115,116,111,114,121]),[i([111,112,116,105,111,110,115])]:{[i([97,105,119,115,103,105,99])]:!0,[i([97,105,116,99,100,103,105,108])]:!0,[i([97,105,114,118,105,105,108])]:!0}},{[i([105,100])]:5,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([68,111,99,117,109,101,110,116,32,79,117,116,108,105,110,101]),[i([112,108,117,103,105,110,78,97,109,101])]:i([68,111,99,117,109,101,110,116,79,117,116,108,105,110,101,85,73]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([100,111,99,117,109,101,110,116,79,117,116,108,105,110,101,76,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101])},{[i([105,100])]:6,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([70,111,114,109,97,116,32,80,97,105,110,116,101,114]),[i([112,108,117,103,105,110,78,97,109,101])]:i([70,111,114,109,97,116,80,97,105,110,116,101,114,85,73]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([102,111,114,109,97,116,80,97,105,110,116,101,114,76,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101])},{[i([105,100])]:7,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([83,108,97,115,104,32,67,111,109,109,97,110,100]),[i([112,108,117,103,105,110,78,97,109,101])]:i([83,108,97,115,104,67,111,109,109,97,110,100,85,73]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([115,108,97,115,104,67,111,109,109,97,110,100,76,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101])},{[i([105,100])]:8,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([84,97,98,108,101,32,111,102,32,67,111,110,116,101,110,116,115]),[i([112,108,117,103,105,110,78,97,109,101])]:i([84,97,98,108,101,79,102,67,111,110,116,101,110,116,115,69,100,105,116,105,110,103]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([116,97,98,108,101,79,102,67,111,110,116,101,110,116,115,76,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101])},{[i([105,100])]:9,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([84,101,109,112,108,97,116,101]),[i([112,108,117,103,105,110,78,97,109,101])]:i([84,101,109,112,108,97,116,101,85,73]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([116,101,109,112,108,97,116,101,76,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101])},{[i([105,100])]:10,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([80,97,115,116,101,32,102,114,111,109,32,79,102,102,105,99,101,32,69,110,104,97,110,99,101,100]),[i([112,108,117,103,105,110,78,97,109,101])]:i([80,97,115,116,101,70,114,111,109,79,102,102,105,99,101,69,110,104,97,110,99,101,100,73,110,108,105,110,101,114]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([112,97,115,116,101,70,114,111,109,79,102,102,105,99,101,69,110,104,97,110,99,101,100,76,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101])},{[i([105,100])]:11,[i([102,101,97,116,117,114,101,78,97,109,101])]:i([65,73,32,65,115,115,105,115,116,97,110,116]),[i([112,108,117,103,105,110,78,97,109,101])]:i([65,73,65,115,115,105,115,116,97,110,116,85,73]),[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]:i([97,105,76,105,99,101,110,115,101,75,101,121]),[i([104,97,110,100,108,101,114])]:i([99,104,101,99,107,76,105,99,101,110,115,101])}];return function t(e){e[i([102,111,114,69,97,99,104])]((e=>{e[i([112,101,114,109,105,115,115,105,111,110,77,97,115,107])]=1<<e[i([105,100])]-1,e[i([99,104,101,99,107,65,108,115,111])]&&t(e[i([99,104,101,99,107,65,108,115,111])])}))}(t),t}(),a={[i([99,104,101,99,107,76,105,99,101,110,115,101])]:function(t,e){p(f(t,e),e)},[i([99,104,101,99,107,76,105,99,101,110,115,101,70,111,114,84,114,97,99,107,67,104,97,110,103,101,115])]:function(t,e){p(function(t,e){try{if(v(l,i([84,114,97,99,107,67,104,97,110,103,101,115,69,100,105,116,105,110,103]))&&t){const o=_(l,i([84,114,97,99,107,67,104,97,110,103,101,115,69,100,105,116,105,110,103]))[i([95,101,120,101,99,117,116,101,83,117,103,103,101,115,116,105,111,110])];if(parseInt(o)/2>t[i([101,120,112,105,114,97,116,105,111,110,68,97,116,101])])return k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100]))}return f(t,e)}catch(t){return k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100]))}}(t,e),e)},[i([99,104,101,99,107,76,105,99,101,110,115,101,70,111,114,82,101,118,105,115,105,111,110,72,105,115,116,111,114,121])]:function(t,e){const s=n[0]*o[1],r=n[0]*o[2],a=n[2]*o[2];function c(t,e){u(),k(e+i([84,114,105,97,108,76,105,109,105,116,58])+t),window[g()]=t===i([116,105,109,101])?s:r}function u(){const t=l;function e(){v(t,i([82,101,118,105,115,105,111,110,84,114,97,99,107,101,114]))&&(_(t,i([82,101,118,105,115,105,111,110,84,114,97,99,107,101,114]))[i([117,110,98,105,110,100])](i([105,115,69,110,97,98,108,101,100])),_(t,i([82,101,118,105,115,105,111,110,84,114,97,99,107,101,114]))[i([105,115,69,110,97,98,108,101,100])]=!1,_(t,i([82,101,118,105,115,105,111,110,84,114,97,99,107,101,114]))[i([117,112,100,97,116,101])]=b,_(t,i([82,101,118,105,115,105,111,110,84,114,97,99,107,101,114]))[i([115,97,118,101,82,101,118,105,115,105,111,110])]=b,t[i([109,111,100,101,108])][i([99,104,97,110,103,101])]=b,t[i([109,111,100,101,108])][i([101,110,113,117,101,117,101,67,104,97,110,103,101])]=b,t[i([101,110,97,98,108,101,82,101,97,100,79,110,108,121,77,111,100,101])](i([109,111,100,101,108]))),v(t,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114]))&&(_(t,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114]))[i([117,110,98,105,110,100])](i([105,115,69,110,97,98,108,101,100])),_(t,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114]))[i([105,115,69,110,97,98,108,101,100])]=!1,_(t,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114]))[i([99,111,109,112,97,114,101])]=b,_(t,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114]))[i([95,103,101,116,68,105,102,102])]=b)}t[i([115,116,97,116,101])]==i([114,101,97,100,121])?e():t[i([111,110,99,101])](i([114,101,97,100,121]),(()=>{if(v(t,i([82,101,118,105,115,105,111,110,84,114,97,99,107,101,114]))&&e(),v(t,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114]))){const o=_(t,i([82,101,118,105,115,105,111,110,115,82,101,112,111,115,105,116,111,114,121])),n=o.getRevision(0),s=o.getEarlierVisibleRevision(n[i([105,100])]);_(t,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114]))[i([99,111,109,112,97,114,101])](n[i([105,100])],s?s[i([105,100])]:null,1).then((()=>e()))}}))}v(l,i([87,101,98,83,111,99,107,101,116,71,97,116,101,119,97,121]))&&_(l,i([87,101,98,83,111,99,107,101,116,71,97,116,101,119,97,121]))[i([115,116,97,116,101])]==i([99,111,110,110,101,99,116,101,100])&&(window[g()]=a),function(t,e){if(t==e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100]))u();else if(t==e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([84,114,105,97,108])){const t=function(){if(!v(l,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114])))return!1;for(const t in window)if(Number.isNaN(Number(t))){if(window[t]===s)return i([116,105,109,101]);if(window[t]===r)return i([114,101,118,105,115,105,111,110,115])}return!1}();t&&c(t,e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]);const a=function(){let t=n[6]*o[8]*o[6];return v(l,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114]))&&(t/=10),t}();window[i([115,101,116,84,105,109,101,111,117,116])]((()=>{c(i([116,105,109,101]),e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])])}),a);const u=_(l,i([82,101,118,105,115,105,111,110,115,82,101,112,111,115,105,116,111,114,121]))[i([95,114,101,118,105,115,105,111,110,115])];u[i([108,101,110,103,116,104])]>=7?c(i([114,101,118,105,115,105,111,110,115]),e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]):u.on(i([97,100,100]),(()=>{u[i([108,101,110,103,116,104])]>=7&&c(i([114,101,118,105,115,105,111,110,115]),e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])])}))}}(function(t,e){try{return function(){if(!v(l,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114])))return!1;for(const t in window)if(Number.isNaN(Number(t))&&window[t]===a)return!0;return!1}()?k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([86,97,108,105,100])):f(t,e)}catch(t){return k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100]))}}(t,e),e)}},c=t[i([99,111,110,115,116,114,117,99,116,111,114])][i([112,108,117,103,105,110,78,97,109,101])],l=i([99,111,110,116,101,120,116])in t?t.context:t.editor,u=i([52,48,52,54,49,56,53,52]),d=i([65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57]),h=l.config.get(i([108,105,99,101,110,115,101,75,101,121])),m=r[i([102,105,110,100])]((t=>t[i([112,108,117,103,105,110,78,97,109,101])]===c));function f(t,e){try{return function(t){if(!v(l,t[i([112,108,117,103,105,110,78,97,109,101])]))return!0;const e=t[i([111,112,116,105,111,110,115])]||{},o=e[i([97,105,119,115,103,105,99])]||!1,n=e[i([97,105,116,99,100,103,105,108])]||!1,s=e[i([97,105,114,118,105,105,108])]||!1;return!(!v(l,i([87,101,98,83,111,99,107,101,116,71,97,116,101,119,97,121]))||_(l,i([87,101,98,83,111,99,107,101,116,71,97,116,101,119,97,121]))[i([115,116,97,116,101])]!=i([99,111,110,110,101,99,116,101,100])||!o)||(!(!v(l,i([84,114,97,99,107,67,104,97,110,103,101,115,68,97,116,97,71,101,116,116,101,114]))||_(l,i([84,114,97,99,107,67,104,97,110,103,101,115,68,97,116,97,71,101,116,116,101,114]))[i([114,101,115,117,108,116])]!=i([101,110,100])||!n)||!(!v(l,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114,73,110,116,101,103,114,97,116,105,111,110]))||_(l,i([82,101,118,105,115,105,111,110,86,105,101,119,101,114,73,110,116,101,103,114,97,116,105,111,110]))[i([114,101,115,117,108,116])]!=i([101,110,100])||!s))}(e)?k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([86,97,108,105,100])):t&&t[i([97,108,108,111,119,101,100,80,108,117,103,105,110,115])]&e[i([112,101,114,109,105,115,115,105,111,110,77,97,115,107])]?t[i([105,115,73,110,116,101,114,110,97,108])]&&!window[i([111,112,101,110])][i([99,108,111,115,101,100])]||parseInt(u)/2>t[i([101,120,112,105,114,97,116,105,111,110,68,97,116,101])]?k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100])):t[i([105,115,84,114,105,97,108])]?k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([84,114,105,97,108])):k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([86,97,108,105,100])):k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100]))}catch(t){return k(e[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100]))}}function p(t,s){if(l instanceof e.Context){const e=l;t==s[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100])?x(e):t==s[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([84,114,105,97,108])&&window[i([115,101,116,84,105,109,101,111,117,116])]((()=>{x(e),k(s[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([84,114,105,97,108,76,105,109,105,116,58,116,105,109,101]))}),n[6]*o[8]*o[6]),e[i([101,100,105,116,111,114,115])][i([111,110])](i([97,100,100]),((e,o)=>{t!=s[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100])&&t!=s[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([84,114,105,97,108,76,105,109,105,116,58,116,105,109,101])&&t!=s[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([84,114,105,97,108,76,105,109,105,116,58,111,112,101,114,97,116,105,111,110,115])||w(o)}))}else{const e=l;t==s[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([73,110,118,97,108,105,100])?w(e):t==s[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([84,114,105,97,108])&&e[i([111,110])](i([114,101,97,100,121]),(()=>{let t=0;e[i([109,111,100,101,108])][i([111,110])](i([97,112,112,108,121,79,112,101,114,97,116,105,111,110]),((o,n)=>{n[0][i([105,115,68,111,99,117,109,101,110,116,79,112,101,114,97,116,105,111,110])]&&t++,504===t&&(w(e),k(s[i([108,105,99,101,110,115,101,83,116,97,116,117,115,80,114,101,102,105,120])]+i([84,114,105,97,108,76,105,109,105,116,58,111,112,101,114,97,116,105,111,110,115])),o[i([111,102,102])]())}),{priority:i([104,105,103,104,101,115,116])})}))}}function k(t){const e=g();return l[e]=t,t}function g(){const t=String(window[i([112,101,114,102,111,114,109,97,110,99,101])][i([110,111,119])]())[i([114,101,112,108,97,99,101])](i([46]),"");let e="";for(let o=0;o<t[i([108,101,110,103,116,104])];o+=2){let n=parseInt(t[i([115,117,98,115,116,114,105,110,103])](o,o+2));n>=d[i([108,101,110,103,116,104])]&&(n-=d[i([108,101,110,103,116,104])]),e+=d[n]}return e}function x(t){for(const e of t[i([101,100,105,116,111,114,115])])w(e);_(t,i([67,111,109,109,101,110,116,115,82,101,112,111,115,105,116,111,114,121]))[i([115,119,105,116,99,104,82,101,97,100,79,110,108,121])](!0),_(t,i([67,111,109,109,101,110,116,115,82,101,112,111,115,105,116,111,114,121]))[i([115,119,105,116,99,104,82,101,97,100,79,110,108,121])]=b}function w(t){function e(){t[i([109,111,100,101,108])][i([99,104,97,110,103,101])]=b,t[i([109,111,100,101,108])][i([101,110,113,117,101,117,101,67,104,97,110,103,101])]=b,t[i([101,110,97,98,108,101,82,101,97,100,79,110,108,121,77,111,100,101])](i([109,111,100,101,108]))}t[i([115,116,97,116,101])]==i([114,101,97,100,121])?e():t[i([111,110,99,101])](i([114,101,97,100,121]),(()=>e()))}function b(){return null}function v(t,e){return t[i([112,108,117,103,105,110,115])][i([104,97,115])](e)}function _(t,e){return t[i([112,108,117,103,105,110,115])][i([103,101,116])](e)}m&&function t(e,o){a[o[i([104,97,110,100,108,101,114])]](e,o),o[i([99,104,101,99,107,65,108,115,111])]&&o[i([99,104,101,99,107,65,108,115,111])][i([102,105,108,116,101,114])]((t=>v(l,t[i([112,108,117,103,105,110,78,97,109,101])])))[i([102,111,114,69,97,99,104])]((i=>t(e,i)))}(function(t){try{const e=s(t),o=JSON[i([112,97,114,115,101])](e),n=parseInt(o[i([49])]),r=parseInt(o[i([51])]),a=parseInt(o[i([52])])||0,c=parseInt(o[i([53])])||0;return{[i([97,108,108,111,119,101,100,80,108,117,103,105,110,115])]:a,[i([101,120,112,105,114,97,116,105,111,110,68,97,116,101])]:n,[i([105,115,84,114,105,97,108])]:r,[i([105,115,73,110,116,101,114,110,97,108])]:c}}catch(t){return null}}(h),m)})(t)}(this)}showUI(t="",e="",i=this.editor.model.document.selection){const o=this.editor,n=o.plugins.get(u);if(this._formView)return;n.showFakeVisualSelection();const s=o.data.toView(o.model.getSelectedContent(i)),r=o.data.htmlProcessor.toData(s);this._formView=new Vt(this.editor.locale,e),this._aiAssistantController=new b(this._aiConnector,this._formView,r,t),this._enableAIBalloonInteractions(),this._balloon.add({view:this._formView,position:{target:()=>{const t=o.editing.view,e=t.document.selection.getFirstRange();return t.domConverter.viewRangeToDom(e).getBoundingClientRect()}}}),this._formView.focus(),this.listenTo(this._formView,"replaceContent",((t,e)=>{this.hideUI(),n.insertContent(e)})),this.listenTo(this._formView,"insertContentBelow",((t,e)=>{this.hideUI(),n.insertContentBelow(e)})),this._isUIVisible=!0}hideUI(){const t=this.editor.plugins.get(u);this._formView&&this._balloon.hasView(this._formView)&&(t.hideFakeVisualSelection(),this._balloon.remove(this._formView),this._formView=null,this.editor.editing.view.focus()),this._isUIVisible=!1}_enableAIBalloonInteractions(){this.editor.keystrokes.set("Esc",((t,e)=>{this._formView&&(this.hideUI(),e())})),(0,n.clickOutsideHandler)({emitter:this._formView,activator:()=>!!this._formView,contextElements:()=>[this._balloon.view.element],callback:()=>this.hideUI()})}}function Nt(t,e){const i=new St(t.locale),o=function(t){const e={};return t.forEach((t=>{const i=t.groupLabel||t.groupId,o=t.commands;e[i]=o})),e}(t.config.get("aiAssistant.commands")||[]);return Object.entries(o).forEach((([o,s])=>{const r=s.map((i=>function(t,e,i){const o=new n.ListItemView,s=new at,r=new n.ButtonView(t,s);return o.children.add(r),r.set({label:i.label,withText:!0}),r.on("execute",(()=>{e(i.prompt,i.label)})),o}(t.locale,e,i)));i.items.add(function(t,e){const i=new n.ListItemGroupView;return i.label=t,i.items.addMany(e),i}(o,r))})),i}var Zt=i(492);const Ut=["Bearer ","data","read","_cleanUpData","_abortController","document","get","data: ","_prepareMessages","resolve","aiAssistant.apiUrl","text/html","choices","define","_normalizeResponseHeadings","error","delta","_xmlSerializer","editing","view","rename","user","_apiUrl","config","catch","processor","filter","length","split","toView","_parseAndNormalizeContent","stringify","gpt-3.5-turbo","AbortError","Your task is to process HTML content. You are given HTML content and an instruction how it should be processed. Follow closely the instruction. Try to preserve all HTML formatting from the original HTML content unless asked otherwise. As an answer return only the HTML processed accordingly to the instruction. Do not add any additional remarks or notes. Do not act like a chatbot or a real person.\n\nExample:\n\nUser:\n\nInstruction:\nChange to uppercase\n\nHTML content:\n<p>This is a dog.</p>\n\nAssistant:\n\n<p>THIS IS A DOG.</p>","_domParser","content","sendPrompt","abort","element","adapter","push","signal","parseFromString","application/json","system","[DONE]","getReader","map","startsWith","aiAssistant.apiKey","POST","<span>","editor","\n\nHTML content:\n","body","https://api.openai.com/v1/chat/completions","toModel","name","</span>","join","decode","pluginName","processPrompt","Your task is to generate HTML content accordingly to the given instruction. As an answer return only the generated HTML. The returned answer must be a well-structed, properly formatted HTML. Do not add any additional remarks or notes. Do not act like a chatbot or a real person.\n\nExample:\n\nUser:\n\nGenerate a list with names of a few vegetables\n\nAssistant:\n\n<ul><li>Carrot</li><li>Potato</li><li>Cabbage</li><li>Corn</li></ul>","_apiKey","_isBufferIncomplete","Authorization"];var Kt,zt;Kt=Ut,zt=429,function(t){for(;--t;)Kt.push(Kt.shift())}(++zt);const qt=function(t,e){return Ut[t-=0]};class Dt extends e.Plugin{static get[qt("0x29")](){return"AIConnector"}constructor(t){super(t),t.config[qt("0x3c")](qt("0x39"),qt("0x23"));const e=t[qt("0x2")][qt("0x35")](qt("0x39")),i=t[qt("0x2")].get(qt("0x1d"));this[qt("0x33")]=new AbortController,this[qt("0x13")]=new Gt(t,e,i)}async[qt("0x2a")](e,i,o){const{systemMessage:n,userMessage:s}=this[qt("0x37")](e,i);return this[qt("0x13")][qt("0x10")](n,s,this[qt("0x33")].signal,o)[qt("0x3")]((e=>{if(qt("0xc")===e[qt("0x25")])return Promise[qt("0x38")]();throw console[qt("0x3e")](e),new t.CKEditorError("aiconnector-send-prompt-failed",null)}))}[qt("0x11")](){this[qt("0x33")][qt("0x15")].aborted||(this[qt("0x33")].abort(),this[qt("0x33")]=new AbortController)}[qt("0x37")](t,e){let i,o;return e?(i=qt("0xd"),o="Instruction:\n"+t+qt("0x21")+(e[qt("0x1c")]("<")?e:qt("0x1f")+e+qt("0x26"))):(i=qt("0x2b"),o=t),{systemMessage:i,userMessage:o}}}class Gt{constructor(t,e,i){this[qt("0x20")]=t,this[qt("0x1")]=e,this[qt("0x2c")]=i,this[qt("0xe")]=new DOMParser,this[qt("0x40")]=new XMLSerializer}async sendPrompt(t,e,i,o){const n={"Content-Type":qt("0x17")};this[qt("0x2c")]&&(n[qt("0x2e")]=qt("0x2f")+this[qt("0x2c")]);const s={method:qt("0x1e"),headers:n,body:JSON.stringify({model:qt("0xb"),messages:[{role:qt("0x18"),content:t},{role:qt("0x0"),content:e}],stream:!0}),signal:i},r=(await fetch(this[qt("0x1")],s))[qt("0x22")];return await this._processStream(r,o),Promise[qt("0x38")]()}async _processStream(t,e){const i=t[qt("0x1a")](),o=new TextDecoder;let n="",s="",r="",a=!1;for(;!a;){const{done:t,value:c}=await i[qt("0x31")](),l=n+o[qt("0x28")](c);let u="";a=t;try{u=this[qt("0x32")](l),n=""}catch(t){n+=l;continue}s+=u,!t&&this[qt("0x2d")](s)||s&&(r+=s,e(this[qt("0x9")](r)),s="")}return Promise[qt("0x38")]()}_isBufferIncomplete(t){const e=t[qt("0x7")]("<").length!==t[qt("0x7")](">")[qt("0x6")],i=t.length<30;return e&&i}[qt("0x9")](t){const e=this[qt("0xe")][qt("0x16")](t,qt("0x3a")),i=this[qt("0x20")][qt("0x30")][qt("0x4")][qt("0x8")](this._xmlSerializer.serializeToString(e[qt("0x22")]));return this[qt("0x3d")](i),this[qt("0x20")][qt("0x30")][qt("0xa")](this.editor.data[qt("0x24")](i))}[qt("0x3d")](t){const e=new Zt.UpcastWriter(this[qt("0x20")][qt("0x41")][qt("0x42")][qt("0x34")]),i=new Zt.Matcher({name:/^h[1-5]$/}),o=[];let n=!1;for(const e of t)e.is(qt("0x12"))&&i.match(e)&&(o[qt("0x14")](e),"h1"==e.name&&(n=!0));if(n)for(const t of o)e[qt("0x43")]("h"+(parseInt(t[qt("0x25")][1])+1),t)}[qt("0x32")](t){return t.split("\n")[qt("0x1b")]((t=>t.replace(qt("0x36"),"")))[qt("0x5")]((t=>t&&t[qt("0x6")]>0&&qt("0x19")!==t))[qt("0x1b")]((t=>JSON.parse(t)[qt("0x3b")][0][qt("0x3f")][qt("0xf")]))[qt("0x5")]((t=>t))[qt("0x27")]("")}}class Jt extends e.Plugin{static get requires(){return[Ft,u,Dt]}static get pluginName(){return"AIAssistant"}constructor(t){super(t);const e=t.config,i=t.locale.t;var o;e.define("aiAssistant.commands",[{groupId:"editOrReview",groupLabel:(o=i)("Edit or review"),commands:[{id:"improveWriting",label:o("Improve writing"),prompt:"Rewrite this content with no spelling mistakes, proper grammar, and with more descriptive language, using best writing practices without losing the original meaning."},{id:"makeShorter",label:o("Make shorter"),prompt:"Remove any repetitive, redundant, or non-essential writing in this content without changing the meaning or losing any key information."},{id:"makeLonger",label:o("Make longer"),prompt:"Expand upon this content with descriptive language and more detailed explanations, to make the writing easier to understand and increase the length of the content."},{id:"simplifyLanguage",label:o("Simplify language"),prompt:"Rewrite this content with simplified language and reduce the complexity of the writing, so that the content is easier to understand."}]},{groupId:"generate",groupLabel:o("Generate from selection"),commands:[{id:"summarize",label:o("Summarize"),prompt:"Provide the key points and concepts in this content in a succinct summary."},{id:"explain",label:o("Explain"),prompt:"Explain this text."},{id:"continue",label:o("Continue"),prompt:"Continue this text."}]},{groupId:"changeTone",groupLabel:o("Change tone"),commands:[{id:"professional",label:o("Professional"),prompt:"Rewrite this content using polished, formal, and respectful language to convey professional expertise and competence."},{id:"casual",label:o("Casual"),prompt:"Rewrite this content with casual, informal language to convey a casual conversation with a real person."},{id:"direct",label:o("Direct"),prompt:"Rewrite this content with direct language using only the essential information."},{id:"confident",label:o("Confident"),prompt:"Rewrite this content using compelling, optimistic language to convey confidence in the writing."},{id:"friendly",label:o("Friendly"),prompt:"Rewrite this content using friendly, comforting language, to convey understanding and empathy."}]},{groupId:"changeStyle",groupLabel:o("Change style"),commands:[{id:"business",label:o("Business"),prompt:"Rewrite this content as a business professional with formal language."},{id:"legal",label:o("Legal"),prompt:"Rewrite this content as a legal professional using valid legal terminology."},{id:"journalism",label:o("Journalism"),prompt:"Rewrite this content as a journalist using engaging language to convey the importance of the information."},{id:"medical",label:o("Medical"),prompt:"Rewrite this content as a medical professional using valid medical terminology."},{id:"poetic",label:o("Poetic"),prompt:"Rewrite this content as a poem using poetic techniques without losing the original meaning."}]}]),e.define("aiAssistant.extraCommandGroups",[]),e.define("aiAssistant.removeCommands",[]);const n=e.get("aiAssistant.commands"),s=e.get("aiAssistant.extraCommandGroups"),r=e.get("aiAssistant.removeCommands");s.forEach((t=>{const e=n.find((e=>e.groupId===t.groupId));e?e.commands.concat(t.commands):n.push(t)})),n.forEach((t=>{t.commands=t.commands.filter((t=>!r.includes(t.id)))})),e.set("aiAssistant.commands",n)}init(){const e=this.editor;this.licenseKey=e.config.get("licenseKey"),this._licenseKeyCheckInterval=setInterval((()=>{let i;for(const t in e){const o=t,n=e[o];if("aiLicenseKeyTrial"===n||"aiLicenseKeyInvalid"===n||"aiLicenseKeyValid"===n||"aiLicenseKeyTrialLimit:operations"===n){delete e[o],i=n;break}}if("aiLicenseKeyInvalid"===i)throw clearInterval(this._licenseKeyCheckInterval),new t.CKEditorError("ai-invalid-license-key",null);if("aiLicenseKeyTrial"===i&&console.info("You are using the trial version of CKEditor 5 ai plugin with limited usage. Make sure you will not use it in the production environment."),"aiLicenseKeyTrialLimit:operations"===i)throw clearInterval(this._licenseKeyCheckInterval),new t.CKEditorError("ai-trial-license-key-reached-limit-changes",null);"aiLicenseKeyValid"===i&&clearInterval(this._licenseKeyCheckInterval)}),1e3)}}})(),(window.CKEditor5=window.CKEditor5||{}).ai=o})();
@@ -0,0 +1,23 @@
1
+ {
2
+ "plugins": [
3
+ {
4
+ "name": "AI Assistant",
5
+ "className": "AIAssistant",
6
+ "description": "Introduces AI tools for generating and improving content through the use of pre-defined commands or custom queries inserted by the user",
7
+ "docs": "features/ai-assistant.html",
8
+ "path": "src/aiassistant.js",
9
+ "uiComponents": [
10
+ {
11
+ "type": "SplitButton",
12
+ "name": "aiCommands",
13
+ "iconPath": "theme/icons/magic-wand.svg"
14
+ },
15
+ {
16
+ "type": "Button",
17
+ "name": "aiAssistant",
18
+ "iconPath": "theme/icons/robot-pencil.svg"
19
+ }
20
+ ]
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "Ask AI": "Label of the text field where the user to enters a request to the AI.",
3
+ "Edit or review": "AI command group label for editing and reviewing.",
4
+ "Improve writing": "Label for the AI command to improve the writing of content.",
5
+ "Make shorter": "Label for the AI command to make the content shorter.",
6
+ "Make longer": "Label for the AI command to make the content longer.",
7
+ "Simplify language": "Label for the AI command to simplify the language of content.",
8
+ "Generate from selection": "AI command group label for generating content from selection.",
9
+ "Summarize": "Label for the AI command to provide a summary of content.",
10
+ "Explain": "Label for the AI command to explain the content.",
11
+ "Continue": "Label for the AI command to continue the content.",
12
+ "Change tone": "AI command group label for changing the tone of content.",
13
+ "Professional": "Label for the AI command to rewrite content in a professional tone.",
14
+ "Casual": "Label for the AI command to rewrite content in a casual tone.",
15
+ "Direct": "Label for the AI command to rewrite content in a direct manner.",
16
+ "Confident": "Label for the AI command to rewrite content in a confident tone.",
17
+ "Friendly": "Label for the AI command to rewrite content in a friendly tone.",
18
+ "Change style": "AI command group label for changing the style of content.",
19
+ "Business": "Label for the AI command to rewrite content in a business style.",
20
+ "Legal": "Label for the AI command to rewrite content in a legal style.",
21
+ "Journalism": "Label for the AI command to rewrite content in a journalistic style.",
22
+ "Medical": "Label for the AI command to rewrite content in a medical style.",
23
+ "Poetic": "Label for the AI command to rewrite content poetically.",
24
+ "AI Assistant": "The heading element name displayed in the AI balloon and the button tooltip that opens the balloon.",
25
+ "AI Commands": "The toolbar button tooltip for the dropdown with predefined AI commands.",
26
+ "Ask AI to edit or generate": "The placeholder for the prompt input to obtain new content.",
27
+ "Ask AI to improve generated text": "The placeholder for the prompt input to improve the generated content.",
28
+ "Copy": "The label for the button that copies the text from the textarea.",
29
+ "Submit": "The label for the button that submits the entered AI prompt.",
30
+ "Replace": "The label for the button that replaces the selected content by the generated AI response.",
31
+ "Insert below": "The label for the button that inserts the generated AI response below the current selection.",
32
+ "Try again": "The label for the button that repeats the request to AI.",
33
+ "Stop": "The label for the button that stops the generating of the content by AI.",
34
+ "AI is writing...": "The label that indicates the AI is generating content.",
35
+ "Failed to communicate with the AI service": "The default error message that appears when the connection with AI fails.",
36
+ "History": "The label of the button that toggles the prompt history pane in the AI balloon.",
37
+ "Empty history": "The primary information text displayed when the prompt history is empty.",
38
+ "Ask AI and your prompts will be listed here for you to use later.": "The secondary information text displayed when the prompt history is empty.",
39
+ "Prompt history": "The label of the list group that hosts historical user prompts in the AI balloon.",
40
+ "Search AI command": "The placeholder for the search input to filter the AI commands.",
41
+ "No commands found": "The message displayed when the commands search input does not match any AI commands.",
42
+ "No commands available": "The message displayed when there are no AI commands available in the commands dropdown."
43
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@ckeditor/ckeditor5-ai",
3
+ "version": "0.0.0-nightly-20230927.0",
4
+ "description": "AI-powered features for CKEditor 5.",
5
+ "license": "SEE LICENSE IN LICENSE.md",
6
+ "author": "CKSource (http://cksource.com/)",
7
+ "homepage": "https://ckeditor.com/collaboration/",
8
+ "keywords": [
9
+ "CKEditor",
10
+ "ckeditor5",
11
+ "ckeditor 5",
12
+ "WYSIWYG",
13
+ "WYSIWYW",
14
+ "text",
15
+ "rich-text",
16
+ "richtext",
17
+ "editor",
18
+ "editing",
19
+ "html",
20
+ "operational transformation",
21
+ "ot",
22
+ "AI",
23
+ "framework"
24
+ ],
25
+ "dependencies": {
26
+ "ckeditor5": "0.0.0-nightly-20230927.0",
27
+ "@ckeditor/ckeditor5-ui": "0.0.0-nightly-20230927.0",
28
+ "lodash-es": "4.17.21"
29
+ },
30
+ "files": [
31
+ "lang",
32
+ "src/**/*.js",
33
+ "src/**/*.d.ts",
34
+ "theme",
35
+ "build",
36
+ "ckeditor5-metadata.json",
37
+ "CHANGELOG.md"
38
+ ],
39
+ "bugs": {
40
+ "url": "https://support.ckeditor.com/hc/en-us/requests/new"
41
+ },
42
+ "obfuscated": true
43
+ }
@@ -0,0 +1,128 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import { Plugin, type Editor } from 'ckeditor5/src/core';
6
+ import AIAssistantUI from './aiassistantui';
7
+ import AIAssistantEditing from './aiassistantediting';
8
+ import AIConnector from './aiconnector';
9
+ /**
10
+ * AI assistant plugin that allows you to use external AI models to generate content or improve existing content.
11
+ */
12
+ export default class AIAssistant extends Plugin {
13
+ /**
14
+ * @inheritDoc
15
+ */
16
+ static get requires(): readonly [typeof AIAssistantUI, typeof AIAssistantEditing, typeof AIConnector];
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ static get pluginName(): "AIAssistant";
21
+ /**
22
+ * @inheritDoc
23
+ */
24
+ constructor(editor: Editor);
25
+ /**
26
+ * @inheritDoc
27
+ */
28
+ init(): void;
29
+ }
30
+ /**
31
+ * The configuration of the AI assistant feature.
32
+ *
33
+ * ```ts
34
+ * ClassicEditor
35
+ * .create( editorElement, {
36
+ * aiAssistant: ... // AI assistant options.
37
+ * } )
38
+ * .then( ... )
39
+ * .catch( ... );
40
+ * ```
41
+ *
42
+ * See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
43
+ */
44
+ export interface AIAssistantConfig {
45
+ /**
46
+ * The URL to which the API request will be sent.
47
+ * If not provided, the default API endpoint will be used.
48
+ */
49
+ apiUrl?: string;
50
+ /**
51
+ * API key which is used to authorize the request to AI.
52
+ */
53
+ apiKey?: string;
54
+ /**
55
+ * A list of all AI commands groups definitions to be displayed in the `'aiCommands'` UI dropdown.
56
+ *
57
+ * Setting this property will overwrite the default list of predefined commands.
58
+ */
59
+ commands?: Array<GroupDefinition>;
60
+ /**
61
+ * A list of additional AI commands groups definitions that are merged with the default commands.
62
+ *
63
+ * You can define new AI commands groups or add new AI commands to existing groups. If you add AI commands to an existing group,
64
+ * you do not need to specify `groupLabel` property.
65
+ *
66
+ * An example configuration:
67
+ *
68
+ * ```json
69
+ * {
70
+ * aiAssistant: {
71
+ * extraCommandGroups: [
72
+ * // Add to an existing AI commands group:
73
+ * {
74
+ * groupId: 'changeTone',
75
+ * commands: [
76
+ * id: 'sad',
77
+ * label: 'Sad',
78
+ * prompt: 'Rewrite this text to make it sound sad and depressing.'
79
+ * ]
80
+ * },
81
+ * // Create a new AI commands group:
82
+ * {
83
+ * groupId: 'transformations',
84
+ * groupLabel: 'Transformations',
85
+ * commands: [
86
+ * {
87
+ * id: 'addEmojis',
88
+ * label: 'Add emojis',
89
+ * prompt: 'Analyze each sentence of this text. After each sentence add emoji that summarizes the sentence.'
90
+ * },
91
+ * // ...
92
+ * ]
93
+ * },
94
+ * ],
95
+ * // ...
96
+ * }
97
+ * ```
98
+ */
99
+ extraCommandGroups?: Array<GroupDefinition>;
100
+ /**
101
+ * A list of ids of AI commands to be removed.
102
+ *
103
+ * An example configuration:
104
+ *
105
+ * ```json
106
+ * {
107
+ * aiAssistant: {
108
+ * removeCommands: [
109
+ * 'improveWriting',
110
+ * // ...
111
+ * ],
112
+ * // ...
113
+ * }
114
+ * ```
115
+ */
116
+ removeCommands?: Array<string>;
117
+ }
118
+ export type GroupDefinition = {
119
+ groupId: string;
120
+ groupLabel?: string;
121
+ commands: Array<CommandDefinition>;
122
+ };
123
+ export type CommandDefinition = {
124
+ id: string;
125
+ label: string;
126
+ prompt: string;
127
+ isDisabled?: any;
128
+ };
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ *
4
+ *
5
+ *
6
+ *
7
+ * +---------------------------------------------------------------------------------+
8
+ * | |
9
+ * | Hello stranger! |
10
+ * | |
11
+ * | |
12
+ * | What you're currently looking at is the source code of a legally protected, |
13
+ * | proprietary software. Any attempts to deobfuscate / disassemble this code |
14
+ * | are forbidden and will result in legal consequences. |
15
+ * | |
16
+ * | |
17
+ * +---------------------------------------------------------------------------------+
18
+ *
19
+ *
20
+ *
21
+ *
22
+ */
23
+ import{CKEditorError as _0x4fd15a}from'ckeditor5/src/utils';import{Plugin as _0x211d6d}from'ckeditor5/src/core';import _0x1eb47f from'./aiassistantui';import _0x19698a from'./aiassistantediting';import _0xd752f4 from'./aiconnector';export default class s extends _0x211d6d{static get['requires'](){return[_0x1eb47f,_0x19698a,_0xd752f4];}static get['pluginName'](){return'AIAssistant';}constructor(_0x9e5032){super(_0x9e5032);const _0x3f327d=_0x9e5032['config'],_0x48e9a0=_0x9e5032['locale']['t'];var t;_0x3f327d['define']('aiAssistant.commands',[{'groupId':'editOrReview','groupLabel':(t=_0x48e9a0)('Edit\x20or\x20review'),'commands':[{'id':'improveWriting','label':t('Improve\x20writing'),'prompt':'Rewrite\x20this\x20content\x20with\x20no\x20spelling\x20mistakes,\x20proper\x20grammar,\x20and\x20with\x20more\x20descriptive\x20language,\x20using\x20best\x20writing\x20practices\x20without\x20losing\x20the\x20original\x20meaning.'},{'id':'makeShorter','label':t('Make\x20shorter'),'prompt':'Remove\x20any\x20repetitive,\x20redundant,\x20or\x20non-essential\x20writing\x20in\x20this\x20content\x20without\x20changing\x20the\x20meaning\x20or\x20losing\x20any\x20key\x20information.'},{'id':'makeLonger','label':t('Make\x20longer'),'prompt':'Expand\x20upon\x20this\x20content\x20with\x20descriptive\x20language\x20and\x20more\x20detailed\x20explanations,\x20to\x20make\x20the\x20writing\x20easier\x20to\x20understand\x20and\x20increase\x20the\x20length\x20of\x20the\x20content.'},{'id':'simplifyLanguage','label':t('Simplify\x20language'),'prompt':'Rewrite\x20this\x20content\x20with\x20simplified\x20language\x20and\x20reduce\x20the\x20complexity\x20of\x20the\x20writing,\x20so\x20that\x20the\x20content\x20is\x20easier\x20to\x20understand.'}]},{'groupId':'generate','groupLabel':t('Generate\x20from\x20selection'),'commands':[{'id':'summarize','label':t('Summarize'),'prompt':'Provide\x20the\x20key\x20points\x20and\x20concepts\x20in\x20this\x20content\x20in\x20a\x20succinct\x20summary.'},{'id':'explain','label':t('Explain'),'prompt':'Explain\x20this\x20text.'},{'id':'continue','label':t('Continue'),'prompt':'Continue\x20this\x20text.'}]},{'groupId':'changeTone','groupLabel':t('Change\x20tone'),'commands':[{'id':'professional','label':t('Professional'),'prompt':'Rewrite\x20this\x20content\x20using\x20polished,\x20formal,\x20and\x20respectful\x20language\x20to\x20convey\x20professional\x20expertise\x20and\x20competence.'},{'id':'casual','label':t('Casual'),'prompt':'Rewrite\x20this\x20content\x20with\x20casual,\x20informal\x20language\x20to\x20convey\x20a\x20casual\x20conversation\x20with\x20a\x20real\x20person.'},{'id':'direct','label':t('Direct'),'prompt':'Rewrite\x20this\x20content\x20with\x20direct\x20language\x20using\x20only\x20the\x20essential\x20information.'},{'id':'confident','label':t('Confident'),'prompt':'Rewrite\x20this\x20content\x20using\x20compelling,\x20optimistic\x20language\x20to\x20convey\x20confidence\x20in\x20the\x20writing.'},{'id':'friendly','label':t('Friendly'),'prompt':'Rewrite\x20this\x20content\x20using\x20friendly,\x20comforting\x20language,\x20to\x20convey\x20understanding\x20and\x20empathy.'}]},{'groupId':'changeStyle','groupLabel':t('Change\x20style'),'commands':[{'id':'business','label':t('Business'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20business\x20professional\x20with\x20formal\x20language.'},{'id':'legal','label':t('Legal'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20legal\x20professional\x20using\x20valid\x20legal\x20terminology.'},{'id':'journalism','label':t('Journalism'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20journalist\x20using\x20engaging\x20language\x20to\x20convey\x20the\x20importance\x20of\x20the\x20information.'},{'id':'medical','label':t('Medical'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20medical\x20professional\x20using\x20valid\x20medical\x20terminology.'},{'id':'poetic','label':t('Poetic'),'prompt':'Rewrite\x20this\x20content\x20as\x20a\x20poem\x20using\x20poetic\x20techniques\x20without\x20losing\x20the\x20original\x20meaning.'}]}]),_0x3f327d['define']('aiAssistant.extraCommandGroups',[]),_0x3f327d['define']('aiAssistant.removeCommands',[]);const _0x6264d=_0x3f327d['get']('aiAssistant.commands'),_0x576d8c=_0x3f327d['get']('aiAssistant.extraCommandGroups'),_0xba79ae=_0x3f327d['get']('aiAssistant.removeCommands');_0x576d8c['forEach'](_0xe24108=>{const _0xc8421=_0x6264d['find'](_0x11a873=>_0x11a873['groupId']===_0xe24108['groupId']);_0xc8421?_0xc8421['commands']['concat'](_0xe24108['commands']):_0x6264d['push'](_0xe24108);}),_0x6264d['forEach'](_0xba0f6f=>{_0xba0f6f['commands']=_0xba0f6f['commands']['filter'](_0xb91c76=>!_0xba79ae['includes'](_0xb91c76['id']));}),_0x3f327d['set']('aiAssistant.commands',_0x6264d);}['init'](){const _0x5a87d1=this['editor'];this['licenseKey']=_0x5a87d1['config']['get']('licenseKey'),this['_licenseKeyCheckInterval']=setInterval(()=>{let _0x6e67e2;for(const _0x31cd75 in _0x5a87d1){const _0x599456=_0x31cd75,_0x3a22db=_0x5a87d1[_0x599456];if('aiLicenseKeyTrial'===_0x3a22db||'aiLicenseKeyInvalid'===_0x3a22db||'aiLicenseKeyValid'===_0x3a22db||'aiLicenseKeyTrialLimit:operations'===_0x3a22db){delete _0x5a87d1[_0x599456],_0x6e67e2=_0x3a22db;break;}}if('aiLicenseKeyInvalid'===_0x6e67e2)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x4fd15a('ai-invalid-license-key',null);if('aiLicenseKeyTrial'===_0x6e67e2&&console['info']('You\x20are\x20using\x20the\x20trial\x20version\x20of\x20CKEditor\x205\x20ai\x20plugin\x20with\x20limited\x20usage.\x20Make\x20sure\x20you\x20will\x20not\x20use\x20it\x20in\x20the\x20production\x20environment.'),'aiLicenseKeyTrialLimit:operations'===_0x6e67e2)throw clearInterval(this['_licenseKeyCheckInterval']),new _0x4fd15a('ai-trial-license-key-reached-limit-changes',null);'aiLicenseKeyValid'===_0x6e67e2&&clearInterval(this['_licenseKeyCheckInterval']);},0x3e8);}}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module ai/aiassistantediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import type { Position } from 'ckeditor5/src/engine';
10
+ /**
11
+ * The AI assistant editing plugin.
12
+ */
13
+ export default class AIAssistantEditing extends Plugin {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ static get pluginName(): "AIAssistantEditing";
18
+ /**
19
+ * @inheritDoc
20
+ */
21
+ init(): void;
22
+ /**
23
+ * Displays a fake visual selection when the contextual balloon is displayed.
24
+ *
25
+ * This adds a 'ai-ui' marker into the document that is rendered as a highlight on selected text fragment.
26
+ */
27
+ showFakeVisualSelection(): void;
28
+ /**
29
+ * Removes a fake visual selection when the contextual balloon is hidden.
30
+ *
31
+ * This removes all 'ai-ui' markers from the document.
32
+ */
33
+ hideFakeVisualSelection(): void;
34
+ /**
35
+ * Converts the HTML string into the model fragment and inserts it at the specified position.
36
+ * If a position is not provided, the insertion will be performed at the current selection.
37
+ */
38
+ insertContent(content: string, position?: Position): void;
39
+ /**
40
+ * Converts the HTML string into the model fragment and inserts it at the specified position.
41
+ * If a position is not provided, the insertion will be performed at the current selection.
42
+ */
43
+ insertContentBelow(content: string): void;
44
+ }