UNPKG

@ckeditor/ckeditor5-ai

Version:

AI Assistant feature for CKEditor 5.

23 lines • 10.6 kB
/* * Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. * * * * * +---------------------------------------------------------------------------------+ * | | * | Hello stranger! | * | | * | | * | What you're currently looking at is the source code of a legally protected, | * | proprietary software. Any attempts to deobfuscate / disassemble this code | * | are forbidden and will result in legal consequences. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ const _0x368421=_0x918a;function _0x3aad(){const _0x1332ec=['items','ck-ai-form','add','execute','replaceContent','locale','prompt','setTemplate','focusLast','high','AI_ERROR_FAILED','REPLACE','_promptHistory','promptView','search','14718576XgfIZr','Ask\x20AI\x20to\x20improve\x20generated\x20text','3116904ymfPds','copyButtonView','handleError','contentArea','submitPrompt','queryView','isError','delegate','historyGroupView','isProcessing','insertButton','66RNjKXV','fire','isVisible','reset','1056350auPgQo','toolbar','focus','text','clearHistory','tryAgainEvent','trim','insertContentBelow','chain','Ask\x20AI\x20to\x20edit\x20or\x20generate','stopProcessing','createCollection','_createPromptView','357933gcZiDM','bindTo','mainAction','ck-ai-form-content','Empty\x20history','clear','startProcessing','keystrokes','listenTo','6619809sVVpyQ','fieldView','tab','finishProcessing','value','stopButton','label','element','tryAgainButton','focusTracker','focusCycler','_createHistoryView','219648YUjwPB','submit','isEnabled','errorView','div','92995zLoxKu','_createToolbar','ck-hidden','replaceButton','shift\x20+\x20tab','focusFirst','_focusables','bind','Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.','set','render','bindTemplate'];_0x3aad=function(){return _0x1332ec;};return _0x3aad();}(function(_0x51d1d3,_0x2472d2){const _0x438be4=_0x918a,_0x46af07=_0x51d1d3();while(!![]){try{const _0x3acd66=-parseInt(_0x438be4(0x19a))/0x1+-parseInt(_0x438be4(0x18d))/0x2+-parseInt(_0x438be4(0x1af))/0x3+parseInt(_0x438be4(0x1d1))/0x4+-parseInt(_0x438be4(0x1b4))/0x5*(parseInt(_0x438be4(0x189))/0x6)+-parseInt(_0x438be4(0x1a3))/0x7+parseInt(_0x438be4(0x1cf))/0x8;if(_0x3acd66===_0x2472d2)break;else _0x46af07['push'](_0x46af07['shift']());}catch(_0x3b369a){_0x46af07['push'](_0x46af07['shift']());}}}(_0x3aad,0x7c608));import{FocusTracker as _0x258d86,KeystrokeHandler as _0x45658f}from'ckeditor5/src/utils.js';import{View as _0xc51084,FocusCycler as _0x4bb50b,createLabeledTextarea as _0x190f24}from'ckeditor5/src/ui.js';function _0x918a(_0x39ebae,_0x5afcbe){const _0x3aadd8=_0x3aad();return _0x918a=function(_0x918a9,_0x5230aa){_0x918a9=_0x918a9-0x186;let _0x145345=_0x3aadd8[_0x918a9];return _0x145345;},_0x918a(_0x39ebae,_0x5afcbe);}import{AIFormToolbarView as _0x58b638,AIFormToolbarViewMainActionLabel as _0xf7b809}from'./aiformtoolbarview.js';import{AIFormContentArea as _0x42d43b}from'./aiformcontentarea.js';import{AIFormErrorView as _0x54f0c4}from'./aiformerrorview.js';import{AIFormPromptView as _0x462a04}from'./aiformpromptview.js';import{AIHistoryListView as _0x5103f9}from'./aihistorylistview.js';import{AIHistoryListItemView as _0xa0c53a}from'./aihistorylistitemview.js';import{PromptHistory as _0x32778b}from'./prompthistory.js';import{getTranslation as _0x5c777c}from'../../utils/common-translations.js';import{escape as _0x3e3360}from'es-toolkit/compat';export class AIFormView extends _0xc51084{[_0x368421(0x1ac)];[_0x368421(0x1a1)];[_0x368421(0x1d4)];[_0x368421(0x18e)];[_0x368421(0x1cd)];[_0x368421(0x1b2)];[_0x368421(0x1ba)];[_0x368421(0x1ad)];[_0x368421(0x1cc)];constructor(_0x13cb41,_0x3def9f,_0x46e99a=''){const _0x26cfaa=_0x368421;super(_0x13cb41),this[_0x26cfaa(0x1bd)](_0x26cfaa(0x1b1),!0x0),this[_0x26cfaa(0x1bd)](_0x26cfaa(0x187),!0x1),this[_0x26cfaa(0x1bd)](_0x26cfaa(0x1c6),''),this[_0x26cfaa(0x1bd)](_0x26cfaa(0x1a7),''),this[_0x26cfaa(0x1bd)](_0x26cfaa(0x1d7),!0x1),this[_0x26cfaa(0x1bd)](_0x26cfaa(0x19c),_0xf7b809[_0x26cfaa(0x1cb)]),this[_0x26cfaa(0x1cc)]=new _0x32778b(),this[_0x26cfaa(0x1b2)]=new _0x54f0c4(_0x13cb41),this[_0x26cfaa(0x1d4)]=new _0x42d43b(_0x13cb41,_0x46e99a),this[_0x26cfaa(0x1d4)][_0x26cfaa(0x1bb)](_0x26cfaa(0x187))['to'](this),this[_0x26cfaa(0x1d4)][_0x26cfaa(0x1bb)](_0x26cfaa(0x1a7))['to'](this),this[_0x26cfaa(0x18e)]=this[_0x26cfaa(0x1b5)](),this[_0x26cfaa(0x18e)][_0x26cfaa(0x1bb)](_0x26cfaa(0x19c))['to'](this),this[_0x26cfaa(0x1cd)]=this[_0x26cfaa(0x199)](),this[_0x26cfaa(0x1ac)]=new _0x258d86(),this[_0x26cfaa(0x1a1)]=new _0x45658f(),this[_0x26cfaa(0x1ba)]=this[_0x26cfaa(0x198)]([this[_0x26cfaa(0x1d4)],this[_0x26cfaa(0x1d4)][_0x26cfaa(0x1d2)],this[_0x26cfaa(0x18e)],this[_0x26cfaa(0x1cd)]]),this[_0x26cfaa(0x1ad)]=new _0x4bb50b({'focusables':this[_0x26cfaa(0x1ba)],'focusTracker':this[_0x26cfaa(0x1ac)],'keystrokeHandler':this[_0x26cfaa(0x1a1)],'actions':{'focusPrevious':_0x26cfaa(0x1b8),'focusNext':_0x26cfaa(0x1a5)}}),this[_0x26cfaa(0x1ad)][_0x26cfaa(0x195)](this[_0x26cfaa(0x1cd)][_0x26cfaa(0x1ad)]),this[_0x26cfaa(0x1cd)][_0x26cfaa(0x1d6)][_0x26cfaa(0x1a4)][_0x26cfaa(0x1bb)](_0x26cfaa(0x1a7))['to'](this,_0x26cfaa(0x1c6));const _0x3322ee=this[_0x26cfaa(0x1bf)];this[_0x26cfaa(0x1c7)]({'tag':_0x26cfaa(0x1b3),'attributes':{'class':['ck',_0x26cfaa(0x1c1),_0x3def9f],'tabindex':'-1'},'children':[{'tag':_0x26cfaa(0x1b3),'attributes':{'class':['ck',_0x26cfaa(0x19d)]},'children':[{'tag':_0x26cfaa(0x1b3),'attributes':{'class':[_0x3322ee['if'](_0x26cfaa(0x1d7),_0x26cfaa(0x1b6),_0x15f3dc=>!_0x15f3dc)]},'children':[this[_0x26cfaa(0x1b2)]]},this[_0x26cfaa(0x1d4)],this[_0x26cfaa(0x18e)],this[_0x26cfaa(0x1cd)]]}]});}[_0x368421(0x1be)](){const _0x16db17=_0x368421;super[_0x16db17(0x1be)](),this[_0x16db17(0x1ac)][_0x16db17(0x1c2)](this[_0x16db17(0x1d4)][_0x16db17(0x1aa)]),this[_0x16db17(0x1ac)][_0x16db17(0x1c2)](this[_0x16db17(0x1d4)][_0x16db17(0x1d2)][_0x16db17(0x1aa)]),this[_0x16db17(0x1ac)][_0x16db17(0x1c2)](this[_0x16db17(0x18e)][_0x16db17(0x1aa)]),this[_0x16db17(0x1ac)][_0x16db17(0x1c2)](this[_0x16db17(0x1cd)][_0x16db17(0x1aa)]),this[_0x16db17(0x1a1)][_0x16db17(0x1a2)](this[_0x16db17(0x1aa)]);}[_0x368421(0x18f)](_0x115e48=0x1){const _0x6a2b7b=_0x368421;-0x1===_0x115e48?this[_0x6a2b7b(0x1ad)][_0x6a2b7b(0x1c8)]():this[_0x6a2b7b(0x1ad)][_0x6a2b7b(0x1b9)]();}[_0x368421(0x18c)](){const _0x596bce=_0x368421;this[_0x596bce(0x1c6)]='',this[_0x596bce(0x1a7)]='',this[_0x596bce(0x1d7)]=!0x1,this[_0x596bce(0x1cd)][_0x596bce(0x18c)](),this[_0x596bce(0x1d4)][_0x596bce(0x18b)]=!0x1,this[_0x596bce(0x18e)][_0x596bce(0x18b)]=!0x1;}[_0x368421(0x199)](){const _0x232470=_0x368421,_0x2f6ea5=this[_0x232470(0x1c5)],_0x529fd4=new _0x462a04(_0x2f6ea5,{'queryView':{'label':_0x5c777c(_0x2f6ea5,_0x232470(0x196)),'creator':_0x190f24,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':_0x5c777c(_0x2f6ea5,_0x232470(0x19e)),'secondary':_0x5c777c(_0x2f6ea5,_0x232470(0x1bc))}}},'filteredView':this[_0x232470(0x1ae)](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x529fd4[_0x232470(0x1bb)](_0x232470(0x1b1))['to'](this,_0x232470(0x1b1),this,_0x232470(0x187),(_0x5ce907,_0x2eadb1)=>_0x5ce907&&!_0x2eadb1),this[_0x232470(0x1a2)](_0x529fd4,_0x232470(0x1b0),(_0x3ef379,_0x3e16fe)=>{const _0x30f005=_0x232470;this[_0x30f005(0x1c6)]=_0x3e16fe;const _0x20bccd=_0x3e3360(_0x3e16fe);this[_0x30f005(0x18a)](_0x30f005(0x1d5),_0x20bccd),_0x3e16fe[_0x30f005(0x193)]()&&this[_0x30f005(0x1cc)][_0x30f005(0x1c2)]({'prompt':_0x20bccd},0x0);},{'priority':_0x232470(0x1c9)}),_0x529fd4;}[_0x368421(0x1ae)](){const _0x155570=_0x368421,_0x5dd04b=new _0x5103f9(this[_0x155570(0x1c5)]);return _0x5dd04b[_0x155570(0x186)][_0x155570(0x1c0)][_0x155570(0x19b)](this[_0x155570(0x1cc)])['as'](_0xa0c53a),_0x5dd04b['on'](_0x155570(0x191),()=>{const _0x21263b=_0x155570;this[_0x21263b(0x1cc)][_0x21263b(0x19f)](),this[_0x21263b(0x1cd)][_0x21263b(0x1ce)](''),this[_0x21263b(0x1cd)][_0x21263b(0x18f)]();}),_0x5dd04b;}[_0x368421(0x1b5)](){const _0x3a45cf=_0x368421,_0x13533e=new _0x58b638(this[_0x3a45cf(0x1c5)]);return _0x13533e[_0x3a45cf(0x1b7)][_0x3a45cf(0x1bb)](_0x3a45cf(0x1b1))['to'](this,_0x3a45cf(0x1b1),this,_0x3a45cf(0x187),this,_0x3a45cf(0x1a7),(_0x602bca,_0x5b56c3,_0x549228)=>_0x602bca&&!_0x5b56c3&&!!_0x549228),_0x13533e[_0x3a45cf(0x1b7)][_0x3a45cf(0x1d8)](_0x3a45cf(0x1c3))['to'](this,_0x3a45cf(0x1c4)),_0x13533e[_0x3a45cf(0x188)][_0x3a45cf(0x1bb)](_0x3a45cf(0x1b1))['to'](this,_0x3a45cf(0x1b1),this,_0x3a45cf(0x187),this,_0x3a45cf(0x1a7),(_0x2fa532,_0x33bd5a,_0x3971ab)=>_0x2fa532&&!_0x33bd5a&&!!_0x3971ab),_0x13533e[_0x3a45cf(0x188)][_0x3a45cf(0x1d8)](_0x3a45cf(0x1c3))['to'](this,_0x3a45cf(0x194)),_0x13533e[_0x3a45cf(0x1ab)][_0x3a45cf(0x1bb)](_0x3a45cf(0x1b1))['to'](this,_0x3a45cf(0x1b1),this,_0x3a45cf(0x187),(_0xfa3c79,_0xbbbf3c)=>_0xfa3c79&&!_0xbbbf3c),_0x13533e[_0x3a45cf(0x1ab)][_0x3a45cf(0x1d8)](_0x3a45cf(0x1c3))['to'](this,_0x3a45cf(0x192)),_0x13533e[_0x3a45cf(0x1a8)][_0x3a45cf(0x1bb)](_0x3a45cf(0x1b1))['to'](this,_0x3a45cf(0x187)),_0x13533e[_0x3a45cf(0x1a8)][_0x3a45cf(0x1d8)](_0x3a45cf(0x1c3))['to'](this,_0x3a45cf(0x197)),_0x13533e;}[_0x368421(0x1a0)](){const _0x5ec2b7=_0x368421;this[_0x5ec2b7(0x1a7)]='',this[_0x5ec2b7(0x1d7)]=!0x1,this[_0x5ec2b7(0x187)]=!0x0,this[_0x5ec2b7(0x1d4)][_0x5ec2b7(0x18b)]=!0x0,this[_0x5ec2b7(0x18e)][_0x5ec2b7(0x18b)]=!0x0,this[_0x5ec2b7(0x1d4)][_0x5ec2b7(0x18f)]();}[_0x368421(0x1a6)](){const _0x112e3c=_0x368421,_0x5d5452=this[_0x112e3c(0x1c5)];this[_0x112e3c(0x187)]=!0x1,this[_0x112e3c(0x1c6)]='',this[_0x112e3c(0x1cd)][_0x112e3c(0x18c)](),this[_0x112e3c(0x1a7)]&&(this[_0x112e3c(0x1cd)][_0x112e3c(0x1d6)][_0x112e3c(0x1a9)]=_0x5c777c(_0x5d5452,_0x112e3c(0x1d0)));}[_0x368421(0x1d3)](_0x4b203b){const _0x2fcdf5=_0x368421,_0x2c4cad=this[_0x2fcdf5(0x1c5)];this[_0x2fcdf5(0x1a6)](),this[_0x2fcdf5(0x1d7)]=!0x0,this[_0x2fcdf5(0x1b2)][_0x2fcdf5(0x190)]=_0x4b203b||_0x5c777c(_0x2c4cad,_0x2fcdf5(0x1ca)),this[_0x2fcdf5(0x1a7)]||(this[_0x2fcdf5(0x1d4)][_0x2fcdf5(0x18b)]=!0x1);}}