UNPKG

@ckeditor/ckeditor5-real-time-collaboration

Version:

A set of CKEditor 5 features enabling real-time collaboration within the editor using CKEditor Cloud Services.

24 lines • 15.3 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 _0x1c76ab=_0x4e54;(function(_0x212591,_0x533492){const _0x3ef555=_0x4e54,_0x2ca8f9=_0x212591();while(!![]){try{const _0x11118d=-parseInt(_0x3ef555(0x143))/0x1+parseInt(_0x3ef555(0x142))/0x2*(parseInt(_0x3ef555(0x149))/0x3)+-parseInt(_0x3ef555(0x165))/0x4+-parseInt(_0x3ef555(0x150))/0x5+-parseInt(_0x3ef555(0x141))/0x6+-parseInt(_0x3ef555(0x163))/0x7+-parseInt(_0x3ef555(0x194))/0x8*(-parseInt(_0x3ef555(0x183))/0x9);if(_0x11118d===_0x533492)break;else _0x2ca8f9['push'](_0x2ca8f9['shift']());}catch(_0x52e57a){_0x2ca8f9['push'](_0x2ca8f9['shift']());}}}(_0x3ad6,0x349ed));import{Plugin as _0x4dcbaf}from'ckeditor5/src/core.js';import{version as _0x2b37c9}from'ckeditor5/src/utils.js';function _0x3ad6(){const _0x4d7b4c=['isOfficialPlugin','wrongRequestId','RevisionHistoryService','cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.','sendBufferedUpdates','message','getOperations','_bufferedUpdates','_getLatestVersion','1803402qedzNq','2NOZrBL','407349aHvTqu','state','type','max','editor','change:_isPendingUpdate','805773irOqOW','pluginName','change:_isConnected','remove','currentRevision','reverse','plugins','1333780vaSFDu','then','listenTo','fromVersion','from','isEmptyCurrent','has','RevisionHistory','bind','_fetchMissingUsers','off','destroy','buildRevisionData','_createCurrentRevision','startsWith','_isPendingUpdate','_revisions','revisionsUpdated','getRevision','1312458EWHDfK','requires','1129224RxuHlz','once','CloudServicesRevisionHistoryAdapter','updateRevisions','map','_startingVersion','isConnected','size','_lastRequestId','getRevisions','_bufferUpdate','data','cloud-services-internal-error:\x20Request\x20timeout.','isEnabled','addRevisionData','serverHistory','_handleReconnectionError','createdAt','config','collaboration.channelId','_revisionDataBuilder','_revisionTracker','connected','add','baseVersion','_isConnected','_fixRevision','affectsData','connection','adapter','40266htyBqD','_getLatestVersionFromServerOperations','code','length','setSource','connect','reconnect','_revisionHistoryService','catch','isBundleUploaded','marker','cloud-services-internal-error:\x20Not\x20connected.','toVersion','400','_update','getUser','diffData','2488nlskBf','addUser','isPremiumPlugin','CONNECTED','_waitForServiceReady','authors','authorsIds','init','_oldOffset','RevisionTracker','repository','getMany','_offset','_handleRevisionsUpdate','cloudServices.bundleVersion','creatorId','get','addToReconnectionStack','reInit','setRevisionData','_preventResendingRevisionData','keys','sessionId'];_0x3ad6=function(){return _0x4d7b4c;};return _0x3ad6();}import{Users as _0x391f77}from'ckeditor5-collaboration/src/collaboration-core.js';import{RealTimeCollaborationClient as _0x85fb36}from'../realtimecollaborativeediting/realtimecollaborationclient.js';import{WebSocketGateway as _0xd7862f}from'../realtimecollaborativeediting/websocketgateway.js';function _0x4e54(_0x4d54be,_0x56d002){const _0x3ad696=_0x3ad6();return _0x4e54=function(_0x4e5489,_0x433038){_0x4e5489=_0x4e5489-0x126;let _0x5555a6=_0x3ad696[_0x4e5489];return _0x5555a6;},_0x4e54(_0x4d54be,_0x56d002);}import{Sessions as _0x4d7faf}from'../realtimecollaborativeediting/sessions.js';import{EditorService as _0x41ba5d,RevisionHistoryService as _0x1f6375,User as _0x28ebe3,WEB_SOCKET_GATEWAY_STATES as _0x1dccc6}from'@ckeditor/ckeditor-cloud-services-collaboration/src/services.js';export class CloudServicesRevisionHistoryAdapter extends _0x4dcbaf{static [_0x1c76ab(0x13a)]=/* #__PURE__ -- @preserve */ ((()=>_0x1f6375)());[_0x1c76ab(0x16d)];[_0x1c76ab(0x17a)];[_0x1c76ab(0x18a)];[_0x1c76ab(0x129)];static get[_0x1c76ab(0x164)](){const _0x21a448=_0x1c76ab;return[_0xd7862f,_0x85fb36,_0x21a448(0x157),_0x4d7faf,_0x391f77];}static get[_0x1c76ab(0x14a)](){const _0x5d5a14=_0x1c76ab;return _0x5d5a14(0x167);}static get[_0x1c76ab(0x138)](){return!0x0;}static get[_0x1c76ab(0x196)](){return!0x0;}constructor(_0x5061ac){const _0x25ec42=_0x1c76ab;super(_0x5061ac);const _0xf818a6=this[_0x25ec42(0x147)][_0x25ec42(0x177)][_0x25ec42(0x131)](_0x25ec42(0x178));this[_0x25ec42(0x16d)]=null,this[_0x25ec42(0x17a)]=this[_0x25ec42(0x147)][_0x25ec42(0x14f)][_0x25ec42(0x131)](_0x25ec42(0x12a)),this[_0x25ec42(0x18a)]=new CloudServicesRevisionHistoryAdapter[(_0x25ec42(0x13a))](_0xf818a6);}async[_0x1c76ab(0x128)](){const _0x4aaf77=_0x1c76ab,_0x174c72=this[_0x4aaf77(0x147)][_0x4aaf77(0x14f)][_0x4aaf77(0x131)](_0x85fb36),_0xae7cee=_0x174c72[_0x4aaf77(0x174)],_0x489bfe=this[_0x4aaf77(0x147)][_0x4aaf77(0x14f)][_0x4aaf77(0x131)](_0xd7862f);this[_0x4aaf77(0x17a)][_0x4aaf77(0x187)]({'history':_0xae7cee,'getLatestVersion':()=>this[_0x4aaf77(0x140)](),'getCurrentRevisionId':()=>_0x174c72[_0x4aaf77(0x137)]});const _0x5bef44=this[_0x4aaf77(0x147)][_0x4aaf77(0x177)][_0x4aaf77(0x131)](_0x4aaf77(0x12f))||_0x2b37c9,_0x5e58c9=await _0x41ba5d[_0x4aaf77(0x18c)](_0x489bfe[_0x4aaf77(0x181)],_0x5bef44);this[_0x4aaf77(0x147)][_0x4aaf77(0x14f)][_0x4aaf77(0x131)](_0x4aaf77(0x157))[_0x4aaf77(0x182)]={'getRevision':async({revisionId:_0x1330ae})=>(await this[_0x4aaf77(0x198)](),await this[_0x4aaf77(0x18a)][_0x4aaf77(0x162)](_0x1330ae)),'updateRevisions':async _0x265c65=>{const _0x5c17ca=_0x4aaf77;await this[_0x5c17ca(0x198)]();const _0xa60969=this[_0x5c17ca(0x17a)][_0x5c17ca(0x14d)];if(_0x5e58c9&&0x1===_0x265c65[_0x5c17ca(0x186)]&&_0x265c65[0x0]['id']===_0xa60969['id'])return _0x265c65;for(const _0xd8e13b of _0x265c65)_0xd8e13b['id']===_0xa60969['id']&&(_0xd8e13b[_0x5c17ca(0x155)]=_0xd8e13b[_0x5c17ca(0x153)]===_0xd8e13b[_0x5c17ca(0x18f)]);return this[_0x5c17ca(0x18a)][_0x5c17ca(0x168)](_0x265c65,this[_0x5c17ca(0x16d)])[_0x5c17ca(0x151)](_0xaa282a=>(this[_0x5c17ca(0x16d)]=_0xaa282a,_0x265c65))[_0x5c17ca(0x18b)](_0x163ab6=>{const _0x4282a4=_0x5c17ca;if(_(_0x163ab6)||_0x4282a4(0x190)===_0x163ab6[_0x4282a4(0x185)]&&void 0x0!==_0x163ab6[_0x4282a4(0x170)][_0x4282a4(0x139)]){for(const _0x157df9 of _0x265c65){!this[_0x4282a4(0x17a)][_0x4282a4(0x12b)][_0x4282a4(0x162)](_0x157df9['id'])||this[_0x4282a4(0x17a)][_0x4282a4(0x16f)](_0x157df9['id'],_0x157df9,!0x1);}if(_(_0x163ab6))throw _0x163ab6;return _0x265c65;}throw _0x163ab6;});}},this[_0x4aaf77(0x152)](this[_0x4aaf77(0x18a)],_0x4aaf77(0x161),(_0x3a9738,{revisionsData:_0x418eeb,requestId:_0x2afad2})=>{const _0x1d647e=_0x4aaf77;Math[_0x1d647e(0x146)](..._0x418eeb[_0x1d647e(0x169)](_0x4268ce=>_0x4268ce[_0x1d647e(0x18f)]))>this[_0x1d647e(0x184)]()-0x1?this[_0x1d647e(0x140)]()[_0x1d647e(0x151)](()=>{const _0x2393d2=_0x1d647e;this[_0x2393d2(0x12e)](_0x418eeb,_0x2afad2);}):this[_0x1d647e(0x12e)](_0x418eeb,_0x2afad2);});const {revisions:_0x4a1291,requestId:_0x652a3d}=await this[_0x4aaf77(0x18a)][_0x4aaf77(0x188)](_0x489bfe[_0x4aaf77(0x181)]);_0x489bfe[_0x4aaf77(0x132)](this),this[_0x4aaf77(0x16d)]=_0x652a3d,await this[_0x4aaf77(0x159)](_0x4a1291);for(const _0x4e5b09 of _0x4a1291)this[_0x4aaf77(0x17a)][_0x4aaf77(0x173)](_0x4e5b09);this[_0x4aaf77(0x152)](_0x174c72,_0x4aaf77(0x14b),(_0x2ab5ba,_0x5aab73,_0x1f6f88)=>{const _0x4c53e4=_0x4aaf77;_0x1f6f88&&(this[_0x4c53e4(0x129)]=_0x174c72[_0x4c53e4(0x12d)],_0x2ab5ba[_0x4c53e4(0x15a)]());}),this[_0x4aaf77(0x17a)][_0x4aaf77(0x158)](_0x4aaf77(0x172))['to'](_0x489bfe,_0x4aaf77(0x144),_0x474d29=>_0x474d29===_0x1dccc6[_0x4aaf77(0x197)]);}async[_0x1c76ab(0x189)](){const _0x18812e=_0x1c76ab,_0xc677c4=this[_0x18812e(0x147)][_0x18812e(0x14f)][_0x18812e(0x131)](_0xd7862f),_0x142d23=this[_0x18812e(0x147)][_0x18812e(0x14f)][_0x18812e(0x131)](_0x85fb36),_0x5a9f0e=async()=>{const _0x358ecd=_0x18812e,_0x153184=this[_0x358ecd(0x17a)][_0x358ecd(0x14d)],_0x18076e=_0x153184['id'],_0x3bd5a9=_0x18076e!==_0x142d23[_0x358ecd(0x137)];if(_0x3bd5a9){const _0x49a13f=_0x142d23[_0x358ecd(0x12d)]-this[_0x358ecd(0x129)],_0x151b26=this[_0x358ecd(0x184)]();this[_0x358ecd(0x17a)][_0x358ecd(0x179)][_0x358ecd(0x133)]();if(_0x153184[_0x358ecd(0x18f)]+_0x49a13f!==_0x151b26){const _0x228903=_0x153184[_0x358ecd(0x153)]+_0x49a13f,_0x479f69=this[_0x358ecd(0x147)][_0x358ecd(0x14f)][_0x358ecd(0x131)](_0x391f77),_0x469a51=this[_0x358ecd(0x17a)][_0x358ecd(0x15c)]({'revision':_0x153184,'from':_0x228903,'to':_0x151b26});_0x469a51['id']=_0x153184['id'];const _0x205dcb=_0x469a51[_0x358ecd(0x127)][_0x358ecd(0x169)](_0x2480c=>_0x479f69[_0x358ecd(0x192)](_0x2480c));_0x153184[_0x358ecd(0x191)]({..._0x469a51,'authors':_0x205dcb},!0x0),this[_0x358ecd(0x17a)][_0x358ecd(0x16f)](_0x153184['id'],_0x469a51,!0x0);}this[_0x358ecd(0x17a)][_0x358ecd(0x16a)]=_0x151b26,(_0x153184[_0x358ecd(0x18f)]===_0x153184[_0x358ecd(0x153)]&&!this[_0x358ecd(0x17a)][_0x358ecd(0x13f)][_0x358ecd(0x156)](_0x18076e)&&this[_0x358ecd(0x17a)][_0x358ecd(0x12b)][_0x358ecd(0x160)][_0x358ecd(0x14c)](_0x18076e),this[_0x358ecd(0x17a)][_0x358ecd(0x15d)](_0x151b26));}const {revisions:_0x5c88fd,requestId:_0x8af4ba}=await this[_0x358ecd(0x18a)][_0x358ecd(0x189)](_0xc677c4[_0x358ecd(0x181)],this[_0x358ecd(0x16d)]);_0x3bd5a9&&_0x5c88fd[_0x358ecd(0x186)]>0x0?_0x142d23[_0x358ecd(0x175)]():(await this[_0x358ecd(0x159)](_0x5c88fd),this[_0x358ecd(0x12e)](_0x5c88fd,_0x8af4ba),this[_0x358ecd(0x17a)][_0x358ecd(0x13c)]());};return _0x142d23[_0x18812e(0x17e)]?_0x5a9f0e():new Promise((_0x10c8fe,_0x3bcdfe)=>{const _0x2bd1b4=_0x18812e;_0x142d23[_0x2bd1b4(0x166)](_0x2bd1b4(0x14b),()=>{const _0x580339=_0x2bd1b4;_0x5a9f0e()[_0x580339(0x151)](_0x10c8fe)[_0x580339(0x18b)](_0x3bcdfe);});});}[_0x1c76ab(0x15b)](){const _0x5a9f04=_0x1c76ab;super[_0x5a9f04(0x15b)]();}async[_0x1c76ab(0x198)](){const _0x27e8ea=_0x1c76ab;this[_0x27e8ea(0x18a)][_0x27e8ea(0x16b)]||await new Promise(_0x46bf3e=>{const _0x5527a5=_0x27e8ea;this[_0x5527a5(0x152)](this[_0x5527a5(0x18a)],_0x5527a5(0x17b),_0x122d9d=>{const _0x2180e4=_0x5527a5;_0x122d9d[_0x2180e4(0x15a)](),_0x46bf3e();});});}[_0x1c76ab(0x184)](){const _0x5bacd9=_0x1c76ab,_0x27b2ed=this[_0x5bacd9(0x147)][_0x5bacd9(0x14f)][_0x5bacd9(0x131)](_0x85fb36)[_0x5bacd9(0x174)][_0x5bacd9(0x13e)]()[_0x5bacd9(0x14e)]();for(const _0x27b60f of _0x27b2ed)if(_0x5bacd9(0x18d)!==_0x27b60f[_0x5bacd9(0x145)]||_0x27b60f[_0x5bacd9(0x180)])return _0x27b60f[_0x5bacd9(0x17d)]+0x1;}[_0x1c76ab(0x140)](){const _0x1bf5ca=_0x1c76ab,_0x56ed3a=this[_0x1bf5ca(0x147)][_0x1bf5ca(0x14f)][_0x1bf5ca(0x131)](_0x85fb36);return new Promise(_0x5899fb=>{const _0x1af024=_0x1bf5ca;_0x56ed3a[_0x1af024(0x15f)]?_0x56ed3a[_0x1af024(0x166)](_0x1af024(0x148),()=>{const _0x29205f=_0x1af024;_0x5899fb(this[_0x29205f(0x184)]());}):_0x5899fb(this[_0x1af024(0x184)]());});}[_0x1c76ab(0x12e)](_0x53ac2e,_0x2520ef){const _0xfda9df=_0x1c76ab,_0x35f6b6=this[_0xfda9df(0x17a)][_0xfda9df(0x12b)];this[_0xfda9df(0x16d)]=_0x2520ef;for(const _0x11c6b4 of _0x53ac2e){const _0x5e787b=_0x35f6b6[_0xfda9df(0x162)](_0x11c6b4['id']);if(_0x5e787b){if((_0x11c6b4[_0xfda9df(0x153)]||_0x11c6b4[_0xfda9df(0x18f)])&&(_0x11c6b4[_0xfda9df(0x193)]=null),_0x5e787b===this[_0xfda9df(0x17a)][_0xfda9df(0x14d)]){const _0x4983c5=Math[_0xfda9df(0x146)](_0x5e787b[_0xfda9df(0x18f)],_0x11c6b4[_0xfda9df(0x18f)]),_0x24ec7d=Math[_0xfda9df(0x146)](_0x5e787b[_0xfda9df(0x153)],_0x11c6b4[_0xfda9df(0x153)]);let _0x1c3858;_0x5e787b[_0xfda9df(0x18f)]===_0x11c6b4[_0xfda9df(0x18f)]&&_0x5e787b[_0xfda9df(0x153)]===_0x11c6b4[_0xfda9df(0x153)]?(_0x1c3858=!0x0,this[_0xfda9df(0x135)](_0x11c6b4)):_0x11c6b4[_0xfda9df(0x18f)]===_0x4983c5&&_0x11c6b4[_0xfda9df(0x153)]===_0x24ec7d?_0x1c3858=!0x1:(_0x5e787b[_0xfda9df(0x18f)]===_0x4983c5&&_0x5e787b[_0xfda9df(0x153)]===_0x24ec7d||this[_0xfda9df(0x17f)]({'revision':_0x5e787b,'from':_0x24ec7d,'to':_0x4983c5}),_0x1c3858=!0x0),_0x1c3858&&(delete _0x11c6b4[_0xfda9df(0x153)],delete _0x11c6b4[_0xfda9df(0x18f)],delete _0x11c6b4[_0xfda9df(0x193)],delete _0x11c6b4[_0xfda9df(0x176)],delete _0x11c6b4[_0xfda9df(0x127)]);}this[_0xfda9df(0x17a)][_0xfda9df(0x134)](_0x11c6b4),this[_0xfda9df(0x135)](_0x11c6b4);}else this[_0xfda9df(0x17a)][_0xfda9df(0x173)](_0x11c6b4);}const _0x47045a=_0x35f6b6[_0xfda9df(0x16e)]();_0x47045a[_0xfda9df(0x14e)]();for(let _0x2f1233=0x0;_0x2f1233<_0x47045a[_0xfda9df(0x186)]-0x1;_0x2f1233++){const _0x21441d=_0x47045a[_0x2f1233],_0x4e0fbe=_0x47045a[_0x2f1233+0x1];if(_0x21441d[_0xfda9df(0x153)]<_0x4e0fbe[_0xfda9df(0x18f)]){const _0x561bf2=_0x4e0fbe[_0xfda9df(0x18f)],_0x3492a7=Math[_0xfda9df(0x146)](_0x561bf2,_0x21441d[_0xfda9df(0x18f)]);this[_0xfda9df(0x17f)]({'revision':_0x21441d,'from':_0x561bf2,'to':_0x3492a7});}}}[_0x1c76ab(0x17f)]({revision:_0x462242,from:_0x12d457,to:_0x1ec3c6}={}){const _0x43514e=_0x1c76ab,_0x1064fa=this[_0x43514e(0x147)][_0x43514e(0x14f)][_0x43514e(0x131)](_0x391f77),_0x5b76a2=this[_0x43514e(0x17a)][_0x43514e(0x15c)]({'revision':_0x462242,'from':_0x12d457,'to':_0x1ec3c6});_0x5b76a2[_0x43514e(0x126)]=_0x5b76a2[_0x43514e(0x127)][_0x43514e(0x169)](_0x2d6755=>_0x1064fa[_0x43514e(0x192)](_0x2d6755)),_0x462242[_0x43514e(0x191)](_0x5b76a2);}[_0x1c76ab(0x135)](_0x55d98e){const _0x259739=_0x1c76ab,_0x21a560={};_0x21a560['id']=_0x55d98e['id'];for(const _0x29e240 of Object[_0x259739(0x136)](_0x55d98e))'id'!==_0x29e240&&(_0x21a560[_0x29e240]=void 0x0);this[_0x259739(0x17a)][_0x259739(0x16f)](_0x21a560['id'],_0x21a560,!0x0);}async[_0x1c76ab(0x159)](_0x4b6ba6){const _0x54cb2f=_0x1c76ab,_0x517fb2=this[_0x54cb2f(0x147)][_0x54cb2f(0x14f)][_0x54cb2f(0x131)](_0x391f77),{connection:_0xf87630}=this[_0x54cb2f(0x147)][_0x54cb2f(0x14f)][_0x54cb2f(0x131)](_0xd7862f),_0x1a4965=new Set();for(const _0x46ad82 of _0x4b6ba6){for(const _0x23a336 of _0x46ad82[_0x54cb2f(0x127)])_0x139551(_0x23a336);_0x46ad82[_0x54cb2f(0x130)]&&_0x139551(_0x46ad82[_0x54cb2f(0x130)]);}if(0x0===_0x1a4965[_0x54cb2f(0x16c)])return;const _0xfe659d=await _0x28ebe3[_0x54cb2f(0x12c)](_0xf87630,Array[_0x54cb2f(0x154)](_0x1a4965));for(const _0xd4f35b of _0xfe659d)_0x517fb2[_0x54cb2f(0x192)](_0xd4f35b['id'])||_0x517fb2[_0x54cb2f(0x195)](_0xd4f35b);function _0x139551(_0x3db446){const _0x1f38b8=_0x54cb2f;_0x517fb2[_0x1f38b8(0x192)](_0x3db446)||_0x1a4965[_0x1f38b8(0x17c)](_0x3db446);}}}function _(_0x5e33aa){const _0x21942f=_0x1c76ab;return _0x5e33aa[_0x21942f(0x13d)][_0x21942f(0x15e)](_0x21942f(0x13b))||_0x5e33aa[_0x21942f(0x13d)][_0x21942f(0x15e)](_0x21942f(0x18e))||_0x5e33aa[_0x21942f(0x13d)][_0x21942f(0x15e)](_0x21942f(0x171));}