@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
23 lines • 7.91 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 _0x2982ed=_0x3520;function _0x35d7(){const _0x16f3f7=['1479078fqbRgo','fire','reasoningStarted','abort','getStream','actionCallId','content','conversationTitle','interactionDestroyed','interactionStarted','reasoning','error','web-search','textDelta','forEach','editor','5ypjQvk','source','destroy','webSearchFinished','callId','ai-chat-interaction-error','1488699XHLmCw','getReply','event','isDestroyed','connector','reasoningFinished','13290399IqaEvm','appendContent','interactionCreated','_isWebSearching','modification-delta','messageId','find','isStopped','sources','action-metadata','_finalizeInteraction','currentReply','63FnTEBk','interactionStopped','createReply','push','sendRequest','195008CXFmDk','getDocumentContext','replies','_isReasoning','setConversationTitle','replyContentUpdated','splice','replyChangeGroupStateUpdated','delegate','abortController','stopListening','759372ueLsHg','replyCreated','currentRequest','8655336BDXiDz','message-metadata','data','length','stop','done','webSearchStarted','5683356jIoPmC','interactionFinished','start'];_0x35d7=function(){return _0x16f3f7;};return _0x35d7();}(function(_0x481e9e,_0xcfbcaa){const _0x2193fc=_0x3520,_0x38c18d=_0x481e9e();while(!![]){try{const _0xf0847f=parseInt(_0x2193fc(0xfc))/0x1+-parseInt(_0x2193fc(0x109))/0x2+-parseInt(_0x2193fc(0x11f))/0x3+-parseInt(_0x2193fc(0x106))/0x4*(parseInt(_0x2193fc(0x119))/0x5)+parseInt(_0x2193fc(0xff))/0x6+parseInt(_0x2193fc(0x131))/0x7*(-parseInt(_0x2193fc(0x136))/0x8)+parseInt(_0x2193fc(0x125))/0x9;if(_0xf0847f===_0xcfbcaa)break;else _0x38c18d['push'](_0x38c18d['shift']());}catch(_0x3390af){_0x38c18d['push'](_0x38c18d['shift']());}}}(_0x35d7,0xc3f54));import{CKEditorError as _0x420eae,EmitterMixin as _0xf6c3d8,uid as _0x51265d}from'ckeditor5/src/utils.js';function _0x3520(_0x1ebed6,_0x171296){const _0x35d758=_0x35d7();return _0x3520=function(_0x3520e0,_0x194146){_0x3520e0=_0x3520e0-0xf9;let _0x3675a1=_0x35d758[_0x3520e0];return _0x3675a1;},_0x3520(_0x1ebed6,_0x171296);}import{AIReply as _0x146306,isIgnoredReplyType as _0x46b23b,isValidReplyType as _0x3bcf46,isReplyTitleType as _0x309d0c,isSourceType as _0x291282}from'./aireply.js';export const AI_MODEL_EVENT_NAMES=[_0x2982ed(0x127),_0x2982ed(0x112),_0x2982ed(0x132),_0x2982ed(0x107),_0x2982ed(0x111),_0x2982ed(0xfd),_0x2982ed(0x13b),_0x2982ed(0x13d),_0x2982ed(0x13a),_0x2982ed(0x105),_0x2982ed(0x11c),_0x2982ed(0x10b),_0x2982ed(0x124),_0x2982ed(0x114)];export class AIInteraction extends _0xf6c3d8(){['id'];[_0x2982ed(0x138)]=[];[_0x2982ed(0x130)];[_0x2982ed(0x12a)];[_0x2982ed(0x10e)];[_0x2982ed(0xfe)];[_0x2982ed(0x123)];[_0x2982ed(0x12c)]=!0x1;[_0x2982ed(0x122)]=!0x1;[_0x2982ed(0x118)];[_0x2982ed(0x139)]=!0x1;[_0x2982ed(0x128)]=!0x1;constructor({connector:_0x2ea4fc,editor:_0x3d7dba}){const _0x24df01=_0x2982ed;super(),this['id']=_0x51265d(),this[_0x24df01(0x123)]=_0x2ea4fc,this[_0x24df01(0x12c)]=!0x0,this[_0x24df01(0x118)]=_0x3d7dba;}async[_0x2982ed(0x108)](){const _0x1972a5=_0x2982ed;let _0xc3f7fa;const _0x22de7d=[];this[_0x1972a5(0x12c)]=!0x1;try{this[_0x1972a5(0xfe)]=await this[_0x1972a5(0x135)](),this[_0x1972a5(0x10a)](_0x1972a5(0x112),this);const _0x3e61be=await this[_0x1972a5(0xfe)][_0x1972a5(0x10d)]();for await(const _0x5597d4 of _0x3e61be){if(this[_0x1972a5(0x12c)])return;if(_0x1972a5(0x114)===_0x5597d4[_0x1972a5(0x121)])return void this[_0x1972a5(0x10a)](_0x1972a5(0x114),{'error':new _0x420eae(_0x1972a5(0x11e),this)});if(_0x1972a5(0x100)!==_0x5597d4[_0x1972a5(0x121)]){if(_0x1972a5(0x12e)!==_0x5597d4[_0x1972a5(0x121)]){if(_0x309d0c(_0x5597d4[_0x1972a5(0x121)])&&this[_0x1972a5(0x13a)](_0x5597d4[_0x1972a5(0x101)][_0x1972a5(0x110)],!0x0),_0x291282(_0x5597d4[_0x1972a5(0x121)]))_0x22de7d[_0x1972a5(0x134)](_0x5597d4[_0x1972a5(0x101)][_0x1972a5(0x11a)]);else{if(_0x3bcf46(_0x5597d4[_0x1972a5(0x121)])){if(_0x5597d4[_0x1972a5(0x121)]!==_0xc3f7fa){if(_0xc3f7fa=_0x5597d4[_0x1972a5(0x121)],_0x1972a5(0x115)===_0x5597d4[_0x1972a5(0x121)]){this[_0x1972a5(0x128)]||(this[_0x1972a5(0x128)]=!0x0,this[_0x1972a5(0x10a)](_0x1972a5(0x105),this));continue;}if(_0x1972a5(0x113)===_0x5597d4[_0x1972a5(0x121)]){this[_0x1972a5(0x139)]||(this[_0x1972a5(0x139)]=!0x0,this[_0x1972a5(0x10a)](_0x1972a5(0x10b),this));continue;}this[_0x1972a5(0x139)]&&(this[_0x1972a5(0x139)]=!0x1,this[_0x1972a5(0x10a)](_0x1972a5(0x124),this)),this[_0x1972a5(0x128)]&&(this[_0x1972a5(0x128)]=!0x1,this[_0x1972a5(0x10a)](_0x1972a5(0x11c),this)),this[_0x1972a5(0x130)]&&this[_0x1972a5(0x130)][_0x1972a5(0x104)](),this[_0x1972a5(0x130)]=this[_0x1972a5(0x133)]({'type':_0x5597d4[_0x1972a5(0x121)],'interactionId':this['id'],'id':_0x5597d4[_0x1972a5(0x101)]?.['id']}),_0x22de7d[_0x1972a5(0x102)]>0x0&&_0x1972a5(0x129)===_0x5597d4[_0x1972a5(0x121)]&&(this[_0x1972a5(0x130)][_0x1972a5(0x12d)]=_0x22de7d[_0x1972a5(0x13c)](0x0));}_0x5597d4[_0x1972a5(0x101)][_0x1972a5(0x116)]&&this[_0x1972a5(0x130)][_0x1972a5(0x126)](_0x5597d4[_0x1972a5(0x101)][_0x1972a5(0x116)]);}else _0x46b23b(_0x5597d4[_0x1972a5(0x121)]);}}else this[_0x1972a5(0x10e)]=_0x5597d4[_0x1972a5(0x101)][_0x1972a5(0x11d)];}else this[_0x1972a5(0x12a)]=_0x5597d4[_0x1972a5(0x101)][_0x1972a5(0x12a)];}}finally{this[_0x1972a5(0x12c)]||(_0x22de7d[_0x1972a5(0x102)]>0x0&&(this[_0x1972a5(0x130)][_0x1972a5(0x12d)]=_0x22de7d[_0x1972a5(0x13c)](0x0)),this[_0x1972a5(0x12f)](),this[_0x1972a5(0x10a)](_0x1972a5(0x107),this));}}[_0x2982ed(0x103)](){const _0x5afbe1=_0x2982ed;this[_0x5afbe1(0x12c)]||(this[_0x5afbe1(0x12f)](),this[_0x5afbe1(0x10a)](_0x5afbe1(0x132),this));}[_0x2982ed(0x120)](_0x519d4e){const _0x133644=_0x2982ed;return this[_0x133644(0x138)][_0x133644(0x12b)](_0x3e3e89=>_0x3e3e89['id']===_0x519d4e);}[_0x2982ed(0x11b)](){const _0x1b1cbd=_0x2982ed;this[_0x1b1cbd(0x122)]||(this[_0x1b1cbd(0x103)](),this[_0x1b1cbd(0x138)][_0x1b1cbd(0x117)](_0x3c5235=>_0x3c5235[_0x1b1cbd(0x11b)]()),this[_0x1b1cbd(0x138)]=[],this[_0x1b1cbd(0x122)]=!0x0,this[_0x1b1cbd(0x10a)](_0x1b1cbd(0x111),this),this[_0x1b1cbd(0xfb)]());}[_0x2982ed(0x133)](_0x5d75f7){const _0x5a4dbb=_0x2982ed,_0x3b1a31=new _0x146306({'editor':this[_0x5a4dbb(0x118)],'documentContextContent':this[_0x5a4dbb(0x137)]()?.[_0x5a4dbb(0x10f)],..._0x5d75f7});return this[_0x5a4dbb(0x138)][_0x5a4dbb(0x134)](_0x3b1a31),_0x3b1a31[_0x5a4dbb(0xf9)](...AI_MODEL_EVENT_NAMES)['to'](this),this[_0x5a4dbb(0x10a)](_0x5a4dbb(0xfd),_0x3b1a31),_0x3b1a31;}[_0x2982ed(0x13a)](_0x15fb0f,_0x2b6eef=!0x1){const _0x2cd2d5=_0x2982ed;this[_0x2cd2d5(0x10a)](_0x2cd2d5(0x13a),_0x15fb0f,_0x2b6eef);}[_0x2982ed(0x12f)](){const _0x1d6ad2=_0x2982ed;this[_0x1d6ad2(0x12c)]=!0x0,this[_0x1d6ad2(0xfe)]&&this[_0x1d6ad2(0xfe)][_0x1d6ad2(0xfa)][_0x1d6ad2(0x10c)](),this[_0x1d6ad2(0x130)]&&this[_0x1d6ad2(0x130)][_0x1d6ad2(0x104)](),this[_0x1d6ad2(0xfe)]=this[_0x1d6ad2(0x130)]=void 0x0;}}