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 89.6 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. | * | | * | | * +---------------------------------------------------------------------------------+ * * * * */ import{ContextPlugin as _0x373179,Plugin as _0x1b88e7,PendingActions as _0x45dc74,Context as _0x56d2e6}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x49ba8a,CKEditorError as _0x5f3c76,Collection as _0x2b6088,global as _0x5d7312,version as nt,uid as _0x3f44af,KeystrokeHandler as _0x4eccc8}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x1155f0,View as _0x3a03f8,ListView as _0x5b209c,ListItemView as et,LabelView as ot,BalloonPanelView as _0x1fd67d,clickOutsideHandler as _0x3b5a70,BodyCollection as _0x2db1f5}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x49cbb2,History as _0x1ef85f,NoOperation as _0x113dde,InsertOperation as _0x42735d,MarkerOperation as _0x1e107f,RootAttributeOperation as _0x43f2c0,transformOperationSets as _0x424768,OperationFactory as _0x55eb3b}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as rt,WEB_SOCKET_GATEWAY_STATES as _0x29578b,CollaborativeEditingService as _0x1d3e11,User as at,CommentsService as _0x464c89,TrackChangesService as _0x649362,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x5ad930,UserView as st}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x20d78f}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x267cb3}from'es-toolkit/compat';class n extends _0x373179{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */ ((()=>rt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x1155f0];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x484574){super(_0x484574),this['set']('state',_0x29578b['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x49ba8a())();}['init'](){const _0x3389a8=this['context'],_0x2b2e23=_0x3389a8['plugins']['get']('CloudServices'),_0x4cc383=_0x3389a8['plugins']['get'](_0x1155f0);if(!_0x2b2e23['token'])throw new _0x5f3c76('websocketgateway-missing-token',this);if(!_0x2b2e23['webSocketUrl'])throw new _0x5f3c76('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),n['WebSocketGateway']['connect'](_0x2b2e23['token'],_0x2b2e23['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x6d1de2=>{if(this['connection']=_0x6d1de2,this['bind']('state')['to'](_0x6d1de2,'state',this,'_isBrowserOffline',(_0x275f8d,_0x5190c6)=>('connected'!==_0x275f8d&&(this['_shouldPluginsReconnect']=!0x0),_0x5190c6||_0x275f8d!==_0x29578b['CONNECTED']?_0x29578b['DISCONNECTED']:this['state']==_0x29578b['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x29578b['CONNECTING']):_0x29578b['CONNECTED'])),this['connection']['on']('error',(_0x4eb3a9,_0x3cd00c)=>{if('limitExceeded'!==_0x3cd00c['code'])throw console['error'](_0x3cd00c),new _0x5f3c76('cloudservices-init',null,{'originalError':_0x3cd00c});_0x4cc383['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'});}),!_0x6d1de2['me'])return new Promise(_0x3e88b7=>_0x6d1de2['on']('change:me',_0x3e88b7));})['catch'](_0x5a0d42=>{throw console['error'](_0x5a0d42),new _0x5f3c76('cloudservices-init',null,{'originalError':_0x5a0d42});});}['addToReconnectionStack'](_0xf0802f){if('function'!=typeof _0xf0802f['reconnect'])throw new _0x5f3c76('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0xf0802f))throw new _0x5f3c76('websocketgateway-plugin-already-registered',this,{'name':_0xf0802f['constructor']['pluginName']});this['_reconnectionStack']['add'](_0xf0802f);}['removeFromReconnectionStack'](_0x2745ed){this['_reconnectionStack']['delete'](_0x2745ed);}['isInReconnectionStack'](_0x174c24){return this['_reconnectionStack']['has'](_0x174c24);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x2c1da7=>_0x2c1da7['reconnect']())))['then'](()=>this['state']=_0x29578b['CONNECTED'])['catch'](_0x8b3b17=>{throw console['error'](_0x8b3b17),new _0x5f3c76('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x29578b['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x373179{['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[n,_0x5ad930];}constructor(_0x10365b){super(_0x10365b),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x2b6088(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x5ad930);}['init'](){const _0x29453b=this['context']['plugins']['get'](n);this['listenTo'](_0x29453b,'change:state',(_0x4ee13d,_0x5b3463,_0x5a76ac)=>{if('connected'!==_0x5a76ac)this['channelSessions']['forEach'](_0x60cf45=>_0x60cf45['clear']()),this['channelConnectedUsers']['forEach'](_0x295c2b=>_0x295c2b['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x41fb18,_0x811873]of this['_registeredSessions'])for(const _0x8dbb2c of _0x811873)this['_handleSessionAdd'](_0x41fb18,_0x8dbb2c);}}),this['_createUser'](_0x29453b['connection']['me'],!0x0);}['register'](_0x540385,_0x39bf06){if(this['_registeredSessions']['has'](_0x540385))throw new _0x5f3c76('sessions-register-already-registered',null,{'channelId':_0x540385});this['_registeredSessions']['set'](_0x540385,_0x39bf06),this['channelSessions']['set'](_0x540385,new _0x2b6088()),this['channelConnectedUsers']['set'](_0x540385,new _0x2b6088()),this['listenTo'](_0x39bf06,'add',(_0x10c14a,_0x3a429f)=>this['_handleSessionAdd'](_0x540385,_0x3a429f)),this['listenTo'](_0x39bf06,'remove',(_0x5cf051,_0x6c3738)=>this['_handleSessionRemove'](_0x540385,_0x6c3738));for(const _0x2e9094 of _0x39bf06)this['_handleSessionAdd'](_0x540385,_0x2e9094);}['unregister'](_0xfff59b){if(!this['_registeredSessions']['has'](_0xfff59b))throw new _0x5f3c76('sessions-unregister-not-exist',null,{'channelId':_0xfff59b});const _0x3f5f6e=this['_registeredSessions']['get'](_0xfff59b);this['stopListening'](_0x3f5f6e);for(const _0x1f8c98 of _0x3f5f6e)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0xfff59b,_0x1f8c98);this['_registeredSessions']['delete'](_0xfff59b),this['channelSessions']['delete'](_0xfff59b),this['channelConnectedUsers']['delete'](_0xfff59b);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x5f3e18){for(const _0x354398 of this['channelSessions']['values']())for(const _0x9243bc of _0x354398)if(_0x9243bc['id']===_0x5f3e18)return _0x9243bc['user'];}['getUserSessions'](_0xc0f39d,_0x376b6a){const _0x47a323=_0x376b6a?[this['channelSessions']['get'](_0x376b6a)]:this['channelSessions']['values'](),_0x2b0f87=new Set();for(const _0x17e2cc of _0x47a323)for(const _0x2bee1d of _0x17e2cc)_0x2bee1d['user']['id']===_0xc0f39d['id']&&_0x2b0f87['add'](_0x2bee1d['id']);return _0x2b0f87;}['getUserRole'](_0x1af990){for(const _0x1e1527 of this['channelSessions']['values']())for(const _0x4a46c3 of _0x1e1527)if(_0x4a46c3['user']===_0x1af990)return _0x4a46c3['role'];}['_handleSessionAdd'](_0x533c5a,_0x88f9f7){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x4dce99=_0x88f9f7['user'],_0x2e1474=this['_users']['getUser'](_0x4dce99['id'])||this['_createUser'](_0x4dce99),_0x3c07ad=Object['assign']({},_0x88f9f7,{'user':_0x2e1474});if(this['channelSessions']['get'](_0x533c5a)['add'](_0x3c07ad),!_0x4dce99['hiddenInPresenceList']){const _0x17efd9=this['channelConnectedUsers']['get'](_0x533c5a);_0x17efd9['has'](_0x2e1474['id'])||_0x17efd9['add'](_0x2e1474),this['allConnectedUsers']['has'](_0x2e1474['id'])||_0x4dce99['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x2e1474,_0x2e1474['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x533c5a,{'channelId':_0x533c5a,'session':_0x3c07ad});}['_handleSessionRemove'](_0x124262,_0x4a7640){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0xf42e0c=this['channelConnectedUsers']['get'](_0x124262),_0x52db2a=_0x4a7640['user'];_0x52db2a['id']&&(this['channelSessions']['get'](_0x124262)['remove'](_0x4a7640['id']),_0xf42e0c['has'](_0x52db2a['id'])&&!this['getUserSessions'](_0x52db2a,_0x124262)['size']&&_0xf42e0c['remove'](_0x52db2a['id']),this['allConnectedUsers']['get'](_0x52db2a['id'])&&!this['getUserSessions'](_0x52db2a)['size']&&this['allConnectedUsers']['remove'](_0x52db2a['id']));}['_createUser'](_0x7945e3,_0x431d9c){const _0x168031=this['_users']['addUser'](_0x7945e3);return _0x431d9c&&this['_users']['defineMe'](_0x7945e3['id']),_0x168031['orderNumber']=this['_uniqueUsersCount']++,_0x168031;}}class W extends _0x1b88e7{['_domEmitter']=new(_0x49ba8a())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x30a67c=this['editor'],_0x53ea3a=_0x30a67c['plugins']['get'](i);_0x30a67c['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x426c48,{writer:_0x53a17c})=>function(_0xf22c2f,_0x378746,_0x41d697,_0x2cc11a){const _0x1962fd=_0xf22c2f['markerName']['split'](':')[0x2],_0x157bc3=_0x41d697['getUserBySessionId'](_0x1962fd);if(!_0x157bc3||_0x1962fd===_0x41d697['mySessionId'])return;if(!_0x2cc11a['model']['schema']['checkChild'](_0xf22c2f['markerRange']['start'],'$text'))return;const _0x1dc0f5={'class':'ck-user__marker\x20'+_0x157bc3['color']['getMarkerClass'](),'data-name':_0x157bc3['name'],'data-session-id':_0x1962fd},_0xe110af=_0x2cc11a['model']['markers']['get'](_0xf22c2f['markerName']),_0x41c0ff=_0xe110af['getStart'](),_0x5519fb=_0x41c0ff['nodeAfter'],_0x3ec4f7=_0x2cc11a['model']['schema'];if(_0x5519fb&&_0x3ec4f7['isObject'](_0x5519fb)&&_0x3ec4f7['isInline'](_0x5519fb)&&!_0x2cc11a['model']['markers']['get']('user:range:'+_0x1962fd)['getRange']()['isCollapsed'])return;const _0x4cdf8f=_0x41c0ff['parent'];return _0x2cc11a['model']['schema']['isLimit'](_0x4cdf8f)&&!_0x2cc11a['model']['hasContent'](_0x4cdf8f)&&(_0x1dc0f5['contenteditable']=!0x1),function(_0x21ab82,_0x4111f2,_0x3f9db0){const _0x1e02da=_0x21ab82['createUIElement']('span',_0x4111f2);return _0x21ab82['setCustomProperty']('userPositionMarker',!0x0,_0x1e02da),_0x1e02da['render']=function(_0x13072f){const _0x23501c=this['toDomElement'](_0x13072f),_0x3684eb=document['createElement']('span');return _0x3684eb['classList']['add']('ck-user__marker-tooltip'),_0x3684eb['setAttribute']('contenteditable','false'),_0x3684eb['setAttribute']('spellcheck','false'),_0x3684eb['textContent']=_0x3f9db0['name'],_0x23501c['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x3684eb['outerHTML']+'⁠',_0x23501c['addEventListener']('mouseenter',()=>{_0x23501c['classList']['add']('ck-user__marker_hovered');}),_0x23501c['addEventListener']('mouseleave',()=>{_0x23501c['classList']['remove']('ck-user__marker_hovered');}),_0x23501c;},_0x1e02da['isSimilar']=function(_0x97c000){return!(!this['getCustomProperty']('userPositionMarker')||!_0x97c000['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x97c000['getAttribute']('data-session-id'));},_0x1e02da;}(_0x378746,_0x1dc0f5,_0x157bc3);}(_0x426c48,_0x53a17c,_0x53ea3a,_0x30a67c)}),_0x30a67c['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x27cae7=>function(_0x58d35c,_0x55eed9){const _0x5460da=_0x58d35c['markerName']['split'](':')[0x2];if(_0x5460da===_0x55eed9['mySessionId'])return null;const _0x373282=_0x55eed9['getUserBySessionId'](_0x5460da);if(!_0x373282)return{'id':_0x5460da,'classes':[]};return{'id':_0x5460da,'classes':['ck-user__selection',_0x373282['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x5460da},'priority':0x7d0+_0x373282['orderNumber']};}(_0x27cae7,_0x53ea3a)}),function(_0x2c7afa){const _0x34e4ac=_0x2c7afa['model'],_0x3ddfe0=new Map(),_0x4d961c=_0x2c7afa['plugins']['get'](i);_0x34e4ac['markers']['on']('update:user:range',(_0x57d3f1,_0x177286,_0x25f527,_0x58ba2a)=>{if(!_0x58ba2a&&_0x3ddfe0['get'](_0x177286['name']))return _0x3ddfe0['get'](_0x177286['name'])['detach'](),void _0x3ddfe0['delete'](_0x177286['name']);const _0x434bb8=_0x177286['name']['split'](':')[0x2];if(_0x434bb8===_0x4d961c['mySessionId'])return;const _0x58dde6='user:position:'+_0x434bb8;_0x34e4ac['markers']['has'](_0x58dde6)&&_0x2c7afa['editing']['reconvertMarker'](_0x58dde6),_0x177286['on']('change:range',(_0x58acd5,_0x4a0005,_0x5f4565)=>{if('$graveyard'!=_0x4a0005['root']['rootName']&&'$graveyard'==_0x177286['getRange']()['root']['rootName']&&!_0x3ddfe0['has'](_0x177286['name'])){const _0x5b1406=_0x34e4ac['schema']['getNearestSelectionRange'](_0x5f4565['deletionPosition']);if(_0x5b1406){const _0x41cc9d=_0x49cbb2['fromRange'](_0x5b1406);_0x3ddfe0['set'](_0x177286['name'],_0x41cc9d),_0x41cc9d['on']('change:range',(_0x4efb1d,_0x58fc7b,_0x43dbd1)=>{if('$graveyard'==_0x41cc9d['root']['rootName']){const _0x49b066=_0x34e4ac['schema']['getNearestSelectionRange'](_0x43dbd1['deletionPosition']);_0x49b066?(_0x41cc9d['start']=_0x49b066['start'],_0x41cc9d['end']=_0x49b066['end']):(_0x3ddfe0['delete'](_0x177286['name']),_0x41cc9d['detach']());}});}}});}),_0x34e4ac['document']['on']('change',()=>{_0x3ddfe0['size']>0x0&&_0x34e4ac['enqueueChange']({'isUndoable':!0x1},_0x145d54=>{for(const [_0x305b60,_0xa6badf]of _0x3ddfe0)'$graveyard'==_0x34e4ac['markers']['get'](_0x305b60)['getRange']()['root']['rootName']&&(re(_0x305b60['split'](':')[0x2],_0xa6badf['toRange'](),_0x34e4ac,_0x145d54),_0xa6badf['detach']());_0x3ddfe0['clear']();});});}(_0x30a67c),this['_domEmitter']['listenTo'](_0x5d7312['document'],'keydown',(_0x1ec766,{key:_0x2d2c7e})=>{'Escape'===_0x2d2c7e&&function(_0x5e46c1){_0x5e46c1['editing']['view']['change'](_0x235567=>{for(const _0x2d4745 of _0x5e46c1['model']['markers']){if(!_0x2d4745['name']['startsWith']('user:position'))continue;const _0x18e2ac=_0x5e46c1['editing']['mapper']['markerNameToElements'](_0x2d4745['name']);if(_0x18e2ac){for(const _0x30da82 of _0x18e2ac)_0x235567['removeClass']('ck-user__marker_hovered',_0x30da82);}}});}(_0x30a67c);},{'useCapture':!0x0});}['afterInit'](){const _0x22ac19=this['editor'],_0x415145=_0x22ac19['commands']['get']('undo');_0x415145&&_0x22ac19['model']['on']('applyOperation',(_0x1eb0c7,_0x53da81)=>{const _0x683354=_0x53da81[0x0];if(!_0x683354['isDocumentOperation'])return;if('marker'!=_0x683354['type']||!_0x683354['name']['startsWith']('user:'))return;const _0x51d40e=_0x683354['batch'];_0x415145['_createdBatches']['has'](_0x51d40e)&&(_0x683354['newRange']=_0x683354['oldRange']?_0x22ac19['model']['createRange'](_0x683354['oldRange']['start'],_0x683354['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x1d1d3e=this['editor'],_0x42b93b=_0x1d1d3e['model']['document'],_0xbcc08b=_0x1d1d3e['plugins']['get'](i);_0x1d1d3e['model']['enqueueChange']({'isUndoable':!0x1},_0x1979b9=>{const _0x50f9b2='user:range:'+_0xbcc08b['mySessionId'],_0x28d6ec='user:position:'+_0xbcc08b['mySessionId'],_0x2bd9ab=_0x1d1d3e['model']['markers']['has'](_0x50f9b2);_0x1d1d3e['editing']['view']['hasDomSelection']?re(_0xbcc08b['mySessionId'],_0x42b93b['selection']['getFirstRange'](),_0x1d1d3e['model'],_0x1979b9):_0x2bd9ab&&(_0x1979b9['removeMarker'](_0x50f9b2),_0x1979b9['removeMarker'](_0x28d6ec));});}}function re(_0x48366e,_0x2f1be1,_0x40c50c,_0x6cb287){const _0x1367c0='user:range:'+_0x48366e,_0x5b1471='user:position:'+_0x48366e,_0x2ec41e=_0x2f1be1['getContainedElement']();let _0x349d3c=_0x2f1be1['start'];if(_0x2ec41e&&_0x2ec41e['is']('element','tableCell')){const _0x3ba424=function(_0x18bf45,_0x55e3c8){for(const _0x43ab03 of _0x18bf45['getPositions']())if(_0x55e3c8['schema']['checkChild'](_0x43ab03,'$text'))return _0x43ab03;}(_0x2f1be1,_0x40c50c);_0x3ba424&&(_0x349d3c=_0x3ba424,_0x2f1be1=_0x6cb287['createRange'](_0x349d3c));}const _0x5cea13=_0x6cb287['createRange'](_0x349d3c);_0x40c50c['markers']['has'](_0x1367c0)?(_0x6cb287['updateMarker'](_0x1367c0,{'range':_0x2f1be1}),_0x6cb287['updateMarker'](_0x5b1471,{'range':_0x5cea13})):(_0x6cb287['addMarker'](_0x1367c0,{'range':_0x2f1be1,'usingOperation':!0x0}),_0x6cb287['addMarker'](_0x5b1471,{'range':_0x5cea13,'usingOperation':!0x0}));}function q(_0x225cb4,_0x579500,_0x22308a){const _0xe16502=_0x225cb4['t'],t=_0x225cb4['t'];switch(_0x579500){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 _0xe16502({'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'},_0x22308a);default:return'';}}let K=0x1;class l extends _0x1b88e7{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */ ((()=>_0x1d3e11)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,W,_0x45dc74,_0x5ad930,_0x1155f0];}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 _0x581db0=this['serverHistory']['getOperations']();for(let _0x5826b5=_0x581db0['length']-0x1;_0x5826b5>=0x0;_0x5826b5--){const _0x38e983=_0x581db0[_0x5826b5];if(!this['_disconnectionOperations']['has'](_0x38e983))return _0x38e983['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x11d74c){if(super(_0x11d74c),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x1ef85f(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x5f3c76('collaboration-missing-channelid',this);const _0x1c4eca=_0x11d74c['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x1c4eca,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x20d78f(),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 X(this['_disconnectionOperations']);}['init'](){const _0x431479=this['editor'],_0x1680e6=_0x431479['plugins']['get'](_0x5ad930),_0x4180e1=_0x431479['plugins']['get'](n);this['listenTo'](_0x1680e6,'getOperationAuthor',(_0x51cc49,_0x2c6a32)=>{const _0x53a993=_0x2c6a32[0x0];_0x53a993['_authorId']&&(_0x51cc49['return']=_0x1680e6['getUser'](_0x53a993['_authorId']),_0x51cc49['stop']()),null===_0x53a993['_authorId']&&(_0x51cc49['return']=null,_0x51cc49['stop']());},{'priority':'high'}),this['listenTo'](_0x431479['model']['document']['selection'],'change:range',(_0x73a31f,_0x5e6634)=>{_0x5e6634['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x431479['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x431479['model']['on']('applyOperation',(_0x1f6210,_0x32d606)=>{const _0x487c7d=_0x32d606[0x0];_0x487c7d['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x487c7d),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x4180e1,'state',this,'_hasSynchronizationProblem',(_0xa78545,_0x9dfd24)=>'connected'===_0xa78545&&!_0x9dfd24),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x431479['disableReadOnlyMode']('rtc-offline'):_0x431479['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x431479['disableReadOnlyMode']('rtc-offline'):_0x431479['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x44fb3e=this['editor']['plugins']['get'](i),_0x5dcfee=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x44fb3e['unregister'](this['_channelId']);const _0x5abbad=await this['_service']['reconnect'](_0x5dcfee['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x5abbad)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x44ab4b=await this['_service']['getConnectedSessions']();_0x44fb3e['register'](this['_channelId'],_0x44ab4b),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x203153){if(function(_0x1ae0e5){return'404'===_0x1ae0e5['code'];}(_0x203153)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x172e87){return'409'===_0x172e87['code'];}(_0x203153)){const _0x505b92=q(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'](_0x505b92);}else{if(!(_0x203153 instanceof J))throw _0x203153;this['_handleReconnectionError']();}}}}['destroy'](){const _0x1ba94f=this['editor']['plugins']['get'](n),_0x128245=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x128245['channelSessions']['has'](this['_channelId'])&&_0x128245['unregister'](this['_channelId']),_0x1ba94f['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x180df8){if(this['sessionId']!==_0x180df8['sessionId']&&this['_lastSyncedOperationId']!==_0x180df8['lastOperationId'])throw new J();return this['sessionId']=_0x180df8['sessionId'],this['_handleServerResponse']([],{..._0x180df8,'wereChangesApplied':!0x1,'data':_0x180df8['data']},'reconnect');}async['_connectService'](_0x57fbfb,_0x37c047=!0x1){const {connection:_0x1515bf}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x1515bf,this['_channelId'])['then'](_0x2ed2c6=>this['_initSessionsHandling'](_0x2ed2c6))['catch'](_0x3e3ebf=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x3e3ebf);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x2ffede,_0x2f10fd)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x2f10fd);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x559495=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x57fbfb);this['_isPendingUpdate']=!0x0;const _0x5aea52=await this['_service']['connect'](_0x1515bf,this['_compressOperations'](_0x57fbfb),_0x559495);if(this['sessionId']=_0x5aea52['sessionId'],_0x37c047){if(!_0x5aea52['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x5aea52['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x57fbfb,_0x5aea52,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x5aea52,_0x57fbfb);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x3d1227=this['editor']['plugins']['get'](i),_0x3421ef=this['editor']['plugins']['get'](W),_0x2cc565=_0x3d1227['channelSessions']['get'](this['_channelId']);_0x2cc565&&_0x2cc565['length']>0x1?_0x3421ef['createUserMarkerOperations']():this['listenTo'](_0x3d1227,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x3d1227['channelSessions']['get'](this['_channelId'])['length']&&_0x3421ef['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x2ff70e,_0x50a4e3,_0x5c1254,_0x468ce3){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x50a4e3){const _0x372917=this['_decompressOperations'](_0x5c1254,_0x468ce3);await this['_fetchMissingUsers'](_0x372917),this['_handleExternalOperations'](_0x372917,_0x50a4e3,_0x5c1254['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x5db825}=this['editor'];let _0x3a38c7;try{_0x3a38c7=await this['_service']['getDocumentDetails']();}catch{const _0x5cc09d=q(_0x5db825,'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'](_0x5cc09d);}const _0x1ec6cf=_0x3a38c7['currentDocumentSession']||_0x3a38c7['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x1ec6cf['lastOperationId']){const _0x2e9d64=q(_0x5db825,'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'](_0x2e9d64);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x3c9a6b){const _0x5256e5=this['editor']['plugins']['get'](i);this['listenTo'](_0x5256e5,'sessionAdd:'+this['_channelId'],(_0x30b2bb,{session:_0x3713ce})=>{if(_0x3713ce['id']===_0x5256e5['mySessionId']){_0x30b2bb['off']();const _0x462b67=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x1a0925=_0x3713ce['permissions'];_0x462b67&&_0x462b67['isEnabled']&&(_0x1a0925=_0x1a0925['filter'](_0x3fc6e1=>'document:write'!==_0x3fc6e1)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x1a0925,this['_channelId']);}}),_0x5256e5['register'](this['_channelId'],_0x3c9a6b);}['_initThrowingOnDataSet'](){const _0x95fb39=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x20dcf5)=>{if(!_0x20dcf5[_0x20dcf5['length']-0x1]['suppressErrorInCollaboration'])throw new _0x5f3c76('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x95fb39['apply'](this['editor']['data'],_0x20dcf5);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x268f35,[_0x4b6fc5])=>{if(this['_document']['version'])throw new _0x5f3c76('realtimecollaborationclient-init-document-already-initialized',this);_0x268f35['stop'](),this['_setPendingAction']();const _0x76c97d=this['editor']['config']['get']('rootsAttributes'),_0x255497=this['_getOperationsFromInitData'](_0x4b6fc5,_0x76c97d);0x0==_0x255497['length']&&_0x255497['push'](new _0x113dde(0x0)),_0x268f35['return']=this['_connectService'](_0x255497)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1e7641=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1e7641))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x5c9470,[_0x58dcc9,_0x5eabc3])=>{_0x5c9470['stop']();const _0x5eb840=this['editor']['model']['document']['getRoot'](_0x58dcc9);if(!this['_knownRootNames']['has'](_0x58dcc9)){const _0x4fa63b=_0x5eabc3&&_0x5eabc3['data']?_0x5eabc3['data']:'',_0x519e59=_0x5eabc3&&_0x5eabc3['attributes']?_0x5eabc3['attributes']:{};await this['_loadRoot'](_0x58dcc9,_0x4fa63b,_0x519e59);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x5eb840['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x5eb840);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x235cd0){const _0x39bed3=this['editor']['plugins']['get'](_0x5ad930),{connection:_0x383158}=this['editor']['plugins']['get'](n),_0x321051=new Set();for(const _0x32d3ec of _0x235cd0){const _0x442fab=_0x32d3ec['_authorId'];_0x442fab&&!_0x39bed3['getUser'](_0x442fab)&&_0x321051['add'](_0x442fab);}if(0x0===_0x321051['size'])return;const _0x3ad198=await at['getMany'](_0x383158,Array['from'](_0x321051));for(const _0xccc2e9 of _0x3ad198)_0x39bed3['getUser'](_0xccc2e9['id'])||_0x39bed3['addUser'](_0xccc2e9);}['_getOperationsFromInitData'](_0x5580a7,_0xec78c4={}){const _0x3328b2=this['editor']['model'],_0xb33a3e=[];let _0x507ff9=0x0;const _0x15f3e2='string'==typeof _0x5580a7?{'main':_0x5580a7}:_0x5580a7;for(const _0x12da38 of Object['keys'](_0x15f3e2)){if(!this['_document']['roots']['has'](_0x12da38))throw new _0x5f3c76('realtimecollaborationclient-init-non-existent-root',this);const _0x444349=this['editor']['data']['parse'](_0x15f3e2[_0x12da38]),_0xb0b3b7=this['_document']['getRoot'](_0x12da38),_0x13e4d9=new _0x42735d(_0x3328b2['createPositionAt'](_0xb0b3b7,0x0),_0x444349,_0x507ff9++);_0xb33a3e['push'](_0x13e4d9);for(const [_0x5da82d,_0x3a2a73]of _0x444349['markers']){const _0x5f0080=_0x3328b2['createRange'](_0x3328b2['createPositionFromPath'](_0xb0b3b7,_0x3a2a73['start']['path']['slice']()),_0x3328b2['createPositionFromPath'](_0xb0b3b7,_0x3a2a73['end']['path']['slice']())),_0x418e24=new _0x1e107f(_0x5da82d,null,_0x5f0080,_0x3328b2['markers'],!0x0,_0x507ff9++);_0xb33a3e['push'](_0x418e24);}}if(_0xec78c4)for(const [_0x9b30c6,_0x413fc4]of Object['entries'](_0xec78c4)){const _0x25e9b6=_0x3328b2['document']['getRoot'](_0x9b30c6);if(!_0x25e9b6)throw new _0x5f3c76('multi-root-editor-root-attributes-no-root',null);for(const [_0x4216af,_0x369695]of Object['entries'](_0x413fc4))if(null!==_0x369695){const _0x720e86=new _0x43f2c0(_0x25e9b6,_0x4216af,null,_0x369695,_0x507ff9++);_0xb33a3e['push'](_0x720e86);}}return _0xb33a3e;}async['_loadRoot'](_0x27f6ca,_0x24fcae,_0xb84da2){this['_getOperationsFromInitData']({[_0x27f6ca]:_0x24fcae},{[_0x27f6ca]:_0xb84da2})['forEach']((_0xf6bac4,_0x228bb4)=>{_0xf6bac4['baseVersion']=this['_document']['version']+_0x228bb4,_0xf6bac4['_isInit']=!0x0,this['_saveOperationInBuffer'](_0xf6bac4);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x332c2b,_0x4e3766){let _0x1ce08b;this['_offset']=_0x332c2b['offset'];const _0x3a6276=_0x332c2b['wereChangesApplied']&&!_0x332c2b['initData'],_0x16a660=_0x3a6276?0x0:_0x332c2b['data']['baseVersion'];if(_0x4e3766['forEach'](_0x429385=>{_0x429385['_isInit']=!0x0,_0x429385['createdAt']=_0x332c2b['sessionCreatedAt'],_0x429385['_authorId']=null;}),_0x3a6276)_0x1ce08b=_0x4e3766,this['_applyOperationsSet'](_0x1ce08b,_0x3a6276);else{if(_0x332c2b['initData']){const _0x4e583d=this['_getOperationsFromInitData'](_0x332c2b['initData']);this['_document']['history']['version']=-_0x4e583d['length'],_0x4e583d['forEach'](_0x1faec7=>{_0x1faec7['baseVersion']-=_0x4e583d['length'],_0x1faec7['createdAt']=_0x332c2b['sessionCreatedAt'],_0x1faec7['_isInit']=!0x0,_0x1faec7['_authorId']=null;}),this['_applyOperationsSet'](_0x4e583d,!0x0),this['serverHistory']['version']=-_0x4e583d['length']+this['_offset'],this['_updateServerHistory'](_0x4e583d);}this['_document']['history']['version']=_0x16a660,_0x1ce08b=this['_decompressOperations'](_0x332c2b['data'],_0x332c2b['metadata']),await this['_fetchMissingUsers'](_0x1ce08b),this['_applyOperationsSet'](_0x1ce08b,_0x3a6276);}_0x332c2b['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1ce08b,_0x332c2b['lastOperationId']),this['_lastSyncedOperationId']=_0x332c2b['lastOperationId']),this['serverHistory']['version']=_0x16a660+this['_offset'],this['_updateServerHistory'](_0x1ce08b),_0x4e3766['filter'](_0x38e591=>{const _0x57c0c2=this['_getAffectedRoot'](_0x38e591);return _0x57c0c2&&!this['_knownRootNames']['has'](_0x57c0c2);})['forEach']((_0x3f1990,_0x575e8c)=>{_0x3f1990['baseVersion']=this['_document']['version']+_0x575e8c,this['_saveOperationInBuffer'](_0x3f1990);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x42517d,_0x1334ef){const _0x33a395=_0x1334ef&&_0x1334ef['message'];if(_0x33a395&&_0x33a395['startsWith']('realtimecollaborationclient'))throw _0x1334ef;const _0x5a208d=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x5a208d['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x5f3c76(_0x42517d,this['editor'],_0x33a395?{'originalError':_0x33a395}:void 0x0);}['_saveOperationInBuffer'](_0x258ea3){this['_knownOperations']['has'](_0x258ea3)||(this['_knownOperations']['add'](_0x258ea3),this['_bufferedOperations']['push'](_0x258ea3),this['_pendingAction']||'marker'==_0x258ea3['type']&&!_0x258ea3['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x33ead7=!0x1){!_0x33ead7&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x2ec31f=>{_0x2ec31f&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x22cc06=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x2f936e){return _0x2f936e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2f936e['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x2f936e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x22cc06)||this['_crash'](_0x22cc06['message'],_0x22cc06);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x254771=>{this['on']('change:_isPendingUpdate',()=>{_0x254771();});});}async['_sendBufferedOperations'](){const _0x4c63a9=this['editor']['plugins']['get'](W);if(this['_shouldSendSelectionUpdate']()&&(_0x4c63a9['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x16ab59=[...this['_bufferedOperations']];for(const _0x882d60 of _0x16ab59)_0x882d60['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x882d60);const _0x3068f1=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x16ab59),_0x2400d7=K++,_0x42df20=this['_compressOperations'](_0x16ab59),_0x40408c=await this['_service']['sendOperations'](_0x42df20,_0x42df20['baseVersion'],_0x3068f1);try{return await this['_handleServerResponse'](_0x16ab59,_0x40408c,_0x2400d7);}catch(_0x436446){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x436446);}}async['_handleServerResponse'](_0x4e0a8f,_0x59c364,_0x2b2ebb){if('error'in _0x59c364)throw _0x59c364['error'];let _0x1f65fe=!0x1;if(_0x59c364['wereChangesApplied']){_0x59c364['lastOperationId']&&(this['_lastSyncedOperationId']=_0x59c364['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x30add7=>!_0x4e0a8f['includes'](_0x30add7));for(const _0x5a5e2e of _0x4e0a8f)_0x5a5e2e['createdAt']='lastOperationAcceptedAt'in _0x59c364&&_0x59c364['lastOperationAcceptedAt']||void 0x0;Q(_0x4e0a8f,_0x59c364['version']-_0x4e0a8f['length']),this['_updateServerHistory'](_0x4e0a8f);const _0x5258b4=_0x4e0a8f['filter'](_0x4ea1ae=>{if(!_0x4ea1ae['_isInit'])return!0x1;const _0x482de1=this['_getAffectedRoot'](_0x4ea1ae);return _0x482de1&&!this['_knownRootNames']['has'](_0x482de1);});Q(_0x5258b4,this['_document']['version']),this['_applyOperationsSet'](_0x5258b4),_0x1f65fe=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x266397=this['_decompressOperations'](_0x59c364['data'],_0x59c364['metadata'])['filter'](_0x39c1a5=>_0x39c1a5['baseVersion']>=this['_lastServerVersion']);_0x266397['forEach'](_0x294f8e=>this['_addKnownRoot'](_0x294f8e)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x303c85=>!_0x303c85['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x303c85))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x266397),_0x1f65fe=this['_handleExternalOperations'](_0x266397,_0x59c364['version'],_0x59c364['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1f65fe?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x3cd4fe,_0x56f722,_0x280b8b){try{const _0x5963ee={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x80f300,operationsB:_0x17db68,originalOperations:_0x274c30}=_0x424768(_0x3cd4fe,this['_bufferedOperations'],_0x5963ee);Q(_0x80f300,this['_document']['version']),Q(_0x17db68,_0x56f722);for(const _0x41d169 of _0x80f300){const _0x5bef88=_0x274c30['get'](_0x41d169);_0x41d169['_authorId']=_0x5bef88?_0x5bef88['_authorId']:null;}_0x280b8b&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3cd4fe,_0x280b8b),this['_lastSyncedOperationId']=_0x280b8b),this['_bufferedOperations']=[..._0x17db68],this['_applyOperationsSet'](_0x80f300),this['_updateServerHistory'](_0x3cd4fe);}catch(_0x4b7289){return console['error'](_0x4b7289),!0x1;}return!0x0;}['_applyOperationsSet'](_0x49a134,_0x1f93d8=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1995c4=>{for(const _0x286381 of _0x49a134)this['_knownOperations']['add'](_0x286381),this['_addKnownRoot'](_0x286381),_0x1995c4['batch']['addOperation'](_0x286381),this['editor']['model']['applyOperation'](_0x286381);});}['_addKnownRoot'](_0x39c4b1){const _0x33cf9=this['_getAffectedRoot'](_0x39c4b1);_0x33cf9&&this['_knownRootNames']['add'](_0x33cf9);}['_getAffectedRoot'](_0x4fcebd){let _0x4b8383,_0x12db6f;switch(_0x4fcebd['type']){case'insert':_0x4b8383=_0x4fcebd['position']['root'];break;case'marker':if(_0x12db6f=_0x4fcebd['newRange'],!_0x12db6f)return null;_0x4b8383=_0x12db6f['root'];break;case'addRootAttribute':_0x4b8383=_0x4fcebd['root'];break;case'addRoot':_0x4b8383=_0x4fcebd['affectedSelectable'];break;case'move':_0x4b8383=_0x4fcebd['targetPosition']['root'];break;default:return null;}return _0x4b8383['rootName'];}['_updateServerHistory'](_0x9681fe){_0x9681fe['forEach'](_0xcd87a9=>{const _0x45f87e=_0xcd87a9['clone']();_0x45f87e['_authorId']=_0xcd87a9['_authorId'],_0x45f87e['_isInit']=!!_0xcd87a9['_isInit'],_0x45f87e['createdAt']=_0xcd87a9['createdAt'],_0x45f87e['baseVersion']+=this['_offset'],_0xcd87a9['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x45f87e),this['serverHistory']['addOperation'](_0x45f87e);});}['_handleReconnectionError'](_0x15dfe5){const _0x278834=this['editor']['plugins']['get']('Notification'),_0x4b273f=this['editor']['locale'];_0x15dfe5||(_0x15dfe5=q(_0x4b273f,'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.')),_0x278834['showWarning'](_0x15dfe5,{'title':q(_0x4b273f,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x45dc74)['add'](q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x45dc74)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x4614ee){const _0x16db99=_0x4614ee['map'](_0x4bce14=>_0x4bce14['toJSON']());return this['_compressor']['compress'](_0x16db99);}['_decompressOperations'](_0x1c6396,_0xa575a4){return this['_compressor']['decompress'](_0x1c6396)['map']((_0x111a80,_0xae2a68)=>{const _0x379eb0='init'==_0xa575a4[_0xae2a68]['type'];if('InsertOperation'==_0x111a80['__className']){const _0x4b8c9a=_0x111a80['position']['root'];!this['_document']['getRoot'](_0x4b8c9a)&&(this['_document']['createRoot']('$root',_0x4b8c9a)['_isAttached']=!0x1);}const _0x2f1d4a=_0x55eb3b['fromJSON'](_0x111a80,this['_document']);return _0x2f1d4a['wasUndone']=_0x111a80['wasUndone'],_0x2f1d4a['_isInit']=_0x379eb0,_0x2f1d4a['_authorId']=_0x379eb0?null:_0xa575a4[_0xae2a68]['userId'],_0x2f1d4a['_isDisconnection']='cs:removeUser'===_0xa575a4[_0xae2a68]['type'],_0x2f1d4a['createdAt']=_0xa575a4[_0xae2a68]['createdAt'],_0x2f1d4a;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x466e2e=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x466e2e&&_0x466e2e['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class J extends Error{}function Q(_0xb005ba,_0x24a413){for(const _0x1e4356 of _0xb005ba)_0x1e4356['baseVersion']=_0x24a413++;}class X{['_ignoredOperations'];['_operationToId'];constructor(_0x543b72){this['_ignoredOperations']=_0x543b72,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x996cec){let _0xc79997=_0x996cec['length'];for(;_0xc79997--;){const _0x1e557f=_0x996cec[_0xc79997];if(!this['_ignoredOperations']['has'](_0x1e557f)){if(!this['_operationToId']['has'](_0x1e557f)){const _0x490afb=_0x3f44af()['slice'](0x1,0x12);this['_operationToId']['set'](_0x1e557f,_0x490afb);}return this['_operationToId']['get'](_0x1e557f);}}}['setIdForTheLastOperation'](_0x271ccd,_0x3bf4e3){if(!_0x3bf4e3)return;let _0x5cd444=_0x271ccd['length'];for(;_0x5cd444--;){const _0x5f223e=_0x271ccd[_0x5cd444];this['_ignoredOperations']['has'](_0x5f223e)||this['_operationToId']['set'](_0x5f223e,_0x3bf4e3);}}}class a extends _0x1b88e7{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x373179{static ['CommentsService']=/* #__PURE__ -- @preserve */ ((()=>_0x464c89)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x5ad930];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x43f6a8){super(_0x43f6a8),this['_services']=new Map();}async['init'](){const _0x36b3cb=this['context'],_0x56ca6d=_0x36b3cb['plugins']['get']('CommentsRepository');if(_0x36b3cb['plugins']['get'](n)['addToReconnectionStack'](this),_0x56ca6d['adapter']={'addCommentThread':async({channelId:_0x1ae53b,threadId:_0x9840e,comments:_0x2a5168,resolvedAt:_0x2f01a0,resolvedBy:_0x2ff69c,context:_0x4c174a,attributes:_0x2982d9})=>{const _0x29d06d=await this['_getService'](_0x1ae53b)['addCommentThread']({'commentThreadId':_0x9840e,'comments':_0x2a5168['map'](_0x396de9=>function(_0x1ebabc,_0x5e6c85,_0x503b9d){return{'commentThreadId':_0x503b9d,'commentId':_0x1ebabc['commentId'],'userId':_0x1ebabc['authorId'],'content':_0x1ebabc['content'],'documentId':_0x5e6c85,'createdAt':_0x1ebabc['createdAt'],'attributes':_0x1ebabc['attributes']||{}};}(_0x396de9,_0x1ae53b,_0x9840e)),'resolvedAt':_0x2f01a0,'resolvedBy':_0x2ff69c,'context':_0x4c174a,'attributes':_0x2982d9})['catch'](ht);return{'threadId':_0x29d06d['commentThreadId'],'comments':_0x29d06d['comments']};},'getCommentThread':async({channelId:_0x26b3b1,threadId:_0xec9a04})=>{const _0x240fab=await this['_getService'](_0x26b3b1)['getCommentThread'](_0xec9a04)['catch'](F)['catch'](ht);return _0x240fab?_0x240fab['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x240fab]),{'threadId':_0x240fab['commentThreadId'],'comments':_0x240fab['comments']['map'](S),'context':_0x240fab['context'],'resolvedAt':_0x240fab['resolvedAt'],'resolvedBy':_0x240fab['resolvedBy'],'attributes':_0x240fab['attributes']||{}}):null;},'updat