@ckeditor/ckeditor5-ai
Version:
AI Assistant feature for CKEditor 5.
23 lines • 10.3 kB
JavaScript
/*
* 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 _0x1031a2=_0x4d77;(function(_0x4bbe88,_0x59f350){const _0x234b51=_0x4d77,_0x4be4d0=_0x4bbe88();while(!![]){try{const _0x47b0e3=parseInt(_0x234b51(0xda))/0x1*(parseInt(_0x234b51(0x127))/0x2)+-parseInt(_0x234b51(0x11d))/0x3+parseInt(_0x234b51(0xd5))/0x4*(-parseInt(_0x234b51(0xd9))/0x5)+-parseInt(_0x234b51(0xfd))/0x6*(-parseInt(_0x234b51(0xed))/0x7)+parseInt(_0x234b51(0xdc))/0x8+parseInt(_0x234b51(0xd7))/0x9+-parseInt(_0x234b51(0x126))/0xa;if(_0x47b0e3===_0x59f350)break;else _0x4be4d0['push'](_0x4be4d0['shift']());}catch(_0x5c0e8a){_0x4be4d0['push'](_0x4be4d0['shift']());}}}(_0x4238,0xf1874));import{FocusTracker as _0x22f447,KeystrokeHandler as _0x57b5db}from'ckeditor5/src/utils.js';function _0x4238(){const _0x98fd9e=['historyGroupView','value','Empty\x20history','REPLACE','Ask\x20AI\x20to\x20edit\x20or\x20generate','toolbar','tryAgainButton','tab','setTemplate','finishProcessing','replaceButton','element','search','insertButton','contentArea','submit','createCollection','ck-hidden','startProcessing','Ask\x20AI\x20and\x20your\x20prompts\x20will\x20be\x20listed\x20here\x20for\x20you\x20to\x20use\x20later.','ck-ai-form-content','div','shift\x20+\x20tab','copyButtonView','prompt','fire','1034448qUGCac','delegate','stopProcessing','AI_ERROR_FAILED','execute','Ask\x20AI\x20to\x20improve\x20generated\x20text','text','add','set','21292480MFPekC','7852bhQxQJ','insertContentBelow','isVisible','260368whICcB','fieldView','14658516hRMsag','high','80XMmELa','103hVsvoV','focusFirst','6587048uOrTJF','_focusables','clear','keystrokes','clearHistory','handleError','bind','_createToolbar','queryView','render','stopButton','_promptHistory','isProcessing','label','isEnabled','mainAction','trim','371bVIZKK','ck-ai-form','isError','items','_createPromptView','submitPrompt','tryAgainEvent','_createHistoryView','reset','errorView','chain','promptView','focusLast','listenTo','focusTracker','bindTemplate','186606fYrZVa','bindTo','focusCycler','focus','replaceContent','locale'];_0x4238=function(){return _0x98fd9e;};return _0x4238();}import{View as _0x37c9ac,FocusCycler as _0x5a4769,createLabeledTextarea as _0x54e3e7}from'ckeditor5/src/ui.js';import _0x26486b,{AIFormToolbarViewMainActionLabel as _0x47a9c0}from'./aiformtoolbarview.js';import _0x364fc7 from'./aiformcontentarea.js';import _0x5055d2 from'./aiformerrorview.js';import _0x2fb61d from'./aiformpromptview.js';import _0x48adfe from'./aihistorylistview.js';function _0x4d77(_0x404333,_0x23d965){const _0x4238fe=_0x4238();return _0x4d77=function(_0x4d775c,_0x166cc5){_0x4d775c=_0x4d775c-0xd3;let _0x3bbf5b=_0x4238fe[_0x4d775c];return _0x3bbf5b;},_0x4d77(_0x404333,_0x23d965);}import _0x3cb56c from'./aihistorylistitemview.js';import _0xf19d1e from'./prompthistory.js';import{getTranslation as _0x68ca67}from'../../utils/common-translations.js';import{escape as _0x44d862}from'lodash-es';export default class k extends _0x37c9ac{constructor(_0x449ec5,_0x3ab7cf,_0x11c033=''){const _0x2146a2=_0x4d77;super(_0x449ec5),this[_0x2146a2(0x125)](_0x2146a2(0xea),!0x0),this[_0x2146a2(0x125)](_0x2146a2(0xe8),!0x1),this[_0x2146a2(0x125)](_0x2146a2(0x11b),''),this[_0x2146a2(0x125)](_0x2146a2(0x104),''),this[_0x2146a2(0x125)](_0x2146a2(0xef),!0x1),this[_0x2146a2(0x125)](_0x2146a2(0xeb),_0x47a9c0[_0x2146a2(0x106)]),this[_0x2146a2(0xe7)]=new _0xf19d1e(),this[_0x2146a2(0xf6)]=new _0x5055d2(_0x449ec5),this[_0x2146a2(0x111)]=new _0x364fc7(_0x449ec5,_0x11c033),this[_0x2146a2(0x111)][_0x2146a2(0xe2)](_0x2146a2(0xe8))['to'](this),this[_0x2146a2(0x111)][_0x2146a2(0xe2)](_0x2146a2(0x104))['to'](this),this[_0x2146a2(0x108)]=this[_0x2146a2(0xe3)](),this[_0x2146a2(0x108)][_0x2146a2(0xe2)](_0x2146a2(0xeb))['to'](this),this[_0x2146a2(0xf8)]=this[_0x2146a2(0xf1)](),this[_0x2146a2(0xfb)]=new _0x22f447(),this[_0x2146a2(0xdf)]=new _0x57b5db(),this[_0x2146a2(0xdd)]=this[_0x2146a2(0x113)]([this[_0x2146a2(0x111)],this[_0x2146a2(0x111)][_0x2146a2(0x11a)],this[_0x2146a2(0x108)],this[_0x2146a2(0xf8)]]),this[_0x2146a2(0xff)]=new _0x5a4769({'focusables':this[_0x2146a2(0xdd)],'focusTracker':this[_0x2146a2(0xfb)],'keystrokeHandler':this[_0x2146a2(0xdf)],'actions':{'focusPrevious':_0x2146a2(0x119),'focusNext':_0x2146a2(0x10a)}}),this[_0x2146a2(0xff)][_0x2146a2(0xf7)](this[_0x2146a2(0xf8)][_0x2146a2(0xff)]),this[_0x2146a2(0xf8)][_0x2146a2(0xe4)][_0x2146a2(0xd6)][_0x2146a2(0xe2)](_0x2146a2(0x104))['to'](this,_0x2146a2(0x11b));const _0x1edcf2=this[_0x2146a2(0xfc)];this[_0x2146a2(0x10b)]({'tag':_0x2146a2(0x118),'attributes':{'class':['ck',_0x2146a2(0xee),_0x3ab7cf],'tabindex':'-1'},'children':[{'tag':_0x2146a2(0x118),'attributes':{'class':['ck',_0x2146a2(0x117)]},'children':[{'tag':_0x2146a2(0x118),'attributes':{'class':[_0x1edcf2['if'](_0x2146a2(0xef),_0x2146a2(0x114),_0x1815a0=>!_0x1815a0)]},'children':[this[_0x2146a2(0xf6)]]},this[_0x2146a2(0x111)],this[_0x2146a2(0x108)],this[_0x2146a2(0xf8)]]}]});}[_0x1031a2(0xe5)](){const _0x5769b4=_0x1031a2;super[_0x5769b4(0xe5)](),this[_0x5769b4(0xfb)][_0x5769b4(0x124)](this[_0x5769b4(0x111)][_0x5769b4(0x10e)]),this[_0x5769b4(0xfb)][_0x5769b4(0x124)](this[_0x5769b4(0x111)][_0x5769b4(0x11a)][_0x5769b4(0x10e)]),this[_0x5769b4(0xfb)][_0x5769b4(0x124)](this[_0x5769b4(0x108)][_0x5769b4(0x10e)]),this[_0x5769b4(0xfb)][_0x5769b4(0x124)](this[_0x5769b4(0xf8)][_0x5769b4(0x10e)]),this[_0x5769b4(0xdf)][_0x5769b4(0xfa)](this[_0x5769b4(0x10e)]);}[_0x1031a2(0x100)](_0x38bcf2=0x1){const _0x3c970d=_0x1031a2;-0x1===_0x38bcf2?this[_0x3c970d(0xff)][_0x3c970d(0xf9)]():this[_0x3c970d(0xff)][_0x3c970d(0xdb)]();}[_0x1031a2(0xf5)](){const _0x50086f=_0x1031a2;this[_0x50086f(0x11b)]='',this[_0x50086f(0x104)]='',this[_0x50086f(0xef)]=!0x1,this[_0x50086f(0xf8)][_0x50086f(0xf5)](),this[_0x50086f(0x111)][_0x50086f(0xd4)]=!0x1,this[_0x50086f(0x108)][_0x50086f(0xd4)]=!0x1;}[_0x1031a2(0xf1)](){const _0x30079e=_0x1031a2,_0x1af508=this[_0x30079e(0x102)],_0x659fe3=new _0x2fb61d(_0x1af508,{'queryView':{'label':_0x68ca67(_0x1af508,_0x30079e(0x107)),'creator':_0x54e3e7,'showIcon':!0x1,'showResetButton':!0x1},'infoView':{'text':{'noSearchableItems':{'primary':_0x68ca67(_0x1af508,_0x30079e(0x105)),'secondary':_0x68ca67(_0x1af508,_0x30079e(0x116))}}},'filteredView':this[_0x30079e(0xf4)](),'queryMinChars':0x1/0x0,'resetOnBlur':!0x1});return _0x659fe3[_0x30079e(0xe2)](_0x30079e(0xea))['to'](this,_0x30079e(0xea),this,_0x30079e(0xe8),(_0x544c0d,_0x101c94)=>_0x544c0d&&!_0x101c94),this[_0x30079e(0xfa)](_0x659fe3,_0x30079e(0x112),(_0x5d24e2,_0x2518dd)=>{const _0xc1ac0c=_0x30079e;this[_0xc1ac0c(0x11b)]=_0x2518dd;const _0x38f1f1=_0x44d862(_0x2518dd);this[_0xc1ac0c(0x11c)](_0xc1ac0c(0xf2),_0x38f1f1),_0x2518dd[_0xc1ac0c(0xec)]()&&this[_0xc1ac0c(0xe7)][_0xc1ac0c(0x124)]({'prompt':_0x38f1f1},0x0);},{'priority':_0x30079e(0xd8)}),_0x659fe3;}[_0x1031a2(0xf4)](){const _0x357851=_0x1031a2,_0x307673=new _0x48adfe(this[_0x357851(0x102)]);return _0x307673[_0x357851(0x103)][_0x357851(0xf0)][_0x357851(0xfe)](this[_0x357851(0xe7)])['as'](_0x3cb56c),_0x307673['on'](_0x357851(0xe0),()=>{const _0x4e8f97=_0x357851;this[_0x4e8f97(0xe7)][_0x4e8f97(0xde)](),this[_0x4e8f97(0xf8)][_0x4e8f97(0x10f)](''),this[_0x4e8f97(0xf8)][_0x4e8f97(0x100)]();}),_0x307673;}[_0x1031a2(0xe3)](){const _0x4e572d=_0x1031a2,_0x662832=new _0x26486b(this[_0x4e572d(0x102)]);return _0x662832[_0x4e572d(0x10d)][_0x4e572d(0xe2)](_0x4e572d(0xea))['to'](this,_0x4e572d(0xea),this,_0x4e572d(0xe8),this,_0x4e572d(0x104),(_0x905d19,_0x34547f,_0x1eb817)=>_0x905d19&&!_0x34547f&&!!_0x1eb817),_0x662832[_0x4e572d(0x10d)][_0x4e572d(0x11e)](_0x4e572d(0x121))['to'](this,_0x4e572d(0x101)),_0x662832[_0x4e572d(0x110)][_0x4e572d(0xe2)](_0x4e572d(0xea))['to'](this,_0x4e572d(0xea),this,_0x4e572d(0xe8),this,_0x4e572d(0x104),(_0x5de5fb,_0x24804d,_0x1741c8)=>_0x5de5fb&&!_0x24804d&&!!_0x1741c8),_0x662832[_0x4e572d(0x110)][_0x4e572d(0x11e)](_0x4e572d(0x121))['to'](this,_0x4e572d(0xd3)),_0x662832[_0x4e572d(0x109)][_0x4e572d(0xe2)](_0x4e572d(0xea))['to'](this,_0x4e572d(0xea),this,_0x4e572d(0xe8),(_0x5a2c06,_0x4a597d)=>_0x5a2c06&&!_0x4a597d),_0x662832[_0x4e572d(0x109)][_0x4e572d(0x11e)](_0x4e572d(0x121))['to'](this,_0x4e572d(0xf3)),_0x662832[_0x4e572d(0xe6)][_0x4e572d(0xe2)](_0x4e572d(0xea))['to'](this,_0x4e572d(0xe8)),_0x662832[_0x4e572d(0xe6)][_0x4e572d(0x11e)](_0x4e572d(0x121))['to'](this,_0x4e572d(0x11f)),_0x662832;}[_0x1031a2(0x115)](){const _0x1aedba=_0x1031a2;this[_0x1aedba(0x104)]='',this[_0x1aedba(0xef)]=!0x1,this[_0x1aedba(0xe8)]=!0x0,this[_0x1aedba(0x111)][_0x1aedba(0xd4)]=!0x0,this[_0x1aedba(0x108)][_0x1aedba(0xd4)]=!0x0,this[_0x1aedba(0x111)][_0x1aedba(0x100)]();}[_0x1031a2(0x10c)](){const _0x304632=_0x1031a2,_0x2f719d=this[_0x304632(0x102)];this[_0x304632(0xe8)]=!0x1,this[_0x304632(0x11b)]='',this[_0x304632(0xf8)][_0x304632(0xf5)](),this[_0x304632(0x104)]&&(this[_0x304632(0xf8)][_0x304632(0xe4)][_0x304632(0xe9)]=_0x68ca67(_0x2f719d,_0x304632(0x122)));}[_0x1031a2(0xe1)](_0x1dede3){const _0x3cbec6=_0x1031a2,_0x5679b0=this[_0x3cbec6(0x102)];this[_0x3cbec6(0x10c)](),this[_0x3cbec6(0xef)]=!0x0,this[_0x3cbec6(0xf6)][_0x3cbec6(0x123)]=_0x1dede3||_0x68ca67(_0x5679b0,_0x3cbec6(0x120)),this[_0x3cbec6(0x104)]||(this[_0x3cbec6(0x111)][_0x3cbec6(0xd4)]=!0x1);}}