@ckeditor/ckeditor5-real-time-collaboration 44.1.0-alpha.3 → 44.1.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 +9 -9
- package/src/presencelist/presencelistui.js +1 -1
- package/src/presencelist/view/presencecounterview.js +1 -1
- package/src/presencelist/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/presencelist/view/presencelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +1 -1
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +1 -1
- package/src/realtimecollaborativeediting/sessions.js +1 -1
- package/src/realtimecollaborativeediting/usermarkers.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.js +1 -1
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +1 -1
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +1 -1
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',_0x2cb949];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x46f87b){super(_0x46f87b),this['set']('state',_0x347654['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x3c3e51);}['init'](){const _0x44441c=this['context'],_0x5dd1d4=_0x44441c['plugins']['get']('CloudServices'),_0x489b51=_0x44441c['plugins']['get'](_0x2cb949);if(!_0x5dd1d4['token'])throw new _0x47f125('websocketgateway-missing-token',this);if(!_0x5dd1d4['webSocketUrl'])throw new _0x47f125('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),c['WebSocketGateway']['connect'](_0x5dd1d4['token'],_0x5dd1d4['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x1ca47a=>{if(this['connection']=_0x1ca47a,this['bind']('state')['to'](_0x1ca47a,'state',this,'_isBrowserOffline',(_0x430f8b,_0x337e5d)=>('connected'!==_0x430f8b&&(this['_shouldPluginsReconnect']=!0x0),_0x337e5d||_0x430f8b!==_0x347654['CONNECTED']?_0x347654['DISCONNECTED']:this['state']==_0x347654['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x347654['CONNECTING']):_0x347654['CONNECTED'])),this['connection']['on']('error',(_0x3010c3,_0x3c0a9e)=>{if('limitExceeded'!==_0x3c0a9e['code'])throw console['error'](_0x3c0a9e),new _0x47f125('cloudservices-init',null,{'originalError':_0x3c0a9e});_0x489b51['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'});}),!_0x1ca47a['me'])return new Promise(_0x1e3098=>_0x1ca47a['on']('change:me',_0x1e3098));})['catch'](_0x32fbcc=>{throw console['error'](_0x32fbcc),new _0x47f125('cloudservices-init',null,{'originalError':_0x32fbcc});});}['addToReconnectionStack'](_0x2288ad){if('function'!=typeof _0x2288ad['reconnect'])throw new _0x47f125('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x2288ad))throw new _0x47f125('websocketgateway-plugin-already-registered',this,{'name':_0x2288ad['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x2288ad);}['removeFromReconnectionStack'](_0x372f21){this['_reconnectionStack']['delete'](_0x372f21);}['isInReconnectionStack'](_0x40264e){return this['_reconnectionStack']['has'](_0x40264e);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x3652b3=>_0x3652b3['reconnect']())))['then'](()=>this['state']=_0x347654['CONNECTED'])['catch'](_0x13c2d4=>{throw console['error'](_0x13c2d4),new _0x47f125('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x347654['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class i extends _0xf32368{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[c,_0x1e9797];}constructor(_0x364cec){super(_0x364cec),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x2fe827(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1e9797);}['init'](){const _0xdae5d9=this['context']['plugins']['get'](c);this['listenTo'](_0xdae5d9,'change:state',(_0x226e49,_0x4e944a,_0x276b4a)=>{if('connected'!==_0x276b4a)this['channelSessions']['forEach'](_0x376a43=>_0x376a43['clear']()),this['channelConnectedUsers']['forEach'](_0x49f568=>_0x49f568['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x17c251,_0x51d65a]of this['_registeredSessions'])for(const _0xcc5045 of _0x51d65a)this['_handleSessionAdd'](_0x17c251,_0xcc5045);}}),this['_createUser'](_0xdae5d9['connection']['me'],!0x0);}['register'](_0x2e0413,_0x5abb8f){if(this['_registeredSessions']['has'](_0x2e0413))throw new _0x47f125('sessions-register-already-registered',null,{'channelId':_0x2e0413});this['_registeredSessions']['set'](_0x2e0413,_0x5abb8f),this['channelSessions']['set'](_0x2e0413,new _0x2fe827()),this['channelConnectedUsers']['set'](_0x2e0413,new _0x2fe827()),this['listenTo'](_0x5abb8f,'add',(_0xa7b01,_0x2a9952)=>this['_handleSessionAdd'](_0x2e0413,_0x2a9952)),this['listenTo'](_0x5abb8f,'remove',(_0x5def71,_0x3b5f8a)=>this['_handleSessionRemove'](_0x2e0413,_0x3b5f8a));for(const _0x22bf09 of _0x5abb8f)this['_handleSessionAdd'](_0x2e0413,_0x22bf09);}['unregister'](_0x179e5e){if(!this['_registeredSessions']['has'](_0x179e5e))throw new _0x47f125('sessions-unregister-not-exist',null,{'channelId':_0x179e5e});const _0x188792=this['_registeredSessions']['get'](_0x179e5e);this['stopListening'](_0x188792);for(const _0x4fc3eb of _0x188792)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x179e5e,_0x4fc3eb);this['_registeredSessions']['delete'](_0x179e5e),this['channelSessions']['delete'](_0x179e5e),this['channelConnectedUsers']['delete'](_0x179e5e);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x179201){for(const _0x34c771 of this['channelSessions']['values']())for(const _0x2c572c of _0x34c771)if(_0x2c572c['id']===_0x179201)return _0x2c572c['user'];}['getUserSessions'](_0x209574,_0x56f653){const _0x5adc58=_0x56f653?[this['channelSessions']['get'](_0x56f653)]:this['channelSessions']['values'](),_0x554220=new Set();for(const _0x254a35 of _0x5adc58)for(const _0x55b135 of _0x254a35)_0x55b135['user']['id']===_0x209574['id']&&_0x554220['add'](_0x55b135['id']);return _0x554220;}['getUserRole'](_0x6cae7a){for(const _0x5713e0 of this['channelSessions']['values']())for(const _0x228105 of _0x5713e0)if(_0x228105['user']===_0x6cae7a)return _0x228105['role'];}['_handleSessionAdd'](_0x52d488,_0x5e170f){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x2b7f8a=_0x5e170f['user'],_0x23620f=this['_users']['getUser'](_0x2b7f8a['id'])||this['_createUser'](_0x2b7f8a),_0x2df5f2=Object['assign']({},_0x5e170f,{'user':_0x23620f});this['channelSessions']['get'](_0x52d488)['add'](_0x2df5f2);const _0x3ff645=this['channelConnectedUsers']['get'](_0x52d488);_0x3ff645['has'](_0x23620f['id'])||_0x3ff645['add'](_0x23620f),this['allConnectedUsers']['has'](_0x23620f['id'])||this['allConnectedUsers']['add'](_0x23620f,_0x23620f['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x52d488,{'channelId':_0x52d488,'session':_0x2df5f2});}['_handleSessionRemove'](_0xd76203,_0x3358e5){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0xf3783e=this['channelConnectedUsers']['get'](_0xd76203),_0x539e8b=_0x3358e5['user'];_0x539e8b['id']&&(this['channelSessions']['get'](_0xd76203)['remove'](_0x3358e5['id']),_0xf3783e['has'](_0x539e8b['id'])&&!this['getUserSessions'](_0x539e8b,_0xd76203)['size']&&_0xf3783e['remove'](_0x539e8b['id']),this['allConnectedUsers']['get'](_0x539e8b['id'])&&!this['getUserSessions'](_0x539e8b)['size']&&this['allConnectedUsers']['remove'](_0x539e8b['id']));}['_createUser'](_0x58b8bf,_0x51df03){const _0x5325f7=this['_users']['addUser'](_0x58b8bf);return _0x51df03&&this['_users']['defineMe'](_0x58b8bf['id']),_0x5325f7['orderNumber']=this['_uniqueUsersCount']++,_0x5325f7;}}class J extends _0x54be99{['_domEmitter']=new(_0x3c3e51())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x2baa59=this['editor'],_0x494b8e=_0x2baa59['plugins']['get'](i);_0x2baa59['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x16f887,{writer:_0x44cc30})=>function(_0x477584,_0x3ae0db,_0x4896e5,_0x54e2b6){const _0x50b785=_0x477584['markerName']['split'](':')[0x2],_0x1d0e58=_0x4896e5['getUserBySessionId'](_0x50b785);if(!_0x1d0e58||_0x50b785===_0x4896e5['mySessionId'])return;if(!_0x54e2b6['model']['schema']['checkChild'](_0x477584['markerRange']['start'],'$text'))return;const _0x4e3630={'class':'ck-user__marker\x20'+_0x1d0e58['color']['getMarkerClass'](),'data-name':_0x1d0e58['name'],'data-session-id':_0x50b785},_0xae34df=_0x54e2b6['model']['markers']['get'](_0x477584['markerName']),_0x58eb6f=_0xae34df['getStart'](),_0x3b1a5c=_0x58eb6f['nodeAfter'],_0x2c0ff8=_0x54e2b6['model']['schema'];if(_0x3b1a5c&&_0x2c0ff8['isObject'](_0x3b1a5c)&&_0x2c0ff8['isInline'](_0x3b1a5c)&&!_0x54e2b6['model']['markers']['get']('user:range:'+_0x50b785)['getRange']()['isCollapsed'])return;const _0x17e284=_0x58eb6f['parent'];return _0x54e2b6['model']['schema']['isLimit'](_0x17e284)&&!_0x54e2b6['model']['hasContent'](_0x17e284)&&(_0x4e3630['contenteditable']=!0x1),function(_0x5334c6,_0x4542b8,_0x146eed){const _0x565d7b=_0x5334c6['createUIElement']('span',_0x4542b8);return _0x5334c6['setCustomProperty']('userPositionMarker',!0x0,_0x565d7b),_0x565d7b['render']=function(_0x3c1050){const _0x3a83f4=this['toDomElement'](_0x3c1050);return _0x3a83f4['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span><span\x20class=\x22ck-user__marker-tooltip\x22\x20contenteditable=\x22false\x22\x20spellcheck=\x22false\x22>'+_0x146eed['name']+'</span>',_0x3a83f4['addEventListener']('mouseenter',()=>{_0x3a83f4['classList']['add']('ck-user__marker_hovered');}),_0x3a83f4['addEventListener']('mouseleave',()=>{_0x3a83f4['classList']['remove']('ck-user__marker_hovered');}),_0x3a83f4;},_0x565d7b['isSimilar']=function(_0xf1f27e){return!(!this['getCustomProperty']('userPositionMarker')||!_0xf1f27e['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0xf1f27e['getAttribute']('data-session-id'));},_0x565d7b;}(_0x3ae0db,_0x4e3630,_0x1d0e58);}(_0x16f887,_0x44cc30,_0x494b8e,_0x2baa59)}),_0x2baa59['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x5ba6b1=>function(_0x20b672,_0x5288d5){const _0x402ac7=_0x20b672['markerName']['split'](':')[0x2];if(_0x402ac7===_0x5288d5['mySessionId'])return null;const _0x15cee7=_0x5288d5['getUserBySessionId'](_0x402ac7);if(!_0x15cee7)return{'id':_0x402ac7,'classes':[]};return{'id':_0x402ac7,'classes':['ck-user__selection',_0x15cee7['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x402ac7},'priority':0x7d0+_0x15cee7['orderNumber']};}(_0x5ba6b1,_0x494b8e)}),function(_0x3b333a){const _0x46e382=_0x3b333a['model'],_0x24e484=new Map(),_0x169cf2=_0x3b333a['plugins']['get'](i);_0x46e382['markers']['on']('update:user:range',(_0x20ff0f,_0xbc7bb9,_0x32eced,_0x2db3d7)=>{if(!_0x2db3d7&&_0x24e484['get'](_0xbc7bb9['name']))return _0x24e484['get'](_0xbc7bb9['name'])['detach'](),void _0x24e484['delete'](_0xbc7bb9['name']);const _0x538a5c=_0xbc7bb9['name']['split'](':')[0x2];if(_0x538a5c===_0x169cf2['mySessionId'])return;const _0x55bbda='user:position:'+_0x538a5c;_0x46e382['markers']['has'](_0x55bbda)&&_0x3b333a['editing']['reconvertMarker'](_0x55bbda),_0xbc7bb9['on']('change:range',(_0x16d07e,_0x3f1ef7,_0x50411f)=>{if('$graveyard'!=_0x3f1ef7['root']['rootName']&&'$graveyard'==_0xbc7bb9['getRange']()['root']['rootName']&&!_0x24e484['has'](_0xbc7bb9['name'])){const _0x3505a0=_0x46e382['schema']['getNearestSelectionRange'](_0x50411f['deletionPosition']);if(_0x3505a0){const _0x5110a6=at['fromRange'](_0x3505a0);_0x24e484['set'](_0xbc7bb9['name'],_0x5110a6),_0x5110a6['on']('change:range',(_0x1651cc,_0x298655,_0x178ee8)=>{if('$graveyard'==_0x5110a6['root']['rootName']){const _0x909439=_0x46e382['schema']['getNearestSelectionRange'](_0x178ee8['deletionPosition']);_0x909439?(_0x5110a6['start']=_0x909439['start'],_0x5110a6['end']=_0x909439['end']):(_0x24e484['delete'](_0xbc7bb9['name']),_0x5110a6['detach']());}});}}});}),_0x46e382['document']['on']('change',()=>{_0x24e484['size']>0x0&&_0x46e382['enqueueChange']({'isUndoable':!0x1},_0x4b3086=>{for(const [_0x2f8849,_0x1573ba]of _0x24e484)'$graveyard'==_0x46e382['markers']['get'](_0x2f8849)['getRange']()['root']['rootName']&&(te(_0x2f8849['split'](':')[0x2],_0x1573ba['toRange'](),_0x46e382,_0x4b3086),_0x1573ba['detach']());_0x24e484['clear']();});});}(_0x2baa59),this['_domEmitter']['listenTo'](_0x1d2af1['document'],'keydown',(_0x333f18,{key:_0x1e4585})=>{'Escape'===_0x1e4585&&function(_0x259242){_0x259242['editing']['view']['change'](_0x1d6165=>{for(const _0x165725 of _0x259242['model']['markers']){if(!_0x165725['name']['startsWith']('user:position'))continue;const _0x5d8c51=_0x259242['editing']['mapper']['markerNameToElements'](_0x165725['name']);if(_0x5d8c51){for(const _0x11e82e of _0x5d8c51)_0x1d6165['removeClass']('ck-user__marker_hovered',_0x11e82e);}}});}(_0x2baa59);},{'useCapture':!0x0});}['afterInit'](){const _0x166270=this['editor'],_0x564ea7=_0x166270['commands']['get']('undo');_0x564ea7&&_0x166270['model']['on']('applyOperation',(_0x40aa0c,_0x13d7e3)=>{const _0x32ff88=_0x13d7e3[0x0];if('marker'!=_0x32ff88['type']||!_0x32ff88['name']['startsWith']('user:'))return;const _0x4948d2=_0x32ff88['batch'];_0x564ea7['_createdBatches']['has'](_0x4948d2)&&(_0x32ff88['newRange']=_0x32ff88['oldRange']?_0x166270['model']['createRange'](_0x32ff88['oldRange']['start'],_0x32ff88['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x5cde50=this['editor'],_0xe5d96b=_0x5cde50['model']['document'],_0x4e83d5=_0x5cde50['plugins']['get'](i);_0x5cde50['model']['enqueueChange']({'isUndoable':!0x1},_0x11a05d=>{const _0x299dc1='user:range:'+_0x4e83d5['mySessionId'],_0x849962='user:position:'+_0x4e83d5['mySessionId'],_0x190960=_0x5cde50['model']['markers']['has'](_0x299dc1);_0x5cde50['editing']['view']['hasDomSelection']?te(_0x4e83d5['mySessionId'],_0xe5d96b['selection']['getFirstRange'](),_0x5cde50['model'],_0x11a05d):_0x190960&&(_0x11a05d['removeMarker'](_0x299dc1),_0x11a05d['removeMarker'](_0x849962));});}}function te(_0x5e52c9,_0x1a51b1,_0x595038,_0x2a9f3c){const _0x5ef373='user:range:'+_0x5e52c9,_0x178520='user:position:'+_0x5e52c9,_0xe95ff1=_0x1a51b1['getContainedElement']();let _0x5382c0=_0x1a51b1['start'];_0xe95ff1&&_0xe95ff1['is']('element','tableCell')&&(_0x5382c0=function(_0x42686d,_0x12101b){for(const _0x581abc of _0x42686d['getPositions']())if(_0x12101b['schema']['checkChild'](_0x581abc,'$text'))return _0x581abc;}(_0x1a51b1,_0x595038),_0x1a51b1=_0x2a9f3c['createRange'](_0x5382c0));const _0x4d4788=_0x2a9f3c['createRange'](_0x5382c0);_0x595038['markers']['has'](_0x5ef373)?(_0x2a9f3c['updateMarker'](_0x5ef373,{'range':_0x1a51b1}),_0x2a9f3c['updateMarker'](_0x178520,{'range':_0x4d4788})):(_0x2a9f3c['addMarker'](_0x5ef373,{'range':_0x1a51b1,'usingOperation':!0x0}),_0x2a9f3c['addMarker'](_0x178520,{'range':_0x4d4788,'usingOperation':!0x0}));}function Q(_0x5d461b,_0x57a324,_0x35f02d){const _0x4bb02b=_0x5d461b['t'],t=_0x5d461b['t'];switch(_0x57a324){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 _0x4bb02b({'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'},_0x35f02d);default:return'';}}let Z=0x1;class l extends _0x54be99{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x49dce4)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,J,_0x45e8ba,_0x1e9797,_0x2cb949];}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 _0x5f48da=this['serverHistory']['getOperations']();for(let _0xa171bb=_0x5f48da['length']-0x1;_0xa171bb>=0x0;_0xa171bb--){const _0x577ee8=_0x5f48da[_0xa171bb];if(!this['_disconnectionOperations']['has'](_0x577ee8))return _0x577ee8['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x4a84ee){if(super(_0x4a84ee),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x304a65(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x47f125('collaboration-missing-channelid',this);const _0xf0ca04=_0x4a84ee['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0xf0ca04,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x395e46(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new st(this['_disconnectionOperations']);}['init'](){const _0x46e656=this['editor'],_0x2c430e=_0x46e656['plugins']['get'](_0x1e9797),_0x28949d=_0x46e656['plugins']['get'](c);this['listenTo'](_0x2c430e,'getOperationAuthor',(_0x4034d7,_0x64d4b9)=>{const _0x5712f1=_0x64d4b9[0x0];_0x5712f1['_authorId']&&(_0x4034d7['return']=_0x2c430e['getUser'](_0x5712f1['_authorId']),_0x4034d7['stop']()),null===_0x5712f1['_authorId']&&(_0x4034d7['return']=null,_0x4034d7['stop']());},{'priority':'high'}),this['listenTo'](_0x46e656['model']['document']['selection'],'change:range',(_0x5f210b,_0xba1520)=>{_0xba1520['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x46e656['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x46e656['model']['on']('applyOperation',(_0x3cb04b,_0x280520)=>{const _0x69f2fa=_0x280520[0x0];_0x69f2fa['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x69f2fa),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x28949d,'state',this,'_hasSynchronizationProblem',(_0x1e1bc0,_0x184257)=>'connected'===_0x1e1bc0&&!_0x184257),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x46e656['disableReadOnlyMode']('rtc-offline'):_0x46e656['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x46e656['disableReadOnlyMode']('rtc-offline'):_0x46e656['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x37ec0c=this['editor']['plugins']['get'](i),_0x1b84d1=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x37ec0c['unregister'](this['_channelId']);const _0x497dd7=await this['_service']['reconnect'](_0x1b84d1['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x497dd7)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x5ad4b2=await this['_service']['getConnectedSessions']();_0x37ec0c['register'](this['_channelId'],_0x5ad4b2),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x31e68e){if(function(_0x1056e7){return'404'===_0x1056e7['code'];}(_0x31e68e)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0xd3e527){return'409'===_0xd3e527['code'];}(_0x31e68e)){const _0x1cb8a9=Q(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x1cb8a9);}else{if(!(_0x31e68e instanceof tt))throw _0x31e68e;this['_handleReconnectionError']();}}}}['destroy'](){const _0xbe6408=this['editor']['plugins']['get'](c),_0x57541a=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x57541a['channelSessions']['has'](this['_channelId'])&&_0x57541a['unregister'](this['_channelId']),_0xbe6408['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x4b4745){if(this['sessionId']!==_0x4b4745['sessionId']&&this['_lastSyncedOperationId']!==_0x4b4745['lastOperationId'])throw new tt();return this['sessionId']=_0x4b4745['sessionId'],this['_handleServerResponse']([],{..._0x4b4745,'wereChangesApplied':!0x1,'data':_0x4b4745['data']},'reconnect');}async['_connectService'](_0x2f0e63,_0x4700d6=!0x1){const {connection:_0x33efba}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x33efba,this['_channelId'])['then'](_0xa44d1e=>this['_initSessionsHandling'](_0xa44d1e))['catch'](_0x1e14ca=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1e14ca);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x24b019,_0x20e629)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x20e629);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x727d1e=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2f0e63);this['_isPendingUpdate']=!0x0;const _0x374828=await this['_service']['connect'](_0x33efba,this['_compressOperations'](_0x2f0e63),_0x727d1e);if(this['sessionId']=_0x374828['sessionId'],_0x4700d6){if(!_0x374828['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x374828['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x2f0e63,_0x374828,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x374828,_0x2f0e63);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x10fd68=this['editor']['plugins']['get'](i),_0x4a72ef=this['editor']['plugins']['get'](J),_0xd547f4=_0x10fd68['channelSessions']['get'](this['_channelId']);_0xd547f4&&_0xd547f4['length']>0x1?_0x4a72ef['createUserMarkerOperations']():this['listenTo'](_0x10fd68,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x10fd68['channelSessions']['get'](this['_channelId'])['length']&&_0x4a72ef['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x49fe99,_0x137723,_0x4d3f66,_0x8eb27b){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x137723){const _0x165af6=this['_decompressOperations'](_0x4d3f66,_0x8eb27b);await this['_fetchMissingUsers'](_0x165af6),this['_handleExternalOperations'](_0x165af6,_0x137723,_0x4d3f66['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x36289f}=this['editor'];let _0x22e45f;try{_0x22e45f=await this['_service']['getDocumentDetails']();}catch(_0x544180){const _0x57f2ec=Q(_0x36289f,'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'](_0x57f2ec);}const _0x2d2141=_0x22e45f['currentDocumentSession']||_0x22e45f['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x2d2141['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x23c440=Q(_0x36289f,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x23c440);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x197c8e){const _0x39dcb3=this['editor']['plugins']['get'](i);this['listenTo'](_0x39dcb3,'sessionAdd:'+this['_channelId'],(_0x49b797,{session:_0x5cd0ec})=>{if(_0x5cd0ec['id']===_0x39dcb3['mySessionId']){_0x49b797['off']();const _0x59fc27=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x7192b0=_0x5cd0ec['permissions'];_0x59fc27&&_0x59fc27['isEnabled']&&(_0x7192b0=_0x7192b0['filter'](_0x360100=>'document:write'!==_0x360100)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x7192b0,this['_channelId']);}}),_0x39dcb3['register'](this['_channelId'],_0x197c8e);}['_initThrowingOnDataSet'](){const _0x4f167f=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x42c0d0)=>{if(!_0x42c0d0[_0x42c0d0['length']-0x1]['suppressErrorInCollaboration'])throw new _0x47f125('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x4f167f['apply'](this['editor']['data'],_0x42c0d0);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x36498f,[_0x1dba46])=>{if(this['_document']['version'])throw new _0x47f125('realtimecollaborationclient-init-document-already-initialized',this);_0x36498f['stop'](),this['_setPendingAction']();const _0x57797b=this['editor']['config']['get']('rootsAttributes'),_0x514828=this['_getOperationsFromInitData'](_0x1dba46,_0x57797b);0x0==_0x514828['length']&&_0x514828['push'](new _0x452668(0x0)),_0x36498f['return']=this['_connectService'](_0x514828)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x469275=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x469275))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x1901a7,[_0x16d0ac,_0x5f0a15])=>{_0x1901a7['stop']();const _0x1efbd3=this['editor']['model']['document']['getRoot'](_0x16d0ac);if(!this['_knownRootNames']['has'](_0x16d0ac)){const _0x41b9ec=_0x5f0a15&&_0x5f0a15['data']?_0x5f0a15['data']:'',_0x3def4d=_0x5f0a15&&_0x5f0a15['attributes']?_0x5f0a15['attributes']:{};await this['_loadRoot'](_0x16d0ac,_0x41b9ec,_0x3def4d);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x1efbd3['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x1efbd3);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xcc850d){const _0x5920ce=this['editor']['plugins']['get'](_0x1e9797),{connection:_0x273c4f}=this['editor']['plugins']['get'](c),_0x37560f=new Set();for(const _0x16282e of _0xcc850d){const _0x3a9145=_0x16282e['_authorId'];_0x3a9145&&!_0x5920ce['getUser'](_0x3a9145)&&_0x37560f['add'](_0x3a9145);}if(0x0===_0x37560f['size'])return;const _0x168a3c=await lt['getMany'](_0x273c4f,Array['from'](_0x37560f));for(const _0x4b6b0b of _0x168a3c)_0x5920ce['getUser'](_0x4b6b0b['id'])||_0x5920ce['addUser'](_0x4b6b0b);}['_getOperationsFromInitData'](_0x289c7c,_0x567b82={}){const _0x353f79=this['editor']['model'],_0x2818ee=[];let _0x1c9508=0x0;const _0x2203f1='string'==typeof _0x289c7c?{'main':_0x289c7c}:_0x289c7c;for(const _0x1a06fd of Object['keys'](_0x2203f1)){if(!this['_document']['roots']['has'](_0x1a06fd))throw new _0x47f125('realtimecollaborationclient-init-non-existent-root',this);const _0x3ec0d4=this['editor']['data']['parse'](_0x2203f1[_0x1a06fd]),_0x2dcc8f=this['_document']['getRoot'](_0x1a06fd),_0x599ba9=new _0x21d99d(_0x353f79['createPositionAt'](_0x2dcc8f,0x0),_0x3ec0d4,_0x1c9508++);_0x2818ee['push'](_0x599ba9);for(const [_0x4b5a3c,_0x4411ea]of _0x3ec0d4['markers']){const _0x1b226f=_0x353f79['createRange'](_0x353f79['createPositionFromPath'](_0x2dcc8f,_0x4411ea['start']['path']['slice']()),_0x353f79['createPositionFromPath'](_0x2dcc8f,_0x4411ea['end']['path']['slice']())),_0x364da9=new _0x3dccf2(_0x4b5a3c,null,_0x1b226f,_0x353f79['markers'],!0x0,_0x1c9508++);_0x2818ee['push'](_0x364da9);}}if(_0x567b82)for(const [_0x592ff8,_0x1562eb]of Object['entries'](_0x567b82)){const _0x3d14a4=_0x353f79['document']['getRoot'](_0x592ff8);if(!_0x3d14a4)throw new _0x47f125('multi-root-editor-root-attributes-no-root',null);for(const [_0x2097f3,_0x44494d]of Object['entries'](_0x1562eb))if(null!==_0x44494d){const _0xd7229d=new _0x16d8c6(_0x3d14a4,_0x2097f3,null,_0x44494d,_0x1c9508++);_0x2818ee['push'](_0xd7229d);}}return _0x2818ee;}async['_loadRoot'](_0x90edc9,_0x2658e6,_0x23bbc8){this['_getOperationsFromInitData']({[_0x90edc9]:_0x2658e6},{[_0x90edc9]:_0x23bbc8})['forEach']((_0x147fb8,_0x567b64)=>{_0x147fb8['baseVersion']=this['_document']['version']+_0x567b64,_0x147fb8['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x147fb8);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x55e580,_0x4c4ae4){let _0xcb3539;this['_offset']=_0x55e580['offset'];const _0x420566=_0x55e580['wereChangesApplied']&&!_0x55e580['initData'],_0x19eda6=_0x420566?0x0:_0x55e580['data']['baseVersion'];if(_0x4c4ae4['forEach'](_0x3cb112=>{_0x3cb112['_isInit']=!0x0,_0x3cb112['createdAt']=_0x55e580['sessionCreatedAt'],_0x3cb112['_authorId']=null;}),_0x420566)_0xcb3539=_0x4c4ae4,this['_applyOperationsSet'](_0xcb3539,_0x420566);else{if(_0x55e580['initData']){const _0x252b62=this['_getOperationsFromInitData'](_0x55e580['initData']);this['_document']['history']['version']=-_0x252b62['length'],_0x252b62['forEach'](_0x1d1d99=>{_0x1d1d99['baseVersion']-=_0x252b62['length'],_0x1d1d99['createdAt']=_0x55e580['sessionCreatedAt'],_0x1d1d99['_isInit']=!0x0,_0x1d1d99['_authorId']=null;}),this['_applyOperationsSet'](_0x252b62,!0x0),this['serverHistory']['version']=-_0x252b62['length']+this['_offset'],this['_updateServerHistory'](_0x252b62);}this['_document']['history']['version']=_0x19eda6,_0xcb3539=this['_decompressOperations'](_0x55e580['data'],_0x55e580['metadata']),await this['_fetchMissingUsers'](_0xcb3539),this['_applyOperationsSet'](_0xcb3539,_0x420566);}_0x55e580['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xcb3539,_0x55e580['lastOperationId']),this['_lastSyncedOperationId']=_0x55e580['lastOperationId']),this['serverHistory']['version']=_0x19eda6+this['_offset'],this['_updateServerHistory'](_0xcb3539),_0x4c4ae4['filter'](_0x8b073e=>{const _0x43ed15=this['_getAffectedRoot'](_0x8b073e);return _0x43ed15&&!this['_knownRootNames']['has'](_0x43ed15);})['forEach']((_0x576465,_0x500489)=>{_0x576465['baseVersion']=this['_document']['version']+_0x500489,this['_saveOperationInBuffer'](_0x576465);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3414c8,_0x568804,_0x3b9623){throw this['_isPendingUpdate']=!0x0,_0x568804&&console['error'](_0x568804),_0x3b9623&&this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x47f125(_0x3414c8,this['editor']);}['_saveOperationInBuffer'](_0x1d4c7d){this['_knownOperations']['has'](_0x1d4c7d)||(this['_knownOperations']['add'](_0x1d4c7d),this['_bufferedOperations']['push'](_0x1d4c7d),this['_pendingAction']||'marker'==_0x1d4c7d['type']&&!_0x1d4c7d['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x3118e4=!0x1){!_0x3118e4&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x264686=>{_0x264686&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x411a2f=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x25294a){return _0x25294a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x25294a['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x25294a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x411a2f)||this['_crash'](_0x411a2f['message'],_0x411a2f,!0x0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x550de6=>{this['on']('change:_isPendingUpdate',()=>{_0x550de6();});});}async['_sendBufferedOperations'](){const _0x3687d0=this['editor']['plugins']['get'](J);if(this['_shouldSendSelectionUpdate']()&&(_0x3687d0['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x264b46=[...this['_bufferedOperations']];for(const _0x477667 of _0x264b46)_0x477667['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x477667);const _0x29eb3a=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x264b46),_0x59f7d2=Z++,_0x27b0bd=this['_compressOperations'](_0x264b46),_0x4cef04=await this['_service']['sendOperations'](_0x27b0bd,_0x27b0bd['baseVersion'],_0x29eb3a);try{return await this['_handleServerResponse'](_0x264b46,_0x4cef04,_0x59f7d2);}catch(_0x5c21e8){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x5c21e8);}}async['_handleServerResponse'](_0x56ab96,_0x3b0f38,_0x1c07f5){if('error'in _0x3b0f38)throw _0x3b0f38['error'];let _0x2820d9=!0x1;if(_0x3b0f38['wereChangesApplied']){_0x3b0f38['lastOperationId']&&(this['_lastSyncedOperationId']=_0x3b0f38['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3c80c7=>!_0x56ab96['includes'](_0x3c80c7));for(const _0x22c07b of _0x56ab96)_0x22c07b['createdAt']='lastOperationAcceptedAt'in _0x3b0f38&&_0x3b0f38['lastOperationAcceptedAt']||void 0x0;it(_0x56ab96,_0x3b0f38['version']-_0x56ab96['length']),this['_updateServerHistory'](_0x56ab96);const _0x38f03c=_0x56ab96['filter'](_0x18f5e0=>{if(!_0x18f5e0['_isInit'])return!0x1;const _0x2294ca=this['_getAffectedRoot'](_0x18f5e0);return _0x2294ca&&!this['_knownRootNames']['has'](_0x2294ca);});it(_0x38f03c,this['_document']['version']),this['_applyOperationsSet'](_0x38f03c),_0x2820d9=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x104a68=this['_decompressOperations'](_0x3b0f38['data'],_0x3b0f38['metadata'])['filter'](_0x56f9f1=>_0x56f9f1['baseVersion']>=this['_lastServerVersion']);_0x104a68['forEach'](_0x5023aa=>this['_addKnownRoot'](_0x5023aa)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x377389=>!_0x377389['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x377389))),this['_bufferedOperations']['length']&&it(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x104a68),_0x2820d9=this['_handleExternalOperations'](_0x104a68,_0x3b0f38['version'],_0x3b0f38['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x2820d9?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x5d4747,_0x2ae268,_0x17013f){try{const _0x3f8c2a={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x2d03d7,operationsB:_0x2c6295,originalOperations:_0x33302b}=_0x312986(_0x5d4747,this['_bufferedOperations'],_0x3f8c2a);it(_0x2d03d7,this['_document']['version']),it(_0x2c6295,_0x2ae268);for(const _0x2b413d of _0x2d03d7){const _0x445481=_0x33302b['get'](_0x2b413d);_0x2b413d['_authorId']=_0x445481?_0x445481['_authorId']:null;}_0x17013f&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5d4747,_0x17013f),this['_lastSyncedOperationId']=_0x17013f),this['_bufferedOperations']=[..._0x2c6295],this['_applyOperationsSet'](_0x2d03d7),this['_updateServerHistory'](_0x5d4747);}catch(_0x2d057b){return console['error'](_0x2d057b),!0x1;}return!0x0;}['_applyOperationsSet'](_0x28bd08,_0x22b65d=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x50080e=>{for(const _0x13a500 of _0x28bd08)this['_knownOperations']['add'](_0x13a500),this['_addKnownRoot'](_0x13a500),_0x50080e['batch']['addOperation'](_0x13a500),this['editor']['model']['applyOperation'](_0x13a500);});}['_addKnownRoot'](_0x26ce67){const _0x52c34a=this['_getAffectedRoot'](_0x26ce67);_0x52c34a&&this['_knownRootNames']['add'](_0x52c34a);}['_getAffectedRoot'](_0xc388ae){let _0x38b4d5,_0x37e6d4;switch(_0xc388ae['type']){case'insert':_0x38b4d5=_0xc388ae['position']['root'];break;case'marker':if(_0x37e6d4=_0xc388ae['newRange'],!_0x37e6d4)return null;_0x38b4d5=_0x37e6d4['root'];break;case'addRootAttribute':_0x38b4d5=_0xc388ae['root'];break;case'addRoot':_0x38b4d5=_0xc388ae['affectedSelectable'];break;case'move':_0x38b4d5=_0xc388ae['targetPosition']['root'];break;default:return null;}return _0x38b4d5['rootName'];}['_updateServerHistory'](_0x32a571){_0x32a571['forEach'](_0x1934ae=>{const _0x3b5846=_0x1934ae['clone']();_0x3b5846['_authorId']=_0x1934ae['_authorId'],_0x3b5846['_isInit']=!!_0x1934ae['_isInit'],_0x3b5846['createdAt']=_0x1934ae['createdAt'],_0x3b5846['baseVersion']+=this['_offset'],_0x1934ae['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x3b5846),this['serverHistory']['addOperation'](_0x3b5846);});}['_handleReconnectionError'](_0x2cd85d){const _0x414c97=this['editor']['plugins']['get']('Notification'),_0x51fcca=this['editor']['locale'];_0x2cd85d||(_0x2cd85d=Q(_0x51fcca,'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.')),_0x414c97['showWarning'](_0x2cd85d,{'title':Q(_0x51fcca,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['destroy']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x45e8ba)['add'](Q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x45e8ba)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x6f948){const _0x2eac31=_0x6f948['map'](_0x5b0c2b=>_0x5b0c2b['toJSON']());return this['_compressor']['compress'](_0x2eac31);}['_decompressOperations'](_0x9eeee6,_0x2f96c1){return this['_compressor']['decompress'](_0x9eeee6)['map']((_0x3656fb,_0x5a8956)=>{const _0x44c19f='init'==_0x2f96c1[_0x5a8956]['type'];if('InsertOperation'==_0x3656fb['__className']){const _0xdafa4d=_0x3656fb['position']['root'];!this['_document']['getRoot'](_0xdafa4d)&&(this['_document']['createRoot']('$root',_0xdafa4d)['_isAttached']=!0x1);}const _0x1af5e5=_0x444cba['fromJSON'](_0x3656fb,this['_document']);return _0x1af5e5['wasUndone']=_0x3656fb['wasUndone'],_0x1af5e5['_isInit']=_0x44c19f,_0x1af5e5['_authorId']=_0x44c19f?null:_0x2f96c1[_0x5a8956]['userId'],_0x1af5e5['_isDisconnection']='cs:removeUser'===_0x2f96c1[_0x5a8956]['type'],_0x1af5e5['createdAt']=_0x2f96c1[_0x5a8956]['createdAt'],_0x1af5e5;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x501848=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x501848&&_0x501848['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class tt extends Error{}function it(_0x2f7835,_0x59a0c2){for(const _0x3d4074 of _0x2f7835)_0x3d4074['baseVersion']=_0x59a0c2++;}class st{['_ignoredOperations'];['_operationToId'];constructor(_0x25c302){this['_ignoredOperations']=_0x25c302,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x3ee824){let _0x1a7df4=_0x3ee824['length'];for(;_0x1a7df4--;){const _0x41c3fd=_0x3ee824[_0x1a7df4];if(!this['_ignoredOperations']['has'](_0x41c3fd)){if(!this['_operationToId']['has'](_0x41c3fd)){const _0x4939c3=_0x5cace2()['slice'](0x1,0x12);this['_operationToId']['set'](_0x41c3fd,_0x4939c3);}return this['_operationToId']['get'](_0x41c3fd);}}}['setIdForTheLastOperation'](_0x136ac6,_0x4aa472){if(!_0x4aa472)return;let _0x5e8794=_0x136ac6['length'];for(;_0x5e8794--;){const _0x22bd7e=_0x136ac6[_0x5e8794];this['_ignoredOperations']['has'](_0x22bd7e)||this['_operationToId']['set'](_0x22bd7e,_0x4aa472);}}}class n extends _0x54be99{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0xf32368{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x77088c)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x1e9797];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x404d25){super(_0x404d25),this['_services']=new Map();}async['init'](){const _0x5c8504=this['context'],_0xd9c63b=_0x5c8504['plugins']['get']('CommentsRepository');if(_0x5c8504['plugins']['get'](c)['addToReconnectionStack'](this),_0xd9c63b['adapter']={'addCommentThread':async({channelId:_0x229c37,threadId:_0x250aee,comments:_0xc9e4dd,resolvedAt:_0x295097,resolvedBy:_0x37bae5,context:_0x53a39c,attributes:_0x3a0023})=>{const _0x1df1c6=await this['_getService'](_0x229c37)['addCommentThread']({'commentThreadId':_0x250aee,'comments':_0xc9e4dd['map'](_0x2ad7db=>function(_0xf3ba2e,_0x358f4f,_0x4e31b6){return{'commentThreadId':_0x4e31b6,'commentId':_0xf3ba2e['commentId'],'userId':_0xf3ba2e['authorId'],'content':_0xf3ba2e['content'],'documentId':_0x358f4f,'createdAt':_0xf3ba2e['createdAt'],'attributes':_0xf3ba2e['attributes']||{}};}(_0x2ad7db,_0x229c37,_0x250aee)),'resolvedAt':_0x295097,'resolvedBy':_0x37bae5,'context':_0x53a39c,'attributes':_0x3a0023})['catch'](dt);return{'threadId':_0x1df1c6['commentThreadId'],'comments':_0x1df1c6['comments']};},'getCommentThread':async({channelId:_0x4832af,threadId:_0x16902e})=>{const _0xe9f60b=await this['_getService'](_0x4832af)['getCommentThread'](_0x16902e)['catch'](dt);return _0xe9f60b['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0xe9f60b]),{'threadId':_0xe9f60b['commentThreadId'],'comments':_0xe9f60b['comments']['map'](S),'context':_0xe9f60b['context'],'resolvedAt':_0xe9f60b['resolvedAt'],'resolvedBy':_0xe9f60b['resolvedBy'],'attributes':_0xe9f60b['attributes']||{}});},'updateCommentThread':async({channelId:_0x3ceafe,threadId:_0x187916,context:_0x271bb8,unlinkedAt:_0x305adb,attributes:_0x3d89aa})=>this['_getService'](_0x3ceafe)['updateCommentThread']({'commentThreadId':_0x187916,'context':_0x271bb8,'attributes':_0x3d89aa,'unlinkedAt':_0x305adb})['catch'](B)['catch'](dt),'resolveCommentThread':async({channelId:_0xfb9591,threadId:_0xce15d0})=>{const _0xf11b20=await this['_getService'](_0xfb9591)['resolveCommentThread'](_0xce15d0)['catch'](B)['catch'](dt);return{'threadId':_0xf11b20['commentThreadId'],'resolvedAt':_0xf11b20['resolvedAt'],'resolvedBy':_0xf11b20['resolvedBy']};},'reopenCommentThread':async({channelId:_0x59abf8,threadId:_0x1e61fd})=>this['_getService'](_0x59abf8)['reopenCommentThread'](_0x1e61fd)['catch'](B)['catch'](dt),'removeCommentThread':({channelId:_0x3bd265,threadId:_0x36dccc})=>this['_getService'](_0x3bd265)['removeCommentThread'](_0x36dccc)['catch'](B)['catch'](dt),'addComment':({channelId:_0x3c7701,threadId:_0x108bad,commentId:_0x39efb5,content:_0xf8f601,attributes:_0x3ae504})=>this['_getService'](_0x3c7701)['addComment'](_0x108bad,_0x39efb5,_0xf8f601,_0x3ae504)['catch'](dt),'updateComment':({channelId:_0x10bddd,threadId:_0x42e9e6,commentId:_0x2c1d45,content:_0x21f9ba,attributes:_0x3559b3})=>this['_getService'](_0x10bddd)['updateComment'](_0x42e9e6,_0x2c1d45,_0x21f9ba,_0x3559b3)['catch'](B)['catch'](dt),'removeComment':({channelId:_0x3eb3a2,threadId:_0x3c090b,commentId:_0x3d76b2})=>this['_getService'](_0x3eb3a2)['removeComment'](_0x3c090b,_0x3d76b2)['catch'](B)['catch'](dt)},_0x5c8504 instanceof _0x3b8260){const _0x3ba4e4=_0x5c8504['config']['get']('collaboration.channelId'),_0x16983c=_0x5c8504['plugins']['get'](i);await this['_setUpService'](_0x3ba4e4);const _0x11d065=await this['_services']['get'](_0x3ba4e4)['getConnectedSessions']();this['listenTo'](_0x16983c,'sessionAdd:'+_0x3ba4e4,(_0x3f2735,{session:_0x3726d5})=>{_0x3726d5['id']===_0x16983c['mySessionId']&&(_0x3f2735['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3726d5['permissions'],_0x3ba4e4));}),_0x16983c['register'](_0x3ba4e4,_0x11d065);}}async['_setUpService'](_0x262725){if(this['_services']['has'](_0x262725))throw new _0x47f125('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x262725});const _0x2276a2=this['context']['plugins']['get']('CommentsRepository'),_0x4575fd=new a['CommentsService'](_0x262725);this['_services']['set'](_0x262725,_0x4575fd),this['listenTo'](_0x4575fd,'commentThreadAdded',(_0x57678a,_0x1bb17d)=>{const {commentThreadId:_0x5c68cb,documentId:_0x5bdea4,context:_0x38314c,attributes:_0x5c2393,resolvedAt:_0x25b4cd,resolvedBy:_0x4dbd9d,comments:_0x905218}=_0x1bb17d;_0x2276a2['getCommentThread'](_0x5c68cb)||_0x2276a2['addCommentThread']({'threadId':_0x5c68cb,'channelId':_0x5bdea4,'comments':_0x905218?_0x905218['map'](S):[],'context':_0x38314c,'attributes':_0x5c2393,'resolvedAt':_0x25b4cd,'resolvedBy':_0x4dbd9d,'isFromAdapter':!0x0});}),this['listenTo'](_0x4575fd,'commentThreadUpdated',(_0x45c64b,{commentThreadId:_0x385441,documentId:_0x11020b,context:_0xe72f3c,unlinkedAt:_0x418f6c,attributes:_0x4d8d83})=>{_0x2276a2['getCommentThread'](_0x385441)&&_0x2276a2['updateCommentThread']({'threadId':_0x385441,'channelId':_0x11020b,'context':_0xe72f3c,'unlinkedAt':_0x418f6c,'attributes':_0x4d8d83,'isFromAdapter':!0x0});}),this['listenTo'](_0x4575fd,'commentThreadResolved',(_0x1d6fc4,{commentThreadId:_0x4e0c9b,resolvedBy:_0x7ed9bc,resolvedAt:_0x377913})=>{const _0x4b0a9a=_0x2276a2['getCommentThread'](_0x4e0c9b);_0x4b0a9a&&_0x4b0a9a['resolve']({'resolvedBy':_0x7ed9bc,'resolvedAt':_0x377913,'isFromAdapter':!0x0});}),this['listenTo'](_0x4575fd,'commentThreadReopened',(_0xe91160,{commentThreadId:_0x2f3f90})=>{const _0x1a1db9=_0x2276a2['getCommentThread'](_0x2f3f90);_0x1a1db9&&_0x1a1db9['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4575fd,'commentThreadRemoved',(_0x21ff40,{commentThreadId:_0x649ba9})=>{const _0x51af75=_0x2276a2['getCommentThread'](_0x649ba9);_0x51af75&&_0x51af75['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4575fd,'commentAdded',(_0x246a16,_0x56fb8c)=>{const _0x555961=_0x56fb8c['commentThreadId'],_0x457743=_0x2276a2['getCommentThread'](_0x555961);_0x457743&&_0x457743['addComment']({...S(_0x56fb8c),'isFromAdapter':!0x0});}),this['listenTo'](_0x4575fd,'commentUpdated',(_0x3f8b5a,{commentThreadId:_0x449a26,commentId:_0x880128,content:_0x51bae9,attributes:_0x42c0bd})=>{const _0x53647e=_0x2276a2['getCommentThread'](_0x449a26);if(_0x53647e){const _0x2fc93c=_0x53647e['getComment'](_0x880128);_0x2fc93c&&_0x2fc93c['update']({'content':_0x51bae9,'attributes':_0x42c0bd,'isFromAdapter':!0x0});}}),this['listenTo'](_0x4575fd,'commentRemoved',(_0x2ffb0d,{commentThreadId:_0x47a192,commentId:_0x240965})=>{const _0x4150c0=_0x2276a2['getCommentThread'](_0x47a192);if(_0x4150c0){const _0x594cec=_0x4150c0['getComment'](_0x240965);_0x594cec&&_0x594cec['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x262725);}['destroy'](){if(this['context']instanceof _0x3b8260){const _0x11baf0=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x11baf0);}}['_terminateService'](_0xd1b2b5){if(!this['_services']['has'](_0xd1b2b5))throw new _0x47f125('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0xd1b2b5});this['_getService'](_0xd1b2b5)['disconnect'](),this['_services']['delete'](_0xd1b2b5);}async['reconnect'](){for(const _0x216019 of this['_services']['keys']())await this['_connectService'](_0x216019);if(this['context']instanceof _0x3b8260){const _0xb1dd94=this['context']['config']['get']('collaboration.channelId'),_0x3f763c=this['context']['plugins']['get'](i);_0x3f763c['unregister'](_0xb1dd94);const _0x371a3f=await this['_services']['get'](_0xb1dd94)['getConnectedSessions']();_0x3f763c['register'](_0xb1dd94,_0x371a3f);}}async['_connectService'](_0x2591a6){const {connection:_0x3bbf98}=this['context']['plugins']['get'](c),_0x102ec8=this['context']['plugins']['get']('CommentsRepository'),_0x3bf550=this['_services']['get'](_0x2591a6),_0x1ec28e=await _0x3bf550['connect'](_0x3bbf98);await this['_fetchMissingUsersForThreads'](_0x1ec28e);const _0x5d1e6a=new Set(Array['from'](_0x102ec8['getCommentThreads']({'channelId':_0x2591a6}),_0x17b722=>_0x17b722['id']));for(const _0x1e298f of _0x1ec28e)_0x1e298f['deletedAt']||_0x5d1e6a['delete'](_0x1e298f['commentThreadId']);for(const _0xe656ea of _0x5d1e6a)_0x102ec8['getCommentThread'](_0xe656ea)['remove']({'isFromAdapter':!0x0});for(const _0x444dc9 of _0x1ec28e){let _0x4ab537=_0x102ec8['getCommentThread'](_0x444dc9['commentThreadId']);const {commentThreadId:_0x2ff51f,context:_0x484376,attributes:_0x20a947,resolvedBy:_0x5336f1,resolvedAt:_0x43d4e0,unlinkedAt:_0x2df68b,deletedAt:_0x1c350d}=_0x444dc9;if(_0x1c350d)continue;_0x4ab537||(_0x4ab537=_0x102ec8['addCommentThread']({'channelId':_0x2591a6,'threadId':_0x2ff51f,'context':_0x484376,'attributes':_0x20a947||{},'resolvedBy':_0x5336f1,'resolvedAt':_0x43d4e0,'unlinkedAt':_0x2df68b,'isFromAdapter':!0x0}));const _0x3b9011=new Set(Array['from'](_0x4ab537['comments'],_0x5d2895=>_0x5d2895['id']));for(const _0x78b260 of _0x444dc9['comments'])_0x3b9011['delete'](_0x78b260['commentId']);for(const _0xa9486a of _0x3b9011)_0x4ab537['getComment'](_0xa9486a)['remove']({'isFromAdapter':!0x0});for(const _0x1e866e of _0x444dc9['comments']){const _0x593f33=_0x4ab537['getComment'](_0x1e866e['commentId']);_0x593f33?_0x593f33['content']!==_0x1e866e['content']&&_0x593f33['update']({'content':_0x1e866e['content'],'isFromAdapter':!0x0}):_0x4ab537['addComment'](Object['assign'](S(_0x1e866e),{'isFromAdapter':!0x0}));}}}['_getService'](_0x315188){if(!this['_services']['has'](_0x315188))throw new _0x47f125('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x315188});return this['_services']['get'](_0x315188);}async['_fetchMissingUsersForThreads'](_0x4c0ea5){const _0x3621ab=this['context']['plugins']['get'](_0x1e9797),{connection:_0x22c79d}=this['context']['plugins']['get'](c),_0x12fa90=new Set();for(const {resolvedBy:_0x30d2a6,comments:_0x241526}of _0x4c0ea5){_0x30d2a6&&!_0x3621ab['getUser'](_0x30d2a6)&&_0x12fa90['add'](_0x30d2a6);for(const {userId:_0x17191c}of _0x241526)_0x3621ab['getUser'](_0x17191c)||_0x12fa90['add'](_0x17191c);}if(0x0===_0x12fa90['size'])return;const _0x1259c=await lt['getMany'](_0x22c79d,Array['from'](_0x12fa90));for(const _0xd6a2c9 of _0x1259c)_0x3621ab['getUser'](_0xd6a2c9['id'])||_0x3621ab['addUser'](_0xd6a2c9);}}async function B(_0x1857a4){if('404'!==_0x1857a4['code'])throw _0x1857a4;}function dt(_0x3e8339){if((_0xd8a7a2=_0x3e8339)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0xd8a7a2['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xd8a7a2['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0xd8a7a2;throw _0x3e8339;}function S(_0xc0adb1){return{'threadId':_0xc0adb1['commentThreadId'],'commentId':_0xc0adb1['commentId'],'content':_0xc0adb1['content'],'createdAt':_0xc0adb1['createdAt'],'authorId':_0xc0adb1['userId'],'attributes':_0xc0adb1['attributes']||{}};}class f extends _0x54be99{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x304e9e)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',i,_0x1e9797];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1f0fa6){super(_0x1f0fa6);const _0x278463=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x278463);}async['init'](){const _0x1e0038=this['editor']['plugins']['get'](l),_0x2ca355=_0x1e0038['serverHistory'],_0xa1ed0=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x2ca355,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x1e0038['sessionId']});const _0x36eb35=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x20cd89=await _0x1f0bdd['isBundleUploaded'](_0xa1ed0['connection'],_0x36eb35);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x526585})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x526585)),'updateRevisions':async _0x45e002=>{await this['_waitForServiceReady']();const _0x2ab7f0=this['_revisionTracker']['currentRevision'];if(_0x20cd89&&0x1===_0x45e002['length']&&_0x45e002[0x0]['id']===_0x2ab7f0['id'])return _0x45e002;for(const _0x437569 of _0x45e002)_0x437569['id']===_0x2ab7f0['id']&&(_0x437569['isEmptyCurrent']=_0x437569['fromVersion']===_0x437569['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x45e002,this['_lastRequestId'])['then'](_0xd3ddaf=>(this['_lastRequestId']=_0xd3ddaf,_0x45e002))['catch'](_0x2cb0d6=>{if(U(_0x2cb0d6)||'400'===_0x2cb0d6['code']&&void 0x0!==_0x2cb0d6['data']['wrongRequestId']){for(const _0x35a33f of _0x45e002){!this['_revisionTracker']['repository']['getRevision'](_0x35a33f['id'])||this['_revisionTracker']['_bufferUpdate'](_0x35a33f['id'],_0x35a33f,!0x1);}if(U(_0x2cb0d6))throw _0x2cb0d6;return _0x45e002;}throw _0x2cb0d6;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x249624,{revisionsData:_0x482de2,requestId:_0x4bd68d})=>{Math['max'](..._0x482de2['map'](_0x3c0011=>_0x3c0011['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x482de2,_0x4bd68d);}):this['_handleRevisionsUpdate'](_0x482de2,_0x4bd68d);});const {revisions:_0x3dd6d1,requestId:_0x26dda6}=await this['_revisionHistoryService']['connect'](_0xa1ed0['connection']);_0xa1ed0['addToReconnectionStack'](this),this['_lastRequestId']=_0x26dda6,await this['_fetchMissingUsers'](_0x3dd6d1);for(const _0x5a3c61 of _0x3dd6d1)this['_revisionTracker']['addRevisionData'](_0x5a3c61);this['listenTo'](_0x1e0038,'change:_isConnected',(_0x222c20,_0x265e44,_0x121659)=>{_0x121659&&(this['_oldOffset']=_0x1e0038['_offset'],_0x222c20['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0xa1ed0,'state',_0x4b39ce=>_0x4b39ce===_0x347654['CONNECTED']);}async['reconnect'](){const _0x2f9ade=this['editor']['plugins']['get'](c),_0x207ec0=this['editor']['plugins']['get'](l),_0x22d938=async()=>{const _0x2c9dc9=this['_revisionTracker']['currentRevision'],_0x317a41=_0x2c9dc9['id'],_0x173f32=_0x317a41!==_0x207ec0['sessionId'];if(_0x173f32){const _0x296b59=_0x207ec0['_offset']-this['_oldOffset'],_0x2f57ec=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x2c9dc9['toVersion']+_0x296b59!==_0x2f57ec){const _0x39b2b3=_0x2c9dc9['fromVersion']+_0x296b59,_0xe44a40=this['editor']['plugins']['get'](_0x1e9797),_0x1e7fe1=this['_revisionTracker']['buildRevisionData']({'revision':_0x2c9dc9,'from':_0x39b2b3,'to':_0x2f57ec});_0x1e7fe1['id']=_0x2c9dc9['id'];const _0x26802d=_0x1e7fe1['authorsIds']['map'](_0x5b8638=>_0xe44a40['getUser'](_0x5b8638));_0x2c9dc9['_update']({..._0x1e7fe1,'authors':_0x26802d},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x2c9dc9['id'],_0x1e7fe1,!0x0);}this['_revisionTracker']['_startingVersion']=_0x2f57ec,(_0x2c9dc9['toVersion']===_0x2c9dc9['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x317a41)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x317a41),this['_revisionTracker']['_createCurrentRevision'](_0x2f57ec));}const {revisions:_0x424b62,requestId:_0x6506c1}=await this['_revisionHistoryService']['reconnect'](_0x2f9ade['connection'],this['_lastRequestId']);_0x173f32&&_0x424b62['length']>0x0?_0x207ec0['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x424b62),this['_handleRevisionsUpdate'](_0x424b62,_0x6506c1),this['_revisionTracker']['sendBufferedUpdates']());};return _0x207ec0['_isConnected']?_0x22d938():new Promise((_0x3c89aa,_0x582b06)=>{_0x207ec0['once']('change:_isConnected',()=>{_0x22d938()['then'](_0x3c89aa)['catch'](_0x582b06);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x442b9a=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x282735=>{_0x282735['off'](),_0x442b9a();});});}['_getLatestVersionFromServerOperations'](){const _0x4a0b3f=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x4214e9 of _0x4a0b3f)if('marker'!==_0x4214e9['type']||_0x4214e9['affectsData'])return _0x4214e9['baseVersion']+0x1;}['_getLatestVersion'](){const _0x2b1d3e=this['editor']['plugins']['get'](l);return new Promise(_0x3a616d=>{_0x2b1d3e['_isPendingUpdate']?_0x2b1d3e['once']('change:_isPendingUpdate',()=>{_0x3a616d(this['_getLatestVersionFromServerOperations']());}):_0x3a616d(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x596440,_0x59f29c){const _0x50d45e=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x59f29c;for(const _0x15b2b0 of _0x596440){const _0x25d30a=_0x50d45e['getRevision'](_0x15b2b0['id']);if(_0x25d30a){if((_0x15b2b0['fromVersion']||_0x15b2b0['toVersion'])&&(_0x15b2b0['diffData']=null),_0x25d30a===this['_revisionTracker']['currentRevision']){const _0xfa89c0=Math['max'](_0x25d30a['toVersion'],_0x15b2b0['toVersion']),_0x19cd8e=Math['max'](_0x25d30a['fromVersion'],_0x15b2b0['fromVersion']);let _0x4df160;_0x25d30a['toVersion']===_0x15b2b0['toVersion']&&_0x25d30a['fromVersion']===_0x15b2b0['fromVersion']?(_0x4df160=!0x0,this['_preventResendingRevisionData'](_0x15b2b0)):_0x15b2b0['toVersion']===_0xfa89c0&&_0x15b2b0['fromVersion']===_0x19cd8e?_0x4df160=!0x1:(_0x25d30a['toVersion']===_0xfa89c0&&_0x25d30a['fromVersion']===_0x19cd8e||this['_fixRevision']({'revision':_0x25d30a,'from':_0x19cd8e,'to':_0xfa89c0}),_0x4df160=!0x0),_0x4df160&&(delete _0x15b2b0['fromVersion'],delete _0x15b2b0['toVersion'],delete _0x15b2b0['diffData'],delete _0x15b2b0['createdAt'],delete _0x15b2b0['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x15b2b0),this['_preventResendingRevisionData'](_0x15b2b0);}else this['_revisionTracker']['addRevisionData'](_0x15b2b0);}const _0x169753=_0x50d45e['getRevisions']();_0x169753['reverse']();for(let _0x5394d8=0x0;_0x5394d8<_0x169753['length']-0x1;_0x5394d8++){const _0x49c156=_0x169753[_0x5394d8],_0x18e19b=_0x169753[_0x5394d8+0x1];if(_0x49c156['fromVersion']<_0x18e19b['toVersion']){const _0x131860=_0x18e19b['toVersion'],_0x5c043b=Math['max'](_0x131860,_0x49c156['toVersion']);this['_fixRevision']({'revision':_0x49c156,'from':_0x131860,'to':_0x5c043b});}}}['_fixRevision']({revision:_0x402339,from:_0x4c307f,to:_0x56a114}={}){const _0x5ba63e=this['editor']['plugins']['get'](_0x1e9797),_0x387c8b=this['_revisionTracker']['buildRevisionData']({'revision':_0x402339,'from':_0x4c307f,'to':_0x56a114});_0x387c8b['authors']=_0x387c8b['authorsIds']['map'](_0x1f59ce=>_0x5ba63e['getUser'](_0x1f59ce)),_0x402339['_update'](_0x387c8b);}['_preventResendingRevisionData'](_0xe28d32){const _0x2610eb={};_0x2610eb['id']=_0xe28d32['id'];for(const _0x3ebe7f of Object['keys'](_0xe28d32))'id'!==_0x3ebe7f&&(_0x2610eb[_0x3ebe7f]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x2610eb['id'],_0x2610eb,!0x0);}async['_fetchMissingUsers'](_0x4a4fdf){const _0x2cdd1d=this['editor']['plugins']['get'](_0x1e9797),{connection:_0x4acff3}=this['editor']['plugins']['get'](c),_0x15cd14=new Set();for(const _0x4fef51 of _0x4a4fdf){for(const _0x517e8b of _0x4fef51['authorsIds'])_0x18d023(_0x517e8b);_0x4fef51['creatorId']&&_0x18d023(_0x4fef51['creatorId']);}if(0x0===_0x15cd14['size'])return;const _0x4a6bab=await lt['getMany'](_0x4acff3,Array['from'](_0x15cd14));for(const _0x71da2f of _0x4a6bab)_0x2cdd1d['getUser'](_0x71da2f['id'])||_0x2cdd1d['addUser'](_0x71da2f);function _0x18d023(_0x2356db){_0x2cdd1d['getUser'](_0x2356db)||_0x15cd14['add'](_0x2356db);}}}function U(_0x47b59a){return _0x47b59a['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x47b59a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x47b59a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x54be99{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class ts extends _0x30ffbd{constructor(_0x4e9b99){super(_0x4e9b99);const _0x4cd327=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0x4cd327['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0x4cd327['to']('usersCount',_0xe77725=>Q(_0x4e9b99,'CONNECTED_USERS',_0xe77725))}]});}}class es extends _0x30ffbd{['items'];['keystrokes'];constructor(_0xb5cfe){super(_0xb5cfe);const _0x2eadf7=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x2eface(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x2eadf7['if']('hasPopup'),'aria-expanded':_0x2eadf7['to']('isExpanded',_0x27a9d2=>this['hasPopup']&&String(_0x27a9d2)),'aria-label':_0x2eadf7['to']('hasPopup',_0x802078=>Q(_0xb5cfe,_0x802078?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x2eadf7['to']('hasPopup',_0x49cfdf=>!!_0x49cfdf&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x2eadf7['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0xf4329d,_0x2caee8,_0x3270c8)=>{this['element']&&(_0x3270c8?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class L extends _0x30ffbd{['counterView'];['inlineListView'];constructor(_0x237336){super(_0x237336);const _0x11cb0a=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0x237336),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x26e4d5 of this['inlineListView']['items'])_0x26e4d5['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',_0x11cb0a['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class j extends _0x30ffbd{['listWrapperView'];constructor(_0xf36899,_0x3361a6){super(_0xf36899),this['listWrapperView']=new ft(_0xf36899,_0x3361a6),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':Q(_0xf36899,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class ft extends _0x551b2d{constructor(_0x247bac,_0x45c39f){super(_0x247bac);const _0x591d8a=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x45c39f?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x591d8a['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x591d8a['to']('role'),'aria-label':_0x591d8a['to']('ariaLabel'),'aria-labelledby':_0x591d8a['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x1d2af1['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x21ff5b=this['element'];_0x21ff5b&&(this['_isScrollable']=Math['max'](_0x21ff5b['scrollHeight'],_0x21ff5b['clientHeight'])>0.8*window['innerHeight']);}}class k extends et{['userView'];constructor(_0x305917,_0x1d32fb,_0x1965c6){super(_0x305917);const _0x46c670=this['bindTemplate'];this['userView']=new rt(_0x305917,_0x1d32fb);const _0x4d378f={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x1d32fb['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x1d32fb['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1d32fb['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x1965c6&&(_0x4d378f['tag']='button',_0x4d378f['on']={'click':_0x46c670['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4d378f);}['focus'](){this['element']['focus']();}}class y extends _0x30ffbd{['userView'];['markerView'];constructor(_0x326e6c,_0x24567a,_0x381b9b){super(_0x326e6c);const _0x5d1ec5=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new rt(_0x326e6c,_0x24567a),this['markerView']=new ct(_0x326e6c,_0x24567a);const _0x307436=new ot(_0x326e6c);_0x307436['template']['tag']='span',_0x307436['text']=_0x24567a['name'];const _0x1d6b3e={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5d1ec5['to']('isFocusable',_0x325def=>!!_0x325def&&0x0),'aria-labelledby':_0x307436['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5d1ec5['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5d1ec5['to']('hasTooltip',_0x4a901b=>!_0x4a901b),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x307436]};_0x381b9b&&(_0x1d6b3e['tag']='button',_0x1d6b3e['on']={'click':_0x5d1ec5['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1d6b3e);}}class ct extends _0x30ffbd{constructor(_0x517f40,_0x5b4d96){super(_0x517f40),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5b4d96['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const A={'collapseAt':0x6,'displayMe':!0x0};class r extends _0xf32368{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x4efdd3){super(_0x4efdd3),this['context']['config']['define']('presenceList',A);const _0x2a3347=_0x4efdd3['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x2a3347)throw new _0x47f125('presencelist-collapseat-invalid-format',this);if(_0x2a3347<0x1)throw new _0x47f125('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x2fe827(),this['balloonPanelView']=new _0x46174d(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x1eeade of this['_allConnectedUsers'])this['_handleUserAdd'](_0x1eeade);this['listenTo'](this['_allConnectedUsers'],'add',(_0x59d998,_0x3df005)=>{this['_handleUserAdd'](_0x3df005);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x12f0bf,_0x1afad3)=>{this['_handleUserRemove'](_0x1afad3);});}['_createView'](){const _0x5dcd9f=this['context'],_0x4d1bad=new L(this['context']['locale']),_0x39a32c=this['balloonPanelView'];if(!_0x5056da(_0x5dcd9f['config']['get']('presenceList.container')))throw new _0x47f125('presencelist-missing-container',this);return _0x4d1bad['counterView']['bind']('usersCount')['to'](this),_0x4d1bad['bind']('isCollapsed')['to'](this,'usersCount',_0xf1cf72=>{const {collapseAt:_0x38b930,displayMe:_0x51b6fa}=_0x5dcd9f['config']['get']('presenceList'),_0x44c248=_0xf1cf72>=_0x38b930;return _0x4d1bad['counterView']['isHidden']=!(0x1==_0xf1cf72&&_0x51b6fa||_0x44c248),_0x44c248||this['hideDropdown'](),_0x44c248;}),_0x4d1bad['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x773a76=>{const _0x417cd4=_0x5dcd9f['config']['get']('presenceList'),_0x2f4a13=new y(_0x5dcd9f['locale'],_0x773a76,!!_0x417cd4['onClick']);return _0x2f4a13['bind']('hasTooltip')['to'](_0x4d1bad,'isCollapsed',_0x5d02ad=>!_0x5d02ad),_0x2f4a13['bind']('isFocusable')['to'](_0x4d1bad,'isCollapsed',_0x408872=>!_0x408872),_0x417cd4['onClick']&&this['listenTo'](_0x2f4a13,'execute',()=>{this['view']['isCollapsed']||_0x417cd4['onClick'](_0x773a76,_0x2f4a13['element']);}),_0x2f4a13;}),this['listenTo'](_0x4d1bad['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0x4d1bad['inlineListView']['keystrokes']['set']('Enter',(_0x538c45,_0x3cd847)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x3cd847());}),_0x4d1bad['render'](),_0x39a32c['render'](),_0x3df6cb({'emitter':_0x4d1bad,'activator':()=>_0x39a32c['isVisible'],'contextElements':[_0x39a32c['element'],_0x4d1bad['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x5dcd9f['config']['get']('presenceList.container')['appendChild'](_0x4d1bad['element']),this['_bodyCollection']=new _0x498766(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x4d1bad;}['_handleUserAdd'](_0x263e74){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x263e74['isMe'])return;const _0x2e68a8=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0x2e68a8&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0x28d7fd=_0x263e74['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x263e74,_0x28d7fd);}['_handleUserRemove'](_0x45f0bd){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0x45f0bd['id'])&&(this['currentDisplayedUsers']['remove'](_0x45f0bd['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0xc6d352 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0xc6d352['id']))return void this['currentDisplayedUsers']['add'](_0xc6d352,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x5b809d=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new j(this['context']['locale'],!!_0x5b809d['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x42e87f}=this['presenceDropdownView'];_0x42e87f['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x119599=>{if(!_0x5b809d['displayMe']&&_0x119599['isMe'])return null;const _0x1d17c3=new k(this['context']['locale'],_0x119599,!!_0x5b809d['onClick']);return _0x5b809d['onClick']&&this['listenTo'](_0x1d17c3,'execute',()=>{_0x5b809d['onClick'](_0x119599,_0x1d17c3['element']);}),_0x1d17c3;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x42e87f['focus'](),_0x42e87f['checkIfScrollable']();const _0x1335c2=(_0x81a83a,_0x5c4c14)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x5c4c14();};_0x42e87f['keystrokes']['set']('Esc',_0x1335c2),_0x42e87f['keystrokes']['set']('Shift+Tab',_0x1335c2),_0x42e87f['keystrokes']['set']('Tab',(_0x27de17,_0x891c7f)=>{!function(_0x563abe){const _0x54e195=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x490521=>_0x490521+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0xe139f0=[...document['body']['querySelectorAll'](_0x54e195)]['filter'](_0x210366=>_0x210366===document['activeElement']||_0x210366['offsetWidth']+_0x210366['offsetHeight']>0x0)['sort']((_0x4f0a3e,_0x1188a9)=>(_0x4f0a3e['tabIndex']||0x0)-(_0x1188a9['tabIndex']||0x0)),_0x5e2602=_0xe139f0['indexOf'](_0x563abe),_0x39cbc5=_0xe139f0[(_0x5e2602+0x1)%_0xe139f0['length']];_0x39cbc5&&_0x39cbc5['focus']();}(this['view']['element']),this['hideDropdown'](),_0x891c7f();}),_0x42e87f['focusTracker']['add'](this['view']['element']),_0x42e87f['focusTracker']['on']('change:isFocused',(_0x254a71,_0xd3e311,_0x4fb5bd)=>{_0x4fb5bd||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class s extends _0xf32368{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges};
|
|
23
|
+
import{ContextPlugin as _0x44d9cd,Plugin as _0x5ab26d,PendingActions as _0x849d5e,Context as _0x3362af}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x54bac1,CKEditorError as _0x1c3b27,Collection as _0x27f226,global as _0xc3811,version as nt,uid as _0x41ae09,KeystrokeHandler as _0x1bc3ac}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x1c4726,View as _0x35ade4,ListView as _0x3ff8be,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x7e4ba1,clickOutsideHandler as _0x52aff7,BodyCollection as _0x1b2e2a}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ht,History as _0x109ee1,NoOperation as _0x2fd97d,InsertOperation as _0x3f9bda,MarkerOperation as _0x3bb101,RootAttributeOperation as _0x16516e,transformSets as _0x558107,OperationFactory as _0x2cf636}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as lt,WEB_SOCKET_GATEWAY_STATES as _0xf6d7c,CollaborativeEditingService as _0x2c7c64,User as dt,CommentsService as _0x2e95a3,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x2197dd,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x558b7e}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x5cdde0}from'lodash-es';class c extends _0x44d9cd{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x1c4726];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4f2dae){super(_0x4f2dae),this['set']('state',_0xf6d7c['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x54bac1);}['init'](){const _0x240c3a=this['context'],_0xf7f257=_0x240c3a['plugins']['get']('CloudServices'),_0x56972d=_0x240c3a['plugins']['get'](_0x1c4726);if(!_0xf7f257['token'])throw new _0x1c3b27('websocketgateway-missing-token',this);if(!_0xf7f257['webSocketUrl'])throw new _0x1c3b27('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),c['WebSocketGateway']['connect'](_0xf7f257['token'],_0xf7f257['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x31fc02=>{if(this['connection']=_0x31fc02,this['bind']('state')['to'](_0x31fc02,'state',this,'_isBrowserOffline',(_0x1fe153,_0xbb54a6)=>('connected'!==_0x1fe153&&(this['_shouldPluginsReconnect']=!0x0),_0xbb54a6||_0x1fe153!==_0xf6d7c['CONNECTED']?_0xf6d7c['DISCONNECTED']:this['state']==_0xf6d7c['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0xf6d7c['CONNECTING']):_0xf6d7c['CONNECTED'])),this['connection']['on']('error',(_0x41b878,_0x55c060)=>{if('limitExceeded'!==_0x55c060['code'])throw console['error'](_0x55c060),new _0x1c3b27('cloudservices-init',null,{'originalError':_0x55c060});_0x56972d['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'});}),!_0x31fc02['me'])return new Promise(_0x545aa9=>_0x31fc02['on']('change:me',_0x545aa9));})['catch'](_0x1a90d6=>{throw console['error'](_0x1a90d6),new _0x1c3b27('cloudservices-init',null,{'originalError':_0x1a90d6});});}['addToReconnectionStack'](_0x5df69c){if('function'!=typeof _0x5df69c['reconnect'])throw new _0x1c3b27('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x5df69c))throw new _0x1c3b27('websocketgateway-plugin-already-registered',this,{'name':_0x5df69c['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x5df69c);}['removeFromReconnectionStack'](_0x5df3ef){this['_reconnectionStack']['delete'](_0x5df3ef);}['isInReconnectionStack'](_0x4643ce){return this['_reconnectionStack']['has'](_0x4643ce);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x58e682=>_0x58e682['reconnect']())))['then'](()=>this['state']=_0xf6d7c['CONNECTED'])['catch'](_0x36c752=>{throw console['error'](_0x36c752),new _0x1c3b27('cloudservices-reconnection-error',this['context']);});}['destroy'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0xf6d7c['DISCONNECTED'],this['_domEmitter']['stopListening'](),super['destroy']();}}class i extends _0x44d9cd{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[c,_0x2197dd];}constructor(_0x4f3c3a){super(_0x4f3c3a),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x27f226(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x2197dd);}['init'](){const _0x530d06=this['context']['plugins']['get'](c);this['listenTo'](_0x530d06,'change:state',(_0x58b619,_0x59ab9a,_0x1fc1bb)=>{if('connected'!==_0x1fc1bb)this['channelSessions']['forEach'](_0x31074f=>_0x31074f['clear']()),this['channelConnectedUsers']['forEach'](_0x5da036=>_0x5da036['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x3d9e74,_0x38473e]of this['_registeredSessions'])for(const _0x5f1be3 of _0x38473e)this['_handleSessionAdd'](_0x3d9e74,_0x5f1be3);}}),this['_createUser'](_0x530d06['connection']['me'],!0x0);}['register'](_0x32c95c,_0x17286a){if(this['_registeredSessions']['has'](_0x32c95c))throw new _0x1c3b27('sessions-register-already-registered',null,{'channelId':_0x32c95c});this['_registeredSessions']['set'](_0x32c95c,_0x17286a),this['channelSessions']['set'](_0x32c95c,new _0x27f226()),this['channelConnectedUsers']['set'](_0x32c95c,new _0x27f226()),this['listenTo'](_0x17286a,'add',(_0x5b6fea,_0x56c5a3)=>this['_handleSessionAdd'](_0x32c95c,_0x56c5a3)),this['listenTo'](_0x17286a,'remove',(_0x14d7b3,_0x5cc5f0)=>this['_handleSessionRemove'](_0x32c95c,_0x5cc5f0));for(const _0x27a546 of _0x17286a)this['_handleSessionAdd'](_0x32c95c,_0x27a546);}['unregister'](_0x1aafe6){if(!this['_registeredSessions']['has'](_0x1aafe6))throw new _0x1c3b27('sessions-unregister-not-exist',null,{'channelId':_0x1aafe6});const _0x47e6b7=this['_registeredSessions']['get'](_0x1aafe6);this['stopListening'](_0x47e6b7);for(const _0x31187b of _0x47e6b7)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x1aafe6,_0x31187b);this['_registeredSessions']['delete'](_0x1aafe6),this['channelSessions']['delete'](_0x1aafe6),this['channelConnectedUsers']['delete'](_0x1aafe6);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x3f1616){for(const _0x388b74 of this['channelSessions']['values']())for(const _0x28c078 of _0x388b74)if(_0x28c078['id']===_0x3f1616)return _0x28c078['user'];}['getUserSessions'](_0x11a4d6,_0x4c36b9){const _0x4d40d9=_0x4c36b9?[this['channelSessions']['get'](_0x4c36b9)]:this['channelSessions']['values'](),_0x4e1e64=new Set();for(const _0x378196 of _0x4d40d9)for(const _0x168e46 of _0x378196)_0x168e46['user']['id']===_0x11a4d6['id']&&_0x4e1e64['add'](_0x168e46['id']);return _0x4e1e64;}['getUserRole'](_0x4b8f95){for(const _0x293deb of this['channelSessions']['values']())for(const _0x266959 of _0x293deb)if(_0x266959['user']===_0x4b8f95)return _0x266959['role'];}['_handleSessionAdd'](_0x2de550,_0x206a4a){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x4e6808=_0x206a4a['user'],_0x56a1dd=this['_users']['getUser'](_0x4e6808['id'])||this['_createUser'](_0x4e6808),_0x2f80c8=Object['assign']({},_0x206a4a,{'user':_0x56a1dd});this['channelSessions']['get'](_0x2de550)['add'](_0x2f80c8);const _0x13ef0b=this['channelConnectedUsers']['get'](_0x2de550);_0x13ef0b['has'](_0x56a1dd['id'])||_0x13ef0b['add'](_0x56a1dd),this['allConnectedUsers']['has'](_0x56a1dd['id'])||this['allConnectedUsers']['add'](_0x56a1dd,_0x56a1dd['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x2de550,{'channelId':_0x2de550,'session':_0x2f80c8});}['_handleSessionRemove'](_0x35b101,_0x2547f6){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x4923c0=this['channelConnectedUsers']['get'](_0x35b101),_0x46dfdb=_0x2547f6['user'];_0x46dfdb['id']&&(this['channelSessions']['get'](_0x35b101)['remove'](_0x2547f6['id']),_0x4923c0['has'](_0x46dfdb['id'])&&!this['getUserSessions'](_0x46dfdb,_0x35b101)['size']&&_0x4923c0['remove'](_0x46dfdb['id']),this['allConnectedUsers']['get'](_0x46dfdb['id'])&&!this['getUserSessions'](_0x46dfdb)['size']&&this['allConnectedUsers']['remove'](_0x46dfdb['id']));}['_createUser'](_0x4cae1c,_0x4bb202){const _0x3b6566=this['_users']['addUser'](_0x4cae1c);return _0x4bb202&&this['_users']['defineMe'](_0x4cae1c['id']),_0x3b6566['orderNumber']=this['_uniqueUsersCount']++,_0x3b6566;}}class H extends _0x5ab26d{['_domEmitter']=new(_0x54bac1())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x56b2b9=this['editor'],_0x4bee5a=_0x56b2b9['plugins']['get'](i);_0x56b2b9['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x140988,{writer:_0x5a6e04})=>function(_0x383c6f,_0x79e207,_0x43e3e0,_0x5d80a8){const _0x44f110=_0x383c6f['markerName']['split'](':')[0x2],_0x55176e=_0x43e3e0['getUserBySessionId'](_0x44f110);if(!_0x55176e||_0x44f110===_0x43e3e0['mySessionId'])return;if(!_0x5d80a8['model']['schema']['checkChild'](_0x383c6f['markerRange']['start'],'$text'))return;const _0x37ca34={'class':'ck-user__marker\x20'+_0x55176e['color']['getMarkerClass'](),'data-name':_0x55176e['name'],'data-session-id':_0x44f110},_0x2128c6=_0x5d80a8['model']['markers']['get'](_0x383c6f['markerName']),_0x47e892=_0x2128c6['getStart'](),_0x3c4866=_0x47e892['nodeAfter'],_0x352597=_0x5d80a8['model']['schema'];if(_0x3c4866&&_0x352597['isObject'](_0x3c4866)&&_0x352597['isInline'](_0x3c4866)&&!_0x5d80a8['model']['markers']['get']('user:range:'+_0x44f110)['getRange']()['isCollapsed'])return;const _0x152a4d=_0x47e892['parent'];return _0x5d80a8['model']['schema']['isLimit'](_0x152a4d)&&!_0x5d80a8['model']['hasContent'](_0x152a4d)&&(_0x37ca34['contenteditable']=!0x1),function(_0x546f3d,_0x55f576,_0x154c74){const _0x1abbd3=_0x546f3d['createUIElement']('span',_0x55f576);return _0x546f3d['setCustomProperty']('userPositionMarker',!0x0,_0x1abbd3),_0x1abbd3['render']=function(_0x1cb842){const _0x41bfef=this['toDomElement'](_0x1cb842);return _0x41bfef['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span><span\x20class=\x22ck-user__marker-tooltip\x22\x20contenteditable=\x22false\x22\x20spellcheck=\x22false\x22>'+_0x154c74['name']+'</span>',_0x41bfef['addEventListener']('mouseenter',()=>{_0x41bfef['classList']['add']('ck-user__marker_hovered');}),_0x41bfef['addEventListener']('mouseleave',()=>{_0x41bfef['classList']['remove']('ck-user__marker_hovered');}),_0x41bfef;},_0x1abbd3['isSimilar']=function(_0x3209ef){return!(!this['getCustomProperty']('userPositionMarker')||!_0x3209ef['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x3209ef['getAttribute']('data-session-id'));},_0x1abbd3;}(_0x79e207,_0x37ca34,_0x55176e);}(_0x140988,_0x5a6e04,_0x4bee5a,_0x56b2b9)}),_0x56b2b9['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2467d4=>function(_0x3a3ab1,_0x5e45a6){const _0x3f4c22=_0x3a3ab1['markerName']['split'](':')[0x2];if(_0x3f4c22===_0x5e45a6['mySessionId'])return null;const _0x1d2fa2=_0x5e45a6['getUserBySessionId'](_0x3f4c22);if(!_0x1d2fa2)return{'id':_0x3f4c22,'classes':[]};return{'id':_0x3f4c22,'classes':['ck-user__selection',_0x1d2fa2['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x3f4c22},'priority':0x7d0+_0x1d2fa2['orderNumber']};}(_0x2467d4,_0x4bee5a)}),function(_0xbd4978){const _0x46b96b=_0xbd4978['model'],_0x48fb04=new Map(),_0x3d0e50=_0xbd4978['plugins']['get'](i);_0x46b96b['markers']['on']('update:user:range',(_0x430cd4,_0x44d50,_0x2fa42d,_0x3b1844)=>{if(!_0x3b1844&&_0x48fb04['get'](_0x44d50['name']))return _0x48fb04['get'](_0x44d50['name'])['detach'](),void _0x48fb04['delete'](_0x44d50['name']);const _0x12e279=_0x44d50['name']['split'](':')[0x2];if(_0x12e279===_0x3d0e50['mySessionId'])return;const _0x1dd6a5='user:position:'+_0x12e279;_0x46b96b['markers']['has'](_0x1dd6a5)&&_0xbd4978['editing']['reconvertMarker'](_0x1dd6a5),_0x44d50['on']('change:range',(_0x2cb4f8,_0x4c5f52,_0x5727ed)=>{if('$graveyard'!=_0x4c5f52['root']['rootName']&&'$graveyard'==_0x44d50['getRange']()['root']['rootName']&&!_0x48fb04['has'](_0x44d50['name'])){const _0x32346a=_0x46b96b['schema']['getNearestSelectionRange'](_0x5727ed['deletionPosition']);if(_0x32346a){const _0x2740f8=ht['fromRange'](_0x32346a);_0x48fb04['set'](_0x44d50['name'],_0x2740f8),_0x2740f8['on']('change:range',(_0xcac0d6,_0x2dae34,_0x5d9b7e)=>{if('$graveyard'==_0x2740f8['root']['rootName']){const _0x2d6b61=_0x46b96b['schema']['getNearestSelectionRange'](_0x5d9b7e['deletionPosition']);_0x2d6b61?(_0x2740f8['start']=_0x2d6b61['start'],_0x2740f8['end']=_0x2d6b61['end']):(_0x48fb04['delete'](_0x44d50['name']),_0x2740f8['detach']());}});}}});}),_0x46b96b['document']['on']('change',()=>{_0x48fb04['size']>0x0&&_0x46b96b['enqueueChange']({'isUndoable':!0x1},_0x3e55eb=>{for(const [_0xfa5d50,_0x43f3b1]of _0x48fb04)'$graveyard'==_0x46b96b['markers']['get'](_0xfa5d50)['getRange']()['root']['rootName']&&(re(_0xfa5d50['split'](':')[0x2],_0x43f3b1['toRange'](),_0x46b96b,_0x3e55eb),_0x43f3b1['detach']());_0x48fb04['clear']();});});}(_0x56b2b9),this['_domEmitter']['listenTo'](_0xc3811['document'],'keydown',(_0x4b6ead,{key:_0x4c26d2})=>{'Escape'===_0x4c26d2&&function(_0x52a530){_0x52a530['editing']['view']['change'](_0x1d073f=>{for(const _0x375fc0 of _0x52a530['model']['markers']){if(!_0x375fc0['name']['startsWith']('user:position'))continue;const _0x19a916=_0x52a530['editing']['mapper']['markerNameToElements'](_0x375fc0['name']);if(_0x19a916){for(const _0xbf807d of _0x19a916)_0x1d073f['removeClass']('ck-user__marker_hovered',_0xbf807d);}}});}(_0x56b2b9);},{'useCapture':!0x0});}['afterInit'](){const _0x16d39b=this['editor'],_0x5af41a=_0x16d39b['commands']['get']('undo');_0x5af41a&&_0x16d39b['model']['on']('applyOperation',(_0xc1cd10,_0x52c5fb)=>{const _0x37afbc=_0x52c5fb[0x0];if('marker'!=_0x37afbc['type']||!_0x37afbc['name']['startsWith']('user:'))return;const _0x43ee0c=_0x37afbc['batch'];_0x5af41a['_createdBatches']['has'](_0x43ee0c)&&(_0x37afbc['newRange']=_0x37afbc['oldRange']?_0x16d39b['model']['createRange'](_0x37afbc['oldRange']['start'],_0x37afbc['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x33c0a6=this['editor'],_0xe88978=_0x33c0a6['model']['document'],_0x189c0b=_0x33c0a6['plugins']['get'](i);_0x33c0a6['model']['enqueueChange']({'isUndoable':!0x1},_0x400412=>{const _0x48271a='user:range:'+_0x189c0b['mySessionId'],_0x59b188='user:position:'+_0x189c0b['mySessionId'],_0xbe60ee=_0x33c0a6['model']['markers']['has'](_0x48271a);_0x33c0a6['editing']['view']['hasDomSelection']?re(_0x189c0b['mySessionId'],_0xe88978['selection']['getFirstRange'](),_0x33c0a6['model'],_0x400412):_0xbe60ee&&(_0x400412['removeMarker'](_0x48271a),_0x400412['removeMarker'](_0x59b188));});}}function re(_0x13fe6b,_0x48a2e5,_0x49cdf6,_0x587be9){const _0x3856eb='user:range:'+_0x13fe6b,_0x2111b3='user:position:'+_0x13fe6b,_0x3905d1=_0x48a2e5['getContainedElement']();let _0x25e320=_0x48a2e5['start'];_0x3905d1&&_0x3905d1['is']('element','tableCell')&&(_0x25e320=function(_0x41acde,_0x23735f){for(const _0x570fe5 of _0x41acde['getPositions']())if(_0x23735f['schema']['checkChild'](_0x570fe5,'$text'))return _0x570fe5;}(_0x48a2e5,_0x49cdf6),_0x48a2e5=_0x587be9['createRange'](_0x25e320));const _0x238be4=_0x587be9['createRange'](_0x25e320);_0x49cdf6['markers']['has'](_0x3856eb)?(_0x587be9['updateMarker'](_0x3856eb,{'range':_0x48a2e5}),_0x587be9['updateMarker'](_0x2111b3,{'range':_0x238be4})):(_0x587be9['addMarker'](_0x3856eb,{'range':_0x48a2e5,'usingOperation':!0x0}),_0x587be9['addMarker'](_0x2111b3,{'range':_0x238be4,'usingOperation':!0x0}));}function q(_0x614e26,_0x1ae3ea,_0x5e8b6b){const _0x321425=_0x614e26['t'],t=_0x614e26['t'];switch(_0x1ae3ea){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 _0x321425({'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'},_0x5e8b6b);default:return'';}}let K=0x1;class l extends _0x5ab26d{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x2c7c64)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,H,_0x849d5e,_0x2197dd,_0x1c4726];}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 _0x384462=this['serverHistory']['getOperations']();for(let _0x59a45e=_0x384462['length']-0x1;_0x59a45e>=0x0;_0x59a45e--){const _0xc9ef90=_0x384462[_0x59a45e];if(!this['_disconnectionOperations']['has'](_0xc9ef90))return _0xc9ef90['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x3f9d44){if(super(_0x3f9d44),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x109ee1(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1c3b27('collaboration-missing-channelid',this);const _0x1b222c=_0x3f9d44['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x1b222c,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x558b7e(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new X(this['_disconnectionOperations']);}['init'](){const _0x20e409=this['editor'],_0x26fd86=_0x20e409['plugins']['get'](_0x2197dd),_0x2c8d21=_0x20e409['plugins']['get'](c);this['listenTo'](_0x26fd86,'getOperationAuthor',(_0x2cb11f,_0x1dbe12)=>{const _0x350401=_0x1dbe12[0x0];_0x350401['_authorId']&&(_0x2cb11f['return']=_0x26fd86['getUser'](_0x350401['_authorId']),_0x2cb11f['stop']()),null===_0x350401['_authorId']&&(_0x2cb11f['return']=null,_0x2cb11f['stop']());},{'priority':'high'}),this['listenTo'](_0x20e409['model']['document']['selection'],'change:range',(_0x10323c,_0x57b95a)=>{_0x57b95a['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x20e409['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x20e409['model']['on']('applyOperation',(_0x445c15,_0x4a9fc8)=>{const _0x7e6a0e=_0x4a9fc8[0x0];_0x7e6a0e['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x7e6a0e),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x2c8d21,'state',this,'_hasSynchronizationProblem',(_0x40fcc0,_0x1ce4b2)=>'connected'===_0x40fcc0&&!_0x1ce4b2),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x20e409['disableReadOnlyMode']('rtc-offline'):_0x20e409['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x20e409['disableReadOnlyMode']('rtc-offline'):_0x20e409['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x1ea0ce=this['editor']['plugins']['get'](i),_0x373729=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x1ea0ce['unregister'](this['_channelId']);const _0x1073e4=await this['_service']['reconnect'](_0x373729['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1073e4)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x2ed833=await this['_service']['getConnectedSessions']();_0x1ea0ce['register'](this['_channelId'],_0x2ed833),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x277142){if(function(_0x25db58){return'404'===_0x25db58['code'];}(_0x277142)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x20f5bf){return'409'===_0x20f5bf['code'];}(_0x277142)){const _0x4f6681=q(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x4f6681);}else{if(!(_0x277142 instanceof J))throw _0x277142;this['_handleReconnectionError']();}}}}['destroy'](){const _0xa21676=this['editor']['plugins']['get'](c),_0x5e88be=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x5e88be['channelSessions']['has'](this['_channelId'])&&_0x5e88be['unregister'](this['_channelId']),_0xa21676['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x582fdf){if(this['sessionId']!==_0x582fdf['sessionId']&&this['_lastSyncedOperationId']!==_0x582fdf['lastOperationId'])throw new J();return this['sessionId']=_0x582fdf['sessionId'],this['_handleServerResponse']([],{..._0x582fdf,'wereChangesApplied':!0x1,'data':_0x582fdf['data']},'reconnect');}async['_connectService'](_0x4ee076,_0x4f90dc=!0x1){const {connection:_0x15f0aa}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x15f0aa,this['_channelId'])['then'](_0x1a0c2a=>this['_initSessionsHandling'](_0x1a0c2a))['catch'](_0x1edc98=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1edc98);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x30d77f,_0x53a37)=>{this['_crash']('realtimecollaborationclient-initservice-internal-error',_0x53a37);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x196a4e=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4ee076);this['_isPendingUpdate']=!0x0;const _0x5118f4=await this['_service']['connect'](_0x15f0aa,this['_compressOperations'](_0x4ee076),_0x196a4e);if(this['sessionId']=_0x5118f4['sessionId'],_0x4f90dc){if(!_0x5118f4['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x5118f4['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x4ee076,_0x5118f4,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x5118f4,_0x4ee076);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x7faf3d=this['editor']['plugins']['get'](i),_0x178b88=this['editor']['plugins']['get'](H),_0x1e92f5=_0x7faf3d['channelSessions']['get'](this['_channelId']);_0x1e92f5&&_0x1e92f5['length']>0x1?_0x178b88['createUserMarkerOperations']():this['listenTo'](_0x7faf3d,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x7faf3d['channelSessions']['get'](this['_channelId'])['length']&&_0x178b88['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x4dec4d,_0x1cf0ef,_0x35a219,_0x381e0a){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1cf0ef){const _0x2154b1=this['_decompressOperations'](_0x35a219,_0x381e0a);await this['_fetchMissingUsers'](_0x2154b1),this['_handleExternalOperations'](_0x2154b1,_0x1cf0ef,_0x35a219['lastOperationId'])||this['_crash']('realtimecollaborationclient-initservice-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x24e867}=this['editor'];let _0x1f078d;try{_0x1f078d=await this['_service']['getDocumentDetails']();}catch(_0x386e6a){const _0x1a3ace=q(_0x24e867,'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'](_0x1a3ace);}const _0x10bda2=_0x1f078d['currentDocumentSession']||_0x1f078d['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x10bda2['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x181469=q(_0x24e867,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x181469);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x8ea74a){const _0x3d80cf=this['editor']['plugins']['get'](i);this['listenTo'](_0x3d80cf,'sessionAdd:'+this['_channelId'],(_0x1c261b,{session:_0x4ac47a})=>{if(_0x4ac47a['id']===_0x3d80cf['mySessionId']){_0x1c261b['off']();const _0x48e602=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x1c7c4b=_0x4ac47a['permissions'];_0x48e602&&_0x48e602['isEnabled']&&(_0x1c7c4b=_0x1c7c4b['filter'](_0x36b29a=>'document:write'!==_0x36b29a)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x1c7c4b,this['_channelId']);}}),_0x3d80cf['register'](this['_channelId'],_0x8ea74a);}['_initThrowingOnDataSet'](){const _0x21c3d6=this['editor']['data']['set'];this['editor']['data']['set']=(..._0xd300b8)=>{if(!_0xd300b8[_0xd300b8['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1c3b27('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x21c3d6['apply'](this['editor']['data'],_0xd300b8);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0xfec7cd,[_0x4330df])=>{if(this['_document']['version'])throw new _0x1c3b27('realtimecollaborationclient-init-document-already-initialized',this);_0xfec7cd['stop'](),this['_setPendingAction']();const _0x3d8126=this['editor']['config']['get']('rootsAttributes'),_0x3bbc0b=this['_getOperationsFromInitData'](_0x4330df,_0x3d8126);0x0==_0x3bbc0b['length']&&_0x3bbc0b['push'](new _0x2fd97d(0x0)),_0xfec7cd['return']=this['_connectService'](_0x3bbc0b)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x18ad51=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x18ad51))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2265ad,[_0xea6e1d,_0x56a091])=>{_0x2265ad['stop']();const _0x416fba=this['editor']['model']['document']['getRoot'](_0xea6e1d);if(!this['_knownRootNames']['has'](_0xea6e1d)){const _0x172382=_0x56a091&&_0x56a091['data']?_0x56a091['data']:'',_0x20605b=_0x56a091&&_0x56a091['attributes']?_0x56a091['attributes']:{};await this['_loadRoot'](_0xea6e1d,_0x172382,_0x20605b);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x416fba['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x416fba);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x3d1e57){const _0x156a27=this['editor']['plugins']['get'](_0x2197dd),{connection:_0x48ad57}=this['editor']['plugins']['get'](c),_0x48fbe7=new Set();for(const _0x3c5489 of _0x3d1e57){const _0x4d9b81=_0x3c5489['_authorId'];_0x4d9b81&&!_0x156a27['getUser'](_0x4d9b81)&&_0x48fbe7['add'](_0x4d9b81);}if(0x0===_0x48fbe7['size'])return;const _0x1cd723=await dt['getMany'](_0x48ad57,Array['from'](_0x48fbe7));for(const _0x30ff34 of _0x1cd723)_0x156a27['getUser'](_0x30ff34['id'])||_0x156a27['addUser'](_0x30ff34);}['_getOperationsFromInitData'](_0x1bfa90,_0xb6124a={}){const _0x1cdb8b=this['editor']['model'],_0xe60468=[];let _0x56361c=0x0;const _0x49afde='string'==typeof _0x1bfa90?{'main':_0x1bfa90}:_0x1bfa90;for(const _0x368eae of Object['keys'](_0x49afde)){if(!this['_document']['roots']['has'](_0x368eae))throw new _0x1c3b27('realtimecollaborationclient-init-non-existent-root',this);const _0x3dec2b=this['editor']['data']['parse'](_0x49afde[_0x368eae]),_0x508a0b=this['_document']['getRoot'](_0x368eae),_0x39c0ec=new _0x3f9bda(_0x1cdb8b['createPositionAt'](_0x508a0b,0x0),_0x3dec2b,_0x56361c++);_0xe60468['push'](_0x39c0ec);for(const [_0x587442,_0x3f9f63]of _0x3dec2b['markers']){const _0x275fc5=_0x1cdb8b['createRange'](_0x1cdb8b['createPositionFromPath'](_0x508a0b,_0x3f9f63['start']['path']['slice']()),_0x1cdb8b['createPositionFromPath'](_0x508a0b,_0x3f9f63['end']['path']['slice']())),_0x513bb6=new _0x3bb101(_0x587442,null,_0x275fc5,_0x1cdb8b['markers'],!0x0,_0x56361c++);_0xe60468['push'](_0x513bb6);}}if(_0xb6124a)for(const [_0x43b010,_0x50e14a]of Object['entries'](_0xb6124a)){const _0x95c105=_0x1cdb8b['document']['getRoot'](_0x43b010);if(!_0x95c105)throw new _0x1c3b27('multi-root-editor-root-attributes-no-root',null);for(const [_0x44d528,_0xfc3ca]of Object['entries'](_0x50e14a))if(null!==_0xfc3ca){const _0x1a0c8a=new _0x16516e(_0x95c105,_0x44d528,null,_0xfc3ca,_0x56361c++);_0xe60468['push'](_0x1a0c8a);}}return _0xe60468;}async['_loadRoot'](_0x3fcf8a,_0x5b2863,_0x32670b){this['_getOperationsFromInitData']({[_0x3fcf8a]:_0x5b2863},{[_0x3fcf8a]:_0x32670b})['forEach']((_0x5188ab,_0x42b333)=>{_0x5188ab['baseVersion']=this['_document']['version']+_0x42b333,_0x5188ab['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x5188ab);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x3e661f,_0x1a4150){let _0x4a1d26;this['_offset']=_0x3e661f['offset'];const _0x456240=_0x3e661f['wereChangesApplied']&&!_0x3e661f['initData'],_0x12db3f=_0x456240?0x0:_0x3e661f['data']['baseVersion'];if(_0x1a4150['forEach'](_0x1a5c8b=>{_0x1a5c8b['_isInit']=!0x0,_0x1a5c8b['createdAt']=_0x3e661f['sessionCreatedAt'],_0x1a5c8b['_authorId']=null;}),_0x456240)_0x4a1d26=_0x1a4150,this['_applyOperationsSet'](_0x4a1d26,_0x456240);else{if(_0x3e661f['initData']){const _0xa68f9b=this['_getOperationsFromInitData'](_0x3e661f['initData']);this['_document']['history']['version']=-_0xa68f9b['length'],_0xa68f9b['forEach'](_0x371638=>{_0x371638['baseVersion']-=_0xa68f9b['length'],_0x371638['createdAt']=_0x3e661f['sessionCreatedAt'],_0x371638['_isInit']=!0x0,_0x371638['_authorId']=null;}),this['_applyOperationsSet'](_0xa68f9b,!0x0),this['serverHistory']['version']=-_0xa68f9b['length']+this['_offset'],this['_updateServerHistory'](_0xa68f9b);}this['_document']['history']['version']=_0x12db3f,_0x4a1d26=this['_decompressOperations'](_0x3e661f['data'],_0x3e661f['metadata']),await this['_fetchMissingUsers'](_0x4a1d26),this['_applyOperationsSet'](_0x4a1d26,_0x456240);}_0x3e661f['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x4a1d26,_0x3e661f['lastOperationId']),this['_lastSyncedOperationId']=_0x3e661f['lastOperationId']),this['serverHistory']['version']=_0x12db3f+this['_offset'],this['_updateServerHistory'](_0x4a1d26),_0x1a4150['filter'](_0x375a51=>{const _0x510fbe=this['_getAffectedRoot'](_0x375a51);return _0x510fbe&&!this['_knownRootNames']['has'](_0x510fbe);})['forEach']((_0x390e11,_0x32b473)=>{_0x390e11['baseVersion']=this['_document']['version']+_0x32b473,this['_saveOperationInBuffer'](_0x390e11);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3f1507,_0x4e9211,_0xb4b747){throw this['_isPendingUpdate']=!0x0,_0x4e9211&&console['error'](_0x4e9211),_0xb4b747&&this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1c3b27(_0x3f1507,this['editor']);}['_saveOperationInBuffer'](_0x1de458){this['_knownOperations']['has'](_0x1de458)||(this['_knownOperations']['add'](_0x1de458),this['_bufferedOperations']['push'](_0x1de458),this['_pendingAction']||'marker'==_0x1de458['type']&&!_0x1de458['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x42876c=!0x1){!_0x42876c&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x16366e=>{_0x16366e&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x37fb55=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x8755fd){return _0x8755fd['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x8755fd['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x8755fd['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x37fb55)||this['_crash'](_0x37fb55['message'],_0x37fb55,!0x0);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x338b78=>{this['on']('change:_isPendingUpdate',()=>{_0x338b78();});});}async['_sendBufferedOperations'](){const _0x309ccd=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0x309ccd['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x55f75b=[...this['_bufferedOperations']];for(const _0x1c6d91 of _0x55f75b)_0x1c6d91['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x1c6d91);const _0x536643=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x55f75b),_0x5e70c3=K++,_0x32eb4a=this['_compressOperations'](_0x55f75b),_0x1d366e=await this['_service']['sendOperations'](_0x32eb4a,_0x32eb4a['baseVersion'],_0x536643);try{return await this['_handleServerResponse'](_0x55f75b,_0x1d366e,_0x5e70c3);}catch(_0x565125){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x565125);}}async['_handleServerResponse'](_0x2162f2,_0x4be509,_0x30f833){if('error'in _0x4be509)throw _0x4be509['error'];let _0x12290d=!0x1;if(_0x4be509['wereChangesApplied']){_0x4be509['lastOperationId']&&(this['_lastSyncedOperationId']=_0x4be509['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x424cae=>!_0x2162f2['includes'](_0x424cae));for(const _0x12afa5 of _0x2162f2)_0x12afa5['createdAt']='lastOperationAcceptedAt'in _0x4be509&&_0x4be509['lastOperationAcceptedAt']||void 0x0;Q(_0x2162f2,_0x4be509['version']-_0x2162f2['length']),this['_updateServerHistory'](_0x2162f2);const _0x565910=_0x2162f2['filter'](_0x2ea485=>{if(!_0x2ea485['_isInit'])return!0x1;const _0x260b53=this['_getAffectedRoot'](_0x2ea485);return _0x260b53&&!this['_knownRootNames']['has'](_0x260b53);});Q(_0x565910,this['_document']['version']),this['_applyOperationsSet'](_0x565910),_0x12290d=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x43f600=this['_decompressOperations'](_0x4be509['data'],_0x4be509['metadata'])['filter'](_0x46f98c=>_0x46f98c['baseVersion']>=this['_lastServerVersion']);_0x43f600['forEach'](_0x3a4fa4=>this['_addKnownRoot'](_0x3a4fa4)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x38f734=>!_0x38f734['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x38f734))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x43f600),_0x12290d=this['_handleExternalOperations'](_0x43f600,_0x4be509['version'],_0x4be509['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x12290d?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x55a96b,_0x3e980e,_0x7854d5){try{const _0xdb97d9={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x541233,operationsB:_0x57eb8f,originalOperations:_0x5813e7}=_0x558107(_0x55a96b,this['_bufferedOperations'],_0xdb97d9);Q(_0x541233,this['_document']['version']),Q(_0x57eb8f,_0x3e980e);for(const _0x3dcf3 of _0x541233){const _0x5afd0c=_0x5813e7['get'](_0x3dcf3);_0x3dcf3['_authorId']=_0x5afd0c?_0x5afd0c['_authorId']:null;}_0x7854d5&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x55a96b,_0x7854d5),this['_lastSyncedOperationId']=_0x7854d5),this['_bufferedOperations']=[..._0x57eb8f],this['_applyOperationsSet'](_0x541233),this['_updateServerHistory'](_0x55a96b);}catch(_0x44f02c){return console['error'](_0x44f02c),!0x1;}return!0x0;}['_applyOperationsSet'](_0x1ba7b2,_0x27bebc=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x2ee302=>{for(const _0x18a5ee of _0x1ba7b2)this['_knownOperations']['add'](_0x18a5ee),this['_addKnownRoot'](_0x18a5ee),_0x2ee302['batch']['addOperation'](_0x18a5ee),this['editor']['model']['applyOperation'](_0x18a5ee);});}['_addKnownRoot'](_0x185281){const _0x3198dd=this['_getAffectedRoot'](_0x185281);_0x3198dd&&this['_knownRootNames']['add'](_0x3198dd);}['_getAffectedRoot'](_0x51cd22){let _0x1aa55d,_0x17aa78;switch(_0x51cd22['type']){case'insert':_0x1aa55d=_0x51cd22['position']['root'];break;case'marker':if(_0x17aa78=_0x51cd22['newRange'],!_0x17aa78)return null;_0x1aa55d=_0x17aa78['root'];break;case'addRootAttribute':_0x1aa55d=_0x51cd22['root'];break;case'addRoot':_0x1aa55d=_0x51cd22['affectedSelectable'];break;case'move':_0x1aa55d=_0x51cd22['targetPosition']['root'];break;default:return null;}return _0x1aa55d['rootName'];}['_updateServerHistory'](_0x31e2c6){_0x31e2c6['forEach'](_0x4c4d94=>{const _0x29b445=_0x4c4d94['clone']();_0x29b445['_authorId']=_0x4c4d94['_authorId'],_0x29b445['_isInit']=!!_0x4c4d94['_isInit'],_0x29b445['createdAt']=_0x4c4d94['createdAt'],_0x29b445['baseVersion']+=this['_offset'],_0x4c4d94['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x29b445),this['serverHistory']['addOperation'](_0x29b445);});}['_handleReconnectionError'](_0x219ffc){const _0x1d1722=this['editor']['plugins']['get']('Notification'),_0x45a792=this['editor']['locale'];_0x219ffc||(_0x219ffc=q(_0x45a792,'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.')),_0x1d1722['showWarning'](_0x219ffc,{'title':q(_0x45a792,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['destroy']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x849d5e)['add'](q(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x849d5e)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x11d6a4){const _0x34da02=_0x11d6a4['map'](_0x489c61=>_0x489c61['toJSON']());return this['_compressor']['compress'](_0x34da02);}['_decompressOperations'](_0x3fb9aa,_0x52c44b){return this['_compressor']['decompress'](_0x3fb9aa)['map']((_0x157d8a,_0x28a815)=>{const _0x32ac57='init'==_0x52c44b[_0x28a815]['type'];if('InsertOperation'==_0x157d8a['__className']){const _0x5336b9=_0x157d8a['position']['root'];!this['_document']['getRoot'](_0x5336b9)&&(this['_document']['createRoot']('$root',_0x5336b9)['_isAttached']=!0x1);}const _0x4065e2=_0x2cf636['fromJSON'](_0x157d8a,this['_document']);return _0x4065e2['wasUndone']=_0x157d8a['wasUndone'],_0x4065e2['_isInit']=_0x32ac57,_0x4065e2['_authorId']=_0x32ac57?null:_0x52c44b[_0x28a815]['userId'],_0x4065e2['_isDisconnection']='cs:removeUser'===_0x52c44b[_0x28a815]['type'],_0x4065e2['createdAt']=_0x52c44b[_0x28a815]['createdAt'],_0x4065e2;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x20eafe=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x20eafe&&_0x20eafe['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class J extends Error{}function Q(_0x37946f,_0x651437){for(const _0x225a78 of _0x37946f)_0x225a78['baseVersion']=_0x651437++;}class X{['_ignoredOperations'];['_operationToId'];constructor(_0x2d1cdf){this['_ignoredOperations']=_0x2d1cdf,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x1d47b9){let _0x4ad5ab=_0x1d47b9['length'];for(;_0x4ad5ab--;){const _0x4d036d=_0x1d47b9[_0x4ad5ab];if(!this['_ignoredOperations']['has'](_0x4d036d)){if(!this['_operationToId']['has'](_0x4d036d)){const _0x3a3ed6=_0x41ae09()['slice'](0x1,0x12);this['_operationToId']['set'](_0x4d036d,_0x3a3ed6);}return this['_operationToId']['get'](_0x4d036d);}}}['setIdForTheLastOperation'](_0xf3929e,_0x2b087d){if(!_0x2b087d)return;let _0xbd98c5=_0xf3929e['length'];for(;_0xbd98c5--;){const _0x26f70c=_0xf3929e[_0xbd98c5];this['_ignoredOperations']['has'](_0x26f70c)||this['_operationToId']['set'](_0x26f70c,_0x2b087d);}}}class n extends _0x5ab26d{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x44d9cd{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x2e95a3)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x2197dd];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4c30ad){super(_0x4c30ad),this['_services']=new Map();}async['init'](){const _0x518b6c=this['context'],_0x53fd06=_0x518b6c['plugins']['get']('CommentsRepository');if(_0x518b6c['plugins']['get'](c)['addToReconnectionStack'](this),_0x53fd06['adapter']={'addCommentThread':async({channelId:_0x94357c,threadId:_0x547478,comments:_0x497735,resolvedAt:_0x272a93,resolvedBy:_0x4b5c33,context:_0x115447,attributes:_0x2661ae})=>{const _0x26e167=await this['_getService'](_0x94357c)['addCommentThread']({'commentThreadId':_0x547478,'comments':_0x497735['map'](_0x1929bf=>function(_0x1574e4,_0xc516f3,_0xd04879){return{'commentThreadId':_0xd04879,'commentId':_0x1574e4['commentId'],'userId':_0x1574e4['authorId'],'content':_0x1574e4['content'],'documentId':_0xc516f3,'createdAt':_0x1574e4['createdAt'],'attributes':_0x1574e4['attributes']||{}};}(_0x1929bf,_0x94357c,_0x547478)),'resolvedAt':_0x272a93,'resolvedBy':_0x4b5c33,'context':_0x115447,'attributes':_0x2661ae})['catch'](ut);return{'threadId':_0x26e167['commentThreadId'],'comments':_0x26e167['comments']};},'getCommentThread':async({channelId:_0x46aeae,threadId:_0x1041fa})=>{const _0x199531=await this['_getService'](_0x46aeae)['getCommentThread'](_0x1041fa)['catch'](ut);return _0x199531['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x199531]),{'threadId':_0x199531['commentThreadId'],'comments':_0x199531['comments']['map'](b),'context':_0x199531['context'],'resolvedAt':_0x199531['resolvedAt'],'resolvedBy':_0x199531['resolvedBy'],'attributes':_0x199531['attributes']||{}});},'updateCommentThread':async({channelId:_0x1eb6f7,threadId:_0x3582cb,context:_0x50c94d,unlinkedAt:_0x526705,attributes:_0x129a2f})=>this['_getService'](_0x1eb6f7)['updateCommentThread']({'commentThreadId':_0x3582cb,'context':_0x50c94d,'attributes':_0x129a2f,'unlinkedAt':_0x526705})['catch'](y)['catch'](ut),'resolveCommentThread':async({channelId:_0x22c9f4,threadId:_0xac2991})=>{const _0x426947=await this['_getService'](_0x22c9f4)['resolveCommentThread'](_0xac2991)['catch'](y)['catch'](ut);return{'threadId':_0x426947['commentThreadId'],'resolvedAt':_0x426947['resolvedAt'],'resolvedBy':_0x426947['resolvedBy']};},'reopenCommentThread':async({channelId:_0x40a076,threadId:_0xaa7cc0})=>this['_getService'](_0x40a076)['reopenCommentThread'](_0xaa7cc0)['catch'](y)['catch'](ut),'removeCommentThread':({channelId:_0x5d2365,threadId:_0x1fadd7})=>this['_getService'](_0x5d2365)['removeCommentThread'](_0x1fadd7)['catch'](y)['catch'](ut),'addComment':({channelId:_0xbffcd,threadId:_0x17d4f9,commentId:_0x3d2489,content:_0x2c08d9,attributes:_0x1bea0d})=>this['_getService'](_0xbffcd)['addComment'](_0x17d4f9,_0x3d2489,_0x2c08d9,_0x1bea0d)['catch'](ut),'updateComment':({channelId:_0x30666b,threadId:_0x24c01e,commentId:_0x15719b,content:_0x59ce3a,attributes:_0x23043b})=>this['_getService'](_0x30666b)['updateComment'](_0x24c01e,_0x15719b,_0x59ce3a,_0x23043b)['catch'](y)['catch'](ut),'removeComment':({channelId:_0x5e045e,threadId:_0x28194c,commentId:_0x164ce4})=>this['_getService'](_0x5e045e)['removeComment'](_0x28194c,_0x164ce4)['catch'](y)['catch'](ut)},_0x518b6c instanceof _0x3362af){const _0x2fa602=_0x518b6c['config']['get']('collaboration.channelId'),_0x56f7fb=_0x518b6c['plugins']['get'](i);await this['_setUpService'](_0x2fa602);const _0x44b1ca=await this['_services']['get'](_0x2fa602)['getConnectedSessions']();this['listenTo'](_0x56f7fb,'sessionAdd:'+_0x2fa602,(_0x396745,{session:_0x3c4023})=>{_0x3c4023['id']===_0x56f7fb['mySessionId']&&(_0x396745['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x3c4023['permissions'],_0x2fa602));}),_0x56f7fb['register'](_0x2fa602,_0x44b1ca);}}async['_setUpService'](_0x227bb1){if(this['_services']['has'](_0x227bb1))throw new _0x1c3b27('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x227bb1});const _0x26da89=this['context']['plugins']['get']('CommentsRepository'),_0x5747c5=new a['CommentsService'](_0x227bb1);this['_services']['set'](_0x227bb1,_0x5747c5),this['listenTo'](_0x5747c5,'commentThreadAdded',(_0x5e8c53,_0x226db9)=>{const {commentThreadId:_0x3cfb04,documentId:_0xd38569,context:_0x11ebcc,attributes:_0x53c9f5,resolvedAt:_0x524655,resolvedBy:_0x4b13bb,comments:_0x466c75}=_0x226db9;_0x26da89['getCommentThread'](_0x3cfb04)||_0x26da89['addCommentThread']({'threadId':_0x3cfb04,'channelId':_0xd38569,'comments':_0x466c75?_0x466c75['map'](b):[],'context':_0x11ebcc,'attributes':_0x53c9f5,'resolvedAt':_0x524655,'resolvedBy':_0x4b13bb,'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentThreadUpdated',(_0x38012a,{commentThreadId:_0x157a31,documentId:_0x1419c6,context:_0x22a5a5,unlinkedAt:_0x59aeb2,attributes:_0x4ae0f5})=>{_0x26da89['getCommentThread'](_0x157a31)&&_0x26da89['updateCommentThread']({'threadId':_0x157a31,'channelId':_0x1419c6,'context':_0x22a5a5,'unlinkedAt':_0x59aeb2,'attributes':_0x4ae0f5,'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentThreadResolved',(_0x206ca9,{commentThreadId:_0x3c8c06,resolvedBy:_0x55066f,resolvedAt:_0x3b9728})=>{const _0x6962bc=_0x26da89['getCommentThread'](_0x3c8c06);_0x6962bc&&_0x6962bc['resolve']({'resolvedBy':_0x55066f,'resolvedAt':_0x3b9728,'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentThreadReopened',(_0x326d2e,{commentThreadId:_0xab9549})=>{const _0x357e5e=_0x26da89['getCommentThread'](_0xab9549);_0x357e5e&&_0x357e5e['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentThreadRemoved',(_0x5ae694,{commentThreadId:_0x4260ba})=>{const _0xbf523b=_0x26da89['getCommentThread'](_0x4260ba);_0xbf523b&&_0xbf523b['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentAdded',(_0x337693,_0x4f5aee)=>{const _0x467591=_0x4f5aee['commentThreadId'],_0x14dddd=_0x26da89['getCommentThread'](_0x467591);_0x14dddd&&_0x14dddd['addComment']({...b(_0x4f5aee),'isFromAdapter':!0x0});}),this['listenTo'](_0x5747c5,'commentUpdated',(_0x80761b,{commentThreadId:_0x144709,commentId:_0x9d13b6,content:_0x22e0f5,attributes:_0x4fa542})=>{const _0x16c032=_0x26da89['getCommentThread'](_0x144709);if(_0x16c032){const _0x3af0f2=_0x16c032['getComment'](_0x9d13b6);_0x3af0f2&&_0x3af0f2['update']({'content':_0x22e0f5,'attributes':_0x4fa542,'isFromAdapter':!0x0});}}),this['listenTo'](_0x5747c5,'commentRemoved',(_0x3ecc76,{commentThreadId:_0x20db46,commentId:_0x147b75})=>{const _0x37699b=_0x26da89['getCommentThread'](_0x20db46);if(_0x37699b){const _0x1bf0b7=_0x37699b['getComment'](_0x147b75);_0x1bf0b7&&_0x1bf0b7['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x227bb1);}['destroy'](){if(this['context']instanceof _0x3362af){const _0xd404d3=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0xd404d3);}}['_terminateService'](_0x524cc0){if(!this['_services']['has'](_0x524cc0))throw new _0x1c3b27('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x524cc0});this['_getService'](_0x524cc0)['disconnect'](),this['_services']['delete'](_0x524cc0);}async['reconnect'](){for(const _0x18cede of this['_services']['keys']())await this['_connectService'](_0x18cede);if(this['context']instanceof _0x3362af){const _0xfea44c=this['context']['config']['get']('collaboration.channelId'),_0x3baa41=this['context']['plugins']['get'](i);_0x3baa41['unregister'](_0xfea44c);const _0x312f1f=await this['_services']['get'](_0xfea44c)['getConnectedSessions']();_0x3baa41['register'](_0xfea44c,_0x312f1f);}}async['_connectService'](_0x3a83a8){const {connection:_0x2fe508}=this['context']['plugins']['get'](c),_0x3f42ed=this['context']['plugins']['get']('CommentsRepository'),_0x26b0d1=this['_services']['get'](_0x3a83a8),_0x4b77ce=await _0x26b0d1['connect'](_0x2fe508);await this['_fetchMissingUsersForThreads'](_0x4b77ce);const _0x5a302c=new Set(Array['from'](_0x3f42ed['getCommentThreads']({'channelId':_0x3a83a8}),_0x4c99d0=>_0x4c99d0['id']));for(const _0x1635c6 of _0x4b77ce)_0x1635c6['deletedAt']||_0x5a302c['delete'](_0x1635c6['commentThreadId']);for(const _0x1a8230 of _0x5a302c)_0x3f42ed['getCommentThread'](_0x1a8230)['remove']({'isFromAdapter':!0x0});for(const _0x573d23 of _0x4b77ce){let _0x5ad70f=_0x3f42ed['getCommentThread'](_0x573d23['commentThreadId']);const {commentThreadId:_0x1b1765,context:_0xe4df5f,attributes:_0x9dd1c1,resolvedBy:_0x51b6f,resolvedAt:_0x5f156e,unlinkedAt:_0x276690,deletedAt:_0x1e6ee2}=_0x573d23;if(_0x1e6ee2)continue;_0x5ad70f||(_0x5ad70f=_0x3f42ed['addCommentThread']({'channelId':_0x3a83a8,'threadId':_0x1b1765,'context':_0xe4df5f,'attributes':_0x9dd1c1||{},'resolvedBy':_0x51b6f,'resolvedAt':_0x5f156e,'unlinkedAt':_0x276690,'isFromAdapter':!0x0}));const _0x1f9c94=new Set(Array['from'](_0x5ad70f['comments'],_0xc670ea=>_0xc670ea['id']));for(const _0x31d1f4 of _0x573d23['comments'])_0x1f9c94['delete'](_0x31d1f4['commentId']);for(const _0x45a4bc of _0x1f9c94)_0x5ad70f['getComment'](_0x45a4bc)['remove']({'isFromAdapter':!0x0});for(const _0xc3b3b of _0x573d23['comments']){const _0x33cd78=_0x5ad70f['getComment'](_0xc3b3b['commentId']);_0x33cd78?_0x33cd78['content']!==_0xc3b3b['content']&&_0x33cd78['update']({'content':_0xc3b3b['content'],'isFromAdapter':!0x0}):_0x5ad70f['addComment'](Object['assign'](b(_0xc3b3b),{'isFromAdapter':!0x0}));}}}['_getService'](_0x77efa5){if(!this['_services']['has'](_0x77efa5))throw new _0x1c3b27('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x77efa5});return this['_services']['get'](_0x77efa5);}async['_fetchMissingUsersForThreads'](_0x512be8){const _0x1e7651=this['context']['plugins']['get'](_0x2197dd),{connection:_0x2a5b36}=this['context']['plugins']['get'](c),_0x29b73c=new Set();for(const {resolvedBy:_0x4364e4,comments:_0x52e601}of _0x512be8){_0x4364e4&&!_0x1e7651['getUser'](_0x4364e4)&&_0x29b73c['add'](_0x4364e4);for(const {userId:_0x43368d}of _0x52e601)_0x1e7651['getUser'](_0x43368d)||_0x29b73c['add'](_0x43368d);}if(0x0===_0x29b73c['size'])return;const _0x4304c2=await dt['getMany'](_0x2a5b36,Array['from'](_0x29b73c));for(const _0xaa38e5 of _0x4304c2)_0x1e7651['getUser'](_0xaa38e5['id'])||_0x1e7651['addUser'](_0xaa38e5);}}async function y(_0x808ee){if('404'!==_0x808ee['code'])throw _0x808ee;}function ut(_0x4163ff){if((_0xb0b36c=_0x4163ff)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0xb0b36c['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xb0b36c['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0xb0b36c;throw _0x4163ff;}function b(_0x390ae2){return{'threadId':_0x390ae2['commentThreadId'],'commentId':_0x390ae2['commentId'],'content':_0x390ae2['content'],'createdAt':_0x390ae2['createdAt'],'authorId':_0x390ae2['userId'],'attributes':_0x390ae2['attributes']||{}};}class f extends _0x5ab26d{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>et)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[a,'TrackChangesEditing',c];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3ee329){super(_0x3ee329);const _0x20f264=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x20f264);}['init'](){const _0x2bf5fc=this['editor']['plugins']['get'](c),_0x4532ca=this['editor']['plugins']['get']('TrackChangesEditing');return _0x4532ca['adapter']={'getSuggestion':async _0x27fa05=>{await this['_waitForServiceReady']();const _0x4e7f37=await this['_trackChangesService']['get'](_0x27fa05)['catch'](w);return await this['_fetchMissingUsersForThreads']([_0x4e7f37]),_0x4e7f37;},'addSuggestion':async({id:_0x3b94ab,type:_0x479ea6,data:_0x3c2bd7,originalSuggestionId:_0x22ed29,attributes:_0x1b7d21})=>{await this['_waitForServiceReady']();const _0x57d39c={'id':_0x3b94ab,'type':_0x479ea6,'data':_0x3c2bd7,'originalSuggestionId':_0x22ed29,'attributes':_0x1b7d21},_0x24138c=await this['_trackChangesService']['add'](_0x3b94ab,_0x479ea6,_0x3c2bd7,_0x22ed29,_0x1b7d21)['catch'](_0xe79c02=>{if(ft(_0xe79c02))return new Promise(_0x6568f1=>{this['_bufferedRequests']['set'](_0x3b94ab,{'resolve':_0x6568f1,'suggestionData':_0x57d39c});});throw _0xe79c02;});return this['_bufferedRequests']['delete'](_0x3b94ab),_0x24138c;},'updateSuggestion':async(_0x49ad7d,_0x4f6ee7)=>{if(await this['_waitForServiceReady'](),'open'!==_0x4f6ee7['state'])return this['_trackChangesService']['update'](_0x49ad7d,_0x4f6ee7)['catch'](w);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x3ff625,_0x18cc71)=>{_0x4532ca['hasSuggestion'](_0x18cc71['id'])&&(_0x4532ca['getSuggestion'](_0x18cc71['id'])['attributes']=_0x18cc71['attributes']);}),this['_trackChangesService']['connect'](_0x2bf5fc['connection'])['then'](_0x27445c=>(_0x2bf5fc['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x27445c)['then'](()=>{for(const _0x284ae3 of _0x27445c){_0x4532ca['addSuggestionData'](_0x284ae3)['_saved']=!0x0;}})));}async['reconnect'](){const _0x1bf000=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x2556ac}=this['editor']['plugins']['get'](c),_0x5b4344=await this['_trackChangesService']['connect'](_0x2556ac);await this['_fetchMissingUsersForThreads'](_0x5b4344);for(const {suggestionData:_0x17ba51,resolve:_0x4d477b}of this['_bufferedRequests']['values']()){let _0x4bf2d9=_0x5b4344['find'](_0x1f91a1=>_0x1f91a1['id']===_0x17ba51['id']);_0x4bf2d9||(_0x4bf2d9=await this['_trackChangesService']['add'](_0x17ba51['id'],_0x17ba51['type'],_0x17ba51['data'],_0x17ba51['originalSuggestionId'])),_0x4d477b(_0x4bf2d9);}for(const _0x12cb7f of _0x5b4344)_0x1bf000['hasSuggestion'](_0x12cb7f['id'])||_0x1bf000['addSuggestionData'](_0x12cb7f);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x1c4e94=>{this['listenTo'](this['_trackChangesService'],'connected',_0x37003f=>{_0x37003f['off'](),_0x1c4e94();});});}async['_fetchMissingUsersForThreads'](_0x269036){const _0x5da90c=this['editor']['plugins']['get'](_0x2197dd),{connection:_0x23d54c}=this['editor']['plugins']['get'](c),_0x3bca4a=new Set();for(const {authorId:_0x59b796}of _0x269036)_0x5da90c['getUser'](_0x59b796)||_0x3bca4a['add'](_0x59b796);if(0x0===_0x3bca4a['size'])return;const _0x19a1ed=await dt['getMany'](_0x23d54c,Array['from'](_0x3bca4a));for(const _0x59807e of _0x19a1ed)_0x5da90c['getUser'](_0x59807e['id'])||_0x5da90c['addUser'](_0x59807e);}}function w(_0x416385){if(ft(_0x416385))return new Promise(()=>{});throw _0x416385;}function ft(_0x2149f8){return _0x2149f8['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2149f8['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x5ab26d{static get['requires'](){return['Comments',a,n,c];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x369dfa=this['editor']['plugins']['get'](c),_0x12b456=this['editor']['plugins']['get']('CommentsEditing'),_0x202d4c=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x369dfa,'change:state',(_0x413a98,_0x23c46d,_0x133a0e)=>{_0x12b456['isThreadsLoadingPaused']='connected'!==_0x133a0e;});}),this['listenTo'](_0x369dfa,'change:state',(_0x3d10bc,_0x3ed553,_0x2f2c19)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x2f2c19);}),_0x202d4c['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](a)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class p extends _0x5ab26d{static get['requires'](){return[m,f,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class u extends _0x5ab26d{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionTracker',i,_0x2197dd];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4ed332){super(_0x4ed332);const _0x3db451=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x3db451);}async['init'](){const _0x4fd2dd=this['editor']['plugins']['get'](l),_0x2d1252=_0x4fd2dd['serverHistory'],_0x3333df=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x2d1252,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x4fd2dd['sessionId']});const _0x4ca199=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x3b2c72=await tt['isBundleUploaded'](_0x3333df['connection'],_0x4ca199);this['_revisionTracker']['adapter']={'getRevision':async({revisionId:_0x4de007})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x4de007)),'updateRevisions':async _0x5362e7=>{await this['_waitForServiceReady']();const _0x1c12b8=this['_revisionTracker']['currentRevision'];if(_0x3b2c72&&0x1===_0x5362e7['length']&&_0x5362e7[0x0]['id']===_0x1c12b8['id'])return _0x5362e7;for(const _0x460732 of _0x5362e7)_0x460732['id']===_0x1c12b8['id']&&(_0x460732['isEmptyCurrent']=_0x460732['fromVersion']===_0x460732['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x5362e7,this['_lastRequestId'])['then'](_0x41949d=>(this['_lastRequestId']=_0x41949d,_0x5362e7))['catch'](_0x27afd1=>{if(st(_0x27afd1)||'400'===_0x27afd1['code']&&void 0x0!==_0x27afd1['data']['wrongRequestId']){for(const _0x2c94ed of _0x5362e7){!this['_revisionTracker']['repository']['getRevision'](_0x2c94ed['id'])||this['_revisionTracker']['_bufferUpdate'](_0x2c94ed['id'],_0x2c94ed,!0x1);}if(st(_0x27afd1))throw _0x27afd1;return _0x5362e7;}throw _0x27afd1;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x57dfb2,{revisionsData:_0x37fb3c,requestId:_0x11f1db})=>{Math['max'](..._0x37fb3c['map'](_0x20d3f0=>_0x20d3f0['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x37fb3c,_0x11f1db);}):this['_handleRevisionsUpdate'](_0x37fb3c,_0x11f1db);});const {revisions:_0x14b1f1,requestId:_0x1fe2da}=await this['_revisionHistoryService']['connect'](_0x3333df['connection']);_0x3333df['addToReconnectionStack'](this),this['_lastRequestId']=_0x1fe2da,await this['_fetchMissingUsers'](_0x14b1f1);for(const _0x21e942 of _0x14b1f1)this['_revisionTracker']['addRevisionData'](_0x21e942);this['listenTo'](_0x4fd2dd,'change:_isConnected',(_0x2b0fed,_0x3891d0,_0x551e3c)=>{_0x551e3c&&(this['_oldOffset']=_0x4fd2dd['_offset'],_0x2b0fed['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x3333df,'state',_0x1595d1=>_0x1595d1===_0xf6d7c['CONNECTED']);}async['reconnect'](){const _0x1afc1c=this['editor']['plugins']['get'](c),_0x4b25cf=this['editor']['plugins']['get'](l),_0x328ba6=async()=>{const _0x59b615=this['_revisionTracker']['currentRevision'],_0x3f7dd7=_0x59b615['id'],_0x1157ed=_0x3f7dd7!==_0x4b25cf['sessionId'];if(_0x1157ed){const _0x53c745=_0x4b25cf['_offset']-this['_oldOffset'],_0x40413d=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x59b615['toVersion']+_0x53c745!==_0x40413d){const _0x40563e=_0x59b615['fromVersion']+_0x53c745,_0xdcbaef=this['editor']['plugins']['get'](_0x2197dd),_0x4fe8bd=this['_revisionTracker']['buildRevisionData']({'revision':_0x59b615,'from':_0x40563e,'to':_0x40413d});_0x4fe8bd['id']=_0x59b615['id'];const _0x596c3f=_0x4fe8bd['authorsIds']['map'](_0x31f84f=>_0xdcbaef['getUser'](_0x31f84f));_0x59b615['_update']({..._0x4fe8bd,'authors':_0x596c3f},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x59b615['id'],_0x4fe8bd,!0x0);}this['_revisionTracker']['_startingVersion']=_0x40413d,(_0x59b615['toVersion']===_0x59b615['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x3f7dd7)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x3f7dd7),this['_revisionTracker']['_createCurrentRevision'](_0x40413d));}const {revisions:_0x5df542,requestId:_0x42bf59}=await this['_revisionHistoryService']['reconnect'](_0x1afc1c['connection'],this['_lastRequestId']);_0x1157ed&&_0x5df542['length']>0x0?_0x4b25cf['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x5df542),this['_handleRevisionsUpdate'](_0x5df542,_0x42bf59),this['_revisionTracker']['sendBufferedUpdates']());};return _0x4b25cf['_isConnected']?_0x328ba6():new Promise((_0x5b2e81,_0x395b9c)=>{_0x4b25cf['once']('change:_isConnected',()=>{_0x328ba6()['then'](_0x5b2e81)['catch'](_0x395b9c);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5b6c9c=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x43bb09=>{_0x43bb09['off'](),_0x5b6c9c();});});}['_getLatestVersionFromServerOperations'](){const _0x3a1d90=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x327e30 of _0x3a1d90)if('marker'!==_0x327e30['type']||_0x327e30['affectsData'])return _0x327e30['baseVersion']+0x1;}['_getLatestVersion'](){const _0x19c9ff=this['editor']['plugins']['get'](l);return new Promise(_0x4ebf17=>{_0x19c9ff['_isPendingUpdate']?_0x19c9ff['once']('change:_isPendingUpdate',()=>{_0x4ebf17(this['_getLatestVersionFromServerOperations']());}):_0x4ebf17(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x4e5764,_0x35eb05){const _0x744326=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x35eb05;for(const _0x4ddda7 of _0x4e5764){const _0x393529=_0x744326['getRevision'](_0x4ddda7['id']);if(_0x393529){if((_0x4ddda7['fromVersion']||_0x4ddda7['toVersion'])&&(_0x4ddda7['diffData']=null),_0x393529===this['_revisionTracker']['currentRevision']){const _0x377525=Math['max'](_0x393529['toVersion'],_0x4ddda7['toVersion']),_0x5bdc91=Math['max'](_0x393529['fromVersion'],_0x4ddda7['fromVersion']);let _0x2cc720;_0x393529['toVersion']===_0x4ddda7['toVersion']&&_0x393529['fromVersion']===_0x4ddda7['fromVersion']?(_0x2cc720=!0x0,this['_preventResendingRevisionData'](_0x4ddda7)):_0x4ddda7['toVersion']===_0x377525&&_0x4ddda7['fromVersion']===_0x5bdc91?_0x2cc720=!0x1:(_0x393529['toVersion']===_0x377525&&_0x393529['fromVersion']===_0x5bdc91||this['_fixRevision']({'revision':_0x393529,'from':_0x5bdc91,'to':_0x377525}),_0x2cc720=!0x0),_0x2cc720&&(delete _0x4ddda7['fromVersion'],delete _0x4ddda7['toVersion'],delete _0x4ddda7['diffData'],delete _0x4ddda7['createdAt'],delete _0x4ddda7['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x4ddda7),this['_preventResendingRevisionData'](_0x4ddda7);}else this['_revisionTracker']['addRevisionData'](_0x4ddda7);}const _0x1f7549=_0x744326['getRevisions']();_0x1f7549['reverse']();for(let _0x5615d0=0x0;_0x5615d0<_0x1f7549['length']-0x1;_0x5615d0++){const _0x31e0a2=_0x1f7549[_0x5615d0],_0x5aac35=_0x1f7549[_0x5615d0+0x1];if(_0x31e0a2['fromVersion']<_0x5aac35['toVersion']){const _0x454b6f=_0x5aac35['toVersion'],_0x2b63b0=Math['max'](_0x454b6f,_0x31e0a2['toVersion']);this['_fixRevision']({'revision':_0x31e0a2,'from':_0x454b6f,'to':_0x2b63b0});}}}['_fixRevision']({revision:_0x526d60,from:_0x3afac0,to:_0x272d93}={}){const _0x2c863b=this['editor']['plugins']['get'](_0x2197dd),_0x420b52=this['_revisionTracker']['buildRevisionData']({'revision':_0x526d60,'from':_0x3afac0,'to':_0x272d93});_0x420b52['authors']=_0x420b52['authorsIds']['map'](_0x441f4c=>_0x2c863b['getUser'](_0x441f4c)),_0x526d60['_update'](_0x420b52);}['_preventResendingRevisionData'](_0x314c91){const _0x514996={};_0x514996['id']=_0x314c91['id'];for(const _0x5e608b of Object['keys'](_0x314c91))'id'!==_0x5e608b&&(_0x514996[_0x5e608b]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x514996['id'],_0x514996,!0x0);}async['_fetchMissingUsers'](_0x43ce96){const _0x5796b4=this['editor']['plugins']['get'](_0x2197dd),{connection:_0x5cd484}=this['editor']['plugins']['get'](c),_0x49fdea=new Set();for(const _0x5f4352 of _0x43ce96){for(const _0xb8b2a5 of _0x5f4352['authorsIds'])_0x175518(_0xb8b2a5);_0x5f4352['creatorId']&&_0x175518(_0x5f4352['creatorId']);}if(0x0===_0x49fdea['size'])return;const _0x303761=await dt['getMany'](_0x5cd484,Array['from'](_0x49fdea));for(const _0x473a53 of _0x303761)_0x5796b4['getUser'](_0x473a53['id'])||_0x5796b4['addUser'](_0x473a53);function _0x175518(_0x41079e){_0x5796b4['getUser'](_0x41079e)||_0x49fdea['add'](_0x41079e);}}}function st(_0x2bdd85){return _0x2bdd85['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2bdd85['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2bdd85['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x5ab26d{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class ts extends _0x35ade4{constructor(_0x2f9913){super(_0x2f9913);const _0x3acf34=this['bindTemplate'];this['set']('usersCount',0x0),this['set']('isHidden',!0x0),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__counter',_0x3acf34['if']('isHidden','ck-presence-list__counter--hidden')]},'children':[{'text':_0x3acf34['to']('usersCount',_0x243a65=>q(_0x2f9913,'CONNECTED_USERS',_0x243a65))}]});}}class es extends _0x35ade4{['items'];['keystrokes'];constructor(_0x40ddad){super(_0x40ddad);const _0x202c68=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x1bc3ac(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x202c68['if']('hasPopup'),'aria-expanded':_0x202c68['to']('isExpanded',_0x44d206=>this['hasPopup']&&String(_0x44d206)),'aria-label':_0x202c68['to']('hasPopup',_0x4a0178=>q(_0x40ddad,_0x4a0178?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x202c68['to']('hasPopup',_0x13d0a8=>!!_0x13d0a8&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'click':_0x202c68['to'](()=>this['fire']('execute'))}}),this['on']('change:hasPopup',(_0x36473e,_0x424d27,_0x1c440c)=>{this['element']&&(_0x1c440c?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 _ extends _0x35ade4{['counterView'];['inlineListView'];constructor(_0x3b6832){super(_0x3b6832);const _0x5e2675=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new ts(this['locale']),this['inlineListView']=new es(_0x3b6832),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x3e81c7 of this['inlineListView']['items'])_0x3e81c7['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',_0x5e2675['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['counterView'],this['inlineListView']]});}}class M extends _0x35ade4{['listWrapperView'];constructor(_0x2730d5,_0x1dfbca){super(_0x2730d5),this['listWrapperView']=new mt(_0x2730d5,_0x1dfbca),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':q(_0x2730d5,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}}class mt extends _0x3ff8be{constructor(_0x28fa34,_0x5916cf){super(_0x28fa34);const _0x2ebf79=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x5916cf?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2ebf79['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2ebf79['to']('role'),'aria-label':_0x2ebf79['to']('ariaLabel'),'aria-labelledby':_0x2ebf79['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0xc3811['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x3d581a=this['element'];_0x3d581a&&(this['_isScrollable']=Math['max'](_0x3d581a['scrollHeight'],_0x3d581a['clientHeight'])>0.8*window['innerHeight']);}}class E extends rt{['userView'];constructor(_0xd2d187,_0x57cc8f,_0x4786c0){super(_0xd2d187);const _0x50d897=this['bindTemplate'];this['userView']=new ct(_0xd2d187,_0x57cc8f);const _0x385549={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x57cc8f['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x57cc8f['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x57cc8f['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x4786c0&&(_0x385549['tag']='button',_0x385549['on']={'click':_0x50d897['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x385549);}['focus'](){this['element']['focus']();}}class T extends _0x35ade4{['userView'];['markerView'];constructor(_0x107b64,_0x4dfc18,_0x4c9b59){super(_0x107b64);const _0x38b64b=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x107b64,_0x4dfc18),this['markerView']=new at(_0x107b64,_0x4dfc18);const _0x33f94d=new ot(_0x107b64);_0x33f94d['template']['tag']='span',_0x33f94d['text']=_0x4dfc18['name'];const _0x550379={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x38b64b['to']('isFocusable',_0x34217f=>!!_0x34217f&&0x0),'aria-labelledby':_0x33f94d['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x38b64b['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x38b64b['to']('hasTooltip',_0x4b30e9=>!_0x4b30e9),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x33f94d]};_0x4c9b59&&(_0x550379['tag']='button',_0x550379['on']={'click':_0x38b64b['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x550379);}}class at extends _0x35ade4{constructor(_0x13758f,_0x5010c8){super(_0x13758f),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5010c8['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const D={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x44d9cd{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;constructor(_0x56c467){super(_0x56c467),this['context']['config']['define']('presenceList',D);const _0x2ad8a2=_0x56c467['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x2ad8a2)throw new _0x1c3b27('presencelist-collapseat-invalid-format',this);if(_0x2ad8a2<0x1)throw new _0x1c3b27('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x27f226(),this['balloonPanelView']=new _0x7e4ba1(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x242db9 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x242db9);this['listenTo'](this['_allConnectedUsers'],'add',(_0x2c8754,_0x5c5cc0)=>{this['_handleUserAdd'](_0x5c5cc0);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x425036,_0x5b3e56)=>{this['_handleUserRemove'](_0x5b3e56);});}['_createView'](){const _0x30ba9f=this['context'],_0x24db9b=new _(this['context']['locale']),_0x2a0a8f=this['balloonPanelView'];if(!_0x5cdde0(_0x30ba9f['config']['get']('presenceList.container')))throw new _0x1c3b27('presencelist-missing-container',this);return _0x24db9b['counterView']['bind']('usersCount')['to'](this),_0x24db9b['bind']('isCollapsed')['to'](this,'usersCount',_0x450992=>{const {collapseAt:_0x2d26c,displayMe:_0x543faf}=_0x30ba9f['config']['get']('presenceList'),_0x2d0561=_0x450992>=_0x2d26c;return _0x24db9b['counterView']['isHidden']=!(0x1==_0x450992&&_0x543faf||_0x2d0561),_0x2d0561||this['hideDropdown'](),_0x2d0561;}),_0x24db9b['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x55d736=>{const _0x58a067=_0x30ba9f['config']['get']('presenceList'),_0x5cb763=new T(_0x30ba9f['locale'],_0x55d736,!!_0x58a067['onClick']);return _0x5cb763['bind']('hasTooltip')['to'](_0x24db9b,'isCollapsed',_0x1cdbec=>!_0x1cdbec),_0x5cb763['bind']('isFocusable')['to'](_0x24db9b,'isCollapsed',_0x46dd22=>!_0x46dd22),_0x58a067['onClick']&&this['listenTo'](_0x5cb763,'execute',()=>{this['view']['isCollapsed']||_0x58a067['onClick'](_0x55d736,_0x5cb763['element']);}),_0x5cb763;}),this['listenTo'](_0x24db9b['inlineListView'],'execute',()=>{this['presenceDropdownView']?this['hideDropdown']():this['view']['isCollapsed']&&this['showDropdown']();}),_0x24db9b['inlineListView']['keystrokes']['set']('Enter',(_0x4dd943,_0x3446e9)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x3446e9());}),_0x24db9b['render'](),_0x2a0a8f['render'](),_0x52aff7({'emitter':_0x24db9b,'activator':()=>_0x2a0a8f['isVisible'],'contextElements':[_0x2a0a8f['element'],_0x24db9b['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x30ba9f['config']['get']('presenceList.container')['appendChild'](_0x24db9b['element']),this['_bodyCollection']=new _0x1b2e2a(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x24db9b;}['_handleUserAdd'](_0x519c30){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x519c30['isMe'])return;const _0x50a63a=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['usersCount']++,this['currentDisplayedUsers']['length']==_0x50a63a&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](0x1);const _0x3f4778=_0x519c30['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x519c30,_0x3f4778);}['_handleUserRemove'](_0x43e7ee){if(this['usersCount']--,this['currentDisplayedUsers']['get'](_0x43e7ee['id'])&&(this['currentDisplayedUsers']['remove'](_0x43e7ee['id']),this['currentDisplayedUsers']['length']<this['usersCount'])){for(const _0xe7029e of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0xe7029e['id']))return void this['currentDisplayedUsers']['add'](_0xe7029e,Math['min'](this['currentDisplayedUsers']['length'],0x1));}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1ea4ad=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new M(this['context']['locale'],!!_0x1ea4ad['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0xf9edb0}=this['presenceDropdownView'];_0xf9edb0['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1247a4=>{if(!_0x1ea4ad['displayMe']&&_0x1247a4['isMe'])return null;const _0x2691db=new E(this['context']['locale'],_0x1247a4,!!_0x1ea4ad['onClick']);return _0x1ea4ad['onClick']&&this['listenTo'](_0x2691db,'execute',()=>{_0x1ea4ad['onClick'](_0x1247a4,_0x2691db['element']);}),_0x2691db;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0xf9edb0['focus'](),_0xf9edb0['checkIfScrollable']();const _0x20763d=(_0x55fd71,_0x3cfc68)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x3cfc68();};_0xf9edb0['keystrokes']['set']('Esc',_0x20763d),_0xf9edb0['keystrokes']['set']('Shift+Tab',_0x20763d),_0xf9edb0['keystrokes']['set']('Tab',(_0x4e23a0,_0x152efd)=>{!function(_0x587f3b){const _0x4aaf12=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x20cec6=>_0x20cec6+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x1955ae=[...document['body']['querySelectorAll'](_0x4aaf12)]['filter'](_0x3c80ac=>_0x3c80ac===document['activeElement']||_0x3c80ac['offsetWidth']+_0x3c80ac['offsetHeight']>0x0)['sort']((_0x3833cd,_0x400b04)=>(_0x3833cd['tabIndex']||0x0)-(_0x400b04['tabIndex']||0x0)),_0xd8ebc8=_0x1955ae['indexOf'](_0x587f3b),_0x56c47b=_0x1955ae[(_0xd8ebc8+0x1)%_0x1955ae['length']];_0x56c47b&&_0x56c47b['focus']();}(this['view']['element']),this['hideDropdown'](),_0x152efd();}),_0xf9edb0['focusTracker']['add'](this['view']['element']),_0xf9edb0['focusTracker']['on']('change:isFocused',(_0x2a73ea,_0x14cc60,_0x56393c)=>{_0x56393c||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class s extends _0x44d9cd{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-real-time-collaboration",
|
|
3
|
-
"version": "44.1.0-alpha.
|
|
3
|
+
"version": "44.1.0-alpha.5",
|
|
4
4
|
"description": "A set of CKEditor 5 features enabling real-time collaboration within the editor using CKEditor Cloud Services.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@ckeditor/ckeditor-cloud-services-collaboration": "52.6.11",
|
|
45
|
-
"@ckeditor/ckeditor5-core": "44.1.0-alpha.
|
|
46
|
-
"@ckeditor/ckeditor5-engine": "44.1.0-alpha.
|
|
47
|
-
"@ckeditor/ckeditor5-operations-compressor": "44.1.0-alpha.
|
|
48
|
-
"@ckeditor/ckeditor5-theme-lark": "44.1.0-alpha.
|
|
49
|
-
"@ckeditor/ckeditor5-ui": "44.1.0-alpha.
|
|
50
|
-
"@ckeditor/ckeditor5-utils": "44.1.0-alpha.
|
|
51
|
-
"ckeditor5": "44.1.0-alpha.
|
|
52
|
-
"ckeditor5-collaboration": "44.1.0-alpha.
|
|
45
|
+
"@ckeditor/ckeditor5-core": "44.1.0-alpha.5",
|
|
46
|
+
"@ckeditor/ckeditor5-engine": "44.1.0-alpha.5",
|
|
47
|
+
"@ckeditor/ckeditor5-operations-compressor": "44.1.0-alpha.5",
|
|
48
|
+
"@ckeditor/ckeditor5-theme-lark": "44.1.0-alpha.5",
|
|
49
|
+
"@ckeditor/ckeditor5-ui": "44.1.0-alpha.5",
|
|
50
|
+
"@ckeditor/ckeditor5-utils": "44.1.0-alpha.5",
|
|
51
|
+
"ckeditor5": "44.1.0-alpha.5",
|
|
52
|
+
"ckeditor5-collaboration": "44.1.0-alpha.5",
|
|
53
53
|
"lodash-es": "4.17.21"
|
|
54
54
|
},
|
|
55
55
|
"types": "src/index.d.ts",
|