UNPKG

@ckeditor/ckeditor5-real-time-collaboration

Version:

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

26 lines 92.9 kB
/* * Copyright (c) 2003-2026, 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. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ import{ContextPlugin as _0x394a1b,Plugin as _0x39f59e,PendingActions as _0x21d2f4,Context as _0x24b668}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x19d0fb,CKEditorError as _0x243503,Collection as _0x4e20c8,global as _0x83c1e,version as _0x48cf3d,uid as _0x438389,KeystrokeHandler as _0x14a27d}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x4674d2,View as _0x11fac4,ListView as _0x57db8b,ListItemView as _0x2c1667,LabelView as _0x4191d9,BalloonPanelView as _0x317f08,clickOutsideHandler as _0x13bc91,BodyCollection as _0xe18bfe}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x95f11e,History as _0x33b12d,NoOperation as _0x5197d8,InsertOperation as _0x203f45,MarkerOperation as _0x12333c,RootAttributeOperation as _0x3d0c24,transformOperationSets as _0x233e00,OperationFactory as _0x1b7c05}from'@ckeditor/ckeditor5-engine/dist/index.js';import{CloudServices as _0x171d85}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{WebSocketGateway as _0x36da21,WEB_SOCKET_GATEWAY_STATES as _0x3534a0,CollaborativeEditingService as _0x2b269e,User as _0x34df4b,CommentsService as _0x1b1ea1,TrackChangesService as _0x5c2a30,RevisionHistoryService as _0x150025,EditorService as _0x27f1a5}from'@ckeditor/ckeditor-cloud-services-collaboration';import{Users as _0x3536cf,UserView as _0x4e6de2}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import{Compressor as _0x96b0a0}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChangesEditing as _0x4ec4de,TrackChanges as _0x36fd6b}from'@ckeditor/ckeditor5-track-changes/dist/index.js';import{CommentsRepository as _0x3fd35f,Comments as _0x514b66,CommentsEditing as _0x83c134}from'@ckeditor/ckeditor5-comments/dist/index.js';import{RevisionHistory as _0xb826a}from'@ckeditor/ckeditor5-revision-history/dist/index.js';import{isElement as _0x3ce7c0}from'es-toolkit/compat';class WebSocketGateway extends _0x394a1b{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */ ((()=>_0x36da21)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return[_0x171d85,_0x4674d2];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x493528){super(_0x493528),this['set']('state',_0x3534a0['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x19d0fb())();}['init'](){const _0x3fe20c=this['context'],_0x1228a8=_0x3fe20c['plugins']['get'](_0x171d85),_0x158cd4=_0x3fe20c['plugins']['get'](_0x4674d2);if(!_0x1228a8['token'])throw new _0x243503('websocketgateway-missing-token',this);if(!_0x1228a8['webSocketUrl'])throw new _0x243503('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),WebSocketGateway['WebSocketGateway']['connect'](_0x1228a8['token'],_0x1228a8['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0xefee9=>{if(this['connection']=_0xefee9,this['bind']('state')['to'](_0xefee9,'state',this,'_isBrowserOffline',(_0x39fe1f,_0x566557)=>('connected'!==_0x39fe1f&&(this['_shouldPluginsReconnect']=!0x0),_0x566557||_0x39fe1f!==_0x3534a0['CONNECTED']?_0x3534a0['DISCONNECTED']:this['state']==_0x3534a0['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x3534a0['CONNECTING']):_0x3534a0['CONNECTED'])),this['connection']['on']('error',(_0x49b349,_0x5cf69a)=>{if('limitExceeded'!==_0x5cf69a['code'])throw console['error'](_0x5cf69a),new _0x243503('cloudservices-init',null,{'originalError':_0x5cf69a});_0x158cd4['showWarning']('The\x20limit\x20of\x20maximum\x20concurrent\x20connections\x20that\x20the\x20collaboration\x20server\x20can\x20handle\x20has\x20been\x20reached.\x20Try\x20opening\x20the\x20document\x20again\x20in\x20a\x20few\x20minutes.\x20Please\x20contact\x20your\x20system\x20administrator\x20if\x20the\x20problem\x20persists.',{'title':'Connected\x20users\x20limit\x20exceeded','namespace':'real-time-collaboration'});}),!_0xefee9['me'])return new Promise(_0x23490f=>_0xefee9['on']('change:me',_0x23490f));})['catch'](_0x3c1e2d=>{throw console['error'](_0x3c1e2d),new _0x243503('cloudservices-init',null,{'originalError':_0x3c1e2d});});}['addToReconnectionStack'](_0x2fcda7){if('function'!=typeof _0x2fcda7['reconnect'])throw new _0x243503('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x2fcda7))throw new _0x243503('websocketgateway-plugin-already-registered',this,{'name':_0x2fcda7['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x2fcda7);}['removeFromReconnectionStack'](_0x4ae221){this['_reconnectionStack']['delete'](_0x4ae221);}['isInReconnectionStack'](_0x1c766e){return this['_reconnectionStack']['has'](_0x1c766e);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x2102d2=>_0x2102d2['reconnect']())))['then'](()=>this['state']=_0x3534a0['CONNECTED'])['catch'](_0x3917d4=>{throw console['error'](_0x3917d4),new _0x243503('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x3534a0['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class Sessions extends _0x394a1b{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[WebSocketGateway,_0x3536cf];}constructor(_0x577745){super(_0x577745),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x4e20c8(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x3536cf);}['init'](){const _0x443730=this['context']['plugins']['get'](WebSocketGateway);this['listenTo'](_0x443730,'change:state',(_0x715bf8,_0x241dd4,_0x3dffcd)=>{if('connected'!==_0x3dffcd)this['channelSessions']['forEach'](_0x354c7d=>_0x354c7d['clear']()),this['channelConnectedUsers']['forEach'](_0xa7371a=>_0xa7371a['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x23647f,_0x2aa1b4]of this['_registeredSessions'])for(const _0x3d6f0f of _0x2aa1b4)this['_handleSessionAdd'](_0x23647f,_0x3d6f0f);}}),this['_createUser'](_0x443730['connection']['me'],!0x0);}['register'](_0x377bff,_0x275229){if(this['_registeredSessions']['has'](_0x377bff))throw new _0x243503('sessions-register-already-registered',null,{'channelId':_0x377bff});this['_registeredSessions']['set'](_0x377bff,_0x275229),this['channelSessions']['set'](_0x377bff,new _0x4e20c8()),this['channelConnectedUsers']['set'](_0x377bff,new _0x4e20c8()),this['listenTo'](_0x275229,'add',(_0x21062b,_0x1878a1)=>this['_handleSessionAdd'](_0x377bff,_0x1878a1)),this['listenTo'](_0x275229,'remove',(_0x4ae252,_0x280a52)=>this['_handleSessionRemove'](_0x377bff,_0x280a52));for(const _0x4f40fb of _0x275229)this['_handleSessionAdd'](_0x377bff,_0x4f40fb);}['unregister'](_0x27aaec){if(!this['_registeredSessions']['has'](_0x27aaec))throw new _0x243503('sessions-unregister-not-exist',null,{'channelId':_0x27aaec});const _0x1453ba=this['_registeredSessions']['get'](_0x27aaec);this['stopListening'](_0x1453ba);for(const _0x212b97 of _0x1453ba)'connected'===this['context']['plugins']['get'](WebSocketGateway)['state']&&this['_handleSessionRemove'](_0x27aaec,_0x212b97);this['_registeredSessions']['delete'](_0x27aaec),this['channelSessions']['delete'](_0x27aaec),this['channelConnectedUsers']['delete'](_0x27aaec);}get['mySessionId'](){return this['context']['plugins']['get'](WebSocketGateway)['connection']['sessionId'];}['getUserBySessionId'](_0x2c7f01){for(const _0xddfc75 of this['channelSessions']['values']())for(const _0x474300 of _0xddfc75)if(_0x474300['id']===_0x2c7f01)return _0x474300['user'];}['getUserSessions'](_0x2c61f8,_0x2b5828){const _0x1326b6=_0x2b5828?[this['channelSessions']['get'](_0x2b5828)]:this['channelSessions']['values'](),_0xfeecc0=new Set();for(const _0x172db2 of _0x1326b6)for(const _0x18ecbc of _0x172db2)_0x18ecbc['user']['id']===_0x2c61f8['id']&&_0xfeecc0['add'](_0x18ecbc['id']);return _0xfeecc0;}['getUserRole'](_0x36b5c8){for(const _0x5b735f of this['channelSessions']['values']())for(const _0x13f3aa of _0x5b735f)if(_0x13f3aa['user']===_0x36b5c8)return _0x13f3aa['role'];}['_handleSessionAdd'](_0x365330,_0x34b99e){if('connected'!==this['context']['plugins']['get'](WebSocketGateway)['state'])return;const _0x117984=_0x34b99e['user'],_0x38dc5e=this['_users']['getUser'](_0x117984['id'])||this['_createUser'](_0x117984),_0x13902d=Object['assign']({},_0x34b99e,{'user':_0x38dc5e});if(this['channelSessions']['get'](_0x365330)['add'](_0x13902d),!_0x117984['hiddenInPresenceList']){const _0x47de85=this['channelConnectedUsers']['get'](_0x365330);_0x47de85['has'](_0x38dc5e['id'])||_0x47de85['add'](_0x38dc5e),this['allConnectedUsers']['has'](_0x38dc5e['id'])||_0x117984['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x38dc5e,_0x38dc5e['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x365330,{'channelId':_0x365330,'session':_0x13902d});}['_handleSessionRemove'](_0x3590c9,_0x345788){if('connected'!==this['context']['plugins']['get'](WebSocketGateway)['state'])return;const _0x4fedb3=this['channelConnectedUsers']['get'](_0x3590c9),_0x18b0e8=_0x345788['user'];_0x18b0e8['id']&&(this['channelSessions']['get'](_0x3590c9)['remove'](_0x345788['id']),_0x4fedb3['has'](_0x18b0e8['id'])&&!this['getUserSessions'](_0x18b0e8,_0x3590c9)['size']&&_0x4fedb3['remove'](_0x18b0e8['id']),this['allConnectedUsers']['get'](_0x18b0e8['id'])&&!this['getUserSessions'](_0x18b0e8)['size']&&this['allConnectedUsers']['remove'](_0x18b0e8['id']));}['_createUser'](_0x529c7d,_0x12ff64){const _0x544605=this['_users']['addUser'](_0x529c7d);return _0x12ff64&&this['_users']['defineMe'](_0x529c7d['id']),_0x544605['orderNumber']=this['_uniqueUsersCount']++,_0x544605;}}class UserMarkers extends _0x39f59e{['_domEmitter']=new(_0x19d0fb())();static get['requires'](){return[Sessions];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1b44fb=this['editor'],_0x225eac=_0x1b44fb['plugins']['get'](Sessions);_0x1b44fb['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x4b09eb,{writer:_0x3d841b})=>function(_0x2e2a16,_0x1ffcfa,_0x2ecd65,_0x5af396){const _0x10d84b=_0x2e2a16['markerName']['split'](':')[0x2],_0x4ce4d1=_0x2ecd65['getUserBySessionId'](_0x10d84b);if(!_0x4ce4d1||_0x10d84b===_0x2ecd65['mySessionId'])return;if(!_0x5af396['model']['schema']['checkChild'](_0x2e2a16['markerRange']['start'],'$text'))return;const _0x3f4008={'class':'ck-user__marker\x20'+_0x4ce4d1['color']['getMarkerClass'](),'style':Y(_0x4ce4d1),'data-name':_0x4ce4d1['name'],'data-session-id':_0x10d84b},_0x1e351f=_0x5af396['model']['markers']['get'](_0x2e2a16['markerName']),_0x2c9e63=_0x1e351f['getStart'](),_0x279d3e=_0x2c9e63['nodeAfter'],_0x5267e1=_0x5af396['model']['schema'];if(_0x279d3e&&_0x5267e1['isObject'](_0x279d3e)&&_0x5267e1['isInline'](_0x279d3e)&&!_0x5af396['model']['markers']['get']('user:range:'+_0x10d84b)['getRange']()['isCollapsed'])return;const _0x52fdfa=_0x2c9e63['parent'];return _0x5af396['model']['schema']['isLimit'](_0x52fdfa)&&!_0x5af396['model']['hasContent'](_0x52fdfa)&&(_0x3f4008['contenteditable']=!0x1),function(_0xb5f199,_0xaeab4,_0x1591c0){const _0x226e0c=_0xb5f199['createUIElement']('span',_0xaeab4);return _0xb5f199['setCustomProperty']('userPositionMarker',!0x0,_0x226e0c),_0x226e0c['render']=function(_0x119045){const _0x6f4cc3=this['toDomElement'](_0x119045),_0x365fde=document['createElement']('span');return _0x365fde['classList']['add']('ck-user__marker-tooltip'),_0x365fde['setAttribute']('contenteditable','false'),_0x365fde['setAttribute']('spellcheck','false'),_0x365fde['textContent']=_0x1591c0['name'],_0x6f4cc3['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x365fde['outerHTML']+'⁠',_0x6f4cc3['addEventListener']('mouseenter',()=>{_0x6f4cc3['classList']['add']('ck-user__marker_hovered');}),_0x6f4cc3['addEventListener']('mouseleave',()=>{_0x6f4cc3['classList']['remove']('ck-user__marker_hovered');}),_0x6f4cc3;},_0x226e0c['isSimilar']=function(_0x247532){return!(!this['getCustomProperty']('userPositionMarker')||!_0x247532['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x247532['getAttribute']('data-session-id'));},_0x226e0c;}(_0x1ffcfa,_0x3f4008,_0x4ce4d1);}(_0x4b09eb,_0x3d841b,_0x225eac,_0x1b44fb)}),_0x1b44fb['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0xd3e482=>function(_0x2603dd,_0x4c7935){const _0x2d22cf=_0x2603dd['markerName']['split'](':')[0x2];if(_0x2d22cf===_0x4c7935['mySessionId'])return null;const _0x5355ec=_0x4c7935['getUserBySessionId'](_0x2d22cf);if(!_0x5355ec)return{'id':_0x2d22cf,'classes':[]};return{'id':_0x2d22cf,'classes':['ck-user__selection',_0x5355ec['color']['getSelectionClass']()],'attributes':{'style':Y(_0x5355ec),'data-session-id':_0x2d22cf},'priority':0x7d0+_0x5355ec['orderNumber']};}(_0xd3e482,_0x225eac)}),function(_0x21c095){const _0x33778d=_0x21c095['model'],_0xb5a306=new Map(),_0x3c1191=_0x21c095['plugins']['get'](Sessions);_0x33778d['markers']['on']('update:user:range',(_0x300388,_0xedfc1d,_0x48aac6,_0x1d1e94)=>{if(!_0x1d1e94&&_0xb5a306['get'](_0xedfc1d['name']))return _0xb5a306['get'](_0xedfc1d['name'])['detach'](),void _0xb5a306['delete'](_0xedfc1d['name']);const _0x593c0c=_0xedfc1d['name']['split'](':')[0x2];if(_0x593c0c===_0x3c1191['mySessionId'])return;const _0x21f2d2='user:position:'+_0x593c0c;_0x33778d['markers']['has'](_0x21f2d2)&&_0x21c095['editing']['reconvertMarker'](_0x21f2d2),_0xedfc1d['on']('change:range',(_0x131087,_0xf3a8ed,_0x680c3d)=>{if('$graveyard'!=_0xf3a8ed['root']['rootName']&&'$graveyard'==_0xedfc1d['getRange']()['root']['rootName']&&!_0xb5a306['has'](_0xedfc1d['name'])){const _0x4a1aba=_0x33778d['schema']['getNearestSelectionRange'](_0x680c3d['deletionPosition']);if(_0x4a1aba){const _0x317589=_0x95f11e['fromRange'](_0x4a1aba);_0xb5a306['set'](_0xedfc1d['name'],_0x317589),_0x317589['on']('change:range',(_0x58a472,_0x51c300,_0x3e39f0)=>{if('$graveyard'==_0x317589['root']['rootName']){const _0x407e01=_0x33778d['schema']['getNearestSelectionRange'](_0x3e39f0['deletionPosition']);_0x407e01?(_0x317589['start']=_0x407e01['start'],_0x317589['end']=_0x407e01['end']):(_0xb5a306['delete'](_0xedfc1d['name']),_0x317589['detach']());}});}}});}),_0x33778d['document']['on']('change',()=>{_0xb5a306['size']>0x0&&_0x33778d['enqueueChange']({'isUndoable':!0x1},_0x3c8d5f=>{for(const [_0x4bc588,_0x3c9906]of _0xb5a306)'$graveyard'==_0x33778d['markers']['get'](_0x4bc588)['getRange']()['root']['rootName']&&(z(_0x4bc588['split'](':')[0x2],_0x3c9906['toRange'](),_0x33778d,_0x3c8d5f),_0x3c9906['detach']());_0xb5a306['clear']();});});}(_0x1b44fb),this['_domEmitter']['listenTo'](_0x83c1e['document'],'keydown',(_0x177401,{key:_0x5dabcb})=>{'Escape'===_0x5dabcb&&function(_0x564811){_0x564811['editing']['view']['change'](_0x3bca76=>{for(const _0x2ddee5 of _0x564811['model']['markers']){if(!_0x2ddee5['name']['startsWith']('user:position'))continue;const _0x231ac5=_0x564811['editing']['mapper']['markerNameToElements'](_0x2ddee5['name']);if(_0x231ac5){for(const _0xab5c22 of _0x231ac5)_0x3bca76['removeClass']('ck-user__marker_hovered',_0xab5c22);}}});}(_0x1b44fb);},{'useCapture':!0x0});}['afterInit'](){const _0x42958e=this['editor'],_0xadea62=_0x42958e['commands']['get']('undo');_0xadea62&&_0x42958e['model']['on']('applyOperation',(_0x131b97,_0x36d634)=>{const _0x1f077c=_0x36d634[0x0];if(!_0x1f077c['isDocumentOperation'])return;if('marker'!=_0x1f077c['type']||!_0x1f077c['name']['startsWith']('user:'))return;const _0x5caec2=_0x1f077c['batch'];_0xadea62['_createdBatches']['has'](_0x5caec2)&&(_0x1f077c['newRange']=_0x1f077c['oldRange']?_0x42958e['model']['createRange'](_0x1f077c['oldRange']['start'],_0x1f077c['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x2f9b81=this['editor'],_0x2ca018=_0x2f9b81['model']['document'],_0x222ec2=_0x2f9b81['plugins']['get'](Sessions);_0x2f9b81['model']['enqueueChange']({'isUndoable':!0x1},_0x3a23a4=>{const _0x438b77='user:range:'+_0x222ec2['mySessionId'],_0x5b339f='user:position:'+_0x222ec2['mySessionId'],_0x59fce9=_0x2f9b81['model']['markers']['has'](_0x438b77);_0x2f9b81['editing']['view']['hasDomSelection']?z(_0x222ec2['mySessionId'],_0x2ca018['selection']['getFirstRange'](),_0x2f9b81['model'],_0x3a23a4):_0x59fce9&&(_0x3a23a4['removeMarker'](_0x438b77),_0x3a23a4['removeMarker'](_0x5b339f));});}}function z(_0x3c7291,_0x2f5846,_0x173750,_0x187ea1){const _0x2982e2='user:range:'+_0x3c7291,_0x17a2b6='user:position:'+_0x3c7291,_0x37111d=_0x2f5846['getContainedElement']();let _0x31b497=_0x2f5846['start'];if(_0x37111d&&_0x37111d['is']('element','tableCell')){const _0x152857=function(_0x591a01,_0x5036f6){for(const _0x306b6a of _0x591a01['getPositions']())if(_0x5036f6['schema']['checkChild'](_0x306b6a,'$text'))return _0x306b6a;}(_0x2f5846,_0x173750);_0x152857&&(_0x31b497=_0x152857,_0x2f5846=_0x187ea1['createRange'](_0x31b497));}const _0x3c1ffb=_0x187ea1['createRange'](_0x31b497);_0x173750['markers']['has'](_0x2982e2)?(_0x187ea1['updateMarker'](_0x2982e2,{'range':_0x2f5846}),_0x187ea1['updateMarker'](_0x17a2b6,{'range':_0x3c1ffb})):(_0x187ea1['addMarker'](_0x2982e2,{'range':_0x2f5846,'usingOperation':!0x0}),_0x187ea1['addMarker'](_0x17a2b6,{'range':_0x3c1ffb,'usingOperation':!0x0}));}function Y(_0x3741ce){return'--ck-user-color:'+_0x3741ce['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x3741ce['color']['getColorAlphaVariable']()+';';}function K(_0x6cb83c,_0x2cd517,_0x5e9cbd){const _0x5a38ab=_0x6cb83c['t'],t=_0x6cb83c['t'];switch(_0x2cd517){case'PENDING_ACTION_SENDING_DATA':return t({'string':'Sending\x20data\x20to\x20the\x20server.','id':'PENDING_ACTION_SENDING_DATA'});case'The\x20local\x20document\x20and\x20server\x20document\x20differ\x20and\x20merging\x20them\x20can\x20cause\x20unexpected\x20behavior.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20local\x20document\x20and\x20server\x20document\x20differ\x20and\x20merging\x20them\x20can\x20cause\x20unexpected\x20behavior.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'The\x20document\x20details\x20could\x20not\x20be\x20taken\x20during\x20the\x20reconnection.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20document\x20details\x20could\x20not\x20be\x20taken\x20during\x20the\x20reconnection.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.':return t('The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');case'Synchronization\x20issue':return t('Synchronization\x20issue');case'Connected\x20users\x20list\x20dropdown\x20menu':return t('Connected\x20users\x20list\x20dropdown\x20menu');case'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':return t('Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)');case'Connected\x20users\x20list':return t('Connected\x20users\x20list');case'PENDING_ACTION_REVISION_HISTORY':return _0x5a38ab({'string':'Unsaved\x20change\x20in\x20revision\x20history.','id':'PENDING_ACTION_REVISION_HISTORY'});case'CONNECTED_USERS':return t({'string':'1\x20connected\x20user\x20(me)','plural':'%0\x20connected\x20users','id':'CONNECTED_USERS'},_0x5e9cbd);default:return'';}}let J=0x1;class RealTimeCollaborationClient extends _0x39f59e{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */ ((()=>_0x2b269e)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[WebSocketGateway,Sessions,UserMarkers,_0x21d2f4,_0x3536cf,_0x4674d2];}static get['pluginName'](){return'RealTimeCollaborationClient';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}get['cloudDocumentVersion'](){return this['_lastServerVersion']+this['_offset'];}get['_lastServerVersion'](){return this['serverHistory']['version']-this['_offset'];}get['lastSyncVersion'](){const _0x2992f7=this['serverHistory']['getOperations']();for(let _0x22f139=_0x2992f7['length']-0x1;_0x22f139>=0x0;_0x22f139--){const _0x5d7222=_0x2992f7[_0x22f139];if(!this['_disconnectionOperations']['has'](_0x5d7222))return _0x5d7222['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x5c0c2d){if(super(_0x5c0c2d),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x33b12d(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x243503('collaboration-missing-channelid',this);const _0x525c8c=_0x5c0c2d['config']['get']('cloudServices.bundleVersion')||_0x48cf3d;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x525c8c,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x96b0a0(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new OperationIdentifier(this['_disconnectionOperations']);}['init'](){const _0x54c511=this['editor'],_0x4b4078=_0x54c511['plugins']['get'](_0x3536cf),_0x23209a=_0x54c511['plugins']['get'](WebSocketGateway);this['listenTo'](_0x4b4078,'getOperationAuthor',(_0x3e25fc,_0x322a0e)=>{const _0x101216=_0x322a0e[0x0];_0x101216['_authorId']&&(_0x3e25fc['return']=_0x4b4078['getUser'](_0x101216['_authorId']),_0x3e25fc['stop']()),null===_0x101216['_authorId']&&(_0x3e25fc['return']=null,_0x3e25fc['stop']());},{'priority':'high'}),this['listenTo'](_0x54c511['model']['document']['selection'],'change:range',(_0xe33f90,_0xd1b967)=>{_0xd1b967['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x54c511['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x54c511['model']['on']('applyOperation',(_0x1197d2,_0x5e75ad)=>{const _0x4450bb=_0x5e75ad[0x0];_0x4450bb['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x4450bb),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x23209a,'state',this,'_hasSynchronizationProblem',(_0xb9ae7d,_0x3199a7)=>'connected'===_0xb9ae7d&&!_0x3199a7),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x54c511['disableReadOnlyMode']('rtc-offline'):_0x54c511['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x54c511['disableReadOnlyMode']('rtc-offline'):_0x54c511['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x5856e9=this['editor']['plugins']['get'](Sessions),_0xc6e0e5=this['editor']['plugins']['get'](WebSocketGateway);try{this['_isPendingUpdate']=!0x0,_0x5856e9['unregister'](this['_channelId']);const _0x3d07a0=await this['_service']['reconnect'](_0xc6e0e5['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x3d07a0)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x3d5a7b=await this['_service']['getConnectedSessions']();_0x5856e9['register'](this['_channelId'],_0x3d5a7b),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x11d246){if(function(_0xe3d799){return'404'===_0xe3d799['code'];}(_0x11d246)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x2fc04d){return'409'===_0x2fc04d['code'];}(_0x11d246)){const _0x8bedc1=K(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x8bedc1);}else{if(!(_0x11d246 instanceof ReconnectionError))throw _0x11d246;this['_handleReconnectionError']();}}}}['destroy'](){const _0x52e5e5=this['editor']['plugins']['get'](WebSocketGateway),_0x5b2dbe=this['editor']['plugins']['get'](Sessions);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x5b2dbe['channelSessions']['has'](this['_channelId'])&&_0x5b2dbe['unregister'](this['_channelId']),_0x52e5e5['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x5e31f9){if(this['sessionId']!==_0x5e31f9['sessionId']&&this['_lastSyncedOperationId']!==_0x5e31f9['lastOperationId'])throw new ReconnectionError();return this['sessionId']=_0x5e31f9['sessionId'],this['_handleServerResponse']([],{..._0x5e31f9,'wereChangesApplied':!0x1,'data':_0x5e31f9['data']},'reconnect');}async['_connectService'](_0x3d30da,_0x219b38=!0x1){const {connection:_0x416772}=this['editor']['plugins']['get'](WebSocketGateway);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x416772,this['_channelId'])['then'](_0x4cf78a=>this['_initSessionsHandling'](_0x4cf78a))['catch'](_0x1e10bb=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1e10bb);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x51e251,_0xb13e17)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0xb13e17);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x5d67b6=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3d30da);this['_isPendingUpdate']=!0x0;const _0x7bf8d0=await this['_service']['connect'](_0x416772,this['_compressOperations'](_0x3d30da),_0x5d67b6);if(this['sessionId']=_0x7bf8d0['sessionId'],_0x219b38){if(!_0x7bf8d0['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x7bf8d0['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x3d30da,_0x7bf8d0,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x7bf8d0,_0x3d30da);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x25f7ca=this['editor']['plugins']['get'](Sessions),_0x379217=this['editor']['plugins']['get'](UserMarkers),_0x172c22=_0x25f7ca['channelSessions']['get'](this['_channelId']);_0x172c22&&_0x172c22['length']>0x1?_0x379217['createUserMarkerOperations']():this['listenTo'](_0x25f7ca,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x25f7ca['channelSessions']['get'](this['_channelId'])['length']&&_0x379217['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x2d2eb9,_0x5c3bb0,_0x498488,_0x252893){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x5c3bb0){const _0x516abd=this['_decompressOperations'](_0x498488,_0x252893);await this['_fetchMissingUsers'](_0x516abd),this['_handleExternalOperations'](_0x516abd,_0x5c3bb0,_0x498488['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x280c14}=this['editor'];let _0x4f1fdd;try{_0x4f1fdd=await this['_service']['getDocumentDetails']();}catch{const _0x39bd73=K(_0x280c14,'The\x20document\x20details\x20could\x20not\x20be\x20taken\x20during\x20the\x20reconnection.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x39bd73);}const _0x2ce777=_0x4f1fdd['currentDocumentSession']||_0x4f1fdd['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2ce777['lastOperationId']){const _0x542ac6=K(_0x280c14,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x542ac6);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x24f632){const _0x3672c4=this['editor']['plugins']['get'](Sessions);this['listenTo'](_0x3672c4,'sessionAdd:'+this['_channelId'],(_0x3e4892,{session:_0x364da6})=>{if(_0x364da6['id']===_0x3672c4['mySessionId']){_0x3e4892['off']();const _0x131f6d=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x53ec6c=_0x364da6['permissions'];_0x131f6d&&_0x131f6d['isEnabled']&&(_0x53ec6c=_0x53ec6c['filter'](_0x1da141=>'document:write'!==_0x1da141)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x53ec6c,this['_channelId']);}}),_0x3672c4['register'](this['_channelId'],_0x24f632);}['_initThrowingOnDataSet'](){const _0x464eed=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x18f99c)=>{if(!_0x18f99c[_0x18f99c['length']-0x1]['suppressErrorInCollaboration'])throw new _0x243503('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x464eed['apply'](this['editor']['data'],_0x18f99c);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0xe0777a,[_0x363b90])=>{if(this['_document']['version'])throw new _0x243503('realtimecollaborationclient-init-document-already-initialized',this);_0xe0777a['stop'](),this['_setPendingAction']();const _0x3af6cb=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x42c31f])=>!_0x42c31f['lazyLoad'])['map'](([_0x2c1d97,_0x557ed6])=>[_0x2c1d97,_0x557ed6['modelAttributes']||{}])),_0xe165ad=this['_getOperationsFromInitData'](_0x363b90,_0x3af6cb);0x0==_0xe165ad['length']&&_0xe165ad['push'](new _0x5197d8(0x0)),_0xe0777a['return']=this['_connectService'](_0xe165ad)['then'](()=>{this['editor']['plugins']['get'](WebSocketGateway)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x148419=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x148419))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0xf4b7dc,[_0x180b8e,_0x1bb445])=>{_0xf4b7dc['stop']();const _0x5cfe97=this['editor']['model']['document']['getRoot'](_0x180b8e);if(!this['_knownRootNames']['has'](_0x180b8e)){const _0x18e896=_0x1bb445&&_0x1bb445['data']?_0x1bb445['data']:'',_0x3f97d6=_0x1bb445&&_0x1bb445['attributes']?_0x1bb445['attributes']:{};await this['_loadRoot'](_0x180b8e,_0x18e896,_0x3f97d6);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x5cfe97['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x5cfe97);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x5839f3){const _0x466311=this['editor']['plugins']['get'](_0x3536cf),{connection:_0x5868ab}=this['editor']['plugins']['get'](WebSocketGateway),_0x674d7b=new Set();for(const _0x5940b7 of _0x5839f3){const _0x52d192=_0x5940b7['_authorId'];_0x52d192&&!_0x466311['getUser'](_0x52d192)&&_0x674d7b['add'](_0x52d192);}if(0x0===_0x674d7b['size'])return;const _0x4ec212=await _0x34df4b['getMany'](_0x5868ab,Array['from'](_0x674d7b));for(const _0x3a8dd8 of _0x4ec212)_0x466311['getUser'](_0x3a8dd8['id'])||_0x466311['addUser'](_0x3a8dd8);}['_getOperationsFromInitData'](_0x2933c1,_0x387129={}){const _0x210d87=this['editor']['model'],_0x408f79=[];let _0x416168=0x0;const _0x529a67='string'==typeof _0x2933c1?{'main':_0x2933c1}:_0x2933c1;for(const _0x3ea26a of Object['keys'](_0x529a67)){if(!this['_document']['roots']['has'](_0x3ea26a))throw new _0x243503('realtimecollaborationclient-init-non-existent-root',this);const _0x2ae180=this['_document']['getRoot'](_0x3ea26a),_0x52780f=this['editor']['data']['parse'](_0x529a67[_0x3ea26a],_0x2ae180),_0x265267=new _0x203f45(_0x210d87['createPositionAt'](_0x2ae180,0x0),_0x52780f,_0x416168++);_0x408f79['push'](_0x265267);for(const [_0x33690c,_0x1aa544]of _0x52780f['markers']){const _0x3e554d=_0x210d87['createRange'](_0x210d87['createPositionFromPath'](_0x2ae180,_0x1aa544['start']['path']['slice']()),_0x210d87['createPositionFromPath'](_0x2ae180,_0x1aa544['end']['path']['slice']())),_0x1d1d2c=new _0x12333c(_0x33690c,null,_0x3e554d,_0x210d87['markers'],!0x0,_0x416168++);_0x408f79['push'](_0x1d1d2c);}}if(_0x387129)for(const [_0x4c5a51,_0x56a564]of Object['entries'](_0x387129)){const _0x294594=_0x210d87['document']['getRoot'](_0x4c5a51);if(!_0x294594)throw new _0x243503('multi-root-editor-root-attributes-no-root',null);for(const [_0x1ce66d,_0xd73879]of Object['entries'](_0x56a564))if(null!==_0xd73879){const _0x3cfaac=new _0x3d0c24(_0x294594,_0x1ce66d,null,_0xd73879,_0x416168++);_0x408f79['push'](_0x3cfaac);}}return _0x408f79;}async['_loadRoot'](_0x3495c2,_0x462c58,_0x320858){this['_getOperationsFromInitData']({[_0x3495c2]:_0x462c58},{[_0x3495c2]:_0x320858})['forEach']((_0x27dda0,_0x184384)=>{_0x27dda0['baseVersion']=this['_document']['version']+_0x184384,_0x27dda0['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x27dda0);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x2da156,_0x8651ef){let _0x2e361c;this['_offset']=_0x2da156['offset'];const _0x2ccf0b=_0x2da156['wereChangesApplied']&&!_0x2da156['initData'],_0x5c5f33=_0x2ccf0b?0x0:_0x2da156['data']['baseVersion'];if(_0x8651ef['forEach'](_0x5c79be=>{_0x5c79be['_isInit']=!0x0,_0x5c79be['createdAt']=_0x2da156['sessionCreatedAt'],_0x5c79be['_authorId']=null;}),_0x2ccf0b)_0x2e361c=_0x8651ef,this['_applyOperationsSet'](_0x2e361c,_0x2ccf0b);else{if(_0x2da156['initData']){const _0x283e64=this['_getOperationsFromInitData'](_0x2da156['initData']);this['_document']['history']['version']=-_0x283e64['length'],_0x283e64['forEach'](_0x3586b1=>{_0x3586b1['baseVersion']-=_0x283e64['length'],_0x3586b1['createdAt']=_0x2da156['sessionCreatedAt'],_0x3586b1['_isInit']=!0x0,_0x3586b1['_authorId']=null;}),this['_applyOperationsSet'](_0x283e64,!0x0),this['serverHistory']['version']=-_0x283e64['length']+this['_offset'],this['_updateServerHistory'](_0x283e64);}this['_document']['history']['version']=_0x5c5f33,_0x2e361c=this['_decompressOperations'](_0x2da156['data'],_0x2da156['metadata']),await this['_fetchMissingUsers'](_0x2e361c),this['_applyOperationsSet'](_0x2e361c,_0x2ccf0b);}_0x2da156['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2e361c,_0x2da156['lastOperationId']),this['_lastSyncedOperationId']=_0x2da156['lastOperationId']),this['serverHistory']['version']=_0x5c5f33+this['_offset'],this['_updateServerHistory'](_0x2e361c),_0x8651ef['filter'](_0x5cd1a6=>{const _0x453e60=this['_getAffectedRoot'](_0x5cd1a6);return _0x453e60&&!this['_knownRootNames']['has'](_0x453e60);})['forEach']((_0x4eb299,_0x3f1c5e)=>{_0x4eb299['baseVersion']=this['_document']['version']+_0x3f1c5e,this['_saveOperationInBuffer'](_0x4eb299);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x13b683,_0x1975dc){const _0x115f67=_0x1975dc&&_0x1975dc['message'];if(_0x115f67&&_0x115f67['startsWith']('realtimecollaborationclient'))throw _0x1975dc;const _0x22db40=this['editor']['plugins']['get'](WebSocketGateway);throw this['_isPendingUpdate']=!0x0,_0x22db40['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x243503(_0x13b683,this['editor'],_0x115f67?{'originalError':_0x115f67}:void 0x0);}['_saveOperationInBuffer'](_0x4853d4){this['_knownOperations']['has'](_0x4853d4)||(this['_knownOperations']['add'](_0x4853d4),this['_bufferedOperations']['push'](_0x4853d4),this['_pendingAction']||'marker'==_0x4853d4['type']&&!_0x4853d4['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x22a42e=!0x1){!_0x22a42e&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x3f60fb=>{_0x3f60fb&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x19631c=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x333a97){return _0x333a97['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x333a97['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x333a97['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x19631c)||this['_crash'](_0x19631c['message'],_0x19631c);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0xfdf696=>{this['on']('change:_isPendingUpdate',()=>{_0xfdf696();});});}async['_sendBufferedOperations'](){const _0x4003a0=this['editor']['plugins']['get'](UserMarkers);if(this['_shouldSendSelectionUpdate']()&&(_0x4003a0['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x2e1f41=[...this['_bufferedOperations']];for(const _0x2f015d of _0x2e1f41)_0x2f015d['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x2f015d);const _0x338f2f=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2e1f41),_0x2a52f7=J++,_0x35c205=this['_compressOperations'](_0x2e1f41),_0x104abc=await this['_service']['sendOperations'](_0x35c205,_0x35c205['baseVersion'],_0x338f2f);try{return await this['_handleServerResponse'](_0x2e1f41,_0x104abc,_0x2a52f7);}catch(_0x43b75a){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x43b75a);}}async['_handleServerResponse'](_0x59bd4a,_0x3a4d32,_0xfc5dee){if('error'in _0x3a4d32)throw _0x3a4d32['error'];let _0x25c730=!0x1;if(_0x3a4d32['wereChangesApplied']){_0x3a4d32['lastOperationId']&&(this['_lastSyncedOperationId']=_0x3a4d32['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x2797bd=>!_0x59bd4a['includes'](_0x2797bd));for(const _0x3c5b9b of _0x59bd4a)_0x3c5b9b['createdAt']='lastOperationAcceptedAt'in _0x3a4d32&&_0x3a4d32['lastOperationAcceptedAt']||void 0x0;Q(_0x59bd4a,_0x3a4d32['version']-_0x59bd4a['length']),this['_updateServerHistory'](_0x59bd4a);const _0x44aa51=_0x59bd4a['filter'](_0x13d23b=>{if(!_0x13d23b['_isInit'])return!0x1;const _0x498f39=this['_getAffectedRoot'](_0x13d23b);return _0x498f39&&!this['_knownRootNames']['has'](_0x498f39);});Q(_0x44aa51,this['_document']['version']),this['_applyOperationsSet'](_0x44aa51),_0x25c730=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x353ea9=this['_decompressOperations'](_0x3a4d32['data'],_0x3a4d32['metadata'])['filter'](_0x2b1289=>_0x2b1289['baseVersion']>=this['_lastServerVersion']);_0x353ea9['forEach'](_0x1ac4dc=>this['_addKnownRoot'](_0x1ac4dc)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x423fdd=>!_0x423fdd['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x423fdd))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x353ea9),_0x25c730=this['_handleExternalOperations'](_0x353ea9,_0x3a4d32['version'],_0x3a4d32['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x25c730?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x1c9cf0,_0x2da236,_0x4b15ab){try{const _0x242d50={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0xe4e8b2,operationsB:_0x3995a9,originalOperations:_0x460906}=_0x233e00(_0x1c9cf0,this['_bufferedOperations'],_0x242d50);Q(_0xe4e8b2,this['_document']['version']),Q(_0x3995a9,_0x2da236);for(const _0x15378e of _0xe4e8b2){const _0x49844c=_0x460906['get'](_0x15378e);_0x15378e['_authorId']=_0x49844c?_0x49844c['_authorId']:null;}_0x4b15ab&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1c9cf0,_0x4b15ab),this['_lastSyncedOperationId']=_0x4b15ab),this['_bufferedOperations']=[..._0x3995a9],this['_applyOperationsSet'](_0xe4e8b2),this['_updateServerHistory'](_0x1c9cf0);}catch(_0x5acf46){return console['error'](_0x5acf46),!0x1;}return!0x0;}['_applyOperationsSet'](_0xc88faa,_0x27ada4=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1d48c2=>{for(const _0x218952 of _0xc88faa)this['_knownOperations']['add'](_0x218952),this['_addKnownRoot'](_0x218952),_0x1d48c2['batch']['addOperation'](_0x218952),this['editor']['model']['applyOperation'](_0x218952);});}['_addKnownRoot'](_0x66c2ad){const _0x42bdf4=this['_getAffectedRoot'](_0x66c2ad);_0x42bdf4&&this['_knownRootNames']['add'](_0x42bdf4);}['_getAffectedRoot'](_0x3a89a5){let _0x56d1fe,_0x18350c;switch(_0x3a89a5['type']){case'insert':_0x56d1fe=_0x3a89a5['position']['root'];break;case'marker':if(_0x18350c=_0x3a89a5['newRange'],!_0x18350c)return null;_0x56d1fe=_0x18350c['root'];break;case'addRootAttribute':_0x56d1fe=_0x3a89a5['root'];break;case'addRoot':_0x56d1fe=_0x3a89a5['affectedSelectable'];break;case'move':_0x56d1fe=_0x3a89a5['targetPosition']['root'];break;default:return null;}return _0x56d1fe['rootName'];}['_updateServerHistory'](_0x34fa6e){_0x34fa6e['forEach'](_0x56ffd5=>{const _0x1ce28c=_0x56ffd5['clone']();_0x1ce28c['_authorId']=_0x56ffd5['_authorId'],_0x1ce28c['_isInit']=!!_0x56ffd5['_isInit'],_0x1ce28c['createdAt']=_0x56ffd5['createdAt'],_0x1ce28c['baseVersion']+=this['_offset'],_0x56ffd5['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x1ce28c),this['serverHistory']['addOperation'](_0x1ce28c);});}['_handleReconnectionError'](_0x3e50e9){const _0x9cdfc0=this['editor']['plugins']['get']('Notification'),_0x22d08c=this['editor']['locale'];_0x3e50e9||(_0x3e50e9=K(_0x22d08c,'The\x20local\x20document\x20and\x20server\x20document\x20differ\x20and\x20merging\x20them\x20can\x20cause\x20unexpected\x20behavior.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.')),_0x9cdfc0['showWarning'](_0x3e50e9,{'title':K(_0x22d08c,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](WebSocketGateway)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x21d2f4)['add'](K(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x21d2f4)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x54107f){const _0x15513e=_0x54107f['map'](_0x567002=>_0x567002['toJSON']());return this['_compressor']['compress'](_0x15513e);}['_decompressOperations'](_0x4ae7d3,_0x37ebe6){return this['_compressor']['decompress'](_0x4ae7d3)['map']((_0x4411a8,_0x7bbd90)=>{const _0x5ada0c='init'==_0x37ebe6[_0x7bbd90]['type'];if('InsertOperation'==_0x4411a8['__className']){const _0x5142bb=_0x4411a8['position']['root'];!this['_document']['getRoot'](_0x5142bb)&&(this['_document']['createRoot']('$unknown',_0x5142bb)['_isAttached']=!0x1);}else{if('RootOperation'==_0x4411a8['__className']){const _0x4e01e3=this['_document']['getRoot'](_0x4411a8['rootName']);_0x4e01e3&&'$unknown'==_0x4e01e3['name']&&_0x4411a8['elementName']!=_0x4e01e3['name']&&(_0x4e01e3['name']=_0x4411a8['elementName']);}}const _0x444210=_0x1b7c05['fromJSON'](_0x4411a8,this['_document']);return _0x444210['wasUndone']=_0x4411a8['wasUndone'],_0x444210['_isInit']=_0x5ada0c,_0x444210['_authorId']=_0x5ada0c?null:_0x37ebe6[_0x7bbd90]['userId'],_0x444210['_isDisconnection']='cs:removeUser'===_0x37ebe6[_0x7bbd90]['type'],_0x444210['createdAt']=_0x37ebe6[_0x7bbd90]['createdAt'],_0x444210;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x28bbf4=this['editor']['plugins']['get'](Sessions)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x28bbf4&&_0x28bbf4['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class ReconnectionError extends Error{}function Q(_0x4f0cd9,_0x545467){for(const _0x1cb32c of _0x4f0cd9)_0x1cb32c['baseVersion']=_0x545467++;}class OperationIdentifier{['_ignoredOperations'];['_operationToId'];constructor(_0x397bd6){this['_ignoredOperations']=_0x397bd6,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x358c82){let _0x1b8b0e=_0x358c82['length'];for(;_0x1b8b0e--;){const _0x217780=_0x358c82[_0x1b8b0e];if(!this['_ignoredOperations']['has'](_0x217780)){if(!this['_operationToId']['has'](_0x217780)){const _0x592702=_0x438389()['slice'](0x1,0x12);this['_operationToId']['set'](_0x217780,_0x592702);}return this['_operationToId']['get'](_0x217780);}}}['setIdForTheLastOperation'](_0x2ca159,_0x1bb6dd){if(!_0x1bb6dd)return;let _0x58ce93=_0x2ca159['length'];for(;_0x58ce93--;){const _0x61c658=_0x2ca159[_0x58ce93];this['_ignoredOperations']['has'](_0x61c658)||this['_operationToId']['set'](_0x61c658,_0x1bb6dd);}}}class RealTimeCollaborativeEditing extends _0x39f59e{static get['requires'](){return[RealTimeCollaborationClient];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class CloudServicesCommentsAdapter extends _0x394a1b{static ['CommentsService']=/* #__PURE__ -- @preserve */ ((()=>_0x1b1ea1)());['_services'];static get['requires'](){return[WebSocketGateway,_0x3fd35f,Sessions,_0x3536cf];