@ckeditor/ckeditor5-ai
Version:
AI features for CKEditor 5.
23 lines • 10.6 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 _0x111b5c=_0x15c8;(function(_0x196690,_0x3c2783){const _0x565f46=_0x15c8,_0x3c13dc=_0x196690();while(!![]){try{const _0x4cc48c=-parseInt(_0x565f46(0x163))/0x1*(parseInt(_0x565f46(0x16a))/0x2)+-parseInt(_0x565f46(0x15f))/0x3+parseInt(_0x565f46(0x196))/0x4+-parseInt(_0x565f46(0x154))/0x5+parseInt(_0x565f46(0x167))/0x6*(parseInt(_0x565f46(0x174))/0x7)+-parseInt(_0x565f46(0x19e))/0x8*(-parseInt(_0x565f46(0x181))/0x9)+-parseInt(_0x565f46(0x183))/0xa;if(_0x4cc48c===_0x3c2783)break;else _0x3c13dc['push'](_0x3c13dc['shift']());}catch(_0x2b9e0a){_0x3c13dc['push'](_0x3c13dc['shift']());}}}(_0x274a,0xb7263));import{ViewDowncastWriter as _0x1ee6f7}from'ckeditor5/src/engine.js';import{ContextPlugin as _0x2da618,Editor as _0x2196ed}from'ckeditor5/src/core.js';function _0x15c8(_0x21bebb,_0x219569){const _0x274a96=_0x274a();return _0x15c8=function(_0x15c88f,_0x2ab487){_0x15c88f=_0x15c88f-0x150;let _0x5b1a5a=_0x274a96[_0x15c88f];return _0x5b1a5a;},_0x15c8(_0x21bebb,_0x219569);}import{uid as _0x56895e}from'ckeditor5/src/utils.js';import{getEditorFromContext as _0x261efa}from'./utils/geteditorfromcontext.js';export const AI_VISUAL_SELECTION_MARKER_NAME=_0x111b5c(0x171);export class AIEditing extends _0x2da618{[_0x111b5c(0x15a)]=null;[_0x111b5c(0x160)]=!0x1;[_0x111b5c(0x182)];static get[_0x111b5c(0x15d)](){const _0x4f8824=_0x111b5c;return _0x4f8824(0x1a4);}static get[_0x111b5c(0x19a)](){return!0x0;}static get[_0x111b5c(0x15b)](){return!0x0;}get[_0x111b5c(0x17d)](){const _0x8492e=_0x111b5c;if(!this[_0x8492e(0x182)]){const _0x4d2be8=_0x261efa(this[_0x8492e(0x1b4)]),_0x22eedc=_0x4d2be8[_0x8492e(0x15e)][_0x8492e(0x194)](_0x8492e(0x157))&&_0x4d2be8[_0x8492e(0x15e)][_0x8492e(0x186)](_0x8492e(0x157))[_0x8492e(0x17d)];this[_0x8492e(0x182)]=_0x22eedc||_0x56895e();}return this[_0x8492e(0x182)];}[_0x111b5c(0x164)](){const _0x5ee3c8=_0x111b5c,_0x255023=_0x261efa(this[_0x5ee3c8(0x1b4)]),_0x1536e7=_0x255023[_0x5ee3c8(0x170)],_0x449c71=_0x255023[_0x5ee3c8(0x162)][_0x5ee3c8(0x187)](_0x1536e7[_0x5ee3c8(0x1b1)][_0x5ee3c8(0x1a9)](),{'convertAiChatSelectionMarker':!0x0}),_0x1a80bd=new _0x1ee6f7(_0x255023[_0x5ee3c8(0x1b3)][_0x5ee3c8(0x179)][_0x5ee3c8(0x1b1)]);this[_0x5ee3c8(0x1b6)](_0x449c71,_0x1a80bd);let _0x3e9a2d=_0x255023[_0x5ee3c8(0x162)][_0x5ee3c8(0x1ae)][_0x5ee3c8(0x166)](_0x449c71);const _0x5ac97c=this[_0x5ee3c8(0x168)](),_0x297602=[];for(const _0x506eb3 of _0x5ac97c){const _0x5ccc9b='<'+_0x506eb3[_0x5ee3c8(0x155)]+_0x5ee3c8(0x169)+_0x506eb3[_0x5ee3c8(0x155)]+_0x5ee3c8(0x198),_0x52fd4c=_0x3e9a2d[_0x5ee3c8(0x18d)](_0x5ccc9b);_0x3e9a2d=_0x3e9a2d[_0x5ee3c8(0x17a)](0x0,_0x52fd4c)+_0x3e9a2d[_0x5ee3c8(0x17a)](_0x52fd4c+_0x5ccc9b[_0x5ee3c8(0x1b7)]);const _0x3f9117='<'+_0x506eb3[_0x5ee3c8(0x155)]+_0x5ee3c8(0x17c)+_0x506eb3[_0x5ee3c8(0x155)]+_0x5ee3c8(0x19d),_0x1c73d9=_0x3e9a2d[_0x5ee3c8(0x18d)](_0x3f9117);_0x3e9a2d=_0x3e9a2d[_0x5ee3c8(0x17a)](0x0,_0x1c73d9)+_0x3e9a2d[_0x5ee3c8(0x17a)](_0x1c73d9+_0x3f9117[_0x5ee3c8(0x1b7)]),_0x297602[_0x5ee3c8(0x1a3)]({'markerName':_0x506eb3[_0x5ee3c8(0x155)],'start':_0x52fd4c,'end':_0x1c73d9,'htmlFragment':_0x3e9a2d[_0x5ee3c8(0x17a)](_0x52fd4c,_0x1c73d9)});}return{'content':_0x3e9a2d,'version':_0x255023[_0x5ee3c8(0x170)][_0x5ee3c8(0x1b1)][_0x5ee3c8(0x17b)],'sessionId':this[_0x5ee3c8(0x17d)],'selections':_0x297602};}async[_0x111b5c(0x19b)](){const _0x553914=_0x111b5c;this[_0x553914(0x1b4)]instanceof _0x2196ed?this[_0x553914(0x16c)](this[_0x553914(0x1b4)]):this[_0x553914(0x192)](this[_0x553914(0x1b4)][_0x553914(0x1b5)],_0x553914(0x1ad),(_0x7816b9,_0x508dda)=>{const _0x4edf0d=_0x553914;_0x508dda['on'](_0x4edf0d(0x18f),()=>{const _0x32d010=_0x4edf0d;this[_0x32d010(0x16c)](_0x508dda);});});}[_0x111b5c(0x16c)](_0x528d33){const _0x32f8dd=_0x111b5c;_0x528d33[_0x32f8dd(0x1a1)][_0x32f8dd(0x17e)](_0x32f8dd(0x17f))[_0x32f8dd(0x151)]({'model':_0x32f8dd(0x171),'view':{'classes':[_0x32f8dd(0x1a2),_0x32f8dd(0x189)],'priority':0xc}}),_0x528d33[_0x32f8dd(0x1a1)][_0x32f8dd(0x17e)](_0x32f8dd(0x172))[_0x32f8dd(0x18b)]({'model':_0x32f8dd(0x171),'view':(_0xb16425,{writer:_0x587faf,options:_0x244c6b})=>_0x244c6b[_0x32f8dd(0x176)]?_0x587faf[_0x32f8dd(0x152)](_0xb16425[_0x32f8dd(0x1aa)]+':'+(_0xb16425[_0x32f8dd(0x1af)]?_0x32f8dd(0x153):_0x32f8dd(0x1a7))):null});}[_0x111b5c(0x16b)](_0xbbe1c0,_0x3bd22f,_0x4fe0db=!0x1,_0x1a5ea5=!0x1){const _0x4ef2e2=_0x111b5c;if(this[_0x4ef2e2(0x160)]&&!_0x1a5ea5)return!0x1;const _0x21434a=_0x261efa(this[_0x4ef2e2(0x1b4)])[_0x4ef2e2(0x170)];return _0x21434a[_0x4ef2e2(0x184)](_0x44c15c=>{const _0x31cdbe=_0x4ef2e2;this[_0x31cdbe(0x15a)]&&this[_0x31cdbe(0x175)](this[_0x31cdbe(0x15a)]),this[_0x31cdbe(0x15a)]=_0x3bd22f,this[_0x31cdbe(0x160)]=_0x4fe0db;let _0x1fae63=0x0;for(let _0x100e88 of _0xbbe1c0){const _0x4d2957=_0x31cdbe(0x1a8)+_0x1fae63;if(_0x100e88[_0x31cdbe(0x153)][_0x31cdbe(0x159)]){const _0x3d252f=_0x100e88[_0x31cdbe(0x153)][_0x31cdbe(0x150)](({item:_0x51dcb8})=>!_0x21434a[_0x31cdbe(0x197)][_0x31cdbe(0x18e)](_0x51dcb8),{'boundaries':_0x100e88});_0x100e88=_0x44c15c[_0x31cdbe(0x1b8)](_0x3d252f,_0x100e88[_0x31cdbe(0x1a7)]);}_0x44c15c[_0x31cdbe(0x161)](_0x4d2957,{'usingOperation':!0x1,'affectsData':!0x1,'range':_0x100e88}),_0x1fae63++;}}),window[_0x4ef2e2(0x178)]()?.[_0x4ef2e2(0x185)](),!0x0;}[_0x111b5c(0x175)](_0x4c9773){const _0x526246=_0x111b5c;if(this[_0x526246(0x15a)]!=_0x4c9773)return!0x1;this[_0x526246(0x15a)]=null,this[_0x526246(0x160)]=!0x1;const _0x338b5d=_0x261efa(this[_0x526246(0x1b4)]),_0x12ff85=_0x338b5d[_0x526246(0x170)][_0x526246(0x1a5)][_0x526246(0x18c)](_0x526246(0x171));return _0x338b5d[_0x526246(0x170)][_0x526246(0x184)](_0x3803f3=>{const _0x1b15c8=_0x526246;for(const _0x2ba6a1 of _0x12ff85)_0x3803f3[_0x1b15c8(0x173)](_0x2ba6a1);}),!0x0;}[_0x111b5c(0x195)](_0x198105){const _0x2e2076=_0x111b5c,_0x4349f5=_0x261efa(this[_0x2e2076(0x1b4)]),_0x36ea8a=_0x4349f5[_0x2e2076(0x162)][_0x2e2076(0x187)](_0x198105),_0x2e0863=new _0x1ee6f7(_0x4349f5[_0x2e2076(0x1b3)][_0x2e2076(0x179)][_0x2e2076(0x1b1)]);return this[_0x2e2076(0x1b6)](_0x36ea8a,_0x2e0863),_0x36ea8a;}[_0x111b5c(0x1b6)](_0x43cff5,_0x179f23){const _0x5a1e1e=_0x111b5c;let _0x19bfc5=!0x1;const _0x2ade4f=new Set();for(const _0x24b622 of _0x43cff5[_0x5a1e1e(0x1a0)]()){const _0x1ba733=_0x24b622['is'](_0x5a1e1e(0x1a6))||_0x24b622['is'](_0x5a1e1e(0x177));if(!_0x24b622['is'](_0x5a1e1e(0x165)))continue;(this[_0x5a1e1e(0x1b6)](_0x24b622,_0x179f23)||_0x1ba733)&&(_0x179f23[_0x5a1e1e(0x18a)](_0x5a1e1e(0x16e),this[_0x5a1e1e(0x1ab)](_0x2ade4f),_0x24b622),_0x19bfc5=!0x0);}return _0x19bfc5;}[_0x111b5c(0x1ab)](_0x56302c){const _0x2a05b9=_0x111b5c;let _0x1d2f8b;do{_0x1d2f8b='';for(let _0x42ed67=0x0;_0x42ed67<0x4;_0x42ed67++)_0x1d2f8b+=String[_0x2a05b9(0x158)](0x61+Math[_0x2a05b9(0x16d)](0x1a*Math[_0x2a05b9(0x180)]()));}while(_0x56302c[_0x2a05b9(0x194)](_0x1d2f8b));return _0x56302c[_0x2a05b9(0x1ad)](_0x1d2f8b),_0x1d2f8b;}[_0x111b5c(0x1ac)](){const _0x1817ba=_0x111b5c,{model:_0x555a6e}=_0x261efa(this[_0x1817ba(0x1b4)]),_0x394e75=_0x555a6e[_0x1817ba(0x1b1)][_0x1817ba(0x19f)],_0x44ed93=_0x555a6e[_0x1817ba(0x1b0)](_0x394e75),_0x4f6453=[],_0xc9f024=_0x555a6e[_0x1817ba(0x156)](_0x44ed93)[_0x1817ba(0x188)]();for(const {item:_0xb4694e}of _0xc9f024)_0xb4694e['is'](_0x1817ba(0x199))?_0x4f6453[_0x1817ba(0x1a3)](_0xb4694e[_0x1817ba(0x162)]):_0xb4694e['is'](_0x1817ba(0x165))&&_0x4f6453[_0x1817ba(0x1b7)]>0x0&&'\x20'!==_0x4f6453[_0x4f6453[_0x1817ba(0x1b7)]-0x1]&&_0x4f6453[_0x1817ba(0x1a3)]('\x20');return'\x22'+_0x4f6453[_0x1817ba(0x19c)]('')[_0x1817ba(0x190)]()+'\x22';}[_0x111b5c(0x168)](){const _0x64565d=_0x111b5c,_0x338b77=_0x261efa(this[_0x64565d(0x1b4)])[_0x64565d(0x170)];return Array[_0x64565d(0x16f)](_0x338b77[_0x64565d(0x1a5)][_0x64565d(0x18c)](_0x64565d(0x171)))[_0x64565d(0x191)]((_0x4f1d05,_0x2783c4)=>_0x4f1d05[_0x64565d(0x15c)]()[_0x64565d(0x193)](_0x2783c4[_0x64565d(0x15c)]())?-0x1:_0x4f1d05[_0x64565d(0x15c)]()[_0x64565d(0x1b2)](_0x2783c4[_0x64565d(0x15c)]())?0x1:0x0);}}function _0x274a(){const _0x4606cc=['push','AIEditing','markers','emptyElement','end','ai-selection:','getRoot','markerName','_nextDataId','getSelectionText','add','processor','isOpening','getSelectedContent','document','isAfter','editing','context','editors','_setDataIdsOnChildren','length','createRange','getLastMatchingPosition','markerToHighlight','createUIElement','start','736485KsHnBz','name','createRangeIn','RealTimeCollaborationClient','fromCharCode','isAtEnd','_displayedFakeSelectionId','isPremiumPlugin','getStart','pluginName','plugins','694404mBbQXw','_displayedFakeSelectionLocked','addMarker','data','4803SUoGjm','getDocumentData','element','toData','2577792OAXUic','_getMarkersInDocumentOrder',':start></','196wPtrbu','showFakeVisualSelection','_integrateEditor','floor','data-id','from','model','ai-selection','dataDowncast','removeMarker','21cgBwjM','hideFakeVisualSelection','convertAiChatSelectionMarker','containerElement','getSelection','view','substring','version',':end></','sessionId','for','editingDowncast','random','738IyjAjE','_sessionId','14139580ReBrow','change','removeAllRanges','get','toView','getWalker','ck-ai-assistant-ui_theme','setAttribute','markerToElement','getMarkersGroup','indexOf','isContent','ready','trim','sort','listenTo','isBefore','has','modelToViewWithIds','1684912vRMSHA','schema',':start>','$textProxy','isOfficialPlugin','afterInit','join',':end>','127168vpJNEu','selection','getChildren','conversion','ck-fake-ai-selection'];_0x274a=function(){return _0x4606cc;};return _0x274a();}