@ckeditor/ckeditor5-real-time-collaboration 48.1.1 → 48.2.0-alpha.1
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/dist/index.js +6 -6
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>_0x38b55b)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return[_0x162121,_0x532a35];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x14bba5){super(_0x14bba5),this['set']('state',_0x4e17ce['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x3daabf())();}['init'](){const _0x4d14d8=this['context'],_0x429829=_0x4d14d8['plugins']['get'](_0x162121),_0x2ac04c=_0x4d14d8['plugins']['get'](_0x532a35);if(!_0x429829['token'])throw new _0x146074('websocketgateway-missing-token',this);if(!_0x429829['webSocketUrl'])throw new _0x146074('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),WebSocketGateway['WebSocketGateway']['connect'](_0x429829['token'],_0x429829['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x391952=>{if(this['connection']=_0x391952,this['bind']('state')['to'](_0x391952,'state',this,'_isBrowserOffline',(_0x361914,_0x2f4a41)=>('connected'!==_0x361914&&(this['_shouldPluginsReconnect']=!0x0),_0x2f4a41||_0x361914!==_0x4e17ce['CONNECTED']?_0x4e17ce['DISCONNECTED']:this['state']==_0x4e17ce['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x4e17ce['CONNECTING']):_0x4e17ce['CONNECTED'])),this['connection']['on']('error',(_0x2855ec,_0x1c0ff7)=>{if('limitExceeded'!==_0x1c0ff7['code'])throw console['error'](_0x1c0ff7),new _0x146074('cloudservices-init',null,{'originalError':_0x1c0ff7});_0x2ac04c['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'});}),!_0x391952['me'])return new Promise(_0x299c39=>_0x391952['on']('change:me',_0x299c39));})['catch'](_0xa2723b=>{throw console['error'](_0xa2723b),new _0x146074('cloudservices-init',null,{'originalError':_0xa2723b});});}['addToReconnectionStack'](_0x1ea049){if('function'!=typeof _0x1ea049['reconnect'])throw new _0x146074('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x1ea049))throw new _0x146074('websocketgateway-plugin-already-registered',this,{'name':_0x1ea049['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x1ea049);}['removeFromReconnectionStack'](_0x5e8d8c){this['_reconnectionStack']['delete'](_0x5e8d8c);}['isInReconnectionStack'](_0x195352){return this['_reconnectionStack']['has'](_0x195352);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x4e12cf=>_0x4e12cf['reconnect']())))['then'](()=>this['state']=_0x4e17ce['CONNECTED'])['catch'](_0x75db37=>{throw console['error'](_0x75db37),new _0x146074('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x4e17ce['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class Sessions extends _0x1b9cff{['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[WebSocketGateway,_0x3e9224];}constructor(_0x1e08b9){super(_0x1e08b9),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x340917(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x3e9224);}['init'](){const _0x2ca04c=this['context']['plugins']['get'](WebSocketGateway);this['listenTo'](_0x2ca04c,'change:state',(_0x1ec655,_0x4ed08a,_0x18a927)=>{if('connected'!==_0x18a927)this['channelSessions']['forEach'](_0x372c72=>_0x372c72['clear']()),this['channelConnectedUsers']['forEach'](_0x417c1a=>_0x417c1a['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x17c5b8,_0x353fcf]of this['_registeredSessions'])for(const _0x1a5374 of _0x353fcf)this['_handleSessionAdd'](_0x17c5b8,_0x1a5374);}}),this['_createUser'](_0x2ca04c['connection']['me'],!0x0);}['register'](_0x577280,_0xf6e01){if(this['_registeredSessions']['has'](_0x577280))throw new _0x146074('sessions-register-already-registered',null,{'channelId':_0x577280});this['_registeredSessions']['set'](_0x577280,_0xf6e01),this['channelSessions']['set'](_0x577280,new _0x340917()),this['channelConnectedUsers']['set'](_0x577280,new _0x340917()),this['listenTo'](_0xf6e01,'add',(_0x53a7e0,_0xcb8861)=>this['_handleSessionAdd'](_0x577280,_0xcb8861)),this['listenTo'](_0xf6e01,'remove',(_0x4afd8a,_0x1b2703)=>this['_handleSessionRemove'](_0x577280,_0x1b2703));for(const _0xc0262c of _0xf6e01)this['_handleSessionAdd'](_0x577280,_0xc0262c);}['unregister'](_0x869e36){if(!this['_registeredSessions']['has'](_0x869e36))throw new _0x146074('sessions-unregister-not-exist',null,{'channelId':_0x869e36});const _0xb493df=this['_registeredSessions']['get'](_0x869e36);this['stopListening'](_0xb493df);for(const _0x201a20 of _0xb493df)'connected'===this['context']['plugins']['get'](WebSocketGateway)['state']&&this['_handleSessionRemove'](_0x869e36,_0x201a20);this['_registeredSessions']['delete'](_0x869e36),this['channelSessions']['delete'](_0x869e36),this['channelConnectedUsers']['delete'](_0x869e36);}get['mySessionId'](){return this['context']['plugins']['get'](WebSocketGateway)['connection']['sessionId'];}['getUserBySessionId'](_0x2d6edc){for(const _0x130710 of this['channelSessions']['values']())for(const _0x598c0d of _0x130710)if(_0x598c0d['id']===_0x2d6edc)return _0x598c0d['user'];}['getUserSessions'](_0x766f00,_0x354b28){const _0x18bed8=_0x354b28?[this['channelSessions']['get'](_0x354b28)]:this['channelSessions']['values'](),_0x39d9bf=new Set();for(const _0x5335e1 of _0x18bed8)for(const _0x2bb8e3 of _0x5335e1)_0x2bb8e3['user']['id']===_0x766f00['id']&&_0x39d9bf['add'](_0x2bb8e3['id']);return _0x39d9bf;}['getUserRole'](_0x1b9de6){for(const _0x2ef450 of this['channelSessions']['values']())for(const _0x38f0bd of _0x2ef450)if(_0x38f0bd['user']===_0x1b9de6)return _0x38f0bd['role'];}['_handleSessionAdd'](_0x179593,_0x1d4d8a){if('connected'!==this['context']['plugins']['get'](WebSocketGateway)['state'])return;const _0x1429cc=_0x1d4d8a['user'],_0x23063d=this['_users']['getUser'](_0x1429cc['id'])||this['_createUser'](_0x1429cc),_0x24fc96=Object['assign']({},_0x1d4d8a,{'user':_0x23063d});if(this['channelSessions']['get'](_0x179593)['add'](_0x24fc96),!_0x1429cc['hiddenInPresenceList']){const _0x2e0f46=this['channelConnectedUsers']['get'](_0x179593);_0x2e0f46['has'](_0x23063d['id'])||_0x2e0f46['add'](_0x23063d),this['allConnectedUsers']['has'](_0x23063d['id'])||_0x1429cc['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x23063d,_0x23063d['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x179593,{'channelId':_0x179593,'session':_0x24fc96});}['_handleSessionRemove'](_0x2e49af,_0x230126){if('connected'!==this['context']['plugins']['get'](WebSocketGateway)['state'])return;const _0x25068f=this['channelConnectedUsers']['get'](_0x2e49af),_0x3bce15=_0x230126['user'];_0x3bce15['id']&&(this['channelSessions']['get'](_0x2e49af)['remove'](_0x230126['id']),_0x25068f['has'](_0x3bce15['id'])&&!this['getUserSessions'](_0x3bce15,_0x2e49af)['size']&&_0x25068f['remove'](_0x3bce15['id']),this['allConnectedUsers']['get'](_0x3bce15['id'])&&!this['getUserSessions'](_0x3bce15)['size']&&this['allConnectedUsers']['remove'](_0x3bce15['id']));}['_createUser'](_0x4fa32d,_0x3c9496){const _0x4dff0f=this['_users']['addUser'](_0x4fa32d);return _0x3c9496&&this['_users']['defineMe'](_0x4fa32d['id']),_0x4dff0f['orderNumber']=this['_uniqueUsersCount']++,_0x4dff0f;}}class UserMarkers extends _0x25acfb{['_domEmitter']=new(_0x3daabf())();static get['requires'](){return[Sessions];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x1c744e=this['editor'],_0x17f8ec=_0x1c744e['plugins']['get'](Sessions);_0x1c744e['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x110bf1,{writer:_0x4fca7b})=>function(_0x435555,_0x22e618,_0x5590b8,_0x56a491){const _0x1308e8=_0x435555['markerName']['split'](':')[0x2],_0x12cc05=_0x5590b8['getUserBySessionId'](_0x1308e8);if(!_0x12cc05||_0x1308e8===_0x5590b8['mySessionId'])return;if(!_0x56a491['model']['schema']['checkChild'](_0x435555['markerRange']['start'],'$text'))return;const _0x191944={'class':'ck-user__marker\x20'+_0x12cc05['color']['getMarkerClass'](),'style':Y(_0x12cc05),'data-name':_0x12cc05['name'],'data-session-id':_0x1308e8},_0x1250de=_0x56a491['model']['markers']['get'](_0x435555['markerName']),_0x9eb81e=_0x1250de['getStart'](),_0x251116=_0x9eb81e['nodeAfter'],_0x34f2b9=_0x56a491['model']['schema'];if(_0x251116&&_0x34f2b9['isObject'](_0x251116)&&_0x34f2b9['isInline'](_0x251116)&&!_0x56a491['model']['markers']['get']('user:range:'+_0x1308e8)['getRange']()['isCollapsed'])return;const _0x4cd3f3=_0x9eb81e['parent'];return _0x56a491['model']['schema']['isLimit'](_0x4cd3f3)&&!_0x56a491['model']['hasContent'](_0x4cd3f3)&&(_0x191944['contenteditable']=!0x1),function(_0x50d7fc,_0x213b72,_0xea48ec){const _0x588475=_0x50d7fc['createUIElement']('span',_0x213b72);return _0x50d7fc['setCustomProperty']('userPositionMarker',!0x0,_0x588475),_0x588475['render']=function(_0x17ae13){const _0x56fa49=this['toDomElement'](_0x17ae13),_0x540e92=document['createElement']('span');return _0x540e92['classList']['add']('ck-user__marker-tooltip'),_0x540e92['setAttribute']('contenteditable','false'),_0x540e92['setAttribute']('spellcheck','false'),_0x540e92['textContent']=_0xea48ec['name'],_0x56fa49['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x540e92['outerHTML']+'',_0x56fa49['addEventListener']('mouseenter',()=>{_0x56fa49['classList']['add']('ck-user__marker_hovered');}),_0x56fa49['addEventListener']('mouseleave',()=>{_0x56fa49['classList']['remove']('ck-user__marker_hovered');}),_0x56fa49;},_0x588475['isSimilar']=function(_0xbbe249){return!(!this['getCustomProperty']('userPositionMarker')||!_0xbbe249['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0xbbe249['getAttribute']('data-session-id'));},_0x588475;}(_0x22e618,_0x191944,_0x12cc05);}(_0x110bf1,_0x4fca7b,_0x17f8ec,_0x1c744e)}),_0x1c744e['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x2fcd16=>function(_0x3a8068,_0x1cc68c){const _0x5a3777=_0x3a8068['markerName']['split'](':')[0x2];if(_0x5a3777===_0x1cc68c['mySessionId'])return null;const _0x41dbf7=_0x1cc68c['getUserBySessionId'](_0x5a3777);if(!_0x41dbf7)return{'id':_0x5a3777,'classes':[]};return{'id':_0x5a3777,'classes':['ck-user__selection',_0x41dbf7['color']['getSelectionClass']()],'attributes':{'style':Y(_0x41dbf7),'data-session-id':_0x5a3777},'priority':0x7d0+_0x41dbf7['orderNumber']};}(_0x2fcd16,_0x17f8ec)}),function(_0x55468f){const _0x35fd94=_0x55468f['model'],_0x4192e2=new Map(),_0x1ebad6=_0x55468f['plugins']['get'](Sessions);_0x35fd94['markers']['on']('update:user:range',(_0x5038fb,_0x2ed3a4,_0x51d79f,_0xc4419e)=>{if(!_0xc4419e&&_0x4192e2['get'](_0x2ed3a4['name']))return _0x4192e2['get'](_0x2ed3a4['name'])['detach'](),void _0x4192e2['delete'](_0x2ed3a4['name']);const _0x47d06e=_0x2ed3a4['name']['split'](':')[0x2];if(_0x47d06e===_0x1ebad6['mySessionId'])return;const _0x36d155='user:position:'+_0x47d06e;_0x35fd94['markers']['has'](_0x36d155)&&_0x55468f['editing']['reconvertMarker'](_0x36d155),_0x2ed3a4['on']('change:range',(_0x3a5cb4,_0xdea481,_0x25d880)=>{if('$graveyard'!=_0xdea481['root']['rootName']&&'$graveyard'==_0x2ed3a4['getRange']()['root']['rootName']&&!_0x4192e2['has'](_0x2ed3a4['name'])){const _0x269c14=_0x35fd94['schema']['getNearestSelectionRange'](_0x25d880['deletionPosition']);if(_0x269c14){const _0x17dac3=_0x5d0016['fromRange'](_0x269c14);_0x4192e2['set'](_0x2ed3a4['name'],_0x17dac3),_0x17dac3['on']('change:range',(_0x58f15e,_0x4f0b0c,_0x22a73c)=>{if('$graveyard'==_0x17dac3['root']['rootName']){const _0x1cf256=_0x35fd94['schema']['getNearestSelectionRange'](_0x22a73c['deletionPosition']);_0x1cf256?(_0x17dac3['start']=_0x1cf256['start'],_0x17dac3['end']=_0x1cf256['end']):(_0x4192e2['delete'](_0x2ed3a4['name']),_0x17dac3['detach']());}});}}});}),_0x35fd94['document']['on']('change',()=>{_0x4192e2['size']>0x0&&_0x35fd94['enqueueChange']({'isUndoable':!0x1},_0x3a393c=>{for(const [_0x2e22ff,_0x8e7abd]of _0x4192e2)'$graveyard'==_0x35fd94['markers']['get'](_0x2e22ff)['getRange']()['root']['rootName']&&(z(_0x2e22ff['split'](':')[0x2],_0x8e7abd['toRange'](),_0x35fd94,_0x3a393c),_0x8e7abd['detach']());_0x4192e2['clear']();});});}(_0x1c744e),this['_domEmitter']['listenTo'](_0x248dd9['document'],'keydown',(_0x5db12d,{key:_0x1d2e63})=>{'Escape'===_0x1d2e63&&function(_0x394511){_0x394511['editing']['view']['change'](_0x327a79=>{for(const _0x5c2e1c of _0x394511['model']['markers']){if(!_0x5c2e1c['name']['startsWith']('user:position'))continue;const _0x296c41=_0x394511['editing']['mapper']['markerNameToElements'](_0x5c2e1c['name']);if(_0x296c41){for(const _0x58150b of _0x296c41)_0x327a79['removeClass']('ck-user__marker_hovered',_0x58150b);}}});}(_0x1c744e);},{'useCapture':!0x0});}['afterInit'](){const _0x3c7656=this['editor'],_0x468305=_0x3c7656['commands']['get']('undo');_0x468305&&_0x3c7656['model']['on']('applyOperation',(_0x43fcf0,_0x16dd51)=>{const _0x305a65=_0x16dd51[0x0];if(!_0x305a65['isDocumentOperation'])return;if('marker'!=_0x305a65['type']||!_0x305a65['name']['startsWith']('user:'))return;const _0x466ec2=_0x305a65['batch'];_0x468305['_createdBatches']['has'](_0x466ec2)&&(_0x305a65['newRange']=_0x305a65['oldRange']?_0x3c7656['model']['createRange'](_0x305a65['oldRange']['start'],_0x305a65['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x1c3d2d=this['editor'],_0x5d6ef7=_0x1c3d2d['model']['document'],_0x589626=_0x1c3d2d['plugins']['get'](Sessions);_0x1c3d2d['model']['enqueueChange']({'isUndoable':!0x1},_0x17bdc=>{const _0x49fa24='user:range:'+_0x589626['mySessionId'],_0x25c6d3='user:position:'+_0x589626['mySessionId'],_0x29de2a=_0x1c3d2d['model']['markers']['has'](_0x49fa24);_0x1c3d2d['editing']['view']['hasDomSelection']?z(_0x589626['mySessionId'],_0x5d6ef7['selection']['getFirstRange'](),_0x1c3d2d['model'],_0x17bdc):_0x29de2a&&(_0x17bdc['removeMarker'](_0x49fa24),_0x17bdc['removeMarker'](_0x25c6d3));});}}function z(_0x3c0f6e,_0x20112b,_0x1b4e78,_0x30fa75){const _0x9d9b5d='user:range:'+_0x3c0f6e,_0x43baa1='user:position:'+_0x3c0f6e,_0x32ce0e=_0x20112b['getContainedElement']();let _0x2e5be0=_0x20112b['start'];if(_0x32ce0e&&_0x32ce0e['is']('element','tableCell')){const _0x54faf1=function(_0x47fc28,_0xabfdf7){for(const _0x165e8d of _0x47fc28['getPositions']())if(_0xabfdf7['schema']['checkChild'](_0x165e8d,'$text'))return _0x165e8d;}(_0x20112b,_0x1b4e78);_0x54faf1&&(_0x2e5be0=_0x54faf1,_0x20112b=_0x30fa75['createRange'](_0x2e5be0));}const _0x37a96d=_0x30fa75['createRange'](_0x2e5be0);_0x1b4e78['markers']['has'](_0x9d9b5d)?(_0x30fa75['updateMarker'](_0x9d9b5d,{'range':_0x20112b}),_0x30fa75['updateMarker'](_0x43baa1,{'range':_0x37a96d})):(_0x30fa75['addMarker'](_0x9d9b5d,{'range':_0x20112b,'usingOperation':!0x0}),_0x30fa75['addMarker'](_0x43baa1,{'range':_0x37a96d,'usingOperation':!0x0}));}function Y(_0x1160b1){return'--ck-user-color:'+_0x1160b1['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x1160b1['color']['getColorAlphaVariable']()+';';}function K(_0x524bec,_0x3ed2cd,_0x25243d){const _0x142560=_0x524bec['t'],t=_0x524bec['t'];switch(_0x3ed2cd){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 _0x142560({'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'},_0x25243d);default:return'';}}let J=0x1;class RealTimeCollaborationClient extends _0x25acfb{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x2cf64e)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[WebSocketGateway,Sessions,UserMarkers,_0x31943e,_0x3e9224,_0x532a35];}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 _0x3409a7=this['serverHistory']['getOperations']();for(let _0x3ed423=_0x3409a7['length']-0x1;_0x3ed423>=0x0;_0x3ed423--){const _0x1928ee=_0x3409a7[_0x3ed423];if(!this['_disconnectionOperations']['has'](_0x1928ee))return _0x1928ee['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1c90e7){if(super(_0x1c90e7),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0xb0b44f(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x146074('collaboration-missing-channelid',this);const _0x456fc5=_0x1c90e7['config']['get']('cloudServices.bundleVersion')||_0x429b78;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x456fc5,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x41afd4(),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 OperationIdentifier(this['_disconnectionOperations']);}['init'](){const _0x295fca=this['editor'],_0x29e352=_0x295fca['plugins']['get'](_0x3e9224),_0x6feeac=_0x295fca['plugins']['get'](WebSocketGateway);this['listenTo'](_0x29e352,'getOperationAuthor',(_0x2fdad6,_0x540be5)=>{const _0x5a0498=_0x540be5[0x0];_0x5a0498['_authorId']&&(_0x2fdad6['return']=_0x29e352['getUser'](_0x5a0498['_authorId']),_0x2fdad6['stop']()),null===_0x5a0498['_authorId']&&(_0x2fdad6['return']=null,_0x2fdad6['stop']());},{'priority':'high'}),this['listenTo'](_0x295fca['model']['document']['selection'],'change:range',(_0x46da0d,_0x2598c1)=>{_0x2598c1['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x295fca['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x295fca['model']['on']('applyOperation',(_0x4fabd1,_0x593575)=>{const _0x35c339=_0x593575[0x0];_0x35c339['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x35c339),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x6feeac,'state',this,'_hasSynchronizationProblem',(_0x30e6ff,_0x1aa68c)=>'connected'===_0x30e6ff&&!_0x1aa68c),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x295fca['disableReadOnlyMode']('rtc-offline'):_0x295fca['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x295fca['disableReadOnlyMode']('rtc-offline'):_0x295fca['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x5db02f=this['editor']['plugins']['get'](Sessions),_0x4a5c88=this['editor']['plugins']['get'](WebSocketGateway);try{this['_isPendingUpdate']=!0x0,_0x5db02f['unregister'](this['_channelId']);const _0x3ca5cc=await this['_service']['reconnect'](_0x4a5c88['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x3ca5cc)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x1142e3=await this['_service']['getConnectedSessions']();_0x5db02f['register'](this['_channelId'],_0x1142e3),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x2abfe7){if(function(_0x2c399e){return'404'===_0x2c399e['code'];}(_0x2abfe7)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0xfcd4f){return'409'===_0xfcd4f['code'];}(_0x2abfe7)){const _0x178c3f=K(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x178c3f);}else{if(!(_0x2abfe7 instanceof ReconnectionError))throw _0x2abfe7;this['_handleReconnectionError']();}}}}['destroy'](){const _0x3d6ac9=this['editor']['plugins']['get'](WebSocketGateway),_0x46d7aa=this['editor']['plugins']['get'](Sessions);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x46d7aa['channelSessions']['has'](this['_channelId'])&&_0x46d7aa['unregister'](this['_channelId']),_0x3d6ac9['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x5e7fa5){if(this['sessionId']!==_0x5e7fa5['sessionId']&&this['_lastSyncedOperationId']!==_0x5e7fa5['lastOperationId'])throw new ReconnectionError();return this['sessionId']=_0x5e7fa5['sessionId'],this['_handleServerResponse']([],{..._0x5e7fa5,'wereChangesApplied':!0x1,'data':_0x5e7fa5['data']},'reconnect');}async['_connectService'](_0x222de6,_0x552094=!0x1){const {connection:_0x1b9b90}=this['editor']['plugins']['get'](WebSocketGateway);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x1b9b90,this['_channelId'])['then'](_0x330465=>this['_initSessionsHandling'](_0x330465))['catch'](_0x5c5986=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x5c5986);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x23e7f0,_0x122fe0)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x122fe0);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x3761d7=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x222de6);this['_isPendingUpdate']=!0x0;const _0x3bb3d8=await this['_service']['connect'](_0x1b9b90,this['_compressOperations'](_0x222de6),_0x3761d7);if(this['sessionId']=_0x3bb3d8['sessionId'],_0x552094){if(!_0x3bb3d8['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3bb3d8['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x222de6,_0x3bb3d8,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3bb3d8,_0x222de6);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x35024d=this['editor']['plugins']['get'](Sessions),_0x534157=this['editor']['plugins']['get'](UserMarkers),_0x4aa9b2=_0x35024d['channelSessions']['get'](this['_channelId']);_0x4aa9b2&&_0x4aa9b2['length']>0x1?_0x534157['createUserMarkerOperations']():this['listenTo'](_0x35024d,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x35024d['channelSessions']['get'](this['_channelId'])['length']&&_0x534157['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x129e92,_0x530153,_0x95609,_0x145836){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x530153){const _0x1fcc73=this['_decompressOperations'](_0x95609,_0x145836);await this['_fetchMissingUsers'](_0x1fcc73),this['_handleExternalOperations'](_0x1fcc73,_0x530153,_0x95609['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x564161}=this['editor'];let _0x4ece56;try{_0x4ece56=await this['_service']['getDocumentDetails']();}catch{const _0x964b98=K(_0x564161,'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'](_0x964b98);}const _0x526cf9=_0x4ece56['currentDocumentSession']||_0x4ece56['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x526cf9['lastOperationId']){const _0x12a8ea=K(_0x564161,'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'](_0x12a8ea);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0xfefdf1){const _0x256c47=this['editor']['plugins']['get'](Sessions);this['listenTo'](_0x256c47,'sessionAdd:'+this['_channelId'],(_0x155916,{session:_0x58fc9f})=>{if(_0x58fc9f['id']===_0x256c47['mySessionId']){_0x155916['off']();const _0x2c68c2=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x2d1049=_0x58fc9f['permissions'];_0x2c68c2&&_0x2c68c2['isEnabled']&&(_0x2d1049=_0x2d1049['filter'](_0x1cb5ba=>'document:write'!==_0x1cb5ba)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x2d1049,this['_channelId']);}}),_0x256c47['register'](this['_channelId'],_0xfefdf1);}['_initThrowingOnDataSet'](){const _0x2ef210=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x31ca1c)=>{if(!_0x31ca1c[_0x31ca1c['length']-0x1]['suppressErrorInCollaboration'])throw new _0x146074('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x2ef210['apply'](this['editor']['data'],_0x31ca1c);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x3bca1d,[_0x409118])=>{if(this['_document']['version'])throw new _0x146074('realtimecollaborationclient-init-document-already-initialized',this);_0x3bca1d['stop'](),this['_setPendingAction']();const _0x23ea78=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x1fbf61])=>!_0x1fbf61['lazyLoad'])['map'](([_0x2469e4,_0x13d6b4])=>[_0x2469e4,_0x13d6b4['modelAttributes']||{}])),_0x2e2b15=this['_getOperationsFromInitData'](_0x409118,_0x23ea78);0x0==_0x2e2b15['length']&&_0x2e2b15['push'](new _0x5ea7c9(0x0)),_0x3bca1d['return']=this['_connectService'](_0x2e2b15)['then'](()=>{this['editor']['plugins']['get'](WebSocketGateway)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x28956d=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x28956d))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x57bf82,[_0x5e66b2,_0x2d0a69])=>{_0x57bf82['stop']();const _0x5cac3d=this['editor']['model']['document']['getRoot'](_0x5e66b2);if(!this['_knownRootNames']['has'](_0x5e66b2)){const _0x110af5=_0x2d0a69&&_0x2d0a69['data']?_0x2d0a69['data']:'',_0x26c064=_0x2d0a69&&_0x2d0a69['attributes']?_0x2d0a69['attributes']:{};await this['_loadRoot'](_0x5e66b2,_0x110af5,_0x26c064);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x5cac3d['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x5cac3d);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x17bb91){const _0x41f9a9=this['editor']['plugins']['get'](_0x3e9224),{connection:_0x52163a}=this['editor']['plugins']['get'](WebSocketGateway),_0x2ce6f6=new Set();for(const _0x7fa9 of _0x17bb91){const _0x2db2e1=_0x7fa9['_authorId'];_0x2db2e1&&!_0x41f9a9['getUser'](_0x2db2e1)&&_0x2ce6f6['add'](_0x2db2e1);}if(0x0===_0x2ce6f6['size'])return;const _0x554c2e=await _0x3383d3['getMany'](_0x52163a,Array['from'](_0x2ce6f6));for(const _0x230bab of _0x554c2e)_0x41f9a9['getUser'](_0x230bab['id'])||_0x41f9a9['addUser'](_0x230bab);}['_getOperationsFromInitData'](_0x3349fa,_0x496afa={}){const _0x4a543a=this['editor']['model'],_0x4ece16=[];let _0x1375af=0x0;const _0x114998='string'==typeof _0x3349fa?{'main':_0x3349fa}:_0x3349fa;for(const _0x3df09f of Object['keys'](_0x114998)){if(!this['_document']['roots']['has'](_0x3df09f))throw new _0x146074('realtimecollaborationclient-init-non-existent-root',this);const _0x5d49e5=this['editor']['data']['parse'](_0x114998[_0x3df09f]),_0x53f242=this['_document']['getRoot'](_0x3df09f),_0x4b9802=new _0x10dd3e(_0x4a543a['createPositionAt'](_0x53f242,0x0),_0x5d49e5,_0x1375af++);_0x4ece16['push'](_0x4b9802);for(const [_0x482cd1,_0x2be80d]of _0x5d49e5['markers']){const _0x3c3b0a=_0x4a543a['createRange'](_0x4a543a['createPositionFromPath'](_0x53f242,_0x2be80d['start']['path']['slice']()),_0x4a543a['createPositionFromPath'](_0x53f242,_0x2be80d['end']['path']['slice']())),_0x123a05=new _0x40006b(_0x482cd1,null,_0x3c3b0a,_0x4a543a['markers'],!0x0,_0x1375af++);_0x4ece16['push'](_0x123a05);}}if(_0x496afa)for(const [_0x3d3696,_0x17b135]of Object['entries'](_0x496afa)){const _0x8af1cd=_0x4a543a['document']['getRoot'](_0x3d3696);if(!_0x8af1cd)throw new _0x146074('multi-root-editor-root-attributes-no-root',null);for(const [_0x1fa0ff,_0x5efa23]of Object['entries'](_0x17b135))if(null!==_0x5efa23){const _0x4bcb46=new _0x411e94(_0x8af1cd,_0x1fa0ff,null,_0x5efa23,_0x1375af++);_0x4ece16['push'](_0x4bcb46);}}return _0x4ece16;}async['_loadRoot'](_0x38e74c,_0x39c8b3,_0x48245b){this['_getOperationsFromInitData']({[_0x38e74c]:_0x39c8b3},{[_0x38e74c]:_0x48245b})['forEach']((_0x14f1f1,_0x457912)=>{_0x14f1f1['baseVersion']=this['_document']['version']+_0x457912,_0x14f1f1['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x14f1f1);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x3683d0,_0x2ff763){let _0x652b1b;this['_offset']=_0x3683d0['offset'];const _0x313ff0=_0x3683d0['wereChangesApplied']&&!_0x3683d0['initData'],_0x374655=_0x313ff0?0x0:_0x3683d0['data']['baseVersion'];if(_0x2ff763['forEach'](_0x248a23=>{_0x248a23['_isInit']=!0x0,_0x248a23['createdAt']=_0x3683d0['sessionCreatedAt'],_0x248a23['_authorId']=null;}),_0x313ff0)_0x652b1b=_0x2ff763,this['_applyOperationsSet'](_0x652b1b,_0x313ff0);else{if(_0x3683d0['initData']){const _0x3726cf=this['_getOperationsFromInitData'](_0x3683d0['initData']);this['_document']['history']['version']=-_0x3726cf['length'],_0x3726cf['forEach'](_0xf3ca1f=>{_0xf3ca1f['baseVersion']-=_0x3726cf['length'],_0xf3ca1f['createdAt']=_0x3683d0['sessionCreatedAt'],_0xf3ca1f['_isInit']=!0x0,_0xf3ca1f['_authorId']=null;}),this['_applyOperationsSet'](_0x3726cf,!0x0),this['serverHistory']['version']=-_0x3726cf['length']+this['_offset'],this['_updateServerHistory'](_0x3726cf);}this['_document']['history']['version']=_0x374655,_0x652b1b=this['_decompressOperations'](_0x3683d0['data'],_0x3683d0['metadata']),await this['_fetchMissingUsers'](_0x652b1b),this['_applyOperationsSet'](_0x652b1b,_0x313ff0);}_0x3683d0['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x652b1b,_0x3683d0['lastOperationId']),this['_lastSyncedOperationId']=_0x3683d0['lastOperationId']),this['serverHistory']['version']=_0x374655+this['_offset'],this['_updateServerHistory'](_0x652b1b),_0x2ff763['filter'](_0x4901e9=>{const _0xa36c7a=this['_getAffectedRoot'](_0x4901e9);return _0xa36c7a&&!this['_knownRootNames']['has'](_0xa36c7a);})['forEach']((_0x163b4a,_0x52fd9b)=>{_0x163b4a['baseVersion']=this['_document']['version']+_0x52fd9b,this['_saveOperationInBuffer'](_0x163b4a);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x1707ec,_0x41bb27){const _0x3051e3=_0x41bb27&&_0x41bb27['message'];if(_0x3051e3&&_0x3051e3['startsWith']('realtimecollaborationclient'))throw _0x41bb27;const _0x44c659=this['editor']['plugins']['get'](WebSocketGateway);throw this['_isPendingUpdate']=!0x0,_0x44c659['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x146074(_0x1707ec,this['editor'],_0x3051e3?{'originalError':_0x3051e3}:void 0x0);}['_saveOperationInBuffer'](_0x545d50){this['_knownOperations']['has'](_0x545d50)||(this['_knownOperations']['add'](_0x545d50),this['_bufferedOperations']['push'](_0x545d50),this['_pendingAction']||'marker'==_0x545d50['type']&&!_0x545d50['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x153bcf=!0x1){!_0x153bcf&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x34c599=>{_0x34c599&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x525539=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x44cce5){return _0x44cce5['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x44cce5['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x44cce5['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x525539)||this['_crash'](_0x525539['message'],_0x525539);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x5a89e8=>{this['on']('change:_isPendingUpdate',()=>{_0x5a89e8();});});}async['_sendBufferedOperations'](){const _0x79cb55=this['editor']['plugins']['get'](UserMarkers);if(this['_shouldSendSelectionUpdate']()&&(_0x79cb55['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x4e6a2a=[...this['_bufferedOperations']];for(const _0x28b098 of _0x4e6a2a)_0x28b098['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x28b098);const _0x4237e8=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4e6a2a),_0x5b06a1=J++,_0x1e51ff=this['_compressOperations'](_0x4e6a2a),_0x42196b=await this['_service']['sendOperations'](_0x1e51ff,_0x1e51ff['baseVersion'],_0x4237e8);try{return await this['_handleServerResponse'](_0x4e6a2a,_0x42196b,_0x5b06a1);}catch(_0x20d090){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x20d090);}}async['_handleServerResponse'](_0x1d9651,_0x2871c0,_0x30f470){if('error'in _0x2871c0)throw _0x2871c0['error'];let _0x1f37f3=!0x1;if(_0x2871c0['wereChangesApplied']){_0x2871c0['lastOperationId']&&(this['_lastSyncedOperationId']=_0x2871c0['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x4b26ce=>!_0x1d9651['includes'](_0x4b26ce));for(const _0x2b2643 of _0x1d9651)_0x2b2643['createdAt']='lastOperationAcceptedAt'in _0x2871c0&&_0x2871c0['lastOperationAcceptedAt']||void 0x0;Q(_0x1d9651,_0x2871c0['version']-_0x1d9651['length']),this['_updateServerHistory'](_0x1d9651);const _0x205575=_0x1d9651['filter'](_0x1eee4b=>{if(!_0x1eee4b['_isInit'])return!0x1;const _0x494dfb=this['_getAffectedRoot'](_0x1eee4b);return _0x494dfb&&!this['_knownRootNames']['has'](_0x494dfb);});Q(_0x205575,this['_document']['version']),this['_applyOperationsSet'](_0x205575),_0x1f37f3=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x476070=this['_decompressOperations'](_0x2871c0['data'],_0x2871c0['metadata'])['filter'](_0xac0aac=>_0xac0aac['baseVersion']>=this['_lastServerVersion']);_0x476070['forEach'](_0x2c790c=>this['_addKnownRoot'](_0x2c790c)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x299d69=>!_0x299d69['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x299d69))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x476070),_0x1f37f3=this['_handleExternalOperations'](_0x476070,_0x2871c0['version'],_0x2871c0['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1f37f3?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x1f7d49,_0x1008b3,_0x29b543){try{const _0x475489={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x21c66e,operationsB:_0x491164,originalOperations:_0x46fab3}=_0x325962(_0x1f7d49,this['_bufferedOperations'],_0x475489);Q(_0x21c66e,this['_document']['version']),Q(_0x491164,_0x1008b3);for(const _0x291c98 of _0x21c66e){const _0x4d9a70=_0x46fab3['get'](_0x291c98);_0x291c98['_authorId']=_0x4d9a70?_0x4d9a70['_authorId']:null;}_0x29b543&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1f7d49,_0x29b543),this['_lastSyncedOperationId']=_0x29b543),this['_bufferedOperations']=[..._0x491164],this['_applyOperationsSet'](_0x21c66e),this['_updateServerHistory'](_0x1f7d49);}catch(_0x3295c1){return console['error'](_0x3295c1),!0x1;}return!0x0;}['_applyOperationsSet'](_0x22d622,_0x36e994=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x55d6b5=>{for(const _0x2a0917 of _0x22d622)this['_knownOperations']['add'](_0x2a0917),this['_addKnownRoot'](_0x2a0917),_0x55d6b5['batch']['addOperation'](_0x2a0917),this['editor']['model']['applyOperation'](_0x2a0917);});}['_addKnownRoot'](_0x35de3f){const _0x4edd40=this['_getAffectedRoot'](_0x35de3f);_0x4edd40&&this['_knownRootNames']['add'](_0x4edd40);}['_getAffectedRoot'](_0xb3351f){let _0x2ae70c,_0x3c70b0;switch(_0xb3351f['type']){case'insert':_0x2ae70c=_0xb3351f['position']['root'];break;case'marker':if(_0x3c70b0=_0xb3351f['newRange'],!_0x3c70b0)return null;_0x2ae70c=_0x3c70b0['root'];break;case'addRootAttribute':_0x2ae70c=_0xb3351f['root'];break;case'addRoot':_0x2ae70c=_0xb3351f['affectedSelectable'];break;case'move':_0x2ae70c=_0xb3351f['targetPosition']['root'];break;default:return null;}return _0x2ae70c['rootName'];}['_updateServerHistory'](_0x2ba994){_0x2ba994['forEach'](_0x474aa2=>{const _0x1d2930=_0x474aa2['clone']();_0x1d2930['_authorId']=_0x474aa2['_authorId'],_0x1d2930['_isInit']=!!_0x474aa2['_isInit'],_0x1d2930['createdAt']=_0x474aa2['createdAt'],_0x1d2930['baseVersion']+=this['_offset'],_0x474aa2['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x1d2930),this['serverHistory']['addOperation'](_0x1d2930);});}['_handleReconnectionError'](_0x690d1f){const _0x3a9d53=this['editor']['plugins']['get']('Notification'),_0x4a30e4=this['editor']['locale'];_0x690d1f||(_0x690d1f=K(_0x4a30e4,'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.')),_0x3a9d53['showWarning'](_0x690d1f,{'title':K(_0x4a30e4,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](WebSocketGateway)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x31943e)['add'](K(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x31943e)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x296904){const _0x5eef7f=_0x296904['map'](_0x2bbd42=>_0x2bbd42['toJSON']());return this['_compressor']['compress'](_0x5eef7f);}['_decompressOperations'](_0x50aa8f,_0x51bcb3){return this['_compressor']['decompress'](_0x50aa8f)['map']((_0x46893a,_0x41f355)=>{const _0x5e7f98='init'==_0x51bcb3[_0x41f355]['type'];if('InsertOperation'==_0x46893a['__className']){const _0x43d373=_0x46893a['position']['root'];!this['_document']['getRoot'](_0x43d373)&&(this['_document']['createRoot']('$root',_0x43d373)['_isAttached']=!0x1);}const _0x39c333=_0x44417e['fromJSON'](_0x46893a,this['_document']);return _0x39c333['wasUndone']=_0x46893a['wasUndone'],_0x39c333['_isInit']=_0x5e7f98,_0x39c333['_authorId']=_0x5e7f98?null:_0x51bcb3[_0x41f355]['userId'],_0x39c333['_isDisconnection']='cs:removeUser'===_0x51bcb3[_0x41f355]['type'],_0x39c333['createdAt']=_0x51bcb3[_0x41f355]['createdAt'],_0x39c333;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x14c80a=this['editor']['plugins']['get'](Sessions)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x14c80a&&_0x14c80a['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class ReconnectionError extends Error{}function Q(_0x22f9fb,_0xc8390c){for(const _0x3878af of _0x22f9fb)_0x3878af['baseVersion']=_0xc8390c++;}class OperationIdentifier{['_ignoredOperations'];['_operationToId'];constructor(_0x4f71b5){this['_ignoredOperations']=_0x4f71b5,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x37ca51){let _0x3405e0=_0x37ca51['length'];for(;_0x3405e0--;){const _0x4c14a4=_0x37ca51[_0x3405e0];if(!this['_ignoredOperations']['has'](_0x4c14a4)){if(!this['_operationToId']['has'](_0x4c14a4)){const _0x41e90b=_0x2f36df()['slice'](0x1,0x12);this['_operationToId']['set'](_0x4c14a4,_0x41e90b);}return this['_operationToId']['get'](_0x4c14a4);}}}['setIdForTheLastOperation'](_0x34818f,_0x13b2d4){if(!_0x13b2d4)return;let _0xfaa36f=_0x34818f['length'];for(;_0xfaa36f--;){const _0x2b9d58=_0x34818f[_0xfaa36f];this['_ignoredOperations']['has'](_0x2b9d58)||this['_operationToId']['set'](_0x2b9d58,_0x13b2d4);}}}class RealTimeCollaborativeEditing extends _0x25acfb{static get['requires'](){return[RealTimeCollaborationClient];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class CloudServicesCommentsAdapter extends _0x1b9cff{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x476c1f)());['_services'];static get['requires'](){return[WebSocketGateway,_0x33588d,Sessions,_0x3e9224];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x31d85e){super(_0x31d85e),this['_services']=new Map();}async['init'](){const _0x9ff1f4=this['context'],_0x2427c6=_0x9ff1f4['plugins']['get'](_0x33588d);if(_0x9ff1f4['plugins']['get'](WebSocketGateway)['addToReconnectionStack'](this),_0x2427c6['adapter']={'addCommentThread':async({channelId:_0x3169cb,threadId:_0x280f7d,comments:_0x3dbd8b,resolvedAt:_0x169fb3,resolvedBy:_0x3724bd,context:_0x243f65,attributes:_0xe06c9f})=>{const _0x9f744=await this['_getService'](_0x3169cb)['addCommentThread']({'commentThreadId':_0x280f7d,'comments':_0x3dbd8b['map'](_0x1c3e01=>function(_0x24faa9,_0x1d6894,_0x533bec){return{'commentThreadId':_0x533bec,'commentId':_0x24faa9['commentId'],'userId':_0x24faa9['authorId'],'content':_0x24faa9['content'],'documentId':_0x1d6894,'createdAt':_0x24faa9['createdAt'],'attributes':_0x24faa9['attributes']||{}};}(_0x1c3e01,_0x3169cb,_0x280f7d)),'resolvedAt':_0x169fb3,'resolvedBy':_0x3724bd,'context':_0x243f65,'attributes':_0xe06c9f})['catch'](Z);return{'threadId':_0x9f744['commentThreadId'],'comments':_0x9f744['comments']};},'getCommentThread':async({channelId:_0x5df763,threadId:_0x3ea4f5})=>{const _0xa1316e=await this['_getService'](_0x5df763)['getCommentThread'](_0x3ea4f5)['catch'](X)['catch'](Z);return _0xa1316e?_0xa1316e['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0xa1316e]),{'threadId':_0xa1316e['commentThreadId'],'comments':_0xa1316e['comments']['map'](tt),'context':_0xa1316e['context'],'resolvedAt':_0xa1316e['resolvedAt'],'resolvedBy':_0xa1316e['resolvedBy'],'attributes':_0xa1316e['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x54c7d9,threadId:_0x521538,context:_0x894c19,unlinkedAt:_0x51447b,attributes:_0x53035b})=>this['_getService'](_0x54c7d9)['updateCommentThread']({'commentThreadId':_0x521538,'context':_0x894c19,'attributes':_0x53035b,'unlinkedAt':_0x51447b})['catch'](X)['catch'](Z),'resolveCommentThread':async({channelId:_0x341d79,threadId:_0x54cfa4})=>{const _0xa13a0e=await this['_getService'](_0x341d79)['resolveCommentThread'](_0x54cfa4)['catch'](X)['catch'](Z);return{'threadId':_0xa13a0e['commentThreadId'],'resolvedAt':_0xa13a0e['resolvedAt'],'resolvedBy':_0xa13a0e['resolvedBy']};},'reopenCommentThread':async({channelId:_0x5d7c97,threadId:_0x3936fb})=>this['_getService'](_0x5d7c97)['reopenCommentThread'](_0x3936fb)['catch'](X)['catch'](Z),'removeCommentThread':({channelId:_0x18fc10,threadId:_0x491325})=>this['_getService'](_0x18fc10)['removeCommentThread'](_0x491325)['catch'](X)['catch'](Z),'addComment':({channelId:_0x3c5ad0,threadId:_0x44237e,commentId:_0x413bdd,content:_0x222c31,attributes:_0x5a5614})=>this['_getService'](_0x3c5ad0)['addComment'](_0x44237e,_0x413bdd,_0x222c31,_0x5a5614)['catch'](Z),'updateComment':({channelId:_0xc9077f,threadId:_0x3ce6e7,commentId:_0x2e7e06,content:_0x41d9fc,attributes:_0x1510d7})=>this['_getService'](_0xc9077f)['updateComment'](_0x3ce6e7,_0x2e7e06,_0x41d9fc,_0x1510d7)['catch'](X)['catch'](Z),'removeComment':({channelId:_0x118f7b,threadId:_0x5926e0,commentId:_0x11103d})=>this['_getService'](_0x118f7b)['removeComment'](_0x5926e0,_0x11103d)['catch'](X)['catch'](Z)},_0x9ff1f4 instanceof _0x35a8e1){const _0x11c02d=_0x9ff1f4['config']['get']('collaboration.channelId'),_0x11c64c=_0x9ff1f4['plugins']['get'](Sessions);await this['_setUpService'](_0x11c02d);const _0x1f60c9=await this['_services']['get'](_0x11c02d)['getConnectedSessions']();this['listenTo'](_0x11c64c,'sessionAdd:'+_0x11c02d,(_0x28e380,{session:_0x44df57})=>{_0x44df57['id']===_0x11c64c['mySessionId']&&(_0x28e380['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x44df57['permissions'],_0x11c02d));}),_0x11c64c['register'](_0x11c02d,_0x1f60c9);}}async['_setUpService'](_0x5af1a4){if(this['_services']['has'](_0x5af1a4))throw new _0x146074('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x5af1a4});const _0x141914=this['context']['plugins']['get'](_0x33588d),_0x2db820=new CloudServicesCommentsAdapter['CommentsService'](_0x5af1a4);this['_services']['set'](_0x5af1a4,_0x2db820),this['listenTo'](_0x2db820,'commentThreadAdded',(_0x434c00,_0x6d217c)=>{const {commentThreadId:_0x363ece,documentId:_0x21768c,context:_0x1d37ba,attributes:_0x2d47df,resolvedAt:_0x4e2b42,resolvedBy:_0x29f844,comments:_0x5645b0}=_0x6d217c;_0x141914['getCommentThread'](_0x363ece)||_0x141914['addCommentThread']({'threadId':_0x363ece,'channelId':_0x21768c,'comments':_0x5645b0?_0x5645b0['map'](tt):[],'context':_0x1d37ba,'attributes':_0x2d47df,'resolvedAt':_0x4e2b42,'resolvedBy':_0x29f844,'isFromAdapter':!0x0});}),this['listenTo'](_0x2db820,'commentThreadUpdated',(_0x1660e9,{commentThreadId:_0x333ba7,documentId:_0x4f2f8f,context:_0x185d42,unlinkedAt:_0x325769,attributes:_0x149abf})=>{_0x141914['getCommentThread'](_0x333ba7)&&_0x141914['updateCommentThread']({'threadId':_0x333ba7,'channelId':_0x4f2f8f,'context':_0x185d42,'unlinkedAt':_0x325769,'attributes':_0x149abf,'isFromAdapter':!0x0});}),this['listenTo'](_0x2db820,'commentThreadResolved',(_0x4e7b2d,{commentThreadId:_0x5ae350,resolvedBy:_0x138c16,resolvedAt:_0xd89d39})=>{const _0x3d934d=_0x141914['getCommentThread'](_0x5ae350);_0x3d934d&&_0x3d934d['resolve']({'resolvedBy':_0x138c16,'resolvedAt':_0xd89d39,'isFromAdapter':!0x0});}),this['listenTo'](_0x2db820,'commentThreadReopened',(_0x305b0e,{commentThreadId:_0x432c45})=>{const _0x2abe71=_0x141914['getCommentThread'](_0x432c45);_0x2abe71&&_0x2abe71['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x2db820,'commentThreadRemoved',(_0x38de18,{commentThreadId:_0x15a6a4})=>{const _0x39080d=_0x141914['getCommentThread'](_0x15a6a4);_0x39080d&&_0x39080d['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x2db820,'commentAdded',(_0x38b61b,_0x1a6fa9)=>{const _0x2bf146=_0x1a6fa9['commentThreadId'],_0x33fb6b=_0x141914['getCommentThread'](_0x2bf146);_0x33fb6b&&_0x33fb6b['addComment']({...tt(_0x1a6fa9),'isFromAdapter':!0x0});}),this['listenTo'](_0x2db820,'commentUpdated',(_0x847696,{commentThreadId:_0xee0d9f,commentId:_0x309b75,content:_0x4693c2,attributes:_0x132cf9})=>{const _0x38133e=_0x141914['getCommentThread'](_0xee0d9f);if(_0x38133e){const _0x4a322a=_0x38133e['getComment'](_0x309b75);_0x4a322a&&_0x4a322a['update']({'content':_0x4693c2,'attributes':_0x132cf9,'isFromAdapter':!0x0});}}),this['listenTo'](_0x2db820,'commentRemoved',(_0x1cb75f,{commentThreadId:_0x1cda52,commentId:_0x516aa5})=>{const _0x25e19e=_0x141914['getCommentThread'](_0x1cda52);if(_0x25e19e){const _0x5796df=_0x25e19e['getComment'](_0x516aa5);_0x5796df&&_0x5796df['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x5af1a4);}['destroy'](){if(this['context']instanceof _0x35a8e1){const _0x385029=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x385029);}}['_terminateService'](_0x4300d5){if(!this['_services']['has'](_0x4300d5))throw new _0x146074('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x4300d5});this['_getService'](_0x4300d5)['disconnect'](),this['_services']['delete'](_0x4300d5);}async['reconnect'](){for(const _0x2ab768 of this['_services']['keys']())await this['_connectService'](_0x2ab768);if(this['context']instanceof _0x35a8e1){const _0x489702=this['context']['config']['get']('collaboration.channelId'),_0xe2fca5=this['context']['plugins']['get'](Sessions);_0xe2fca5['unregister'](_0x489702);const _0x102518=await this['_services']['get'](_0x489702)['getConnectedSessions']();_0xe2fca5['register'](_0x489702,_0x102518);}}async['_connectService'](_0x1bb390){const {connection:_0x44b86d}=this['context']['plugins']['get'](WebSocketGateway),_0x20bd46=this['context']['plugins']['get'](_0x33588d),_0x377445=this['_services']['get'](_0x1bb390),_0x3da09d=await _0x377445['connect'](_0x44b86d);await this['_fetchMissingUsersForThreads'](_0x3da09d);const _0x597c3c=new Set(Array['from'](_0x20bd46['getCommentThreads']({'channelId':_0x1bb390}),_0x15f5f3=>_0x15f5f3['id']));for(const _0x251218 of _0x3da09d)_0x251218['deletedAt']||_0x597c3c['delete'](_0x251218['commentThreadId']);for(const _0x268898 of _0x597c3c)_0x20bd46['getCommentThread'](_0x268898)['remove']({'isFromAdapter':!0x0});for(const _0x5caf6a of _0x3da09d){let _0xd282cd=_0x20bd46['getCommentThread'](_0x5caf6a['commentThreadId']);const {commentThreadId:_0x48eebc,context:_0x1f01ce,attributes:_0x2eadf,resolvedBy:_0x427df7,resolvedAt:_0x3e77b,unlinkedAt:_0x2c62cc,deletedAt:_0x58ec63}=_0x5caf6a;if(_0x58ec63)continue;_0xd282cd||(_0xd282cd=_0x20bd46['addCommentThread']({'channelId':_0x1bb390,'threadId':_0x48eebc,'context':_0x1f01ce,'attributes':_0x2eadf||{},'resolvedBy':_0x427df7,'resolvedAt':_0x3e77b,'unlinkedAt':_0x2c62cc,'isFromAdapter':!0x0}));const _0x56e81d=new Set(Array['from'](_0xd282cd['comments'],_0x323703=>_0x323703['id']));for(const _0x6b030a of _0x5caf6a['comments'])_0x56e81d['delete'](_0x6b030a['commentId']);for(const _0x5ec673 of _0x56e81d)_0xd282cd['getComment'](_0x5ec673)['remove']({'isFromAdapter':!0x0});for(const _0x1eb0d7 of _0x5caf6a['comments']){const _0x4b5fa4=_0xd282cd['getComment'](_0x1eb0d7['commentId']);_0x4b5fa4?_0x4b5fa4['content']!==_0x1eb0d7['content']&&_0x4b5fa4['update']({'content':_0x1eb0d7['content'],'isFromAdapter':!0x0}):_0xd282cd['addComment'](Object['assign'](tt(_0x1eb0d7),{'isFromAdapter':!0x0}));}}}['_getService'](_0x52d549){if(!this['_services']['has'](_0x52d549))throw new _0x146074('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x52d549});return this['_services']['get'](_0x52d549);}async['_fetchMissingUsersForThreads'](_0xec45d4){const _0x48804c=this['context']['plugins']['get'](_0x3e9224),{connection:_0x272d74}=this['context']['plugins']['get'](WebSocketGateway),_0xa71af0=new Set();for(const {resolvedBy:_0x2c415a,comments:_0x322f0a}of _0xec45d4){_0x2c415a&&!_0x48804c['getUser'](_0x2c415a)&&_0xa71af0['add'](_0x2c415a);for(const {userId:_0x452302}of _0x322f0a)_0x48804c['getUser'](_0x452302)||_0xa71af0['add'](_0x452302);}if(0x0===_0xa71af0['size'])return;const _0xcb73c1=await _0x3383d3['getMany'](_0x272d74,Array['from'](_0xa71af0));for(const _0x81d4cf of _0xcb73c1)_0x48804c['getUser'](_0x81d4cf['id'])||_0x48804c['addUser'](_0x81d4cf);}}async function X(_0x273a20){if('404'!==_0x273a20['code'])throw _0x273a20;}function Z(_0x5e43cf){if((_0x4046b0=_0x5e43cf)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x4046b0['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4046b0['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x4046b0;throw _0x5e43cf;}function tt(_0x2ebdd8){return{'threadId':_0x2ebdd8['commentThreadId'],'commentId':_0x2ebdd8['commentId'],'content':_0x2ebdd8['content'],'createdAt':_0x2ebdd8['createdAt'],'authorId':_0x2ebdd8['userId'],'attributes':_0x2ebdd8['attributes']||{}};}class CloudServicesTrackChangesAdapter extends _0x25acfb{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x524689)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[WebSocketGateway,RealTimeCollaborationClient,_0x547c0a,Sessions,_0x3e9224];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1498c2){super(_0x1498c2);const _0x2c40da=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x2c40da);}async['init'](){const _0x4e52f7=this['editor']['plugins']['get'](RealTimeCollaborationClient),_0x8e884b=_0x4e52f7['serverHistory'],_0x44523a=this['editor']['plugins']['get'](WebSocketGateway);this['_revisionTracker']['setSource']({'history':_0x8e884b,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x4e52f7['sessionId']});const _0x3e2104=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x429b78,_0x48de88=await _0x548b3a['isBundleUploaded'](_0x44523a['connection'],_0x3e2104);this['editor']['plugins']['get'](_0x547c0a)['adapter']={'getRevision':async({revisionId:_0x189205})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x189205)),'updateRevisions':async _0x3f150b=>{await this['_waitForServiceReady']();const _0x21d2c8=this['_revisionTracker']['currentRevision'];if(_0x48de88&&0x1===_0x3f150b['length']&&_0x3f150b[0x0]['id']===_0x21d2c8['id'])return _0x3f150b;for(const _0x3e1cc7 of _0x3f150b)_0x3e1cc7['id']===_0x21d2c8['id']&&(_0x3e1cc7['isEmptyCurrent']=_0x3e1cc7['fromVersion']===_0x3e1cc7['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x3f150b,this['_lastRequestId'])['then'](_0x501b48=>(this['_lastRequestId']=_0x501b48,_0x3f150b))['catch'](_0x25ec79=>{if(it(_0x25ec79)||'400'===_0x25ec79['code']&&void 0x0!==_0x25ec79['data']['wrongRequestId']){for(const _0x5b3e96 of _0x3f150b){!this['_revisionTracker']['repository']['getRevision'](_0x5b3e96['id'])||this['_revisionTracker']['_bufferUpdate'](_0x5b3e96['id'],_0x5b3e96,!0x1);}if(it(_0x25ec79)&&'destroyed'!==this['editor']['state'])throw _0x25ec79;return _0x3f150b;}throw _0x25ec79;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x5280b1,{revisionsData:_0xc36ee9,requestId:_0x21e5ba})=>{Math['max'](..._0xc36ee9['map'](_0x2041bb=>_0x2041bb['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0xc36ee9,_0x21e5ba);}):this['_handleRevisionsUpdate'](_0xc36ee9,_0x21e5ba);});const {revisions:_0x3279dd,requestId:_0x4bff77}=await this['_revisionHistoryService']['connect'](_0x44523a['connection']);_0x44523a['addToReconnectionStack'](this),this['_lastRequestId']=_0x4bff77,await this['_fetchMissingUsers'](_0x3279dd);for(const _0x5944ce of _0x3279dd)this['_revisionTracker']['addRevisionData'](_0x5944ce);this['listenTo'](_0x4e52f7,'change:_isConnected',(_0x225a8f,_0x508899,_0x49afe6)=>{_0x49afe6&&(this['_oldOffset']=_0x4e52f7['_offset'],_0x225a8f['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x44523a,'state',_0x33a983=>_0x33a983===_0x4e17ce['CONNECTED']);}async['reconnect'](){const _0x175028=this['editor']['plugins']['get'](WebSocketGateway),_0x3c5ed1=this['editor']['plugins']['get'](RealTimeCollaborationClient),_0xe99d09=async()=>{const _0xac0ef8=this['_revisionTracker']['currentRevision'],_0x544cde=_0xac0ef8['id'],_0x12c9f7=_0x544cde!==_0x3c5ed1['sessionId'];if(_0x12c9f7){const _0x4f989f=_0x3c5ed1['_offset']-this['_oldOffset'],_0xf04d77=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0xac0ef8['toVersion']+_0x4f989f!==_0xf04d77){const _0x4f1a1b=_0xac0ef8['fromVersion']+_0x4f989f,_0x55236c=this['editor']['plugins']['get'](_0x3e9224),_0x2883e6=this['_revisionTracker']['buildRevisionData']({'revision':_0xac0ef8,'from':_0x4f1a1b,'to':_0xf04d77});_0x2883e6['id']=_0xac0ef8['id'];const _0x2f8f42=_0x2883e6['authorsIds']['map'](_0x1a657a=>_0x55236c['getUser'](_0x1a657a));_0xac0ef8['_update']({..._0x2883e6,'authors':_0x2f8f42},!0x0),this['_revisionTracker']['_bufferUpdate'](_0xac0ef8['id'],_0x2883e6,!0x0);}this['_revisionTracker']['_startingVersion']=_0xf04d77,(_0xac0ef8['toVersion']===_0xac0ef8['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x544cde)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x544cde),this['_revisionTracker']['_createCurrentRevision'](_0xf04d77));}const {revisions:_0x2c894e,requestId:_0x30b08c}=await this['_revisionHistoryService']['reconnect'](_0x175028['connection'],this['_lastRequestId']);_0x12c9f7&&_0x2c894e['length']>0x0?_0x3c5ed1['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x2c894e),this['_handleRevisionsUpdate'](_0x2c894e,_0x30b08c),this['_revisionTracker']['sendBufferedUpdates']());};return _0x3c5ed1['_isConnected']?_0xe99d09():new Promise((_0x2c20d3,_0x303db4)=>{_0x3c5ed1['once']('change:_isConnected',()=>{_0xe99d09()['then'](_0x2c20d3)['catch'](_0x303db4);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x25f591=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x33ea32=>{_0x33ea32['off'](),_0x25f591();});});}['_getLatestVersionFromServerOperations'](){const _0xd15da2=this['editor']['plugins']['get'](RealTimeCollaborationClient)['serverHistory']['getOperations']()['reverse']();for(const _0x5b74ac of _0xd15da2)if('marker'!==_0x5b74ac['type']||_0x5b74ac['affectsData'])return _0x5b74ac['baseVersion']+0x1;}['_getLatestVersion'](){const _0x2e788c=this['editor']['plugins']['get'](RealTimeCollaborationClient);return new Promise(_0x2d3d66=>{_0x2e788c['_isPendingUpdate']?_0x2e788c['once']('change:_isPendingUpdate',()=>{_0x2d3d66(this['_getLatestVersionFromServerOperations']());}):_0x2d3d66(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x1d4705,_0x54a052){const _0x286f8c=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x54a052;for(const _0x837444 of _0x1d4705){const _0x1ff06b=_0x286f8c['getRevision'](_0x837444['id']);if(_0x1ff06b){if((_0x837444['fromVersion']||_0x837444['toVersion'])&&(_0x837444['diffData']=null),_0x1ff06b===this['_revisionTracker']['currentRevision']){const _0x4e681c=Math['max'](_0x1ff06b['toVersion'],_0x837444['toVersion']),_0x36d31a=Math['max'](_0x1ff06b['fromVersion'],_0x837444['fromVersion']);let _0x392f40;_0x1ff06b['toVersion']===_0x837444['toVersion']&&_0x1ff06b['fromVersion']===_0x837444['fromVersion']?(_0x392f40=!0x0,this['_preventResendingRevisionData'](_0x837444)):_0x837444['toVersion']===_0x4e681c&&_0x837444['fromVersion']===_0x36d31a?_0x392f40=!0x1:(_0x1ff06b['toVersion']===_0x4e681c&&_0x1ff06b['fromVersion']===_0x36d31a||this['_fixRevision']({'revision':_0x1ff06b,'from':_0x36d31a,'to':_0x4e681c}),_0x392f40=!0x0),_0x392f40&&(delete _0x837444['fromVersion'],delete _0x837444['toVersion'],delete _0x837444['diffData'],delete _0x837444['createdAt'],delete _0x837444['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x837444),this['_preventResendingRevisionData'](_0x837444);}else this['_revisionTracker']['addRevisionData'](_0x837444);}const _0x1163a3=_0x286f8c['getRevisions']();_0x1163a3['reverse']();for(let _0x3199fd=0x0;_0x3199fd<_0x1163a3['length']-0x1;_0x3199fd++){const _0x403980=_0x1163a3[_0x3199fd],_0x1aa939=_0x1163a3[_0x3199fd+0x1];if(_0x403980['fromVersion']<_0x1aa939['toVersion']){const _0x2f6869=_0x1aa939['toVersion'],_0x501647=Math['max'](_0x2f6869,_0x403980['toVersion']);this['_fixRevision']({'revision':_0x403980,'from':_0x2f6869,'to':_0x501647});}}}['_fixRevision']({revision:_0x88df30,from:_0x59702a,to:_0x198ade}={}){const _0x3e324f=this['editor']['plugins']['get'](_0x3e9224),_0x12875c=this['_revisionTracker']['buildRevisionData']({'revision':_0x88df30,'from':_0x59702a,'to':_0x198ade});_0x12875c['authors']=_0x12875c['authorsIds']['map'](_0x5b1703=>_0x3e324f['getUser'](_0x5b1703)),_0x88df30['_update'](_0x12875c);}['_preventResendingRevisionData'](_0x46ee17){const _0x1c17d7={};_0x1c17d7['id']=_0x46ee17['id'];for(const _0x2aa9a3 of Object['keys'](_0x46ee17))'id'!==_0x2aa9a3&&(_0x1c17d7[_0x2aa9a3]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x1c17d7['id'],_0x1c17d7,!0x0);}async['_fetchMissingUsers'](_0x3ce50e){const _0x309b4a=this['editor']['plugins']['get'](_0x3e9224),{connection:_0x582a51}=this['editor']['plugins']['get'](WebSocketGateway),_0x525985=new Set();for(const _0x5d615e of _0x3ce50e){for(const _0x56ee97 of _0x5d615e['authorsIds'])_0x205b7f(_0x56ee97);_0x5d615e['creatorId']&&_0x205b7f(_0x5d615e['creatorId']);}if(0x0===_0x525985['size'])return;const _0x11f621=await _0x3383d3['getMany'](_0x582a51,Array['from'](_0x525985));for(const _0x2f2577 of _0x11f621)_0x309b4a['getUser'](_0x2f2577['id'])||_0x309b4a['addUser'](_0x2f2577);function _0x205b7f(_0x244151){_0x309b4a['getUser'](_0x244151)||_0x525985['add'](_0x244151);}}}function it(_0x4a2517){return _0x4a2517['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x4a2517['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4a2517['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class RealTimeCollaborativeRevisionHistory extends _0x25acfb{static get['requires'](){return[_0x547c0a,CloudServicesRevisionHistoryAdapter,RealTimeCollaborativeEditing];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class PresenceCounterView extends _0x1aa21a{['_collapseAt'];constructor(_0x54e7c6,_0x5adb69=0x6){super(_0x54e7c6);const _0x35047e=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x5adb69,this['bind']('isHidden')['to'](this,'usersCount',_0x223333=>_0x223333<_0x5adb69),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x35047e['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':_0x35047e['to']('usersCount',_0x47f631=>'+'+(_0x47f631-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class PresenceInlineListView extends _0x1aa21a{['items'];['keystrokes'];constructor(_0x203923){super(_0x203923);const _0x5493d8=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x39c4bd(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x5493d8['if']('hasPopup'),'aria-expanded':_0x5493d8['to']('isExpanded',_0x1fa5f2=>this['hasPopup']&&String(_0x1fa5f2)),'aria-label':_0x5493d8['to']('hasPopup',_0x1e018b=>K(_0x203923,_0x1e018b?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x5493d8['to']('hasPopup',_0xbcab11=>!!_0xbcab11&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x5493d8['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x5493d8['to'](_0x3283f0=>{const _0xbc2010=_0x3283f0,_0x36baec=document['querySelector']('.ck-presence-list__dropdown-list'),_0x324c36=document['querySelector']('.ck-balloon-panel_with-arrow');_0x36baec?.['contains'](_0xbc2010['relatedTarget'])||_0x324c36?.['contains'](_0xbc2010['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x1d7b57,_0x48c9c4,_0x56b0a6)=>{this['element']&&(_0x56b0a6?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 PresenceListView extends _0x1aa21a{['counterView'];['inlineListView'];constructor(_0x119a10,_0x357c94=0x6){super(_0x119a10);const _0x580eeb=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new PresenceCounterView(this['locale'],_0x357c94),this['inlineListView']=new PresenceInlineListView(_0x119a10),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x58e0a4 of this['inlineListView']['items'])_0x58e0a4['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',_0x580eeb['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class PresenceDropdownListView extends _0x1aa21a{['listWrapperView'];constructor(_0x1b1c54,_0x1cf9c7){super(_0x1b1c54);const _0x40e0b1=this['bindTemplate'];this['listWrapperView']=new PresenceDropdownListWrapperView(_0x1b1c54,_0x1cf9c7),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':K(_0x1b1c54,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x40e0b1['to'](_0x1fed7a=>{const _0xb1c164=_0x1fed7a,_0x1d9a3b=document['querySelector']('.ck-presence-list__list'),_0x242d2d=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1d9a3b?.['contains'](_0xb1c164['relatedTarget'])||_0x242d2d?.['contains'](_0xb1c164['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class PresenceDropdownListWrapperView extends _0x6e06a0{constructor(_0x4d6930,_0x7c573b){super(_0x4d6930);const _0xb84e7c=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x7c573b?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0xb84e7c['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0xb84e7c['to']('role'),'aria-label':_0xb84e7c['to']('ariaLabel'),'aria-labelledby':_0xb84e7c['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x248dd9['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x463a63=this['element'];_0x463a63&&(this['_isScrollable']=Math['max'](_0x463a63['scrollHeight'],_0x463a63['clientHeight'])>0.8*window['innerHeight']);}}class PresenceDropdownListItemView extends _0x9a4d5e{['userView'];constructor(_0x186ed2,_0xa4b587,_0x33bb40){super(_0x186ed2);const _0x4b1359=this['bindTemplate'];this['userView']=new _0xb6d3d9(_0x186ed2,_0xa4b587);const _0x2930d8={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0xa4b587['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0xa4b587['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xa4b587['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0xa4b587['color']['getColorVariable'](),'--ck-user-color-alpha':_0xa4b587['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x33bb40&&(_0x2930d8['tag']='button',_0x2930d8['on']={'click':_0x4b1359['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2930d8);}['focus'](){this['element']['focus']();}}class PresenceInlineListItemView extends _0x1aa21a{['userView'];['markerView'];constructor(_0x33c214,_0x147fdc,_0x2b391b){super(_0x33c214);const _0xd9eba5=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0xb6d3d9(_0x33c214,_0x147fdc),this['markerView']=new MarkerView(_0x33c214,_0x147fdc);const _0x44b6a1=new _0x52e315(_0x33c214);_0x44b6a1['template']['tag']='span',_0x44b6a1['text']=_0x147fdc['name'];const _0x1fa50a={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0xd9eba5['to']('isFocusable',_0x174e18=>!!_0x174e18&&0x0),'aria-labelledby':_0x44b6a1['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0xd9eba5['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0xd9eba5['to']('hasTooltip',_0x3a7fe7=>!_0x3a7fe7),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x44b6a1]};_0x2b391b&&(_0x1fa50a['tag']='button',_0x1fa50a['on']={'click':_0xd9eba5['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1fa50a);}}class MarkerView extends _0x1aa21a{constructor(_0x2e6d8a,_0x3c4aaa){super(_0x2e6d8a),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3c4aaa['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x3c4aaa['color']['getColorVariable'](),'--ck-user-color-alpha':_0x3c4aaa['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}}const nt={'collapseAt':0x6,'displayMe':!0x0};class PresenceListUI extends _0x1b9cff{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3ea392){super(_0x3ea392),this['context']['config']['define']('presenceList',nt);const _0x54485f=_0x3ea392['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x54485f)throw new _0x146074('presencelist-collapseat-invalid-format',this);if(_0x54485f<0x1)throw new _0x146074('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Sessions)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x340917(),this['balloonPanelView']=new _0x30020e(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[Sessions];}['init'](){for(const _0x4480b4 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x4480b4);this['listenTo'](this['_allConnectedUsers'],'add',(_0x24b0c8,_0x22457c)=>{this['_handleUserAdd'](_0x22457c);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x5d1eb8,_0x327861)=>{this['_handleUserRemove'](_0x327861);});}['_createView'](){const _0x3e0482=this['context'],_0x4fed84=new PresenceListView(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x35bfd3=this['balloonPanelView'];if(!_0xecfd2a(_0x3e0482['config']['get']('presenceList.container')))throw new _0x146074('presencelist-missing-container',this);return _0x4fed84['counterView']['bind']('usersCount')['to'](this),_0x4fed84['bind']('isCollapsed')['to'](this,'usersCount',_0x461710=>{const {collapseAt:_0x28785e}=_0x3e0482['config']['get']('presenceList'),_0x463b7e=_0x461710>=_0x28785e;if(_0x463b7e&&!_0x4fed84['inlineListView']['items']['find'](_0x7df740=>_0x7df740 instanceof PresenceCounterView)){const _0x3b0e79=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x3b0e79&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x4fed84['inlineListView']['items']['add'](_0x4fed84['counterView']);}return _0x463b7e||this['hideDropdown'](),_0x463b7e;}),_0x4fed84['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x32c292=>{const _0x48d4ca=_0x3e0482['config']['get']('presenceList'),_0x4e8120=new PresenceInlineListItemView(_0x3e0482['locale'],_0x32c292,!!_0x48d4ca['onClick']);return _0x4e8120['bind']('hasTooltip')['to'](_0x4fed84,'isCollapsed',_0x5037a0=>!_0x5037a0),_0x4e8120['bind']('isFocusable')['to'](_0x4fed84,'isCollapsed',_0x1d2afa=>!_0x1d2afa),_0x48d4ca['onClick']&&this['listenTo'](_0x4e8120,'execute',()=>{this['view']['isCollapsed']||_0x48d4ca['onClick'](_0x32c292,_0x4e8120['element']);}),_0x4e8120;}),this['listenTo'](_0x4fed84['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x4fed84['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x4fed84['inlineListView']['keystrokes']['set']('Enter',(_0x37bfaa,_0x5f2b91)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x5f2b91());}),_0x4fed84['render'](),_0x35bfd3['render'](),_0x1b7bff({'emitter':_0x4fed84,'activator':()=>_0x35bfd3['isVisible'],'contextElements':[_0x35bfd3['element'],_0x4fed84['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x3e0482['config']['get']('presenceList.container')['appendChild'](_0x4fed84['element']),this['_bodyCollection']=new _0x31aa2b(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x4fed84;}['_handleUserAdd'](_0x2dd407){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x2dd407['isMe'])return;const _0x1fe5ff=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x1fe5ff-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x3f0e28=_0x2dd407['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x2dd407,_0x3f0e28);}['_handleUserRemove'](_0xc4c792){this['usersCount']--;const {collapseAt:_0x32f19e}=this['context']['config']['get']('presenceList'),_0x49458a=this['usersCount']>=_0x32f19e;if(this['currentDisplayedUsers']['get'](_0xc4c792['id']))this['currentDisplayedUsers']['remove'](_0xc4c792['id']);else{if(_0x49458a&&this['currentDisplayedUsers']['length']+0x1===_0x32f19e-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x49458a?0x1:0x0)<this['usersCount']){for(const _0x5c97cf of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x5c97cf['id'])&&(this['currentDisplayedUsers']['add'](_0x5c97cf,Math['min'](this['currentDisplayedUsers']['length']-(_0x49458a?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x49458a?0x1:0x0)===_0x32f19e-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x28e09f=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new PresenceDropdownListView(this['context']['locale'],!!_0x28e09f['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x5a310e}=this['presenceDropdownView'];_0x5a310e['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x143c5e=>{if(!_0x28e09f['displayMe']&&_0x143c5e['isMe'])return null;const _0xf4fb8a=new PresenceDropdownListItemView(this['context']['locale'],_0x143c5e,!!_0x28e09f['onClick']);return _0x28e09f['onClick']&&this['listenTo'](_0xf4fb8a,'execute',()=>{_0x28e09f['onClick'](_0x143c5e,_0xf4fb8a['element']);}),_0xf4fb8a;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x5a310e['focus'](),_0x5a310e['checkIfScrollable']();const _0x43d4fe=(_0x543648,_0x353d9d)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x353d9d();};_0x5a310e['keystrokes']['set']('Esc',_0x43d4fe),_0x5a310e['keystrokes']['set']('Shift+Tab',_0x43d4fe),_0x5a310e['keystrokes']['set']('Tab',(_0x1b8102,_0x1df1f6)=>{!function(_0x54c3ff){const _0x3d9e6e=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x365741=>_0x365741+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x28480a=[...document['body']['querySelectorAll'](_0x3d9e6e)]['filter'](_0x111d4a=>_0x111d4a===document['activeElement']||_0x111d4a['offsetWidth']+_0x111d4a['offsetHeight']>0x0)['sort']((_0x5b5010,_0x2a2fe8)=>(_0x5b5010['tabIndex']||0x0)-(_0x2a2fe8['tabIndex']||0x0)),_0x7130b=_0x28480a['indexOf'](_0x54c3ff),_0x38e5ee=_0x28480a[(_0x7130b+0x1)%_0x28480a['length']];_0x38e5ee&&_0x38e5ee['focus']();}(this['view']['element']),this['hideDropdown'](),_0x1df1f6();}),_0x5a310e['focusTracker']['add'](this['view']['element']),_0x5a310e['focusTracker']['on']('change:isFocused',(_0x20bd05,_0x25549a,_0x11e0f5)=>{_0x11e0f5||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 PresenceList extends _0x1b9cff{static get['requires'](){return[Sessions,PresenceListUI];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{CloudServicesCommentsAdapter,CloudServicesRevisionHistoryAdapter,CloudServicesTrackChangesAdapter,PresenceList,PresenceListUI,RealTimeCollaborationClient,RealTimeCollaborativeComments,RealTimeCollaborativeEditing,RealTimeCollaborativeRevisionHistory,RealTimeCollaborativeTrackChanges,Sessions,WebSocketGateway};
|
|
23
|
+
import{ContextPlugin as _0x891fdc,Plugin as _0x18e830,PendingActions as _0x459582,Context as _0x1db326}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x1c552b,CKEditorError as _0x10b4e1,Collection as _0x20fb3f,global as _0x17d194,version as _0x51023f,uid as _0x9f4ec6,KeystrokeHandler as _0x5cc69c}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x5b9c9b,View as _0x4a5408,ListView as _0x4c2180,ListItemView as _0x57caa1,LabelView as _0x28a401,BalloonPanelView as _0x2a43c7,clickOutsideHandler as _0x154176,BodyCollection as _0x1c2f2b}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x23f357,History as _0xde6414,NoOperation as _0x4a4bb9,InsertOperation as _0x5ec806,MarkerOperation as _0x28fe23,RootAttributeOperation as _0x1603ea,transformOperationSets as _0x52cee7,OperationFactory as _0x124a27}from'@ckeditor/ckeditor5-engine/dist/index.js';import{CloudServices as _0x5c766a}from'@ckeditor/ckeditor5-cloud-services/dist/index.js';import{WebSocketGateway as _0x59254a,WEB_SOCKET_GATEWAY_STATES as _0x3c6eda,CollaborativeEditingService as _0x25acf6,User as _0x544a92,CommentsService as _0x1962a0,TrackChangesService as _0x743596,RevisionHistoryService as _0x4a0099,EditorService as _0x483c48}from'@ckeditor/ckeditor-cloud-services-collaboration';import{Users as _0x531388,UserView as _0x6af10f}from'@ckeditor/ckeditor5-collaboration-core/dist/index.js';import{Compressor as _0x5cd15f}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChangesEditing as _0x400485,TrackChanges as _0x250f30}from'@ckeditor/ckeditor5-track-changes/dist/index.js';import{CommentsRepository as _0x5d9000,Comments as _0x494d20,CommentsEditing as _0x3be2c1}from'@ckeditor/ckeditor5-comments/dist/index.js';import{RevisionHistory as _0x43f978}from'@ckeditor/ckeditor5-revision-history/dist/index.js';import{isElement as _0x594a36}from'es-toolkit/compat';class WebSocketGateway extends _0x891fdc{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>_0x59254a)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return[_0x5c766a,_0x5b9c9b];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x9d24b4){super(_0x9d24b4),this['set']('state',_0x3c6eda['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x1c552b())();}['init'](){const _0x3f3785=this['context'],_0x4f45b9=_0x3f3785['plugins']['get'](_0x5c766a),_0x35ad41=_0x3f3785['plugins']['get'](_0x5b9c9b);if(!_0x4f45b9['token'])throw new _0x10b4e1('websocketgateway-missing-token',this);if(!_0x4f45b9['webSocketUrl'])throw new _0x10b4e1('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),WebSocketGateway['WebSocketGateway']['connect'](_0x4f45b9['token'],_0x4f45b9['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x2ee97d=>{if(this['connection']=_0x2ee97d,this['bind']('state')['to'](_0x2ee97d,'state',this,'_isBrowserOffline',(_0x57a070,_0x220f3e)=>('connected'!==_0x57a070&&(this['_shouldPluginsReconnect']=!0x0),_0x220f3e||_0x57a070!==_0x3c6eda['CONNECTED']?_0x3c6eda['DISCONNECTED']:this['state']==_0x3c6eda['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x3c6eda['CONNECTING']):_0x3c6eda['CONNECTED'])),this['connection']['on']('error',(_0x1d61b4,_0x54f712)=>{if('limitExceeded'!==_0x54f712['code'])throw console['error'](_0x54f712),new _0x10b4e1('cloudservices-init',null,{'originalError':_0x54f712});_0x35ad41['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'});}),!_0x2ee97d['me'])return new Promise(_0x4e212d=>_0x2ee97d['on']('change:me',_0x4e212d));})['catch'](_0x432282=>{throw console['error'](_0x432282),new _0x10b4e1('cloudservices-init',null,{'originalError':_0x432282});});}['addToReconnectionStack'](_0x5da3f1){if('function'!=typeof _0x5da3f1['reconnect'])throw new _0x10b4e1('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x5da3f1))throw new _0x10b4e1('websocketgateway-plugin-already-registered',this,{'name':_0x5da3f1['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x5da3f1);}['removeFromReconnectionStack'](_0x175e33){this['_reconnectionStack']['delete'](_0x175e33);}['isInReconnectionStack'](_0x3261cd){return this['_reconnectionStack']['has'](_0x3261cd);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x4808f7=>_0x4808f7['reconnect']())))['then'](()=>this['state']=_0x3c6eda['CONNECTED'])['catch'](_0x569d95=>{throw console['error'](_0x569d95),new _0x10b4e1('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x3c6eda['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class Sessions extends _0x891fdc{['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[WebSocketGateway,_0x531388];}constructor(_0x255938){super(_0x255938),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x20fb3f(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x531388);}['init'](){const _0x456542=this['context']['plugins']['get'](WebSocketGateway);this['listenTo'](_0x456542,'change:state',(_0xe07415,_0xfd89e4,_0x376271)=>{if('connected'!==_0x376271)this['channelSessions']['forEach'](_0x1c5e0c=>_0x1c5e0c['clear']()),this['channelConnectedUsers']['forEach'](_0x2adb02=>_0x2adb02['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x1fb288,_0x41de78]of this['_registeredSessions'])for(const _0x12aeb0 of _0x41de78)this['_handleSessionAdd'](_0x1fb288,_0x12aeb0);}}),this['_createUser'](_0x456542['connection']['me'],!0x0);}['register'](_0x1dcda7,_0x223fe4){if(this['_registeredSessions']['has'](_0x1dcda7))throw new _0x10b4e1('sessions-register-already-registered',null,{'channelId':_0x1dcda7});this['_registeredSessions']['set'](_0x1dcda7,_0x223fe4),this['channelSessions']['set'](_0x1dcda7,new _0x20fb3f()),this['channelConnectedUsers']['set'](_0x1dcda7,new _0x20fb3f()),this['listenTo'](_0x223fe4,'add',(_0x11dda5,_0x1521f9)=>this['_handleSessionAdd'](_0x1dcda7,_0x1521f9)),this['listenTo'](_0x223fe4,'remove',(_0x260655,_0x284998)=>this['_handleSessionRemove'](_0x1dcda7,_0x284998));for(const _0x51e4ac of _0x223fe4)this['_handleSessionAdd'](_0x1dcda7,_0x51e4ac);}['unregister'](_0xeb776f){if(!this['_registeredSessions']['has'](_0xeb776f))throw new _0x10b4e1('sessions-unregister-not-exist',null,{'channelId':_0xeb776f});const _0x2cc4dd=this['_registeredSessions']['get'](_0xeb776f);this['stopListening'](_0x2cc4dd);for(const _0x3e435b of _0x2cc4dd)'connected'===this['context']['plugins']['get'](WebSocketGateway)['state']&&this['_handleSessionRemove'](_0xeb776f,_0x3e435b);this['_registeredSessions']['delete'](_0xeb776f),this['channelSessions']['delete'](_0xeb776f),this['channelConnectedUsers']['delete'](_0xeb776f);}get['mySessionId'](){return this['context']['plugins']['get'](WebSocketGateway)['connection']['sessionId'];}['getUserBySessionId'](_0x4ef3ed){for(const _0xec600e of this['channelSessions']['values']())for(const _0x506c92 of _0xec600e)if(_0x506c92['id']===_0x4ef3ed)return _0x506c92['user'];}['getUserSessions'](_0x12fa11,_0x4c8ac1){const _0x37d273=_0x4c8ac1?[this['channelSessions']['get'](_0x4c8ac1)]:this['channelSessions']['values'](),_0x147506=new Set();for(const _0x4d9e62 of _0x37d273)for(const _0x4762ef of _0x4d9e62)_0x4762ef['user']['id']===_0x12fa11['id']&&_0x147506['add'](_0x4762ef['id']);return _0x147506;}['getUserRole'](_0x4ad32c){for(const _0x358f77 of this['channelSessions']['values']())for(const _0x2cbca0 of _0x358f77)if(_0x2cbca0['user']===_0x4ad32c)return _0x2cbca0['role'];}['_handleSessionAdd'](_0x38e48d,_0x5da4a1){if('connected'!==this['context']['plugins']['get'](WebSocketGateway)['state'])return;const _0x4d613d=_0x5da4a1['user'],_0x284a5a=this['_users']['getUser'](_0x4d613d['id'])||this['_createUser'](_0x4d613d),_0x50e0d8=Object['assign']({},_0x5da4a1,{'user':_0x284a5a});if(this['channelSessions']['get'](_0x38e48d)['add'](_0x50e0d8),!_0x4d613d['hiddenInPresenceList']){const _0x552e3c=this['channelConnectedUsers']['get'](_0x38e48d);_0x552e3c['has'](_0x284a5a['id'])||_0x552e3c['add'](_0x284a5a),this['allConnectedUsers']['has'](_0x284a5a['id'])||_0x4d613d['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x284a5a,_0x284a5a['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x38e48d,{'channelId':_0x38e48d,'session':_0x50e0d8});}['_handleSessionRemove'](_0x243e34,_0x25abe2){if('connected'!==this['context']['plugins']['get'](WebSocketGateway)['state'])return;const _0x7f216b=this['channelConnectedUsers']['get'](_0x243e34),_0x10f066=_0x25abe2['user'];_0x10f066['id']&&(this['channelSessions']['get'](_0x243e34)['remove'](_0x25abe2['id']),_0x7f216b['has'](_0x10f066['id'])&&!this['getUserSessions'](_0x10f066,_0x243e34)['size']&&_0x7f216b['remove'](_0x10f066['id']),this['allConnectedUsers']['get'](_0x10f066['id'])&&!this['getUserSessions'](_0x10f066)['size']&&this['allConnectedUsers']['remove'](_0x10f066['id']));}['_createUser'](_0x4b88f2,_0xc194cd){const _0x47b116=this['_users']['addUser'](_0x4b88f2);return _0xc194cd&&this['_users']['defineMe'](_0x4b88f2['id']),_0x47b116['orderNumber']=this['_uniqueUsersCount']++,_0x47b116;}}class UserMarkers extends _0x18e830{['_domEmitter']=new(_0x1c552b())();static get['requires'](){return[Sessions];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x16d763=this['editor'],_0x12e57b=_0x16d763['plugins']['get'](Sessions);_0x16d763['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x945411,{writer:_0x2656c5})=>function(_0xa9a14,_0x21a10f,_0x50fa26,_0x339016){const _0x4f7477=_0xa9a14['markerName']['split'](':')[0x2],_0x440851=_0x50fa26['getUserBySessionId'](_0x4f7477);if(!_0x440851||_0x4f7477===_0x50fa26['mySessionId'])return;if(!_0x339016['model']['schema']['checkChild'](_0xa9a14['markerRange']['start'],'$text'))return;const _0x340df6={'class':'ck-user__marker\x20'+_0x440851['color']['getMarkerClass'](),'style':Y(_0x440851),'data-name':_0x440851['name'],'data-session-id':_0x4f7477},_0x597176=_0x339016['model']['markers']['get'](_0xa9a14['markerName']),_0x3a8f88=_0x597176['getStart'](),_0x245e45=_0x3a8f88['nodeAfter'],_0x19a168=_0x339016['model']['schema'];if(_0x245e45&&_0x19a168['isObject'](_0x245e45)&&_0x19a168['isInline'](_0x245e45)&&!_0x339016['model']['markers']['get']('user:range:'+_0x4f7477)['getRange']()['isCollapsed'])return;const _0x261e9b=_0x3a8f88['parent'];return _0x339016['model']['schema']['isLimit'](_0x261e9b)&&!_0x339016['model']['hasContent'](_0x261e9b)&&(_0x340df6['contenteditable']=!0x1),function(_0x2bafb8,_0x5bbf65,_0x559b4b){const _0x24497b=_0x2bafb8['createUIElement']('span',_0x5bbf65);return _0x2bafb8['setCustomProperty']('userPositionMarker',!0x0,_0x24497b),_0x24497b['render']=function(_0x46b722){const _0x15334a=this['toDomElement'](_0x46b722),_0x3f9253=document['createElement']('span');return _0x3f9253['classList']['add']('ck-user__marker-tooltip'),_0x3f9253['setAttribute']('contenteditable','false'),_0x3f9253['setAttribute']('spellcheck','false'),_0x3f9253['textContent']=_0x559b4b['name'],_0x15334a['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x3f9253['outerHTML']+'',_0x15334a['addEventListener']('mouseenter',()=>{_0x15334a['classList']['add']('ck-user__marker_hovered');}),_0x15334a['addEventListener']('mouseleave',()=>{_0x15334a['classList']['remove']('ck-user__marker_hovered');}),_0x15334a;},_0x24497b['isSimilar']=function(_0x16e044){return!(!this['getCustomProperty']('userPositionMarker')||!_0x16e044['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x16e044['getAttribute']('data-session-id'));},_0x24497b;}(_0x21a10f,_0x340df6,_0x440851);}(_0x945411,_0x2656c5,_0x12e57b,_0x16d763)}),_0x16d763['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x12b97b=>function(_0x45b8e0,_0x2cf952){const _0x2196c5=_0x45b8e0['markerName']['split'](':')[0x2];if(_0x2196c5===_0x2cf952['mySessionId'])return null;const _0x47a28a=_0x2cf952['getUserBySessionId'](_0x2196c5);if(!_0x47a28a)return{'id':_0x2196c5,'classes':[]};return{'id':_0x2196c5,'classes':['ck-user__selection',_0x47a28a['color']['getSelectionClass']()],'attributes':{'style':Y(_0x47a28a),'data-session-id':_0x2196c5},'priority':0x7d0+_0x47a28a['orderNumber']};}(_0x12b97b,_0x12e57b)}),function(_0x552444){const _0x543ed5=_0x552444['model'],_0x1b217d=new Map(),_0x3f3b1d=_0x552444['plugins']['get'](Sessions);_0x543ed5['markers']['on']('update:user:range',(_0x50657c,_0x1845a4,_0x239918,_0x3f302a)=>{if(!_0x3f302a&&_0x1b217d['get'](_0x1845a4['name']))return _0x1b217d['get'](_0x1845a4['name'])['detach'](),void _0x1b217d['delete'](_0x1845a4['name']);const _0x59fbf4=_0x1845a4['name']['split'](':')[0x2];if(_0x59fbf4===_0x3f3b1d['mySessionId'])return;const _0xd0ad6='user:position:'+_0x59fbf4;_0x543ed5['markers']['has'](_0xd0ad6)&&_0x552444['editing']['reconvertMarker'](_0xd0ad6),_0x1845a4['on']('change:range',(_0x3cf329,_0xde7148,_0x31d3e7)=>{if('$graveyard'!=_0xde7148['root']['rootName']&&'$graveyard'==_0x1845a4['getRange']()['root']['rootName']&&!_0x1b217d['has'](_0x1845a4['name'])){const _0x4b6793=_0x543ed5['schema']['getNearestSelectionRange'](_0x31d3e7['deletionPosition']);if(_0x4b6793){const _0x551255=_0x23f357['fromRange'](_0x4b6793);_0x1b217d['set'](_0x1845a4['name'],_0x551255),_0x551255['on']('change:range',(_0x2d803b,_0x12908e,_0x2b7163)=>{if('$graveyard'==_0x551255['root']['rootName']){const _0x4dac57=_0x543ed5['schema']['getNearestSelectionRange'](_0x2b7163['deletionPosition']);_0x4dac57?(_0x551255['start']=_0x4dac57['start'],_0x551255['end']=_0x4dac57['end']):(_0x1b217d['delete'](_0x1845a4['name']),_0x551255['detach']());}});}}});}),_0x543ed5['document']['on']('change',()=>{_0x1b217d['size']>0x0&&_0x543ed5['enqueueChange']({'isUndoable':!0x1},_0x3d56f3=>{for(const [_0x2d1d4c,_0x543be8]of _0x1b217d)'$graveyard'==_0x543ed5['markers']['get'](_0x2d1d4c)['getRange']()['root']['rootName']&&(z(_0x2d1d4c['split'](':')[0x2],_0x543be8['toRange'](),_0x543ed5,_0x3d56f3),_0x543be8['detach']());_0x1b217d['clear']();});});}(_0x16d763),this['_domEmitter']['listenTo'](_0x17d194['document'],'keydown',(_0x1a9a69,{key:_0x151170})=>{'Escape'===_0x151170&&function(_0x102853){_0x102853['editing']['view']['change'](_0x2e4b5b=>{for(const _0x373439 of _0x102853['model']['markers']){if(!_0x373439['name']['startsWith']('user:position'))continue;const _0x14cb5c=_0x102853['editing']['mapper']['markerNameToElements'](_0x373439['name']);if(_0x14cb5c){for(const _0x13ed7e of _0x14cb5c)_0x2e4b5b['removeClass']('ck-user__marker_hovered',_0x13ed7e);}}});}(_0x16d763);},{'useCapture':!0x0});}['afterInit'](){const _0x3ce797=this['editor'],_0x1cbbae=_0x3ce797['commands']['get']('undo');_0x1cbbae&&_0x3ce797['model']['on']('applyOperation',(_0xabe29d,_0x125946)=>{const _0x11b2e4=_0x125946[0x0];if(!_0x11b2e4['isDocumentOperation'])return;if('marker'!=_0x11b2e4['type']||!_0x11b2e4['name']['startsWith']('user:'))return;const _0x57d914=_0x11b2e4['batch'];_0x1cbbae['_createdBatches']['has'](_0x57d914)&&(_0x11b2e4['newRange']=_0x11b2e4['oldRange']?_0x3ce797['model']['createRange'](_0x11b2e4['oldRange']['start'],_0x11b2e4['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x1bc0af=this['editor'],_0xe5b02d=_0x1bc0af['model']['document'],_0x516cec=_0x1bc0af['plugins']['get'](Sessions);_0x1bc0af['model']['enqueueChange']({'isUndoable':!0x1},_0x27a2bf=>{const _0xc8753='user:range:'+_0x516cec['mySessionId'],_0x341539='user:position:'+_0x516cec['mySessionId'],_0x30d801=_0x1bc0af['model']['markers']['has'](_0xc8753);_0x1bc0af['editing']['view']['hasDomSelection']?z(_0x516cec['mySessionId'],_0xe5b02d['selection']['getFirstRange'](),_0x1bc0af['model'],_0x27a2bf):_0x30d801&&(_0x27a2bf['removeMarker'](_0xc8753),_0x27a2bf['removeMarker'](_0x341539));});}}function z(_0x18e98a,_0x228da7,_0x1c5f53,_0x27482c){const _0x3f28b1='user:range:'+_0x18e98a,_0xfc1539='user:position:'+_0x18e98a,_0x1d38b9=_0x228da7['getContainedElement']();let _0x2e7614=_0x228da7['start'];if(_0x1d38b9&&_0x1d38b9['is']('element','tableCell')){const _0x412497=function(_0x1c6a5e,_0x3b32bb){for(const _0x10ab8b of _0x1c6a5e['getPositions']())if(_0x3b32bb['schema']['checkChild'](_0x10ab8b,'$text'))return _0x10ab8b;}(_0x228da7,_0x1c5f53);_0x412497&&(_0x2e7614=_0x412497,_0x228da7=_0x27482c['createRange'](_0x2e7614));}const _0x21a67a=_0x27482c['createRange'](_0x2e7614);_0x1c5f53['markers']['has'](_0x3f28b1)?(_0x27482c['updateMarker'](_0x3f28b1,{'range':_0x228da7}),_0x27482c['updateMarker'](_0xfc1539,{'range':_0x21a67a})):(_0x27482c['addMarker'](_0x3f28b1,{'range':_0x228da7,'usingOperation':!0x0}),_0x27482c['addMarker'](_0xfc1539,{'range':_0x21a67a,'usingOperation':!0x0}));}function Y(_0xe1d44d){return'--ck-user-color:'+_0xe1d44d['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0xe1d44d['color']['getColorAlphaVariable']()+';';}function K(_0x162267,_0x5ef377,_0x53877d){const _0x2a36c6=_0x162267['t'],t=_0x162267['t'];switch(_0x5ef377){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 _0x2a36c6({'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'},_0x53877d);default:return'';}}let J=0x1;class RealTimeCollaborationClient extends _0x18e830{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x25acf6)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[WebSocketGateway,Sessions,UserMarkers,_0x459582,_0x531388,_0x5b9c9b];}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 _0x4e768f=this['serverHistory']['getOperations']();for(let _0x3d79ac=_0x4e768f['length']-0x1;_0x3d79ac>=0x0;_0x3d79ac--){const _0x560332=_0x4e768f[_0x3d79ac];if(!this['_disconnectionOperations']['has'](_0x560332))return _0x560332['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1c49af){if(super(_0x1c49af),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0xde6414(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x10b4e1('collaboration-missing-channelid',this);const _0x3ecf27=_0x1c49af['config']['get']('cloudServices.bundleVersion')||_0x51023f;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x3ecf27,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x5cd15f(),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 OperationIdentifier(this['_disconnectionOperations']);}['init'](){const _0x2a80a0=this['editor'],_0x273ac9=_0x2a80a0['plugins']['get'](_0x531388),_0xf8cbbd=_0x2a80a0['plugins']['get'](WebSocketGateway);this['listenTo'](_0x273ac9,'getOperationAuthor',(_0x3b5c57,_0x354017)=>{const _0x4a361e=_0x354017[0x0];_0x4a361e['_authorId']&&(_0x3b5c57['return']=_0x273ac9['getUser'](_0x4a361e['_authorId']),_0x3b5c57['stop']()),null===_0x4a361e['_authorId']&&(_0x3b5c57['return']=null,_0x3b5c57['stop']());},{'priority':'high'}),this['listenTo'](_0x2a80a0['model']['document']['selection'],'change:range',(_0x57b2e5,_0x35b602)=>{_0x35b602['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x2a80a0['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x2a80a0['model']['on']('applyOperation',(_0x46bb3b,_0x234992)=>{const _0xfe223d=_0x234992[0x0];_0xfe223d['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0xfe223d),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0xf8cbbd,'state',this,'_hasSynchronizationProblem',(_0x4ec21c,_0x44a648)=>'connected'===_0x4ec21c&&!_0x44a648),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x2a80a0['disableReadOnlyMode']('rtc-offline'):_0x2a80a0['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x2a80a0['disableReadOnlyMode']('rtc-offline'):_0x2a80a0['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x4c015d=this['editor']['plugins']['get'](Sessions),_0x3f63f0=this['editor']['plugins']['get'](WebSocketGateway);try{this['_isPendingUpdate']=!0x0,_0x4c015d['unregister'](this['_channelId']);const _0x10be54=await this['_service']['reconnect'](_0x3f63f0['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x10be54)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x5842a1=await this['_service']['getConnectedSessions']();_0x4c015d['register'](this['_channelId'],_0x5842a1),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x5156fa){if(function(_0xabe03f){return'404'===_0xabe03f['code'];}(_0x5156fa)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x36653a){return'409'===_0x36653a['code'];}(_0x5156fa)){const _0x11ec5c=K(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x11ec5c);}else{if(!(_0x5156fa instanceof ReconnectionError))throw _0x5156fa;this['_handleReconnectionError']();}}}}['destroy'](){const _0x2f2d89=this['editor']['plugins']['get'](WebSocketGateway),_0x1902a6=this['editor']['plugins']['get'](Sessions);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x1902a6['channelSessions']['has'](this['_channelId'])&&_0x1902a6['unregister'](this['_channelId']),_0x2f2d89['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x5ec3ce){if(this['sessionId']!==_0x5ec3ce['sessionId']&&this['_lastSyncedOperationId']!==_0x5ec3ce['lastOperationId'])throw new ReconnectionError();return this['sessionId']=_0x5ec3ce['sessionId'],this['_handleServerResponse']([],{..._0x5ec3ce,'wereChangesApplied':!0x1,'data':_0x5ec3ce['data']},'reconnect');}async['_connectService'](_0x2c2826,_0x31fdfe=!0x1){const {connection:_0x5611d4}=this['editor']['plugins']['get'](WebSocketGateway);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x5611d4,this['_channelId'])['then'](_0x51296f=>this['_initSessionsHandling'](_0x51296f))['catch'](_0x3703e2=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x3703e2);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x132819,_0x3dcc69)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x3dcc69);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x4d7124=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2c2826);this['_isPendingUpdate']=!0x0;const _0x3131f7=await this['_service']['connect'](_0x5611d4,this['_compressOperations'](_0x2c2826),_0x4d7124);if(this['sessionId']=_0x3131f7['sessionId'],_0x31fdfe){if(!_0x3131f7['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3131f7['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x2c2826,_0x3131f7,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3131f7,_0x2c2826);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x3b8887=this['editor']['plugins']['get'](Sessions),_0x94112c=this['editor']['plugins']['get'](UserMarkers),_0x227e60=_0x3b8887['channelSessions']['get'](this['_channelId']);_0x227e60&&_0x227e60['length']>0x1?_0x94112c['createUserMarkerOperations']():this['listenTo'](_0x3b8887,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x3b8887['channelSessions']['get'](this['_channelId'])['length']&&_0x94112c['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x39bc23,_0x161aa0,_0xae2892,_0x4cfc6a){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x161aa0){const _0x37d770=this['_decompressOperations'](_0xae2892,_0x4cfc6a);await this['_fetchMissingUsers'](_0x37d770),this['_handleExternalOperations'](_0x37d770,_0x161aa0,_0xae2892['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x3264d9}=this['editor'];let _0x229510;try{_0x229510=await this['_service']['getDocumentDetails']();}catch{const _0x13ed5c=K(_0x3264d9,'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'](_0x13ed5c);}const _0x454fb7=_0x229510['currentDocumentSession']||_0x229510['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x454fb7['lastOperationId']){const _0x319331=K(_0x3264d9,'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'](_0x319331);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x5543d9){const _0x4a9913=this['editor']['plugins']['get'](Sessions);this['listenTo'](_0x4a9913,'sessionAdd:'+this['_channelId'],(_0x8e2899,{session:_0x1de28f})=>{if(_0x1de28f['id']===_0x4a9913['mySessionId']){_0x8e2899['off']();const _0x4c7c1f=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x5b9206=_0x1de28f['permissions'];_0x4c7c1f&&_0x4c7c1f['isEnabled']&&(_0x5b9206=_0x5b9206['filter'](_0x4501f6=>'document:write'!==_0x4501f6)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x5b9206,this['_channelId']);}}),_0x4a9913['register'](this['_channelId'],_0x5543d9);}['_initThrowingOnDataSet'](){const _0x56a03d=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x391fed)=>{if(!_0x391fed[_0x391fed['length']-0x1]['suppressErrorInCollaboration'])throw new _0x10b4e1('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x56a03d['apply'](this['editor']['data'],_0x391fed);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x3aa586,[_0x4a507c])=>{if(this['_document']['version'])throw new _0x10b4e1('realtimecollaborationclient-init-document-already-initialized',this);_0x3aa586['stop'](),this['_setPendingAction']();const _0x3d4035=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x3b1505])=>!_0x3b1505['lazyLoad'])['map'](([_0x26d34c,_0x5192a1])=>[_0x26d34c,_0x5192a1['modelAttributes']||{}])),_0x4b83b2=this['_getOperationsFromInitData'](_0x4a507c,_0x3d4035);0x0==_0x4b83b2['length']&&_0x4b83b2['push'](new _0x4a4bb9(0x0)),_0x3aa586['return']=this['_connectService'](_0x4b83b2)['then'](()=>{this['editor']['plugins']['get'](WebSocketGateway)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x372b38=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x372b38))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0xf19d2f,[_0x29beca,_0x2f9ee7])=>{_0xf19d2f['stop']();const _0x44be9c=this['editor']['model']['document']['getRoot'](_0x29beca);if(!this['_knownRootNames']['has'](_0x29beca)){const _0x562e94=_0x2f9ee7&&_0x2f9ee7['data']?_0x2f9ee7['data']:'',_0x150072=_0x2f9ee7&&_0x2f9ee7['attributes']?_0x2f9ee7['attributes']:{};await this['_loadRoot'](_0x29beca,_0x562e94,_0x150072);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x44be9c['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x44be9c);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x4c916f){const _0x46d8a1=this['editor']['plugins']['get'](_0x531388),{connection:_0x3d0881}=this['editor']['plugins']['get'](WebSocketGateway),_0x7fece6=new Set();for(const _0x3a721b of _0x4c916f){const _0x4f540c=_0x3a721b['_authorId'];_0x4f540c&&!_0x46d8a1['getUser'](_0x4f540c)&&_0x7fece6['add'](_0x4f540c);}if(0x0===_0x7fece6['size'])return;const _0x486fb4=await _0x544a92['getMany'](_0x3d0881,Array['from'](_0x7fece6));for(const _0x388202 of _0x486fb4)_0x46d8a1['getUser'](_0x388202['id'])||_0x46d8a1['addUser'](_0x388202);}['_getOperationsFromInitData'](_0x48c3e1,_0x4e80f5={}){const _0xaee820=this['editor']['model'],_0xf96d26=[];let _0x15ce18=0x0;const _0x1a7d5f='string'==typeof _0x48c3e1?{'main':_0x48c3e1}:_0x48c3e1;for(const _0x4de1c9 of Object['keys'](_0x1a7d5f)){if(!this['_document']['roots']['has'](_0x4de1c9))throw new _0x10b4e1('realtimecollaborationclient-init-non-existent-root',this);const _0x4ce655=this['_document']['getRoot'](_0x4de1c9),_0x435350=this['editor']['data']['parse'](_0x1a7d5f[_0x4de1c9],_0x4ce655),_0x5db5c1=new _0x5ec806(_0xaee820['createPositionAt'](_0x4ce655,0x0),_0x435350,_0x15ce18++);_0xf96d26['push'](_0x5db5c1);for(const [_0x5c666f,_0x258551]of _0x435350['markers']){const _0x4bc44b=_0xaee820['createRange'](_0xaee820['createPositionFromPath'](_0x4ce655,_0x258551['start']['path']['slice']()),_0xaee820['createPositionFromPath'](_0x4ce655,_0x258551['end']['path']['slice']())),_0x63aa33=new _0x28fe23(_0x5c666f,null,_0x4bc44b,_0xaee820['markers'],!0x0,_0x15ce18++);_0xf96d26['push'](_0x63aa33);}}if(_0x4e80f5)for(const [_0x18d857,_0x4e7783]of Object['entries'](_0x4e80f5)){const _0x4d1787=_0xaee820['document']['getRoot'](_0x18d857);if(!_0x4d1787)throw new _0x10b4e1('multi-root-editor-root-attributes-no-root',null);for(const [_0x1160eb,_0x3bfa21]of Object['entries'](_0x4e7783))if(null!==_0x3bfa21){const _0xaf69e4=new _0x1603ea(_0x4d1787,_0x1160eb,null,_0x3bfa21,_0x15ce18++);_0xf96d26['push'](_0xaf69e4);}}return _0xf96d26;}async['_loadRoot'](_0x56f657,_0xec446e,_0x49dffa){this['_getOperationsFromInitData']({[_0x56f657]:_0xec446e},{[_0x56f657]:_0x49dffa})['forEach']((_0x2cde3b,_0x5a9aca)=>{_0x2cde3b['baseVersion']=this['_document']['version']+_0x5a9aca,_0x2cde3b['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2cde3b);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x154c06,_0x48627a){let _0x26f0d8;this['_offset']=_0x154c06['offset'];const _0x4b5e17=_0x154c06['wereChangesApplied']&&!_0x154c06['initData'],_0x5e6426=_0x4b5e17?0x0:_0x154c06['data']['baseVersion'];if(_0x48627a['forEach'](_0x3ffed0=>{_0x3ffed0['_isInit']=!0x0,_0x3ffed0['createdAt']=_0x154c06['sessionCreatedAt'],_0x3ffed0['_authorId']=null;}),_0x4b5e17)_0x26f0d8=_0x48627a,this['_applyOperationsSet'](_0x26f0d8,_0x4b5e17);else{if(_0x154c06['initData']){const _0x554a87=this['_getOperationsFromInitData'](_0x154c06['initData']);this['_document']['history']['version']=-_0x554a87['length'],_0x554a87['forEach'](_0xafb2e8=>{_0xafb2e8['baseVersion']-=_0x554a87['length'],_0xafb2e8['createdAt']=_0x154c06['sessionCreatedAt'],_0xafb2e8['_isInit']=!0x0,_0xafb2e8['_authorId']=null;}),this['_applyOperationsSet'](_0x554a87,!0x0),this['serverHistory']['version']=-_0x554a87['length']+this['_offset'],this['_updateServerHistory'](_0x554a87);}this['_document']['history']['version']=_0x5e6426,_0x26f0d8=this['_decompressOperations'](_0x154c06['data'],_0x154c06['metadata']),await this['_fetchMissingUsers'](_0x26f0d8),this['_applyOperationsSet'](_0x26f0d8,_0x4b5e17);}_0x154c06['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x26f0d8,_0x154c06['lastOperationId']),this['_lastSyncedOperationId']=_0x154c06['lastOperationId']),this['serverHistory']['version']=_0x5e6426+this['_offset'],this['_updateServerHistory'](_0x26f0d8),_0x48627a['filter'](_0x46d38c=>{const _0x4f1748=this['_getAffectedRoot'](_0x46d38c);return _0x4f1748&&!this['_knownRootNames']['has'](_0x4f1748);})['forEach']((_0x3c66da,_0x363d0b)=>{_0x3c66da['baseVersion']=this['_document']['version']+_0x363d0b,this['_saveOperationInBuffer'](_0x3c66da);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x211123,_0x504e5d){const _0x25a06c=_0x504e5d&&_0x504e5d['message'];if(_0x25a06c&&_0x25a06c['startsWith']('realtimecollaborationclient'))throw _0x504e5d;const _0x5b2221=this['editor']['plugins']['get'](WebSocketGateway);throw this['_isPendingUpdate']=!0x0,_0x5b2221['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x10b4e1(_0x211123,this['editor'],_0x25a06c?{'originalError':_0x25a06c}:void 0x0);}['_saveOperationInBuffer'](_0x55b10e){this['_knownOperations']['has'](_0x55b10e)||(this['_knownOperations']['add'](_0x55b10e),this['_bufferedOperations']['push'](_0x55b10e),this['_pendingAction']||'marker'==_0x55b10e['type']&&!_0x55b10e['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x27e2a5=!0x1){!_0x27e2a5&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x1c1c9d=>{_0x1c1c9d&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x5d56ff=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x28aa67){return _0x28aa67['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x28aa67['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x28aa67['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x5d56ff)||this['_crash'](_0x5d56ff['message'],_0x5d56ff);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x7dce91=>{this['on']('change:_isPendingUpdate',()=>{_0x7dce91();});});}async['_sendBufferedOperations'](){const _0x5221fb=this['editor']['plugins']['get'](UserMarkers);if(this['_shouldSendSelectionUpdate']()&&(_0x5221fb['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x540157=[...this['_bufferedOperations']];for(const _0x3cdc11 of _0x540157)_0x3cdc11['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x3cdc11);const _0x1ade7e=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x540157),_0x416ab1=J++,_0x5bcb37=this['_compressOperations'](_0x540157),_0x46fa50=await this['_service']['sendOperations'](_0x5bcb37,_0x5bcb37['baseVersion'],_0x1ade7e);try{return await this['_handleServerResponse'](_0x540157,_0x46fa50,_0x416ab1);}catch(_0x4b86af){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x4b86af);}}async['_handleServerResponse'](_0x2d103a,_0x34e4d9,_0x53d618){if('error'in _0x34e4d9)throw _0x34e4d9['error'];let _0x136fc8=!0x1;if(_0x34e4d9['wereChangesApplied']){_0x34e4d9['lastOperationId']&&(this['_lastSyncedOperationId']=_0x34e4d9['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x4c3728=>!_0x2d103a['includes'](_0x4c3728));for(const _0x58091c of _0x2d103a)_0x58091c['createdAt']='lastOperationAcceptedAt'in _0x34e4d9&&_0x34e4d9['lastOperationAcceptedAt']||void 0x0;Q(_0x2d103a,_0x34e4d9['version']-_0x2d103a['length']),this['_updateServerHistory'](_0x2d103a);const _0x2e0e85=_0x2d103a['filter'](_0x1bdf23=>{if(!_0x1bdf23['_isInit'])return!0x1;const _0xd26358=this['_getAffectedRoot'](_0x1bdf23);return _0xd26358&&!this['_knownRootNames']['has'](_0xd26358);});Q(_0x2e0e85,this['_document']['version']),this['_applyOperationsSet'](_0x2e0e85),_0x136fc8=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1402f8=this['_decompressOperations'](_0x34e4d9['data'],_0x34e4d9['metadata'])['filter'](_0x11adb1=>_0x11adb1['baseVersion']>=this['_lastServerVersion']);_0x1402f8['forEach'](_0x60b258=>this['_addKnownRoot'](_0x60b258)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x35ecab=>!_0x35ecab['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x35ecab))),this['_bufferedOperations']['length']&&Q(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1402f8),_0x136fc8=this['_handleExternalOperations'](_0x1402f8,_0x34e4d9['version'],_0x34e4d9['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x136fc8?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x3c6419,_0x4b2c9b,_0x1a1bf6){try{const _0x4001b7={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x271f40,operationsB:_0x3b1f1f,originalOperations:_0x209c86}=_0x52cee7(_0x3c6419,this['_bufferedOperations'],_0x4001b7);Q(_0x271f40,this['_document']['version']),Q(_0x3b1f1f,_0x4b2c9b);for(const _0x1ce822 of _0x271f40){const _0x8dbeb9=_0x209c86['get'](_0x1ce822);_0x1ce822['_authorId']=_0x8dbeb9?_0x8dbeb9['_authorId']:null;}_0x1a1bf6&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3c6419,_0x1a1bf6),this['_lastSyncedOperationId']=_0x1a1bf6),this['_bufferedOperations']=[..._0x3b1f1f],this['_applyOperationsSet'](_0x271f40),this['_updateServerHistory'](_0x3c6419);}catch(_0x4f75c8){return console['error'](_0x4f75c8),!0x1;}return!0x0;}['_applyOperationsSet'](_0x2bae45,_0x372e8b=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x385ce8=>{for(const _0x3fed54 of _0x2bae45)this['_knownOperations']['add'](_0x3fed54),this['_addKnownRoot'](_0x3fed54),_0x385ce8['batch']['addOperation'](_0x3fed54),this['editor']['model']['applyOperation'](_0x3fed54);});}['_addKnownRoot'](_0x21eea9){const _0x40d122=this['_getAffectedRoot'](_0x21eea9);_0x40d122&&this['_knownRootNames']['add'](_0x40d122);}['_getAffectedRoot'](_0x43b6e8){let _0x3a98f0,_0x48afc9;switch(_0x43b6e8['type']){case'insert':_0x3a98f0=_0x43b6e8['position']['root'];break;case'marker':if(_0x48afc9=_0x43b6e8['newRange'],!_0x48afc9)return null;_0x3a98f0=_0x48afc9['root'];break;case'addRootAttribute':_0x3a98f0=_0x43b6e8['root'];break;case'addRoot':_0x3a98f0=_0x43b6e8['affectedSelectable'];break;case'move':_0x3a98f0=_0x43b6e8['targetPosition']['root'];break;default:return null;}return _0x3a98f0['rootName'];}['_updateServerHistory'](_0x24eb9b){_0x24eb9b['forEach'](_0xa31262=>{const _0x2fc7ed=_0xa31262['clone']();_0x2fc7ed['_authorId']=_0xa31262['_authorId'],_0x2fc7ed['_isInit']=!!_0xa31262['_isInit'],_0x2fc7ed['createdAt']=_0xa31262['createdAt'],_0x2fc7ed['baseVersion']+=this['_offset'],_0xa31262['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x2fc7ed),this['serverHistory']['addOperation'](_0x2fc7ed);});}['_handleReconnectionError'](_0x588c5f){const _0x42cd83=this['editor']['plugins']['get']('Notification'),_0x34e94d=this['editor']['locale'];_0x588c5f||(_0x588c5f=K(_0x34e94d,'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.')),_0x42cd83['showWarning'](_0x588c5f,{'title':K(_0x34e94d,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](WebSocketGateway)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x459582)['add'](K(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x459582)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x28717e){const _0x60d59=_0x28717e['map'](_0x31aaf5=>_0x31aaf5['toJSON']());return this['_compressor']['compress'](_0x60d59);}['_decompressOperations'](_0x548819,_0x417d5c){return this['_compressor']['decompress'](_0x548819)['map']((_0x281827,_0x987f72)=>{const _0x4911b9='init'==_0x417d5c[_0x987f72]['type'];if('InsertOperation'==_0x281827['__className']){const _0x40aa0b=_0x281827['position']['root'];!this['_document']['getRoot'](_0x40aa0b)&&(this['_document']['createRoot']('$unknown',_0x40aa0b)['_isAttached']=!0x1);}else{if('RootOperation'==_0x281827['__className']){const _0x214e4d=this['_document']['getRoot'](_0x281827['rootName']);_0x214e4d&&'$unknown'==_0x214e4d['name']&&_0x281827['elementName']!=_0x214e4d['name']&&(_0x214e4d['name']=_0x281827['elementName']);}}const _0x31d2c8=_0x124a27['fromJSON'](_0x281827,this['_document']);return _0x31d2c8['wasUndone']=_0x281827['wasUndone'],_0x31d2c8['_isInit']=_0x4911b9,_0x31d2c8['_authorId']=_0x4911b9?null:_0x417d5c[_0x987f72]['userId'],_0x31d2c8['_isDisconnection']='cs:removeUser'===_0x417d5c[_0x987f72]['type'],_0x31d2c8['createdAt']=_0x417d5c[_0x987f72]['createdAt'],_0x31d2c8;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x4280ae=this['editor']['plugins']['get'](Sessions)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x4280ae&&_0x4280ae['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class ReconnectionError extends Error{}function Q(_0x2d009a,_0x87a806){for(const _0x5c8100 of _0x2d009a)_0x5c8100['baseVersion']=_0x87a806++;}class OperationIdentifier{['_ignoredOperations'];['_operationToId'];constructor(_0x34bbbb){this['_ignoredOperations']=_0x34bbbb,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x43f604){let _0x5dedc6=_0x43f604['length'];for(;_0x5dedc6--;){const _0x1822de=_0x43f604[_0x5dedc6];if(!this['_ignoredOperations']['has'](_0x1822de)){if(!this['_operationToId']['has'](_0x1822de)){const _0x2e7c46=_0x9f4ec6()['slice'](0x1,0x12);this['_operationToId']['set'](_0x1822de,_0x2e7c46);}return this['_operationToId']['get'](_0x1822de);}}}['setIdForTheLastOperation'](_0x53008c,_0xba05f5){if(!_0xba05f5)return;let _0x33082d=_0x53008c['length'];for(;_0x33082d--;){const _0x5c3356=_0x53008c[_0x33082d];this['_ignoredOperations']['has'](_0x5c3356)||this['_operationToId']['set'](_0x5c3356,_0xba05f5);}}}class RealTimeCollaborativeEditing extends _0x18e830{static get['requires'](){return[RealTimeCollaborationClient];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class CloudServicesCommentsAdapter extends _0x891fdc{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x1962a0)());['_services'];static get['requires'](){return[WebSocketGateway,_0x5d9000,Sessions,_0x531388];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3c1c90){super(_0x3c1c90),this['_services']=new Map();}async['init'](){const _0x2f6fd3=this['context'],_0x62a408=_0x2f6fd3['plugins']['get'](_0x5d9000);if(_0x2f6fd3['plugins']['get'](WebSocketGateway)['addToReconnectionStack'](this),_0x62a408['adapter']={'addCommentThread':async({channelId:_0x52dbc4,threadId:_0x30751e,comments:_0x2fbd4e,resolvedAt:_0x5bcc4e,resolvedBy:_0x363788,context:_0x440b14,attributes:_0x426e07})=>{const _0x37b226=await this['_getService'](_0x52dbc4)['addCommentThread']({'commentThreadId':_0x30751e,'comments':_0x2fbd4e['map'](_0x437788=>function(_0x211ed6,_0x22471a,_0x3e2190){return{'commentThreadId':_0x3e2190,'commentId':_0x211ed6['commentId'],'userId':_0x211ed6['authorId'],'content':_0x211ed6['content'],'documentId':_0x22471a,'createdAt':_0x211ed6['createdAt'],'attributes':_0x211ed6['attributes']||{}};}(_0x437788,_0x52dbc4,_0x30751e)),'resolvedAt':_0x5bcc4e,'resolvedBy':_0x363788,'context':_0x440b14,'attributes':_0x426e07})['catch'](Z);return{'threadId':_0x37b226['commentThreadId'],'comments':_0x37b226['comments']};},'getCommentThread':async({channelId:_0x8bda26,threadId:_0x3bde6f})=>{const _0x49f5f5=await this['_getService'](_0x8bda26)['getCommentThread'](_0x3bde6f)['catch'](X)['catch'](Z);return _0x49f5f5?_0x49f5f5['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x49f5f5]),{'threadId':_0x49f5f5['commentThreadId'],'comments':_0x49f5f5['comments']['map'](tt),'context':_0x49f5f5['context'],'resolvedAt':_0x49f5f5['resolvedAt'],'resolvedBy':_0x49f5f5['resolvedBy'],'attributes':_0x49f5f5['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x590802,threadId:_0x162954,context:_0x45b5da,unlinkedAt:_0x4e7bd2,attributes:_0x435365})=>this['_getService'](_0x590802)['updateCommentThread']({'commentThreadId':_0x162954,'context':_0x45b5da,'attributes':_0x435365,'unlinkedAt':_0x4e7bd2})['catch'](X)['catch'](Z),'resolveCommentThread':async({channelId:_0x309aeb,threadId:_0x1e30ab})=>{const _0x3b80c8=await this['_getService'](_0x309aeb)['resolveCommentThread'](_0x1e30ab)['catch'](X)['catch'](Z);return{'threadId':_0x3b80c8['commentThreadId'],'resolvedAt':_0x3b80c8['resolvedAt'],'resolvedBy':_0x3b80c8['resolvedBy']};},'reopenCommentThread':async({channelId:_0x445992,threadId:_0x255d94})=>this['_getService'](_0x445992)['reopenCommentThread'](_0x255d94)['catch'](X)['catch'](Z),'removeCommentThread':({channelId:_0x37a9f1,threadId:_0x55add2})=>this['_getService'](_0x37a9f1)['removeCommentThread'](_0x55add2)['catch'](X)['catch'](Z),'addComment':({channelId:_0x31fae7,threadId:_0x2fd3d9,commentId:_0x1efa9a,content:_0x3ef28b,attributes:_0x14c51b})=>this['_getService'](_0x31fae7)['addComment'](_0x2fd3d9,_0x1efa9a,_0x3ef28b,_0x14c51b)['catch'](Z),'updateComment':({channelId:_0x54fce6,threadId:_0x3b9de9,commentId:_0x4da672,content:_0x4030d9,attributes:_0x41a752})=>this['_getService'](_0x54fce6)['updateComment'](_0x3b9de9,_0x4da672,_0x4030d9,_0x41a752)['catch'](X)['catch'](Z),'removeComment':({channelId:_0x3c51ec,threadId:_0x43fc04,commentId:_0x40677a})=>this['_getService'](_0x3c51ec)['removeComment'](_0x43fc04,_0x40677a)['catch'](X)['catch'](Z)},_0x2f6fd3 instanceof _0x1db326){const _0x1505f0=_0x2f6fd3['config']['get']('collaboration.channelId'),_0x28457f=_0x2f6fd3['plugins']['get'](Sessions);await this['_setUpService'](_0x1505f0);const _0x2ff3a5=await this['_services']['get'](_0x1505f0)['getConnectedSessions']();this['listenTo'](_0x28457f,'sessionAdd:'+_0x1505f0,(_0x4f8adc,{session:_0x39bd70})=>{_0x39bd70['id']===_0x28457f['mySessionId']&&(_0x4f8adc['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x39bd70['permissions'],_0x1505f0));}),_0x28457f['register'](_0x1505f0,_0x2ff3a5);}}async['_setUpService'](_0x3e7d0c){if(this['_services']['has'](_0x3e7d0c))throw new _0x10b4e1('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x3e7d0c});const _0x448ecd=this['context']['plugins']['get'](_0x5d9000),_0xeb0bb0=new CloudServicesCommentsAdapter['CommentsService'](_0x3e7d0c);this['_services']['set'](_0x3e7d0c,_0xeb0bb0),this['listenTo'](_0xeb0bb0,'commentThreadAdded',(_0x1fc936,_0x4ead19)=>{const {commentThreadId:_0x4af15f,documentId:_0x2c3f54,context:_0x384fb4,attributes:_0x54ddb0,resolvedAt:_0x18e2a5,resolvedBy:_0x41a9a2,comments:_0x4203a6}=_0x4ead19;_0x448ecd['getCommentThread'](_0x4af15f)||_0x448ecd['addCommentThread']({'threadId':_0x4af15f,'channelId':_0x2c3f54,'comments':_0x4203a6?_0x4203a6['map'](tt):[],'context':_0x384fb4,'attributes':_0x54ddb0,'resolvedAt':_0x18e2a5,'resolvedBy':_0x41a9a2,'isFromAdapter':!0x0});}),this['listenTo'](_0xeb0bb0,'commentThreadUpdated',(_0x2d9752,{commentThreadId:_0x619c59,documentId:_0x445fbd,context:_0x2259d2,unlinkedAt:_0x8f456d,attributes:_0x2b9b23})=>{_0x448ecd['getCommentThread'](_0x619c59)&&_0x448ecd['updateCommentThread']({'threadId':_0x619c59,'channelId':_0x445fbd,'context':_0x2259d2,'unlinkedAt':_0x8f456d,'attributes':_0x2b9b23,'isFromAdapter':!0x0});}),this['listenTo'](_0xeb0bb0,'commentThreadResolved',(_0x42bd50,{commentThreadId:_0xc1ff06,resolvedBy:_0x265f4b,resolvedAt:_0x2e69c5})=>{const _0x34aa05=_0x448ecd['getCommentThread'](_0xc1ff06);_0x34aa05&&_0x34aa05['resolve']({'resolvedBy':_0x265f4b,'resolvedAt':_0x2e69c5,'isFromAdapter':!0x0});}),this['listenTo'](_0xeb0bb0,'commentThreadReopened',(_0x3f1eb5,{commentThreadId:_0xfac516})=>{const _0x41d21c=_0x448ecd['getCommentThread'](_0xfac516);_0x41d21c&&_0x41d21c['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0xeb0bb0,'commentThreadRemoved',(_0x2ce5db,{commentThreadId:_0x359275})=>{const _0x101605=_0x448ecd['getCommentThread'](_0x359275);_0x101605&&_0x101605['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0xeb0bb0,'commentAdded',(_0xc4abe1,_0x586875)=>{const _0x4f8219=_0x586875['commentThreadId'],_0x544bfe=_0x448ecd['getCommentThread'](_0x4f8219);_0x544bfe&&_0x544bfe['addComment']({...tt(_0x586875),'isFromAdapter':!0x0});}),this['listenTo'](_0xeb0bb0,'commentUpdated',(_0x44d3f2,{commentThreadId:_0x7a94b3,commentId:_0xd99d13,content:_0x4033e4,attributes:_0x34f7ab})=>{const _0x11963d=_0x448ecd['getCommentThread'](_0x7a94b3);if(_0x11963d){const _0x28d5da=_0x11963d['getComment'](_0xd99d13);_0x28d5da&&_0x28d5da['update']({'content':_0x4033e4,'attributes':_0x34f7ab,'isFromAdapter':!0x0});}}),this['listenTo'](_0xeb0bb0,'commentRemoved',(_0x237623,{commentThreadId:_0x5c1dd8,commentId:_0x1a3705})=>{const _0x26d5d1=_0x448ecd['getCommentThread'](_0x5c1dd8);if(_0x26d5d1){const _0x1d553b=_0x26d5d1['getComment'](_0x1a3705);_0x1d553b&&_0x1d553b['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x3e7d0c);}['destroy'](){if(this['context']instanceof _0x1db326){const _0x85bb97=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x85bb97);}}['_terminateService'](_0x1d68fa){if(!this['_services']['has'](_0x1d68fa))throw new _0x10b4e1('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x1d68fa});this['_getService'](_0x1d68fa)['disconnect'](),this['_services']['delete'](_0x1d68fa);}async['reconnect'](){for(const _0x618cf4 of this['_services']['keys']())await this['_connectService'](_0x618cf4);if(this['context']instanceof _0x1db326){const _0x4be86a=this['context']['config']['get']('collaboration.channelId'),_0x7e9aad=this['context']['plugins']['get'](Sessions);_0x7e9aad['unregister'](_0x4be86a);const _0x4f5dd8=await this['_services']['get'](_0x4be86a)['getConnectedSessions']();_0x7e9aad['register'](_0x4be86a,_0x4f5dd8);}}async['_connectService'](_0x349362){const {connection:_0x2cd312}=this['context']['plugins']['get'](WebSocketGateway),_0x3f916f=this['context']['plugins']['get'](_0x5d9000),_0x3e696d=this['_services']['get'](_0x349362),_0xd27a16=await _0x3e696d['connect'](_0x2cd312);await this['_fetchMissingUsersForThreads'](_0xd27a16);const _0x218b2b=new Set(Array['from'](_0x3f916f['getCommentThreads']({'channelId':_0x349362}),_0x56b831=>_0x56b831['id']));for(const _0x550f46 of _0xd27a16)_0x550f46['deletedAt']||_0x218b2b['delete'](_0x550f46['commentThreadId']);for(const _0x1f873a of _0x218b2b)_0x3f916f['getCommentThread'](_0x1f873a)['remove']({'isFromAdapter':!0x0});for(const _0x5af7ef of _0xd27a16){let _0x5bba64=_0x3f916f['getCommentThread'](_0x5af7ef['commentThreadId']);const {commentThreadId:_0x78e8c0,context:_0x499217,attributes:_0x1da7f9,resolvedBy:_0xa4078a,resolvedAt:_0x1c2560,unlinkedAt:_0x4f3a3a,deletedAt:_0x4c8fbb}=_0x5af7ef;if(_0x4c8fbb)continue;_0x5bba64||(_0x5bba64=_0x3f916f['addCommentThread']({'channelId':_0x349362,'threadId':_0x78e8c0,'context':_0x499217,'attributes':_0x1da7f9||{},'resolvedBy':_0xa4078a,'resolvedAt':_0x1c2560,'unlinkedAt':_0x4f3a3a,'isFromAdapter':!0x0}));const _0x2b7978=new Set(Array['from'](_0x5bba64['comments'],_0x5c10f0=>_0x5c10f0['id']));for(const _0x6d53fc of _0x5af7ef['comments'])_0x2b7978['delete'](_0x6d53fc['commentId']);for(const _0x575d2c of _0x2b7978)_0x5bba64['getComment'](_0x575d2c)['remove']({'isFromAdapter':!0x0});for(const _0x62fa01 of _0x5af7ef['comments']){const _0x156dfb=_0x5bba64['getComment'](_0x62fa01['commentId']);_0x156dfb?_0x156dfb['content']!==_0x62fa01['content']&&_0x156dfb['update']({'content':_0x62fa01['content'],'isFromAdapter':!0x0}):_0x5bba64['addComment'](Object['assign'](tt(_0x62fa01),{'isFromAdapter':!0x0}));}}}['_getService'](_0x20097d){if(!this['_services']['has'](_0x20097d))throw new _0x10b4e1('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x20097d});return this['_services']['get'](_0x20097d);}async['_fetchMissingUsersForThreads'](_0x4fdfdc){const _0xd78920=this['context']['plugins']['get'](_0x531388),{connection:_0x39e582}=this['context']['plugins']['get'](WebSocketGateway),_0x8b96b7=new Set();for(const {resolvedBy:_0x19ee9e,comments:_0x57bd99}of _0x4fdfdc){_0x19ee9e&&!_0xd78920['getUser'](_0x19ee9e)&&_0x8b96b7['add'](_0x19ee9e);for(const {userId:_0x6d027b}of _0x57bd99)_0xd78920['getUser'](_0x6d027b)||_0x8b96b7['add'](_0x6d027b);}if(0x0===_0x8b96b7['size'])return;const _0x299278=await _0x544a92['getMany'](_0x39e582,Array['from'](_0x8b96b7));for(const _0x32d193 of _0x299278)_0xd78920['getUser'](_0x32d193['id'])||_0xd78920['addUser'](_0x32d193);}}async function X(_0x4c542c){if('404'!==_0x4c542c['code'])throw _0x4c542c;}function Z(_0x38e5c3){if((_0x34f57f=_0x38e5c3)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x34f57f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x34f57f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x34f57f;throw _0x38e5c3;}function tt(_0x3d0d22){return{'threadId':_0x3d0d22['commentThreadId'],'commentId':_0x3d0d22['commentId'],'content':_0x3d0d22['content'],'createdAt':_0x3d0d22['createdAt'],'authorId':_0x3d0d22['userId'],'attributes':_0x3d0d22['attributes']||{}};}class CloudServicesTrackChangesAdapter extends _0x18e830{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>_0x743596)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[CloudServicesCommentsAdapter,_0x400485,WebSocketGateway];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3b21f2){super(_0x3b21f2);const _0x5841a9=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x5841a9);}['init'](){const _0x523343=this['editor']['plugins']['get'](WebSocketGateway),_0x14c05a=this['editor']['plugins']['get'](_0x400485);return _0x14c05a['adapter']={'getSuggestion':async _0x2f56cd=>{await this['_waitForServiceReady']();const _0x3db97e=await this['_trackChangesService']['get'](_0x2f56cd)['catch'](et);return await this['_fetchMissingUsersForThreads']([_0x3db97e]),_0x3db97e;},'addSuggestion':async({id:_0x2bbf66,type:_0x5b5897,data:_0xdec7c5,originalSuggestionId:_0x3c45ee,attributes:_0x3ed3f9})=>{await this['_waitForServiceReady']();const _0x1bfdba={'id':_0x2bbf66,'type':_0x5b5897,'data':_0xdec7c5,'originalSuggestionId':_0x3c45ee,'attributes':_0x3ed3f9},_0x2b3b5f=await this['_trackChangesService']['add'](_0x2bbf66,_0x5b5897,_0xdec7c5,_0x3c45ee,_0x3ed3f9)['catch'](_0x9e1af7=>{if(st(_0x9e1af7))return new Promise(_0x50cda6=>{this['_bufferedRequests']['set'](_0x2bbf66,{'resolve':_0x50cda6,'suggestionData':_0x1bfdba});});throw _0x9e1af7;});return this['_bufferedRequests']['delete'](_0x2bbf66),_0x2b3b5f;},'updateSuggestion':async(_0x1d113f,_0x33ba69)=>{if(await this['_waitForServiceReady'](),'open'!==_0x33ba69['state'])return this['_trackChangesService']['update'](_0x1d113f,_0x33ba69)['catch'](et);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x114400,_0x1a361a)=>{_0x14c05a['hasSuggestion'](_0x1a361a['id'])&&(_0x14c05a['getSuggestion'](_0x1a361a['id'])['attributes']=_0x1a361a['attributes']);}),this['_trackChangesService']['connect'](_0x523343['connection'])['then'](_0x49c754=>(_0x523343['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x49c754)['then'](()=>{for(const _0x2aca13 of _0x49c754){_0x14c05a['addSuggestionData'](_0x2aca13)['_saved']=!0x0;}})));}async['reconnect'](){const _0x1b75bd=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x184136}=this['editor']['plugins']['get'](WebSocketGateway),_0x5b47c1=await this['_trackChangesService']['connect'](_0x184136);await this['_fetchMissingUsersForThreads'](_0x5b47c1);for(const {suggestionData:_0x2cd127,resolve:_0x338046}of this['_bufferedRequests']['values']()){let _0x399049=_0x5b47c1['find'](_0x2fb3f4=>_0x2fb3f4['id']===_0x2cd127['id']);_0x399049||(_0x399049=await this['_trackChangesService']['add'](_0x2cd127['id'],_0x2cd127['type'],_0x2cd127['data'],_0x2cd127['originalSuggestionId'])),_0x338046(_0x399049);}for(const _0x53fd8c of _0x5b47c1)_0x1b75bd['hasSuggestion'](_0x53fd8c['id'])||_0x1b75bd['addSuggestionData'](_0x53fd8c);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x16971c=>{this['listenTo'](this['_trackChangesService'],'connected',_0x457bb8=>{_0x457bb8['off'](),_0x16971c();});});}async['_fetchMissingUsersForThreads'](_0x4b910e){const _0x4f58f4=this['editor']['plugins']['get'](_0x531388),{connection:_0x4b7f7f}=this['editor']['plugins']['get'](WebSocketGateway),_0x92ea4=new Set();for(const {authorId:_0x58849}of _0x4b910e)_0x4f58f4['getUser'](_0x58849)||_0x92ea4['add'](_0x58849);if(0x0===_0x92ea4['size'])return;const _0x5ea84e=await _0x544a92['getMany'](_0x4b7f7f,Array['from'](_0x92ea4));for(const _0x4597dc of _0x5ea84e)_0x4f58f4['getUser'](_0x4597dc['id'])||_0x4f58f4['addUser'](_0x4597dc);}}function et(_0x561c40){if(st(_0x561c40))return new Promise(()=>{});throw _0x561c40;}function st(_0x527137){return _0x527137['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x527137['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class RealTimeCollaborativeComments extends _0x18e830{static get['requires'](){return[_0x494d20,CloudServicesCommentsAdapter,RealTimeCollaborativeEditing,WebSocketGateway];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x44301b=this['editor']['plugins']['get'](WebSocketGateway),_0x5545b4=this['editor']['plugins']['get'](_0x3be2c1),_0x44ddc5=this['editor']['plugins']['get'](CloudServicesCommentsAdapter);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x44301b,'change:state',(_0x48f6ec,_0x15163a,_0x1d1bb0)=>{_0x5545b4['isThreadsLoadingPaused']='connected'!==_0x1d1bb0;});}),this['listenTo'](_0x44301b,'change:state',(_0x5da9a6,_0x9d0dcc,_0xce0343)=>{this['editor']['plugins']['get'](_0x5d9000)['switchReadOnly']('connected'!==_0xce0343);}),_0x44ddc5['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](CloudServicesCommentsAdapter)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class RealTimeCollaborativeTrackChanges extends _0x18e830{static get['requires'](){return[RealTimeCollaborativeComments,CloudServicesTrackChangesAdapter,_0x250f30];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class CloudServicesRevisionHistoryAdapter extends _0x18e830{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x4a0099)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[WebSocketGateway,RealTimeCollaborationClient,_0x43f978,Sessions,_0x531388];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3d3f42){super(_0x3d3f42);const _0x37c102=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x37c102);}async['init'](){const _0x4a1364=this['editor']['plugins']['get'](RealTimeCollaborationClient),_0x53a95c=_0x4a1364['serverHistory'],_0xbfb1d2=this['editor']['plugins']['get'](WebSocketGateway);this['_revisionTracker']['setSource']({'history':_0x53a95c,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x4a1364['sessionId']});const _0x5808dc=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x51023f,_0x578e28=await _0x483c48['isBundleUploaded'](_0xbfb1d2['connection'],_0x5808dc);this['editor']['plugins']['get'](_0x43f978)['adapter']={'getRevision':async({revisionId:_0x303f32})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x303f32)),'updateRevisions':async _0x31d787=>{await this['_waitForServiceReady']();const _0x4e7017=this['_revisionTracker']['currentRevision'];if(_0x578e28&&0x1===_0x31d787['length']&&_0x31d787[0x0]['id']===_0x4e7017['id'])return _0x31d787;for(const _0x2d3c99 of _0x31d787)_0x2d3c99['id']===_0x4e7017['id']&&(_0x2d3c99['isEmptyCurrent']=_0x2d3c99['fromVersion']===_0x2d3c99['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x31d787,this['_lastRequestId'])['then'](_0x5c5de4=>(this['_lastRequestId']=_0x5c5de4,_0x31d787))['catch'](_0x265c49=>{if(it(_0x265c49)||'400'===_0x265c49['code']&&void 0x0!==_0x265c49['data']['wrongRequestId']){for(const _0x45e291 of _0x31d787){!this['_revisionTracker']['repository']['getRevision'](_0x45e291['id'])||this['_revisionTracker']['_bufferUpdate'](_0x45e291['id'],_0x45e291,!0x1);}if(it(_0x265c49)&&'destroyed'!==this['editor']['state'])throw _0x265c49;return _0x31d787;}throw _0x265c49;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3b5aed,{revisionsData:_0x543ce3,requestId:_0x531c4e})=>{Math['max'](..._0x543ce3['map'](_0x128102=>_0x128102['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x543ce3,_0x531c4e);}):this['_handleRevisionsUpdate'](_0x543ce3,_0x531c4e);});const {revisions:_0x1ce387,requestId:_0x19af44}=await this['_revisionHistoryService']['connect'](_0xbfb1d2['connection']);_0xbfb1d2['addToReconnectionStack'](this),this['_lastRequestId']=_0x19af44,await this['_fetchMissingUsers'](_0x1ce387);for(const _0x1f9b7b of _0x1ce387)this['_revisionTracker']['addRevisionData'](_0x1f9b7b);this['listenTo'](_0x4a1364,'change:_isConnected',(_0x132447,_0x3697a0,_0x74da85)=>{_0x74da85&&(this['_oldOffset']=_0x4a1364['_offset'],_0x132447['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0xbfb1d2,'state',_0x1c9930=>_0x1c9930===_0x3c6eda['CONNECTED']);}async['reconnect'](){const _0x3ce8b4=this['editor']['plugins']['get'](WebSocketGateway),_0x38ec1d=this['editor']['plugins']['get'](RealTimeCollaborationClient),_0x350075=async()=>{const _0x38c0a2=this['_revisionTracker']['currentRevision'],_0x16ed8e=_0x38c0a2['id'],_0x1cad5b=_0x16ed8e!==_0x38ec1d['sessionId'];if(_0x1cad5b){const _0xf15354=_0x38ec1d['_offset']-this['_oldOffset'],_0x3472eb=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x38c0a2['toVersion']+_0xf15354!==_0x3472eb){const _0x478d61=_0x38c0a2['fromVersion']+_0xf15354,_0x815a90=this['editor']['plugins']['get'](_0x531388),_0xa32f3a=this['_revisionTracker']['buildRevisionData']({'revision':_0x38c0a2,'from':_0x478d61,'to':_0x3472eb});_0xa32f3a['id']=_0x38c0a2['id'];const _0x29bc9e=_0xa32f3a['authorsIds']['map'](_0x4913da=>_0x815a90['getUser'](_0x4913da));_0x38c0a2['_update']({..._0xa32f3a,'authors':_0x29bc9e},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x38c0a2['id'],_0xa32f3a,!0x0);}this['_revisionTracker']['_startingVersion']=_0x3472eb,(_0x38c0a2['toVersion']===_0x38c0a2['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x16ed8e)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x16ed8e),this['_revisionTracker']['_createCurrentRevision'](_0x3472eb));}const {revisions:_0xf7ef8f,requestId:_0x4732e3}=await this['_revisionHistoryService']['reconnect'](_0x3ce8b4['connection'],this['_lastRequestId']);_0x1cad5b&&_0xf7ef8f['length']>0x0?_0x38ec1d['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0xf7ef8f),this['_handleRevisionsUpdate'](_0xf7ef8f,_0x4732e3),this['_revisionTracker']['sendBufferedUpdates']());};return _0x38ec1d['_isConnected']?_0x350075():new Promise((_0x12a5c2,_0x48e6c1)=>{_0x38ec1d['once']('change:_isConnected',()=>{_0x350075()['then'](_0x12a5c2)['catch'](_0x48e6c1);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x3166fc=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5d6285=>{_0x5d6285['off'](),_0x3166fc();});});}['_getLatestVersionFromServerOperations'](){const _0x5ade46=this['editor']['plugins']['get'](RealTimeCollaborationClient)['serverHistory']['getOperations']()['reverse']();for(const _0x52969c of _0x5ade46)if('marker'!==_0x52969c['type']||_0x52969c['affectsData'])return _0x52969c['baseVersion']+0x1;}['_getLatestVersion'](){const _0xb9c4bf=this['editor']['plugins']['get'](RealTimeCollaborationClient);return new Promise(_0xb14c9c=>{_0xb9c4bf['_isPendingUpdate']?_0xb9c4bf['once']('change:_isPendingUpdate',()=>{_0xb14c9c(this['_getLatestVersionFromServerOperations']());}):_0xb14c9c(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x1f1e50,_0x211d56){const _0x3f8a93=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x211d56;for(const _0x5ced0b of _0x1f1e50){const _0x4518c8=_0x3f8a93['getRevision'](_0x5ced0b['id']);if(_0x4518c8){if((_0x5ced0b['fromVersion']||_0x5ced0b['toVersion'])&&(_0x5ced0b['diffData']=null),_0x4518c8===this['_revisionTracker']['currentRevision']){const _0x387f47=Math['max'](_0x4518c8['toVersion'],_0x5ced0b['toVersion']),_0x3d6a36=Math['max'](_0x4518c8['fromVersion'],_0x5ced0b['fromVersion']);let _0x20b11e;_0x4518c8['toVersion']===_0x5ced0b['toVersion']&&_0x4518c8['fromVersion']===_0x5ced0b['fromVersion']?(_0x20b11e=!0x0,this['_preventResendingRevisionData'](_0x5ced0b)):_0x5ced0b['toVersion']===_0x387f47&&_0x5ced0b['fromVersion']===_0x3d6a36?_0x20b11e=!0x1:(_0x4518c8['toVersion']===_0x387f47&&_0x4518c8['fromVersion']===_0x3d6a36||this['_fixRevision']({'revision':_0x4518c8,'from':_0x3d6a36,'to':_0x387f47}),_0x20b11e=!0x0),_0x20b11e&&(delete _0x5ced0b['fromVersion'],delete _0x5ced0b['toVersion'],delete _0x5ced0b['diffData'],delete _0x5ced0b['createdAt'],delete _0x5ced0b['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x5ced0b),this['_preventResendingRevisionData'](_0x5ced0b);}else this['_revisionTracker']['addRevisionData'](_0x5ced0b);}const _0x53146b=_0x3f8a93['getRevisions']();_0x53146b['reverse']();for(let _0x26f8fe=0x0;_0x26f8fe<_0x53146b['length']-0x1;_0x26f8fe++){const _0x3d5dcb=_0x53146b[_0x26f8fe],_0x29da64=_0x53146b[_0x26f8fe+0x1];if(_0x3d5dcb['fromVersion']<_0x29da64['toVersion']){const _0x2ed919=_0x29da64['toVersion'],_0x2ec977=Math['max'](_0x2ed919,_0x3d5dcb['toVersion']);this['_fixRevision']({'revision':_0x3d5dcb,'from':_0x2ed919,'to':_0x2ec977});}}}['_fixRevision']({revision:_0x237333,from:_0x2a92a1,to:_0x304f1f}={}){const _0x115495=this['editor']['plugins']['get'](_0x531388),_0x461e6b=this['_revisionTracker']['buildRevisionData']({'revision':_0x237333,'from':_0x2a92a1,'to':_0x304f1f});_0x461e6b['authors']=_0x461e6b['authorsIds']['map'](_0x2d7522=>_0x115495['getUser'](_0x2d7522)),_0x237333['_update'](_0x461e6b);}['_preventResendingRevisionData'](_0x5d6b75){const _0x3a9dac={};_0x3a9dac['id']=_0x5d6b75['id'];for(const _0x374d47 of Object['keys'](_0x5d6b75))'id'!==_0x374d47&&(_0x3a9dac[_0x374d47]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x3a9dac['id'],_0x3a9dac,!0x0);}async['_fetchMissingUsers'](_0x3d8a2a){const _0x2aca8b=this['editor']['plugins']['get'](_0x531388),{connection:_0x339d9d}=this['editor']['plugins']['get'](WebSocketGateway),_0x29ff68=new Set();for(const _0x4e3625 of _0x3d8a2a){for(const _0x5098ec of _0x4e3625['authorsIds'])_0x4d32d9(_0x5098ec);_0x4e3625['creatorId']&&_0x4d32d9(_0x4e3625['creatorId']);}if(0x0===_0x29ff68['size'])return;const _0x106b2b=await _0x544a92['getMany'](_0x339d9d,Array['from'](_0x29ff68));for(const _0x1cb1a1 of _0x106b2b)_0x2aca8b['getUser'](_0x1cb1a1['id'])||_0x2aca8b['addUser'](_0x1cb1a1);function _0x4d32d9(_0x2ece74){_0x2aca8b['getUser'](_0x2ece74)||_0x29ff68['add'](_0x2ece74);}}}function it(_0xc67ef5){return _0xc67ef5['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xc67ef5['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xc67ef5['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class RealTimeCollaborativeRevisionHistory extends _0x18e830{static get['requires'](){return[_0x43f978,CloudServicesRevisionHistoryAdapter,RealTimeCollaborativeEditing];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class PresenceCounterView extends _0x4a5408{['_collapseAt'];constructor(_0xc1f1c1,_0x72d161=0x6){super(_0xc1f1c1);const _0x6eaeb8=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x72d161,this['bind']('isHidden')['to'](this,'usersCount',_0x42b05f=>_0x42b05f<_0x72d161),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x6eaeb8['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':_0x6eaeb8['to']('usersCount',_0x165a92=>'+'+(_0x165a92-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class PresenceInlineListView extends _0x4a5408{['items'];['keystrokes'];constructor(_0x50d85a){super(_0x50d85a);const _0x50fa4e=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x5cc69c(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x50fa4e['if']('hasPopup'),'aria-expanded':_0x50fa4e['to']('isExpanded',_0x4454f7=>this['hasPopup']&&String(_0x4454f7)),'aria-label':_0x50fa4e['to']('hasPopup',_0xa66f7c=>K(_0x50d85a,_0xa66f7c?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x50fa4e['to']('hasPopup',_0x3b5f3f=>!!_0x3b5f3f&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x50fa4e['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x50fa4e['to'](_0x3bd121=>{const _0x13998b=_0x3bd121,_0x3337c2=document['querySelector']('.ck-presence-list__dropdown-list'),_0x33874f=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3337c2?.['contains'](_0x13998b['relatedTarget'])||_0x33874f?.['contains'](_0x13998b['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x43bfe8,_0x3fa9a3,_0x464c69)=>{this['element']&&(_0x464c69?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 PresenceListView extends _0x4a5408{['counterView'];['inlineListView'];constructor(_0x151d79,_0x983e7c=0x6){super(_0x151d79);const _0x4f56ad=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new PresenceCounterView(this['locale'],_0x983e7c),this['inlineListView']=new PresenceInlineListView(_0x151d79),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x288dd0 of this['inlineListView']['items'])_0x288dd0['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',_0x4f56ad['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class PresenceDropdownListView extends _0x4a5408{['listWrapperView'];constructor(_0x14db03,_0x97bc72){super(_0x14db03);const _0x57e0d0=this['bindTemplate'];this['listWrapperView']=new PresenceDropdownListWrapperView(_0x14db03,_0x97bc72),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':K(_0x14db03,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x57e0d0['to'](_0x253570=>{const _0x7acf0d=_0x253570,_0x5a7acb=document['querySelector']('.ck-presence-list__list'),_0x13be0f=document['querySelector']('.ck-balloon-panel_with-arrow');_0x5a7acb?.['contains'](_0x7acf0d['relatedTarget'])||_0x13be0f?.['contains'](_0x7acf0d['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class PresenceDropdownListWrapperView extends _0x4c2180{constructor(_0x21599f,_0x55c335){super(_0x21599f);const _0x31c5ca=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x55c335?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x31c5ca['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x31c5ca['to']('role'),'aria-label':_0x31c5ca['to']('ariaLabel'),'aria-labelledby':_0x31c5ca['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x17d194['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0xed085=this['element'];_0xed085&&(this['_isScrollable']=Math['max'](_0xed085['scrollHeight'],_0xed085['clientHeight'])>0.8*window['innerHeight']);}}class PresenceDropdownListItemView extends _0x57caa1{['userView'];constructor(_0x12dbdb,_0x361225,_0x1dc6f9){super(_0x12dbdb);const _0x5eda21=this['bindTemplate'];this['userView']=new _0x6af10f(_0x12dbdb,_0x361225);const _0x175d92={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x361225['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x361225['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x361225['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x361225['color']['getColorVariable'](),'--ck-user-color-alpha':_0x361225['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x1dc6f9&&(_0x175d92['tag']='button',_0x175d92['on']={'click':_0x5eda21['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x175d92);}['focus'](){this['element']['focus']();}}class PresenceInlineListItemView extends _0x4a5408{['userView'];['markerView'];constructor(_0x2fbfb1,_0x2b8bb5,_0x4bf6b3){super(_0x2fbfb1);const _0x3425c5=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x6af10f(_0x2fbfb1,_0x2b8bb5),this['markerView']=new MarkerView(_0x2fbfb1,_0x2b8bb5);const _0x5a826e=new _0x28a401(_0x2fbfb1);_0x5a826e['template']['tag']='span',_0x5a826e['text']=_0x2b8bb5['name'];const _0x1ce76c={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x3425c5['to']('isFocusable',_0x1e0528=>!!_0x1e0528&&0x0),'aria-labelledby':_0x5a826e['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x3425c5['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x3425c5['to']('hasTooltip',_0x4c60b1=>!_0x4c60b1),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x5a826e]};_0x4bf6b3&&(_0x1ce76c['tag']='button',_0x1ce76c['on']={'click':_0x3425c5['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1ce76c);}}class MarkerView extends _0x4a5408{constructor(_0x1b750e,_0x64a3d8){super(_0x1b750e),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x64a3d8['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x64a3d8['color']['getColorVariable'](),'--ck-user-color-alpha':_0x64a3d8['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}}const nt={'collapseAt':0x6,'displayMe':!0x0};class PresenceListUI extends _0x891fdc{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x7730ae){super(_0x7730ae),this['context']['config']['define']('presenceList',nt);const _0x4d12d1=_0x7730ae['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x4d12d1)throw new _0x10b4e1('presencelist-collapseat-invalid-format',this);if(_0x4d12d1<0x1)throw new _0x10b4e1('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Sessions)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x20fb3f(),this['balloonPanelView']=new _0x2a43c7(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[Sessions];}['init'](){for(const _0x37a71b of this['_allConnectedUsers'])this['_handleUserAdd'](_0x37a71b);this['listenTo'](this['_allConnectedUsers'],'add',(_0x237b8f,_0x1f862d)=>{this['_handleUserAdd'](_0x1f862d);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x8fa8dc,_0x5e924b)=>{this['_handleUserRemove'](_0x5e924b);});}['_createView'](){const _0x2fd0e7=this['context'],_0x32e723=new PresenceListView(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x18d8a9=this['balloonPanelView'];if(!_0x594a36(_0x2fd0e7['config']['get']('presenceList.container')))throw new _0x10b4e1('presencelist-missing-container',this);return _0x32e723['counterView']['bind']('usersCount')['to'](this),_0x32e723['bind']('isCollapsed')['to'](this,'usersCount',_0x4fc745=>{const {collapseAt:_0x32a6bc}=_0x2fd0e7['config']['get']('presenceList'),_0x491457=_0x4fc745>=_0x32a6bc;if(_0x491457&&!_0x32e723['inlineListView']['items']['find'](_0x582993=>_0x582993 instanceof PresenceCounterView)){const _0x11bd61=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x11bd61&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x32e723['inlineListView']['items']['add'](_0x32e723['counterView']);}return _0x491457||this['hideDropdown'](),_0x491457;}),_0x32e723['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x16d1c8=>{const _0x40c8ee=_0x2fd0e7['config']['get']('presenceList'),_0x3b3a44=new PresenceInlineListItemView(_0x2fd0e7['locale'],_0x16d1c8,!!_0x40c8ee['onClick']);return _0x3b3a44['bind']('hasTooltip')['to'](_0x32e723,'isCollapsed',_0x8a583e=>!_0x8a583e),_0x3b3a44['bind']('isFocusable')['to'](_0x32e723,'isCollapsed',_0x10b8cd=>!_0x10b8cd),_0x40c8ee['onClick']&&this['listenTo'](_0x3b3a44,'execute',()=>{this['view']['isCollapsed']||_0x40c8ee['onClick'](_0x16d1c8,_0x3b3a44['element']);}),_0x3b3a44;}),this['listenTo'](_0x32e723['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x32e723['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x32e723['inlineListView']['keystrokes']['set']('Enter',(_0x8ceb86,_0x108218)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x108218());}),_0x32e723['render'](),_0x18d8a9['render'](),_0x154176({'emitter':_0x32e723,'activator':()=>_0x18d8a9['isVisible'],'contextElements':[_0x18d8a9['element'],_0x32e723['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x2fd0e7['config']['get']('presenceList.container')['appendChild'](_0x32e723['element']),this['_bodyCollection']=new _0x1c2f2b(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x32e723;}['_handleUserAdd'](_0x5347d7){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x5347d7['isMe'])return;const _0x6eba07=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x6eba07-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x1f02de=_0x5347d7['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x5347d7,_0x1f02de);}['_handleUserRemove'](_0x512aef){this['usersCount']--;const {collapseAt:_0x1b6bf2}=this['context']['config']['get']('presenceList'),_0x19e6b9=this['usersCount']>=_0x1b6bf2;if(this['currentDisplayedUsers']['get'](_0x512aef['id']))this['currentDisplayedUsers']['remove'](_0x512aef['id']);else{if(_0x19e6b9&&this['currentDisplayedUsers']['length']+0x1===_0x1b6bf2-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x19e6b9?0x1:0x0)<this['usersCount']){for(const _0xe19187 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0xe19187['id'])&&(this['currentDisplayedUsers']['add'](_0xe19187,Math['min'](this['currentDisplayedUsers']['length']-(_0x19e6b9?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x19e6b9?0x1:0x0)===_0x1b6bf2-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1cce0c=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new PresenceDropdownListView(this['context']['locale'],!!_0x1cce0c['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x39f6da}=this['presenceDropdownView'];_0x39f6da['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x5810a5=>{if(!_0x1cce0c['displayMe']&&_0x5810a5['isMe'])return null;const _0x32881a=new PresenceDropdownListItemView(this['context']['locale'],_0x5810a5,!!_0x1cce0c['onClick']);return _0x1cce0c['onClick']&&this['listenTo'](_0x32881a,'execute',()=>{_0x1cce0c['onClick'](_0x5810a5,_0x32881a['element']);}),_0x32881a;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x39f6da['focus'](),_0x39f6da['checkIfScrollable']();const _0x275158=(_0x4488b6,_0x259eb3)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x259eb3();};_0x39f6da['keystrokes']['set']('Esc',_0x275158),_0x39f6da['keystrokes']['set']('Shift+Tab',_0x275158),_0x39f6da['keystrokes']['set']('Tab',(_0x3d3e84,_0x1da97c)=>{!function(_0x57566c){const _0x3cd900=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x3e4384=>_0x3e4384+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x3aa1bf=[...document['body']['querySelectorAll'](_0x3cd900)]['filter'](_0x20c23c=>_0x20c23c===document['activeElement']||_0x20c23c['offsetWidth']+_0x20c23c['offsetHeight']>0x0)['sort']((_0x1368d6,_0x3619f9)=>(_0x1368d6['tabIndex']||0x0)-(_0x3619f9['tabIndex']||0x0)),_0x5848f8=_0x3aa1bf['indexOf'](_0x57566c),_0x428b53=_0x3aa1bf[(_0x5848f8+0x1)%_0x3aa1bf['length']];_0x428b53&&_0x428b53['focus']();}(this['view']['element']),this['hideDropdown'](),_0x1da97c();}),_0x39f6da['focusTracker']['add'](this['view']['element']),_0x39f6da['focusTracker']['on']('change:isFocused',(_0x3c8b61,_0x2afe35,_0x4d5db7)=>{_0x4d5db7||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 PresenceList extends _0x891fdc{static get['requires'](){return[Sessions,PresenceListUI];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{CloudServicesCommentsAdapter,CloudServicesRevisionHistoryAdapter,CloudServicesTrackChangesAdapter,PresenceList,PresenceListUI,RealTimeCollaborationClient,RealTimeCollaborativeComments,RealTimeCollaborativeEditing,RealTimeCollaborativeRevisionHistory,RealTimeCollaborativeTrackChanges,Sessions,WebSocketGateway};
|