@ckeditor/ckeditor5-real-time-collaboration 47.6.0-alpha.4 → 47.6.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- 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
|
-
((()=>ht)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x415cf5];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3e20af){super(_0x3e20af),this['set']('state',te['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x447917())();}['init'](){const _0x335316=this['context'],_0x1bb54f=_0x335316['plugins']['get']('CloudServices'),_0x960bf4=_0x335316['plugins']['get'](_0x415cf5);if(!_0x1bb54f['token'])throw new _0x1e7226('websocketgateway-missing-token',this);if(!_0x1bb54f['webSocketUrl'])throw new _0x1e7226('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'](_0x1bb54f['token'],_0x1bb54f['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x5b053f=>{if(this['connection']=_0x5b053f,this['bind']('state')['to'](_0x5b053f,'state',this,'_isBrowserOffline',(_0x68035b,_0x1f4963)=>('connected'!==_0x68035b&&(this['_shouldPluginsReconnect']=!0x0),_0x1f4963||_0x68035b!==te['CONNECTED']?te['DISCONNECTED']:this['state']==te['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),te['CONNECTING']):te['CONNECTED'])),this['connection']['on']('error',(_0x11d2bf,_0x390af6)=>{if('limitExceeded'!==_0x390af6['code'])throw console['error'](_0x390af6),new _0x1e7226('cloudservices-init',null,{'originalError':_0x390af6});_0x960bf4['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'});}),!_0x5b053f['me'])return new Promise(_0xa6fa34=>_0x5b053f['on']('change:me',_0xa6fa34));})['catch'](_0x5c7955=>{throw console['error'](_0x5c7955),new _0x1e7226('cloudservices-init',null,{'originalError':_0x5c7955});});}['addToReconnectionStack'](_0x251cfa){if('function'!=typeof _0x251cfa['reconnect'])throw new _0x1e7226('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x251cfa))throw new _0x1e7226('websocketgateway-plugin-already-registered',this,{'name':_0x251cfa['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x251cfa);}['removeFromReconnectionStack'](_0x34863e){this['_reconnectionStack']['delete'](_0x34863e);}['isInReconnectionStack'](_0x494051){return this['_reconnectionStack']['has'](_0x494051);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x3b234c=>_0x3b234c['reconnect']())))['then'](()=>this['state']=te['CONNECTED'])['catch'](_0x3c7698=>{throw console['error'](_0x3c7698),new _0x1e7226('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=te['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x59b06d{['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,_0x16cf84];}constructor(_0x5282a8){super(_0x5282a8),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x1ad15d(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x16cf84);}['init'](){const _0x45044f=this['context']['plugins']['get'](n);this['listenTo'](_0x45044f,'change:state',(_0x2217e4,_0x2e5e10,_0x544d58)=>{if('connected'!==_0x544d58)this['channelSessions']['forEach'](_0x1423e7=>_0x1423e7['clear']()),this['channelConnectedUsers']['forEach'](_0x39b664=>_0x39b664['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x4fcb34,_0xe7ceae]of this['_registeredSessions'])for(const _0x505acf of _0xe7ceae)this['_handleSessionAdd'](_0x4fcb34,_0x505acf);}}),this['_createUser'](_0x45044f['connection']['me'],!0x0);}['register'](_0x1840e2,_0x136bed){if(this['_registeredSessions']['has'](_0x1840e2))throw new _0x1e7226('sessions-register-already-registered',null,{'channelId':_0x1840e2});this['_registeredSessions']['set'](_0x1840e2,_0x136bed),this['channelSessions']['set'](_0x1840e2,new _0x1ad15d()),this['channelConnectedUsers']['set'](_0x1840e2,new _0x1ad15d()),this['listenTo'](_0x136bed,'add',(_0xac2330,_0x152128)=>this['_handleSessionAdd'](_0x1840e2,_0x152128)),this['listenTo'](_0x136bed,'remove',(_0x41e266,_0x1036e9)=>this['_handleSessionRemove'](_0x1840e2,_0x1036e9));for(const _0x3501ae of _0x136bed)this['_handleSessionAdd'](_0x1840e2,_0x3501ae);}['unregister'](_0xffadca){if(!this['_registeredSessions']['has'](_0xffadca))throw new _0x1e7226('sessions-unregister-not-exist',null,{'channelId':_0xffadca});const _0x490eaf=this['_registeredSessions']['get'](_0xffadca);this['stopListening'](_0x490eaf);for(const _0x4f3bda of _0x490eaf)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0xffadca,_0x4f3bda);this['_registeredSessions']['delete'](_0xffadca),this['channelSessions']['delete'](_0xffadca),this['channelConnectedUsers']['delete'](_0xffadca);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x2bbfd3){for(const _0x203663 of this['channelSessions']['values']())for(const _0x212487 of _0x203663)if(_0x212487['id']===_0x2bbfd3)return _0x212487['user'];}['getUserSessions'](_0x4c1ed9,_0x7a596d){const _0x15a0e8=_0x7a596d?[this['channelSessions']['get'](_0x7a596d)]:this['channelSessions']['values'](),_0x4f6890=new Set();for(const _0x1c976c of _0x15a0e8)for(const _0x12ba24 of _0x1c976c)_0x12ba24['user']['id']===_0x4c1ed9['id']&&_0x4f6890['add'](_0x12ba24['id']);return _0x4f6890;}['getUserRole'](_0x429c49){for(const _0x2f0605 of this['channelSessions']['values']())for(const _0x38b32e of _0x2f0605)if(_0x38b32e['user']===_0x429c49)return _0x38b32e['role'];}['_handleSessionAdd'](_0x52fe3c,_0x3241de){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x438d32=_0x3241de['user'],_0x23bb10=this['_users']['getUser'](_0x438d32['id'])||this['_createUser'](_0x438d32),_0xfbc2c9=Object['assign']({},_0x3241de,{'user':_0x23bb10});if(this['channelSessions']['get'](_0x52fe3c)['add'](_0xfbc2c9),!_0x438d32['hiddenInPresenceList']){const _0x459225=this['channelConnectedUsers']['get'](_0x52fe3c);_0x459225['has'](_0x23bb10['id'])||_0x459225['add'](_0x23bb10),this['allConnectedUsers']['has'](_0x23bb10['id'])||_0x438d32['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x23bb10,_0x23bb10['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x52fe3c,{'channelId':_0x52fe3c,'session':_0xfbc2c9});}['_handleSessionRemove'](_0x44dfc2,_0x4fcbea){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x3b978a=this['channelConnectedUsers']['get'](_0x44dfc2),_0x4b5024=_0x4fcbea['user'];_0x4b5024['id']&&(this['channelSessions']['get'](_0x44dfc2)['remove'](_0x4fcbea['id']),_0x3b978a['has'](_0x4b5024['id'])&&!this['getUserSessions'](_0x4b5024,_0x44dfc2)['size']&&_0x3b978a['remove'](_0x4b5024['id']),this['allConnectedUsers']['get'](_0x4b5024['id'])&&!this['getUserSessions'](_0x4b5024)['size']&&this['allConnectedUsers']['remove'](_0x4b5024['id']));}['_createUser'](_0x38548f,_0x19da2c){const _0x58ec49=this['_users']['addUser'](_0x38548f);return _0x19da2c&&this['_users']['defineMe'](_0x38548f['id']),_0x58ec49['orderNumber']=this['_uniqueUsersCount']++,_0x58ec49;}}class H extends _0x1c2520{['_domEmitter']=new(_0x447917())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x13b0a6=this['editor'],_0x333868=_0x13b0a6['plugins']['get'](i);_0x13b0a6['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x125f6d,{writer:_0x1685fa})=>function(_0xabbd0,_0x2be0a4,_0x3fa99e,_0xaf1358){const _0x516a3f=_0xabbd0['markerName']['split'](':')[0x2],_0x399310=_0x3fa99e['getUserBySessionId'](_0x516a3f);if(!_0x399310||_0x516a3f===_0x3fa99e['mySessionId'])return;if(!_0xaf1358['model']['schema']['checkChild'](_0xabbd0['markerRange']['start'],'$text'))return;const _0x33cb43={'class':'ck-user__marker\x20'+_0x399310['color']['getMarkerClass'](),'data-name':_0x399310['name'],'data-session-id':_0x516a3f},_0xbf37bb=_0xaf1358['model']['markers']['get'](_0xabbd0['markerName']),_0x6940ed=_0xbf37bb['getStart'](),_0x3e5d30=_0x6940ed['nodeAfter'],_0x178928=_0xaf1358['model']['schema'];if(_0x3e5d30&&_0x178928['isObject'](_0x3e5d30)&&_0x178928['isInline'](_0x3e5d30)&&!_0xaf1358['model']['markers']['get']('user:range:'+_0x516a3f)['getRange']()['isCollapsed'])return;const _0x60eda2=_0x6940ed['parent'];return _0xaf1358['model']['schema']['isLimit'](_0x60eda2)&&!_0xaf1358['model']['hasContent'](_0x60eda2)&&(_0x33cb43['contenteditable']=!0x1),function(_0x5e6916,_0x49888e,_0x5d62bb){const _0x1920fd=_0x5e6916['createUIElement']('span',_0x49888e);return _0x5e6916['setCustomProperty']('userPositionMarker',!0x0,_0x1920fd),_0x1920fd['render']=function(_0x28ff40){const _0x3d3445=this['toDomElement'](_0x28ff40),_0x291d01=document['createElement']('span');return _0x291d01['classList']['add']('ck-user__marker-tooltip'),_0x291d01['setAttribute']('contenteditable','false'),_0x291d01['setAttribute']('spellcheck','false'),_0x291d01['textContent']=_0x5d62bb['name'],_0x3d3445['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x291d01['outerHTML']+'',_0x3d3445['addEventListener']('mouseenter',()=>{_0x3d3445['classList']['add']('ck-user__marker_hovered');}),_0x3d3445['addEventListener']('mouseleave',()=>{_0x3d3445['classList']['remove']('ck-user__marker_hovered');}),_0x3d3445;},_0x1920fd['isSimilar']=function(_0x2620de){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2620de['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2620de['getAttribute']('data-session-id'));},_0x1920fd;}(_0x2be0a4,_0x33cb43,_0x399310);}(_0x125f6d,_0x1685fa,_0x333868,_0x13b0a6)}),_0x13b0a6['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x3250c4=>function(_0x3e052f,_0x2952c0){const _0x30a762=_0x3e052f['markerName']['split'](':')[0x2];if(_0x30a762===_0x2952c0['mySessionId'])return null;const _0x24a416=_0x2952c0['getUserBySessionId'](_0x30a762);if(!_0x24a416)return{'id':_0x30a762,'classes':[]};return{'id':_0x30a762,'classes':['ck-user__selection',_0x24a416['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x30a762},'priority':0x7d0+_0x24a416['orderNumber']};}(_0x3250c4,_0x333868)}),function(_0x3d9681){const _0x3b7109=_0x3d9681['model'],_0x16540e=new Map(),_0xc8d205=_0x3d9681['plugins']['get'](i);_0x3b7109['markers']['on']('update:user:range',(_0x767061,_0x4cef0c,_0x33e8f2,_0x3054f4)=>{if(!_0x3054f4&&_0x16540e['get'](_0x4cef0c['name']))return _0x16540e['get'](_0x4cef0c['name'])['detach'](),void _0x16540e['delete'](_0x4cef0c['name']);const _0x2a0af1=_0x4cef0c['name']['split'](':')[0x2];if(_0x2a0af1===_0xc8d205['mySessionId'])return;const _0x17304d='user:position:'+_0x2a0af1;_0x3b7109['markers']['has'](_0x17304d)&&_0x3d9681['editing']['reconvertMarker'](_0x17304d),_0x4cef0c['on']('change:range',(_0xf23450,_0x1c2dfa,_0x6cc343)=>{if('$graveyard'!=_0x1c2dfa['root']['rootName']&&'$graveyard'==_0x4cef0c['getRange']()['root']['rootName']&&!_0x16540e['has'](_0x4cef0c['name'])){const _0x8f7ffb=_0x3b7109['schema']['getNearestSelectionRange'](_0x6cc343['deletionPosition']);if(_0x8f7ffb){const _0x512fdd=_0xc672a5['fromRange'](_0x8f7ffb);_0x16540e['set'](_0x4cef0c['name'],_0x512fdd),_0x512fdd['on']('change:range',(_0x1570b9,_0x4c68f3,_0x44e728)=>{if('$graveyard'==_0x512fdd['root']['rootName']){const _0x2c95a7=_0x3b7109['schema']['getNearestSelectionRange'](_0x44e728['deletionPosition']);_0x2c95a7?(_0x512fdd['start']=_0x2c95a7['start'],_0x512fdd['end']=_0x2c95a7['end']):(_0x16540e['delete'](_0x4cef0c['name']),_0x512fdd['detach']());}});}}});}),_0x3b7109['document']['on']('change',()=>{_0x16540e['size']>0x0&&_0x3b7109['enqueueChange']({'isUndoable':!0x1},_0xa5dfb1=>{for(const [_0x18192d,_0x5d046e]of _0x16540e)'$graveyard'==_0x3b7109['markers']['get'](_0x18192d)['getRange']()['root']['rootName']&&(Z(_0x18192d['split'](':')[0x2],_0x5d046e['toRange'](),_0x3b7109,_0xa5dfb1),_0x5d046e['detach']());_0x16540e['clear']();});});}(_0x13b0a6),this['_domEmitter']['listenTo'](_0xca9fbc['document'],'keydown',(_0x2a5366,{key:_0x4ff511})=>{'Escape'===_0x4ff511&&function(_0x3f2eeb){_0x3f2eeb['editing']['view']['change'](_0x3a73a9=>{for(const _0x4e3746 of _0x3f2eeb['model']['markers']){if(!_0x4e3746['name']['startsWith']('user:position'))continue;const _0x296acf=_0x3f2eeb['editing']['mapper']['markerNameToElements'](_0x4e3746['name']);if(_0x296acf){for(const _0x24337c of _0x296acf)_0x3a73a9['removeClass']('ck-user__marker_hovered',_0x24337c);}}});}(_0x13b0a6);},{'useCapture':!0x0});}['afterInit'](){const _0x16ab6a=this['editor'],_0x1cc60c=_0x16ab6a['commands']['get']('undo');_0x1cc60c&&_0x16ab6a['model']['on']('applyOperation',(_0xc94a7d,_0x558a53)=>{const _0x20ad7e=_0x558a53[0x0];if(!_0x20ad7e['isDocumentOperation'])return;if('marker'!=_0x20ad7e['type']||!_0x20ad7e['name']['startsWith']('user:'))return;const _0x15d94d=_0x20ad7e['batch'];_0x1cc60c['_createdBatches']['has'](_0x15d94d)&&(_0x20ad7e['newRange']=_0x20ad7e['oldRange']?_0x16ab6a['model']['createRange'](_0x20ad7e['oldRange']['start'],_0x20ad7e['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x5914ae=this['editor'],_0x41996a=_0x5914ae['model']['document'],_0x562af3=_0x5914ae['plugins']['get'](i);_0x5914ae['model']['enqueueChange']({'isUndoable':!0x1},_0x4c172f=>{const _0x15ce3a='user:range:'+_0x562af3['mySessionId'],_0xd0eb81='user:position:'+_0x562af3['mySessionId'],_0x1f4c5e=_0x5914ae['model']['markers']['has'](_0x15ce3a);_0x5914ae['editing']['view']['hasDomSelection']?Z(_0x562af3['mySessionId'],_0x41996a['selection']['getFirstRange'](),_0x5914ae['model'],_0x4c172f):_0x1f4c5e&&(_0x4c172f['removeMarker'](_0x15ce3a),_0x4c172f['removeMarker'](_0xd0eb81));});}}function Z(_0x3e3bc4,_0xd20aca,_0x292bc9,_0x5bea9f){const _0x633d24='user:range:'+_0x3e3bc4,_0x154c76='user:position:'+_0x3e3bc4,_0x36fa0c=_0xd20aca['getContainedElement']();let _0x4f32dc=_0xd20aca['start'];if(_0x36fa0c&&_0x36fa0c['is']('element','tableCell')){const _0x1f960c=function(_0x1bea37,_0x80ac5a){for(const _0x1e7069 of _0x1bea37['getPositions']())if(_0x80ac5a['schema']['checkChild'](_0x1e7069,'$text'))return _0x1e7069;}(_0xd20aca,_0x292bc9);_0x1f960c&&(_0x4f32dc=_0x1f960c,_0xd20aca=_0x5bea9f['createRange'](_0x4f32dc));}const _0x3113ab=_0x5bea9f['createRange'](_0x4f32dc);_0x292bc9['markers']['has'](_0x633d24)?(_0x5bea9f['updateMarker'](_0x633d24,{'range':_0xd20aca}),_0x5bea9f['updateMarker'](_0x154c76,{'range':_0x3113ab})):(_0x5bea9f['addMarker'](_0x633d24,{'range':_0xd20aca,'usingOperation':!0x0}),_0x5bea9f['addMarker'](_0x154c76,{'range':_0x3113ab,'usingOperation':!0x0}));}function V(_0x19fc8d,_0xc7ad3b,_0x35e7c6){const _0x26d4ed=_0x19fc8d['t'],t=_0x19fc8d['t'];switch(_0xc7ad3b){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 _0x26d4ed({'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'},_0x35e7c6);default:return'';}}let G=0x1;class l extends _0x1c2520{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x2c7ae4)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,H,_0x498470,_0x16cf84,_0x415cf5];}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 _0xb8abfd=this['serverHistory']['getOperations']();for(let _0x3cb80b=_0xb8abfd['length']-0x1;_0x3cb80b>=0x0;_0x3cb80b--){const _0x497527=_0xb8abfd[_0x3cb80b];if(!this['_disconnectionOperations']['has'](_0x497527))return _0x497527['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x123db8){if(super(_0x123db8),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x43b79e(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1e7226('collaboration-missing-channelid',this);const _0x2aee86=_0x123db8['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x2aee86,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x3f936c(),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 J(this['_disconnectionOperations']);}['init'](){const _0x4aef8a=this['editor'],_0x13f481=_0x4aef8a['plugins']['get'](_0x16cf84),_0x5c1e76=_0x4aef8a['plugins']['get'](n);this['listenTo'](_0x13f481,'getOperationAuthor',(_0x98dfcd,_0x8b36fa)=>{const _0x135c7f=_0x8b36fa[0x0];_0x135c7f['_authorId']&&(_0x98dfcd['return']=_0x13f481['getUser'](_0x135c7f['_authorId']),_0x98dfcd['stop']()),null===_0x135c7f['_authorId']&&(_0x98dfcd['return']=null,_0x98dfcd['stop']());},{'priority':'high'}),this['listenTo'](_0x4aef8a['model']['document']['selection'],'change:range',(_0x2bc602,_0x29b862)=>{_0x29b862['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x4aef8a['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x4aef8a['model']['on']('applyOperation',(_0xc1e6ab,_0x3ef087)=>{const _0x29d85a=_0x3ef087[0x0];_0x29d85a['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x29d85a),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x5c1e76,'state',this,'_hasSynchronizationProblem',(_0x5265e7,_0x365706)=>'connected'===_0x5265e7&&!_0x365706),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x4aef8a['disableReadOnlyMode']('rtc-offline'):_0x4aef8a['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x4aef8a['disableReadOnlyMode']('rtc-offline'):_0x4aef8a['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x55091a=this['editor']['plugins']['get'](i),_0x2025f2=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x55091a['unregister'](this['_channelId']);const _0x4768c9=await this['_service']['reconnect'](_0x2025f2['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x4768c9)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x2dcfac=await this['_service']['getConnectedSessions']();_0x55091a['register'](this['_channelId'],_0x2dcfac),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x51168d){if(function(_0x4630f3){return'404'===_0x4630f3['code'];}(_0x51168d)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x34068f){return'409'===_0x34068f['code'];}(_0x51168d)){const _0x1c6666=V(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'](_0x1c6666);}else{if(!(_0x51168d instanceof $))throw _0x51168d;this['_handleReconnectionError']();}}}}['destroy'](){const _0x9cd080=this['editor']['plugins']['get'](n),_0x2691e8=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x2691e8['channelSessions']['has'](this['_channelId'])&&_0x2691e8['unregister'](this['_channelId']),_0x9cd080['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x52655f){if(this['sessionId']!==_0x52655f['sessionId']&&this['_lastSyncedOperationId']!==_0x52655f['lastOperationId'])throw new $();return this['sessionId']=_0x52655f['sessionId'],this['_handleServerResponse']([],{..._0x52655f,'wereChangesApplied':!0x1,'data':_0x52655f['data']},'reconnect');}async['_connectService'](_0x3b09d9,_0x4fa619=!0x1){const {connection:_0x2087dc}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x2087dc,this['_channelId'])['then'](_0x453d1b=>this['_initSessionsHandling'](_0x453d1b))['catch'](_0x3161fe=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x3161fe);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x77eb44,_0x504f52)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x504f52);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x24c69d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3b09d9);this['_isPendingUpdate']=!0x0;const _0x3ddc54=await this['_service']['connect'](_0x2087dc,this['_compressOperations'](_0x3b09d9),_0x24c69d);if(this['sessionId']=_0x3ddc54['sessionId'],_0x4fa619){if(!_0x3ddc54['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3ddc54['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x3b09d9,_0x3ddc54,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3ddc54,_0x3b09d9);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x315df7=this['editor']['plugins']['get'](i),_0x2304ef=this['editor']['plugins']['get'](H),_0x28156a=_0x315df7['channelSessions']['get'](this['_channelId']);_0x28156a&&_0x28156a['length']>0x1?_0x2304ef['createUserMarkerOperations']():this['listenTo'](_0x315df7,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x315df7['channelSessions']['get'](this['_channelId'])['length']&&_0x2304ef['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x310842,_0x3d00ab,_0x2c77b4,_0x2105da){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x3d00ab){const _0x351c4c=this['_decompressOperations'](_0x2c77b4,_0x2105da);await this['_fetchMissingUsers'](_0x351c4c),this['_handleExternalOperations'](_0x351c4c,_0x3d00ab,_0x2c77b4['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x21fb26}=this['editor'];let _0x408171;try{_0x408171=await this['_service']['getDocumentDetails']();}catch{const _0x5d78b8=V(_0x21fb26,'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'](_0x5d78b8);}const _0x2735b5=_0x408171['currentDocumentSession']||_0x408171['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2735b5['lastOperationId']){const _0x1cc6ee=V(_0x21fb26,'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'](_0x1cc6ee);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x387a71){const _0x477cec=this['editor']['plugins']['get'](i);this['listenTo'](_0x477cec,'sessionAdd:'+this['_channelId'],(_0xb5cc3e,{session:_0x303311})=>{if(_0x303311['id']===_0x477cec['mySessionId']){_0xb5cc3e['off']();const _0x3f1747=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x37adf2=_0x303311['permissions'];_0x3f1747&&_0x3f1747['isEnabled']&&(_0x37adf2=_0x37adf2['filter'](_0x48af7e=>'document:write'!==_0x48af7e)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x37adf2,this['_channelId']);}}),_0x477cec['register'](this['_channelId'],_0x387a71);}['_initThrowingOnDataSet'](){const _0x1c6689=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x24794f)=>{if(!_0x24794f[_0x24794f['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1e7226('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x1c6689['apply'](this['editor']['data'],_0x24794f);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0xebc62d,[_0x17dddb])=>{if(this['_document']['version'])throw new _0x1e7226('realtimecollaborationclient-init-document-already-initialized',this);_0xebc62d['stop'](),this['_setPendingAction']();const _0x1e9940=this['editor']['config']['get']('rootsAttributes'),_0x58280d=this['_getOperationsFromInitData'](_0x17dddb,_0x1e9940);0x0==_0x58280d['length']&&_0x58280d['push'](new _0x5a29ab(0x0)),_0xebc62d['return']=this['_connectService'](_0x58280d)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0xd49b6f=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0xd49b6f))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x33957d,[_0x252259,_0x61afef])=>{_0x33957d['stop']();const _0x430056=this['editor']['model']['document']['getRoot'](_0x252259);if(!this['_knownRootNames']['has'](_0x252259)){const _0x8b2833=_0x61afef&&_0x61afef['data']?_0x61afef['data']:'',_0xdabee7=_0x61afef&&_0x61afef['attributes']?_0x61afef['attributes']:{};await this['_loadRoot'](_0x252259,_0x8b2833,_0xdabee7);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x430056['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x430056);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x37e696){const _0x165d08=this['editor']['plugins']['get'](_0x16cf84),{connection:_0x3bc4d3}=this['editor']['plugins']['get'](n),_0x2bf8a4=new Set();for(const _0x7c17b7 of _0x37e696){const _0x3b8ed0=_0x7c17b7['_authorId'];_0x3b8ed0&&!_0x165d08['getUser'](_0x3b8ed0)&&_0x2bf8a4['add'](_0x3b8ed0);}if(0x0===_0x2bf8a4['size'])return;const _0x5dd617=await lt['getMany'](_0x3bc4d3,Array['from'](_0x2bf8a4));for(const _0x3516dc of _0x5dd617)_0x165d08['getUser'](_0x3516dc['id'])||_0x165d08['addUser'](_0x3516dc);}['_getOperationsFromInitData'](_0x30ea30,_0x4c7e9d={}){const _0x5be967=this['editor']['model'],_0x5ad32b=[];let _0x283b62=0x0;const _0x1260d2='string'==typeof _0x30ea30?{'main':_0x30ea30}:_0x30ea30;for(const _0x2f68e6 of Object['keys'](_0x1260d2)){if(!this['_document']['roots']['has'](_0x2f68e6))throw new _0x1e7226('realtimecollaborationclient-init-non-existent-root',this);const _0x4c3961=this['editor']['data']['parse'](_0x1260d2[_0x2f68e6]),_0xe98a09=this['_document']['getRoot'](_0x2f68e6),_0x4eea9c=new _0x1dc74e(_0x5be967['createPositionAt'](_0xe98a09,0x0),_0x4c3961,_0x283b62++);_0x5ad32b['push'](_0x4eea9c);for(const [_0x2e9ce7,_0x4c752c]of _0x4c3961['markers']){const _0x14bb56=_0x5be967['createRange'](_0x5be967['createPositionFromPath'](_0xe98a09,_0x4c752c['start']['path']['slice']()),_0x5be967['createPositionFromPath'](_0xe98a09,_0x4c752c['end']['path']['slice']())),_0x5c9d7=new _0x2d3076(_0x2e9ce7,null,_0x14bb56,_0x5be967['markers'],!0x0,_0x283b62++);_0x5ad32b['push'](_0x5c9d7);}}if(_0x4c7e9d)for(const [_0x33922c,_0x14b18e]of Object['entries'](_0x4c7e9d)){const _0x18b770=_0x5be967['document']['getRoot'](_0x33922c);if(!_0x18b770)throw new _0x1e7226('multi-root-editor-root-attributes-no-root',null);for(const [_0x1da846,_0x5574db]of Object['entries'](_0x14b18e))if(null!==_0x5574db){const _0xae24fc=new _0x2a4b3a(_0x18b770,_0x1da846,null,_0x5574db,_0x283b62++);_0x5ad32b['push'](_0xae24fc);}}return _0x5ad32b;}async['_loadRoot'](_0x351eb8,_0x3d59c8,_0x441d41){this['_getOperationsFromInitData']({[_0x351eb8]:_0x3d59c8},{[_0x351eb8]:_0x441d41})['forEach']((_0x1e2309,_0x59c803)=>{_0x1e2309['baseVersion']=this['_document']['version']+_0x59c803,_0x1e2309['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x1e2309);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x51fa87,_0x2b5343){let _0x1b8a32;this['_offset']=_0x51fa87['offset'];const _0x19c04e=_0x51fa87['wereChangesApplied']&&!_0x51fa87['initData'],_0x434fd=_0x19c04e?0x0:_0x51fa87['data']['baseVersion'];if(_0x2b5343['forEach'](_0x2bb123=>{_0x2bb123['_isInit']=!0x0,_0x2bb123['createdAt']=_0x51fa87['sessionCreatedAt'],_0x2bb123['_authorId']=null;}),_0x19c04e)_0x1b8a32=_0x2b5343,this['_applyOperationsSet'](_0x1b8a32,_0x19c04e);else{if(_0x51fa87['initData']){const _0x50c469=this['_getOperationsFromInitData'](_0x51fa87['initData']);this['_document']['history']['version']=-_0x50c469['length'],_0x50c469['forEach'](_0x56c2ac=>{_0x56c2ac['baseVersion']-=_0x50c469['length'],_0x56c2ac['createdAt']=_0x51fa87['sessionCreatedAt'],_0x56c2ac['_isInit']=!0x0,_0x56c2ac['_authorId']=null;}),this['_applyOperationsSet'](_0x50c469,!0x0),this['serverHistory']['version']=-_0x50c469['length']+this['_offset'],this['_updateServerHistory'](_0x50c469);}this['_document']['history']['version']=_0x434fd,_0x1b8a32=this['_decompressOperations'](_0x51fa87['data'],_0x51fa87['metadata']),await this['_fetchMissingUsers'](_0x1b8a32),this['_applyOperationsSet'](_0x1b8a32,_0x19c04e);}_0x51fa87['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1b8a32,_0x51fa87['lastOperationId']),this['_lastSyncedOperationId']=_0x51fa87['lastOperationId']),this['serverHistory']['version']=_0x434fd+this['_offset'],this['_updateServerHistory'](_0x1b8a32),_0x2b5343['filter'](_0x545e85=>{const _0x1521ca=this['_getAffectedRoot'](_0x545e85);return _0x1521ca&&!this['_knownRootNames']['has'](_0x1521ca);})['forEach']((_0x5cb169,_0x4b8bd2)=>{_0x5cb169['baseVersion']=this['_document']['version']+_0x4b8bd2,this['_saveOperationInBuffer'](_0x5cb169);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x683bb,_0x3d5026){const _0x2532a9=_0x3d5026&&_0x3d5026['message'];if(_0x2532a9&&_0x2532a9['startsWith']('realtimecollaborationclient'))throw _0x3d5026;const _0x50991a=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x50991a['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1e7226(_0x683bb,this['editor'],_0x2532a9?{'originalError':_0x2532a9}:void 0x0);}['_saveOperationInBuffer'](_0x2ecc85){this['_knownOperations']['has'](_0x2ecc85)||(this['_knownOperations']['add'](_0x2ecc85),this['_bufferedOperations']['push'](_0x2ecc85),this['_pendingAction']||'marker'==_0x2ecc85['type']&&!_0x2ecc85['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x140d1d=!0x1){!_0x140d1d&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x570d3f=>{_0x570d3f&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x2b2455=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0xb5b517){return _0xb5b517['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xb5b517['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0xb5b517['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x2b2455)||this['_crash'](_0x2b2455['message'],_0x2b2455);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x304a80=>{this['on']('change:_isPendingUpdate',()=>{_0x304a80();});});}async['_sendBufferedOperations'](){const _0xbd6ca8=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0xbd6ca8['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x39ed64=[...this['_bufferedOperations']];for(const _0x486059 of _0x39ed64)_0x486059['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x486059);const _0x51900a=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x39ed64),_0x35eb6f=G++,_0x5b2cf8=this['_compressOperations'](_0x39ed64),_0x5080d3=await this['_service']['sendOperations'](_0x5b2cf8,_0x5b2cf8['baseVersion'],_0x51900a);try{return await this['_handleServerResponse'](_0x39ed64,_0x5080d3,_0x35eb6f);}catch(_0x2f8090){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x2f8090);}}async['_handleServerResponse'](_0x484287,_0x7e1b84,_0x263a41){if('error'in _0x7e1b84)throw _0x7e1b84['error'];let _0x296f84=!0x1;if(_0x7e1b84['wereChangesApplied']){_0x7e1b84['lastOperationId']&&(this['_lastSyncedOperationId']=_0x7e1b84['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x54fda1=>!_0x484287['includes'](_0x54fda1));for(const _0x4ab8cd of _0x484287)_0x4ab8cd['createdAt']='lastOperationAcceptedAt'in _0x7e1b84&&_0x7e1b84['lastOperationAcceptedAt']||void 0x0;K(_0x484287,_0x7e1b84['version']-_0x484287['length']),this['_updateServerHistory'](_0x484287);const _0x12a1a2=_0x484287['filter'](_0x4a6cbb=>{if(!_0x4a6cbb['_isInit'])return!0x1;const _0x4bc1c7=this['_getAffectedRoot'](_0x4a6cbb);return _0x4bc1c7&&!this['_knownRootNames']['has'](_0x4bc1c7);});K(_0x12a1a2,this['_document']['version']),this['_applyOperationsSet'](_0x12a1a2),_0x296f84=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x515d03=this['_decompressOperations'](_0x7e1b84['data'],_0x7e1b84['metadata'])['filter'](_0x502334=>_0x502334['baseVersion']>=this['_lastServerVersion']);_0x515d03['forEach'](_0x3b8083=>this['_addKnownRoot'](_0x3b8083)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x11702d=>!_0x11702d['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x11702d))),this['_bufferedOperations']['length']&&K(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x515d03),_0x296f84=this['_handleExternalOperations'](_0x515d03,_0x7e1b84['version'],_0x7e1b84['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x296f84?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x8e8ea1,_0x27c93e,_0xb0d51f){try{const _0x1f792b={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x461131,operationsB:_0x109c11,originalOperations:_0xd22118}=_0x5e9277(_0x8e8ea1,this['_bufferedOperations'],_0x1f792b);K(_0x461131,this['_document']['version']),K(_0x109c11,_0x27c93e);for(const _0x572be5 of _0x461131){const _0x54fd7c=_0xd22118['get'](_0x572be5);_0x572be5['_authorId']=_0x54fd7c?_0x54fd7c['_authorId']:null;}_0xb0d51f&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x8e8ea1,_0xb0d51f),this['_lastSyncedOperationId']=_0xb0d51f),this['_bufferedOperations']=[..._0x109c11],this['_applyOperationsSet'](_0x461131),this['_updateServerHistory'](_0x8e8ea1);}catch(_0x476fd0){return console['error'](_0x476fd0),!0x1;}return!0x0;}['_applyOperationsSet'](_0x334178,_0x3f584c=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x5ef663=>{for(const _0x3ced72 of _0x334178)this['_knownOperations']['add'](_0x3ced72),this['_addKnownRoot'](_0x3ced72),_0x5ef663['batch']['addOperation'](_0x3ced72),this['editor']['model']['applyOperation'](_0x3ced72);});}['_addKnownRoot'](_0xf92ca8){const _0x3210ad=this['_getAffectedRoot'](_0xf92ca8);_0x3210ad&&this['_knownRootNames']['add'](_0x3210ad);}['_getAffectedRoot'](_0x46c274){let _0x512b27,_0x34fe3b;switch(_0x46c274['type']){case'insert':_0x512b27=_0x46c274['position']['root'];break;case'marker':if(_0x34fe3b=_0x46c274['newRange'],!_0x34fe3b)return null;_0x512b27=_0x34fe3b['root'];break;case'addRootAttribute':_0x512b27=_0x46c274['root'];break;case'addRoot':_0x512b27=_0x46c274['affectedSelectable'];break;case'move':_0x512b27=_0x46c274['targetPosition']['root'];break;default:return null;}return _0x512b27['rootName'];}['_updateServerHistory'](_0x59380d){_0x59380d['forEach'](_0x308e4f=>{const _0x3a3c7c=_0x308e4f['clone']();_0x3a3c7c['_authorId']=_0x308e4f['_authorId'],_0x3a3c7c['_isInit']=!!_0x308e4f['_isInit'],_0x3a3c7c['createdAt']=_0x308e4f['createdAt'],_0x3a3c7c['baseVersion']+=this['_offset'],_0x308e4f['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x3a3c7c),this['serverHistory']['addOperation'](_0x3a3c7c);});}['_handleReconnectionError'](_0x249686){const _0x554805=this['editor']['plugins']['get']('Notification'),_0x3cc10c=this['editor']['locale'];_0x249686||(_0x249686=V(_0x3cc10c,'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.')),_0x554805['showWarning'](_0x249686,{'title':V(_0x3cc10c,'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'](_0x498470)['add'](V(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x498470)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x22f5a0){const _0x48060e=_0x22f5a0['map'](_0x202dca=>_0x202dca['toJSON']());return this['_compressor']['compress'](_0x48060e);}['_decompressOperations'](_0x2fb179,_0x528d17){return this['_compressor']['decompress'](_0x2fb179)['map']((_0x19e013,_0x35ce38)=>{const _0x59f299='init'==_0x528d17[_0x35ce38]['type'];if('InsertOperation'==_0x19e013['__className']){const _0x5efb96=_0x19e013['position']['root'];!this['_document']['getRoot'](_0x5efb96)&&(this['_document']['createRoot']('$root',_0x5efb96)['_isAttached']=!0x1);}const _0x3a0b00=_0x5c77eb['fromJSON'](_0x19e013,this['_document']);return _0x3a0b00['wasUndone']=_0x19e013['wasUndone'],_0x3a0b00['_isInit']=_0x59f299,_0x3a0b00['_authorId']=_0x59f299?null:_0x528d17[_0x35ce38]['userId'],_0x3a0b00['_isDisconnection']='cs:removeUser'===_0x528d17[_0x35ce38]['type'],_0x3a0b00['createdAt']=_0x528d17[_0x35ce38]['createdAt'],_0x3a0b00;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x1b1856=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x1b1856&&_0x1b1856['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class $ extends Error{}function K(_0x10fc43,_0x513bee){for(const _0x1365ee of _0x10fc43)_0x1365ee['baseVersion']=_0x513bee++;}class J{['_ignoredOperations'];['_operationToId'];constructor(_0x29fa87){this['_ignoredOperations']=_0x29fa87,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x37c241){let _0x1332c6=_0x37c241['length'];for(;_0x1332c6--;){const _0x53538a=_0x37c241[_0x1332c6];if(!this['_ignoredOperations']['has'](_0x53538a)){if(!this['_operationToId']['has'](_0x53538a)){const _0x510e14=_0x477c16()['slice'](0x1,0x12);this['_operationToId']['set'](_0x53538a,_0x510e14);}return this['_operationToId']['get'](_0x53538a);}}}['setIdForTheLastOperation'](_0x3be9d6,_0x172e87){if(!_0x172e87)return;let _0x3fd546=_0x3be9d6['length'];for(;_0x3fd546--;){const _0xe6a8eb=_0x3be9d6[_0x3fd546];this['_ignoredOperations']['has'](_0xe6a8eb)||this['_operationToId']['set'](_0xe6a8eb,_0x172e87);}}}class a extends _0x1c2520{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x59b06d{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x504bb3)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x16cf84];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x361143){super(_0x361143),this['_services']=new Map();}async['init'](){const _0xac3e1e=this['context'],_0x197e2b=_0xac3e1e['plugins']['get']('CommentsRepository');if(_0xac3e1e['plugins']['get'](n)['addToReconnectionStack'](this),_0x197e2b['adapter']={'addCommentThread':async({channelId:_0x13251b,threadId:_0x4b0716,comments:_0x68114a,resolvedAt:_0x482e32,resolvedBy:_0x20a275,context:_0x12fe9d,attributes:_0x32a512})=>{const _0x211c8c=await this['_getService'](_0x13251b)['addCommentThread']({'commentThreadId':_0x4b0716,'comments':_0x68114a['map'](_0x63ec6f=>function(_0x2f86bb,_0x10dec4,_0x302619){return{'commentThreadId':_0x302619,'commentId':_0x2f86bb['commentId'],'userId':_0x2f86bb['authorId'],'content':_0x2f86bb['content'],'documentId':_0x10dec4,'createdAt':_0x2f86bb['createdAt'],'attributes':_0x2f86bb['attributes']||{}};}(_0x63ec6f,_0x13251b,_0x4b0716)),'resolvedAt':_0x482e32,'resolvedBy':_0x20a275,'context':_0x12fe9d,'attributes':_0x32a512})['catch'](dt);return{'threadId':_0x211c8c['commentThreadId'],'comments':_0x211c8c['comments']};},'getCommentThread':async({channelId:_0x5a7ea3,threadId:_0x54e86c})=>{const _0x23a7da=await this['_getService'](_0x5a7ea3)['getCommentThread'](_0x54e86c)['catch'](F)['catch'](dt);return _0x23a7da?_0x23a7da['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x23a7da]),{'threadId':_0x23a7da['commentThreadId'],'comments':_0x23a7da['comments']['map'](S),'context':_0x23a7da['context'],'resolvedAt':_0x23a7da['resolvedAt'],'resolvedBy':_0x23a7da['resolvedBy'],'attributes':_0x23a7da['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0xb91652,threadId:_0x52b7f9,context:_0x1e776c,unlinkedAt:_0x2f6385,attributes:_0x10f0f7})=>this['_getService'](_0xb91652)['updateCommentThread']({'commentThreadId':_0x52b7f9,'context':_0x1e776c,'attributes':_0x10f0f7,'unlinkedAt':_0x2f6385})['catch'](F)['catch'](dt),'resolveCommentThread':async({channelId:_0x346064,threadId:_0x561533})=>{const _0x5f3bb9=await this['_getService'](_0x346064)['resolveCommentThread'](_0x561533)['catch'](F)['catch'](dt);return{'threadId':_0x5f3bb9['commentThreadId'],'resolvedAt':_0x5f3bb9['resolvedAt'],'resolvedBy':_0x5f3bb9['resolvedBy']};},'reopenCommentThread':async({channelId:_0x485ba3,threadId:_0x54ff62})=>this['_getService'](_0x485ba3)['reopenCommentThread'](_0x54ff62)['catch'](F)['catch'](dt),'removeCommentThread':({channelId:_0x3a9c58,threadId:_0x29f58c})=>this['_getService'](_0x3a9c58)['removeCommentThread'](_0x29f58c)['catch'](F)['catch'](dt),'addComment':({channelId:_0x4a16d6,threadId:_0x4d0691,commentId:_0x14b0c3,content:_0x316dff,attributes:_0x519549})=>this['_getService'](_0x4a16d6)['addComment'](_0x4d0691,_0x14b0c3,_0x316dff,_0x519549)['catch'](dt),'updateComment':({channelId:_0x4e5715,threadId:_0x5a7a75,commentId:_0x2d45cf,content:_0x2ec11a,attributes:_0x7bbf0})=>this['_getService'](_0x4e5715)['updateComment'](_0x5a7a75,_0x2d45cf,_0x2ec11a,_0x7bbf0)['catch'](F)['catch'](dt),'removeComment':({channelId:_0x45e28e,threadId:_0x64f538,commentId:_0x4a9d9a})=>this['_getService'](_0x45e28e)['removeComment'](_0x64f538,_0x4a9d9a)['catch'](F)['catch'](dt)},_0xac3e1e instanceof _0x682e1){const _0x3e474b=_0xac3e1e['config']['get']('collaboration.channelId'),_0x12396a=_0xac3e1e['plugins']['get'](i);await this['_setUpService'](_0x3e474b);const _0x50ce34=await this['_services']['get'](_0x3e474b)['getConnectedSessions']();this['listenTo'](_0x12396a,'sessionAdd:'+_0x3e474b,(_0x3b5ec9,{session:_0x4ce12d})=>{_0x4ce12d['id']===_0x12396a['mySessionId']&&(_0x3b5ec9['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x4ce12d['permissions'],_0x3e474b));}),_0x12396a['register'](_0x3e474b,_0x50ce34);}}async['_setUpService'](_0x33969b){if(this['_services']['has'](_0x33969b))throw new _0x1e7226('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x33969b});const _0x3076b1=this['context']['plugins']['get']('CommentsRepository'),_0x5e820a=new s['CommentsService'](_0x33969b);this['_services']['set'](_0x33969b,_0x5e820a),this['listenTo'](_0x5e820a,'commentThreadAdded',(_0x227397,_0x1ec50d)=>{const {commentThreadId:_0x4cd5f5,documentId:_0x2b3e91,context:_0x2bf4f3,attributes:_0x4631d7,resolvedAt:_0x460b8b,resolvedBy:_0x29443d,comments:_0x141843}=_0x1ec50d;_0x3076b1['getCommentThread'](_0x4cd5f5)||_0x3076b1['addCommentThread']({'threadId':_0x4cd5f5,'channelId':_0x2b3e91,'comments':_0x141843?_0x141843['map'](S):[],'context':_0x2bf4f3,'attributes':_0x4631d7,'resolvedAt':_0x460b8b,'resolvedBy':_0x29443d,'isFromAdapter':!0x0});}),this['listenTo'](_0x5e820a,'commentThreadUpdated',(_0x22c786,{commentThreadId:_0x226c5e,documentId:_0x213865,context:_0x4da0ff,unlinkedAt:_0x58915c,attributes:_0x2c904d})=>{_0x3076b1['getCommentThread'](_0x226c5e)&&_0x3076b1['updateCommentThread']({'threadId':_0x226c5e,'channelId':_0x213865,'context':_0x4da0ff,'unlinkedAt':_0x58915c,'attributes':_0x2c904d,'isFromAdapter':!0x0});}),this['listenTo'](_0x5e820a,'commentThreadResolved',(_0x22db97,{commentThreadId:_0x4e2697,resolvedBy:_0x3f7f34,resolvedAt:_0xf565c})=>{const _0x42c76a=_0x3076b1['getCommentThread'](_0x4e2697);_0x42c76a&&_0x42c76a['resolve']({'resolvedBy':_0x3f7f34,'resolvedAt':_0xf565c,'isFromAdapter':!0x0});}),this['listenTo'](_0x5e820a,'commentThreadReopened',(_0x3b80b0,{commentThreadId:_0x25e17b})=>{const _0x5694d5=_0x3076b1['getCommentThread'](_0x25e17b);_0x5694d5&&_0x5694d5['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5e820a,'commentThreadRemoved',(_0x36f6f0,{commentThreadId:_0x37cd29})=>{const _0x23afbd=_0x3076b1['getCommentThread'](_0x37cd29);_0x23afbd&&_0x23afbd['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5e820a,'commentAdded',(_0x5b3639,_0x2ea5ae)=>{const _0x1aeaad=_0x2ea5ae['commentThreadId'],_0x539a26=_0x3076b1['getCommentThread'](_0x1aeaad);_0x539a26&&_0x539a26['addComment']({...S(_0x2ea5ae),'isFromAdapter':!0x0});}),this['listenTo'](_0x5e820a,'commentUpdated',(_0xdd74f8,{commentThreadId:_0x3127ee,commentId:_0x4f8f21,content:_0x33c662,attributes:_0x57e35c})=>{const _0x5bef2d=_0x3076b1['getCommentThread'](_0x3127ee);if(_0x5bef2d){const _0x37783b=_0x5bef2d['getComment'](_0x4f8f21);_0x37783b&&_0x37783b['update']({'content':_0x33c662,'attributes':_0x57e35c,'isFromAdapter':!0x0});}}),this['listenTo'](_0x5e820a,'commentRemoved',(_0x358b8e,{commentThreadId:_0x5c4877,commentId:_0x121d16})=>{const _0x511005=_0x3076b1['getCommentThread'](_0x5c4877);if(_0x511005){const _0x460ee6=_0x511005['getComment'](_0x121d16);_0x460ee6&&_0x460ee6['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x33969b);}['destroy'](){if(this['context']instanceof _0x682e1){const _0x5a0ed0=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x5a0ed0);}}['_terminateService'](_0x39b6f3){if(!this['_services']['has'](_0x39b6f3))throw new _0x1e7226('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x39b6f3});this['_getService'](_0x39b6f3)['disconnect'](),this['_services']['delete'](_0x39b6f3);}async['reconnect'](){for(const _0x23f01e of this['_services']['keys']())await this['_connectService'](_0x23f01e);if(this['context']instanceof _0x682e1){const _0x8177e4=this['context']['config']['get']('collaboration.channelId'),_0x3d34f6=this['context']['plugins']['get'](i);_0x3d34f6['unregister'](_0x8177e4);const _0x1fbbcb=await this['_services']['get'](_0x8177e4)['getConnectedSessions']();_0x3d34f6['register'](_0x8177e4,_0x1fbbcb);}}async['_connectService'](_0x139376){const {connection:_0x4b775b}=this['context']['plugins']['get'](n),_0x279068=this['context']['plugins']['get']('CommentsRepository'),_0x2171cd=this['_services']['get'](_0x139376),_0x4afb9f=await _0x2171cd['connect'](_0x4b775b);await this['_fetchMissingUsersForThreads'](_0x4afb9f);const _0x20ae2a=new Set(Array['from'](_0x279068['getCommentThreads']({'channelId':_0x139376}),_0x47cd95=>_0x47cd95['id']));for(const _0x20a006 of _0x4afb9f)_0x20a006['deletedAt']||_0x20ae2a['delete'](_0x20a006['commentThreadId']);for(const _0x3827c of _0x20ae2a)_0x279068['getCommentThread'](_0x3827c)['remove']({'isFromAdapter':!0x0});for(const _0x369730 of _0x4afb9f){let _0x3772cb=_0x279068['getCommentThread'](_0x369730['commentThreadId']);const {commentThreadId:_0x46e22f,context:_0x537145,attributes:_0x34a998,resolvedBy:_0x379245,resolvedAt:_0x4e3491,unlinkedAt:_0x14140e,deletedAt:_0x3508e7}=_0x369730;if(_0x3508e7)continue;_0x3772cb||(_0x3772cb=_0x279068['addCommentThread']({'channelId':_0x139376,'threadId':_0x46e22f,'context':_0x537145,'attributes':_0x34a998||{},'resolvedBy':_0x379245,'resolvedAt':_0x4e3491,'unlinkedAt':_0x14140e,'isFromAdapter':!0x0}));const _0x461a9b=new Set(Array['from'](_0x3772cb['comments'],_0x33d519=>_0x33d519['id']));for(const _0x290132 of _0x369730['comments'])_0x461a9b['delete'](_0x290132['commentId']);for(const _0x4ec0be of _0x461a9b)_0x3772cb['getComment'](_0x4ec0be)['remove']({'isFromAdapter':!0x0});for(const _0x57f549 of _0x369730['comments']){const _0x5d54b7=_0x3772cb['getComment'](_0x57f549['commentId']);_0x5d54b7?_0x5d54b7['content']!==_0x57f549['content']&&_0x5d54b7['update']({'content':_0x57f549['content'],'isFromAdapter':!0x0}):_0x3772cb['addComment'](Object['assign'](S(_0x57f549),{'isFromAdapter':!0x0}));}}}['_getService'](_0x52c794){if(!this['_services']['has'](_0x52c794))throw new _0x1e7226('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x52c794});return this['_services']['get'](_0x52c794);}async['_fetchMissingUsersForThreads'](_0x576357){const _0x1f42b9=this['context']['plugins']['get'](_0x16cf84),{connection:_0x5a9c3b}=this['context']['plugins']['get'](n),_0x530aef=new Set();for(const {resolvedBy:_0x515535,comments:_0x379d6c}of _0x576357){_0x515535&&!_0x1f42b9['getUser'](_0x515535)&&_0x530aef['add'](_0x515535);for(const {userId:_0x260184}of _0x379d6c)_0x1f42b9['getUser'](_0x260184)||_0x530aef['add'](_0x260184);}if(0x0===_0x530aef['size'])return;const _0x3d880c=await lt['getMany'](_0x5a9c3b,Array['from'](_0x530aef));for(const _0x4008fd of _0x3d880c)_0x1f42b9['getUser'](_0x4008fd['id'])||_0x1f42b9['addUser'](_0x4008fd);}}async function F(_0x7f064c){if('404'!==_0x7f064c['code'])throw _0x7f064c;}function dt(_0x58a3ff){if((_0x1bdf5b=_0x58a3ff)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x1bdf5b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1bdf5b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x1bdf5b;throw _0x58a3ff;}function S(_0x5343de){return{'threadId':_0x5343de['commentThreadId'],'commentId':_0x5343de['commentId'],'content':_0x5343de['content'],'createdAt':_0x5343de['createdAt'],'authorId':_0x5343de['userId'],'attributes':_0x5343de['attributes']||{}};}class m extends _0x1c2520{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x16cf84];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1b966e){super(_0x1b966e);const _0x239895=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x239895);}async['init'](){const _0x14b45c=this['editor']['plugins']['get'](l),_0x260016=_0x14b45c['serverHistory'],_0x5b1713=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x260016,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x14b45c['sessionId']});const _0x8ee361=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x140ae1=await tt['isBundleUploaded'](_0x5b1713['connection'],_0x8ee361);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x4d2917})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x4d2917)),'updateRevisions':async _0x5a4854=>{await this['_waitForServiceReady']();const _0x34c641=this['_revisionTracker']['currentRevision'];if(_0x140ae1&&0x1===_0x5a4854['length']&&_0x5a4854[0x0]['id']===_0x34c641['id'])return _0x5a4854;for(const _0x20fc86 of _0x5a4854)_0x20fc86['id']===_0x34c641['id']&&(_0x20fc86['isEmptyCurrent']=_0x20fc86['fromVersion']===_0x20fc86['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x5a4854,this['_lastRequestId'])['then'](_0x195f53=>(this['_lastRequestId']=_0x195f53,_0x5a4854))['catch'](_0x29ae20=>{if(st(_0x29ae20)||'400'===_0x29ae20['code']&&void 0x0!==_0x29ae20['data']['wrongRequestId']){for(const _0x4d1ca7 of _0x5a4854){!this['_revisionTracker']['repository']['getRevision'](_0x4d1ca7['id'])||this['_revisionTracker']['_bufferUpdate'](_0x4d1ca7['id'],_0x4d1ca7,!0x1);}if(st(_0x29ae20))throw _0x29ae20;return _0x5a4854;}throw _0x29ae20;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x359097,{revisionsData:_0x186b8d,requestId:_0x3bfc8d})=>{Math['max'](..._0x186b8d['map'](_0x4db51d=>_0x4db51d['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x186b8d,_0x3bfc8d);}):this['_handleRevisionsUpdate'](_0x186b8d,_0x3bfc8d);});const {revisions:_0x6ea220,requestId:_0xfab339}=await this['_revisionHistoryService']['connect'](_0x5b1713['connection']);_0x5b1713['addToReconnectionStack'](this),this['_lastRequestId']=_0xfab339,await this['_fetchMissingUsers'](_0x6ea220);for(const _0x25bb6f of _0x6ea220)this['_revisionTracker']['addRevisionData'](_0x25bb6f);this['listenTo'](_0x14b45c,'change:_isConnected',(_0x3a20b0,_0x14d78d,_0x53f876)=>{_0x53f876&&(this['_oldOffset']=_0x14b45c['_offset'],_0x3a20b0['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x5b1713,'state',_0x8e6ce7=>_0x8e6ce7===te['CONNECTED']);}async['reconnect'](){const _0x2c1443=this['editor']['plugins']['get'](n),_0x3d0b52=this['editor']['plugins']['get'](l),_0xa5a8f4=async()=>{const _0x206c4b=this['_revisionTracker']['currentRevision'],_0x2a3009=_0x206c4b['id'],_0x1ae53c=_0x2a3009!==_0x3d0b52['sessionId'];if(_0x1ae53c){const _0x26bf2a=_0x3d0b52['_offset']-this['_oldOffset'],_0x1a9955=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x206c4b['toVersion']+_0x26bf2a!==_0x1a9955){const _0x5bb637=_0x206c4b['fromVersion']+_0x26bf2a,_0x3575bd=this['editor']['plugins']['get'](_0x16cf84),_0x1892ca=this['_revisionTracker']['buildRevisionData']({'revision':_0x206c4b,'from':_0x5bb637,'to':_0x1a9955});_0x1892ca['id']=_0x206c4b['id'];const _0x2d42d2=_0x1892ca['authorsIds']['map'](_0x2fe6b5=>_0x3575bd['getUser'](_0x2fe6b5));_0x206c4b['_update']({..._0x1892ca,'authors':_0x2d42d2},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x206c4b['id'],_0x1892ca,!0x0);}this['_revisionTracker']['_startingVersion']=_0x1a9955,(_0x206c4b['toVersion']===_0x206c4b['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x2a3009)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x2a3009),this['_revisionTracker']['_createCurrentRevision'](_0x1a9955));}const {revisions:_0x2ca698,requestId:_0x5a8df8}=await this['_revisionHistoryService']['reconnect'](_0x2c1443['connection'],this['_lastRequestId']);_0x1ae53c&&_0x2ca698['length']>0x0?_0x3d0b52['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x2ca698),this['_handleRevisionsUpdate'](_0x2ca698,_0x5a8df8),this['_revisionTracker']['sendBufferedUpdates']());};return _0x3d0b52['_isConnected']?_0xa5a8f4():new Promise((_0x508f80,_0x2d775b)=>{_0x3d0b52['once']('change:_isConnected',()=>{_0xa5a8f4()['then'](_0x508f80)['catch'](_0x2d775b);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5d4797=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x16f267=>{_0x16f267['off'](),_0x5d4797();});});}['_getLatestVersionFromServerOperations'](){const _0x46d0e4=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x1b276d of _0x46d0e4)if('marker'!==_0x1b276d['type']||_0x1b276d['affectsData'])return _0x1b276d['baseVersion']+0x1;}['_getLatestVersion'](){const _0x565b48=this['editor']['plugins']['get'](l);return new Promise(_0x585db0=>{_0x565b48['_isPendingUpdate']?_0x565b48['once']('change:_isPendingUpdate',()=>{_0x585db0(this['_getLatestVersionFromServerOperations']());}):_0x585db0(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0xa40a87,_0x5a2b79){const _0xa3debf=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x5a2b79;for(const _0x1c7b75 of _0xa40a87){const _0x5f235f=_0xa3debf['getRevision'](_0x1c7b75['id']);if(_0x5f235f){if((_0x1c7b75['fromVersion']||_0x1c7b75['toVersion'])&&(_0x1c7b75['diffData']=null),_0x5f235f===this['_revisionTracker']['currentRevision']){const _0x258b22=Math['max'](_0x5f235f['toVersion'],_0x1c7b75['toVersion']),_0xa57b39=Math['max'](_0x5f235f['fromVersion'],_0x1c7b75['fromVersion']);let _0x5be8e4;_0x5f235f['toVersion']===_0x1c7b75['toVersion']&&_0x5f235f['fromVersion']===_0x1c7b75['fromVersion']?(_0x5be8e4=!0x0,this['_preventResendingRevisionData'](_0x1c7b75)):_0x1c7b75['toVersion']===_0x258b22&&_0x1c7b75['fromVersion']===_0xa57b39?_0x5be8e4=!0x1:(_0x5f235f['toVersion']===_0x258b22&&_0x5f235f['fromVersion']===_0xa57b39||this['_fixRevision']({'revision':_0x5f235f,'from':_0xa57b39,'to':_0x258b22}),_0x5be8e4=!0x0),_0x5be8e4&&(delete _0x1c7b75['fromVersion'],delete _0x1c7b75['toVersion'],delete _0x1c7b75['diffData'],delete _0x1c7b75['createdAt'],delete _0x1c7b75['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x1c7b75),this['_preventResendingRevisionData'](_0x1c7b75);}else this['_revisionTracker']['addRevisionData'](_0x1c7b75);}const _0x9cc0ff=_0xa3debf['getRevisions']();_0x9cc0ff['reverse']();for(let _0x44470f=0x0;_0x44470f<_0x9cc0ff['length']-0x1;_0x44470f++){const _0x5224ac=_0x9cc0ff[_0x44470f],_0x189c31=_0x9cc0ff[_0x44470f+0x1];if(_0x5224ac['fromVersion']<_0x189c31['toVersion']){const _0x221c2a=_0x189c31['toVersion'],_0x4dd1f2=Math['max'](_0x221c2a,_0x5224ac['toVersion']);this['_fixRevision']({'revision':_0x5224ac,'from':_0x221c2a,'to':_0x4dd1f2});}}}['_fixRevision']({revision:_0x263713,from:_0x10b13f,to:_0x2582f9}={}){const _0x17cc18=this['editor']['plugins']['get'](_0x16cf84),_0x5367ee=this['_revisionTracker']['buildRevisionData']({'revision':_0x263713,'from':_0x10b13f,'to':_0x2582f9});_0x5367ee['authors']=_0x5367ee['authorsIds']['map'](_0x3dd5e5=>_0x17cc18['getUser'](_0x3dd5e5)),_0x263713['_update'](_0x5367ee);}['_preventResendingRevisionData'](_0x12b52e){const _0x3e9da0={};_0x3e9da0['id']=_0x12b52e['id'];for(const _0x3a4b84 of Object['keys'](_0x12b52e))'id'!==_0x3a4b84&&(_0x3e9da0[_0x3a4b84]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x3e9da0['id'],_0x3e9da0,!0x0);}async['_fetchMissingUsers'](_0x336293){const _0xe017e2=this['editor']['plugins']['get'](_0x16cf84),{connection:_0x3c1cb5}=this['editor']['plugins']['get'](n),_0x33414e=new Set();for(const _0x128ce1 of _0x336293){for(const _0xe2ca2a of _0x128ce1['authorsIds'])_0xbf1383(_0xe2ca2a);_0x128ce1['creatorId']&&_0xbf1383(_0x128ce1['creatorId']);}if(0x0===_0x33414e['size'])return;const _0x2bf180=await lt['getMany'](_0x3c1cb5,Array['from'](_0x33414e));for(const _0x53df69 of _0x2bf180)_0xe017e2['getUser'](_0x53df69['id'])||_0xe017e2['addUser'](_0x53df69);function _0xbf1383(_0x96ea36){_0xe017e2['getUser'](_0x96ea36)||_0x33414e['add'](_0x96ea36);}}}function st(_0x425f99){return _0x425f99['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x425f99['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x425f99['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class mt extends _0x1c2520{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 _0x97363b{['_collapseAt'];constructor(_0x32c070,_0x10ff24=0x6){super(_0x32c070);const _0x28ac97=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x10ff24,this['bind']('isHidden')['to'](this,'usersCount',_0x2ec924=>_0x2ec924<_0x10ff24),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x28ac97['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':_0x28ac97['to']('usersCount',_0x4a7977=>'+'+(_0x4a7977-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x97363b{['items'];['keystrokes'];constructor(_0x26a514){super(_0x26a514);const _0x378cbc=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x5fd7b6(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x378cbc['if']('hasPopup'),'aria-expanded':_0x378cbc['to']('isExpanded',_0x4881ab=>this['hasPopup']&&String(_0x4881ab)),'aria-label':_0x378cbc['to']('hasPopup',_0x2c8d4a=>V(_0x26a514,_0x2c8d4a?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x378cbc['to']('hasPopup',_0x4a5664=>!!_0x4a5664&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x378cbc['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x378cbc['to'](_0x4dc23d=>{const _0x139ddf=_0x4dc23d,_0x1fcc20=document['querySelector']('.ck-presence-list__dropdown-list'),_0x5e2902=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1fcc20?.['contains'](_0x139ddf['relatedTarget'])||_0x5e2902?.['contains'](_0x139ddf['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x1431e7,_0x2df9ae,_0x186d03)=>{this['element']&&(_0x186d03?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 _0x97363b{['counterView'];['inlineListView'];constructor(_0x35b306,_0x26324f=0x6){super(_0x35b306);const _0x199642=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x26324f),this['inlineListView']=new is(_0x35b306),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x7181b6 of this['inlineListView']['items'])_0x7181b6['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',_0x199642['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x97363b{['listWrapperView'];constructor(_0x3be39e,_0x6c059b){super(_0x3be39e);const _0x5435de=this['bindTemplate'];this['listWrapperView']=new pt(_0x3be39e,_0x6c059b),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':V(_0x3be39e,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x5435de['to'](_0x5b02b3=>{const _0x583f70=_0x5b02b3,_0x10b1a7=document['querySelector']('.ck-presence-list__list'),_0x304b0e=document['querySelector']('.ck-balloon-panel_with-arrow');_0x10b1a7?.['contains'](_0x583f70['relatedTarget'])||_0x304b0e?.['contains'](_0x583f70['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class pt extends _0x4e2138{constructor(_0x3a6b0a,_0x53e47d){super(_0x3a6b0a);const _0xe08a37=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x53e47d?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0xe08a37['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0xe08a37['to']('role'),'aria-label':_0xe08a37['to']('ariaLabel'),'aria-labelledby':_0xe08a37['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0xca9fbc['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x5dba0f=this['element'];_0x5dba0f&&(this['_isScrollable']=Math['max'](_0x5dba0f['scrollHeight'],_0x5dba0f['clientHeight'])>0.8*window['innerHeight']);}}class j extends rt{['userView'];constructor(_0x50d88b,_0xca9083,_0x3ba45f){super(_0x50d88b);const _0x2bd5b9=this['bindTemplate'];this['userView']=new ct(_0x50d88b,_0xca9083);const _0x51b5a7={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0xca9083['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0xca9083['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xca9083['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x3ba45f&&(_0x51b5a7['tag']='button',_0x51b5a7['on']={'click':_0x2bd5b9['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x51b5a7);}['focus'](){this['element']['focus']();}}class A extends _0x97363b{['userView'];['markerView'];constructor(_0x711d5,_0x8ffad0,_0x3c0dc1){super(_0x711d5);const _0x5810ef=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x711d5,_0x8ffad0),this['markerView']=new at(_0x711d5,_0x8ffad0);const _0x3c5f93=new ot(_0x711d5);_0x3c5f93['template']['tag']='span',_0x3c5f93['text']=_0x8ffad0['name'];const _0x3bbb8c={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5810ef['to']('isFocusable',_0x34d06d=>!!_0x34d06d&&0x0),'aria-labelledby':_0x3c5f93['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5810ef['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5810ef['to']('hasTooltip',_0x3fd178=>!_0x3fd178),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x3c5f93]};_0x3c0dc1&&(_0x3bbb8c['tag']='button',_0x3bbb8c['on']={'click':_0x5810ef['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x3bbb8c);}}class at extends _0x97363b{constructor(_0x2d1bf2,_0x56e93f){super(_0x2d1bf2),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x56e93f['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x59b06d{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x296499){super(_0x296499),this['context']['config']['define']('presenceList',x);const _0x1c56cd=_0x296499['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x1c56cd)throw new _0x1e7226('presencelist-collapseat-invalid-format',this);if(_0x1c56cd<0x1)throw new _0x1e7226('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x1ad15d(),this['balloonPanelView']=new _0x21440a(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x5705e4 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x5705e4);this['listenTo'](this['_allConnectedUsers'],'add',(_0x4bdf7e,_0x4c37d7)=>{this['_handleUserAdd'](_0x4c37d7);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x1edfdf,_0x18ead1)=>{this['_handleUserRemove'](_0x18ead1);});}['_createView'](){const _0x472207=this['context'],_0x601428=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x11f496=this['balloonPanelView'];if(!_0x1e927f(_0x472207['config']['get']('presenceList.container')))throw new _0x1e7226('presencelist-missing-container',this);return _0x601428['counterView']['bind']('usersCount')['to'](this),_0x601428['bind']('isCollapsed')['to'](this,'usersCount',_0x2b8317=>{const {collapseAt:_0x43945b}=_0x472207['config']['get']('presenceList'),_0x32fcb7=_0x2b8317>=_0x43945b;if(_0x32fcb7&&!_0x601428['inlineListView']['items']['find'](_0xfa8f61=>_0xfa8f61 instanceof b)){const _0x1cc384=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x1cc384&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x601428['inlineListView']['items']['add'](_0x601428['counterView']);}return _0x32fcb7||this['hideDropdown'](),_0x32fcb7;}),_0x601428['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1e2697=>{const _0x4b9fb9=_0x472207['config']['get']('presenceList'),_0x3a1007=new A(_0x472207['locale'],_0x1e2697,!!_0x4b9fb9['onClick']);return _0x3a1007['bind']('hasTooltip')['to'](_0x601428,'isCollapsed',_0xd244a3=>!_0xd244a3),_0x3a1007['bind']('isFocusable')['to'](_0x601428,'isCollapsed',_0x553d25=>!_0x553d25),_0x4b9fb9['onClick']&&this['listenTo'](_0x3a1007,'execute',()=>{this['view']['isCollapsed']||_0x4b9fb9['onClick'](_0x1e2697,_0x3a1007['element']);}),_0x3a1007;}),this['listenTo'](_0x601428['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x601428['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x601428['inlineListView']['keystrokes']['set']('Enter',(_0x2a5c32,_0x23f9ed)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x23f9ed());}),_0x601428['render'](),_0x11f496['render'](),_0x1b8fa0({'emitter':_0x601428,'activator':()=>_0x11f496['isVisible'],'contextElements':[_0x11f496['element'],_0x601428['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x472207['config']['get']('presenceList.container')['appendChild'](_0x601428['element']),this['_bodyCollection']=new _0x7881da(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x601428;}['_handleUserAdd'](_0x380e3a){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x380e3a['isMe'])return;const _0x19c46a=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x19c46a-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x152e48=_0x380e3a['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x380e3a,_0x152e48);}['_handleUserRemove'](_0x4b7c41){this['usersCount']--;const {collapseAt:_0x181b2a}=this['context']['config']['get']('presenceList'),_0x4f3557=this['usersCount']>=_0x181b2a;if(this['currentDisplayedUsers']['get'](_0x4b7c41['id']))this['currentDisplayedUsers']['remove'](_0x4b7c41['id']);else{if(_0x4f3557&&this['currentDisplayedUsers']['length']+0x1===_0x181b2a-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x4f3557?0x1:0x0)<this['usersCount']){for(const _0x15bac7 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x15bac7['id'])&&(this['currentDisplayedUsers']['add'](_0x15bac7,Math['min'](this['currentDisplayedUsers']['length']-(_0x4f3557?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x4f3557?0x1:0x0)===_0x181b2a-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x5650fa=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x5650fa['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x3d14f0}=this['presenceDropdownView'];_0x3d14f0['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x481d4b=>{if(!_0x5650fa['displayMe']&&_0x481d4b['isMe'])return null;const _0x2b37aa=new j(this['context']['locale'],_0x481d4b,!!_0x5650fa['onClick']);return _0x5650fa['onClick']&&this['listenTo'](_0x2b37aa,'execute',()=>{_0x5650fa['onClick'](_0x481d4b,_0x2b37aa['element']);}),_0x2b37aa;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x3d14f0['focus'](),_0x3d14f0['checkIfScrollable']();const _0x50e1cb=(_0x1cd1da,_0x1e64e1)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x1e64e1();};_0x3d14f0['keystrokes']['set']('Esc',_0x50e1cb),_0x3d14f0['keystrokes']['set']('Shift+Tab',_0x50e1cb),_0x3d14f0['keystrokes']['set']('Tab',(_0x6700e3,_0x3a90c8)=>{!function(_0x340a8a){const _0x4e6604=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x17c53a=>_0x17c53a+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x4cab4a=[...document['body']['querySelectorAll'](_0x4e6604)]['filter'](_0x34d6c1=>_0x34d6c1===document['activeElement']||_0x34d6c1['offsetWidth']+_0x34d6c1['offsetHeight']>0x0)['sort']((_0x5c9853,_0x28e7ee)=>(_0x5c9853['tabIndex']||0x0)-(_0x28e7ee['tabIndex']||0x0)),_0x2bb968=_0x4cab4a['indexOf'](_0x340a8a),_0x48235c=_0x4cab4a[(_0x2bb968+0x1)%_0x4cab4a['length']];_0x48235c&&_0x48235c['focus']();}(this['view']['element']),this['hideDropdown'](),_0x3a90c8();}),_0x3d14f0['focusTracker']['add'](this['view']['element']),_0x3d14f0['focusTracker']['on']('change:isFocused',(_0x1219d5,_0x33b986,_0x30dc7a)=>{_0x30dc7a||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 gt extends _0x59b06d{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,gt as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,mt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway};
|
|
23
|
+
import{ContextPlugin as _0x382514,Plugin as _0x5020b7,PendingActions as _0xfa099b,Context as _0x1bb185}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x1e311d,CKEditorError as _0x5eee32,Collection as _0x6d1a51,global as _0x423bdf,version as nt,uid as _0x26c052,KeystrokeHandler as _0x3b9efd}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x1dfd40,View as _0x45849d,ListView as _0x2b176e,ListItemView as et,LabelView as it,BalloonPanelView as _0x2c0dd5,clickOutsideHandler as _0x4693a3,BodyCollection as _0x59e840}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x578e05,History as _0x1fc730,NoOperation as _0x158a54,InsertOperation as _0x159a57,MarkerOperation as _0x45b8bd,RootAttributeOperation as _0x51c0ef,transformOperationSets as _0x5237c5,OperationFactory as _0x49b61a}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as rt,WEB_SOCKET_GATEWAY_STATES as _0x58fce9,CollaborativeEditingService as _0x18f578,User as ct,CommentsService as _0x8fe397,TrackChangesService as tt,RevisionHistoryService as _0x4bbbc8,EditorService as _0x23f175}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x5df8af,UserView as st}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x5bed56}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0xf1dc26}from'es-toolkit/compat';class n extends _0x382514{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>rt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x1dfd40];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x226c55){super(_0x226c55),this['set']('state',_0x58fce9['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x1e311d())();}['init'](){const _0x4ead8a=this['context'],_0x25ec43=_0x4ead8a['plugins']['get']('CloudServices'),_0x195c7f=_0x4ead8a['plugins']['get'](_0x1dfd40);if(!_0x25ec43['token'])throw new _0x5eee32('websocketgateway-missing-token',this);if(!_0x25ec43['webSocketUrl'])throw new _0x5eee32('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'](_0x25ec43['token'],_0x25ec43['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x58de23=>{if(this['connection']=_0x58de23,this['bind']('state')['to'](_0x58de23,'state',this,'_isBrowserOffline',(_0x29036d,_0x1b4a50)=>('connected'!==_0x29036d&&(this['_shouldPluginsReconnect']=!0x0),_0x1b4a50||_0x29036d!==_0x58fce9['CONNECTED']?_0x58fce9['DISCONNECTED']:this['state']==_0x58fce9['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x58fce9['CONNECTING']):_0x58fce9['CONNECTED'])),this['connection']['on']('error',(_0x399615,_0x38fdbc)=>{if('limitExceeded'!==_0x38fdbc['code'])throw console['error'](_0x38fdbc),new _0x5eee32('cloudservices-init',null,{'originalError':_0x38fdbc});_0x195c7f['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'});}),!_0x58de23['me'])return new Promise(_0x3729ea=>_0x58de23['on']('change:me',_0x3729ea));})['catch'](_0x297604=>{throw console['error'](_0x297604),new _0x5eee32('cloudservices-init',null,{'originalError':_0x297604});});}['addToReconnectionStack'](_0x3c6a0a){if('function'!=typeof _0x3c6a0a['reconnect'])throw new _0x5eee32('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x3c6a0a))throw new _0x5eee32('websocketgateway-plugin-already-registered',this,{'name':_0x3c6a0a['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x3c6a0a);}['removeFromReconnectionStack'](_0x5786cd){this['_reconnectionStack']['delete'](_0x5786cd);}['isInReconnectionStack'](_0x3a64f1){return this['_reconnectionStack']['has'](_0x3a64f1);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x57636c=>_0x57636c['reconnect']())))['then'](()=>this['state']=_0x58fce9['CONNECTED'])['catch'](_0x1cd118=>{throw console['error'](_0x1cd118),new _0x5eee32('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x58fce9['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x382514{['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,_0x5df8af];}constructor(_0x7fb293){super(_0x7fb293),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x6d1a51(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x5df8af);}['init'](){const _0x4fe803=this['context']['plugins']['get'](n);this['listenTo'](_0x4fe803,'change:state',(_0x320a07,_0x285fc2,_0x4aacc7)=>{if('connected'!==_0x4aacc7)this['channelSessions']['forEach'](_0x5534f7=>_0x5534f7['clear']()),this['channelConnectedUsers']['forEach'](_0x227724=>_0x227724['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x1116b4,_0x4bf0cf]of this['_registeredSessions'])for(const _0x4dca6e of _0x4bf0cf)this['_handleSessionAdd'](_0x1116b4,_0x4dca6e);}}),this['_createUser'](_0x4fe803['connection']['me'],!0x0);}['register'](_0x4c1906,_0x4f7336){if(this['_registeredSessions']['has'](_0x4c1906))throw new _0x5eee32('sessions-register-already-registered',null,{'channelId':_0x4c1906});this['_registeredSessions']['set'](_0x4c1906,_0x4f7336),this['channelSessions']['set'](_0x4c1906,new _0x6d1a51()),this['channelConnectedUsers']['set'](_0x4c1906,new _0x6d1a51()),this['listenTo'](_0x4f7336,'add',(_0x478d1a,_0x125086)=>this['_handleSessionAdd'](_0x4c1906,_0x125086)),this['listenTo'](_0x4f7336,'remove',(_0x20f4b4,_0x1a6355)=>this['_handleSessionRemove'](_0x4c1906,_0x1a6355));for(const _0x4f034f of _0x4f7336)this['_handleSessionAdd'](_0x4c1906,_0x4f034f);}['unregister'](_0x34bbf3){if(!this['_registeredSessions']['has'](_0x34bbf3))throw new _0x5eee32('sessions-unregister-not-exist',null,{'channelId':_0x34bbf3});const _0x328ea5=this['_registeredSessions']['get'](_0x34bbf3);this['stopListening'](_0x328ea5);for(const _0x156b0b of _0x328ea5)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x34bbf3,_0x156b0b);this['_registeredSessions']['delete'](_0x34bbf3),this['channelSessions']['delete'](_0x34bbf3),this['channelConnectedUsers']['delete'](_0x34bbf3);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x377579){for(const _0x22da5a of this['channelSessions']['values']())for(const _0x4224aa of _0x22da5a)if(_0x4224aa['id']===_0x377579)return _0x4224aa['user'];}['getUserSessions'](_0x4f7d41,_0x2bd75e){const _0x58d40a=_0x2bd75e?[this['channelSessions']['get'](_0x2bd75e)]:this['channelSessions']['values'](),_0x3dcd4f=new Set();for(const _0x485131 of _0x58d40a)for(const _0x3d3db2 of _0x485131)_0x3d3db2['user']['id']===_0x4f7d41['id']&&_0x3dcd4f['add'](_0x3d3db2['id']);return _0x3dcd4f;}['getUserRole'](_0x1307fe){for(const _0x4286b4 of this['channelSessions']['values']())for(const _0x3608e9 of _0x4286b4)if(_0x3608e9['user']===_0x1307fe)return _0x3608e9['role'];}['_handleSessionAdd'](_0x434d60,_0x327f46){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x149bb2=_0x327f46['user'],_0x847228=this['_users']['getUser'](_0x149bb2['id'])||this['_createUser'](_0x149bb2),_0x3326c1=Object['assign']({},_0x327f46,{'user':_0x847228});if(this['channelSessions']['get'](_0x434d60)['add'](_0x3326c1),!_0x149bb2['hiddenInPresenceList']){const _0x185378=this['channelConnectedUsers']['get'](_0x434d60);_0x185378['has'](_0x847228['id'])||_0x185378['add'](_0x847228),this['allConnectedUsers']['has'](_0x847228['id'])||_0x149bb2['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x847228,_0x847228['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x434d60,{'channelId':_0x434d60,'session':_0x3326c1});}['_handleSessionRemove'](_0x134296,_0x2fe271){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x5a0f50=this['channelConnectedUsers']['get'](_0x134296),_0x19f24d=_0x2fe271['user'];_0x19f24d['id']&&(this['channelSessions']['get'](_0x134296)['remove'](_0x2fe271['id']),_0x5a0f50['has'](_0x19f24d['id'])&&!this['getUserSessions'](_0x19f24d,_0x134296)['size']&&_0x5a0f50['remove'](_0x19f24d['id']),this['allConnectedUsers']['get'](_0x19f24d['id'])&&!this['getUserSessions'](_0x19f24d)['size']&&this['allConnectedUsers']['remove'](_0x19f24d['id']));}['_createUser'](_0x34658b,_0x362c33){const _0x5ab93a=this['_users']['addUser'](_0x34658b);return _0x362c33&&this['_users']['defineMe'](_0x34658b['id']),_0x5ab93a['orderNumber']=this['_uniqueUsersCount']++,_0x5ab93a;}}class G extends _0x5020b7{['_domEmitter']=new(_0x1e311d())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1acedc=this['editor'],_0x2b5b5a=_0x1acedc['plugins']['get'](i);_0x1acedc['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x592ff9,{writer:_0xfabaae})=>function(_0x189ac1,_0x3ad066,_0x472738,_0x43fa44){const _0x292c07=_0x189ac1['markerName']['split'](':')[0x2],_0x1f1268=_0x472738['getUserBySessionId'](_0x292c07);if(!_0x1f1268||_0x292c07===_0x472738['mySessionId'])return;if(!_0x43fa44['model']['schema']['checkChild'](_0x189ac1['markerRange']['start'],'$text'))return;const _0x54c5f9={'class':'ck-user__marker\x20'+_0x1f1268['color']['getMarkerClass'](),'data-name':_0x1f1268['name'],'data-session-id':_0x292c07},_0x147a42=_0x43fa44['model']['markers']['get'](_0x189ac1['markerName']),_0x3412bd=_0x147a42['getStart'](),_0x40e251=_0x3412bd['nodeAfter'],_0x4e338e=_0x43fa44['model']['schema'];if(_0x40e251&&_0x4e338e['isObject'](_0x40e251)&&_0x4e338e['isInline'](_0x40e251)&&!_0x43fa44['model']['markers']['get']('user:range:'+_0x292c07)['getRange']()['isCollapsed'])return;const _0x3a2b84=_0x3412bd['parent'];return _0x43fa44['model']['schema']['isLimit'](_0x3a2b84)&&!_0x43fa44['model']['hasContent'](_0x3a2b84)&&(_0x54c5f9['contenteditable']=!0x1),function(_0x380a6a,_0x3d91a5,_0xc21f17){const _0xe7dc43=_0x380a6a['createUIElement']('span',_0x3d91a5);return _0x380a6a['setCustomProperty']('userPositionMarker',!0x0,_0xe7dc43),_0xe7dc43['render']=function(_0x5ea6c3){const _0x52b2c8=this['toDomElement'](_0x5ea6c3),_0x460a15=document['createElement']('span');return _0x460a15['classList']['add']('ck-user__marker-tooltip'),_0x460a15['setAttribute']('contenteditable','false'),_0x460a15['setAttribute']('spellcheck','false'),_0x460a15['textContent']=_0xc21f17['name'],_0x52b2c8['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x460a15['outerHTML']+'',_0x52b2c8['addEventListener']('mouseenter',()=>{_0x52b2c8['classList']['add']('ck-user__marker_hovered');}),_0x52b2c8['addEventListener']('mouseleave',()=>{_0x52b2c8['classList']['remove']('ck-user__marker_hovered');}),_0x52b2c8;},_0xe7dc43['isSimilar']=function(_0x205739){return!(!this['getCustomProperty']('userPositionMarker')||!_0x205739['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x205739['getAttribute']('data-session-id'));},_0xe7dc43;}(_0x3ad066,_0x54c5f9,_0x1f1268);}(_0x592ff9,_0xfabaae,_0x2b5b5a,_0x1acedc)}),_0x1acedc['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0xde3611=>function(_0x383817,_0x5452c1){const _0x16bcc5=_0x383817['markerName']['split'](':')[0x2];if(_0x16bcc5===_0x5452c1['mySessionId'])return null;const _0x547254=_0x5452c1['getUserBySessionId'](_0x16bcc5);if(!_0x547254)return{'id':_0x16bcc5,'classes':[]};return{'id':_0x16bcc5,'classes':['ck-user__selection',_0x547254['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x16bcc5},'priority':0x7d0+_0x547254['orderNumber']};}(_0xde3611,_0x2b5b5a)}),function(_0x39ad16){const _0xb038f4=_0x39ad16['model'],_0x5c48c6=new Map(),_0x1fc8ea=_0x39ad16['plugins']['get'](i);_0xb038f4['markers']['on']('update:user:range',(_0xc5093a,_0x56cf52,_0x5f1e3f,_0x1bdbce)=>{if(!_0x1bdbce&&_0x5c48c6['get'](_0x56cf52['name']))return _0x5c48c6['get'](_0x56cf52['name'])['detach'](),void _0x5c48c6['delete'](_0x56cf52['name']);const _0x278b6b=_0x56cf52['name']['split'](':')[0x2];if(_0x278b6b===_0x1fc8ea['mySessionId'])return;const _0x3e031f='user:position:'+_0x278b6b;_0xb038f4['markers']['has'](_0x3e031f)&&_0x39ad16['editing']['reconvertMarker'](_0x3e031f),_0x56cf52['on']('change:range',(_0x62b611,_0x50d771,_0x353e91)=>{if('$graveyard'!=_0x50d771['root']['rootName']&&'$graveyard'==_0x56cf52['getRange']()['root']['rootName']&&!_0x5c48c6['has'](_0x56cf52['name'])){const _0x6d4ecc=_0xb038f4['schema']['getNearestSelectionRange'](_0x353e91['deletionPosition']);if(_0x6d4ecc){const _0xf3ee10=_0x578e05['fromRange'](_0x6d4ecc);_0x5c48c6['set'](_0x56cf52['name'],_0xf3ee10),_0xf3ee10['on']('change:range',(_0x484e95,_0x5bee32,_0x5be711)=>{if('$graveyard'==_0xf3ee10['root']['rootName']){const _0x22dea6=_0xb038f4['schema']['getNearestSelectionRange'](_0x5be711['deletionPosition']);_0x22dea6?(_0xf3ee10['start']=_0x22dea6['start'],_0xf3ee10['end']=_0x22dea6['end']):(_0x5c48c6['delete'](_0x56cf52['name']),_0xf3ee10['detach']());}});}}});}),_0xb038f4['document']['on']('change',()=>{_0x5c48c6['size']>0x0&&_0xb038f4['enqueueChange']({'isUndoable':!0x1},_0x3f773c=>{for(const [_0x5ba322,_0x186919]of _0x5c48c6)'$graveyard'==_0xb038f4['markers']['get'](_0x5ba322)['getRange']()['root']['rootName']&&(te(_0x5ba322['split'](':')[0x2],_0x186919['toRange'](),_0xb038f4,_0x3f773c),_0x186919['detach']());_0x5c48c6['clear']();});});}(_0x1acedc),this['_domEmitter']['listenTo'](_0x423bdf['document'],'keydown',(_0x297406,{key:_0x3ac08a})=>{'Escape'===_0x3ac08a&&function(_0x45da29){_0x45da29['editing']['view']['change'](_0x3299e6=>{for(const _0x4e52b5 of _0x45da29['model']['markers']){if(!_0x4e52b5['name']['startsWith']('user:position'))continue;const _0x45e319=_0x45da29['editing']['mapper']['markerNameToElements'](_0x4e52b5['name']);if(_0x45e319){for(const _0x175230 of _0x45e319)_0x3299e6['removeClass']('ck-user__marker_hovered',_0x175230);}}});}(_0x1acedc);},{'useCapture':!0x0});}['afterInit'](){const _0x601a6f=this['editor'],_0x10aa5f=_0x601a6f['commands']['get']('undo');_0x10aa5f&&_0x601a6f['model']['on']('applyOperation',(_0xccbb44,_0x22554d)=>{const _0x390453=_0x22554d[0x0];if(!_0x390453['isDocumentOperation'])return;if('marker'!=_0x390453['type']||!_0x390453['name']['startsWith']('user:'))return;const _0x400f67=_0x390453['batch'];_0x10aa5f['_createdBatches']['has'](_0x400f67)&&(_0x390453['newRange']=_0x390453['oldRange']?_0x601a6f['model']['createRange'](_0x390453['oldRange']['start'],_0x390453['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x3f6248=this['editor'],_0x3f546b=_0x3f6248['model']['document'],_0x38af93=_0x3f6248['plugins']['get'](i);_0x3f6248['model']['enqueueChange']({'isUndoable':!0x1},_0x1fdd42=>{const _0xfd3d58='user:range:'+_0x38af93['mySessionId'],_0x3f2054='user:position:'+_0x38af93['mySessionId'],_0x4eb701=_0x3f6248['model']['markers']['has'](_0xfd3d58);_0x3f6248['editing']['view']['hasDomSelection']?te(_0x38af93['mySessionId'],_0x3f546b['selection']['getFirstRange'](),_0x3f6248['model'],_0x1fdd42):_0x4eb701&&(_0x1fdd42['removeMarker'](_0xfd3d58),_0x1fdd42['removeMarker'](_0x3f2054));});}}function te(_0x3c5714,_0x4c6340,_0x5e771b,_0x5db94e){const _0xda7b3c='user:range:'+_0x3c5714,_0x26385a='user:position:'+_0x3c5714,_0xbff46d=_0x4c6340['getContainedElement']();let _0x61010c=_0x4c6340['start'];if(_0xbff46d&&_0xbff46d['is']('element','tableCell')){const _0x2ccafd=function(_0x405170,_0x1e9a82){for(const _0x3199f4 of _0x405170['getPositions']())if(_0x1e9a82['schema']['checkChild'](_0x3199f4,'$text'))return _0x3199f4;}(_0x4c6340,_0x5e771b);_0x2ccafd&&(_0x61010c=_0x2ccafd,_0x4c6340=_0x5db94e['createRange'](_0x61010c));}const _0x3b182c=_0x5db94e['createRange'](_0x61010c);_0x5e771b['markers']['has'](_0xda7b3c)?(_0x5db94e['updateMarker'](_0xda7b3c,{'range':_0x4c6340}),_0x5db94e['updateMarker'](_0x26385a,{'range':_0x3b182c})):(_0x5db94e['addMarker'](_0xda7b3c,{'range':_0x4c6340,'usingOperation':!0x0}),_0x5db94e['addMarker'](_0x26385a,{'range':_0x3b182c,'usingOperation':!0x0}));}function $(_0xa0dfcf,_0x49df05,_0x37eaaa){const _0x453c62=_0xa0dfcf['t'],t=_0xa0dfcf['t'];switch(_0x49df05){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 _0x453c62({'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'},_0x37eaaa);default:return'';}}let Q=0x1;class l extends _0x5020b7{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x18f578)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,G,_0xfa099b,_0x5df8af,_0x1dfd40];}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 _0x441ca9=this['serverHistory']['getOperations']();for(let _0x490d5c=_0x441ca9['length']-0x1;_0x490d5c>=0x0;_0x490d5c--){const _0xddc73c=_0x441ca9[_0x490d5c];if(!this['_disconnectionOperations']['has'](_0xddc73c))return _0xddc73c['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1ee5af){if(super(_0x1ee5af),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x1fc730(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x5eee32('collaboration-missing-channelid',this);const _0xd33b3=_0x1ee5af['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0xd33b3,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x5bed56(),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 Z(this['_disconnectionOperations']);}['init'](){const _0x2dfa8=this['editor'],_0x1b59ea=_0x2dfa8['plugins']['get'](_0x5df8af),_0x27dd2e=_0x2dfa8['plugins']['get'](n);this['listenTo'](_0x1b59ea,'getOperationAuthor',(_0x3b2638,_0x55da15)=>{const _0x26d6b7=_0x55da15[0x0];_0x26d6b7['_authorId']&&(_0x3b2638['return']=_0x1b59ea['getUser'](_0x26d6b7['_authorId']),_0x3b2638['stop']()),null===_0x26d6b7['_authorId']&&(_0x3b2638['return']=null,_0x3b2638['stop']());},{'priority':'high'}),this['listenTo'](_0x2dfa8['model']['document']['selection'],'change:range',(_0xa69a43,_0x4e2ef8)=>{_0x4e2ef8['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x2dfa8['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x2dfa8['model']['on']('applyOperation',(_0x1402fe,_0x34d437)=>{const _0x37e82e=_0x34d437[0x0];_0x37e82e['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x37e82e),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x27dd2e,'state',this,'_hasSynchronizationProblem',(_0x55572b,_0x546a71)=>'connected'===_0x55572b&&!_0x546a71),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x2dfa8['disableReadOnlyMode']('rtc-offline'):_0x2dfa8['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x2dfa8['disableReadOnlyMode']('rtc-offline'):_0x2dfa8['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x50511e=this['editor']['plugins']['get'](i),_0x1a8b32=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x50511e['unregister'](this['_channelId']);const _0x197f04=await this['_service']['reconnect'](_0x1a8b32['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x197f04)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x366355=await this['_service']['getConnectedSessions']();_0x50511e['register'](this['_channelId'],_0x366355),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x35b344){if(function(_0x16323e){return'404'===_0x16323e['code'];}(_0x35b344)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4480d0){return'409'===_0x4480d0['code'];}(_0x35b344)){const _0x2c7f45=$(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'](_0x2c7f45);}else{if(!(_0x35b344 instanceof X))throw _0x35b344;this['_handleReconnectionError']();}}}}['destroy'](){const _0x5d9906=this['editor']['plugins']['get'](n),_0x567eef=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x567eef['channelSessions']['has'](this['_channelId'])&&_0x567eef['unregister'](this['_channelId']),_0x5d9906['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x2def33){if(this['sessionId']!==_0x2def33['sessionId']&&this['_lastSyncedOperationId']!==_0x2def33['lastOperationId'])throw new X();return this['sessionId']=_0x2def33['sessionId'],this['_handleServerResponse']([],{..._0x2def33,'wereChangesApplied':!0x1,'data':_0x2def33['data']},'reconnect');}async['_connectService'](_0x4ffb90,_0x229e64=!0x1){const {connection:_0x37bc79}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x37bc79,this['_channelId'])['then'](_0xff718a=>this['_initSessionsHandling'](_0xff718a))['catch'](_0x23b826=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x23b826);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x29852d,_0x1b5d26)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x1b5d26);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x183ab4=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4ffb90);this['_isPendingUpdate']=!0x0;const _0x448652=await this['_service']['connect'](_0x37bc79,this['_compressOperations'](_0x4ffb90),_0x183ab4);if(this['sessionId']=_0x448652['sessionId'],_0x229e64){if(!_0x448652['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x448652['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x4ffb90,_0x448652,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x448652,_0x4ffb90);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x518c83=this['editor']['plugins']['get'](i),_0x20137d=this['editor']['plugins']['get'](G),_0x353d87=_0x518c83['channelSessions']['get'](this['_channelId']);_0x353d87&&_0x353d87['length']>0x1?_0x20137d['createUserMarkerOperations']():this['listenTo'](_0x518c83,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x518c83['channelSessions']['get'](this['_channelId'])['length']&&_0x20137d['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x42e674,_0x3da53f,_0x4a07a1,_0x376057){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x3da53f){const _0x316288=this['_decompressOperations'](_0x4a07a1,_0x376057);await this['_fetchMissingUsers'](_0x316288),this['_handleExternalOperations'](_0x316288,_0x3da53f,_0x4a07a1['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x299ee9}=this['editor'];let _0x10b674;try{_0x10b674=await this['_service']['getDocumentDetails']();}catch{const _0x34a45a=$(_0x299ee9,'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'](_0x34a45a);}const _0x2dceb8=_0x10b674['currentDocumentSession']||_0x10b674['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2dceb8['lastOperationId']){const _0x493333=$(_0x299ee9,'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'](_0x493333);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x2f3017){const _0x22d9e0=this['editor']['plugins']['get'](i);this['listenTo'](_0x22d9e0,'sessionAdd:'+this['_channelId'],(_0xff67e6,{session:_0x59ce46})=>{if(_0x59ce46['id']===_0x22d9e0['mySessionId']){_0xff67e6['off']();const _0x583cb1=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x462e8d=_0x59ce46['permissions'];_0x583cb1&&_0x583cb1['isEnabled']&&(_0x462e8d=_0x462e8d['filter'](_0x2fd889=>'document:write'!==_0x2fd889)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x462e8d,this['_channelId']);}}),_0x22d9e0['register'](this['_channelId'],_0x2f3017);}['_initThrowingOnDataSet'](){const _0x302c1e=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x4c0638)=>{if(!_0x4c0638[_0x4c0638['length']-0x1]['suppressErrorInCollaboration'])throw new _0x5eee32('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x302c1e['apply'](this['editor']['data'],_0x4c0638);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x6e41bf,[_0x3b824b])=>{if(this['_document']['version'])throw new _0x5eee32('realtimecollaborationclient-init-document-already-initialized',this);_0x6e41bf['stop'](),this['_setPendingAction']();const _0x5a1441=this['editor']['config']['get']('rootsAttributes'),_0x224851=this['_getOperationsFromInitData'](_0x3b824b,_0x5a1441);0x0==_0x224851['length']&&_0x224851['push'](new _0x158a54(0x0)),_0x6e41bf['return']=this['_connectService'](_0x224851)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x54ec63=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x54ec63))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x1f2ebe,[_0x2a8f38,_0x381ac6])=>{_0x1f2ebe['stop']();const _0x421f2b=this['editor']['model']['document']['getRoot'](_0x2a8f38);if(!this['_knownRootNames']['has'](_0x2a8f38)){const _0x4e28e9=_0x381ac6&&_0x381ac6['data']?_0x381ac6['data']:'',_0x1baf9b=_0x381ac6&&_0x381ac6['attributes']?_0x381ac6['attributes']:{};await this['_loadRoot'](_0x2a8f38,_0x4e28e9,_0x1baf9b);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x421f2b['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x421f2b);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x25ae68){const _0x55d7cf=this['editor']['plugins']['get'](_0x5df8af),{connection:_0x17871b}=this['editor']['plugins']['get'](n),_0x552d9e=new Set();for(const _0x53dd21 of _0x25ae68){const _0x414492=_0x53dd21['_authorId'];_0x414492&&!_0x55d7cf['getUser'](_0x414492)&&_0x552d9e['add'](_0x414492);}if(0x0===_0x552d9e['size'])return;const _0x36eff9=await ct['getMany'](_0x17871b,Array['from'](_0x552d9e));for(const _0x23a61f of _0x36eff9)_0x55d7cf['getUser'](_0x23a61f['id'])||_0x55d7cf['addUser'](_0x23a61f);}['_getOperationsFromInitData'](_0x559d63,_0x40f6b0={}){const _0x2d90a1=this['editor']['model'],_0x321e84=[];let _0x5e5d9d=0x0;const _0x4a6e0b='string'==typeof _0x559d63?{'main':_0x559d63}:_0x559d63;for(const _0x45bf8f of Object['keys'](_0x4a6e0b)){if(!this['_document']['roots']['has'](_0x45bf8f))throw new _0x5eee32('realtimecollaborationclient-init-non-existent-root',this);const _0x508299=this['editor']['data']['parse'](_0x4a6e0b[_0x45bf8f]),_0x5bbc0c=this['_document']['getRoot'](_0x45bf8f),_0xe8428d=new _0x159a57(_0x2d90a1['createPositionAt'](_0x5bbc0c,0x0),_0x508299,_0x5e5d9d++);_0x321e84['push'](_0xe8428d);for(const [_0x235d90,_0x4f41a3]of _0x508299['markers']){const _0xe66487=_0x2d90a1['createRange'](_0x2d90a1['createPositionFromPath'](_0x5bbc0c,_0x4f41a3['start']['path']['slice']()),_0x2d90a1['createPositionFromPath'](_0x5bbc0c,_0x4f41a3['end']['path']['slice']())),_0x437a46=new _0x45b8bd(_0x235d90,null,_0xe66487,_0x2d90a1['markers'],!0x0,_0x5e5d9d++);_0x321e84['push'](_0x437a46);}}if(_0x40f6b0)for(const [_0x4e6800,_0x995a08]of Object['entries'](_0x40f6b0)){const _0xc2c7e0=_0x2d90a1['document']['getRoot'](_0x4e6800);if(!_0xc2c7e0)throw new _0x5eee32('multi-root-editor-root-attributes-no-root',null);for(const [_0x1956e9,_0x3f2afe]of Object['entries'](_0x995a08))if(null!==_0x3f2afe){const _0x47aed5=new _0x51c0ef(_0xc2c7e0,_0x1956e9,null,_0x3f2afe,_0x5e5d9d++);_0x321e84['push'](_0x47aed5);}}return _0x321e84;}async['_loadRoot'](_0x43d010,_0x1b879a,_0x306f77){this['_getOperationsFromInitData']({[_0x43d010]:_0x1b879a},{[_0x43d010]:_0x306f77})['forEach']((_0x4d64ea,_0x59d444)=>{_0x4d64ea['baseVersion']=this['_document']['version']+_0x59d444,_0x4d64ea['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x4d64ea);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x4e5e0a,_0x3c3b7d){let _0x5ee904;this['_offset']=_0x4e5e0a['offset'];const _0x3ff7eb=_0x4e5e0a['wereChangesApplied']&&!_0x4e5e0a['initData'],_0x2f2b86=_0x3ff7eb?0x0:_0x4e5e0a['data']['baseVersion'];if(_0x3c3b7d['forEach'](_0x257670=>{_0x257670['_isInit']=!0x0,_0x257670['createdAt']=_0x4e5e0a['sessionCreatedAt'],_0x257670['_authorId']=null;}),_0x3ff7eb)_0x5ee904=_0x3c3b7d,this['_applyOperationsSet'](_0x5ee904,_0x3ff7eb);else{if(_0x4e5e0a['initData']){const _0x46b2ed=this['_getOperationsFromInitData'](_0x4e5e0a['initData']);this['_document']['history']['version']=-_0x46b2ed['length'],_0x46b2ed['forEach'](_0x2969c8=>{_0x2969c8['baseVersion']-=_0x46b2ed['length'],_0x2969c8['createdAt']=_0x4e5e0a['sessionCreatedAt'],_0x2969c8['_isInit']=!0x0,_0x2969c8['_authorId']=null;}),this['_applyOperationsSet'](_0x46b2ed,!0x0),this['serverHistory']['version']=-_0x46b2ed['length']+this['_offset'],this['_updateServerHistory'](_0x46b2ed);}this['_document']['history']['version']=_0x2f2b86,_0x5ee904=this['_decompressOperations'](_0x4e5e0a['data'],_0x4e5e0a['metadata']),await this['_fetchMissingUsers'](_0x5ee904),this['_applyOperationsSet'](_0x5ee904,_0x3ff7eb);}_0x4e5e0a['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5ee904,_0x4e5e0a['lastOperationId']),this['_lastSyncedOperationId']=_0x4e5e0a['lastOperationId']),this['serverHistory']['version']=_0x2f2b86+this['_offset'],this['_updateServerHistory'](_0x5ee904),_0x3c3b7d['filter'](_0x145bd4=>{const _0x56f344=this['_getAffectedRoot'](_0x145bd4);return _0x56f344&&!this['_knownRootNames']['has'](_0x56f344);})['forEach']((_0x12ba49,_0xa5f182)=>{_0x12ba49['baseVersion']=this['_document']['version']+_0xa5f182,this['_saveOperationInBuffer'](_0x12ba49);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3254b9,_0x3cf527){const _0x626a71=_0x3cf527&&_0x3cf527['message'];if(_0x626a71&&_0x626a71['startsWith']('realtimecollaborationclient'))throw _0x3cf527;const _0x5bac5b=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x5bac5b['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x5eee32(_0x3254b9,this['editor'],_0x626a71?{'originalError':_0x626a71}:void 0x0);}['_saveOperationInBuffer'](_0x41f42b){this['_knownOperations']['has'](_0x41f42b)||(this['_knownOperations']['add'](_0x41f42b),this['_bufferedOperations']['push'](_0x41f42b),this['_pendingAction']||'marker'==_0x41f42b['type']&&!_0x41f42b['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0xc895cd=!0x1){!_0xc895cd&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x530a25=>{_0x530a25&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x1a4581=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3042b4){return _0x3042b4['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3042b4['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3042b4['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x1a4581)||this['_crash'](_0x1a4581['message'],_0x1a4581);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x5a57d0=>{this['on']('change:_isPendingUpdate',()=>{_0x5a57d0();});});}async['_sendBufferedOperations'](){const _0x16a5b6=this['editor']['plugins']['get'](G);if(this['_shouldSendSelectionUpdate']()&&(_0x16a5b6['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x20f9a7=[...this['_bufferedOperations']];for(const _0x5d7a26 of _0x20f9a7)_0x5d7a26['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x5d7a26);const _0x213cf6=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x20f9a7),_0x2e1010=Q++,_0xa19ad3=this['_compressOperations'](_0x20f9a7),_0x78dec9=await this['_service']['sendOperations'](_0xa19ad3,_0xa19ad3['baseVersion'],_0x213cf6);try{return await this['_handleServerResponse'](_0x20f9a7,_0x78dec9,_0x2e1010);}catch(_0x1d8337){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1d8337);}}async['_handleServerResponse'](_0x38d512,_0x5d47ee,_0x45a3d4){if('error'in _0x5d47ee)throw _0x5d47ee['error'];let _0xe4fac2=!0x1;if(_0x5d47ee['wereChangesApplied']){_0x5d47ee['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5d47ee['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x543705=>!_0x38d512['includes'](_0x543705));for(const _0x174ed7 of _0x38d512)_0x174ed7['createdAt']='lastOperationAcceptedAt'in _0x5d47ee&&_0x5d47ee['lastOperationAcceptedAt']||void 0x0;Y(_0x38d512,_0x5d47ee['version']-_0x38d512['length']),this['_updateServerHistory'](_0x38d512);const _0x41a0c1=_0x38d512['filter'](_0x20f28a=>{if(!_0x20f28a['_isInit'])return!0x1;const _0xb37c2f=this['_getAffectedRoot'](_0x20f28a);return _0xb37c2f&&!this['_knownRootNames']['has'](_0xb37c2f);});Y(_0x41a0c1,this['_document']['version']),this['_applyOperationsSet'](_0x41a0c1),_0xe4fac2=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x5d37a7=this['_decompressOperations'](_0x5d47ee['data'],_0x5d47ee['metadata'])['filter'](_0x344068=>_0x344068['baseVersion']>=this['_lastServerVersion']);_0x5d37a7['forEach'](_0x537438=>this['_addKnownRoot'](_0x537438)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x58470a=>!_0x58470a['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x58470a))),this['_bufferedOperations']['length']&&Y(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x5d37a7),_0xe4fac2=this['_handleExternalOperations'](_0x5d37a7,_0x5d47ee['version'],_0x5d47ee['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0xe4fac2?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x26bbc0,_0x2b21ff,_0x330f08){try{const _0x18b71b={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x83414b,operationsB:_0x11ff2a,originalOperations:_0x5dace0}=_0x5237c5(_0x26bbc0,this['_bufferedOperations'],_0x18b71b);Y(_0x83414b,this['_document']['version']),Y(_0x11ff2a,_0x2b21ff);for(const _0x421e33 of _0x83414b){const _0xfff642=_0x5dace0['get'](_0x421e33);_0x421e33['_authorId']=_0xfff642?_0xfff642['_authorId']:null;}_0x330f08&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x26bbc0,_0x330f08),this['_lastSyncedOperationId']=_0x330f08),this['_bufferedOperations']=[..._0x11ff2a],this['_applyOperationsSet'](_0x83414b),this['_updateServerHistory'](_0x26bbc0);}catch(_0x568d17){return console['error'](_0x568d17),!0x1;}return!0x0;}['_applyOperationsSet'](_0x71c87f,_0x33df83=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x5a10c7=>{for(const _0x3a381a of _0x71c87f)this['_knownOperations']['add'](_0x3a381a),this['_addKnownRoot'](_0x3a381a),_0x5a10c7['batch']['addOperation'](_0x3a381a),this['editor']['model']['applyOperation'](_0x3a381a);});}['_addKnownRoot'](_0x171146){const _0x2846da=this['_getAffectedRoot'](_0x171146);_0x2846da&&this['_knownRootNames']['add'](_0x2846da);}['_getAffectedRoot'](_0x2dc722){let _0x357c6d,_0x1a42eb;switch(_0x2dc722['type']){case'insert':_0x357c6d=_0x2dc722['position']['root'];break;case'marker':if(_0x1a42eb=_0x2dc722['newRange'],!_0x1a42eb)return null;_0x357c6d=_0x1a42eb['root'];break;case'addRootAttribute':_0x357c6d=_0x2dc722['root'];break;case'addRoot':_0x357c6d=_0x2dc722['affectedSelectable'];break;case'move':_0x357c6d=_0x2dc722['targetPosition']['root'];break;default:return null;}return _0x357c6d['rootName'];}['_updateServerHistory'](_0xd8b11b){_0xd8b11b['forEach'](_0x2039a6=>{const _0x32857a=_0x2039a6['clone']();_0x32857a['_authorId']=_0x2039a6['_authorId'],_0x32857a['_isInit']=!!_0x2039a6['_isInit'],_0x32857a['createdAt']=_0x2039a6['createdAt'],_0x32857a['baseVersion']+=this['_offset'],_0x2039a6['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x32857a),this['serverHistory']['addOperation'](_0x32857a);});}['_handleReconnectionError'](_0x457c2e){const _0x55e939=this['editor']['plugins']['get']('Notification'),_0x59efb1=this['editor']['locale'];_0x457c2e||(_0x457c2e=$(_0x59efb1,'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.')),_0x55e939['showWarning'](_0x457c2e,{'title':$(_0x59efb1,'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'](_0xfa099b)['add']($(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0xfa099b)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x224f09){const _0x4ec6b4=_0x224f09['map'](_0x14546f=>_0x14546f['toJSON']());return this['_compressor']['compress'](_0x4ec6b4);}['_decompressOperations'](_0x1f37bf,_0x535642){return this['_compressor']['decompress'](_0x1f37bf)['map']((_0x2a5096,_0x25a2c2)=>{const _0x45ceab='init'==_0x535642[_0x25a2c2]['type'];if('InsertOperation'==_0x2a5096['__className']){const _0x54628d=_0x2a5096['position']['root'];!this['_document']['getRoot'](_0x54628d)&&(this['_document']['createRoot']('$root',_0x54628d)['_isAttached']=!0x1);}const _0x1e3c7=_0x49b61a['fromJSON'](_0x2a5096,this['_document']);return _0x1e3c7['wasUndone']=_0x2a5096['wasUndone'],_0x1e3c7['_isInit']=_0x45ceab,_0x1e3c7['_authorId']=_0x45ceab?null:_0x535642[_0x25a2c2]['userId'],_0x1e3c7['_isDisconnection']='cs:removeUser'===_0x535642[_0x25a2c2]['type'],_0x1e3c7['createdAt']=_0x535642[_0x25a2c2]['createdAt'],_0x1e3c7;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0xfb7b4=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0xfb7b4&&_0xfb7b4['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class X extends Error{}function Y(_0x7ce543,_0x14601f){for(const _0x373450 of _0x7ce543)_0x373450['baseVersion']=_0x14601f++;}class Z{['_ignoredOperations'];['_operationToId'];constructor(_0x4b715e){this['_ignoredOperations']=_0x4b715e,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x4bc76e){let _0x470083=_0x4bc76e['length'];for(;_0x470083--;){const _0x12ce83=_0x4bc76e[_0x470083];if(!this['_ignoredOperations']['has'](_0x12ce83)){if(!this['_operationToId']['has'](_0x12ce83)){const _0xc9c51f=_0x26c052()['slice'](0x1,0x12);this['_operationToId']['set'](_0x12ce83,_0xc9c51f);}return this['_operationToId']['get'](_0x12ce83);}}}['setIdForTheLastOperation'](_0x189931,_0x488ad6){if(!_0x488ad6)return;let _0x146d98=_0x189931['length'];for(;_0x146d98--;){const _0x5102c0=_0x189931[_0x146d98];this['_ignoredOperations']['has'](_0x5102c0)||this['_operationToId']['set'](_0x5102c0,_0x488ad6);}}}class a extends _0x5020b7{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x382514{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x8fe397)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x5df8af];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x34d6b4){super(_0x34d6b4),this['_services']=new Map();}async['init'](){const _0xe9489d=this['context'],_0x1a52cb=_0xe9489d['plugins']['get']('CommentsRepository');if(_0xe9489d['plugins']['get'](n)['addToReconnectionStack'](this),_0x1a52cb['adapter']={'addCommentThread':async({channelId:_0x3dd475,threadId:_0x1a768a,comments:_0x26ddfa,resolvedAt:_0x37ae8b,resolvedBy:_0x4ddecd,context:_0x1b043c,attributes:_0x371bad})=>{const _0x1f3589=await this['_getService'](_0x3dd475)['addCommentThread']({'commentThreadId':_0x1a768a,'comments':_0x26ddfa['map'](_0x2ae54a=>function(_0x271633,_0x3c00cd,_0x3da5d7){return{'commentThreadId':_0x3da5d7,'commentId':_0x271633['commentId'],'userId':_0x271633['authorId'],'content':_0x271633['content'],'documentId':_0x3c00cd,'createdAt':_0x271633['createdAt'],'attributes':_0x271633['attributes']||{}};}(_0x2ae54a,_0x3dd475,_0x1a768a)),'resolvedAt':_0x37ae8b,'resolvedBy':_0x4ddecd,'context':_0x1b043c,'attributes':_0x371bad})['catch'](at);return{'threadId':_0x1f3589['commentThreadId'],'comments':_0x1f3589['comments']};},'getCommentThread':async({channelId:_0x1cc195,threadId:_0x272602})=>{const _0x42a4cc=await this['_getService'](_0x1cc195)['getCommentThread'](_0x272602)['catch'](F)['catch'](at);return _0x42a4cc?_0x42a4cc['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x42a4cc]),{'threadId':_0x42a4cc['commentThreadId'],'comments':_0x42a4cc['comments']['map'](S),'context':_0x42a4cc['context'],'resolvedAt':_0x42a4cc['resolvedAt'],'resolvedBy':_0x42a4cc['resolvedBy'],'attributes':_0x42a4cc['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x2fa887,threadId:_0x166c60,context:_0x31bb7e,unlinkedAt:_0x4c0e40,attributes:_0x265792})=>this['_getService'](_0x2fa887)['updateCommentThread']({'commentThreadId':_0x166c60,'context':_0x31bb7e,'attributes':_0x265792,'unlinkedAt':_0x4c0e40})['catch'](F)['catch'](at),'resolveCommentThread':async({channelId:_0x1203e7,threadId:_0x2eee0a})=>{const _0x1bec92=await this['_getService'](_0x1203e7)['resolveCommentThread'](_0x2eee0a)['catch'](F)['catch'](at);return{'threadId':_0x1bec92['commentThreadId'],'resolvedAt':_0x1bec92['resolvedAt'],'resolvedBy':_0x1bec92['resolvedBy']};},'reopenCommentThread':async({channelId:_0x3b4b40,threadId:_0x3a4693})=>this['_getService'](_0x3b4b40)['reopenCommentThread'](_0x3a4693)['catch'](F)['catch'](at),'removeCommentThread':({channelId:_0xc5289,threadId:_0xd74a12})=>this['_getService'](_0xc5289)['removeCommentThread'](_0xd74a12)['catch'](F)['catch'](at),'addComment':({channelId:_0x13f3f3,threadId:_0x2d56ad,commentId:_0x5583d8,content:_0x277482,attributes:_0x2598a4})=>this['_getService'](_0x13f3f3)['addComment'](_0x2d56ad,_0x5583d8,_0x277482,_0x2598a4)['catch'](at),'updateComment':({channelId:_0x687aa0,threadId:_0x100482,commentId:_0x4e8dd1,content:_0x57b1b9,attributes:_0x3ef358})=>this['_getService'](_0x687aa0)['updateComment'](_0x100482,_0x4e8dd1,_0x57b1b9,_0x3ef358)['catch'](F)['catch'](at),'removeComment':({channelId:_0x4e7569,threadId:_0x5eea48,commentId:_0x4f6403})=>this['_getService'](_0x4e7569)['removeComment'](_0x5eea48,_0x4f6403)['catch'](F)['catch'](at)},_0xe9489d instanceof _0x1bb185){const _0x2ca37d=_0xe9489d['config']['get']('collaboration.channelId'),_0x4bb19e=_0xe9489d['plugins']['get'](i);await this['_setUpService'](_0x2ca37d);const _0x3fc12f=await this['_services']['get'](_0x2ca37d)['getConnectedSessions']();this['listenTo'](_0x4bb19e,'sessionAdd:'+_0x2ca37d,(_0x41888a,{session:_0x2e6632})=>{_0x2e6632['id']===_0x4bb19e['mySessionId']&&(_0x41888a['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x2e6632['permissions'],_0x2ca37d));}),_0x4bb19e['register'](_0x2ca37d,_0x3fc12f);}}async['_setUpService'](_0x134c42){if(this['_services']['has'](_0x134c42))throw new _0x5eee32('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x134c42});const _0x1b9f91=this['context']['plugins']['get']('CommentsRepository'),_0x4071ee=new s['CommentsService'](_0x134c42);this['_services']['set'](_0x134c42,_0x4071ee),this['listenTo'](_0x4071ee,'commentThreadAdded',(_0x4da69f,_0x5aedda)=>{const {commentThreadId:_0x2338a2,documentId:_0x2d5ea9,context:_0xb2892,attributes:_0x5b5e1a,resolvedAt:_0x3ec700,resolvedBy:_0x13015e,comments:_0x30fcdc}=_0x5aedda;_0x1b9f91['getCommentThread'](_0x2338a2)||_0x1b9f91['addCommentThread']({'threadId':_0x2338a2,'channelId':_0x2d5ea9,'comments':_0x30fcdc?_0x30fcdc['map'](S):[],'context':_0xb2892,'attributes':_0x5b5e1a,'resolvedAt':_0x3ec700,'resolvedBy':_0x13015e,'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentThreadUpdated',(_0xced8ac,{commentThreadId:_0xdaf22b,documentId:_0x1cc211,context:_0x3aa134,unlinkedAt:_0x52ec43,attributes:_0xc4c8b})=>{_0x1b9f91['getCommentThread'](_0xdaf22b)&&_0x1b9f91['updateCommentThread']({'threadId':_0xdaf22b,'channelId':_0x1cc211,'context':_0x3aa134,'unlinkedAt':_0x52ec43,'attributes':_0xc4c8b,'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentThreadResolved',(_0x55144b,{commentThreadId:_0x32b888,resolvedBy:_0x2267aa,resolvedAt:_0x10a4f4})=>{const _0x5c2f80=_0x1b9f91['getCommentThread'](_0x32b888);_0x5c2f80&&_0x5c2f80['resolve']({'resolvedBy':_0x2267aa,'resolvedAt':_0x10a4f4,'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentThreadReopened',(_0x3a72bf,{commentThreadId:_0x548b94})=>{const _0x38e3bd=_0x1b9f91['getCommentThread'](_0x548b94);_0x38e3bd&&_0x38e3bd['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentThreadRemoved',(_0x5ee96d,{commentThreadId:_0x409248})=>{const _0x561c15=_0x1b9f91['getCommentThread'](_0x409248);_0x561c15&&_0x561c15['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentAdded',(_0x3ffddf,_0x485d63)=>{const _0x13bb90=_0x485d63['commentThreadId'],_0x3ba159=_0x1b9f91['getCommentThread'](_0x13bb90);_0x3ba159&&_0x3ba159['addComment']({...S(_0x485d63),'isFromAdapter':!0x0});}),this['listenTo'](_0x4071ee,'commentUpdated',(_0x2efce0,{commentThreadId:_0x39f8f6,commentId:_0x277e9d,content:_0x10d4eb,attributes:_0x1da2ce})=>{const _0x18ceb7=_0x1b9f91['getCommentThread'](_0x39f8f6);if(_0x18ceb7){const _0x1439fa=_0x18ceb7['getComment'](_0x277e9d);_0x1439fa&&_0x1439fa['update']({'content':_0x10d4eb,'attributes':_0x1da2ce,'isFromAdapter':!0x0});}}),this['listenTo'](_0x4071ee,'commentRemoved',(_0x42261b,{commentThreadId:_0x5ee2e7,commentId:_0x2b6cd6})=>{const _0x44d87c=_0x1b9f91['getCommentThread'](_0x5ee2e7);if(_0x44d87c){const _0x11f2b3=_0x44d87c['getComment'](_0x2b6cd6);_0x11f2b3&&_0x11f2b3['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x134c42);}['destroy'](){if(this['context']instanceof _0x1bb185){const _0x19118d=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x19118d);}}['_terminateService'](_0x43806f){if(!this['_services']['has'](_0x43806f))throw new _0x5eee32('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x43806f});this['_getService'](_0x43806f)['disconnect'](),this['_services']['delete'](_0x43806f);}async['reconnect'](){for(const _0x5ab64c of this['_services']['keys']())await this['_connectService'](_0x5ab64c);if(this['context']instanceof _0x1bb185){const _0x29fb41=this['context']['config']['get']('collaboration.channelId'),_0xaddf21=this['context']['plugins']['get'](i);_0xaddf21['unregister'](_0x29fb41);const _0x2c3433=await this['_services']['get'](_0x29fb41)['getConnectedSessions']();_0xaddf21['register'](_0x29fb41,_0x2c3433);}}async['_connectService'](_0x528bf5){const {connection:_0x2acf02}=this['context']['plugins']['get'](n),_0x3f37f1=this['context']['plugins']['get']('CommentsRepository'),_0x3ab5ef=this['_services']['get'](_0x528bf5),_0x49aad3=await _0x3ab5ef['connect'](_0x2acf02);await this['_fetchMissingUsersForThreads'](_0x49aad3);const _0x5b9ff7=new Set(Array['from'](_0x3f37f1['getCommentThreads']({'channelId':_0x528bf5}),_0x28669f=>_0x28669f['id']));for(const _0x8da0f1 of _0x49aad3)_0x8da0f1['deletedAt']||_0x5b9ff7['delete'](_0x8da0f1['commentThreadId']);for(const _0x66fb58 of _0x5b9ff7)_0x3f37f1['getCommentThread'](_0x66fb58)['remove']({'isFromAdapter':!0x0});for(const _0x4f4f8d of _0x49aad3){let _0x24dbaf=_0x3f37f1['getCommentThread'](_0x4f4f8d['commentThreadId']);const {commentThreadId:_0x1e714d,context:_0x260b77,attributes:_0x449788,resolvedBy:_0x2253f8,resolvedAt:_0x1bb325,unlinkedAt:_0x1b8896,deletedAt:_0x14e5f1}=_0x4f4f8d;if(_0x14e5f1)continue;_0x24dbaf||(_0x24dbaf=_0x3f37f1['addCommentThread']({'channelId':_0x528bf5,'threadId':_0x1e714d,'context':_0x260b77,'attributes':_0x449788||{},'resolvedBy':_0x2253f8,'resolvedAt':_0x1bb325,'unlinkedAt':_0x1b8896,'isFromAdapter':!0x0}));const _0x3eda44=new Set(Array['from'](_0x24dbaf['comments'],_0xe81288=>_0xe81288['id']));for(const _0x52816f of _0x4f4f8d['comments'])_0x3eda44['delete'](_0x52816f['commentId']);for(const _0x25ad5c of _0x3eda44)_0x24dbaf['getComment'](_0x25ad5c)['remove']({'isFromAdapter':!0x0});for(const _0x3843fd of _0x4f4f8d['comments']){const _0x218ea7=_0x24dbaf['getComment'](_0x3843fd['commentId']);_0x218ea7?_0x218ea7['content']!==_0x3843fd['content']&&_0x218ea7['update']({'content':_0x3843fd['content'],'isFromAdapter':!0x0}):_0x24dbaf['addComment'](Object['assign'](S(_0x3843fd),{'isFromAdapter':!0x0}));}}}['_getService'](_0x84b61b){if(!this['_services']['has'](_0x84b61b))throw new _0x5eee32('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x84b61b});return this['_services']['get'](_0x84b61b);}async['_fetchMissingUsersForThreads'](_0x683a9d){const _0x21310f=this['context']['plugins']['get'](_0x5df8af),{connection:_0xc786ea}=this['context']['plugins']['get'](n),_0x1de565=new Set();for(const {resolvedBy:_0x5bc7e6,comments:_0x3734ea}of _0x683a9d){_0x5bc7e6&&!_0x21310f['getUser'](_0x5bc7e6)&&_0x1de565['add'](_0x5bc7e6);for(const {userId:_0x3cd7f2}of _0x3734ea)_0x21310f['getUser'](_0x3cd7f2)||_0x1de565['add'](_0x3cd7f2);}if(0x0===_0x1de565['size'])return;const _0x296529=await ct['getMany'](_0xc786ea,Array['from'](_0x1de565));for(const _0x5d1cf4 of _0x296529)_0x21310f['getUser'](_0x5d1cf4['id'])||_0x21310f['addUser'](_0x5d1cf4);}}async function F(_0x1a0f4a){if('404'!==_0x1a0f4a['code'])throw _0x1a0f4a;}function at(_0x22b905){if((_0x2b174d=_0x22b905)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x2b174d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2b174d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x2b174d;throw _0x22b905;}function S(_0x35db0e){return{'threadId':_0x35db0e['commentThreadId'],'commentId':_0x35db0e['commentId'],'content':_0x35db0e['content'],'createdAt':_0x35db0e['createdAt'],'authorId':_0x35db0e['userId'],'attributes':_0x35db0e['attributes']||{}};}class m extends _0x5020b7{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(_0x473b02){super(_0x473b02);const _0x56e24e=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x56e24e);}['init'](){const _0x3617ed=this['editor']['plugins']['get'](n),_0x32308a=this['editor']['plugins']['get']('TrackChangesEditing');return _0x32308a['adapter']={'getSuggestion':async _0x468053=>{await this['_waitForServiceReady']();const _0x1b1854=await this['_trackChangesService']['get'](_0x468053)['catch'](k);return await this['_fetchMissingUsersForThreads']([_0x1b1854]),_0x1b1854;},'addSuggestion':async({id:_0x2d9e5f,type:_0x392247,data:_0x26831c,originalSuggestionId:_0x3ac4f6,attributes:_0x3e0993})=>{await this['_waitForServiceReady']();const _0x38b237={'id':_0x2d9e5f,'type':_0x392247,'data':_0x26831c,'originalSuggestionId':_0x3ac4f6,'attributes':_0x3e0993},_0xd0acc6=await this['_trackChangesService']['add'](_0x2d9e5f,_0x392247,_0x26831c,_0x3ac4f6,_0x3e0993)['catch'](_0x4b8f03=>{if(ht(_0x4b8f03))return new Promise(_0x3b23ea=>{this['_bufferedRequests']['set'](_0x2d9e5f,{'resolve':_0x3b23ea,'suggestionData':_0x38b237});});throw _0x4b8f03;});return this['_bufferedRequests']['delete'](_0x2d9e5f),_0xd0acc6;},'updateSuggestion':async(_0x3d08cf,_0x530b07)=>{if(await this['_waitForServiceReady'](),'open'!==_0x530b07['state'])return this['_trackChangesService']['update'](_0x3d08cf,_0x530b07)['catch'](k);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x2051d9,_0x371dca)=>{_0x32308a['hasSuggestion'](_0x371dca['id'])&&(_0x32308a['getSuggestion'](_0x371dca['id'])['attributes']=_0x371dca['attributes']);}),this['_trackChangesService']['connect'](_0x3617ed['connection'])['then'](_0x8d098f=>(_0x3617ed['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x8d098f)['then'](()=>{for(const _0x540712 of _0x8d098f){_0x32308a['addSuggestionData'](_0x540712)['_saved']=!0x0;}})));}async['reconnect'](){const _0x56f753=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x34cad4}=this['editor']['plugins']['get'](n),_0x3cafa7=await this['_trackChangesService']['connect'](_0x34cad4);await this['_fetchMissingUsersForThreads'](_0x3cafa7);for(const {suggestionData:_0x5a5298,resolve:_0x4b019e}of this['_bufferedRequests']['values']()){let _0x455d16=_0x3cafa7['find'](_0x5ecccd=>_0x5ecccd['id']===_0x5a5298['id']);_0x455d16||(_0x455d16=await this['_trackChangesService']['add'](_0x5a5298['id'],_0x5a5298['type'],_0x5a5298['data'],_0x5a5298['originalSuggestionId'])),_0x4b019e(_0x455d16);}for(const _0x4ec3ef of _0x3cafa7)_0x56f753['hasSuggestion'](_0x4ec3ef['id'])||_0x56f753['addSuggestionData'](_0x4ec3ef);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x39a4c1=>{this['listenTo'](this['_trackChangesService'],'connected',_0x1b3b38=>{_0x1b3b38['off'](),_0x39a4c1();});});}async['_fetchMissingUsersForThreads'](_0x134578){const _0x1d9768=this['editor']['plugins']['get'](_0x5df8af),{connection:_0x446215}=this['editor']['plugins']['get'](n),_0x3f2ad2=new Set();for(const {authorId:_0x70ba3c}of _0x134578)_0x1d9768['getUser'](_0x70ba3c)||_0x3f2ad2['add'](_0x70ba3c);if(0x0===_0x3f2ad2['size'])return;const _0x295585=await ct['getMany'](_0x446215,Array['from'](_0x3f2ad2));for(const _0x311661 of _0x295585)_0x1d9768['getUser'](_0x311661['id'])||_0x1d9768['addUser'](_0x311661);}}function k(_0x2f708b){if(ht(_0x2f708b))return new Promise(()=>{});throw _0x2f708b;}function ht(_0x584bdf){return _0x584bdf['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x584bdf['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x5020b7{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 _0xc991ce=this['editor']['plugins']['get'](n),_0x32b5ea=this['editor']['plugins']['get']('CommentsEditing'),_0x11df6e=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0xc991ce,'change:state',(_0x3d1638,_0xb5cfed,_0x1699b2)=>{_0x32b5ea['isThreadsLoadingPaused']='connected'!==_0x1699b2;});}),this['listenTo'](_0xc991ce,'change:state',(_0x4900c1,_0x5eb902,_0x59b5fc)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x59b5fc);}),_0x11df6e['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](s)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class lt extends _0x5020b7{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 _0x5020b7{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x4bbbc8)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x5df8af];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3a522b){super(_0x3a522b);const _0x24827e=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x24827e);}async['init'](){const _0x3a8623=this['editor']['plugins']['get'](l),_0x414564=_0x3a8623['serverHistory'],_0x41b6fc=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x414564,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x3a8623['sessionId']});const _0x3f5c78=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x2967bb=await _0x23f175['isBundleUploaded'](_0x41b6fc['connection'],_0x3f5c78);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x98cc8f})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x98cc8f)),'updateRevisions':async _0x42fc2b=>{await this['_waitForServiceReady']();const _0x52a145=this['_revisionTracker']['currentRevision'];if(_0x2967bb&&0x1===_0x42fc2b['length']&&_0x42fc2b[0x0]['id']===_0x52a145['id'])return _0x42fc2b;for(const _0x4384f9 of _0x42fc2b)_0x4384f9['id']===_0x52a145['id']&&(_0x4384f9['isEmptyCurrent']=_0x4384f9['fromVersion']===_0x4384f9['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x42fc2b,this['_lastRequestId'])['then'](_0x36c488=>(this['_lastRequestId']=_0x36c488,_0x42fc2b))['catch'](_0x317f96=>{if(q(_0x317f96)||'400'===_0x317f96['code']&&void 0x0!==_0x317f96['data']['wrongRequestId']){for(const _0x2ac474 of _0x42fc2b){!this['_revisionTracker']['repository']['getRevision'](_0x2ac474['id'])||this['_revisionTracker']['_bufferUpdate'](_0x2ac474['id'],_0x2ac474,!0x1);}if(q(_0x317f96))throw _0x317f96;return _0x42fc2b;}throw _0x317f96;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x5d0310,{revisionsData:_0x12ec56,requestId:_0x2ab66f})=>{Math['max'](..._0x12ec56['map'](_0x33b55b=>_0x33b55b['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x12ec56,_0x2ab66f);}):this['_handleRevisionsUpdate'](_0x12ec56,_0x2ab66f);});const {revisions:_0x38a710,requestId:_0x5c2780}=await this['_revisionHistoryService']['connect'](_0x41b6fc['connection']);_0x41b6fc['addToReconnectionStack'](this),this['_lastRequestId']=_0x5c2780,await this['_fetchMissingUsers'](_0x38a710);for(const _0x2366d8 of _0x38a710)this['_revisionTracker']['addRevisionData'](_0x2366d8);this['listenTo'](_0x3a8623,'change:_isConnected',(_0x5232d4,_0x1483b7,_0x298270)=>{_0x298270&&(this['_oldOffset']=_0x3a8623['_offset'],_0x5232d4['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x41b6fc,'state',_0x1ff598=>_0x1ff598===_0x58fce9['CONNECTED']);}async['reconnect'](){const _0x641ae8=this['editor']['plugins']['get'](n),_0x1beb42=this['editor']['plugins']['get'](l),_0x48a297=async()=>{const _0x2bb11b=this['_revisionTracker']['currentRevision'],_0x277cb4=_0x2bb11b['id'],_0x5f0a93=_0x277cb4!==_0x1beb42['sessionId'];if(_0x5f0a93){const _0x555aad=_0x1beb42['_offset']-this['_oldOffset'],_0x554b3e=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x2bb11b['toVersion']+_0x555aad!==_0x554b3e){const _0x478a4b=_0x2bb11b['fromVersion']+_0x555aad,_0x4de86a=this['editor']['plugins']['get'](_0x5df8af),_0x112727=this['_revisionTracker']['buildRevisionData']({'revision':_0x2bb11b,'from':_0x478a4b,'to':_0x554b3e});_0x112727['id']=_0x2bb11b['id'];const _0x1a07fa=_0x112727['authorsIds']['map'](_0x37a614=>_0x4de86a['getUser'](_0x37a614));_0x2bb11b['_update']({..._0x112727,'authors':_0x1a07fa},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x2bb11b['id'],_0x112727,!0x0);}this['_revisionTracker']['_startingVersion']=_0x554b3e,(_0x2bb11b['toVersion']===_0x2bb11b['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x277cb4)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x277cb4),this['_revisionTracker']['_createCurrentRevision'](_0x554b3e));}const {revisions:_0x45aa61,requestId:_0x1ba754}=await this['_revisionHistoryService']['reconnect'](_0x641ae8['connection'],this['_lastRequestId']);_0x5f0a93&&_0x45aa61['length']>0x0?_0x1beb42['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x45aa61),this['_handleRevisionsUpdate'](_0x45aa61,_0x1ba754),this['_revisionTracker']['sendBufferedUpdates']());};return _0x1beb42['_isConnected']?_0x48a297():new Promise((_0x5b9a0a,_0x5d94d2)=>{_0x1beb42['once']('change:_isConnected',()=>{_0x48a297()['then'](_0x5b9a0a)['catch'](_0x5d94d2);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x1526ba=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x26beb1=>{_0x26beb1['off'](),_0x1526ba();});});}['_getLatestVersionFromServerOperations'](){const _0x4d7891=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x100765 of _0x4d7891)if('marker'!==_0x100765['type']||_0x100765['affectsData'])return _0x100765['baseVersion']+0x1;}['_getLatestVersion'](){const _0x8d5c49=this['editor']['plugins']['get'](l);return new Promise(_0x3c34ad=>{_0x8d5c49['_isPendingUpdate']?_0x8d5c49['once']('change:_isPendingUpdate',()=>{_0x3c34ad(this['_getLatestVersionFromServerOperations']());}):_0x3c34ad(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x5de68e,_0x307892){const _0x2fe727=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x307892;for(const _0x303f91 of _0x5de68e){const _0xab1521=_0x2fe727['getRevision'](_0x303f91['id']);if(_0xab1521){if((_0x303f91['fromVersion']||_0x303f91['toVersion'])&&(_0x303f91['diffData']=null),_0xab1521===this['_revisionTracker']['currentRevision']){const _0x1a6d57=Math['max'](_0xab1521['toVersion'],_0x303f91['toVersion']),_0x5a8483=Math['max'](_0xab1521['fromVersion'],_0x303f91['fromVersion']);let _0x362656;_0xab1521['toVersion']===_0x303f91['toVersion']&&_0xab1521['fromVersion']===_0x303f91['fromVersion']?(_0x362656=!0x0,this['_preventResendingRevisionData'](_0x303f91)):_0x303f91['toVersion']===_0x1a6d57&&_0x303f91['fromVersion']===_0x5a8483?_0x362656=!0x1:(_0xab1521['toVersion']===_0x1a6d57&&_0xab1521['fromVersion']===_0x5a8483||this['_fixRevision']({'revision':_0xab1521,'from':_0x5a8483,'to':_0x1a6d57}),_0x362656=!0x0),_0x362656&&(delete _0x303f91['fromVersion'],delete _0x303f91['toVersion'],delete _0x303f91['diffData'],delete _0x303f91['createdAt'],delete _0x303f91['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x303f91),this['_preventResendingRevisionData'](_0x303f91);}else this['_revisionTracker']['addRevisionData'](_0x303f91);}const _0x44bed2=_0x2fe727['getRevisions']();_0x44bed2['reverse']();for(let _0x1b4b42=0x0;_0x1b4b42<_0x44bed2['length']-0x1;_0x1b4b42++){const _0x161d4e=_0x44bed2[_0x1b4b42],_0x2f34b3=_0x44bed2[_0x1b4b42+0x1];if(_0x161d4e['fromVersion']<_0x2f34b3['toVersion']){const _0x5aa5a7=_0x2f34b3['toVersion'],_0x5aca9e=Math['max'](_0x5aa5a7,_0x161d4e['toVersion']);this['_fixRevision']({'revision':_0x161d4e,'from':_0x5aa5a7,'to':_0x5aca9e});}}}['_fixRevision']({revision:_0x3ff1c3,from:_0x193f7f,to:_0x102235}={}){const _0x4abd22=this['editor']['plugins']['get'](_0x5df8af),_0x59168f=this['_revisionTracker']['buildRevisionData']({'revision':_0x3ff1c3,'from':_0x193f7f,'to':_0x102235});_0x59168f['authors']=_0x59168f['authorsIds']['map'](_0x1782a2=>_0x4abd22['getUser'](_0x1782a2)),_0x3ff1c3['_update'](_0x59168f);}['_preventResendingRevisionData'](_0x4b5020){const _0x4fcc21={};_0x4fcc21['id']=_0x4b5020['id'];for(const _0x3c32a4 of Object['keys'](_0x4b5020))'id'!==_0x3c32a4&&(_0x4fcc21[_0x3c32a4]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x4fcc21['id'],_0x4fcc21,!0x0);}async['_fetchMissingUsers'](_0x57bc1d){const _0x2b47bf=this['editor']['plugins']['get'](_0x5df8af),{connection:_0x312be0}=this['editor']['plugins']['get'](n),_0x282273=new Set();for(const _0x242f4d of _0x57bc1d){for(const _0x9e1ba2 of _0x242f4d['authorsIds'])_0x412bf4(_0x9e1ba2);_0x242f4d['creatorId']&&_0x412bf4(_0x242f4d['creatorId']);}if(0x0===_0x282273['size'])return;const _0x5f3b65=await ct['getMany'](_0x312be0,Array['from'](_0x282273));for(const _0x21b2c3 of _0x5f3b65)_0x2b47bf['getUser'](_0x21b2c3['id'])||_0x2b47bf['addUser'](_0x21b2c3);function _0x412bf4(_0x2e7503){_0x2b47bf['getUser'](_0x2e7503)||_0x282273['add'](_0x2e7503);}}}function q(_0x31ae30){return _0x31ae30['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x31ae30['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x31ae30['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class dt extends _0x5020b7{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 _0x45849d{['_collapseAt'];constructor(_0x13e1a3,_0xcb41c1=0x6){super(_0x13e1a3);const _0x1e69bf=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0xcb41c1,this['bind']('isHidden')['to'](this,'usersCount',_0x2e2198=>_0x2e2198<_0xcb41c1),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x1e69bf['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':_0x1e69bf['to']('usersCount',_0x92d024=>'+'+(_0x92d024-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x45849d{['items'];['keystrokes'];constructor(_0x111878){super(_0x111878);const _0x592f08=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x3b9efd(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x592f08['if']('hasPopup'),'aria-expanded':_0x592f08['to']('isExpanded',_0x5828c0=>this['hasPopup']&&String(_0x5828c0)),'aria-label':_0x592f08['to']('hasPopup',_0x1e91e0=>$(_0x111878,_0x1e91e0?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x592f08['to']('hasPopup',_0x159bc8=>!!_0x159bc8&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x592f08['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x592f08['to'](_0xb6d67a=>{const _0x47dd40=_0xb6d67a,_0x1aa4ce=document['querySelector']('.ck-presence-list__dropdown-list'),_0x5add77=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1aa4ce?.['contains'](_0x47dd40['relatedTarget'])||_0x5add77?.['contains'](_0x47dd40['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x409ef0,_0x10c212,_0x110fd2)=>{this['element']&&(_0x110fd2?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 _0x45849d{['counterView'];['inlineListView'];constructor(_0xb02243,_0x4164ef=0x6){super(_0xb02243);const _0x3f90de=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x4164ef),this['inlineListView']=new is(_0xb02243),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x587fbd of this['inlineListView']['items'])_0x587fbd['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',_0x3f90de['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x45849d{['listWrapperView'];constructor(_0x379dfb,_0x134a8f){super(_0x379dfb);const _0x404d7a=this['bindTemplate'];this['listWrapperView']=new ut(_0x379dfb,_0x134a8f),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':$(_0x379dfb,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x404d7a['to'](_0x40bc35=>{const _0x22b25d=_0x40bc35,_0x23e8ff=document['querySelector']('.ck-presence-list__list'),_0xf6af85=document['querySelector']('.ck-balloon-panel_with-arrow');_0x23e8ff?.['contains'](_0x22b25d['relatedTarget'])||_0xf6af85?.['contains'](_0x22b25d['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class ut extends _0x2b176e{constructor(_0x437418,_0x338b66){super(_0x437418);const _0x3063d3=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x338b66?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x3063d3['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x3063d3['to']('role'),'aria-label':_0x3063d3['to']('ariaLabel'),'aria-labelledby':_0x3063d3['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x423bdf['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x568280=this['element'];_0x568280&&(this['_isScrollable']=Math['max'](_0x568280['scrollHeight'],_0x568280['clientHeight'])>0.8*window['innerHeight']);}}class j extends et{['userView'];constructor(_0x4d20fe,_0x18148b,_0x53ef7d){super(_0x4d20fe);const _0x45ca67=this['bindTemplate'];this['userView']=new st(_0x4d20fe,_0x18148b);const _0x294948={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x18148b['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x18148b['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x18148b['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x53ef7d&&(_0x294948['tag']='button',_0x294948['on']={'click':_0x45ca67['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x294948);}['focus'](){this['element']['focus']();}}class A extends _0x45849d{['userView'];['markerView'];constructor(_0x49c467,_0x527522,_0x288cab){super(_0x49c467);const _0x2b65c2=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new st(_0x49c467,_0x527522),this['markerView']=new ot(_0x49c467,_0x527522);const _0x358fc9=new it(_0x49c467);_0x358fc9['template']['tag']='span',_0x358fc9['text']=_0x527522['name'];const _0x5d5791={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x2b65c2['to']('isFocusable',_0x1f64d8=>!!_0x1f64d8&&0x0),'aria-labelledby':_0x358fc9['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x2b65c2['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x2b65c2['to']('hasTooltip',_0x512a20=>!_0x512a20),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x358fc9]};_0x288cab&&(_0x5d5791['tag']='button',_0x5d5791['on']={'click':_0x2b65c2['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5d5791);}}class ot extends _0x45849d{constructor(_0x5e2d60,_0x2bf292){super(_0x5e2d60),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2bf292['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x382514{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x44d1f4){super(_0x44d1f4),this['context']['config']['define']('presenceList',x);const _0x12b1f3=_0x44d1f4['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x12b1f3)throw new _0x5eee32('presencelist-collapseat-invalid-format',this);if(_0x12b1f3<0x1)throw new _0x5eee32('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x6d1a51(),this['balloonPanelView']=new _0x2c0dd5(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x4557a5 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x4557a5);this['listenTo'](this['_allConnectedUsers'],'add',(_0x4063ca,_0x75ac97)=>{this['_handleUserAdd'](_0x75ac97);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3b9388,_0x5c4b92)=>{this['_handleUserRemove'](_0x5c4b92);});}['_createView'](){const _0x52e9ed=this['context'],_0x39bad5=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x55944d=this['balloonPanelView'];if(!_0xf1dc26(_0x52e9ed['config']['get']('presenceList.container')))throw new _0x5eee32('presencelist-missing-container',this);return _0x39bad5['counterView']['bind']('usersCount')['to'](this),_0x39bad5['bind']('isCollapsed')['to'](this,'usersCount',_0x4d8967=>{const {collapseAt:_0x32b0c5}=_0x52e9ed['config']['get']('presenceList'),_0x2499a6=_0x4d8967>=_0x32b0c5;if(_0x2499a6&&!_0x39bad5['inlineListView']['items']['find'](_0x58f846=>_0x58f846 instanceof b)){const _0x35b031=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x35b031&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x39bad5['inlineListView']['items']['add'](_0x39bad5['counterView']);}return _0x2499a6||this['hideDropdown'](),_0x2499a6;}),_0x39bad5['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x5c89ad=>{const _0x54b571=_0x52e9ed['config']['get']('presenceList'),_0x2a188d=new A(_0x52e9ed['locale'],_0x5c89ad,!!_0x54b571['onClick']);return _0x2a188d['bind']('hasTooltip')['to'](_0x39bad5,'isCollapsed',_0x23e547=>!_0x23e547),_0x2a188d['bind']('isFocusable')['to'](_0x39bad5,'isCollapsed',_0x47848a=>!_0x47848a),_0x54b571['onClick']&&this['listenTo'](_0x2a188d,'execute',()=>{this['view']['isCollapsed']||_0x54b571['onClick'](_0x5c89ad,_0x2a188d['element']);}),_0x2a188d;}),this['listenTo'](_0x39bad5['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x39bad5['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x39bad5['inlineListView']['keystrokes']['set']('Enter',(_0x512619,_0x332b61)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x332b61());}),_0x39bad5['render'](),_0x55944d['render'](),_0x4693a3({'emitter':_0x39bad5,'activator':()=>_0x55944d['isVisible'],'contextElements':[_0x55944d['element'],_0x39bad5['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x52e9ed['config']['get']('presenceList.container')['appendChild'](_0x39bad5['element']),this['_bodyCollection']=new _0x59e840(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x39bad5;}['_handleUserAdd'](_0x4638ac){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x4638ac['isMe'])return;const _0x66600b=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x66600b-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x10bf06=_0x4638ac['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x4638ac,_0x10bf06);}['_handleUserRemove'](_0x316d99){this['usersCount']--;const {collapseAt:_0x3e94cc}=this['context']['config']['get']('presenceList'),_0x37bfb5=this['usersCount']>=_0x3e94cc;if(this['currentDisplayedUsers']['get'](_0x316d99['id']))this['currentDisplayedUsers']['remove'](_0x316d99['id']);else{if(_0x37bfb5&&this['currentDisplayedUsers']['length']+0x1===_0x3e94cc-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x37bfb5?0x1:0x0)<this['usersCount']){for(const _0x2e0bf1 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x2e0bf1['id'])&&(this['currentDisplayedUsers']['add'](_0x2e0bf1,Math['min'](this['currentDisplayedUsers']['length']-(_0x37bfb5?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x37bfb5?0x1:0x0)===_0x3e94cc-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x230b0b=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x230b0b['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x219c1c}=this['presenceDropdownView'];_0x219c1c['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x2c7cbe=>{if(!_0x230b0b['displayMe']&&_0x2c7cbe['isMe'])return null;const _0x2c61dd=new j(this['context']['locale'],_0x2c7cbe,!!_0x230b0b['onClick']);return _0x230b0b['onClick']&&this['listenTo'](_0x2c61dd,'execute',()=>{_0x230b0b['onClick'](_0x2c7cbe,_0x2c61dd['element']);}),_0x2c61dd;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x219c1c['focus'](),_0x219c1c['checkIfScrollable']();const _0x13c7a9=(_0x56706c,_0x36baf1)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x36baf1();};_0x219c1c['keystrokes']['set']('Esc',_0x13c7a9),_0x219c1c['keystrokes']['set']('Shift+Tab',_0x13c7a9),_0x219c1c['keystrokes']['set']('Tab',(_0x1f5d7c,_0x42b78c)=>{!function(_0x9d78cd){const _0x18fbe=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x4376a3=>_0x4376a3+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x58eb90=[...document['body']['querySelectorAll'](_0x18fbe)]['filter'](_0x1a9847=>_0x1a9847===document['activeElement']||_0x1a9847['offsetWidth']+_0x1a9847['offsetHeight']>0x0)['sort']((_0x4575ac,_0x393c72)=>(_0x4575ac['tabIndex']||0x0)-(_0x393c72['tabIndex']||0x0)),_0x347d9c=_0x58eb90['indexOf'](_0x9d78cd),_0x48a5a6=_0x58eb90[(_0x347d9c+0x1)%_0x58eb90['length']];_0x48a5a6&&_0x48a5a6['focus']();}(this['view']['element']),this['hideDropdown'](),_0x42b78c();}),_0x219c1c['focusTracker']['add'](this['view']['element']),_0x219c1c['focusTracker']['on']('change:isFocused',(_0x295303,_0x238cc9,_0x521eb6)=>{_0x521eb6||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 _0x382514{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};
|