@ckeditor/ckeditor5-real-time-collaboration 46.0.1-alpha.6 → 46.0.1-alpha.7
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/presencelistui.js +1 -1
- 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/presencelist/view/presencelistview.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',_0x12f92f];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5ca726){super(_0x5ca726),this['set']('state',_0x5bf203['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x262061())();}['init'](){const _0x4a246e=this['context'],_0x463b6b=_0x4a246e['plugins']['get']('CloudServices'),_0x852458=_0x4a246e['plugins']['get'](_0x12f92f);if(!_0x463b6b['token'])throw new _0x9081b9('websocketgateway-missing-token',this);if(!_0x463b6b['webSocketUrl'])throw new _0x9081b9('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'](_0x463b6b['token'],_0x463b6b['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x58efbd=>{if(this['connection']=_0x58efbd,this['bind']('state')['to'](_0x58efbd,'state',this,'_isBrowserOffline',(_0x11e14c,_0x25f8e7)=>('connected'!==_0x11e14c&&(this['_shouldPluginsReconnect']=!0x0),_0x25f8e7||_0x11e14c!==_0x5bf203['CONNECTED']?_0x5bf203['DISCONNECTED']:this['state']==_0x5bf203['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x5bf203['CONNECTING']):_0x5bf203['CONNECTED'])),this['connection']['on']('error',(_0x4093a1,_0x1593af)=>{if('limitExceeded'!==_0x1593af['code'])throw console['error'](_0x1593af),new _0x9081b9('cloudservices-init',null,{'originalError':_0x1593af});_0x852458['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'});}),!_0x58efbd['me'])return new Promise(_0x26a450=>_0x58efbd['on']('change:me',_0x26a450));})['catch'](_0x4fcbc8=>{throw console['error'](_0x4fcbc8),new _0x9081b9('cloudservices-init',null,{'originalError':_0x4fcbc8});});}['addToReconnectionStack'](_0x34ac8a){if('function'!=typeof _0x34ac8a['reconnect'])throw new _0x9081b9('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x34ac8a))throw new _0x9081b9('websocketgateway-plugin-already-registered',this,{'name':_0x34ac8a['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x34ac8a);}['removeFromReconnectionStack'](_0x4b8e7e){this['_reconnectionStack']['delete'](_0x4b8e7e);}['isInReconnectionStack'](_0x2c8374){return this['_reconnectionStack']['has'](_0x2c8374);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x1ad813=>_0x1ad813['reconnect']())))['then'](()=>this['state']=_0x5bf203['CONNECTED'])['catch'](_0x45284b=>{throw console['error'](_0x45284b),new _0x9081b9('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x5bf203['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x4d663b{['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,_0x1a1c18];}constructor(_0x1693a7){super(_0x1693a7),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x1c851a(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1a1c18);}['init'](){const _0x3d8ca5=this['context']['plugins']['get'](n);this['listenTo'](_0x3d8ca5,'change:state',(_0xb0829,_0x443b1b,_0x11a053)=>{if('connected'!==_0x11a053)this['channelSessions']['forEach'](_0x213990=>_0x213990['clear']()),this['channelConnectedUsers']['forEach'](_0x253b55=>_0x253b55['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x4f63ed,_0x1f4179]of this['_registeredSessions'])for(const _0x476597 of _0x1f4179)this['_handleSessionAdd'](_0x4f63ed,_0x476597);}}),this['_createUser'](_0x3d8ca5['connection']['me'],!0x0);}['register'](_0x5a3734,_0x127b40){if(this['_registeredSessions']['has'](_0x5a3734))throw new _0x9081b9('sessions-register-already-registered',null,{'channelId':_0x5a3734});this['_registeredSessions']['set'](_0x5a3734,_0x127b40),this['channelSessions']['set'](_0x5a3734,new _0x1c851a()),this['channelConnectedUsers']['set'](_0x5a3734,new _0x1c851a()),this['listenTo'](_0x127b40,'add',(_0x14a058,_0x424e3b)=>this['_handleSessionAdd'](_0x5a3734,_0x424e3b)),this['listenTo'](_0x127b40,'remove',(_0x28564f,_0x50bee7)=>this['_handleSessionRemove'](_0x5a3734,_0x50bee7));for(const _0x556f3c of _0x127b40)this['_handleSessionAdd'](_0x5a3734,_0x556f3c);}['unregister'](_0x38f85f){if(!this['_registeredSessions']['has'](_0x38f85f))throw new _0x9081b9('sessions-unregister-not-exist',null,{'channelId':_0x38f85f});const _0x33af2e=this['_registeredSessions']['get'](_0x38f85f);this['stopListening'](_0x33af2e);for(const _0x42fe0c of _0x33af2e)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x38f85f,_0x42fe0c);this['_registeredSessions']['delete'](_0x38f85f),this['channelSessions']['delete'](_0x38f85f),this['channelConnectedUsers']['delete'](_0x38f85f);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x7ed0fb){for(const _0x176514 of this['channelSessions']['values']())for(const _0x5945fe of _0x176514)if(_0x5945fe['id']===_0x7ed0fb)return _0x5945fe['user'];}['getUserSessions'](_0x950b69,_0x28f72f){const _0x430ca7=_0x28f72f?[this['channelSessions']['get'](_0x28f72f)]:this['channelSessions']['values'](),_0x467bf4=new Set();for(const _0x4eee5a of _0x430ca7)for(const _0x2f7e44 of _0x4eee5a)_0x2f7e44['user']['id']===_0x950b69['id']&&_0x467bf4['add'](_0x2f7e44['id']);return _0x467bf4;}['getUserRole'](_0x54a90d){for(const _0x524c3c of this['channelSessions']['values']())for(const _0x183b8e of _0x524c3c)if(_0x183b8e['user']===_0x54a90d)return _0x183b8e['role'];}['_handleSessionAdd'](_0xa9c7e1,_0x32a291){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x3fc951=_0x32a291['user'],_0x545bf0=this['_users']['getUser'](_0x3fc951['id'])||this['_createUser'](_0x3fc951),_0x5f3f1b=Object['assign']({},_0x32a291,{'user':_0x545bf0});this['channelSessions']['get'](_0xa9c7e1)['add'](_0x5f3f1b);const _0x381d2c=this['channelConnectedUsers']['get'](_0xa9c7e1);_0x381d2c['has'](_0x545bf0['id'])||_0x381d2c['add'](_0x545bf0),this['allConnectedUsers']['has'](_0x545bf0['id'])||this['allConnectedUsers']['add'](_0x545bf0,_0x545bf0['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0xa9c7e1,{'channelId':_0xa9c7e1,'session':_0x5f3f1b});}['_handleSessionRemove'](_0x3ac59d,_0xc40b1e){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x25a3ff=this['channelConnectedUsers']['get'](_0x3ac59d),_0x2bfbd7=_0xc40b1e['user'];_0x2bfbd7['id']&&(this['channelSessions']['get'](_0x3ac59d)['remove'](_0xc40b1e['id']),_0x25a3ff['has'](_0x2bfbd7['id'])&&!this['getUserSessions'](_0x2bfbd7,_0x3ac59d)['size']&&_0x25a3ff['remove'](_0x2bfbd7['id']),this['allConnectedUsers']['get'](_0x2bfbd7['id'])&&!this['getUserSessions'](_0x2bfbd7)['size']&&this['allConnectedUsers']['remove'](_0x2bfbd7['id']));}['_createUser'](_0x240cf4,_0x122d22){const _0x32428e=this['_users']['addUser'](_0x240cf4);return _0x122d22&&this['_users']['defineMe'](_0x240cf4['id']),_0x32428e['orderNumber']=this['_uniqueUsersCount']++,_0x32428e;}}class $ extends _0x418480{['_domEmitter']=new(_0x262061())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x454aff=this['editor'],_0x465ca5=_0x454aff['plugins']['get'](i);_0x454aff['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x3baf82,{writer:_0x1f3656})=>function(_0x4eb6fe,_0x23e2c9,_0xd7147d,_0x5c037b){const _0xc5f649=_0x4eb6fe['markerName']['split'](':')[0x2],_0x34c941=_0xd7147d['getUserBySessionId'](_0xc5f649);if(!_0x34c941||_0xc5f649===_0xd7147d['mySessionId'])return;if(!_0x5c037b['model']['schema']['checkChild'](_0x4eb6fe['markerRange']['start'],'$text'))return;const _0x2b62fc={'class':'ck-user__marker\x20'+_0x34c941['color']['getMarkerClass'](),'data-name':_0x34c941['name'],'data-session-id':_0xc5f649},_0x1650f8=_0x5c037b['model']['markers']['get'](_0x4eb6fe['markerName']),_0x4dd0ec=_0x1650f8['getStart'](),_0x460e1e=_0x4dd0ec['nodeAfter'],_0x328f31=_0x5c037b['model']['schema'];if(_0x460e1e&&_0x328f31['isObject'](_0x460e1e)&&_0x328f31['isInline'](_0x460e1e)&&!_0x5c037b['model']['markers']['get']('user:range:'+_0xc5f649)['getRange']()['isCollapsed'])return;const _0x137a4f=_0x4dd0ec['parent'];return _0x5c037b['model']['schema']['isLimit'](_0x137a4f)&&!_0x5c037b['model']['hasContent'](_0x137a4f)&&(_0x2b62fc['contenteditable']=!0x1),function(_0x4a2f55,_0x412de4,_0x31f24e){const _0x3eb10b=_0x4a2f55['createUIElement']('span',_0x412de4);return _0x4a2f55['setCustomProperty']('userPositionMarker',!0x0,_0x3eb10b),_0x3eb10b['render']=function(_0x227539){const _0x1c236e=this['toDomElement'](_0x227539),_0x6e752e=document['createElement']('span');return _0x6e752e['classList']['add']('ck-user__marker-tooltip'),_0x6e752e['setAttribute']('contenteditable','false'),_0x6e752e['setAttribute']('spellcheck','false'),_0x6e752e['textContent']=_0x31f24e['name'],_0x1c236e['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x6e752e['outerHTML']+'',_0x1c236e['addEventListener']('mouseenter',()=>{_0x1c236e['classList']['add']('ck-user__marker_hovered');}),_0x1c236e['addEventListener']('mouseleave',()=>{_0x1c236e['classList']['remove']('ck-user__marker_hovered');}),_0x1c236e;},_0x3eb10b['isSimilar']=function(_0x2ea47c){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2ea47c['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2ea47c['getAttribute']('data-session-id'));},_0x3eb10b;}(_0x23e2c9,_0x2b62fc,_0x34c941);}(_0x3baf82,_0x1f3656,_0x465ca5,_0x454aff)}),_0x454aff['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2cc7db=>function(_0xcfee4a,_0x41f766){const _0x49289b=_0xcfee4a['markerName']['split'](':')[0x2];if(_0x49289b===_0x41f766['mySessionId'])return null;const _0x3ae558=_0x41f766['getUserBySessionId'](_0x49289b);if(!_0x3ae558)return{'id':_0x49289b,'classes':[]};return{'id':_0x49289b,'classes':['ck-user__selection',_0x3ae558['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x49289b},'priority':0x7d0+_0x3ae558['orderNumber']};}(_0x2cc7db,_0x465ca5)}),function(_0x396483){const _0xacfc2c=_0x396483['model'],_0x421e29=new Map(),_0x1a482a=_0x396483['plugins']['get'](i);_0xacfc2c['markers']['on']('update:user:range',(_0x543a3f,_0x75b83c,_0x45f1e4,_0x5b0a7d)=>{if(!_0x5b0a7d&&_0x421e29['get'](_0x75b83c['name']))return _0x421e29['get'](_0x75b83c['name'])['detach'](),void _0x421e29['delete'](_0x75b83c['name']);const _0x51b26b=_0x75b83c['name']['split'](':')[0x2];if(_0x51b26b===_0x1a482a['mySessionId'])return;const _0x1627f6='user:position:'+_0x51b26b;_0xacfc2c['markers']['has'](_0x1627f6)&&_0x396483['editing']['reconvertMarker'](_0x1627f6),_0x75b83c['on']('change:range',(_0x1fe44a,_0x57272c,_0x5d921d)=>{if('$graveyard'!=_0x57272c['root']['rootName']&&'$graveyard'==_0x75b83c['getRange']()['root']['rootName']&&!_0x421e29['has'](_0x75b83c['name'])){const _0x2665ac=_0xacfc2c['schema']['getNearestSelectionRange'](_0x5d921d['deletionPosition']);if(_0x2665ac){const _0x184caf=_0x50b8a0['fromRange'](_0x2665ac);_0x421e29['set'](_0x75b83c['name'],_0x184caf),_0x184caf['on']('change:range',(_0x2776fb,_0x304304,_0x47883d)=>{if('$graveyard'==_0x184caf['root']['rootName']){const _0xed0b5=_0xacfc2c['schema']['getNearestSelectionRange'](_0x47883d['deletionPosition']);_0xed0b5?(_0x184caf['start']=_0xed0b5['start'],_0x184caf['end']=_0xed0b5['end']):(_0x421e29['delete'](_0x75b83c['name']),_0x184caf['detach']());}});}}});}),_0xacfc2c['document']['on']('change',()=>{_0x421e29['size']>0x0&&_0xacfc2c['enqueueChange']({'isUndoable':!0x1},_0x39f28a=>{for(const [_0x93bbe8,_0x860e9b]of _0x421e29)'$graveyard'==_0xacfc2c['markers']['get'](_0x93bbe8)['getRange']()['root']['rootName']&&(te(_0x93bbe8['split'](':')[0x2],_0x860e9b['toRange'](),_0xacfc2c,_0x39f28a),_0x860e9b['detach']());_0x421e29['clear']();});});}(_0x454aff),this['_domEmitter']['listenTo'](_0x357dc2['document'],'keydown',(_0x2c723c,{key:_0x25f9ab})=>{'Escape'===_0x25f9ab&&function(_0x3e90ff){_0x3e90ff['editing']['view']['change'](_0x41e7df=>{for(const _0x23353a of _0x3e90ff['model']['markers']){if(!_0x23353a['name']['startsWith']('user:position'))continue;const _0x1bfb5a=_0x3e90ff['editing']['mapper']['markerNameToElements'](_0x23353a['name']);if(_0x1bfb5a){for(const _0x20b15a of _0x1bfb5a)_0x41e7df['removeClass']('ck-user__marker_hovered',_0x20b15a);}}});}(_0x454aff);},{'useCapture':!0x0});}['afterInit'](){const _0x4af880=this['editor'],_0x4a9a49=_0x4af880['commands']['get']('undo');_0x4a9a49&&_0x4af880['model']['on']('applyOperation',(_0x43ba99,_0x13aec5)=>{const _0xe778c5=_0x13aec5[0x0];if(!_0xe778c5['isDocumentOperation'])return;if('marker'!=_0xe778c5['type']||!_0xe778c5['name']['startsWith']('user:'))return;const _0x433c70=_0xe778c5['batch'];_0x4a9a49['_createdBatches']['has'](_0x433c70)&&(_0xe778c5['newRange']=_0xe778c5['oldRange']?_0x4af880['model']['createRange'](_0xe778c5['oldRange']['start'],_0xe778c5['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x2f39cc=this['editor'],_0x23fbf7=_0x2f39cc['model']['document'],_0x1aead9=_0x2f39cc['plugins']['get'](i);_0x2f39cc['model']['enqueueChange']({'isUndoable':!0x1},_0x4e81c8=>{const _0x240197='user:range:'+_0x1aead9['mySessionId'],_0x22ed89='user:position:'+_0x1aead9['mySessionId'],_0x3c86a5=_0x2f39cc['model']['markers']['has'](_0x240197);_0x2f39cc['editing']['view']['hasDomSelection']?te(_0x1aead9['mySessionId'],_0x23fbf7['selection']['getFirstRange'](),_0x2f39cc['model'],_0x4e81c8):_0x3c86a5&&(_0x4e81c8['removeMarker'](_0x240197),_0x4e81c8['removeMarker'](_0x22ed89));});}}function te(_0x27aefb,_0x229d63,_0x3886f0,_0x25e98d){const _0x51e99d='user:range:'+_0x27aefb,_0x2af40d='user:position:'+_0x27aefb,_0x29c40b=_0x229d63['getContainedElement']();let _0x559039=_0x229d63['start'];if(_0x29c40b&&_0x29c40b['is']('element','tableCell')){const _0x240f91=function(_0x176750,_0x43856a){for(const _0x331de2 of _0x176750['getPositions']())if(_0x43856a['schema']['checkChild'](_0x331de2,'$text'))return _0x331de2;}(_0x229d63,_0x3886f0);_0x240f91&&(_0x559039=_0x240f91,_0x229d63=_0x25e98d['createRange'](_0x559039));}const _0x3c11dd=_0x25e98d['createRange'](_0x559039);_0x3886f0['markers']['has'](_0x51e99d)?(_0x25e98d['updateMarker'](_0x51e99d,{'range':_0x229d63}),_0x25e98d['updateMarker'](_0x2af40d,{'range':_0x3c11dd})):(_0x25e98d['addMarker'](_0x51e99d,{'range':_0x229d63,'usingOperation':!0x0}),_0x25e98d['addMarker'](_0x2af40d,{'range':_0x3c11dd,'usingOperation':!0x0}));}function K(_0x4a8433,_0x2d17bc,_0x33f1a0){const _0x5a8fce=_0x4a8433['t'],t=_0x4a8433['t'];switch(_0x2d17bc){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 _0x5a8fce({'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'},_0x33f1a0);default:return'';}}let X=0x1;class l extends _0x418480{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x56d865)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,$,_0x4f019c,_0x1a1c18,_0x12f92f];}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 _0x25ff39=this['serverHistory']['getOperations']();for(let _0x2aed28=_0x25ff39['length']-0x1;_0x2aed28>=0x0;_0x2aed28--){const _0x1402b3=_0x25ff39[_0x2aed28];if(!this['_disconnectionOperations']['has'](_0x1402b3))return _0x1402b3['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x334a97){if(super(_0x334a97),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x270459(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x9081b9('collaboration-missing-channelid',this);const _0x107cfd=_0x334a97['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x107cfd,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x4b26e6(),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 _0x1acfc7=this['editor'],_0x519a9d=_0x1acfc7['plugins']['get'](_0x1a1c18),_0x596422=_0x1acfc7['plugins']['get'](n);this['listenTo'](_0x519a9d,'getOperationAuthor',(_0x5ef430,_0x575287)=>{const _0x25420e=_0x575287[0x0];_0x25420e['_authorId']&&(_0x5ef430['return']=_0x519a9d['getUser'](_0x25420e['_authorId']),_0x5ef430['stop']()),null===_0x25420e['_authorId']&&(_0x5ef430['return']=null,_0x5ef430['stop']());},{'priority':'high'}),this['listenTo'](_0x1acfc7['model']['document']['selection'],'change:range',(_0x57d0aa,_0x49a530)=>{_0x49a530['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x1acfc7['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x1acfc7['model']['on']('applyOperation',(_0x76ccb6,_0x378720)=>{const _0x306560=_0x378720[0x0];_0x306560['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x306560),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x596422,'state',this,'_hasSynchronizationProblem',(_0x10fc48,_0xb9412)=>'connected'===_0x10fc48&&!_0xb9412),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x1acfc7['disableReadOnlyMode']('rtc-offline'):_0x1acfc7['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x1acfc7['disableReadOnlyMode']('rtc-offline'):_0x1acfc7['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x5043ac=this['editor']['plugins']['get'](i),_0x14beb4=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x5043ac['unregister'](this['_channelId']);const _0x316f64=await this['_service']['reconnect'](_0x14beb4['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x316f64)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x31bbe8=await this['_service']['getConnectedSessions']();_0x5043ac['register'](this['_channelId'],_0x31bbe8),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x5c286e){if(function(_0x13b9f5){return'404'===_0x13b9f5['code'];}(_0x5c286e)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x17608c){return'409'===_0x17608c['code'];}(_0x5c286e)){const _0x1cf0fb=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'](_0x1cf0fb);}else{if(!(_0x5c286e instanceof Y))throw _0x5c286e;this['_handleReconnectionError']();}}}}['destroy'](){const _0x5286ce=this['editor']['plugins']['get'](n),_0x56ec2d=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x56ec2d['channelSessions']['has'](this['_channelId'])&&_0x56ec2d['unregister'](this['_channelId']),_0x5286ce['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x5e8649){if(this['sessionId']!==_0x5e8649['sessionId']&&this['_lastSyncedOperationId']!==_0x5e8649['lastOperationId'])throw new Y();return this['sessionId']=_0x5e8649['sessionId'],this['_handleServerResponse']([],{..._0x5e8649,'wereChangesApplied':!0x1,'data':_0x5e8649['data']},'reconnect');}async['_connectService'](_0x405964,_0x19e43a=!0x1){const {connection:_0x15a6f5}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x15a6f5,this['_channelId'])['then'](_0x56c518=>this['_initSessionsHandling'](_0x56c518))['catch'](_0x1f8ab6=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1f8ab6);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x380032,_0x16130c)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x16130c);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0xd8846e=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x405964);this['_isPendingUpdate']=!0x0;const _0x5033d4=await this['_service']['connect'](_0x15a6f5,this['_compressOperations'](_0x405964),_0xd8846e);if(this['sessionId']=_0x5033d4['sessionId'],_0x19e43a){if(!_0x5033d4['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x5033d4['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x405964,_0x5033d4,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x5033d4,_0x405964);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x5749fc=this['editor']['plugins']['get'](i),_0x572d46=this['editor']['plugins']['get']($),_0x356406=_0x5749fc['channelSessions']['get'](this['_channelId']);_0x356406&&_0x356406['length']>0x1?_0x572d46['createUserMarkerOperations']():this['listenTo'](_0x5749fc,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x5749fc['channelSessions']['get'](this['_channelId'])['length']&&_0x572d46['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x2d91ec,_0x2d760b,_0x585982,_0x34fa0d){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x2d760b){const _0x583ff9=this['_decompressOperations'](_0x585982,_0x34fa0d);await this['_fetchMissingUsers'](_0x583ff9),this['_handleExternalOperations'](_0x583ff9,_0x2d760b,_0x585982['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x44a49e}=this['editor'];let _0x56c69e;try{_0x56c69e=await this['_service']['getDocumentDetails']();}catch{const _0x35d9a8=K(_0x44a49e,'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'](_0x35d9a8);}const _0x23fe07=_0x56c69e['currentDocumentSession']||_0x56c69e['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x23fe07['lastOperationId']){const _0x517196=K(_0x44a49e,'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'](_0x517196);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x38b4f0){const _0x386529=this['editor']['plugins']['get'](i);this['listenTo'](_0x386529,'sessionAdd:'+this['_channelId'],(_0x487643,{session:_0x50d606})=>{if(_0x50d606['id']===_0x386529['mySessionId']){_0x487643['off']();const _0x62a084=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x379597=_0x50d606['permissions'];_0x62a084&&_0x62a084['isEnabled']&&(_0x379597=_0x379597['filter'](_0xcb6d23=>'document:write'!==_0xcb6d23)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x379597,this['_channelId']);}}),_0x386529['register'](this['_channelId'],_0x38b4f0);}['_initThrowingOnDataSet'](){const _0x2ab267=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x188d73)=>{if(!_0x188d73[_0x188d73['length']-0x1]['suppressErrorInCollaboration'])throw new _0x9081b9('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x2ab267['apply'](this['editor']['data'],_0x188d73);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x1a52f7,[_0x59fc92])=>{if(this['_document']['version'])throw new _0x9081b9('realtimecollaborationclient-init-document-already-initialized',this);_0x1a52f7['stop'](),this['_setPendingAction']();const _0x16c08b=this['editor']['config']['get']('rootsAttributes'),_0x3dbc1d=this['_getOperationsFromInitData'](_0x59fc92,_0x16c08b);0x0==_0x3dbc1d['length']&&_0x3dbc1d['push'](new _0x19fa2d(0x0)),_0x1a52f7['return']=this['_connectService'](_0x3dbc1d)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x22559d=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x22559d))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2af780,[_0x137a10,_0xf04a14])=>{_0x2af780['stop']();const _0x1c753e=this['editor']['model']['document']['getRoot'](_0x137a10);if(!this['_knownRootNames']['has'](_0x137a10)){const _0x36d84a=_0xf04a14&&_0xf04a14['data']?_0xf04a14['data']:'',_0x38729f=_0xf04a14&&_0xf04a14['attributes']?_0xf04a14['attributes']:{};await this['_loadRoot'](_0x137a10,_0x36d84a,_0x38729f);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x1c753e['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x1c753e);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x3e4681){const _0x3e68b6=this['editor']['plugins']['get'](_0x1a1c18),{connection:_0x421028}=this['editor']['plugins']['get'](n),_0x29e225=new Set();for(const _0x6d57fe of _0x3e4681){const _0x199ab9=_0x6d57fe['_authorId'];_0x199ab9&&!_0x3e68b6['getUser'](_0x199ab9)&&_0x29e225['add'](_0x199ab9);}if(0x0===_0x29e225['size'])return;const _0x530d3e=await ct['getMany'](_0x421028,Array['from'](_0x29e225));for(const _0x3faeda of _0x530d3e)_0x3e68b6['getUser'](_0x3faeda['id'])||_0x3e68b6['addUser'](_0x3faeda);}['_getOperationsFromInitData'](_0xe12340,_0x433f83={}){const _0x47784e=this['editor']['model'],_0x21ee0a=[];let _0x20a94e=0x0;const _0xd4d906='string'==typeof _0xe12340?{'main':_0xe12340}:_0xe12340;for(const _0x3c8811 of Object['keys'](_0xd4d906)){if(!this['_document']['roots']['has'](_0x3c8811))throw new _0x9081b9('realtimecollaborationclient-init-non-existent-root',this);const _0x4b1b35=this['editor']['data']['parse'](_0xd4d906[_0x3c8811]),_0x425d29=this['_document']['getRoot'](_0x3c8811),_0x1e8114=new _0xd2e013(_0x47784e['createPositionAt'](_0x425d29,0x0),_0x4b1b35,_0x20a94e++);_0x21ee0a['push'](_0x1e8114);for(const [_0x359c29,_0x54d5a1]of _0x4b1b35['markers']){const _0x582b94=_0x47784e['createRange'](_0x47784e['createPositionFromPath'](_0x425d29,_0x54d5a1['start']['path']['slice']()),_0x47784e['createPositionFromPath'](_0x425d29,_0x54d5a1['end']['path']['slice']())),_0x33abb6=new _0x3b9cb1(_0x359c29,null,_0x582b94,_0x47784e['markers'],!0x0,_0x20a94e++);_0x21ee0a['push'](_0x33abb6);}}if(_0x433f83)for(const [_0x4595c2,_0x487948]of Object['entries'](_0x433f83)){const _0x31797d=_0x47784e['document']['getRoot'](_0x4595c2);if(!_0x31797d)throw new _0x9081b9('multi-root-editor-root-attributes-no-root',null);for(const [_0xdd4f70,_0x5a9951]of Object['entries'](_0x487948))if(null!==_0x5a9951){const _0x232da8=new _0x5c673a(_0x31797d,_0xdd4f70,null,_0x5a9951,_0x20a94e++);_0x21ee0a['push'](_0x232da8);}}return _0x21ee0a;}async['_loadRoot'](_0x4f7926,_0x4362b4,_0x4c18a7){this['_getOperationsFromInitData']({[_0x4f7926]:_0x4362b4},{[_0x4f7926]:_0x4c18a7})['forEach']((_0x46c526,_0x1212a0)=>{_0x46c526['baseVersion']=this['_document']['version']+_0x1212a0,_0x46c526['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x46c526);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x1a19b6,_0x12987e){let _0x3f7fac;this['_offset']=_0x1a19b6['offset'];const _0x3f3667=_0x1a19b6['wereChangesApplied']&&!_0x1a19b6['initData'],_0x1a744e=_0x3f3667?0x0:_0x1a19b6['data']['baseVersion'];if(_0x12987e['forEach'](_0x198b7f=>{_0x198b7f['_isInit']=!0x0,_0x198b7f['createdAt']=_0x1a19b6['sessionCreatedAt'],_0x198b7f['_authorId']=null;}),_0x3f3667)_0x3f7fac=_0x12987e,this['_applyOperationsSet'](_0x3f7fac,_0x3f3667);else{if(_0x1a19b6['initData']){const _0x3c63a6=this['_getOperationsFromInitData'](_0x1a19b6['initData']);this['_document']['history']['version']=-_0x3c63a6['length'],_0x3c63a6['forEach'](_0x30db96=>{_0x30db96['baseVersion']-=_0x3c63a6['length'],_0x30db96['createdAt']=_0x1a19b6['sessionCreatedAt'],_0x30db96['_isInit']=!0x0,_0x30db96['_authorId']=null;}),this['_applyOperationsSet'](_0x3c63a6,!0x0),this['serverHistory']['version']=-_0x3c63a6['length']+this['_offset'],this['_updateServerHistory'](_0x3c63a6);}this['_document']['history']['version']=_0x1a744e,_0x3f7fac=this['_decompressOperations'](_0x1a19b6['data'],_0x1a19b6['metadata']),await this['_fetchMissingUsers'](_0x3f7fac),this['_applyOperationsSet'](_0x3f7fac,_0x3f3667);}_0x1a19b6['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3f7fac,_0x1a19b6['lastOperationId']),this['_lastSyncedOperationId']=_0x1a19b6['lastOperationId']),this['serverHistory']['version']=_0x1a744e+this['_offset'],this['_updateServerHistory'](_0x3f7fac),_0x12987e['filter'](_0x23a3f1=>{const _0x2c5e24=this['_getAffectedRoot'](_0x23a3f1);return _0x2c5e24&&!this['_knownRootNames']['has'](_0x2c5e24);})['forEach']((_0x2b5cd8,_0x463013)=>{_0x2b5cd8['baseVersion']=this['_document']['version']+_0x463013,this['_saveOperationInBuffer'](_0x2b5cd8);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x16c425,_0x377105){const _0x436fbb=_0x377105&&_0x377105['message'];if(_0x436fbb&&_0x436fbb['startsWith']('realtimecollaborationclient'))throw _0x377105;const _0x36b4e9=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x36b4e9['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x9081b9(_0x16c425,this['editor'],_0x436fbb?{'originalError':_0x436fbb}:void 0x0);}['_saveOperationInBuffer'](_0x9cffa){this['_knownOperations']['has'](_0x9cffa)||(this['_knownOperations']['add'](_0x9cffa),this['_bufferedOperations']['push'](_0x9cffa),this['_pendingAction']||'marker'==_0x9cffa['type']&&!_0x9cffa['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0xfc9f7c=!0x1){!_0xfc9f7c&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x20f2e8=>{_0x20f2e8&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x4c6eb3=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3cfd08){return _0x3cfd08['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3cfd08['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3cfd08['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x4c6eb3)||this['_crash'](_0x4c6eb3['message'],_0x4c6eb3);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x461e97=>{this['on']('change:_isPendingUpdate',()=>{_0x461e97();});});}async['_sendBufferedOperations'](){const _0x1a3aa9=this['editor']['plugins']['get']($);if(this['_shouldSendSelectionUpdate']()&&(_0x1a3aa9['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x45d02b=[...this['_bufferedOperations']];for(const _0x217fd5 of _0x45d02b)_0x217fd5['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x217fd5);const _0x2a2159=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x45d02b),_0x5e00c2=X++,_0x52f077=this['_compressOperations'](_0x45d02b),_0x391586=await this['_service']['sendOperations'](_0x52f077,_0x52f077['baseVersion'],_0x2a2159);try{return await this['_handleServerResponse'](_0x45d02b,_0x391586,_0x5e00c2);}catch(_0x5dd567){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x5dd567);}}async['_handleServerResponse'](_0x5debc3,_0x449884,_0x57f2fa){if('error'in _0x449884)throw _0x449884['error'];let _0x4a14f6=!0x1;if(_0x449884['wereChangesApplied']){_0x449884['lastOperationId']&&(this['_lastSyncedOperationId']=_0x449884['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0xd33185=>!_0x5debc3['includes'](_0xd33185));for(const _0x350d64 of _0x5debc3)_0x350d64['createdAt']='lastOperationAcceptedAt'in _0x449884&&_0x449884['lastOperationAcceptedAt']||void 0x0;Z(_0x5debc3,_0x449884['version']-_0x5debc3['length']),this['_updateServerHistory'](_0x5debc3);const _0x59d803=_0x5debc3['filter'](_0x559d53=>{if(!_0x559d53['_isInit'])return!0x1;const _0x4d9dd9=this['_getAffectedRoot'](_0x559d53);return _0x4d9dd9&&!this['_knownRootNames']['has'](_0x4d9dd9);});Z(_0x59d803,this['_document']['version']),this['_applyOperationsSet'](_0x59d803),_0x4a14f6=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x3dae24=this['_decompressOperations'](_0x449884['data'],_0x449884['metadata'])['filter'](_0x39fac9=>_0x39fac9['baseVersion']>=this['_lastServerVersion']);_0x3dae24['forEach'](_0x57e3fe=>this['_addKnownRoot'](_0x57e3fe)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x19494b=>!_0x19494b['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x19494b))),this['_bufferedOperations']['length']&&Z(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x3dae24),_0x4a14f6=this['_handleExternalOperations'](_0x3dae24,_0x449884['version'],_0x449884['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x4a14f6?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x4c21ab,_0x145b51,_0x42f0af){try{const _0x53a420={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x13778e,operationsB:_0x3cbeb3,originalOperations:_0x259bb5}=_0x378410(_0x4c21ab,this['_bufferedOperations'],_0x53a420);Z(_0x13778e,this['_document']['version']),Z(_0x3cbeb3,_0x145b51);for(const _0x13a2c5 of _0x13778e){const _0x5c5c36=_0x259bb5['get'](_0x13a2c5);_0x13a2c5['_authorId']=_0x5c5c36?_0x5c5c36['_authorId']:null;}_0x42f0af&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x4c21ab,_0x42f0af),this['_lastSyncedOperationId']=_0x42f0af),this['_bufferedOperations']=[..._0x3cbeb3],this['_applyOperationsSet'](_0x13778e),this['_updateServerHistory'](_0x4c21ab);}catch(_0x44a4d7){return console['error'](_0x44a4d7),!0x1;}return!0x0;}['_applyOperationsSet'](_0xb7a944,_0x321db9=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x505c43=>{for(const _0x3dfbd0 of _0xb7a944)this['_knownOperations']['add'](_0x3dfbd0),this['_addKnownRoot'](_0x3dfbd0),_0x505c43['batch']['addOperation'](_0x3dfbd0),this['editor']['model']['applyOperation'](_0x3dfbd0);});}['_addKnownRoot'](_0x23d88f){const _0x30fa1c=this['_getAffectedRoot'](_0x23d88f);_0x30fa1c&&this['_knownRootNames']['add'](_0x30fa1c);}['_getAffectedRoot'](_0x3e9470){let _0x500a65,_0x4c176a;switch(_0x3e9470['type']){case'insert':_0x500a65=_0x3e9470['position']['root'];break;case'marker':if(_0x4c176a=_0x3e9470['newRange'],!_0x4c176a)return null;_0x500a65=_0x4c176a['root'];break;case'addRootAttribute':_0x500a65=_0x3e9470['root'];break;case'addRoot':_0x500a65=_0x3e9470['affectedSelectable'];break;case'move':_0x500a65=_0x3e9470['targetPosition']['root'];break;default:return null;}return _0x500a65['rootName'];}['_updateServerHistory'](_0x3f9913){_0x3f9913['forEach'](_0x30c4d2=>{const _0xacf7d0=_0x30c4d2['clone']();_0xacf7d0['_authorId']=_0x30c4d2['_authorId'],_0xacf7d0['_isInit']=!!_0x30c4d2['_isInit'],_0xacf7d0['createdAt']=_0x30c4d2['createdAt'],_0xacf7d0['baseVersion']+=this['_offset'],_0x30c4d2['_isDisconnection']&&this['_disconnectionOperations']['add'](_0xacf7d0),this['serverHistory']['addOperation'](_0xacf7d0);});}['_handleReconnectionError'](_0x35605e){const _0x3d08a3=this['editor']['plugins']['get']('Notification'),_0x5e79e4=this['editor']['locale'];_0x35605e||(_0x35605e=K(_0x5e79e4,'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.')),_0x3d08a3['showWarning'](_0x35605e,{'title':K(_0x5e79e4,'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'](_0x4f019c)['add'](K(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x4f019c)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0xdea506){const _0x189f59=_0xdea506['map'](_0x347265=>_0x347265['toJSON']());return this['_compressor']['compress'](_0x189f59);}['_decompressOperations'](_0x2b5b14,_0x1afe55){return this['_compressor']['decompress'](_0x2b5b14)['map']((_0x2a7cea,_0x3ef2ca)=>{const _0x305367='init'==_0x1afe55[_0x3ef2ca]['type'];if('InsertOperation'==_0x2a7cea['__className']){const _0x413ed2=_0x2a7cea['position']['root'];!this['_document']['getRoot'](_0x413ed2)&&(this['_document']['createRoot']('$root',_0x413ed2)['_isAttached']=!0x1);}const _0x21ce3a=_0x3f9384['fromJSON'](_0x2a7cea,this['_document']);return _0x21ce3a['wasUndone']=_0x2a7cea['wasUndone'],_0x21ce3a['_isInit']=_0x305367,_0x21ce3a['_authorId']=_0x305367?null:_0x1afe55[_0x3ef2ca]['userId'],_0x21ce3a['_isDisconnection']='cs:removeUser'===_0x1afe55[_0x3ef2ca]['type'],_0x21ce3a['createdAt']=_0x1afe55[_0x3ef2ca]['createdAt'],_0x21ce3a;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x22da2c=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x22da2c&&_0x22da2c['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Y extends Error{}function Z(_0x5d85a6,_0x5a676f){for(const _0x2fde5d of _0x5d85a6)_0x2fde5d['baseVersion']=_0x5a676f++;}class tt{['_ignoredOperations'];['_operationToId'];constructor(_0x25c4e1){this['_ignoredOperations']=_0x25c4e1,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x4e5eee){let _0x5c847e=_0x4e5eee['length'];for(;_0x5c847e--;){const _0x176c96=_0x4e5eee[_0x5c847e];if(!this['_ignoredOperations']['has'](_0x176c96)){if(!this['_operationToId']['has'](_0x176c96)){const _0x33e7b1=_0x2d92be()['slice'](0x1,0x12);this['_operationToId']['set'](_0x176c96,_0x33e7b1);}return this['_operationToId']['get'](_0x176c96);}}}['setIdForTheLastOperation'](_0x3c4032,_0x2d1aa2){if(!_0x2d1aa2)return;let _0x2c0af2=_0x3c4032['length'];for(;_0x2c0af2--;){const _0x1c6257=_0x3c4032[_0x2c0af2];this['_ignoredOperations']['has'](_0x1c6257)||this['_operationToId']['set'](_0x1c6257,_0x2d1aa2);}}}class a extends _0x418480{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x4d663b{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x5470cf)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x1a1c18];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xbd3e5f){super(_0xbd3e5f),this['_services']=new Map();}async['init'](){const _0x103999=this['context'],_0x571eee=_0x103999['plugins']['get']('CommentsRepository');if(_0x103999['plugins']['get'](n)['addToReconnectionStack'](this),_0x571eee['adapter']={'addCommentThread':async({channelId:_0x84e6e6,threadId:_0x1c2fd3,comments:_0x3c62fa,resolvedAt:_0x30fedd,resolvedBy:_0x23d236,context:_0xe5a74d,attributes:_0x51e8fc})=>{const _0x1c1014=await this['_getService'](_0x84e6e6)['addCommentThread']({'commentThreadId':_0x1c2fd3,'comments':_0x3c62fa['map'](_0x2e76de=>function(_0x4eeedc,_0x317436,_0x422713){return{'commentThreadId':_0x422713,'commentId':_0x4eeedc['commentId'],'userId':_0x4eeedc['authorId'],'content':_0x4eeedc['content'],'documentId':_0x317436,'createdAt':_0x4eeedc['createdAt'],'attributes':_0x4eeedc['attributes']||{}};}(_0x2e76de,_0x84e6e6,_0x1c2fd3)),'resolvedAt':_0x30fedd,'resolvedBy':_0x23d236,'context':_0xe5a74d,'attributes':_0x51e8fc})['catch'](at);return{'threadId':_0x1c1014['commentThreadId'],'comments':_0x1c1014['comments']};},'getCommentThread':async({channelId:_0x3fe157,threadId:_0x4e7ae9})=>{const _0x700ffd=await this['_getService'](_0x3fe157)['getCommentThread'](_0x4e7ae9)['catch'](at);return _0x700ffd['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x700ffd]),{'threadId':_0x700ffd['commentThreadId'],'comments':_0x700ffd['comments']['map'](p),'context':_0x700ffd['context'],'resolvedAt':_0x700ffd['resolvedAt'],'resolvedBy':_0x700ffd['resolvedBy'],'attributes':_0x700ffd['attributes']||{}});},'updateCommentThread':async({channelId:_0x1f4edc,threadId:_0x1711e2,context:_0x529fb7,unlinkedAt:_0x3e89cd,attributes:_0x25134c})=>this['_getService'](_0x1f4edc)['updateCommentThread']({'commentThreadId':_0x1711e2,'context':_0x529fb7,'attributes':_0x25134c,'unlinkedAt':_0x3e89cd})['catch'](v)['catch'](at),'resolveCommentThread':async({channelId:_0x55da45,threadId:_0x49d5ca})=>{const _0x465527=await this['_getService'](_0x55da45)['resolveCommentThread'](_0x49d5ca)['catch'](v)['catch'](at);return{'threadId':_0x465527['commentThreadId'],'resolvedAt':_0x465527['resolvedAt'],'resolvedBy':_0x465527['resolvedBy']};},'reopenCommentThread':async({channelId:_0x32fa74,threadId:_0x275453})=>this['_getService'](_0x32fa74)['reopenCommentThread'](_0x275453)['catch'](v)['catch'](at),'removeCommentThread':({channelId:_0x52fead,threadId:_0x9515da})=>this['_getService'](_0x52fead)['removeCommentThread'](_0x9515da)['catch'](v)['catch'](at),'addComment':({channelId:_0x58f4b4,threadId:_0x172fc7,commentId:_0x3fd3b3,content:_0x41fa50,attributes:_0x3fb02e})=>this['_getService'](_0x58f4b4)['addComment'](_0x172fc7,_0x3fd3b3,_0x41fa50,_0x3fb02e)['catch'](at),'updateComment':({channelId:_0x126ca2,threadId:_0x2df09d,commentId:_0xc0cff9,content:_0x51fd3a,attributes:_0x228fca})=>this['_getService'](_0x126ca2)['updateComment'](_0x2df09d,_0xc0cff9,_0x51fd3a,_0x228fca)['catch'](v)['catch'](at),'removeComment':({channelId:_0x10fdff,threadId:_0x2b4dbf,commentId:_0x4c26d4})=>this['_getService'](_0x10fdff)['removeComment'](_0x2b4dbf,_0x4c26d4)['catch'](v)['catch'](at)},_0x103999 instanceof _0x2950e7){const _0x3429d5=_0x103999['config']['get']('collaboration.channelId'),_0x212626=_0x103999['plugins']['get'](i);await this['_setUpService'](_0x3429d5);const _0x28d2c9=await this['_services']['get'](_0x3429d5)['getConnectedSessions']();this['listenTo'](_0x212626,'sessionAdd:'+_0x3429d5,(_0x3489e2,{session:_0x140ef8})=>{_0x140ef8['id']===_0x212626['mySessionId']&&(_0x3489e2['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x140ef8['permissions'],_0x3429d5));}),_0x212626['register'](_0x3429d5,_0x28d2c9);}}async['_setUpService'](_0x130cb9){if(this['_services']['has'](_0x130cb9))throw new _0x9081b9('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x130cb9});const _0x36f8a5=this['context']['plugins']['get']('CommentsRepository'),_0x31d374=new s['CommentsService'](_0x130cb9);this['_services']['set'](_0x130cb9,_0x31d374),this['listenTo'](_0x31d374,'commentThreadAdded',(_0x337887,_0x51b0a5)=>{const {commentThreadId:_0x188bf1,documentId:_0x3ad995,context:_0x2d4dba,attributes:_0x2e1537,resolvedAt:_0x111e7a,resolvedBy:_0xf5d3eb,comments:_0x36759b}=_0x51b0a5;_0x36f8a5['getCommentThread'](_0x188bf1)||_0x36f8a5['addCommentThread']({'threadId':_0x188bf1,'channelId':_0x3ad995,'comments':_0x36759b?_0x36759b['map'](p):[],'context':_0x2d4dba,'attributes':_0x2e1537,'resolvedAt':_0x111e7a,'resolvedBy':_0xf5d3eb,'isFromAdapter':!0x0});}),this['listenTo'](_0x31d374,'commentThreadUpdated',(_0x4295b6,{commentThreadId:_0x6b736c,documentId:_0x3a6b4d,context:_0xd386a9,unlinkedAt:_0xbf0c0a,attributes:_0x464a90})=>{_0x36f8a5['getCommentThread'](_0x6b736c)&&_0x36f8a5['updateCommentThread']({'threadId':_0x6b736c,'channelId':_0x3a6b4d,'context':_0xd386a9,'unlinkedAt':_0xbf0c0a,'attributes':_0x464a90,'isFromAdapter':!0x0});}),this['listenTo'](_0x31d374,'commentThreadResolved',(_0x1832c1,{commentThreadId:_0x10cc1e,resolvedBy:_0x39d676,resolvedAt:_0x5a569a})=>{const _0x1a3435=_0x36f8a5['getCommentThread'](_0x10cc1e);_0x1a3435&&_0x1a3435['resolve']({'resolvedBy':_0x39d676,'resolvedAt':_0x5a569a,'isFromAdapter':!0x0});}),this['listenTo'](_0x31d374,'commentThreadReopened',(_0x76321c,{commentThreadId:_0xb2c05f})=>{const _0x114c0b=_0x36f8a5['getCommentThread'](_0xb2c05f);_0x114c0b&&_0x114c0b['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x31d374,'commentThreadRemoved',(_0x2ce21a,{commentThreadId:_0x3694a0})=>{const _0x5776f3=_0x36f8a5['getCommentThread'](_0x3694a0);_0x5776f3&&_0x5776f3['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x31d374,'commentAdded',(_0x593be7,_0x41e8fe)=>{const _0x5c20bb=_0x41e8fe['commentThreadId'],_0x3c71a7=_0x36f8a5['getCommentThread'](_0x5c20bb);_0x3c71a7&&_0x3c71a7['addComment']({...p(_0x41e8fe),'isFromAdapter':!0x0});}),this['listenTo'](_0x31d374,'commentUpdated',(_0x92b507,{commentThreadId:_0x1bdc73,commentId:_0x10906b,content:_0x1015d2,attributes:_0x3e1675})=>{const _0x1b37de=_0x36f8a5['getCommentThread'](_0x1bdc73);if(_0x1b37de){const _0x1f50c1=_0x1b37de['getComment'](_0x10906b);_0x1f50c1&&_0x1f50c1['update']({'content':_0x1015d2,'attributes':_0x3e1675,'isFromAdapter':!0x0});}}),this['listenTo'](_0x31d374,'commentRemoved',(_0x599603,{commentThreadId:_0x2c43c1,commentId:_0x241c6d})=>{const _0x276001=_0x36f8a5['getCommentThread'](_0x2c43c1);if(_0x276001){const _0x5b6368=_0x276001['getComment'](_0x241c6d);_0x5b6368&&_0x5b6368['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x130cb9);}['destroy'](){if(this['context']instanceof _0x2950e7){const _0x32b9ad=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x32b9ad);}}['_terminateService'](_0x3187a7){if(!this['_services']['has'](_0x3187a7))throw new _0x9081b9('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x3187a7});this['_getService'](_0x3187a7)['disconnect'](),this['_services']['delete'](_0x3187a7);}async['reconnect'](){for(const _0x50ea40 of this['_services']['keys']())await this['_connectService'](_0x50ea40);if(this['context']instanceof _0x2950e7){const _0xccc46=this['context']['config']['get']('collaboration.channelId'),_0x15d14c=this['context']['plugins']['get'](i);_0x15d14c['unregister'](_0xccc46);const _0x1f9170=await this['_services']['get'](_0xccc46)['getConnectedSessions']();_0x15d14c['register'](_0xccc46,_0x1f9170);}}async['_connectService'](_0x3978f5){const {connection:_0x165123}=this['context']['plugins']['get'](n),_0x59d90a=this['context']['plugins']['get']('CommentsRepository'),_0x53b240=this['_services']['get'](_0x3978f5),_0x21c3b7=await _0x53b240['connect'](_0x165123);await this['_fetchMissingUsersForThreads'](_0x21c3b7);const _0x2bec26=new Set(Array['from'](_0x59d90a['getCommentThreads']({'channelId':_0x3978f5}),_0x2a3292=>_0x2a3292['id']));for(const _0x2a8435 of _0x21c3b7)_0x2a8435['deletedAt']||_0x2bec26['delete'](_0x2a8435['commentThreadId']);for(const _0x28e327 of _0x2bec26)_0x59d90a['getCommentThread'](_0x28e327)['remove']({'isFromAdapter':!0x0});for(const _0x174367 of _0x21c3b7){let _0x42ff93=_0x59d90a['getCommentThread'](_0x174367['commentThreadId']);const {commentThreadId:_0x41527c,context:_0x29db26,attributes:_0x896e1c,resolvedBy:_0x393152,resolvedAt:_0x148714,unlinkedAt:_0x2dbac2,deletedAt:_0x1536dd}=_0x174367;if(_0x1536dd)continue;_0x42ff93||(_0x42ff93=_0x59d90a['addCommentThread']({'channelId':_0x3978f5,'threadId':_0x41527c,'context':_0x29db26,'attributes':_0x896e1c||{},'resolvedBy':_0x393152,'resolvedAt':_0x148714,'unlinkedAt':_0x2dbac2,'isFromAdapter':!0x0}));const _0x51dadb=new Set(Array['from'](_0x42ff93['comments'],_0x48c31c=>_0x48c31c['id']));for(const _0x4805b8 of _0x174367['comments'])_0x51dadb['delete'](_0x4805b8['commentId']);for(const _0x76af2d of _0x51dadb)_0x42ff93['getComment'](_0x76af2d)['remove']({'isFromAdapter':!0x0});for(const _0x1d63e9 of _0x174367['comments']){const _0x41c3c5=_0x42ff93['getComment'](_0x1d63e9['commentId']);_0x41c3c5?_0x41c3c5['content']!==_0x1d63e9['content']&&_0x41c3c5['update']({'content':_0x1d63e9['content'],'isFromAdapter':!0x0}):_0x42ff93['addComment'](Object['assign'](p(_0x1d63e9),{'isFromAdapter':!0x0}));}}}['_getService'](_0x53a6de){if(!this['_services']['has'](_0x53a6de))throw new _0x9081b9('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x53a6de});return this['_services']['get'](_0x53a6de);}async['_fetchMissingUsersForThreads'](_0x4b379a){const _0x187de9=this['context']['plugins']['get'](_0x1a1c18),{connection:_0x343664}=this['context']['plugins']['get'](n),_0x17cd9a=new Set();for(const {resolvedBy:_0x271b6b,comments:_0x381225}of _0x4b379a){_0x271b6b&&!_0x187de9['getUser'](_0x271b6b)&&_0x17cd9a['add'](_0x271b6b);for(const {userId:_0xc0b7f2}of _0x381225)_0x187de9['getUser'](_0xc0b7f2)||_0x17cd9a['add'](_0xc0b7f2);}if(0x0===_0x17cd9a['size'])return;const _0x421784=await ct['getMany'](_0x343664,Array['from'](_0x17cd9a));for(const _0x419960 of _0x421784)_0x187de9['getUser'](_0x419960['id'])||_0x187de9['addUser'](_0x419960);}}async function v(_0xaf62a6){if('404'!==_0xaf62a6['code'])throw _0xaf62a6;}function at(_0x1236c1){if((_0x567698=_0x1236c1)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x567698['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x567698['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x567698;throw _0x1236c1;}function p(_0x5c87fa){return{'threadId':_0x5c87fa['commentThreadId'],'commentId':_0x5c87fa['commentId'],'content':_0x5c87fa['content'],'createdAt':_0x5c87fa['createdAt'],'authorId':_0x5c87fa['userId'],'attributes':_0x5c87fa['attributes']||{}};}class m extends _0x418480{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x5b41fc)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x1a1c18];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2d6d9c){super(_0x2d6d9c);const _0x3b56c9=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x3b56c9);}async['init'](){const _0x186b08=this['editor']['plugins']['get'](l),_0x431b16=_0x186b08['serverHistory'],_0x36a70d=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x431b16,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x186b08['sessionId']});const _0x106a1d=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x49959d=await _0x24bdd2['isBundleUploaded'](_0x36a70d['connection'],_0x106a1d);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x3c2439})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x3c2439)),'updateRevisions':async _0x3053ae=>{await this['_waitForServiceReady']();const _0x139920=this['_revisionTracker']['currentRevision'];if(_0x49959d&&0x1===_0x3053ae['length']&&_0x3053ae[0x0]['id']===_0x139920['id'])return _0x3053ae;for(const _0x144215 of _0x3053ae)_0x144215['id']===_0x139920['id']&&(_0x144215['isEmptyCurrent']=_0x144215['fromVersion']===_0x144215['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x3053ae,this['_lastRequestId'])['then'](_0x2a1526=>(this['_lastRequestId']=_0x2a1526,_0x3053ae))['catch'](_0x328193=>{if(b(_0x328193)||'400'===_0x328193['code']&&void 0x0!==_0x328193['data']['wrongRequestId']){for(const _0x1ae5be of _0x3053ae){!this['_revisionTracker']['repository']['getRevision'](_0x1ae5be['id'])||this['_revisionTracker']['_bufferUpdate'](_0x1ae5be['id'],_0x1ae5be,!0x1);}if(b(_0x328193))throw _0x328193;return _0x3053ae;}throw _0x328193;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x866de9,{revisionsData:_0x1725f8,requestId:_0x43f5e1})=>{Math['max'](..._0x1725f8['map'](_0x49e3e7=>_0x49e3e7['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x1725f8,_0x43f5e1);}):this['_handleRevisionsUpdate'](_0x1725f8,_0x43f5e1);});const {revisions:_0x10de2b,requestId:_0x1031e4}=await this['_revisionHistoryService']['connect'](_0x36a70d['connection']);_0x36a70d['addToReconnectionStack'](this),this['_lastRequestId']=_0x1031e4,await this['_fetchMissingUsers'](_0x10de2b);for(const _0x158347 of _0x10de2b)this['_revisionTracker']['addRevisionData'](_0x158347);this['listenTo'](_0x186b08,'change:_isConnected',(_0x267f2f,_0x2022ff,_0x2b5366)=>{_0x2b5366&&(this['_oldOffset']=_0x186b08['_offset'],_0x267f2f['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x36a70d,'state',_0x476dbd=>_0x476dbd===_0x5bf203['CONNECTED']);}async['reconnect'](){const _0x29d7dc=this['editor']['plugins']['get'](n),_0x532064=this['editor']['plugins']['get'](l),_0x42f219=async()=>{const _0x25777a=this['_revisionTracker']['currentRevision'],_0xec44df=_0x25777a['id'],_0x605628=_0xec44df!==_0x532064['sessionId'];if(_0x605628){const _0x61c910=_0x532064['_offset']-this['_oldOffset'],_0x19bd6e=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x25777a['toVersion']+_0x61c910!==_0x19bd6e){const _0x54b87e=_0x25777a['fromVersion']+_0x61c910,_0x445fd6=this['editor']['plugins']['get'](_0x1a1c18),_0xdb0f75=this['_revisionTracker']['buildRevisionData']({'revision':_0x25777a,'from':_0x54b87e,'to':_0x19bd6e});_0xdb0f75['id']=_0x25777a['id'];const _0x2d64d1=_0xdb0f75['authorsIds']['map'](_0x4d82dc=>_0x445fd6['getUser'](_0x4d82dc));_0x25777a['_update']({..._0xdb0f75,'authors':_0x2d64d1},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x25777a['id'],_0xdb0f75,!0x0);}this['_revisionTracker']['_startingVersion']=_0x19bd6e,(_0x25777a['toVersion']===_0x25777a['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0xec44df)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0xec44df),this['_revisionTracker']['_createCurrentRevision'](_0x19bd6e));}const {revisions:_0x2e24d9,requestId:_0x2f0db9}=await this['_revisionHistoryService']['reconnect'](_0x29d7dc['connection'],this['_lastRequestId']);_0x605628&&_0x2e24d9['length']>0x0?_0x532064['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x2e24d9),this['_handleRevisionsUpdate'](_0x2e24d9,_0x2f0db9),this['_revisionTracker']['sendBufferedUpdates']());};return _0x532064['_isConnected']?_0x42f219():new Promise((_0x4c73a8,_0x5b4139)=>{_0x532064['once']('change:_isConnected',()=>{_0x42f219()['then'](_0x4c73a8)['catch'](_0x5b4139);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x36e087=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5bdbad=>{_0x5bdbad['off'](),_0x36e087();});});}['_getLatestVersionFromServerOperations'](){const _0x32968a=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x3ea84f of _0x32968a)if('marker'!==_0x3ea84f['type']||_0x3ea84f['affectsData'])return _0x3ea84f['baseVersion']+0x1;}['_getLatestVersion'](){const _0x2e7b30=this['editor']['plugins']['get'](l);return new Promise(_0x146b41=>{_0x2e7b30['_isPendingUpdate']?_0x2e7b30['once']('change:_isPendingUpdate',()=>{_0x146b41(this['_getLatestVersionFromServerOperations']());}):_0x146b41(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x575117,_0x3648c5){const _0x1cceab=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3648c5;for(const _0x23b0c9 of _0x575117){const _0xdcc3e0=_0x1cceab['getRevision'](_0x23b0c9['id']);if(_0xdcc3e0){if((_0x23b0c9['fromVersion']||_0x23b0c9['toVersion'])&&(_0x23b0c9['diffData']=null),_0xdcc3e0===this['_revisionTracker']['currentRevision']){const _0x2f5c08=Math['max'](_0xdcc3e0['toVersion'],_0x23b0c9['toVersion']),_0x42923d=Math['max'](_0xdcc3e0['fromVersion'],_0x23b0c9['fromVersion']);let _0x2cb800;_0xdcc3e0['toVersion']===_0x23b0c9['toVersion']&&_0xdcc3e0['fromVersion']===_0x23b0c9['fromVersion']?(_0x2cb800=!0x0,this['_preventResendingRevisionData'](_0x23b0c9)):_0x23b0c9['toVersion']===_0x2f5c08&&_0x23b0c9['fromVersion']===_0x42923d?_0x2cb800=!0x1:(_0xdcc3e0['toVersion']===_0x2f5c08&&_0xdcc3e0['fromVersion']===_0x42923d||this['_fixRevision']({'revision':_0xdcc3e0,'from':_0x42923d,'to':_0x2f5c08}),_0x2cb800=!0x0),_0x2cb800&&(delete _0x23b0c9['fromVersion'],delete _0x23b0c9['toVersion'],delete _0x23b0c9['diffData'],delete _0x23b0c9['createdAt'],delete _0x23b0c9['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x23b0c9),this['_preventResendingRevisionData'](_0x23b0c9);}else this['_revisionTracker']['addRevisionData'](_0x23b0c9);}const _0x33c7cb=_0x1cceab['getRevisions']();_0x33c7cb['reverse']();for(let _0x51e6b6=0x0;_0x51e6b6<_0x33c7cb['length']-0x1;_0x51e6b6++){const _0x78c6ef=_0x33c7cb[_0x51e6b6],_0x1920ee=_0x33c7cb[_0x51e6b6+0x1];if(_0x78c6ef['fromVersion']<_0x1920ee['toVersion']){const _0x4f05bd=_0x1920ee['toVersion'],_0x522488=Math['max'](_0x4f05bd,_0x78c6ef['toVersion']);this['_fixRevision']({'revision':_0x78c6ef,'from':_0x4f05bd,'to':_0x522488});}}}['_fixRevision']({revision:_0x4414ec,from:_0x493803,to:_0x11cc99}={}){const _0x23c7fe=this['editor']['plugins']['get'](_0x1a1c18),_0x3c8722=this['_revisionTracker']['buildRevisionData']({'revision':_0x4414ec,'from':_0x493803,'to':_0x11cc99});_0x3c8722['authors']=_0x3c8722['authorsIds']['map'](_0x632818=>_0x23c7fe['getUser'](_0x632818)),_0x4414ec['_update'](_0x3c8722);}['_preventResendingRevisionData'](_0x4131ae){const _0x10cfe9={};_0x10cfe9['id']=_0x4131ae['id'];for(const _0x1036b8 of Object['keys'](_0x4131ae))'id'!==_0x1036b8&&(_0x10cfe9[_0x1036b8]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x10cfe9['id'],_0x10cfe9,!0x0);}async['_fetchMissingUsers'](_0x346913){const _0x46492e=this['editor']['plugins']['get'](_0x1a1c18),{connection:_0xd631c7}=this['editor']['plugins']['get'](n),_0x395649=new Set();for(const _0x16c61c of _0x346913){for(const _0x5aee2d of _0x16c61c['authorsIds'])_0x1183c2(_0x5aee2d);_0x16c61c['creatorId']&&_0x1183c2(_0x16c61c['creatorId']);}if(0x0===_0x395649['size'])return;const _0x148b1b=await ct['getMany'](_0xd631c7,Array['from'](_0x395649));for(const _0x1ef142 of _0x148b1b)_0x46492e['getUser'](_0x1ef142['id'])||_0x46492e['addUser'](_0x1ef142);function _0x1183c2(_0x57fcee){_0x46492e['getUser'](_0x57fcee)||_0x395649['add'](_0x57fcee);}}}function b(_0x2f6234){return _0x2f6234['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2f6234['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2f6234['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class dt extends _0x418480{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class D extends _0x549067{['_collapseAt'];constructor(_0x2f47b3,_0x28acc9=0x6){super(_0x2f47b3);const _0x5d1c65=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x28acc9,this['bind']('isHidden')['to'](this,'usersCount',_0x5ac0f1=>_0x5ac0f1<_0x28acc9),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x5d1c65['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':_0x5d1c65['to']('usersCount',_0x4f86a9=>'+'+(_0x4f86a9-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x549067{['items'];['keystrokes'];constructor(_0x19c771){super(_0x19c771);const _0x2fd4c9=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0xbf9fc(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x2fd4c9['if']('hasPopup'),'aria-expanded':_0x2fd4c9['to']('isExpanded',_0x190a57=>this['hasPopup']&&String(_0x190a57)),'aria-label':_0x2fd4c9['to']('hasPopup',_0x436ad2=>K(_0x19c771,_0x436ad2?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x2fd4c9['to']('hasPopup',_0x2308e0=>!!_0x2308e0&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x2fd4c9['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x2fd4c9['to'](_0x449679=>{const _0x1a6868=_0x449679,_0x24653c=document['querySelector']('.ck-presence-list__dropdown-list'),_0x7ede7c=document['querySelector']('.ck-balloon-panel_with-arrow');_0x24653c?.['contains'](_0x1a6868['relatedTarget'])||_0x7ede7c?.['contains'](_0x1a6868['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x4ab727,_0x2f3a17,_0x3bd8ac)=>{this['element']&&(_0x3bd8ac?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 U extends _0x549067{['counterView'];['inlineListView'];constructor(_0x36a176,_0x763982=0x6){super(_0x36a176);const _0x44d1ed=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new D(this['locale'],_0x763982),this['inlineListView']=new is(_0x36a176),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x12f811 of this['inlineListView']['items'])_0x12f811['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',_0x44d1ed['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class V extends _0x549067{['listWrapperView'];constructor(_0x36901c,_0x5b5a19){super(_0x36901c);const _0xe211aa=this['bindTemplate'];this['listWrapperView']=new ut(_0x36901c,_0x5b5a19),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':K(_0x36901c,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0xe211aa['to'](_0x382193=>{const _0x370e8b=_0x382193,_0x30beb2=document['querySelector']('.ck-presence-list__list'),_0x297583=document['querySelector']('.ck-balloon-panel_with-arrow');_0x30beb2?.['contains'](_0x370e8b['relatedTarget'])||_0x297583?.['contains'](_0x370e8b['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class ut extends _0x5a4aa5{constructor(_0x3dff3a,_0x2921a0){super(_0x3dff3a);const _0x2fffb9=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x2921a0?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2fffb9['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2fffb9['to']('role'),'aria-label':_0x2fffb9['to']('ariaLabel'),'aria-labelledby':_0x2fffb9['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x357dc2['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x2ed49e=this['element'];_0x2ed49e&&(this['_isScrollable']=Math['max'](_0x2ed49e['scrollHeight'],_0x2ed49e['clientHeight'])>0.8*window['innerHeight']);}}class E extends et{['userView'];constructor(_0x4239de,_0x4c2336,_0x31fdc2){super(_0x4239de);const _0x2227b9=this['bindTemplate'];this['userView']=new st(_0x4239de,_0x4c2336);const _0x296f02={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x4c2336['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x4c2336['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4c2336['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x31fdc2&&(_0x296f02['tag']='button',_0x296f02['on']={'click':_0x2227b9['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x296f02);}['focus'](){this['element']['focus']();}}class M extends _0x549067{['userView'];['markerView'];constructor(_0xca42f7,_0x2de738,_0x393d2f){super(_0xca42f7);const _0x4c4f82=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0xca42f7,_0x2de738),this['markerView']=new ot(_0xca42f7,_0x2de738);const _0x3cd706=new it(_0xca42f7);_0x3cd706['template']['tag']='span',_0x3cd706['text']=_0x2de738['name'];const _0x1e6102={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x4c4f82['to']('isFocusable',_0x2fe610=>!!_0x2fe610&&0x0),'aria-labelledby':_0x3cd706['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x4c4f82['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x4c4f82['to']('hasTooltip',_0x44a809=>!_0x44a809),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x3cd706]};_0x393d2f&&(_0x1e6102['tag']='button',_0x1e6102['on']={'click':_0x4c4f82['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1e6102);}}class ot extends _0x549067{constructor(_0x474506,_0x3501bf){super(_0x474506),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3501bf['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const T={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x4d663b{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2be1cc){super(_0x2be1cc),this['context']['config']['define']('presenceList',T);const _0x33e122=_0x2be1cc['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x33e122)throw new _0x9081b9('presencelist-collapseat-invalid-format',this);if(_0x33e122<0x1)throw new _0x9081b9('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x1c851a(),this['balloonPanelView']=new _0x573854(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x36def7 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x36def7);this['listenTo'](this['_allConnectedUsers'],'add',(_0x227790,_0x4099a7)=>{this['_handleUserAdd'](_0x4099a7);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3e950f,_0x19cf30)=>{this['_handleUserRemove'](_0x19cf30);});}['_createView'](){const _0x3a5999=this['context'],_0x382df8=new U(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x274508=this['balloonPanelView'];if(!_0x1a28a6(_0x3a5999['config']['get']('presenceList.container')))throw new _0x9081b9('presencelist-missing-container',this);return _0x382df8['counterView']['bind']('usersCount')['to'](this),_0x382df8['bind']('isCollapsed')['to'](this,'usersCount',_0x4fa589=>{const {collapseAt:_0x528911}=_0x3a5999['config']['get']('presenceList'),_0x17adf6=_0x4fa589>=_0x528911;if(_0x17adf6&&!_0x382df8['inlineListView']['items']['find'](_0x47813d=>_0x47813d instanceof D)){const _0x316c0b=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x316c0b&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x382df8['inlineListView']['items']['add'](_0x382df8['counterView']);}return _0x17adf6||this['hideDropdown'](),_0x17adf6;}),_0x382df8['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x14eb1c=>{const _0x2efd03=_0x3a5999['config']['get']('presenceList'),_0x69514f=new M(_0x3a5999['locale'],_0x14eb1c,!!_0x2efd03['onClick']);return _0x69514f['bind']('hasTooltip')['to'](_0x382df8,'isCollapsed',_0x37b10b=>!_0x37b10b),_0x69514f['bind']('isFocusable')['to'](_0x382df8,'isCollapsed',_0x1dfea2=>!_0x1dfea2),_0x2efd03['onClick']&&this['listenTo'](_0x69514f,'execute',()=>{this['view']['isCollapsed']||_0x2efd03['onClick'](_0x14eb1c,_0x69514f['element']);}),_0x69514f;}),this['listenTo'](_0x382df8['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x382df8['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x382df8['inlineListView']['keystrokes']['set']('Enter',(_0x2c2188,_0x273612)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x273612());}),_0x382df8['render'](),_0x274508['render'](),_0x2e32ee({'emitter':_0x382df8,'activator':()=>_0x274508['isVisible'],'contextElements':[_0x274508['element'],_0x382df8['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x3a5999['config']['get']('presenceList.container')['appendChild'](_0x382df8['element']),this['_bodyCollection']=new _0x2d6212(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x382df8;}['_handleUserAdd'](_0x20a2ef){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x20a2ef['isMe'])return;const _0x1c88c2=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x1c88c2-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x8b0f56=_0x20a2ef['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x20a2ef,_0x8b0f56);}['_handleUserRemove'](_0x1ef77a){this['usersCount']--;const {collapseAt:_0x57e199}=this['context']['config']['get']('presenceList'),_0x1f7efa=this['usersCount']>=_0x57e199;if(this['currentDisplayedUsers']['get'](_0x1ef77a['id']))this['currentDisplayedUsers']['remove'](_0x1ef77a['id']);else{if(_0x1f7efa&&this['currentDisplayedUsers']['length']+0x1===_0x57e199-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x1f7efa?0x1:0x0)<this['usersCount']){for(const _0x3b83d8 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x3b83d8['id'])&&(this['currentDisplayedUsers']['add'](_0x3b83d8,Math['min'](this['currentDisplayedUsers']['length']-(_0x1f7efa?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x1f7efa?0x1:0x0)===_0x57e199-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x36fbc2=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new V(this['context']['locale'],!!_0x36fbc2['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x597f3e}=this['presenceDropdownView'];_0x597f3e['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1297b4=>{if(!_0x36fbc2['displayMe']&&_0x1297b4['isMe'])return null;const _0x212303=new E(this['context']['locale'],_0x1297b4,!!_0x36fbc2['onClick']);return _0x36fbc2['onClick']&&this['listenTo'](_0x212303,'execute',()=>{_0x36fbc2['onClick'](_0x1297b4,_0x212303['element']);}),_0x212303;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x597f3e['focus'](),_0x597f3e['checkIfScrollable']();const _0x477275=(_0x1f0a54,_0x178ed6)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x178ed6();};_0x597f3e['keystrokes']['set']('Esc',_0x477275),_0x597f3e['keystrokes']['set']('Shift+Tab',_0x477275),_0x597f3e['keystrokes']['set']('Tab',(_0x1681d9,_0x5692ee)=>{!function(_0x320406){const _0x9e41ad=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x4251ba=>_0x4251ba+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x120ea8=[...document['body']['querySelectorAll'](_0x9e41ad)]['filter'](_0x57dc4e=>_0x57dc4e===document['activeElement']||_0x57dc4e['offsetWidth']+_0x57dc4e['offsetHeight']>0x0)['sort']((_0x3f6b38,_0x547141)=>(_0x3f6b38['tabIndex']||0x0)-(_0x547141['tabIndex']||0x0)),_0x26a120=_0x120ea8['indexOf'](_0x320406),_0x4d4396=_0x120ea8[(_0x26a120+0x1)%_0x120ea8['length']];_0x4d4396&&_0x4d4396['focus']();}(this['view']['element']),this['hideDropdown'](),_0x5692ee();}),_0x597f3e['focusTracker']['add'](this['view']['element']),_0x597f3e['focusTracker']['on']('change:isFocused',(_0x3ad652,_0x144967,_0x23d702)=>{_0x23d702||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 _0x4d663b{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 _0x145007,Plugin as _0x341d22,PendingActions as _0x25eec0,Context as et}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x55f0f8,CKEditorError as _0x4aecac,Collection as _0x286cbd,global as _0x22f0d0,version as ht,uid as _0x510af3,KeystrokeHandler as _0x2539c3}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x18f334,View as _0x13e27c,ListView as _0x4d7272,ListItemView as rt,LabelView as at,BalloonPanelView as _0x15d792,clickOutsideHandler as _0x33c89b,BodyCollection as _0x292897}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x407c9a,History as _0x402461,NoOperation as _0x36b680,InsertOperation as _0x30c50e,MarkerOperation as _0x3a582f,RootAttributeOperation as _0x31ee7a,transformOperationSets as _0x4af893,OperationFactory as _0x26136f}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as dt,WEB_SOCKET_GATEWAY_STATES as _0x2634d5,CollaborativeEditingService as _0x3c533e,User as ut,CommentsService as ot,TrackChangesService as tt,RevisionHistoryService as _0x1a57be,EditorService as _0x4cecd1}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x2dac71,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x5d28e4}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x2664e4}from'es-toolkit/compat';class n extends _0x145007{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>dt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x18f334];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2b756a){super(_0x2b756a),this['set']('state',_0x2634d5['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x55f0f8())();}['init'](){const _0x22a2d2=this['context'],_0x4d641a=_0x22a2d2['plugins']['get']('CloudServices'),_0x2fb0c2=_0x22a2d2['plugins']['get'](_0x18f334);if(!_0x4d641a['token'])throw new _0x4aecac('websocketgateway-missing-token',this);if(!_0x4d641a['webSocketUrl'])throw new _0x4aecac('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'](_0x4d641a['token'],_0x4d641a['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x3ba3ec=>{if(this['connection']=_0x3ba3ec,this['bind']('state')['to'](_0x3ba3ec,'state',this,'_isBrowserOffline',(_0x4983ee,_0x3da6b3)=>('connected'!==_0x4983ee&&(this['_shouldPluginsReconnect']=!0x0),_0x3da6b3||_0x4983ee!==_0x2634d5['CONNECTED']?_0x2634d5['DISCONNECTED']:this['state']==_0x2634d5['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x2634d5['CONNECTING']):_0x2634d5['CONNECTED'])),this['connection']['on']('error',(_0x1a7f7a,_0x1044ac)=>{if('limitExceeded'!==_0x1044ac['code'])throw console['error'](_0x1044ac),new _0x4aecac('cloudservices-init',null,{'originalError':_0x1044ac});_0x2fb0c2['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'});}),!_0x3ba3ec['me'])return new Promise(_0x4f8d40=>_0x3ba3ec['on']('change:me',_0x4f8d40));})['catch'](_0x14bdf1=>{throw console['error'](_0x14bdf1),new _0x4aecac('cloudservices-init',null,{'originalError':_0x14bdf1});});}['addToReconnectionStack'](_0x3dfe6f){if('function'!=typeof _0x3dfe6f['reconnect'])throw new _0x4aecac('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x3dfe6f))throw new _0x4aecac('websocketgateway-plugin-already-registered',this,{'name':_0x3dfe6f['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x3dfe6f);}['removeFromReconnectionStack'](_0x1a3afa){this['_reconnectionStack']['delete'](_0x1a3afa);}['isInReconnectionStack'](_0x348f48){return this['_reconnectionStack']['has'](_0x348f48);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0xc87a3c=>_0xc87a3c['reconnect']())))['then'](()=>this['state']=_0x2634d5['CONNECTED'])['catch'](_0x527305=>{throw console['error'](_0x527305),new _0x4aecac('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x2634d5['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x145007{['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,_0x2dac71];}constructor(_0x429782){super(_0x429782),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x286cbd(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x2dac71);}['init'](){const _0x231b4c=this['context']['plugins']['get'](n);this['listenTo'](_0x231b4c,'change:state',(_0x58fe22,_0x5e82e0,_0x43eba3)=>{if('connected'!==_0x43eba3)this['channelSessions']['forEach'](_0x8a610e=>_0x8a610e['clear']()),this['channelConnectedUsers']['forEach'](_0x2f33a4=>_0x2f33a4['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x1c1ec4,_0x4678df]of this['_registeredSessions'])for(const _0xea9f4d of _0x4678df)this['_handleSessionAdd'](_0x1c1ec4,_0xea9f4d);}}),this['_createUser'](_0x231b4c['connection']['me'],!0x0);}['register'](_0x31c669,_0x5f2b16){if(this['_registeredSessions']['has'](_0x31c669))throw new _0x4aecac('sessions-register-already-registered',null,{'channelId':_0x31c669});this['_registeredSessions']['set'](_0x31c669,_0x5f2b16),this['channelSessions']['set'](_0x31c669,new _0x286cbd()),this['channelConnectedUsers']['set'](_0x31c669,new _0x286cbd()),this['listenTo'](_0x5f2b16,'add',(_0x1db754,_0x4d5211)=>this['_handleSessionAdd'](_0x31c669,_0x4d5211)),this['listenTo'](_0x5f2b16,'remove',(_0x55929d,_0x2a3671)=>this['_handleSessionRemove'](_0x31c669,_0x2a3671));for(const _0x43ac01 of _0x5f2b16)this['_handleSessionAdd'](_0x31c669,_0x43ac01);}['unregister'](_0x37dbfd){if(!this['_registeredSessions']['has'](_0x37dbfd))throw new _0x4aecac('sessions-unregister-not-exist',null,{'channelId':_0x37dbfd});const _0x40a8cb=this['_registeredSessions']['get'](_0x37dbfd);this['stopListening'](_0x40a8cb);for(const _0x48926e of _0x40a8cb)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x37dbfd,_0x48926e);this['_registeredSessions']['delete'](_0x37dbfd),this['channelSessions']['delete'](_0x37dbfd),this['channelConnectedUsers']['delete'](_0x37dbfd);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x5002bd){for(const _0x299cc9 of this['channelSessions']['values']())for(const _0x10a634 of _0x299cc9)if(_0x10a634['id']===_0x5002bd)return _0x10a634['user'];}['getUserSessions'](_0x376b72,_0x20058d){const _0x23543c=_0x20058d?[this['channelSessions']['get'](_0x20058d)]:this['channelSessions']['values'](),_0x5a893a=new Set();for(const _0x1a9504 of _0x23543c)for(const _0x33c8ad of _0x1a9504)_0x33c8ad['user']['id']===_0x376b72['id']&&_0x5a893a['add'](_0x33c8ad['id']);return _0x5a893a;}['getUserRole'](_0x1caaee){for(const _0x1e8bb4 of this['channelSessions']['values']())for(const _0x6f5272 of _0x1e8bb4)if(_0x6f5272['user']===_0x1caaee)return _0x6f5272['role'];}['_handleSessionAdd'](_0x30904c,_0x45f47b){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x1fcb16=_0x45f47b['user'],_0x1c8b27=this['_users']['getUser'](_0x1fcb16['id'])||this['_createUser'](_0x1fcb16),_0x4c0e33=Object['assign']({},_0x45f47b,{'user':_0x1c8b27});this['channelSessions']['get'](_0x30904c)['add'](_0x4c0e33);const _0xf69747=this['channelConnectedUsers']['get'](_0x30904c);_0xf69747['has'](_0x1c8b27['id'])||_0xf69747['add'](_0x1c8b27),this['allConnectedUsers']['has'](_0x1c8b27['id'])||this['allConnectedUsers']['add'](_0x1c8b27,_0x1c8b27['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x30904c,{'channelId':_0x30904c,'session':_0x4c0e33});}['_handleSessionRemove'](_0x57ac75,_0x136e69){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x54e6ad=this['channelConnectedUsers']['get'](_0x57ac75),_0x3fd3e9=_0x136e69['user'];_0x3fd3e9['id']&&(this['channelSessions']['get'](_0x57ac75)['remove'](_0x136e69['id']),_0x54e6ad['has'](_0x3fd3e9['id'])&&!this['getUserSessions'](_0x3fd3e9,_0x57ac75)['size']&&_0x54e6ad['remove'](_0x3fd3e9['id']),this['allConnectedUsers']['get'](_0x3fd3e9['id'])&&!this['getUserSessions'](_0x3fd3e9)['size']&&this['allConnectedUsers']['remove'](_0x3fd3e9['id']));}['_createUser'](_0xedc86f,_0x4f2152){const _0x474194=this['_users']['addUser'](_0xedc86f);return _0x4f2152&&this['_users']['defineMe'](_0xedc86f['id']),_0x474194['orderNumber']=this['_uniqueUsersCount']++,_0x474194;}}class C extends _0x341d22{['_domEmitter']=new(_0x55f0f8())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x3ef039=this['editor'],_0x2a6372=_0x3ef039['plugins']['get'](i);_0x3ef039['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x37cad4,{writer:_0x27d536})=>function(_0x3e589a,_0x166c48,_0x4ae69e,_0x1ad155){const _0x471a54=_0x3e589a['markerName']['split'](':')[0x2],_0x4dc608=_0x4ae69e['getUserBySessionId'](_0x471a54);if(!_0x4dc608||_0x471a54===_0x4ae69e['mySessionId'])return;if(!_0x1ad155['model']['schema']['checkChild'](_0x3e589a['markerRange']['start'],'$text'))return;const _0xcc1e9d={'class':'ck-user__marker\x20'+_0x4dc608['color']['getMarkerClass'](),'data-name':_0x4dc608['name'],'data-session-id':_0x471a54},_0x2c5abe=_0x1ad155['model']['markers']['get'](_0x3e589a['markerName']),_0x5dd06c=_0x2c5abe['getStart'](),_0x16d934=_0x5dd06c['nodeAfter'],_0x54516c=_0x1ad155['model']['schema'];if(_0x16d934&&_0x54516c['isObject'](_0x16d934)&&_0x54516c['isInline'](_0x16d934)&&!_0x1ad155['model']['markers']['get']('user:range:'+_0x471a54)['getRange']()['isCollapsed'])return;const _0x58cc0b=_0x5dd06c['parent'];return _0x1ad155['model']['schema']['isLimit'](_0x58cc0b)&&!_0x1ad155['model']['hasContent'](_0x58cc0b)&&(_0xcc1e9d['contenteditable']=!0x1),function(_0x5f0fbd,_0x41c2f2,_0x2bae37){const _0x23ec99=_0x5f0fbd['createUIElement']('span',_0x41c2f2);return _0x5f0fbd['setCustomProperty']('userPositionMarker',!0x0,_0x23ec99),_0x23ec99['render']=function(_0x4e3e04){const _0x34f51b=this['toDomElement'](_0x4e3e04),_0x2ee2d8=document['createElement']('span');return _0x2ee2d8['classList']['add']('ck-user__marker-tooltip'),_0x2ee2d8['setAttribute']('contenteditable','false'),_0x2ee2d8['setAttribute']('spellcheck','false'),_0x2ee2d8['textContent']=_0x2bae37['name'],_0x34f51b['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x2ee2d8['outerHTML']+'',_0x34f51b['addEventListener']('mouseenter',()=>{_0x34f51b['classList']['add']('ck-user__marker_hovered');}),_0x34f51b['addEventListener']('mouseleave',()=>{_0x34f51b['classList']['remove']('ck-user__marker_hovered');}),_0x34f51b;},_0x23ec99['isSimilar']=function(_0x44c6bc){return!(!this['getCustomProperty']('userPositionMarker')||!_0x44c6bc['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x44c6bc['getAttribute']('data-session-id'));},_0x23ec99;}(_0x166c48,_0xcc1e9d,_0x4dc608);}(_0x37cad4,_0x27d536,_0x2a6372,_0x3ef039)}),_0x3ef039['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x17adfd=>function(_0x3bac6f,_0x3f338d){const _0x4ac219=_0x3bac6f['markerName']['split'](':')[0x2];if(_0x4ac219===_0x3f338d['mySessionId'])return null;const _0x2a6ac3=_0x3f338d['getUserBySessionId'](_0x4ac219);if(!_0x2a6ac3)return{'id':_0x4ac219,'classes':[]};return{'id':_0x4ac219,'classes':['ck-user__selection',_0x2a6ac3['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x4ac219},'priority':0x7d0+_0x2a6ac3['orderNumber']};}(_0x17adfd,_0x2a6372)}),function(_0x3c565d){const _0x341504=_0x3c565d['model'],_0x732c48=new Map(),_0xdd2ce3=_0x3c565d['plugins']['get'](i);_0x341504['markers']['on']('update:user:range',(_0x4e4b10,_0x3de56c,_0x4ba213,_0x38ebee)=>{if(!_0x38ebee&&_0x732c48['get'](_0x3de56c['name']))return _0x732c48['get'](_0x3de56c['name'])['detach'](),void _0x732c48['delete'](_0x3de56c['name']);const _0x5bc70f=_0x3de56c['name']['split'](':')[0x2];if(_0x5bc70f===_0xdd2ce3['mySessionId'])return;const _0xbfc7c5='user:position:'+_0x5bc70f;_0x341504['markers']['has'](_0xbfc7c5)&&_0x3c565d['editing']['reconvertMarker'](_0xbfc7c5),_0x3de56c['on']('change:range',(_0x11615c,_0x53d42f,_0x301681)=>{if('$graveyard'!=_0x53d42f['root']['rootName']&&'$graveyard'==_0x3de56c['getRange']()['root']['rootName']&&!_0x732c48['has'](_0x3de56c['name'])){const _0x2f6a04=_0x341504['schema']['getNearestSelectionRange'](_0x301681['deletionPosition']);if(_0x2f6a04){const _0x33c64c=_0x407c9a['fromRange'](_0x2f6a04);_0x732c48['set'](_0x3de56c['name'],_0x33c64c),_0x33c64c['on']('change:range',(_0x58de09,_0x27ed25,_0x27bc22)=>{if('$graveyard'==_0x33c64c['root']['rootName']){const _0x1af25c=_0x341504['schema']['getNearestSelectionRange'](_0x27bc22['deletionPosition']);_0x1af25c?(_0x33c64c['start']=_0x1af25c['start'],_0x33c64c['end']=_0x1af25c['end']):(_0x732c48['delete'](_0x3de56c['name']),_0x33c64c['detach']());}});}}});}),_0x341504['document']['on']('change',()=>{_0x732c48['size']>0x0&&_0x341504['enqueueChange']({'isUndoable':!0x1},_0x2f896c=>{for(const [_0x3c2b36,_0x2fe3b8]of _0x732c48)'$graveyard'==_0x341504['markers']['get'](_0x3c2b36)['getRange']()['root']['rootName']&&(J(_0x3c2b36['split'](':')[0x2],_0x2fe3b8['toRange'](),_0x341504,_0x2f896c),_0x2fe3b8['detach']());_0x732c48['clear']();});});}(_0x3ef039),this['_domEmitter']['listenTo'](_0x22f0d0['document'],'keydown',(_0xf648bb,{key:_0x5af562})=>{'Escape'===_0x5af562&&function(_0x24bf64){_0x24bf64['editing']['view']['change'](_0x472439=>{for(const _0x166bfd of _0x24bf64['model']['markers']){if(!_0x166bfd['name']['startsWith']('user:position'))continue;const _0x17957e=_0x24bf64['editing']['mapper']['markerNameToElements'](_0x166bfd['name']);if(_0x17957e){for(const _0x21bd9c of _0x17957e)_0x472439['removeClass']('ck-user__marker_hovered',_0x21bd9c);}}});}(_0x3ef039);},{'useCapture':!0x0});}['afterInit'](){const _0x1c1df7=this['editor'],_0x2bf22f=_0x1c1df7['commands']['get']('undo');_0x2bf22f&&_0x1c1df7['model']['on']('applyOperation',(_0x43e3ca,_0x49c24d)=>{const _0x56bac3=_0x49c24d[0x0];if(!_0x56bac3['isDocumentOperation'])return;if('marker'!=_0x56bac3['type']||!_0x56bac3['name']['startsWith']('user:'))return;const _0x2d3b46=_0x56bac3['batch'];_0x2bf22f['_createdBatches']['has'](_0x2d3b46)&&(_0x56bac3['newRange']=_0x56bac3['oldRange']?_0x1c1df7['model']['createRange'](_0x56bac3['oldRange']['start'],_0x56bac3['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x169427=this['editor'],_0x2205bd=_0x169427['model']['document'],_0x4dd512=_0x169427['plugins']['get'](i);_0x169427['model']['enqueueChange']({'isUndoable':!0x1},_0x3f88b3=>{const _0x56cf9e='user:range:'+_0x4dd512['mySessionId'],_0x5a598d='user:position:'+_0x4dd512['mySessionId'],_0x722672=_0x169427['model']['markers']['has'](_0x56cf9e);_0x169427['editing']['view']['hasDomSelection']?J(_0x4dd512['mySessionId'],_0x2205bd['selection']['getFirstRange'](),_0x169427['model'],_0x3f88b3):_0x722672&&(_0x3f88b3['removeMarker'](_0x56cf9e),_0x3f88b3['removeMarker'](_0x5a598d));});}}function J(_0x3eeb51,_0x429acd,_0xceee6c,_0x1ea7e2){const _0x59aced='user:range:'+_0x3eeb51,_0x564f99='user:position:'+_0x3eeb51,_0x1d4d41=_0x429acd['getContainedElement']();let _0x25f348=_0x429acd['start'];if(_0x1d4d41&&_0x1d4d41['is']('element','tableCell')){const _0x3ee767=function(_0x486e9a,_0x49ce6d){for(const _0x1c90f0 of _0x486e9a['getPositions']())if(_0x49ce6d['schema']['checkChild'](_0x1c90f0,'$text'))return _0x1c90f0;}(_0x429acd,_0xceee6c);_0x3ee767&&(_0x25f348=_0x3ee767,_0x429acd=_0x1ea7e2['createRange'](_0x25f348));}const _0x51126e=_0x1ea7e2['createRange'](_0x25f348);_0xceee6c['markers']['has'](_0x59aced)?(_0x1ea7e2['updateMarker'](_0x59aced,{'range':_0x429acd}),_0x1ea7e2['updateMarker'](_0x564f99,{'range':_0x51126e})):(_0x1ea7e2['addMarker'](_0x59aced,{'range':_0x429acd,'usingOperation':!0x0}),_0x1ea7e2['addMarker'](_0x564f99,{'range':_0x51126e,'usingOperation':!0x0}));}function E(_0x26a86c,_0x5751da,_0x5c37dd){const _0x45e812=_0x26a86c['t'],t=_0x26a86c['t'];switch(_0x5751da){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 _0x45e812({'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'},_0x5c37dd);default:return'';}}let H=0x1;class l extends _0x341d22{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x3c533e)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,C,_0x25eec0,_0x2dac71,_0x18f334];}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 _0x121add=this['serverHistory']['getOperations']();for(let _0x3f307e=_0x121add['length']-0x1;_0x3f307e>=0x0;_0x3f307e--){const _0x5b7a7b=_0x121add[_0x3f307e];if(!this['_disconnectionOperations']['has'](_0x5b7a7b))return _0x5b7a7b['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x50d2ea){if(super(_0x50d2ea),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x402461(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x4aecac('collaboration-missing-channelid',this);const _0x4663af=_0x50d2ea['config']['get']('cloudServices.bundleVersion')||ht;this['_service']=new l['CollaborativeEditingService'](_0x4663af,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x5d28e4(),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 _0x59150e=this['editor'],_0x57fb01=_0x59150e['plugins']['get'](_0x2dac71),_0x431a2b=_0x59150e['plugins']['get'](n);this['listenTo'](_0x57fb01,'getOperationAuthor',(_0x33e900,_0x492748)=>{const _0x4384bf=_0x492748[0x0];_0x4384bf['_authorId']&&(_0x33e900['return']=_0x57fb01['getUser'](_0x4384bf['_authorId']),_0x33e900['stop']()),null===_0x4384bf['_authorId']&&(_0x33e900['return']=null,_0x33e900['stop']());},{'priority':'high'}),this['listenTo'](_0x59150e['model']['document']['selection'],'change:range',(_0x3b1343,_0x40b073)=>{_0x40b073['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x59150e['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x59150e['model']['on']('applyOperation',(_0xa4804,_0x23cef)=>{const _0xd1d8cb=_0x23cef[0x0];_0xd1d8cb['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0xd1d8cb),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x431a2b,'state',this,'_hasSynchronizationProblem',(_0x22eaad,_0x3a0760)=>'connected'===_0x22eaad&&!_0x3a0760),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x59150e['disableReadOnlyMode']('rtc-offline'):_0x59150e['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x59150e['disableReadOnlyMode']('rtc-offline'):_0x59150e['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x4f332b=this['editor']['plugins']['get'](i),_0x1c5507=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x4f332b['unregister'](this['_channelId']);const _0x4a651a=await this['_service']['reconnect'](_0x1c5507['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x4a651a)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x589116=await this['_service']['getConnectedSessions']();_0x4f332b['register'](this['_channelId'],_0x589116),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x7a9bca){if(function(_0x1660e2){return'404'===_0x1660e2['code'];}(_0x7a9bca)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x5358a4){return'409'===_0x5358a4['code'];}(_0x7a9bca)){const _0x226604=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'](_0x226604);}else{if(!(_0x7a9bca instanceof V))throw _0x7a9bca;this['_handleReconnectionError']();}}}}['destroy'](){const _0x4b73a1=this['editor']['plugins']['get'](n),_0x20dc79=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x20dc79['channelSessions']['has'](this['_channelId'])&&_0x20dc79['unregister'](this['_channelId']),_0x4b73a1['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x2973fd){if(this['sessionId']!==_0x2973fd['sessionId']&&this['_lastSyncedOperationId']!==_0x2973fd['lastOperationId'])throw new V();return this['sessionId']=_0x2973fd['sessionId'],this['_handleServerResponse']([],{..._0x2973fd,'wereChangesApplied':!0x1,'data':_0x2973fd['data']},'reconnect');}async['_connectService'](_0x4b8016,_0x38bb92=!0x1){const {connection:_0x33dff5}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x33dff5,this['_channelId'])['then'](_0x4bb5b6=>this['_initSessionsHandling'](_0x4bb5b6))['catch'](_0x1dda3c=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1dda3c);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4b662c,_0x4281d2)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x4281d2);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x4c982b=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4b8016);this['_isPendingUpdate']=!0x0;const _0x9be618=await this['_service']['connect'](_0x33dff5,this['_compressOperations'](_0x4b8016),_0x4c982b);if(this['sessionId']=_0x9be618['sessionId'],_0x38bb92){if(!_0x9be618['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x9be618['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x4b8016,_0x9be618,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x9be618,_0x4b8016);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x223dbe=this['editor']['plugins']['get'](i),_0x5298a4=this['editor']['plugins']['get'](C),_0x273a09=_0x223dbe['channelSessions']['get'](this['_channelId']);_0x273a09&&_0x273a09['length']>0x1?_0x5298a4['createUserMarkerOperations']():this['listenTo'](_0x223dbe,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x223dbe['channelSessions']['get'](this['_channelId'])['length']&&_0x5298a4['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0xb2a8db,_0x520fa0,_0x50fb2b,_0x2d306a){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x520fa0){const _0x312218=this['_decompressOperations'](_0x50fb2b,_0x2d306a);await this['_fetchMissingUsers'](_0x312218),this['_handleExternalOperations'](_0x312218,_0x520fa0,_0x50fb2b['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x28f62a}=this['editor'];let _0x4ab371;try{_0x4ab371=await this['_service']['getDocumentDetails']();}catch{const _0x1dd516=E(_0x28f62a,'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'](_0x1dd516);}const _0x5837d5=_0x4ab371['currentDocumentSession']||_0x4ab371['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x5837d5['lastOperationId']){const _0x18046c=E(_0x28f62a,'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'](_0x18046c);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x1670c2){const _0x183df8=this['editor']['plugins']['get'](i);this['listenTo'](_0x183df8,'sessionAdd:'+this['_channelId'],(_0x2abb1a,{session:_0x1f331a})=>{if(_0x1f331a['id']===_0x183df8['mySessionId']){_0x2abb1a['off']();const _0x1dd825=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x14785c=_0x1f331a['permissions'];_0x1dd825&&_0x1dd825['isEnabled']&&(_0x14785c=_0x14785c['filter'](_0x147339=>'document:write'!==_0x147339)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x14785c,this['_channelId']);}}),_0x183df8['register'](this['_channelId'],_0x1670c2);}['_initThrowingOnDataSet'](){const _0x22e404=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x15be9d)=>{if(!_0x15be9d[_0x15be9d['length']-0x1]['suppressErrorInCollaboration'])throw new _0x4aecac('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x22e404['apply'](this['editor']['data'],_0x15be9d);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x128e66,[_0x62dbd2])=>{if(this['_document']['version'])throw new _0x4aecac('realtimecollaborationclient-init-document-already-initialized',this);_0x128e66['stop'](),this['_setPendingAction']();const _0x5ed04d=this['editor']['config']['get']('rootsAttributes'),_0x1bff1f=this['_getOperationsFromInitData'](_0x62dbd2,_0x5ed04d);0x0==_0x1bff1f['length']&&_0x1bff1f['push'](new _0x36b680(0x0)),_0x128e66['return']=this['_connectService'](_0x1bff1f)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x3781ed=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x3781ed))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x25bb00,[_0x31eead,_0x33c26f])=>{_0x25bb00['stop']();const _0x44133b=this['editor']['model']['document']['getRoot'](_0x31eead);if(!this['_knownRootNames']['has'](_0x31eead)){const _0xc7c73f=_0x33c26f&&_0x33c26f['data']?_0x33c26f['data']:'',_0x20afb6=_0x33c26f&&_0x33c26f['attributes']?_0x33c26f['attributes']:{};await this['_loadRoot'](_0x31eead,_0xc7c73f,_0x20afb6);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x44133b['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x44133b);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x39c89f){const _0x483701=this['editor']['plugins']['get'](_0x2dac71),{connection:_0x1510dc}=this['editor']['plugins']['get'](n),_0x57b8f2=new Set();for(const _0x3061f9 of _0x39c89f){const _0x3a1ca6=_0x3061f9['_authorId'];_0x3a1ca6&&!_0x483701['getUser'](_0x3a1ca6)&&_0x57b8f2['add'](_0x3a1ca6);}if(0x0===_0x57b8f2['size'])return;const _0x5acbfa=await ut['getMany'](_0x1510dc,Array['from'](_0x57b8f2));for(const _0x2ee53f of _0x5acbfa)_0x483701['getUser'](_0x2ee53f['id'])||_0x483701['addUser'](_0x2ee53f);}['_getOperationsFromInitData'](_0x4ba792,_0x14d622={}){const _0x73091e=this['editor']['model'],_0x5d635b=[];let _0x49e6a7=0x0;const _0x102121='string'==typeof _0x4ba792?{'main':_0x4ba792}:_0x4ba792;for(const _0x59d8db of Object['keys'](_0x102121)){if(!this['_document']['roots']['has'](_0x59d8db))throw new _0x4aecac('realtimecollaborationclient-init-non-existent-root',this);const _0x323462=this['editor']['data']['parse'](_0x102121[_0x59d8db]),_0x343625=this['_document']['getRoot'](_0x59d8db),_0x12b060=new _0x30c50e(_0x73091e['createPositionAt'](_0x343625,0x0),_0x323462,_0x49e6a7++);_0x5d635b['push'](_0x12b060);for(const [_0x49c181,_0xc99c1c]of _0x323462['markers']){const _0x2cdd1c=_0x73091e['createRange'](_0x73091e['createPositionFromPath'](_0x343625,_0xc99c1c['start']['path']['slice']()),_0x73091e['createPositionFromPath'](_0x343625,_0xc99c1c['end']['path']['slice']())),_0x29f766=new _0x3a582f(_0x49c181,null,_0x2cdd1c,_0x73091e['markers'],!0x0,_0x49e6a7++);_0x5d635b['push'](_0x29f766);}}if(_0x14d622)for(const [_0x126c61,_0x1a1bc9]of Object['entries'](_0x14d622)){const _0x4bbb54=_0x73091e['document']['getRoot'](_0x126c61);if(!_0x4bbb54)throw new _0x4aecac('multi-root-editor-root-attributes-no-root',null);for(const [_0x13d83d,_0x5d0ed5]of Object['entries'](_0x1a1bc9))if(null!==_0x5d0ed5){const _0x170576=new _0x31ee7a(_0x4bbb54,_0x13d83d,null,_0x5d0ed5,_0x49e6a7++);_0x5d635b['push'](_0x170576);}}return _0x5d635b;}async['_loadRoot'](_0x2636f3,_0xf2cc68,_0x414fc2){this['_getOperationsFromInitData']({[_0x2636f3]:_0xf2cc68},{[_0x2636f3]:_0x414fc2})['forEach']((_0x965450,_0xdfada4)=>{_0x965450['baseVersion']=this['_document']['version']+_0xdfada4,_0x965450['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x965450);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x42128f,_0x1244dd){let _0x89deea;this['_offset']=_0x42128f['offset'];const _0x4cd741=_0x42128f['wereChangesApplied']&&!_0x42128f['initData'],_0x13c1cb=_0x4cd741?0x0:_0x42128f['data']['baseVersion'];if(_0x1244dd['forEach'](_0x4d9037=>{_0x4d9037['_isInit']=!0x0,_0x4d9037['createdAt']=_0x42128f['sessionCreatedAt'],_0x4d9037['_authorId']=null;}),_0x4cd741)_0x89deea=_0x1244dd,this['_applyOperationsSet'](_0x89deea,_0x4cd741);else{if(_0x42128f['initData']){const _0x23d74a=this['_getOperationsFromInitData'](_0x42128f['initData']);this['_document']['history']['version']=-_0x23d74a['length'],_0x23d74a['forEach'](_0x46c574=>{_0x46c574['baseVersion']-=_0x23d74a['length'],_0x46c574['createdAt']=_0x42128f['sessionCreatedAt'],_0x46c574['_isInit']=!0x0,_0x46c574['_authorId']=null;}),this['_applyOperationsSet'](_0x23d74a,!0x0),this['serverHistory']['version']=-_0x23d74a['length']+this['_offset'],this['_updateServerHistory'](_0x23d74a);}this['_document']['history']['version']=_0x13c1cb,_0x89deea=this['_decompressOperations'](_0x42128f['data'],_0x42128f['metadata']),await this['_fetchMissingUsers'](_0x89deea),this['_applyOperationsSet'](_0x89deea,_0x4cd741);}_0x42128f['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x89deea,_0x42128f['lastOperationId']),this['_lastSyncedOperationId']=_0x42128f['lastOperationId']),this['serverHistory']['version']=_0x13c1cb+this['_offset'],this['_updateServerHistory'](_0x89deea),_0x1244dd['filter'](_0x52198a=>{const _0x174637=this['_getAffectedRoot'](_0x52198a);return _0x174637&&!this['_knownRootNames']['has'](_0x174637);})['forEach']((_0x172db5,_0x337b41)=>{_0x172db5['baseVersion']=this['_document']['version']+_0x337b41,this['_saveOperationInBuffer'](_0x172db5);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x1cc701,_0x4f125b){const _0x210d63=_0x4f125b&&_0x4f125b['message'];if(_0x210d63&&_0x210d63['startsWith']('realtimecollaborationclient'))throw _0x4f125b;const _0x45371e=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x45371e['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x4aecac(_0x1cc701,this['editor'],_0x210d63?{'originalError':_0x210d63}:void 0x0);}['_saveOperationInBuffer'](_0x57dffa){this['_knownOperations']['has'](_0x57dffa)||(this['_knownOperations']['add'](_0x57dffa),this['_bufferedOperations']['push'](_0x57dffa),this['_pendingAction']||'marker'==_0x57dffa['type']&&!_0x57dffa['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0xa3c3b8=!0x1){!_0xa3c3b8&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x4cc27c=>{_0x4cc27c&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0xde99f0=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0xe31572){return _0xe31572['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xe31572['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0xe31572['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0xde99f0)||this['_crash'](_0xde99f0['message'],_0xde99f0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x45ecb2=>{this['on']('change:_isPendingUpdate',()=>{_0x45ecb2();});});}async['_sendBufferedOperations'](){const _0x36ed76=this['editor']['plugins']['get'](C);if(this['_shouldSendSelectionUpdate']()&&(_0x36ed76['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x985ee4=[...this['_bufferedOperations']];for(const _0x581b04 of _0x985ee4)_0x581b04['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x581b04);const _0x21439a=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x985ee4),_0x20c3f5=H++,_0x5cbb5d=this['_compressOperations'](_0x985ee4),_0x202d98=await this['_service']['sendOperations'](_0x5cbb5d,_0x5cbb5d['baseVersion'],_0x21439a);try{return await this['_handleServerResponse'](_0x985ee4,_0x202d98,_0x20c3f5);}catch(_0xfcbb1d){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0xfcbb1d);}}async['_handleServerResponse'](_0x581644,_0x634395,_0x11fa3){if('error'in _0x634395)throw _0x634395['error'];let _0x1c5328=!0x1;if(_0x634395['wereChangesApplied']){_0x634395['lastOperationId']&&(this['_lastSyncedOperationId']=_0x634395['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5e761b=>!_0x581644['includes'](_0x5e761b));for(const _0x5a4549 of _0x581644)_0x5a4549['createdAt']='lastOperationAcceptedAt'in _0x634395&&_0x634395['lastOperationAcceptedAt']||void 0x0;W(_0x581644,_0x634395['version']-_0x581644['length']),this['_updateServerHistory'](_0x581644);const _0x204a08=_0x581644['filter'](_0x10df19=>{if(!_0x10df19['_isInit'])return!0x1;const _0x1a7997=this['_getAffectedRoot'](_0x10df19);return _0x1a7997&&!this['_knownRootNames']['has'](_0x1a7997);});W(_0x204a08,this['_document']['version']),this['_applyOperationsSet'](_0x204a08),_0x1c5328=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x487db5=this['_decompressOperations'](_0x634395['data'],_0x634395['metadata'])['filter'](_0x2e2ec7=>_0x2e2ec7['baseVersion']>=this['_lastServerVersion']);_0x487db5['forEach'](_0x132cde=>this['_addKnownRoot'](_0x132cde)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x72dd40=>!_0x72dd40['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x72dd40))),this['_bufferedOperations']['length']&&W(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x487db5),_0x1c5328=this['_handleExternalOperations'](_0x487db5,_0x634395['version'],_0x634395['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1c5328?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x3b2623,_0x1597a6,_0x478d73){try{const _0x20c6ed={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x578701,operationsB:_0x1752c8,originalOperations:_0x4e4a29}=_0x4af893(_0x3b2623,this['_bufferedOperations'],_0x20c6ed);W(_0x578701,this['_document']['version']),W(_0x1752c8,_0x1597a6);for(const _0x27c348 of _0x578701){const _0x53ee3b=_0x4e4a29['get'](_0x27c348);_0x27c348['_authorId']=_0x53ee3b?_0x53ee3b['_authorId']:null;}_0x478d73&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3b2623,_0x478d73),this['_lastSyncedOperationId']=_0x478d73),this['_bufferedOperations']=[..._0x1752c8],this['_applyOperationsSet'](_0x578701),this['_updateServerHistory'](_0x3b2623);}catch(_0x602edf){return console['error'](_0x602edf),!0x1;}return!0x0;}['_applyOperationsSet'](_0x35ee72,_0x472368=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x323ce2=>{for(const _0x4dbf9a of _0x35ee72)this['_knownOperations']['add'](_0x4dbf9a),this['_addKnownRoot'](_0x4dbf9a),_0x323ce2['batch']['addOperation'](_0x4dbf9a),this['editor']['model']['applyOperation'](_0x4dbf9a);});}['_addKnownRoot'](_0x562887){const _0x294979=this['_getAffectedRoot'](_0x562887);_0x294979&&this['_knownRootNames']['add'](_0x294979);}['_getAffectedRoot'](_0x3fa9ff){let _0x2adb88,_0x1ca4e3;switch(_0x3fa9ff['type']){case'insert':_0x2adb88=_0x3fa9ff['position']['root'];break;case'marker':if(_0x1ca4e3=_0x3fa9ff['newRange'],!_0x1ca4e3)return null;_0x2adb88=_0x1ca4e3['root'];break;case'addRootAttribute':_0x2adb88=_0x3fa9ff['root'];break;case'addRoot':_0x2adb88=_0x3fa9ff['affectedSelectable'];break;case'move':_0x2adb88=_0x3fa9ff['targetPosition']['root'];break;default:return null;}return _0x2adb88['rootName'];}['_updateServerHistory'](_0x11c7a9){_0x11c7a9['forEach'](_0x541e87=>{const _0x50818e=_0x541e87['clone']();_0x50818e['_authorId']=_0x541e87['_authorId'],_0x50818e['_isInit']=!!_0x541e87['_isInit'],_0x50818e['createdAt']=_0x541e87['createdAt'],_0x50818e['baseVersion']+=this['_offset'],_0x541e87['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x50818e),this['serverHistory']['addOperation'](_0x50818e);});}['_handleReconnectionError'](_0xc9696a){const _0x175d93=this['editor']['plugins']['get']('Notification'),_0x2683cc=this['editor']['locale'];_0xc9696a||(_0xc9696a=E(_0x2683cc,'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.')),_0x175d93['showWarning'](_0xc9696a,{'title':E(_0x2683cc,'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'](_0x25eec0)['add'](E(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x25eec0)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x38b079){const _0xaa170f=_0x38b079['map'](_0xf05020=>_0xf05020['toJSON']());return this['_compressor']['compress'](_0xaa170f);}['_decompressOperations'](_0x560e47,_0x23f0ff){return this['_compressor']['decompress'](_0x560e47)['map']((_0x248dd2,_0x87768e)=>{const _0x19703e='init'==_0x23f0ff[_0x87768e]['type'];if('InsertOperation'==_0x248dd2['__className']){const _0xef1644=_0x248dd2['position']['root'];!this['_document']['getRoot'](_0xef1644)&&(this['_document']['createRoot']('$root',_0xef1644)['_isAttached']=!0x1);}const _0x51e700=_0x26136f['fromJSON'](_0x248dd2,this['_document']);return _0x51e700['wasUndone']=_0x248dd2['wasUndone'],_0x51e700['_isInit']=_0x19703e,_0x51e700['_authorId']=_0x19703e?null:_0x23f0ff[_0x87768e]['userId'],_0x51e700['_isDisconnection']='cs:removeUser'===_0x23f0ff[_0x87768e]['type'],_0x51e700['createdAt']=_0x23f0ff[_0x87768e]['createdAt'],_0x51e700;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x12b73a=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x12b73a&&_0x12b73a['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class V extends Error{}function W(_0x36ee3c,_0x43f8ee){for(const _0x403519 of _0x36ee3c)_0x403519['baseVersion']=_0x43f8ee++;}class F{['_ignoredOperations'];['_operationToId'];constructor(_0x74096){this['_ignoredOperations']=_0x74096,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x3c71dd){let _0x2bb128=_0x3c71dd['length'];for(;_0x2bb128--;){const _0xa34784=_0x3c71dd[_0x2bb128];if(!this['_ignoredOperations']['has'](_0xa34784)){if(!this['_operationToId']['has'](_0xa34784)){const _0x457ea0=_0x510af3()['slice'](0x1,0x12);this['_operationToId']['set'](_0xa34784,_0x457ea0);}return this['_operationToId']['get'](_0xa34784);}}}['setIdForTheLastOperation'](_0x1d059c,_0x39b2a5){if(!_0x39b2a5)return;let _0x49abf4=_0x1d059c['length'];for(;_0x49abf4--;){const _0x1f8b5a=_0x1d059c[_0x49abf4];this['_ignoredOperations']['has'](_0x1f8b5a)||this['_operationToId']['set'](_0x1f8b5a,_0x39b2a5);}}}class a extends _0x341d22{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x145007{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>ot)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x2dac71];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x277866){super(_0x277866),this['_services']=new Map();}async['init'](){const _0x46a78f=this['context'],_0x2bc8b4=_0x46a78f['plugins']['get']('CommentsRepository');if(_0x46a78f['plugins']['get'](n)['addToReconnectionStack'](this),_0x2bc8b4['adapter']={'addCommentThread':async({channelId:_0x19f2ff,threadId:_0x26e47b,comments:_0x3989d8,resolvedAt:_0x44ef0a,resolvedBy:_0x191c46,context:_0x4b173d,attributes:_0x40a913})=>{const _0x24de0a=await this['_getService'](_0x19f2ff)['addCommentThread']({'commentThreadId':_0x26e47b,'comments':_0x3989d8['map'](_0x22efc1=>function(_0x4f4966,_0xfe3d00,_0x558aaf){return{'commentThreadId':_0x558aaf,'commentId':_0x4f4966['commentId'],'userId':_0x4f4966['authorId'],'content':_0x4f4966['content'],'documentId':_0xfe3d00,'createdAt':_0x4f4966['createdAt'],'attributes':_0x4f4966['attributes']||{}};}(_0x22efc1,_0x19f2ff,_0x26e47b)),'resolvedAt':_0x44ef0a,'resolvedBy':_0x191c46,'context':_0x4b173d,'attributes':_0x40a913})['catch'](ft);return{'threadId':_0x24de0a['commentThreadId'],'comments':_0x24de0a['comments']};},'getCommentThread':async({channelId:_0x2a206b,threadId:_0xb1acf7})=>{const _0x14820f=await this['_getService'](_0x2a206b)['getCommentThread'](_0xb1acf7)['catch'](ft);return _0x14820f['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x14820f]),{'threadId':_0x14820f['commentThreadId'],'comments':_0x14820f['comments']['map'](st),'context':_0x14820f['context'],'resolvedAt':_0x14820f['resolvedAt'],'resolvedBy':_0x14820f['resolvedBy'],'attributes':_0x14820f['attributes']||{}});},'updateCommentThread':async({channelId:_0x33822b,threadId:_0x474418,context:_0x23d9f9,unlinkedAt:_0x58ecba,attributes:_0x229da1})=>this['_getService'](_0x33822b)['updateCommentThread']({'commentThreadId':_0x474418,'context':_0x23d9f9,'attributes':_0x229da1,'unlinkedAt':_0x58ecba})['catch'](nt)['catch'](ft),'resolveCommentThread':async({channelId:_0x3fbb13,threadId:_0x2cac4c})=>{const _0x4141ef=await this['_getService'](_0x3fbb13)['resolveCommentThread'](_0x2cac4c)['catch'](nt)['catch'](ft);return{'threadId':_0x4141ef['commentThreadId'],'resolvedAt':_0x4141ef['resolvedAt'],'resolvedBy':_0x4141ef['resolvedBy']};},'reopenCommentThread':async({channelId:_0x2391d1,threadId:_0x1846d1})=>this['_getService'](_0x2391d1)['reopenCommentThread'](_0x1846d1)['catch'](nt)['catch'](ft),'removeCommentThread':({channelId:_0x3f6c4c,threadId:_0x4ea6b2})=>this['_getService'](_0x3f6c4c)['removeCommentThread'](_0x4ea6b2)['catch'](nt)['catch'](ft),'addComment':({channelId:_0x247f59,threadId:_0xa00029,commentId:_0x33eac0,content:_0x22eb11,attributes:_0x33052e})=>this['_getService'](_0x247f59)['addComment'](_0xa00029,_0x33eac0,_0x22eb11,_0x33052e)['catch'](ft),'updateComment':({channelId:_0x397ee8,threadId:_0x5685c0,commentId:_0x594afb,content:_0x2cb5ed,attributes:_0x419f3a})=>this['_getService'](_0x397ee8)['updateComment'](_0x5685c0,_0x594afb,_0x2cb5ed,_0x419f3a)['catch'](nt)['catch'](ft),'removeComment':({channelId:_0x124d0a,threadId:_0x2649ce,commentId:_0x408571})=>this['_getService'](_0x124d0a)['removeComment'](_0x2649ce,_0x408571)['catch'](nt)['catch'](ft)},_0x46a78f instanceof et){const _0x10ead4=_0x46a78f['config']['get']('collaboration.channelId'),_0x20a3af=_0x46a78f['plugins']['get'](i);await this['_setUpService'](_0x10ead4);const _0x47ea01=await this['_services']['get'](_0x10ead4)['getConnectedSessions']();this['listenTo'](_0x20a3af,'sessionAdd:'+_0x10ead4,(_0x2e625f,{session:_0x106935})=>{_0x106935['id']===_0x20a3af['mySessionId']&&(_0x2e625f['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x106935['permissions'],_0x10ead4));}),_0x20a3af['register'](_0x10ead4,_0x47ea01);}}async['_setUpService'](_0x511431){if(this['_services']['has'](_0x511431))throw new _0x4aecac('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x511431});const _0x3da07d=this['context']['plugins']['get']('CommentsRepository'),_0x489535=new s['CommentsService'](_0x511431);this['_services']['set'](_0x511431,_0x489535),this['listenTo'](_0x489535,'commentThreadAdded',(_0x2de49c,_0x3cbff5)=>{const {commentThreadId:_0x425c28,documentId:_0xfd1a54,context:_0x199eb4,attributes:_0x3b57ae,resolvedAt:_0x32e3c4,resolvedBy:_0x1365cc,comments:_0x1fecb0}=_0x3cbff5;_0x3da07d['getCommentThread'](_0x425c28)||_0x3da07d['addCommentThread']({'threadId':_0x425c28,'channelId':_0xfd1a54,'comments':_0x1fecb0?_0x1fecb0['map'](st):[],'context':_0x199eb4,'attributes':_0x3b57ae,'resolvedAt':_0x32e3c4,'resolvedBy':_0x1365cc,'isFromAdapter':!0x0});}),this['listenTo'](_0x489535,'commentThreadUpdated',(_0x23d2d8,{commentThreadId:_0x4187f3,documentId:_0x43036d,context:_0x271b12,unlinkedAt:_0x2c151d,attributes:_0x255c27})=>{_0x3da07d['getCommentThread'](_0x4187f3)&&_0x3da07d['updateCommentThread']({'threadId':_0x4187f3,'channelId':_0x43036d,'context':_0x271b12,'unlinkedAt':_0x2c151d,'attributes':_0x255c27,'isFromAdapter':!0x0});}),this['listenTo'](_0x489535,'commentThreadResolved',(_0x493430,{commentThreadId:_0x4b60fd,resolvedBy:_0x5128c2,resolvedAt:_0x2b8592})=>{const _0x4b2139=_0x3da07d['getCommentThread'](_0x4b60fd);_0x4b2139&&_0x4b2139['resolve']({'resolvedBy':_0x5128c2,'resolvedAt':_0x2b8592,'isFromAdapter':!0x0});}),this['listenTo'](_0x489535,'commentThreadReopened',(_0x1c9b46,{commentThreadId:_0x86fd9c})=>{const _0x510db8=_0x3da07d['getCommentThread'](_0x86fd9c);_0x510db8&&_0x510db8['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x489535,'commentThreadRemoved',(_0x39438c,{commentThreadId:_0x679c36})=>{const _0x29aa7c=_0x3da07d['getCommentThread'](_0x679c36);_0x29aa7c&&_0x29aa7c['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x489535,'commentAdded',(_0x17c459,_0x41e8ac)=>{const _0x5ee6c8=_0x41e8ac['commentThreadId'],_0xb249b5=_0x3da07d['getCommentThread'](_0x5ee6c8);_0xb249b5&&_0xb249b5['addComment']({...st(_0x41e8ac),'isFromAdapter':!0x0});}),this['listenTo'](_0x489535,'commentUpdated',(_0x44c600,{commentThreadId:_0x1354c5,commentId:_0x3f4645,content:_0x53afd0,attributes:_0x3d44ff})=>{const _0x535eec=_0x3da07d['getCommentThread'](_0x1354c5);if(_0x535eec){const _0x59082e=_0x535eec['getComment'](_0x3f4645);_0x59082e&&_0x59082e['update']({'content':_0x53afd0,'attributes':_0x3d44ff,'isFromAdapter':!0x0});}}),this['listenTo'](_0x489535,'commentRemoved',(_0x5f4b48,{commentThreadId:_0x5ebf88,commentId:_0x39d5bf})=>{const _0x3d0a08=_0x3da07d['getCommentThread'](_0x5ebf88);if(_0x3d0a08){const _0x5179c1=_0x3d0a08['getComment'](_0x39d5bf);_0x5179c1&&_0x5179c1['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x511431);}['destroy'](){if(this['context']instanceof et){const _0x394dc7=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x394dc7);}}['_terminateService'](_0x140eeb){if(!this['_services']['has'](_0x140eeb))throw new _0x4aecac('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x140eeb});this['_getService'](_0x140eeb)['disconnect'](),this['_services']['delete'](_0x140eeb);}async['reconnect'](){for(const _0x1c45ef of this['_services']['keys']())await this['_connectService'](_0x1c45ef);if(this['context']instanceof et){const _0x45d29c=this['context']['config']['get']('collaboration.channelId'),_0x440273=this['context']['plugins']['get'](i);_0x440273['unregister'](_0x45d29c);const _0x124c7e=await this['_services']['get'](_0x45d29c)['getConnectedSessions']();_0x440273['register'](_0x45d29c,_0x124c7e);}}async['_connectService'](_0x4802f8){const {connection:_0x4a3f58}=this['context']['plugins']['get'](n),_0x1a6ef4=this['context']['plugins']['get']('CommentsRepository'),_0x43201e=this['_services']['get'](_0x4802f8),_0x2cbb68=await _0x43201e['connect'](_0x4a3f58);await this['_fetchMissingUsersForThreads'](_0x2cbb68);const _0x1ec7ff=new Set(Array['from'](_0x1a6ef4['getCommentThreads']({'channelId':_0x4802f8}),_0x36071f=>_0x36071f['id']));for(const _0xc2373a of _0x2cbb68)_0xc2373a['deletedAt']||_0x1ec7ff['delete'](_0xc2373a['commentThreadId']);for(const _0x51b6c1 of _0x1ec7ff)_0x1a6ef4['getCommentThread'](_0x51b6c1)['remove']({'isFromAdapter':!0x0});for(const _0x3cd1f4 of _0x2cbb68){let _0x413484=_0x1a6ef4['getCommentThread'](_0x3cd1f4['commentThreadId']);const {commentThreadId:_0x2ce291,context:_0x29876c,attributes:_0x36c796,resolvedBy:_0x2cb4a6,resolvedAt:_0x471a6c,unlinkedAt:_0x43b143,deletedAt:_0x33577a}=_0x3cd1f4;if(_0x33577a)continue;_0x413484||(_0x413484=_0x1a6ef4['addCommentThread']({'channelId':_0x4802f8,'threadId':_0x2ce291,'context':_0x29876c,'attributes':_0x36c796||{},'resolvedBy':_0x2cb4a6,'resolvedAt':_0x471a6c,'unlinkedAt':_0x43b143,'isFromAdapter':!0x0}));const _0x3e90fc=new Set(Array['from'](_0x413484['comments'],_0xa5b9d=>_0xa5b9d['id']));for(const _0x5edffd of _0x3cd1f4['comments'])_0x3e90fc['delete'](_0x5edffd['commentId']);for(const _0x14c763 of _0x3e90fc)_0x413484['getComment'](_0x14c763)['remove']({'isFromAdapter':!0x0});for(const _0x5c6c67 of _0x3cd1f4['comments']){const _0x1bae2c=_0x413484['getComment'](_0x5c6c67['commentId']);_0x1bae2c?_0x1bae2c['content']!==_0x5c6c67['content']&&_0x1bae2c['update']({'content':_0x5c6c67['content'],'isFromAdapter':!0x0}):_0x413484['addComment'](Object['assign'](st(_0x5c6c67),{'isFromAdapter':!0x0}));}}}['_getService'](_0x2e8cdf){if(!this['_services']['has'](_0x2e8cdf))throw new _0x4aecac('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x2e8cdf});return this['_services']['get'](_0x2e8cdf);}async['_fetchMissingUsersForThreads'](_0x28104){const _0x2b5697=this['context']['plugins']['get'](_0x2dac71),{connection:_0x4ab8bb}=this['context']['plugins']['get'](n),_0x1eb204=new Set();for(const {resolvedBy:_0x2928fe,comments:_0x3497b5}of _0x28104){_0x2928fe&&!_0x2b5697['getUser'](_0x2928fe)&&_0x1eb204['add'](_0x2928fe);for(const {userId:_0x2967d8}of _0x3497b5)_0x2b5697['getUser'](_0x2967d8)||_0x1eb204['add'](_0x2967d8);}if(0x0===_0x1eb204['size'])return;const _0x30bb5d=await ut['getMany'](_0x4ab8bb,Array['from'](_0x1eb204));for(const _0x512a49 of _0x30bb5d)_0x2b5697['getUser'](_0x512a49['id'])||_0x2b5697['addUser'](_0x512a49);}}async function nt(_0x24487f){if('404'!==_0x24487f['code'])throw _0x24487f;}function ft(_0x1de4d1){if((_0x282f7e=_0x1de4d1)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x282f7e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x282f7e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x282f7e;throw _0x1de4d1;}function st(_0x421c69){return{'threadId':_0x421c69['commentThreadId'],'commentId':_0x421c69['commentId'],'content':_0x421c69['content'],'createdAt':_0x421c69['createdAt'],'authorId':_0x421c69['userId'],'attributes':_0x421c69['attributes']||{}};}class m extends _0x341d22{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>tt)());['_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(_0x2d63f3){super(_0x2d63f3);const _0x47e873=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x47e873);}['init'](){const _0x14d01c=this['editor']['plugins']['get'](n),_0x5c9866=this['editor']['plugins']['get']('TrackChangesEditing');return _0x5c9866['adapter']={'getSuggestion':async _0x18bcfb=>{await this['_waitForServiceReady']();const _0x4c17fb=await this['_trackChangesService']['get'](_0x18bcfb)['catch'](it);return await this['_fetchMissingUsersForThreads']([_0x4c17fb]),_0x4c17fb;},'addSuggestion':async({id:_0x4d3056,type:_0x50e793,data:_0x52566d,originalSuggestionId:_0x4ec22d,attributes:_0x161736})=>{await this['_waitForServiceReady']();const _0x451cd9={'id':_0x4d3056,'type':_0x50e793,'data':_0x52566d,'originalSuggestionId':_0x4ec22d,'attributes':_0x161736},_0x59e718=await this['_trackChangesService']['add'](_0x4d3056,_0x50e793,_0x52566d,_0x4ec22d,_0x161736)['catch'](_0x34fe79=>{if(mt(_0x34fe79))return new Promise(_0x23cf2f=>{this['_bufferedRequests']['set'](_0x4d3056,{'resolve':_0x23cf2f,'suggestionData':_0x451cd9});});throw _0x34fe79;});return this['_bufferedRequests']['delete'](_0x4d3056),_0x59e718;},'updateSuggestion':async(_0x2c5d8b,_0x1287fd)=>{if(await this['_waitForServiceReady'](),'open'!==_0x1287fd['state'])return this['_trackChangesService']['update'](_0x2c5d8b,_0x1287fd)['catch'](it);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x415429,_0x17fb4c)=>{_0x5c9866['hasSuggestion'](_0x17fb4c['id'])&&(_0x5c9866['getSuggestion'](_0x17fb4c['id'])['attributes']=_0x17fb4c['attributes']);}),this['_trackChangesService']['connect'](_0x14d01c['connection'])['then'](_0x1f4e3b=>(_0x14d01c['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x1f4e3b)['then'](()=>{for(const _0x3ae30f of _0x1f4e3b){_0x5c9866['addSuggestionData'](_0x3ae30f)['_saved']=!0x0;}})));}async['reconnect'](){const _0x12e781=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0xf482f3}=this['editor']['plugins']['get'](n),_0x463b7b=await this['_trackChangesService']['connect'](_0xf482f3);await this['_fetchMissingUsersForThreads'](_0x463b7b);for(const {suggestionData:_0x3a77cc,resolve:_0xd3e06e}of this['_bufferedRequests']['values']()){let _0x59d151=_0x463b7b['find'](_0x3b22b0=>_0x3b22b0['id']===_0x3a77cc['id']);_0x59d151||(_0x59d151=await this['_trackChangesService']['add'](_0x3a77cc['id'],_0x3a77cc['type'],_0x3a77cc['data'],_0x3a77cc['originalSuggestionId'])),_0xd3e06e(_0x59d151);}for(const _0x46e494 of _0x463b7b)_0x12e781['hasSuggestion'](_0x46e494['id'])||_0x12e781['addSuggestionData'](_0x46e494);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x2da44d=>{this['listenTo'](this['_trackChangesService'],'connected',_0x84a81a=>{_0x84a81a['off'](),_0x2da44d();});});}async['_fetchMissingUsersForThreads'](_0xb8dcbd){const _0x210b34=this['editor']['plugins']['get'](_0x2dac71),{connection:_0x2b812d}=this['editor']['plugins']['get'](n),_0x3648b0=new Set();for(const {authorId:_0x29673b}of _0xb8dcbd)_0x210b34['getUser'](_0x29673b)||_0x3648b0['add'](_0x29673b);if(0x0===_0x3648b0['size'])return;const _0x5303fa=await ut['getMany'](_0x2b812d,Array['from'](_0x3648b0));for(const _0x422bce of _0x5303fa)_0x210b34['getUser'](_0x422bce['id'])||_0x210b34['addUser'](_0x422bce);}}function it(_0x53a623){if(mt(_0x53a623))return new Promise(()=>{});throw _0x53a623;}function mt(_0x5ea6f3){return _0x5ea6f3['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5ea6f3['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x341d22{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 _0x29da38=this['editor']['plugins']['get'](n),_0x33056a=this['editor']['plugins']['get']('CommentsEditing'),_0xa62a4=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x29da38,'change:state',(_0x1e50ef,_0x425bf3,_0x1f3ea2)=>{_0x33056a['isThreadsLoadingPaused']='connected'!==_0x1f3ea2;});}),this['listenTo'](_0x29da38,'change:state',(_0x2b3fd0,_0x3e35de,_0x42a579)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x42a579);}),_0xa62a4['_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 _0x341d22{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 _0x341d22{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x1a57be)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x2dac71];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2f19b6){super(_0x2f19b6);const _0xcd42aa=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0xcd42aa);}async['init'](){const _0x42eb44=this['editor']['plugins']['get'](l),_0x281e55=_0x42eb44['serverHistory'],_0x10a4db=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x281e55,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x42eb44['sessionId']});const _0x1da30e=this['editor']['config']['get']('cloudServices.bundleVersion')||ht,_0x1220d6=await _0x4cecd1['isBundleUploaded'](_0x10a4db['connection'],_0x1da30e);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x344156})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x344156)),'updateRevisions':async _0x1b7060=>{await this['_waitForServiceReady']();const _0xb59ef3=this['_revisionTracker']['currentRevision'];if(_0x1220d6&&0x1===_0x1b7060['length']&&_0x1b7060[0x0]['id']===_0xb59ef3['id'])return _0x1b7060;for(const _0x5d4161 of _0x1b7060)_0x5d4161['id']===_0xb59ef3['id']&&(_0x5d4161['isEmptyCurrent']=_0x5d4161['fromVersion']===_0x5d4161['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1b7060,this['_lastRequestId'])['then'](_0x45ac5d=>(this['_lastRequestId']=_0x45ac5d,_0x1b7060))['catch'](_0x192590=>{if(Z(_0x192590)||'400'===_0x192590['code']&&void 0x0!==_0x192590['data']['wrongRequestId']){for(const _0x4f2c0d of _0x1b7060){!this['_revisionTracker']['repository']['getRevision'](_0x4f2c0d['id'])||this['_revisionTracker']['_bufferUpdate'](_0x4f2c0d['id'],_0x4f2c0d,!0x1);}if(Z(_0x192590))throw _0x192590;return _0x1b7060;}throw _0x192590;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x220245,{revisionsData:_0x51e5fe,requestId:_0x1e72b8})=>{Math['max'](..._0x51e5fe['map'](_0x1932ae=>_0x1932ae['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x51e5fe,_0x1e72b8);}):this['_handleRevisionsUpdate'](_0x51e5fe,_0x1e72b8);});const {revisions:_0x4fd795,requestId:_0xc044d8}=await this['_revisionHistoryService']['connect'](_0x10a4db['connection']);_0x10a4db['addToReconnectionStack'](this),this['_lastRequestId']=_0xc044d8,await this['_fetchMissingUsers'](_0x4fd795);for(const _0x1639dd of _0x4fd795)this['_revisionTracker']['addRevisionData'](_0x1639dd);this['listenTo'](_0x42eb44,'change:_isConnected',(_0xafeb38,_0x157647,_0x3aacac)=>{_0x3aacac&&(this['_oldOffset']=_0x42eb44['_offset'],_0xafeb38['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x10a4db,'state',_0xfabcd9=>_0xfabcd9===_0x2634d5['CONNECTED']);}async['reconnect'](){const _0x5bac34=this['editor']['plugins']['get'](n),_0x3c7d56=this['editor']['plugins']['get'](l),_0x1390c2=async()=>{const _0xd665f3=this['_revisionTracker']['currentRevision'],_0xc11f09=_0xd665f3['id'],_0x3646b1=_0xc11f09!==_0x3c7d56['sessionId'];if(_0x3646b1){const _0xe4a9bf=_0x3c7d56['_offset']-this['_oldOffset'],_0x456323=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0xd665f3['toVersion']+_0xe4a9bf!==_0x456323){const _0x9f0d49=_0xd665f3['fromVersion']+_0xe4a9bf,_0x37ab11=this['editor']['plugins']['get'](_0x2dac71),_0x8b2ac2=this['_revisionTracker']['buildRevisionData']({'revision':_0xd665f3,'from':_0x9f0d49,'to':_0x456323});_0x8b2ac2['id']=_0xd665f3['id'];const _0xded966=_0x8b2ac2['authorsIds']['map'](_0x27b6ed=>_0x37ab11['getUser'](_0x27b6ed));_0xd665f3['_update']({..._0x8b2ac2,'authors':_0xded966},!0x0),this['_revisionTracker']['_bufferUpdate'](_0xd665f3['id'],_0x8b2ac2,!0x0);}this['_revisionTracker']['_startingVersion']=_0x456323,(_0xd665f3['toVersion']===_0xd665f3['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0xc11f09)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0xc11f09),this['_revisionTracker']['_createCurrentRevision'](_0x456323));}const {revisions:_0x3a992c,requestId:_0x580f6e}=await this['_revisionHistoryService']['reconnect'](_0x5bac34['connection'],this['_lastRequestId']);_0x3646b1&&_0x3a992c['length']>0x0?_0x3c7d56['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x3a992c),this['_handleRevisionsUpdate'](_0x3a992c,_0x580f6e),this['_revisionTracker']['sendBufferedUpdates']());};return _0x3c7d56['_isConnected']?_0x1390c2():new Promise((_0x19611b,_0x1cf979)=>{_0x3c7d56['once']('change:_isConnected',()=>{_0x1390c2()['then'](_0x19611b)['catch'](_0x1cf979);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0xae3030=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x1df93e=>{_0x1df93e['off'](),_0xae3030();});});}['_getLatestVersionFromServerOperations'](){const _0x3dee8c=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x25d97f of _0x3dee8c)if('marker'!==_0x25d97f['type']||_0x25d97f['affectsData'])return _0x25d97f['baseVersion']+0x1;}['_getLatestVersion'](){const _0x30e127=this['editor']['plugins']['get'](l);return new Promise(_0x2dda7c=>{_0x30e127['_isPendingUpdate']?_0x30e127['once']('change:_isPendingUpdate',()=>{_0x2dda7c(this['_getLatestVersionFromServerOperations']());}):_0x2dda7c(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x11f714,_0xb59cdb){const _0x57857a=this['_revisionTracker']['repository'];this['_lastRequestId']=_0xb59cdb;for(const _0x18f37e of _0x11f714){const _0xe22ce9=_0x57857a['getRevision'](_0x18f37e['id']);if(_0xe22ce9){if((_0x18f37e['fromVersion']||_0x18f37e['toVersion'])&&(_0x18f37e['diffData']=null),_0xe22ce9===this['_revisionTracker']['currentRevision']){const _0x5d9f04=Math['max'](_0xe22ce9['toVersion'],_0x18f37e['toVersion']),_0x21f0d4=Math['max'](_0xe22ce9['fromVersion'],_0x18f37e['fromVersion']);let _0x2b7b73;_0xe22ce9['toVersion']===_0x18f37e['toVersion']&&_0xe22ce9['fromVersion']===_0x18f37e['fromVersion']?(_0x2b7b73=!0x0,this['_preventResendingRevisionData'](_0x18f37e)):_0x18f37e['toVersion']===_0x5d9f04&&_0x18f37e['fromVersion']===_0x21f0d4?_0x2b7b73=!0x1:(_0xe22ce9['toVersion']===_0x5d9f04&&_0xe22ce9['fromVersion']===_0x21f0d4||this['_fixRevision']({'revision':_0xe22ce9,'from':_0x21f0d4,'to':_0x5d9f04}),_0x2b7b73=!0x0),_0x2b7b73&&(delete _0x18f37e['fromVersion'],delete _0x18f37e['toVersion'],delete _0x18f37e['diffData'],delete _0x18f37e['createdAt'],delete _0x18f37e['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x18f37e),this['_preventResendingRevisionData'](_0x18f37e);}else this['_revisionTracker']['addRevisionData'](_0x18f37e);}const _0x582310=_0x57857a['getRevisions']();_0x582310['reverse']();for(let _0x38ca40=0x0;_0x38ca40<_0x582310['length']-0x1;_0x38ca40++){const _0x4f7148=_0x582310[_0x38ca40],_0x203761=_0x582310[_0x38ca40+0x1];if(_0x4f7148['fromVersion']<_0x203761['toVersion']){const _0x2d54fe=_0x203761['toVersion'],_0x4e23af=Math['max'](_0x2d54fe,_0x4f7148['toVersion']);this['_fixRevision']({'revision':_0x4f7148,'from':_0x2d54fe,'to':_0x4e23af});}}}['_fixRevision']({revision:_0x4cf6f6,from:_0x178310,to:_0x496252}={}){const _0x363633=this['editor']['plugins']['get'](_0x2dac71),_0x2177d1=this['_revisionTracker']['buildRevisionData']({'revision':_0x4cf6f6,'from':_0x178310,'to':_0x496252});_0x2177d1['authors']=_0x2177d1['authorsIds']['map'](_0x932b47=>_0x363633['getUser'](_0x932b47)),_0x4cf6f6['_update'](_0x2177d1);}['_preventResendingRevisionData'](_0xaee46a){const _0x592309={};_0x592309['id']=_0xaee46a['id'];for(const _0x18310a of Object['keys'](_0xaee46a))'id'!==_0x18310a&&(_0x592309[_0x18310a]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x592309['id'],_0x592309,!0x0);}async['_fetchMissingUsers'](_0x1bcd50){const _0x33187b=this['editor']['plugins']['get'](_0x2dac71),{connection:_0x181c65}=this['editor']['plugins']['get'](n),_0x5988c3=new Set();for(const _0x4cf055 of _0x1bcd50){for(const _0x22981a of _0x4cf055['authorsIds'])_0x679a74(_0x22981a);_0x4cf055['creatorId']&&_0x679a74(_0x4cf055['creatorId']);}if(0x0===_0x5988c3['size'])return;const _0x5322e7=await ut['getMany'](_0x181c65,Array['from'](_0x5988c3));for(const _0x38f798 of _0x5322e7)_0x33187b['getUser'](_0x38f798['id'])||_0x33187b['addUser'](_0x38f798);function _0x679a74(_0x5d45db){_0x33187b['getUser'](_0x5d45db)||_0x5988c3['add'](_0x5d45db);}}}function Z(_0x3e2f44){return _0x3e2f44['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x3e2f44['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3e2f44['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class gt extends _0x341d22{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 _0x13e27c{['_collapseAt'];constructor(_0x282642,_0x2837d5=0x6){super(_0x282642);const _0xfabbd9=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x2837d5,this['bind']('isHidden')['to'](this,'usersCount',_0x2c6d1e=>_0x2c6d1e<_0x2837d5),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0xfabbd9['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':_0xfabbd9['to']('usersCount',_0x14e650=>'+'+(_0x14e650-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x13e27c{['items'];['keystrokes'];constructor(_0xb44f7){super(_0xb44f7);const _0xd8b8fc=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x2539c3(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0xd8b8fc['if']('hasPopup'),'aria-expanded':_0xd8b8fc['to']('isExpanded',_0x26b080=>this['hasPopup']&&String(_0x26b080)),'aria-label':_0xd8b8fc['to']('hasPopup',_0xcbca35=>E(_0xb44f7,_0xcbca35?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0xd8b8fc['to']('hasPopup',_0x59f1a8=>!!_0x59f1a8&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0xd8b8fc['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0xd8b8fc['to'](_0x31199d=>{const _0x11bed6=_0x31199d,_0x35a882=document['querySelector']('.ck-presence-list__dropdown-list'),_0x1a4658=document['querySelector']('.ck-balloon-panel_with-arrow');_0x35a882?.['contains'](_0x11bed6['relatedTarget'])||_0x1a4658?.['contains'](_0x11bed6['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x38b1a2,_0x23a74c,_0x3548cd)=>{this['element']&&(_0x3548cd?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 _0x13e27c{['counterView'];['inlineListView'];constructor(_0x53df63,_0x20494f=0x6){super(_0x53df63);const _0x5e28e8=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x20494f),this['inlineListView']=new is(_0x53df63),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x529891 of this['inlineListView']['items'])_0x529891['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',_0x5e28e8['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x13e27c{['listWrapperView'];constructor(_0x17aa48,_0x4b2cc8){super(_0x17aa48);const _0x4a44ed=this['bindTemplate'];this['listWrapperView']=new wt(_0x17aa48,_0x4b2cc8),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':E(_0x17aa48,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x4a44ed['to'](_0x21bd08=>{const _0x209869=_0x21bd08,_0x5ca59b=document['querySelector']('.ck-presence-list__list'),_0x420669=document['querySelector']('.ck-balloon-panel_with-arrow');_0x5ca59b?.['contains'](_0x209869['relatedTarget'])||_0x420669?.['contains'](_0x209869['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class wt extends _0x4d7272{constructor(_0x19b03e,_0x42e08e){super(_0x19b03e);const _0x161932=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x42e08e?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x161932['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x161932['to']('role'),'aria-label':_0x161932['to']('ariaLabel'),'aria-labelledby':_0x161932['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x22f0d0['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x4aa093=this['element'];_0x4aa093&&(this['_isScrollable']=Math['max'](_0x4aa093['scrollHeight'],_0x4aa093['clientHeight'])>0.8*window['innerHeight']);}}class j extends rt{['userView'];constructor(_0x1edd55,_0x54c681,_0x14b990){super(_0x1edd55);const _0x58f3ab=this['bindTemplate'];this['userView']=new ct(_0x1edd55,_0x54c681);const _0x1d67e0={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x54c681['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x54c681['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x54c681['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x14b990&&(_0x1d67e0['tag']='button',_0x1d67e0['on']={'click':_0x58f3ab['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1d67e0);}['focus'](){this['element']['focus']();}}class A extends _0x13e27c{['userView'];['markerView'];constructor(_0x65b3b0,_0x5300bf,_0x172011){super(_0x65b3b0);const _0x577576=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x65b3b0,_0x5300bf),this['markerView']=new lt(_0x65b3b0,_0x5300bf);const _0x40728f=new at(_0x65b3b0);_0x40728f['template']['tag']='span',_0x40728f['text']=_0x5300bf['name'];const _0x9619ef={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x577576['to']('isFocusable',_0xd23d53=>!!_0xd23d53&&0x0),'aria-labelledby':_0x40728f['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x577576['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x577576['to']('hasTooltip',_0x1ab83e=>!_0x1ab83e),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x40728f]};_0x172011&&(_0x9619ef['tag']='button',_0x9619ef['on']={'click':_0x577576['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x9619ef);}}class lt extends _0x13e27c{constructor(_0x1759db,_0x1b0ec6){super(_0x1759db),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1b0ec6['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x145007{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xfa0d79){super(_0xfa0d79),this['context']['config']['define']('presenceList',x);const _0x52aab8=_0xfa0d79['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x52aab8)throw new _0x4aecac('presencelist-collapseat-invalid-format',this);if(_0x52aab8<0x1)throw new _0x4aecac('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x286cbd(),this['balloonPanelView']=new _0x15d792(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x22dfed of this['_allConnectedUsers'])this['_handleUserAdd'](_0x22dfed);this['listenTo'](this['_allConnectedUsers'],'add',(_0x187c35,_0x26c1d5)=>{this['_handleUserAdd'](_0x26c1d5);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3227cf,_0x27fa5a)=>{this['_handleUserRemove'](_0x27fa5a);});}['_createView'](){const _0x4b107d=this['context'],_0x2b84ca=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x1f5996=this['balloonPanelView'];if(!_0x2664e4(_0x4b107d['config']['get']('presenceList.container')))throw new _0x4aecac('presencelist-missing-container',this);return _0x2b84ca['counterView']['bind']('usersCount')['to'](this),_0x2b84ca['bind']('isCollapsed')['to'](this,'usersCount',_0x4ac160=>{const {collapseAt:_0x53189f}=_0x4b107d['config']['get']('presenceList'),_0x4c2d29=_0x4ac160>=_0x53189f;if(_0x4c2d29&&!_0x2b84ca['inlineListView']['items']['find'](_0x3ce390=>_0x3ce390 instanceof b)){const _0x139255=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x139255&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2b84ca['inlineListView']['items']['add'](_0x2b84ca['counterView']);}return _0x4c2d29||this['hideDropdown'](),_0x4c2d29;}),_0x2b84ca['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x391d77=>{const _0xd6a9c4=_0x4b107d['config']['get']('presenceList'),_0x38473d=new A(_0x4b107d['locale'],_0x391d77,!!_0xd6a9c4['onClick']);return _0x38473d['bind']('hasTooltip')['to'](_0x2b84ca,'isCollapsed',_0x23c8bc=>!_0x23c8bc),_0x38473d['bind']('isFocusable')['to'](_0x2b84ca,'isCollapsed',_0x25f2c0=>!_0x25f2c0),_0xd6a9c4['onClick']&&this['listenTo'](_0x38473d,'execute',()=>{this['view']['isCollapsed']||_0xd6a9c4['onClick'](_0x391d77,_0x38473d['element']);}),_0x38473d;}),this['listenTo'](_0x2b84ca['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x2b84ca['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x2b84ca['inlineListView']['keystrokes']['set']('Enter',(_0x3db2b2,_0x52f95f)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x52f95f());}),_0x2b84ca['render'](),_0x1f5996['render'](),_0x33c89b({'emitter':_0x2b84ca,'activator':()=>_0x1f5996['isVisible'],'contextElements':[_0x1f5996['element'],_0x2b84ca['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x4b107d['config']['get']('presenceList.container')['appendChild'](_0x2b84ca['element']),this['_bodyCollection']=new _0x292897(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x2b84ca;}['_handleUserAdd'](_0x1f077e){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x1f077e['isMe'])return;const _0x527b8d=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x527b8d-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x404393=_0x1f077e['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x1f077e,_0x404393);}['_handleUserRemove'](_0x49f664){this['usersCount']--;const {collapseAt:_0x3d4861}=this['context']['config']['get']('presenceList'),_0x3a1a66=this['usersCount']>=_0x3d4861;if(this['currentDisplayedUsers']['get'](_0x49f664['id']))this['currentDisplayedUsers']['remove'](_0x49f664['id']);else{if(_0x3a1a66&&this['currentDisplayedUsers']['length']+0x1===_0x3d4861-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x3a1a66?0x1:0x0)<this['usersCount']){for(const _0x40173f of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x40173f['id'])&&(this['currentDisplayedUsers']['add'](_0x40173f,Math['min'](this['currentDisplayedUsers']['length']-(_0x3a1a66?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x3a1a66?0x1:0x0)===_0x3d4861-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x5920b9=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x5920b9['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x869a5d}=this['presenceDropdownView'];_0x869a5d['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x50b26a=>{if(!_0x5920b9['displayMe']&&_0x50b26a['isMe'])return null;const _0x380177=new j(this['context']['locale'],_0x50b26a,!!_0x5920b9['onClick']);return _0x5920b9['onClick']&&this['listenTo'](_0x380177,'execute',()=>{_0x5920b9['onClick'](_0x50b26a,_0x380177['element']);}),_0x380177;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x869a5d['focus'](),_0x869a5d['checkIfScrollable']();const _0x503731=(_0x1e0af6,_0x389491)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x389491();};_0x869a5d['keystrokes']['set']('Esc',_0x503731),_0x869a5d['keystrokes']['set']('Shift+Tab',_0x503731),_0x869a5d['keystrokes']['set']('Tab',(_0x848a59,_0xd75b2d)=>{!function(_0x4055ef){const _0x3e1bc3=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x5826d3=>_0x5826d3+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x1ae0cf=[...document['body']['querySelectorAll'](_0x3e1bc3)]['filter'](_0x4ddfc2=>_0x4ddfc2===document['activeElement']||_0x4ddfc2['offsetWidth']+_0x4ddfc2['offsetHeight']>0x0)['sort']((_0xaadc67,_0x324a66)=>(_0xaadc67['tabIndex']||0x0)-(_0x324a66['tabIndex']||0x0)),_0x40b4e0=_0x1ae0cf['indexOf'](_0x4055ef),_0xb41804=_0x1ae0cf[(_0x40b4e0+0x1)%_0x1ae0cf['length']];_0xb41804&&_0xb41804['focus']();}(this['view']['element']),this['hideDropdown'](),_0xd75b2d();}),_0x869a5d['focusTracker']['add'](this['view']['element']),_0x869a5d['focusTracker']['on']('change:isFocused',(_0x173fa1,_0x5ebbb8,_0x3aad2d)=>{_0x3aad2d||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 _0x145007{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};
|