@ckeditor/ckeditor5-real-time-collaboration 45.2.1-alpha.5 → 45.2.1-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/presencelistui.js +1 -1
- package/src/presencelist/view/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/presencelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +2 -2
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/sessions.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.js +2 -2
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +2 -2
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +2 -2
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x4fd7cf];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5ce15d){super(_0x5ce15d),this['set']('state',_0x4bea31['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x27e3ec);}['init'](){const _0x3439fc=this['context'],_0x3175c6=_0x3439fc['plugins']['get']('CloudServices'),_0x2e1fdb=_0x3439fc['plugins']['get'](_0x4fd7cf);if(!_0x3175c6['token'])throw new _0x2493d0('websocketgateway-missing-token',this);if(!_0x3175c6['webSocketUrl'])throw new _0x2493d0('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'](_0x3175c6['token'],_0x3175c6['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x17c930=>{if(this['connection']=_0x17c930,this['bind']('state')['to'](_0x17c930,'state',this,'_isBrowserOffline',(_0x572efc,_0x1e7165)=>('connected'!==_0x572efc&&(this['_shouldPluginsReconnect']=!0x0),_0x1e7165||_0x572efc!==_0x4bea31['CONNECTED']?_0x4bea31['DISCONNECTED']:this['state']==_0x4bea31['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x4bea31['CONNECTING']):_0x4bea31['CONNECTED'])),this['connection']['on']('error',(_0x31e6d9,_0xd0dbee)=>{if('limitExceeded'!==_0xd0dbee['code'])throw console['error'](_0xd0dbee),new _0x2493d0('cloudservices-init',null,{'originalError':_0xd0dbee});_0x2e1fdb['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'});}),!_0x17c930['me'])return new Promise(_0x438d8b=>_0x17c930['on']('change:me',_0x438d8b));})['catch'](_0x31e42a=>{throw console['error'](_0x31e42a),new _0x2493d0('cloudservices-init',null,{'originalError':_0x31e42a});});}['addToReconnectionStack'](_0x545249){if('function'!=typeof _0x545249['reconnect'])throw new _0x2493d0('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x545249))throw new _0x2493d0('websocketgateway-plugin-already-registered',this,{'name':_0x545249['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x545249);}['removeFromReconnectionStack'](_0x3b6135){this['_reconnectionStack']['delete'](_0x3b6135);}['isInReconnectionStack'](_0x2bb44a){return this['_reconnectionStack']['has'](_0x2bb44a);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x292f58=>_0x292f58['reconnect']())))['then'](()=>this['state']=_0x4bea31['CONNECTED'])['catch'](_0x4116a5=>{throw console['error'](_0x4116a5),new _0x2493d0('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x4bea31['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x19f79c{['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,_0x3a4ee8];}constructor(_0x4b27af){super(_0x4b27af),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x3ddc9f(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x3a4ee8);}['init'](){const _0x1337df=this['context']['plugins']['get'](c);this['listenTo'](_0x1337df,'change:state',(_0x5f23f7,_0x4d99ae,_0x1ca3e1)=>{if('connected'!==_0x1ca3e1)this['channelSessions']['forEach'](_0x25bd4b=>_0x25bd4b['clear']()),this['channelConnectedUsers']['forEach'](_0x117e81=>_0x117e81['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x4fb267,_0x1ad930]of this['_registeredSessions'])for(const _0x5d40c7 of _0x1ad930)this['_handleSessionAdd'](_0x4fb267,_0x5d40c7);}}),this['_createUser'](_0x1337df['connection']['me'],!0x0);}['register'](_0x513391,_0x2dbbd2){if(this['_registeredSessions']['has'](_0x513391))throw new _0x2493d0('sessions-register-already-registered',null,{'channelId':_0x513391});this['_registeredSessions']['set'](_0x513391,_0x2dbbd2),this['channelSessions']['set'](_0x513391,new _0x3ddc9f()),this['channelConnectedUsers']['set'](_0x513391,new _0x3ddc9f()),this['listenTo'](_0x2dbbd2,'add',(_0x5afaef,_0x2440c1)=>this['_handleSessionAdd'](_0x513391,_0x2440c1)),this['listenTo'](_0x2dbbd2,'remove',(_0x404e19,_0x50b3b2)=>this['_handleSessionRemove'](_0x513391,_0x50b3b2));for(const _0x590253 of _0x2dbbd2)this['_handleSessionAdd'](_0x513391,_0x590253);}['unregister'](_0x8e53c8){if(!this['_registeredSessions']['has'](_0x8e53c8))throw new _0x2493d0('sessions-unregister-not-exist',null,{'channelId':_0x8e53c8});const _0x147856=this['_registeredSessions']['get'](_0x8e53c8);this['stopListening'](_0x147856);for(const _0x598dd0 of _0x147856)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x8e53c8,_0x598dd0);this['_registeredSessions']['delete'](_0x8e53c8),this['channelSessions']['delete'](_0x8e53c8),this['channelConnectedUsers']['delete'](_0x8e53c8);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x4b45be){for(const _0x28bcf3 of this['channelSessions']['values']())for(const _0x7ecd19 of _0x28bcf3)if(_0x7ecd19['id']===_0x4b45be)return _0x7ecd19['user'];}['getUserSessions'](_0x5248e5,_0x89ab88){const _0x5b7c98=_0x89ab88?[this['channelSessions']['get'](_0x89ab88)]:this['channelSessions']['values'](),_0xcd4169=new Set();for(const _0x442787 of _0x5b7c98)for(const _0x6217b6 of _0x442787)_0x6217b6['user']['id']===_0x5248e5['id']&&_0xcd4169['add'](_0x6217b6['id']);return _0xcd4169;}['getUserRole'](_0x1c8f26){for(const _0x47ef3f of this['channelSessions']['values']())for(const _0x550f4f of _0x47ef3f)if(_0x550f4f['user']===_0x1c8f26)return _0x550f4f['role'];}['_handleSessionAdd'](_0x5930ee,_0x1e4913){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x232721=_0x1e4913['user'],_0x6c4049=this['_users']['getUser'](_0x232721['id'])||this['_createUser'](_0x232721),_0x351a63=Object['assign']({},_0x1e4913,{'user':_0x6c4049});this['channelSessions']['get'](_0x5930ee)['add'](_0x351a63);const _0x16b62c=this['channelConnectedUsers']['get'](_0x5930ee);_0x16b62c['has'](_0x6c4049['id'])||_0x16b62c['add'](_0x6c4049),this['allConnectedUsers']['has'](_0x6c4049['id'])||this['allConnectedUsers']['add'](_0x6c4049,_0x6c4049['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x5930ee,{'channelId':_0x5930ee,'session':_0x351a63});}['_handleSessionRemove'](_0x2c2cc0,_0x2fd4f8){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x395904=this['channelConnectedUsers']['get'](_0x2c2cc0),_0x4bf368=_0x2fd4f8['user'];_0x4bf368['id']&&(this['channelSessions']['get'](_0x2c2cc0)['remove'](_0x2fd4f8['id']),_0x395904['has'](_0x4bf368['id'])&&!this['getUserSessions'](_0x4bf368,_0x2c2cc0)['size']&&_0x395904['remove'](_0x4bf368['id']),this['allConnectedUsers']['get'](_0x4bf368['id'])&&!this['getUserSessions'](_0x4bf368)['size']&&this['allConnectedUsers']['remove'](_0x4bf368['id']));}['_createUser'](_0x35a33b,_0x5f3ae8){const _0x41d458=this['_users']['addUser'](_0x35a33b);return _0x5f3ae8&&this['_users']['defineMe'](_0x35a33b['id']),_0x41d458['orderNumber']=this['_uniqueUsersCount']++,_0x41d458;}}class q extends _0x4f4ec3{['_domEmitter']=new(_0x27e3ec())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4137f3=this['editor'],_0x2b16ce=_0x4137f3['plugins']['get'](i);_0x4137f3['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x540e76,{writer:_0x212140})=>function(_0x3e1ffe,_0x6e25c4,_0x36d6e7,_0x105c7a){const _0x103d11=_0x3e1ffe['markerName']['split'](':')[0x2],_0x3968a6=_0x36d6e7['getUserBySessionId'](_0x103d11);if(!_0x3968a6||_0x103d11===_0x36d6e7['mySessionId'])return;if(!_0x105c7a['model']['schema']['checkChild'](_0x3e1ffe['markerRange']['start'],'$text'))return;const _0x3ff9ab={'class':'ck-user__marker\x20'+_0x3968a6['color']['getMarkerClass'](),'data-name':_0x3968a6['name'],'data-session-id':_0x103d11},_0x442c53=_0x105c7a['model']['markers']['get'](_0x3e1ffe['markerName']),_0x32ee1a=_0x442c53['getStart'](),_0x5138f8=_0x32ee1a['nodeAfter'],_0x5dad4e=_0x105c7a['model']['schema'];if(_0x5138f8&&_0x5dad4e['isObject'](_0x5138f8)&&_0x5dad4e['isInline'](_0x5138f8)&&!_0x105c7a['model']['markers']['get']('user:range:'+_0x103d11)['getRange']()['isCollapsed'])return;const _0x46977c=_0x32ee1a['parent'];return _0x105c7a['model']['schema']['isLimit'](_0x46977c)&&!_0x105c7a['model']['hasContent'](_0x46977c)&&(_0x3ff9ab['contenteditable']=!0x1),function(_0x219333,_0x56c631,_0x134494){const _0x3e709b=_0x219333['createUIElement']('span',_0x56c631);return _0x219333['setCustomProperty']('userPositionMarker',!0x0,_0x3e709b),_0x3e709b['render']=function(_0x38ab7c){const _0xab959=this['toDomElement'](_0x38ab7c),_0x3d2a9a=document['createElement']('span');return _0x3d2a9a['classList']['add']('ck-user__marker-tooltip'),_0x3d2a9a['setAttribute']('contenteditable','false'),_0x3d2a9a['setAttribute']('spellcheck','false'),_0x3d2a9a['textContent']=_0x134494['name'],_0xab959['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x3d2a9a['outerHTML']+'',_0xab959['addEventListener']('mouseenter',()=>{_0xab959['classList']['add']('ck-user__marker_hovered');}),_0xab959['addEventListener']('mouseleave',()=>{_0xab959['classList']['remove']('ck-user__marker_hovered');}),_0xab959;},_0x3e709b['isSimilar']=function(_0x39076c){return!(!this['getCustomProperty']('userPositionMarker')||!_0x39076c['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x39076c['getAttribute']('data-session-id'));},_0x3e709b;}(_0x6e25c4,_0x3ff9ab,_0x3968a6);}(_0x540e76,_0x212140,_0x2b16ce,_0x4137f3)}),_0x4137f3['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x40cb29=>function(_0x2d3047,_0x40f846){const _0x47a3c5=_0x2d3047['markerName']['split'](':')[0x2];if(_0x47a3c5===_0x40f846['mySessionId'])return null;const _0x517881=_0x40f846['getUserBySessionId'](_0x47a3c5);if(!_0x517881)return{'id':_0x47a3c5,'classes':[]};return{'id':_0x47a3c5,'classes':['ck-user__selection',_0x517881['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x47a3c5},'priority':0x7d0+_0x517881['orderNumber']};}(_0x40cb29,_0x2b16ce)}),function(_0x2aac80){const _0x15a9c1=_0x2aac80['model'],_0x457667=new Map(),_0x16a886=_0x2aac80['plugins']['get'](i);_0x15a9c1['markers']['on']('update:user:range',(_0x3697cf,_0x3fa29e,_0x3ceca1,_0x3130f2)=>{if(!_0x3130f2&&_0x457667['get'](_0x3fa29e['name']))return _0x457667['get'](_0x3fa29e['name'])['detach'](),void _0x457667['delete'](_0x3fa29e['name']);const _0x393fd3=_0x3fa29e['name']['split'](':')[0x2];if(_0x393fd3===_0x16a886['mySessionId'])return;const _0x296c56='user:position:'+_0x393fd3;_0x15a9c1['markers']['has'](_0x296c56)&&_0x2aac80['editing']['reconvertMarker'](_0x296c56),_0x3fa29e['on']('change:range',(_0xad397e,_0x401cb7,_0x281a9f)=>{if('$graveyard'!=_0x401cb7['root']['rootName']&&'$graveyard'==_0x3fa29e['getRange']()['root']['rootName']&&!_0x457667['has'](_0x3fa29e['name'])){const _0x495bf9=_0x15a9c1['schema']['getNearestSelectionRange'](_0x281a9f['deletionPosition']);if(_0x495bf9){const _0x33c442=ht['fromRange'](_0x495bf9);_0x457667['set'](_0x3fa29e['name'],_0x33c442),_0x33c442['on']('change:range',(_0x1ad0b7,_0x3e1ced,_0x4d0ca5)=>{if('$graveyard'==_0x33c442['root']['rootName']){const _0x2c7dd2=_0x15a9c1['schema']['getNearestSelectionRange'](_0x4d0ca5['deletionPosition']);_0x2c7dd2?(_0x33c442['start']=_0x2c7dd2['start'],_0x33c442['end']=_0x2c7dd2['end']):(_0x457667['delete'](_0x3fa29e['name']),_0x33c442['detach']());}});}}});}),_0x15a9c1['document']['on']('change',()=>{_0x457667['size']>0x0&&_0x15a9c1['enqueueChange']({'isUndoable':!0x1},_0x517629=>{for(const [_0x593b4b,_0x16b590]of _0x457667)'$graveyard'==_0x15a9c1['markers']['get'](_0x593b4b)['getRange']()['root']['rootName']&&(te(_0x593b4b['split'](':')[0x2],_0x16b590['toRange'](),_0x15a9c1,_0x517629),_0x16b590['detach']());_0x457667['clear']();});});}(_0x4137f3),this['_domEmitter']['listenTo'](_0x2e0fae['document'],'keydown',(_0x4ac7ff,{key:_0x1bb66c})=>{'Escape'===_0x1bb66c&&function(_0x3f1db1){_0x3f1db1['editing']['view']['change'](_0x5735be=>{for(const _0x53f49f of _0x3f1db1['model']['markers']){if(!_0x53f49f['name']['startsWith']('user:position'))continue;const _0x3581ba=_0x3f1db1['editing']['mapper']['markerNameToElements'](_0x53f49f['name']);if(_0x3581ba){for(const _0x2ea941 of _0x3581ba)_0x5735be['removeClass']('ck-user__marker_hovered',_0x2ea941);}}});}(_0x4137f3);},{'useCapture':!0x0});}['afterInit'](){const _0x1d7985=this['editor'],_0x5777c5=_0x1d7985['commands']['get']('undo');_0x5777c5&&_0x1d7985['model']['on']('applyOperation',(_0x458304,_0x47edbb)=>{const _0x3a7fc3=_0x47edbb[0x0];if(!_0x3a7fc3['isDocumentOperation'])return;if('marker'!=_0x3a7fc3['type']||!_0x3a7fc3['name']['startsWith']('user:'))return;const _0x49fbb9=_0x3a7fc3['batch'];_0x5777c5['_createdBatches']['has'](_0x49fbb9)&&(_0x3a7fc3['newRange']=_0x3a7fc3['oldRange']?_0x1d7985['model']['createRange'](_0x3a7fc3['oldRange']['start'],_0x3a7fc3['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x33208d=this['editor'],_0x2db56d=_0x33208d['model']['document'],_0xd9cdd=_0x33208d['plugins']['get'](i);_0x33208d['model']['enqueueChange']({'isUndoable':!0x1},_0x1ea791=>{const _0x1e913e='user:range:'+_0xd9cdd['mySessionId'],_0x431462='user:position:'+_0xd9cdd['mySessionId'],_0x117813=_0x33208d['model']['markers']['has'](_0x1e913e);_0x33208d['editing']['view']['hasDomSelection']?te(_0xd9cdd['mySessionId'],_0x2db56d['selection']['getFirstRange'](),_0x33208d['model'],_0x1ea791):_0x117813&&(_0x1ea791['removeMarker'](_0x1e913e),_0x1ea791['removeMarker'](_0x431462));});}}function te(_0xc92973,_0x3d8cea,_0x5010dd,_0x502ceb){const _0x580da4='user:range:'+_0xc92973,_0x4aa6f5='user:position:'+_0xc92973,_0x4cbbd9=_0x3d8cea['getContainedElement']();let _0x6bf933=_0x3d8cea['start'];if(_0x4cbbd9&&_0x4cbbd9['is']('element','tableCell')){const _0x44f4b1=function(_0xf659b,_0x35c22b){for(const _0x2a86b6 of _0xf659b['getPositions']())if(_0x35c22b['schema']['checkChild'](_0x2a86b6,'$text'))return _0x2a86b6;}(_0x3d8cea,_0x5010dd);_0x44f4b1&&(_0x6bf933=_0x44f4b1,_0x3d8cea=_0x502ceb['createRange'](_0x6bf933));}const _0x3302fb=_0x502ceb['createRange'](_0x6bf933);_0x5010dd['markers']['has'](_0x580da4)?(_0x502ceb['updateMarker'](_0x580da4,{'range':_0x3d8cea}),_0x502ceb['updateMarker'](_0x4aa6f5,{'range':_0x3302fb})):(_0x502ceb['addMarker'](_0x580da4,{'range':_0x3d8cea,'usingOperation':!0x0}),_0x502ceb['addMarker'](_0x4aa6f5,{'range':_0x3302fb,'usingOperation':!0x0}));}function G(_0x14d581,_0x349d69,_0x5dba66){const _0x57627a=_0x14d581['t'],t=_0x14d581['t'];switch(_0x349d69){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 _0x57627a({'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'},_0x5dba66);default:return'';}}let J=0x1;class l extends _0x4f4ec3{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x21ac0b)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,q,_0x3de8f1,_0x3a4ee8,_0x4fd7cf];}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 _0x199874=this['serverHistory']['getOperations']();for(let _0x555086=_0x199874['length']-0x1;_0x555086>=0x0;_0x555086--){const _0x38a0ff=_0x199874[_0x555086];if(!this['_disconnectionOperations']['has'](_0x38a0ff))return _0x38a0ff['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x17db78){if(super(_0x17db78),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x3363f9(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x2493d0('collaboration-missing-channelid',this);const _0x3180a3=_0x17db78['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x3180a3,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x319d7c(),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 Y(this['_disconnectionOperations']);}['init'](){const _0x1e958e=this['editor'],_0x37fefe=_0x1e958e['plugins']['get'](_0x3a4ee8),_0x22477a=_0x1e958e['plugins']['get'](c);this['listenTo'](_0x37fefe,'getOperationAuthor',(_0x2d05cb,_0x169742)=>{const _0x6cd868=_0x169742[0x0];_0x6cd868['_authorId']&&(_0x2d05cb['return']=_0x37fefe['getUser'](_0x6cd868['_authorId']),_0x2d05cb['stop']()),null===_0x6cd868['_authorId']&&(_0x2d05cb['return']=null,_0x2d05cb['stop']());},{'priority':'high'}),this['listenTo'](_0x1e958e['model']['document']['selection'],'change:range',(_0x5dc9cf,_0x2e5b0f)=>{_0x2e5b0f['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x1e958e['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x1e958e['model']['on']('applyOperation',(_0x49cfec,_0x4f08a8)=>{const _0xc7baaa=_0x4f08a8[0x0];_0xc7baaa['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0xc7baaa),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x22477a,'state',this,'_hasSynchronizationProblem',(_0x17a5d6,_0x4db316)=>'connected'===_0x17a5d6&&!_0x4db316),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x1e958e['disableReadOnlyMode']('rtc-offline'):_0x1e958e['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x1e958e['disableReadOnlyMode']('rtc-offline'):_0x1e958e['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x4f35ab=this['editor']['plugins']['get'](i),_0x1b1d25=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x4f35ab['unregister'](this['_channelId']);const _0x71e9c5=await this['_service']['reconnect'](_0x1b1d25['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x71e9c5)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x1cc250=await this['_service']['getConnectedSessions']();_0x4f35ab['register'](this['_channelId'],_0x1cc250),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4c7f21){if(function(_0x6b4228){return'404'===_0x6b4228['code'];}(_0x4c7f21)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x1a1ff1){return'409'===_0x1a1ff1['code'];}(_0x4c7f21)){const _0x32044f=G(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'](_0x32044f);}else{if(!(_0x4c7f21 instanceof Q))throw _0x4c7f21;this['_handleReconnectionError']();}}}}['destroy'](){const _0x576c76=this['editor']['plugins']['get'](c),_0x4d78ad=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x4d78ad['channelSessions']['has'](this['_channelId'])&&_0x4d78ad['unregister'](this['_channelId']),_0x576c76['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x2e667c){if(this['sessionId']!==_0x2e667c['sessionId']&&this['_lastSyncedOperationId']!==_0x2e667c['lastOperationId'])throw new Q();return this['sessionId']=_0x2e667c['sessionId'],this['_handleServerResponse']([],{..._0x2e667c,'wereChangesApplied':!0x1,'data':_0x2e667c['data']},'reconnect');}async['_connectService'](_0x598763,_0x370789=!0x1){const {connection:_0x4eee55}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x4eee55,this['_channelId'])['then'](_0x1fa384=>this['_initSessionsHandling'](_0x1fa384))['catch'](_0x9260b2=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x9260b2);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4e756a,_0xc384da)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0xc384da);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x17069a=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x598763);this['_isPendingUpdate']=!0x0;const _0x4a9158=await this['_service']['connect'](_0x4eee55,this['_compressOperations'](_0x598763),_0x17069a);if(this['sessionId']=_0x4a9158['sessionId'],_0x370789){if(!_0x4a9158['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x4a9158['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x598763,_0x4a9158,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x4a9158,_0x598763);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x25f0ee=this['editor']['plugins']['get'](i),_0x227852=this['editor']['plugins']['get'](q),_0x3072ca=_0x25f0ee['channelSessions']['get'](this['_channelId']);_0x3072ca&&_0x3072ca['length']>0x1?_0x227852['createUserMarkerOperations']():this['listenTo'](_0x25f0ee,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x25f0ee['channelSessions']['get'](this['_channelId'])['length']&&_0x227852['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x527e76,_0x162fea,_0x3b41fe,_0x4869b9){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x162fea){const _0x2928a2=this['_decompressOperations'](_0x3b41fe,_0x4869b9);await this['_fetchMissingUsers'](_0x2928a2),this['_handleExternalOperations'](_0x2928a2,_0x162fea,_0x3b41fe['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x47aa00}=this['editor'];let _0x4a16ba;try{_0x4a16ba=await this['_service']['getDocumentDetails']();}catch{const _0x13e425=G(_0x47aa00,'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'](_0x13e425);}const _0x401730=_0x4a16ba['currentDocumentSession']||_0x4a16ba['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x401730['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x1e7cb1=G(_0x47aa00,'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'](_0x1e7cb1);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x16658a){const _0xe63da=this['editor']['plugins']['get'](i);this['listenTo'](_0xe63da,'sessionAdd:'+this['_channelId'],(_0x29ae32,{session:_0x47cb46})=>{if(_0x47cb46['id']===_0xe63da['mySessionId']){_0x29ae32['off']();const _0x28aee8=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x42652e=_0x47cb46['permissions'];_0x28aee8&&_0x28aee8['isEnabled']&&(_0x42652e=_0x42652e['filter'](_0x1d8a45=>'document:write'!==_0x1d8a45)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x42652e,this['_channelId']);}}),_0xe63da['register'](this['_channelId'],_0x16658a);}['_initThrowingOnDataSet'](){const _0x48c79d=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x6dc40f)=>{if(!_0x6dc40f[_0x6dc40f['length']-0x1]['suppressErrorInCollaboration'])throw new _0x2493d0('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x48c79d['apply'](this['editor']['data'],_0x6dc40f);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x477ac5,[_0x5b9d36])=>{if(this['_document']['version'])throw new _0x2493d0('realtimecollaborationclient-init-document-already-initialized',this);_0x477ac5['stop'](),this['_setPendingAction']();const _0x167283=this['editor']['config']['get']('rootsAttributes'),_0x209d7b=this['_getOperationsFromInitData'](_0x5b9d36,_0x167283);0x0==_0x209d7b['length']&&_0x209d7b['push'](new _0x172d8c(0x0)),_0x477ac5['return']=this['_connectService'](_0x209d7b)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x2d95fc=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x2d95fc))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2e25d2,[_0x52ac65,_0x35f995])=>{_0x2e25d2['stop']();const _0x373be5=this['editor']['model']['document']['getRoot'](_0x52ac65);if(!this['_knownRootNames']['has'](_0x52ac65)){const _0x287197=_0x35f995&&_0x35f995['data']?_0x35f995['data']:'',_0xd39fdc=_0x35f995&&_0x35f995['attributes']?_0x35f995['attributes']:{};await this['_loadRoot'](_0x52ac65,_0x287197,_0xd39fdc);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x373be5['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x373be5);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x29e252){const _0x282ff8=this['editor']['plugins']['get'](_0x3a4ee8),{connection:_0x54f281}=this['editor']['plugins']['get'](c),_0x18e904=new Set();for(const _0x1e7f18 of _0x29e252){const _0x800bc5=_0x1e7f18['_authorId'];_0x800bc5&&!_0x282ff8['getUser'](_0x800bc5)&&_0x18e904['add'](_0x800bc5);}if(0x0===_0x18e904['size'])return;const _0x54bf53=await dt['getMany'](_0x54f281,Array['from'](_0x18e904));for(const _0xa71867 of _0x54bf53)_0x282ff8['getUser'](_0xa71867['id'])||_0x282ff8['addUser'](_0xa71867);}['_getOperationsFromInitData'](_0x2c263b,_0x54fd5a={}){const _0x3124da=this['editor']['model'],_0x4b28ba=[];let _0x38f6c5=0x0;const _0x48921b='string'==typeof _0x2c263b?{'main':_0x2c263b}:_0x2c263b;for(const _0x54173d of Object['keys'](_0x48921b)){if(!this['_document']['roots']['has'](_0x54173d))throw new _0x2493d0('realtimecollaborationclient-init-non-existent-root',this);const _0x39ca5b=this['editor']['data']['parse'](_0x48921b[_0x54173d]),_0x345c14=this['_document']['getRoot'](_0x54173d),_0x5f3292=new _0xa4b6d8(_0x3124da['createPositionAt'](_0x345c14,0x0),_0x39ca5b,_0x38f6c5++);_0x4b28ba['push'](_0x5f3292);for(const [_0x20ce2c,_0x51d670]of _0x39ca5b['markers']){const _0x5008ca=_0x3124da['createRange'](_0x3124da['createPositionFromPath'](_0x345c14,_0x51d670['start']['path']['slice']()),_0x3124da['createPositionFromPath'](_0x345c14,_0x51d670['end']['path']['slice']())),_0x4725e5=new _0x4de982(_0x20ce2c,null,_0x5008ca,_0x3124da['markers'],!0x0,_0x38f6c5++);_0x4b28ba['push'](_0x4725e5);}}if(_0x54fd5a)for(const [_0xa9e521,_0x152642]of Object['entries'](_0x54fd5a)){const _0x3da9cb=_0x3124da['document']['getRoot'](_0xa9e521);if(!_0x3da9cb)throw new _0x2493d0('multi-root-editor-root-attributes-no-root',null);for(const [_0x16d520,_0xa36270]of Object['entries'](_0x152642))if(null!==_0xa36270){const _0x206d90=new _0x5bc6a7(_0x3da9cb,_0x16d520,null,_0xa36270,_0x38f6c5++);_0x4b28ba['push'](_0x206d90);}}return _0x4b28ba;}async['_loadRoot'](_0x216663,_0x18b245,_0x44ff11){this['_getOperationsFromInitData']({[_0x216663]:_0x18b245},{[_0x216663]:_0x44ff11})['forEach']((_0x508614,_0x1b21d1)=>{_0x508614['baseVersion']=this['_document']['version']+_0x1b21d1,_0x508614['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x508614);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x4e080e,_0x36b5ed){let _0x17b200;this['_offset']=_0x4e080e['offset'];const _0x582dae=_0x4e080e['wereChangesApplied']&&!_0x4e080e['initData'],_0x38369f=_0x582dae?0x0:_0x4e080e['data']['baseVersion'];if(_0x36b5ed['forEach'](_0x36dc47=>{_0x36dc47['_isInit']=!0x0,_0x36dc47['createdAt']=_0x4e080e['sessionCreatedAt'],_0x36dc47['_authorId']=null;}),_0x582dae)_0x17b200=_0x36b5ed,this['_applyOperationsSet'](_0x17b200,_0x582dae);else{if(_0x4e080e['initData']){const _0x2922d8=this['_getOperationsFromInitData'](_0x4e080e['initData']);this['_document']['history']['version']=-_0x2922d8['length'],_0x2922d8['forEach'](_0x338438=>{_0x338438['baseVersion']-=_0x2922d8['length'],_0x338438['createdAt']=_0x4e080e['sessionCreatedAt'],_0x338438['_isInit']=!0x0,_0x338438['_authorId']=null;}),this['_applyOperationsSet'](_0x2922d8,!0x0),this['serverHistory']['version']=-_0x2922d8['length']+this['_offset'],this['_updateServerHistory'](_0x2922d8);}this['_document']['history']['version']=_0x38369f,_0x17b200=this['_decompressOperations'](_0x4e080e['data'],_0x4e080e['metadata']),await this['_fetchMissingUsers'](_0x17b200),this['_applyOperationsSet'](_0x17b200,_0x582dae);}_0x4e080e['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x17b200,_0x4e080e['lastOperationId']),this['_lastSyncedOperationId']=_0x4e080e['lastOperationId']),this['serverHistory']['version']=_0x38369f+this['_offset'],this['_updateServerHistory'](_0x17b200),_0x36b5ed['filter'](_0xf0a3ff=>{const _0x1b353d=this['_getAffectedRoot'](_0xf0a3ff);return _0x1b353d&&!this['_knownRootNames']['has'](_0x1b353d);})['forEach']((_0x20628d,_0x50fc0b)=>{_0x20628d['baseVersion']=this['_document']['version']+_0x50fc0b,this['_saveOperationInBuffer'](_0x20628d);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x433967,_0x30ff10){const _0xc6be1d=_0x30ff10&&_0x30ff10['message'];if(_0xc6be1d&&_0xc6be1d['startsWith']('realtimecollaborationclient'))throw _0x30ff10;const _0x26b32f=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0x26b32f['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x2493d0(_0x433967,this['editor'],_0xc6be1d?{'originalError':_0xc6be1d}:void 0x0);}['_saveOperationInBuffer'](_0x44d592){this['_knownOperations']['has'](_0x44d592)||(this['_knownOperations']['add'](_0x44d592),this['_bufferedOperations']['push'](_0x44d592),this['_pendingAction']||'marker'==_0x44d592['type']&&!_0x44d592['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x507d52=!0x1){!_0x507d52&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x3571f2=>{_0x3571f2&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x3f55e4=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x5552c5){return _0x5552c5['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5552c5['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x5552c5['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x3f55e4)||this['_crash'](_0x3f55e4['message'],_0x3f55e4);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x135ef9=>{this['on']('change:_isPendingUpdate',()=>{_0x135ef9();});});}async['_sendBufferedOperations'](){const _0x347614=this['editor']['plugins']['get'](q);if(this['_shouldSendSelectionUpdate']()&&(_0x347614['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0xcf8c8a=[...this['_bufferedOperations']];for(const _0x517d08 of _0xcf8c8a)_0x517d08['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x517d08);const _0x3efa02=this['_operationIdentifier']['getIdOfTheLastOperation'](_0xcf8c8a),_0x4a2b47=J++,_0xceb8a0=this['_compressOperations'](_0xcf8c8a),_0x1c7c5b=await this['_service']['sendOperations'](_0xceb8a0,_0xceb8a0['baseVersion'],_0x3efa02);try{return await this['_handleServerResponse'](_0xcf8c8a,_0x1c7c5b,_0x4a2b47);}catch(_0x461806){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x461806);}}async['_handleServerResponse'](_0x1f377c,_0x53795e,_0x3a10b6){if('error'in _0x53795e)throw _0x53795e['error'];let _0x2c3549=!0x1;if(_0x53795e['wereChangesApplied']){_0x53795e['lastOperationId']&&(this['_lastSyncedOperationId']=_0x53795e['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x518cfa=>!_0x1f377c['includes'](_0x518cfa));for(const _0x17b22e of _0x1f377c)_0x17b22e['createdAt']='lastOperationAcceptedAt'in _0x53795e&&_0x53795e['lastOperationAcceptedAt']||void 0x0;X(_0x1f377c,_0x53795e['version']-_0x1f377c['length']),this['_updateServerHistory'](_0x1f377c);const _0x53e5f1=_0x1f377c['filter'](_0x37bec4=>{if(!_0x37bec4['_isInit'])return!0x1;const _0xf72b17=this['_getAffectedRoot'](_0x37bec4);return _0xf72b17&&!this['_knownRootNames']['has'](_0xf72b17);});X(_0x53e5f1,this['_document']['version']),this['_applyOperationsSet'](_0x53e5f1),_0x2c3549=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1b0425=this['_decompressOperations'](_0x53795e['data'],_0x53795e['metadata'])['filter'](_0x42b8d3=>_0x42b8d3['baseVersion']>=this['_lastServerVersion']);_0x1b0425['forEach'](_0x591323=>this['_addKnownRoot'](_0x591323)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x131b36=>!_0x131b36['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x131b36))),this['_bufferedOperations']['length']&&X(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1b0425),_0x2c3549=this['_handleExternalOperations'](_0x1b0425,_0x53795e['version'],_0x53795e['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x2c3549?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x219672,_0x106868,_0x56e62f){try{const _0x1a24bd={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x235270,operationsB:_0x1c9c8b,originalOperations:_0x54e320}=_0x230d27(_0x219672,this['_bufferedOperations'],_0x1a24bd);X(_0x235270,this['_document']['version']),X(_0x1c9c8b,_0x106868);for(const _0x51c01e of _0x235270){const _0x23b25c=_0x54e320['get'](_0x51c01e);_0x51c01e['_authorId']=_0x23b25c?_0x23b25c['_authorId']:null;}_0x56e62f&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x219672,_0x56e62f),this['_lastSyncedOperationId']=_0x56e62f),this['_bufferedOperations']=[..._0x1c9c8b],this['_applyOperationsSet'](_0x235270),this['_updateServerHistory'](_0x219672);}catch(_0x3ad35c){return console['error'](_0x3ad35c),!0x1;}return!0x0;}['_applyOperationsSet'](_0x9bd15e,_0x1c773c=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x3caa23=>{for(const _0x121928 of _0x9bd15e)this['_knownOperations']['add'](_0x121928),this['_addKnownRoot'](_0x121928),_0x3caa23['batch']['addOperation'](_0x121928),this['editor']['model']['applyOperation'](_0x121928);});}['_addKnownRoot'](_0x5d897c){const _0x16c5b4=this['_getAffectedRoot'](_0x5d897c);_0x16c5b4&&this['_knownRootNames']['add'](_0x16c5b4);}['_getAffectedRoot'](_0x43449c){let _0x13a18c,_0x55d051;switch(_0x43449c['type']){case'insert':_0x13a18c=_0x43449c['position']['root'];break;case'marker':if(_0x55d051=_0x43449c['newRange'],!_0x55d051)return null;_0x13a18c=_0x55d051['root'];break;case'addRootAttribute':_0x13a18c=_0x43449c['root'];break;case'addRoot':_0x13a18c=_0x43449c['affectedSelectable'];break;case'move':_0x13a18c=_0x43449c['targetPosition']['root'];break;default:return null;}return _0x13a18c['rootName'];}['_updateServerHistory'](_0x10d6fd){_0x10d6fd['forEach'](_0x30c340=>{const _0x1462ff=_0x30c340['clone']();_0x1462ff['_authorId']=_0x30c340['_authorId'],_0x1462ff['_isInit']=!!_0x30c340['_isInit'],_0x1462ff['createdAt']=_0x30c340['createdAt'],_0x1462ff['baseVersion']+=this['_offset'],_0x30c340['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x1462ff),this['serverHistory']['addOperation'](_0x1462ff);});}['_handleReconnectionError'](_0x2ed0d7){const _0xe23c94=this['editor']['plugins']['get']('Notification'),_0xfbbaa=this['editor']['locale'];_0x2ed0d7||(_0x2ed0d7=G(_0xfbbaa,'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.')),_0xe23c94['showWarning'](_0x2ed0d7,{'title':G(_0xfbbaa,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x3de8f1)['add'](G(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x3de8f1)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x5df48b){const _0x791aad=_0x5df48b['map'](_0x1e38ef=>_0x1e38ef['toJSON']());return this['_compressor']['compress'](_0x791aad);}['_decompressOperations'](_0xb8192b,_0x12bf31){return this['_compressor']['decompress'](_0xb8192b)['map']((_0x410ae0,_0x558529)=>{const _0x5c61de='init'==_0x12bf31[_0x558529]['type'];if('InsertOperation'==_0x410ae0['__className']){const _0x483150=_0x410ae0['position']['root'];!this['_document']['getRoot'](_0x483150)&&(this['_document']['createRoot']('$root',_0x483150)['_isAttached']=!0x1);}const _0x559355=_0x18dbd4['fromJSON'](_0x410ae0,this['_document']);return _0x559355['wasUndone']=_0x410ae0['wasUndone'],_0x559355['_isInit']=_0x5c61de,_0x559355['_authorId']=_0x5c61de?null:_0x12bf31[_0x558529]['userId'],_0x559355['_isDisconnection']='cs:removeUser'===_0x12bf31[_0x558529]['type'],_0x559355['createdAt']=_0x12bf31[_0x558529]['createdAt'],_0x559355;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x346af4=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x346af4&&_0x346af4['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Q extends Error{}function X(_0x2f8ff2,_0x57e258){for(const _0x1a945e of _0x2f8ff2)_0x1a945e['baseVersion']=_0x57e258++;}class Y{['_ignoredOperations'];['_operationToId'];constructor(_0x1573c6){this['_ignoredOperations']=_0x1573c6,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x5bd432){let _0x519cf7=_0x5bd432['length'];for(;_0x519cf7--;){const _0x1c2414=_0x5bd432[_0x519cf7];if(!this['_ignoredOperations']['has'](_0x1c2414)){if(!this['_operationToId']['has'](_0x1c2414)){const _0x357a9f=_0x13399e()['slice'](0x1,0x12);this['_operationToId']['set'](_0x1c2414,_0x357a9f);}return this['_operationToId']['get'](_0x1c2414);}}}['setIdForTheLastOperation'](_0xdc4459,_0xf1bec4){if(!_0xf1bec4)return;let _0x290a77=_0xdc4459['length'];for(;_0x290a77--;){const _0x349539=_0xdc4459[_0x290a77];this['_ignoredOperations']['has'](_0x349539)||this['_operationToId']['set'](_0x349539,_0xf1bec4);}}}class n extends _0x4f4ec3{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x19f79c{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x1f0922)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x3a4ee8];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5ab57c){super(_0x5ab57c),this['_services']=new Map();}async['init'](){const _0x389f37=this['context'],_0x36f8c7=_0x389f37['plugins']['get']('CommentsRepository');if(_0x389f37['plugins']['get'](c)['addToReconnectionStack'](this),_0x36f8c7['adapter']={'addCommentThread':async({channelId:_0x26780c,threadId:_0x3a7448,comments:_0x40c129,resolvedAt:_0x3c2d9c,resolvedBy:_0x1429ad,context:_0xa52226,attributes:_0x38ceae})=>{const _0x3dd3ad=await this['_getService'](_0x26780c)['addCommentThread']({'commentThreadId':_0x3a7448,'comments':_0x40c129['map'](_0x2e7a2=>function(_0x575362,_0x4cb39,_0x3cbc5e){return{'commentThreadId':_0x3cbc5e,'commentId':_0x575362['commentId'],'userId':_0x575362['authorId'],'content':_0x575362['content'],'documentId':_0x4cb39,'createdAt':_0x575362['createdAt'],'attributes':_0x575362['attributes']||{}};}(_0x2e7a2,_0x26780c,_0x3a7448)),'resolvedAt':_0x3c2d9c,'resolvedBy':_0x1429ad,'context':_0xa52226,'attributes':_0x38ceae})['catch'](ut);return{'threadId':_0x3dd3ad['commentThreadId'],'comments':_0x3dd3ad['comments']};},'getCommentThread':async({channelId:_0xf0d086,threadId:_0x3951a9})=>{const _0x2ea3bc=await this['_getService'](_0xf0d086)['getCommentThread'](_0x3951a9)['catch'](ut);return _0x2ea3bc['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x2ea3bc]),{'threadId':_0x2ea3bc['commentThreadId'],'comments':_0x2ea3bc['comments']['map'](_),'context':_0x2ea3bc['context'],'resolvedAt':_0x2ea3bc['resolvedAt'],'resolvedBy':_0x2ea3bc['resolvedBy'],'attributes':_0x2ea3bc['attributes']||{}});},'updateCommentThread':async({channelId:_0x35c43e,threadId:_0x26284c,context:_0x400d92,unlinkedAt:_0x512ff1,attributes:_0x3069f4})=>this['_getService'](_0x35c43e)['updateCommentThread']({'commentThreadId':_0x26284c,'context':_0x400d92,'attributes':_0x3069f4,'unlinkedAt':_0x512ff1})['catch'](S)['catch'](ut),'resolveCommentThread':async({channelId:_0x22a056,threadId:_0x42d952})=>{const _0x1e7af5=await this['_getService'](_0x22a056)['resolveCommentThread'](_0x42d952)['catch'](S)['catch'](ut);return{'threadId':_0x1e7af5['commentThreadId'],'resolvedAt':_0x1e7af5['resolvedAt'],'resolvedBy':_0x1e7af5['resolvedBy']};},'reopenCommentThread':async({channelId:_0x7cf6d1,threadId:_0x431115})=>this['_getService'](_0x7cf6d1)['reopenCommentThread'](_0x431115)['catch'](S)['catch'](ut),'removeCommentThread':({channelId:_0x2d471f,threadId:_0x5e6298})=>this['_getService'](_0x2d471f)['removeCommentThread'](_0x5e6298)['catch'](S)['catch'](ut),'addComment':({channelId:_0x33b21a,threadId:_0x15dc04,commentId:_0x26cee1,content:_0x41eb74,attributes:_0x5ccb7b})=>this['_getService'](_0x33b21a)['addComment'](_0x15dc04,_0x26cee1,_0x41eb74,_0x5ccb7b)['catch'](ut),'updateComment':({channelId:_0x4159c0,threadId:_0x3b5804,commentId:_0x36bbd7,content:_0x3d90e5,attributes:_0x31384b})=>this['_getService'](_0x4159c0)['updateComment'](_0x3b5804,_0x36bbd7,_0x3d90e5,_0x31384b)['catch'](S)['catch'](ut),'removeComment':({channelId:_0x2023fe,threadId:_0x118754,commentId:_0x24d32d})=>this['_getService'](_0x2023fe)['removeComment'](_0x118754,_0x24d32d)['catch'](S)['catch'](ut)},_0x389f37 instanceof _0x39273d){const _0x8c2d17=_0x389f37['config']['get']('collaboration.channelId'),_0x57af6f=_0x389f37['plugins']['get'](i);await this['_setUpService'](_0x8c2d17);const _0x1ef943=await this['_services']['get'](_0x8c2d17)['getConnectedSessions']();this['listenTo'](_0x57af6f,'sessionAdd:'+_0x8c2d17,(_0x5c4c49,{session:_0x223682})=>{_0x223682['id']===_0x57af6f['mySessionId']&&(_0x5c4c49['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x223682['permissions'],_0x8c2d17));}),_0x57af6f['register'](_0x8c2d17,_0x1ef943);}}async['_setUpService'](_0x7dd25e){if(this['_services']['has'](_0x7dd25e))throw new _0x2493d0('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x7dd25e});const _0x37e1b7=this['context']['plugins']['get']('CommentsRepository'),_0x1a8a36=new a['CommentsService'](_0x7dd25e);this['_services']['set'](_0x7dd25e,_0x1a8a36),this['listenTo'](_0x1a8a36,'commentThreadAdded',(_0x4dc30f,_0x101b54)=>{const {commentThreadId:_0x547924,documentId:_0x55400d,context:_0x341806,attributes:_0x6090d,resolvedAt:_0x682e30,resolvedBy:_0x2edcf1,comments:_0x3290e5}=_0x101b54;_0x37e1b7['getCommentThread'](_0x547924)||_0x37e1b7['addCommentThread']({'threadId':_0x547924,'channelId':_0x55400d,'comments':_0x3290e5?_0x3290e5['map'](_):[],'context':_0x341806,'attributes':_0x6090d,'resolvedAt':_0x682e30,'resolvedBy':_0x2edcf1,'isFromAdapter':!0x0});}),this['listenTo'](_0x1a8a36,'commentThreadUpdated',(_0x1c75d3,{commentThreadId:_0x32f686,documentId:_0x64a6e9,context:_0x11a4ed,unlinkedAt:_0x333182,attributes:_0x1ab74a})=>{_0x37e1b7['getCommentThread'](_0x32f686)&&_0x37e1b7['updateCommentThread']({'threadId':_0x32f686,'channelId':_0x64a6e9,'context':_0x11a4ed,'unlinkedAt':_0x333182,'attributes':_0x1ab74a,'isFromAdapter':!0x0});}),this['listenTo'](_0x1a8a36,'commentThreadResolved',(_0x5d61a2,{commentThreadId:_0x387b95,resolvedBy:_0x3dc015,resolvedAt:_0x4e6730})=>{const _0x56f0ac=_0x37e1b7['getCommentThread'](_0x387b95);_0x56f0ac&&_0x56f0ac['resolve']({'resolvedBy':_0x3dc015,'resolvedAt':_0x4e6730,'isFromAdapter':!0x0});}),this['listenTo'](_0x1a8a36,'commentThreadReopened',(_0x21861e,{commentThreadId:_0x41417e})=>{const _0x6042f0=_0x37e1b7['getCommentThread'](_0x41417e);_0x6042f0&&_0x6042f0['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1a8a36,'commentThreadRemoved',(_0x367ef9,{commentThreadId:_0x23c378})=>{const _0x37d724=_0x37e1b7['getCommentThread'](_0x23c378);_0x37d724&&_0x37d724['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1a8a36,'commentAdded',(_0x384a12,_0x4884f0)=>{const _0x2c47a6=_0x4884f0['commentThreadId'],_0x4feca8=_0x37e1b7['getCommentThread'](_0x2c47a6);_0x4feca8&&_0x4feca8['addComment']({..._(_0x4884f0),'isFromAdapter':!0x0});}),this['listenTo'](_0x1a8a36,'commentUpdated',(_0x27d28e,{commentThreadId:_0x40cc22,commentId:_0x2c1b36,content:_0x1f2653,attributes:_0x55155f})=>{const _0x23edd8=_0x37e1b7['getCommentThread'](_0x40cc22);if(_0x23edd8){const _0x17d383=_0x23edd8['getComment'](_0x2c1b36);_0x17d383&&_0x17d383['update']({'content':_0x1f2653,'attributes':_0x55155f,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1a8a36,'commentRemoved',(_0x865fbd,{commentThreadId:_0x2870a1,commentId:_0x287486})=>{const _0x2cd262=_0x37e1b7['getCommentThread'](_0x2870a1);if(_0x2cd262){const _0x181db6=_0x2cd262['getComment'](_0x287486);_0x181db6&&_0x181db6['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x7dd25e);}['destroy'](){if(this['context']instanceof _0x39273d){const _0x342b5f=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x342b5f);}}['_terminateService'](_0x41556f){if(!this['_services']['has'](_0x41556f))throw new _0x2493d0('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x41556f});this['_getService'](_0x41556f)['disconnect'](),this['_services']['delete'](_0x41556f);}async['reconnect'](){for(const _0x5e068c of this['_services']['keys']())await this['_connectService'](_0x5e068c);if(this['context']instanceof _0x39273d){const _0x38d163=this['context']['config']['get']('collaboration.channelId'),_0x29c09f=this['context']['plugins']['get'](i);_0x29c09f['unregister'](_0x38d163);const _0x486dd6=await this['_services']['get'](_0x38d163)['getConnectedSessions']();_0x29c09f['register'](_0x38d163,_0x486dd6);}}async['_connectService'](_0x4199d0){const {connection:_0x4d1ce1}=this['context']['plugins']['get'](c),_0x33aee8=this['context']['plugins']['get']('CommentsRepository'),_0x47d273=this['_services']['get'](_0x4199d0),_0x4668d2=await _0x47d273['connect'](_0x4d1ce1);await this['_fetchMissingUsersForThreads'](_0x4668d2);const _0x1e22c6=new Set(Array['from'](_0x33aee8['getCommentThreads']({'channelId':_0x4199d0}),_0x380638=>_0x380638['id']));for(const _0x202c52 of _0x4668d2)_0x202c52['deletedAt']||_0x1e22c6['delete'](_0x202c52['commentThreadId']);for(const _0x5dd589 of _0x1e22c6)_0x33aee8['getCommentThread'](_0x5dd589)['remove']({'isFromAdapter':!0x0});for(const _0x58d103 of _0x4668d2){let _0x640d3b=_0x33aee8['getCommentThread'](_0x58d103['commentThreadId']);const {commentThreadId:_0x4e1eb3,context:_0x5b8623,attributes:_0x4099ce,resolvedBy:_0x5988bc,resolvedAt:_0x3e794e,unlinkedAt:_0x4faf55,deletedAt:_0x673dba}=_0x58d103;if(_0x673dba)continue;_0x640d3b||(_0x640d3b=_0x33aee8['addCommentThread']({'channelId':_0x4199d0,'threadId':_0x4e1eb3,'context':_0x5b8623,'attributes':_0x4099ce||{},'resolvedBy':_0x5988bc,'resolvedAt':_0x3e794e,'unlinkedAt':_0x4faf55,'isFromAdapter':!0x0}));const _0x433067=new Set(Array['from'](_0x640d3b['comments'],_0x308b9a=>_0x308b9a['id']));for(const _0x5b8799 of _0x58d103['comments'])_0x433067['delete'](_0x5b8799['commentId']);for(const _0x4fb7b8 of _0x433067)_0x640d3b['getComment'](_0x4fb7b8)['remove']({'isFromAdapter':!0x0});for(const _0x49aa11 of _0x58d103['comments']){const _0xa17864=_0x640d3b['getComment'](_0x49aa11['commentId']);_0xa17864?_0xa17864['content']!==_0x49aa11['content']&&_0xa17864['update']({'content':_0x49aa11['content'],'isFromAdapter':!0x0}):_0x640d3b['addComment'](Object['assign'](_(_0x49aa11),{'isFromAdapter':!0x0}));}}}['_getService'](_0x55f5ec){if(!this['_services']['has'](_0x55f5ec))throw new _0x2493d0('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x55f5ec});return this['_services']['get'](_0x55f5ec);}async['_fetchMissingUsersForThreads'](_0x2b4d51){const _0x2310d5=this['context']['plugins']['get'](_0x3a4ee8),{connection:_0x3a4de3}=this['context']['plugins']['get'](c),_0x5b4186=new Set();for(const {resolvedBy:_0x2d869d,comments:_0x74f8a5}of _0x2b4d51){_0x2d869d&&!_0x2310d5['getUser'](_0x2d869d)&&_0x5b4186['add'](_0x2d869d);for(const {userId:_0x4647c0}of _0x74f8a5)_0x2310d5['getUser'](_0x4647c0)||_0x5b4186['add'](_0x4647c0);}if(0x0===_0x5b4186['size'])return;const _0x3099f7=await dt['getMany'](_0x3a4de3,Array['from'](_0x5b4186));for(const _0x5ab225 of _0x3099f7)_0x2310d5['getUser'](_0x5ab225['id'])||_0x2310d5['addUser'](_0x5ab225);}}async function S(_0x23e97c){if('404'!==_0x23e97c['code'])throw _0x23e97c;}function ut(_0x2d74d8){if((_0xed864f=_0x2d74d8)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0xed864f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xed864f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0xed864f;throw _0x2d74d8;}function _(_0x28052b){return{'threadId':_0x28052b['commentThreadId'],'commentId':_0x28052b['commentId'],'content':_0x28052b['content'],'createdAt':_0x28052b['createdAt'],'authorId':_0x28052b['userId'],'attributes':_0x28052b['attributes']||{}};}class f extends _0x4f4ec3{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(
|
|
28
|
-
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x3a4ee8];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4a26d7){super(_0x4a26d7);const _0x420589=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x420589);}async['init'](){const _0x250c84=this['editor']['plugins']['get'](l),_0x35f72a=_0x250c84['serverHistory'],_0x1a1c9c=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x35f72a,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x250c84['sessionId']});const _0x533600=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x2b2eef=await tt['isBundleUploaded'](_0x1a1c9c['connection'],_0x533600);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x2b7446})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x2b7446)),'updateRevisions':async _0x1ef458=>{await this['_waitForServiceReady']();const _0x3272b6=this['_revisionTracker']['currentRevision'];if(_0x2b2eef&&0x1===_0x1ef458['length']&&_0x1ef458[0x0]['id']===_0x3272b6['id'])return _0x1ef458;for(const _0x8e4c7a of _0x1ef458)_0x8e4c7a['id']===_0x3272b6['id']&&(_0x8e4c7a['isEmptyCurrent']=_0x8e4c7a['fromVersion']===_0x8e4c7a['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1ef458,this['_lastRequestId'])['then'](_0x2cc1f9=>(this['_lastRequestId']=_0x2cc1f9,_0x1ef458))['catch'](_0x49257d=>{if(st(_0x49257d)||'400'===_0x49257d['code']&&void 0x0!==_0x49257d['data']['wrongRequestId']){for(const _0x4b0dff of _0x1ef458){!this['_revisionTracker']['repository']['getRevision'](_0x4b0dff['id'])||this['_revisionTracker']['_bufferUpdate'](_0x4b0dff['id'],_0x4b0dff,!0x1);}if(st(_0x49257d))throw _0x49257d;return _0x1ef458;}throw _0x49257d;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x18e9aa,{revisionsData:_0x13363a,requestId:_0x1a29ec})=>{Math['max'](..._0x13363a['map'](_0x248b22=>_0x248b22['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x13363a,_0x1a29ec);}):this['_handleRevisionsUpdate'](_0x13363a,_0x1a29ec);});const {revisions:_0x878007,requestId:_0x45ab22}=await this['_revisionHistoryService']['connect'](_0x1a1c9c['connection']);_0x1a1c9c['addToReconnectionStack'](this),this['_lastRequestId']=_0x45ab22,await this['_fetchMissingUsers'](_0x878007);for(const _0x9ae2dd of _0x878007)this['_revisionTracker']['addRevisionData'](_0x9ae2dd);this['listenTo'](_0x250c84,'change:_isConnected',(_0x5d27ab,_0x353940,_0x42a2f2)=>{_0x42a2f2&&(this['_oldOffset']=_0x250c84['_offset'],_0x5d27ab['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x1a1c9c,'state',_0x65d73=>_0x65d73===_0x4bea31['CONNECTED']);}async['reconnect'](){const _0x48b537=this['editor']['plugins']['get'](c),_0x5a06c2=this['editor']['plugins']['get'](l),_0x381acb=async()=>{const _0x59f6ed=this['_revisionTracker']['currentRevision'],_0x4dde51=_0x59f6ed['id'],_0x3902a7=_0x4dde51!==_0x5a06c2['sessionId'];if(_0x3902a7){const _0x1a07f8=_0x5a06c2['_offset']-this['_oldOffset'],_0x228088=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x59f6ed['toVersion']+_0x1a07f8!==_0x228088){const _0x599ac2=_0x59f6ed['fromVersion']+_0x1a07f8,_0x43bf2f=this['editor']['plugins']['get'](_0x3a4ee8),_0x5c4f0e=this['_revisionTracker']['buildRevisionData']({'revision':_0x59f6ed,'from':_0x599ac2,'to':_0x228088});_0x5c4f0e['id']=_0x59f6ed['id'];const _0x27c9fc=_0x5c4f0e['authorsIds']['map'](_0x504761=>_0x43bf2f['getUser'](_0x504761));_0x59f6ed['_update']({..._0x5c4f0e,'authors':_0x27c9fc},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x59f6ed['id'],_0x5c4f0e,!0x0);}this['_revisionTracker']['_startingVersion']=_0x228088,(_0x59f6ed['toVersion']===_0x59f6ed['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x4dde51)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x4dde51),this['_revisionTracker']['_createCurrentRevision'](_0x228088));}const {revisions:_0x3caf1e,requestId:_0x172c4f}=await this['_revisionHistoryService']['reconnect'](_0x48b537['connection'],this['_lastRequestId']);_0x3902a7&&_0x3caf1e['length']>0x0?_0x5a06c2['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x3caf1e),this['_handleRevisionsUpdate'](_0x3caf1e,_0x172c4f),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5a06c2['_isConnected']?_0x381acb():new Promise((_0x33a20d,_0x2ec2eb)=>{_0x5a06c2['once']('change:_isConnected',()=>{_0x381acb()['then'](_0x33a20d)['catch'](_0x2ec2eb);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5b6e4a=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x4c410c=>{_0x4c410c['off'](),_0x5b6e4a();});});}['_getLatestVersionFromServerOperations'](){const _0x339553=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x504216 of _0x339553)if('marker'!==_0x504216['type']||_0x504216['affectsData'])return _0x504216['baseVersion']+0x1;}['_getLatestVersion'](){const _0x35d6f6=this['editor']['plugins']['get'](l);return new Promise(_0x162638=>{_0x35d6f6['_isPendingUpdate']?_0x35d6f6['once']('change:_isPendingUpdate',()=>{_0x162638(this['_getLatestVersionFromServerOperations']());}):_0x162638(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x20a216,_0x49eabe){const _0x124625=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x49eabe;for(const _0xa393f1 of _0x20a216){const _0x419e2d=_0x124625['getRevision'](_0xa393f1['id']);if(_0x419e2d){if((_0xa393f1['fromVersion']||_0xa393f1['toVersion'])&&(_0xa393f1['diffData']=null),_0x419e2d===this['_revisionTracker']['currentRevision']){const _0x2aaa84=Math['max'](_0x419e2d['toVersion'],_0xa393f1['toVersion']),_0x2da53c=Math['max'](_0x419e2d['fromVersion'],_0xa393f1['fromVersion']);let _0x4dd08e;_0x419e2d['toVersion']===_0xa393f1['toVersion']&&_0x419e2d['fromVersion']===_0xa393f1['fromVersion']?(_0x4dd08e=!0x0,this['_preventResendingRevisionData'](_0xa393f1)):_0xa393f1['toVersion']===_0x2aaa84&&_0xa393f1['fromVersion']===_0x2da53c?_0x4dd08e=!0x1:(_0x419e2d['toVersion']===_0x2aaa84&&_0x419e2d['fromVersion']===_0x2da53c||this['_fixRevision']({'revision':_0x419e2d,'from':_0x2da53c,'to':_0x2aaa84}),_0x4dd08e=!0x0),_0x4dd08e&&(delete _0xa393f1['fromVersion'],delete _0xa393f1['toVersion'],delete _0xa393f1['diffData'],delete _0xa393f1['createdAt'],delete _0xa393f1['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0xa393f1),this['_preventResendingRevisionData'](_0xa393f1);}else this['_revisionTracker']['addRevisionData'](_0xa393f1);}const _0x227781=_0x124625['getRevisions']();_0x227781['reverse']();for(let _0x196896=0x0;_0x196896<_0x227781['length']-0x1;_0x196896++){const _0x2d2fb3=_0x227781[_0x196896],_0x3e850b=_0x227781[_0x196896+0x1];if(_0x2d2fb3['fromVersion']<_0x3e850b['toVersion']){const _0x41bef1=_0x3e850b['toVersion'],_0xa8ee6d=Math['max'](_0x41bef1,_0x2d2fb3['toVersion']);this['_fixRevision']({'revision':_0x2d2fb3,'from':_0x41bef1,'to':_0xa8ee6d});}}}['_fixRevision']({revision:_0x34fcac,from:_0x2443b9,to:_0x17d0d7}={}){const _0x47fca6=this['editor']['plugins']['get'](_0x3a4ee8),_0x1c2ca1=this['_revisionTracker']['buildRevisionData']({'revision':_0x34fcac,'from':_0x2443b9,'to':_0x17d0d7});_0x1c2ca1['authors']=_0x1c2ca1['authorsIds']['map'](_0x170c5a=>_0x47fca6['getUser'](_0x170c5a)),_0x34fcac['_update'](_0x1c2ca1);}['_preventResendingRevisionData'](_0xef0e47){const _0x3b8644={};_0x3b8644['id']=_0xef0e47['id'];for(const _0x13e588 of Object['keys'](_0xef0e47))'id'!==_0x13e588&&(_0x3b8644[_0x13e588]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x3b8644['id'],_0x3b8644,!0x0);}async['_fetchMissingUsers'](_0x97d7ec){const _0x432a49=this['editor']['plugins']['get'](_0x3a4ee8),{connection:_0x2b412f}=this['editor']['plugins']['get'](c),_0x1b093b=new Set();for(const _0x3fd470 of _0x97d7ec){for(const _0x59fba1 of _0x3fd470['authorsIds'])_0xd6884e(_0x59fba1);_0x3fd470['creatorId']&&_0xd6884e(_0x3fd470['creatorId']);}if(0x0===_0x1b093b['size'])return;const _0x5864a6=await dt['getMany'](_0x2b412f,Array['from'](_0x1b093b));for(const _0x14fad7 of _0x5864a6)_0x432a49['getUser'](_0x14fad7['id'])||_0x432a49['addUser'](_0x14fad7);function _0xd6884e(_0x468e2a){_0x432a49['getUser'](_0x468e2a)||_0x1b093b['add'](_0x468e2a);}}}function st(_0x5584e0){return _0x5584e0['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x5584e0['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5584e0['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x4f4ec3{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class A extends _0x3fe695{['_collapseAt'];constructor(_0x8c8a62,_0x1f834f=0x6){super(_0x8c8a62);const _0x1e282c=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x1f834f,this['bind']('isHidden')['to'](this,'usersCount',_0x1f5b9e=>_0x1f5b9e<_0x1f834f),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x1e282c['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0x1e282c['to']('usersCount',_0x3c7a44=>'+'+(_0x3c7a44-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x3fe695{['items'];['keystrokes'];constructor(_0x5ea184){super(_0x5ea184);const _0x2d8f4d=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x11de96(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x2d8f4d['if']('hasPopup'),'aria-expanded':_0x2d8f4d['to']('isExpanded',_0x4939b6=>this['hasPopup']&&String(_0x4939b6)),'aria-label':_0x2d8f4d['to']('hasPopup',_0x27f526=>G(_0x5ea184,_0x27f526?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x2d8f4d['to']('hasPopup',_0x4ee6bd=>!!_0x4ee6bd&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x2d8f4d['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x2d8f4d['to'](_0x319228=>{const _0x4a1354=_0x319228,_0x1cc71c=document['querySelector']('.ck-presence-list__dropdown-list'),_0x1e6497=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1cc71c?.['contains'](_0x4a1354['relatedTarget'])||_0x1e6497?.['contains'](_0x4a1354['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x1b5e84,_0x36dff4,_0x5bc012)=>{this['element']&&(_0x5bc012?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 j extends _0x3fe695{['counterView'];['inlineListView'];constructor(_0x1fdd25,_0x29fae2=0x6){super(_0x1fdd25);const _0x417c99=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new A(this['locale'],_0x29fae2),this['inlineListView']=new ts(_0x1fdd25),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x344d36 of this['inlineListView']['items'])_0x344d36['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',_0x417c99['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class x extends _0x3fe695{['listWrapperView'];constructor(_0x450523,_0x2958ab){super(_0x450523);const _0x595ab3=this['bindTemplate'];this['listWrapperView']=new mt(_0x450523,_0x2958ab),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':G(_0x450523,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x595ab3['to'](_0xae3d82=>{const _0x3acfc4=_0xae3d82,_0xb99509=document['querySelector']('.ck-presence-list__list'),_0x58401a=document['querySelector']('.ck-balloon-panel_with-arrow');_0xb99509?.['contains'](_0x3acfc4['relatedTarget'])||_0x58401a?.['contains'](_0x3acfc4['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class mt extends _0x102a21{constructor(_0x4d2fd6,_0x4a531c){super(_0x4d2fd6);const _0x142e15=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x4a531c?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x142e15['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x142e15['to']('role'),'aria-label':_0x142e15['to']('ariaLabel'),'aria-labelledby':_0x142e15['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x2e0fae['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x59c32e=this['element'];_0x59c32e&&(this['_isScrollable']=Math['max'](_0x59c32e['scrollHeight'],_0x59c32e['clientHeight'])>0.8*window['innerHeight']);}}class k extends rt{['userView'];constructor(_0x53497f,_0x16530c,_0x478571){super(_0x53497f);const _0x5df1a0=this['bindTemplate'];this['userView']=new ct(_0x53497f,_0x16530c);const _0x4666f2={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x16530c['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x16530c['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x16530c['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x478571&&(_0x4666f2['tag']='button',_0x4666f2['on']={'click':_0x5df1a0['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4666f2);}['focus'](){this['element']['focus']();}}class y extends _0x3fe695{['userView'];['markerView'];constructor(_0x2bde02,_0x396dec,_0x3c4db3){super(_0x2bde02);const _0x964786=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x2bde02,_0x396dec),this['markerView']=new at(_0x2bde02,_0x396dec);const _0x5db868=new ot(_0x2bde02);_0x5db868['template']['tag']='span',_0x5db868['text']=_0x396dec['name'];const _0x5caf76={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x964786['to']('isFocusable',_0x18b507=>!!_0x18b507&&0x0),'aria-labelledby':_0x5db868['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x964786['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x964786['to']('hasTooltip',_0x26e38d=>!_0x26e38d),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x5db868]};_0x3c4db3&&(_0x5caf76['tag']='button',_0x5caf76['on']={'click':_0x964786['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5caf76);}}class at extends _0x3fe695{constructor(_0xbf0d19,_0x5b288e){super(_0xbf0d19),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5b288e['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const C={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x19f79c{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2db9be){super(_0x2db9be),this['context']['config']['define']('presenceList',C);const _0x184d10=_0x2db9be['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x184d10)throw new _0x2493d0('presencelist-collapseat-invalid-format',this);if(_0x184d10<0x1)throw new _0x2493d0('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x3ddc9f(),this['balloonPanelView']=new _0x123570(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x317124 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x317124);this['listenTo'](this['_allConnectedUsers'],'add',(_0x37230e,_0x284437)=>{this['_handleUserAdd'](_0x284437);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0xae45e2,_0x2550cd)=>{this['_handleUserRemove'](_0x2550cd);});}['_createView'](){const _0x5b1fd9=this['context'],_0x42614b=new j(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x321ae1=this['balloonPanelView'];if(!_0x261598(_0x5b1fd9['config']['get']('presenceList.container')))throw new _0x2493d0('presencelist-missing-container',this);return _0x42614b['counterView']['bind']('usersCount')['to'](this),_0x42614b['bind']('isCollapsed')['to'](this,'usersCount',_0x4ae979=>{const {collapseAt:_0x591a4c}=_0x5b1fd9['config']['get']('presenceList'),_0x3c1b95=_0x4ae979>=_0x591a4c;if(_0x3c1b95&&!_0x42614b['inlineListView']['items']['find'](_0x24926d=>_0x24926d instanceof A)){const _0x11c838=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x11c838&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x42614b['inlineListView']['items']['add'](_0x42614b['counterView']);}return _0x3c1b95||this['hideDropdown'](),_0x3c1b95;}),_0x42614b['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x6b571e=>{const _0x1b52bd=_0x5b1fd9['config']['get']('presenceList'),_0x5ae00d=new y(_0x5b1fd9['locale'],_0x6b571e,!!_0x1b52bd['onClick']);return _0x5ae00d['bind']('hasTooltip')['to'](_0x42614b,'isCollapsed',_0x3f1560=>!_0x3f1560),_0x5ae00d['bind']('isFocusable')['to'](_0x42614b,'isCollapsed',_0xb4b2ea=>!_0xb4b2ea),_0x1b52bd['onClick']&&this['listenTo'](_0x5ae00d,'execute',()=>{this['view']['isCollapsed']||_0x1b52bd['onClick'](_0x6b571e,_0x5ae00d['element']);}),_0x5ae00d;}),this['listenTo'](_0x42614b['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x42614b['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x42614b['inlineListView']['keystrokes']['set']('Enter',(_0x78d570,_0x32f57d)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x32f57d());}),_0x42614b['render'](),_0x321ae1['render'](),_0x5e7d43({'emitter':_0x42614b,'activator':()=>_0x321ae1['isVisible'],'contextElements':[_0x321ae1['element'],_0x42614b['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x5b1fd9['config']['get']('presenceList.container')['appendChild'](_0x42614b['element']),this['_bodyCollection']=new _0x476504(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x42614b;}['_handleUserAdd'](_0x2d3673){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x2d3673['isMe'])return;const _0x5a4275=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x5a4275-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x36ac6d=_0x2d3673['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x2d3673,_0x36ac6d);}['_handleUserRemove'](_0x31ece0){this['usersCount']--;const {collapseAt:_0x67a5e4}=this['context']['config']['get']('presenceList'),_0x1b6d43=this['usersCount']>=_0x67a5e4;if(this['currentDisplayedUsers']['get'](_0x31ece0['id']))this['currentDisplayedUsers']['remove'](_0x31ece0['id']);else{if(_0x1b6d43&&this['currentDisplayedUsers']['length']+0x1===_0x67a5e4-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x1b6d43?0x1:0x0)<this['usersCount']){for(const _0x14978c of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x14978c['id'])&&(this['currentDisplayedUsers']['add'](_0x14978c,Math['min'](this['currentDisplayedUsers']['length']-(_0x1b6d43?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x1b6d43?0x1:0x0)===_0x67a5e4-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x408061=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new x(this['context']['locale'],!!_0x408061['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x5d6457}=this['presenceDropdownView'];_0x5d6457['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x3b9449=>{if(!_0x408061['displayMe']&&_0x3b9449['isMe'])return null;const _0x2c7ed7=new k(this['context']['locale'],_0x3b9449,!!_0x408061['onClick']);return _0x408061['onClick']&&this['listenTo'](_0x2c7ed7,'execute',()=>{_0x408061['onClick'](_0x3b9449,_0x2c7ed7['element']);}),_0x2c7ed7;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x5d6457['focus'](),_0x5d6457['checkIfScrollable']();const _0x273f47=(_0x420505,_0x4af217)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x4af217();};_0x5d6457['keystrokes']['set']('Esc',_0x273f47),_0x5d6457['keystrokes']['set']('Shift+Tab',_0x273f47),_0x5d6457['keystrokes']['set']('Tab',(_0x33b57e,_0x1fe5ff)=>{!function(_0x43a0c8){const _0x5da5ab=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x46be2e=>_0x46be2e+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x105c98=[...document['body']['querySelectorAll'](_0x5da5ab)]['filter'](_0x9f2049=>_0x9f2049===document['activeElement']||_0x9f2049['offsetWidth']+_0x9f2049['offsetHeight']>0x0)['sort']((_0x5a412e,_0x5589fe)=>(_0x5a412e['tabIndex']||0x0)-(_0x5589fe['tabIndex']||0x0)),_0x1d9646=_0x105c98['indexOf'](_0x43a0c8),_0x3be0c7=_0x105c98[(_0x1d9646+0x1)%_0x105c98['length']];_0x3be0c7&&_0x3be0c7['focus']();}(this['view']['element']),this['hideDropdown'](),_0x1fe5ff();}),_0x5d6457['focusTracker']['add'](this['view']['element']),_0x5d6457['focusTracker']['on']('change:isFocused',(_0x21ca1b,_0x2b05d9,_0xcef033)=>{_0xcef033||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 _0x19f79c{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,r as PresenceListUI,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges,i as Sessions};
|
|
23
|
+
import{ContextPlugin as _0x42e636,Plugin as _0x101618,PendingActions as _0x5b9ce0,Context as _0xe89c7}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x553aa8,CKEditorError as _0x9c1d4e,Collection as _0x4af4f4,global as _0x3b3485,version as nt,uid as _0x1416ae,KeystrokeHandler as _0x135344}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x105111,View as _0x157a15,ListView as _0x13123e,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x3c08a0,clickOutsideHandler as _0x188faf,BodyCollection as _0x4fb312}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ht,History as _0x56ac5e,NoOperation as _0x3fd772,InsertOperation as _0x24acca,MarkerOperation as _0x3c5467,RootAttributeOperation as _0x21f95a,transformSets as _0x69da3a,OperationFactory as _0x57cd0a}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as lt,WEB_SOCKET_GATEWAY_STATES as _0x20e191,CollaborativeEditingService as _0x1415a3,User as dt,CommentsService as _0x468d30,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x5f0649,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x5d48a0}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x185eae}from'es-toolkit/compat';class c extends _0x42e636{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x105111];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x130474){super(_0x130474),this['set']('state',_0x20e191['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x553aa8);}['init'](){const _0x191ebb=this['context'],_0x1382ef=_0x191ebb['plugins']['get']('CloudServices'),_0x3b5a43=_0x191ebb['plugins']['get'](_0x105111);if(!_0x1382ef['token'])throw new _0x9c1d4e('websocketgateway-missing-token',this);if(!_0x1382ef['webSocketUrl'])throw new _0x9c1d4e('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'](_0x1382ef['token'],_0x1382ef['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x7d8d5b=>{if(this['connection']=_0x7d8d5b,this['bind']('state')['to'](_0x7d8d5b,'state',this,'_isBrowserOffline',(_0x126897,_0x2850b5)=>('connected'!==_0x126897&&(this['_shouldPluginsReconnect']=!0x0),_0x2850b5||_0x126897!==_0x20e191['CONNECTED']?_0x20e191['DISCONNECTED']:this['state']==_0x20e191['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x20e191['CONNECTING']):_0x20e191['CONNECTED'])),this['connection']['on']('error',(_0x46f542,_0x3e1986)=>{if('limitExceeded'!==_0x3e1986['code'])throw console['error'](_0x3e1986),new _0x9c1d4e('cloudservices-init',null,{'originalError':_0x3e1986});_0x3b5a43['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'});}),!_0x7d8d5b['me'])return new Promise(_0x10f3f2=>_0x7d8d5b['on']('change:me',_0x10f3f2));})['catch'](_0x4d5229=>{throw console['error'](_0x4d5229),new _0x9c1d4e('cloudservices-init',null,{'originalError':_0x4d5229});});}['addToReconnectionStack'](_0x4fc6c3){if('function'!=typeof _0x4fc6c3['reconnect'])throw new _0x9c1d4e('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x4fc6c3))throw new _0x9c1d4e('websocketgateway-plugin-already-registered',this,{'name':_0x4fc6c3['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x4fc6c3);}['removeFromReconnectionStack'](_0xc3fafd){this['_reconnectionStack']['delete'](_0xc3fafd);}['isInReconnectionStack'](_0x270428){return this['_reconnectionStack']['has'](_0x270428);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x435eac=>_0x435eac['reconnect']())))['then'](()=>this['state']=_0x20e191['CONNECTED'])['catch'](_0x441465=>{throw console['error'](_0x441465),new _0x9c1d4e('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x20e191['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x42e636{['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,_0x5f0649];}constructor(_0x1c5e82){super(_0x1c5e82),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x4af4f4(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x5f0649);}['init'](){const _0x413384=this['context']['plugins']['get'](c);this['listenTo'](_0x413384,'change:state',(_0x39b04b,_0x3ea863,_0x13c81b)=>{if('connected'!==_0x13c81b)this['channelSessions']['forEach'](_0x5903bc=>_0x5903bc['clear']()),this['channelConnectedUsers']['forEach'](_0x3adf62=>_0x3adf62['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x3a4e76,_0x1e3d0f]of this['_registeredSessions'])for(const _0x418026 of _0x1e3d0f)this['_handleSessionAdd'](_0x3a4e76,_0x418026);}}),this['_createUser'](_0x413384['connection']['me'],!0x0);}['register'](_0x38a5c7,_0x946696){if(this['_registeredSessions']['has'](_0x38a5c7))throw new _0x9c1d4e('sessions-register-already-registered',null,{'channelId':_0x38a5c7});this['_registeredSessions']['set'](_0x38a5c7,_0x946696),this['channelSessions']['set'](_0x38a5c7,new _0x4af4f4()),this['channelConnectedUsers']['set'](_0x38a5c7,new _0x4af4f4()),this['listenTo'](_0x946696,'add',(_0x4c1a17,_0x5c3944)=>this['_handleSessionAdd'](_0x38a5c7,_0x5c3944)),this['listenTo'](_0x946696,'remove',(_0x10d0ba,_0x4f3a04)=>this['_handleSessionRemove'](_0x38a5c7,_0x4f3a04));for(const _0x473142 of _0x946696)this['_handleSessionAdd'](_0x38a5c7,_0x473142);}['unregister'](_0x25b0dc){if(!this['_registeredSessions']['has'](_0x25b0dc))throw new _0x9c1d4e('sessions-unregister-not-exist',null,{'channelId':_0x25b0dc});const _0x2038db=this['_registeredSessions']['get'](_0x25b0dc);this['stopListening'](_0x2038db);for(const _0x3bdffb of _0x2038db)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x25b0dc,_0x3bdffb);this['_registeredSessions']['delete'](_0x25b0dc),this['channelSessions']['delete'](_0x25b0dc),this['channelConnectedUsers']['delete'](_0x25b0dc);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x231ca0){for(const _0x5c55cc of this['channelSessions']['values']())for(const _0x21a77c of _0x5c55cc)if(_0x21a77c['id']===_0x231ca0)return _0x21a77c['user'];}['getUserSessions'](_0x2c2a13,_0xbf56f6){const _0x53f89e=_0xbf56f6?[this['channelSessions']['get'](_0xbf56f6)]:this['channelSessions']['values'](),_0x1e4888=new Set();for(const _0x3d10d0 of _0x53f89e)for(const _0x44641e of _0x3d10d0)_0x44641e['user']['id']===_0x2c2a13['id']&&_0x1e4888['add'](_0x44641e['id']);return _0x1e4888;}['getUserRole'](_0x2f351e){for(const _0x1569d4 of this['channelSessions']['values']())for(const _0x3d7131 of _0x1569d4)if(_0x3d7131['user']===_0x2f351e)return _0x3d7131['role'];}['_handleSessionAdd'](_0x430ff4,_0x2351b2){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x24171e=_0x2351b2['user'],_0x29092e=this['_users']['getUser'](_0x24171e['id'])||this['_createUser'](_0x24171e),_0x2705a6=Object['assign']({},_0x2351b2,{'user':_0x29092e});this['channelSessions']['get'](_0x430ff4)['add'](_0x2705a6);const _0x40fefb=this['channelConnectedUsers']['get'](_0x430ff4);_0x40fefb['has'](_0x29092e['id'])||_0x40fefb['add'](_0x29092e),this['allConnectedUsers']['has'](_0x29092e['id'])||this['allConnectedUsers']['add'](_0x29092e,_0x29092e['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x430ff4,{'channelId':_0x430ff4,'session':_0x2705a6});}['_handleSessionRemove'](_0x1651e0,_0x45b703){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x134b2f=this['channelConnectedUsers']['get'](_0x1651e0),_0xead3f2=_0x45b703['user'];_0xead3f2['id']&&(this['channelSessions']['get'](_0x1651e0)['remove'](_0x45b703['id']),_0x134b2f['has'](_0xead3f2['id'])&&!this['getUserSessions'](_0xead3f2,_0x1651e0)['size']&&_0x134b2f['remove'](_0xead3f2['id']),this['allConnectedUsers']['get'](_0xead3f2['id'])&&!this['getUserSessions'](_0xead3f2)['size']&&this['allConnectedUsers']['remove'](_0xead3f2['id']));}['_createUser'](_0x51d554,_0x26117b){const _0x16e084=this['_users']['addUser'](_0x51d554);return _0x26117b&&this['_users']['defineMe'](_0x51d554['id']),_0x16e084['orderNumber']=this['_uniqueUsersCount']++,_0x16e084;}}class q extends _0x101618{['_domEmitter']=new(_0x553aa8())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x2c0cff=this['editor'],_0x4cc035=_0x2c0cff['plugins']['get'](i);_0x2c0cff['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0xb22d7f,{writer:_0x52dd29})=>function(_0x50a946,_0xcfe90b,_0x98d195,_0x43ad38){const _0xf3d45b=_0x50a946['markerName']['split'](':')[0x2],_0x2b510c=_0x98d195['getUserBySessionId'](_0xf3d45b);if(!_0x2b510c||_0xf3d45b===_0x98d195['mySessionId'])return;if(!_0x43ad38['model']['schema']['checkChild'](_0x50a946['markerRange']['start'],'$text'))return;const _0x3f707c={'class':'ck-user__marker\x20'+_0x2b510c['color']['getMarkerClass'](),'data-name':_0x2b510c['name'],'data-session-id':_0xf3d45b},_0x1651d9=_0x43ad38['model']['markers']['get'](_0x50a946['markerName']),_0x6d8519=_0x1651d9['getStart'](),_0x298c17=_0x6d8519['nodeAfter'],_0x29f30b=_0x43ad38['model']['schema'];if(_0x298c17&&_0x29f30b['isObject'](_0x298c17)&&_0x29f30b['isInline'](_0x298c17)&&!_0x43ad38['model']['markers']['get']('user:range:'+_0xf3d45b)['getRange']()['isCollapsed'])return;const _0x3a948a=_0x6d8519['parent'];return _0x43ad38['model']['schema']['isLimit'](_0x3a948a)&&!_0x43ad38['model']['hasContent'](_0x3a948a)&&(_0x3f707c['contenteditable']=!0x1),function(_0x11946b,_0x5403e5,_0x4066aa){const _0x4c591d=_0x11946b['createUIElement']('span',_0x5403e5);return _0x11946b['setCustomProperty']('userPositionMarker',!0x0,_0x4c591d),_0x4c591d['render']=function(_0x440927){const _0x41e6df=this['toDomElement'](_0x440927),_0x2c8b62=document['createElement']('span');return _0x2c8b62['classList']['add']('ck-user__marker-tooltip'),_0x2c8b62['setAttribute']('contenteditable','false'),_0x2c8b62['setAttribute']('spellcheck','false'),_0x2c8b62['textContent']=_0x4066aa['name'],_0x41e6df['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x2c8b62['outerHTML']+'',_0x41e6df['addEventListener']('mouseenter',()=>{_0x41e6df['classList']['add']('ck-user__marker_hovered');}),_0x41e6df['addEventListener']('mouseleave',()=>{_0x41e6df['classList']['remove']('ck-user__marker_hovered');}),_0x41e6df;},_0x4c591d['isSimilar']=function(_0x440b8d){return!(!this['getCustomProperty']('userPositionMarker')||!_0x440b8d['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x440b8d['getAttribute']('data-session-id'));},_0x4c591d;}(_0xcfe90b,_0x3f707c,_0x2b510c);}(_0xb22d7f,_0x52dd29,_0x4cc035,_0x2c0cff)}),_0x2c0cff['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x5cedad=>function(_0x48f994,_0x3010fd){const _0x3c309e=_0x48f994['markerName']['split'](':')[0x2];if(_0x3c309e===_0x3010fd['mySessionId'])return null;const _0x4c011c=_0x3010fd['getUserBySessionId'](_0x3c309e);if(!_0x4c011c)return{'id':_0x3c309e,'classes':[]};return{'id':_0x3c309e,'classes':['ck-user__selection',_0x4c011c['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x3c309e},'priority':0x7d0+_0x4c011c['orderNumber']};}(_0x5cedad,_0x4cc035)}),function(_0x440088){const _0x10902c=_0x440088['model'],_0x2e95e1=new Map(),_0x585ca1=_0x440088['plugins']['get'](i);_0x10902c['markers']['on']('update:user:range',(_0x33b4c2,_0x1e142f,_0x3fd46a,_0x5eda85)=>{if(!_0x5eda85&&_0x2e95e1['get'](_0x1e142f['name']))return _0x2e95e1['get'](_0x1e142f['name'])['detach'](),void _0x2e95e1['delete'](_0x1e142f['name']);const _0x30111b=_0x1e142f['name']['split'](':')[0x2];if(_0x30111b===_0x585ca1['mySessionId'])return;const _0x4bcfae='user:position:'+_0x30111b;_0x10902c['markers']['has'](_0x4bcfae)&&_0x440088['editing']['reconvertMarker'](_0x4bcfae),_0x1e142f['on']('change:range',(_0x428969,_0x1db3c0,_0x392615)=>{if('$graveyard'!=_0x1db3c0['root']['rootName']&&'$graveyard'==_0x1e142f['getRange']()['root']['rootName']&&!_0x2e95e1['has'](_0x1e142f['name'])){const _0x4d72fe=_0x10902c['schema']['getNearestSelectionRange'](_0x392615['deletionPosition']);if(_0x4d72fe){const _0x20cf82=ht['fromRange'](_0x4d72fe);_0x2e95e1['set'](_0x1e142f['name'],_0x20cf82),_0x20cf82['on']('change:range',(_0x1c5e59,_0x538e0c,_0x40d13b)=>{if('$graveyard'==_0x20cf82['root']['rootName']){const _0x132f75=_0x10902c['schema']['getNearestSelectionRange'](_0x40d13b['deletionPosition']);_0x132f75?(_0x20cf82['start']=_0x132f75['start'],_0x20cf82['end']=_0x132f75['end']):(_0x2e95e1['delete'](_0x1e142f['name']),_0x20cf82['detach']());}});}}});}),_0x10902c['document']['on']('change',()=>{_0x2e95e1['size']>0x0&&_0x10902c['enqueueChange']({'isUndoable':!0x1},_0x5a248d=>{for(const [_0x4a629c,_0x22aac2]of _0x2e95e1)'$graveyard'==_0x10902c['markers']['get'](_0x4a629c)['getRange']()['root']['rootName']&&(te(_0x4a629c['split'](':')[0x2],_0x22aac2['toRange'](),_0x10902c,_0x5a248d),_0x22aac2['detach']());_0x2e95e1['clear']();});});}(_0x2c0cff),this['_domEmitter']['listenTo'](_0x3b3485['document'],'keydown',(_0x5d98f9,{key:_0x56d5fd})=>{'Escape'===_0x56d5fd&&function(_0x584869){_0x584869['editing']['view']['change'](_0x2d4788=>{for(const _0x540052 of _0x584869['model']['markers']){if(!_0x540052['name']['startsWith']('user:position'))continue;const _0x4060ea=_0x584869['editing']['mapper']['markerNameToElements'](_0x540052['name']);if(_0x4060ea){for(const _0xdc8de6 of _0x4060ea)_0x2d4788['removeClass']('ck-user__marker_hovered',_0xdc8de6);}}});}(_0x2c0cff);},{'useCapture':!0x0});}['afterInit'](){const _0x3e3c68=this['editor'],_0x174d6c=_0x3e3c68['commands']['get']('undo');_0x174d6c&&_0x3e3c68['model']['on']('applyOperation',(_0x476fe8,_0x2d4bb0)=>{const _0x5c9641=_0x2d4bb0[0x0];if(!_0x5c9641['isDocumentOperation'])return;if('marker'!=_0x5c9641['type']||!_0x5c9641['name']['startsWith']('user:'))return;const _0x598b51=_0x5c9641['batch'];_0x174d6c['_createdBatches']['has'](_0x598b51)&&(_0x5c9641['newRange']=_0x5c9641['oldRange']?_0x3e3c68['model']['createRange'](_0x5c9641['oldRange']['start'],_0x5c9641['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x44ca7d=this['editor'],_0xca30a=_0x44ca7d['model']['document'],_0x5bb0d7=_0x44ca7d['plugins']['get'](i);_0x44ca7d['model']['enqueueChange']({'isUndoable':!0x1},_0x582141=>{const _0x647242='user:range:'+_0x5bb0d7['mySessionId'],_0x24181d='user:position:'+_0x5bb0d7['mySessionId'],_0x1e860b=_0x44ca7d['model']['markers']['has'](_0x647242);_0x44ca7d['editing']['view']['hasDomSelection']?te(_0x5bb0d7['mySessionId'],_0xca30a['selection']['getFirstRange'](),_0x44ca7d['model'],_0x582141):_0x1e860b&&(_0x582141['removeMarker'](_0x647242),_0x582141['removeMarker'](_0x24181d));});}}function te(_0x3bbf31,_0x2c9cf4,_0x2e2f65,_0x2e6d95){const _0x4c53e3='user:range:'+_0x3bbf31,_0x20dcfc='user:position:'+_0x3bbf31,_0x2ba6e9=_0x2c9cf4['getContainedElement']();let _0x5088be=_0x2c9cf4['start'];if(_0x2ba6e9&&_0x2ba6e9['is']('element','tableCell')){const _0x35715b=function(_0x313c75,_0x1f7a6d){for(const _0x1d1ce3 of _0x313c75['getPositions']())if(_0x1f7a6d['schema']['checkChild'](_0x1d1ce3,'$text'))return _0x1d1ce3;}(_0x2c9cf4,_0x2e2f65);_0x35715b&&(_0x5088be=_0x35715b,_0x2c9cf4=_0x2e6d95['createRange'](_0x5088be));}const _0x395f9c=_0x2e6d95['createRange'](_0x5088be);_0x2e2f65['markers']['has'](_0x4c53e3)?(_0x2e6d95['updateMarker'](_0x4c53e3,{'range':_0x2c9cf4}),_0x2e6d95['updateMarker'](_0x20dcfc,{'range':_0x395f9c})):(_0x2e6d95['addMarker'](_0x4c53e3,{'range':_0x2c9cf4,'usingOperation':!0x0}),_0x2e6d95['addMarker'](_0x20dcfc,{'range':_0x395f9c,'usingOperation':!0x0}));}function G(_0x1a7806,_0x505f15,_0x1e4b91){const _0x7bcfe9=_0x1a7806['t'],t=_0x1a7806['t'];switch(_0x505f15){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 _0x7bcfe9({'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'},_0x1e4b91);default:return'';}}let J=0x1;class l extends _0x101618{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x1415a3)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,q,_0x5b9ce0,_0x5f0649,_0x105111];}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 _0x4adc9f=this['serverHistory']['getOperations']();for(let _0x34879c=_0x4adc9f['length']-0x1;_0x34879c>=0x0;_0x34879c--){const _0x2a8a01=_0x4adc9f[_0x34879c];if(!this['_disconnectionOperations']['has'](_0x2a8a01))return _0x2a8a01['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x16674d){if(super(_0x16674d),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x56ac5e(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x9c1d4e('collaboration-missing-channelid',this);const _0x30266a=_0x16674d['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x30266a,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x5d48a0(),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 Y(this['_disconnectionOperations']);}['init'](){const _0x17b224=this['editor'],_0x59272e=_0x17b224['plugins']['get'](_0x5f0649),_0x477733=_0x17b224['plugins']['get'](c);this['listenTo'](_0x59272e,'getOperationAuthor',(_0x3cedf4,_0x149fd7)=>{const _0x346e38=_0x149fd7[0x0];_0x346e38['_authorId']&&(_0x3cedf4['return']=_0x59272e['getUser'](_0x346e38['_authorId']),_0x3cedf4['stop']()),null===_0x346e38['_authorId']&&(_0x3cedf4['return']=null,_0x3cedf4['stop']());},{'priority':'high'}),this['listenTo'](_0x17b224['model']['document']['selection'],'change:range',(_0x1c4cb3,_0x251c90)=>{_0x251c90['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x17b224['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x17b224['model']['on']('applyOperation',(_0x31dc06,_0x41547d)=>{const _0x5153b6=_0x41547d[0x0];_0x5153b6['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x5153b6),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x477733,'state',this,'_hasSynchronizationProblem',(_0x4ae849,_0x38c50a)=>'connected'===_0x4ae849&&!_0x38c50a),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x17b224['disableReadOnlyMode']('rtc-offline'):_0x17b224['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x17b224['disableReadOnlyMode']('rtc-offline'):_0x17b224['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0xa70e71=this['editor']['plugins']['get'](i),_0x236f0a=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0xa70e71['unregister'](this['_channelId']);const _0x3ad993=await this['_service']['reconnect'](_0x236f0a['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x3ad993)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x53372c=await this['_service']['getConnectedSessions']();_0xa70e71['register'](this['_channelId'],_0x53372c),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x2094ed){if(function(_0x2f46e5){return'404'===_0x2f46e5['code'];}(_0x2094ed)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x32d15b){return'409'===_0x32d15b['code'];}(_0x2094ed)){const _0x43861e=G(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'](_0x43861e);}else{if(!(_0x2094ed instanceof Q))throw _0x2094ed;this['_handleReconnectionError']();}}}}['destroy'](){const _0x3af6e7=this['editor']['plugins']['get'](c),_0x317120=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x317120['channelSessions']['has'](this['_channelId'])&&_0x317120['unregister'](this['_channelId']),_0x3af6e7['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x326e57){if(this['sessionId']!==_0x326e57['sessionId']&&this['_lastSyncedOperationId']!==_0x326e57['lastOperationId'])throw new Q();return this['sessionId']=_0x326e57['sessionId'],this['_handleServerResponse']([],{..._0x326e57,'wereChangesApplied':!0x1,'data':_0x326e57['data']},'reconnect');}async['_connectService'](_0x3d0dfc,_0xc6b678=!0x1){const {connection:_0x82a694}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x82a694,this['_channelId'])['then'](_0x17589d=>this['_initSessionsHandling'](_0x17589d))['catch'](_0x50b58c=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x50b58c);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x995237,_0x3d67b8)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x3d67b8);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x419b5b=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3d0dfc);this['_isPendingUpdate']=!0x0;const _0x5bdca4=await this['_service']['connect'](_0x82a694,this['_compressOperations'](_0x3d0dfc),_0x419b5b);if(this['sessionId']=_0x5bdca4['sessionId'],_0xc6b678){if(!_0x5bdca4['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x5bdca4['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x3d0dfc,_0x5bdca4,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x5bdca4,_0x3d0dfc);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0xf7a1c5=this['editor']['plugins']['get'](i),_0x4aeb6c=this['editor']['plugins']['get'](q),_0x330ea5=_0xf7a1c5['channelSessions']['get'](this['_channelId']);_0x330ea5&&_0x330ea5['length']>0x1?_0x4aeb6c['createUserMarkerOperations']():this['listenTo'](_0xf7a1c5,'sessionAdd:'+this['_channelId'],()=>{0x2===_0xf7a1c5['channelSessions']['get'](this['_channelId'])['length']&&_0x4aeb6c['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x483bc2,_0x580e6d,_0x5211a9,_0x102abc){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x580e6d){const _0x47fd3f=this['_decompressOperations'](_0x5211a9,_0x102abc);await this['_fetchMissingUsers'](_0x47fd3f),this['_handleExternalOperations'](_0x47fd3f,_0x580e6d,_0x5211a9['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x5bb7e4}=this['editor'];let _0x438229;try{_0x438229=await this['_service']['getDocumentDetails']();}catch{const _0x6816b8=G(_0x5bb7e4,'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'](_0x6816b8);}const _0x4b871f=_0x438229['currentDocumentSession']||_0x438229['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x4b871f['lastOperationId']){const _0x57a7b9=G(_0x5bb7e4,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x57a7b9);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x3e2e90){const _0x12b57f=this['editor']['plugins']['get'](i);this['listenTo'](_0x12b57f,'sessionAdd:'+this['_channelId'],(_0x5a9370,{session:_0x21f776})=>{if(_0x21f776['id']===_0x12b57f['mySessionId']){_0x5a9370['off']();const _0xc18cc=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x131de3=_0x21f776['permissions'];_0xc18cc&&_0xc18cc['isEnabled']&&(_0x131de3=_0x131de3['filter'](_0x1da6c5=>'document:write'!==_0x1da6c5)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x131de3,this['_channelId']);}}),_0x12b57f['register'](this['_channelId'],_0x3e2e90);}['_initThrowingOnDataSet'](){const _0x110a9b=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x26c8fc)=>{if(!_0x26c8fc[_0x26c8fc['length']-0x1]['suppressErrorInCollaboration'])throw new _0x9c1d4e('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x110a9b['apply'](this['editor']['data'],_0x26c8fc);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x57b875,[_0x452991])=>{if(this['_document']['version'])throw new _0x9c1d4e('realtimecollaborationclient-init-document-already-initialized',this);_0x57b875['stop'](),this['_setPendingAction']();const _0x5ebe26=this['editor']['config']['get']('rootsAttributes'),_0x1cbee4=this['_getOperationsFromInitData'](_0x452991,_0x5ebe26);0x0==_0x1cbee4['length']&&_0x1cbee4['push'](new _0x3fd772(0x0)),_0x57b875['return']=this['_connectService'](_0x1cbee4)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x8f70eb=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x8f70eb))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x510813,[_0x144b19,_0x5d00ff])=>{_0x510813['stop']();const _0x29b0ca=this['editor']['model']['document']['getRoot'](_0x144b19);if(!this['_knownRootNames']['has'](_0x144b19)){const _0x34a0bf=_0x5d00ff&&_0x5d00ff['data']?_0x5d00ff['data']:'',_0x41389e=_0x5d00ff&&_0x5d00ff['attributes']?_0x5d00ff['attributes']:{};await this['_loadRoot'](_0x144b19,_0x34a0bf,_0x41389e);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x29b0ca['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x29b0ca);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x1d90f2){const _0x301183=this['editor']['plugins']['get'](_0x5f0649),{connection:_0x291bcd}=this['editor']['plugins']['get'](c),_0x1ba474=new Set();for(const _0x3cfff3 of _0x1d90f2){const _0x48f957=_0x3cfff3['_authorId'];_0x48f957&&!_0x301183['getUser'](_0x48f957)&&_0x1ba474['add'](_0x48f957);}if(0x0===_0x1ba474['size'])return;const _0x3f0c30=await dt['getMany'](_0x291bcd,Array['from'](_0x1ba474));for(const _0x322f45 of _0x3f0c30)_0x301183['getUser'](_0x322f45['id'])||_0x301183['addUser'](_0x322f45);}['_getOperationsFromInitData'](_0x4cd2f0,_0x3c605b={}){const _0x433289=this['editor']['model'],_0x458460=[];let _0x3e459c=0x0;const _0x1c5f5d='string'==typeof _0x4cd2f0?{'main':_0x4cd2f0}:_0x4cd2f0;for(const _0x44d433 of Object['keys'](_0x1c5f5d)){if(!this['_document']['roots']['has'](_0x44d433))throw new _0x9c1d4e('realtimecollaborationclient-init-non-existent-root',this);const _0x516c70=this['editor']['data']['parse'](_0x1c5f5d[_0x44d433]),_0x302a06=this['_document']['getRoot'](_0x44d433),_0x1fbc01=new _0x24acca(_0x433289['createPositionAt'](_0x302a06,0x0),_0x516c70,_0x3e459c++);_0x458460['push'](_0x1fbc01);for(const [_0x44e113,_0x16bebe]of _0x516c70['markers']){const _0x3c2a5e=_0x433289['createRange'](_0x433289['createPositionFromPath'](_0x302a06,_0x16bebe['start']['path']['slice']()),_0x433289['createPositionFromPath'](_0x302a06,_0x16bebe['end']['path']['slice']())),_0x3d89fa=new _0x3c5467(_0x44e113,null,_0x3c2a5e,_0x433289['markers'],!0x0,_0x3e459c++);_0x458460['push'](_0x3d89fa);}}if(_0x3c605b)for(const [_0x536940,_0xcb96e7]of Object['entries'](_0x3c605b)){const _0x51132c=_0x433289['document']['getRoot'](_0x536940);if(!_0x51132c)throw new _0x9c1d4e('multi-root-editor-root-attributes-no-root',null);for(const [_0x313fb2,_0x42b668]of Object['entries'](_0xcb96e7))if(null!==_0x42b668){const _0x5d2e39=new _0x21f95a(_0x51132c,_0x313fb2,null,_0x42b668,_0x3e459c++);_0x458460['push'](_0x5d2e39);}}return _0x458460;}async['_loadRoot'](_0x4f39f6,_0x3dcb72,_0x55927d){this['_getOperationsFromInitData']({[_0x4f39f6]:_0x3dcb72},{[_0x4f39f6]:_0x55927d})['forEach']((_0x2c2d6,_0x5b31ad)=>{_0x2c2d6['baseVersion']=this['_document']['version']+_0x5b31ad,_0x2c2d6['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2c2d6);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x375564,_0x1ddcf2){let _0x206d72;this['_offset']=_0x375564['offset'];const _0x1813d4=_0x375564['wereChangesApplied']&&!_0x375564['initData'],_0x34ceae=_0x1813d4?0x0:_0x375564['data']['baseVersion'];if(_0x1ddcf2['forEach'](_0x525699=>{_0x525699['_isInit']=!0x0,_0x525699['createdAt']=_0x375564['sessionCreatedAt'],_0x525699['_authorId']=null;}),_0x1813d4)_0x206d72=_0x1ddcf2,this['_applyOperationsSet'](_0x206d72,_0x1813d4);else{if(_0x375564['initData']){const _0xa9e270=this['_getOperationsFromInitData'](_0x375564['initData']);this['_document']['history']['version']=-_0xa9e270['length'],_0xa9e270['forEach'](_0x919c2a=>{_0x919c2a['baseVersion']-=_0xa9e270['length'],_0x919c2a['createdAt']=_0x375564['sessionCreatedAt'],_0x919c2a['_isInit']=!0x0,_0x919c2a['_authorId']=null;}),this['_applyOperationsSet'](_0xa9e270,!0x0),this['serverHistory']['version']=-_0xa9e270['length']+this['_offset'],this['_updateServerHistory'](_0xa9e270);}this['_document']['history']['version']=_0x34ceae,_0x206d72=this['_decompressOperations'](_0x375564['data'],_0x375564['metadata']),await this['_fetchMissingUsers'](_0x206d72),this['_applyOperationsSet'](_0x206d72,_0x1813d4);}_0x375564['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x206d72,_0x375564['lastOperationId']),this['_lastSyncedOperationId']=_0x375564['lastOperationId']),this['serverHistory']['version']=_0x34ceae+this['_offset'],this['_updateServerHistory'](_0x206d72),_0x1ddcf2['filter'](_0x4d8220=>{const _0x184ee3=this['_getAffectedRoot'](_0x4d8220);return _0x184ee3&&!this['_knownRootNames']['has'](_0x184ee3);})['forEach']((_0x231dd1,_0x32c3e2)=>{_0x231dd1['baseVersion']=this['_document']['version']+_0x32c3e2,this['_saveOperationInBuffer'](_0x231dd1);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x53adb1,_0x2fce4a){const _0x368fb3=_0x2fce4a&&_0x2fce4a['message'];if(_0x368fb3&&_0x368fb3['startsWith']('realtimecollaborationclient'))throw _0x2fce4a;const _0xe778c8=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0xe778c8['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x9c1d4e(_0x53adb1,this['editor'],_0x368fb3?{'originalError':_0x368fb3}:void 0x0);}['_saveOperationInBuffer'](_0x13d42a){this['_knownOperations']['has'](_0x13d42a)||(this['_knownOperations']['add'](_0x13d42a),this['_bufferedOperations']['push'](_0x13d42a),this['_pendingAction']||'marker'==_0x13d42a['type']&&!_0x13d42a['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x11ba13=!0x1){!_0x11ba13&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x68a190=>{_0x68a190&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x543396=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x38dbde){return _0x38dbde['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x38dbde['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x38dbde['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x543396)||this['_crash'](_0x543396['message'],_0x543396);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x41bab3=>{this['on']('change:_isPendingUpdate',()=>{_0x41bab3();});});}async['_sendBufferedOperations'](){const _0x42e7c3=this['editor']['plugins']['get'](q);if(this['_shouldSendSelectionUpdate']()&&(_0x42e7c3['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x17b22c=[...this['_bufferedOperations']];for(const _0x2d878e of _0x17b22c)_0x2d878e['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x2d878e);const _0x199b05=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x17b22c),_0x5c60a2=J++,_0x924cac=this['_compressOperations'](_0x17b22c),_0x362f6d=await this['_service']['sendOperations'](_0x924cac,_0x924cac['baseVersion'],_0x199b05);try{return await this['_handleServerResponse'](_0x17b22c,_0x362f6d,_0x5c60a2);}catch(_0x3c6e8a){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3c6e8a);}}async['_handleServerResponse'](_0x557bbf,_0x2981a3,_0x22a495){if('error'in _0x2981a3)throw _0x2981a3['error'];let _0x3f7f1b=!0x1;if(_0x2981a3['wereChangesApplied']){_0x2981a3['lastOperationId']&&(this['_lastSyncedOperationId']=_0x2981a3['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x541e77=>!_0x557bbf['includes'](_0x541e77));for(const _0xec11c of _0x557bbf)_0xec11c['createdAt']='lastOperationAcceptedAt'in _0x2981a3&&_0x2981a3['lastOperationAcceptedAt']||void 0x0;X(_0x557bbf,_0x2981a3['version']-_0x557bbf['length']),this['_updateServerHistory'](_0x557bbf);const _0x376fd8=_0x557bbf['filter'](_0x208b95=>{if(!_0x208b95['_isInit'])return!0x1;const _0x479ac9=this['_getAffectedRoot'](_0x208b95);return _0x479ac9&&!this['_knownRootNames']['has'](_0x479ac9);});X(_0x376fd8,this['_document']['version']),this['_applyOperationsSet'](_0x376fd8),_0x3f7f1b=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1bcc7e=this['_decompressOperations'](_0x2981a3['data'],_0x2981a3['metadata'])['filter'](_0x21bf27=>_0x21bf27['baseVersion']>=this['_lastServerVersion']);_0x1bcc7e['forEach'](_0x149c71=>this['_addKnownRoot'](_0x149c71)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x4b8cc6=>!_0x4b8cc6['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x4b8cc6))),this['_bufferedOperations']['length']&&X(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1bcc7e),_0x3f7f1b=this['_handleExternalOperations'](_0x1bcc7e,_0x2981a3['version'],_0x2981a3['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x3f7f1b?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x3934b6,_0xe6eccc,_0x4d6b63){try{const _0x5056e5={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x3aa007,operationsB:_0x37c050,originalOperations:_0xa2969}=_0x69da3a(_0x3934b6,this['_bufferedOperations'],_0x5056e5);X(_0x3aa007,this['_document']['version']),X(_0x37c050,_0xe6eccc);for(const _0x193309 of _0x3aa007){const _0x23e4b0=_0xa2969['get'](_0x193309);_0x193309['_authorId']=_0x23e4b0?_0x23e4b0['_authorId']:null;}_0x4d6b63&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3934b6,_0x4d6b63),this['_lastSyncedOperationId']=_0x4d6b63),this['_bufferedOperations']=[..._0x37c050],this['_applyOperationsSet'](_0x3aa007),this['_updateServerHistory'](_0x3934b6);}catch(_0x1f4552){return console['error'](_0x1f4552),!0x1;}return!0x0;}['_applyOperationsSet'](_0x1de60d,_0x1e91e5=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x3a9f1e=>{for(const _0x2c4111 of _0x1de60d)this['_knownOperations']['add'](_0x2c4111),this['_addKnownRoot'](_0x2c4111),_0x3a9f1e['batch']['addOperation'](_0x2c4111),this['editor']['model']['applyOperation'](_0x2c4111);});}['_addKnownRoot'](_0x4607d0){const _0x589f4a=this['_getAffectedRoot'](_0x4607d0);_0x589f4a&&this['_knownRootNames']['add'](_0x589f4a);}['_getAffectedRoot'](_0x293906){let _0x115cf7,_0x24572c;switch(_0x293906['type']){case'insert':_0x115cf7=_0x293906['position']['root'];break;case'marker':if(_0x24572c=_0x293906['newRange'],!_0x24572c)return null;_0x115cf7=_0x24572c['root'];break;case'addRootAttribute':_0x115cf7=_0x293906['root'];break;case'addRoot':_0x115cf7=_0x293906['affectedSelectable'];break;case'move':_0x115cf7=_0x293906['targetPosition']['root'];break;default:return null;}return _0x115cf7['rootName'];}['_updateServerHistory'](_0x8a4b87){_0x8a4b87['forEach'](_0x2571f2=>{const _0x482482=_0x2571f2['clone']();_0x482482['_authorId']=_0x2571f2['_authorId'],_0x482482['_isInit']=!!_0x2571f2['_isInit'],_0x482482['createdAt']=_0x2571f2['createdAt'],_0x482482['baseVersion']+=this['_offset'],_0x2571f2['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x482482),this['serverHistory']['addOperation'](_0x482482);});}['_handleReconnectionError'](_0xfcd941){const _0x57b51c=this['editor']['plugins']['get']('Notification'),_0x2c22bb=this['editor']['locale'];_0xfcd941||(_0xfcd941=G(_0x2c22bb,'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.')),_0x57b51c['showWarning'](_0xfcd941,{'title':G(_0x2c22bb,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x5b9ce0)['add'](G(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x5b9ce0)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x44e33f){const _0x1c9cdc=_0x44e33f['map'](_0x178c78=>_0x178c78['toJSON']());return this['_compressor']['compress'](_0x1c9cdc);}['_decompressOperations'](_0x2ae521,_0x2afb53){return this['_compressor']['decompress'](_0x2ae521)['map']((_0x438722,_0x1de0d7)=>{const _0x2bb8c1='init'==_0x2afb53[_0x1de0d7]['type'];if('InsertOperation'==_0x438722['__className']){const _0x222462=_0x438722['position']['root'];!this['_document']['getRoot'](_0x222462)&&(this['_document']['createRoot']('$root',_0x222462)['_isAttached']=!0x1);}const _0x201a5c=_0x57cd0a['fromJSON'](_0x438722,this['_document']);return _0x201a5c['wasUndone']=_0x438722['wasUndone'],_0x201a5c['_isInit']=_0x2bb8c1,_0x201a5c['_authorId']=_0x2bb8c1?null:_0x2afb53[_0x1de0d7]['userId'],_0x201a5c['_isDisconnection']='cs:removeUser'===_0x2afb53[_0x1de0d7]['type'],_0x201a5c['createdAt']=_0x2afb53[_0x1de0d7]['createdAt'],_0x201a5c;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x3293f5=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3293f5&&_0x3293f5['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Q extends Error{}function X(_0x59ee14,_0x39a8da){for(const _0x296b5f of _0x59ee14)_0x296b5f['baseVersion']=_0x39a8da++;}class Y{['_ignoredOperations'];['_operationToId'];constructor(_0x16b7a0){this['_ignoredOperations']=_0x16b7a0,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x231f57){let _0x1986bd=_0x231f57['length'];for(;_0x1986bd--;){const _0x3abe65=_0x231f57[_0x1986bd];if(!this['_ignoredOperations']['has'](_0x3abe65)){if(!this['_operationToId']['has'](_0x3abe65)){const _0x33e658=_0x1416ae()['slice'](0x1,0x12);this['_operationToId']['set'](_0x3abe65,_0x33e658);}return this['_operationToId']['get'](_0x3abe65);}}}['setIdForTheLastOperation'](_0x304f21,_0x2dfa6b){if(!_0x2dfa6b)return;let _0x6592c0=_0x304f21['length'];for(;_0x6592c0--;){const _0x4b5ca4=_0x304f21[_0x6592c0];this['_ignoredOperations']['has'](_0x4b5ca4)||this['_operationToId']['set'](_0x4b5ca4,_0x2dfa6b);}}}class n extends _0x101618{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x42e636{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x468d30)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x5f0649];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5c2900){super(_0x5c2900),this['_services']=new Map();}async['init'](){const _0x464e3c=this['context'],_0x5c5db0=_0x464e3c['plugins']['get']('CommentsRepository');if(_0x464e3c['plugins']['get'](c)['addToReconnectionStack'](this),_0x5c5db0['adapter']={'addCommentThread':async({channelId:_0x22b343,threadId:_0xd3bfa9,comments:_0x481fbc,resolvedAt:_0x4b629d,resolvedBy:_0x499d7a,context:_0x174193,attributes:_0x1ef0c4})=>{const _0x117f03=await this['_getService'](_0x22b343)['addCommentThread']({'commentThreadId':_0xd3bfa9,'comments':_0x481fbc['map'](_0x4b96f3=>function(_0x113c16,_0x30042a,_0x4c37f6){return{'commentThreadId':_0x4c37f6,'commentId':_0x113c16['commentId'],'userId':_0x113c16['authorId'],'content':_0x113c16['content'],'documentId':_0x30042a,'createdAt':_0x113c16['createdAt'],'attributes':_0x113c16['attributes']||{}};}(_0x4b96f3,_0x22b343,_0xd3bfa9)),'resolvedAt':_0x4b629d,'resolvedBy':_0x499d7a,'context':_0x174193,'attributes':_0x1ef0c4})['catch'](ut);return{'threadId':_0x117f03['commentThreadId'],'comments':_0x117f03['comments']};},'getCommentThread':async({channelId:_0x16541a,threadId:_0x57c2d8})=>{const _0x57e844=await this['_getService'](_0x16541a)['getCommentThread'](_0x57c2d8)['catch'](ut);return _0x57e844['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x57e844]),{'threadId':_0x57e844['commentThreadId'],'comments':_0x57e844['comments']['map'](b),'context':_0x57e844['context'],'resolvedAt':_0x57e844['resolvedAt'],'resolvedBy':_0x57e844['resolvedBy'],'attributes':_0x57e844['attributes']||{}});},'updateCommentThread':async({channelId:_0x310c1f,threadId:_0xd4fb8c,context:_0x337dac,unlinkedAt:_0x4e4a19,attributes:_0x48ab23})=>this['_getService'](_0x310c1f)['updateCommentThread']({'commentThreadId':_0xd4fb8c,'context':_0x337dac,'attributes':_0x48ab23,'unlinkedAt':_0x4e4a19})['catch'](y)['catch'](ut),'resolveCommentThread':async({channelId:_0x55908b,threadId:_0x75fcdb})=>{const _0xdffbab=await this['_getService'](_0x55908b)['resolveCommentThread'](_0x75fcdb)['catch'](y)['catch'](ut);return{'threadId':_0xdffbab['commentThreadId'],'resolvedAt':_0xdffbab['resolvedAt'],'resolvedBy':_0xdffbab['resolvedBy']};},'reopenCommentThread':async({channelId:_0xcb430b,threadId:_0xb02e0})=>this['_getService'](_0xcb430b)['reopenCommentThread'](_0xb02e0)['catch'](y)['catch'](ut),'removeCommentThread':({channelId:_0x1c5fab,threadId:_0x4cbac6})=>this['_getService'](_0x1c5fab)['removeCommentThread'](_0x4cbac6)['catch'](y)['catch'](ut),'addComment':({channelId:_0x47f087,threadId:_0x3b1bfb,commentId:_0x5eb965,content:_0x354659,attributes:_0x151135})=>this['_getService'](_0x47f087)['addComment'](_0x3b1bfb,_0x5eb965,_0x354659,_0x151135)['catch'](ut),'updateComment':({channelId:_0x58a176,threadId:_0x4e6cbc,commentId:_0x42b3e,content:_0x2c51fa,attributes:_0x1ad1ab})=>this['_getService'](_0x58a176)['updateComment'](_0x4e6cbc,_0x42b3e,_0x2c51fa,_0x1ad1ab)['catch'](y)['catch'](ut),'removeComment':({channelId:_0x1123d1,threadId:_0x4fe38c,commentId:_0x2fe0f7})=>this['_getService'](_0x1123d1)['removeComment'](_0x4fe38c,_0x2fe0f7)['catch'](y)['catch'](ut)},_0x464e3c instanceof _0xe89c7){const _0x2fd411=_0x464e3c['config']['get']('collaboration.channelId'),_0x201706=_0x464e3c['plugins']['get'](i);await this['_setUpService'](_0x2fd411);const _0x599168=await this['_services']['get'](_0x2fd411)['getConnectedSessions']();this['listenTo'](_0x201706,'sessionAdd:'+_0x2fd411,(_0x4d586c,{session:_0x396a79})=>{_0x396a79['id']===_0x201706['mySessionId']&&(_0x4d586c['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x396a79['permissions'],_0x2fd411));}),_0x201706['register'](_0x2fd411,_0x599168);}}async['_setUpService'](_0x5cf746){if(this['_services']['has'](_0x5cf746))throw new _0x9c1d4e('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x5cf746});const _0x41b4c2=this['context']['plugins']['get']('CommentsRepository'),_0x10e6d4=new a['CommentsService'](_0x5cf746);this['_services']['set'](_0x5cf746,_0x10e6d4),this['listenTo'](_0x10e6d4,'commentThreadAdded',(_0x11d5d7,_0x5307dd)=>{const {commentThreadId:_0x37f4c5,documentId:_0x4c4acb,context:_0x225e8c,attributes:_0x52222f,resolvedAt:_0x2f5e74,resolvedBy:_0x192b31,comments:_0x35492d}=_0x5307dd;_0x41b4c2['getCommentThread'](_0x37f4c5)||_0x41b4c2['addCommentThread']({'threadId':_0x37f4c5,'channelId':_0x4c4acb,'comments':_0x35492d?_0x35492d['map'](b):[],'context':_0x225e8c,'attributes':_0x52222f,'resolvedAt':_0x2f5e74,'resolvedBy':_0x192b31,'isFromAdapter':!0x0});}),this['listenTo'](_0x10e6d4,'commentThreadUpdated',(_0x825087,{commentThreadId:_0x1c3071,documentId:_0x5d0dee,context:_0x59f65e,unlinkedAt:_0x5c6de4,attributes:_0x38cc4d})=>{_0x41b4c2['getCommentThread'](_0x1c3071)&&_0x41b4c2['updateCommentThread']({'threadId':_0x1c3071,'channelId':_0x5d0dee,'context':_0x59f65e,'unlinkedAt':_0x5c6de4,'attributes':_0x38cc4d,'isFromAdapter':!0x0});}),this['listenTo'](_0x10e6d4,'commentThreadResolved',(_0x223d58,{commentThreadId:_0x4911ef,resolvedBy:_0x26b8a4,resolvedAt:_0xea16ca})=>{const _0x3ab314=_0x41b4c2['getCommentThread'](_0x4911ef);_0x3ab314&&_0x3ab314['resolve']({'resolvedBy':_0x26b8a4,'resolvedAt':_0xea16ca,'isFromAdapter':!0x0});}),this['listenTo'](_0x10e6d4,'commentThreadReopened',(_0x34b397,{commentThreadId:_0x3759a2})=>{const _0x2af1c1=_0x41b4c2['getCommentThread'](_0x3759a2);_0x2af1c1&&_0x2af1c1['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x10e6d4,'commentThreadRemoved',(_0x362491,{commentThreadId:_0x1329ab})=>{const _0x51332b=_0x41b4c2['getCommentThread'](_0x1329ab);_0x51332b&&_0x51332b['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x10e6d4,'commentAdded',(_0x4c6f3b,_0x280030)=>{const _0x2ee435=_0x280030['commentThreadId'],_0x26af45=_0x41b4c2['getCommentThread'](_0x2ee435);_0x26af45&&_0x26af45['addComment']({...b(_0x280030),'isFromAdapter':!0x0});}),this['listenTo'](_0x10e6d4,'commentUpdated',(_0x48ab9c,{commentThreadId:_0xde085d,commentId:_0x115547,content:_0x2e6c37,attributes:_0x40fba2})=>{const _0x99a8b1=_0x41b4c2['getCommentThread'](_0xde085d);if(_0x99a8b1){const _0x34dec6=_0x99a8b1['getComment'](_0x115547);_0x34dec6&&_0x34dec6['update']({'content':_0x2e6c37,'attributes':_0x40fba2,'isFromAdapter':!0x0});}}),this['listenTo'](_0x10e6d4,'commentRemoved',(_0x62cb21,{commentThreadId:_0x51bb9d,commentId:_0x5316a0})=>{const _0x4ce726=_0x41b4c2['getCommentThread'](_0x51bb9d);if(_0x4ce726){const _0x43ad82=_0x4ce726['getComment'](_0x5316a0);_0x43ad82&&_0x43ad82['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x5cf746);}['destroy'](){if(this['context']instanceof _0xe89c7){const _0x534772=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x534772);}}['_terminateService'](_0x5b7a44){if(!this['_services']['has'](_0x5b7a44))throw new _0x9c1d4e('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x5b7a44});this['_getService'](_0x5b7a44)['disconnect'](),this['_services']['delete'](_0x5b7a44);}async['reconnect'](){for(const _0x373123 of this['_services']['keys']())await this['_connectService'](_0x373123);if(this['context']instanceof _0xe89c7){const _0x1947a1=this['context']['config']['get']('collaboration.channelId'),_0x29a9f7=this['context']['plugins']['get'](i);_0x29a9f7['unregister'](_0x1947a1);const _0x14d0d7=await this['_services']['get'](_0x1947a1)['getConnectedSessions']();_0x29a9f7['register'](_0x1947a1,_0x14d0d7);}}async['_connectService'](_0x595833){const {connection:_0x485c69}=this['context']['plugins']['get'](c),_0x569669=this['context']['plugins']['get']('CommentsRepository'),_0x43e95e=this['_services']['get'](_0x595833),_0x10925c=await _0x43e95e['connect'](_0x485c69);await this['_fetchMissingUsersForThreads'](_0x10925c);const _0x5d51e7=new Set(Array['from'](_0x569669['getCommentThreads']({'channelId':_0x595833}),_0x2ca030=>_0x2ca030['id']));for(const _0x46827f of _0x10925c)_0x46827f['deletedAt']||_0x5d51e7['delete'](_0x46827f['commentThreadId']);for(const _0xe53e9b of _0x5d51e7)_0x569669['getCommentThread'](_0xe53e9b)['remove']({'isFromAdapter':!0x0});for(const _0x48a404 of _0x10925c){let _0xb45d85=_0x569669['getCommentThread'](_0x48a404['commentThreadId']);const {commentThreadId:_0x5a761b,context:_0x120eed,attributes:_0x2cf1ae,resolvedBy:_0x36e740,resolvedAt:_0xac2f80,unlinkedAt:_0x45d247,deletedAt:_0x449d28}=_0x48a404;if(_0x449d28)continue;_0xb45d85||(_0xb45d85=_0x569669['addCommentThread']({'channelId':_0x595833,'threadId':_0x5a761b,'context':_0x120eed,'attributes':_0x2cf1ae||{},'resolvedBy':_0x36e740,'resolvedAt':_0xac2f80,'unlinkedAt':_0x45d247,'isFromAdapter':!0x0}));const _0x173386=new Set(Array['from'](_0xb45d85['comments'],_0x4844ac=>_0x4844ac['id']));for(const _0x1b5d95 of _0x48a404['comments'])_0x173386['delete'](_0x1b5d95['commentId']);for(const _0x26c83d of _0x173386)_0xb45d85['getComment'](_0x26c83d)['remove']({'isFromAdapter':!0x0});for(const _0x22c362 of _0x48a404['comments']){const _0x560115=_0xb45d85['getComment'](_0x22c362['commentId']);_0x560115?_0x560115['content']!==_0x22c362['content']&&_0x560115['update']({'content':_0x22c362['content'],'isFromAdapter':!0x0}):_0xb45d85['addComment'](Object['assign'](b(_0x22c362),{'isFromAdapter':!0x0}));}}}['_getService'](_0x386e26){if(!this['_services']['has'](_0x386e26))throw new _0x9c1d4e('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x386e26});return this['_services']['get'](_0x386e26);}async['_fetchMissingUsersForThreads'](_0x288c59){const _0xb49145=this['context']['plugins']['get'](_0x5f0649),{connection:_0x34832f}=this['context']['plugins']['get'](c),_0x41a9e9=new Set();for(const {resolvedBy:_0x39075e,comments:_0x3274b9}of _0x288c59){_0x39075e&&!_0xb49145['getUser'](_0x39075e)&&_0x41a9e9['add'](_0x39075e);for(const {userId:_0x245a9d}of _0x3274b9)_0xb49145['getUser'](_0x245a9d)||_0x41a9e9['add'](_0x245a9d);}if(0x0===_0x41a9e9['size'])return;const _0x477ccd=await dt['getMany'](_0x34832f,Array['from'](_0x41a9e9));for(const _0x5326ce of _0x477ccd)_0xb49145['getUser'](_0x5326ce['id'])||_0xb49145['addUser'](_0x5326ce);}}async function y(_0x320add){if('404'!==_0x320add['code'])throw _0x320add;}function ut(_0x3a9eb5){if((_0x34b0ef=_0x3a9eb5)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x34b0ef['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x34b0ef['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x34b0ef;throw _0x3a9eb5;}function b(_0x2a8f07){return{'threadId':_0x2a8f07['commentThreadId'],'commentId':_0x2a8f07['commentId'],'content':_0x2a8f07['content'],'createdAt':_0x2a8f07['createdAt'],'authorId':_0x2a8f07['userId'],'attributes':_0x2a8f07['attributes']||{}};}class f extends _0x101618{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(_0xdea358){super(_0xdea358);const _0x11e411=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x11e411);}['init'](){const _0x1d2d5d=this['editor']['plugins']['get'](c),_0x367abb=this['editor']['plugins']['get']('TrackChangesEditing');return _0x367abb['adapter']={'getSuggestion':async _0x3b3793=>{await this['_waitForServiceReady']();const _0x5f24da=await this['_trackChangesService']['get'](_0x3b3793)['catch'](w);return await this['_fetchMissingUsersForThreads']([_0x5f24da]),_0x5f24da;},'addSuggestion':async({id:_0x2afc86,type:_0x32c1f7,data:_0x27227c,originalSuggestionId:_0xb78091,attributes:_0x15462e})=>{await this['_waitForServiceReady']();const _0x4f5464={'id':_0x2afc86,'type':_0x32c1f7,'data':_0x27227c,'originalSuggestionId':_0xb78091,'attributes':_0x15462e},_0x56eb6f=await this['_trackChangesService']['add'](_0x2afc86,_0x32c1f7,_0x27227c,_0xb78091,_0x15462e)['catch'](_0x542d38=>{if(ft(_0x542d38))return new Promise(_0x3e3060=>{this['_bufferedRequests']['set'](_0x2afc86,{'resolve':_0x3e3060,'suggestionData':_0x4f5464});});throw _0x542d38;});return this['_bufferedRequests']['delete'](_0x2afc86),_0x56eb6f;},'updateSuggestion':async(_0x2f857f,_0x54e367)=>{if(await this['_waitForServiceReady'](),'open'!==_0x54e367['state'])return this['_trackChangesService']['update'](_0x2f857f,_0x54e367)['catch'](w);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x3d3d22,_0x3dae5a)=>{_0x367abb['hasSuggestion'](_0x3dae5a['id'])&&(_0x367abb['getSuggestion'](_0x3dae5a['id'])['attributes']=_0x3dae5a['attributes']);}),this['_trackChangesService']['connect'](_0x1d2d5d['connection'])['then'](_0x4ddd75=>(_0x1d2d5d['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x4ddd75)['then'](()=>{for(const _0x24a0d3 of _0x4ddd75){_0x367abb['addSuggestionData'](_0x24a0d3)['_saved']=!0x0;}})));}async['reconnect'](){const _0x203957=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x12ee45}=this['editor']['plugins']['get'](c),_0x378aa9=await this['_trackChangesService']['connect'](_0x12ee45);await this['_fetchMissingUsersForThreads'](_0x378aa9);for(const {suggestionData:_0xf5f56d,resolve:_0x2fa63d}of this['_bufferedRequests']['values']()){let _0x2d77b3=_0x378aa9['find'](_0xe7caa7=>_0xe7caa7['id']===_0xf5f56d['id']);_0x2d77b3||(_0x2d77b3=await this['_trackChangesService']['add'](_0xf5f56d['id'],_0xf5f56d['type'],_0xf5f56d['data'],_0xf5f56d['originalSuggestionId'])),_0x2fa63d(_0x2d77b3);}for(const _0x2a7e29 of _0x378aa9)_0x203957['hasSuggestion'](_0x2a7e29['id'])||_0x203957['addSuggestionData'](_0x2a7e29);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x5774ce=>{this['listenTo'](this['_trackChangesService'],'connected',_0x1a0b96=>{_0x1a0b96['off'](),_0x5774ce();});});}async['_fetchMissingUsersForThreads'](_0x4e2e79){const _0x16ebc3=this['editor']['plugins']['get'](_0x5f0649),{connection:_0x177f9c}=this['editor']['plugins']['get'](c),_0x3e1efa=new Set();for(const {authorId:_0x4561c1}of _0x4e2e79)_0x16ebc3['getUser'](_0x4561c1)||_0x3e1efa['add'](_0x4561c1);if(0x0===_0x3e1efa['size'])return;const _0x318cf8=await dt['getMany'](_0x177f9c,Array['from'](_0x3e1efa));for(const _0x26af05 of _0x318cf8)_0x16ebc3['getUser'](_0x26af05['id'])||_0x16ebc3['addUser'](_0x26af05);}}function w(_0x1397ff){if(ft(_0x1397ff))return new Promise(()=>{});throw _0x1397ff;}function ft(_0x3b4a26){return _0x3b4a26['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3b4a26['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x101618{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 _0x473583=this['editor']['plugins']['get'](c),_0x13fd80=this['editor']['plugins']['get']('CommentsEditing'),_0x3f29d4=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x473583,'change:state',(_0x23f90e,_0x285160,_0x420533)=>{_0x13fd80['isThreadsLoadingPaused']='connected'!==_0x420533;});}),this['listenTo'](_0x473583,'change:state',(_0x14b0c6,_0x9a73fc,_0x41f7dc)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x41f7dc);}),_0x3f29d4['_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 _0x101618{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 _0x101618{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x5f0649];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4c2b1f){super(_0x4c2b1f);const _0x584d54=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x584d54);}async['init'](){const _0x20ac60=this['editor']['plugins']['get'](l),_0x1fd3be=_0x20ac60['serverHistory'],_0x293f59=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x1fd3be,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x20ac60['sessionId']});const _0x4514af=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x564e99=await tt['isBundleUploaded'](_0x293f59['connection'],_0x4514af);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x3e615d})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x3e615d)),'updateRevisions':async _0xe2deee=>{await this['_waitForServiceReady']();const _0xcea423=this['_revisionTracker']['currentRevision'];if(_0x564e99&&0x1===_0xe2deee['length']&&_0xe2deee[0x0]['id']===_0xcea423['id'])return _0xe2deee;for(const _0x33c617 of _0xe2deee)_0x33c617['id']===_0xcea423['id']&&(_0x33c617['isEmptyCurrent']=_0x33c617['fromVersion']===_0x33c617['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0xe2deee,this['_lastRequestId'])['then'](_0x3eb26a=>(this['_lastRequestId']=_0x3eb26a,_0xe2deee))['catch'](_0x26db97=>{if(st(_0x26db97)||'400'===_0x26db97['code']&&void 0x0!==_0x26db97['data']['wrongRequestId']){for(const _0x11f09b of _0xe2deee){!this['_revisionTracker']['repository']['getRevision'](_0x11f09b['id'])||this['_revisionTracker']['_bufferUpdate'](_0x11f09b['id'],_0x11f09b,!0x1);}if(st(_0x26db97))throw _0x26db97;return _0xe2deee;}throw _0x26db97;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x5590b3,{revisionsData:_0xdec175,requestId:_0xfbad0a})=>{Math['max'](..._0xdec175['map'](_0x48e0e7=>_0x48e0e7['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0xdec175,_0xfbad0a);}):this['_handleRevisionsUpdate'](_0xdec175,_0xfbad0a);});const {revisions:_0x4b1a9b,requestId:_0x2dc31d}=await this['_revisionHistoryService']['connect'](_0x293f59['connection']);_0x293f59['addToReconnectionStack'](this),this['_lastRequestId']=_0x2dc31d,await this['_fetchMissingUsers'](_0x4b1a9b);for(const _0x3333c8 of _0x4b1a9b)this['_revisionTracker']['addRevisionData'](_0x3333c8);this['listenTo'](_0x20ac60,'change:_isConnected',(_0x1f9dcc,_0x501902,_0x5e9b43)=>{_0x5e9b43&&(this['_oldOffset']=_0x20ac60['_offset'],_0x1f9dcc['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x293f59,'state',_0x21033e=>_0x21033e===_0x20e191['CONNECTED']);}async['reconnect'](){const _0x4d9af9=this['editor']['plugins']['get'](c),_0x5b7df0=this['editor']['plugins']['get'](l),_0x3eb374=async()=>{const _0x4c85bd=this['_revisionTracker']['currentRevision'],_0x36b93e=_0x4c85bd['id'],_0x295b69=_0x36b93e!==_0x5b7df0['sessionId'];if(_0x295b69){const _0x2c3b57=_0x5b7df0['_offset']-this['_oldOffset'],_0x5c89dc=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x4c85bd['toVersion']+_0x2c3b57!==_0x5c89dc){const _0x41ed65=_0x4c85bd['fromVersion']+_0x2c3b57,_0x1463a8=this['editor']['plugins']['get'](_0x5f0649),_0x4531fb=this['_revisionTracker']['buildRevisionData']({'revision':_0x4c85bd,'from':_0x41ed65,'to':_0x5c89dc});_0x4531fb['id']=_0x4c85bd['id'];const _0x4727f8=_0x4531fb['authorsIds']['map'](_0x2ccc1a=>_0x1463a8['getUser'](_0x2ccc1a));_0x4c85bd['_update']({..._0x4531fb,'authors':_0x4727f8},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x4c85bd['id'],_0x4531fb,!0x0);}this['_revisionTracker']['_startingVersion']=_0x5c89dc,(_0x4c85bd['toVersion']===_0x4c85bd['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x36b93e)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x36b93e),this['_revisionTracker']['_createCurrentRevision'](_0x5c89dc));}const {revisions:_0x99edc6,requestId:_0x55bbe0}=await this['_revisionHistoryService']['reconnect'](_0x4d9af9['connection'],this['_lastRequestId']);_0x295b69&&_0x99edc6['length']>0x0?_0x5b7df0['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x99edc6),this['_handleRevisionsUpdate'](_0x99edc6,_0x55bbe0),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5b7df0['_isConnected']?_0x3eb374():new Promise((_0x34abf7,_0x321ba7)=>{_0x5b7df0['once']('change:_isConnected',()=>{_0x3eb374()['then'](_0x34abf7)['catch'](_0x321ba7);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x2c38e7=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x334d46=>{_0x334d46['off'](),_0x2c38e7();});});}['_getLatestVersionFromServerOperations'](){const _0x4c240f=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x4f3268 of _0x4c240f)if('marker'!==_0x4f3268['type']||_0x4f3268['affectsData'])return _0x4f3268['baseVersion']+0x1;}['_getLatestVersion'](){const _0x3cad7c=this['editor']['plugins']['get'](l);return new Promise(_0x2ec22f=>{_0x3cad7c['_isPendingUpdate']?_0x3cad7c['once']('change:_isPendingUpdate',()=>{_0x2ec22f(this['_getLatestVersionFromServerOperations']());}):_0x2ec22f(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x5f244b,_0x7d5f11){const _0x2d6d56=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x7d5f11;for(const _0x25620b of _0x5f244b){const _0x150846=_0x2d6d56['getRevision'](_0x25620b['id']);if(_0x150846){if((_0x25620b['fromVersion']||_0x25620b['toVersion'])&&(_0x25620b['diffData']=null),_0x150846===this['_revisionTracker']['currentRevision']){const _0xe66e36=Math['max'](_0x150846['toVersion'],_0x25620b['toVersion']),_0x298979=Math['max'](_0x150846['fromVersion'],_0x25620b['fromVersion']);let _0x1975bf;_0x150846['toVersion']===_0x25620b['toVersion']&&_0x150846['fromVersion']===_0x25620b['fromVersion']?(_0x1975bf=!0x0,this['_preventResendingRevisionData'](_0x25620b)):_0x25620b['toVersion']===_0xe66e36&&_0x25620b['fromVersion']===_0x298979?_0x1975bf=!0x1:(_0x150846['toVersion']===_0xe66e36&&_0x150846['fromVersion']===_0x298979||this['_fixRevision']({'revision':_0x150846,'from':_0x298979,'to':_0xe66e36}),_0x1975bf=!0x0),_0x1975bf&&(delete _0x25620b['fromVersion'],delete _0x25620b['toVersion'],delete _0x25620b['diffData'],delete _0x25620b['createdAt'],delete _0x25620b['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x25620b),this['_preventResendingRevisionData'](_0x25620b);}else this['_revisionTracker']['addRevisionData'](_0x25620b);}const _0x5c68d6=_0x2d6d56['getRevisions']();_0x5c68d6['reverse']();for(let _0x2f3444=0x0;_0x2f3444<_0x5c68d6['length']-0x1;_0x2f3444++){const _0x276196=_0x5c68d6[_0x2f3444],_0x529d7c=_0x5c68d6[_0x2f3444+0x1];if(_0x276196['fromVersion']<_0x529d7c['toVersion']){const _0x168991=_0x529d7c['toVersion'],_0x5f212e=Math['max'](_0x168991,_0x276196['toVersion']);this['_fixRevision']({'revision':_0x276196,'from':_0x168991,'to':_0x5f212e});}}}['_fixRevision']({revision:_0x476c94,from:_0x2c2170,to:_0x3d8ad0}={}){const _0x4258fa=this['editor']['plugins']['get'](_0x5f0649),_0x547f76=this['_revisionTracker']['buildRevisionData']({'revision':_0x476c94,'from':_0x2c2170,'to':_0x3d8ad0});_0x547f76['authors']=_0x547f76['authorsIds']['map'](_0x207f65=>_0x4258fa['getUser'](_0x207f65)),_0x476c94['_update'](_0x547f76);}['_preventResendingRevisionData'](_0x595104){const _0x531446={};_0x531446['id']=_0x595104['id'];for(const _0x3b8bdf of Object['keys'](_0x595104))'id'!==_0x3b8bdf&&(_0x531446[_0x3b8bdf]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x531446['id'],_0x531446,!0x0);}async['_fetchMissingUsers'](_0x228aa6){const _0x4d2e0d=this['editor']['plugins']['get'](_0x5f0649),{connection:_0x3b058c}=this['editor']['plugins']['get'](c),_0x1b1918=new Set();for(const _0x2f234d of _0x228aa6){for(const _0x2a0318 of _0x2f234d['authorsIds'])_0x321d7e(_0x2a0318);_0x2f234d['creatorId']&&_0x321d7e(_0x2f234d['creatorId']);}if(0x0===_0x1b1918['size'])return;const _0x1f5499=await dt['getMany'](_0x3b058c,Array['from'](_0x1b1918));for(const _0x202020 of _0x1f5499)_0x4d2e0d['getUser'](_0x202020['id'])||_0x4d2e0d['addUser'](_0x202020);function _0x321d7e(_0x1d23a0){_0x4d2e0d['getUser'](_0x1d23a0)||_0x1b1918['add'](_0x1d23a0);}}}function st(_0x5adb0b){return _0x5adb0b['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x5adb0b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5adb0b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x101618{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class P extends _0x157a15{['_collapseAt'];constructor(_0x145ac9,_0x18db91=0x6){super(_0x145ac9);const _0xd05952=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x18db91,this['bind']('isHidden')['to'](this,'usersCount',_0x1cabff=>_0x1cabff<_0x18db91),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0xd05952['if']('isHidden','ck-presence-list__counter--hidden')],'role':'listitem'},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter']},'children':[{'tag':'div','attributes':{'class':['ck','ck-presence-list__users-counter__text']},'children':[{'text':_0xd05952['to']('usersCount',_0x219624=>'+'+(_0x219624-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x157a15{['items'];['keystrokes'];constructor(_0x210c64){super(_0x210c64);const _0x3e455a=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x135344(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x3e455a['if']('hasPopup'),'aria-expanded':_0x3e455a['to']('isExpanded',_0x5853e3=>this['hasPopup']&&String(_0x5853e3)),'aria-label':_0x3e455a['to']('hasPopup',_0x3cf8fc=>G(_0x210c64,_0x3cf8fc?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x3e455a['to']('hasPopup',_0x2c8b37=>!!_0x2c8b37&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x3e455a['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x3e455a['to'](_0x3526b2=>{const _0x4dd92e=_0x3526b2,_0x246199=document['querySelector']('.ck-presence-list__dropdown-list'),_0x311af5=document['querySelector']('.ck-balloon-panel_with-arrow');_0x246199?.['contains'](_0x4dd92e['relatedTarget'])||_0x311af5?.['contains'](_0x4dd92e['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x1cad54,_0x46d434,_0x1dcd63)=>{this['element']&&(_0x1dcd63?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 _0x157a15{['counterView'];['inlineListView'];constructor(_0x5a96ac,_0x2781f0=0x6){super(_0x5a96ac);const _0x2b64b6=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new P(this['locale'],_0x2781f0),this['inlineListView']=new ts(_0x5a96ac),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x44344e of this['inlineListView']['items'])_0x44344e['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',_0x2b64b6['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class D extends _0x157a15{['listWrapperView'];constructor(_0x3b04c1,_0x1b2a76){super(_0x3b04c1);const _0x508f91=this['bindTemplate'];this['listWrapperView']=new mt(_0x3b04c1,_0x1b2a76),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':G(_0x3b04c1,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x508f91['to'](_0x2e7ad9=>{const _0x165521=_0x2e7ad9,_0x2437d6=document['querySelector']('.ck-presence-list__list'),_0x437fd0=document['querySelector']('.ck-balloon-panel_with-arrow');_0x2437d6?.['contains'](_0x165521['relatedTarget'])||_0x437fd0?.['contains'](_0x165521['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class mt extends _0x13123e{constructor(_0x45b271,_0x40bc81){super(_0x45b271);const _0x4b31bd=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x40bc81?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x4b31bd['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x4b31bd['to']('role'),'aria-label':_0x4b31bd['to']('ariaLabel'),'aria-labelledby':_0x4b31bd['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x3b3485['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x52d734=this['element'];_0x52d734&&(this['_isScrollable']=Math['max'](_0x52d734['scrollHeight'],_0x52d734['clientHeight'])>0.8*window['innerHeight']);}}class U extends rt{['userView'];constructor(_0x19fb62,_0x3f445f,_0x191d45){super(_0x19fb62);const _0x2f7e5e=this['bindTemplate'];this['userView']=new ct(_0x19fb62,_0x3f445f);const _0x3d24b7={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x3f445f['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x3f445f['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3f445f['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x191d45&&(_0x3d24b7['tag']='button',_0x3d24b7['on']={'click':_0x2f7e5e['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x3d24b7);}['focus'](){this['element']['focus']();}}class V extends _0x157a15{['userView'];['markerView'];constructor(_0x36a1ca,_0x3ad1d6,_0x3354d2){super(_0x36a1ca);const _0x3029fa=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x36a1ca,_0x3ad1d6),this['markerView']=new at(_0x36a1ca,_0x3ad1d6);const _0x59d38b=new ot(_0x36a1ca);_0x59d38b['template']['tag']='span',_0x59d38b['text']=_0x3ad1d6['name'];const _0x3a4c9d={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x3029fa['to']('isFocusable',_0x2a7fca=>!!_0x2a7fca&&0x0),'aria-labelledby':_0x59d38b['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x3029fa['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x3029fa['to']('hasTooltip',_0x5112f4=>!_0x5112f4),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x59d38b]};_0x3354d2&&(_0x3a4c9d['tag']='button',_0x3a4c9d['on']={'click':_0x3029fa['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x3a4c9d);}}class at extends _0x157a15{constructor(_0x140a59,_0x11b5ee){super(_0x140a59),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x11b5ee['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const E={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x42e636{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x565cda){super(_0x565cda),this['context']['config']['define']('presenceList',E);const _0x5bcac9=_0x565cda['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x5bcac9)throw new _0x9c1d4e('presencelist-collapseat-invalid-format',this);if(_0x5bcac9<0x1)throw new _0x9c1d4e('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x4af4f4(),this['balloonPanelView']=new _0x3c08a0(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x31ca2b of this['_allConnectedUsers'])this['_handleUserAdd'](_0x31ca2b);this['listenTo'](this['_allConnectedUsers'],'add',(_0xcee5ab,_0x494851)=>{this['_handleUserAdd'](_0x494851);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x45fffe,_0x58a450)=>{this['_handleUserRemove'](_0x58a450);});}['_createView'](){const _0x5a44c7=this['context'],_0x3b1acb=new _(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x32f29f=this['balloonPanelView'];if(!_0x185eae(_0x5a44c7['config']['get']('presenceList.container')))throw new _0x9c1d4e('presencelist-missing-container',this);return _0x3b1acb['counterView']['bind']('usersCount')['to'](this),_0x3b1acb['bind']('isCollapsed')['to'](this,'usersCount',_0xd8830=>{const {collapseAt:_0x42574b}=_0x5a44c7['config']['get']('presenceList'),_0x1aa537=_0xd8830>=_0x42574b;if(_0x1aa537&&!_0x3b1acb['inlineListView']['items']['find'](_0x1a9306=>_0x1a9306 instanceof P)){const _0x5841ac=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x5841ac&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x3b1acb['inlineListView']['items']['add'](_0x3b1acb['counterView']);}return _0x1aa537||this['hideDropdown'](),_0x1aa537;}),_0x3b1acb['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x252be8=>{const _0x1633fa=_0x5a44c7['config']['get']('presenceList'),_0xc0b780=new V(_0x5a44c7['locale'],_0x252be8,!!_0x1633fa['onClick']);return _0xc0b780['bind']('hasTooltip')['to'](_0x3b1acb,'isCollapsed',_0x20c212=>!_0x20c212),_0xc0b780['bind']('isFocusable')['to'](_0x3b1acb,'isCollapsed',_0x10ef2b=>!_0x10ef2b),_0x1633fa['onClick']&&this['listenTo'](_0xc0b780,'execute',()=>{this['view']['isCollapsed']||_0x1633fa['onClick'](_0x252be8,_0xc0b780['element']);}),_0xc0b780;}),this['listenTo'](_0x3b1acb['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x3b1acb['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x3b1acb['inlineListView']['keystrokes']['set']('Enter',(_0x274b1b,_0x498602)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x498602());}),_0x3b1acb['render'](),_0x32f29f['render'](),_0x188faf({'emitter':_0x3b1acb,'activator':()=>_0x32f29f['isVisible'],'contextElements':[_0x32f29f['element'],_0x3b1acb['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x5a44c7['config']['get']('presenceList.container')['appendChild'](_0x3b1acb['element']),this['_bodyCollection']=new _0x4fb312(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x3b1acb;}['_handleUserAdd'](_0x513a0b){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x513a0b['isMe'])return;const _0x34ffa4=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x34ffa4-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x2cef83=_0x513a0b['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x513a0b,_0x2cef83);}['_handleUserRemove'](_0x47f8f8){this['usersCount']--;const {collapseAt:_0x372c06}=this['context']['config']['get']('presenceList'),_0x4c6059=this['usersCount']>=_0x372c06;if(this['currentDisplayedUsers']['get'](_0x47f8f8['id']))this['currentDisplayedUsers']['remove'](_0x47f8f8['id']);else{if(_0x4c6059&&this['currentDisplayedUsers']['length']+0x1===_0x372c06-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x4c6059?0x1:0x0)<this['usersCount']){for(const _0x20270b of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x20270b['id'])&&(this['currentDisplayedUsers']['add'](_0x20270b,Math['min'](this['currentDisplayedUsers']['length']-(_0x4c6059?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x4c6059?0x1:0x0)===_0x372c06-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x11d0c7=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new D(this['context']['locale'],!!_0x11d0c7['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x5be7b8}=this['presenceDropdownView'];_0x5be7b8['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x44da56=>{if(!_0x11d0c7['displayMe']&&_0x44da56['isMe'])return null;const _0x3a231b=new U(this['context']['locale'],_0x44da56,!!_0x11d0c7['onClick']);return _0x11d0c7['onClick']&&this['listenTo'](_0x3a231b,'execute',()=>{_0x11d0c7['onClick'](_0x44da56,_0x3a231b['element']);}),_0x3a231b;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x5be7b8['focus'](),_0x5be7b8['checkIfScrollable']();const _0x3c460e=(_0xaa9dbe,_0x1e2996)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x1e2996();};_0x5be7b8['keystrokes']['set']('Esc',_0x3c460e),_0x5be7b8['keystrokes']['set']('Shift+Tab',_0x3c460e),_0x5be7b8['keystrokes']['set']('Tab',(_0x1face4,_0x3a3945)=>{!function(_0x470259){const _0x19b6dd=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x15556f=>_0x15556f+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x5251f3=[...document['body']['querySelectorAll'](_0x19b6dd)]['filter'](_0x4636f4=>_0x4636f4===document['activeElement']||_0x4636f4['offsetWidth']+_0x4636f4['offsetHeight']>0x0)['sort']((_0x542eaa,_0x43cd69)=>(_0x542eaa['tabIndex']||0x0)-(_0x43cd69['tabIndex']||0x0)),_0xfdebae=_0x5251f3['indexOf'](_0x470259),_0x5489b3=_0x5251f3[(_0xfdebae+0x1)%_0x5251f3['length']];_0x5489b3&&_0x5489b3['focus']();}(this['view']['element']),this['hideDropdown'](),_0x3a3945();}),_0x5be7b8['focusTracker']['add'](this['view']['element']),_0x5be7b8['focusTracker']['on']('change:isFocused',(_0x22b2f1,_0x431d5b,_0x181131)=>{_0x181131||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 _0x42e636{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,r as PresenceListUI,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges,i as Sessions};
|