@ckeditor/ckeditor5-real-time-collaboration 47.3.0-alpha.3 → 47.3.0-alpha.5
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/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +2 -2
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/sessions.js +1 -1
- package/src/realtimecollaborativeediting/usermarkers.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.js +2 -2
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +2 -2
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +2 -2
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>rt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0xc0661f];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x36e8c1){super(_0x36e8c1),this['set']('state',_0x46af62['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x1e5929())();}['init'](){const _0x120423=this['context'],_0x3a76a0=_0x120423['plugins']['get']('CloudServices'),_0xdef588=_0x120423['plugins']['get'](_0xc0661f);if(!_0x3a76a0['token'])throw new _0xc89e2a('websocketgateway-missing-token',this);if(!_0x3a76a0['webSocketUrl'])throw new _0xc89e2a('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),n['WebSocketGateway']['connect'](_0x3a76a0['token'],_0x3a76a0['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x53ea92=>{if(this['connection']=_0x53ea92,this['bind']('state')['to'](_0x53ea92,'state',this,'_isBrowserOffline',(_0x2d8ec0,_0x1ddbb8)=>('connected'!==_0x2d8ec0&&(this['_shouldPluginsReconnect']=!0x0),_0x1ddbb8||_0x2d8ec0!==_0x46af62['CONNECTED']?_0x46af62['DISCONNECTED']:this['state']==_0x46af62['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x46af62['CONNECTING']):_0x46af62['CONNECTED'])),this['connection']['on']('error',(_0xc3717f,_0x220a74)=>{if('limitExceeded'!==_0x220a74['code'])throw console['error'](_0x220a74),new _0xc89e2a('cloudservices-init',null,{'originalError':_0x220a74});_0xdef588['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'});}),!_0x53ea92['me'])return new Promise(_0x54d687=>_0x53ea92['on']('change:me',_0x54d687));})['catch'](_0x3a2364=>{throw console['error'](_0x3a2364),new _0xc89e2a('cloudservices-init',null,{'originalError':_0x3a2364});});}['addToReconnectionStack'](_0x162f33){if('function'!=typeof _0x162f33['reconnect'])throw new _0xc89e2a('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x162f33))throw new _0xc89e2a('websocketgateway-plugin-already-registered',this,{'name':_0x162f33['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x162f33);}['removeFromReconnectionStack'](_0x281096){this['_reconnectionStack']['delete'](_0x281096);}['isInReconnectionStack'](_0x1b3995){return this['_reconnectionStack']['has'](_0x1b3995);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x835dfd=>_0x835dfd['reconnect']())))['then'](()=>this['state']=_0x46af62['CONNECTED'])['catch'](_0x1d53d8=>{throw console['error'](_0x1d53d8),new _0xc89e2a('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x46af62['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x3622a5{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[n,_0x1fb28d];}constructor(_0x2e70ef){super(_0x2e70ef),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x15e0cd(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1fb28d);}['init'](){const _0x2b4222=this['context']['plugins']['get'](n);this['listenTo'](_0x2b4222,'change:state',(_0x757eac,_0x248d85,_0x3c0cf0)=>{if('connected'!==_0x3c0cf0)this['channelSessions']['forEach'](_0x4ab53a=>_0x4ab53a['clear']()),this['channelConnectedUsers']['forEach'](_0x162ea8=>_0x162ea8['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x141dda,_0x1f51a7]of this['_registeredSessions'])for(const _0x4b5387 of _0x1f51a7)this['_handleSessionAdd'](_0x141dda,_0x4b5387);}}),this['_createUser'](_0x2b4222['connection']['me'],!0x0);}['register'](_0x51ef24,_0x2561f1){if(this['_registeredSessions']['has'](_0x51ef24))throw new _0xc89e2a('sessions-register-already-registered',null,{'channelId':_0x51ef24});this['_registeredSessions']['set'](_0x51ef24,_0x2561f1),this['channelSessions']['set'](_0x51ef24,new _0x15e0cd()),this['channelConnectedUsers']['set'](_0x51ef24,new _0x15e0cd()),this['listenTo'](_0x2561f1,'add',(_0x3eb5d6,_0x3805a5)=>this['_handleSessionAdd'](_0x51ef24,_0x3805a5)),this['listenTo'](_0x2561f1,'remove',(_0x43a456,_0x2aa8da)=>this['_handleSessionRemove'](_0x51ef24,_0x2aa8da));for(const _0x5a88a9 of _0x2561f1)this['_handleSessionAdd'](_0x51ef24,_0x5a88a9);}['unregister'](_0x3ec87a){if(!this['_registeredSessions']['has'](_0x3ec87a))throw new _0xc89e2a('sessions-unregister-not-exist',null,{'channelId':_0x3ec87a});const _0x1fec2f=this['_registeredSessions']['get'](_0x3ec87a);this['stopListening'](_0x1fec2f);for(const _0x34e3fc of _0x1fec2f)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x3ec87a,_0x34e3fc);this['_registeredSessions']['delete'](_0x3ec87a),this['channelSessions']['delete'](_0x3ec87a),this['channelConnectedUsers']['delete'](_0x3ec87a);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x483906){for(const _0x17331d of this['channelSessions']['values']())for(const _0x370e60 of _0x17331d)if(_0x370e60['id']===_0x483906)return _0x370e60['user'];}['getUserSessions'](_0x2913d3,_0x11ed4f){const _0x4bf38b=_0x11ed4f?[this['channelSessions']['get'](_0x11ed4f)]:this['channelSessions']['values'](),_0xc659bb=new Set();for(const _0x477930 of _0x4bf38b)for(const _0x2629dd of _0x477930)_0x2629dd['user']['id']===_0x2913d3['id']&&_0xc659bb['add'](_0x2629dd['id']);return _0xc659bb;}['getUserRole'](_0x35d8b2){for(const _0x1929d6 of this['channelSessions']['values']())for(const _0x2bcb31 of _0x1929d6)if(_0x2bcb31['user']===_0x35d8b2)return _0x2bcb31['role'];}['_handleSessionAdd'](_0x3984eb,_0x1ef0f5){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0xcc5074=_0x1ef0f5['user'],_0x51a460=this['_users']['getUser'](_0xcc5074['id'])||this['_createUser'](_0xcc5074),_0x540e60=Object['assign']({},_0x1ef0f5,{'user':_0x51a460});if(this['channelSessions']['get'](_0x3984eb)['add'](_0x540e60),!_0xcc5074['hiddenInPresenceList']){const _0x3ca036=this['channelConnectedUsers']['get'](_0x3984eb);_0x3ca036['has'](_0x51a460['id'])||_0x3ca036['add'](_0x51a460),this['allConnectedUsers']['has'](_0x51a460['id'])||_0xcc5074['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x51a460,_0x51a460['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x3984eb,{'channelId':_0x3984eb,'session':_0x540e60});}['_handleSessionRemove'](_0x118f45,_0x2af5b0){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x545670=this['channelConnectedUsers']['get'](_0x118f45),_0xe850d=_0x2af5b0['user'];_0xe850d['id']&&(this['channelSessions']['get'](_0x118f45)['remove'](_0x2af5b0['id']),_0x545670['has'](_0xe850d['id'])&&!this['getUserSessions'](_0xe850d,_0x118f45)['size']&&_0x545670['remove'](_0xe850d['id']),this['allConnectedUsers']['get'](_0xe850d['id'])&&!this['getUserSessions'](_0xe850d)['size']&&this['allConnectedUsers']['remove'](_0xe850d['id']));}['_createUser'](_0x475fe7,_0x686ea3){const _0x5322ec=this['_users']['addUser'](_0x475fe7);return _0x686ea3&&this['_users']['defineMe'](_0x475fe7['id']),_0x5322ec['orderNumber']=this['_uniqueUsersCount']++,_0x5322ec;}}class $ extends _0x147cd0{['_domEmitter']=new(_0x1e5929())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x32de8b=this['editor'],_0x2a8194=_0x32de8b['plugins']['get'](i);_0x32de8b['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x5b4394,{writer:_0x835cad})=>function(_0x5e492d,_0x5bd811,_0x2e6768,_0x2b0dff){const _0x186b2c=_0x5e492d['markerName']['split'](':')[0x2],_0x5dce97=_0x2e6768['getUserBySessionId'](_0x186b2c);if(!_0x5dce97||_0x186b2c===_0x2e6768['mySessionId'])return;if(!_0x2b0dff['model']['schema']['checkChild'](_0x5e492d['markerRange']['start'],'$text'))return;const _0x3970fa={'class':'ck-user__marker\x20'+_0x5dce97['color']['getMarkerClass'](),'data-name':_0x5dce97['name'],'data-session-id':_0x186b2c},_0x728b61=_0x2b0dff['model']['markers']['get'](_0x5e492d['markerName']),_0x599d3f=_0x728b61['getStart'](),_0xf74631=_0x599d3f['nodeAfter'],_0x21d289=_0x2b0dff['model']['schema'];if(_0xf74631&&_0x21d289['isObject'](_0xf74631)&&_0x21d289['isInline'](_0xf74631)&&!_0x2b0dff['model']['markers']['get']('user:range:'+_0x186b2c)['getRange']()['isCollapsed'])return;const _0x324c90=_0x599d3f['parent'];return _0x2b0dff['model']['schema']['isLimit'](_0x324c90)&&!_0x2b0dff['model']['hasContent'](_0x324c90)&&(_0x3970fa['contenteditable']=!0x1),function(_0x40ad6b,_0x5e425d,_0x5c8b2c){const _0x108f39=_0x40ad6b['createUIElement']('span',_0x5e425d);return _0x40ad6b['setCustomProperty']('userPositionMarker',!0x0,_0x108f39),_0x108f39['render']=function(_0x2f3d9f){const _0x36f924=this['toDomElement'](_0x2f3d9f),_0x5bc38f=document['createElement']('span');return _0x5bc38f['classList']['add']('ck-user__marker-tooltip'),_0x5bc38f['setAttribute']('contenteditable','false'),_0x5bc38f['setAttribute']('spellcheck','false'),_0x5bc38f['textContent']=_0x5c8b2c['name'],_0x36f924['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x5bc38f['outerHTML']+'',_0x36f924['addEventListener']('mouseenter',()=>{_0x36f924['classList']['add']('ck-user__marker_hovered');}),_0x36f924['addEventListener']('mouseleave',()=>{_0x36f924['classList']['remove']('ck-user__marker_hovered');}),_0x36f924;},_0x108f39['isSimilar']=function(_0x267f22){return!(!this['getCustomProperty']('userPositionMarker')||!_0x267f22['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x267f22['getAttribute']('data-session-id'));},_0x108f39;}(_0x5bd811,_0x3970fa,_0x5dce97);}(_0x5b4394,_0x835cad,_0x2a8194,_0x32de8b)}),_0x32de8b['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x100f2d=>function(_0x5a77fe,_0x2ed0ea){const _0x1e0c8b=_0x5a77fe['markerName']['split'](':')[0x2];if(_0x1e0c8b===_0x2ed0ea['mySessionId'])return null;const _0x17059f=_0x2ed0ea['getUserBySessionId'](_0x1e0c8b);if(!_0x17059f)return{'id':_0x1e0c8b,'classes':[]};return{'id':_0x1e0c8b,'classes':['ck-user__selection',_0x17059f['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x1e0c8b},'priority':0x7d0+_0x17059f['orderNumber']};}(_0x100f2d,_0x2a8194)}),function(_0x142e53){const _0x298cc3=_0x142e53['model'],_0x2919f6=new Map(),_0x4987f2=_0x142e53['plugins']['get'](i);_0x298cc3['markers']['on']('update:user:range',(_0x4f84e0,_0x40abf2,_0x34ee8f,_0x5f0430)=>{if(!_0x5f0430&&_0x2919f6['get'](_0x40abf2['name']))return _0x2919f6['get'](_0x40abf2['name'])['detach'](),void _0x2919f6['delete'](_0x40abf2['name']);const _0x117067=_0x40abf2['name']['split'](':')[0x2];if(_0x117067===_0x4987f2['mySessionId'])return;const _0x3cfec4='user:position:'+_0x117067;_0x298cc3['markers']['has'](_0x3cfec4)&&_0x142e53['editing']['reconvertMarker'](_0x3cfec4),_0x40abf2['on']('change:range',(_0xdd4e5f,_0x42e8a4,_0x265c0b)=>{if('$graveyard'!=_0x42e8a4['root']['rootName']&&'$graveyard'==_0x40abf2['getRange']()['root']['rootName']&&!_0x2919f6['has'](_0x40abf2['name'])){const _0x46426b=_0x298cc3['schema']['getNearestSelectionRange'](_0x265c0b['deletionPosition']);if(_0x46426b){const _0x54f04c=_0x50bb47['fromRange'](_0x46426b);_0x2919f6['set'](_0x40abf2['name'],_0x54f04c),_0x54f04c['on']('change:range',(_0x29d122,_0x4b0c56,_0x4b481b)=>{if('$graveyard'==_0x54f04c['root']['rootName']){const _0x3ac71e=_0x298cc3['schema']['getNearestSelectionRange'](_0x4b481b['deletionPosition']);_0x3ac71e?(_0x54f04c['start']=_0x3ac71e['start'],_0x54f04c['end']=_0x3ac71e['end']):(_0x2919f6['delete'](_0x40abf2['name']),_0x54f04c['detach']());}});}}});}),_0x298cc3['document']['on']('change',()=>{_0x2919f6['size']>0x0&&_0x298cc3['enqueueChange']({'isUndoable':!0x1},_0x1ff703=>{for(const [_0x47f110,_0x239301]of _0x2919f6)'$graveyard'==_0x298cc3['markers']['get'](_0x47f110)['getRange']()['root']['rootName']&&(te(_0x47f110['split'](':')[0x2],_0x239301['toRange'](),_0x298cc3,_0x1ff703),_0x239301['detach']());_0x2919f6['clear']();});});}(_0x32de8b),this['_domEmitter']['listenTo'](_0x256274['document'],'keydown',(_0x1b8dfa,{key:_0x2f625f})=>{'Escape'===_0x2f625f&&function(_0x18e020){_0x18e020['editing']['view']['change'](_0x40539b=>{for(const _0x47ddd8 of _0x18e020['model']['markers']){if(!_0x47ddd8['name']['startsWith']('user:position'))continue;const _0x5cfde9=_0x18e020['editing']['mapper']['markerNameToElements'](_0x47ddd8['name']);if(_0x5cfde9){for(const _0x46a0af of _0x5cfde9)_0x40539b['removeClass']('ck-user__marker_hovered',_0x46a0af);}}});}(_0x32de8b);},{'useCapture':!0x0});}['afterInit'](){const _0x409e48=this['editor'],_0x2cfe2f=_0x409e48['commands']['get']('undo');_0x2cfe2f&&_0x409e48['model']['on']('applyOperation',(_0x33b3c6,_0x1f0116)=>{const _0x9d417a=_0x1f0116[0x0];if(!_0x9d417a['isDocumentOperation'])return;if('marker'!=_0x9d417a['type']||!_0x9d417a['name']['startsWith']('user:'))return;const _0x403d92=_0x9d417a['batch'];_0x2cfe2f['_createdBatches']['has'](_0x403d92)&&(_0x9d417a['newRange']=_0x9d417a['oldRange']?_0x409e48['model']['createRange'](_0x9d417a['oldRange']['start'],_0x9d417a['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x44d21a=this['editor'],_0x334782=_0x44d21a['model']['document'],_0x32d661=_0x44d21a['plugins']['get'](i);_0x44d21a['model']['enqueueChange']({'isUndoable':!0x1},_0x10d6e9=>{const _0x329686='user:range:'+_0x32d661['mySessionId'],_0x2e5280='user:position:'+_0x32d661['mySessionId'],_0x3a50d1=_0x44d21a['model']['markers']['has'](_0x329686);_0x44d21a['editing']['view']['hasDomSelection']?te(_0x32d661['mySessionId'],_0x334782['selection']['getFirstRange'](),_0x44d21a['model'],_0x10d6e9):_0x3a50d1&&(_0x10d6e9['removeMarker'](_0x329686),_0x10d6e9['removeMarker'](_0x2e5280));});}}function te(_0x106759,_0x3d03c2,_0x53bf4e,_0x1613cc){const _0x5e37b6='user:range:'+_0x106759,_0x3934a4='user:position:'+_0x106759,_0x3b25ec=_0x3d03c2['getContainedElement']();let _0x123f8b=_0x3d03c2['start'];if(_0x3b25ec&&_0x3b25ec['is']('element','tableCell')){const _0x22d958=function(_0x144838,_0x4e2e80){for(const _0x572b7a of _0x144838['getPositions']())if(_0x4e2e80['schema']['checkChild'](_0x572b7a,'$text'))return _0x572b7a;}(_0x3d03c2,_0x53bf4e);_0x22d958&&(_0x123f8b=_0x22d958,_0x3d03c2=_0x1613cc['createRange'](_0x123f8b));}const _0x535c76=_0x1613cc['createRange'](_0x123f8b);_0x53bf4e['markers']['has'](_0x5e37b6)?(_0x1613cc['updateMarker'](_0x5e37b6,{'range':_0x3d03c2}),_0x1613cc['updateMarker'](_0x3934a4,{'range':_0x535c76})):(_0x1613cc['addMarker'](_0x5e37b6,{'range':_0x3d03c2,'usingOperation':!0x0}),_0x1613cc['addMarker'](_0x3934a4,{'range':_0x535c76,'usingOperation':!0x0}));}function K(_0xb9a30c,_0x4e0f64,_0x4d09f7){const _0x1d5186=_0xb9a30c['t'],t=_0xb9a30c['t'];switch(_0x4e0f64){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 _0x1d5186({'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'},_0x4d09f7);default:return'';}}let X=0x1;class l extends _0x147cd0{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x1cab8d)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,$,_0x1a6203,_0x1fb28d,_0xc0661f];}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 _0x4eeaf5=this['serverHistory']['getOperations']();for(let _0x1d6408=_0x4eeaf5['length']-0x1;_0x1d6408>=0x0;_0x1d6408--){const _0x587aed=_0x4eeaf5[_0x1d6408];if(!this['_disconnectionOperations']['has'](_0x587aed))return _0x587aed['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x2395ff){if(super(_0x2395ff),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x50693a(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0xc89e2a('collaboration-missing-channelid',this);const _0x6b30aa=_0x2395ff['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x6b30aa,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x54ccce(),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 tt(this['_disconnectionOperations']);}['init'](){const _0x2db1ec=this['editor'],_0x3a6bcc=_0x2db1ec['plugins']['get'](_0x1fb28d),_0x264ab2=_0x2db1ec['plugins']['get'](n);this['listenTo'](_0x3a6bcc,'getOperationAuthor',(_0x5b1bc5,_0x2d7f93)=>{const _0x2652f2=_0x2d7f93[0x0];_0x2652f2['_authorId']&&(_0x5b1bc5['return']=_0x3a6bcc['getUser'](_0x2652f2['_authorId']),_0x5b1bc5['stop']()),null===_0x2652f2['_authorId']&&(_0x5b1bc5['return']=null,_0x5b1bc5['stop']());},{'priority':'high'}),this['listenTo'](_0x2db1ec['model']['document']['selection'],'change:range',(_0xd598c4,_0x19262e)=>{_0x19262e['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x2db1ec['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x2db1ec['model']['on']('applyOperation',(_0x56a5f1,_0x25d0d8)=>{const _0x2529e7=_0x25d0d8[0x0];_0x2529e7['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x2529e7),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x264ab2,'state',this,'_hasSynchronizationProblem',(_0x3dc449,_0x2afba5)=>'connected'===_0x3dc449&&!_0x2afba5),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x2db1ec['disableReadOnlyMode']('rtc-offline'):_0x2db1ec['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x2db1ec['disableReadOnlyMode']('rtc-offline'):_0x2db1ec['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x129b85=this['editor']['plugins']['get'](i),_0x4bd673=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x129b85['unregister'](this['_channelId']);const _0x24062b=await this['_service']['reconnect'](_0x4bd673['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x24062b)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x1b87c4=await this['_service']['getConnectedSessions']();_0x129b85['register'](this['_channelId'],_0x1b87c4),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x45ef51){if(function(_0x4038bc){return'404'===_0x4038bc['code'];}(_0x45ef51)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x375a76){return'409'===_0x375a76['code'];}(_0x45ef51)){const _0x3745f1=K(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x3745f1);}else{if(!(_0x45ef51 instanceof Y))throw _0x45ef51;this['_handleReconnectionError']();}}}}['destroy'](){const _0x41cac9=this['editor']['plugins']['get'](n),_0x82bff=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x82bff['channelSessions']['has'](this['_channelId'])&&_0x82bff['unregister'](this['_channelId']),_0x41cac9['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x40681a){if(this['sessionId']!==_0x40681a['sessionId']&&this['_lastSyncedOperationId']!==_0x40681a['lastOperationId'])throw new Y();return this['sessionId']=_0x40681a['sessionId'],this['_handleServerResponse']([],{..._0x40681a,'wereChangesApplied':!0x1,'data':_0x40681a['data']},'reconnect');}async['_connectService'](_0x400db2,_0x3ba517=!0x1){const {connection:_0x1a82d4}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x1a82d4,this['_channelId'])['then'](_0x290567=>this['_initSessionsHandling'](_0x290567))['catch'](_0x10fd7d=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x10fd7d);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x519465,_0x4f4835)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x4f4835);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x3ec09d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x400db2);this['_isPendingUpdate']=!0x0;const _0x9940a4=await this['_service']['connect'](_0x1a82d4,this['_compressOperations'](_0x400db2),_0x3ec09d);if(this['sessionId']=_0x9940a4['sessionId'],_0x3ba517){if(!_0x9940a4['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x9940a4['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x400db2,_0x9940a4,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x9940a4,_0x400db2);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x36a405=this['editor']['plugins']['get'](i),_0x48d98e=this['editor']['plugins']['get']($),_0x2b96da=_0x36a405['channelSessions']['get'](this['_channelId']);_0x2b96da&&_0x2b96da['length']>0x1?_0x48d98e['createUserMarkerOperations']():this['listenTo'](_0x36a405,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x36a405['channelSessions']['get'](this['_channelId'])['length']&&_0x48d98e['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x44739a,_0x23defe,_0x512c29,_0x5b1926){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x23defe){const _0xce306=this['_decompressOperations'](_0x512c29,_0x5b1926);await this['_fetchMissingUsers'](_0xce306),this['_handleExternalOperations'](_0xce306,_0x23defe,_0x512c29['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x4f69bc}=this['editor'];let _0x506f99;try{_0x506f99=await this['_service']['getDocumentDetails']();}catch{const _0x4327b9=K(_0x4f69bc,'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'](_0x4327b9);}const _0x56d878=_0x506f99['currentDocumentSession']||_0x506f99['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x56d878['lastOperationId']){const _0x4ae8c9=K(_0x4f69bc,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x4ae8c9);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x2c9222){const _0x26a5d1=this['editor']['plugins']['get'](i);this['listenTo'](_0x26a5d1,'sessionAdd:'+this['_channelId'],(_0x29737d,{session:_0x45d53d})=>{if(_0x45d53d['id']===_0x26a5d1['mySessionId']){_0x29737d['off']();const _0x593d2e=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x2d407e=_0x45d53d['permissions'];_0x593d2e&&_0x593d2e['isEnabled']&&(_0x2d407e=_0x2d407e['filter'](_0x157f73=>'document:write'!==_0x157f73)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x2d407e,this['_channelId']);}}),_0x26a5d1['register'](this['_channelId'],_0x2c9222);}['_initThrowingOnDataSet'](){const _0x50ed41=this['editor']['data']['set'];this['editor']['data']['set']=(..._0xf2a3fb)=>{if(!_0xf2a3fb[_0xf2a3fb['length']-0x1]['suppressErrorInCollaboration'])throw new _0xc89e2a('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x50ed41['apply'](this['editor']['data'],_0xf2a3fb);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x2241e5,[_0x1443ad])=>{if(this['_document']['version'])throw new _0xc89e2a('realtimecollaborationclient-init-document-already-initialized',this);_0x2241e5['stop'](),this['_setPendingAction']();const _0x30225f=this['editor']['config']['get']('rootsAttributes'),_0x1f698a=this['_getOperationsFromInitData'](_0x1443ad,_0x30225f);0x0==_0x1f698a['length']&&_0x1f698a['push'](new _0x583665(0x0)),_0x2241e5['return']=this['_connectService'](_0x1f698a)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x55d6ff=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x55d6ff))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2aca31,[_0x564492,_0x332726])=>{_0x2aca31['stop']();const _0x9b9d49=this['editor']['model']['document']['getRoot'](_0x564492);if(!this['_knownRootNames']['has'](_0x564492)){const _0x4af5e2=_0x332726&&_0x332726['data']?_0x332726['data']:'',_0x2da7e9=_0x332726&&_0x332726['attributes']?_0x332726['attributes']:{};await this['_loadRoot'](_0x564492,_0x4af5e2,_0x2da7e9);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x9b9d49['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x9b9d49);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x5ae70b){const _0x38ef30=this['editor']['plugins']['get'](_0x1fb28d),{connection:_0x1584da}=this['editor']['plugins']['get'](n),_0x41c891=new Set();for(const _0x1614c3 of _0x5ae70b){const _0x3d8763=_0x1614c3['_authorId'];_0x3d8763&&!_0x38ef30['getUser'](_0x3d8763)&&_0x41c891['add'](_0x3d8763);}if(0x0===_0x41c891['size'])return;const _0xf634db=await ct['getMany'](_0x1584da,Array['from'](_0x41c891));for(const _0x57ea50 of _0xf634db)_0x38ef30['getUser'](_0x57ea50['id'])||_0x38ef30['addUser'](_0x57ea50);}['_getOperationsFromInitData'](_0x20e039,_0x1294e3={}){const _0x219703=this['editor']['model'],_0x73ca36=[];let _0x150497=0x0;const _0xec4e2e='string'==typeof _0x20e039?{'main':_0x20e039}:_0x20e039;for(const _0x378ccb of Object['keys'](_0xec4e2e)){if(!this['_document']['roots']['has'](_0x378ccb))throw new _0xc89e2a('realtimecollaborationclient-init-non-existent-root',this);const _0x1a7051=this['editor']['data']['parse'](_0xec4e2e[_0x378ccb]),_0x376aef=this['_document']['getRoot'](_0x378ccb),_0x4494d0=new _0x42acf4(_0x219703['createPositionAt'](_0x376aef,0x0),_0x1a7051,_0x150497++);_0x73ca36['push'](_0x4494d0);for(const [_0x514d9b,_0x5b891f]of _0x1a7051['markers']){const _0x1b10ac=_0x219703['createRange'](_0x219703['createPositionFromPath'](_0x376aef,_0x5b891f['start']['path']['slice']()),_0x219703['createPositionFromPath'](_0x376aef,_0x5b891f['end']['path']['slice']())),_0x2b5a2f=new _0x186c9c(_0x514d9b,null,_0x1b10ac,_0x219703['markers'],!0x0,_0x150497++);_0x73ca36['push'](_0x2b5a2f);}}if(_0x1294e3)for(const [_0x546f63,_0x597699]of Object['entries'](_0x1294e3)){const _0x509299=_0x219703['document']['getRoot'](_0x546f63);if(!_0x509299)throw new _0xc89e2a('multi-root-editor-root-attributes-no-root',null);for(const [_0x25a81e,_0x57093d]of Object['entries'](_0x597699))if(null!==_0x57093d){const _0x24d2e5=new _0x1caf87(_0x509299,_0x25a81e,null,_0x57093d,_0x150497++);_0x73ca36['push'](_0x24d2e5);}}return _0x73ca36;}async['_loadRoot'](_0x6ffb66,_0x30b1ca,_0x5af030){this['_getOperationsFromInitData']({[_0x6ffb66]:_0x30b1ca},{[_0x6ffb66]:_0x5af030})['forEach']((_0x2a526e,_0x51df1)=>{_0x2a526e['baseVersion']=this['_document']['version']+_0x51df1,_0x2a526e['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2a526e);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x57ccdb,_0x25f674){let _0x207cba;this['_offset']=_0x57ccdb['offset'];const _0x1c62d1=_0x57ccdb['wereChangesApplied']&&!_0x57ccdb['initData'],_0x2bd948=_0x1c62d1?0x0:_0x57ccdb['data']['baseVersion'];if(_0x25f674['forEach'](_0x45c4d1=>{_0x45c4d1['_isInit']=!0x0,_0x45c4d1['createdAt']=_0x57ccdb['sessionCreatedAt'],_0x45c4d1['_authorId']=null;}),_0x1c62d1)_0x207cba=_0x25f674,this['_applyOperationsSet'](_0x207cba,_0x1c62d1);else{if(_0x57ccdb['initData']){const _0x1579ef=this['_getOperationsFromInitData'](_0x57ccdb['initData']);this['_document']['history']['version']=-_0x1579ef['length'],_0x1579ef['forEach'](_0xd6d53f=>{_0xd6d53f['baseVersion']-=_0x1579ef['length'],_0xd6d53f['createdAt']=_0x57ccdb['sessionCreatedAt'],_0xd6d53f['_isInit']=!0x0,_0xd6d53f['_authorId']=null;}),this['_applyOperationsSet'](_0x1579ef,!0x0),this['serverHistory']['version']=-_0x1579ef['length']+this['_offset'],this['_updateServerHistory'](_0x1579ef);}this['_document']['history']['version']=_0x2bd948,_0x207cba=this['_decompressOperations'](_0x57ccdb['data'],_0x57ccdb['metadata']),await this['_fetchMissingUsers'](_0x207cba),this['_applyOperationsSet'](_0x207cba,_0x1c62d1);}_0x57ccdb['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x207cba,_0x57ccdb['lastOperationId']),this['_lastSyncedOperationId']=_0x57ccdb['lastOperationId']),this['serverHistory']['version']=_0x2bd948+this['_offset'],this['_updateServerHistory'](_0x207cba),_0x25f674['filter'](_0x512c8d=>{const _0x5acff6=this['_getAffectedRoot'](_0x512c8d);return _0x5acff6&&!this['_knownRootNames']['has'](_0x5acff6);})['forEach']((_0x58e7ef,_0x56e8f2)=>{_0x58e7ef['baseVersion']=this['_document']['version']+_0x56e8f2,this['_saveOperationInBuffer'](_0x58e7ef);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x106704,_0x679994){const _0x4eb290=_0x679994&&_0x679994['message'];if(_0x4eb290&&_0x4eb290['startsWith']('realtimecollaborationclient'))throw _0x679994;const _0x2eae5d=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x2eae5d['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0xc89e2a(_0x106704,this['editor'],_0x4eb290?{'originalError':_0x4eb290}:void 0x0);}['_saveOperationInBuffer'](_0x3504eb){this['_knownOperations']['has'](_0x3504eb)||(this['_knownOperations']['add'](_0x3504eb),this['_bufferedOperations']['push'](_0x3504eb),this['_pendingAction']||'marker'==_0x3504eb['type']&&!_0x3504eb['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x346953=!0x1){!_0x346953&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x35090d=>{_0x35090d&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x525ed0=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x39859e){return _0x39859e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x39859e['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x39859e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x525ed0)||this['_crash'](_0x525ed0['message'],_0x525ed0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x331ca6=>{this['on']('change:_isPendingUpdate',()=>{_0x331ca6();});});}async['_sendBufferedOperations'](){const _0xca09e7=this['editor']['plugins']['get']($);if(this['_shouldSendSelectionUpdate']()&&(_0xca09e7['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x560249=[...this['_bufferedOperations']];for(const _0x185f6c of _0x560249)_0x185f6c['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x185f6c);const _0x5ee599=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x560249),_0x3560b9=X++,_0x4202c5=this['_compressOperations'](_0x560249),_0x43bb42=await this['_service']['sendOperations'](_0x4202c5,_0x4202c5['baseVersion'],_0x5ee599);try{return await this['_handleServerResponse'](_0x560249,_0x43bb42,_0x3560b9);}catch(_0x56d235){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x56d235);}}async['_handleServerResponse'](_0x2a6c2b,_0x226408,_0x3710eb){if('error'in _0x226408)throw _0x226408['error'];let _0x391a5f=!0x1;if(_0x226408['wereChangesApplied']){_0x226408['lastOperationId']&&(this['_lastSyncedOperationId']=_0x226408['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3d5e4c=>!_0x2a6c2b['includes'](_0x3d5e4c));for(const _0x230b67 of _0x2a6c2b)_0x230b67['createdAt']='lastOperationAcceptedAt'in _0x226408&&_0x226408['lastOperationAcceptedAt']||void 0x0;Z(_0x2a6c2b,_0x226408['version']-_0x2a6c2b['length']),this['_updateServerHistory'](_0x2a6c2b);const _0x72096d=_0x2a6c2b['filter'](_0x5957cc=>{if(!_0x5957cc['_isInit'])return!0x1;const _0x3ad76b=this['_getAffectedRoot'](_0x5957cc);return _0x3ad76b&&!this['_knownRootNames']['has'](_0x3ad76b);});Z(_0x72096d,this['_document']['version']),this['_applyOperationsSet'](_0x72096d),_0x391a5f=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x24ee4b=this['_decompressOperations'](_0x226408['data'],_0x226408['metadata'])['filter'](_0x2c5ed5=>_0x2c5ed5['baseVersion']>=this['_lastServerVersion']);_0x24ee4b['forEach'](_0x4f6938=>this['_addKnownRoot'](_0x4f6938)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x48e0a1=>!_0x48e0a1['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x48e0a1))),this['_bufferedOperations']['length']&&Z(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x24ee4b),_0x391a5f=this['_handleExternalOperations'](_0x24ee4b,_0x226408['version'],_0x226408['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x391a5f?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0xba01e5,_0x382d96,_0x9f278b){try{const _0x11aa8f={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x15f3de,operationsB:_0x11a56c,originalOperations:_0x4b5760}=_0x148299(_0xba01e5,this['_bufferedOperations'],_0x11aa8f);Z(_0x15f3de,this['_document']['version']),Z(_0x11a56c,_0x382d96);for(const _0x164568 of _0x15f3de){const _0xe481a5=_0x4b5760['get'](_0x164568);_0x164568['_authorId']=_0xe481a5?_0xe481a5['_authorId']:null;}_0x9f278b&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xba01e5,_0x9f278b),this['_lastSyncedOperationId']=_0x9f278b),this['_bufferedOperations']=[..._0x11a56c],this['_applyOperationsSet'](_0x15f3de),this['_updateServerHistory'](_0xba01e5);}catch(_0x278332){return console['error'](_0x278332),!0x1;}return!0x0;}['_applyOperationsSet'](_0x34c0ff,_0x2a3b60=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x2d5ffc=>{for(const _0x46981e of _0x34c0ff)this['_knownOperations']['add'](_0x46981e),this['_addKnownRoot'](_0x46981e),_0x2d5ffc['batch']['addOperation'](_0x46981e),this['editor']['model']['applyOperation'](_0x46981e);});}['_addKnownRoot'](_0x23ec46){const _0x152e4e=this['_getAffectedRoot'](_0x23ec46);_0x152e4e&&this['_knownRootNames']['add'](_0x152e4e);}['_getAffectedRoot'](_0x4b0626){let _0x5c13d3,_0x37e6af;switch(_0x4b0626['type']){case'insert':_0x5c13d3=_0x4b0626['position']['root'];break;case'marker':if(_0x37e6af=_0x4b0626['newRange'],!_0x37e6af)return null;_0x5c13d3=_0x37e6af['root'];break;case'addRootAttribute':_0x5c13d3=_0x4b0626['root'];break;case'addRoot':_0x5c13d3=_0x4b0626['affectedSelectable'];break;case'move':_0x5c13d3=_0x4b0626['targetPosition']['root'];break;default:return null;}return _0x5c13d3['rootName'];}['_updateServerHistory'](_0x2862ed){_0x2862ed['forEach'](_0x55b8bc=>{const _0x162a1f=_0x55b8bc['clone']();_0x162a1f['_authorId']=_0x55b8bc['_authorId'],_0x162a1f['_isInit']=!!_0x55b8bc['_isInit'],_0x162a1f['createdAt']=_0x55b8bc['createdAt'],_0x162a1f['baseVersion']+=this['_offset'],_0x55b8bc['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x162a1f),this['serverHistory']['addOperation'](_0x162a1f);});}['_handleReconnectionError'](_0x482f97){const _0x483610=this['editor']['plugins']['get']('Notification'),_0x446dad=this['editor']['locale'];_0x482f97||(_0x482f97=K(_0x446dad,'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.')),_0x483610['showWarning'](_0x482f97,{'title':K(_0x446dad,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x1a6203)['add'](K(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x1a6203)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x554ffc){const _0x4e79da=_0x554ffc['map'](_0x518c5d=>_0x518c5d['toJSON']());return this['_compressor']['compress'](_0x4e79da);}['_decompressOperations'](_0x29d4a5,_0x4b4d4f){return this['_compressor']['decompress'](_0x29d4a5)['map']((_0x30be0e,_0x2bea2f)=>{const _0x2c4449='init'==_0x4b4d4f[_0x2bea2f]['type'];if('InsertOperation'==_0x30be0e['__className']){const _0x46ddbe=_0x30be0e['position']['root'];!this['_document']['getRoot'](_0x46ddbe)&&(this['_document']['createRoot']('$root',_0x46ddbe)['_isAttached']=!0x1);}const _0x46f9f9=_0x59ded6['fromJSON'](_0x30be0e,this['_document']);return _0x46f9f9['wasUndone']=_0x30be0e['wasUndone'],_0x46f9f9['_isInit']=_0x2c4449,_0x46f9f9['_authorId']=_0x2c4449?null:_0x4b4d4f[_0x2bea2f]['userId'],_0x46f9f9['_isDisconnection']='cs:removeUser'===_0x4b4d4f[_0x2bea2f]['type'],_0x46f9f9['createdAt']=_0x4b4d4f[_0x2bea2f]['createdAt'],_0x46f9f9;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x336451=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x336451&&_0x336451['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Y extends Error{}function Z(_0x33d463,_0x2c22d2){for(const _0x4aebf2 of _0x33d463)_0x4aebf2['baseVersion']=_0x2c22d2++;}class tt{['_ignoredOperations'];['_operationToId'];constructor(_0x3a313c){this['_ignoredOperations']=_0x3a313c,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x142967){let _0xfd349f=_0x142967['length'];for(;_0xfd349f--;){const _0x57b4fd=_0x142967[_0xfd349f];if(!this['_ignoredOperations']['has'](_0x57b4fd)){if(!this['_operationToId']['has'](_0x57b4fd)){const _0x232747=_0x53395f()['slice'](0x1,0x12);this['_operationToId']['set'](_0x57b4fd,_0x232747);}return this['_operationToId']['get'](_0x57b4fd);}}}['setIdForTheLastOperation'](_0x1ee5fe,_0x4a9136){if(!_0x4a9136)return;let _0x3a466a=_0x1ee5fe['length'];for(;_0x3a466a--;){const _0x3245be=_0x1ee5fe[_0x3a466a];this['_ignoredOperations']['has'](_0x3245be)||this['_operationToId']['set'](_0x3245be,_0x4a9136);}}}class a extends _0x147cd0{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x3622a5{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x3be316)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x1fb28d];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xac6353){super(_0xac6353),this['_services']=new Map();}async['init'](){const _0x57ef40=this['context'],_0x104a65=_0x57ef40['plugins']['get']('CommentsRepository');if(_0x57ef40['plugins']['get'](n)['addToReconnectionStack'](this),_0x104a65['adapter']={'addCommentThread':async({channelId:_0x5cf238,threadId:_0x1d830c,comments:_0x264211,resolvedAt:_0xde554e,resolvedBy:_0x320445,context:_0x55f52e,attributes:_0x20cb4c})=>{const _0x1230f1=await this['_getService'](_0x5cf238)['addCommentThread']({'commentThreadId':_0x1d830c,'comments':_0x264211['map'](_0x3f3786=>function(_0x30c409,_0x512fce,_0x5d6e1a){return{'commentThreadId':_0x5d6e1a,'commentId':_0x30c409['commentId'],'userId':_0x30c409['authorId'],'content':_0x30c409['content'],'documentId':_0x512fce,'createdAt':_0x30c409['createdAt'],'attributes':_0x30c409['attributes']||{}};}(_0x3f3786,_0x5cf238,_0x1d830c)),'resolvedAt':_0xde554e,'resolvedBy':_0x320445,'context':_0x55f52e,'attributes':_0x20cb4c})['catch'](at);return{'threadId':_0x1230f1['commentThreadId'],'comments':_0x1230f1['comments']};},'getCommentThread':async({channelId:_0x490556,threadId:_0x2fae9d})=>{const _0x1f0d03=await this['_getService'](_0x490556)['getCommentThread'](_0x2fae9d)['catch'](F)['catch'](at);return _0x1f0d03?_0x1f0d03['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x1f0d03]),{'threadId':_0x1f0d03['commentThreadId'],'comments':_0x1f0d03['comments']['map'](S),'context':_0x1f0d03['context'],'resolvedAt':_0x1f0d03['resolvedAt'],'resolvedBy':_0x1f0d03['resolvedBy'],'attributes':_0x1f0d03['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x486a4d,threadId:_0x3d9f05,context:_0x164bfb,unlinkedAt:_0x4d84b3,attributes:_0x49be25})=>this['_getService'](_0x486a4d)['updateCommentThread']({'commentThreadId':_0x3d9f05,'context':_0x164bfb,'attributes':_0x49be25,'unlinkedAt':_0x4d84b3})['catch'](F)['catch'](at),'resolveCommentThread':async({channelId:_0x42cd87,threadId:_0x4b6baa})=>{const _0x3bc1eb=await this['_getService'](_0x42cd87)['resolveCommentThread'](_0x4b6baa)['catch'](F)['catch'](at);return{'threadId':_0x3bc1eb['commentThreadId'],'resolvedAt':_0x3bc1eb['resolvedAt'],'resolvedBy':_0x3bc1eb['resolvedBy']};},'reopenCommentThread':async({channelId:_0x23072b,threadId:_0x3960b1})=>this['_getService'](_0x23072b)['reopenCommentThread'](_0x3960b1)['catch'](F)['catch'](at),'removeCommentThread':({channelId:_0x93f8bc,threadId:_0x486a57})=>this['_getService'](_0x93f8bc)['removeCommentThread'](_0x486a57)['catch'](F)['catch'](at),'addComment':({channelId:_0x9dad87,threadId:_0xceedc3,commentId:_0x2eae5f,content:_0x44b32d,attributes:_0x162441})=>this['_getService'](_0x9dad87)['addComment'](_0xceedc3,_0x2eae5f,_0x44b32d,_0x162441)['catch'](at),'updateComment':({channelId:_0x439e6f,threadId:_0x54829d,commentId:_0x4d0723,content:_0x59b0cf,attributes:_0x57ecb8})=>this['_getService'](_0x439e6f)['updateComment'](_0x54829d,_0x4d0723,_0x59b0cf,_0x57ecb8)['catch'](F)['catch'](at),'removeComment':({channelId:_0x23b1e3,threadId:_0x40ea87,commentId:_0xde6733})=>this['_getService'](_0x23b1e3)['removeComment'](_0x40ea87,_0xde6733)['catch'](F)['catch'](at)},_0x57ef40 instanceof _0x7aab25){const _0x1a8a61=_0x57ef40['config']['get']('collaboration.channelId'),_0x4f343a=_0x57ef40['plugins']['get'](i);await this['_setUpService'](_0x1a8a61);const _0x387d1f=await this['_services']['get'](_0x1a8a61)['getConnectedSessions']();this['listenTo'](_0x4f343a,'sessionAdd:'+_0x1a8a61,(_0x3cedbf,{session:_0x1fa534})=>{_0x1fa534['id']===_0x4f343a['mySessionId']&&(_0x3cedbf['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x1fa534['permissions'],_0x1a8a61));}),_0x4f343a['register'](_0x1a8a61,_0x387d1f);}}async['_setUpService'](_0x3ce3a3){if(this['_services']['has'](_0x3ce3a3))throw new _0xc89e2a('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x3ce3a3});const _0x3759b6=this['context']['plugins']['get']('CommentsRepository'),_0x4e210a=new s['CommentsService'](_0x3ce3a3);this['_services']['set'](_0x3ce3a3,_0x4e210a),this['listenTo'](_0x4e210a,'commentThreadAdded',(_0x5b5c1e,_0x113209)=>{const {commentThreadId:_0x1275ac,documentId:_0x566535,context:_0x5b6e4f,attributes:_0x179477,resolvedAt:_0x2e79a7,resolvedBy:_0x43ea58,comments:_0x1b54fb}=_0x113209;_0x3759b6['getCommentThread'](_0x1275ac)||_0x3759b6['addCommentThread']({'threadId':_0x1275ac,'channelId':_0x566535,'comments':_0x1b54fb?_0x1b54fb['map'](S):[],'context':_0x5b6e4f,'attributes':_0x179477,'resolvedAt':_0x2e79a7,'resolvedBy':_0x43ea58,'isFromAdapter':!0x0});}),this['listenTo'](_0x4e210a,'commentThreadUpdated',(_0x3f164a,{commentThreadId:_0x252aed,documentId:_0x1c8002,context:_0x5149ac,unlinkedAt:_0x5e197c,attributes:_0x677fef})=>{_0x3759b6['getCommentThread'](_0x252aed)&&_0x3759b6['updateCommentThread']({'threadId':_0x252aed,'channelId':_0x1c8002,'context':_0x5149ac,'unlinkedAt':_0x5e197c,'attributes':_0x677fef,'isFromAdapter':!0x0});}),this['listenTo'](_0x4e210a,'commentThreadResolved',(_0x46e22d,{commentThreadId:_0x5e85bd,resolvedBy:_0x2e0f2a,resolvedAt:_0x391460})=>{const _0x1705e3=_0x3759b6['getCommentThread'](_0x5e85bd);_0x1705e3&&_0x1705e3['resolve']({'resolvedBy':_0x2e0f2a,'resolvedAt':_0x391460,'isFromAdapter':!0x0});}),this['listenTo'](_0x4e210a,'commentThreadReopened',(_0x28f91b,{commentThreadId:_0x1ebf71})=>{const _0x1a7dc0=_0x3759b6['getCommentThread'](_0x1ebf71);_0x1a7dc0&&_0x1a7dc0['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4e210a,'commentThreadRemoved',(_0x4a9d29,{commentThreadId:_0x1a2017})=>{const _0x2f4025=_0x3759b6['getCommentThread'](_0x1a2017);_0x2f4025&&_0x2f4025['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4e210a,'commentAdded',(_0x1e284f,_0x5349d4)=>{const _0x68f6b5=_0x5349d4['commentThreadId'],_0x16e43b=_0x3759b6['getCommentThread'](_0x68f6b5);_0x16e43b&&_0x16e43b['addComment']({...S(_0x5349d4),'isFromAdapter':!0x0});}),this['listenTo'](_0x4e210a,'commentUpdated',(_0x26c1b6,{commentThreadId:_0x4652a0,commentId:_0x19bd05,content:_0x3f805b,attributes:_0x27f67d})=>{const _0x488907=_0x3759b6['getCommentThread'](_0x4652a0);if(_0x488907){const _0x1de0b6=_0x488907['getComment'](_0x19bd05);_0x1de0b6&&_0x1de0b6['update']({'content':_0x3f805b,'attributes':_0x27f67d,'isFromAdapter':!0x0});}}),this['listenTo'](_0x4e210a,'commentRemoved',(_0x4226a6,{commentThreadId:_0x1eaab4,commentId:_0x414ee2})=>{const _0x245c3d=_0x3759b6['getCommentThread'](_0x1eaab4);if(_0x245c3d){const _0x2e718e=_0x245c3d['getComment'](_0x414ee2);_0x2e718e&&_0x2e718e['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x3ce3a3);}['destroy'](){if(this['context']instanceof _0x7aab25){const _0x1cc7c8=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x1cc7c8);}}['_terminateService'](_0x46b0f4){if(!this['_services']['has'](_0x46b0f4))throw new _0xc89e2a('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x46b0f4});this['_getService'](_0x46b0f4)['disconnect'](),this['_services']['delete'](_0x46b0f4);}async['reconnect'](){for(const _0x3120c8 of this['_services']['keys']())await this['_connectService'](_0x3120c8);if(this['context']instanceof _0x7aab25){const _0x3c9c8e=this['context']['config']['get']('collaboration.channelId'),_0x5e365b=this['context']['plugins']['get'](i);_0x5e365b['unregister'](_0x3c9c8e);const _0x29a4ff=await this['_services']['get'](_0x3c9c8e)['getConnectedSessions']();_0x5e365b['register'](_0x3c9c8e,_0x29a4ff);}}async['_connectService'](_0x15613a){const {connection:_0x3b6871}=this['context']['plugins']['get'](n),_0x4cbe4c=this['context']['plugins']['get']('CommentsRepository'),_0x515227=this['_services']['get'](_0x15613a),_0x124e0d=await _0x515227['connect'](_0x3b6871);await this['_fetchMissingUsersForThreads'](_0x124e0d);const _0x11a5a2=new Set(Array['from'](_0x4cbe4c['getCommentThreads']({'channelId':_0x15613a}),_0x36030a=>_0x36030a['id']));for(const _0x40f773 of _0x124e0d)_0x40f773['deletedAt']||_0x11a5a2['delete'](_0x40f773['commentThreadId']);for(const _0x332715 of _0x11a5a2)_0x4cbe4c['getCommentThread'](_0x332715)['remove']({'isFromAdapter':!0x0});for(const _0x2e594f of _0x124e0d){let _0x366465=_0x4cbe4c['getCommentThread'](_0x2e594f['commentThreadId']);const {commentThreadId:_0x49fc43,context:_0x2f415b,attributes:_0x37c43a,resolvedBy:_0x43aaf3,resolvedAt:_0x396e96,unlinkedAt:_0xd595cd,deletedAt:_0x2cb014}=_0x2e594f;if(_0x2cb014)continue;_0x366465||(_0x366465=_0x4cbe4c['addCommentThread']({'channelId':_0x15613a,'threadId':_0x49fc43,'context':_0x2f415b,'attributes':_0x37c43a||{},'resolvedBy':_0x43aaf3,'resolvedAt':_0x396e96,'unlinkedAt':_0xd595cd,'isFromAdapter':!0x0}));const _0x1aebd7=new Set(Array['from'](_0x366465['comments'],_0x57916=>_0x57916['id']));for(const _0x210d02 of _0x2e594f['comments'])_0x1aebd7['delete'](_0x210d02['commentId']);for(const _0x121b3e of _0x1aebd7)_0x366465['getComment'](_0x121b3e)['remove']({'isFromAdapter':!0x0});for(const _0x5a739a of _0x2e594f['comments']){const _0x55431a=_0x366465['getComment'](_0x5a739a['commentId']);_0x55431a?_0x55431a['content']!==_0x5a739a['content']&&_0x55431a['update']({'content':_0x5a739a['content'],'isFromAdapter':!0x0}):_0x366465['addComment'](Object['assign'](S(_0x5a739a),{'isFromAdapter':!0x0}));}}}['_getService'](_0x5781f3){if(!this['_services']['has'](_0x5781f3))throw new _0xc89e2a('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x5781f3});return this['_services']['get'](_0x5781f3);}async['_fetchMissingUsersForThreads'](_0x44a2b5){const _0x2b9563=this['context']['plugins']['get'](_0x1fb28d),{connection:_0x4231a4}=this['context']['plugins']['get'](n),_0x565656=new Set();for(const {resolvedBy:_0x37d282,comments:_0x5daa91}of _0x44a2b5){_0x37d282&&!_0x2b9563['getUser'](_0x37d282)&&_0x565656['add'](_0x37d282);for(const {userId:_0x28ba6d}of _0x5daa91)_0x2b9563['getUser'](_0x28ba6d)||_0x565656['add'](_0x28ba6d);}if(0x0===_0x565656['size'])return;const _0x38df45=await ct['getMany'](_0x4231a4,Array['from'](_0x565656));for(const _0x21651e of _0x38df45)_0x2b9563['getUser'](_0x21651e['id'])||_0x2b9563['addUser'](_0x21651e);}}async function F(_0x163dda){if('404'!==_0x163dda['code'])throw _0x163dda;}function at(_0x4365ef){if((_0x3c874c=_0x4365ef)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x3c874c['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3c874c['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x3c874c;throw _0x4365ef;}function S(_0x17842e){return{'threadId':_0x17842e['commentThreadId'],'commentId':_0x17842e['commentId'],'content':_0x17842e['content'],'createdAt':_0x17842e['createdAt'],'authorId':_0x17842e['userId'],'attributes':_0x17842e['attributes']||{}};}class m extends _0x147cd0{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x4891a6)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x1fb28d];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x9ccca4){super(_0x9ccca4);const _0xa52af2=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0xa52af2);}async['init'](){const _0x5a5ddb=this['editor']['plugins']['get'](l),_0xfc7195=_0x5a5ddb['serverHistory'],_0x43be81=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0xfc7195,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x5a5ddb['sessionId']});const _0x2124be=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x3f4974=await _0x46d6a6['isBundleUploaded'](_0x43be81['connection'],_0x2124be);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x39228a})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x39228a)),'updateRevisions':async _0x281c93=>{await this['_waitForServiceReady']();const _0x582031=this['_revisionTracker']['currentRevision'];if(_0x3f4974&&0x1===_0x281c93['length']&&_0x281c93[0x0]['id']===_0x582031['id'])return _0x281c93;for(const _0x5a267a of _0x281c93)_0x5a267a['id']===_0x582031['id']&&(_0x5a267a['isEmptyCurrent']=_0x5a267a['fromVersion']===_0x5a267a['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x281c93,this['_lastRequestId'])['then'](_0x1ef38d=>(this['_lastRequestId']=_0x1ef38d,_0x281c93))['catch'](_0xd0d452=>{if(q(_0xd0d452)||'400'===_0xd0d452['code']&&void 0x0!==_0xd0d452['data']['wrongRequestId']){for(const _0x401401 of _0x281c93){!this['_revisionTracker']['repository']['getRevision'](_0x401401['id'])||this['_revisionTracker']['_bufferUpdate'](_0x401401['id'],_0x401401,!0x1);}if(q(_0xd0d452))throw _0xd0d452;return _0x281c93;}throw _0xd0d452;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3c00d8,{revisionsData:_0x494cf6,requestId:_0x45bca9})=>{Math['max'](..._0x494cf6['map'](_0x1d442e=>_0x1d442e['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x494cf6,_0x45bca9);}):this['_handleRevisionsUpdate'](_0x494cf6,_0x45bca9);});const {revisions:_0x2a4ae7,requestId:_0x14cb7f}=await this['_revisionHistoryService']['connect'](_0x43be81['connection']);_0x43be81['addToReconnectionStack'](this),this['_lastRequestId']=_0x14cb7f,await this['_fetchMissingUsers'](_0x2a4ae7);for(const _0x48ae68 of _0x2a4ae7)this['_revisionTracker']['addRevisionData'](_0x48ae68);this['listenTo'](_0x5a5ddb,'change:_isConnected',(_0x3a77f9,_0x54a311,_0x140800)=>{_0x140800&&(this['_oldOffset']=_0x5a5ddb['_offset'],_0x3a77f9['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x43be81,'state',_0x5e7a62=>_0x5e7a62===_0x46af62['CONNECTED']);}async['reconnect'](){const _0x5eee3e=this['editor']['plugins']['get'](n),_0x296e57=this['editor']['plugins']['get'](l),_0x10fb02=async()=>{const _0x27ec26=this['_revisionTracker']['currentRevision'],_0x595696=_0x27ec26['id'],_0x2c4ed2=_0x595696!==_0x296e57['sessionId'];if(_0x2c4ed2){const _0x153fee=_0x296e57['_offset']-this['_oldOffset'],_0x27ca71=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x27ec26['toVersion']+_0x153fee!==_0x27ca71){const _0x49dad7=_0x27ec26['fromVersion']+_0x153fee,_0x1a52a2=this['editor']['plugins']['get'](_0x1fb28d),_0x1c2217=this['_revisionTracker']['buildRevisionData']({'revision':_0x27ec26,'from':_0x49dad7,'to':_0x27ca71});_0x1c2217['id']=_0x27ec26['id'];const _0x506503=_0x1c2217['authorsIds']['map'](_0x5297a3=>_0x1a52a2['getUser'](_0x5297a3));_0x27ec26['_update']({..._0x1c2217,'authors':_0x506503},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x27ec26['id'],_0x1c2217,!0x0);}this['_revisionTracker']['_startingVersion']=_0x27ca71,(_0x27ec26['toVersion']===_0x27ec26['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x595696)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x595696),this['_revisionTracker']['_createCurrentRevision'](_0x27ca71));}const {revisions:_0x5876a7,requestId:_0x24f899}=await this['_revisionHistoryService']['reconnect'](_0x5eee3e['connection'],this['_lastRequestId']);_0x2c4ed2&&_0x5876a7['length']>0x0?_0x296e57['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x5876a7),this['_handleRevisionsUpdate'](_0x5876a7,_0x24f899),this['_revisionTracker']['sendBufferedUpdates']());};return _0x296e57['_isConnected']?_0x10fb02():new Promise((_0x11e661,_0x3c5e1b)=>{_0x296e57['once']('change:_isConnected',()=>{_0x10fb02()['then'](_0x11e661)['catch'](_0x3c5e1b);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x2b5cbe=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x37d781=>{_0x37d781['off'](),_0x2b5cbe();});});}['_getLatestVersionFromServerOperations'](){const _0x5829f9=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x3b49f1 of _0x5829f9)if('marker'!==_0x3b49f1['type']||_0x3b49f1['affectsData'])return _0x3b49f1['baseVersion']+0x1;}['_getLatestVersion'](){const _0x38ad5f=this['editor']['plugins']['get'](l);return new Promise(_0x191983=>{_0x38ad5f['_isPendingUpdate']?_0x38ad5f['once']('change:_isPendingUpdate',()=>{_0x191983(this['_getLatestVersionFromServerOperations']());}):_0x191983(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x5ee868,_0x9a8746){const _0x1ffab1=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x9a8746;for(const _0x49d694 of _0x5ee868){const _0x5c0952=_0x1ffab1['getRevision'](_0x49d694['id']);if(_0x5c0952){if((_0x49d694['fromVersion']||_0x49d694['toVersion'])&&(_0x49d694['diffData']=null),_0x5c0952===this['_revisionTracker']['currentRevision']){const _0x106f24=Math['max'](_0x5c0952['toVersion'],_0x49d694['toVersion']),_0x18a5f4=Math['max'](_0x5c0952['fromVersion'],_0x49d694['fromVersion']);let _0x2c4015;_0x5c0952['toVersion']===_0x49d694['toVersion']&&_0x5c0952['fromVersion']===_0x49d694['fromVersion']?(_0x2c4015=!0x0,this['_preventResendingRevisionData'](_0x49d694)):_0x49d694['toVersion']===_0x106f24&&_0x49d694['fromVersion']===_0x18a5f4?_0x2c4015=!0x1:(_0x5c0952['toVersion']===_0x106f24&&_0x5c0952['fromVersion']===_0x18a5f4||this['_fixRevision']({'revision':_0x5c0952,'from':_0x18a5f4,'to':_0x106f24}),_0x2c4015=!0x0),_0x2c4015&&(delete _0x49d694['fromVersion'],delete _0x49d694['toVersion'],delete _0x49d694['diffData'],delete _0x49d694['createdAt'],delete _0x49d694['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x49d694),this['_preventResendingRevisionData'](_0x49d694);}else this['_revisionTracker']['addRevisionData'](_0x49d694);}const _0x525058=_0x1ffab1['getRevisions']();_0x525058['reverse']();for(let _0x45aef5=0x0;_0x45aef5<_0x525058['length']-0x1;_0x45aef5++){const _0x10a8c6=_0x525058[_0x45aef5],_0x2300f8=_0x525058[_0x45aef5+0x1];if(_0x10a8c6['fromVersion']<_0x2300f8['toVersion']){const _0x4fc637=_0x2300f8['toVersion'],_0x3a5de1=Math['max'](_0x4fc637,_0x10a8c6['toVersion']);this['_fixRevision']({'revision':_0x10a8c6,'from':_0x4fc637,'to':_0x3a5de1});}}}['_fixRevision']({revision:_0x1453d7,from:_0x29526f,to:_0x558e6c}={}){const _0x3967ac=this['editor']['plugins']['get'](_0x1fb28d),_0x2d5157=this['_revisionTracker']['buildRevisionData']({'revision':_0x1453d7,'from':_0x29526f,'to':_0x558e6c});_0x2d5157['authors']=_0x2d5157['authorsIds']['map'](_0x4a27af=>_0x3967ac['getUser'](_0x4a27af)),_0x1453d7['_update'](_0x2d5157);}['_preventResendingRevisionData'](_0x5dec7a){const _0x5dac7c={};_0x5dac7c['id']=_0x5dec7a['id'];for(const _0x453853 of Object['keys'](_0x5dec7a))'id'!==_0x453853&&(_0x5dac7c[_0x453853]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x5dac7c['id'],_0x5dac7c,!0x0);}async['_fetchMissingUsers'](_0x2f58bc){const _0x3a257c=this['editor']['plugins']['get'](_0x1fb28d),{connection:_0x14c439}=this['editor']['plugins']['get'](n),_0x8c1640=new Set();for(const _0x348ab8 of _0x2f58bc){for(const _0x4a7c9b of _0x348ab8['authorsIds'])_0xf80f25(_0x4a7c9b);_0x348ab8['creatorId']&&_0xf80f25(_0x348ab8['creatorId']);}if(0x0===_0x8c1640['size'])return;const _0x201420=await ct['getMany'](_0x14c439,Array['from'](_0x8c1640));for(const _0x57d3de of _0x201420)_0x3a257c['getUser'](_0x57d3de['id'])||_0x3a257c['addUser'](_0x57d3de);function _0xf80f25(_0x55f7fd){_0x3a257c['getUser'](_0x55f7fd)||_0x8c1640['add'](_0x55f7fd);}}}function q(_0x2353be){return _0x2353be['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2353be['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2353be['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class dt extends _0x147cd0{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x189f71{['_collapseAt'];constructor(_0x24e006,_0x4c4b88=0x6){super(_0x24e006);const _0x1edc18=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x4c4b88,this['bind']('isHidden')['to'](this,'usersCount',_0x37e8e6=>_0x37e8e6<_0x4c4b88),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x1edc18['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0x1edc18['to']('usersCount',_0x50c023=>'+'+(_0x50c023-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x189f71{['items'];['keystrokes'];constructor(_0x46bbd0){super(_0x46bbd0);const _0x4f3d27=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x37c8ef(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x4f3d27['if']('hasPopup'),'aria-expanded':_0x4f3d27['to']('isExpanded',_0xeb8a32=>this['hasPopup']&&String(_0xeb8a32)),'aria-label':_0x4f3d27['to']('hasPopup',_0x42ec6e=>K(_0x46bbd0,_0x42ec6e?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x4f3d27['to']('hasPopup',_0x44a30b=>!!_0x44a30b&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x4f3d27['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x4f3d27['to'](_0x2a3563=>{const _0x4be5ad=_0x2a3563,_0x2e718f=document['querySelector']('.ck-presence-list__dropdown-list'),_0x3fbc13=document['querySelector']('.ck-balloon-panel_with-arrow');_0x2e718f?.['contains'](_0x4be5ad['relatedTarget'])||_0x3fbc13?.['contains'](_0x4be5ad['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x504508,_0x5798ea,_0x225810)=>{this['element']&&(_0x225810?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 v extends _0x189f71{['counterView'];['inlineListView'];constructor(_0x210661,_0x50b2c6=0x6){super(_0x210661);const _0x57cb10=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x50b2c6),this['inlineListView']=new is(_0x210661),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x3d6517 of this['inlineListView']['items'])_0x3d6517['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',_0x57cb10['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x189f71{['listWrapperView'];constructor(_0x45c473,_0x4979b0){super(_0x45c473);const _0x4a81cf=this['bindTemplate'];this['listWrapperView']=new ut(_0x45c473,_0x4979b0),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':K(_0x45c473,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x4a81cf['to'](_0x294125=>{const _0x47d5ae=_0x294125,_0x5767ab=document['querySelector']('.ck-presence-list__list'),_0x26f845=document['querySelector']('.ck-balloon-panel_with-arrow');_0x5767ab?.['contains'](_0x47d5ae['relatedTarget'])||_0x26f845?.['contains'](_0x47d5ae['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class ut extends _0x1ecd86{constructor(_0x1e519c,_0x387401){super(_0x1e519c);const _0x1ca77f=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x387401?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x1ca77f['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x1ca77f['to']('role'),'aria-label':_0x1ca77f['to']('ariaLabel'),'aria-labelledby':_0x1ca77f['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x256274['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x5a6884=this['element'];_0x5a6884&&(this['_isScrollable']=Math['max'](_0x5a6884['scrollHeight'],_0x5a6884['clientHeight'])>0.8*window['innerHeight']);}}class j extends et{['userView'];constructor(_0x21d002,_0x981294,_0xae81a1){super(_0x21d002);const _0x17439d=this['bindTemplate'];this['userView']=new st(_0x21d002,_0x981294);const _0xac8dca={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x981294['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x981294['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x981294['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0xae81a1&&(_0xac8dca['tag']='button',_0xac8dca['on']={'click':_0x17439d['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0xac8dca);}['focus'](){this['element']['focus']();}}class A extends _0x189f71{['userView'];['markerView'];constructor(_0x512865,_0x5bc726,_0x5b1f38){super(_0x512865);const _0x5bc929=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x512865,_0x5bc726),this['markerView']=new ot(_0x512865,_0x5bc726);const _0x999f3=new it(_0x512865);_0x999f3['template']['tag']='span',_0x999f3['text']=_0x5bc726['name'];const _0x32ee22={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5bc929['to']('isFocusable',_0x1d185f=>!!_0x1d185f&&0x0),'aria-labelledby':_0x999f3['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5bc929['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5bc929['to']('hasTooltip',_0x55e525=>!_0x55e525),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x999f3]};_0x5b1f38&&(_0x32ee22['tag']='button',_0x32ee22['on']={'click':_0x5bc929['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x32ee22);}}class ot extends _0x189f71{constructor(_0x2608ce,_0xfdde33){super(_0x2608ce),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xfdde33['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x3622a5{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x113f5f){super(_0x113f5f),this['context']['config']['define']('presenceList',x);const _0x1b8c31=_0x113f5f['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x1b8c31)throw new _0xc89e2a('presencelist-collapseat-invalid-format',this);if(_0x1b8c31<0x1)throw new _0xc89e2a('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x15e0cd(),this['balloonPanelView']=new _0x2f4310(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x2baf67 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x2baf67);this['listenTo'](this['_allConnectedUsers'],'add',(_0x2abdb4,_0x14a125)=>{this['_handleUserAdd'](_0x14a125);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x148e37,_0x5abe1d)=>{this['_handleUserRemove'](_0x5abe1d);});}['_createView'](){const _0x286897=this['context'],_0x1d7dc8=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x2385c9=this['balloonPanelView'];if(!_0x489d51(_0x286897['config']['get']('presenceList.container')))throw new _0xc89e2a('presencelist-missing-container',this);return _0x1d7dc8['counterView']['bind']('usersCount')['to'](this),_0x1d7dc8['bind']('isCollapsed')['to'](this,'usersCount',_0x4ac010=>{const {collapseAt:_0xa3278d}=_0x286897['config']['get']('presenceList'),_0x34010a=_0x4ac010>=_0xa3278d;if(_0x34010a&&!_0x1d7dc8['inlineListView']['items']['find'](_0x213d6c=>_0x213d6c instanceof b)){const _0x35959b=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x35959b&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x1d7dc8['inlineListView']['items']['add'](_0x1d7dc8['counterView']);}return _0x34010a||this['hideDropdown'](),_0x34010a;}),_0x1d7dc8['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0xc1f5c5=>{const _0x3af577=_0x286897['config']['get']('presenceList'),_0x578b66=new A(_0x286897['locale'],_0xc1f5c5,!!_0x3af577['onClick']);return _0x578b66['bind']('hasTooltip')['to'](_0x1d7dc8,'isCollapsed',_0x289f6d=>!_0x289f6d),_0x578b66['bind']('isFocusable')['to'](_0x1d7dc8,'isCollapsed',_0xc650a3=>!_0xc650a3),_0x3af577['onClick']&&this['listenTo'](_0x578b66,'execute',()=>{this['view']['isCollapsed']||_0x3af577['onClick'](_0xc1f5c5,_0x578b66['element']);}),_0x578b66;}),this['listenTo'](_0x1d7dc8['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x1d7dc8['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x1d7dc8['inlineListView']['keystrokes']['set']('Enter',(_0x2a2592,_0x5875a5)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x5875a5());}),_0x1d7dc8['render'](),_0x2385c9['render'](),_0x3491fb({'emitter':_0x1d7dc8,'activator':()=>_0x2385c9['isVisible'],'contextElements':[_0x2385c9['element'],_0x1d7dc8['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x286897['config']['get']('presenceList.container')['appendChild'](_0x1d7dc8['element']),this['_bodyCollection']=new _0x207d27(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x1d7dc8;}['_handleUserAdd'](_0x21324c){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x21324c['isMe'])return;const _0x2f22a4=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x2f22a4-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x10a724=_0x21324c['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x21324c,_0x10a724);}['_handleUserRemove'](_0x291471){this['usersCount']--;const {collapseAt:_0x3f9d45}=this['context']['config']['get']('presenceList'),_0x218475=this['usersCount']>=_0x3f9d45;if(this['currentDisplayedUsers']['get'](_0x291471['id']))this['currentDisplayedUsers']['remove'](_0x291471['id']);else{if(_0x218475&&this['currentDisplayedUsers']['length']+0x1===_0x3f9d45-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x218475?0x1:0x0)<this['usersCount']){for(const _0x47371b of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x47371b['id'])&&(this['currentDisplayedUsers']['add'](_0x47371b,Math['min'](this['currentDisplayedUsers']['length']-(_0x218475?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x218475?0x1:0x0)===_0x3f9d45-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x5d7204=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x5d7204['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x50742c}=this['presenceDropdownView'];_0x50742c['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x16a946=>{if(!_0x5d7204['displayMe']&&_0x16a946['isMe'])return null;const _0x5de637=new j(this['context']['locale'],_0x16a946,!!_0x5d7204['onClick']);return _0x5d7204['onClick']&&this['listenTo'](_0x5de637,'execute',()=>{_0x5d7204['onClick'](_0x16a946,_0x5de637['element']);}),_0x5de637;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x50742c['focus'](),_0x50742c['checkIfScrollable']();const _0x3acc94=(_0x173925,_0x3af9b3)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3af9b3();};_0x50742c['keystrokes']['set']('Esc',_0x3acc94),_0x50742c['keystrokes']['set']('Shift+Tab',_0x3acc94),_0x50742c['keystrokes']['set']('Tab',(_0x556cf5,_0x59b48a)=>{!function(_0x80f0b){const _0x4ddc0c=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x4122b4=>_0x4122b4+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x4414be=[...document['body']['querySelectorAll'](_0x4ddc0c)]['filter'](_0xdc13b0=>_0xdc13b0===document['activeElement']||_0xdc13b0['offsetWidth']+_0xdc13b0['offsetHeight']>0x0)['sort']((_0x59e8bd,_0x5de1c0)=>(_0x59e8bd['tabIndex']||0x0)-(_0x5de1c0['tabIndex']||0x0)),_0x1e359a=_0x4414be['indexOf'](_0x80f0b),_0x2d83fe=_0x4414be[(_0x1e359a+0x1)%_0x4414be['length']];_0x2d83fe&&_0x2d83fe['focus']();}(this['view']['element']),this['hideDropdown'](),_0x59b48a();}),_0x50742c['focusTracker']['add'](this['view']['element']),_0x50742c['focusTracker']['on']('change:isFocused',(_0xc587b6,_0x5040a6,_0x28177e)=>{_0x28177e||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 ft extends _0x3622a5{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,ft as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,dt as RealTimeCollaborativeRevisionHistory,lt as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|
|
23
|
+
import{ContextPlugin as _0x30f1c1,Plugin as _0x2db22b,PendingActions as _0x2cb9a5,Context as tt}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x3e8656,CKEditorError as _0x1d5a00,Collection as _0x58c1e0,global as _0x2bfaf9,version as ht,uid as _0x10ba7d,KeystrokeHandler as _0x2d8e87}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x205a02,View as _0x55006c,ListView as _0x32cb91,ListItemView as rt,LabelView as at,BalloonPanelView as _0xf7afb,clickOutsideHandler as _0x58a9e6,BodyCollection as _0x3f70a6}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x193441,History as _0x278641,NoOperation as _0x265da0,InsertOperation as _0x4d4990,MarkerOperation as _0x5c7a4b,RootAttributeOperation as _0x3f4d0b,transformOperationSets as _0x430af8,OperationFactory as _0x3caf06}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as dt,WEB_SOCKET_GATEWAY_STATES as _0x4d5800,CollaborativeEditingService as _0x524947,User as ut,CommentsService as et,TrackChangesService as it,RevisionHistoryService as _0x3d0be0,EditorService as _0xa346ac}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x1e6d0b,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x3b4bbc}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x23b94a}from'es-toolkit/compat';class n extends _0x30f1c1{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>dt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x205a02];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x331666){super(_0x331666),this['set']('state',_0x4d5800['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x3e8656())();}['init'](){const _0x53e48b=this['context'],_0x4ca8e3=_0x53e48b['plugins']['get']('CloudServices'),_0x1acefd=_0x53e48b['plugins']['get'](_0x205a02);if(!_0x4ca8e3['token'])throw new _0x1d5a00('websocketgateway-missing-token',this);if(!_0x4ca8e3['webSocketUrl'])throw new _0x1d5a00('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),n['WebSocketGateway']['connect'](_0x4ca8e3['token'],_0x4ca8e3['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0xf4f46b=>{if(this['connection']=_0xf4f46b,this['bind']('state')['to'](_0xf4f46b,'state',this,'_isBrowserOffline',(_0x222c4f,_0x2684eb)=>('connected'!==_0x222c4f&&(this['_shouldPluginsReconnect']=!0x0),_0x2684eb||_0x222c4f!==_0x4d5800['CONNECTED']?_0x4d5800['DISCONNECTED']:this['state']==_0x4d5800['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x4d5800['CONNECTING']):_0x4d5800['CONNECTED'])),this['connection']['on']('error',(_0x40e8c5,_0x4a0d37)=>{if('limitExceeded'!==_0x4a0d37['code'])throw console['error'](_0x4a0d37),new _0x1d5a00('cloudservices-init',null,{'originalError':_0x4a0d37});_0x1acefd['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'});}),!_0xf4f46b['me'])return new Promise(_0x4698f9=>_0xf4f46b['on']('change:me',_0x4698f9));})['catch'](_0x3dc966=>{throw console['error'](_0x3dc966),new _0x1d5a00('cloudservices-init',null,{'originalError':_0x3dc966});});}['addToReconnectionStack'](_0x1ab122){if('function'!=typeof _0x1ab122['reconnect'])throw new _0x1d5a00('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x1ab122))throw new _0x1d5a00('websocketgateway-plugin-already-registered',this,{'name':_0x1ab122['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x1ab122);}['removeFromReconnectionStack'](_0x5c10f9){this['_reconnectionStack']['delete'](_0x5c10f9);}['isInReconnectionStack'](_0x5b33dd){return this['_reconnectionStack']['has'](_0x5b33dd);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x1dc4c5=>_0x1dc4c5['reconnect']())))['then'](()=>this['state']=_0x4d5800['CONNECTED'])['catch'](_0x1dbb8d=>{throw console['error'](_0x1dbb8d),new _0x1d5a00('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x4d5800['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x30f1c1{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[n,_0x1e6d0b];}constructor(_0x16f240){super(_0x16f240),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x58c1e0(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1e6d0b);}['init'](){const _0x223212=this['context']['plugins']['get'](n);this['listenTo'](_0x223212,'change:state',(_0x45619d,_0x13b383,_0x225a75)=>{if('connected'!==_0x225a75)this['channelSessions']['forEach'](_0x2fbb47=>_0x2fbb47['clear']()),this['channelConnectedUsers']['forEach'](_0x1c11c0=>_0x1c11c0['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x31a453,_0x28b045]of this['_registeredSessions'])for(const _0xce7b6c of _0x28b045)this['_handleSessionAdd'](_0x31a453,_0xce7b6c);}}),this['_createUser'](_0x223212['connection']['me'],!0x0);}['register'](_0x26146c,_0x47b7ae){if(this['_registeredSessions']['has'](_0x26146c))throw new _0x1d5a00('sessions-register-already-registered',null,{'channelId':_0x26146c});this['_registeredSessions']['set'](_0x26146c,_0x47b7ae),this['channelSessions']['set'](_0x26146c,new _0x58c1e0()),this['channelConnectedUsers']['set'](_0x26146c,new _0x58c1e0()),this['listenTo'](_0x47b7ae,'add',(_0x50fe18,_0x1741ab)=>this['_handleSessionAdd'](_0x26146c,_0x1741ab)),this['listenTo'](_0x47b7ae,'remove',(_0x3889c8,_0x5704be)=>this['_handleSessionRemove'](_0x26146c,_0x5704be));for(const _0x5e9dec of _0x47b7ae)this['_handleSessionAdd'](_0x26146c,_0x5e9dec);}['unregister'](_0x59539d){if(!this['_registeredSessions']['has'](_0x59539d))throw new _0x1d5a00('sessions-unregister-not-exist',null,{'channelId':_0x59539d});const _0x196837=this['_registeredSessions']['get'](_0x59539d);this['stopListening'](_0x196837);for(const _0x3ecefc of _0x196837)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x59539d,_0x3ecefc);this['_registeredSessions']['delete'](_0x59539d),this['channelSessions']['delete'](_0x59539d),this['channelConnectedUsers']['delete'](_0x59539d);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x318219){for(const _0x3d9513 of this['channelSessions']['values']())for(const _0x43665e of _0x3d9513)if(_0x43665e['id']===_0x318219)return _0x43665e['user'];}['getUserSessions'](_0x1a3319,_0x1060b4){const _0x380609=_0x1060b4?[this['channelSessions']['get'](_0x1060b4)]:this['channelSessions']['values'](),_0x97380d=new Set();for(const _0x316eac of _0x380609)for(const _0x528025 of _0x316eac)_0x528025['user']['id']===_0x1a3319['id']&&_0x97380d['add'](_0x528025['id']);return _0x97380d;}['getUserRole'](_0x1d46aa){for(const _0x39d3e5 of this['channelSessions']['values']())for(const _0x10c75d of _0x39d3e5)if(_0x10c75d['user']===_0x1d46aa)return _0x10c75d['role'];}['_handleSessionAdd'](_0x39ccc4,_0x34bed6){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0xf972cb=_0x34bed6['user'],_0x24ba86=this['_users']['getUser'](_0xf972cb['id'])||this['_createUser'](_0xf972cb),_0x46380d=Object['assign']({},_0x34bed6,{'user':_0x24ba86});if(this['channelSessions']['get'](_0x39ccc4)['add'](_0x46380d),!_0xf972cb['hiddenInPresenceList']){const _0x4a2c9b=this['channelConnectedUsers']['get'](_0x39ccc4);_0x4a2c9b['has'](_0x24ba86['id'])||_0x4a2c9b['add'](_0x24ba86),this['allConnectedUsers']['has'](_0x24ba86['id'])||_0xf972cb['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x24ba86,_0x24ba86['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x39ccc4,{'channelId':_0x39ccc4,'session':_0x46380d});}['_handleSessionRemove'](_0x29fd28,_0x240c4f){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x224d58=this['channelConnectedUsers']['get'](_0x29fd28),_0x150aac=_0x240c4f['user'];_0x150aac['id']&&(this['channelSessions']['get'](_0x29fd28)['remove'](_0x240c4f['id']),_0x224d58['has'](_0x150aac['id'])&&!this['getUserSessions'](_0x150aac,_0x29fd28)['size']&&_0x224d58['remove'](_0x150aac['id']),this['allConnectedUsers']['get'](_0x150aac['id'])&&!this['getUserSessions'](_0x150aac)['size']&&this['allConnectedUsers']['remove'](_0x150aac['id']));}['_createUser'](_0x2892a4,_0x4ca664){const _0xc5ba01=this['_users']['addUser'](_0x2892a4);return _0x4ca664&&this['_users']['defineMe'](_0x2892a4['id']),_0xc5ba01['orderNumber']=this['_uniqueUsersCount']++,_0xc5ba01;}}class U extends _0x2db22b{['_domEmitter']=new(_0x3e8656())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x47813e=this['editor'],_0x2d987c=_0x47813e['plugins']['get'](i);_0x47813e['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x300b76,{writer:_0x1cce1c})=>function(_0x174b5b,_0x1564d5,_0x1c5320,_0x476298){const _0x51c323=_0x174b5b['markerName']['split'](':')[0x2],_0x3a41ce=_0x1c5320['getUserBySessionId'](_0x51c323);if(!_0x3a41ce||_0x51c323===_0x1c5320['mySessionId'])return;if(!_0x476298['model']['schema']['checkChild'](_0x174b5b['markerRange']['start'],'$text'))return;const _0x46e0e9={'class':'ck-user__marker\x20'+_0x3a41ce['color']['getMarkerClass'](),'data-name':_0x3a41ce['name'],'data-session-id':_0x51c323},_0x432fae=_0x476298['model']['markers']['get'](_0x174b5b['markerName']),_0x2d51de=_0x432fae['getStart'](),_0x3696e3=_0x2d51de['nodeAfter'],_0x45a6d3=_0x476298['model']['schema'];if(_0x3696e3&&_0x45a6d3['isObject'](_0x3696e3)&&_0x45a6d3['isInline'](_0x3696e3)&&!_0x476298['model']['markers']['get']('user:range:'+_0x51c323)['getRange']()['isCollapsed'])return;const _0x31424c=_0x2d51de['parent'];return _0x476298['model']['schema']['isLimit'](_0x31424c)&&!_0x476298['model']['hasContent'](_0x31424c)&&(_0x46e0e9['contenteditable']=!0x1),function(_0x5e25cd,_0x21c917,_0x214c07){const _0x55cfea=_0x5e25cd['createUIElement']('span',_0x21c917);return _0x5e25cd['setCustomProperty']('userPositionMarker',!0x0,_0x55cfea),_0x55cfea['render']=function(_0x5e8d8b){const _0x1e0dbf=this['toDomElement'](_0x5e8d8b),_0x4e25bb=document['createElement']('span');return _0x4e25bb['classList']['add']('ck-user__marker-tooltip'),_0x4e25bb['setAttribute']('contenteditable','false'),_0x4e25bb['setAttribute']('spellcheck','false'),_0x4e25bb['textContent']=_0x214c07['name'],_0x1e0dbf['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x4e25bb['outerHTML']+'',_0x1e0dbf['addEventListener']('mouseenter',()=>{_0x1e0dbf['classList']['add']('ck-user__marker_hovered');}),_0x1e0dbf['addEventListener']('mouseleave',()=>{_0x1e0dbf['classList']['remove']('ck-user__marker_hovered');}),_0x1e0dbf;},_0x55cfea['isSimilar']=function(_0x1797a0){return!(!this['getCustomProperty']('userPositionMarker')||!_0x1797a0['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x1797a0['getAttribute']('data-session-id'));},_0x55cfea;}(_0x1564d5,_0x46e0e9,_0x3a41ce);}(_0x300b76,_0x1cce1c,_0x2d987c,_0x47813e)}),_0x47813e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x3cb144=>function(_0xaf8ddf,_0x2fe2f9){const _0x129dfd=_0xaf8ddf['markerName']['split'](':')[0x2];if(_0x129dfd===_0x2fe2f9['mySessionId'])return null;const _0x344bb2=_0x2fe2f9['getUserBySessionId'](_0x129dfd);if(!_0x344bb2)return{'id':_0x129dfd,'classes':[]};return{'id':_0x129dfd,'classes':['ck-user__selection',_0x344bb2['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x129dfd},'priority':0x7d0+_0x344bb2['orderNumber']};}(_0x3cb144,_0x2d987c)}),function(_0x528438){const _0x5a0956=_0x528438['model'],_0x2b405f=new Map(),_0x289342=_0x528438['plugins']['get'](i);_0x5a0956['markers']['on']('update:user:range',(_0x40b5ba,_0x1d6d86,_0x1dc90a,_0x4140e0)=>{if(!_0x4140e0&&_0x2b405f['get'](_0x1d6d86['name']))return _0x2b405f['get'](_0x1d6d86['name'])['detach'](),void _0x2b405f['delete'](_0x1d6d86['name']);const _0x177f32=_0x1d6d86['name']['split'](':')[0x2];if(_0x177f32===_0x289342['mySessionId'])return;const _0x24c96f='user:position:'+_0x177f32;_0x5a0956['markers']['has'](_0x24c96f)&&_0x528438['editing']['reconvertMarker'](_0x24c96f),_0x1d6d86['on']('change:range',(_0x5cb689,_0x393247,_0x37403c)=>{if('$graveyard'!=_0x393247['root']['rootName']&&'$graveyard'==_0x1d6d86['getRange']()['root']['rootName']&&!_0x2b405f['has'](_0x1d6d86['name'])){const _0x4b445f=_0x5a0956['schema']['getNearestSelectionRange'](_0x37403c['deletionPosition']);if(_0x4b445f){const _0x487676=_0x193441['fromRange'](_0x4b445f);_0x2b405f['set'](_0x1d6d86['name'],_0x487676),_0x487676['on']('change:range',(_0x4af0ff,_0x205cba,_0x50be5f)=>{if('$graveyard'==_0x487676['root']['rootName']){const _0x33cbc7=_0x5a0956['schema']['getNearestSelectionRange'](_0x50be5f['deletionPosition']);_0x33cbc7?(_0x487676['start']=_0x33cbc7['start'],_0x487676['end']=_0x33cbc7['end']):(_0x2b405f['delete'](_0x1d6d86['name']),_0x487676['detach']());}});}}});}),_0x5a0956['document']['on']('change',()=>{_0x2b405f['size']>0x0&&_0x5a0956['enqueueChange']({'isUndoable':!0x1},_0x14306c=>{for(const [_0x12e497,_0x59b084]of _0x2b405f)'$graveyard'==_0x5a0956['markers']['get'](_0x12e497)['getRange']()['root']['rootName']&&(J(_0x12e497['split'](':')[0x2],_0x59b084['toRange'](),_0x5a0956,_0x14306c),_0x59b084['detach']());_0x2b405f['clear']();});});}(_0x47813e),this['_domEmitter']['listenTo'](_0x2bfaf9['document'],'keydown',(_0x184bff,{key:_0x1bfaad})=>{'Escape'===_0x1bfaad&&function(_0x56a86c){_0x56a86c['editing']['view']['change'](_0xfd3979=>{for(const _0x20680c of _0x56a86c['model']['markers']){if(!_0x20680c['name']['startsWith']('user:position'))continue;const _0x2c767a=_0x56a86c['editing']['mapper']['markerNameToElements'](_0x20680c['name']);if(_0x2c767a){for(const _0x51420c of _0x2c767a)_0xfd3979['removeClass']('ck-user__marker_hovered',_0x51420c);}}});}(_0x47813e);},{'useCapture':!0x0});}['afterInit'](){const _0x49ac23=this['editor'],_0x13f0a8=_0x49ac23['commands']['get']('undo');_0x13f0a8&&_0x49ac23['model']['on']('applyOperation',(_0x5c2c45,_0x49ee21)=>{const _0x5c0dc3=_0x49ee21[0x0];if(!_0x5c0dc3['isDocumentOperation'])return;if('marker'!=_0x5c0dc3['type']||!_0x5c0dc3['name']['startsWith']('user:'))return;const _0x178b1c=_0x5c0dc3['batch'];_0x13f0a8['_createdBatches']['has'](_0x178b1c)&&(_0x5c0dc3['newRange']=_0x5c0dc3['oldRange']?_0x49ac23['model']['createRange'](_0x5c0dc3['oldRange']['start'],_0x5c0dc3['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x3bb999=this['editor'],_0x4b4b53=_0x3bb999['model']['document'],_0x54ebd0=_0x3bb999['plugins']['get'](i);_0x3bb999['model']['enqueueChange']({'isUndoable':!0x1},_0x17e203=>{const _0x1356e1='user:range:'+_0x54ebd0['mySessionId'],_0x5a175c='user:position:'+_0x54ebd0['mySessionId'],_0x2400a4=_0x3bb999['model']['markers']['has'](_0x1356e1);_0x3bb999['editing']['view']['hasDomSelection']?J(_0x54ebd0['mySessionId'],_0x4b4b53['selection']['getFirstRange'](),_0x3bb999['model'],_0x17e203):_0x2400a4&&(_0x17e203['removeMarker'](_0x1356e1),_0x17e203['removeMarker'](_0x5a175c));});}}function J(_0xb85a,_0x48ce81,_0x567b53,_0x39e4b1){const _0x24bd51='user:range:'+_0xb85a,_0x2387ba='user:position:'+_0xb85a,_0x59ae69=_0x48ce81['getContainedElement']();let _0x1fd044=_0x48ce81['start'];if(_0x59ae69&&_0x59ae69['is']('element','tableCell')){const _0xc27d2e=function(_0x114e24,_0x3a920f){for(const _0x4826a7 of _0x114e24['getPositions']())if(_0x3a920f['schema']['checkChild'](_0x4826a7,'$text'))return _0x4826a7;}(_0x48ce81,_0x567b53);_0xc27d2e&&(_0x1fd044=_0xc27d2e,_0x48ce81=_0x39e4b1['createRange'](_0x1fd044));}const _0x14cad4=_0x39e4b1['createRange'](_0x1fd044);_0x567b53['markers']['has'](_0x24bd51)?(_0x39e4b1['updateMarker'](_0x24bd51,{'range':_0x48ce81}),_0x39e4b1['updateMarker'](_0x2387ba,{'range':_0x14cad4})):(_0x39e4b1['addMarker'](_0x24bd51,{'range':_0x48ce81,'usingOperation':!0x0}),_0x39e4b1['addMarker'](_0x2387ba,{'range':_0x14cad4,'usingOperation':!0x0}));}function E(_0x526916,_0x57f278,_0x32ef8d){const _0x2b1707=_0x526916['t'],t=_0x526916['t'];switch(_0x57f278){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 _0x2b1707({'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'},_0x32ef8d);default:return'';}}let H=0x1;class l extends _0x2db22b{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x524947)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,U,_0x2cb9a5,_0x1e6d0b,_0x205a02];}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 _0x4b8eb5=this['serverHistory']['getOperations']();for(let _0x4af675=_0x4b8eb5['length']-0x1;_0x4af675>=0x0;_0x4af675--){const _0x59f90f=_0x4b8eb5[_0x4af675];if(!this['_disconnectionOperations']['has'](_0x59f90f))return _0x59f90f['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x513cc9){if(super(_0x513cc9),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x278641(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1d5a00('collaboration-missing-channelid',this);const _0x3798d2=_0x513cc9['config']['get']('cloudServices.bundleVersion')||ht;this['_service']=new l['CollaborativeEditingService'](_0x3798d2,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x3b4bbc(),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 F(this['_disconnectionOperations']);}['init'](){const _0x3d056b=this['editor'],_0x4f948a=_0x3d056b['plugins']['get'](_0x1e6d0b),_0x1d2c99=_0x3d056b['plugins']['get'](n);this['listenTo'](_0x4f948a,'getOperationAuthor',(_0x4d2079,_0xa413f1)=>{const _0x4bf222=_0xa413f1[0x0];_0x4bf222['_authorId']&&(_0x4d2079['return']=_0x4f948a['getUser'](_0x4bf222['_authorId']),_0x4d2079['stop']()),null===_0x4bf222['_authorId']&&(_0x4d2079['return']=null,_0x4d2079['stop']());},{'priority':'high'}),this['listenTo'](_0x3d056b['model']['document']['selection'],'change:range',(_0x119639,_0x4ac70f)=>{_0x4ac70f['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x3d056b['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x3d056b['model']['on']('applyOperation',(_0x14b034,_0x301165)=>{const _0x87b000=_0x301165[0x0];_0x87b000['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x87b000),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x1d2c99,'state',this,'_hasSynchronizationProblem',(_0x4ea403,_0x48d9c8)=>'connected'===_0x4ea403&&!_0x48d9c8),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x3d056b['disableReadOnlyMode']('rtc-offline'):_0x3d056b['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x3d056b['disableReadOnlyMode']('rtc-offline'):_0x3d056b['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x3f1275=this['editor']['plugins']['get'](i),_0x2327bd=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x3f1275['unregister'](this['_channelId']);const _0x11a05f=await this['_service']['reconnect'](_0x2327bd['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x11a05f)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x5a2a45=await this['_service']['getConnectedSessions']();_0x3f1275['register'](this['_channelId'],_0x5a2a45),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x2292aa){if(function(_0x1f681a){return'404'===_0x1f681a['code'];}(_0x2292aa)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x3f0b8f){return'409'===_0x3f0b8f['code'];}(_0x2292aa)){const _0x3c6911=E(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'](_0x3c6911);}else{if(!(_0x2292aa instanceof V))throw _0x2292aa;this['_handleReconnectionError']();}}}}['destroy'](){const _0x34b2db=this['editor']['plugins']['get'](n),_0x1402b3=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x1402b3['channelSessions']['has'](this['_channelId'])&&_0x1402b3['unregister'](this['_channelId']),_0x34b2db['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0xc40724){if(this['sessionId']!==_0xc40724['sessionId']&&this['_lastSyncedOperationId']!==_0xc40724['lastOperationId'])throw new V();return this['sessionId']=_0xc40724['sessionId'],this['_handleServerResponse']([],{..._0xc40724,'wereChangesApplied':!0x1,'data':_0xc40724['data']},'reconnect');}async['_connectService'](_0x3f2b3e,_0x42c381=!0x1){const {connection:_0x35a3dd}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x35a3dd,this['_channelId'])['then'](_0x47bfb1=>this['_initSessionsHandling'](_0x47bfb1))['catch'](_0x244aec=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x244aec);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x5d51d5,_0x21e3df)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x21e3df);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x276e6f=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3f2b3e);this['_isPendingUpdate']=!0x0;const _0x2e737d=await this['_service']['connect'](_0x35a3dd,this['_compressOperations'](_0x3f2b3e),_0x276e6f);if(this['sessionId']=_0x2e737d['sessionId'],_0x42c381){if(!_0x2e737d['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x2e737d['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x3f2b3e,_0x2e737d,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x2e737d,_0x3f2b3e);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x5c2c25=this['editor']['plugins']['get'](i),_0x46b322=this['editor']['plugins']['get'](U),_0x3e0b37=_0x5c2c25['channelSessions']['get'](this['_channelId']);_0x3e0b37&&_0x3e0b37['length']>0x1?_0x46b322['createUserMarkerOperations']():this['listenTo'](_0x5c2c25,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x5c2c25['channelSessions']['get'](this['_channelId'])['length']&&_0x46b322['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x12e734,_0x1f2f66,_0x56c418,_0x59e445){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1f2f66){const _0x4ff729=this['_decompressOperations'](_0x56c418,_0x59e445);await this['_fetchMissingUsers'](_0x4ff729),this['_handleExternalOperations'](_0x4ff729,_0x1f2f66,_0x56c418['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x2404a2}=this['editor'];let _0x44f698;try{_0x44f698=await this['_service']['getDocumentDetails']();}catch{const _0x24b9b3=E(_0x2404a2,'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'](_0x24b9b3);}const _0x3b9395=_0x44f698['currentDocumentSession']||_0x44f698['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x3b9395['lastOperationId']){const _0x3da51b=E(_0x2404a2,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x3da51b);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x5c60d8){const _0x4b1870=this['editor']['plugins']['get'](i);this['listenTo'](_0x4b1870,'sessionAdd:'+this['_channelId'],(_0xe9a4a9,{session:_0x4f55d9})=>{if(_0x4f55d9['id']===_0x4b1870['mySessionId']){_0xe9a4a9['off']();const _0x45927f=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x3d6173=_0x4f55d9['permissions'];_0x45927f&&_0x45927f['isEnabled']&&(_0x3d6173=_0x3d6173['filter'](_0x16efaf=>'document:write'!==_0x16efaf)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x3d6173,this['_channelId']);}}),_0x4b1870['register'](this['_channelId'],_0x5c60d8);}['_initThrowingOnDataSet'](){const _0x319d2a=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x295034)=>{if(!_0x295034[_0x295034['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1d5a00('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x319d2a['apply'](this['editor']['data'],_0x295034);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x262c6d,[_0x550851])=>{if(this['_document']['version'])throw new _0x1d5a00('realtimecollaborationclient-init-document-already-initialized',this);_0x262c6d['stop'](),this['_setPendingAction']();const _0xd0d15f=this['editor']['config']['get']('rootsAttributes'),_0x42af54=this['_getOperationsFromInitData'](_0x550851,_0xd0d15f);0x0==_0x42af54['length']&&_0x42af54['push'](new _0x265da0(0x0)),_0x262c6d['return']=this['_connectService'](_0x42af54)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x374440=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x374440))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x4571fd,[_0x377759,_0x25a337])=>{_0x4571fd['stop']();const _0xd99e19=this['editor']['model']['document']['getRoot'](_0x377759);if(!this['_knownRootNames']['has'](_0x377759)){const _0x5c37c7=_0x25a337&&_0x25a337['data']?_0x25a337['data']:'',_0xfde5f6=_0x25a337&&_0x25a337['attributes']?_0x25a337['attributes']:{};await this['_loadRoot'](_0x377759,_0x5c37c7,_0xfde5f6);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0xd99e19['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0xd99e19);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xd183cd){const _0x5384d8=this['editor']['plugins']['get'](_0x1e6d0b),{connection:_0x103e1d}=this['editor']['plugins']['get'](n),_0x16fc69=new Set();for(const _0x12f4d9 of _0xd183cd){const _0x2e9c19=_0x12f4d9['_authorId'];_0x2e9c19&&!_0x5384d8['getUser'](_0x2e9c19)&&_0x16fc69['add'](_0x2e9c19);}if(0x0===_0x16fc69['size'])return;const _0x2805ec=await ut['getMany'](_0x103e1d,Array['from'](_0x16fc69));for(const _0x3ea290 of _0x2805ec)_0x5384d8['getUser'](_0x3ea290['id'])||_0x5384d8['addUser'](_0x3ea290);}['_getOperationsFromInitData'](_0x32feac,_0x47d232={}){const _0xef9e64=this['editor']['model'],_0x4d19fa=[];let _0x57c2ab=0x0;const _0x328bd2='string'==typeof _0x32feac?{'main':_0x32feac}:_0x32feac;for(const _0x530c57 of Object['keys'](_0x328bd2)){if(!this['_document']['roots']['has'](_0x530c57))throw new _0x1d5a00('realtimecollaborationclient-init-non-existent-root',this);const _0x40e84d=this['editor']['data']['parse'](_0x328bd2[_0x530c57]),_0x1783d6=this['_document']['getRoot'](_0x530c57),_0x38d18b=new _0x4d4990(_0xef9e64['createPositionAt'](_0x1783d6,0x0),_0x40e84d,_0x57c2ab++);_0x4d19fa['push'](_0x38d18b);for(const [_0x47db16,_0x124428]of _0x40e84d['markers']){const _0x5a8a42=_0xef9e64['createRange'](_0xef9e64['createPositionFromPath'](_0x1783d6,_0x124428['start']['path']['slice']()),_0xef9e64['createPositionFromPath'](_0x1783d6,_0x124428['end']['path']['slice']())),_0x41826d=new _0x5c7a4b(_0x47db16,null,_0x5a8a42,_0xef9e64['markers'],!0x0,_0x57c2ab++);_0x4d19fa['push'](_0x41826d);}}if(_0x47d232)for(const [_0x3c7671,_0x1949c3]of Object['entries'](_0x47d232)){const _0xbed6b5=_0xef9e64['document']['getRoot'](_0x3c7671);if(!_0xbed6b5)throw new _0x1d5a00('multi-root-editor-root-attributes-no-root',null);for(const [_0x38a6ba,_0x3cb1d6]of Object['entries'](_0x1949c3))if(null!==_0x3cb1d6){const _0x57db97=new _0x3f4d0b(_0xbed6b5,_0x38a6ba,null,_0x3cb1d6,_0x57c2ab++);_0x4d19fa['push'](_0x57db97);}}return _0x4d19fa;}async['_loadRoot'](_0x53e70a,_0x517a16,_0x276dd0){this['_getOperationsFromInitData']({[_0x53e70a]:_0x517a16},{[_0x53e70a]:_0x276dd0})['forEach']((_0x44882b,_0x3af326)=>{_0x44882b['baseVersion']=this['_document']['version']+_0x3af326,_0x44882b['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x44882b);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x27021b,_0x4a3dbb){let _0x19bb26;this['_offset']=_0x27021b['offset'];const _0x2016ef=_0x27021b['wereChangesApplied']&&!_0x27021b['initData'],_0x2d61e9=_0x2016ef?0x0:_0x27021b['data']['baseVersion'];if(_0x4a3dbb['forEach'](_0x3dfe8f=>{_0x3dfe8f['_isInit']=!0x0,_0x3dfe8f['createdAt']=_0x27021b['sessionCreatedAt'],_0x3dfe8f['_authorId']=null;}),_0x2016ef)_0x19bb26=_0x4a3dbb,this['_applyOperationsSet'](_0x19bb26,_0x2016ef);else{if(_0x27021b['initData']){const _0x55aa94=this['_getOperationsFromInitData'](_0x27021b['initData']);this['_document']['history']['version']=-_0x55aa94['length'],_0x55aa94['forEach'](_0x42e407=>{_0x42e407['baseVersion']-=_0x55aa94['length'],_0x42e407['createdAt']=_0x27021b['sessionCreatedAt'],_0x42e407['_isInit']=!0x0,_0x42e407['_authorId']=null;}),this['_applyOperationsSet'](_0x55aa94,!0x0),this['serverHistory']['version']=-_0x55aa94['length']+this['_offset'],this['_updateServerHistory'](_0x55aa94);}this['_document']['history']['version']=_0x2d61e9,_0x19bb26=this['_decompressOperations'](_0x27021b['data'],_0x27021b['metadata']),await this['_fetchMissingUsers'](_0x19bb26),this['_applyOperationsSet'](_0x19bb26,_0x2016ef);}_0x27021b['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x19bb26,_0x27021b['lastOperationId']),this['_lastSyncedOperationId']=_0x27021b['lastOperationId']),this['serverHistory']['version']=_0x2d61e9+this['_offset'],this['_updateServerHistory'](_0x19bb26),_0x4a3dbb['filter'](_0x317738=>{const _0x509904=this['_getAffectedRoot'](_0x317738);return _0x509904&&!this['_knownRootNames']['has'](_0x509904);})['forEach']((_0x56b1fd,_0x960605)=>{_0x56b1fd['baseVersion']=this['_document']['version']+_0x960605,this['_saveOperationInBuffer'](_0x56b1fd);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x28e615,_0x16150e){const _0x2fb784=_0x16150e&&_0x16150e['message'];if(_0x2fb784&&_0x2fb784['startsWith']('realtimecollaborationclient'))throw _0x16150e;const _0x4ccef5=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x4ccef5['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1d5a00(_0x28e615,this['editor'],_0x2fb784?{'originalError':_0x2fb784}:void 0x0);}['_saveOperationInBuffer'](_0x142bc2){this['_knownOperations']['has'](_0x142bc2)||(this['_knownOperations']['add'](_0x142bc2),this['_bufferedOperations']['push'](_0x142bc2),this['_pendingAction']||'marker'==_0x142bc2['type']&&!_0x142bc2['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x459ad6=!0x1){!_0x459ad6&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x12fa55=>{_0x12fa55&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x598b04=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x12973b){return _0x12973b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x12973b['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x12973b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x598b04)||this['_crash'](_0x598b04['message'],_0x598b04);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x558b28=>{this['on']('change:_isPendingUpdate',()=>{_0x558b28();});});}async['_sendBufferedOperations'](){const _0x280e31=this['editor']['plugins']['get'](U);if(this['_shouldSendSelectionUpdate']()&&(_0x280e31['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x4c8995=[...this['_bufferedOperations']];for(const _0x2dff77 of _0x4c8995)_0x2dff77['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x2dff77);const _0x33b616=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4c8995),_0xd434b2=H++,_0x912608=this['_compressOperations'](_0x4c8995),_0x158873=await this['_service']['sendOperations'](_0x912608,_0x912608['baseVersion'],_0x33b616);try{return await this['_handleServerResponse'](_0x4c8995,_0x158873,_0xd434b2);}catch(_0x14f084){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x14f084);}}async['_handleServerResponse'](_0x25efc8,_0x5b0517,_0x868490){if('error'in _0x5b0517)throw _0x5b0517['error'];let _0x421816=!0x1;if(_0x5b0517['wereChangesApplied']){_0x5b0517['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5b0517['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x32c93f=>!_0x25efc8['includes'](_0x32c93f));for(const _0x6752ab of _0x25efc8)_0x6752ab['createdAt']='lastOperationAcceptedAt'in _0x5b0517&&_0x5b0517['lastOperationAcceptedAt']||void 0x0;W(_0x25efc8,_0x5b0517['version']-_0x25efc8['length']),this['_updateServerHistory'](_0x25efc8);const _0x55f46b=_0x25efc8['filter'](_0xbfef34=>{if(!_0xbfef34['_isInit'])return!0x1;const _0x3acbd2=this['_getAffectedRoot'](_0xbfef34);return _0x3acbd2&&!this['_knownRootNames']['has'](_0x3acbd2);});W(_0x55f46b,this['_document']['version']),this['_applyOperationsSet'](_0x55f46b),_0x421816=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x5c6e31=this['_decompressOperations'](_0x5b0517['data'],_0x5b0517['metadata'])['filter'](_0x13c583=>_0x13c583['baseVersion']>=this['_lastServerVersion']);_0x5c6e31['forEach'](_0x4c8167=>this['_addKnownRoot'](_0x4c8167)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5c8b69=>!_0x5c8b69['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x5c8b69))),this['_bufferedOperations']['length']&&W(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x5c6e31),_0x421816=this['_handleExternalOperations'](_0x5c6e31,_0x5b0517['version'],_0x5b0517['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x421816?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x315bb8,_0x53a67a,_0x45f236){try{const _0x34aaec={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x47a4a4,operationsB:_0x179cb7,originalOperations:_0x433bb2}=_0x430af8(_0x315bb8,this['_bufferedOperations'],_0x34aaec);W(_0x47a4a4,this['_document']['version']),W(_0x179cb7,_0x53a67a);for(const _0x3aadfc of _0x47a4a4){const _0x2e5b8f=_0x433bb2['get'](_0x3aadfc);_0x3aadfc['_authorId']=_0x2e5b8f?_0x2e5b8f['_authorId']:null;}_0x45f236&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x315bb8,_0x45f236),this['_lastSyncedOperationId']=_0x45f236),this['_bufferedOperations']=[..._0x179cb7],this['_applyOperationsSet'](_0x47a4a4),this['_updateServerHistory'](_0x315bb8);}catch(_0x404bd6){return console['error'](_0x404bd6),!0x1;}return!0x0;}['_applyOperationsSet'](_0x32b56a,_0x528592=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x21b5c3=>{for(const _0x29618b of _0x32b56a)this['_knownOperations']['add'](_0x29618b),this['_addKnownRoot'](_0x29618b),_0x21b5c3['batch']['addOperation'](_0x29618b),this['editor']['model']['applyOperation'](_0x29618b);});}['_addKnownRoot'](_0x24ed36){const _0x5995ca=this['_getAffectedRoot'](_0x24ed36);_0x5995ca&&this['_knownRootNames']['add'](_0x5995ca);}['_getAffectedRoot'](_0x294dae){let _0x5721af,_0x4b94cc;switch(_0x294dae['type']){case'insert':_0x5721af=_0x294dae['position']['root'];break;case'marker':if(_0x4b94cc=_0x294dae['newRange'],!_0x4b94cc)return null;_0x5721af=_0x4b94cc['root'];break;case'addRootAttribute':_0x5721af=_0x294dae['root'];break;case'addRoot':_0x5721af=_0x294dae['affectedSelectable'];break;case'move':_0x5721af=_0x294dae['targetPosition']['root'];break;default:return null;}return _0x5721af['rootName'];}['_updateServerHistory'](_0x12d704){_0x12d704['forEach'](_0x5b05c5=>{const _0x200b83=_0x5b05c5['clone']();_0x200b83['_authorId']=_0x5b05c5['_authorId'],_0x200b83['_isInit']=!!_0x5b05c5['_isInit'],_0x200b83['createdAt']=_0x5b05c5['createdAt'],_0x200b83['baseVersion']+=this['_offset'],_0x5b05c5['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x200b83),this['serverHistory']['addOperation'](_0x200b83);});}['_handleReconnectionError'](_0x31aa2c){const _0x477636=this['editor']['plugins']['get']('Notification'),_0x47d19b=this['editor']['locale'];_0x31aa2c||(_0x31aa2c=E(_0x47d19b,'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.')),_0x477636['showWarning'](_0x31aa2c,{'title':E(_0x47d19b,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x2cb9a5)['add'](E(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x2cb9a5)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x36d643){const _0x5eb6e0=_0x36d643['map'](_0x447505=>_0x447505['toJSON']());return this['_compressor']['compress'](_0x5eb6e0);}['_decompressOperations'](_0xf7e80a,_0x1890c5){return this['_compressor']['decompress'](_0xf7e80a)['map']((_0x4f2177,_0x5ad6c4)=>{const _0x567ece='init'==_0x1890c5[_0x5ad6c4]['type'];if('InsertOperation'==_0x4f2177['__className']){const _0x368762=_0x4f2177['position']['root'];!this['_document']['getRoot'](_0x368762)&&(this['_document']['createRoot']('$root',_0x368762)['_isAttached']=!0x1);}const _0x380dcf=_0x3caf06['fromJSON'](_0x4f2177,this['_document']);return _0x380dcf['wasUndone']=_0x4f2177['wasUndone'],_0x380dcf['_isInit']=_0x567ece,_0x380dcf['_authorId']=_0x567ece?null:_0x1890c5[_0x5ad6c4]['userId'],_0x380dcf['_isDisconnection']='cs:removeUser'===_0x1890c5[_0x5ad6c4]['type'],_0x380dcf['createdAt']=_0x1890c5[_0x5ad6c4]['createdAt'],_0x380dcf;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x588de4=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x588de4&&_0x588de4['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class V extends Error{}function W(_0x498cbc,_0xb7d01){for(const _0x37c82e of _0x498cbc)_0x37c82e['baseVersion']=_0xb7d01++;}class F{['_ignoredOperations'];['_operationToId'];constructor(_0x343730){this['_ignoredOperations']=_0x343730,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x5bf5d7){let _0x4a118d=_0x5bf5d7['length'];for(;_0x4a118d--;){const _0x34dc70=_0x5bf5d7[_0x4a118d];if(!this['_ignoredOperations']['has'](_0x34dc70)){if(!this['_operationToId']['has'](_0x34dc70)){const _0xb1fe65=_0x10ba7d()['slice'](0x1,0x12);this['_operationToId']['set'](_0x34dc70,_0xb1fe65);}return this['_operationToId']['get'](_0x34dc70);}}}['setIdForTheLastOperation'](_0x2bc498,_0xc57379){if(!_0xc57379)return;let _0x4fef79=_0x2bc498['length'];for(;_0x4fef79--;){const _0x1fe9d9=_0x2bc498[_0x4fef79];this['_ignoredOperations']['has'](_0x1fe9d9)||this['_operationToId']['set'](_0x1fe9d9,_0xc57379);}}}class a extends _0x2db22b{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x30f1c1{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>et)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x1e6d0b];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x9b1380){super(_0x9b1380),this['_services']=new Map();}async['init'](){const _0x130313=this['context'],_0x3990d2=_0x130313['plugins']['get']('CommentsRepository');if(_0x130313['plugins']['get'](n)['addToReconnectionStack'](this),_0x3990d2['adapter']={'addCommentThread':async({channelId:_0xb93755,threadId:_0x8652e7,comments:_0x463673,resolvedAt:_0x2e9303,resolvedBy:_0x1606c6,context:_0x26df93,attributes:_0x38d63a})=>{const _0x34af3a=await this['_getService'](_0xb93755)['addCommentThread']({'commentThreadId':_0x8652e7,'comments':_0x463673['map'](_0x2c3e3d=>function(_0x5d881e,_0x52a21f,_0xb457db){return{'commentThreadId':_0xb457db,'commentId':_0x5d881e['commentId'],'userId':_0x5d881e['authorId'],'content':_0x5d881e['content'],'documentId':_0x52a21f,'createdAt':_0x5d881e['createdAt'],'attributes':_0x5d881e['attributes']||{}};}(_0x2c3e3d,_0xb93755,_0x8652e7)),'resolvedAt':_0x2e9303,'resolvedBy':_0x1606c6,'context':_0x26df93,'attributes':_0x38d63a})['catch'](ft);return{'threadId':_0x34af3a['commentThreadId'],'comments':_0x34af3a['comments']};},'getCommentThread':async({channelId:_0x15e0f1,threadId:_0x541e97})=>{const _0x44fd13=await this['_getService'](_0x15e0f1)['getCommentThread'](_0x541e97)['catch'](ot)['catch'](ft);return _0x44fd13?_0x44fd13['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x44fd13]),{'threadId':_0x44fd13['commentThreadId'],'comments':_0x44fd13['comments']['map'](st),'context':_0x44fd13['context'],'resolvedAt':_0x44fd13['resolvedAt'],'resolvedBy':_0x44fd13['resolvedBy'],'attributes':_0x44fd13['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x4fda6e,threadId:_0x27f9cc,context:_0x57c74d,unlinkedAt:_0x4ef2f3,attributes:_0x2b6700})=>this['_getService'](_0x4fda6e)['updateCommentThread']({'commentThreadId':_0x27f9cc,'context':_0x57c74d,'attributes':_0x2b6700,'unlinkedAt':_0x4ef2f3})['catch'](ot)['catch'](ft),'resolveCommentThread':async({channelId:_0x566ee7,threadId:_0x4698ae})=>{const _0x2106c7=await this['_getService'](_0x566ee7)['resolveCommentThread'](_0x4698ae)['catch'](ot)['catch'](ft);return{'threadId':_0x2106c7['commentThreadId'],'resolvedAt':_0x2106c7['resolvedAt'],'resolvedBy':_0x2106c7['resolvedBy']};},'reopenCommentThread':async({channelId:_0xbe67cd,threadId:_0x26d321})=>this['_getService'](_0xbe67cd)['reopenCommentThread'](_0x26d321)['catch'](ot)['catch'](ft),'removeCommentThread':({channelId:_0x415a02,threadId:_0x3161c9})=>this['_getService'](_0x415a02)['removeCommentThread'](_0x3161c9)['catch'](ot)['catch'](ft),'addComment':({channelId:_0x17873e,threadId:_0x559150,commentId:_0x507e10,content:_0x318304,attributes:_0x54339a})=>this['_getService'](_0x17873e)['addComment'](_0x559150,_0x507e10,_0x318304,_0x54339a)['catch'](ft),'updateComment':({channelId:_0x8c789a,threadId:_0x2d57ad,commentId:_0x41dacf,content:_0x20f7f3,attributes:_0x38c829})=>this['_getService'](_0x8c789a)['updateComment'](_0x2d57ad,_0x41dacf,_0x20f7f3,_0x38c829)['catch'](ot)['catch'](ft),'removeComment':({channelId:_0x4a595a,threadId:_0x4393f1,commentId:_0x442074})=>this['_getService'](_0x4a595a)['removeComment'](_0x4393f1,_0x442074)['catch'](ot)['catch'](ft)},_0x130313 instanceof tt){const _0x1833ea=_0x130313['config']['get']('collaboration.channelId'),_0x2ee81e=_0x130313['plugins']['get'](i);await this['_setUpService'](_0x1833ea);const _0x3075a9=await this['_services']['get'](_0x1833ea)['getConnectedSessions']();this['listenTo'](_0x2ee81e,'sessionAdd:'+_0x1833ea,(_0x4c9284,{session:_0x3d46fe})=>{_0x3d46fe['id']===_0x2ee81e['mySessionId']&&(_0x4c9284['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3d46fe['permissions'],_0x1833ea));}),_0x2ee81e['register'](_0x1833ea,_0x3075a9);}}async['_setUpService'](_0x396a1f){if(this['_services']['has'](_0x396a1f))throw new _0x1d5a00('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x396a1f});const _0x3a91a0=this['context']['plugins']['get']('CommentsRepository'),_0x30b708=new s['CommentsService'](_0x396a1f);this['_services']['set'](_0x396a1f,_0x30b708),this['listenTo'](_0x30b708,'commentThreadAdded',(_0x35de2f,_0xd925c)=>{const {commentThreadId:_0x467948,documentId:_0x3dabc2,context:_0x4acfa5,attributes:_0x35ff62,resolvedAt:_0x1e0226,resolvedBy:_0x1f8e57,comments:_0x413d56}=_0xd925c;_0x3a91a0['getCommentThread'](_0x467948)||_0x3a91a0['addCommentThread']({'threadId':_0x467948,'channelId':_0x3dabc2,'comments':_0x413d56?_0x413d56['map'](st):[],'context':_0x4acfa5,'attributes':_0x35ff62,'resolvedAt':_0x1e0226,'resolvedBy':_0x1f8e57,'isFromAdapter':!0x0});}),this['listenTo'](_0x30b708,'commentThreadUpdated',(_0x53efbc,{commentThreadId:_0x9bf89a,documentId:_0x2abc5b,context:_0x50598e,unlinkedAt:_0x2f8278,attributes:_0x36ecc4})=>{_0x3a91a0['getCommentThread'](_0x9bf89a)&&_0x3a91a0['updateCommentThread']({'threadId':_0x9bf89a,'channelId':_0x2abc5b,'context':_0x50598e,'unlinkedAt':_0x2f8278,'attributes':_0x36ecc4,'isFromAdapter':!0x0});}),this['listenTo'](_0x30b708,'commentThreadResolved',(_0x5c6a31,{commentThreadId:_0xaf37a4,resolvedBy:_0x26c018,resolvedAt:_0x43ec2c})=>{const _0x10938f=_0x3a91a0['getCommentThread'](_0xaf37a4);_0x10938f&&_0x10938f['resolve']({'resolvedBy':_0x26c018,'resolvedAt':_0x43ec2c,'isFromAdapter':!0x0});}),this['listenTo'](_0x30b708,'commentThreadReopened',(_0x13bf87,{commentThreadId:_0x304aba})=>{const _0x43a9ce=_0x3a91a0['getCommentThread'](_0x304aba);_0x43a9ce&&_0x43a9ce['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x30b708,'commentThreadRemoved',(_0x2260b0,{commentThreadId:_0x5f1f0d})=>{const _0x59d170=_0x3a91a0['getCommentThread'](_0x5f1f0d);_0x59d170&&_0x59d170['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x30b708,'commentAdded',(_0x4bf844,_0x32c0d7)=>{const _0x330e54=_0x32c0d7['commentThreadId'],_0x143882=_0x3a91a0['getCommentThread'](_0x330e54);_0x143882&&_0x143882['addComment']({...st(_0x32c0d7),'isFromAdapter':!0x0});}),this['listenTo'](_0x30b708,'commentUpdated',(_0x582e67,{commentThreadId:_0x1308a7,commentId:_0x309b58,content:_0x419c67,attributes:_0x507748})=>{const _0x55a7b0=_0x3a91a0['getCommentThread'](_0x1308a7);if(_0x55a7b0){const _0x2429b7=_0x55a7b0['getComment'](_0x309b58);_0x2429b7&&_0x2429b7['update']({'content':_0x419c67,'attributes':_0x507748,'isFromAdapter':!0x0});}}),this['listenTo'](_0x30b708,'commentRemoved',(_0x5dee36,{commentThreadId:_0x24b12e,commentId:_0x6dc95a})=>{const _0x391865=_0x3a91a0['getCommentThread'](_0x24b12e);if(_0x391865){const _0x5df250=_0x391865['getComment'](_0x6dc95a);_0x5df250&&_0x5df250['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x396a1f);}['destroy'](){if(this['context']instanceof tt){const _0x5f37df=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x5f37df);}}['_terminateService'](_0x59a8bc){if(!this['_services']['has'](_0x59a8bc))throw new _0x1d5a00('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x59a8bc});this['_getService'](_0x59a8bc)['disconnect'](),this['_services']['delete'](_0x59a8bc);}async['reconnect'](){for(const _0x544ee5 of this['_services']['keys']())await this['_connectService'](_0x544ee5);if(this['context']instanceof tt){const _0x5a716b=this['context']['config']['get']('collaboration.channelId'),_0x20b873=this['context']['plugins']['get'](i);_0x20b873['unregister'](_0x5a716b);const _0x4d28f3=await this['_services']['get'](_0x5a716b)['getConnectedSessions']();_0x20b873['register'](_0x5a716b,_0x4d28f3);}}async['_connectService'](_0x2cf6da){const {connection:_0x48777e}=this['context']['plugins']['get'](n),_0x4c5316=this['context']['plugins']['get']('CommentsRepository'),_0x2b5e69=this['_services']['get'](_0x2cf6da),_0x403444=await _0x2b5e69['connect'](_0x48777e);await this['_fetchMissingUsersForThreads'](_0x403444);const _0x1da7d7=new Set(Array['from'](_0x4c5316['getCommentThreads']({'channelId':_0x2cf6da}),_0x37a0eb=>_0x37a0eb['id']));for(const _0x382c11 of _0x403444)_0x382c11['deletedAt']||_0x1da7d7['delete'](_0x382c11['commentThreadId']);for(const _0x477876 of _0x1da7d7)_0x4c5316['getCommentThread'](_0x477876)['remove']({'isFromAdapter':!0x0});for(const _0x1d0c2b of _0x403444){let _0x229358=_0x4c5316['getCommentThread'](_0x1d0c2b['commentThreadId']);const {commentThreadId:_0x84ab5b,context:_0x55bb64,attributes:_0x25e336,resolvedBy:_0x1abd09,resolvedAt:_0x4b6afe,unlinkedAt:_0x1e4ac5,deletedAt:_0x2e01ce}=_0x1d0c2b;if(_0x2e01ce)continue;_0x229358||(_0x229358=_0x4c5316['addCommentThread']({'channelId':_0x2cf6da,'threadId':_0x84ab5b,'context':_0x55bb64,'attributes':_0x25e336||{},'resolvedBy':_0x1abd09,'resolvedAt':_0x4b6afe,'unlinkedAt':_0x1e4ac5,'isFromAdapter':!0x0}));const _0x36aab6=new Set(Array['from'](_0x229358['comments'],_0x2afab4=>_0x2afab4['id']));for(const _0x253afa of _0x1d0c2b['comments'])_0x36aab6['delete'](_0x253afa['commentId']);for(const _0xdbb053 of _0x36aab6)_0x229358['getComment'](_0xdbb053)['remove']({'isFromAdapter':!0x0});for(const _0x5728f1 of _0x1d0c2b['comments']){const _0x5381ef=_0x229358['getComment'](_0x5728f1['commentId']);_0x5381ef?_0x5381ef['content']!==_0x5728f1['content']&&_0x5381ef['update']({'content':_0x5728f1['content'],'isFromAdapter':!0x0}):_0x229358['addComment'](Object['assign'](st(_0x5728f1),{'isFromAdapter':!0x0}));}}}['_getService'](_0x5770be){if(!this['_services']['has'](_0x5770be))throw new _0x1d5a00('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x5770be});return this['_services']['get'](_0x5770be);}async['_fetchMissingUsersForThreads'](_0x1d995a){const _0x53263c=this['context']['plugins']['get'](_0x1e6d0b),{connection:_0x22ccc9}=this['context']['plugins']['get'](n),_0x236029=new Set();for(const {resolvedBy:_0x208007,comments:_0x293283}of _0x1d995a){_0x208007&&!_0x53263c['getUser'](_0x208007)&&_0x236029['add'](_0x208007);for(const {userId:_0x5dd3a4}of _0x293283)_0x53263c['getUser'](_0x5dd3a4)||_0x236029['add'](_0x5dd3a4);}if(0x0===_0x236029['size'])return;const _0x25ca65=await ut['getMany'](_0x22ccc9,Array['from'](_0x236029));for(const _0x205b10 of _0x25ca65)_0x53263c['getUser'](_0x205b10['id'])||_0x53263c['addUser'](_0x205b10);}}async function ot(_0x163053){if('404'!==_0x163053['code'])throw _0x163053;}function ft(_0x44f61b){if((_0x548e8f=_0x44f61b)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x548e8f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x548e8f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x548e8f;throw _0x44f61b;}function st(_0x198b8a){return{'threadId':_0x198b8a['commentThreadId'],'commentId':_0x198b8a['commentId'],'content':_0x198b8a['content'],'createdAt':_0x198b8a['createdAt'],'authorId':_0x198b8a['userId'],'attributes':_0x198b8a['attributes']||{}};}class m extends _0x2db22b{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>it)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[s,'TrackChangesEditing',n];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1476a8){super(_0x1476a8);const _0x54a9e6=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x54a9e6);}['init'](){const _0x32cc3d=this['editor']['plugins']['get'](n),_0x34142e=this['editor']['plugins']['get']('TrackChangesEditing');return _0x34142e['adapter']={'getSuggestion':async _0x4b1d52=>{await this['_waitForServiceReady']();const _0x33a245=await this['_trackChangesService']['get'](_0x4b1d52)['catch'](nt);return await this['_fetchMissingUsersForThreads']([_0x33a245]),_0x33a245;},'addSuggestion':async({id:_0x56ece7,type:_0x586e28,data:_0x533d3f,originalSuggestionId:_0x1ec717,attributes:_0x3e7eae})=>{await this['_waitForServiceReady']();const _0x1f8e12={'id':_0x56ece7,'type':_0x586e28,'data':_0x533d3f,'originalSuggestionId':_0x1ec717,'attributes':_0x3e7eae},_0x153460=await this['_trackChangesService']['add'](_0x56ece7,_0x586e28,_0x533d3f,_0x1ec717,_0x3e7eae)['catch'](_0x2d8401=>{if(mt(_0x2d8401))return new Promise(_0x42eb37=>{this['_bufferedRequests']['set'](_0x56ece7,{'resolve':_0x42eb37,'suggestionData':_0x1f8e12});});throw _0x2d8401;});return this['_bufferedRequests']['delete'](_0x56ece7),_0x153460;},'updateSuggestion':async(_0x5d2139,_0x4e9b08)=>{if(await this['_waitForServiceReady'](),'open'!==_0x4e9b08['state'])return this['_trackChangesService']['update'](_0x5d2139,_0x4e9b08)['catch'](nt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x507091,_0x35588a)=>{_0x34142e['hasSuggestion'](_0x35588a['id'])&&(_0x34142e['getSuggestion'](_0x35588a['id'])['attributes']=_0x35588a['attributes']);}),this['_trackChangesService']['connect'](_0x32cc3d['connection'])['then'](_0x340992=>(_0x32cc3d['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x340992)['then'](()=>{for(const _0xcbe13e of _0x340992){_0x34142e['addSuggestionData'](_0xcbe13e)['_saved']=!0x0;}})));}async['reconnect'](){const _0x17e43c=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x43c3ef}=this['editor']['plugins']['get'](n),_0x2c2f03=await this['_trackChangesService']['connect'](_0x43c3ef);await this['_fetchMissingUsersForThreads'](_0x2c2f03);for(const {suggestionData:_0x5e5159,resolve:_0xb395ce}of this['_bufferedRequests']['values']()){let _0x2736a7=_0x2c2f03['find'](_0xcaa2b4=>_0xcaa2b4['id']===_0x5e5159['id']);_0x2736a7||(_0x2736a7=await this['_trackChangesService']['add'](_0x5e5159['id'],_0x5e5159['type'],_0x5e5159['data'],_0x5e5159['originalSuggestionId'])),_0xb395ce(_0x2736a7);}for(const _0x4bbd73 of _0x2c2f03)_0x17e43c['hasSuggestion'](_0x4bbd73['id'])||_0x17e43c['addSuggestionData'](_0x4bbd73);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x5612ff=>{this['listenTo'](this['_trackChangesService'],'connected',_0xa8f666=>{_0xa8f666['off'](),_0x5612ff();});});}async['_fetchMissingUsersForThreads'](_0x23c99a){const _0x55510f=this['editor']['plugins']['get'](_0x1e6d0b),{connection:_0x2d1da5}=this['editor']['plugins']['get'](n),_0x977b5f=new Set();for(const {authorId:_0x4f6fd8}of _0x23c99a)_0x55510f['getUser'](_0x4f6fd8)||_0x977b5f['add'](_0x4f6fd8);if(0x0===_0x977b5f['size'])return;const _0x4ac9fb=await ut['getMany'](_0x2d1da5,Array['from'](_0x977b5f));for(const _0x1c9cb8 of _0x4ac9fb)_0x55510f['getUser'](_0x1c9cb8['id'])||_0x55510f['addUser'](_0x1c9cb8);}}function nt(_0x1b4966){if(mt(_0x1b4966))return new Promise(()=>{});throw _0x1b4966;}function mt(_0x3725e8){return _0x3725e8['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3725e8['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x2db22b{static get['requires'](){return['Comments',s,a,n];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x47f0be=this['editor']['plugins']['get'](n),_0x2f3701=this['editor']['plugins']['get']('CommentsEditing'),_0x48f868=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x47f0be,'change:state',(_0x2b582a,_0x367f89,_0x30de7a)=>{_0x2f3701['isThreadsLoadingPaused']='connected'!==_0x30de7a;});}),this['listenTo'](_0x47f0be,'change:state',(_0x2d138b,_0x4a09ce,_0x417fd2)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x417fd2);}),_0x48f868['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](s)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class pt extends _0x2db22b{static get['requires'](){return[g,m,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class c extends _0x2db22b{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x3d0be0)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x1e6d0b];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1e068b){super(_0x1e068b);const _0x2fd420=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x2fd420);}async['init'](){const _0x33be75=this['editor']['plugins']['get'](l),_0x4c82b2=_0x33be75['serverHistory'],_0xcb0a94=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x4c82b2,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x33be75['sessionId']});const _0x2a9ef1=this['editor']['config']['get']('cloudServices.bundleVersion')||ht,_0x5627e1=await _0xa346ac['isBundleUploaded'](_0xcb0a94['connection'],_0x2a9ef1);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x3477b5})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x3477b5)),'updateRevisions':async _0x1386f9=>{await this['_waitForServiceReady']();const _0x3516f5=this['_revisionTracker']['currentRevision'];if(_0x5627e1&&0x1===_0x1386f9['length']&&_0x1386f9[0x0]['id']===_0x3516f5['id'])return _0x1386f9;for(const _0x48dc2a of _0x1386f9)_0x48dc2a['id']===_0x3516f5['id']&&(_0x48dc2a['isEmptyCurrent']=_0x48dc2a['fromVersion']===_0x48dc2a['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1386f9,this['_lastRequestId'])['then'](_0x5d7b15=>(this['_lastRequestId']=_0x5d7b15,_0x1386f9))['catch'](_0x1e499d=>{if(Z(_0x1e499d)||'400'===_0x1e499d['code']&&void 0x0!==_0x1e499d['data']['wrongRequestId']){for(const _0x8fd860 of _0x1386f9){!this['_revisionTracker']['repository']['getRevision'](_0x8fd860['id'])||this['_revisionTracker']['_bufferUpdate'](_0x8fd860['id'],_0x8fd860,!0x1);}if(Z(_0x1e499d))throw _0x1e499d;return _0x1386f9;}throw _0x1e499d;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3c1bec,{revisionsData:_0x5613b4,requestId:_0x3de15c})=>{Math['max'](..._0x5613b4['map'](_0x2c3404=>_0x2c3404['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x5613b4,_0x3de15c);}):this['_handleRevisionsUpdate'](_0x5613b4,_0x3de15c);});const {revisions:_0x2c3ac7,requestId:_0x3055bb}=await this['_revisionHistoryService']['connect'](_0xcb0a94['connection']);_0xcb0a94['addToReconnectionStack'](this),this['_lastRequestId']=_0x3055bb,await this['_fetchMissingUsers'](_0x2c3ac7);for(const _0x3157e7 of _0x2c3ac7)this['_revisionTracker']['addRevisionData'](_0x3157e7);this['listenTo'](_0x33be75,'change:_isConnected',(_0x42f3ac,_0x41f77b,_0x3afcd2)=>{_0x3afcd2&&(this['_oldOffset']=_0x33be75['_offset'],_0x42f3ac['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0xcb0a94,'state',_0x5a42c4=>_0x5a42c4===_0x4d5800['CONNECTED']);}async['reconnect'](){const _0x472020=this['editor']['plugins']['get'](n),_0x2a1153=this['editor']['plugins']['get'](l),_0x374c2a=async()=>{const _0x1cccbd=this['_revisionTracker']['currentRevision'],_0xb79d9b=_0x1cccbd['id'],_0x3a93d8=_0xb79d9b!==_0x2a1153['sessionId'];if(_0x3a93d8){const _0x20f4c8=_0x2a1153['_offset']-this['_oldOffset'],_0x30135b=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x1cccbd['toVersion']+_0x20f4c8!==_0x30135b){const _0xc5ed4d=_0x1cccbd['fromVersion']+_0x20f4c8,_0x350c40=this['editor']['plugins']['get'](_0x1e6d0b),_0x306e4a=this['_revisionTracker']['buildRevisionData']({'revision':_0x1cccbd,'from':_0xc5ed4d,'to':_0x30135b});_0x306e4a['id']=_0x1cccbd['id'];const _0x53e627=_0x306e4a['authorsIds']['map'](_0x50afa9=>_0x350c40['getUser'](_0x50afa9));_0x1cccbd['_update']({..._0x306e4a,'authors':_0x53e627},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1cccbd['id'],_0x306e4a,!0x0);}this['_revisionTracker']['_startingVersion']=_0x30135b,(_0x1cccbd['toVersion']===_0x1cccbd['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0xb79d9b)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0xb79d9b),this['_revisionTracker']['_createCurrentRevision'](_0x30135b));}const {revisions:_0x2c2126,requestId:_0x37a02e}=await this['_revisionHistoryService']['reconnect'](_0x472020['connection'],this['_lastRequestId']);_0x3a93d8&&_0x2c2126['length']>0x0?_0x2a1153['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x2c2126),this['_handleRevisionsUpdate'](_0x2c2126,_0x37a02e),this['_revisionTracker']['sendBufferedUpdates']());};return _0x2a1153['_isConnected']?_0x374c2a():new Promise((_0x3bb0e9,_0x3d7a53)=>{_0x2a1153['once']('change:_isConnected',()=>{_0x374c2a()['then'](_0x3bb0e9)['catch'](_0x3d7a53);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x19b4c9=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x3eae4c=>{_0x3eae4c['off'](),_0x19b4c9();});});}['_getLatestVersionFromServerOperations'](){const _0x56eb19=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x2b984e of _0x56eb19)if('marker'!==_0x2b984e['type']||_0x2b984e['affectsData'])return _0x2b984e['baseVersion']+0x1;}['_getLatestVersion'](){const _0x24cdfd=this['editor']['plugins']['get'](l);return new Promise(_0x4a6184=>{_0x24cdfd['_isPendingUpdate']?_0x24cdfd['once']('change:_isPendingUpdate',()=>{_0x4a6184(this['_getLatestVersionFromServerOperations']());}):_0x4a6184(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0xedf149,_0x1e9537){const _0x50f6e9=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x1e9537;for(const _0x158900 of _0xedf149){const _0x28926f=_0x50f6e9['getRevision'](_0x158900['id']);if(_0x28926f){if((_0x158900['fromVersion']||_0x158900['toVersion'])&&(_0x158900['diffData']=null),_0x28926f===this['_revisionTracker']['currentRevision']){const _0x24be51=Math['max'](_0x28926f['toVersion'],_0x158900['toVersion']),_0xc16bb6=Math['max'](_0x28926f['fromVersion'],_0x158900['fromVersion']);let _0x53ccb1;_0x28926f['toVersion']===_0x158900['toVersion']&&_0x28926f['fromVersion']===_0x158900['fromVersion']?(_0x53ccb1=!0x0,this['_preventResendingRevisionData'](_0x158900)):_0x158900['toVersion']===_0x24be51&&_0x158900['fromVersion']===_0xc16bb6?_0x53ccb1=!0x1:(_0x28926f['toVersion']===_0x24be51&&_0x28926f['fromVersion']===_0xc16bb6||this['_fixRevision']({'revision':_0x28926f,'from':_0xc16bb6,'to':_0x24be51}),_0x53ccb1=!0x0),_0x53ccb1&&(delete _0x158900['fromVersion'],delete _0x158900['toVersion'],delete _0x158900['diffData'],delete _0x158900['createdAt'],delete _0x158900['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x158900),this['_preventResendingRevisionData'](_0x158900);}else this['_revisionTracker']['addRevisionData'](_0x158900);}const _0x47499c=_0x50f6e9['getRevisions']();_0x47499c['reverse']();for(let _0x7913f1=0x0;_0x7913f1<_0x47499c['length']-0x1;_0x7913f1++){const _0x5e9220=_0x47499c[_0x7913f1],_0xbc0555=_0x47499c[_0x7913f1+0x1];if(_0x5e9220['fromVersion']<_0xbc0555['toVersion']){const _0x37a3d0=_0xbc0555['toVersion'],_0x3ef7d5=Math['max'](_0x37a3d0,_0x5e9220['toVersion']);this['_fixRevision']({'revision':_0x5e9220,'from':_0x37a3d0,'to':_0x3ef7d5});}}}['_fixRevision']({revision:_0x62d977,from:_0x22f44c,to:_0xbb522f}={}){const _0x8df819=this['editor']['plugins']['get'](_0x1e6d0b),_0x291885=this['_revisionTracker']['buildRevisionData']({'revision':_0x62d977,'from':_0x22f44c,'to':_0xbb522f});_0x291885['authors']=_0x291885['authorsIds']['map'](_0x1ffed4=>_0x8df819['getUser'](_0x1ffed4)),_0x62d977['_update'](_0x291885);}['_preventResendingRevisionData'](_0x2197e3){const _0x52c46a={};_0x52c46a['id']=_0x2197e3['id'];for(const _0x3ab016 of Object['keys'](_0x2197e3))'id'!==_0x3ab016&&(_0x52c46a[_0x3ab016]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x52c46a['id'],_0x52c46a,!0x0);}async['_fetchMissingUsers'](_0x152d53){const _0xf9e718=this['editor']['plugins']['get'](_0x1e6d0b),{connection:_0x312d66}=this['editor']['plugins']['get'](n),_0x175a6f=new Set();for(const _0x550291 of _0x152d53){for(const _0x27ec7a of _0x550291['authorsIds'])_0x85198b(_0x27ec7a);_0x550291['creatorId']&&_0x85198b(_0x550291['creatorId']);}if(0x0===_0x175a6f['size'])return;const _0x706b13=await ut['getMany'](_0x312d66,Array['from'](_0x175a6f));for(const _0x30d7ff of _0x706b13)_0xf9e718['getUser'](_0x30d7ff['id'])||_0xf9e718['addUser'](_0x30d7ff);function _0x85198b(_0x5e2374){_0xf9e718['getUser'](_0x5e2374)||_0x175a6f['add'](_0x5e2374);}}}function Z(_0x25d262){return _0x25d262['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x25d262['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x25d262['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class gt extends _0x2db22b{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x55006c{['_collapseAt'];constructor(_0x137cf0,_0x56b452=0x6){super(_0x137cf0);const _0x35807e=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x56b452,this['bind']('isHidden')['to'](this,'usersCount',_0x4b2b1e=>_0x4b2b1e<_0x56b452),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x35807e['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0x35807e['to']('usersCount',_0x1b8cf3=>'+'+(_0x1b8cf3-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x55006c{['items'];['keystrokes'];constructor(_0x4af693){super(_0x4af693);const _0x1f995a=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x2d8e87(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x1f995a['if']('hasPopup'),'aria-expanded':_0x1f995a['to']('isExpanded',_0x71644d=>this['hasPopup']&&String(_0x71644d)),'aria-label':_0x1f995a['to']('hasPopup',_0x39fcba=>E(_0x4af693,_0x39fcba?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x1f995a['to']('hasPopup',_0x51fa51=>!!_0x51fa51&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x1f995a['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x1f995a['to'](_0x2e9724=>{const _0x47d63e=_0x2e9724,_0x5343e1=document['querySelector']('.ck-presence-list__dropdown-list'),_0x7961ec=document['querySelector']('.ck-balloon-panel_with-arrow');_0x5343e1?.['contains'](_0x47d63e['relatedTarget'])||_0x7961ec?.['contains'](_0x47d63e['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x231ae8,_0x141195,_0x300247)=>{this['element']&&(_0x300247?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 v extends _0x55006c{['counterView'];['inlineListView'];constructor(_0x4143ab,_0xfa6a25=0x6){super(_0x4143ab);const _0x47ca1d=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0xfa6a25),this['inlineListView']=new is(_0x4143ab),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x677195 of this['inlineListView']['items'])_0x677195['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',_0x47ca1d['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x55006c{['listWrapperView'];constructor(_0x3d2c59,_0x2547e8){super(_0x3d2c59);const _0x28e0e7=this['bindTemplate'];this['listWrapperView']=new wt(_0x3d2c59,_0x2547e8),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':E(_0x3d2c59,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x28e0e7['to'](_0x1354da=>{const _0x4c4e2a=_0x1354da,_0x424432=document['querySelector']('.ck-presence-list__list'),_0x9d8ba6=document['querySelector']('.ck-balloon-panel_with-arrow');_0x424432?.['contains'](_0x4c4e2a['relatedTarget'])||_0x9d8ba6?.['contains'](_0x4c4e2a['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class wt extends _0x32cb91{constructor(_0x2b7d7d,_0x5cdbc4){super(_0x2b7d7d);const _0x3ecb28=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x5cdbc4?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x3ecb28['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x3ecb28['to']('role'),'aria-label':_0x3ecb28['to']('ariaLabel'),'aria-labelledby':_0x3ecb28['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x2bfaf9['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x275658=this['element'];_0x275658&&(this['_isScrollable']=Math['max'](_0x275658['scrollHeight'],_0x275658['clientHeight'])>0.8*window['innerHeight']);}}class j extends rt{['userView'];constructor(_0x5e5cf1,_0x1761af,_0x396899){super(_0x5e5cf1);const _0x314300=this['bindTemplate'];this['userView']=new ct(_0x5e5cf1,_0x1761af);const _0x313ab5={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x1761af['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x1761af['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1761af['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x396899&&(_0x313ab5['tag']='button',_0x313ab5['on']={'click':_0x314300['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x313ab5);}['focus'](){this['element']['focus']();}}class A extends _0x55006c{['userView'];['markerView'];constructor(_0x25f029,_0x4ec83f,_0x37226e){super(_0x25f029);const _0x5a644f=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x25f029,_0x4ec83f),this['markerView']=new lt(_0x25f029,_0x4ec83f);const _0x548001=new at(_0x25f029);_0x548001['template']['tag']='span',_0x548001['text']=_0x4ec83f['name'];const _0x3b2be8={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5a644f['to']('isFocusable',_0x4e1f0e=>!!_0x4e1f0e&&0x0),'aria-labelledby':_0x548001['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5a644f['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5a644f['to']('hasTooltip',_0x5f4c5c=>!_0x5f4c5c),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x548001]};_0x37226e&&(_0x3b2be8['tag']='button',_0x3b2be8['on']={'click':_0x5a644f['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x3b2be8);}}class lt extends _0x55006c{constructor(_0x13c429,_0x42b2da){super(_0x13c429),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x42b2da['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x30f1c1{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1b332c){super(_0x1b332c),this['context']['config']['define']('presenceList',x);const _0x2937be=_0x1b332c['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x2937be)throw new _0x1d5a00('presencelist-collapseat-invalid-format',this);if(_0x2937be<0x1)throw new _0x1d5a00('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x58c1e0(),this['balloonPanelView']=new _0xf7afb(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x20b9b8 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x20b9b8);this['listenTo'](this['_allConnectedUsers'],'add',(_0x153c88,_0x2fbd60)=>{this['_handleUserAdd'](_0x2fbd60);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x2efac3,_0x1d51af)=>{this['_handleUserRemove'](_0x1d51af);});}['_createView'](){const _0x2cc7a1=this['context'],_0x552548=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x3e3ec6=this['balloonPanelView'];if(!_0x23b94a(_0x2cc7a1['config']['get']('presenceList.container')))throw new _0x1d5a00('presencelist-missing-container',this);return _0x552548['counterView']['bind']('usersCount')['to'](this),_0x552548['bind']('isCollapsed')['to'](this,'usersCount',_0x543140=>{const {collapseAt:_0x206efb}=_0x2cc7a1['config']['get']('presenceList'),_0x20dcc8=_0x543140>=_0x206efb;if(_0x20dcc8&&!_0x552548['inlineListView']['items']['find'](_0x21c9e4=>_0x21c9e4 instanceof b)){const _0x22722b=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x22722b&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x552548['inlineListView']['items']['add'](_0x552548['counterView']);}return _0x20dcc8||this['hideDropdown'](),_0x20dcc8;}),_0x552548['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x3fef8e=>{const _0x3d42a6=_0x2cc7a1['config']['get']('presenceList'),_0x117f1c=new A(_0x2cc7a1['locale'],_0x3fef8e,!!_0x3d42a6['onClick']);return _0x117f1c['bind']('hasTooltip')['to'](_0x552548,'isCollapsed',_0x1f9f37=>!_0x1f9f37),_0x117f1c['bind']('isFocusable')['to'](_0x552548,'isCollapsed',_0x1c3611=>!_0x1c3611),_0x3d42a6['onClick']&&this['listenTo'](_0x117f1c,'execute',()=>{this['view']['isCollapsed']||_0x3d42a6['onClick'](_0x3fef8e,_0x117f1c['element']);}),_0x117f1c;}),this['listenTo'](_0x552548['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x552548['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x552548['inlineListView']['keystrokes']['set']('Enter',(_0x3e67b8,_0x1c7c5a)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x1c7c5a());}),_0x552548['render'](),_0x3e3ec6['render'](),_0x58a9e6({'emitter':_0x552548,'activator':()=>_0x3e3ec6['isVisible'],'contextElements':[_0x3e3ec6['element'],_0x552548['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x2cc7a1['config']['get']('presenceList.container')['appendChild'](_0x552548['element']),this['_bodyCollection']=new _0x3f70a6(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x552548;}['_handleUserAdd'](_0x4ac701){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x4ac701['isMe'])return;const _0x3d1c86=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x3d1c86-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x1b9ebc=_0x4ac701['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x4ac701,_0x1b9ebc);}['_handleUserRemove'](_0x218628){this['usersCount']--;const {collapseAt:_0x3e9127}=this['context']['config']['get']('presenceList'),_0x3044d7=this['usersCount']>=_0x3e9127;if(this['currentDisplayedUsers']['get'](_0x218628['id']))this['currentDisplayedUsers']['remove'](_0x218628['id']);else{if(_0x3044d7&&this['currentDisplayedUsers']['length']+0x1===_0x3e9127-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x3044d7?0x1:0x0)<this['usersCount']){for(const _0x347dc8 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x347dc8['id'])&&(this['currentDisplayedUsers']['add'](_0x347dc8,Math['min'](this['currentDisplayedUsers']['length']-(_0x3044d7?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x3044d7?0x1:0x0)===_0x3e9127-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x33f389=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x33f389['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x8e28b8}=this['presenceDropdownView'];_0x8e28b8['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x21de4b=>{if(!_0x33f389['displayMe']&&_0x21de4b['isMe'])return null;const _0x87e1c0=new j(this['context']['locale'],_0x21de4b,!!_0x33f389['onClick']);return _0x33f389['onClick']&&this['listenTo'](_0x87e1c0,'execute',()=>{_0x33f389['onClick'](_0x21de4b,_0x87e1c0['element']);}),_0x87e1c0;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x8e28b8['focus'](),_0x8e28b8['checkIfScrollable']();const _0x477cef=(_0x9efe37,_0x47009c)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x47009c();};_0x8e28b8['keystrokes']['set']('Esc',_0x477cef),_0x8e28b8['keystrokes']['set']('Shift+Tab',_0x477cef),_0x8e28b8['keystrokes']['set']('Tab',(_0x3618a6,_0x1999ba)=>{!function(_0x24f008){const _0x2a8a97=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x6f944b=>_0x6f944b+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x17fd62=[...document['body']['querySelectorAll'](_0x2a8a97)]['filter'](_0x5274f5=>_0x5274f5===document['activeElement']||_0x5274f5['offsetWidth']+_0x5274f5['offsetHeight']>0x0)['sort']((_0x318742,_0x33652e)=>(_0x318742['tabIndex']||0x0)-(_0x33652e['tabIndex']||0x0)),_0x3c3e78=_0x17fd62['indexOf'](_0x24f008),_0x4eb74d=_0x17fd62[(_0x3c3e78+0x1)%_0x17fd62['length']];_0x4eb74d&&_0x4eb74d['focus']();}(this['view']['element']),this['hideDropdown'](),_0x1999ba();}),_0x8e28b8['focusTracker']['add'](this['view']['element']),_0x8e28b8['focusTracker']['on']('change:isFocused',(_0x542750,_0x23ece1,_0x306b06)=>{_0x306b06||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 vt extends _0x30f1c1{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,vt as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,pt as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|