@ckeditor/ckeditor5-real-time-collaboration 48.5.2-alpha.0 → 48.5.3
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.umd.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/be.umd.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/gu.umd.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/hy.umd.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/kk.umd.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/oc.umd.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/si.umd.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.umd.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{Context as
|
|
24
|
-
((()=>_0x43643c)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0xfb615,_0x41498b];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xbc0a3b){super(_0xbc0a3b),this['set']('state',_0x45097b['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x5eaf0b())();}init(){const _0x164d36=this['context'],_0x4f451b=_0x164d36['plugins']['get'](_0xfb615),_0x1a0158=_0x164d36['plugins']['get'](_0x41498b);if(!_0x4f451b['token'])throw new _0x3793cd('websocketgateway-missing-token',this);if(!_0x4f451b['webSocketUrl'])throw new _0x3793cd('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'](_0x4f451b['token'],_0x4f451b['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x7bd6b8=>{if(this['connection']=_0x7bd6b8,this['bind']('state')['to'](_0x7bd6b8,'state',this,'_isBrowserOffline',(_0x3a23fa,_0x404b6f)=>('connected'!==_0x3a23fa&&(this['_shouldPluginsReconnect']=!0x0),_0x404b6f||_0x3a23fa!==_0x45097b['CONNECTED']?_0x45097b['DISCONNECTED']:this['state']==_0x45097b['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x45097b['CONNECTING']):_0x45097b['CONNECTED'])),this['connection']['on']('error',(_0x21947e,_0x1b7d37)=>{if('limitExceeded'!==_0x1b7d37['code'])throw console['error'](_0x1b7d37),new _0x3793cd('cloudservices-init',null,{'originalError':_0x1b7d37});_0x1a0158['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'});}),!_0x7bd6b8['me'])return new Promise(_0x3ec281=>_0x7bd6b8['on']('change:me',_0x3ec281));})['catch'](_0x18eb8a=>{throw console['error'](_0x18eb8a),new _0x3793cd('cloudservices-init',null,{'originalError':_0x18eb8a});});}addToReconnectionStack(_0x23fbbf){if('function'!=typeof _0x23fbbf['reconnect'])throw new _0x3793cd('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x23fbbf))throw new _0x3793cd('websocketgateway-plugin-already-registered',this,{'name':_0x23fbbf['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x23fbbf);}removeFromReconnectionStack(_0x181f24){this['_reconnectionStack']['delete'](_0x181f24);}isInReconnectionStack(_0x1e1035){return this['_reconnectionStack']['has'](_0x1e1035);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x2af609=>_0x2af609['reconnect']())))['then'](()=>this['state']=_0x45097b['CONNECTED'])['catch'](_0x406341=>{throw console['error'](_0x406341),new _0x3793cd('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x45097b['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x5383fe{['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[z,_0x326fdb];}constructor(_0x340179){super(_0x340179),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x43ba52(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x326fdb);}init(){const _0x2f85e4=this['context']['plugins']['get'](z);this['listenTo'](_0x2f85e4,'change:state',(_0x58f8e6,_0x406277,_0x27737d)=>{if('connected'!==_0x27737d)this['channelSessions']['forEach'](_0x2ae407=>_0x2ae407['clear']()),this['channelConnectedUsers']['forEach'](_0x12cf8f=>_0x12cf8f['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x87181c,_0x54ce3a]of this['_registeredSessions'])for(const _0x5bf723 of _0x54ce3a)this['_handleSessionAdd'](_0x87181c,_0x5bf723);}}),this['_createUser'](_0x2f85e4['connection']['me'],!0x0);}register(_0x178528,_0x2afeb0){if(this['_registeredSessions']['has'](_0x178528))throw new _0x3793cd('sessions-register-already-registered',null,{'channelId':_0x178528});this['_registeredSessions']['set'](_0x178528,_0x2afeb0),this['channelSessions']['set'](_0x178528,new _0x43ba52()),this['channelConnectedUsers']['set'](_0x178528,new _0x43ba52()),this['listenTo'](_0x2afeb0,'add',(_0x235255,_0x30ff74)=>this['_handleSessionAdd'](_0x178528,_0x30ff74)),this['listenTo'](_0x2afeb0,'remove',(_0x2eebcf,_0x16f3b4)=>this['_handleSessionRemove'](_0x178528,_0x16f3b4));for(const _0x18c048 of _0x2afeb0)this['_handleSessionAdd'](_0x178528,_0x18c048);}unregister(_0x2b75b1){if(!this['_registeredSessions']['has'](_0x2b75b1))throw new _0x3793cd('sessions-unregister-not-exist',null,{'channelId':_0x2b75b1});const _0x292f2d=this['_registeredSessions']['get'](_0x2b75b1);this['stopListening'](_0x292f2d);for(const _0x1695a6 of _0x292f2d)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x2b75b1,_0x1695a6);this['_registeredSessions']['delete'](_0x2b75b1),this['channelSessions']['delete'](_0x2b75b1),this['channelConnectedUsers']['delete'](_0x2b75b1);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x326aac){for(const _0x5ee189 of this['channelSessions']['values']())for(const _0x2b43a3 of _0x5ee189)if(_0x2b43a3['id']===_0x326aac)return _0x2b43a3['user'];}getUserSessions(_0x3ca5c5,_0x1ca343){const _0x6795b6=_0x1ca343?[this['channelSessions']['get'](_0x1ca343)]:this['channelSessions']['values'](),_0x11bd71=new Set();for(const _0x6fd794 of _0x6795b6)for(const _0x3bce13 of _0x6fd794)_0x3bce13['user']['id']===_0x3ca5c5['id']&&_0x11bd71['add'](_0x3bce13['id']);return _0x11bd71;}getUserRole(_0x510644){for(const _0x598a71 of this['channelSessions']['values']())for(const _0x31ce6a of _0x598a71)if(_0x31ce6a['user']===_0x510644)return _0x31ce6a['role'];}['_handleSessionAdd'](_0x4fc309,_0x3b8164){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x41d194=_0x3b8164['user'],_0x59e9ae=this['_users']['getUser'](_0x41d194['id'])||this['_createUser'](_0x41d194),_0x710129=Object['assign']({},_0x3b8164,{'user':_0x59e9ae});if(this['channelSessions']['get'](_0x4fc309)['add'](_0x710129),!_0x41d194['hiddenInPresenceList']){const _0xb664ac=this['channelConnectedUsers']['get'](_0x4fc309);_0xb664ac['has'](_0x59e9ae['id'])||_0xb664ac['add'](_0x59e9ae),this['allConnectedUsers']['has'](_0x59e9ae['id'])||_0x41d194['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x59e9ae,_0x59e9ae['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x4fc309,{'channelId':_0x4fc309,'session':_0x710129});}['_handleSessionRemove'](_0x237bbd,_0x529197){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x5bbd14=this['channelConnectedUsers']['get'](_0x237bbd),_0x3d0a91=_0x529197['user'];_0x3d0a91['id']&&(this['channelSessions']['get'](_0x237bbd)['remove'](_0x529197['id']),_0x5bbd14['has'](_0x3d0a91['id'])&&!this['getUserSessions'](_0x3d0a91,_0x237bbd)['size']&&_0x5bbd14['remove'](_0x3d0a91['id']),this['allConnectedUsers']['get'](_0x3d0a91['id'])&&!this['getUserSessions'](_0x3d0a91)['size']&&this['allConnectedUsers']['remove'](_0x3d0a91['id']));}_createUser(_0x4815c9,_0x261088){const _0x1540f0=this['_users']['addUser'](_0x4815c9);return _0x261088&&this['_users']['defineMe'](_0x4815c9['id']),_0x1540f0['orderNumber']=this['_uniqueUsersCount']++,_0x1540f0;}},K=class extends _0x182d58{_domEmitter=new(_0x5eaf0b())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x2c4fb7=this['editor'],_0x40d607=_0x2c4fb7['plugins']['get'](Y);_0x2c4fb7['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x55b15a,{writer:_0x2d4981})=>function(_0x57ce35,_0x288390,_0x295017,_0x2ef0e2){const _0x4bba1c=_0x57ce35['markerName']['split'](':')[0x2],_0x3c35a7=_0x295017['getUserBySessionId'](_0x4bba1c);if(!_0x3c35a7||_0x4bba1c===_0x295017['mySessionId'])return;if(!_0x2ef0e2['model']['schema']['checkChild'](_0x57ce35['markerRange']['start'],'$text'))return;const _0x328035={'class':'ck-user__marker\x20'+_0x3c35a7['color']['getMarkerClass'](),'style':Q(_0x3c35a7),'data-name':_0x3c35a7['name'],'data-session-id':_0x4bba1c},_0xadac99=_0x2ef0e2['model']['markers']['get'](_0x57ce35['markerName'])['getStart'](),_0x35dd5c=_0xadac99['nodeAfter'],_0x23c06a=_0x2ef0e2['model']['schema'];if(_0x35dd5c&&_0x23c06a['isObject'](_0x35dd5c)&&_0x23c06a['isInline'](_0x35dd5c)&&!_0x2ef0e2['model']['markers']['get']('user:range:'+_0x4bba1c)['getRange']()['isCollapsed'])return;const _0x37b4c9=_0xadac99['parent'];return _0x2ef0e2['model']['schema']['isLimit'](_0x37b4c9)&&!_0x2ef0e2['model']['hasContent'](_0x37b4c9)&&(_0x328035['contenteditable']=!0x1),function(_0x4b6374,_0x35b671,_0x5bd3b6){const _0xbfac4c=_0x4b6374['createUIElement']('span',_0x35b671);return _0x4b6374['setCustomProperty']('userPositionMarker',!0x0,_0xbfac4c),_0xbfac4c['render']=function(_0x58a194){const _0x68e6e5=this['toDomElement'](_0x58a194),_0x24312e=document['createElement']('span');return _0x24312e['classList']['add']('ck-user__marker-tooltip'),_0x24312e['setAttribute']('contenteditable','false'),_0x24312e['setAttribute']('spellcheck','false'),_0x24312e['textContent']=_0x5bd3b6['name'],_0x68e6e5['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x24312e['outerHTML']+'',_0x68e6e5['addEventListener']('mouseenter',()=>{_0x68e6e5['classList']['add']('ck-user__marker_hovered');}),_0x68e6e5['addEventListener']('mouseleave',()=>{_0x68e6e5['classList']['remove']('ck-user__marker_hovered');}),_0x68e6e5;},_0xbfac4c['isSimilar']=function(_0xa8a42a){return!(!this['getCustomProperty']('userPositionMarker')||!_0xa8a42a['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0xa8a42a['getAttribute']('data-session-id'));},_0xbfac4c;}(_0x288390,_0x328035,_0x3c35a7);}(_0x55b15a,_0x2d4981,_0x40d607,_0x2c4fb7)}),_0x2c4fb7['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x95329f=>function(_0x34f01e,_0x37e457){const _0x44e217=_0x34f01e['markerName']['split'](':')[0x2];if(_0x44e217===_0x37e457['mySessionId'])return null;const _0x4ee6a8=_0x37e457['getUserBySessionId'](_0x44e217);return _0x4ee6a8?{'id':_0x44e217,'classes':['ck-user__selection',_0x4ee6a8['color']['getSelectionClass']()],'attributes':{'style':Q(_0x4ee6a8),'data-session-id':_0x44e217},'priority':0x7d0+_0x4ee6a8['orderNumber']}:{'id':_0x44e217,'classes':[]};}(_0x95329f,_0x40d607)}),function(_0xb95c91){const _0x5d4f9f=_0xb95c91['model'],_0x2c3cb8=new Map(),_0x2e3740=_0xb95c91['plugins']['get'](Y);_0x5d4f9f['markers']['on']('update:user:range',(_0x3736d5,_0x3c95fd,_0x3e1f77,_0x80afbb)=>{if(!_0x80afbb&&_0x2c3cb8['get'](_0x3c95fd['name']))return _0x2c3cb8['get'](_0x3c95fd['name'])['detach'](),void _0x2c3cb8['delete'](_0x3c95fd['name']);const _0x187877=_0x3c95fd['name']['split'](':')[0x2];if(_0x187877===_0x2e3740['mySessionId'])return;const _0x518024='user:position:'+_0x187877;_0x5d4f9f['markers']['has'](_0x518024)&&_0xb95c91['editing']['reconvertMarker'](_0x518024),_0x3c95fd['on']('change:range',(_0xf872b,_0x182c0a,_0x23dcb9)=>{if('$graveyard'!=_0x182c0a['root']['rootName']&&'$graveyard'==_0x3c95fd['getRange']()['root']['rootName']&&!_0x2c3cb8['has'](_0x3c95fd['name'])){const _0x146679=_0x5d4f9f['schema']['getNearestSelectionRange'](_0x23dcb9['deletionPosition']);if(_0x146679){const _0x5f5692=_0x1db5d4['fromRange'](_0x146679);_0x2c3cb8['set'](_0x3c95fd['name'],_0x5f5692),_0x5f5692['on']('change:range',(_0x21571,_0x11cfeb,_0x43db17)=>{if('$graveyard'==_0x5f5692['root']['rootName']){const _0x3f1705=_0x5d4f9f['schema']['getNearestSelectionRange'](_0x43db17['deletionPosition']);_0x3f1705?(_0x5f5692['start']=_0x3f1705['start'],_0x5f5692['end']=_0x3f1705['end']):(_0x2c3cb8['delete'](_0x3c95fd['name']),_0x5f5692['detach']());}});}}});}),_0x5d4f9f['document']['on']('change',()=>{_0x2c3cb8['size']>0x0&&_0x5d4f9f['enqueueChange']({'isUndoable':!0x1},_0x1adaf6=>{for(const [_0x1dffa3,_0xf2df5a]of _0x2c3cb8)'$graveyard'==_0x5d4f9f['markers']['get'](_0x1dffa3)['getRange']()['root']['rootName']&&(J(_0x1dffa3['split'](':')[0x2],_0xf2df5a['toRange'](),_0x5d4f9f,_0x1adaf6),_0xf2df5a['detach']());_0x2c3cb8['clear']();});});}(_0x2c4fb7),this['_domEmitter']['listenTo'](_0x415cf5['document'],'keydown',(_0x745298,{key:_0x57a51a})=>{'Escape'===_0x57a51a&&function(_0x5de076){_0x5de076['editing']['view']['change'](_0x42cc75=>{for(const _0x2dbbe9 of _0x5de076['model']['markers']){if(!_0x2dbbe9['name']['startsWith']('user:position'))continue;const _0x1f1689=_0x5de076['editing']['mapper']['markerNameToElements'](_0x2dbbe9['name']);if(_0x1f1689){for(const _0x101b54 of _0x1f1689)_0x42cc75['removeClass']('ck-user__marker_hovered',_0x101b54);}}});}(_0x2c4fb7);},{'useCapture':!0x0});}afterInit(){const _0x26d221=this['editor'],_0x1860c8=_0x26d221['commands']['get']('undo');_0x1860c8&&_0x26d221['model']['on']('applyOperation',(_0x2703ed,_0x2619c0)=>{const _0x363a0b=_0x2619c0[0x0];if(!_0x363a0b['isDocumentOperation'])return;if('marker'!=_0x363a0b['type']||!_0x363a0b['name']['startsWith']('user:'))return;const _0xf127e0=_0x363a0b['batch'];_0x1860c8['_createdBatches']['has'](_0xf127e0)&&(_0x363a0b['newRange']=_0x363a0b['oldRange']?_0x26d221['model']['createRange'](_0x363a0b['oldRange']['start'],_0x363a0b['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x429ba1=this['editor'],_0x11bff4=_0x429ba1['model']['document'],_0xfe38e0=_0x429ba1['plugins']['get'](Y);_0x429ba1['model']['enqueueChange']({'isUndoable':!0x1},_0x16490d=>{const _0x1e621e='user:range:'+_0xfe38e0['mySessionId'],_0x3f84fc='user:position:'+_0xfe38e0['mySessionId'],_0x181a09=_0x429ba1['model']['markers']['has'](_0x1e621e);_0x429ba1['editing']['view']['hasDomSelection']?J(_0xfe38e0['mySessionId'],_0x11bff4['selection']['getFirstRange'](),_0x429ba1['model'],_0x16490d):_0x181a09&&(_0x16490d['removeMarker'](_0x1e621e),_0x16490d['removeMarker'](_0x3f84fc));});}};function J(_0x5ab3d9,_0x4278d0,_0x239ad2,_0xbf9805){const _0x4368da='user:range:'+_0x5ab3d9,_0x393ad9='user:position:'+_0x5ab3d9,_0x21bf63=_0x4278d0['getContainedElement']();let _0x518dff=_0x4278d0['start'];if(_0x21bf63&&_0x21bf63['is']('element','tableCell')){const _0x34d8ee=function(_0x16f517,_0x322a23){for(const _0xca68 of _0x16f517['getPositions']())if(_0x322a23['schema']['checkChild'](_0xca68,'$text'))return _0xca68;}(_0x4278d0,_0x239ad2);_0x34d8ee&&(_0x518dff=_0x34d8ee,_0x4278d0=_0xbf9805['createRange'](_0x518dff));}const _0x155432=_0xbf9805['createRange'](_0x518dff);_0x239ad2['markers']['has'](_0x4368da)?(_0xbf9805['updateMarker'](_0x4368da,{'range':_0x4278d0}),_0xbf9805['updateMarker'](_0x393ad9,{'range':_0x155432})):(_0xbf9805['addMarker'](_0x4368da,{'range':_0x4278d0,'usingOperation':!0x0}),_0xbf9805['addMarker'](_0x393ad9,{'range':_0x155432,'usingOperation':!0x0}));}function Q(_0x502ea9){return'--ck-user-color:'+_0x502ea9['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x502ea9['color']['getColorAlphaVariable']()+';';}function X(_0x568c1f,_0x72db53,_0x3886e1){const _0x443ca3=_0x568c1f['t'],t=_0x568c1f['t'];switch(_0x72db53){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 _0x443ca3({'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'},_0x3886e1);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x182d58{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x30f8d9)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x4f34ce,_0x326fdb,_0x41498b];}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 _0x4c20a9=this['serverHistory']['getOperations']();for(let _0xf40ce6=_0x4c20a9['length']-0x1;_0xf40ce6>=0x0;_0xf40ce6--){const _0x31a309=_0x4c20a9[_0xf40ce6];if(!this['_disconnectionOperations']['has'](_0x31a309))return _0x31a309['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x163aaa){if(super(_0x163aaa),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0xd1004d(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x3793cd('collaboration-missing-channelid',this);const _0x73e9d4=_0x163aaa['config']['get']('cloudServices.bundleVersion')||_0x4b7de2;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x73e9d4,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x567ad9(),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 it(this['_disconnectionOperations']);}init(){const _0x162aff=this['editor'],_0x50a1c3=_0x162aff['plugins']['get'](_0x326fdb),_0x3486a0=_0x162aff['plugins']['get'](z);this['listenTo'](_0x50a1c3,'getOperationAuthor',(_0x4a762f,_0x561147)=>{const _0x2abccf=_0x561147[0x0];_0x2abccf['_authorId']&&(_0x4a762f['return']=_0x50a1c3['getUser'](_0x2abccf['_authorId']),_0x4a762f['stop']()),null===_0x2abccf['_authorId']&&(_0x4a762f['return']=null,_0x4a762f['stop']());},{'priority':'high'}),this['listenTo'](_0x162aff['model']['document']['selection'],'change:range',(_0x23a4ae,_0x30008e)=>{_0x30008e['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x162aff['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x162aff['model']['on']('applyOperation',(_0x4b5eb,_0x2f3223)=>{const _0x57ee36=_0x2f3223[0x0];_0x57ee36['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x57ee36),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x3486a0,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x28e267,_0x2b29bc,_0x3b8a67)=>'connected'===_0x28e267&&!_0x2b29bc&&!_0x3b8a67),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x162aff['disableReadOnlyMode']('rtc-offline'):_0x162aff['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x162aff['disableReadOnlyMode']('rtc-offline'):_0x162aff['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x2c6253=this['editor']['plugins']['get'](Y),_0x19fe19=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x2c6253['unregister'](this['_channelId']);const _0x1ab637=await this['_service']['reconnect'](_0x19fe19['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1ab637)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x5a1e07=await this['_service']['getConnectedSessions']();_0x2c6253['register'](this['_channelId'],_0x5a1e07),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x57cc32){if(function(_0x4cd1fa){return'404'===_0x4cd1fa['code'];}(_0x57cc32)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0xca52d){return'409'===_0xca52d['code'];}(_0x57cc32)){const _0x749678=X(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'](_0x749678);}else{if(!(_0x57cc32 instanceof et))throw _0x57cc32;this['_handleReconnectionError']();}}}}destroy(){const _0x39698b=this['editor']['plugins']['get'](z),_0x2b95ee=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x2b95ee['channelSessions']['has'](this['_channelId'])&&_0x2b95ee['unregister'](this['_channelId']),_0x39698b['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x563e93){if(this['sessionId']!==_0x563e93['sessionId']&&this['_lastSyncedOperationId']!==_0x563e93['lastOperationId'])throw new et();return this['sessionId']=_0x563e93['sessionId'],this['_handleServerResponse']([],{..._0x563e93,'wereChangesApplied':!0x1,'data':_0x563e93['data']},'reconnect');}async _connectService(_0x551f60,_0x3e9fce=!0x1){const {connection:_0x1da318}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x1da318,this['_channelId'])['then'](_0x581228=>this['_initSessionsHandling'](_0x581228))['catch'](_0x292a6d=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x292a6d);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x55e2ea,_0x1681bc)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x1681bc);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x1901aa=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x551f60);this['_isPendingUpdate']=!0x0;const _0x19b290=await this['_service']['connect'](_0x1da318,this['_compressOperations'](_0x551f60),_0x1901aa);if(this['sessionId']=_0x19b290['sessionId'],_0x3e9fce){if(!_0x19b290['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x19b290['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x551f60,_0x19b290,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x19b290,_0x551f60);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x3d7aa1=this['editor']['plugins']['get'](Y),_0x3f6773=this['editor']['plugins']['get'](K),_0x4d9f06=_0x3d7aa1['channelSessions']['get'](this['_channelId']);_0x4d9f06&&_0x4d9f06['length']>0x1?_0x3f6773['createUserMarkerOperations']():this['listenTo'](_0x3d7aa1,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x3d7aa1['channelSessions']['get'](this['_channelId'])['length']&&_0x3f6773['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x434915,_0x2f8e03,_0x1fcfba,_0x2493ff){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x2f8e03){const _0x10d36d=this['_decompressOperations'](_0x1fcfba,_0x2493ff);await this['_fetchMissingUsers'](_0x10d36d),this['_handleExternalOperations'](_0x10d36d,_0x2f8e03,_0x1fcfba['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x2f3d7f}=this['editor'];let _0x21d273;try{_0x21d273=await this['_service']['getDocumentDetails']();}catch{const _0x4836d9=X(_0x2f3d7f,'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'](_0x4836d9);}const _0x1d34f0=_0x21d273['currentDocumentSession']||_0x21d273['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x1d34f0['lastOperationId']){const _0x539828=X(_0x2f3d7f,'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'](_0x539828);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x437013=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x437013['connection']||'connected'!==_0x437013['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x478648=this['editor']['plugins']['get'](Y);_0x478648['channelSessions']['has'](this['_channelId'])&&_0x478648['unregister'](this['_channelId']),_0x437013['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x18de96){const _0x36c605=this['editor']['plugins']['get'](Y);this['listenTo'](_0x36c605,'sessionAdd:'+this['_channelId'],(_0x1c6704,{session:_0x28e4f8})=>{if(_0x28e4f8['id']===_0x36c605['mySessionId']){_0x1c6704['off']();const _0x442a7f=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x3b97b3=_0x28e4f8['permissions'];_0x442a7f&&_0x442a7f['isEnabled']&&(_0x3b97b3=_0x3b97b3['filter'](_0x5a366f=>'document:write'!==_0x5a366f)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x3b97b3,this['_channelId']);}}),_0x36c605['register'](this['_channelId'],_0x18de96);}_initThrowingOnDataSet(){const _0x158276=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x5a8f6c)=>{if(!_0x5a8f6c[_0x5a8f6c['length']-0x1]['suppressErrorInCollaboration'])throw new _0x3793cd('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x158276['apply'](this['editor']['data'],_0x5a8f6c);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x4d9912,[_0x1edd54])=>{if(this['_document']['version'])throw new _0x3793cd('realtimecollaborationclient-init-document-already-initialized',this);_0x4d9912['stop'](),this['_setPendingAction']();const _0x3eae75=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x516743])=>!_0x516743['lazyLoad'])['map'](([_0x7bb452,_0x525d68])=>[_0x7bb452,_0x525d68['modelAttributes']||{}])),_0x1ecb4f=this['_getOperationsFromInitData'](_0x1edd54,_0x3eae75);0x0==_0x1ecb4f['length']&&_0x1ecb4f['push'](new _0x48d7e0(0x0)),_0x4d9912['return']=this['_connectService'](_0x1ecb4f)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1b4bc8=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1b4bc8))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2067ed,[_0x2477b7,_0x4f444f])=>{_0x2067ed['stop']();const _0x3d09c8=this['editor']['model']['document']['getRoot'](_0x2477b7);if(!this['_knownRootNames']['has'](_0x2477b7)){const _0x411834=_0x4f444f&&_0x4f444f['data']?_0x4f444f['data']:'',_0x4ac733=_0x4f444f&&_0x4f444f['attributes']?_0x4f444f['attributes']:{};await this['_loadRoot'](_0x2477b7,_0x411834,_0x4ac733);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x3d09c8['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x3d09c8);});},{'priority':'high'});}async _fetchMissingUsers(_0x2d1175){const _0x560787=this['editor']['plugins']['get'](_0x326fdb),{connection:_0x41e75e}=this['editor']['plugins']['get'](z),_0x747a55=new Set();for(const _0x5967df of _0x2d1175){const _0x159327=_0x5967df['_authorId'];_0x159327&&!_0x560787['getUser'](_0x159327)&&_0x747a55['add'](_0x159327);}if(0x0===_0x747a55['size'])return;const _0x2bacb2=await _0x198d99['getMany'](_0x41e75e,Array['from'](_0x747a55));for(const _0x2a01bb of _0x2bacb2)_0x560787['getUser'](_0x2a01bb['id'])||_0x560787['addUser'](_0x2a01bb);}_getOperationsFromInitData(_0x28e7e1,_0x6b6aa3={}){const _0x1a5dda=this['editor']['model'],_0x27c33b=[];let _0x17affc=0x0;const _0x181a79='string'==typeof _0x28e7e1?{'main':_0x28e7e1}:_0x28e7e1;for(const _0x3302a1 of Object['keys'](_0x181a79)){if(!this['_document']['roots']['has'](_0x3302a1))throw new _0x3793cd('realtimecollaborationclient-init-non-existent-root',this);const _0x58cadb=this['_document']['getRoot'](_0x3302a1),_0x30d6c4=this['editor']['data']['parse'](_0x181a79[_0x3302a1],_0x58cadb),_0x5c6c8e=new _0x812ce(_0x1a5dda['createPositionAt'](_0x58cadb,0x0),_0x30d6c4,_0x17affc++);_0x27c33b['push'](_0x5c6c8e);for(const [_0x342d87,_0x2c9fd9]of _0x30d6c4['markers']){const _0x32a0f0=_0x1a5dda['createRange'](_0x1a5dda['createPositionFromPath'](_0x58cadb,_0x2c9fd9['start']['path']['slice']()),_0x1a5dda['createPositionFromPath'](_0x58cadb,_0x2c9fd9['end']['path']['slice']())),_0x502fa3=new _0x4955a2(_0x342d87,null,_0x32a0f0,_0x1a5dda['markers'],!0x0,_0x17affc++);_0x27c33b['push'](_0x502fa3);}}if(_0x6b6aa3)for(const [_0x191285,_0x1250fb]of Object['entries'](_0x6b6aa3)){const _0x7e4bed=_0x1a5dda['document']['getRoot'](_0x191285);if(!_0x7e4bed)throw new _0x3793cd('multi-root-editor-root-attributes-no-root',null);for(const [_0x2e50ee,_0x32e05d]of Object['entries'](_0x1250fb))if(null!==_0x32e05d){const _0x1b1f50=new _0x4ece14(_0x7e4bed,_0x2e50ee,null,_0x32e05d,_0x17affc++);_0x27c33b['push'](_0x1b1f50);}}return _0x27c33b;}async _loadRoot(_0xc3e647,_0x2fdba1,_0x3f0c2f){this['_getOperationsFromInitData']({[_0xc3e647]:_0x2fdba1},{[_0xc3e647]:_0x3f0c2f})['forEach']((_0x1ab4af,_0x204085)=>{_0x1ab4af['baseVersion']=this['_document']['version']+_0x204085,_0x1ab4af['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x1ab4af);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x41f684,_0x3d3254){let _0x13b78b;this['_offset']=_0x41f684['offset'];const _0x2f66fd=_0x41f684['wereChangesApplied']&&!_0x41f684['initData'],_0xa1f038=_0x2f66fd?0x0:_0x41f684['data']['baseVersion'];if(_0x3d3254['forEach'](_0x3bc580=>{_0x3bc580['_isInit']=!0x0,_0x3bc580['createdAt']=_0x41f684['sessionCreatedAt'],_0x3bc580['_authorId']=null;}),_0x2f66fd)_0x13b78b=_0x3d3254,this['_applyOperationsSet'](_0x13b78b,_0x2f66fd);else{if(_0x41f684['initData']){const _0x37f6da=this['_getOperationsFromInitData'](_0x41f684['initData']);this['_document']['history']['version']=-_0x37f6da['length'],_0x37f6da['forEach'](_0x53efbf=>{_0x53efbf['baseVersion']-=_0x37f6da['length'],_0x53efbf['createdAt']=_0x41f684['sessionCreatedAt'],_0x53efbf['_isInit']=!0x0,_0x53efbf['_authorId']=null;}),this['_applyOperationsSet'](_0x37f6da,!0x0),this['serverHistory']['version']=-_0x37f6da['length']+this['_offset'],this['_updateServerHistory'](_0x37f6da);}this['_document']['history']['version']=_0xa1f038,_0x13b78b=this['_decompressOperations'](_0x41f684['data'],_0x41f684['metadata']),await this['_fetchMissingUsers'](_0x13b78b),this['_applyOperationsSet'](_0x13b78b,_0x2f66fd);}_0x41f684['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x13b78b,_0x41f684['lastOperationId']),this['_lastSyncedOperationId']=_0x41f684['lastOperationId']),this['serverHistory']['version']=_0xa1f038+this['_offset'],this['_updateServerHistory'](_0x13b78b),_0x3d3254['filter'](_0x31841e=>{const _0x4c279f=this['_getAffectedRoot'](_0x31841e);return _0x4c279f&&!this['_knownRootNames']['has'](_0x4c279f);})['forEach']((_0x9347f6,_0x5a819f)=>{_0x9347f6['baseVersion']=this['_document']['version']+_0x5a819f,this['_saveOperationInBuffer'](_0x9347f6);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3bd39d,_0xdfd9cc){const _0x3670c5=_0xdfd9cc&&_0xdfd9cc['message'];if(_0x3670c5&&_0x3670c5['startsWith']('realtimecollaborationclient'))throw _0xdfd9cc;const _0x15b0d6=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x15b0d6['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x3793cd(_0x3bd39d,this['editor'],_0x3670c5?{'originalError':_0x3670c5}:void 0x0);}_saveOperationInBuffer(_0x295c38){this['_knownOperations']['has'](_0x295c38)||(this['_knownOperations']['add'](_0x295c38),this['_bufferedOperations']['push'](_0x295c38),this['_pendingAction']||'marker'==_0x295c38['type']&&!_0x295c38['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x3be581=!0x1){!_0x3be581&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x4a4bf5=>{_0x4a4bf5&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x1e2f0f=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x2c17e2){return _0x2c17e2['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2c17e2['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x2c17e2['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x1e2f0f)||this['_crash'](_0x1e2f0f['message'],_0x1e2f0f);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x57feac=>{this['on']('change:_isPendingUpdate',()=>{_0x57feac();});});}async _sendBufferedOperations(){const _0x314e07=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x314e07['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x10fc27=[...this['_bufferedOperations']];for(const _0xc9c52f of _0x10fc27)_0xc9c52f['wasUndone']=this['_document']['history']['isUndoneOperation'](_0xc9c52f);const _0x1f66b9=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x10fc27),_0x324cef=Z++,_0xd39cea=this['_compressOperations'](_0x10fc27),_0x5185e9=await this['_service']['sendOperations'](_0xd39cea,_0xd39cea['baseVersion'],_0x1f66b9);try{return await this['_handleServerResponse'](_0x10fc27,_0x5185e9,_0x324cef);}catch(_0x3f6f91){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3f6f91);}}async['_handleServerResponse'](_0x385cf2,_0x23c6b9,_0x5997e3){if('error'in _0x23c6b9)throw _0x23c6b9['error'];let _0x1c9f5a;if(_0x23c6b9['wereChangesApplied']){_0x23c6b9['lastOperationId']&&(this['_lastSyncedOperationId']=_0x23c6b9['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1a26a0=>!_0x385cf2['includes'](_0x1a26a0));for(const _0x370cab of _0x385cf2)_0x370cab['createdAt']='lastOperationAcceptedAt'in _0x23c6b9&&_0x23c6b9['lastOperationAcceptedAt']||void 0x0;st(_0x385cf2,_0x23c6b9['version']-_0x385cf2['length']),this['_updateServerHistory'](_0x385cf2);const _0x4a8d7a=_0x385cf2['filter'](_0x547178=>{if(!_0x547178['_isInit'])return!0x1;const _0x485ad1=this['_getAffectedRoot'](_0x547178);return _0x485ad1&&!this['_knownRootNames']['has'](_0x485ad1);});st(_0x4a8d7a,this['_document']['version']),this['_applyOperationsSet'](_0x4a8d7a),_0x1c9f5a=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0xc02c1f=this['_decompressOperations'](_0x23c6b9['data'],_0x23c6b9['metadata'])['filter'](_0x2c2236=>_0x2c2236['baseVersion']>=this['_lastServerVersion']);_0xc02c1f['forEach'](_0x574c96=>this['_addKnownRoot'](_0x574c96)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x53014f=>!_0x53014f['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x53014f))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0xc02c1f),_0x1c9f5a=this['_handleExternalOperations'](_0xc02c1f,_0x23c6b9['version'],_0x23c6b9['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1c9f5a?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x109fc9,_0xad4fdb,_0x5db956){try{const _0x3e348a={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x3601be,operationsB:_0x1e8d15,originalOperations:_0x315ec1}=_0x53ed02(_0x109fc9,this['_bufferedOperations'],_0x3e348a);st(_0x3601be,this['_document']['version']),st(_0x1e8d15,_0xad4fdb);for(const _0x316dc7 of _0x3601be){const _0x56b13b=_0x315ec1['get'](_0x316dc7);_0x56b13b?(_0x316dc7['_authorId']=_0x56b13b['_authorId'],'noop'!==_0x316dc7['type']&&(_0x316dc7['_aiSource']=_0x56b13b['_aiSource'])):_0x316dc7['_authorId']=null;}for(const _0x210427 of _0x1e8d15)'noop'!==_0x210427['type']&&(_0x210427['_aiSource']=_0x315ec1['get'](_0x210427)?.['_aiSource']);_0x5db956&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x109fc9,_0x5db956),this['_lastSyncedOperationId']=_0x5db956),this['_bufferedOperations']=[..._0x1e8d15],this['_applyOperationsSet'](_0x3601be),this['_updateServerHistory'](_0x109fc9);}catch(_0x4383f1){return console['error'](_0x4383f1),!0x1;}return!0x0;}_applyOperationsSet(_0x572c95,_0x246770=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x457ea7=>{for(const _0x4c47f9 of _0x572c95)this['_knownOperations']['add'](_0x4c47f9),this['_addKnownRoot'](_0x4c47f9),_0x457ea7['batch']['addOperation'](_0x4c47f9),this['editor']['model']['applyOperation'](_0x4c47f9);});}_addKnownRoot(_0x400f30){const _0x33e0f6=this['_getAffectedRoot'](_0x400f30);_0x33e0f6&&this['_knownRootNames']['add'](_0x33e0f6);}_getAffectedRoot(_0x33386b){let _0x29ecee,_0x1d516d;switch(_0x33386b['type']){case'insert':_0x29ecee=_0x33386b['position']['root'];break;case'marker':if(_0x1d516d=_0x33386b['newRange'],!_0x1d516d)return null;_0x29ecee=_0x1d516d['root'];break;case'addRootAttribute':_0x29ecee=_0x33386b['root'];break;case'addRoot':_0x29ecee=_0x33386b['affectedSelectable'];break;case'move':_0x29ecee=_0x33386b['targetPosition']['root'];break;default:return null;}return _0x29ecee['rootName'];}_updateServerHistory(_0x4c11fb){_0x4c11fb['forEach'](_0x4bca50=>{const _0x4f7d4d=_0x4bca50['clone']();_0x4f7d4d['_authorId']=_0x4bca50['_authorId'],_0x4f7d4d['_isInit']=!!_0x4bca50['_isInit'],_0x4f7d4d['_aiSource']=_0x4bca50['_aiSource'],_0x4f7d4d['createdAt']=_0x4bca50['createdAt'],_0x4f7d4d['baseVersion']+=this['_offset'],_0x4bca50['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x4f7d4d),this['serverHistory']['addOperation'](_0x4f7d4d);});}_handleReconnectionError(_0x1e58ba){const _0x6d605=this['editor']['plugins']['get']('Notification'),_0x4abb26=this['editor']['locale'];_0x1e58ba||(_0x1e58ba=X(_0x4abb26,'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.')),_0x6d605['showWarning'](_0x1e58ba,{'title':X(_0x4abb26,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x4f34ce)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x4f34ce)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x1ecf7d){const _0xc0c0be=_0x1ecf7d['map'](_0x5a680c=>_0x5a680c['toJSON']());return this['_compressor']['compress'](_0xc0c0be);}_decompressOperations(_0x582bfa,_0x334d48){return this['_compressor']['decompress'](_0x582bfa)['map']((_0x380f99,_0x400b0c)=>{const _0x3a600d='init'==_0x334d48[_0x400b0c]['type'];if('InsertOperation'==_0x380f99['__className']){const _0x2c1aa8=_0x380f99['position']['root'];!this['_document']['getRoot'](_0x2c1aa8)&&(this['_document']['createRoot']('$unknown',_0x2c1aa8)['_isAttached']=!0x1);}else{if('RootOperation'==_0x380f99['__className']){const _0x41427f=this['_document']['getRoot'](_0x380f99['rootName']);_0x41427f&&'$unknown'==_0x41427f['name']&&_0x380f99['elementName']!=_0x41427f['name']&&(_0x41427f['name']=_0x380f99['elementName']);}}const _0x2b3443=_0x3db4a7['fromJSON'](_0x380f99,this['_document']);return _0x2b3443['wasUndone']=_0x380f99['wasUndone'],_0x2b3443['_isInit']=_0x3a600d,_0x2b3443['_authorId']=_0x3a600d?null:_0x334d48[_0x400b0c]['userId'],_0x2b3443['_isDisconnection']='cs:removeUser'===_0x334d48[_0x400b0c]['type'],_0x2b3443['_aiSource']=_0x380f99['_aiSource']||void 0x0,_0x2b3443['createdAt']=_0x334d48[_0x400b0c]['createdAt'],_0x2b3443;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x35d4c2=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x35d4c2&&_0x35d4c2['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x475c48,_0x2fa779){for(const _0x1ffd46 of _0x475c48)_0x1ffd46['baseVersion']=_0x2fa779++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x223e01){this['_ignoredOperations']=_0x223e01,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x3c1d6b){let _0xdeb38d=_0x3c1d6b['length'];for(;_0xdeb38d--;){const _0x44cd2c=_0x3c1d6b[_0xdeb38d];if(!this['_ignoredOperations']['has'](_0x44cd2c)){if(!this['_operationToId']['has'](_0x44cd2c)){const _0x21f74d=_0x26b079()['slice'](0x1,0x12);this['_operationToId']['set'](_0x44cd2c,_0x21f74d);}return this['_operationToId']['get'](_0x44cd2c);}}}setIdForTheLastOperation(_0x101ff9,_0x400655){if(!_0x400655)return;let _0x326300=_0x101ff9['length'];for(;_0x326300--;){const _0x539b07=_0x101ff9[_0x326300];this['_ignoredOperations']['has'](_0x539b07)||this['_operationToId']['set'](_0x539b07,_0x400655);}}},nt=class extends _0x182d58{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x5383fe{static CommentsService=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>_0x5c5423)());['_services'];static get requires(){return[z,_0xc1d332,Y,_0x326fdb];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x178daf){super(_0x178daf),this['_services']=new Map();}async init(){const _0x4ffedb=this['context'],_0x220c99=_0x4ffedb['plugins']['get'](_0xc1d332);if(_0x4ffedb['plugins']['get'](z)['addToReconnectionStack'](this),_0x220c99['adapter']={'addCommentThread':async({channelId:_0x1a5103,threadId:_0x14264f,comments:_0x376952,resolvedAt:_0x302d84,resolvedBy:_0x2d563a,context:_0x105304,attributes:_0x321b33})=>{const _0x1f3a56=await this['_getService'](_0x1a5103)['addCommentThread']({'commentThreadId':_0x14264f,'comments':_0x376952['map'](_0x20be87=>function(_0x5d813a,_0x40f8a7,_0x420cd5){return{'commentThreadId':_0x420cd5,'commentId':_0x5d813a['commentId'],'userId':_0x5d813a['authorId'],'content':_0x5d813a['content'],'documentId':_0x40f8a7,'createdAt':_0x5d813a['createdAt'],'attributes':_0x5d813a['attributes']||{}};}(_0x20be87,_0x1a5103,_0x14264f)),'resolvedAt':_0x302d84,'resolvedBy':_0x2d563a,'context':_0x105304,'attributes':_0x321b33})['catch'](ct);return{'threadId':_0x1f3a56['commentThreadId'],'comments':_0x1f3a56['comments']};},'getCommentThread':async({channelId:_0x3097c8,threadId:_0x517e17})=>{const _0x57dd88=await this['_getService'](_0x3097c8)['getCommentThread'](_0x517e17)['catch'](rt)['catch'](ct);return _0x57dd88?_0x57dd88['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x57dd88]),{'threadId':_0x57dd88['commentThreadId'],'comments':_0x57dd88['comments']['map'](at),'context':_0x57dd88['context'],'resolvedAt':_0x57dd88['resolvedAt'],'resolvedBy':_0x57dd88['resolvedBy'],'attributes':_0x57dd88['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x3b085d,threadId:_0x46be81,context:_0x18c918,unlinkedAt:_0x1831b9,attributes:_0x263ab1})=>this['_getService'](_0x3b085d)['updateCommentThread']({'commentThreadId':_0x46be81,'context':_0x18c918,'attributes':_0x263ab1,'unlinkedAt':_0x1831b9})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x6afdb8,threadId:_0x5ad0da})=>{const _0x1181e9=await this['_getService'](_0x6afdb8)['resolveCommentThread'](_0x5ad0da)['catch'](rt)['catch'](ct);return{'threadId':_0x1181e9['commentThreadId'],'resolvedAt':_0x1181e9['resolvedAt'],'resolvedBy':_0x1181e9['resolvedBy']};},'reopenCommentThread':async({channelId:_0x1dc277,threadId:_0x58daaa})=>this['_getService'](_0x1dc277)['reopenCommentThread'](_0x58daaa)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x24cfb7,threadId:_0x91c29c})=>this['_getService'](_0x24cfb7)['removeCommentThread'](_0x91c29c)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x11225a,threadId:_0x55b922,commentId:_0x1bc696,content:_0x126c59,attributes:_0x3a7104})=>this['_getService'](_0x11225a)['addComment'](_0x55b922,_0x1bc696,_0x126c59,_0x3a7104)['catch'](ct),'updateComment':({channelId:_0x40060f,threadId:_0x21f9f3,commentId:_0x56f38f,content:_0x47dc31,attributes:_0xb0dca7})=>this['_getService'](_0x40060f)['updateComment'](_0x21f9f3,_0x56f38f,_0x47dc31,_0xb0dca7)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x1ac2f0,threadId:_0x53beab,commentId:_0x34b746})=>this['_getService'](_0x1ac2f0)['removeComment'](_0x53beab,_0x34b746)['catch'](rt)['catch'](ct)},_0x4ffedb instanceof _0x4be23b){const _0x5b783d=_0x4ffedb['config']['get']('collaboration.channelId'),_0x26fe01=_0x4ffedb['plugins']['get'](Y);await this['_setUpService'](_0x5b783d);const _0x3918ea=await this['_services']['get'](_0x5b783d)['getConnectedSessions']();this['listenTo'](_0x26fe01,'sessionAdd:'+_0x5b783d,(_0x3af277,{session:_0x5886d2})=>{_0x5886d2['id']===_0x26fe01['mySessionId']&&(_0x3af277['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x5886d2['permissions'],_0x5b783d));}),_0x26fe01['register'](_0x5b783d,_0x3918ea);}}async _setUpService(_0x48192){if(this['_services']['has'](_0x48192))throw new _0x3793cd('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x48192});const _0xbe483e=this['context']['plugins']['get'](_0xc1d332),_0x1099fd=new CloudServicesCommentsAdapter['CommentsService'](_0x48192);this['_services']['set'](_0x48192,_0x1099fd),this['listenTo'](_0x1099fd,'commentThreadAdded',(_0x5e33b6,_0x36d34d)=>{const {commentThreadId:_0x45661a,documentId:_0x1d6fec,context:_0x11605f,attributes:_0x270e5a,resolvedAt:_0x3794e6,resolvedBy:_0x57f939,comments:_0xdd377d}=_0x36d34d;_0xbe483e['getCommentThread'](_0x45661a)||_0xbe483e['addCommentThread']({'threadId':_0x45661a,'channelId':_0x1d6fec,'comments':_0xdd377d?_0xdd377d['map'](at):[],'context':_0x11605f,'attributes':_0x270e5a,'resolvedAt':_0x3794e6,'resolvedBy':_0x57f939,'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentThreadUpdated',(_0x2897ca,{commentThreadId:_0x19d315,documentId:_0x48ba58,context:_0x15e591,unlinkedAt:_0x3a58ca,attributes:_0x1f4341})=>{_0xbe483e['getCommentThread'](_0x19d315)&&_0xbe483e['updateCommentThread']({'threadId':_0x19d315,'channelId':_0x48ba58,'context':_0x15e591,'unlinkedAt':_0x3a58ca,'attributes':_0x1f4341,'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentThreadResolved',(_0x386a2e,{commentThreadId:_0xab1aac,resolvedBy:_0x1a7cad,resolvedAt:_0x19b806})=>{const _0x40806e=_0xbe483e['getCommentThread'](_0xab1aac);_0x40806e&&_0x40806e['resolve']({'resolvedBy':_0x1a7cad,'resolvedAt':_0x19b806,'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentThreadReopened',(_0x5a58ed,{commentThreadId:_0x223a8b})=>{const _0x580824=_0xbe483e['getCommentThread'](_0x223a8b);_0x580824&&_0x580824['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentThreadRemoved',(_0x2589a7,{commentThreadId:_0x5bdda6})=>{const _0x284ff2=_0xbe483e['getCommentThread'](_0x5bdda6);_0x284ff2&&_0x284ff2['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentAdded',(_0x2e275b,_0x1d13d3)=>{const _0x4e5c14=_0x1d13d3['commentThreadId'],_0x3b653d=_0xbe483e['getCommentThread'](_0x4e5c14);_0x3b653d&&_0x3b653d['addComment']({...at(_0x1d13d3),'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentUpdated',(_0xdcc506,{commentThreadId:_0x433fa7,commentId:_0x5995b4,content:_0x191087,attributes:_0x48cfa0})=>{const _0x57d29d=_0xbe483e['getCommentThread'](_0x433fa7);if(_0x57d29d){const _0x2faf1e=_0x57d29d['getComment'](_0x5995b4);_0x2faf1e&&_0x2faf1e['update']({'content':_0x191087,'attributes':_0x48cfa0,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1099fd,'commentRemoved',(_0x3fccaa,{commentThreadId:_0x54704f,commentId:_0x754bf3})=>{const _0x22b696=_0xbe483e['getCommentThread'](_0x54704f);if(_0x22b696){const _0xad336b=_0x22b696['getComment'](_0x754bf3);_0xad336b&&_0xad336b['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x1099fd,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x48192),this['stopListening'](_0x1099fd));}),await this['_connectService'](_0x48192);}destroy(){if(this['context']instanceof _0x4be23b){const _0x513387=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x513387)&&this['_terminateService'](_0x513387);}}_terminateService(_0x51d838){if(!this['_services']['has'](_0x51d838))throw new _0x3793cd('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x51d838});this['_getService'](_0x51d838)['disconnect'](),this['_services']['delete'](_0x51d838);}async reconnect(){for(const _0x354646 of this['_services']['keys']())await this['_connectService'](_0x354646);if(this['context']instanceof _0x4be23b){const _0x2174ff=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x2174ff)){const _0x5cc79a=this['context']['plugins']['get'](Y);_0x5cc79a['unregister'](_0x2174ff);const _0x4e5af2=await this['_services']['get'](_0x2174ff)['getConnectedSessions']();_0x5cc79a['register'](_0x2174ff,_0x4e5af2);}}}async _connectService(_0x25754c){const {connection:_0x24345d}=this['context']['plugins']['get'](z),_0x172abb=this['context']['plugins']['get'](_0xc1d332),_0xbd62=await this['_services']['get'](_0x25754c)['connect'](_0x24345d);await this['_fetchMissingUsersForThreads'](_0xbd62);const _0x152c65=new Set(Array['from'](_0x172abb['getCommentThreads']({'channelId':_0x25754c}),_0x46a394=>_0x46a394['id']));for(const _0x330a70 of _0xbd62)_0x330a70['deletedAt']||_0x152c65['delete'](_0x330a70['commentThreadId']);for(const _0x4ab74b of _0x152c65)_0x172abb['getCommentThread'](_0x4ab74b)['remove']({'isFromAdapter':!0x0});for(const _0x1c319c of _0xbd62){let _0x594e25=_0x172abb['getCommentThread'](_0x1c319c['commentThreadId']);const {commentThreadId:_0x2166a3,context:_0x46f958,attributes:_0x24d8f9,resolvedBy:_0x20eef0,resolvedAt:_0x5c3013,unlinkedAt:_0x547867,deletedAt:_0x55c106}=_0x1c319c;if(_0x55c106)continue;_0x594e25||(_0x594e25=_0x172abb['addCommentThread']({'channelId':_0x25754c,'threadId':_0x2166a3,'context':_0x46f958,'attributes':_0x24d8f9||{},'resolvedBy':_0x20eef0,'resolvedAt':_0x5c3013,'unlinkedAt':_0x547867,'isFromAdapter':!0x0}));const _0x479809=new Set(Array['from'](_0x594e25['comments'],_0x30aca5=>_0x30aca5['id']));for(const _0x285989 of _0x1c319c['comments'])_0x479809['delete'](_0x285989['commentId']);for(const _0xa96d09 of _0x479809)_0x594e25['getComment'](_0xa96d09)['remove']({'isFromAdapter':!0x0});for(const _0x29d771 of _0x1c319c['comments']){const _0x51180d=_0x594e25['getComment'](_0x29d771['commentId']);_0x51180d?_0x51180d['content']!==_0x29d771['content']&&_0x51180d['update']({'content':_0x29d771['content'],'isFromAdapter':!0x0}):_0x594e25['addComment'](Object['assign'](at(_0x29d771),{'isFromAdapter':!0x0}));}}}_getService(_0x1fac26){if(!this['_services']['has'](_0x1fac26))throw new _0x3793cd('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x1fac26});return this['_services']['get'](_0x1fac26);}async _fetchMissingUsersForThreads(_0x4cbbdc){const _0xe62fd9=this['context']['plugins']['get'](_0x326fdb),{connection:_0x2f45f8}=this['context']['plugins']['get'](z),_0x4122f0=new Set();for(const {resolvedBy:_0x241c6e,comments:_0x5748cf}of _0x4cbbdc){_0x241c6e&&!_0xe62fd9['getUser'](_0x241c6e)&&_0x4122f0['add'](_0x241c6e);for(const {userId:_0x141fcb}of _0x5748cf)_0xe62fd9['getUser'](_0x141fcb)||_0x4122f0['add'](_0x141fcb);}if(0x0===_0x4122f0['size'])return;const _0x4e6ae4=await _0x198d99['getMany'](_0x2f45f8,Array['from'](_0x4122f0));for(const _0x4545e1 of _0x4e6ae4)_0xe62fd9['getUser'](_0x4545e1['id'])||_0xe62fd9['addUser'](_0x4545e1);}};async function rt(_0x5ed07f){if('404'!==_0x5ed07f['code'])throw _0x5ed07f;}function ct(_0x42857a){if((_0x5b949f=_0x42857a)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x5b949f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5b949f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x5b949f;throw _0x42857a;}function at(_0x301e79){return{'threadId':_0x301e79['commentThreadId'],'commentId':_0x301e79['commentId'],'content':_0x301e79['content'],'createdAt':_0x301e79['createdAt'],'authorId':_0x301e79['userId'],'attributes':_0x301e79['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x182d58{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x142660)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x5f0e50,Y,_0x326fdb];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xb845f8){super(_0xb845f8);const _0x407079=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x407079);}async init(){const _0x48df2f=this['editor']['plugins']['get'](tt),_0x28bb6c=_0x48df2f['serverHistory'],_0x494ce7=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x28bb6c,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x48df2f['sessionId']});const _0x5ebd8c=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x4b7de2,_0x375849=await _0xb6b90c['isBundleUploaded'](_0x494ce7['connection'],_0x5ebd8c);this['editor']['plugins']['get'](_0x5f0e50)['adapter']={'getRevision':async({revisionId:_0x13ce8c})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x13ce8c)),'updateRevisions':async _0x2df615=>{await this['_waitForServiceReady']();const _0x5736a2=this['_revisionTracker']['currentRevision'];if(_0x375849&&0x1===_0x2df615['length']&&_0x2df615[0x0]['id']===_0x5736a2['id'])return _0x2df615;for(const _0x5bbd27 of _0x2df615)_0x5bbd27['id']===_0x5736a2['id']&&(_0x5bbd27['isEmptyCurrent']=_0x5bbd27['fromVersion']===_0x5bbd27['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x2df615,this['_lastRequestId'])['then'](_0x2ba981=>(this['_lastRequestId']=_0x2ba981,_0x2df615))['catch'](_0xfea5f1=>{if(pt(_0xfea5f1)||'400'===_0xfea5f1['code']&&void 0x0!==_0xfea5f1['data']['wrongRequestId']){for(const _0x509260 of _0x2df615)this['_revisionTracker']['repository']['getRevision'](_0x509260['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x509260['id'],_0x509260,!0x1);if(pt(_0xfea5f1)&&'destroyed'!==this['editor']['state'])throw _0xfea5f1;return _0x2df615;}throw _0xfea5f1;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3ec62a,{revisionsData:_0x5bbd3c,requestId:_0x2d9036})=>{Math['max'](..._0x5bbd3c['map'](_0x4d6952=>_0x4d6952['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x5bbd3c,_0x2d9036);}):this['_handleRevisionsUpdate'](_0x5bbd3c,_0x2d9036);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x494ce7['connection']?.['state']&&(_0x494ce7['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x378450,requestId:_0x2551b0}=await this['_revisionHistoryService']['connect'](_0x494ce7['connection']);_0x494ce7['addToReconnectionStack'](this),this['_lastRequestId']=_0x2551b0,await this['_fetchMissingUsers'](_0x378450);for(const _0x49af90 of _0x378450)this['_revisionTracker']['addRevisionData'](_0x49af90);this['listenTo'](_0x48df2f,'change:_isConnected',(_0x2e9ebd,_0x4d1486,_0x20dca9)=>{_0x20dca9&&(this['_oldOffset']=_0x48df2f['_offset'],_0x2e9ebd['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x40e422=this['editor']['plugins']['get'](z),_0x45f675=this['editor']['plugins']['get'](tt),_0x4e6c53=async()=>{const _0x3b0245=this['_revisionTracker']['currentRevision'],_0x225e6e=_0x3b0245['id'],_0x457f4e=_0x225e6e!==_0x45f675['sessionId'];if(_0x457f4e){const _0xf3b93d=_0x45f675['_offset']-this['_oldOffset'],_0x514de7=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x3b0245['toVersion']+_0xf3b93d!==_0x514de7){const _0xd2b49d=_0x3b0245['fromVersion']+_0xf3b93d,_0x198ff0=this['editor']['plugins']['get'](_0x326fdb),_0x41212f=this['_revisionTracker']['buildRevisionData']({'revision':_0x3b0245,'from':_0xd2b49d,'to':_0x514de7});_0x41212f['id']=_0x3b0245['id'];const _0x13fe1a=_0x41212f['authorsIds']['map'](_0x30fd66=>_0x198ff0['getUser'](_0x30fd66));_0x3b0245['_update']({..._0x41212f,'authors':_0x13fe1a},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x3b0245['id'],_0x41212f,!0x0);}this['_revisionTracker']['_startingVersion']=_0x514de7,_0x3b0245['toVersion']!==_0x3b0245['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x225e6e)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x225e6e),this['_revisionTracker']['_createCurrentRevision'](_0x514de7);}const {revisions:_0x610379,requestId:_0x20494a}=await this['_revisionHistoryService']['reconnect'](_0x40e422['connection'],this['_lastRequestId']);_0x457f4e&&_0x610379['length']>0x0?_0x45f675['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x610379),this['_handleRevisionsUpdate'](_0x610379,_0x20494a),this['_revisionTracker']['sendBufferedUpdates']());};return _0x45f675['_isConnected']?_0x4e6c53():new Promise((_0x560c12,_0x51d756)=>{_0x45f675['once']('change:_isConnected',()=>{_0x4e6c53()['then'](_0x560c12)['catch'](_0x51d756);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x42760f=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x260169=>{_0x260169['off'](),_0x42760f();});});}_getLatestVersionFromServerOperations(){const _0xc49f4b=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x25cced of _0xc49f4b)if('marker'!==_0x25cced['type']||_0x25cced['affectsData'])return _0x25cced['baseVersion']+0x1;}_getLatestVersion(){const _0x488492=this['editor']['plugins']['get'](tt);return new Promise(_0x90d794=>{_0x488492['_isPendingUpdate']?_0x488492['once']('change:_isPendingUpdate',()=>{_0x90d794(this['_getLatestVersionFromServerOperations']());}):_0x90d794(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x421667,_0x20d470){const _0x13b3a2=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x20d470;for(const _0x1f4a22 of _0x421667){const _0xc63e1b=_0x13b3a2['getRevision'](_0x1f4a22['id']);if(_0xc63e1b){if((_0x1f4a22['fromVersion']||_0x1f4a22['toVersion'])&&(_0x1f4a22['diffData']=null),_0xc63e1b===this['_revisionTracker']['currentRevision']){const _0x1b5018=Math['max'](_0xc63e1b['toVersion'],_0x1f4a22['toVersion']),_0xffe728=Math['max'](_0xc63e1b['fromVersion'],_0x1f4a22['fromVersion']);let _0x247944;_0xc63e1b['toVersion']===_0x1f4a22['toVersion']&&_0xc63e1b['fromVersion']===_0x1f4a22['fromVersion']?(_0x247944=!0x0,this['_preventResendingRevisionData'](_0x1f4a22)):_0x1f4a22['toVersion']===_0x1b5018&&_0x1f4a22['fromVersion']===_0xffe728?_0x247944=!0x1:(_0xc63e1b['toVersion']===_0x1b5018&&_0xc63e1b['fromVersion']===_0xffe728||this['_fixRevision']({'revision':_0xc63e1b,'from':_0xffe728,'to':_0x1b5018}),_0x247944=!0x0),_0x247944&&(delete _0x1f4a22['fromVersion'],delete _0x1f4a22['toVersion'],delete _0x1f4a22['diffData'],delete _0x1f4a22['createdAt'],delete _0x1f4a22['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x1f4a22),this['_preventResendingRevisionData'](_0x1f4a22);}else this['_revisionTracker']['addRevisionData'](_0x1f4a22);}const _0x18c4df=_0x13b3a2['getRevisions']();_0x18c4df['reverse']();for(let _0x7a2330=0x0;_0x7a2330<_0x18c4df['length']-0x1;_0x7a2330++){const _0x2cf06a=_0x18c4df[_0x7a2330],_0x3096a=_0x18c4df[_0x7a2330+0x1];if(_0x2cf06a['fromVersion']<_0x3096a['toVersion']){const _0x6cce8f=_0x3096a['toVersion'],_0x5ab973=Math['max'](_0x6cce8f,_0x2cf06a['toVersion']);this['_fixRevision']({'revision':_0x2cf06a,'from':_0x6cce8f,'to':_0x5ab973});}}}['_fixRevision']({revision:_0x3a423d,from:_0x5ad7c1,to:_0x3372bd}={}){const _0x15e1e7=this['editor']['plugins']['get'](_0x326fdb),_0x458e48=this['_revisionTracker']['buildRevisionData']({'revision':_0x3a423d,'from':_0x5ad7c1,'to':_0x3372bd});_0x458e48['authors']=_0x458e48['authorsIds']['map'](_0x1797b8=>_0x15e1e7['getUser'](_0x1797b8)),_0x3a423d['_update'](_0x458e48);}_preventResendingRevisionData(_0x472cd8){const _0xaa09e1={};_0xaa09e1['id']=_0x472cd8['id'];for(const _0x54288f of Object['keys'](_0x472cd8))'id'!==_0x54288f&&(_0xaa09e1[_0x54288f]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0xaa09e1['id'],_0xaa09e1,!0x0);}async _fetchMissingUsers(_0x300b77){const _0x18e48a=this['editor']['plugins']['get'](_0x326fdb),{connection:_0x42262c}=this['editor']['plugins']['get'](z),_0x42968e=new Set();for(const _0x8aad2b of _0x300b77){for(const _0x4d5438 of _0x8aad2b['authorsIds'])_0x4218c3(_0x4d5438);_0x8aad2b['creatorId']&&_0x4218c3(_0x8aad2b['creatorId']);}if(0x0===_0x42968e['size'])return;const _0xf051bb=await _0x198d99['getMany'](_0x42262c,Array['from'](_0x42968e));for(const _0x6026a5 of _0xf051bb)_0x18e48a['getUser'](_0x6026a5['id'])||_0x18e48a['addUser'](_0x6026a5);function _0x4218c3(_0x59db7b){_0x18e48a['getUser'](_0x59db7b)||_0x42968e['add'](_0x59db7b);}}};function pt(_0x2485ab){return _0x2485ab['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2485ab['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2485ab['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x182d58{static get requires(){return[_0x5f0e50,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x4fcb28{_collapseAt;constructor(_0x1ef3e5,_0x316620=0x6){super(_0x1ef3e5);const _0xca0f7=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x316620,this['bind']('isHidden')['to'](this,'usersCount',_0x549f11=>_0x549f11<_0x316620),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0xca0f7['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':_0xca0f7['to']('usersCount',_0x1b7abe=>'+'+(_0x1b7abe-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x4fcb28{items;keystrokes;constructor(_0x1707c4){super(_0x1707c4);const _0x39dfda=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x48672d(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x39dfda['if']('hasPopup'),'aria-expanded':_0x39dfda['to']('isExpanded',_0x75fce0=>this['hasPopup']&&String(_0x75fce0)),'aria-label':_0x39dfda['to']('hasPopup',_0x58925d=>X(_0x1707c4,_0x58925d?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x39dfda['to']('hasPopup',_0x1cb497=>!!_0x1cb497&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x39dfda['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x39dfda['to'](_0x447588=>{const _0x439892=_0x447588,_0x272226=document['querySelector']('.ck-presence-list__dropdown-list'),_0x2be7c1=document['querySelector']('.ck-balloon-panel_with-arrow');_0x272226?.['contains'](_0x439892['relatedTarget'])||_0x2be7c1?.['contains'](_0x439892['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x354d04,_0x3a5e1a,_0x54dd01)=>{this['element']&&(_0x54dd01?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']);}},_t=class extends _0x4fcb28{counterView;inlineListView;constructor(_0x4d75e6,_0x44f8a0=0x6){super(_0x4d75e6);const _0x2cddc8=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x44f8a0),this['inlineListView']=new vt(_0x4d75e6),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x27813d of this['inlineListView']['items'])_0x27813d['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',_0x2cddc8['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x4fcb28{listWrapperView;constructor(_0x46b5f9,_0x3ae42c){super(_0x46b5f9);const _0x362352=this['bindTemplate'];this['listWrapperView']=new bt(_0x46b5f9,_0x3ae42c),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x46b5f9,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x362352['to'](_0x5bd87d=>{const _0x3115a2=_0x5bd87d,_0x3ed2a9=document['querySelector']('.ck-presence-list__list'),_0x2e0419=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3ed2a9?.['contains'](_0x3115a2['relatedTarget'])||_0x2e0419?.['contains'](_0x3115a2['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x4410a0{constructor(_0x75b8f4,_0x573ef3){super(_0x75b8f4);const _0x11daf3=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x573ef3?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x11daf3['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x11daf3['to']('role'),'aria-label':_0x11daf3['to']('ariaLabel'),'aria-labelledby':_0x11daf3['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x415cf5['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x1d4106=this['element'];_0x1d4106&&(this['_isScrollable']=Math['max'](_0x1d4106['scrollHeight'],_0x1d4106['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x2c05db{['userView'];constructor(_0x30d555,_0x565d1b,_0x2fecfc){super(_0x30d555);const _0x5b6fd6=this['bindTemplate'];this['userView']=new _0x4e3739(_0x30d555,_0x565d1b);const _0x41b3c1={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x565d1b['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x565d1b['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x565d1b['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x565d1b['color']['getColorVariable'](),'--ck-user-color-alpha':_0x565d1b['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x2fecfc&&(_0x41b3c1['tag']='button',_0x41b3c1['on']={'click':_0x5b6fd6['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x41b3c1);}['focus'](){this['element']['focus']();}},It=class extends _0x4fcb28{['userView'];['markerView'];constructor(_0x3f4496,_0x3ad6c2,_0xd69b91){super(_0x3f4496);const _0x13aa3d=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x4e3739(_0x3f4496,_0x3ad6c2),this['markerView']=new St(_0x3f4496,_0x3ad6c2);const _0x54c930=new _0x79a609(_0x3f4496);_0x54c930['template']['tag']='span',_0x54c930['text']=_0x3ad6c2['name'];const _0x2e8e70={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x13aa3d['to']('isFocusable',_0x28ad58=>!!_0x28ad58&&0x0),'aria-labelledby':_0x54c930['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x13aa3d['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x13aa3d['to']('hasTooltip',_0x2511c3=>!_0x2511c3),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x54c930]};_0xd69b91&&(_0x2e8e70['tag']='button',_0x2e8e70['on']={'click':_0x13aa3d['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2e8e70);}},St=class extends _0x4fcb28{constructor(_0x3ae204,_0x3aee1d){super(_0x3ae204),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3aee1d['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x3aee1d['color']['getColorVariable'](),'--ck-user-color-alpha':_0x3aee1d['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x5383fe{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5eec6a){super(_0x5eec6a),this['context']['config']['define']('presenceList',Tt);const _0x24afa9=_0x5eec6a['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x24afa9)throw new _0x3793cd('presencelist-collapseat-invalid-format',this);if(_0x24afa9<0x1)throw new _0x3793cd('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x43ba52(),this['balloonPanelView']=new _0x41d86b(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x237b97 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x237b97);this['listenTo'](this['_allConnectedUsers'],'add',(_0x26e96a,_0x27bad7)=>{this['_handleUserAdd'](_0x27bad7);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x7f0bf3,_0x4abe1f)=>{this['_handleUserRemove'](_0x4abe1f);});}_createView(){const _0x3c8016=this['context'],_0x2ee260=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x1181c0=this['balloonPanelView'];if(!_0x4b1f95(_0x3c8016['config']['get']('presenceList.container')))throw new _0x3793cd('presencelist-missing-container',this);return _0x2ee260['counterView']['bind']('usersCount')['to'](this),_0x2ee260['bind']('isCollapsed')['to'](this,'usersCount',_0x440970=>{const {collapseAt:_0x46511f}=_0x3c8016['config']['get']('presenceList'),_0x439ee3=_0x440970>=_0x46511f;if(_0x439ee3&&!_0x2ee260['inlineListView']['items']['find'](_0x4df0f2=>_0x4df0f2 instanceof wt)){const _0x108475=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x108475&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2ee260['inlineListView']['items']['add'](_0x2ee260['counterView']);}return _0x439ee3||this['hideDropdown'](),_0x439ee3;}),_0x2ee260['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x4c4c7d=>{const _0x4e46e8=_0x3c8016['config']['get']('presenceList'),_0x34ed3f=new It(_0x3c8016['locale'],_0x4c4c7d,!!_0x4e46e8['onClick']);return _0x34ed3f['bind']('hasTooltip')['to'](_0x2ee260,'isCollapsed',_0x180e69=>!_0x180e69),_0x34ed3f['bind']('isFocusable')['to'](_0x2ee260,'isCollapsed',_0xae2272=>!_0xae2272),_0x4e46e8['onClick']&&this['listenTo'](_0x34ed3f,'execute',()=>{this['view']['isCollapsed']||_0x4e46e8['onClick'](_0x4c4c7d,_0x34ed3f['element']);}),_0x34ed3f;}),this['listenTo'](_0x2ee260['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x2ee260['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x2ee260['inlineListView']['keystrokes']['set']('Enter',(_0xb47333,_0x6ca41b)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x6ca41b());}),_0x2ee260['render'](),_0x1181c0['render'](),_0x1ef56d({'emitter':_0x2ee260,'activator':()=>_0x1181c0['isVisible'],'contextElements':[_0x1181c0['element'],_0x2ee260['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x3c8016['config']['get']('presenceList.container')['appendChild'](_0x2ee260['element']),this['_bodyCollection']=new _0x2c3ba0(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x2ee260;}['_handleUserAdd'](_0x410b86){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x410b86['isMe'])return;const _0x5455e6=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x5455e6-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x32decc=_0x410b86['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x410b86,_0x32decc);}['_handleUserRemove'](_0x2c349b){this['usersCount']--;const {collapseAt:_0x5174de}=this['context']['config']['get']('presenceList'),_0x1a3737=this['usersCount']>=_0x5174de;if(this['currentDisplayedUsers']['get'](_0x2c349b['id']))this['currentDisplayedUsers']['remove'](_0x2c349b['id']);else{if(_0x1a3737&&this['currentDisplayedUsers']['length']+0x1===_0x5174de-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x1a3737?0x1:0x0)<this['usersCount']){for(const _0x52f80a of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x52f80a['id'])&&(this['currentDisplayedUsers']['add'](_0x52f80a,Math['min'](this['currentDisplayedUsers']['length']-(_0x1a3737?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x1a3737?0x1:0x0)===_0x5174de-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x49f2ba=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x49f2ba['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x293352}=this['presenceDropdownView'];_0x293352['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x113bd4=>{if(!_0x49f2ba['displayMe']&&_0x113bd4['isMe'])return null;const _0xddf5e0=new kt(this['context']['locale'],_0x113bd4,!!_0x49f2ba['onClick']);return _0x49f2ba['onClick']&&this['listenTo'](_0xddf5e0,'execute',()=>{_0x49f2ba['onClick'](_0x113bd4,_0xddf5e0['element']);}),_0xddf5e0;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x293352['focus'](),_0x293352['checkIfScrollable']();const _0x21a4f5=(_0x273153,_0x36e335)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x36e335();};_0x293352['keystrokes']['set']('Esc',_0x21a4f5),_0x293352['keystrokes']['set']('Shift+Tab',_0x21a4f5),_0x293352['keystrokes']['set']('Tab',(_0x237fa0,_0x7eba9f)=>{!function(_0x520690){const _0x327783=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x5e99e7=>_0x5e99e7+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x14c959=[...document['body']['querySelectorAll'](_0x327783)]['filter'](_0x20215b=>_0x20215b===document['activeElement']||_0x20215b['offsetWidth']+_0x20215b['offsetHeight']>0x0)['sort']((_0x2335de,_0x26d4ed)=>(_0x2335de['tabIndex']||0x0)-(_0x26d4ed['tabIndex']||0x0)),_0xbd2cbb=_0x14c959[(_0x14c959['indexOf'](_0x520690)+0x1)%_0x14c959['length']];_0xbd2cbb&&_0xbd2cbb['focus']();}(this['view']['element']),this['hideDropdown'](),_0x7eba9f();}),_0x293352['focusTracker']['add'](this['view']['element']),_0x293352['focusTracker']['on']('change:isFocused',(_0x5aa5b9,_0x254a56,_0x545f8b)=>{_0x545f8b||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);}},At=class extends _0x5383fe{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};
|
|
23
|
+
import{Context as _0x3b8224,ContextPlugin as _0x199983,PendingActions as _0x462aee,Plugin as _0x4dea7b}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x4221a8,Collection as _0xbc07ad,DomEmitterMixin as _0x1e66e0,KeystrokeHandler as _0x1d53f5,global as _0x4e5766,uid as _0x26b330,version as _0x5f039b}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x23dff2,BodyCollection as _0x52cb49,LabelView as _0x3f0acc,ListItemView as _0x3d822f,ListView as _0x2426d0,Notification as _0x509873,View as _0x19ada5,clickOutsideHandler as _0x1ce9fc}from'@ckeditor/ckeditor5-ui';import{History as _0x46d843,InsertOperation as _0x5e3756,MarkerOperation as _0x2d5d99,ModelLiveRange as _0x48dbc3,NoOperation as _0x533353,OperationFactory as _0x25c611,RootAttributeOperation as _0x54eaa8,transformOperationSets as _0x1b9d7f}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x383832}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x4ecff9,CommentsService as _0x8155c2,EditorService as _0x132713,RevisionHistoryService as _0x11ab20,TrackChangesService as _0x462a45,User as _0x5918aa,WEB_SOCKET_GATEWAY_STATES as _0x24ea0b,WebSocketGateway as _0x405022}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x398431,Users as _0xc75193}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x49b5f3}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x19ed4c,TrackChangesEditing as _0x559281}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0xb0d326,CommentsEditing as _0x7afca3,CommentsRepository as _0x5120b7}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x423746}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x139989}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x199983{static WebSocketGateway=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>_0x405022)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x383832,_0x509873];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x91f262){super(_0x91f262),this['set']('state',_0x24ea0b['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x1e66e0())();}init(){const _0xbfbf10=this['context'],_0x1b246f=_0xbfbf10['plugins']['get'](_0x383832),_0x37ed7e=_0xbfbf10['plugins']['get'](_0x509873);if(!_0x1b246f['token'])throw new _0x4221a8('websocketgateway-missing-token',this);if(!_0x1b246f['webSocketUrl'])throw new _0x4221a8('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'](_0x1b246f['token'],_0x1b246f['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x4e0799=>{if(this['connection']=_0x4e0799,this['bind']('state')['to'](_0x4e0799,'state',this,'_isBrowserOffline',(_0x393e16,_0x1d1723)=>('connected'!==_0x393e16&&(this['_shouldPluginsReconnect']=!0x0),_0x1d1723||_0x393e16!==_0x24ea0b['CONNECTED']?_0x24ea0b['DISCONNECTED']:this['state']==_0x24ea0b['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x24ea0b['CONNECTING']):_0x24ea0b['CONNECTED'])),this['connection']['on']('error',(_0x4c785c,_0x15bafc)=>{if('limitExceeded'!==_0x15bafc['code'])throw console['error'](_0x15bafc),new _0x4221a8('cloudservices-init',null,{'originalError':_0x15bafc});_0x37ed7e['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'});}),!_0x4e0799['me'])return new Promise(_0x129ab4=>_0x4e0799['on']('change:me',_0x129ab4));})['catch'](_0x2e7c96=>{throw console['error'](_0x2e7c96),new _0x4221a8('cloudservices-init',null,{'originalError':_0x2e7c96});});}addToReconnectionStack(_0x598e5a){if('function'!=typeof _0x598e5a['reconnect'])throw new _0x4221a8('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x598e5a))throw new _0x4221a8('websocketgateway-plugin-already-registered',this,{'name':_0x598e5a['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x598e5a);}removeFromReconnectionStack(_0x233e89){this['_reconnectionStack']['delete'](_0x233e89);}isInReconnectionStack(_0x47f6b0){return this['_reconnectionStack']['has'](_0x47f6b0);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x20a6ca=>_0x20a6ca['reconnect']())))['then'](()=>this['state']=_0x24ea0b['CONNECTED'])['catch'](_0x1901e0=>{throw console['error'](_0x1901e0),new _0x4221a8('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x24ea0b['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x199983{['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[z,_0xc75193];}constructor(_0x20ee2c){super(_0x20ee2c),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0xbc07ad(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0xc75193);}init(){const _0x4f61cd=this['context']['plugins']['get'](z);this['listenTo'](_0x4f61cd,'change:state',(_0x13f542,_0xe3cc5c,_0x274f8e)=>{if('connected'!==_0x274f8e)this['channelSessions']['forEach'](_0x47e908=>_0x47e908['clear']()),this['channelConnectedUsers']['forEach'](_0x1853c2=>_0x1853c2['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x41e6a0,_0x1dcf0a]of this['_registeredSessions'])for(const _0x2806b3 of _0x1dcf0a)this['_handleSessionAdd'](_0x41e6a0,_0x2806b3);}}),this['_createUser'](_0x4f61cd['connection']['me'],!0x0);}register(_0x36e0a9,_0x55f14d){if(this['_registeredSessions']['has'](_0x36e0a9))throw new _0x4221a8('sessions-register-already-registered',null,{'channelId':_0x36e0a9});this['_registeredSessions']['set'](_0x36e0a9,_0x55f14d),this['channelSessions']['set'](_0x36e0a9,new _0xbc07ad()),this['channelConnectedUsers']['set'](_0x36e0a9,new _0xbc07ad()),this['listenTo'](_0x55f14d,'add',(_0x5e5182,_0x4431c2)=>this['_handleSessionAdd'](_0x36e0a9,_0x4431c2)),this['listenTo'](_0x55f14d,'remove',(_0x57c071,_0x2b89a8)=>this['_handleSessionRemove'](_0x36e0a9,_0x2b89a8));for(const _0x1fed10 of _0x55f14d)this['_handleSessionAdd'](_0x36e0a9,_0x1fed10);}unregister(_0x369f80){if(!this['_registeredSessions']['has'](_0x369f80))throw new _0x4221a8('sessions-unregister-not-exist',null,{'channelId':_0x369f80});const _0x325a55=this['_registeredSessions']['get'](_0x369f80);this['stopListening'](_0x325a55);for(const _0x330df2 of _0x325a55)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x369f80,_0x330df2);this['_registeredSessions']['delete'](_0x369f80),this['channelSessions']['delete'](_0x369f80),this['channelConnectedUsers']['delete'](_0x369f80);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x2f1687){for(const _0x26db68 of this['channelSessions']['values']())for(const _0x5636d0 of _0x26db68)if(_0x5636d0['id']===_0x2f1687)return _0x5636d0['user'];}getUserSessions(_0x43b5a3,_0x45c335){const _0x4d1ced=_0x45c335?[this['channelSessions']['get'](_0x45c335)]:this['channelSessions']['values'](),_0x3744fc=new Set();for(const _0x18bc6e of _0x4d1ced)for(const _0x39dfb1 of _0x18bc6e)_0x39dfb1['user']['id']===_0x43b5a3['id']&&_0x3744fc['add'](_0x39dfb1['id']);return _0x3744fc;}getUserRole(_0x541e65){for(const _0x546536 of this['channelSessions']['values']())for(const _0x2a9ba9 of _0x546536)if(_0x2a9ba9['user']===_0x541e65)return _0x2a9ba9['role'];}['_handleSessionAdd'](_0x1e67be,_0x33abf6){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x250eeb=_0x33abf6['user'],_0x267c97=this['_users']['getUser'](_0x250eeb['id'])||this['_createUser'](_0x250eeb),_0x14a049=Object['assign']({},_0x33abf6,{'user':_0x267c97});if(this['channelSessions']['get'](_0x1e67be)['add'](_0x14a049),!_0x250eeb['hiddenInPresenceList']){const _0x5df07d=this['channelConnectedUsers']['get'](_0x1e67be);_0x5df07d['has'](_0x267c97['id'])||_0x5df07d['add'](_0x267c97),this['allConnectedUsers']['has'](_0x267c97['id'])||_0x250eeb['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x267c97,_0x267c97['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x1e67be,{'channelId':_0x1e67be,'session':_0x14a049});}['_handleSessionRemove'](_0x1181b7,_0x4a2862){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x1f64b1=this['channelConnectedUsers']['get'](_0x1181b7),_0x2e2cb9=_0x4a2862['user'];_0x2e2cb9['id']&&(this['channelSessions']['get'](_0x1181b7)['remove'](_0x4a2862['id']),_0x1f64b1['has'](_0x2e2cb9['id'])&&!this['getUserSessions'](_0x2e2cb9,_0x1181b7)['size']&&_0x1f64b1['remove'](_0x2e2cb9['id']),this['allConnectedUsers']['get'](_0x2e2cb9['id'])&&!this['getUserSessions'](_0x2e2cb9)['size']&&this['allConnectedUsers']['remove'](_0x2e2cb9['id']));}_createUser(_0x468f83,_0x2800d3){const _0x3b79ff=this['_users']['addUser'](_0x468f83);return _0x2800d3&&this['_users']['defineMe'](_0x468f83['id']),_0x3b79ff['orderNumber']=this['_uniqueUsersCount']++,_0x3b79ff;}},K=class extends _0x4dea7b{_domEmitter=new(_0x1e66e0())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x312b4c=this['editor'],_0x501d19=_0x312b4c['plugins']['get'](Y);_0x312b4c['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x543a8e,{writer:_0x51c9f7})=>function(_0x39388b,_0x150b2f,_0x7c28db,_0x181c97){const _0x51b754=_0x39388b['markerName']['split'](':')[0x2],_0x2373f0=_0x7c28db['getUserBySessionId'](_0x51b754);if(!_0x2373f0||_0x51b754===_0x7c28db['mySessionId'])return;if(!_0x181c97['model']['schema']['checkChild'](_0x39388b['markerRange']['start'],'$text'))return;const _0x255a50={'class':'ck-user__marker\x20'+_0x2373f0['color']['getMarkerClass'](),'style':Q(_0x2373f0),'data-name':_0x2373f0['name'],'data-session-id':_0x51b754},_0xb9bb35=_0x181c97['model']['markers']['get'](_0x39388b['markerName'])['getStart'](),_0x50d5e7=_0xb9bb35['nodeAfter'],_0x4b684a=_0x181c97['model']['schema'];if(_0x50d5e7&&_0x4b684a['isObject'](_0x50d5e7)&&_0x4b684a['isInline'](_0x50d5e7)&&!_0x181c97['model']['markers']['get']('user:range:'+_0x51b754)['getRange']()['isCollapsed'])return;const _0x597501=_0xb9bb35['parent'];return _0x181c97['model']['schema']['isLimit'](_0x597501)&&!_0x181c97['model']['hasContent'](_0x597501)&&(_0x255a50['contenteditable']=!0x1),function(_0x53c634,_0x27e488,_0x5a5300){const _0x200d51=_0x53c634['createUIElement']('span',_0x27e488);return _0x53c634['setCustomProperty']('userPositionMarker',!0x0,_0x200d51),_0x200d51['render']=function(_0x3eed8c){const _0x5dbb4a=this['toDomElement'](_0x3eed8c),_0x473dd=document['createElement']('span');return _0x473dd['classList']['add']('ck-user__marker-tooltip'),_0x473dd['setAttribute']('contenteditable','false'),_0x473dd['setAttribute']('spellcheck','false'),_0x473dd['textContent']=_0x5a5300['name'],_0x5dbb4a['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x473dd['outerHTML']+'',_0x5dbb4a['addEventListener']('mouseenter',()=>{_0x5dbb4a['classList']['add']('ck-user__marker_hovered');}),_0x5dbb4a['addEventListener']('mouseleave',()=>{_0x5dbb4a['classList']['remove']('ck-user__marker_hovered');}),_0x5dbb4a;},_0x200d51['isSimilar']=function(_0x2b6a1d){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2b6a1d['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2b6a1d['getAttribute']('data-session-id'));},_0x200d51;}(_0x150b2f,_0x255a50,_0x2373f0);}(_0x543a8e,_0x51c9f7,_0x501d19,_0x312b4c)}),_0x312b4c['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x56c9b0=>function(_0x4b9e57,_0x36496b){const _0x6d1362=_0x4b9e57['markerName']['split'](':')[0x2];if(_0x6d1362===_0x36496b['mySessionId'])return null;const _0x2513b6=_0x36496b['getUserBySessionId'](_0x6d1362);return _0x2513b6?{'id':_0x6d1362,'classes':['ck-user__selection',_0x2513b6['color']['getSelectionClass']()],'attributes':{'style':Q(_0x2513b6),'data-session-id':_0x6d1362},'priority':0x7d0+_0x2513b6['orderNumber']}:{'id':_0x6d1362,'classes':[]};}(_0x56c9b0,_0x501d19)}),function(_0x45cf0e){const _0x33aae4=_0x45cf0e['model'],_0x4db5cf=new Map(),_0x3b8c4a=_0x45cf0e['plugins']['get'](Y);_0x33aae4['markers']['on']('update:user:range',(_0x374829,_0x49d9e5,_0x37cb36,_0xfde76b)=>{if(!_0xfde76b&&_0x4db5cf['get'](_0x49d9e5['name']))return _0x4db5cf['get'](_0x49d9e5['name'])['detach'](),void _0x4db5cf['delete'](_0x49d9e5['name']);const _0x13bbe9=_0x49d9e5['name']['split'](':')[0x2];if(_0x13bbe9===_0x3b8c4a['mySessionId'])return;const _0x1f9f56='user:position:'+_0x13bbe9;_0x33aae4['markers']['has'](_0x1f9f56)&&_0x45cf0e['editing']['reconvertMarker'](_0x1f9f56),_0x49d9e5['on']('change:range',(_0x40ad0c,_0x2b1247,_0x5ab008)=>{if('$graveyard'!=_0x2b1247['root']['rootName']&&'$graveyard'==_0x49d9e5['getRange']()['root']['rootName']&&!_0x4db5cf['has'](_0x49d9e5['name'])){const _0x3f23da=_0x33aae4['schema']['getNearestSelectionRange'](_0x5ab008['deletionPosition']);if(_0x3f23da){const _0x19a13a=_0x48dbc3['fromRange'](_0x3f23da);_0x4db5cf['set'](_0x49d9e5['name'],_0x19a13a),_0x19a13a['on']('change:range',(_0x288481,_0x3d7f34,_0x2f4abf)=>{if('$graveyard'==_0x19a13a['root']['rootName']){const _0x2c461e=_0x33aae4['schema']['getNearestSelectionRange'](_0x2f4abf['deletionPosition']);_0x2c461e?(_0x19a13a['start']=_0x2c461e['start'],_0x19a13a['end']=_0x2c461e['end']):(_0x4db5cf['delete'](_0x49d9e5['name']),_0x19a13a['detach']());}});}}});}),_0x33aae4['document']['on']('change',()=>{_0x4db5cf['size']>0x0&&_0x33aae4['enqueueChange']({'isUndoable':!0x1},_0x1a4bf6=>{for(const [_0x4b1d02,_0x254361]of _0x4db5cf)'$graveyard'==_0x33aae4['markers']['get'](_0x4b1d02)['getRange']()['root']['rootName']&&(J(_0x4b1d02['split'](':')[0x2],_0x254361['toRange'](),_0x33aae4,_0x1a4bf6),_0x254361['detach']());_0x4db5cf['clear']();});});}(_0x312b4c),this['_domEmitter']['listenTo'](_0x4e5766['document'],'keydown',(_0x3e219f,{key:_0x42a9be})=>{'Escape'===_0x42a9be&&function(_0x3d892a){_0x3d892a['editing']['view']['change'](_0x92a995=>{for(const _0xae81a5 of _0x3d892a['model']['markers']){if(!_0xae81a5['name']['startsWith']('user:position'))continue;const _0x1b4568=_0x3d892a['editing']['mapper']['markerNameToElements'](_0xae81a5['name']);if(_0x1b4568){for(const _0x48746c of _0x1b4568)_0x92a995['removeClass']('ck-user__marker_hovered',_0x48746c);}}});}(_0x312b4c);},{'useCapture':!0x0});}afterInit(){const _0x2055bf=this['editor'],_0x35fcb8=_0x2055bf['commands']['get']('undo');_0x35fcb8&&_0x2055bf['model']['on']('applyOperation',(_0x528b34,_0x1c3651)=>{const _0x1c4d4d=_0x1c3651[0x0];if(!_0x1c4d4d['isDocumentOperation'])return;if('marker'!=_0x1c4d4d['type']||!_0x1c4d4d['name']['startsWith']('user:'))return;const _0x5a89bb=_0x1c4d4d['batch'];_0x35fcb8['_createdBatches']['has'](_0x5a89bb)&&(_0x1c4d4d['newRange']=_0x1c4d4d['oldRange']?_0x2055bf['model']['createRange'](_0x1c4d4d['oldRange']['start'],_0x1c4d4d['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x366ea8=this['editor'],_0x59c957=_0x366ea8['model']['document'],_0x3bee22=_0x366ea8['plugins']['get'](Y);_0x366ea8['model']['enqueueChange']({'isUndoable':!0x1},_0x9d3bab=>{const _0xc129cd='user:range:'+_0x3bee22['mySessionId'],_0x34a22d='user:position:'+_0x3bee22['mySessionId'],_0xd526e1=_0x366ea8['model']['markers']['has'](_0xc129cd);_0x366ea8['editing']['view']['hasDomSelection']?J(_0x3bee22['mySessionId'],_0x59c957['selection']['getFirstRange'](),_0x366ea8['model'],_0x9d3bab):_0xd526e1&&(_0x9d3bab['removeMarker'](_0xc129cd),_0x9d3bab['removeMarker'](_0x34a22d));});}};function J(_0x21b4c9,_0x2176bb,_0x54ef81,_0x5aa546){const _0x1c52fb='user:range:'+_0x21b4c9,_0x4e857b='user:position:'+_0x21b4c9,_0x1a0d3f=_0x2176bb['getContainedElement']();let _0x491196=_0x2176bb['start'];if(_0x1a0d3f&&_0x1a0d3f['is']('element','tableCell')){const _0x4dc3b4=function(_0x2753cc,_0x4feaf0){for(const _0x297507 of _0x2753cc['getPositions']())if(_0x4feaf0['schema']['checkChild'](_0x297507,'$text'))return _0x297507;}(_0x2176bb,_0x54ef81);_0x4dc3b4&&(_0x491196=_0x4dc3b4,_0x2176bb=_0x5aa546['createRange'](_0x491196));}const _0x20f17b=_0x5aa546['createRange'](_0x491196);_0x54ef81['markers']['has'](_0x1c52fb)?(_0x5aa546['updateMarker'](_0x1c52fb,{'range':_0x2176bb}),_0x5aa546['updateMarker'](_0x4e857b,{'range':_0x20f17b})):(_0x5aa546['addMarker'](_0x1c52fb,{'range':_0x2176bb,'usingOperation':!0x0}),_0x5aa546['addMarker'](_0x4e857b,{'range':_0x20f17b,'usingOperation':!0x0}));}function Q(_0x4e46f7){return'--ck-user-color:'+_0x4e46f7['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x4e46f7['color']['getColorAlphaVariable']()+';';}function X(_0x8b869e,_0x4b7ec3,_0x940cea){const _0x540ee8=_0x8b869e['t'],t=_0x8b869e['t'];switch(_0x4b7ec3){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 _0x540ee8({'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'},_0x940cea);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x4dea7b{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x4ecff9)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x462aee,_0xc75193,_0x509873];}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 _0x5dc317=this['serverHistory']['getOperations']();for(let _0x1425b1=_0x5dc317['length']-0x1;_0x1425b1>=0x0;_0x1425b1--){const _0x1b1e5d=_0x5dc317[_0x1425b1];if(!this['_disconnectionOperations']['has'](_0x1b1e5d))return _0x1b1e5d['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0xb8950c){if(super(_0xb8950c),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x46d843(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x4221a8('collaboration-missing-channelid',this);const _0x55d56c=_0xb8950c['config']['get']('cloudServices.bundleVersion')||_0x5f039b;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x55d56c,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x49b5f3(),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 it(this['_disconnectionOperations']);}init(){const _0x5e5ab5=this['editor'],_0x814d29=_0x5e5ab5['plugins']['get'](_0xc75193),_0x103dd9=_0x5e5ab5['plugins']['get'](z);this['listenTo'](_0x814d29,'getOperationAuthor',(_0x4d1ff8,_0x5d0306)=>{const _0x3aeee6=_0x5d0306[0x0];_0x3aeee6['_authorId']&&(_0x4d1ff8['return']=_0x814d29['getUser'](_0x3aeee6['_authorId']),_0x4d1ff8['stop']()),null===_0x3aeee6['_authorId']&&(_0x4d1ff8['return']=null,_0x4d1ff8['stop']());},{'priority':'high'}),this['listenTo'](_0x5e5ab5['model']['document']['selection'],'change:range',(_0x37af6c,_0x8555d4)=>{_0x8555d4['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x5e5ab5['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x5e5ab5['model']['on']('applyOperation',(_0xa11fb4,_0x4c60dd)=>{const _0x30a079=_0x4c60dd[0x0];_0x30a079['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x30a079),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x103dd9,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x5a7dcf,_0x60c6e6,_0x38a418)=>'connected'===_0x5a7dcf&&!_0x60c6e6&&!_0x38a418),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x5e5ab5['disableReadOnlyMode']('rtc-offline'):_0x5e5ab5['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x5e5ab5['disableReadOnlyMode']('rtc-offline'):_0x5e5ab5['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x492837=this['editor']['plugins']['get'](Y),_0x1d3506=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x492837['unregister'](this['_channelId']);const _0x1c6fc8=await this['_service']['reconnect'](_0x1d3506['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1c6fc8)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x37dd2e=await this['_service']['getConnectedSessions']();_0x492837['register'](this['_channelId'],_0x37dd2e),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4992de){if(function(_0x55899f){return'404'===_0x55899f['code'];}(_0x4992de)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4afdf5){return'409'===_0x4afdf5['code'];}(_0x4992de)){const _0x2545a0=X(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'](_0x2545a0);}else{if(!(_0x4992de instanceof et))throw _0x4992de;this['_handleReconnectionError']();}}}}destroy(){const _0x39b42d=this['editor']['plugins']['get'](z),_0x5a1f40=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x5a1f40['channelSessions']['has'](this['_channelId'])&&_0x5a1f40['unregister'](this['_channelId']),_0x39b42d['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x3e61a9){if(this['sessionId']!==_0x3e61a9['sessionId']&&this['_lastSyncedOperationId']!==_0x3e61a9['lastOperationId'])throw new et();return this['sessionId']=_0x3e61a9['sessionId'],this['_handleServerResponse']([],{..._0x3e61a9,'wereChangesApplied':!0x1,'data':_0x3e61a9['data']},'reconnect');}async _connectService(_0x5c47da,_0x3223cc=!0x1){const {connection:_0x3f7278}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x3f7278,this['_channelId'])['then'](_0x316a96=>this['_initSessionsHandling'](_0x316a96))['catch'](_0x2a3375=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x2a3375);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x334517,_0x8c8059)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x8c8059);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x59c094=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x5c47da);this['_isPendingUpdate']=!0x0;const _0x12ee90=await this['_service']['connect'](_0x3f7278,this['_compressOperations'](_0x5c47da),_0x59c094);if(this['sessionId']=_0x12ee90['sessionId'],_0x3223cc){if(!_0x12ee90['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x12ee90['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x5c47da,_0x12ee90,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x12ee90,_0x5c47da);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x5b1c85=this['editor']['plugins']['get'](Y),_0x33c711=this['editor']['plugins']['get'](K),_0x447994=_0x5b1c85['channelSessions']['get'](this['_channelId']);_0x447994&&_0x447994['length']>0x1?_0x33c711['createUserMarkerOperations']():this['listenTo'](_0x5b1c85,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x5b1c85['channelSessions']['get'](this['_channelId'])['length']&&_0x33c711['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x354c53,_0x4885e6,_0xefe1fd,_0x5c6298){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x4885e6){const _0x1003d5=this['_decompressOperations'](_0xefe1fd,_0x5c6298);await this['_fetchMissingUsers'](_0x1003d5),this['_handleExternalOperations'](_0x1003d5,_0x4885e6,_0xefe1fd['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x11d2b7}=this['editor'];let _0xb5db62;try{_0xb5db62=await this['_service']['getDocumentDetails']();}catch{const _0x4578a7=X(_0x11d2b7,'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'](_0x4578a7);}const _0x20c034=_0xb5db62['currentDocumentSession']||_0xb5db62['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x20c034['lastOperationId']){const _0x14344a=X(_0x11d2b7,'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'](_0x14344a);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0xe87616=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0xe87616['connection']||'connected'!==_0xe87616['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x59a739=this['editor']['plugins']['get'](Y);_0x59a739['channelSessions']['has'](this['_channelId'])&&_0x59a739['unregister'](this['_channelId']),_0xe87616['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x1cd64c){const _0xdb8ef=this['editor']['plugins']['get'](Y);this['listenTo'](_0xdb8ef,'sessionAdd:'+this['_channelId'],(_0x41ec7c,{session:_0x24e02f})=>{if(_0x24e02f['id']===_0xdb8ef['mySessionId']){_0x41ec7c['off']();const _0x1d5974=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0xafe74a=_0x24e02f['permissions'];_0x1d5974&&_0x1d5974['isEnabled']&&(_0xafe74a=_0xafe74a['filter'](_0x467ef8=>'document:write'!==_0x467ef8)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0xafe74a,this['_channelId']);}}),_0xdb8ef['register'](this['_channelId'],_0x1cd64c);}_initThrowingOnDataSet(){const _0x4022ac=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x2b304f)=>{if(!_0x2b304f[_0x2b304f['length']-0x1]['suppressErrorInCollaboration'])throw new _0x4221a8('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x4022ac['apply'](this['editor']['data'],_0x2b304f);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x472911,[_0x51ec92])=>{if(this['_document']['version'])throw new _0x4221a8('realtimecollaborationclient-init-document-already-initialized',this);_0x472911['stop'](),this['_setPendingAction']();const _0x272532=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x3ebbf9])=>!_0x3ebbf9['lazyLoad'])['map'](([_0x56a928,_0x4369af])=>[_0x56a928,_0x4369af['modelAttributes']||{}])),_0x26f45b=this['_getOperationsFromInitData'](_0x51ec92,_0x272532);0x0==_0x26f45b['length']&&_0x26f45b['push'](new _0x533353(0x0)),_0x472911['return']=this['_connectService'](_0x26f45b)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1c68f5=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1c68f5))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x112dda,[_0x9f5bb7,_0x7bb6fc])=>{_0x112dda['stop']();const _0x2b4ed4=this['editor']['model']['document']['getRoot'](_0x9f5bb7);if(!this['_knownRootNames']['has'](_0x9f5bb7)){const _0x428c41=_0x7bb6fc&&_0x7bb6fc['data']?_0x7bb6fc['data']:'',_0x4558aa=_0x7bb6fc&&_0x7bb6fc['attributes']?_0x7bb6fc['attributes']:{};await this['_loadRoot'](_0x9f5bb7,_0x428c41,_0x4558aa);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x2b4ed4['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x2b4ed4);});},{'priority':'high'});}async _fetchMissingUsers(_0x541205){const _0x1b339a=this['editor']['plugins']['get'](_0xc75193),{connection:_0x1eab6f}=this['editor']['plugins']['get'](z),_0x403987=new Set();for(const _0x4f4ca9 of _0x541205){const _0x561173=_0x4f4ca9['_authorId'];_0x561173&&!_0x1b339a['getUser'](_0x561173)&&_0x403987['add'](_0x561173);}if(0x0===_0x403987['size'])return;const _0x1dd27b=await _0x5918aa['getMany'](_0x1eab6f,Array['from'](_0x403987));for(const _0x2b3fef of _0x1dd27b)_0x1b339a['getUser'](_0x2b3fef['id'])||_0x1b339a['addUser'](_0x2b3fef);}_getOperationsFromInitData(_0x8f6dbc,_0x4c725c={}){const _0x4334e8=this['editor']['model'],_0x100176=[];let _0x10459c=0x0;const _0x13be34='string'==typeof _0x8f6dbc?{'main':_0x8f6dbc}:_0x8f6dbc;for(const _0x5aee64 of Object['keys'](_0x13be34)){if(!this['_document']['roots']['has'](_0x5aee64))throw new _0x4221a8('realtimecollaborationclient-init-non-existent-root',this);const _0x1a0e8d=this['_document']['getRoot'](_0x5aee64),_0x4ee5db=this['editor']['data']['parse'](_0x13be34[_0x5aee64],_0x1a0e8d),_0x595ae3=new _0x5e3756(_0x4334e8['createPositionAt'](_0x1a0e8d,0x0),_0x4ee5db,_0x10459c++);_0x100176['push'](_0x595ae3);for(const [_0x50022c,_0x32b8c3]of _0x4ee5db['markers']){const _0x3aaf97=_0x4334e8['createRange'](_0x4334e8['createPositionFromPath'](_0x1a0e8d,_0x32b8c3['start']['path']['slice']()),_0x4334e8['createPositionFromPath'](_0x1a0e8d,_0x32b8c3['end']['path']['slice']())),_0x433224=new _0x2d5d99(_0x50022c,null,_0x3aaf97,_0x4334e8['markers'],!0x0,_0x10459c++);_0x100176['push'](_0x433224);}}if(_0x4c725c)for(const [_0x49b2c7,_0x1e0747]of Object['entries'](_0x4c725c)){const _0x257e21=_0x4334e8['document']['getRoot'](_0x49b2c7);if(!_0x257e21)throw new _0x4221a8('multi-root-editor-root-attributes-no-root',null);for(const [_0x46f2ef,_0x59b90c]of Object['entries'](_0x1e0747))if(null!==_0x59b90c){const _0xec4480=new _0x54eaa8(_0x257e21,_0x46f2ef,null,_0x59b90c,_0x10459c++);_0x100176['push'](_0xec4480);}}return _0x100176;}async _loadRoot(_0x289ca1,_0x58c434,_0x20980c){this['_getOperationsFromInitData']({[_0x289ca1]:_0x58c434},{[_0x289ca1]:_0x20980c})['forEach']((_0x460d28,_0x2dfdac)=>{_0x460d28['baseVersion']=this['_document']['version']+_0x2dfdac,_0x460d28['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x460d28);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x539952,_0x7507bc){let _0x74ffb3;this['_offset']=_0x539952['offset'];const _0x201973=_0x539952['wereChangesApplied']&&!_0x539952['initData'],_0x4b631e=_0x201973?0x0:_0x539952['data']['baseVersion'];if(_0x7507bc['forEach'](_0x4ae361=>{_0x4ae361['_isInit']=!0x0,_0x4ae361['createdAt']=_0x539952['sessionCreatedAt'],_0x4ae361['_authorId']=null;}),_0x201973)_0x74ffb3=_0x7507bc,this['_applyOperationsSet'](_0x74ffb3,_0x201973);else{if(_0x539952['initData']){const _0x3a1100=this['_getOperationsFromInitData'](_0x539952['initData']);this['_document']['history']['version']=-_0x3a1100['length'],_0x3a1100['forEach'](_0x2f928f=>{_0x2f928f['baseVersion']-=_0x3a1100['length'],_0x2f928f['createdAt']=_0x539952['sessionCreatedAt'],_0x2f928f['_isInit']=!0x0,_0x2f928f['_authorId']=null;}),this['_applyOperationsSet'](_0x3a1100,!0x0),this['serverHistory']['version']=-_0x3a1100['length']+this['_offset'],this['_updateServerHistory'](_0x3a1100);}this['_document']['history']['version']=_0x4b631e,_0x74ffb3=this['_decompressOperations'](_0x539952['data'],_0x539952['metadata']),await this['_fetchMissingUsers'](_0x74ffb3),this['_applyOperationsSet'](_0x74ffb3,_0x201973);}_0x539952['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x74ffb3,_0x539952['lastOperationId']),this['_lastSyncedOperationId']=_0x539952['lastOperationId']),this['serverHistory']['version']=_0x4b631e+this['_offset'],this['_updateServerHistory'](_0x74ffb3),_0x7507bc['filter'](_0x225e6d=>{const _0x13b4ad=this['_getAffectedRoot'](_0x225e6d);return _0x13b4ad&&!this['_knownRootNames']['has'](_0x13b4ad);})['forEach']((_0x479819,_0x19a5c8)=>{_0x479819['baseVersion']=this['_document']['version']+_0x19a5c8,this['_saveOperationInBuffer'](_0x479819);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x4e6d5a,_0x20c8b7){const _0x4a809e=_0x20c8b7&&_0x20c8b7['message'];if(_0x4a809e&&_0x4a809e['startsWith']('realtimecollaborationclient'))throw _0x20c8b7;const _0x3cd6a8=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x3cd6a8['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x4221a8(_0x4e6d5a,this['editor'],_0x4a809e?{'originalError':_0x4a809e}:void 0x0);}_saveOperationInBuffer(_0x479c06){this['_knownOperations']['has'](_0x479c06)||(this['_knownOperations']['add'](_0x479c06),this['_bufferedOperations']['push'](_0x479c06),this['_pendingAction']||'marker'==_0x479c06['type']&&!_0x479c06['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x2ac7b1=!0x1){!_0x2ac7b1&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x8e120e=>{_0x8e120e&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0xcd1227=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x5bffde){return _0x5bffde['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5bffde['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x5bffde['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0xcd1227)||this['_crash'](_0xcd1227['message'],_0xcd1227);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x28b96e=>{this['on']('change:_isPendingUpdate',()=>{_0x28b96e();});});}async _sendBufferedOperations(){const _0x39300e=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x39300e['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x1dabe2=[...this['_bufferedOperations']];for(const _0x26932e of _0x1dabe2)_0x26932e['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x26932e);const _0x1cac95=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1dabe2),_0xe5586e=Z++,_0x1b9646=this['_compressOperations'](_0x1dabe2),_0x33f5a6=await this['_service']['sendOperations'](_0x1b9646,_0x1b9646['baseVersion'],_0x1cac95);try{return await this['_handleServerResponse'](_0x1dabe2,_0x33f5a6,_0xe5586e);}catch(_0xbd8028){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0xbd8028);}}async['_handleServerResponse'](_0x31baf5,_0x3dff06,_0x190818){if('error'in _0x3dff06)throw _0x3dff06['error'];let _0x1167e6;if(_0x3dff06['wereChangesApplied']){_0x3dff06['lastOperationId']&&(this['_lastSyncedOperationId']=_0x3dff06['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x57f2d3=>!_0x31baf5['includes'](_0x57f2d3));for(const _0x2397fd of _0x31baf5)_0x2397fd['createdAt']='lastOperationAcceptedAt'in _0x3dff06&&_0x3dff06['lastOperationAcceptedAt']||void 0x0;st(_0x31baf5,_0x3dff06['version']-_0x31baf5['length']),this['_updateServerHistory'](_0x31baf5);const _0x35ddc9=_0x31baf5['filter'](_0x2b652e=>{if(!_0x2b652e['_isInit'])return!0x1;const _0x40472d=this['_getAffectedRoot'](_0x2b652e);return _0x40472d&&!this['_knownRootNames']['has'](_0x40472d);});st(_0x35ddc9,this['_document']['version']),this['_applyOperationsSet'](_0x35ddc9),_0x1167e6=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1b57f7=this['_decompressOperations'](_0x3dff06['data'],_0x3dff06['metadata'])['filter'](_0x2732cd=>_0x2732cd['baseVersion']>=this['_lastServerVersion']);_0x1b57f7['forEach'](_0x6af32b=>this['_addKnownRoot'](_0x6af32b)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1232ce=>!_0x1232ce['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x1232ce))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1b57f7),_0x1167e6=this['_handleExternalOperations'](_0x1b57f7,_0x3dff06['version'],_0x3dff06['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1167e6?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x2af192,_0x3292e1,_0x1e3b6d){try{const _0x119f36={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x277758,operationsB:_0x2911a7,originalOperations:_0x25e70e}=_0x1b9d7f(_0x2af192,this['_bufferedOperations'],_0x119f36);st(_0x277758,this['_document']['version']),st(_0x2911a7,_0x3292e1);for(const _0xa44f29 of _0x277758){const _0x4944b7=_0x25e70e['get'](_0xa44f29);_0x4944b7?(_0xa44f29['_authorId']=_0x4944b7['_authorId'],'noop'!==_0xa44f29['type']&&(_0xa44f29['_aiSource']=_0x4944b7['_aiSource'])):_0xa44f29['_authorId']=null;}for(const _0x357d07 of _0x2911a7)'noop'!==_0x357d07['type']&&(_0x357d07['_aiSource']=_0x25e70e['get'](_0x357d07)?.['_aiSource']);_0x1e3b6d&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2af192,_0x1e3b6d),this['_lastSyncedOperationId']=_0x1e3b6d),this['_bufferedOperations']=[..._0x2911a7],this['_applyOperationsSet'](_0x277758),this['_updateServerHistory'](_0x2af192);}catch(_0xc4e257){return console['error'](_0xc4e257),!0x1;}return!0x0;}_applyOperationsSet(_0x3975c5,_0x356e50=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1926c1=>{for(const _0x5ebbf0 of _0x3975c5)this['_knownOperations']['add'](_0x5ebbf0),this['_addKnownRoot'](_0x5ebbf0),_0x1926c1['batch']['addOperation'](_0x5ebbf0),this['editor']['model']['applyOperation'](_0x5ebbf0);});}_addKnownRoot(_0x5f278f){const _0x130666=this['_getAffectedRoot'](_0x5f278f);_0x130666&&this['_knownRootNames']['add'](_0x130666);}_getAffectedRoot(_0x3efadd){let _0x49309e,_0x5d7340;switch(_0x3efadd['type']){case'insert':_0x49309e=_0x3efadd['position']['root'];break;case'marker':if(_0x5d7340=_0x3efadd['newRange'],!_0x5d7340)return null;_0x49309e=_0x5d7340['root'];break;case'addRootAttribute':_0x49309e=_0x3efadd['root'];break;case'addRoot':_0x49309e=_0x3efadd['affectedSelectable'];break;case'move':_0x49309e=_0x3efadd['targetPosition']['root'];break;default:return null;}return _0x49309e['rootName'];}_updateServerHistory(_0x750aab){_0x750aab['forEach'](_0x4ea965=>{const _0x471250=_0x4ea965['clone']();_0x471250['_authorId']=_0x4ea965['_authorId'],_0x471250['_isInit']=!!_0x4ea965['_isInit'],_0x471250['_aiSource']=_0x4ea965['_aiSource'],_0x471250['createdAt']=_0x4ea965['createdAt'],_0x471250['baseVersion']+=this['_offset'],_0x4ea965['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x471250),this['serverHistory']['addOperation'](_0x471250);});}_handleReconnectionError(_0x1e8b99){const _0x5d1600=this['editor']['plugins']['get']('Notification'),_0x1d0681=this['editor']['locale'];_0x1e8b99||(_0x1e8b99=X(_0x1d0681,'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.')),_0x5d1600['showWarning'](_0x1e8b99,{'title':X(_0x1d0681,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x462aee)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x462aee)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x188206){const _0x3500a7=_0x188206['map'](_0x48e1b4=>_0x48e1b4['toJSON']());return this['_compressor']['compress'](_0x3500a7);}_decompressOperations(_0x45dc54,_0x5714dd){return this['_compressor']['decompress'](_0x45dc54)['map']((_0x2a0b54,_0x2ae9ea)=>{const _0x2582db='init'==_0x5714dd[_0x2ae9ea]['type'];if('InsertOperation'==_0x2a0b54['__className']){const _0x56f2dd=_0x2a0b54['position']['root'];!this['_document']['getRoot'](_0x56f2dd)&&(this['_document']['createRoot']('$unknown',_0x56f2dd)['_isAttached']=!0x1);}else{if('RootOperation'==_0x2a0b54['__className']){const _0x12851b=this['_document']['getRoot'](_0x2a0b54['rootName']);_0x12851b&&'$unknown'==_0x12851b['name']&&_0x2a0b54['elementName']!=_0x12851b['name']&&(_0x12851b['name']=_0x2a0b54['elementName']);}}const _0x1684f5=_0x25c611['fromJSON'](_0x2a0b54,this['_document']);return _0x1684f5['wasUndone']=_0x2a0b54['wasUndone'],_0x1684f5['_isInit']=_0x2582db,_0x1684f5['_authorId']=_0x2582db?null:_0x5714dd[_0x2ae9ea]['userId'],_0x1684f5['_isDisconnection']='cs:removeUser'===_0x5714dd[_0x2ae9ea]['type'],_0x1684f5['_aiSource']=_0x2a0b54['_aiSource']||void 0x0,_0x1684f5['createdAt']=_0x5714dd[_0x2ae9ea]['createdAt'],_0x1684f5;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x1646cd=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x1646cd&&_0x1646cd['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x181f77,_0x2759fd){for(const _0x26267f of _0x181f77)_0x26267f['baseVersion']=_0x2759fd++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x26b926){this['_ignoredOperations']=_0x26b926,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x1fc0c0){let _0x29cb2e=_0x1fc0c0['length'];for(;_0x29cb2e--;){const _0x160cab=_0x1fc0c0[_0x29cb2e];if(!this['_ignoredOperations']['has'](_0x160cab)){if(!this['_operationToId']['has'](_0x160cab)){const _0x1dcca9=_0x26b330()['slice'](0x1,0x12);this['_operationToId']['set'](_0x160cab,_0x1dcca9);}return this['_operationToId']['get'](_0x160cab);}}}setIdForTheLastOperation(_0x37fea8,_0x137f40){if(!_0x137f40)return;let _0x15972c=_0x37fea8['length'];for(;_0x15972c--;){const _0x4e8139=_0x37fea8[_0x15972c];this['_ignoredOperations']['has'](_0x4e8139)||this['_operationToId']['set'](_0x4e8139,_0x137f40);}}},nt=class extends _0x4dea7b{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x199983{static CommentsService=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x8155c2)());['_services'];static get requires(){return[z,_0x5120b7,Y,_0xc75193];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2c3f71){super(_0x2c3f71),this['_services']=new Map();}async init(){const _0x18a22a=this['context'],_0x4c71e6=_0x18a22a['plugins']['get'](_0x5120b7);if(_0x18a22a['plugins']['get'](z)['addToReconnectionStack'](this),_0x4c71e6['adapter']={'addCommentThread':async({channelId:_0x252f40,threadId:_0x2838a3,comments:_0x5de31f,resolvedAt:_0x1cc075,resolvedBy:_0x3aa7c2,context:_0x1739fe,attributes:_0x389bac})=>{const _0x380466=await this['_getService'](_0x252f40)['addCommentThread']({'commentThreadId':_0x2838a3,'comments':_0x5de31f['map'](_0x212fbc=>function(_0x2bad31,_0x2aabfd,_0x408466){return{'commentThreadId':_0x408466,'commentId':_0x2bad31['commentId'],'userId':_0x2bad31['authorId'],'content':_0x2bad31['content'],'documentId':_0x2aabfd,'createdAt':_0x2bad31['createdAt'],'attributes':_0x2bad31['attributes']||{}};}(_0x212fbc,_0x252f40,_0x2838a3)),'resolvedAt':_0x1cc075,'resolvedBy':_0x3aa7c2,'context':_0x1739fe,'attributes':_0x389bac})['catch'](ct);return{'threadId':_0x380466['commentThreadId'],'comments':_0x380466['comments']};},'getCommentThread':async({channelId:_0x437cf8,threadId:_0x2a9fe1})=>{const _0x280bd2=await this['_getService'](_0x437cf8)['getCommentThread'](_0x2a9fe1)['catch'](rt)['catch'](ct);return _0x280bd2?_0x280bd2['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x280bd2]),{'threadId':_0x280bd2['commentThreadId'],'comments':_0x280bd2['comments']['map'](at),'context':_0x280bd2['context'],'resolvedAt':_0x280bd2['resolvedAt'],'resolvedBy':_0x280bd2['resolvedBy'],'attributes':_0x280bd2['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x30f6b3,threadId:_0x17f7db,context:_0x2ea4b5,unlinkedAt:_0x1adcbf,attributes:_0x45fbd2})=>this['_getService'](_0x30f6b3)['updateCommentThread']({'commentThreadId':_0x17f7db,'context':_0x2ea4b5,'attributes':_0x45fbd2,'unlinkedAt':_0x1adcbf})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x37c532,threadId:_0x51e330})=>{const _0x310282=await this['_getService'](_0x37c532)['resolveCommentThread'](_0x51e330)['catch'](rt)['catch'](ct);return{'threadId':_0x310282['commentThreadId'],'resolvedAt':_0x310282['resolvedAt'],'resolvedBy':_0x310282['resolvedBy']};},'reopenCommentThread':async({channelId:_0x295cb4,threadId:_0x3d5bd6})=>this['_getService'](_0x295cb4)['reopenCommentThread'](_0x3d5bd6)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x5b3904,threadId:_0x524709})=>this['_getService'](_0x5b3904)['removeCommentThread'](_0x524709)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x1439cf,threadId:_0x475108,commentId:_0x5a36ab,content:_0x1eb9c8,attributes:_0x2ba247})=>this['_getService'](_0x1439cf)['addComment'](_0x475108,_0x5a36ab,_0x1eb9c8,_0x2ba247)['catch'](ct),'updateComment':({channelId:_0x5370e0,threadId:_0x572b05,commentId:_0x4f055d,content:_0xbb84e0,attributes:_0x36275e})=>this['_getService'](_0x5370e0)['updateComment'](_0x572b05,_0x4f055d,_0xbb84e0,_0x36275e)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x3f3cc5,threadId:_0x188639,commentId:_0xb62b0a})=>this['_getService'](_0x3f3cc5)['removeComment'](_0x188639,_0xb62b0a)['catch'](rt)['catch'](ct)},_0x18a22a instanceof _0x3b8224){const _0x351ad6=_0x18a22a['config']['get']('collaboration.channelId'),_0x3e19ee=_0x18a22a['plugins']['get'](Y);await this['_setUpService'](_0x351ad6);const _0x102b44=await this['_services']['get'](_0x351ad6)['getConnectedSessions']();this['listenTo'](_0x3e19ee,'sessionAdd:'+_0x351ad6,(_0x38279e,{session:_0x5d166a})=>{_0x5d166a['id']===_0x3e19ee['mySessionId']&&(_0x38279e['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x5d166a['permissions'],_0x351ad6));}),_0x3e19ee['register'](_0x351ad6,_0x102b44);}}async _setUpService(_0x47caa6){if(this['_services']['has'](_0x47caa6))throw new _0x4221a8('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x47caa6});const _0x3b9486=this['context']['plugins']['get'](_0x5120b7),_0x1329d5=new CloudServicesCommentsAdapter['CommentsService'](_0x47caa6);this['_services']['set'](_0x47caa6,_0x1329d5),this['listenTo'](_0x1329d5,'commentThreadAdded',(_0x245574,_0x3c2d8b)=>{const {commentThreadId:_0xdff74f,documentId:_0x3a9c42,context:_0x47190b,attributes:_0x332b32,resolvedAt:_0x4af224,resolvedBy:_0x14c1d2,comments:_0x33a8b1}=_0x3c2d8b;_0x3b9486['getCommentThread'](_0xdff74f)||_0x3b9486['addCommentThread']({'threadId':_0xdff74f,'channelId':_0x3a9c42,'comments':_0x33a8b1?_0x33a8b1['map'](at):[],'context':_0x47190b,'attributes':_0x332b32,'resolvedAt':_0x4af224,'resolvedBy':_0x14c1d2,'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentThreadUpdated',(_0x413acf,{commentThreadId:_0x54a314,documentId:_0x2d5918,context:_0x3218b4,unlinkedAt:_0x134d02,attributes:_0x1b717c})=>{_0x3b9486['getCommentThread'](_0x54a314)&&_0x3b9486['updateCommentThread']({'threadId':_0x54a314,'channelId':_0x2d5918,'context':_0x3218b4,'unlinkedAt':_0x134d02,'attributes':_0x1b717c,'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentThreadResolved',(_0x4846b3,{commentThreadId:_0x265c2b,resolvedBy:_0x5a0220,resolvedAt:_0x5e5313})=>{const _0x2aba07=_0x3b9486['getCommentThread'](_0x265c2b);_0x2aba07&&_0x2aba07['resolve']({'resolvedBy':_0x5a0220,'resolvedAt':_0x5e5313,'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentThreadReopened',(_0x175bd5,{commentThreadId:_0x4ae202})=>{const _0x4deb28=_0x3b9486['getCommentThread'](_0x4ae202);_0x4deb28&&_0x4deb28['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentThreadRemoved',(_0x58cd69,{commentThreadId:_0x4b31cf})=>{const _0x28e36b=_0x3b9486['getCommentThread'](_0x4b31cf);_0x28e36b&&_0x28e36b['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentAdded',(_0x7141dc,_0xdf64c5)=>{const _0x83b42=_0xdf64c5['commentThreadId'],_0x1ed3fc=_0x3b9486['getCommentThread'](_0x83b42);_0x1ed3fc&&_0x1ed3fc['addComment']({...at(_0xdf64c5),'isFromAdapter':!0x0});}),this['listenTo'](_0x1329d5,'commentUpdated',(_0x327c3b,{commentThreadId:_0x2a852f,commentId:_0x15f730,content:_0x2c2e6a,attributes:_0x50baa1})=>{const _0x4f76d5=_0x3b9486['getCommentThread'](_0x2a852f);if(_0x4f76d5){const _0x457a2f=_0x4f76d5['getComment'](_0x15f730);_0x457a2f&&_0x457a2f['update']({'content':_0x2c2e6a,'attributes':_0x50baa1,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1329d5,'commentRemoved',(_0x2fa895,{commentThreadId:_0x18c8e8,commentId:_0xb25b8d})=>{const _0x4ae079=_0x3b9486['getCommentThread'](_0x18c8e8);if(_0x4ae079){const _0x3c9879=_0x4ae079['getComment'](_0xb25b8d);_0x3c9879&&_0x3c9879['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x1329d5,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x47caa6),this['stopListening'](_0x1329d5));}),await this['_connectService'](_0x47caa6);}destroy(){if(this['context']instanceof _0x3b8224){const _0x3d0780=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x3d0780)&&this['_terminateService'](_0x3d0780);}}_terminateService(_0x5c97c8){if(!this['_services']['has'](_0x5c97c8))throw new _0x4221a8('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x5c97c8});this['_getService'](_0x5c97c8)['disconnect'](),this['_services']['delete'](_0x5c97c8);}async reconnect(){for(const _0x34a235 of this['_services']['keys']())await this['_connectService'](_0x34a235);if(this['context']instanceof _0x3b8224){const _0xae420=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0xae420)){const _0x49daa=this['context']['plugins']['get'](Y);_0x49daa['unregister'](_0xae420);const _0x302b9b=await this['_services']['get'](_0xae420)['getConnectedSessions']();_0x49daa['register'](_0xae420,_0x302b9b);}}}async _connectService(_0x13cf05){const {connection:_0x5302ad}=this['context']['plugins']['get'](z),_0x54cc5f=this['context']['plugins']['get'](_0x5120b7),_0x539b3d=await this['_services']['get'](_0x13cf05)['connect'](_0x5302ad);await this['_fetchMissingUsersForThreads'](_0x539b3d);const _0x52bffe=new Set(Array['from'](_0x54cc5f['getCommentThreads']({'channelId':_0x13cf05}),_0x1b90f6=>_0x1b90f6['id']));for(const _0x4e7358 of _0x539b3d)_0x4e7358['deletedAt']||_0x52bffe['delete'](_0x4e7358['commentThreadId']);for(const _0x1e3e9c of _0x52bffe)_0x54cc5f['getCommentThread'](_0x1e3e9c)['remove']({'isFromAdapter':!0x0});for(const _0x274f10 of _0x539b3d){let _0x27e6aa=_0x54cc5f['getCommentThread'](_0x274f10['commentThreadId']);const {commentThreadId:_0xfdadb7,context:_0x1918a8,attributes:_0x225f0b,resolvedBy:_0x586ec6,resolvedAt:_0x41f6f4,unlinkedAt:_0x371f64,deletedAt:_0x40f668}=_0x274f10;if(_0x40f668)continue;_0x27e6aa||(_0x27e6aa=_0x54cc5f['addCommentThread']({'channelId':_0x13cf05,'threadId':_0xfdadb7,'context':_0x1918a8,'attributes':_0x225f0b||{},'resolvedBy':_0x586ec6,'resolvedAt':_0x41f6f4,'unlinkedAt':_0x371f64,'isFromAdapter':!0x0}));const _0x20a57c=new Set(Array['from'](_0x27e6aa['comments'],_0x25b161=>_0x25b161['id']));for(const _0x10ea0f of _0x274f10['comments'])_0x20a57c['delete'](_0x10ea0f['commentId']);for(const _0x906341 of _0x20a57c)_0x27e6aa['getComment'](_0x906341)['remove']({'isFromAdapter':!0x0});for(const _0x3e44d2 of _0x274f10['comments']){const _0x1ca918=_0x27e6aa['getComment'](_0x3e44d2['commentId']);_0x1ca918?_0x1ca918['content']!==_0x3e44d2['content']&&_0x1ca918['update']({'content':_0x3e44d2['content'],'isFromAdapter':!0x0}):_0x27e6aa['addComment'](Object['assign'](at(_0x3e44d2),{'isFromAdapter':!0x0}));}}}_getService(_0x34fa0a){if(!this['_services']['has'](_0x34fa0a))throw new _0x4221a8('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x34fa0a});return this['_services']['get'](_0x34fa0a);}async _fetchMissingUsersForThreads(_0x3e1f8f){const _0xae1aa0=this['context']['plugins']['get'](_0xc75193),{connection:_0x23d120}=this['context']['plugins']['get'](z),_0x589c5a=new Set();for(const {resolvedBy:_0x170ca8,comments:_0x3be095}of _0x3e1f8f){_0x170ca8&&!_0xae1aa0['getUser'](_0x170ca8)&&_0x589c5a['add'](_0x170ca8);for(const {userId:_0x29fb0e}of _0x3be095)_0xae1aa0['getUser'](_0x29fb0e)||_0x589c5a['add'](_0x29fb0e);}if(0x0===_0x589c5a['size'])return;const _0x365901=await _0x5918aa['getMany'](_0x23d120,Array['from'](_0x589c5a));for(const _0x488cc5 of _0x365901)_0xae1aa0['getUser'](_0x488cc5['id'])||_0xae1aa0['addUser'](_0x488cc5);}};async function rt(_0x448108){if('404'!==_0x448108['code'])throw _0x448108;}function ct(_0x24ca7d){if((_0x4b91f6=_0x24ca7d)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x4b91f6['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4b91f6['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x4b91f6;throw _0x24ca7d;}function at(_0x1327df){return{'threadId':_0x1327df['commentThreadId'],'commentId':_0x1327df['commentId'],'content':_0x1327df['content'],'createdAt':_0x1327df['createdAt'],'authorId':_0x1327df['userId'],'attributes':_0x1327df['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x4dea7b{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>_0x462a45)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x559281,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x377cb7){super(_0x377cb7);const _0x336e8a=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x336e8a);}init(){const _0x223f0c=this['editor']['plugins']['get'](z),_0x240177=this['editor']['plugins']['get'](_0x559281);return _0x240177['adapter']={'getSuggestion':async _0x59f38a=>{await this['_waitForServiceReady']();const _0x33bc3c=await this['_trackChangesService']['get'](_0x59f38a)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x33bc3c]),_0x33bc3c;},'addSuggestion':async({id:_0x1f9445,type:_0x13067e,data:_0x1ce53b,originalSuggestionId:_0xdca724,attributes:_0x1a39ad})=>{await this['_waitForServiceReady']();const _0x510303={'id':_0x1f9445,'type':_0x13067e,'data':_0x1ce53b,'originalSuggestionId':_0xdca724,'attributes':_0x1a39ad},_0x2f0ff5=await this['_trackChangesService']['add'](_0x1f9445,_0x13067e,_0x1ce53b,_0xdca724,_0x1a39ad)['catch'](_0x58dfa6=>{if(dt(_0x58dfa6))return new Promise(_0x1aba3c=>{this['_bufferedRequests']['set'](_0x1f9445,{'resolve':_0x1aba3c,'suggestionData':_0x510303});});throw _0x58dfa6;});return this['_bufferedRequests']['delete'](_0x1f9445),_0x2f0ff5;},'updateSuggestion':async(_0x397e6f,_0x77a354)=>{if(await this['_waitForServiceReady'](),'open'!==_0x77a354['state'])return this['_trackChangesService']['update'](_0x397e6f,_0x77a354)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x19bfba,_0x561732)=>{_0x240177['hasSuggestion'](_0x561732['id'])&&(_0x240177['getSuggestion'](_0x561732['id'])['attributes']=_0x561732['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x223f0c['connection']?.['state']&&(_0x223f0c['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x223f0c['connection'])['then'](_0x934d5a=>(_0x223f0c['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x934d5a)['then'](()=>{for(const _0x3cd712 of _0x934d5a){_0x240177['addSuggestionData'](_0x3cd712)['_saved']=!0x0;}})));}async reconnect(){const _0x3900cf=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x51a6db}=this['editor']['plugins']['get'](z),_0x44daf7=await this['_trackChangesService']['connect'](_0x51a6db);await this['_fetchMissingUsersForThreads'](_0x44daf7);for(const {suggestionData:_0x449d43,resolve:_0x5c5c7c}of this['_bufferedRequests']['values']()){let _0x263ccf=_0x44daf7['find'](_0x18b21c=>_0x18b21c['id']===_0x449d43['id']);_0x263ccf||(_0x263ccf=await this['_trackChangesService']['add'](_0x449d43['id'],_0x449d43['type'],_0x449d43['data'],_0x449d43['originalSuggestionId'])),_0x5c5c7c(_0x263ccf);}for(const _0x39b242 of _0x44daf7)_0x3900cf['hasSuggestion'](_0x39b242['id'])||_0x3900cf['addSuggestionData'](_0x39b242);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x44ff21=>{this['listenTo'](this['_trackChangesService'],'connected',_0x302534=>{_0x302534['off'](),_0x44ff21();});});}async _fetchMissingUsersForThreads(_0x69ae7d){const _0x4e89e4=this['editor']['plugins']['get'](_0xc75193),{connection:_0x42ce7b}=this['editor']['plugins']['get'](z),_0x599eb6=new Set();for(const {authorId:_0x4ca1f1}of _0x69ae7d)_0x4e89e4['getUser'](_0x4ca1f1)||_0x599eb6['add'](_0x4ca1f1);if(0x0===_0x599eb6['size'])return;const _0x312dce=await _0x5918aa['getMany'](_0x42ce7b,Array['from'](_0x599eb6));for(const _0x16e156 of _0x312dce)_0x4e89e4['getUser'](_0x16e156['id'])||_0x4e89e4['addUser'](_0x16e156);}};function lt(_0x45f1d){if(dt(_0x45f1d))return new Promise(()=>{});throw _0x45f1d;}function dt(_0x1b502d){return _0x1b502d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1b502d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x4dea7b{static get requires(){return[_0xb0d326,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x583ec2=this['editor']['plugins']['get'](z),_0x1726c9=this['editor']['plugins']['get'](_0x7afca3),_0xa9e184=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x583ec2,'change:state',(_0x42e50d,_0x4b8a31,_0x313722)=>{_0x1726c9['isThreadsLoadingPaused']='connected'!==_0x313722;});}),this['listenTo'](_0x583ec2,'change:state',(_0x29ad25,_0x169ae4,_0xc85f2d)=>{this['editor']['plugins']['get'](_0x5120b7)['switchReadOnly']('connected'!==_0xc85f2d);}),_0xa9e184['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x1d6562=this['editor']['plugins']['get'](ot),_0x5469fa=this['editor']['config']['get']('collaboration.channelId');_0x1d6562['_services']['has'](_0x5469fa)&&_0x1d6562['_terminateService'](_0x5469fa),super['destroy']();}},ft=class extends _0x4dea7b{static get requires(){return[ut,ht,_0x19ed4c];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x4dea7b{static RevisionHistoryService=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>_0x11ab20)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x423746,Y,_0xc75193];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x300e7b){super(_0x300e7b);const _0x5f49b8=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x5f49b8);}async init(){const _0x5c6b06=this['editor']['plugins']['get'](tt),_0x1c126d=_0x5c6b06['serverHistory'],_0x155b9d=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x1c126d,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x5c6b06['sessionId']});const _0x230822=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x5f039b,_0x221459=await _0x132713['isBundleUploaded'](_0x155b9d['connection'],_0x230822);this['editor']['plugins']['get'](_0x423746)['adapter']={'getRevision':async({revisionId:_0x234017})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x234017)),'updateRevisions':async _0x1f08d0=>{await this['_waitForServiceReady']();const _0x101e56=this['_revisionTracker']['currentRevision'];if(_0x221459&&0x1===_0x1f08d0['length']&&_0x1f08d0[0x0]['id']===_0x101e56['id'])return _0x1f08d0;for(const _0x387f7b of _0x1f08d0)_0x387f7b['id']===_0x101e56['id']&&(_0x387f7b['isEmptyCurrent']=_0x387f7b['fromVersion']===_0x387f7b['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1f08d0,this['_lastRequestId'])['then'](_0x38ed08=>(this['_lastRequestId']=_0x38ed08,_0x1f08d0))['catch'](_0x3a64c7=>{if(pt(_0x3a64c7)||'400'===_0x3a64c7['code']&&void 0x0!==_0x3a64c7['data']['wrongRequestId']){for(const _0x37b59c of _0x1f08d0)this['_revisionTracker']['repository']['getRevision'](_0x37b59c['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x37b59c['id'],_0x37b59c,!0x1);if(pt(_0x3a64c7)&&'destroyed'!==this['editor']['state'])throw _0x3a64c7;return _0x1f08d0;}throw _0x3a64c7;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0xbbe71b,{revisionsData:_0x39d34f,requestId:_0x242d36})=>{Math['max'](..._0x39d34f['map'](_0x2b6a7b=>_0x2b6a7b['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x39d34f,_0x242d36);}):this['_handleRevisionsUpdate'](_0x39d34f,_0x242d36);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x155b9d['connection']?.['state']&&(_0x155b9d['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x5abada,requestId:_0x32dfa8}=await this['_revisionHistoryService']['connect'](_0x155b9d['connection']);_0x155b9d['addToReconnectionStack'](this),this['_lastRequestId']=_0x32dfa8,await this['_fetchMissingUsers'](_0x5abada);for(const _0x4ab92d of _0x5abada)this['_revisionTracker']['addRevisionData'](_0x4ab92d);this['listenTo'](_0x5c6b06,'change:_isConnected',(_0x42a9e3,_0x258179,_0x30e2f2)=>{_0x30e2f2&&(this['_oldOffset']=_0x5c6b06['_offset'],_0x42a9e3['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x5effb1=this['editor']['plugins']['get'](z),_0x548ed7=this['editor']['plugins']['get'](tt),_0x3420b2=async()=>{const _0x3552b0=this['_revisionTracker']['currentRevision'],_0x1a2038=_0x3552b0['id'],_0x1e1831=_0x1a2038!==_0x548ed7['sessionId'];if(_0x1e1831){const _0x353305=_0x548ed7['_offset']-this['_oldOffset'],_0x4f47e7=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x3552b0['toVersion']+_0x353305!==_0x4f47e7){const _0x58cce9=_0x3552b0['fromVersion']+_0x353305,_0x2ced82=this['editor']['plugins']['get'](_0xc75193),_0x2dca5b=this['_revisionTracker']['buildRevisionData']({'revision':_0x3552b0,'from':_0x58cce9,'to':_0x4f47e7});_0x2dca5b['id']=_0x3552b0['id'];const _0x515e4c=_0x2dca5b['authorsIds']['map'](_0x382beb=>_0x2ced82['getUser'](_0x382beb));_0x3552b0['_update']({..._0x2dca5b,'authors':_0x515e4c},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x3552b0['id'],_0x2dca5b,!0x0);}this['_revisionTracker']['_startingVersion']=_0x4f47e7,_0x3552b0['toVersion']!==_0x3552b0['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x1a2038)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x1a2038),this['_revisionTracker']['_createCurrentRevision'](_0x4f47e7);}const {revisions:_0x5d3fa1,requestId:_0x2b6698}=await this['_revisionHistoryService']['reconnect'](_0x5effb1['connection'],this['_lastRequestId']);_0x1e1831&&_0x5d3fa1['length']>0x0?_0x548ed7['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x5d3fa1),this['_handleRevisionsUpdate'](_0x5d3fa1,_0x2b6698),this['_revisionTracker']['sendBufferedUpdates']());};return _0x548ed7['_isConnected']?_0x3420b2():new Promise((_0x4ffd5a,_0x24f30a)=>{_0x548ed7['once']('change:_isConnected',()=>{_0x3420b2()['then'](_0x4ffd5a)['catch'](_0x24f30a);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x4f0ee8=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x3066d5=>{_0x3066d5['off'](),_0x4f0ee8();});});}_getLatestVersionFromServerOperations(){const _0xd1c994=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0xac796f of _0xd1c994)if('marker'!==_0xac796f['type']||_0xac796f['affectsData'])return _0xac796f['baseVersion']+0x1;}_getLatestVersion(){const _0x7ea920=this['editor']['plugins']['get'](tt);return new Promise(_0x4471c7=>{_0x7ea920['_isPendingUpdate']?_0x7ea920['once']('change:_isPendingUpdate',()=>{_0x4471c7(this['_getLatestVersionFromServerOperations']());}):_0x4471c7(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x4eb039,_0x3106ca){const _0x2c9e19=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3106ca;for(const _0x43c62f of _0x4eb039){const _0x56f42e=_0x2c9e19['getRevision'](_0x43c62f['id']);if(_0x56f42e){if((_0x43c62f['fromVersion']||_0x43c62f['toVersion'])&&(_0x43c62f['diffData']=null),_0x56f42e===this['_revisionTracker']['currentRevision']){const _0x5861d6=Math['max'](_0x56f42e['toVersion'],_0x43c62f['toVersion']),_0x381b2f=Math['max'](_0x56f42e['fromVersion'],_0x43c62f['fromVersion']);let _0x2a4bc3;_0x56f42e['toVersion']===_0x43c62f['toVersion']&&_0x56f42e['fromVersion']===_0x43c62f['fromVersion']?(_0x2a4bc3=!0x0,this['_preventResendingRevisionData'](_0x43c62f)):_0x43c62f['toVersion']===_0x5861d6&&_0x43c62f['fromVersion']===_0x381b2f?_0x2a4bc3=!0x1:(_0x56f42e['toVersion']===_0x5861d6&&_0x56f42e['fromVersion']===_0x381b2f||this['_fixRevision']({'revision':_0x56f42e,'from':_0x381b2f,'to':_0x5861d6}),_0x2a4bc3=!0x0),_0x2a4bc3&&(delete _0x43c62f['fromVersion'],delete _0x43c62f['toVersion'],delete _0x43c62f['diffData'],delete _0x43c62f['createdAt'],delete _0x43c62f['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x43c62f),this['_preventResendingRevisionData'](_0x43c62f);}else this['_revisionTracker']['addRevisionData'](_0x43c62f);}const _0x1ccb49=_0x2c9e19['getRevisions']();_0x1ccb49['reverse']();for(let _0x246bef=0x0;_0x246bef<_0x1ccb49['length']-0x1;_0x246bef++){const _0x42c929=_0x1ccb49[_0x246bef],_0x189dcf=_0x1ccb49[_0x246bef+0x1];if(_0x42c929['fromVersion']<_0x189dcf['toVersion']){const _0x2ee1ba=_0x189dcf['toVersion'],_0x4d801b=Math['max'](_0x2ee1ba,_0x42c929['toVersion']);this['_fixRevision']({'revision':_0x42c929,'from':_0x2ee1ba,'to':_0x4d801b});}}}['_fixRevision']({revision:_0x592b30,from:_0x529e3c,to:_0x46dbad}={}){const _0x389e2f=this['editor']['plugins']['get'](_0xc75193),_0x5345ec=this['_revisionTracker']['buildRevisionData']({'revision':_0x592b30,'from':_0x529e3c,'to':_0x46dbad});_0x5345ec['authors']=_0x5345ec['authorsIds']['map'](_0x196b59=>_0x389e2f['getUser'](_0x196b59)),_0x592b30['_update'](_0x5345ec);}_preventResendingRevisionData(_0x37defb){const _0x503522={};_0x503522['id']=_0x37defb['id'];for(const _0x240b17 of Object['keys'](_0x37defb))'id'!==_0x240b17&&(_0x503522[_0x240b17]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x503522['id'],_0x503522,!0x0);}async _fetchMissingUsers(_0x244154){const _0x29bce7=this['editor']['plugins']['get'](_0xc75193),{connection:_0x2cdec7}=this['editor']['plugins']['get'](z),_0x2b2289=new Set();for(const _0xc99503 of _0x244154){for(const _0x580bb6 of _0xc99503['authorsIds'])_0x27bae2(_0x580bb6);_0xc99503['creatorId']&&_0x27bae2(_0xc99503['creatorId']);}if(0x0===_0x2b2289['size'])return;const _0x58f803=await _0x5918aa['getMany'](_0x2cdec7,Array['from'](_0x2b2289));for(const _0x567293 of _0x58f803)_0x29bce7['getUser'](_0x567293['id'])||_0x29bce7['addUser'](_0x567293);function _0x27bae2(_0x3b756e){_0x29bce7['getUser'](_0x3b756e)||_0x2b2289['add'](_0x3b756e);}}};function pt(_0x3004f1){return _0x3004f1['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x3004f1['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3004f1['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x4dea7b{static get requires(){return[_0x423746,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x19ada5{_collapseAt;constructor(_0x4d9b4d,_0x340e99=0x6){super(_0x4d9b4d);const _0xd2cbea=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x340e99,this['bind']('isHidden')['to'](this,'usersCount',_0x579d81=>_0x579d81<_0x340e99),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0xd2cbea['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':_0xd2cbea['to']('usersCount',_0x2e4ab8=>'+'+(_0x2e4ab8-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x19ada5{items;keystrokes;constructor(_0x49d3fc){super(_0x49d3fc);const _0x555c8d=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x1d53f5(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x555c8d['if']('hasPopup'),'aria-expanded':_0x555c8d['to']('isExpanded',_0x2f9d25=>this['hasPopup']&&String(_0x2f9d25)),'aria-label':_0x555c8d['to']('hasPopup',_0x1888fc=>X(_0x49d3fc,_0x1888fc?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x555c8d['to']('hasPopup',_0xac6d10=>!!_0xac6d10&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x555c8d['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x555c8d['to'](_0x5700e7=>{const _0x3d866a=_0x5700e7,_0x505c92=document['querySelector']('.ck-presence-list__dropdown-list'),_0x3e5f54=document['querySelector']('.ck-balloon-panel_with-arrow');_0x505c92?.['contains'](_0x3d866a['relatedTarget'])||_0x3e5f54?.['contains'](_0x3d866a['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x4d63e2,_0x496738,_0x377406)=>{this['element']&&(_0x377406?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']);}},_t=class extends _0x19ada5{counterView;inlineListView;constructor(_0x4a6aa8,_0x5b9c0e=0x6){super(_0x4a6aa8);const _0x8f3cb=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x5b9c0e),this['inlineListView']=new vt(_0x4a6aa8),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4a249d of this['inlineListView']['items'])_0x4a249d['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',_0x8f3cb['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x19ada5{listWrapperView;constructor(_0x3d9026,_0xb80b5d){super(_0x3d9026);const _0x17c8ad=this['bindTemplate'];this['listWrapperView']=new bt(_0x3d9026,_0xb80b5d),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x3d9026,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x17c8ad['to'](_0x354415=>{const _0x2741f1=_0x354415,_0x61b69=document['querySelector']('.ck-presence-list__list'),_0x24ecea=document['querySelector']('.ck-balloon-panel_with-arrow');_0x61b69?.['contains'](_0x2741f1['relatedTarget'])||_0x24ecea?.['contains'](_0x2741f1['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x2426d0{constructor(_0x15ccea,_0x392aa4){super(_0x15ccea);const _0x3e901f=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x392aa4?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x3e901f['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x3e901f['to']('role'),'aria-label':_0x3e901f['to']('ariaLabel'),'aria-labelledby':_0x3e901f['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x4e5766['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x204f03=this['element'];_0x204f03&&(this['_isScrollable']=Math['max'](_0x204f03['scrollHeight'],_0x204f03['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x3d822f{['userView'];constructor(_0x31cd39,_0x5f35c4,_0x2e6689){super(_0x31cd39);const _0x55b50e=this['bindTemplate'];this['userView']=new _0x398431(_0x31cd39,_0x5f35c4);const _0x191d6b={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5f35c4['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5f35c4['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5f35c4['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x5f35c4['color']['getColorVariable'](),'--ck-user-color-alpha':_0x5f35c4['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x2e6689&&(_0x191d6b['tag']='button',_0x191d6b['on']={'click':_0x55b50e['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x191d6b);}['focus'](){this['element']['focus']();}},It=class extends _0x19ada5{['userView'];['markerView'];constructor(_0x2c9626,_0x5e722f,_0xcc82b1){super(_0x2c9626);const _0x179e88=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x398431(_0x2c9626,_0x5e722f),this['markerView']=new St(_0x2c9626,_0x5e722f);const _0x499552=new _0x3f0acc(_0x2c9626);_0x499552['template']['tag']='span',_0x499552['text']=_0x5e722f['name'];const _0x190864={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x179e88['to']('isFocusable',_0x47cb2b=>!!_0x47cb2b&&0x0),'aria-labelledby':_0x499552['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x179e88['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x179e88['to']('hasTooltip',_0x4af26e=>!_0x4af26e),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x499552]};_0xcc82b1&&(_0x190864['tag']='button',_0x190864['on']={'click':_0x179e88['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x190864);}},St=class extends _0x19ada5{constructor(_0x1d9983,_0x10577e){super(_0x1d9983),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x10577e['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x10577e['color']['getColorVariable'](),'--ck-user-color-alpha':_0x10577e['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x199983{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3573c9){super(_0x3573c9),this['context']['config']['define']('presenceList',Tt);const _0x36e58e=_0x3573c9['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x36e58e)throw new _0x4221a8('presencelist-collapseat-invalid-format',this);if(_0x36e58e<0x1)throw new _0x4221a8('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0xbc07ad(),this['balloonPanelView']=new _0x23dff2(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x2fbbe9 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x2fbbe9);this['listenTo'](this['_allConnectedUsers'],'add',(_0x59de80,_0x5e7e10)=>{this['_handleUserAdd'](_0x5e7e10);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0xa82910,_0x3fd20c)=>{this['_handleUserRemove'](_0x3fd20c);});}_createView(){const _0x355d6f=this['context'],_0x2e0f21=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x40acda=this['balloonPanelView'];if(!_0x139989(_0x355d6f['config']['get']('presenceList.container')))throw new _0x4221a8('presencelist-missing-container',this);return _0x2e0f21['counterView']['bind']('usersCount')['to'](this),_0x2e0f21['bind']('isCollapsed')['to'](this,'usersCount',_0x501c56=>{const {collapseAt:_0x4917cd}=_0x355d6f['config']['get']('presenceList'),_0x2c8333=_0x501c56>=_0x4917cd;if(_0x2c8333&&!_0x2e0f21['inlineListView']['items']['find'](_0x41bee6=>_0x41bee6 instanceof wt)){const _0x110192=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x110192&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2e0f21['inlineListView']['items']['add'](_0x2e0f21['counterView']);}return _0x2c8333||this['hideDropdown'](),_0x2c8333;}),_0x2e0f21['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x46618e=>{const _0x590dd5=_0x355d6f['config']['get']('presenceList'),_0xc69366=new It(_0x355d6f['locale'],_0x46618e,!!_0x590dd5['onClick']);return _0xc69366['bind']('hasTooltip')['to'](_0x2e0f21,'isCollapsed',_0x1a2e5b=>!_0x1a2e5b),_0xc69366['bind']('isFocusable')['to'](_0x2e0f21,'isCollapsed',_0x403420=>!_0x403420),_0x590dd5['onClick']&&this['listenTo'](_0xc69366,'execute',()=>{this['view']['isCollapsed']||_0x590dd5['onClick'](_0x46618e,_0xc69366['element']);}),_0xc69366;}),this['listenTo'](_0x2e0f21['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x2e0f21['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x2e0f21['inlineListView']['keystrokes']['set']('Enter',(_0x39764f,_0x121bfb)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x121bfb());}),_0x2e0f21['render'](),_0x40acda['render'](),_0x1ce9fc({'emitter':_0x2e0f21,'activator':()=>_0x40acda['isVisible'],'contextElements':[_0x40acda['element'],_0x2e0f21['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x355d6f['config']['get']('presenceList.container')['appendChild'](_0x2e0f21['element']),this['_bodyCollection']=new _0x52cb49(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x2e0f21;}['_handleUserAdd'](_0xfdbeca){if(!this['context']['config']['get']('presenceList.displayMe')&&_0xfdbeca['isMe'])return;const _0x248621=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x248621-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x3d5d8c=_0xfdbeca['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0xfdbeca,_0x3d5d8c);}['_handleUserRemove'](_0x3588aa){this['usersCount']--;const {collapseAt:_0x5a2c92}=this['context']['config']['get']('presenceList'),_0x4d04fe=this['usersCount']>=_0x5a2c92;if(this['currentDisplayedUsers']['get'](_0x3588aa['id']))this['currentDisplayedUsers']['remove'](_0x3588aa['id']);else{if(_0x4d04fe&&this['currentDisplayedUsers']['length']+0x1===_0x5a2c92-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x4d04fe?0x1:0x0)<this['usersCount']){for(const _0x228eb5 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x228eb5['id'])&&(this['currentDisplayedUsers']['add'](_0x228eb5,Math['min'](this['currentDisplayedUsers']['length']-(_0x4d04fe?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x4d04fe?0x1:0x0)===_0x5a2c92-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x234a13=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x234a13['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x119d23}=this['presenceDropdownView'];_0x119d23['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x9afeae=>{if(!_0x234a13['displayMe']&&_0x9afeae['isMe'])return null;const _0x1a5f76=new kt(this['context']['locale'],_0x9afeae,!!_0x234a13['onClick']);return _0x234a13['onClick']&&this['listenTo'](_0x1a5f76,'execute',()=>{_0x234a13['onClick'](_0x9afeae,_0x1a5f76['element']);}),_0x1a5f76;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x119d23['focus'](),_0x119d23['checkIfScrollable']();const _0x2b9faf=(_0x2de283,_0x14eaf8)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x14eaf8();};_0x119d23['keystrokes']['set']('Esc',_0x2b9faf),_0x119d23['keystrokes']['set']('Shift+Tab',_0x2b9faf),_0x119d23['keystrokes']['set']('Tab',(_0x58308b,_0x506182)=>{!function(_0x22d9db){const _0x54edf5=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x2385b3=>_0x2385b3+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x19dae8=[...document['body']['querySelectorAll'](_0x54edf5)]['filter'](_0x422a24=>_0x422a24===document['activeElement']||_0x422a24['offsetWidth']+_0x422a24['offsetHeight']>0x0)['sort']((_0x5689a9,_0x3a8b2d)=>(_0x5689a9['tabIndex']||0x0)-(_0x3a8b2d['tabIndex']||0x0)),_0x1f856f=_0x19dae8[(_0x19dae8['indexOf'](_0x22d9db)+0x1)%_0x19dae8['length']];_0x1f856f&&_0x1f856f['focus']();}(this['view']['element']),this['hideDropdown'](),_0x506182();}),_0x119d23['focusTracker']['add'](this['view']['element']),_0x119d23['focusTracker']['on']('change:isFocused',(_0x4bf13a,_0x549a88,_0x13ad07)=>{_0x13ad07||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);}},At=class extends _0x199983{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};
|