@ckeditor/ckeditor5-real-time-collaboration 44.1.0-alpha.0 → 44.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{ContextPlugin as _0x37a9d3,Plugin as _0x50372a,PendingActions as _0x368f32,Context as _0x112e10}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x4c6426,CKEditorError as _0x408616,Collection as _0x5da562,global as _0x38475b,version as nt,uid as _0x301035,KeystrokeHandler as _0x60e8df}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x1d35e3,View as _0x32c1aa,ListView as _0x5e215a,ListItemView as et,LabelView as ot,BalloonPanelView as _0x4bb92d,clickOutsideHandler as _0x452c2f,BodyCollection as _0x400f02}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as at,History as _0x2d8e8d,NoOperation as _0x54ca34,InsertOperation as _0x4e5089,MarkerOperation as _0x184ddc,RootAttributeOperation as _0x3baf28,transformSets as _0x453bb3,OperationFactory as _0x1e5de9}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as ht,WEB_SOCKET_GATEWAY_STATES as _0x39f1be,CollaborativeEditingService as _0x35ce65,User as lt,CommentsService as _0x2fcac4,TrackChangesService as _0x3715b6,RevisionHistoryService as _0x20d94b,EditorService as _0x2f88e7}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x4c3346,UserView as rt}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x439fc2}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x1667f2}from'lodash-es';class c extends _0x37a9d3{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
24
- ((()=>ht)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x1d35e3];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x19c74c){super(_0x19c74c),this['set']('state',_0x39f1be['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x4c6426);}['init'](){const _0x2340db=this['context'],_0x2358d2=_0x2340db['plugins']['get']('CloudServices'),_0x204d81=_0x2340db['plugins']['get'](_0x1d35e3);if(!_0x2358d2['token'])throw new _0x408616('websocketgateway-missing-token',this);if(!_0x2358d2['webSocketUrl'])throw new _0x408616('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),c['WebSocketGateway']['connect'](_0x2358d2['token'],_0x2358d2['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x2b8af7=>{if(this['connection']=_0x2b8af7,this['bind']('state')['to'](_0x2b8af7,'state',this,'_isBrowserOffline',(_0x57a9c6,_0x3088cc)=>('connected'!==_0x57a9c6&&(this['_shouldPluginsReconnect']=!0x0),_0x3088cc||_0x57a9c6!==_0x39f1be['CONNECTED']?_0x39f1be['DISCONNECTED']:this['state']==_0x39f1be['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x39f1be['CONNECTING']):_0x39f1be['CONNECTED'])),this['connection']['on']('error',(_0x45feea,_0x29ac25)=>{if('limitExceeded'!==_0x29ac25['code'])throw console['error'](_0x29ac25),new _0x408616('cloudservices-init',null,{'originalError':_0x29ac25});_0x204d81['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'});}),!_0x2b8af7['me'])return new Promise(_0xd8e606=>_0x2b8af7['on']('change:me',_0xd8e606));})['catch'](_0x1a4be3=>{throw console['error'](_0x1a4be3),new _0x408616('cloudservices-init',null,{'originalError':_0x1a4be3});});}['addToReconnectionStack'](_0x19f3f4){if('function'!=typeof _0x19f3f4['reconnect'])throw new _0x408616('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x19f3f4))throw new _0x408616('websocketgateway-plugin-already-registered',this,{'name':_0x19f3f4['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x19f3f4);}['removeFromReconnectionStack'](_0x4bce05){this['_reconnectionStack']['delete'](_0x4bce05);}['isInReconnectionStack'](_0x7fd775){return this['_reconnectionStack']['has'](_0x7fd775);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x4864d0=>_0x4864d0['reconnect']())))['then'](()=>this['state']=_0x39f1be['CONNECTED'])['catch'](_0x3fdb4d=>{throw console['error'](_0x3fdb4d),new _0x408616('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x39f1be['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class i extends _0x37a9d3{['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[c,_0x4c3346];}constructor(_0x26a76d){super(_0x26a76d),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x5da562(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x4c3346);}['init'](){const _0x30a0fa=this['context']['plugins']['get'](c);this['listenTo'](_0x30a0fa,'change:state',(_0x5171da,_0x19b10a,_0x117b54)=>{if('connected'!==_0x117b54)this['channelSessions']['forEach'](_0x433229=>_0x433229['clear']()),this['channelConnectedUsers']['forEach'](_0x1b8c59=>_0x1b8c59['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x1b1c0e,_0x102eca]of this['_registeredSessions'])for(const _0x5b9dbd of _0x102eca)this['_handleSessionAdd'](_0x1b1c0e,_0x5b9dbd);}}),this['_createUser'](_0x30a0fa['connection']['me'],!0x0);}['register'](_0xaa7016,_0x556212){if(this['_registeredSessions']['has'](_0xaa7016))throw new _0x408616('sessions-register-already-registered',null,{'channelId':_0xaa7016});this['_registeredSessions']['set'](_0xaa7016,_0x556212),this['channelSessions']['set'](_0xaa7016,new _0x5da562()),this['channelConnectedUsers']['set'](_0xaa7016,new _0x5da562()),this['listenTo'](_0x556212,'add',(_0x409ab3,_0x1c4542)=>this['_handleSessionAdd'](_0xaa7016,_0x1c4542)),this['listenTo'](_0x556212,'remove',(_0x3d42bc,_0x45f841)=>this['_handleSessionRemove'](_0xaa7016,_0x45f841));for(const _0x1d12d4 of _0x556212)this['_handleSessionAdd'](_0xaa7016,_0x1d12d4);}['unregister'](_0x2e3809){if(!this['_registeredSessions']['has'](_0x2e3809))throw new _0x408616('sessions-unregister-not-exist',null,{'channelId':_0x2e3809});const _0x162ccb=this['_registeredSessions']['get'](_0x2e3809);this['stopListening'](_0x162ccb);for(const _0x502de8 of _0x162ccb)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x2e3809,_0x502de8);this['_registeredSessions']['delete'](_0x2e3809),this['channelSessions']['delete'](_0x2e3809),this['channelConnectedUsers']['delete'](_0x2e3809);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x14f0de){for(const _0x357871 of this['channelSessions']['values']())for(const _0x58349a of _0x357871)if(_0x58349a['id']===_0x14f0de)return _0x58349a['user'];}['getUserSessions'](_0x385825,_0x9c6073){const _0x430299=_0x9c6073?[this['channelSessions']['get'](_0x9c6073)]:this['channelSessions']['values'](),_0x296469=new Set();for(const _0x391ba9 of _0x430299)for(const _0x206f37 of _0x391ba9)_0x206f37['user']['id']===_0x385825['id']&&_0x296469['add'](_0x206f37['id']);return _0x296469;}['getUserRole'](_0x4f83d5){for(const _0x406933 of this['channelSessions']['values']())for(const _0x252324 of _0x406933)if(_0x252324['user']===_0x4f83d5)return _0x252324['role'];}['_handleSessionAdd'](_0x571b78,_0x31874a){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x25f633=_0x31874a['user'],_0x1bc4f2=this['_users']['getUser'](_0x25f633['id'])||this['_createUser'](_0x25f633),_0x4eba01=Object['assign']({},_0x31874a,{'user':_0x1bc4f2});this['channelSessions']['get'](_0x571b78)['add'](_0x4eba01);const _0x350488=this['channelConnectedUsers']['get'](_0x571b78);_0x350488['has'](_0x1bc4f2['id'])||_0x350488['add'](_0x1bc4f2),this['allConnectedUsers']['has'](_0x1bc4f2['id'])||this['allConnectedUsers']['add'](_0x1bc4f2,_0x1bc4f2['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x571b78,{'channelId':_0x571b78,'session':_0x4eba01});}['_handleSessionRemove'](_0x1aadfe,_0x46d888){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0xdedd13=this['channelConnectedUsers']['get'](_0x1aadfe),_0x16107c=_0x46d888['user'];_0x16107c['id']&&(this['channelSessions']['get'](_0x1aadfe)['remove'](_0x46d888['id']),_0xdedd13['has'](_0x16107c['id'])&&!this['getUserSessions'](_0x16107c,_0x1aadfe)['size']&&_0xdedd13['remove'](_0x16107c['id']),this['allConnectedUsers']['get'](_0x16107c['id'])&&!this['getUserSessions'](_0x16107c)['size']&&this['allConnectedUsers']['remove'](_0x16107c['id']));}['_createUser'](_0x4f6c61,_0x11cd30){const _0x35e889=this['_users']['addUser'](_0x4f6c61);return _0x11cd30&&this['_users']['defineMe'](_0x4f6c61['id']),_0x35e889['orderNumber']=this['_uniqueUsersCount']++,_0x35e889;}}class J extends _0x50372a{['_domEmitter']=new(_0x4c6426())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4f2322=this['editor'],_0x286365=_0x4f2322['plugins']['get'](i);_0x4f2322['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x3bb0e0,{writer:_0x5e55d2})=>function(_0xbbf936,_0x8c4244,_0x2bcfb9,_0x2e2625){const _0x121ed8=_0xbbf936['markerName']['split'](':')[0x2],_0xf207f4=_0x2bcfb9['getUserBySessionId'](_0x121ed8);if(!_0xf207f4||_0x121ed8===_0x2bcfb9['mySessionId'])return;if(!_0x2e2625['model']['schema']['checkChild'](_0xbbf936['markerRange']['start'],'$text'))return;const _0x3c7846={'class':'ck-user__marker\x20'+_0xf207f4['color']['getMarkerClass'](),'data-name':_0xf207f4['name'],'data-session-id':_0x121ed8},_0x51574d=_0x2e2625['model']['markers']['get'](_0xbbf936['markerName']),_0x15c528=_0x51574d['getStart'](),_0x2ee8bf=_0x15c528['nodeAfter'],_0x1b5b45=_0x2e2625['model']['schema'];if(_0x2ee8bf&&_0x1b5b45['isObject'](_0x2ee8bf)&&_0x1b5b45['isInline'](_0x2ee8bf)&&!_0x2e2625['model']['markers']['get']('user:range:'+_0x121ed8)['getRange']()['isCollapsed'])return;const _0x38a309=_0x15c528['parent'];return _0x2e2625['model']['schema']['isLimit'](_0x38a309)&&!_0x2e2625['model']['hasContent'](_0x38a309)&&(_0x3c7846['contenteditable']=!0x1),function(_0x45b51c,_0x3251b4,_0x5368ff){const _0x389d2c=_0x45b51c['createUIElement']('span',_0x3251b4);return _0x45b51c['setCustomProperty']('userPositionMarker',!0x0,_0x389d2c),_0x389d2c['render']=function(_0x53bac7){const _0x45c86b=this['toDomElement'](_0x53bac7);return _0x45c86b['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span><span\x20class=\x22ck-user__marker-tooltip\x22\x20contenteditable=\x22false\x22\x20spellcheck=\x22false\x22>'+_0x5368ff['name']+'</span>⁠',_0x45c86b['addEventListener']('mouseenter',()=>{_0x45c86b['classList']['add']('ck-user__marker_hovered');}),_0x45c86b['addEventListener']('mouseleave',()=>{_0x45c86b['classList']['remove']('ck-user__marker_hovered');}),_0x45c86b;},_0x389d2c['isSimilar']=function(_0xbbc359){return!(!this['getCustomProperty']('userPositionMarker')||!_0xbbc359['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0xbbc359['getAttribute']('data-session-id'));},_0x389d2c;}(_0x8c4244,_0x3c7846,_0xf207f4);}(_0x3bb0e0,_0x5e55d2,_0x286365,_0x4f2322)}),_0x4f2322['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4c9c60=>function(_0x1ebf50,_0x5b0d91){const _0x50e9e7=_0x1ebf50['markerName']['split'](':')[0x2];if(_0x50e9e7===_0x5b0d91['mySessionId'])return null;const _0x1d1614=_0x5b0d91['getUserBySessionId'](_0x50e9e7);if(!_0x1d1614)return{'id':_0x50e9e7,'classes':[]};return{'id':_0x50e9e7,'classes':['ck-user__selection',_0x1d1614['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x50e9e7},'priority':0x7d0+_0x1d1614['orderNumber']};}(_0x4c9c60,_0x286365)}),function(_0x125fbb){const _0x3ec903=_0x125fbb['model'],_0x146284=new Map(),_0x3c5005=_0x125fbb['plugins']['get'](i);_0x3ec903['markers']['on']('update:user:range',(_0xe64318,_0x14e49c,_0x5233fb,_0x8b33db)=>{if(!_0x8b33db&&_0x146284['get'](_0x14e49c['name']))return _0x146284['get'](_0x14e49c['name'])['detach'](),void _0x146284['delete'](_0x14e49c['name']);const _0x11db1f=_0x14e49c['name']['split'](':')[0x2];if(_0x11db1f===_0x3c5005['mySessionId'])return;const _0x580649='user:position:'+_0x11db1f;_0x3ec903['markers']['has'](_0x580649)&&_0x125fbb['editing']['reconvertMarker'](_0x580649),_0x14e49c['on']('change:range',(_0x32c1ad,_0x2c6ef1,_0x4cb00c)=>{if('$graveyard'!=_0x2c6ef1['root']['rootName']&&'$graveyard'==_0x14e49c['getRange']()['root']['rootName']&&!_0x146284['has'](_0x14e49c['name'])){const _0x43e2c9=_0x3ec903['schema']['getNearestSelectionRange'](_0x4cb00c['deletionPosition']);if(_0x43e2c9){const _0x591a1c=at['fromRange'](_0x43e2c9);_0x146284['set'](_0x14e49c['name'],_0x591a1c),_0x591a1c['on']('change:range',(_0x5a404a,_0x467bff,_0x5c2121)=>{if('$graveyard'==_0x591a1c['root']['rootName']){const _0x3aad36=_0x3ec903['schema']['getNearestSelectionRange'](_0x5c2121['deletionPosition']);_0x3aad36?(_0x591a1c['start']=_0x3aad36['start'],_0x591a1c['end']=_0x3aad36['end']):(_0x146284['delete'](_0x14e49c['name']),_0x591a1c['detach']());}});}}});}),_0x3ec903['document']['on']('change',()=>{_0x146284['size']>0x0&&_0x3ec903['enqueueChange']({'isUndoable':!0x1},_0x45187f=>{for(const [_0x5c2daf,_0x23d428]of _0x146284)'$graveyard'==_0x3ec903['markers']['get'](_0x5c2daf)['getRange']()['root']['rootName']&&(te(_0x5c2daf['split'](':')[0x2],_0x23d428['toRange'](),_0x3ec903,_0x45187f),_0x23d428['detach']());_0x146284['clear']();});});}(_0x4f2322),this['_domEmitter']['listenTo'](_0x38475b['document'],'keydown',(_0x480ae3,{key:_0x4da8cf})=>{'Escape'===_0x4da8cf&&function(_0x428dce){_0x428dce['editing']['view']['change'](_0x5ca89b=>{for(const _0x3c3f7f of _0x428dce['model']['markers']){if(!_0x3c3f7f['name']['startsWith']('user:position'))continue;const _0x279173=_0x428dce['editing']['mapper']['markerNameToElements'](_0x3c3f7f['name']);if(_0x279173){for(const _0x2dc69a of _0x279173)_0x5ca89b['removeClass']('ck-user__marker_hovered',_0x2dc69a);}}});}(_0x4f2322);},{'useCapture':!0x0});}['afterInit'](){const _0x574118=this['editor'],_0x24cf2a=_0x574118['commands']['get']('undo');_0x24cf2a&&_0x574118['model']['on']('applyOperation',(_0x283b83,_0x4b8769)=>{const _0x4a4a44=_0x4b8769[0x0];if('marker'!=_0x4a4a44['type']||!_0x4a4a44['name']['startsWith']('user:'))return;const _0x51a2b9=_0x4a4a44['batch'];_0x24cf2a['_createdBatches']['has'](_0x51a2b9)&&(_0x4a4a44['newRange']=_0x4a4a44['oldRange']?_0x574118['model']['createRange'](_0x4a4a44['oldRange']['start'],_0x4a4a44['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x2798fe=this['editor'],_0x376591=_0x2798fe['model']['document'],_0x2f8e81=_0x2798fe['plugins']['get'](i);_0x2798fe['model']['enqueueChange']({'isUndoable':!0x1},_0x1450e4=>{const _0x5c2550='user:range:'+_0x2f8e81['mySessionId'],_0xfd3398='user:position:'+_0x2f8e81['mySessionId'],_0x3f1292=_0x2798fe['model']['markers']['has'](_0x5c2550);_0x2798fe['editing']['view']['hasDomSelection']?te(_0x2f8e81['mySessionId'],_0x376591['selection']['getFirstRange'](),_0x2798fe['model'],_0x1450e4):_0x3f1292&&(_0x1450e4['removeMarker'](_0x5c2550),_0x1450e4['removeMarker'](_0xfd3398));});}}function te(_0x4a6f09,_0x23628c,_0x2f0698,_0x2cb0a3){const _0xcd8c68='user:range:'+_0x4a6f09,_0x41d0a9='user:position:'+_0x4a6f09,_0xc252b1=_0x23628c['getContainedElement']();let _0x56adf9=_0x23628c['start'];_0xc252b1&&_0xc252b1['is']('element','tableCell')&&(_0x56adf9=function(_0x23967d,_0x1575b9){for(const _0x51d807 of _0x23967d['getPositions']())if(_0x1575b9['schema']['checkChild'](_0x51d807,'$text'))return _0x51d807;}(_0x23628c,_0x2f0698),_0x23628c=_0x2cb0a3['createRange'](_0x56adf9));const _0x568d31=_0x2cb0a3['createRange'](_0x56adf9);_0x2f0698['markers']['has'](_0xcd8c68)?(_0x2cb0a3['updateMarker'](_0xcd8c68,{'range':_0x23628c}),_0x2cb0a3['updateMarker'](_0x41d0a9,{'range':_0x568d31})):(_0x2cb0a3['addMarker'](_0xcd8c68,{'range':_0x23628c,'usingOperation':!0x0}),_0x2cb0a3['addMarker'](_0x41d0a9,{'range':_0x568d31,'usingOperation':!0x0}));}function Q(_0x32da98,_0x1340f4,_0x3ade47){const _0x4adff1=_0x32da98['t'],t=_0x32da98['t'];switch(_0x1340f4){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 _0x4adff1({'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'},_0x3ade47);default:return'';}}let Z=0x1;class l extends _0x50372a{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
25
- ((()=>_0x35ce65)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,J,_0x368f32,_0x4c3346,_0x1d35e3];}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 _0x475d26=this['serverHistory']['getOperations']();for(let _0x271ff8=_0x475d26['length']-0x1;_0x271ff8>=0x0;_0x271ff8--){const _0x40956f=_0x475d26[_0x271ff8];if(!this['_disconnectionOperations']['has'](_0x40956f))return _0x40956f['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x31378f){if(super(_0x31378f),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x2d8e8d(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x408616('collaboration-missing-channelid',this);const _0x5236a6=_0x31378f['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x5236a6,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x439fc2(),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 st(this['_disconnectionOperations']);}['init'](){const _0x840f44=this['editor'],_0x42bad7=_0x840f44['plugins']['get'](_0x4c3346),_0x36795f=_0x840f44['plugins']['get'](c);this['listenTo'](_0x42bad7,'getOperationAuthor',(_0x547f57,_0x2b760c)=>{const _0x340d1a=_0x2b760c[0x0];_0x340d1a['_authorId']&&(_0x547f57['return']=_0x42bad7['getUser'](_0x340d1a['_authorId']),_0x547f57['stop']()),null===_0x340d1a['_authorId']&&(_0x547f57['return']=null,_0x547f57['stop']());},{'priority':'high'}),this['listenTo'](_0x840f44['model']['document']['selection'],'change:range',(_0x48e793,_0x51833e)=>{_0x51833e['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x840f44['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x840f44['model']['on']('applyOperation',(_0x51cbab,_0x51a853)=>{const _0x543c66=_0x51a853[0x0];_0x543c66['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x543c66),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x36795f,'state',this,'_hasSynchronizationProblem',(_0x2f2285,_0x1dec65)=>'connected'===_0x2f2285&&!_0x1dec65),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x840f44['disableReadOnlyMode']('rtc-offline'):_0x840f44['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x840f44['disableReadOnlyMode']('rtc-offline'):_0x840f44['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x223d0c=this['editor']['plugins']['get'](i),_0x24455e=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x223d0c['unregister'](this['_channelId']);const _0x579c27=await this['_service']['reconnect'](_0x24455e['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x579c27)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x25f60b=await this['_service']['getConnectedSessions']();_0x223d0c['register'](this['_channelId'],_0x25f60b),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x3b16cf){if(function(_0x3106cb){return'404'===_0x3106cb['code'];}(_0x3b16cf)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x2c39be){return'409'===_0x2c39be['code'];}(_0x3b16cf)){const _0x2845e7=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'](_0x2845e7);}else{if(!(_0x3b16cf instanceof tt))throw _0x3b16cf;this['_handleReconnectionError']();}}}}['destroy'](){const _0x35cd10=this['editor']['plugins']['get'](c),_0x176b83=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x176b83['channelSessions']['has'](this['_channelId'])&&_0x176b83['unregister'](this['_channelId']),_0x35cd10['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x4c1dd0){if(this['sessionId']!==_0x4c1dd0['sessionId']&&this['_lastSyncedOperationId']!==_0x4c1dd0['lastOperationId'])throw new tt();return this['sessionId']=_0x4c1dd0['sessionId'],this['_handleServerResponse']([],{..._0x4c1dd0,'wereChangesApplied':!0x1,'data':_0x4c1dd0['data']},'reconnect');}async['_connectService'](_0x3a92f9,_0x3cc43d=!0x1){const {connection:_0x2f0c00}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x2f0c00,this['_channelId'])['then'](_0x2665e0=>this['_initSessionsHandling'](_0x2665e0))['catch'](_0x325a0e=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x325a0e);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x548d90,_0x3e0b8a)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x3e0b8a);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0xb4c97d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3a92f9);this['_isPendingUpdate']=!0x0;const _0x4681c3=await this['_service']['connect'](_0x2f0c00,this['_compressOperations'](_0x3a92f9),_0xb4c97d);if(this['sessionId']=_0x4681c3['sessionId'],_0x3cc43d){if(!_0x4681c3['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x4681c3['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x3a92f9,_0x4681c3,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x4681c3,_0x3a92f9);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x2c85d6=this['editor']['plugins']['get'](i),_0x76f47d=this['editor']['plugins']['get'](J),_0x1aae00=_0x2c85d6['channelSessions']['get'](this['_channelId']);_0x1aae00&&_0x1aae00['length']>0x1?_0x76f47d['createUserMarkerOperations']():this['listenTo'](_0x2c85d6,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x2c85d6['channelSessions']['get'](this['_channelId'])['length']&&_0x76f47d['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x3d30e0,_0x152453,_0x53e5d5,_0x9da1fa){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x152453){const _0x2ae469=this['_decompressOperations'](_0x53e5d5,_0x9da1fa);await this['_fetchMissingUsers'](_0x2ae469),this['_handleExternalOperations'](_0x2ae469,_0x152453,_0x53e5d5['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x23a2f1}=this['editor'];let _0x3de310;try{_0x3de310=await this['_service']['getDocumentDetails']();}catch(_0x4863e7){const _0x254151=Q(_0x23a2f1,'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'](_0x254151);}const _0x41cd13=_0x3de310['currentDocumentSession']||_0x3de310['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x41cd13['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x4b1751=Q(_0x23a2f1,'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.');this['_handleReconnectionError'](_0x4b1751);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x218460){const _0x3f5628=this['editor']['plugins']['get'](i);this['listenTo'](_0x3f5628,'sessionAdd:'+this['_channelId'],(_0x136297,{session:_0x3a0a02})=>{if(_0x3a0a02['id']===_0x3f5628['mySessionId']){_0x136297['off']();const _0xc1f66c=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x4f3416=_0x3a0a02['permissions'];_0xc1f66c&&_0xc1f66c['isEnabled']&&(_0x4f3416=_0x4f3416['filter'](_0x21a30d=>'document:write'!==_0x21a30d)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x4f3416,this['_channelId']);}}),_0x3f5628['register'](this['_channelId'],_0x218460);}['_initThrowingOnDataSet'](){const _0x5261ad=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x31b1e1)=>{if(!_0x31b1e1[_0x31b1e1['length']-0x1]['suppressErrorInCollaboration'])throw new _0x408616('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x5261ad['apply'](this['editor']['data'],_0x31b1e1);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x1dac26,[_0x1bfd6c])=>{if(this['_document']['version'])throw new _0x408616('realtimecollaborationclient-init-document-already-initialized',this);_0x1dac26['stop'](),this['_setPendingAction']();const _0x2fbbc8=this['editor']['config']['get']('rootsAttributes'),_0x5bfa8a=this['_getOperationsFromInitData'](_0x1bfd6c,_0x2fbbc8);0x0==_0x5bfa8a['length']&&_0x5bfa8a['push'](new _0x54ca34(0x0)),_0x1dac26['return']=this['_connectService'](_0x5bfa8a)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1f1033=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1f1033))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2df160,[_0x44dd76,_0x4057b1])=>{_0x2df160['stop']();const _0x5de0ec=this['editor']['model']['document']['getRoot'](_0x44dd76);if(!this['_knownRootNames']['has'](_0x44dd76)){const _0x2a72dc=_0x4057b1&&_0x4057b1['data']?_0x4057b1['data']:'',_0x37556e=_0x4057b1&&_0x4057b1['attributes']?_0x4057b1['attributes']:{};await this['_loadRoot'](_0x44dd76,_0x2a72dc,_0x37556e);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x5de0ec['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x5de0ec);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xe9fdbd){const _0x234686=this['editor']['plugins']['get'](_0x4c3346),{connection:_0x4762e7}=this['editor']['plugins']['get'](c),_0x4a030a=new Set();for(const _0x6c73f6 of _0xe9fdbd){const _0x509edd=_0x6c73f6['_authorId'];_0x509edd&&!_0x234686['getUser'](_0x509edd)&&_0x4a030a['add'](_0x509edd);}if(0x0===_0x4a030a['size'])return;const _0x5c09fc=await lt['getMany'](_0x4762e7,Array['from'](_0x4a030a));for(const _0x3af950 of _0x5c09fc)_0x234686['getUser'](_0x3af950['id'])||_0x234686['addUser'](_0x3af950);}['_getOperationsFromInitData'](_0x3e767f,_0x2586c4={}){const _0x527e68=this['editor']['model'],_0x5b7a6a=[];let _0x1e1251=0x0;const _0x4ecd9c='string'==typeof _0x3e767f?{'main':_0x3e767f}:_0x3e767f;for(const _0x458968 of Object['keys'](_0x4ecd9c)){if(!this['_document']['roots']['has'](_0x458968))throw new _0x408616('realtimecollaborationclient-init-non-existent-root',this);const _0x43f878=this['editor']['data']['parse'](_0x4ecd9c[_0x458968]),_0x4acb00=this['_document']['getRoot'](_0x458968),_0xb7edb1=new _0x4e5089(_0x527e68['createPositionAt'](_0x4acb00,0x0),_0x43f878,_0x1e1251++);_0x5b7a6a['push'](_0xb7edb1);for(const [_0x2fa92,_0x2faaaf]of _0x43f878['markers']){const _0x2a4b2f=_0x527e68['createRange'](_0x527e68['createPositionFromPath'](_0x4acb00,_0x2faaaf['start']['path']['slice']()),_0x527e68['createPositionFromPath'](_0x4acb00,_0x2faaaf['end']['path']['slice']())),_0x503faa=new _0x184ddc(_0x2fa92,null,_0x2a4b2f,_0x527e68['markers'],!0x0,_0x1e1251++);_0x5b7a6a['push'](_0x503faa);}}if(_0x2586c4)for(const [_0x128b7f,_0x3a1688]of Object['entries'](_0x2586c4)){const _0x5c34aa=_0x527e68['document']['getRoot'](_0x128b7f);if(!_0x5c34aa)throw new _0x408616('multi-root-editor-root-attributes-no-root',null);for(const [_0x270014,_0x35601d]of Object['entries'](_0x3a1688))if(null!==_0x35601d){const _0x5733f9=new _0x3baf28(_0x5c34aa,_0x270014,null,_0x35601d,_0x1e1251++);_0x5b7a6a['push'](_0x5733f9);}}return _0x5b7a6a;}async['_loadRoot'](_0x106715,_0x39839a,_0x4ca3d1){this['_getOperationsFromInitData']({[_0x106715]:_0x39839a},{[_0x106715]:_0x4ca3d1})['forEach']((_0x2d9bcc,_0x4c387c)=>{_0x2d9bcc['baseVersion']=this['_document']['version']+_0x4c387c,_0x2d9bcc['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2d9bcc);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x363cf7,_0x767697){let _0x15d3dd;this['_offset']=_0x363cf7['offset'];const _0x4917e5=_0x363cf7['wereChangesApplied']&&!_0x363cf7['initData'],_0x40ca2d=_0x4917e5?0x0:_0x363cf7['data']['baseVersion'];if(_0x767697['forEach'](_0x3f1592=>{_0x3f1592['_isInit']=!0x0,_0x3f1592['createdAt']=_0x363cf7['sessionCreatedAt'],_0x3f1592['_authorId']=null;}),_0x4917e5)_0x15d3dd=_0x767697,this['_applyOperationsSet'](_0x15d3dd,_0x4917e5);else{if(_0x363cf7['initData']){const _0x2ce947=this['_getOperationsFromInitData'](_0x363cf7['initData']);this['_document']['history']['version']=-_0x2ce947['length'],_0x2ce947['forEach'](_0x3f420e=>{_0x3f420e['baseVersion']-=_0x2ce947['length'],_0x3f420e['createdAt']=_0x363cf7['sessionCreatedAt'],_0x3f420e['_isInit']=!0x0,_0x3f420e['_authorId']=null;}),this['_applyOperationsSet'](_0x2ce947,!0x0),this['serverHistory']['version']=-_0x2ce947['length']+this['_offset'],this['_updateServerHistory'](_0x2ce947);}this['_document']['history']['version']=_0x40ca2d,_0x15d3dd=this['_decompressOperations'](_0x363cf7['data'],_0x363cf7['metadata']),await this['_fetchMissingUsers'](_0x15d3dd),this['_applyOperationsSet'](_0x15d3dd,_0x4917e5);}_0x363cf7['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x15d3dd,_0x363cf7['lastOperationId']),this['_lastSyncedOperationId']=_0x363cf7['lastOperationId']),this['serverHistory']['version']=_0x40ca2d+this['_offset'],this['_updateServerHistory'](_0x15d3dd),_0x767697['filter'](_0x23321e=>{const _0x57f483=this['_getAffectedRoot'](_0x23321e);return _0x57f483&&!this['_knownRootNames']['has'](_0x57f483);})['forEach']((_0x3240fc,_0x5397c8)=>{_0x3240fc['baseVersion']=this['_document']['version']+_0x5397c8,this['_saveOperationInBuffer'](_0x3240fc);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x171afb,_0x350373,_0x19a521){throw this['_isPendingUpdate']=!0x0,_0x350373&&console['error'](_0x350373),_0x19a521&&this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x408616(_0x171afb,this['editor']);}['_saveOperationInBuffer'](_0x1fc260){this['_knownOperations']['has'](_0x1fc260)||(this['_knownOperations']['add'](_0x1fc260),this['_bufferedOperations']['push'](_0x1fc260),this['_pendingAction']||'marker'==_0x1fc260['type']&&!_0x1fc260['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x467c70=!0x1){!_0x467c70&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x2042b6=>{_0x2042b6&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x476d46=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x36aa87){return _0x36aa87['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x36aa87['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x36aa87['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x476d46)||this['_crash'](_0x476d46['message'],_0x476d46,!0x0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x21df35=>{this['on']('change:_isPendingUpdate',()=>{_0x21df35();});});}async['_sendBufferedOperations'](){const _0x270e9a=this['editor']['plugins']['get'](J);if(this['_shouldSendSelectionUpdate']()&&(_0x270e9a['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x2603e2=[...this['_bufferedOperations']];for(const _0x443e61 of _0x2603e2)_0x443e61['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x443e61);const _0x185669=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2603e2),_0x14bb03=Z++,_0x27eca6=this['_compressOperations'](_0x2603e2),_0x5a40fd=await this['_service']['sendOperations'](_0x27eca6,_0x27eca6['baseVersion'],_0x185669);try{return await this['_handleServerResponse'](_0x2603e2,_0x5a40fd,_0x14bb03);}catch(_0x2ff1e3){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x2ff1e3);}}async['_handleServerResponse'](_0x1286ba,_0x479a8b,_0x5503cb){if('error'in _0x479a8b)throw _0x479a8b['error'];let _0x5df959=!0x1;if(_0x479a8b['wereChangesApplied']){_0x479a8b['lastOperationId']&&(this['_lastSyncedOperationId']=_0x479a8b['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x44b596=>!_0x1286ba['includes'](_0x44b596));for(const _0xa80072 of _0x1286ba)_0xa80072['createdAt']='lastOperationAcceptedAt'in _0x479a8b&&_0x479a8b['lastOperationAcceptedAt']||void 0x0;it(_0x1286ba,_0x479a8b['version']-_0x1286ba['length']),this['_updateServerHistory'](_0x1286ba);const _0x2ac032=_0x1286ba['filter'](_0x2d981a=>{if(!_0x2d981a['_isInit'])return!0x1;const _0x55b651=this['_getAffectedRoot'](_0x2d981a);return _0x55b651&&!this['_knownRootNames']['has'](_0x55b651);});it(_0x2ac032,this['_document']['version']),this['_applyOperationsSet'](_0x2ac032),_0x5df959=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x45bd1b=this['_decompressOperations'](_0x479a8b['data'],_0x479a8b['metadata'])['filter'](_0x4357b6=>_0x4357b6['baseVersion']>=this['_lastServerVersion']);_0x45bd1b['forEach'](_0x13c73b=>this['_addKnownRoot'](_0x13c73b)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x47be01=>!_0x47be01['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x47be01))),this['_bufferedOperations']['length']&&it(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x45bd1b),_0x5df959=this['_handleExternalOperations'](_0x45bd1b,_0x479a8b['version'],_0x479a8b['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x5df959?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x494e61,_0x2538dc,_0x2bf8c7){try{const _0x38a26c={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x57d387,operationsB:_0x12b01d,originalOperations:_0x13de61}=_0x453bb3(_0x494e61,this['_bufferedOperations'],_0x38a26c);it(_0x57d387,this['_document']['version']),it(_0x12b01d,_0x2538dc);for(const _0x16cc18 of _0x57d387){const _0xe63d2a=_0x13de61['get'](_0x16cc18);_0x16cc18['_authorId']=_0xe63d2a?_0xe63d2a['_authorId']:null;}_0x2bf8c7&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x494e61,_0x2bf8c7),this['_lastSyncedOperationId']=_0x2bf8c7),this['_bufferedOperations']=[..._0x12b01d],this['_applyOperationsSet'](_0x57d387),this['_updateServerHistory'](_0x494e61);}catch(_0x58bc4c){return console['error'](_0x58bc4c),!0x1;}return!0x0;}['_applyOperationsSet'](_0x5d14e2,_0x31871e=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x3a193f=>{for(const _0x410c0c of _0x5d14e2)this['_knownOperations']['add'](_0x410c0c),this['_addKnownRoot'](_0x410c0c),_0x3a193f['batch']['addOperation'](_0x410c0c),this['editor']['model']['applyOperation'](_0x410c0c);});}['_addKnownRoot'](_0x973b8c){const _0x18de1a=this['_getAffectedRoot'](_0x973b8c);_0x18de1a&&this['_knownRootNames']['add'](_0x18de1a);}['_getAffectedRoot'](_0x49a7c6){let _0x281594,_0x52da4c;switch(_0x49a7c6['type']){case'insert':_0x281594=_0x49a7c6['position']['root'];break;case'marker':if(_0x52da4c=_0x49a7c6['newRange'],!_0x52da4c)return null;_0x281594=_0x52da4c['root'];break;case'addRootAttribute':_0x281594=_0x49a7c6['root'];break;case'addRoot':_0x281594=_0x49a7c6['affectedSelectable'];break;case'move':_0x281594=_0x49a7c6['targetPosition']['root'];break;default:return null;}return _0x281594['rootName'];}['_updateServerHistory'](_0x317e53){_0x317e53['forEach'](_0x244aba=>{const _0x105f1c=_0x244aba['clone']();_0x105f1c['_authorId']=_0x244aba['_authorId'],_0x105f1c['_isInit']=!!_0x244aba['_isInit'],_0x105f1c['createdAt']=_0x244aba['createdAt'],_0x105f1c['baseVersion']+=this['_offset'],_0x244aba['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x105f1c),this['serverHistory']['addOperation'](_0x105f1c);});}['_handleReconnectionError'](_0x3d69fc){const _0x1e1f3f=this['editor']['plugins']['get']('Notification'),_0xf2aac=this['editor']['locale'];_0x3d69fc||(_0x3d69fc=Q(_0xf2aac,'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.')),_0x1e1f3f['showWarning'](_0x3d69fc,{'title':Q(_0xf2aac,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['destroy']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x368f32)['add'](Q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x368f32)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x4cb562){const _0x76cb36=_0x4cb562['map'](_0x370842=>_0x370842['toJSON']());return this['_compressor']['compress'](_0x76cb36);}['_decompressOperations'](_0x5c3db2,_0x2c4d5f){return this['_compressor']['decompress'](_0x5c3db2)['map']((_0x2779c5,_0x4ff71a)=>{const _0x26cbf8='init'==_0x2c4d5f[_0x4ff71a]['type'];if('InsertOperation'==_0x2779c5['__className']){const _0x490b7d=_0x2779c5['position']['root'];!this['_document']['getRoot'](_0x490b7d)&&(this['_document']['createRoot']('$root',_0x490b7d)['_isAttached']=!0x1);}const _0x39670a=_0x1e5de9['fromJSON'](_0x2779c5,this['_document']);return _0x39670a['wasUndone']=_0x2779c5['wasUndone'],_0x39670a['_isInit']=_0x26cbf8,_0x39670a['_authorId']=_0x26cbf8?null:_0x2c4d5f[_0x4ff71a]['userId'],_0x39670a['_isDisconnection']='cs:removeUser'===_0x2c4d5f[_0x4ff71a]['type'],_0x39670a['createdAt']=_0x2c4d5f[_0x4ff71a]['createdAt'],_0x39670a;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x3e26ac=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3e26ac&&_0x3e26ac['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class tt extends Error{}function it(_0x42937e,_0x241cbd){for(const _0x4c1c0b of _0x42937e)_0x4c1c0b['baseVersion']=_0x241cbd++;}class st{['_ignoredOperations'];['_operationToId'];constructor(_0x58a2b0){this['_ignoredOperations']=_0x58a2b0,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0xc78e90){let _0x55a0a7=_0xc78e90['length'];for(;_0x55a0a7--;){const _0x3ce8f6=_0xc78e90[_0x55a0a7];if(!this['_ignoredOperations']['has'](_0x3ce8f6)){if(!this['_operationToId']['has'](_0x3ce8f6)){const _0x42a061=_0x301035()['slice'](0x1,0x12);this['_operationToId']['set'](_0x3ce8f6,_0x42a061);}return this['_operationToId']['get'](_0x3ce8f6);}}}['setIdForTheLastOperation'](_0x4f4f96,_0x2b93bd){if(!_0x2b93bd)return;let _0x45f7ba=_0x4f4f96['length'];for(;_0x45f7ba--;){const _0x9ae605=_0x4f4f96[_0x45f7ba];this['_ignoredOperations']['has'](_0x9ae605)||this['_operationToId']['set'](_0x9ae605,_0x2b93bd);}}}class n extends _0x50372a{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x37a9d3{static ['CommentsService']=/* #__PURE__ -- @preserve */
26
- ((()=>_0x2fcac4)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x4c3346];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x203d3f){super(_0x203d3f),this['_services']=new Map();}async['init'](){const _0x4fb797=this['context'],_0xe59c4e=_0x4fb797['plugins']['get']('CommentsRepository');if(_0x4fb797['plugins']['get'](c)['addToReconnectionStack'](this),_0xe59c4e['adapter']={'addCommentThread':async({channelId:_0x4cd9a1,threadId:_0x3420bf,comments:_0x18d822,resolvedAt:_0x30d2d6,resolvedBy:_0x4a8414,context:_0x2d6c94,attributes:_0x3d1620})=>{const _0x4b1608=await this['_getService'](_0x4cd9a1)['addCommentThread']({'commentThreadId':_0x3420bf,'comments':_0x18d822['map'](_0x2d70df=>function(_0x249ff1,_0x2982c2,_0x20dafa){return{'commentThreadId':_0x20dafa,'commentId':_0x249ff1['commentId'],'userId':_0x249ff1['authorId'],'content':_0x249ff1['content'],'documentId':_0x2982c2,'createdAt':_0x249ff1['createdAt'],'attributes':_0x249ff1['attributes']||{}};}(_0x2d70df,_0x4cd9a1,_0x3420bf)),'resolvedAt':_0x30d2d6,'resolvedBy':_0x4a8414,'context':_0x2d6c94,'attributes':_0x3d1620})['catch'](dt);return{'threadId':_0x4b1608['commentThreadId'],'comments':_0x4b1608['comments']};},'getCommentThread':async({channelId:_0x20fc95,threadId:_0x5be569})=>{const _0x28bbb7=await this['_getService'](_0x20fc95)['getCommentThread'](_0x5be569)['catch'](dt);return _0x28bbb7['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x28bbb7]),{'threadId':_0x28bbb7['commentThreadId'],'comments':_0x28bbb7['comments']['map'](S),'context':_0x28bbb7['context'],'resolvedAt':_0x28bbb7['resolvedAt'],'resolvedBy':_0x28bbb7['resolvedBy'],'attributes':_0x28bbb7['attributes']||{}});},'updateCommentThread':async({channelId:_0x581bdb,threadId:_0x1edd08,context:_0x47c239,unlinkedAt:_0x276e82,attributes:_0x282691})=>this['_getService'](_0x581bdb)['updateCommentThread']({'commentThreadId':_0x1edd08,'context':_0x47c239,'attributes':_0x282691,'unlinkedAt':_0x276e82})['catch'](B)['catch'](dt),'resolveCommentThread':async({channelId:_0x32055b,threadId:_0x3c8224})=>{const _0x514117=await this['_getService'](_0x32055b)['resolveCommentThread'](_0x3c8224)['catch'](B)['catch'](dt);return{'threadId':_0x514117['commentThreadId'],'resolvedAt':_0x514117['resolvedAt'],'resolvedBy':_0x514117['resolvedBy']};},'reopenCommentThread':async({channelId:_0x49a056,threadId:_0x398f17})=>this['_getService'](_0x49a056)['reopenCommentThread'](_0x398f17)['catch'](B)['catch'](dt),'removeCommentThread':({channelId:_0x22a6fe,threadId:_0x441628})=>this['_getService'](_0x22a6fe)['removeCommentThread'](_0x441628)['catch'](B)['catch'](dt),'addComment':({channelId:_0x48bef4,threadId:_0x5da0a0,commentId:_0x485c5c,content:_0x5de220,attributes:_0x55129a})=>this['_getService'](_0x48bef4)['addComment'](_0x5da0a0,_0x485c5c,_0x5de220,_0x55129a)['catch'](dt),'updateComment':({channelId:_0x19031b,threadId:_0x3ed5e7,commentId:_0x2a3ad5,content:_0x3eef45,attributes:_0x121149})=>this['_getService'](_0x19031b)['updateComment'](_0x3ed5e7,_0x2a3ad5,_0x3eef45,_0x121149)['catch'](B)['catch'](dt),'removeComment':({channelId:_0x35b92d,threadId:_0x225d0d,commentId:_0x14092e})=>this['_getService'](_0x35b92d)['removeComment'](_0x225d0d,_0x14092e)['catch'](B)['catch'](dt)},_0x4fb797 instanceof _0x112e10){const _0x4d38ea=_0x4fb797['config']['get']('collaboration.channelId'),_0x13ce2d=_0x4fb797['plugins']['get'](i);await this['_setUpService'](_0x4d38ea);const _0xcc3ebd=await this['_services']['get'](_0x4d38ea)['getConnectedSessions']();this['listenTo'](_0x13ce2d,'sessionAdd:'+_0x4d38ea,(_0x529fcc,{session:_0x2d8c8b})=>{_0x2d8c8b['id']===_0x13ce2d['mySessionId']&&(_0x529fcc['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x2d8c8b['permissions'],_0x4d38ea));}),_0x13ce2d['register'](_0x4d38ea,_0xcc3ebd);}}async['_setUpService'](_0x2859d0){if(this['_services']['has'](_0x2859d0))throw new _0x408616('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x2859d0});const _0x81796e=this['context']['plugins']['get']('CommentsRepository'),_0x51fa2d=new a['CommentsService'](_0x2859d0);this['_services']['set'](_0x2859d0,_0x51fa2d),this['listenTo'](_0x51fa2d,'commentThreadAdded',(_0x261e84,_0x2d4f8e)=>{const {commentThreadId:_0x54602b,documentId:_0x4e0db4,context:_0x461943,attributes:_0x142026,resolvedAt:_0x45caa6,resolvedBy:_0x2e3ea2,comments:_0x2d5949}=_0x2d4f8e;_0x81796e['getCommentThread'](_0x54602b)||_0x81796e['addCommentThread']({'threadId':_0x54602b,'channelId':_0x4e0db4,'comments':_0x2d5949?_0x2d5949['map'](S):[],'context':_0x461943,'attributes':_0x142026,'resolvedAt':_0x45caa6,'resolvedBy':_0x2e3ea2,'isFromAdapter':!0x0});}),this['listenTo'](_0x51fa2d,'commentThreadUpdated',(_0x19c496,{commentThreadId:_0x3a28ae,documentId:_0x2920b8,context:_0x2d73ea,unlinkedAt:_0xe84df,attributes:_0x5bfc73})=>{_0x81796e['getCommentThread'](_0x3a28ae)&&_0x81796e['updateCommentThread']({'threadId':_0x3a28ae,'channelId':_0x2920b8,'context':_0x2d73ea,'unlinkedAt':_0xe84df,'attributes':_0x5bfc73,'isFromAdapter':!0x0});}),this['listenTo'](_0x51fa2d,'commentThreadResolved',(_0x59fa5b,{commentThreadId:_0x5ed39e,resolvedBy:_0x4c50f6,resolvedAt:_0xf74b91})=>{const _0x158d73=_0x81796e['getCommentThread'](_0x5ed39e);_0x158d73&&_0x158d73['resolve']({'resolvedBy':_0x4c50f6,'resolvedAt':_0xf74b91,'isFromAdapter':!0x0});}),this['listenTo'](_0x51fa2d,'commentThreadReopened',(_0x1fc94b,{commentThreadId:_0x59a2cc})=>{const _0x29cca7=_0x81796e['getCommentThread'](_0x59a2cc);_0x29cca7&&_0x29cca7['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x51fa2d,'commentThreadRemoved',(_0x58f5a4,{commentThreadId:_0x55ce8d})=>{const _0x265fe0=_0x81796e['getCommentThread'](_0x55ce8d);_0x265fe0&&_0x265fe0['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x51fa2d,'commentAdded',(_0x2f32bc,_0x1c1ea8)=>{const _0x2a9bd4=_0x1c1ea8['commentThreadId'],_0x4bb639=_0x81796e['getCommentThread'](_0x2a9bd4);_0x4bb639&&_0x4bb639['addComment']({...S(_0x1c1ea8),'isFromAdapter':!0x0});}),this['listenTo'](_0x51fa2d,'commentUpdated',(_0x126684,{commentThreadId:_0x598c3d,commentId:_0x33c08f,content:_0x3ade66,attributes:_0x4ca2f5})=>{const _0x28aa11=_0x81796e['getCommentThread'](_0x598c3d);if(_0x28aa11){const _0x29688e=_0x28aa11['getComment'](_0x33c08f);_0x29688e&&_0x29688e['update']({'content':_0x3ade66,'attributes':_0x4ca2f5,'isFromAdapter':!0x0});}}),this['listenTo'](_0x51fa2d,'commentRemoved',(_0x3d71a6,{commentThreadId:_0x2aeec5,commentId:_0x218c11})=>{const _0x2bf15d=_0x81796e['getCommentThread'](_0x2aeec5);if(_0x2bf15d){const _0xeb125e=_0x2bf15d['getComment'](_0x218c11);_0xeb125e&&_0xeb125e['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x2859d0);}['destroy'](){if(this['context']instanceof _0x112e10){const _0x563767=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x563767);}}['_terminateService'](_0x57cb46){if(!this['_services']['has'](_0x57cb46))throw new _0x408616('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x57cb46});this['_getService'](_0x57cb46)['disconnect'](),this['_services']['delete'](_0x57cb46);}async['reconnect'](){for(const _0x88d658 of this['_services']['keys']())await this['_connectService'](_0x88d658);if(this['context']instanceof _0x112e10){const _0x12d8b4=this['context']['config']['get']('collaboration.channelId'),_0x287e1a=this['context']['plugins']['get'](i);_0x287e1a['unregister'](_0x12d8b4);const _0x331684=await this['_services']['get'](_0x12d8b4)['getConnectedSessions']();_0x287e1a['register'](_0x12d8b4,_0x331684);}}async['_connectService'](_0x4ad732){const {connection:_0x2508a6}=this['context']['plugins']['get'](c),_0x3347c2=this['context']['plugins']['get']('CommentsRepository'),_0x4fc6e0=this['_services']['get'](_0x4ad732),_0x2139e0=await _0x4fc6e0['connect'](_0x2508a6);await this['_fetchMissingUsersForThreads'](_0x2139e0);const _0x162206=new Set(Array['from'](_0x3347c2['getCommentThreads']({'channelId':_0x4ad732}),_0x21960e=>_0x21960e['id']));for(const _0x96374b of _0x2139e0)_0x96374b['deletedAt']||_0x162206['delete'](_0x96374b['commentThreadId']);for(const _0x1fe4f4 of _0x162206)_0x3347c2['getCommentThread'](_0x1fe4f4)['remove']({'isFromAdapter':!0x0});for(const _0x5cfb57 of _0x2139e0){let _0x1fa430=_0x3347c2['getCommentThread'](_0x5cfb57['commentThreadId']);const {commentThreadId:_0x1de89f,context:_0x132a21,attributes:_0x199415,resolvedBy:_0xd8f423,resolvedAt:_0x11b49f,unlinkedAt:_0x83d5d2,deletedAt:_0x58eb9c}=_0x5cfb57;if(_0x58eb9c)continue;_0x1fa430||(_0x1fa430=_0x3347c2['addCommentThread']({'channelId':_0x4ad732,'threadId':_0x1de89f,'context':_0x132a21,'attributes':_0x199415||{},'resolvedBy':_0xd8f423,'resolvedAt':_0x11b49f,'unlinkedAt':_0x83d5d2,'isFromAdapter':!0x0}));const _0x1b84a2=new Set(Array['from'](_0x1fa430['comments'],_0xfdf117=>_0xfdf117['id']));for(const _0x4ca0af of _0x5cfb57['comments'])_0x1b84a2['delete'](_0x4ca0af['commentId']);for(const _0x310fae of _0x1b84a2)_0x1fa430['getComment'](_0x310fae)['remove']({'isFromAdapter':!0x0});for(const _0x34f5f3 of _0x5cfb57['comments']){const _0x1d3256=_0x1fa430['getComment'](_0x34f5f3['commentId']);_0x1d3256?_0x1d3256['content']!==_0x34f5f3['content']&&_0x1d3256['update']({'content':_0x34f5f3['content'],'isFromAdapter':!0x0}):_0x1fa430['addComment'](Object['assign'](S(_0x34f5f3),{'isFromAdapter':!0x0}));}}}['_getService'](_0x2e61a4){if(!this['_services']['has'](_0x2e61a4))throw new _0x408616('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x2e61a4});return this['_services']['get'](_0x2e61a4);}async['_fetchMissingUsersForThreads'](_0x1fd44a){const _0x5e0b3e=this['context']['plugins']['get'](_0x4c3346),{connection:_0x1ebf38}=this['context']['plugins']['get'](c),_0x185cc1=new Set();for(const {resolvedBy:_0x4589a1,comments:_0x23f30d}of _0x1fd44a){_0x4589a1&&!_0x5e0b3e['getUser'](_0x4589a1)&&_0x185cc1['add'](_0x4589a1);for(const {userId:_0x35156b}of _0x23f30d)_0x5e0b3e['getUser'](_0x35156b)||_0x185cc1['add'](_0x35156b);}if(0x0===_0x185cc1['size'])return;const _0x5d1a00=await lt['getMany'](_0x1ebf38,Array['from'](_0x185cc1));for(const _0x4cf02d of _0x5d1a00)_0x5e0b3e['getUser'](_0x4cf02d['id'])||_0x5e0b3e['addUser'](_0x4cf02d);}}async function B(_0x3286db){if('404'!==_0x3286db['code'])throw _0x3286db;}function dt(_0x184926){if((_0x5b9c4b=_0x184926)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x5b9c4b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5b9c4b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x5b9c4b;throw _0x184926;}function S(_0x277c97){return{'threadId':_0x277c97['commentThreadId'],'commentId':_0x277c97['commentId'],'content':_0x277c97['content'],'createdAt':_0x277c97['createdAt'],'authorId':_0x277c97['userId'],'attributes':_0x277c97['attributes']||{}};}class f extends _0x50372a{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x3715b6)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[a,'TrackChangesEditing',c];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3cb4ca){super(_0x3cb4ca);const _0x2b33ec=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x2b33ec);}['init'](){const _0x57ead0=this['editor']['plugins']['get'](c),_0x4196c3=this['editor']['plugins']['get']('TrackChangesEditing');return _0x4196c3['adapter']={'getSuggestion':async _0x1a684f=>{await this['_waitForServiceReady']();const _0x43a307=await this['_trackChangesService']['get'](_0x1a684f)['catch'](R);return await this['_fetchMissingUsersForThreads']([_0x43a307]),_0x43a307;},'addSuggestion':async({id:_0x58c437,type:_0x4f5819,data:_0x54ca2a,originalSuggestionId:_0xc494f0,attributes:_0x8ee014})=>{await this['_waitForServiceReady']();const _0x47af8b={'id':_0x58c437,'type':_0x4f5819,'data':_0x54ca2a,'originalSuggestionId':_0xc494f0,'attributes':_0x8ee014},_0x4c4db2=await this['_trackChangesService']['add'](_0x58c437,_0x4f5819,_0x54ca2a,_0xc494f0,_0x8ee014)['catch'](_0x1839f5=>{if(ut(_0x1839f5))return new Promise(_0x56f2b7=>{this['_bufferedRequests']['set'](_0x58c437,{'resolve':_0x56f2b7,'suggestionData':_0x47af8b});});throw _0x1839f5;});return this['_bufferedRequests']['delete'](_0x58c437),_0x4c4db2;},'updateSuggestion':async(_0x144b0f,_0x1576a6)=>{if(await this['_waitForServiceReady'](),'open'!==_0x1576a6['state'])return this['_trackChangesService']['update'](_0x144b0f,_0x1576a6)['catch'](R);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x28feed,_0x227ee3)=>{_0x4196c3['hasSuggestion'](_0x227ee3['id'])&&(_0x4196c3['getSuggestion'](_0x227ee3['id'])['attributes']=_0x227ee3['attributes']);}),this['_trackChangesService']['connect'](_0x57ead0['connection'])['then'](_0x12b2d9=>(_0x57ead0['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x12b2d9)['then'](()=>{for(const _0x257c05 of _0x12b2d9){_0x4196c3['addSuggestionData'](_0x257c05)['_saved']=!0x0;}})));}async['reconnect'](){const _0x5c5dc6=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x5b5713}=this['editor']['plugins']['get'](c),_0x40f528=await this['_trackChangesService']['connect'](_0x5b5713);await this['_fetchMissingUsersForThreads'](_0x40f528);for(const {suggestionData:_0x378b65,resolve:_0x1e70cf}of this['_bufferedRequests']['values']()){let _0x2e17d0=_0x40f528['find'](_0x304bb4=>_0x304bb4['id']===_0x378b65['id']);_0x2e17d0||(_0x2e17d0=await this['_trackChangesService']['add'](_0x378b65['id'],_0x378b65['type'],_0x378b65['data'],_0x378b65['originalSuggestionId'])),_0x1e70cf(_0x2e17d0);}for(const _0x324c91 of _0x40f528)_0x5c5dc6['hasSuggestion'](_0x324c91['id'])||_0x5c5dc6['addSuggestionData'](_0x324c91);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x2d028d=>{this['listenTo'](this['_trackChangesService'],'connected',_0x204485=>{_0x204485['off'](),_0x2d028d();});});}async['_fetchMissingUsersForThreads'](_0x5b188e){const _0x2674f1=this['editor']['plugins']['get'](_0x4c3346),{connection:_0x61cae6}=this['editor']['plugins']['get'](c),_0x2b272d=new Set();for(const {authorId:_0x48da32}of _0x5b188e)_0x2674f1['getUser'](_0x48da32)||_0x2b272d['add'](_0x48da32);if(0x0===_0x2b272d['size'])return;const _0x4a246b=await lt['getMany'](_0x61cae6,Array['from'](_0x2b272d));for(const _0x4f7c56 of _0x4a246b)_0x2674f1['getUser'](_0x4f7c56['id'])||_0x2674f1['addUser'](_0x4f7c56);}}function R(_0x4f5f03){if(ut(_0x4f5f03))return new Promise(()=>{});throw _0x4f5f03;}function ut(_0x58c6f3){return _0x58c6f3['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x58c6f3['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x50372a{static get['requires'](){return['Comments',a,n,c];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x20557a=this['editor']['plugins']['get'](c),_0x2e9ba1=this['editor']['plugins']['get']('CommentsEditing'),_0x77c8b2=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x20557a,'change:state',(_0x1619fd,_0x32e1c4,_0x494523)=>{_0x2e9ba1['isThreadsLoadingPaused']='connected'!==_0x494523;});}),this['listenTo'](_0x20557a,'change:state',(_0x2ce699,_0x4e938d,_0x1409c4)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x1409c4);}),_0x77c8b2['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](a)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class p extends _0x50372a{static get['requires'](){return[m,f,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class u extends _0x50372a{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
28
- ((()=>_0x20d94b)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',i,_0x4c3346];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3335c3){super(_0x3335c3);const _0x17d594=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x17d594);}async['init'](){const _0x43e13b=this['editor']['plugins']['get'](l),_0x5945e0=_0x43e13b['serverHistory'],_0x265929=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x5945e0,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x43e13b['sessionId']});const _0x3f9524=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x362857=await _0x2f88e7['isBundleUploaded'](_0x265929['connection'],_0x3f9524);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x5681e9})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x5681e9)),'updateRevisions':async _0x5d4c73=>{await this['_waitForServiceReady']();const _0x1dd2b0=this['_revisionTracker']['currentRevision'];if(_0x362857&&0x1===_0x5d4c73['length']&&_0x5d4c73[0x0]['id']===_0x1dd2b0['id'])return _0x5d4c73;for(const _0x232fc6 of _0x5d4c73)_0x232fc6['id']===_0x1dd2b0['id']&&(_0x232fc6['isEmptyCurrent']=_0x232fc6['fromVersion']===_0x232fc6['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x5d4c73,this['_lastRequestId'])['then'](_0x2912b4=>(this['_lastRequestId']=_0x2912b4,_0x5d4c73))['catch'](_0xe13d99=>{if(U(_0xe13d99)||'400'===_0xe13d99['code']&&void 0x0!==_0xe13d99['data']['wrongRequestId']){for(const _0x52c7cc of _0x5d4c73){!this['_revisionTracker']['repository']['getRevision'](_0x52c7cc['id'])||this['_revisionTracker']['_bufferUpdate'](_0x52c7cc['id'],_0x52c7cc,!0x1);}if(U(_0xe13d99))throw _0xe13d99;return _0x5d4c73;}throw _0xe13d99;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x2c345a,{revisionsData:_0x2d8dca,requestId:_0x517b4f})=>{Math['max'](..._0x2d8dca['map'](_0x56cff7=>_0x56cff7['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x2d8dca,_0x517b4f);}):this['_handleRevisionsUpdate'](_0x2d8dca,_0x517b4f);});const {revisions:_0x4223b6,requestId:_0x3468ef}=await this['_revisionHistoryService']['connect'](_0x265929['connection']);_0x265929['addToReconnectionStack'](this),this['_lastRequestId']=_0x3468ef,await this['_fetchMissingUsers'](_0x4223b6);for(const _0x298f37 of _0x4223b6)this['_revisionTracker']['addRevisionData'](_0x298f37);this['listenTo'](_0x43e13b,'change:_isConnected',(_0x269e9b,_0x4297b7,_0x4fe7a2)=>{_0x4fe7a2&&(this['_oldOffset']=_0x43e13b['_offset'],_0x269e9b['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x265929,'state',_0x21d9c9=>_0x21d9c9===_0x39f1be['CONNECTED']);}async['reconnect'](){const _0x5d9f18=this['editor']['plugins']['get'](c),_0x58d57d=this['editor']['plugins']['get'](l),_0x18ef1a=async()=>{const _0x43ebe9=this['_revisionTracker']['currentRevision'],_0x1db6b1=_0x43ebe9['id'],_0x1090ec=_0x1db6b1!==_0x58d57d['sessionId'];if(_0x1090ec){const _0x4e5f4c=_0x58d57d['_offset']-this['_oldOffset'],_0x9c289f=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x43ebe9['toVersion']+_0x4e5f4c!==_0x9c289f){const _0x1039df=_0x43ebe9['fromVersion']+_0x4e5f4c,_0x25fc3d=this['editor']['plugins']['get'](_0x4c3346),_0x4fdab9=this['_revisionTracker']['buildRevisionData']({'revision':_0x43ebe9,'from':_0x1039df,'to':_0x9c289f});_0x4fdab9['id']=_0x43ebe9['id'];const _0x74d991=_0x4fdab9['authorsIds']['map'](_0x43f931=>_0x25fc3d['getUser'](_0x43f931));_0x43ebe9['_update']({..._0x4fdab9,'authors':_0x74d991},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x43ebe9['id'],_0x4fdab9,!0x0);}this['_revisionTracker']['_startingVersion']=_0x9c289f,(_0x43ebe9['toVersion']===_0x43ebe9['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x1db6b1)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x1db6b1),this['_revisionTracker']['_createCurrentRevision'](_0x9c289f));}const {revisions:_0x3ad5e8,requestId:_0xa9019d}=await this['_revisionHistoryService']['reconnect'](_0x5d9f18['connection'],this['_lastRequestId']);_0x1090ec&&_0x3ad5e8['length']>0x0?_0x58d57d['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x3ad5e8),this['_handleRevisionsUpdate'](_0x3ad5e8,_0xa9019d),this['_revisionTracker']['sendBufferedUpdates']());};return _0x58d57d['_isConnected']?_0x18ef1a():new Promise((_0x3f164b,_0x1cb8e6)=>{_0x58d57d['once']('change:_isConnected',()=>{_0x18ef1a()['then'](_0x3f164b)['catch'](_0x1cb8e6);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x25b7d7=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x589228=>{_0x589228['off'](),_0x25b7d7();});});}['_getLatestVersionFromServerOperations'](){const _0x346069=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x3d4f5d of _0x346069)if('marker'!==_0x3d4f5d['type']||_0x3d4f5d['affectsData'])return _0x3d4f5d['baseVersion']+0x1;}['_getLatestVersion'](){const _0x61d21a=this['editor']['plugins']['get'](l);return new Promise(_0x1a2d16=>{_0x61d21a['_isPendingUpdate']?_0x61d21a['once']('change:_isPendingUpdate',()=>{_0x1a2d16(this['_getLatestVersionFromServerOperations']());}):_0x1a2d16(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0xd9feed,_0x5b0bea){const _0x2ad339=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x5b0bea;for(const _0x1b89d5 of _0xd9feed){const _0x1bc378=_0x2ad339['getRevision'](_0x1b89d5['id']);if(_0x1bc378){if((_0x1b89d5['fromVersion']||_0x1b89d5['toVersion'])&&(_0x1b89d5['diffData']=null),_0x1bc378===this['_revisionTracker']['currentRevision']){const _0x2701f2=Math['max'](_0x1bc378['toVersion'],_0x1b89d5['toVersion']),_0x2f2c1b=Math['max'](_0x1bc378['fromVersion'],_0x1b89d5['fromVersion']);let _0xe21026;_0x1bc378['toVersion']===_0x1b89d5['toVersion']&&_0x1bc378['fromVersion']===_0x1b89d5['fromVersion']?(_0xe21026=!0x0,this['_preventResendingRevisionData'](_0x1b89d5)):_0x1b89d5['toVersion']===_0x2701f2&&_0x1b89d5['fromVersion']===_0x2f2c1b?_0xe21026=!0x1:(_0x1bc378['toVersion']===_0x2701f2&&_0x1bc378['fromVersion']===_0x2f2c1b||this['_fixRevision']({'revision':_0x1bc378,'from':_0x2f2c1b,'to':_0x2701f2}),_0xe21026=!0x0),_0xe21026&&(delete _0x1b89d5['fromVersion'],delete _0x1b89d5['toVersion'],delete _0x1b89d5['diffData'],delete _0x1b89d5['createdAt'],delete _0x1b89d5['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x1b89d5),this['_preventResendingRevisionData'](_0x1b89d5);}else this['_revisionTracker']['addRevisionData'](_0x1b89d5);}const _0x50ba41=_0x2ad339['getRevisions']();_0x50ba41['reverse']();for(let _0xa0c3ea=0x0;_0xa0c3ea<_0x50ba41['length']-0x1;_0xa0c3ea++){const _0x25a682=_0x50ba41[_0xa0c3ea],_0x53cd71=_0x50ba41[_0xa0c3ea+0x1];if(_0x25a682['fromVersion']<_0x53cd71['toVersion']){const _0x4c7f16=_0x53cd71['toVersion'],_0x2c4f94=Math['max'](_0x4c7f16,_0x25a682['toVersion']);this['_fixRevision']({'revision':_0x25a682,'from':_0x4c7f16,'to':_0x2c4f94});}}}['_fixRevision']({revision:_0x32e5d4,from:_0x45527e,to:_0x139e71}={}){const _0x4a7de3=this['editor']['plugins']['get'](_0x4c3346),_0x13b666=this['_revisionTracker']['buildRevisionData']({'revision':_0x32e5d4,'from':_0x45527e,'to':_0x139e71});_0x13b666['authors']=_0x13b666['authorsIds']['map'](_0xc619b4=>_0x4a7de3['getUser'](_0xc619b4)),_0x32e5d4['_update'](_0x13b666);}['_preventResendingRevisionData'](_0x5c159b){const _0x563f45={};_0x563f45['id']=_0x5c159b['id'];for(const _0x295536 of Object['keys'](_0x5c159b))'id'!==_0x295536&&(_0x563f45[_0x295536]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x563f45['id'],_0x563f45,!0x0);}async['_fetchMissingUsers'](_0x59feaf){const _0x19839e=this['editor']['plugins']['get'](_0x4c3346),{connection:_0x58bb33}=this['editor']['plugins']['get'](c),_0xabc583=new Set();for(const _0x24c934 of _0x59feaf){for(const _0x24e53d of _0x24c934['authorsIds'])_0x2733ce(_0x24e53d);_0x24c934['creatorId']&&_0x2733ce(_0x24c934['creatorId']);}if(0x0===_0xabc583['size'])return;const _0x812fff=await lt['getMany'](_0x58bb33,Array['from'](_0xabc583));for(const _0xa279e of _0x812fff)_0x19839e['getUser'](_0xa279e['id'])||_0x19839e['addUser'](_0xa279e);function _0x2733ce(_0x9d6c8){_0x19839e['getUser'](_0x9d6c8)||_0xabc583['add'](_0x9d6c8);}}}function U(_0x2f01d3){return _0x2f01d3['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2f01d3['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2f01d3['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x50372a{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class ts extends _0x32c1aa{constructor(_0x99282d){super(_0x99282d);const _0x2fe8f0=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0x2fe8f0['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0x2fe8f0['to']('usersCount',_0x4a947f=>Q(_0x99282d,'CONNECTED_USERS',_0x4a947f))}]});}}class es extends _0x32c1aa{['items'];['keystrokes'];constructor(_0x1c64a1){super(_0x1c64a1);const _0x5d62ec=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x60e8df(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x5d62ec['if']('hasPopup'),'aria-expanded':_0x5d62ec['to']('isExpanded',_0x1052d2=>this['hasPopup']&&String(_0x1052d2)),'aria-label':_0x5d62ec['to']('hasPopup',_0x41c488=>Q(_0x1c64a1,_0x41c488?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x5d62ec['to']('hasPopup',_0x1c1000=>!!_0x1c1000&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x5d62ec['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0x1b6c96,_0x41ee2a,_0x43d221)=>{this['element']&&(_0x43d221?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class L extends _0x32c1aa{['counterView'];['inlineListView'];constructor(_0xbb82cc){super(_0xbb82cc);const _0x4d6c23=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0xbb82cc),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5abe92 of this['inlineListView']['items'])_0x5abe92['tooltipPosition']='s';this['inlineListView']['items']['first']&&(this['inlineListView']['items']['first']['tooltipPosition']='se');}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list','ck-reset','ck-rounded-corners',_0x4d6c23['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class j extends _0x32c1aa{['listWrapperView'];constructor(_0x14c926,_0x3dbaeb){super(_0x14c926),this['listWrapperView']=new ft(_0x14c926,_0x3dbaeb),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':Q(_0x14c926,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class ft extends _0x5e215a{constructor(_0x53fe56,_0xeb3e12){super(_0x53fe56);const _0x523b94=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0xeb3e12?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x523b94['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x523b94['to']('role'),'aria-label':_0x523b94['to']('ariaLabel'),'aria-labelledby':_0x523b94['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x38475b['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x4d3c33=this['element'];_0x4d3c33&&(this['_isScrollable']=Math['max'](_0x4d3c33['scrollHeight'],_0x4d3c33['clientHeight'])>0.8*window['innerHeight']);}}class k extends et{['userView'];constructor(_0x45bab6,_0x46441e,_0x18ca97){super(_0x45bab6);const _0x2295c5=this['bindTemplate'];this['userView']=new rt(_0x45bab6,_0x46441e);const _0xda6f3b={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x46441e['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x46441e['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x46441e['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x18ca97&&(_0xda6f3b['tag']='button',_0xda6f3b['on']={'click':_0x2295c5['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0xda6f3b);}['focus'](){this['element']['focus']();}}class y extends _0x32c1aa{['userView'];['markerView'];constructor(_0x155632,_0x11163b,_0x168381){super(_0x155632);const _0x22b73f=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new rt(_0x155632,_0x11163b),this['markerView']=new ct(_0x155632,_0x11163b);const _0x3ad4bb=new ot(_0x155632);_0x3ad4bb['template']['tag']='span',_0x3ad4bb['text']=_0x11163b['name'];const _0x18c731={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x22b73f['to']('isFocusable',_0x595e2d=>!!_0x595e2d&&0x0),'aria-labelledby':_0x3ad4bb['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x22b73f['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x22b73f['to']('hasTooltip',_0x1625a1=>!_0x1625a1),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x3ad4bb]};_0x168381&&(_0x18c731['tag']='button',_0x18c731['on']={'click':_0x22b73f['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x18c731);}}class ct extends _0x32c1aa{constructor(_0x2acadf,_0x24c0fa){super(_0x2acadf),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x24c0fa['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const A={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x37a9d3{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x4cadb1){super(_0x4cadb1),this['context']['config']['define']('presenceList',A);const _0x31d572=_0x4cadb1['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x31d572)throw new _0x408616('presencelist-collapseat-invalid-format',this);if(_0x31d572<0x1)throw new _0x408616('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x5da562(),this['balloonPanelView']=new _0x4bb92d(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x448557 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x448557);this['listenTo'](this['_allConnectedUsers'],'add',(_0x2ae293,_0x1e748f)=>{this['_handleUserAdd'](_0x1e748f);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x277e3d,_0x77f534)=>{this['_handleUserRemove'](_0x77f534);});}['_createView'](){const _0x371173=this['context'],_0x2cc2c8=new L(this['context']['locale']),_0x48a799=this['balloonPanelView'];if(!_0x1667f2(_0x371173['config']['get']('presenceList.container')))throw new _0x408616('presencelist-missing-container',this);return _0x2cc2c8['counterView']['bind']('usersCount')['to'](this),_0x2cc2c8['bind']('isCollapsed')['to'](this,'usersCount',_0x405e63=>{const {collapseAt:_0x5e9170,displayMe:_0x262b17}=_0x371173['config']['get']('presenceList'),_0x49224c=_0x405e63>=_0x5e9170;return _0x2cc2c8['counterView']['isHidden']=!(0x1==_0x405e63&&_0x262b17||_0x49224c),_0x49224c||this['hideDropdown'](),_0x49224c;}),_0x2cc2c8['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x15db90=>{const _0x406c99=_0x371173['config']['get']('presenceList'),_0xbb6ed5=new y(_0x371173['locale'],_0x15db90,!!_0x406c99['onClick']);return _0xbb6ed5['bind']('hasTooltip')['to'](_0x2cc2c8,'isCollapsed',_0x175d65=>!_0x175d65),_0xbb6ed5['bind']('isFocusable')['to'](_0x2cc2c8,'isCollapsed',_0x5cd35f=>!_0x5cd35f),_0x406c99['onClick']&&this['listenTo'](_0xbb6ed5,'execute',()=>{this['view']['isCollapsed']||_0x406c99['onClick'](_0x15db90,_0xbb6ed5['element']);}),_0xbb6ed5;}),this['listenTo'](_0x2cc2c8['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0x2cc2c8['inlineListView']['keystrokes']['set']('Enter',(_0x24c4ab,_0x68243a)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x68243a());}),_0x2cc2c8['render'](),_0x48a799['render'](),_0x452c2f({'emitter':_0x2cc2c8,'activator':()=>_0x48a799['isVisible'],'contextElements':[_0x48a799['element'],_0x2cc2c8['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x371173['config']['get']('presenceList.container')['appendChild'](_0x2cc2c8['element']),this['_bodyCollection']=new _0x400f02(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x2cc2c8;}['_handleUserAdd'](_0x5923f6){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x5923f6['isMe'])return;const _0x234ce4=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0x234ce4&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0x353801=_0x5923f6['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x5923f6,_0x353801);}['_handleUserRemove'](_0x468634){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0x468634['id'])&&(this['currentDisplayedUsers']['remove'](_0x468634['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0x8b8a0c of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x8b8a0c['id']))return void this['currentDisplayedUsers']['add'](_0x8b8a0c,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x4ef9bb=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new j(this['context']['locale'],!!_0x4ef9bb['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x177eba}=this['presenceDropdownView'];_0x177eba['items']['bindTo'](this['_allConnectedUsers'])['using'](_0xcae3b8=>{if(!_0x4ef9bb['displayMe']&&_0xcae3b8['isMe'])return null;const _0x55639f=new k(this['context']['locale'],_0xcae3b8,!!_0x4ef9bb['onClick']);return _0x4ef9bb['onClick']&&this['listenTo'](_0x55639f,'execute',()=>{_0x4ef9bb['onClick'](_0xcae3b8,_0x55639f['element']);}),_0x55639f;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x177eba['focus'](),_0x177eba['checkIfScrollable']();const _0x559eae=(_0x4ecf5c,_0x1330db)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x1330db();};_0x177eba['keystrokes']['set']('Esc',_0x559eae),_0x177eba['keystrokes']['set']('Shift+Tab',_0x559eae),_0x177eba['keystrokes']['set']('Tab',(_0x23ba25,_0x41491c)=>{!function(_0x551708){const _0x29e028=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x5378fd=>_0x5378fd+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x39489a=[...document['body']['querySelectorAll'](_0x29e028)]['filter'](_0x2a626c=>_0x2a626c===document['activeElement']||_0x2a626c['offsetWidth']+_0x2a626c['offsetHeight']>0x0)['sort']((_0x32d156,_0x3f229b)=>(_0x32d156['tabIndex']||0x0)-(_0x3f229b['tabIndex']||0x0)),_0x10d74b=_0x39489a['indexOf'](_0x551708),_0xe0dc73=_0x39489a[(_0x10d74b+0x1)%_0x39489a['length']];_0xe0dc73&&_0xe0dc73['focus']();}(this['view']['element']),this['hideDropdown'](),_0x41491c();}),_0x177eba['focusTracker']['add'](this['view']['element']),_0x177eba['focusTracker']['on']('change:isFocused',(_0x1f614c,_0x5252ba,_0x16f62f)=>{_0x16f62f||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class s extends _0x37a9d3{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges};
23
+ import{ContextPlugin as _0x2570ba,Plugin as _0x348114,PendingActions as _0x4d25bd,Context as _0xd60d61}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x4c9d2a,CKEditorError as _0x2e3272,Collection as _0x1b4970,global as _0x23615d,version as nt,uid as _0x50f5fd,KeystrokeHandler as _0xd8aef6}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x39ca86,View as _0x3f9851,ListView as _0x3304c8,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x99933,clickOutsideHandler as _0x1b10bb,BodyCollection as _0x4dadbb}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ht,History as _0x12abdb,NoOperation as _0x3848dc,InsertOperation as _0x5e3fb9,MarkerOperation as _0x468189,RootAttributeOperation as _0x1fed11,transformSets as _0x2dd9b2,OperationFactory as _0x198c4d}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as lt,WEB_SOCKET_GATEWAY_STATES as _0x1b4187,CollaborativeEditingService as _0x478d92,User as dt,CommentsService as _0xa0ac43,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x1adc04,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x17f265}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x3f492d}from'lodash-es';class c extends _0x2570ba{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
24
+ ((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x39ca86];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3ca0db){super(_0x3ca0db),this['set']('state',_0x1b4187['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x4c9d2a);}['init'](){const _0x52aa42=this['context'],_0x248ce4=_0x52aa42['plugins']['get']('CloudServices'),_0x398282=_0x52aa42['plugins']['get'](_0x39ca86);if(!_0x248ce4['token'])throw new _0x2e3272('websocketgateway-missing-token',this);if(!_0x248ce4['webSocketUrl'])throw new _0x2e3272('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),c['WebSocketGateway']['connect'](_0x248ce4['token'],_0x248ce4['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x50143e=>{if(this['connection']=_0x50143e,this['bind']('state')['to'](_0x50143e,'state',this,'_isBrowserOffline',(_0x35e524,_0x198855)=>('connected'!==_0x35e524&&(this['_shouldPluginsReconnect']=!0x0),_0x198855||_0x35e524!==_0x1b4187['CONNECTED']?_0x1b4187['DISCONNECTED']:this['state']==_0x1b4187['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x1b4187['CONNECTING']):_0x1b4187['CONNECTED'])),this['connection']['on']('error',(_0xba2678,_0xa24497)=>{if('limitExceeded'!==_0xa24497['code'])throw console['error'](_0xa24497),new _0x2e3272('cloudservices-init',null,{'originalError':_0xa24497});_0x398282['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'});}),!_0x50143e['me'])return new Promise(_0x53b723=>_0x50143e['on']('change:me',_0x53b723));})['catch'](_0x5c8ee4=>{throw console['error'](_0x5c8ee4),new _0x2e3272('cloudservices-init',null,{'originalError':_0x5c8ee4});});}['addToReconnectionStack'](_0x4dca7c){if('function'!=typeof _0x4dca7c['reconnect'])throw new _0x2e3272('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x4dca7c))throw new _0x2e3272('websocketgateway-plugin-already-registered',this,{'name':_0x4dca7c['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x4dca7c);}['removeFromReconnectionStack'](_0x230c14){this['_reconnectionStack']['delete'](_0x230c14);}['isInReconnectionStack'](_0x2816d1){return this['_reconnectionStack']['has'](_0x2816d1);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x2f24de=>_0x2f24de['reconnect']())))['then'](()=>this['state']=_0x1b4187['CONNECTED'])['catch'](_0x3e2481=>{throw console['error'](_0x3e2481),new _0x2e3272('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x1b4187['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class i extends _0x2570ba{['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[c,_0x1adc04];}constructor(_0x2d1f90){super(_0x2d1f90),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x1b4970(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1adc04);}['init'](){const _0xd98c84=this['context']['plugins']['get'](c);this['listenTo'](_0xd98c84,'change:state',(_0x2152d8,_0x528d2c,_0x22baee)=>{if('connected'!==_0x22baee)this['channelSessions']['forEach'](_0x1d8f4a=>_0x1d8f4a['clear']()),this['channelConnectedUsers']['forEach'](_0x4994fb=>_0x4994fb['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x25318f,_0x38d542]of this['_registeredSessions'])for(const _0x7ac5b7 of _0x38d542)this['_handleSessionAdd'](_0x25318f,_0x7ac5b7);}}),this['_createUser'](_0xd98c84['connection']['me'],!0x0);}['register'](_0x193149,_0x41b3be){if(this['_registeredSessions']['has'](_0x193149))throw new _0x2e3272('sessions-register-already-registered',null,{'channelId':_0x193149});this['_registeredSessions']['set'](_0x193149,_0x41b3be),this['channelSessions']['set'](_0x193149,new _0x1b4970()),this['channelConnectedUsers']['set'](_0x193149,new _0x1b4970()),this['listenTo'](_0x41b3be,'add',(_0x54913b,_0x41f63f)=>this['_handleSessionAdd'](_0x193149,_0x41f63f)),this['listenTo'](_0x41b3be,'remove',(_0x3df78b,_0x1cc673)=>this['_handleSessionRemove'](_0x193149,_0x1cc673));for(const _0x1e324e of _0x41b3be)this['_handleSessionAdd'](_0x193149,_0x1e324e);}['unregister'](_0xb876fd){if(!this['_registeredSessions']['has'](_0xb876fd))throw new _0x2e3272('sessions-unregister-not-exist',null,{'channelId':_0xb876fd});const _0x3c024d=this['_registeredSessions']['get'](_0xb876fd);this['stopListening'](_0x3c024d);for(const _0x51ce93 of _0x3c024d)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0xb876fd,_0x51ce93);this['_registeredSessions']['delete'](_0xb876fd),this['channelSessions']['delete'](_0xb876fd),this['channelConnectedUsers']['delete'](_0xb876fd);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x3e69f2){for(const _0xbab6b1 of this['channelSessions']['values']())for(const _0x38851f of _0xbab6b1)if(_0x38851f['id']===_0x3e69f2)return _0x38851f['user'];}['getUserSessions'](_0x18aa6e,_0x210174){const _0x13ed4c=_0x210174?[this['channelSessions']['get'](_0x210174)]:this['channelSessions']['values'](),_0x44e8f7=new Set();for(const _0xaceb5c of _0x13ed4c)for(const _0x1d6282 of _0xaceb5c)_0x1d6282['user']['id']===_0x18aa6e['id']&&_0x44e8f7['add'](_0x1d6282['id']);return _0x44e8f7;}['getUserRole'](_0x22356e){for(const _0x240eaa of this['channelSessions']['values']())for(const _0x1fb728 of _0x240eaa)if(_0x1fb728['user']===_0x22356e)return _0x1fb728['role'];}['_handleSessionAdd'](_0x2f2aa7,_0x2c586e){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x241cda=_0x2c586e['user'],_0x19a6dc=this['_users']['getUser'](_0x241cda['id'])||this['_createUser'](_0x241cda),_0x55c0a8=Object['assign']({},_0x2c586e,{'user':_0x19a6dc});this['channelSessions']['get'](_0x2f2aa7)['add'](_0x55c0a8);const _0x113cdd=this['channelConnectedUsers']['get'](_0x2f2aa7);_0x113cdd['has'](_0x19a6dc['id'])||_0x113cdd['add'](_0x19a6dc),this['allConnectedUsers']['has'](_0x19a6dc['id'])||this['allConnectedUsers']['add'](_0x19a6dc,_0x19a6dc['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x2f2aa7,{'channelId':_0x2f2aa7,'session':_0x55c0a8});}['_handleSessionRemove'](_0x35411d,_0x4c4188){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x441e57=this['channelConnectedUsers']['get'](_0x35411d),_0x5e5a0c=_0x4c4188['user'];_0x5e5a0c['id']&&(this['channelSessions']['get'](_0x35411d)['remove'](_0x4c4188['id']),_0x441e57['has'](_0x5e5a0c['id'])&&!this['getUserSessions'](_0x5e5a0c,_0x35411d)['size']&&_0x441e57['remove'](_0x5e5a0c['id']),this['allConnectedUsers']['get'](_0x5e5a0c['id'])&&!this['getUserSessions'](_0x5e5a0c)['size']&&this['allConnectedUsers']['remove'](_0x5e5a0c['id']));}['_createUser'](_0x128aa1,_0x185496){const _0x5b82de=this['_users']['addUser'](_0x128aa1);return _0x185496&&this['_users']['defineMe'](_0x128aa1['id']),_0x5b82de['orderNumber']=this['_uniqueUsersCount']++,_0x5b82de;}}class H extends _0x348114{['_domEmitter']=new(_0x4c9d2a())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3992e8=this['editor'],_0x135ebf=_0x3992e8['plugins']['get'](i);_0x3992e8['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x3de16d,{writer:_0x5d7eec})=>function(_0x573370,_0xfc431f,_0x1b378d,_0x2f94a9){const _0x1c6012=_0x573370['markerName']['split'](':')[0x2],_0x52df54=_0x1b378d['getUserBySessionId'](_0x1c6012);if(!_0x52df54||_0x1c6012===_0x1b378d['mySessionId'])return;if(!_0x2f94a9['model']['schema']['checkChild'](_0x573370['markerRange']['start'],'$text'))return;const _0x590d57={'class':'ck-user__marker\x20'+_0x52df54['color']['getMarkerClass'](),'data-name':_0x52df54['name'],'data-session-id':_0x1c6012},_0x580b96=_0x2f94a9['model']['markers']['get'](_0x573370['markerName']),_0x9c78a6=_0x580b96['getStart'](),_0x281d90=_0x9c78a6['nodeAfter'],_0x559ad1=_0x2f94a9['model']['schema'];if(_0x281d90&&_0x559ad1['isObject'](_0x281d90)&&_0x559ad1['isInline'](_0x281d90)&&!_0x2f94a9['model']['markers']['get']('user:range:'+_0x1c6012)['getRange']()['isCollapsed'])return;const _0x34b9d2=_0x9c78a6['parent'];return _0x2f94a9['model']['schema']['isLimit'](_0x34b9d2)&&!_0x2f94a9['model']['hasContent'](_0x34b9d2)&&(_0x590d57['contenteditable']=!0x1),function(_0x15f31a,_0xa89c9c,_0x527cbb){const _0x52b845=_0x15f31a['createUIElement']('span',_0xa89c9c);return _0x15f31a['setCustomProperty']('userPositionMarker',!0x0,_0x52b845),_0x52b845['render']=function(_0xafe3cf){const _0x3c5482=this['toDomElement'](_0xafe3cf);return _0x3c5482['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span><span\x20class=\x22ck-user__marker-tooltip\x22\x20contenteditable=\x22false\x22\x20spellcheck=\x22false\x22>'+_0x527cbb['name']+'</span>⁠',_0x3c5482['addEventListener']('mouseenter',()=>{_0x3c5482['classList']['add']('ck-user__marker_hovered');}),_0x3c5482['addEventListener']('mouseleave',()=>{_0x3c5482['classList']['remove']('ck-user__marker_hovered');}),_0x3c5482;},_0x52b845['isSimilar']=function(_0x4372c6){return!(!this['getCustomProperty']('userPositionMarker')||!_0x4372c6['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x4372c6['getAttribute']('data-session-id'));},_0x52b845;}(_0xfc431f,_0x590d57,_0x52df54);}(_0x3de16d,_0x5d7eec,_0x135ebf,_0x3992e8)}),_0x3992e8['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4f05aa=>function(_0x36403f,_0x18f93a){const _0xae48ad=_0x36403f['markerName']['split'](':')[0x2];if(_0xae48ad===_0x18f93a['mySessionId'])return null;const _0x3df567=_0x18f93a['getUserBySessionId'](_0xae48ad);if(!_0x3df567)return{'id':_0xae48ad,'classes':[]};return{'id':_0xae48ad,'classes':['ck-user__selection',_0x3df567['color']['getSelectionClass']()],'attributes':{'data-session-id':_0xae48ad},'priority':0x7d0+_0x3df567['orderNumber']};}(_0x4f05aa,_0x135ebf)}),function(_0x53ad44){const _0x359ba4=_0x53ad44['model'],_0x594e02=new Map(),_0x4ee20b=_0x53ad44['plugins']['get'](i);_0x359ba4['markers']['on']('update:user:range',(_0x3817a9,_0x43068d,_0x54e8c0,_0xf3cc66)=>{if(!_0xf3cc66&&_0x594e02['get'](_0x43068d['name']))return _0x594e02['get'](_0x43068d['name'])['detach'](),void _0x594e02['delete'](_0x43068d['name']);const _0x4c03e4=_0x43068d['name']['split'](':')[0x2];if(_0x4c03e4===_0x4ee20b['mySessionId'])return;const _0x1bb72e='user:position:'+_0x4c03e4;_0x359ba4['markers']['has'](_0x1bb72e)&&_0x53ad44['editing']['reconvertMarker'](_0x1bb72e),_0x43068d['on']('change:range',(_0x5282fc,_0x262784,_0x3c433d)=>{if('$graveyard'!=_0x262784['root']['rootName']&&'$graveyard'==_0x43068d['getRange']()['root']['rootName']&&!_0x594e02['has'](_0x43068d['name'])){const _0x236b83=_0x359ba4['schema']['getNearestSelectionRange'](_0x3c433d['deletionPosition']);if(_0x236b83){const _0x595d01=ht['fromRange'](_0x236b83);_0x594e02['set'](_0x43068d['name'],_0x595d01),_0x595d01['on']('change:range',(_0x51326c,_0x48a0a1,_0x31158a)=>{if('$graveyard'==_0x595d01['root']['rootName']){const _0x43bb0a=_0x359ba4['schema']['getNearestSelectionRange'](_0x31158a['deletionPosition']);_0x43bb0a?(_0x595d01['start']=_0x43bb0a['start'],_0x595d01['end']=_0x43bb0a['end']):(_0x594e02['delete'](_0x43068d['name']),_0x595d01['detach']());}});}}});}),_0x359ba4['document']['on']('change',()=>{_0x594e02['size']>0x0&&_0x359ba4['enqueueChange']({'isUndoable':!0x1},_0x2b17b4=>{for(const [_0x579ac4,_0x46999f]of _0x594e02)'$graveyard'==_0x359ba4['markers']['get'](_0x579ac4)['getRange']()['root']['rootName']&&(re(_0x579ac4['split'](':')[0x2],_0x46999f['toRange'](),_0x359ba4,_0x2b17b4),_0x46999f['detach']());_0x594e02['clear']();});});}(_0x3992e8),this['_domEmitter']['listenTo'](_0x23615d['document'],'keydown',(_0x557bec,{key:_0x98adc7})=>{'Escape'===_0x98adc7&&function(_0x46108a){_0x46108a['editing']['view']['change'](_0x4659f3=>{for(const _0x1c085b of _0x46108a['model']['markers']){if(!_0x1c085b['name']['startsWith']('user:position'))continue;const _0x37f231=_0x46108a['editing']['mapper']['markerNameToElements'](_0x1c085b['name']);if(_0x37f231){for(const _0x18e10f of _0x37f231)_0x4659f3['removeClass']('ck-user__marker_hovered',_0x18e10f);}}});}(_0x3992e8);},{'useCapture':!0x0});}['afterInit'](){const _0x593867=this['editor'],_0x3d4cff=_0x593867['commands']['get']('undo');_0x3d4cff&&_0x593867['model']['on']('applyOperation',(_0x35f639,_0x144741)=>{const _0x31cdf7=_0x144741[0x0];if('marker'!=_0x31cdf7['type']||!_0x31cdf7['name']['startsWith']('user:'))return;const _0x746e=_0x31cdf7['batch'];_0x3d4cff['_createdBatches']['has'](_0x746e)&&(_0x31cdf7['newRange']=_0x31cdf7['oldRange']?_0x593867['model']['createRange'](_0x31cdf7['oldRange']['start'],_0x31cdf7['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x4409c0=this['editor'],_0x49d2a3=_0x4409c0['model']['document'],_0xd1d0e2=_0x4409c0['plugins']['get'](i);_0x4409c0['model']['enqueueChange']({'isUndoable':!0x1},_0x1615f6=>{const _0x3db767='user:range:'+_0xd1d0e2['mySessionId'],_0x4762ae='user:position:'+_0xd1d0e2['mySessionId'],_0x437d89=_0x4409c0['model']['markers']['has'](_0x3db767);_0x4409c0['editing']['view']['hasDomSelection']?re(_0xd1d0e2['mySessionId'],_0x49d2a3['selection']['getFirstRange'](),_0x4409c0['model'],_0x1615f6):_0x437d89&&(_0x1615f6['removeMarker'](_0x3db767),_0x1615f6['removeMarker'](_0x4762ae));});}}function re(_0x2b1549,_0xf20440,_0x214868,_0x21dd28){const _0x2ef6df='user:range:'+_0x2b1549,_0x2dc874='user:position:'+_0x2b1549,_0xdd548f=_0xf20440['getContainedElement']();let _0x2b3ffe=_0xf20440['start'];_0xdd548f&&_0xdd548f['is']('element','tableCell')&&(_0x2b3ffe=function(_0x14a6d9,_0x364180){for(const _0x450668 of _0x14a6d9['getPositions']())if(_0x364180['schema']['checkChild'](_0x450668,'$text'))return _0x450668;}(_0xf20440,_0x214868),_0xf20440=_0x21dd28['createRange'](_0x2b3ffe));const _0x583efc=_0x21dd28['createRange'](_0x2b3ffe);_0x214868['markers']['has'](_0x2ef6df)?(_0x21dd28['updateMarker'](_0x2ef6df,{'range':_0xf20440}),_0x21dd28['updateMarker'](_0x2dc874,{'range':_0x583efc})):(_0x21dd28['addMarker'](_0x2ef6df,{'range':_0xf20440,'usingOperation':!0x0}),_0x21dd28['addMarker'](_0x2dc874,{'range':_0x583efc,'usingOperation':!0x0}));}function q(_0x37c31b,_0x503dec,_0x33f9fc){const _0x555433=_0x37c31b['t'],t=_0x37c31b['t'];switch(_0x503dec){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 _0x555433({'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'},_0x33f9fc);default:return'';}}let K=0x1;class l extends _0x348114{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x478d92)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,H,_0x4d25bd,_0x1adc04,_0x39ca86];}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 _0x5dc52f=this['serverHistory']['getOperations']();for(let _0x13a924=_0x5dc52f['length']-0x1;_0x13a924>=0x0;_0x13a924--){const _0x51c414=_0x5dc52f[_0x13a924];if(!this['_disconnectionOperations']['has'](_0x51c414))return _0x51c414['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x23af4a){if(super(_0x23af4a),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x12abdb(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x2e3272('collaboration-missing-channelid',this);const _0x12e2c1=_0x23af4a['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x12e2c1,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x17f265(),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 _0x1a777a=this['editor'],_0x287733=_0x1a777a['plugins']['get'](_0x1adc04),_0x2c0485=_0x1a777a['plugins']['get'](c);this['listenTo'](_0x287733,'getOperationAuthor',(_0x1de7e8,_0xa094d3)=>{const _0x558837=_0xa094d3[0x0];_0x558837['_authorId']&&(_0x1de7e8['return']=_0x287733['getUser'](_0x558837['_authorId']),_0x1de7e8['stop']()),null===_0x558837['_authorId']&&(_0x1de7e8['return']=null,_0x1de7e8['stop']());},{'priority':'high'}),this['listenTo'](_0x1a777a['model']['document']['selection'],'change:range',(_0x116f29,_0x780832)=>{_0x780832['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x1a777a['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x1a777a['model']['on']('applyOperation',(_0x1b975c,_0x449ca3)=>{const _0x2156f2=_0x449ca3[0x0];_0x2156f2['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x2156f2),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x2c0485,'state',this,'_hasSynchronizationProblem',(_0x360592,_0x4cddd9)=>'connected'===_0x360592&&!_0x4cddd9),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x1a777a['disableReadOnlyMode']('rtc-offline'):_0x1a777a['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x1a777a['disableReadOnlyMode']('rtc-offline'):_0x1a777a['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x40003e=this['editor']['plugins']['get'](i),_0x380cda=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x40003e['unregister'](this['_channelId']);const _0x12456a=await this['_service']['reconnect'](_0x380cda['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x12456a)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x853314=await this['_service']['getConnectedSessions']();_0x40003e['register'](this['_channelId'],_0x853314),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x535765){if(function(_0x597d90){return'404'===_0x597d90['code'];}(_0x535765)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x452761){return'409'===_0x452761['code'];}(_0x535765)){const _0x3c449c=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'](_0x3c449c);}else{if(!(_0x535765 instanceof J))throw _0x535765;this['_handleReconnectionError']();}}}}['destroy'](){const _0x18d280=this['editor']['plugins']['get'](c),_0xd40ace=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0xd40ace['channelSessions']['has'](this['_channelId'])&&_0xd40ace['unregister'](this['_channelId']),_0x18d280['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x11c50c){if(this['sessionId']!==_0x11c50c['sessionId']&&this['_lastSyncedOperationId']!==_0x11c50c['lastOperationId'])throw new J();return this['sessionId']=_0x11c50c['sessionId'],this['_handleServerResponse']([],{..._0x11c50c,'wereChangesApplied':!0x1,'data':_0x11c50c['data']},'reconnect');}async['_connectService'](_0x5a26ff,_0x4586ce=!0x1){const {connection:_0x1f9643}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x1f9643,this['_channelId'])['then'](_0x407831=>this['_initSessionsHandling'](_0x407831))['catch'](_0x56fab2=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x56fab2);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x419bfc,_0x3e2e37)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x3e2e37);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x3b3186=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x5a26ff);this['_isPendingUpdate']=!0x0;const _0x49a34c=await this['_service']['connect'](_0x1f9643,this['_compressOperations'](_0x5a26ff),_0x3b3186);if(this['sessionId']=_0x49a34c['sessionId'],_0x4586ce){if(!_0x49a34c['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x49a34c['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x5a26ff,_0x49a34c,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x49a34c,_0x5a26ff);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x3da62a=this['editor']['plugins']['get'](i),_0x35abaf=this['editor']['plugins']['get'](H),_0x57c019=_0x3da62a['channelSessions']['get'](this['_channelId']);_0x57c019&&_0x57c019['length']>0x1?_0x35abaf['createUserMarkerOperations']():this['listenTo'](_0x3da62a,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x3da62a['channelSessions']['get'](this['_channelId'])['length']&&_0x35abaf['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x4b6256,_0x1cc85f,_0x615ada,_0x19aeaf){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1cc85f){const _0x4eeec8=this['_decompressOperations'](_0x615ada,_0x19aeaf);await this['_fetchMissingUsers'](_0x4eeec8),this['_handleExternalOperations'](_0x4eeec8,_0x1cc85f,_0x615ada['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x2c83fa}=this['editor'];let _0xb5d03b;try{_0xb5d03b=await this['_service']['getDocumentDetails']();}catch(_0x558a3e){const _0x5a622e=q(_0x2c83fa,'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'](_0x5a622e);}const _0x579678=_0xb5d03b['currentDocumentSession']||_0xb5d03b['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x579678['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x415392=q(_0x2c83fa,'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.');this['_handleReconnectionError'](_0x415392);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x7bbce5){const _0x12872d=this['editor']['plugins']['get'](i);this['listenTo'](_0x12872d,'sessionAdd:'+this['_channelId'],(_0x4c016f,{session:_0x32f1d7})=>{if(_0x32f1d7['id']===_0x12872d['mySessionId']){_0x4c016f['off']();const _0x2ff757=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x1f0423=_0x32f1d7['permissions'];_0x2ff757&&_0x2ff757['isEnabled']&&(_0x1f0423=_0x1f0423['filter'](_0x3845b3=>'document:write'!==_0x3845b3)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x1f0423,this['_channelId']);}}),_0x12872d['register'](this['_channelId'],_0x7bbce5);}['_initThrowingOnDataSet'](){const _0x478ce1=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x2a89d3)=>{if(!_0x2a89d3[_0x2a89d3['length']-0x1]['suppressErrorInCollaboration'])throw new _0x2e3272('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x478ce1['apply'](this['editor']['data'],_0x2a89d3);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x1d9782,[_0x596fc4])=>{if(this['_document']['version'])throw new _0x2e3272('realtimecollaborationclient-init-document-already-initialized',this);_0x1d9782['stop'](),this['_setPendingAction']();const _0x308098=this['editor']['config']['get']('rootsAttributes'),_0x42832e=this['_getOperationsFromInitData'](_0x596fc4,_0x308098);0x0==_0x42832e['length']&&_0x42832e['push'](new _0x3848dc(0x0)),_0x1d9782['return']=this['_connectService'](_0x42832e)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x55ee3c=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x55ee3c))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2d76aa,[_0x836075,_0x52909b])=>{_0x2d76aa['stop']();const _0x27d7eb=this['editor']['model']['document']['getRoot'](_0x836075);if(!this['_knownRootNames']['has'](_0x836075)){const _0xd074d9=_0x52909b&&_0x52909b['data']?_0x52909b['data']:'',_0x24182c=_0x52909b&&_0x52909b['attributes']?_0x52909b['attributes']:{};await this['_loadRoot'](_0x836075,_0xd074d9,_0x24182c);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x27d7eb['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x27d7eb);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x4b7e40){const _0x1bbcdb=this['editor']['plugins']['get'](_0x1adc04),{connection:_0x5ac9ef}=this['editor']['plugins']['get'](c),_0x5dc107=new Set();for(const _0x5dba26 of _0x4b7e40){const _0x2c9080=_0x5dba26['_authorId'];_0x2c9080&&!_0x1bbcdb['getUser'](_0x2c9080)&&_0x5dc107['add'](_0x2c9080);}if(0x0===_0x5dc107['size'])return;const _0x33e835=await dt['getMany'](_0x5ac9ef,Array['from'](_0x5dc107));for(const _0x564daa of _0x33e835)_0x1bbcdb['getUser'](_0x564daa['id'])||_0x1bbcdb['addUser'](_0x564daa);}['_getOperationsFromInitData'](_0x4c6981,_0x2040f7={}){const _0x184192=this['editor']['model'],_0x7cf1d4=[];let _0x12bca5=0x0;const _0x58cf5='string'==typeof _0x4c6981?{'main':_0x4c6981}:_0x4c6981;for(const _0x9ce8c2 of Object['keys'](_0x58cf5)){if(!this['_document']['roots']['has'](_0x9ce8c2))throw new _0x2e3272('realtimecollaborationclient-init-non-existent-root',this);const _0x42094f=this['editor']['data']['parse'](_0x58cf5[_0x9ce8c2]),_0x29e02b=this['_document']['getRoot'](_0x9ce8c2),_0x4940c2=new _0x5e3fb9(_0x184192['createPositionAt'](_0x29e02b,0x0),_0x42094f,_0x12bca5++);_0x7cf1d4['push'](_0x4940c2);for(const [_0x5c8ecf,_0x268296]of _0x42094f['markers']){const _0x45ff2f=_0x184192['createRange'](_0x184192['createPositionFromPath'](_0x29e02b,_0x268296['start']['path']['slice']()),_0x184192['createPositionFromPath'](_0x29e02b,_0x268296['end']['path']['slice']())),_0x47b7c2=new _0x468189(_0x5c8ecf,null,_0x45ff2f,_0x184192['markers'],!0x0,_0x12bca5++);_0x7cf1d4['push'](_0x47b7c2);}}if(_0x2040f7)for(const [_0x597b66,_0x57aa8f]of Object['entries'](_0x2040f7)){const _0x3efe5f=_0x184192['document']['getRoot'](_0x597b66);if(!_0x3efe5f)throw new _0x2e3272('multi-root-editor-root-attributes-no-root',null);for(const [_0x1c9ce9,_0x154219]of Object['entries'](_0x57aa8f))if(null!==_0x154219){const _0x2a4965=new _0x1fed11(_0x3efe5f,_0x1c9ce9,null,_0x154219,_0x12bca5++);_0x7cf1d4['push'](_0x2a4965);}}return _0x7cf1d4;}async['_loadRoot'](_0x3edb96,_0x4cb640,_0x30d4d7){this['_getOperationsFromInitData']({[_0x3edb96]:_0x4cb640},{[_0x3edb96]:_0x30d4d7})['forEach']((_0xdc1f6a,_0x3b4183)=>{_0xdc1f6a['baseVersion']=this['_document']['version']+_0x3b4183,_0xdc1f6a['_isInit']=!0x0,this['_saveOperationInBuffer'](_0xdc1f6a);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x30f104,_0x594ab6){let _0x27971a;this['_offset']=_0x30f104['offset'];const _0x200d22=_0x30f104['wereChangesApplied']&&!_0x30f104['initData'],_0x48543c=_0x200d22?0x0:_0x30f104['data']['baseVersion'];if(_0x594ab6['forEach'](_0x19d891=>{_0x19d891['_isInit']=!0x0,_0x19d891['createdAt']=_0x30f104['sessionCreatedAt'],_0x19d891['_authorId']=null;}),_0x200d22)_0x27971a=_0x594ab6,this['_applyOperationsSet'](_0x27971a,_0x200d22);else{if(_0x30f104['initData']){const _0x3ef415=this['_getOperationsFromInitData'](_0x30f104['initData']);this['_document']['history']['version']=-_0x3ef415['length'],_0x3ef415['forEach'](_0x3710f9=>{_0x3710f9['baseVersion']-=_0x3ef415['length'],_0x3710f9['createdAt']=_0x30f104['sessionCreatedAt'],_0x3710f9['_isInit']=!0x0,_0x3710f9['_authorId']=null;}),this['_applyOperationsSet'](_0x3ef415,!0x0),this['serverHistory']['version']=-_0x3ef415['length']+this['_offset'],this['_updateServerHistory'](_0x3ef415);}this['_document']['history']['version']=_0x48543c,_0x27971a=this['_decompressOperations'](_0x30f104['data'],_0x30f104['metadata']),await this['_fetchMissingUsers'](_0x27971a),this['_applyOperationsSet'](_0x27971a,_0x200d22);}_0x30f104['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x27971a,_0x30f104['lastOperationId']),this['_lastSyncedOperationId']=_0x30f104['lastOperationId']),this['serverHistory']['version']=_0x48543c+this['_offset'],this['_updateServerHistory'](_0x27971a),_0x594ab6['filter'](_0x5c3064=>{const _0x3b63ae=this['_getAffectedRoot'](_0x5c3064);return _0x3b63ae&&!this['_knownRootNames']['has'](_0x3b63ae);})['forEach']((_0xa40cd0,_0x37d7be)=>{_0xa40cd0['baseVersion']=this['_document']['version']+_0x37d7be,this['_saveOperationInBuffer'](_0xa40cd0);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x325cf8,_0x2151d8,_0x3c0bf6){throw this['_isPendingUpdate']=!0x0,_0x2151d8&&console['error'](_0x2151d8),_0x3c0bf6&&this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x2e3272(_0x325cf8,this['editor']);}['_saveOperationInBuffer'](_0x5a8a83){this['_knownOperations']['has'](_0x5a8a83)||(this['_knownOperations']['add'](_0x5a8a83),this['_bufferedOperations']['push'](_0x5a8a83),this['_pendingAction']||'marker'==_0x5a8a83['type']&&!_0x5a8a83['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x241dff=!0x1){!_0x241dff&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x84bb47=>{_0x84bb47&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x6ee949=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x53fb48){return _0x53fb48['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x53fb48['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x53fb48['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x6ee949)||this['_crash'](_0x6ee949['message'],_0x6ee949,!0x0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x5f1125=>{this['on']('change:_isPendingUpdate',()=>{_0x5f1125();});});}async['_sendBufferedOperations'](){const _0x5f52f2=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x5f52f2['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x17815e=[...this['_bufferedOperations']];for(const _0x1b25a1 of _0x17815e)_0x1b25a1['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x1b25a1);const _0x4fc879=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x17815e),_0x38ec32=K++,_0x11bb73=this['_compressOperations'](_0x17815e),_0x2b1ca5=await this['_service']['sendOperations'](_0x11bb73,_0x11bb73['baseVersion'],_0x4fc879);try{return await this['_handleServerResponse'](_0x17815e,_0x2b1ca5,_0x38ec32);}catch(_0x9756ff){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x9756ff);}}async['_handleServerResponse'](_0x55f852,_0x7c171a,_0x143d06){if('error'in _0x7c171a)throw _0x7c171a['error'];let _0x276a3a=!0x1;if(_0x7c171a['wereChangesApplied']){_0x7c171a['lastOperationId']&&(this['_lastSyncedOperationId']=_0x7c171a['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x294262=>!_0x55f852['includes'](_0x294262));for(const _0x866acb of _0x55f852)_0x866acb['createdAt']='lastOperationAcceptedAt'in _0x7c171a&&_0x7c171a['lastOperationAcceptedAt']||void 0x0;Q(_0x55f852,_0x7c171a['version']-_0x55f852['length']),this['_updateServerHistory'](_0x55f852);const _0x1fbddb=_0x55f852['filter'](_0x434693=>{if(!_0x434693['_isInit'])return!0x1;const _0x261e1e=this['_getAffectedRoot'](_0x434693);return _0x261e1e&&!this['_knownRootNames']['has'](_0x261e1e);});Q(_0x1fbddb,this['_document']['version']),this['_applyOperationsSet'](_0x1fbddb),_0x276a3a=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x2ab3e9=this['_decompressOperations'](_0x7c171a['data'],_0x7c171a['metadata'])['filter'](_0x1a8c77=>_0x1a8c77['baseVersion']>=this['_lastServerVersion']);_0x2ab3e9['forEach'](_0x180b24=>this['_addKnownRoot'](_0x180b24)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1e318e=>!_0x1e318e['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x1e318e))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x2ab3e9),_0x276a3a=this['_handleExternalOperations'](_0x2ab3e9,_0x7c171a['version'],_0x7c171a['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x276a3a?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x5eb1e1,_0x1f1e46,_0x26e55b){try{const _0x447766={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x17d0f3,operationsB:_0x3b3811,originalOperations:_0x538c71}=_0x2dd9b2(_0x5eb1e1,this['_bufferedOperations'],_0x447766);Q(_0x17d0f3,this['_document']['version']),Q(_0x3b3811,_0x1f1e46);for(const _0x344949 of _0x17d0f3){const _0x1383c2=_0x538c71['get'](_0x344949);_0x344949['_authorId']=_0x1383c2?_0x1383c2['_authorId']:null;}_0x26e55b&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5eb1e1,_0x26e55b),this['_lastSyncedOperationId']=_0x26e55b),this['_bufferedOperations']=[..._0x3b3811],this['_applyOperationsSet'](_0x17d0f3),this['_updateServerHistory'](_0x5eb1e1);}catch(_0x42f656){return console['error'](_0x42f656),!0x1;}return!0x0;}['_applyOperationsSet'](_0x1b5d74,_0x259a6c=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0xa7f78d=>{for(const _0x510531 of _0x1b5d74)this['_knownOperations']['add'](_0x510531),this['_addKnownRoot'](_0x510531),_0xa7f78d['batch']['addOperation'](_0x510531),this['editor']['model']['applyOperation'](_0x510531);});}['_addKnownRoot'](_0x4affea){const _0x2fc6c7=this['_getAffectedRoot'](_0x4affea);_0x2fc6c7&&this['_knownRootNames']['add'](_0x2fc6c7);}['_getAffectedRoot'](_0x661f9b){let _0x56e307,_0x4eeda8;switch(_0x661f9b['type']){case'insert':_0x56e307=_0x661f9b['position']['root'];break;case'marker':if(_0x4eeda8=_0x661f9b['newRange'],!_0x4eeda8)return null;_0x56e307=_0x4eeda8['root'];break;case'addRootAttribute':_0x56e307=_0x661f9b['root'];break;case'addRoot':_0x56e307=_0x661f9b['affectedSelectable'];break;case'move':_0x56e307=_0x661f9b['targetPosition']['root'];break;default:return null;}return _0x56e307['rootName'];}['_updateServerHistory'](_0x53fa0c){_0x53fa0c['forEach'](_0x122a57=>{const _0x25d0d8=_0x122a57['clone']();_0x25d0d8['_authorId']=_0x122a57['_authorId'],_0x25d0d8['_isInit']=!!_0x122a57['_isInit'],_0x25d0d8['createdAt']=_0x122a57['createdAt'],_0x25d0d8['baseVersion']+=this['_offset'],_0x122a57['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x25d0d8),this['serverHistory']['addOperation'](_0x25d0d8);});}['_handleReconnectionError'](_0x465f16){const _0x58740f=this['editor']['plugins']['get']('Notification'),_0x1f6fd9=this['editor']['locale'];_0x465f16||(_0x465f16=q(_0x1f6fd9,'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.')),_0x58740f['showWarning'](_0x465f16,{'title':q(_0x1f6fd9,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['destroy']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x4d25bd)['add'](q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x4d25bd)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0xc1edd){const _0x39492e=_0xc1edd['map'](_0x1f8765=>_0x1f8765['toJSON']());return this['_compressor']['compress'](_0x39492e);}['_decompressOperations'](_0x1db9a8,_0x1bdc8c){return this['_compressor']['decompress'](_0x1db9a8)['map']((_0x1af40b,_0x4c49a9)=>{const _0x420140='init'==_0x1bdc8c[_0x4c49a9]['type'];if('InsertOperation'==_0x1af40b['__className']){const _0x38224d=_0x1af40b['position']['root'];!this['_document']['getRoot'](_0x38224d)&&(this['_document']['createRoot']('$root',_0x38224d)['_isAttached']=!0x1);}const _0x24ceda=_0x198c4d['fromJSON'](_0x1af40b,this['_document']);return _0x24ceda['wasUndone']=_0x1af40b['wasUndone'],_0x24ceda['_isInit']=_0x420140,_0x24ceda['_authorId']=_0x420140?null:_0x1bdc8c[_0x4c49a9]['userId'],_0x24ceda['_isDisconnection']='cs:removeUser'===_0x1bdc8c[_0x4c49a9]['type'],_0x24ceda['createdAt']=_0x1bdc8c[_0x4c49a9]['createdAt'],_0x24ceda;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x34f1ac=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x34f1ac&&_0x34f1ac['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class J extends Error{}function Q(_0x31b24f,_0x4feabc){for(const _0x50aaf5 of _0x31b24f)_0x50aaf5['baseVersion']=_0x4feabc++;}class X{['_ignoredOperations'];['_operationToId'];constructor(_0x38a36b){this['_ignoredOperations']=_0x38a36b,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x1ea6f3){let _0xb40b5f=_0x1ea6f3['length'];for(;_0xb40b5f--;){const _0x1609bf=_0x1ea6f3[_0xb40b5f];if(!this['_ignoredOperations']['has'](_0x1609bf)){if(!this['_operationToId']['has'](_0x1609bf)){const _0x1c52d9=_0x50f5fd()['slice'](0x1,0x12);this['_operationToId']['set'](_0x1609bf,_0x1c52d9);}return this['_operationToId']['get'](_0x1609bf);}}}['setIdForTheLastOperation'](_0x9cbd70,_0x271734){if(!_0x271734)return;let _0x585450=_0x9cbd70['length'];for(;_0x585450--;){const _0x4d8306=_0x9cbd70[_0x585450];this['_ignoredOperations']['has'](_0x4d8306)||this['_operationToId']['set'](_0x4d8306,_0x271734);}}}class n extends _0x348114{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x2570ba{static ['CommentsService']=/* #__PURE__ -- @preserve */
26
+ ((()=>_0xa0ac43)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x1adc04];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x63e1b4){super(_0x63e1b4),this['_services']=new Map();}async['init'](){const _0x220328=this['context'],_0x3e7b20=_0x220328['plugins']['get']('CommentsRepository');if(_0x220328['plugins']['get'](c)['addToReconnectionStack'](this),_0x3e7b20['adapter']={'addCommentThread':async({channelId:_0x4f3b63,threadId:_0x641ef1,comments:_0x425047,resolvedAt:_0x536209,resolvedBy:_0x179c96,context:_0x2e0961,attributes:_0x218dc2})=>{const _0x38b7ef=await this['_getService'](_0x4f3b63)['addCommentThread']({'commentThreadId':_0x641ef1,'comments':_0x425047['map'](_0x1b2411=>function(_0x27283c,_0x38b120,_0x328ddb){return{'commentThreadId':_0x328ddb,'commentId':_0x27283c['commentId'],'userId':_0x27283c['authorId'],'content':_0x27283c['content'],'documentId':_0x38b120,'createdAt':_0x27283c['createdAt'],'attributes':_0x27283c['attributes']||{}};}(_0x1b2411,_0x4f3b63,_0x641ef1)),'resolvedAt':_0x536209,'resolvedBy':_0x179c96,'context':_0x2e0961,'attributes':_0x218dc2})['catch'](ut);return{'threadId':_0x38b7ef['commentThreadId'],'comments':_0x38b7ef['comments']};},'getCommentThread':async({channelId:_0x3fc91e,threadId:_0x5378f2})=>{const _0x5e37ab=await this['_getService'](_0x3fc91e)['getCommentThread'](_0x5378f2)['catch'](ut);return _0x5e37ab['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x5e37ab]),{'threadId':_0x5e37ab['commentThreadId'],'comments':_0x5e37ab['comments']['map'](S),'context':_0x5e37ab['context'],'resolvedAt':_0x5e37ab['resolvedAt'],'resolvedBy':_0x5e37ab['resolvedBy'],'attributes':_0x5e37ab['attributes']||{}});},'updateCommentThread':async({channelId:_0x239f0c,threadId:_0x84f70c,context:_0x36b467,unlinkedAt:_0x426f5e,attributes:_0x193f4b})=>this['_getService'](_0x239f0c)['updateCommentThread']({'commentThreadId':_0x84f70c,'context':_0x36b467,'attributes':_0x193f4b,'unlinkedAt':_0x426f5e})['catch'](B)['catch'](ut),'resolveCommentThread':async({channelId:_0x3ab7da,threadId:_0x8c7163})=>{const _0x19660f=await this['_getService'](_0x3ab7da)['resolveCommentThread'](_0x8c7163)['catch'](B)['catch'](ut);return{'threadId':_0x19660f['commentThreadId'],'resolvedAt':_0x19660f['resolvedAt'],'resolvedBy':_0x19660f['resolvedBy']};},'reopenCommentThread':async({channelId:_0x2c4735,threadId:_0x3222f3})=>this['_getService'](_0x2c4735)['reopenCommentThread'](_0x3222f3)['catch'](B)['catch'](ut),'removeCommentThread':({channelId:_0x5d04c4,threadId:_0x4b30e2})=>this['_getService'](_0x5d04c4)['removeCommentThread'](_0x4b30e2)['catch'](B)['catch'](ut),'addComment':({channelId:_0x3e53c6,threadId:_0x47fa15,commentId:_0x48548d,content:_0x5809f5,attributes:_0x125c69})=>this['_getService'](_0x3e53c6)['addComment'](_0x47fa15,_0x48548d,_0x5809f5,_0x125c69)['catch'](ut),'updateComment':({channelId:_0x32fde3,threadId:_0x5ae98b,commentId:_0x56c0e0,content:_0x295555,attributes:_0x38b595})=>this['_getService'](_0x32fde3)['updateComment'](_0x5ae98b,_0x56c0e0,_0x295555,_0x38b595)['catch'](B)['catch'](ut),'removeComment':({channelId:_0x1fa2df,threadId:_0x5714bc,commentId:_0xc83b7e})=>this['_getService'](_0x1fa2df)['removeComment'](_0x5714bc,_0xc83b7e)['catch'](B)['catch'](ut)},_0x220328 instanceof _0xd60d61){const _0x50ca6a=_0x220328['config']['get']('collaboration.channelId'),_0x3ac1bf=_0x220328['plugins']['get'](i);await this['_setUpService'](_0x50ca6a);const _0x45ac6d=await this['_services']['get'](_0x50ca6a)['getConnectedSessions']();this['listenTo'](_0x3ac1bf,'sessionAdd:'+_0x50ca6a,(_0xf1ae57,{session:_0x3613fb})=>{_0x3613fb['id']===_0x3ac1bf['mySessionId']&&(_0xf1ae57['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3613fb['permissions'],_0x50ca6a));}),_0x3ac1bf['register'](_0x50ca6a,_0x45ac6d);}}async['_setUpService'](_0x27b8a4){if(this['_services']['has'](_0x27b8a4))throw new _0x2e3272('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x27b8a4});const _0x503482=this['context']['plugins']['get']('CommentsRepository'),_0x5381c2=new a['CommentsService'](_0x27b8a4);this['_services']['set'](_0x27b8a4,_0x5381c2),this['listenTo'](_0x5381c2,'commentThreadAdded',(_0x247c75,_0xf27e6)=>{const {commentThreadId:_0x65ac04,documentId:_0x252551,context:_0x2c6346,attributes:_0x3682b5,resolvedAt:_0x3f1340,resolvedBy:_0x2cf8a1,comments:_0x19a524}=_0xf27e6;_0x503482['getCommentThread'](_0x65ac04)||_0x503482['addCommentThread']({'threadId':_0x65ac04,'channelId':_0x252551,'comments':_0x19a524?_0x19a524['map'](S):[],'context':_0x2c6346,'attributes':_0x3682b5,'resolvedAt':_0x3f1340,'resolvedBy':_0x2cf8a1,'isFromAdapter':!0x0});}),this['listenTo'](_0x5381c2,'commentThreadUpdated',(_0x159738,{commentThreadId:_0x4b1d8d,documentId:_0x7a57af,context:_0x570e21,unlinkedAt:_0x46b2f5,attributes:_0xf78d17})=>{_0x503482['getCommentThread'](_0x4b1d8d)&&_0x503482['updateCommentThread']({'threadId':_0x4b1d8d,'channelId':_0x7a57af,'context':_0x570e21,'unlinkedAt':_0x46b2f5,'attributes':_0xf78d17,'isFromAdapter':!0x0});}),this['listenTo'](_0x5381c2,'commentThreadResolved',(_0x1c97b1,{commentThreadId:_0x5e14ae,resolvedBy:_0x284549,resolvedAt:_0x54e9d0})=>{const _0x13cf76=_0x503482['getCommentThread'](_0x5e14ae);_0x13cf76&&_0x13cf76['resolve']({'resolvedBy':_0x284549,'resolvedAt':_0x54e9d0,'isFromAdapter':!0x0});}),this['listenTo'](_0x5381c2,'commentThreadReopened',(_0x1bccf6,{commentThreadId:_0x250770})=>{const _0x4adecf=_0x503482['getCommentThread'](_0x250770);_0x4adecf&&_0x4adecf['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5381c2,'commentThreadRemoved',(_0xb60215,{commentThreadId:_0x3f6089})=>{const _0x25cad8=_0x503482['getCommentThread'](_0x3f6089);_0x25cad8&&_0x25cad8['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5381c2,'commentAdded',(_0x2e8f7e,_0x517afc)=>{const _0x5a14e1=_0x517afc['commentThreadId'],_0xaf954a=_0x503482['getCommentThread'](_0x5a14e1);_0xaf954a&&_0xaf954a['addComment']({...S(_0x517afc),'isFromAdapter':!0x0});}),this['listenTo'](_0x5381c2,'commentUpdated',(_0x227406,{commentThreadId:_0x595658,commentId:_0x403c7d,content:_0x3ab222,attributes:_0x38ff58})=>{const _0x38b0a9=_0x503482['getCommentThread'](_0x595658);if(_0x38b0a9){const _0x265af8=_0x38b0a9['getComment'](_0x403c7d);_0x265af8&&_0x265af8['update']({'content':_0x3ab222,'attributes':_0x38ff58,'isFromAdapter':!0x0});}}),this['listenTo'](_0x5381c2,'commentRemoved',(_0x5c0952,{commentThreadId:_0x4d56e4,commentId:_0x3e89bd})=>{const _0x3b0395=_0x503482['getCommentThread'](_0x4d56e4);if(_0x3b0395){const _0x5cc2f5=_0x3b0395['getComment'](_0x3e89bd);_0x5cc2f5&&_0x5cc2f5['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x27b8a4);}['destroy'](){if(this['context']instanceof _0xd60d61){const _0x91f386=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x91f386);}}['_terminateService'](_0x370980){if(!this['_services']['has'](_0x370980))throw new _0x2e3272('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x370980});this['_getService'](_0x370980)['disconnect'](),this['_services']['delete'](_0x370980);}async['reconnect'](){for(const _0x2cc08d of this['_services']['keys']())await this['_connectService'](_0x2cc08d);if(this['context']instanceof _0xd60d61){const _0xc0fc48=this['context']['config']['get']('collaboration.channelId'),_0x140e6c=this['context']['plugins']['get'](i);_0x140e6c['unregister'](_0xc0fc48);const _0xf936b6=await this['_services']['get'](_0xc0fc48)['getConnectedSessions']();_0x140e6c['register'](_0xc0fc48,_0xf936b6);}}async['_connectService'](_0x3db70a){const {connection:_0x358509}=this['context']['plugins']['get'](c),_0xc57012=this['context']['plugins']['get']('CommentsRepository'),_0x257a71=this['_services']['get'](_0x3db70a),_0x191890=await _0x257a71['connect'](_0x358509);await this['_fetchMissingUsersForThreads'](_0x191890);const _0x4828e3=new Set(Array['from'](_0xc57012['getCommentThreads']({'channelId':_0x3db70a}),_0x5ca850=>_0x5ca850['id']));for(const _0xf69356 of _0x191890)_0xf69356['deletedAt']||_0x4828e3['delete'](_0xf69356['commentThreadId']);for(const _0x1f91a8 of _0x4828e3)_0xc57012['getCommentThread'](_0x1f91a8)['remove']({'isFromAdapter':!0x0});for(const _0x57dc70 of _0x191890){let _0x3b6938=_0xc57012['getCommentThread'](_0x57dc70['commentThreadId']);const {commentThreadId:_0x4e07ff,context:_0x4b1f8f,attributes:_0x22ec45,resolvedBy:_0x20042e,resolvedAt:_0x2e26b2,unlinkedAt:_0x44ba42,deletedAt:_0x12476e}=_0x57dc70;if(_0x12476e)continue;_0x3b6938||(_0x3b6938=_0xc57012['addCommentThread']({'channelId':_0x3db70a,'threadId':_0x4e07ff,'context':_0x4b1f8f,'attributes':_0x22ec45||{},'resolvedBy':_0x20042e,'resolvedAt':_0x2e26b2,'unlinkedAt':_0x44ba42,'isFromAdapter':!0x0}));const _0x596c53=new Set(Array['from'](_0x3b6938['comments'],_0x1b4d88=>_0x1b4d88['id']));for(const _0x42c888 of _0x57dc70['comments'])_0x596c53['delete'](_0x42c888['commentId']);for(const _0x3331c4 of _0x596c53)_0x3b6938['getComment'](_0x3331c4)['remove']({'isFromAdapter':!0x0});for(const _0x20b4a8 of _0x57dc70['comments']){const _0x5b228e=_0x3b6938['getComment'](_0x20b4a8['commentId']);_0x5b228e?_0x5b228e['content']!==_0x20b4a8['content']&&_0x5b228e['update']({'content':_0x20b4a8['content'],'isFromAdapter':!0x0}):_0x3b6938['addComment'](Object['assign'](S(_0x20b4a8),{'isFromAdapter':!0x0}));}}}['_getService'](_0x4016a6){if(!this['_services']['has'](_0x4016a6))throw new _0x2e3272('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4016a6});return this['_services']['get'](_0x4016a6);}async['_fetchMissingUsersForThreads'](_0x46decc){const _0x2b0f84=this['context']['plugins']['get'](_0x1adc04),{connection:_0x13a1c6}=this['context']['plugins']['get'](c),_0x5c724d=new Set();for(const {resolvedBy:_0x252252,comments:_0x10fa5d}of _0x46decc){_0x252252&&!_0x2b0f84['getUser'](_0x252252)&&_0x5c724d['add'](_0x252252);for(const {userId:_0x2dc696}of _0x10fa5d)_0x2b0f84['getUser'](_0x2dc696)||_0x5c724d['add'](_0x2dc696);}if(0x0===_0x5c724d['size'])return;const _0x2ca472=await dt['getMany'](_0x13a1c6,Array['from'](_0x5c724d));for(const _0x1d96b7 of _0x2ca472)_0x2b0f84['getUser'](_0x1d96b7['id'])||_0x2b0f84['addUser'](_0x1d96b7);}}async function B(_0x2ce13f){if('404'!==_0x2ce13f['code'])throw _0x2ce13f;}function ut(_0x1e2e45){if((_0x49ad45=_0x1e2e45)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x49ad45['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x49ad45['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x49ad45;throw _0x1e2e45;}function S(_0xbb2d14){return{'threadId':_0xbb2d14['commentThreadId'],'commentId':_0xbb2d14['commentId'],'content':_0xbb2d14['content'],'createdAt':_0xbb2d14['createdAt'],'authorId':_0xbb2d14['userId'],'attributes':_0xbb2d14['attributes']||{}};}class f extends _0x348114{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>et)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[a,'TrackChangesEditing',c];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x57bd21){super(_0x57bd21);const _0x59f37b=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x59f37b);}['init'](){const _0x44b7a6=this['editor']['plugins']['get'](c),_0xc9ff01=this['editor']['plugins']['get']('TrackChangesEditing');return _0xc9ff01['adapter']={'getSuggestion':async _0x23eb6a=>{await this['_waitForServiceReady']();const _0x1e2d0b=await this['_trackChangesService']['get'](_0x23eb6a)['catch'](R);return await this['_fetchMissingUsersForThreads']([_0x1e2d0b]),_0x1e2d0b;},'addSuggestion':async({id:_0x417623,type:_0x357b2a,data:_0x33fc4c,originalSuggestionId:_0x35befd,attributes:_0x425a3d})=>{await this['_waitForServiceReady']();const _0x4852d8={'id':_0x417623,'type':_0x357b2a,'data':_0x33fc4c,'originalSuggestionId':_0x35befd,'attributes':_0x425a3d},_0x2c17e5=await this['_trackChangesService']['add'](_0x417623,_0x357b2a,_0x33fc4c,_0x35befd,_0x425a3d)['catch'](_0x5f07ad=>{if(ft(_0x5f07ad))return new Promise(_0x29a6ff=>{this['_bufferedRequests']['set'](_0x417623,{'resolve':_0x29a6ff,'suggestionData':_0x4852d8});});throw _0x5f07ad;});return this['_bufferedRequests']['delete'](_0x417623),_0x2c17e5;},'updateSuggestion':async(_0x214dad,_0x1a8aef)=>{if(await this['_waitForServiceReady'](),'open'!==_0x1a8aef['state'])return this['_trackChangesService']['update'](_0x214dad,_0x1a8aef)['catch'](R);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x116b44,_0x5e3803)=>{_0xc9ff01['hasSuggestion'](_0x5e3803['id'])&&(_0xc9ff01['getSuggestion'](_0x5e3803['id'])['attributes']=_0x5e3803['attributes']);}),this['_trackChangesService']['connect'](_0x44b7a6['connection'])['then'](_0x238167=>(_0x44b7a6['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x238167)['then'](()=>{for(const _0x4d3b3f of _0x238167){_0xc9ff01['addSuggestionData'](_0x4d3b3f)['_saved']=!0x0;}})));}async['reconnect'](){const _0x267fab=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x469f8f}=this['editor']['plugins']['get'](c),_0x3b9137=await this['_trackChangesService']['connect'](_0x469f8f);await this['_fetchMissingUsersForThreads'](_0x3b9137);for(const {suggestionData:_0x1b6d2f,resolve:_0x30c4cb}of this['_bufferedRequests']['values']()){let _0x1287af=_0x3b9137['find'](_0x20545e=>_0x20545e['id']===_0x1b6d2f['id']);_0x1287af||(_0x1287af=await this['_trackChangesService']['add'](_0x1b6d2f['id'],_0x1b6d2f['type'],_0x1b6d2f['data'],_0x1b6d2f['originalSuggestionId'])),_0x30c4cb(_0x1287af);}for(const _0x5be7b3 of _0x3b9137)_0x267fab['hasSuggestion'](_0x5be7b3['id'])||_0x267fab['addSuggestionData'](_0x5be7b3);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x58dcf0=>{this['listenTo'](this['_trackChangesService'],'connected',_0x3e4702=>{_0x3e4702['off'](),_0x58dcf0();});});}async['_fetchMissingUsersForThreads'](_0x341f9e){const _0x3a4159=this['editor']['plugins']['get'](_0x1adc04),{connection:_0xb54898}=this['editor']['plugins']['get'](c),_0x13a362=new Set();for(const {authorId:_0x3669bd}of _0x341f9e)_0x3a4159['getUser'](_0x3669bd)||_0x13a362['add'](_0x3669bd);if(0x0===_0x13a362['size'])return;const _0x343ec5=await dt['getMany'](_0xb54898,Array['from'](_0x13a362));for(const _0x5584ce of _0x343ec5)_0x3a4159['getUser'](_0x5584ce['id'])||_0x3a4159['addUser'](_0x5584ce);}}function R(_0x1e8b1e){if(ft(_0x1e8b1e))return new Promise(()=>{});throw _0x1e8b1e;}function ft(_0x319af4){return _0x319af4['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x319af4['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x348114{static get['requires'](){return['Comments',a,n,c];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0xc3ec3c=this['editor']['plugins']['get'](c),_0x2dd53d=this['editor']['plugins']['get']('CommentsEditing'),_0x4a8db8=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0xc3ec3c,'change:state',(_0x2e1f3d,_0x20e563,_0x1066c8)=>{_0x2dd53d['isThreadsLoadingPaused']='connected'!==_0x1066c8;});}),this['listenTo'](_0xc3ec3c,'change:state',(_0xc06432,_0x5dc210,_0x42cc45)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x42cc45);}),_0x4a8db8['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](a)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class p extends _0x348114{static get['requires'](){return[m,f,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class u extends _0x348114{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
28
+ ((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',i,_0x1adc04];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1ac6c9){super(_0x1ac6c9);const _0x1c2d19=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x1c2d19);}async['init'](){const _0x363dbd=this['editor']['plugins']['get'](l),_0x29fa02=_0x363dbd['serverHistory'],_0x367c28=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x29fa02,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x363dbd['sessionId']});const _0x129702=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x23f196=await tt['isBundleUploaded'](_0x367c28['connection'],_0x129702);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x4161bb})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x4161bb)),'updateRevisions':async _0x3030da=>{await this['_waitForServiceReady']();const _0x16a590=this['_revisionTracker']['currentRevision'];if(_0x23f196&&0x1===_0x3030da['length']&&_0x3030da[0x0]['id']===_0x16a590['id'])return _0x3030da;for(const _0x4f3d5a of _0x3030da)_0x4f3d5a['id']===_0x16a590['id']&&(_0x4f3d5a['isEmptyCurrent']=_0x4f3d5a['fromVersion']===_0x4f3d5a['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x3030da,this['_lastRequestId'])['then'](_0x2f1dba=>(this['_lastRequestId']=_0x2f1dba,_0x3030da))['catch'](_0x468597=>{if(st(_0x468597)||'400'===_0x468597['code']&&void 0x0!==_0x468597['data']['wrongRequestId']){for(const _0x1e08a0 of _0x3030da){!this['_revisionTracker']['repository']['getRevision'](_0x1e08a0['id'])||this['_revisionTracker']['_bufferUpdate'](_0x1e08a0['id'],_0x1e08a0,!0x1);}if(st(_0x468597))throw _0x468597;return _0x3030da;}throw _0x468597;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x241b3e,{revisionsData:_0x271335,requestId:_0x20fbd4})=>{Math['max'](..._0x271335['map'](_0x293f5f=>_0x293f5f['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x271335,_0x20fbd4);}):this['_handleRevisionsUpdate'](_0x271335,_0x20fbd4);});const {revisions:_0x31284a,requestId:_0x1c318c}=await this['_revisionHistoryService']['connect'](_0x367c28['connection']);_0x367c28['addToReconnectionStack'](this),this['_lastRequestId']=_0x1c318c,await this['_fetchMissingUsers'](_0x31284a);for(const _0x26b177 of _0x31284a)this['_revisionTracker']['addRevisionData'](_0x26b177);this['listenTo'](_0x363dbd,'change:_isConnected',(_0x196e9a,_0x531c3c,_0x1fb31e)=>{_0x1fb31e&&(this['_oldOffset']=_0x363dbd['_offset'],_0x196e9a['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x367c28,'state',_0x3be282=>_0x3be282===_0x1b4187['CONNECTED']);}async['reconnect'](){const _0x1faf8c=this['editor']['plugins']['get'](c),_0x191f08=this['editor']['plugins']['get'](l),_0x798822=async()=>{const _0x48affc=this['_revisionTracker']['currentRevision'],_0x232cbb=_0x48affc['id'],_0x2e9ca5=_0x232cbb!==_0x191f08['sessionId'];if(_0x2e9ca5){const _0x4e8f47=_0x191f08['_offset']-this['_oldOffset'],_0x39657a=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x48affc['toVersion']+_0x4e8f47!==_0x39657a){const _0x56fe4d=_0x48affc['fromVersion']+_0x4e8f47,_0x562e3e=this['editor']['plugins']['get'](_0x1adc04),_0x101193=this['_revisionTracker']['buildRevisionData']({'revision':_0x48affc,'from':_0x56fe4d,'to':_0x39657a});_0x101193['id']=_0x48affc['id'];const _0xce24f8=_0x101193['authorsIds']['map'](_0xb8c058=>_0x562e3e['getUser'](_0xb8c058));_0x48affc['_update']({..._0x101193,'authors':_0xce24f8},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x48affc['id'],_0x101193,!0x0);}this['_revisionTracker']['_startingVersion']=_0x39657a,(_0x48affc['toVersion']===_0x48affc['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x232cbb)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x232cbb),this['_revisionTracker']['_createCurrentRevision'](_0x39657a));}const {revisions:_0x39ad36,requestId:_0x3229dc}=await this['_revisionHistoryService']['reconnect'](_0x1faf8c['connection'],this['_lastRequestId']);_0x2e9ca5&&_0x39ad36['length']>0x0?_0x191f08['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x39ad36),this['_handleRevisionsUpdate'](_0x39ad36,_0x3229dc),this['_revisionTracker']['sendBufferedUpdates']());};return _0x191f08['_isConnected']?_0x798822():new Promise((_0x2f5f35,_0x5e02bb)=>{_0x191f08['once']('change:_isConnected',()=>{_0x798822()['then'](_0x2f5f35)['catch'](_0x5e02bb);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x46de36=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x3a345d=>{_0x3a345d['off'](),_0x46de36();});});}['_getLatestVersionFromServerOperations'](){const _0xb27226=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x5a16ce of _0xb27226)if('marker'!==_0x5a16ce['type']||_0x5a16ce['affectsData'])return _0x5a16ce['baseVersion']+0x1;}['_getLatestVersion'](){const _0x1e0cd0=this['editor']['plugins']['get'](l);return new Promise(_0x39818a=>{_0x1e0cd0['_isPendingUpdate']?_0x1e0cd0['once']('change:_isPendingUpdate',()=>{_0x39818a(this['_getLatestVersionFromServerOperations']());}):_0x39818a(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0xe20361,_0x3d74f0){const _0x4fa1a7=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3d74f0;for(const _0x31cbe8 of _0xe20361){const _0x45a9a9=_0x4fa1a7['getRevision'](_0x31cbe8['id']);if(_0x45a9a9){if((_0x31cbe8['fromVersion']||_0x31cbe8['toVersion'])&&(_0x31cbe8['diffData']=null),_0x45a9a9===this['_revisionTracker']['currentRevision']){const _0x550bfd=Math['max'](_0x45a9a9['toVersion'],_0x31cbe8['toVersion']),_0x2412b5=Math['max'](_0x45a9a9['fromVersion'],_0x31cbe8['fromVersion']);let _0x4b6dd7;_0x45a9a9['toVersion']===_0x31cbe8['toVersion']&&_0x45a9a9['fromVersion']===_0x31cbe8['fromVersion']?(_0x4b6dd7=!0x0,this['_preventResendingRevisionData'](_0x31cbe8)):_0x31cbe8['toVersion']===_0x550bfd&&_0x31cbe8['fromVersion']===_0x2412b5?_0x4b6dd7=!0x1:(_0x45a9a9['toVersion']===_0x550bfd&&_0x45a9a9['fromVersion']===_0x2412b5||this['_fixRevision']({'revision':_0x45a9a9,'from':_0x2412b5,'to':_0x550bfd}),_0x4b6dd7=!0x0),_0x4b6dd7&&(delete _0x31cbe8['fromVersion'],delete _0x31cbe8['toVersion'],delete _0x31cbe8['diffData'],delete _0x31cbe8['createdAt'],delete _0x31cbe8['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x31cbe8),this['_preventResendingRevisionData'](_0x31cbe8);}else this['_revisionTracker']['addRevisionData'](_0x31cbe8);}const _0x4138d9=_0x4fa1a7['getRevisions']();_0x4138d9['reverse']();for(let _0x344b0e=0x0;_0x344b0e<_0x4138d9['length']-0x1;_0x344b0e++){const _0x31db26=_0x4138d9[_0x344b0e],_0x443885=_0x4138d9[_0x344b0e+0x1];if(_0x31db26['fromVersion']<_0x443885['toVersion']){const _0x45ff92=_0x443885['toVersion'],_0x124e74=Math['max'](_0x45ff92,_0x31db26['toVersion']);this['_fixRevision']({'revision':_0x31db26,'from':_0x45ff92,'to':_0x124e74});}}}['_fixRevision']({revision:_0x24204d,from:_0xec6e6a,to:_0x30cbec}={}){const _0x1f3a37=this['editor']['plugins']['get'](_0x1adc04),_0x139ee3=this['_revisionTracker']['buildRevisionData']({'revision':_0x24204d,'from':_0xec6e6a,'to':_0x30cbec});_0x139ee3['authors']=_0x139ee3['authorsIds']['map'](_0x4817e7=>_0x1f3a37['getUser'](_0x4817e7)),_0x24204d['_update'](_0x139ee3);}['_preventResendingRevisionData'](_0x585206){const _0x112b26={};_0x112b26['id']=_0x585206['id'];for(const _0x3cd2da of Object['keys'](_0x585206))'id'!==_0x3cd2da&&(_0x112b26[_0x3cd2da]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x112b26['id'],_0x112b26,!0x0);}async['_fetchMissingUsers'](_0x4fc114){const _0x2102ff=this['editor']['plugins']['get'](_0x1adc04),{connection:_0x7ddb8f}=this['editor']['plugins']['get'](c),_0x5db1fb=new Set();for(const _0x192da1 of _0x4fc114){for(const _0x1570b7 of _0x192da1['authorsIds'])_0x2a79ba(_0x1570b7);_0x192da1['creatorId']&&_0x2a79ba(_0x192da1['creatorId']);}if(0x0===_0x5db1fb['size'])return;const _0x29f2a6=await dt['getMany'](_0x7ddb8f,Array['from'](_0x5db1fb));for(const _0x467536 of _0x29f2a6)_0x2102ff['getUser'](_0x467536['id'])||_0x2102ff['addUser'](_0x467536);function _0x2a79ba(_0x4ce7ef){_0x2102ff['getUser'](_0x4ce7ef)||_0x5db1fb['add'](_0x4ce7ef);}}}function st(_0x38e6b7){return _0x38e6b7['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x38e6b7['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x38e6b7['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x348114{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class ts extends _0x3f9851{constructor(_0x76ec97){super(_0x76ec97);const _0x1da8f2=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0x1da8f2['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0x1da8f2['to']('usersCount',_0x1963d5=>q(_0x76ec97,'CONNECTED_USERS',_0x1963d5))}]});}}class es extends _0x3f9851{['items'];['keystrokes'];constructor(_0x36554e){super(_0x36554e);const _0x393e9d=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0xd8aef6(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x393e9d['if']('hasPopup'),'aria-expanded':_0x393e9d['to']('isExpanded',_0x4d5c3a=>this['hasPopup']&&String(_0x4d5c3a)),'aria-label':_0x393e9d['to']('hasPopup',_0x1a1acd=>q(_0x36554e,_0x1a1acd?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x393e9d['to']('hasPopup',_0x31d8cc=>!!_0x31d8cc&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x393e9d['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0x135a06,_0x334ac5,_0x5532b7)=>{this['element']&&(_0x5532b7?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class L extends _0x3f9851{['counterView'];['inlineListView'];constructor(_0x3d2a34){super(_0x3d2a34);const _0x2ef2cf=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0x3d2a34),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x10980f of this['inlineListView']['items'])_0x10980f['tooltipPosition']='s';this['inlineListView']['items']['first']&&(this['inlineListView']['items']['first']['tooltipPosition']='se');}),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list','ck-reset','ck-rounded-corners',_0x2ef2cf['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class j extends _0x3f9851{['listWrapperView'];constructor(_0x58abc8,_0x1a92cb){super(_0x58abc8),this['listWrapperView']=new mt(_0x58abc8,_0x1a92cb),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':q(_0x58abc8,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class mt extends _0x3304c8{constructor(_0x3814a2,_0x21337c){super(_0x3814a2);const _0x4110de=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x21337c?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x4110de['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x4110de['to']('role'),'aria-label':_0x4110de['to']('ariaLabel'),'aria-labelledby':_0x4110de['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x23615d['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x3c9257=this['element'];_0x3c9257&&(this['_isScrollable']=Math['max'](_0x3c9257['scrollHeight'],_0x3c9257['clientHeight'])>0.8*window['innerHeight']);}}class k extends rt{['userView'];constructor(_0x1dc546,_0x41eeb9,_0x5e73dd){super(_0x1dc546);const _0x5d50ef=this['bindTemplate'];this['userView']=new ct(_0x1dc546,_0x41eeb9);const _0xb5fda3={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x41eeb9['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x41eeb9['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x41eeb9['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x5e73dd&&(_0xb5fda3['tag']='button',_0xb5fda3['on']={'click':_0x5d50ef['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0xb5fda3);}['focus'](){this['element']['focus']();}}class y extends _0x3f9851{['userView'];['markerView'];constructor(_0x414c0d,_0x118816,_0x9b1c8e){super(_0x414c0d);const _0xf91c04=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x414c0d,_0x118816),this['markerView']=new at(_0x414c0d,_0x118816);const _0x1d6842=new ot(_0x414c0d);_0x1d6842['template']['tag']='span',_0x1d6842['text']=_0x118816['name'];const _0x1dbf2b={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0xf91c04['to']('isFocusable',_0x279d8b=>!!_0x279d8b&&0x0),'aria-labelledby':_0x1d6842['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0xf91c04['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0xf91c04['to']('hasTooltip',_0x408376=>!_0x408376),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x1d6842]};_0x9b1c8e&&(_0x1dbf2b['tag']='button',_0x1dbf2b['on']={'click':_0xf91c04['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1dbf2b);}}class at extends _0x3f9851{constructor(_0x1c3ce7,_0x2b5bfd){super(_0x1c3ce7),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2b5bfd['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const A={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x2570ba{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x36d129){super(_0x36d129),this['context']['config']['define']('presenceList',A);const _0x1e043d=_0x36d129['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x1e043d)throw new _0x2e3272('presencelist-collapseat-invalid-format',this);if(_0x1e043d<0x1)throw new _0x2e3272('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x1b4970(),this['balloonPanelView']=new _0x99933(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x4af79e of this['_allConnectedUsers'])this['_handleUserAdd'](_0x4af79e);this['listenTo'](this['_allConnectedUsers'],'add',(_0x95032,_0x3fa28e)=>{this['_handleUserAdd'](_0x3fa28e);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x198ab5,_0x25251a)=>{this['_handleUserRemove'](_0x25251a);});}['_createView'](){const _0x4fc22b=this['context'],_0xd53dc7=new L(this['context']['locale']),_0x278f41=this['balloonPanelView'];if(!_0x3f492d(_0x4fc22b['config']['get']('presenceList.container')))throw new _0x2e3272('presencelist-missing-container',this);return _0xd53dc7['counterView']['bind']('usersCount')['to'](this),_0xd53dc7['bind']('isCollapsed')['to'](this,'usersCount',_0x170078=>{const {collapseAt:_0x4cff2c,displayMe:_0x56403e}=_0x4fc22b['config']['get']('presenceList'),_0x1cc609=_0x170078>=_0x4cff2c;return _0xd53dc7['counterView']['isHidden']=!(0x1==_0x170078&&_0x56403e||_0x1cc609),_0x1cc609||this['hideDropdown'](),_0x1cc609;}),_0xd53dc7['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0xd32276=>{const _0x3b05d8=_0x4fc22b['config']['get']('presenceList'),_0x2c5f76=new y(_0x4fc22b['locale'],_0xd32276,!!_0x3b05d8['onClick']);return _0x2c5f76['bind']('hasTooltip')['to'](_0xd53dc7,'isCollapsed',_0x438fd3=>!_0x438fd3),_0x2c5f76['bind']('isFocusable')['to'](_0xd53dc7,'isCollapsed',_0x4d7cf9=>!_0x4d7cf9),_0x3b05d8['onClick']&&this['listenTo'](_0x2c5f76,'execute',()=>{this['view']['isCollapsed']||_0x3b05d8['onClick'](_0xd32276,_0x2c5f76['element']);}),_0x2c5f76;}),this['listenTo'](_0xd53dc7['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0xd53dc7['inlineListView']['keystrokes']['set']('Enter',(_0x52019e,_0x3ca201)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x3ca201());}),_0xd53dc7['render'](),_0x278f41['render'](),_0x1b10bb({'emitter':_0xd53dc7,'activator':()=>_0x278f41['isVisible'],'contextElements':[_0x278f41['element'],_0xd53dc7['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x4fc22b['config']['get']('presenceList.container')['appendChild'](_0xd53dc7['element']),this['_bodyCollection']=new _0x4dadbb(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0xd53dc7;}['_handleUserAdd'](_0x4f326e){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x4f326e['isMe'])return;const _0xde5b75=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0xde5b75&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0x33a9ad=_0x4f326e['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x4f326e,_0x33a9ad);}['_handleUserRemove'](_0xac9954){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0xac9954['id'])&&(this['currentDisplayedUsers']['remove'](_0xac9954['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0x298c53 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x298c53['id']))return void this['currentDisplayedUsers']['add'](_0x298c53,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0xfbc7b=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new j(this['context']['locale'],!!_0xfbc7b['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x22d233}=this['presenceDropdownView'];_0x22d233['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x7fc5c3=>{if(!_0xfbc7b['displayMe']&&_0x7fc5c3['isMe'])return null;const _0x4bacbb=new k(this['context']['locale'],_0x7fc5c3,!!_0xfbc7b['onClick']);return _0xfbc7b['onClick']&&this['listenTo'](_0x4bacbb,'execute',()=>{_0xfbc7b['onClick'](_0x7fc5c3,_0x4bacbb['element']);}),_0x4bacbb;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x22d233['focus'](),_0x22d233['checkIfScrollable']();const _0x4d7825=(_0x276917,_0x1365f2)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x1365f2();};_0x22d233['keystrokes']['set']('Esc',_0x4d7825),_0x22d233['keystrokes']['set']('Shift+Tab',_0x4d7825),_0x22d233['keystrokes']['set']('Tab',(_0x1b4249,_0x4d2d96)=>{!function(_0x153102){const _0x25a907=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x4c65eb=>_0x4c65eb+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0xe9bb6b=[...document['body']['querySelectorAll'](_0x25a907)]['filter'](_0xf83c76=>_0xf83c76===document['activeElement']||_0xf83c76['offsetWidth']+_0xf83c76['offsetHeight']>0x0)['sort']((_0x8c9e0f,_0x392515)=>(_0x8c9e0f['tabIndex']||0x0)-(_0x392515['tabIndex']||0x0)),_0xa7ee47=_0xe9bb6b['indexOf'](_0x153102),_0x3c5890=_0xe9bb6b[(_0xa7ee47+0x1)%_0xe9bb6b['length']];_0x3c5890&&_0x3c5890['focus']();}(this['view']['element']),this['hideDropdown'](),_0x4d2d96();}),_0x22d233['focusTracker']['add'](this['view']['element']),_0x22d233['focusTracker']['on']('change:isFocused',(_0x50c9d7,_0x94a843,_0x53f5ef)=>{_0x53f5ef||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class s extends _0x2570ba{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-real-time-collaboration",
3
- "version": "44.1.0-alpha.0",
3
+ "version": "44.1.0-alpha.2",
4
4
  "description": "A set of CKEditor 5 features enabling real-time collaboration within the editor using CKEditor Cloud Services.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -42,14 +42,14 @@
42
42
  ],
43
43
  "dependencies": {
44
44
  "@ckeditor/ckeditor-cloud-services-collaboration": "52.6.11",
45
- "@ckeditor/ckeditor5-core": "44.1.0-alpha.0",
46
- "@ckeditor/ckeditor5-engine": "44.1.0-alpha.0",
47
- "@ckeditor/ckeditor5-operations-compressor": "44.1.0-alpha.0",
48
- "@ckeditor/ckeditor5-theme-lark": "44.1.0-alpha.0",
49
- "@ckeditor/ckeditor5-ui": "44.1.0-alpha.0",
50
- "@ckeditor/ckeditor5-utils": "44.1.0-alpha.0",
51
- "ckeditor5": "44.1.0-alpha.0",
52
- "ckeditor5-collaboration": "44.1.0-alpha.0",
45
+ "@ckeditor/ckeditor5-core": "44.1.0-alpha.2",
46
+ "@ckeditor/ckeditor5-engine": "44.1.0-alpha.2",
47
+ "@ckeditor/ckeditor5-operations-compressor": "44.1.0-alpha.2",
48
+ "@ckeditor/ckeditor5-theme-lark": "44.1.0-alpha.2",
49
+ "@ckeditor/ckeditor5-ui": "44.1.0-alpha.2",
50
+ "@ckeditor/ckeditor5-utils": "44.1.0-alpha.2",
51
+ "ckeditor5": "44.1.0-alpha.2",
52
+ "ckeditor5-collaboration": "44.1.0-alpha.2",
53
53
  "lodash-es": "4.17.21"
54
54
  },
55
55
  "types": "src/index.d.ts",