@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
23 lines • 6.33 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. |
* | |
* | |
* +---------------------------------------------------------------------------------+
*
*
*
*
*/
function _0x2bd6(_0x1d55aa,_0x2911ff){const _0x1ed112=_0x1ed1();return _0x2bd6=function(_0x2bd6b7,_0x1d4c0e){_0x2bd6b7=_0x2bd6b7-0xc9;let _0x5d609b=_0x1ed112[_0x2bd6b7];return _0x5d609b;},_0x2bd6(_0x1d55aa,_0x2911ff);}const _0x4ffb22=_0x2bd6;(function(_0x559618,_0x1c3dac){const _0x803eee=_0x2bd6,_0x211b4a=_0x559618();while(!![]){try{const _0xd5cee1=-parseInt(_0x803eee(0xd4))/0x1*(parseInt(_0x803eee(0xf1))/0x2)+-parseInt(_0x803eee(0xcd))/0x3+parseInt(_0x803eee(0xec))/0x4+-parseInt(_0x803eee(0xde))/0x5*(-parseInt(_0x803eee(0xf3))/0x6)+-parseInt(_0x803eee(0xda))/0x7+parseInt(_0x803eee(0xd6))/0x8*(parseInt(_0x803eee(0xdb))/0x9)+parseInt(_0x803eee(0xd2))/0xa*(parseInt(_0x803eee(0xd9))/0xb);if(_0xd5cee1===_0x1c3dac)break;else _0x211b4a['push'](_0x211b4a['shift']());}catch(_0x4ff0fb){_0x211b4a['push'](_0x211b4a['shift']());}}}(_0x1ed1,0x4e474));import{EmitterMixin as _0x53c874,logWarning as _0x3e3f34,logError as _0x255d1d}from'ckeditor5/src/utils.js';import{getTranslation as _0x444136}from'../utils/common-translations.js';function _0x1ed1(){const _0x164860=['ai-models-unable-to-retrieve','24VdsOhR','ai-chat-model-id-unrecognized','getLocalized','toUpperCase','_filterModels','isAvailable','name','_defaultModelId','92790esSzVJ','AI_MODEL_NAME_AUTO','getDefault','toLocaleLowerCase','AI_MODEL_DESCRIPTION_','2087110tkUjAS','_modelList','65327BGSopD','list','1826040JmzyPr','push','getModels','33ELHMAS','512498LuhXcq','9TxxZtB','getModel','map','120455fDFOUj','provider','ai-chat-default-model-id-unrecognized','_getModelById','_availableModels','some','find','items','AI_MODEL_DESCRIPTION_AUTO','getAvailableModels','_connector','description','startsWith','string','247852ulFJQF','agent','length','getAll','auto','18DoZwTr'];_0x1ed1=function(){return _0x164860;};return _0x1ed1();}export class AIModels extends _0x53c874(){[_0x4ffb22(0xe8)];[_0x4ffb22(0xe2)];[_0x4ffb22(0xcc)];[_0x4ffb22(0xd3)]=[];constructor({connector:_0x26a42f,availableModels:_0xfdc82,defaultModelId:_0x552763}){const _0x48c8fa=_0x4ffb22;super(),this[_0x48c8fa(0xe8)]=_0x26a42f,this[_0x48c8fa(0xe2)]=_0xfdc82,this[_0x48c8fa(0xcc)]=_0x552763;}async[_0x4ffb22(0xef)](){const _0x885f85=_0x4ffb22;if(!this[_0x885f85(0xd3)][_0x885f85(0xee)])try{const _0x2d48f7=this[_0x885f85(0xe8)][_0x885f85(0xd8)](),_0x4cf419=await _0x2d48f7[_0x885f85(0xd5)]();this[_0x885f85(0xd3)]=_0x4cf419[_0x885f85(0xe5)];}catch(_0x215df2){throw _0x255d1d(_0x885f85(0xf2),{'error':_0x215df2}),_0x215df2;}return[...this[_0x885f85(0xd3)]];}async[_0x4ffb22(0xe7)](){const _0x4ba189=_0x4ffb22,_0x19f544=await this[_0x4ba189(0xef)]();return this[_0x4ba189(0xc9)](_0x19f544,this[_0x4ba189(0xe2)]);}async[_0x4ffb22(0xdc)](_0x273769){const _0x36f5d7=_0x4ffb22,_0x3949c6=await this[_0x36f5d7(0xef)]();if(!_0x3949c6[_0x36f5d7(0xee)])return null;if(_0x273769){const _0x5bb2d6=this[_0x36f5d7(0xe1)](_0x3949c6,_0x273769);if(_0x5bb2d6)return _0x5bb2d6;_0x3e3f34(_0x36f5d7(0xf4),{'modelId':_0x273769,'fallBackModelId':this[_0x36f5d7(0xcc)]});}return this[_0x36f5d7(0xcf)]();}async[_0x4ffb22(0xcf)](){const _0x276f60=_0x4ffb22,_0x3a3fa5=await this[_0x276f60(0xe7)]();if(!_0x3a3fa5[_0x276f60(0xee)])return null;if(this[_0x276f60(0xcc)]){const _0x3fec0b=this[_0x276f60(0xe1)](_0x3a3fa5,this[_0x276f60(0xcc)]);if(_0x3fec0b)return _0x3fec0b;_0x3e3f34(_0x276f60(0xe0),{'defaultModelId':this[_0x276f60(0xcc)],'fallBackModelId':_0x3a3fa5[0x0]['id']});}return _0x3a3fa5[0x0];}async[_0x4ffb22(0xca)](_0x48bd9d){const _0x4547d1=_0x4ffb22;return(await this[_0x4547d1(0xe7)]())[_0x4547d1(0xe3)](_0x8b361=>_0x8b361[_0x4547d1(0xcb)]===_0x48bd9d[_0x4547d1(0xcb)]&&_0x8b361[_0x4547d1(0xdf)]===_0x48bd9d[_0x4547d1(0xdf)]);}[_0x4ffb22(0xc9)](_0x588c5e,_0x47872a){const _0x32c08e=_0x4ffb22;let _0x207a99;if(_0x47872a){_0x207a99=[];const _0x29d71a=_0x32c08e(0xeb)==typeof _0x47872a?[_0x47872a[_0x32c08e(0xd0)]()]:_0x47872a[_0x32c08e(0xdd)](_0x39999b=>_0x39999b[_0x32c08e(0xd0)]());for(const _0x372d53 of _0x29d71a)for(const _0x487731 of _0x588c5e)(_0x487731['id'][_0x32c08e(0xd0)]()===_0x372d53||_0x487731[_0x32c08e(0xcb)][_0x32c08e(0xd0)]()===_0x372d53||Ne(_0x487731)&&_0x32c08e(0xf0)===_0x372d53||_0x487731[_0x32c08e(0xdf)][_0x32c08e(0xd0)]()===_0x372d53||_0x487731['id'][_0x32c08e(0xd0)]()[_0x32c08e(0xea)](_0x372d53))&&_0x207a99[_0x32c08e(0xd7)](_0x487731);}else _0x207a99=_0x588c5e;return _0x207a99;}[_0x4ffb22(0xe1)](_0x154c43,_0x2b6327){const _0x4b3840=_0x4ffb22;return _0x154c43[_0x4b3840(0xe4)](_0x3f0c01=>Ne(_0x3f0c01)&&_0x4b3840(0xf0)===_0x2b6327?_0x3f0c01:_0x3f0c01['id']===_0x2b6327)||null;}static[_0x4ffb22(0xf5)](_0x415d00,_0x3c7daa){const _0x342813=_0x4ffb22;return _0x3c7daa[_0x342813(0xdd)](_0x6b25bd=>{const _0x24e3dd=_0x342813;if(Ne(_0x6b25bd))_0x6b25bd[_0x24e3dd(0xcb)]=_0x444136(_0x415d00,_0x24e3dd(0xce)),_0x6b25bd[_0x24e3dd(0xe9)]=_0x444136(_0x415d00,_0x24e3dd(0xe6));else _0x444136(_0x415d00,_0x24e3dd(0xd1)+_0x6b25bd['id'][_0x24e3dd(0xf6)]())[_0x24e3dd(0xea)](_0x24e3dd(0xd1))||(_0x6b25bd[_0x24e3dd(0xe9)]=_0x444136(_0x415d00,_0x24e3dd(0xd1)+_0x6b25bd['id'][_0x24e3dd(0xf6)]()));return _0x6b25bd;});}}function Ne(_0x2c445e){const _0x37108d=_0x4ffb22;return _0x2c445e['id'][_0x37108d(0xea)](_0x37108d(0xed));}