@ckeditor/ckeditor5-real-time-collaboration 46.0.0-alpha.7 → 46.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/real-time-collaboration.js +1 -1
- package/dist/index.js +6 -6
- package/package.json +14 -14
- package/src/presencelist/presencelistui.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/presencelist/view/presencelistview.js +1 -1
- package/src/realtimecollaborativecomments/cloudservicescommentsadapter.js +2 -2
- package/src/realtimecollaborativeediting/realtimecollaborationclient.js +2 -2
- package/src/realtimecollaborativeediting/sessions.js +1 -1
- package/src/realtimecollaborativeediting/usermarkers.js +1 -1
- package/src/realtimecollaborativeediting/websocketgateway.js +2 -2
- package/src/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.js +2 -2
- package/src/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.js +2 -2
package/dist/index.js
CHANGED
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
import{ContextPlugin as
|
|
24
|
-
((()=>dt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x573187];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4c959f){super(_0x4c959f),this['set']('state',_0x7cdbe8['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x4c231c())();}['init'](){const _0x4fc524=this['context'],_0x5ee719=_0x4fc524['plugins']['get']('CloudServices'),_0x549de5=_0x4fc524['plugins']['get'](_0x573187);if(!_0x5ee719['token'])throw new _0x5d33a2('websocketgateway-missing-token',this);if(!_0x5ee719['webSocketUrl'])throw new _0x5d33a2('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),n['WebSocketGateway']['connect'](_0x5ee719['token'],_0x5ee719['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x151346=>{if(this['connection']=_0x151346,this['bind']('state')['to'](_0x151346,'state',this,'_isBrowserOffline',(_0x2da1a6,_0x49a4d0)=>('connected'!==_0x2da1a6&&(this['_shouldPluginsReconnect']=!0x0),_0x49a4d0||_0x2da1a6!==_0x7cdbe8['CONNECTED']?_0x7cdbe8['DISCONNECTED']:this['state']==_0x7cdbe8['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x7cdbe8['CONNECTING']):_0x7cdbe8['CONNECTED'])),this['connection']['on']('error',(_0x4b1beb,_0x2c8a3c)=>{if('limitExceeded'!==_0x2c8a3c['code'])throw console['error'](_0x2c8a3c),new _0x5d33a2('cloudservices-init',null,{'originalError':_0x2c8a3c});_0x549de5['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'});}),!_0x151346['me'])return new Promise(_0x24efe8=>_0x151346['on']('change:me',_0x24efe8));})['catch'](_0x616836=>{throw console['error'](_0x616836),new _0x5d33a2('cloudservices-init',null,{'originalError':_0x616836});});}['addToReconnectionStack'](_0x24de7f){if('function'!=typeof _0x24de7f['reconnect'])throw new _0x5d33a2('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x24de7f))throw new _0x5d33a2('websocketgateway-plugin-already-registered',this,{'name':_0x24de7f['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x24de7f);}['removeFromReconnectionStack'](_0x14167d){this['_reconnectionStack']['delete'](_0x14167d);}['isInReconnectionStack'](_0x109540){return this['_reconnectionStack']['has'](_0x109540);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x6021ed=>_0x6021ed['reconnect']())))['then'](()=>this['state']=_0x7cdbe8['CONNECTED'])['catch'](_0x89a229=>{throw console['error'](_0x89a229),new _0x5d33a2('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x7cdbe8['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x3c0204{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[n,_0x390b4e];}constructor(_0xe5298a){super(_0xe5298a),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x457aeb(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x390b4e);}['init'](){const _0x44b840=this['context']['plugins']['get'](n);this['listenTo'](_0x44b840,'change:state',(_0x331896,_0x2c4748,_0x18e282)=>{if('connected'!==_0x18e282)this['channelSessions']['forEach'](_0x1a70ff=>_0x1a70ff['clear']()),this['channelConnectedUsers']['forEach'](_0x50f740=>_0x50f740['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x84473c,_0x12b6ec]of this['_registeredSessions'])for(const _0x54025e of _0x12b6ec)this['_handleSessionAdd'](_0x84473c,_0x54025e);}}),this['_createUser'](_0x44b840['connection']['me'],!0x0);}['register'](_0x378994,_0x546130){if(this['_registeredSessions']['has'](_0x378994))throw new _0x5d33a2('sessions-register-already-registered',null,{'channelId':_0x378994});this['_registeredSessions']['set'](_0x378994,_0x546130),this['channelSessions']['set'](_0x378994,new _0x457aeb()),this['channelConnectedUsers']['set'](_0x378994,new _0x457aeb()),this['listenTo'](_0x546130,'add',(_0x8808ee,_0x558257)=>this['_handleSessionAdd'](_0x378994,_0x558257)),this['listenTo'](_0x546130,'remove',(_0x570eec,_0x91f23b)=>this['_handleSessionRemove'](_0x378994,_0x91f23b));for(const _0x1cb35e of _0x546130)this['_handleSessionAdd'](_0x378994,_0x1cb35e);}['unregister'](_0x41ab3b){if(!this['_registeredSessions']['has'](_0x41ab3b))throw new _0x5d33a2('sessions-unregister-not-exist',null,{'channelId':_0x41ab3b});const _0x2d2766=this['_registeredSessions']['get'](_0x41ab3b);this['stopListening'](_0x2d2766);for(const _0x49d9c9 of _0x2d2766)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x41ab3b,_0x49d9c9);this['_registeredSessions']['delete'](_0x41ab3b),this['channelSessions']['delete'](_0x41ab3b),this['channelConnectedUsers']['delete'](_0x41ab3b);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x2d7220){for(const _0x4b1800 of this['channelSessions']['values']())for(const _0xbfd4a4 of _0x4b1800)if(_0xbfd4a4['id']===_0x2d7220)return _0xbfd4a4['user'];}['getUserSessions'](_0x3b6273,_0x41c277){const _0x5a7602=_0x41c277?[this['channelSessions']['get'](_0x41c277)]:this['channelSessions']['values'](),_0x53e115=new Set();for(const _0x5d21b0 of _0x5a7602)for(const _0x2bd54a of _0x5d21b0)_0x2bd54a['user']['id']===_0x3b6273['id']&&_0x53e115['add'](_0x2bd54a['id']);return _0x53e115;}['getUserRole'](_0x121bb8){for(const _0x4c589b of this['channelSessions']['values']())for(const _0x3d1c24 of _0x4c589b)if(_0x3d1c24['user']===_0x121bb8)return _0x3d1c24['role'];}['_handleSessionAdd'](_0x4cf14a,_0x3ba48f){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x76e9ab=_0x3ba48f['user'],_0x233e62=this['_users']['getUser'](_0x76e9ab['id'])||this['_createUser'](_0x76e9ab),_0x4ecfd7=Object['assign']({},_0x3ba48f,{'user':_0x233e62});this['channelSessions']['get'](_0x4cf14a)['add'](_0x4ecfd7);const _0x4a80df=this['channelConnectedUsers']['get'](_0x4cf14a);_0x4a80df['has'](_0x233e62['id'])||_0x4a80df['add'](_0x233e62),this['allConnectedUsers']['has'](_0x233e62['id'])||this['allConnectedUsers']['add'](_0x233e62,_0x233e62['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x4cf14a,{'channelId':_0x4cf14a,'session':_0x4ecfd7});}['_handleSessionRemove'](_0x1e3680,_0xe82389){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0xefd934=this['channelConnectedUsers']['get'](_0x1e3680),_0x113776=_0xe82389['user'];_0x113776['id']&&(this['channelSessions']['get'](_0x1e3680)['remove'](_0xe82389['id']),_0xefd934['has'](_0x113776['id'])&&!this['getUserSessions'](_0x113776,_0x1e3680)['size']&&_0xefd934['remove'](_0x113776['id']),this['allConnectedUsers']['get'](_0x113776['id'])&&!this['getUserSessions'](_0x113776)['size']&&this['allConnectedUsers']['remove'](_0x113776['id']));}['_createUser'](_0x19be89,_0x7bc151){const _0x4502fc=this['_users']['addUser'](_0x19be89);return _0x7bc151&&this['_users']['defineMe'](_0x19be89['id']),_0x4502fc['orderNumber']=this['_uniqueUsersCount']++,_0x4502fc;}}class H extends _0x3b44ca{['_domEmitter']=new(_0x4c231c())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x4d8f83=this['editor'],_0x38c4b9=_0x4d8f83['plugins']['get'](i);_0x4d8f83['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0xa1c729,{writer:_0x169653})=>function(_0x1160b6,_0xa5749b,_0x4926a7,_0x5faaeb){const _0x2c38ee=_0x1160b6['markerName']['split'](':')[0x2],_0x205501=_0x4926a7['getUserBySessionId'](_0x2c38ee);if(!_0x205501||_0x2c38ee===_0x4926a7['mySessionId'])return;if(!_0x5faaeb['model']['schema']['checkChild'](_0x1160b6['markerRange']['start'],'$text'))return;const _0x29f71e={'class':'ck-user__marker\x20'+_0x205501['color']['getMarkerClass'](),'data-name':_0x205501['name'],'data-session-id':_0x2c38ee},_0xd3ce91=_0x5faaeb['model']['markers']['get'](_0x1160b6['markerName']),_0x1c0c8b=_0xd3ce91['getStart'](),_0xd222a4=_0x1c0c8b['nodeAfter'],_0x1b7921=_0x5faaeb['model']['schema'];if(_0xd222a4&&_0x1b7921['isObject'](_0xd222a4)&&_0x1b7921['isInline'](_0xd222a4)&&!_0x5faaeb['model']['markers']['get']('user:range:'+_0x2c38ee)['getRange']()['isCollapsed'])return;const _0x39b589=_0x1c0c8b['parent'];return _0x5faaeb['model']['schema']['isLimit'](_0x39b589)&&!_0x5faaeb['model']['hasContent'](_0x39b589)&&(_0x29f71e['contenteditable']=!0x1),function(_0x28f2ba,_0x56fd3d,_0x5edcf0){const _0x20b3b5=_0x28f2ba['createUIElement']('span',_0x56fd3d);return _0x28f2ba['setCustomProperty']('userPositionMarker',!0x0,_0x20b3b5),_0x20b3b5['render']=function(_0x5ec94e){const _0x45d60b=this['toDomElement'](_0x5ec94e),_0xccb9ac=document['createElement']('span');return _0xccb9ac['classList']['add']('ck-user__marker-tooltip'),_0xccb9ac['setAttribute']('contenteditable','false'),_0xccb9ac['setAttribute']('spellcheck','false'),_0xccb9ac['textContent']=_0x5edcf0['name'],_0x45d60b['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0xccb9ac['outerHTML']+'',_0x45d60b['addEventListener']('mouseenter',()=>{_0x45d60b['classList']['add']('ck-user__marker_hovered');}),_0x45d60b['addEventListener']('mouseleave',()=>{_0x45d60b['classList']['remove']('ck-user__marker_hovered');}),_0x45d60b;},_0x20b3b5['isSimilar']=function(_0x2abd3b){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2abd3b['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2abd3b['getAttribute']('data-session-id'));},_0x20b3b5;}(_0xa5749b,_0x29f71e,_0x205501);}(_0xa1c729,_0x169653,_0x38c4b9,_0x4d8f83)}),_0x4d8f83['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x351b9b=>function(_0x5dc5f4,_0x51c664){const _0x398877=_0x5dc5f4['markerName']['split'](':')[0x2];if(_0x398877===_0x51c664['mySessionId'])return null;const _0x242bc0=_0x51c664['getUserBySessionId'](_0x398877);if(!_0x242bc0)return{'id':_0x398877,'classes':[]};return{'id':_0x398877,'classes':['ck-user__selection',_0x242bc0['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x398877},'priority':0x7d0+_0x242bc0['orderNumber']};}(_0x351b9b,_0x38c4b9)}),function(_0x42c5e6){const _0x353d3b=_0x42c5e6['model'],_0x41eb79=new Map(),_0x5a8a4a=_0x42c5e6['plugins']['get'](i);_0x353d3b['markers']['on']('update:user:range',(_0x211ad7,_0xcbe48c,_0x58ab78,_0x5e78e8)=>{if(!_0x5e78e8&&_0x41eb79['get'](_0xcbe48c['name']))return _0x41eb79['get'](_0xcbe48c['name'])['detach'](),void _0x41eb79['delete'](_0xcbe48c['name']);const _0x3fe462=_0xcbe48c['name']['split'](':')[0x2];if(_0x3fe462===_0x5a8a4a['mySessionId'])return;const _0x1ac2b3='user:position:'+_0x3fe462;_0x353d3b['markers']['has'](_0x1ac2b3)&&_0x42c5e6['editing']['reconvertMarker'](_0x1ac2b3),_0xcbe48c['on']('change:range',(_0x3f0f80,_0x95d34,_0x26444f)=>{if('$graveyard'!=_0x95d34['root']['rootName']&&'$graveyard'==_0xcbe48c['getRange']()['root']['rootName']&&!_0x41eb79['has'](_0xcbe48c['name'])){const _0x18b244=_0x353d3b['schema']['getNearestSelectionRange'](_0x26444f['deletionPosition']);if(_0x18b244){const _0x36d94a=_0x5787b9['fromRange'](_0x18b244);_0x41eb79['set'](_0xcbe48c['name'],_0x36d94a),_0x36d94a['on']('change:range',(_0x5ad822,_0x4c4181,_0xc30041)=>{if('$graveyard'==_0x36d94a['root']['rootName']){const _0x1fe777=_0x353d3b['schema']['getNearestSelectionRange'](_0xc30041['deletionPosition']);_0x1fe777?(_0x36d94a['start']=_0x1fe777['start'],_0x36d94a['end']=_0x1fe777['end']):(_0x41eb79['delete'](_0xcbe48c['name']),_0x36d94a['detach']());}});}}});}),_0x353d3b['document']['on']('change',()=>{_0x41eb79['size']>0x0&&_0x353d3b['enqueueChange']({'isUndoable':!0x1},_0x128d45=>{for(const [_0x54d2f9,_0x845a70]of _0x41eb79)'$graveyard'==_0x353d3b['markers']['get'](_0x54d2f9)['getRange']()['root']['rootName']&&(Y(_0x54d2f9['split'](':')[0x2],_0x845a70['toRange'](),_0x353d3b,_0x128d45),_0x845a70['detach']());_0x41eb79['clear']();});});}(_0x4d8f83),this['_domEmitter']['listenTo'](_0x2321a2['document'],'keydown',(_0x526301,{key:_0x281f2e})=>{'Escape'===_0x281f2e&&function(_0x45a364){_0x45a364['editing']['view']['change'](_0x1225ff=>{for(const _0x4183d7 of _0x45a364['model']['markers']){if(!_0x4183d7['name']['startsWith']('user:position'))continue;const _0x67dd9b=_0x45a364['editing']['mapper']['markerNameToElements'](_0x4183d7['name']);if(_0x67dd9b){for(const _0x392afd of _0x67dd9b)_0x1225ff['removeClass']('ck-user__marker_hovered',_0x392afd);}}});}(_0x4d8f83);},{'useCapture':!0x0});}['afterInit'](){const _0x4be433=this['editor'],_0x447d6d=_0x4be433['commands']['get']('undo');_0x447d6d&&_0x4be433['model']['on']('applyOperation',(_0x46374a,_0x8b4b70)=>{const _0x15be9a=_0x8b4b70[0x0];if(!_0x15be9a['isDocumentOperation'])return;if('marker'!=_0x15be9a['type']||!_0x15be9a['name']['startsWith']('user:'))return;const _0x56f254=_0x15be9a['batch'];_0x447d6d['_createdBatches']['has'](_0x56f254)&&(_0x15be9a['newRange']=_0x15be9a['oldRange']?_0x4be433['model']['createRange'](_0x15be9a['oldRange']['start'],_0x15be9a['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x231ae8=this['editor'],_0x400b03=_0x231ae8['model']['document'],_0x467d81=_0x231ae8['plugins']['get'](i);_0x231ae8['model']['enqueueChange']({'isUndoable':!0x1},_0x44a3f9=>{const _0x1cbb84='user:range:'+_0x467d81['mySessionId'],_0x261a0b='user:position:'+_0x467d81['mySessionId'],_0x55452e=_0x231ae8['model']['markers']['has'](_0x1cbb84);_0x231ae8['editing']['view']['hasDomSelection']?Y(_0x467d81['mySessionId'],_0x400b03['selection']['getFirstRange'](),_0x231ae8['model'],_0x44a3f9):_0x55452e&&(_0x44a3f9['removeMarker'](_0x1cbb84),_0x44a3f9['removeMarker'](_0x261a0b));});}}function Y(_0x14c958,_0x422ccd,_0x3a4423,_0x244e5e){const _0x2e0d93='user:range:'+_0x14c958,_0x24f36d='user:position:'+_0x14c958,_0x47876e=_0x422ccd['getContainedElement']();let _0x308c65=_0x422ccd['start'];if(_0x47876e&&_0x47876e['is']('element','tableCell')){const _0x2d2203=function(_0x4c61d5,_0x5f1efc){for(const _0x3570b0 of _0x4c61d5['getPositions']())if(_0x5f1efc['schema']['checkChild'](_0x3570b0,'$text'))return _0x3570b0;}(_0x422ccd,_0x3a4423);_0x2d2203&&(_0x308c65=_0x2d2203,_0x422ccd=_0x244e5e['createRange'](_0x308c65));}const _0x4e1e9c=_0x244e5e['createRange'](_0x308c65);_0x3a4423['markers']['has'](_0x2e0d93)?(_0x244e5e['updateMarker'](_0x2e0d93,{'range':_0x422ccd}),_0x244e5e['updateMarker'](_0x24f36d,{'range':_0x4e1e9c})):(_0x244e5e['addMarker'](_0x2e0d93,{'range':_0x422ccd,'usingOperation':!0x0}),_0x244e5e['addMarker'](_0x24f36d,{'range':_0x4e1e9c,'usingOperation':!0x0}));}function V(_0x5d7011,_0x3c29ad,_0x4933af){const _0x3d5845=_0x5d7011['t'],t=_0x5d7011['t'];switch(_0x3c29ad){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 _0x3d5845({'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'},_0x4933af);default:return'';}}let q=0x1;class l extends _0x3b44ca{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x5d9791)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,H,_0x292e1d,_0x390b4e,_0x573187];}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 _0x16f78a=this['serverHistory']['getOperations']();for(let _0x5b83a7=_0x16f78a['length']-0x1;_0x5b83a7>=0x0;_0x5b83a7--){const _0x40a062=_0x16f78a[_0x5b83a7];if(!this['_disconnectionOperations']['has'](_0x40a062))return _0x40a062['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x4edb22){if(super(_0x4edb22),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x23b671(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x5d33a2('collaboration-missing-channelid',this);const _0x50ea34=_0x4edb22['config']['get']('cloudServices.bundleVersion')||ht;this['_service']=new l['CollaborativeEditingService'](_0x50ea34,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x7cfd5f(),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 K(this['_disconnectionOperations']);}['init'](){const _0x117129=this['editor'],_0x446007=_0x117129['plugins']['get'](_0x390b4e),_0x41e020=_0x117129['plugins']['get'](n);this['listenTo'](_0x446007,'getOperationAuthor',(_0x4ff7c7,_0x490ba1)=>{const _0x4d1c4a=_0x490ba1[0x0];_0x4d1c4a['_authorId']&&(_0x4ff7c7['return']=_0x446007['getUser'](_0x4d1c4a['_authorId']),_0x4ff7c7['stop']()),null===_0x4d1c4a['_authorId']&&(_0x4ff7c7['return']=null,_0x4ff7c7['stop']());},{'priority':'high'}),this['listenTo'](_0x117129['model']['document']['selection'],'change:range',(_0x1b6409,_0x149728)=>{_0x149728['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x117129['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x117129['model']['on']('applyOperation',(_0x2e8b4c,_0x24e1f5)=>{const _0x263d9b=_0x24e1f5[0x0];_0x263d9b['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x263d9b),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x41e020,'state',this,'_hasSynchronizationProblem',(_0x4942fb,_0x2ed3be)=>'connected'===_0x4942fb&&!_0x2ed3be),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x117129['disableReadOnlyMode']('rtc-offline'):_0x117129['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x117129['disableReadOnlyMode']('rtc-offline'):_0x117129['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x492973=this['editor']['plugins']['get'](i),_0x31e8cc=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x492973['unregister'](this['_channelId']);const _0x223c1c=await this['_service']['reconnect'](_0x31e8cc['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x223c1c)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x169786=await this['_service']['getConnectedSessions']();_0x492973['register'](this['_channelId'],_0x169786),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4c1530){if(function(_0x54b62d){return'404'===_0x54b62d['code'];}(_0x4c1530)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x228f61){return'409'===_0x228f61['code'];}(_0x4c1530)){const _0x2009b2=V(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x2009b2);}else{if(!(_0x4c1530 instanceof G))throw _0x4c1530;this['_handleReconnectionError']();}}}}['destroy'](){const _0x3623ed=this['editor']['plugins']['get'](n),_0x53ae52=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x53ae52['channelSessions']['has'](this['_channelId'])&&_0x53ae52['unregister'](this['_channelId']),_0x3623ed['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x526106){if(this['sessionId']!==_0x526106['sessionId']&&this['_lastSyncedOperationId']!==_0x526106['lastOperationId'])throw new G();return this['sessionId']=_0x526106['sessionId'],this['_handleServerResponse']([],{..._0x526106,'wereChangesApplied':!0x1,'data':_0x526106['data']},'reconnect');}async['_connectService'](_0x1ae99d,_0xa6f615=!0x1){const {connection:_0x59e1a4}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x59e1a4,this['_channelId'])['then'](_0x359c67=>this['_initSessionsHandling'](_0x359c67))['catch'](_0x5ce415=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x5ce415);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4c1a0a,_0x3846b4)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x3846b4);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x59a9f2=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1ae99d);this['_isPendingUpdate']=!0x0;const _0x3e5c77=await this['_service']['connect'](_0x59e1a4,this['_compressOperations'](_0x1ae99d),_0x59a9f2);if(this['sessionId']=_0x3e5c77['sessionId'],_0xa6f615){if(!_0x3e5c77['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3e5c77['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x1ae99d,_0x3e5c77,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3e5c77,_0x1ae99d);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x431110=this['editor']['plugins']['get'](i),_0x1b8c5a=this['editor']['plugins']['get'](H),_0x366c3b=_0x431110['channelSessions']['get'](this['_channelId']);_0x366c3b&&_0x366c3b['length']>0x1?_0x1b8c5a['createUserMarkerOperations']():this['listenTo'](_0x431110,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x431110['channelSessions']['get'](this['_channelId'])['length']&&_0x1b8c5a['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x3f23f7,_0x5e00a2,_0x43cd97,_0x593bf5){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x5e00a2){const _0x4bce60=this['_decompressOperations'](_0x43cd97,_0x593bf5);await this['_fetchMissingUsers'](_0x4bce60),this['_handleExternalOperations'](_0x4bce60,_0x5e00a2,_0x43cd97['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x42e4fc}=this['editor'];let _0x5d99fe;try{_0x5d99fe=await this['_service']['getDocumentDetails']();}catch{const _0x1b0bc8=V(_0x42e4fc,'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'](_0x1b0bc8);}const _0x4a3784=_0x5d99fe['currentDocumentSession']||_0x5d99fe['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x4a3784['lastOperationId']){const _0x5ea43a=V(_0x42e4fc,'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'](_0x5ea43a);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x4806eb){const _0x3b125c=this['editor']['plugins']['get'](i);this['listenTo'](_0x3b125c,'sessionAdd:'+this['_channelId'],(_0x4516c5,{session:_0x24f68d})=>{if(_0x24f68d['id']===_0x3b125c['mySessionId']){_0x4516c5['off']();const _0x21be23=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x30cd94=_0x24f68d['permissions'];_0x21be23&&_0x21be23['isEnabled']&&(_0x30cd94=_0x30cd94['filter'](_0x133b2e=>'document:write'!==_0x133b2e)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x30cd94,this['_channelId']);}}),_0x3b125c['register'](this['_channelId'],_0x4806eb);}['_initThrowingOnDataSet'](){const _0xbf757b=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x3a4dd1)=>{if(!_0x3a4dd1[_0x3a4dd1['length']-0x1]['suppressErrorInCollaboration'])throw new _0x5d33a2('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0xbf757b['apply'](this['editor']['data'],_0x3a4dd1);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x249b79,[_0x218611])=>{if(this['_document']['version'])throw new _0x5d33a2('realtimecollaborationclient-init-document-already-initialized',this);_0x249b79['stop'](),this['_setPendingAction']();const _0x5165df=this['editor']['config']['get']('rootsAttributes'),_0x52ee64=this['_getOperationsFromInitData'](_0x218611,_0x5165df);0x0==_0x52ee64['length']&&_0x52ee64['push'](new _0x32e409(0x0)),_0x249b79['return']=this['_connectService'](_0x52ee64)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x263be4=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x263be4))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x1ceb94,[_0x4f21ae,_0xb33170])=>{_0x1ceb94['stop']();const _0x35cef3=this['editor']['model']['document']['getRoot'](_0x4f21ae);if(!this['_knownRootNames']['has'](_0x4f21ae)){const _0x2e0522=_0xb33170&&_0xb33170['data']?_0xb33170['data']:'',_0xcc3106=_0xb33170&&_0xb33170['attributes']?_0xb33170['attributes']:{};await this['_loadRoot'](_0x4f21ae,_0x2e0522,_0xcc3106);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x35cef3['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x35cef3);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xfbb4e9){const _0x9295cc=this['editor']['plugins']['get'](_0x390b4e),{connection:_0x57fe8c}=this['editor']['plugins']['get'](n),_0x375033=new Set();for(const _0x4ba736 of _0xfbb4e9){const _0x4738f8=_0x4ba736['_authorId'];_0x4738f8&&!_0x9295cc['getUser'](_0x4738f8)&&_0x375033['add'](_0x4738f8);}if(0x0===_0x375033['size'])return;const _0x302a81=await ut['getMany'](_0x57fe8c,Array['from'](_0x375033));for(const _0x5f4f6d of _0x302a81)_0x9295cc['getUser'](_0x5f4f6d['id'])||_0x9295cc['addUser'](_0x5f4f6d);}['_getOperationsFromInitData'](_0x47ba16,_0x2b80b0={}){const _0x1952fd=this['editor']['model'],_0x3916b4=[];let _0x16d409=0x0;const _0x299000='string'==typeof _0x47ba16?{'main':_0x47ba16}:_0x47ba16;for(const _0x17c7a2 of Object['keys'](_0x299000)){if(!this['_document']['roots']['has'](_0x17c7a2))throw new _0x5d33a2('realtimecollaborationclient-init-non-existent-root',this);const _0x226f8f=this['editor']['data']['parse'](_0x299000[_0x17c7a2]),_0x459149=this['_document']['getRoot'](_0x17c7a2),_0x4d2769=new _0x4ef4e0(_0x1952fd['createPositionAt'](_0x459149,0x0),_0x226f8f,_0x16d409++);_0x3916b4['push'](_0x4d2769);for(const [_0x39e116,_0x59a48a]of _0x226f8f['markers']){const _0x395a0b=_0x1952fd['createRange'](_0x1952fd['createPositionFromPath'](_0x459149,_0x59a48a['start']['path']['slice']()),_0x1952fd['createPositionFromPath'](_0x459149,_0x59a48a['end']['path']['slice']())),_0x325e79=new _0x162f68(_0x39e116,null,_0x395a0b,_0x1952fd['markers'],!0x0,_0x16d409++);_0x3916b4['push'](_0x325e79);}}if(_0x2b80b0)for(const [_0x41bf33,_0x1bd9cf]of Object['entries'](_0x2b80b0)){const _0x20606c=_0x1952fd['document']['getRoot'](_0x41bf33);if(!_0x20606c)throw new _0x5d33a2('multi-root-editor-root-attributes-no-root',null);for(const [_0x31663d,_0x3247d4]of Object['entries'](_0x1bd9cf))if(null!==_0x3247d4){const _0x358d1e=new _0x422b46(_0x20606c,_0x31663d,null,_0x3247d4,_0x16d409++);_0x3916b4['push'](_0x358d1e);}}return _0x3916b4;}async['_loadRoot'](_0x4b363a,_0x56eec1,_0x18dc2b){this['_getOperationsFromInitData']({[_0x4b363a]:_0x56eec1},{[_0x4b363a]:_0x18dc2b})['forEach']((_0x4a2d58,_0x684319)=>{_0x4a2d58['baseVersion']=this['_document']['version']+_0x684319,_0x4a2d58['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x4a2d58);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x54fd42,_0x4b0183){let _0x351938;this['_offset']=_0x54fd42['offset'];const _0x32577f=_0x54fd42['wereChangesApplied']&&!_0x54fd42['initData'],_0x7eb02d=_0x32577f?0x0:_0x54fd42['data']['baseVersion'];if(_0x4b0183['forEach'](_0xb3cbc1=>{_0xb3cbc1['_isInit']=!0x0,_0xb3cbc1['createdAt']=_0x54fd42['sessionCreatedAt'],_0xb3cbc1['_authorId']=null;}),_0x32577f)_0x351938=_0x4b0183,this['_applyOperationsSet'](_0x351938,_0x32577f);else{if(_0x54fd42['initData']){const _0x1c438a=this['_getOperationsFromInitData'](_0x54fd42['initData']);this['_document']['history']['version']=-_0x1c438a['length'],_0x1c438a['forEach'](_0x14172f=>{_0x14172f['baseVersion']-=_0x1c438a['length'],_0x14172f['createdAt']=_0x54fd42['sessionCreatedAt'],_0x14172f['_isInit']=!0x0,_0x14172f['_authorId']=null;}),this['_applyOperationsSet'](_0x1c438a,!0x0),this['serverHistory']['version']=-_0x1c438a['length']+this['_offset'],this['_updateServerHistory'](_0x1c438a);}this['_document']['history']['version']=_0x7eb02d,_0x351938=this['_decompressOperations'](_0x54fd42['data'],_0x54fd42['metadata']),await this['_fetchMissingUsers'](_0x351938),this['_applyOperationsSet'](_0x351938,_0x32577f);}_0x54fd42['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x351938,_0x54fd42['lastOperationId']),this['_lastSyncedOperationId']=_0x54fd42['lastOperationId']),this['serverHistory']['version']=_0x7eb02d+this['_offset'],this['_updateServerHistory'](_0x351938),_0x4b0183['filter'](_0x287186=>{const _0x47bd49=this['_getAffectedRoot'](_0x287186);return _0x47bd49&&!this['_knownRootNames']['has'](_0x47bd49);})['forEach']((_0x477cfb,_0x49030b)=>{_0x477cfb['baseVersion']=this['_document']['version']+_0x49030b,this['_saveOperationInBuffer'](_0x477cfb);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x92d8e5,_0x27eff1){const _0x44f917=_0x27eff1&&_0x27eff1['message'];if(_0x44f917&&_0x44f917['startsWith']('realtimecollaborationclient'))throw _0x27eff1;const _0x214e09=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x214e09['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x5d33a2(_0x92d8e5,this['editor'],_0x44f917?{'originalError':_0x44f917}:void 0x0);}['_saveOperationInBuffer'](_0x1dcd2b){this['_knownOperations']['has'](_0x1dcd2b)||(this['_knownOperations']['add'](_0x1dcd2b),this['_bufferedOperations']['push'](_0x1dcd2b),this['_pendingAction']||'marker'==_0x1dcd2b['type']&&!_0x1dcd2b['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x220faa=!0x1){!_0x220faa&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x1cb60f=>{_0x1cb60f&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x5326bb=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x541776){return _0x541776['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x541776['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x541776['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x5326bb)||this['_crash'](_0x5326bb['message'],_0x5326bb);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x4e34b4=>{this['on']('change:_isPendingUpdate',()=>{_0x4e34b4();});});}async['_sendBufferedOperations'](){const _0xf13ba2=this['editor']['plugins']['get'](H);if(this['_shouldSendSelectionUpdate']()&&(_0xf13ba2['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x982c61=[...this['_bufferedOperations']];for(const _0x29ccfe of _0x982c61)_0x29ccfe['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x29ccfe);const _0x413139=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x982c61),_0x16a816=q++,_0x412283=this['_compressOperations'](_0x982c61),_0x2b8589=await this['_service']['sendOperations'](_0x412283,_0x412283['baseVersion'],_0x413139);try{return await this['_handleServerResponse'](_0x982c61,_0x2b8589,_0x16a816);}catch(_0x1fd792){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1fd792);}}async['_handleServerResponse'](_0x528a35,_0x10f65e,_0x4ad69e){if('error'in _0x10f65e)throw _0x10f65e['error'];let _0x4b48f7=!0x1;if(_0x10f65e['wereChangesApplied']){_0x10f65e['lastOperationId']&&(this['_lastSyncedOperationId']=_0x10f65e['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x48415f=>!_0x528a35['includes'](_0x48415f));for(const _0x8e6ecc of _0x528a35)_0x8e6ecc['createdAt']='lastOperationAcceptedAt'in _0x10f65e&&_0x10f65e['lastOperationAcceptedAt']||void 0x0;$(_0x528a35,_0x10f65e['version']-_0x528a35['length']),this['_updateServerHistory'](_0x528a35);const _0x5754db=_0x528a35['filter'](_0x107c5c=>{if(!_0x107c5c['_isInit'])return!0x1;const _0x2c7c1c=this['_getAffectedRoot'](_0x107c5c);return _0x2c7c1c&&!this['_knownRootNames']['has'](_0x2c7c1c);});$(_0x5754db,this['_document']['version']),this['_applyOperationsSet'](_0x5754db),_0x4b48f7=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1f0e57=this['_decompressOperations'](_0x10f65e['data'],_0x10f65e['metadata'])['filter'](_0x1a3d08=>_0x1a3d08['baseVersion']>=this['_lastServerVersion']);_0x1f0e57['forEach'](_0x4305bf=>this['_addKnownRoot'](_0x4305bf)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x4b71a4=>!_0x4b71a4['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x4b71a4))),this['_bufferedOperations']['length']&&$(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1f0e57),_0x4b48f7=this['_handleExternalOperations'](_0x1f0e57,_0x10f65e['version'],_0x10f65e['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x4b48f7?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x49c68f,_0x5ce2fe,_0x263329){try{const _0x18979d={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x1afd54,operationsB:_0x38ffee,originalOperations:_0x39601f}=_0x596c44(_0x49c68f,this['_bufferedOperations'],_0x18979d);$(_0x1afd54,this['_document']['version']),$(_0x38ffee,_0x5ce2fe);for(const _0x3788aa of _0x1afd54){const _0x3f35cc=_0x39601f['get'](_0x3788aa);_0x3788aa['_authorId']=_0x3f35cc?_0x3f35cc['_authorId']:null;}_0x263329&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x49c68f,_0x263329),this['_lastSyncedOperationId']=_0x263329),this['_bufferedOperations']=[..._0x38ffee],this['_applyOperationsSet'](_0x1afd54),this['_updateServerHistory'](_0x49c68f);}catch(_0x2e4910){return console['error'](_0x2e4910),!0x1;}return!0x0;}['_applyOperationsSet'](_0x4a94b6,_0x551196=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x298063=>{for(const _0x387816 of _0x4a94b6)this['_knownOperations']['add'](_0x387816),this['_addKnownRoot'](_0x387816),_0x298063['batch']['addOperation'](_0x387816),this['editor']['model']['applyOperation'](_0x387816);});}['_addKnownRoot'](_0x2ff170){const _0x1d43d2=this['_getAffectedRoot'](_0x2ff170);_0x1d43d2&&this['_knownRootNames']['add'](_0x1d43d2);}['_getAffectedRoot'](_0x57d4e7){let _0x15a976,_0x1c3b3f;switch(_0x57d4e7['type']){case'insert':_0x15a976=_0x57d4e7['position']['root'];break;case'marker':if(_0x1c3b3f=_0x57d4e7['newRange'],!_0x1c3b3f)return null;_0x15a976=_0x1c3b3f['root'];break;case'addRootAttribute':_0x15a976=_0x57d4e7['root'];break;case'addRoot':_0x15a976=_0x57d4e7['affectedSelectable'];break;case'move':_0x15a976=_0x57d4e7['targetPosition']['root'];break;default:return null;}return _0x15a976['rootName'];}['_updateServerHistory'](_0x57020d){_0x57020d['forEach'](_0x25fe9b=>{const _0x177d4e=_0x25fe9b['clone']();_0x177d4e['_authorId']=_0x25fe9b['_authorId'],_0x177d4e['_isInit']=!!_0x25fe9b['_isInit'],_0x177d4e['createdAt']=_0x25fe9b['createdAt'],_0x177d4e['baseVersion']+=this['_offset'],_0x25fe9b['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x177d4e),this['serverHistory']['addOperation'](_0x177d4e);});}['_handleReconnectionError'](_0x30756f){const _0x4333ed=this['editor']['plugins']['get']('Notification'),_0x68b46b=this['editor']['locale'];_0x30756f||(_0x30756f=V(_0x68b46b,'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.')),_0x4333ed['showWarning'](_0x30756f,{'title':V(_0x68b46b,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x292e1d)['add'](V(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x292e1d)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x259a5c){const _0x48966f=_0x259a5c['map'](_0x77bea8=>_0x77bea8['toJSON']());return this['_compressor']['compress'](_0x48966f);}['_decompressOperations'](_0x4e5664,_0x5c380d){return this['_compressor']['decompress'](_0x4e5664)['map']((_0x3770ca,_0x85cb43)=>{const _0x37aeea='init'==_0x5c380d[_0x85cb43]['type'];if('InsertOperation'==_0x3770ca['__className']){const _0x4627aa=_0x3770ca['position']['root'];!this['_document']['getRoot'](_0x4627aa)&&(this['_document']['createRoot']('$root',_0x4627aa)['_isAttached']=!0x1);}const _0x360333=_0x553054['fromJSON'](_0x3770ca,this['_document']);return _0x360333['wasUndone']=_0x3770ca['wasUndone'],_0x360333['_isInit']=_0x37aeea,_0x360333['_authorId']=_0x37aeea?null:_0x5c380d[_0x85cb43]['userId'],_0x360333['_isDisconnection']='cs:removeUser'===_0x5c380d[_0x85cb43]['type'],_0x360333['createdAt']=_0x5c380d[_0x85cb43]['createdAt'],_0x360333;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x3f77c3=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3f77c3&&_0x3f77c3['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class G extends Error{}function $(_0x3ff7a8,_0x6d578){for(const _0x2b0ad3 of _0x3ff7a8)_0x2b0ad3['baseVersion']=_0x6d578++;}class K{['_ignoredOperations'];['_operationToId'];constructor(_0x28ee7e){this['_ignoredOperations']=_0x28ee7e,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x431581){let _0x590aee=_0x431581['length'];for(;_0x590aee--;){const _0x26ccc5=_0x431581[_0x590aee];if(!this['_ignoredOperations']['has'](_0x26ccc5)){if(!this['_operationToId']['has'](_0x26ccc5)){const _0x358d37=_0x5bf958()['slice'](0x1,0x12);this['_operationToId']['set'](_0x26ccc5,_0x358d37);}return this['_operationToId']['get'](_0x26ccc5);}}}['setIdForTheLastOperation'](_0x449627,_0x1ca4cb){if(!_0x1ca4cb)return;let _0x3bda70=_0x449627['length'];for(;_0x3bda70--;){const _0x361957=_0x449627[_0x3bda70];this['_ignoredOperations']['has'](_0x361957)||this['_operationToId']['set'](_0x361957,_0x1ca4cb);}}}class a extends _0x3b44ca{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x3c0204{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>et)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x390b4e];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x8d2000){super(_0x8d2000),this['_services']=new Map();}async['init'](){const _0x1a2233=this['context'],_0x22965c=_0x1a2233['plugins']['get']('CommentsRepository');if(_0x1a2233['plugins']['get'](n)['addToReconnectionStack'](this),_0x22965c['adapter']={'addCommentThread':async({channelId:_0x45f992,threadId:_0x4e6d5e,comments:_0x34356c,resolvedAt:_0x387775,resolvedBy:_0x3fa3cb,context:_0x11ead3,attributes:_0x1c5308})=>{const _0x21cc44=await this['_getService'](_0x45f992)['addCommentThread']({'commentThreadId':_0x4e6d5e,'comments':_0x34356c['map'](_0xcea80e=>function(_0x14367f,_0xa001c7,_0x12a8c9){return{'commentThreadId':_0x12a8c9,'commentId':_0x14367f['commentId'],'userId':_0x14367f['authorId'],'content':_0x14367f['content'],'documentId':_0xa001c7,'createdAt':_0x14367f['createdAt'],'attributes':_0x14367f['attributes']||{}};}(_0xcea80e,_0x45f992,_0x4e6d5e)),'resolvedAt':_0x387775,'resolvedBy':_0x3fa3cb,'context':_0x11ead3,'attributes':_0x1c5308})['catch'](ft);return{'threadId':_0x21cc44['commentThreadId'],'comments':_0x21cc44['comments']};},'getCommentThread':async({channelId:_0x408b40,threadId:_0x20f199})=>{const _0x3bd2b7=await this['_getService'](_0x408b40)['getCommentThread'](_0x20f199)['catch'](ft);return _0x3bd2b7['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3bd2b7]),{'threadId':_0x3bd2b7['commentThreadId'],'comments':_0x3bd2b7['comments']['map'](st),'context':_0x3bd2b7['context'],'resolvedAt':_0x3bd2b7['resolvedAt'],'resolvedBy':_0x3bd2b7['resolvedBy'],'attributes':_0x3bd2b7['attributes']||{}});},'updateCommentThread':async({channelId:_0xf6d52c,threadId:_0x5e948d,context:_0x265de5,unlinkedAt:_0xcd74de,attributes:_0x1c606a})=>this['_getService'](_0xf6d52c)['updateCommentThread']({'commentThreadId':_0x5e948d,'context':_0x265de5,'attributes':_0x1c606a,'unlinkedAt':_0xcd74de})['catch'](ot)['catch'](ft),'resolveCommentThread':async({channelId:_0x38f2f7,threadId:_0x321823})=>{const _0x2ddec9=await this['_getService'](_0x38f2f7)['resolveCommentThread'](_0x321823)['catch'](ot)['catch'](ft);return{'threadId':_0x2ddec9['commentThreadId'],'resolvedAt':_0x2ddec9['resolvedAt'],'resolvedBy':_0x2ddec9['resolvedBy']};},'reopenCommentThread':async({channelId:_0x4ac139,threadId:_0x494027})=>this['_getService'](_0x4ac139)['reopenCommentThread'](_0x494027)['catch'](ot)['catch'](ft),'removeCommentThread':({channelId:_0x23ec59,threadId:_0x5504a4})=>this['_getService'](_0x23ec59)['removeCommentThread'](_0x5504a4)['catch'](ot)['catch'](ft),'addComment':({channelId:_0x5e0f2a,threadId:_0x5294be,commentId:_0x433cd2,content:_0x2b0d23,attributes:_0x5580d0})=>this['_getService'](_0x5e0f2a)['addComment'](_0x5294be,_0x433cd2,_0x2b0d23,_0x5580d0)['catch'](ft),'updateComment':({channelId:_0x19f956,threadId:_0x512312,commentId:_0x337933,content:_0x35f460,attributes:_0x37a314})=>this['_getService'](_0x19f956)['updateComment'](_0x512312,_0x337933,_0x35f460,_0x37a314)['catch'](ot)['catch'](ft),'removeComment':({channelId:_0xdea26a,threadId:_0x65c12,commentId:_0x44cbd8})=>this['_getService'](_0xdea26a)['removeComment'](_0x65c12,_0x44cbd8)['catch'](ot)['catch'](ft)},_0x1a2233 instanceof tt){const _0x3be269=_0x1a2233['config']['get']('collaboration.channelId'),_0x768b49=_0x1a2233['plugins']['get'](i);await this['_setUpService'](_0x3be269);const _0x56a273=await this['_services']['get'](_0x3be269)['getConnectedSessions']();this['listenTo'](_0x768b49,'sessionAdd:'+_0x3be269,(_0x2bbcab,{session:_0x560ba1})=>{_0x560ba1['id']===_0x768b49['mySessionId']&&(_0x2bbcab['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x560ba1['permissions'],_0x3be269));}),_0x768b49['register'](_0x3be269,_0x56a273);}}async['_setUpService'](_0x35a742){if(this['_services']['has'](_0x35a742))throw new _0x5d33a2('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x35a742});const _0x5a65c4=this['context']['plugins']['get']('CommentsRepository'),_0x20f9cf=new s['CommentsService'](_0x35a742);this['_services']['set'](_0x35a742,_0x20f9cf),this['listenTo'](_0x20f9cf,'commentThreadAdded',(_0x379d7f,_0x60b19b)=>{const {commentThreadId:_0x5eb89b,documentId:_0x6897e8,context:_0x8ce2f9,attributes:_0x5e2c95,resolvedAt:_0x36a21b,resolvedBy:_0x6b873f,comments:_0x1e654b}=_0x60b19b;_0x5a65c4['getCommentThread'](_0x5eb89b)||_0x5a65c4['addCommentThread']({'threadId':_0x5eb89b,'channelId':_0x6897e8,'comments':_0x1e654b?_0x1e654b['map'](st):[],'context':_0x8ce2f9,'attributes':_0x5e2c95,'resolvedAt':_0x36a21b,'resolvedBy':_0x6b873f,'isFromAdapter':!0x0});}),this['listenTo'](_0x20f9cf,'commentThreadUpdated',(_0x4345ae,{commentThreadId:_0x3e0ea3,documentId:_0x5b6d21,context:_0x7ec95c,unlinkedAt:_0x1b1420,attributes:_0x37bf89})=>{_0x5a65c4['getCommentThread'](_0x3e0ea3)&&_0x5a65c4['updateCommentThread']({'threadId':_0x3e0ea3,'channelId':_0x5b6d21,'context':_0x7ec95c,'unlinkedAt':_0x1b1420,'attributes':_0x37bf89,'isFromAdapter':!0x0});}),this['listenTo'](_0x20f9cf,'commentThreadResolved',(_0x44f510,{commentThreadId:_0x32040f,resolvedBy:_0x4353ab,resolvedAt:_0x3df048})=>{const _0x41b447=_0x5a65c4['getCommentThread'](_0x32040f);_0x41b447&&_0x41b447['resolve']({'resolvedBy':_0x4353ab,'resolvedAt':_0x3df048,'isFromAdapter':!0x0});}),this['listenTo'](_0x20f9cf,'commentThreadReopened',(_0x29657c,{commentThreadId:_0x357196})=>{const _0x1cfb88=_0x5a65c4['getCommentThread'](_0x357196);_0x1cfb88&&_0x1cfb88['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x20f9cf,'commentThreadRemoved',(_0x328a9a,{commentThreadId:_0x2058d1})=>{const _0x1595c4=_0x5a65c4['getCommentThread'](_0x2058d1);_0x1595c4&&_0x1595c4['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x20f9cf,'commentAdded',(_0x423a21,_0x1b31a6)=>{const _0x211b90=_0x1b31a6['commentThreadId'],_0x3619f4=_0x5a65c4['getCommentThread'](_0x211b90);_0x3619f4&&_0x3619f4['addComment']({...st(_0x1b31a6),'isFromAdapter':!0x0});}),this['listenTo'](_0x20f9cf,'commentUpdated',(_0x28a8b5,{commentThreadId:_0x1c70f5,commentId:_0x12e7de,content:_0x1b04c7,attributes:_0x28c835})=>{const _0x115a8a=_0x5a65c4['getCommentThread'](_0x1c70f5);if(_0x115a8a){const _0x5ef7cb=_0x115a8a['getComment'](_0x12e7de);_0x5ef7cb&&_0x5ef7cb['update']({'content':_0x1b04c7,'attributes':_0x28c835,'isFromAdapter':!0x0});}}),this['listenTo'](_0x20f9cf,'commentRemoved',(_0x105159,{commentThreadId:_0x3341ac,commentId:_0x324355})=>{const _0x48eae6=_0x5a65c4['getCommentThread'](_0x3341ac);if(_0x48eae6){const _0x5ce6c3=_0x48eae6['getComment'](_0x324355);_0x5ce6c3&&_0x5ce6c3['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x35a742);}['destroy'](){if(this['context']instanceof tt){const _0x394bdb=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x394bdb);}}['_terminateService'](_0x310674){if(!this['_services']['has'](_0x310674))throw new _0x5d33a2('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x310674});this['_getService'](_0x310674)['disconnect'](),this['_services']['delete'](_0x310674);}async['reconnect'](){for(const _0x181db6 of this['_services']['keys']())await this['_connectService'](_0x181db6);if(this['context']instanceof tt){const _0x2d0f2a=this['context']['config']['get']('collaboration.channelId'),_0x22cbaf=this['context']['plugins']['get'](i);_0x22cbaf['unregister'](_0x2d0f2a);const _0x2aa059=await this['_services']['get'](_0x2d0f2a)['getConnectedSessions']();_0x22cbaf['register'](_0x2d0f2a,_0x2aa059);}}async['_connectService'](_0x591fae){const {connection:_0x8b2775}=this['context']['plugins']['get'](n),_0x4d901f=this['context']['plugins']['get']('CommentsRepository'),_0x18f006=this['_services']['get'](_0x591fae),_0x248fed=await _0x18f006['connect'](_0x8b2775);await this['_fetchMissingUsersForThreads'](_0x248fed);const _0x252f47=new Set(Array['from'](_0x4d901f['getCommentThreads']({'channelId':_0x591fae}),_0x4880a4=>_0x4880a4['id']));for(const _0x54d58a of _0x248fed)_0x54d58a['deletedAt']||_0x252f47['delete'](_0x54d58a['commentThreadId']);for(const _0x16c777 of _0x252f47)_0x4d901f['getCommentThread'](_0x16c777)['remove']({'isFromAdapter':!0x0});for(const _0x3e7e30 of _0x248fed){let _0x388dda=_0x4d901f['getCommentThread'](_0x3e7e30['commentThreadId']);const {commentThreadId:_0x131723,context:_0x38eecc,attributes:_0x29dc6f,resolvedBy:_0x13f83f,resolvedAt:_0x3a6446,unlinkedAt:_0x4dfd89,deletedAt:_0x2f9a95}=_0x3e7e30;if(_0x2f9a95)continue;_0x388dda||(_0x388dda=_0x4d901f['addCommentThread']({'channelId':_0x591fae,'threadId':_0x131723,'context':_0x38eecc,'attributes':_0x29dc6f||{},'resolvedBy':_0x13f83f,'resolvedAt':_0x3a6446,'unlinkedAt':_0x4dfd89,'isFromAdapter':!0x0}));const _0x5b06a4=new Set(Array['from'](_0x388dda['comments'],_0x37de67=>_0x37de67['id']));for(const _0x382b48 of _0x3e7e30['comments'])_0x5b06a4['delete'](_0x382b48['commentId']);for(const _0x4996e9 of _0x5b06a4)_0x388dda['getComment'](_0x4996e9)['remove']({'isFromAdapter':!0x0});for(const _0xbb489d of _0x3e7e30['comments']){const _0x5e6df5=_0x388dda['getComment'](_0xbb489d['commentId']);_0x5e6df5?_0x5e6df5['content']!==_0xbb489d['content']&&_0x5e6df5['update']({'content':_0xbb489d['content'],'isFromAdapter':!0x0}):_0x388dda['addComment'](Object['assign'](st(_0xbb489d),{'isFromAdapter':!0x0}));}}}['_getService'](_0x4420a2){if(!this['_services']['has'](_0x4420a2))throw new _0x5d33a2('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4420a2});return this['_services']['get'](_0x4420a2);}async['_fetchMissingUsersForThreads'](_0xb1c22a){const _0x4423ca=this['context']['plugins']['get'](_0x390b4e),{connection:_0x24c4f7}=this['context']['plugins']['get'](n),_0xfa8761=new Set();for(const {resolvedBy:_0x16bec5,comments:_0x3e092d}of _0xb1c22a){_0x16bec5&&!_0x4423ca['getUser'](_0x16bec5)&&_0xfa8761['add'](_0x16bec5);for(const {userId:_0x47d06d}of _0x3e092d)_0x4423ca['getUser'](_0x47d06d)||_0xfa8761['add'](_0x47d06d);}if(0x0===_0xfa8761['size'])return;const _0x3a2361=await ut['getMany'](_0x24c4f7,Array['from'](_0xfa8761));for(const _0x2b947c of _0x3a2361)_0x4423ca['getUser'](_0x2b947c['id'])||_0x4423ca['addUser'](_0x2b947c);}}async function ot(_0x4e6b47){if('404'!==_0x4e6b47['code'])throw _0x4e6b47;}function ft(_0xa5c4d3){if((_0x129f6c=_0xa5c4d3)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x129f6c['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x129f6c['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x129f6c;throw _0xa5c4d3;}function st(_0x1d0623){return{'threadId':_0x1d0623['commentThreadId'],'commentId':_0x1d0623['commentId'],'content':_0x1d0623['content'],'createdAt':_0x1d0623['createdAt'],'authorId':_0x1d0623['userId'],'attributes':_0x1d0623['attributes']||{}};}class m extends _0x3b44ca{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>_0x2a008e)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x390b4e];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x55294d){super(_0x55294d);const _0xc0ac8c=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0xc0ac8c);}async['init'](){const _0xad968b=this['editor']['plugins']['get'](l),_0x3ded57=_0xad968b['serverHistory'],_0x4fb6de=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x3ded57,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0xad968b['sessionId']});const _0x572a19=this['editor']['config']['get']('cloudServices.bundleVersion')||ht,_0x4d16c0=await _0x151793['isBundleUploaded'](_0x4fb6de['connection'],_0x572a19);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x3f7d13})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x3f7d13)),'updateRevisions':async _0x17a4ba=>{await this['_waitForServiceReady']();const _0x19f010=this['_revisionTracker']['currentRevision'];if(_0x4d16c0&&0x1===_0x17a4ba['length']&&_0x17a4ba[0x0]['id']===_0x19f010['id'])return _0x17a4ba;for(const _0x30abfe of _0x17a4ba)_0x30abfe['id']===_0x19f010['id']&&(_0x30abfe['isEmptyCurrent']=_0x30abfe['fromVersion']===_0x30abfe['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x17a4ba,this['_lastRequestId'])['then'](_0x3eaf62=>(this['_lastRequestId']=_0x3eaf62,_0x17a4ba))['catch'](_0x13ae71=>{if(P(_0x13ae71)||'400'===_0x13ae71['code']&&void 0x0!==_0x13ae71['data']['wrongRequestId']){for(const _0x1cbdc5 of _0x17a4ba){!this['_revisionTracker']['repository']['getRevision'](_0x1cbdc5['id'])||this['_revisionTracker']['_bufferUpdate'](_0x1cbdc5['id'],_0x1cbdc5,!0x1);}if(P(_0x13ae71))throw _0x13ae71;return _0x17a4ba;}throw _0x13ae71;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x43ea25,{revisionsData:_0x45b59b,requestId:_0x1338f5})=>{Math['max'](..._0x45b59b['map'](_0x547d34=>_0x547d34['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x45b59b,_0x1338f5);}):this['_handleRevisionsUpdate'](_0x45b59b,_0x1338f5);});const {revisions:_0x1b622c,requestId:_0x422e39}=await this['_revisionHistoryService']['connect'](_0x4fb6de['connection']);_0x4fb6de['addToReconnectionStack'](this),this['_lastRequestId']=_0x422e39,await this['_fetchMissingUsers'](_0x1b622c);for(const _0x4d9068 of _0x1b622c)this['_revisionTracker']['addRevisionData'](_0x4d9068);this['listenTo'](_0xad968b,'change:_isConnected',(_0x5a4882,_0x27e323,_0x45ce81)=>{_0x45ce81&&(this['_oldOffset']=_0xad968b['_offset'],_0x5a4882['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x4fb6de,'state',_0x3cf877=>_0x3cf877===_0x7cdbe8['CONNECTED']);}async['reconnect'](){const _0x5a986d=this['editor']['plugins']['get'](n),_0x160172=this['editor']['plugins']['get'](l),_0x3557b0=async()=>{const _0x3e07f0=this['_revisionTracker']['currentRevision'],_0x403899=_0x3e07f0['id'],_0x44d0b3=_0x403899!==_0x160172['sessionId'];if(_0x44d0b3){const _0x5b3123=_0x160172['_offset']-this['_oldOffset'],_0x29603e=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x3e07f0['toVersion']+_0x5b3123!==_0x29603e){const _0x360e1d=_0x3e07f0['fromVersion']+_0x5b3123,_0x57f92d=this['editor']['plugins']['get'](_0x390b4e),_0x5d9847=this['_revisionTracker']['buildRevisionData']({'revision':_0x3e07f0,'from':_0x360e1d,'to':_0x29603e});_0x5d9847['id']=_0x3e07f0['id'];const _0x45b05c=_0x5d9847['authorsIds']['map'](_0x24f85b=>_0x57f92d['getUser'](_0x24f85b));_0x3e07f0['_update']({..._0x5d9847,'authors':_0x45b05c},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x3e07f0['id'],_0x5d9847,!0x0);}this['_revisionTracker']['_startingVersion']=_0x29603e,(_0x3e07f0['toVersion']===_0x3e07f0['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x403899)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x403899),this['_revisionTracker']['_createCurrentRevision'](_0x29603e));}const {revisions:_0x84c60f,requestId:_0x1c55a7}=await this['_revisionHistoryService']['reconnect'](_0x5a986d['connection'],this['_lastRequestId']);_0x44d0b3&&_0x84c60f['length']>0x0?_0x160172['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x84c60f),this['_handleRevisionsUpdate'](_0x84c60f,_0x1c55a7),this['_revisionTracker']['sendBufferedUpdates']());};return _0x160172['_isConnected']?_0x3557b0():new Promise((_0x505a82,_0x5ef6b2)=>{_0x160172['once']('change:_isConnected',()=>{_0x3557b0()['then'](_0x505a82)['catch'](_0x5ef6b2);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x3a5c62=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5b743b=>{_0x5b743b['off'](),_0x3a5c62();});});}['_getLatestVersionFromServerOperations'](){const _0x2ee460=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x434880 of _0x2ee460)if('marker'!==_0x434880['type']||_0x434880['affectsData'])return _0x434880['baseVersion']+0x1;}['_getLatestVersion'](){const _0x37354f=this['editor']['plugins']['get'](l);return new Promise(_0x37a773=>{_0x37354f['_isPendingUpdate']?_0x37354f['once']('change:_isPendingUpdate',()=>{_0x37a773(this['_getLatestVersionFromServerOperations']());}):_0x37a773(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0xe7f295,_0x470d83){const _0x515bd0=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x470d83;for(const _0x124bd3 of _0xe7f295){const _0x41bcd1=_0x515bd0['getRevision'](_0x124bd3['id']);if(_0x41bcd1){if((_0x124bd3['fromVersion']||_0x124bd3['toVersion'])&&(_0x124bd3['diffData']=null),_0x41bcd1===this['_revisionTracker']['currentRevision']){const _0x2d68b4=Math['max'](_0x41bcd1['toVersion'],_0x124bd3['toVersion']),_0x2fee01=Math['max'](_0x41bcd1['fromVersion'],_0x124bd3['fromVersion']);let _0x2708d0;_0x41bcd1['toVersion']===_0x124bd3['toVersion']&&_0x41bcd1['fromVersion']===_0x124bd3['fromVersion']?(_0x2708d0=!0x0,this['_preventResendingRevisionData'](_0x124bd3)):_0x124bd3['toVersion']===_0x2d68b4&&_0x124bd3['fromVersion']===_0x2fee01?_0x2708d0=!0x1:(_0x41bcd1['toVersion']===_0x2d68b4&&_0x41bcd1['fromVersion']===_0x2fee01||this['_fixRevision']({'revision':_0x41bcd1,'from':_0x2fee01,'to':_0x2d68b4}),_0x2708d0=!0x0),_0x2708d0&&(delete _0x124bd3['fromVersion'],delete _0x124bd3['toVersion'],delete _0x124bd3['diffData'],delete _0x124bd3['createdAt'],delete _0x124bd3['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x124bd3),this['_preventResendingRevisionData'](_0x124bd3);}else this['_revisionTracker']['addRevisionData'](_0x124bd3);}const _0xbd9fcb=_0x515bd0['getRevisions']();_0xbd9fcb['reverse']();for(let _0x22d120=0x0;_0x22d120<_0xbd9fcb['length']-0x1;_0x22d120++){const _0x2cca6f=_0xbd9fcb[_0x22d120],_0x4c9441=_0xbd9fcb[_0x22d120+0x1];if(_0x2cca6f['fromVersion']<_0x4c9441['toVersion']){const _0x26aa82=_0x4c9441['toVersion'],_0x133e30=Math['max'](_0x26aa82,_0x2cca6f['toVersion']);this['_fixRevision']({'revision':_0x2cca6f,'from':_0x26aa82,'to':_0x133e30});}}}['_fixRevision']({revision:_0x3229d0,from:_0x195dba,to:_0x5dfc8c}={}){const _0x7b9988=this['editor']['plugins']['get'](_0x390b4e),_0x55fda9=this['_revisionTracker']['buildRevisionData']({'revision':_0x3229d0,'from':_0x195dba,'to':_0x5dfc8c});_0x55fda9['authors']=_0x55fda9['authorsIds']['map'](_0x47acc7=>_0x7b9988['getUser'](_0x47acc7)),_0x3229d0['_update'](_0x55fda9);}['_preventResendingRevisionData'](_0x51497e){const _0x3a1700={};_0x3a1700['id']=_0x51497e['id'];for(const _0x4c9ee1 of Object['keys'](_0x51497e))'id'!==_0x4c9ee1&&(_0x3a1700[_0x4c9ee1]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x3a1700['id'],_0x3a1700,!0x0);}async['_fetchMissingUsers'](_0x2928a0){const _0x1e7742=this['editor']['plugins']['get'](_0x390b4e),{connection:_0x3444c4}=this['editor']['plugins']['get'](n),_0x5af313=new Set();for(const _0x127f59 of _0x2928a0){for(const _0x243103 of _0x127f59['authorsIds'])_0x443f50(_0x243103);_0x127f59['creatorId']&&_0x443f50(_0x127f59['creatorId']);}if(0x0===_0x5af313['size'])return;const _0x2faab7=await ut['getMany'](_0x3444c4,Array['from'](_0x5af313));for(const _0x5f3c73 of _0x2faab7)_0x1e7742['getUser'](_0x5f3c73['id'])||_0x1e7742['addUser'](_0x5f3c73);function _0x443f50(_0x298cc0){_0x1e7742['getUser'](_0x298cc0)||_0x5af313['add'](_0x298cc0);}}}function P(_0x47c788){return _0x47c788['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x47c788['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x47c788['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class gt extends _0x3b44ca{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class b extends _0x172d9c{['_collapseAt'];constructor(_0x55db27,_0x794449=0x6){super(_0x55db27);const _0x32c210=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x794449,this['bind']('isHidden')['to'](this,'usersCount',_0x18d4f3=>_0x18d4f3<_0x794449),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x32c210['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':_0x32c210['to']('usersCount',_0x292161=>'+'+(_0x292161-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x172d9c{['items'];['keystrokes'];constructor(_0x2b30d7){super(_0x2b30d7);const _0x4b7b02=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x3afe3d(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x4b7b02['if']('hasPopup'),'aria-expanded':_0x4b7b02['to']('isExpanded',_0x57c0d4=>this['hasPopup']&&String(_0x57c0d4)),'aria-label':_0x4b7b02['to']('hasPopup',_0x3632bd=>V(_0x2b30d7,_0x3632bd?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x4b7b02['to']('hasPopup',_0x16d0ca=>!!_0x16d0ca&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x4b7b02['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x4b7b02['to'](_0x3c58a7=>{const _0x239d38=_0x3c58a7,_0x2f65b7=document['querySelector']('.ck-presence-list__dropdown-list'),_0x227a1a=document['querySelector']('.ck-balloon-panel_with-arrow');_0x2f65b7?.['contains'](_0x239d38['relatedTarget'])||_0x227a1a?.['contains'](_0x239d38['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0xf3e8ba,_0x4451aa,_0x289d7b)=>{this['element']&&(_0x289d7b?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class v extends _0x172d9c{['counterView'];['inlineListView'];constructor(_0xa19d42,_0x2b162a=0x6){super(_0xa19d42);const _0x300c79=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new b(this['locale'],_0x2b162a),this['inlineListView']=new is(_0xa19d42),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x3edac8 of this['inlineListView']['items'])_0x3edac8['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',_0x300c79['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class L extends _0x172d9c{['listWrapperView'];constructor(_0xe13da0,_0x2838f7){super(_0xe13da0);const _0x4bc6b4=this['bindTemplate'];this['listWrapperView']=new wt(_0xe13da0,_0x2838f7),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':V(_0xe13da0,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x4bc6b4['to'](_0x2962b6=>{const _0x19c2cd=_0x2962b6,_0x323d42=document['querySelector']('.ck-presence-list__list'),_0x4f0ab5=document['querySelector']('.ck-balloon-panel_with-arrow');_0x323d42?.['contains'](_0x19c2cd['relatedTarget'])||_0x4f0ab5?.['contains'](_0x19c2cd['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class wt extends _0x12028f{constructor(_0xc4ae3d,_0x349bd2){super(_0xc4ae3d);const _0x58c9ef=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x349bd2?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x58c9ef['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x58c9ef['to']('role'),'aria-label':_0x58c9ef['to']('ariaLabel'),'aria-labelledby':_0x58c9ef['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x2321a2['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x58c4d2=this['element'];_0x58c4d2&&(this['_isScrollable']=Math['max'](_0x58c4d2['scrollHeight'],_0x58c4d2['clientHeight'])>0.8*window['innerHeight']);}}class j extends rt{['userView'];constructor(_0x5611a1,_0x5156a5,_0x26e231){super(_0x5611a1);const _0xfa7301=this['bindTemplate'];this['userView']=new ct(_0x5611a1,_0x5156a5);const _0x3eb0d0={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5156a5['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5156a5['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5156a5['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x26e231&&(_0x3eb0d0['tag']='button',_0x3eb0d0['on']={'click':_0xfa7301['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x3eb0d0);}['focus'](){this['element']['focus']();}}class A extends _0x172d9c{['userView'];['markerView'];constructor(_0x334078,_0x2351ce,_0x77cbeb){super(_0x334078);const _0x4d2f19=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x334078,_0x2351ce),this['markerView']=new lt(_0x334078,_0x2351ce);const _0x50f26f=new at(_0x334078);_0x50f26f['template']['tag']='span',_0x50f26f['text']=_0x2351ce['name'];const _0x1d62dc={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x4d2f19['to']('isFocusable',_0xd83d16=>!!_0xd83d16&&0x0),'aria-labelledby':_0x50f26f['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x4d2f19['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x4d2f19['to']('hasTooltip',_0x4a579a=>!_0x4a579a),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x50f26f]};_0x77cbeb&&(_0x1d62dc['tag']='button',_0x1d62dc['on']={'click':_0x4d2f19['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1d62dc);}}class lt extends _0x172d9c{constructor(_0x20d9bf,_0x3ab7e5){super(_0x20d9bf),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3ab7e5['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const x={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x3c0204{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x167d53){super(_0x167d53),this['context']['config']['define']('presenceList',x);const _0xb5ce1f=_0x167d53['config']['get']('presenceList.collapseAt');if('number'!=typeof _0xb5ce1f)throw new _0x5d33a2('presencelist-collapseat-invalid-format',this);if(_0xb5ce1f<0x1)throw new _0x5d33a2('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x457aeb(),this['balloonPanelView']=new _0x2e678e(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x116c42 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x116c42);this['listenTo'](this['_allConnectedUsers'],'add',(_0x17f053,_0x4923f2)=>{this['_handleUserAdd'](_0x4923f2);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3dbe1f,_0x4b6397)=>{this['_handleUserRemove'](_0x4b6397);});}['_createView'](){const _0x50b2b6=this['context'],_0x5f17f7=new v(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x2b3095=this['balloonPanelView'];if(!_0x1378a2(_0x50b2b6['config']['get']('presenceList.container')))throw new _0x5d33a2('presencelist-missing-container',this);return _0x5f17f7['counterView']['bind']('usersCount')['to'](this),_0x5f17f7['bind']('isCollapsed')['to'](this,'usersCount',_0x33c013=>{const {collapseAt:_0x148f7e}=_0x50b2b6['config']['get']('presenceList'),_0x31c296=_0x33c013>=_0x148f7e;if(_0x31c296&&!_0x5f17f7['inlineListView']['items']['find'](_0x14f3f6=>_0x14f3f6 instanceof b)){const _0x552874=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x552874&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x5f17f7['inlineListView']['items']['add'](_0x5f17f7['counterView']);}return _0x31c296||this['hideDropdown'](),_0x31c296;}),_0x5f17f7['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x189834=>{const _0x489bb9=_0x50b2b6['config']['get']('presenceList'),_0x38110d=new A(_0x50b2b6['locale'],_0x189834,!!_0x489bb9['onClick']);return _0x38110d['bind']('hasTooltip')['to'](_0x5f17f7,'isCollapsed',_0x47373a=>!_0x47373a),_0x38110d['bind']('isFocusable')['to'](_0x5f17f7,'isCollapsed',_0x295142=>!_0x295142),_0x489bb9['onClick']&&this['listenTo'](_0x38110d,'execute',()=>{this['view']['isCollapsed']||_0x489bb9['onClick'](_0x189834,_0x38110d['element']);}),_0x38110d;}),this['listenTo'](_0x5f17f7['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x5f17f7['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x5f17f7['inlineListView']['keystrokes']['set']('Enter',(_0x3970b9,_0x34d7ed)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x34d7ed());}),_0x5f17f7['render'](),_0x2b3095['render'](),_0x27fd0e({'emitter':_0x5f17f7,'activator':()=>_0x2b3095['isVisible'],'contextElements':[_0x2b3095['element'],_0x5f17f7['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x50b2b6['config']['get']('presenceList.container')['appendChild'](_0x5f17f7['element']),this['_bodyCollection']=new _0x4cb225(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x5f17f7;}['_handleUserAdd'](_0x411fe0){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x411fe0['isMe'])return;const _0x59fd9a=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x59fd9a-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x5a2ddf=_0x411fe0['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x411fe0,_0x5a2ddf);}['_handleUserRemove'](_0x4cf33a){this['usersCount']--;const {collapseAt:_0x590167}=this['context']['config']['get']('presenceList'),_0x37cdf9=this['usersCount']>=_0x590167;if(this['currentDisplayedUsers']['get'](_0x4cf33a['id']))this['currentDisplayedUsers']['remove'](_0x4cf33a['id']);else{if(_0x37cdf9&&this['currentDisplayedUsers']['length']+0x1===_0x590167-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x37cdf9?0x1:0x0)<this['usersCount']){for(const _0x34b646 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x34b646['id'])&&(this['currentDisplayedUsers']['add'](_0x34b646,Math['min'](this['currentDisplayedUsers']['length']-(_0x37cdf9?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x37cdf9?0x1:0x0)===_0x590167-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x405445=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new L(this['context']['locale'],!!_0x405445['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x4dde7a}=this['presenceDropdownView'];_0x4dde7a['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x622d92=>{if(!_0x405445['displayMe']&&_0x622d92['isMe'])return null;const _0x5ebf56=new j(this['context']['locale'],_0x622d92,!!_0x405445['onClick']);return _0x405445['onClick']&&this['listenTo'](_0x5ebf56,'execute',()=>{_0x405445['onClick'](_0x622d92,_0x5ebf56['element']);}),_0x5ebf56;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x4dde7a['focus'](),_0x4dde7a['checkIfScrollable']();const _0x18efac=(_0x5404a2,_0x4b0245)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x4b0245();};_0x4dde7a['keystrokes']['set']('Esc',_0x18efac),_0x4dde7a['keystrokes']['set']('Shift+Tab',_0x18efac),_0x4dde7a['keystrokes']['set']('Tab',(_0x20fa89,_0x5a3b7f)=>{!function(_0x5eb0c3){const _0x1c6c0a=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x305c7b=>_0x305c7b+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x5d3433=[...document['body']['querySelectorAll'](_0x1c6c0a)]['filter'](_0x55dac1=>_0x55dac1===document['activeElement']||_0x55dac1['offsetWidth']+_0x55dac1['offsetHeight']>0x0)['sort']((_0x2d367e,_0x48d777)=>(_0x2d367e['tabIndex']||0x0)-(_0x48d777['tabIndex']||0x0)),_0x578239=_0x5d3433['indexOf'](_0x5eb0c3),_0x29bb96=_0x5d3433[(_0x578239+0x1)%_0x5d3433['length']];_0x29bb96&&_0x29bb96['focus']();}(this['view']['element']),this['hideDropdown'](),_0x5a3b7f();}),_0x4dde7a['focusTracker']['add'](this['view']['element']),_0x4dde7a['focusTracker']['on']('change:isFocused',(_0x3d07af,_0x48c493,_0x11aaff)=>{_0x11aaff||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class vt extends _0x3c0204{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,vt as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,pt as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway,L as _RtcPresenceDropdownListView,wt as _RtcPresenceDropdownListWrapperView,v as _RtcPresenceListView};
|
|
23
|
+
import{ContextPlugin as _0x9e975b,Plugin as _0x4a0bed,PendingActions as _0x41c5b4,Context as _0x531905}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x12f71d,CKEditorError as _0x54c6c0,Collection as _0x16c371,global as _0x42123c,version as nt,uid as _0x2761ba,KeystrokeHandler as _0x48aed2}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x57f6fb,View as _0x54ed70,ListView as _0x193b34,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x151f25,clickOutsideHandler as _0xe3a062,BodyCollection as _0x2b34c6}from'@ckeditor/ckeditor5-ui/dist/index.js';import{ModelLiveRange as _0x338c17,History as _0x191abb,NoOperation as _0x69b68f,InsertOperation as _0x41cf28,MarkerOperation as _0x2383be,RootAttributeOperation as _0x587080,transformOperationSets as _0x315a78,OperationFactory as _0xdad854}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as ht,WEB_SOCKET_GATEWAY_STATES as te,CollaborativeEditingService as _0x3865c5,User as lt,CommentsService as _0x58dead,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x1a686c,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x5d84a9}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x208f32}from'es-toolkit/compat';class n extends _0x9e975b{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>ht)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x57f6fb];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x252fc7){super(_0x252fc7),this['set']('state',te['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x12f71d())();}['init'](){const _0xbd20d2=this['context'],_0x257297=_0xbd20d2['plugins']['get']('CloudServices'),_0xa0128a=_0xbd20d2['plugins']['get'](_0x57f6fb);if(!_0x257297['token'])throw new _0x54c6c0('websocketgateway-missing-token',this);if(!_0x257297['webSocketUrl'])throw new _0x54c6c0('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),n['WebSocketGateway']['connect'](_0x257297['token'],_0x257297['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x3859a9=>{if(this['connection']=_0x3859a9,this['bind']('state')['to'](_0x3859a9,'state',this,'_isBrowserOffline',(_0x207c65,_0x59e8ba)=>('connected'!==_0x207c65&&(this['_shouldPluginsReconnect']=!0x0),_0x59e8ba||_0x207c65!==te['CONNECTED']?te['DISCONNECTED']:this['state']==te['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),te['CONNECTING']):te['CONNECTED'])),this['connection']['on']('error',(_0x52d633,_0x4d1e6f)=>{if('limitExceeded'!==_0x4d1e6f['code'])throw console['error'](_0x4d1e6f),new _0x54c6c0('cloudservices-init',null,{'originalError':_0x4d1e6f});_0xa0128a['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'});}),!_0x3859a9['me'])return new Promise(_0x201dd0=>_0x3859a9['on']('change:me',_0x201dd0));})['catch'](_0x54e50f=>{throw console['error'](_0x54e50f),new _0x54c6c0('cloudservices-init',null,{'originalError':_0x54e50f});});}['addToReconnectionStack'](_0x493750){if('function'!=typeof _0x493750['reconnect'])throw new _0x54c6c0('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x493750))throw new _0x54c6c0('websocketgateway-plugin-already-registered',this,{'name':_0x493750['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x493750);}['removeFromReconnectionStack'](_0x26e417){this['_reconnectionStack']['delete'](_0x26e417);}['isInReconnectionStack'](_0x23c39a){return this['_reconnectionStack']['has'](_0x23c39a);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x1d5cb5=>_0x1d5cb5['reconnect']())))['then'](()=>this['state']=te['CONNECTED'])['catch'](_0x22d043=>{throw console['error'](_0x22d043),new _0x54c6c0('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=te['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x9e975b{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[n,_0x1a686c];}constructor(_0x265dc7){super(_0x265dc7),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x16c371(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1a686c);}['init'](){const _0x5f0d3e=this['context']['plugins']['get'](n);this['listenTo'](_0x5f0d3e,'change:state',(_0x71a846,_0x301bf7,_0x4c550a)=>{if('connected'!==_0x4c550a)this['channelSessions']['forEach'](_0x52f0b2=>_0x52f0b2['clear']()),this['channelConnectedUsers']['forEach'](_0x27f3c1=>_0x27f3c1['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x389b25,_0x2ed96b]of this['_registeredSessions'])for(const _0x2f3d20 of _0x2ed96b)this['_handleSessionAdd'](_0x389b25,_0x2f3d20);}}),this['_createUser'](_0x5f0d3e['connection']['me'],!0x0);}['register'](_0x4bd0d1,_0xe0f81e){if(this['_registeredSessions']['has'](_0x4bd0d1))throw new _0x54c6c0('sessions-register-already-registered',null,{'channelId':_0x4bd0d1});this['_registeredSessions']['set'](_0x4bd0d1,_0xe0f81e),this['channelSessions']['set'](_0x4bd0d1,new _0x16c371()),this['channelConnectedUsers']['set'](_0x4bd0d1,new _0x16c371()),this['listenTo'](_0xe0f81e,'add',(_0x9dfbf8,_0x387eda)=>this['_handleSessionAdd'](_0x4bd0d1,_0x387eda)),this['listenTo'](_0xe0f81e,'remove',(_0x5c5942,_0x3ee480)=>this['_handleSessionRemove'](_0x4bd0d1,_0x3ee480));for(const _0x288c42 of _0xe0f81e)this['_handleSessionAdd'](_0x4bd0d1,_0x288c42);}['unregister'](_0x3d3d94){if(!this['_registeredSessions']['has'](_0x3d3d94))throw new _0x54c6c0('sessions-unregister-not-exist',null,{'channelId':_0x3d3d94});const _0x4dc939=this['_registeredSessions']['get'](_0x3d3d94);this['stopListening'](_0x4dc939);for(const _0x1c6512 of _0x4dc939)'connected'===this['context']['plugins']['get'](n)['state']&&this['_handleSessionRemove'](_0x3d3d94,_0x1c6512);this['_registeredSessions']['delete'](_0x3d3d94),this['channelSessions']['delete'](_0x3d3d94),this['channelConnectedUsers']['delete'](_0x3d3d94);}get['mySessionId'](){return this['context']['plugins']['get'](n)['connection']['sessionId'];}['getUserBySessionId'](_0x169a0e){for(const _0x2b972d of this['channelSessions']['values']())for(const _0x30a4bc of _0x2b972d)if(_0x30a4bc['id']===_0x169a0e)return _0x30a4bc['user'];}['getUserSessions'](_0x5e611e,_0x57dfea){const _0x405d78=_0x57dfea?[this['channelSessions']['get'](_0x57dfea)]:this['channelSessions']['values'](),_0x4ca4a7=new Set();for(const _0x12eeb3 of _0x405d78)for(const _0x26e717 of _0x12eeb3)_0x26e717['user']['id']===_0x5e611e['id']&&_0x4ca4a7['add'](_0x26e717['id']);return _0x4ca4a7;}['getUserRole'](_0x9ccb09){for(const _0x432b7d of this['channelSessions']['values']())for(const _0x2d4900 of _0x432b7d)if(_0x2d4900['user']===_0x9ccb09)return _0x2d4900['role'];}['_handleSessionAdd'](_0x5a16c4,_0x342938){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x5c635e=_0x342938['user'],_0x4162ab=this['_users']['getUser'](_0x5c635e['id'])||this['_createUser'](_0x5c635e),_0x29d8ba=Object['assign']({},_0x342938,{'user':_0x4162ab});this['channelSessions']['get'](_0x5a16c4)['add'](_0x29d8ba);const _0x16cc46=this['channelConnectedUsers']['get'](_0x5a16c4);_0x16cc46['has'](_0x4162ab['id'])||_0x16cc46['add'](_0x4162ab),this['allConnectedUsers']['has'](_0x4162ab['id'])||this['allConnectedUsers']['add'](_0x4162ab,_0x4162ab['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x5a16c4,{'channelId':_0x5a16c4,'session':_0x29d8ba});}['_handleSessionRemove'](_0x2e1d67,_0x127217){if('connected'!==this['context']['plugins']['get'](n)['state'])return;const _0x248b72=this['channelConnectedUsers']['get'](_0x2e1d67),_0xa46c4f=_0x127217['user'];_0xa46c4f['id']&&(this['channelSessions']['get'](_0x2e1d67)['remove'](_0x127217['id']),_0x248b72['has'](_0xa46c4f['id'])&&!this['getUserSessions'](_0xa46c4f,_0x2e1d67)['size']&&_0x248b72['remove'](_0xa46c4f['id']),this['allConnectedUsers']['get'](_0xa46c4f['id'])&&!this['getUserSessions'](_0xa46c4f)['size']&&this['allConnectedUsers']['remove'](_0xa46c4f['id']));}['_createUser'](_0x16fc23,_0x26c708){const _0x6abb21=this['_users']['addUser'](_0x16fc23);return _0x26c708&&this['_users']['defineMe'](_0x16fc23['id']),_0x6abb21['orderNumber']=this['_uniqueUsersCount']++,_0x6abb21;}}class V extends _0x4a0bed{['_domEmitter']=new(_0x12f71d())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x7ba431=this['editor'],_0x207da3=_0x7ba431['plugins']['get'](i);_0x7ba431['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x2dd6e5,{writer:_0x203672})=>function(_0xc2c6c2,_0x433c16,_0x49ae82,_0xbcda92){const _0x138984=_0xc2c6c2['markerName']['split'](':')[0x2],_0x526f68=_0x49ae82['getUserBySessionId'](_0x138984);if(!_0x526f68||_0x138984===_0x49ae82['mySessionId'])return;if(!_0xbcda92['model']['schema']['checkChild'](_0xc2c6c2['markerRange']['start'],'$text'))return;const _0xac44e9={'class':'ck-user__marker\x20'+_0x526f68['color']['getMarkerClass'](),'data-name':_0x526f68['name'],'data-session-id':_0x138984},_0x12c7a5=_0xbcda92['model']['markers']['get'](_0xc2c6c2['markerName']),_0x210b9d=_0x12c7a5['getStart'](),_0x1d6a8f=_0x210b9d['nodeAfter'],_0x8e21be=_0xbcda92['model']['schema'];if(_0x1d6a8f&&_0x8e21be['isObject'](_0x1d6a8f)&&_0x8e21be['isInline'](_0x1d6a8f)&&!_0xbcda92['model']['markers']['get']('user:range:'+_0x138984)['getRange']()['isCollapsed'])return;const _0x3908ad=_0x210b9d['parent'];return _0xbcda92['model']['schema']['isLimit'](_0x3908ad)&&!_0xbcda92['model']['hasContent'](_0x3908ad)&&(_0xac44e9['contenteditable']=!0x1),function(_0x10d053,_0x9662c4,_0x22e8f8){const _0x36e1b2=_0x10d053['createUIElement']('span',_0x9662c4);return _0x10d053['setCustomProperty']('userPositionMarker',!0x0,_0x36e1b2),_0x36e1b2['render']=function(_0x2999ee){const _0x3c1a1c=this['toDomElement'](_0x2999ee),_0x16028c=document['createElement']('span');return _0x16028c['classList']['add']('ck-user__marker-tooltip'),_0x16028c['setAttribute']('contenteditable','false'),_0x16028c['setAttribute']('spellcheck','false'),_0x16028c['textContent']=_0x22e8f8['name'],_0x3c1a1c['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x16028c['outerHTML']+'',_0x3c1a1c['addEventListener']('mouseenter',()=>{_0x3c1a1c['classList']['add']('ck-user__marker_hovered');}),_0x3c1a1c['addEventListener']('mouseleave',()=>{_0x3c1a1c['classList']['remove']('ck-user__marker_hovered');}),_0x3c1a1c;},_0x36e1b2['isSimilar']=function(_0x20f387){return!(!this['getCustomProperty']('userPositionMarker')||!_0x20f387['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x20f387['getAttribute']('data-session-id'));},_0x36e1b2;}(_0x433c16,_0xac44e9,_0x526f68);}(_0x2dd6e5,_0x203672,_0x207da3,_0x7ba431)}),_0x7ba431['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x49e3f6=>function(_0x570b4f,_0x9c532b){const _0x49bbb5=_0x570b4f['markerName']['split'](':')[0x2];if(_0x49bbb5===_0x9c532b['mySessionId'])return null;const _0x100d1d=_0x9c532b['getUserBySessionId'](_0x49bbb5);if(!_0x100d1d)return{'id':_0x49bbb5,'classes':[]};return{'id':_0x49bbb5,'classes':['ck-user__selection',_0x100d1d['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x49bbb5},'priority':0x7d0+_0x100d1d['orderNumber']};}(_0x49e3f6,_0x207da3)}),function(_0x259896){const _0x55029b=_0x259896['model'],_0x45515d=new Map(),_0x54b29e=_0x259896['plugins']['get'](i);_0x55029b['markers']['on']('update:user:range',(_0x2e8982,_0x199f2e,_0x30b0c3,_0x2c3b1e)=>{if(!_0x2c3b1e&&_0x45515d['get'](_0x199f2e['name']))return _0x45515d['get'](_0x199f2e['name'])['detach'](),void _0x45515d['delete'](_0x199f2e['name']);const _0x3f3af7=_0x199f2e['name']['split'](':')[0x2];if(_0x3f3af7===_0x54b29e['mySessionId'])return;const _0x2802c9='user:position:'+_0x3f3af7;_0x55029b['markers']['has'](_0x2802c9)&&_0x259896['editing']['reconvertMarker'](_0x2802c9),_0x199f2e['on']('change:range',(_0x457682,_0x26bac3,_0x387baf)=>{if('$graveyard'!=_0x26bac3['root']['rootName']&&'$graveyard'==_0x199f2e['getRange']()['root']['rootName']&&!_0x45515d['has'](_0x199f2e['name'])){const _0x44bc07=_0x55029b['schema']['getNearestSelectionRange'](_0x387baf['deletionPosition']);if(_0x44bc07){const _0x418148=_0x338c17['fromRange'](_0x44bc07);_0x45515d['set'](_0x199f2e['name'],_0x418148),_0x418148['on']('change:range',(_0x558ec4,_0x157f8d,_0xe1f2e)=>{if('$graveyard'==_0x418148['root']['rootName']){const _0x92e28e=_0x55029b['schema']['getNearestSelectionRange'](_0xe1f2e['deletionPosition']);_0x92e28e?(_0x418148['start']=_0x92e28e['start'],_0x418148['end']=_0x92e28e['end']):(_0x45515d['delete'](_0x199f2e['name']),_0x418148['detach']());}});}}});}),_0x55029b['document']['on']('change',()=>{_0x45515d['size']>0x0&&_0x55029b['enqueueChange']({'isUndoable':!0x1},_0xd06211=>{for(const [_0x1e773d,_0x4c27e0]of _0x45515d)'$graveyard'==_0x55029b['markers']['get'](_0x1e773d)['getRange']()['root']['rootName']&&(Z(_0x1e773d['split'](':')[0x2],_0x4c27e0['toRange'](),_0x55029b,_0xd06211),_0x4c27e0['detach']());_0x45515d['clear']();});});}(_0x7ba431),this['_domEmitter']['listenTo'](_0x42123c['document'],'keydown',(_0x15ca46,{key:_0x1750c2})=>{'Escape'===_0x1750c2&&function(_0x288a07){_0x288a07['editing']['view']['change'](_0x21b398=>{for(const _0x1071ef of _0x288a07['model']['markers']){if(!_0x1071ef['name']['startsWith']('user:position'))continue;const _0x576203=_0x288a07['editing']['mapper']['markerNameToElements'](_0x1071ef['name']);if(_0x576203){for(const _0x31c376 of _0x576203)_0x21b398['removeClass']('ck-user__marker_hovered',_0x31c376);}}});}(_0x7ba431);},{'useCapture':!0x0});}['afterInit'](){const _0x9f50d0=this['editor'],_0x9d6dc9=_0x9f50d0['commands']['get']('undo');_0x9d6dc9&&_0x9f50d0['model']['on']('applyOperation',(_0x3a86c1,_0x1c6ecf)=>{const _0x2bfce9=_0x1c6ecf[0x0];if(!_0x2bfce9['isDocumentOperation'])return;if('marker'!=_0x2bfce9['type']||!_0x2bfce9['name']['startsWith']('user:'))return;const _0x551b4d=_0x2bfce9['batch'];_0x9d6dc9['_createdBatches']['has'](_0x551b4d)&&(_0x2bfce9['newRange']=_0x2bfce9['oldRange']?_0x9f50d0['model']['createRange'](_0x2bfce9['oldRange']['start'],_0x2bfce9['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0xbf764=this['editor'],_0x1c0444=_0xbf764['model']['document'],_0x63fe6b=_0xbf764['plugins']['get'](i);_0xbf764['model']['enqueueChange']({'isUndoable':!0x1},_0x384936=>{const _0x35fdda='user:range:'+_0x63fe6b['mySessionId'],_0x44fbfc='user:position:'+_0x63fe6b['mySessionId'],_0x48a201=_0xbf764['model']['markers']['has'](_0x35fdda);_0xbf764['editing']['view']['hasDomSelection']?Z(_0x63fe6b['mySessionId'],_0x1c0444['selection']['getFirstRange'](),_0xbf764['model'],_0x384936):_0x48a201&&(_0x384936['removeMarker'](_0x35fdda),_0x384936['removeMarker'](_0x44fbfc));});}}function Z(_0x4118e0,_0x58ea91,_0x536b88,_0x40d3c2){const _0x2315f3='user:range:'+_0x4118e0,_0xbd009d='user:position:'+_0x4118e0,_0x33f758=_0x58ea91['getContainedElement']();let _0x28615b=_0x58ea91['start'];if(_0x33f758&&_0x33f758['is']('element','tableCell')){const _0x240b89=function(_0x6d4960,_0x1365ac){for(const _0x36dc85 of _0x6d4960['getPositions']())if(_0x1365ac['schema']['checkChild'](_0x36dc85,'$text'))return _0x36dc85;}(_0x58ea91,_0x536b88);_0x240b89&&(_0x28615b=_0x240b89,_0x58ea91=_0x40d3c2['createRange'](_0x28615b));}const _0x4d30b4=_0x40d3c2['createRange'](_0x28615b);_0x536b88['markers']['has'](_0x2315f3)?(_0x40d3c2['updateMarker'](_0x2315f3,{'range':_0x58ea91}),_0x40d3c2['updateMarker'](_0xbd009d,{'range':_0x4d30b4})):(_0x40d3c2['addMarker'](_0x2315f3,{'range':_0x58ea91,'usingOperation':!0x0}),_0x40d3c2['addMarker'](_0xbd009d,{'range':_0x4d30b4,'usingOperation':!0x0}));}function W(_0x72d52a,_0x111b97,_0x544137){const _0x19a6d2=_0x72d52a['t'],t=_0x72d52a['t'];switch(_0x111b97){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 _0x19a6d2({'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'},_0x544137);default:return'';}}let G=0x1;class l extends _0x4a0bed{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x3865c5)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[n,i,V,_0x41c5b4,_0x1a686c,_0x57f6fb];}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 _0x342389=this['serverHistory']['getOperations']();for(let _0x3f68c2=_0x342389['length']-0x1;_0x3f68c2>=0x0;_0x3f68c2--){const _0x3bfcba=_0x342389[_0x3f68c2];if(!this['_disconnectionOperations']['has'](_0x3bfcba))return _0x3bfcba['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x41b108){if(super(_0x41b108),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x191abb(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x54c6c0('collaboration-missing-channelid',this);const _0xe4f75d=_0x41b108['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0xe4f75d,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x5d84a9(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new J(this['_disconnectionOperations']);}['init'](){const _0x19f607=this['editor'],_0x129dec=_0x19f607['plugins']['get'](_0x1a686c),_0x2164bc=_0x19f607['plugins']['get'](n);this['listenTo'](_0x129dec,'getOperationAuthor',(_0x3b91d6,_0x463aeb)=>{const _0x3b18c6=_0x463aeb[0x0];_0x3b18c6['_authorId']&&(_0x3b91d6['return']=_0x129dec['getUser'](_0x3b18c6['_authorId']),_0x3b91d6['stop']()),null===_0x3b18c6['_authorId']&&(_0x3b91d6['return']=null,_0x3b91d6['stop']());},{'priority':'high'}),this['listenTo'](_0x19f607['model']['document']['selection'],'change:range',(_0x823568,_0x9c193b)=>{_0x9c193b['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x19f607['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x19f607['model']['on']('applyOperation',(_0x134c5e,_0x1bccea)=>{const _0x489225=_0x1bccea[0x0];_0x489225['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x489225),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x2164bc,'state',this,'_hasSynchronizationProblem',(_0x2e710c,_0x1e49be)=>'connected'===_0x2e710c&&!_0x1e49be),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x19f607['disableReadOnlyMode']('rtc-offline'):_0x19f607['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x19f607['disableReadOnlyMode']('rtc-offline'):_0x19f607['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x42de65=this['editor']['plugins']['get'](i),_0x2d089b=this['editor']['plugins']['get'](n);try{this['_isPendingUpdate']=!0x0,_0x42de65['unregister'](this['_channelId']);const _0x2c0b21=await this['_service']['reconnect'](_0x2d089b['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x2c0b21)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x485c7f=await this['_service']['getConnectedSessions']();_0x42de65['register'](this['_channelId'],_0x485c7f),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x104ee0){if(function(_0xb7fe83){return'404'===_0xb7fe83['code'];}(_0x104ee0)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x400df7){return'409'===_0x400df7['code'];}(_0x104ee0)){const _0x574571=W(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'](_0x574571);}else{if(!(_0x104ee0 instanceof $))throw _0x104ee0;this['_handleReconnectionError']();}}}}['destroy'](){const _0x5050fe=this['editor']['plugins']['get'](n),_0x132cbd=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x132cbd['channelSessions']['has'](this['_channelId'])&&_0x132cbd['unregister'](this['_channelId']),_0x5050fe['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x4568d9){if(this['sessionId']!==_0x4568d9['sessionId']&&this['_lastSyncedOperationId']!==_0x4568d9['lastOperationId'])throw new $();return this['sessionId']=_0x4568d9['sessionId'],this['_handleServerResponse']([],{..._0x4568d9,'wereChangesApplied':!0x1,'data':_0x4568d9['data']},'reconnect');}async['_connectService'](_0x2ac479,_0x1cd7ae=!0x1){const {connection:_0x29cba1}=this['editor']['plugins']['get'](n);l['CollaborativeEditingService']['getConnectedSessions'](_0x29cba1,this['_channelId'])['then'](_0x29abce=>this['_initSessionsHandling'](_0x29abce))['catch'](_0x4c6fa6=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x4c6fa6);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x5ef5ae,_0x4dde6f)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x4dde6f);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x5b717c=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2ac479);this['_isPendingUpdate']=!0x0;const _0x45b490=await this['_service']['connect'](_0x29cba1,this['_compressOperations'](_0x2ac479),_0x5b717c);if(this['sessionId']=_0x45b490['sessionId'],_0x1cd7ae){if(!_0x45b490['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x45b490['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x2ac479,_0x45b490,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x45b490,_0x2ac479);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x68edb0=this['editor']['plugins']['get'](i),_0x3aa4ff=this['editor']['plugins']['get'](V),_0x4231d1=_0x68edb0['channelSessions']['get'](this['_channelId']);_0x4231d1&&_0x4231d1['length']>0x1?_0x3aa4ff['createUserMarkerOperations']():this['listenTo'](_0x68edb0,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x68edb0['channelSessions']['get'](this['_channelId'])['length']&&_0x3aa4ff['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x4144f9,_0x282343,_0x58f48d,_0x532d94){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x282343){const _0x136106=this['_decompressOperations'](_0x58f48d,_0x532d94);await this['_fetchMissingUsers'](_0x136106),this['_handleExternalOperations'](_0x136106,_0x282343,_0x58f48d['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x2418ce}=this['editor'];let _0x3178b5;try{_0x3178b5=await this['_service']['getDocumentDetails']();}catch{const _0xc8888b=W(_0x2418ce,'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'](_0xc8888b);}const _0x51b511=_0x3178b5['currentDocumentSession']||_0x3178b5['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x51b511['lastOperationId']){const _0x3cad2c=W(_0x2418ce,'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'](_0x3cad2c);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x278b82){const _0x1e737a=this['editor']['plugins']['get'](i);this['listenTo'](_0x1e737a,'sessionAdd:'+this['_channelId'],(_0x568d66,{session:_0x2ce6c6})=>{if(_0x2ce6c6['id']===_0x1e737a['mySessionId']){_0x568d66['off']();const _0x554366=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x18336a=_0x2ce6c6['permissions'];_0x554366&&_0x554366['isEnabled']&&(_0x18336a=_0x18336a['filter'](_0x3127e1=>'document:write'!==_0x3127e1)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x18336a,this['_channelId']);}}),_0x1e737a['register'](this['_channelId'],_0x278b82);}['_initThrowingOnDataSet'](){const _0x1d5a86=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x1af339)=>{if(!_0x1af339[_0x1af339['length']-0x1]['suppressErrorInCollaboration'])throw new _0x54c6c0('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x1d5a86['apply'](this['editor']['data'],_0x1af339);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0xb40e5c,[_0x362782])=>{if(this['_document']['version'])throw new _0x54c6c0('realtimecollaborationclient-init-document-already-initialized',this);_0xb40e5c['stop'](),this['_setPendingAction']();const _0x6517d0=this['editor']['config']['get']('rootsAttributes'),_0x50f2da=this['_getOperationsFromInitData'](_0x362782,_0x6517d0);0x0==_0x50f2da['length']&&_0x50f2da['push'](new _0x69b68f(0x0)),_0xb40e5c['return']=this['_connectService'](_0x50f2da)['then'](()=>{this['editor']['plugins']['get'](n)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0xcb97db=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0xcb97db))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x54bac5,[_0x46b299,_0xdc4313])=>{_0x54bac5['stop']();const _0x50d0a5=this['editor']['model']['document']['getRoot'](_0x46b299);if(!this['_knownRootNames']['has'](_0x46b299)){const _0x197ef8=_0xdc4313&&_0xdc4313['data']?_0xdc4313['data']:'',_0x33375c=_0xdc4313&&_0xdc4313['attributes']?_0xdc4313['attributes']:{};await this['_loadRoot'](_0x46b299,_0x197ef8,_0x33375c);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x50d0a5['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x50d0a5);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xf5361){const _0x4a5f4b=this['editor']['plugins']['get'](_0x1a686c),{connection:_0x25ae26}=this['editor']['plugins']['get'](n),_0x576999=new Set();for(const _0x40e0d7 of _0xf5361){const _0x15eb86=_0x40e0d7['_authorId'];_0x15eb86&&!_0x4a5f4b['getUser'](_0x15eb86)&&_0x576999['add'](_0x15eb86);}if(0x0===_0x576999['size'])return;const _0x2466b2=await lt['getMany'](_0x25ae26,Array['from'](_0x576999));for(const _0x2f6c3a of _0x2466b2)_0x4a5f4b['getUser'](_0x2f6c3a['id'])||_0x4a5f4b['addUser'](_0x2f6c3a);}['_getOperationsFromInitData'](_0x385e97,_0x2b26f4={}){const _0x31556b=this['editor']['model'],_0x274b2d=[];let _0x29669f=0x0;const _0x190dd5='string'==typeof _0x385e97?{'main':_0x385e97}:_0x385e97;for(const _0x26350f of Object['keys'](_0x190dd5)){if(!this['_document']['roots']['has'](_0x26350f))throw new _0x54c6c0('realtimecollaborationclient-init-non-existent-root',this);const _0x52c521=this['editor']['data']['parse'](_0x190dd5[_0x26350f]),_0x3a342f=this['_document']['getRoot'](_0x26350f),_0x11ca7b=new _0x41cf28(_0x31556b['createPositionAt'](_0x3a342f,0x0),_0x52c521,_0x29669f++);_0x274b2d['push'](_0x11ca7b);for(const [_0x307378,_0x202c14]of _0x52c521['markers']){const _0x2ba44f=_0x31556b['createRange'](_0x31556b['createPositionFromPath'](_0x3a342f,_0x202c14['start']['path']['slice']()),_0x31556b['createPositionFromPath'](_0x3a342f,_0x202c14['end']['path']['slice']())),_0x14e28b=new _0x2383be(_0x307378,null,_0x2ba44f,_0x31556b['markers'],!0x0,_0x29669f++);_0x274b2d['push'](_0x14e28b);}}if(_0x2b26f4)for(const [_0x18abd3,_0x376a03]of Object['entries'](_0x2b26f4)){const _0x4c052b=_0x31556b['document']['getRoot'](_0x18abd3);if(!_0x4c052b)throw new _0x54c6c0('multi-root-editor-root-attributes-no-root',null);for(const [_0x5c861f,_0x4fcc99]of Object['entries'](_0x376a03))if(null!==_0x4fcc99){const _0x501d27=new _0x587080(_0x4c052b,_0x5c861f,null,_0x4fcc99,_0x29669f++);_0x274b2d['push'](_0x501d27);}}return _0x274b2d;}async['_loadRoot'](_0x2a31ad,_0x266d87,_0x540cb9){this['_getOperationsFromInitData']({[_0x2a31ad]:_0x266d87},{[_0x2a31ad]:_0x540cb9})['forEach']((_0x494208,_0x51e188)=>{_0x494208['baseVersion']=this['_document']['version']+_0x51e188,_0x494208['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x494208);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x4f274d,_0x41e347){let _0x47a37c;this['_offset']=_0x4f274d['offset'];const _0x3fb97d=_0x4f274d['wereChangesApplied']&&!_0x4f274d['initData'],_0x56e322=_0x3fb97d?0x0:_0x4f274d['data']['baseVersion'];if(_0x41e347['forEach'](_0x2cdd66=>{_0x2cdd66['_isInit']=!0x0,_0x2cdd66['createdAt']=_0x4f274d['sessionCreatedAt'],_0x2cdd66['_authorId']=null;}),_0x3fb97d)_0x47a37c=_0x41e347,this['_applyOperationsSet'](_0x47a37c,_0x3fb97d);else{if(_0x4f274d['initData']){const _0x526800=this['_getOperationsFromInitData'](_0x4f274d['initData']);this['_document']['history']['version']=-_0x526800['length'],_0x526800['forEach'](_0x65ae9d=>{_0x65ae9d['baseVersion']-=_0x526800['length'],_0x65ae9d['createdAt']=_0x4f274d['sessionCreatedAt'],_0x65ae9d['_isInit']=!0x0,_0x65ae9d['_authorId']=null;}),this['_applyOperationsSet'](_0x526800,!0x0),this['serverHistory']['version']=-_0x526800['length']+this['_offset'],this['_updateServerHistory'](_0x526800);}this['_document']['history']['version']=_0x56e322,_0x47a37c=this['_decompressOperations'](_0x4f274d['data'],_0x4f274d['metadata']),await this['_fetchMissingUsers'](_0x47a37c),this['_applyOperationsSet'](_0x47a37c,_0x3fb97d);}_0x4f274d['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x47a37c,_0x4f274d['lastOperationId']),this['_lastSyncedOperationId']=_0x4f274d['lastOperationId']),this['serverHistory']['version']=_0x56e322+this['_offset'],this['_updateServerHistory'](_0x47a37c),_0x41e347['filter'](_0x513853=>{const _0x594902=this['_getAffectedRoot'](_0x513853);return _0x594902&&!this['_knownRootNames']['has'](_0x594902);})['forEach']((_0x313509,_0x39f214)=>{_0x313509['baseVersion']=this['_document']['version']+_0x39f214,this['_saveOperationInBuffer'](_0x313509);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x53b8ac,_0x1280d8){const _0x56e561=_0x1280d8&&_0x1280d8['message'];if(_0x56e561&&_0x56e561['startsWith']('realtimecollaborationclient'))throw _0x1280d8;const _0x3ca32c=this['editor']['plugins']['get'](n);throw this['_isPendingUpdate']=!0x0,_0x3ca32c['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x54c6c0(_0x53b8ac,this['editor'],_0x56e561?{'originalError':_0x56e561}:void 0x0);}['_saveOperationInBuffer'](_0x3093c7){this['_knownOperations']['has'](_0x3093c7)||(this['_knownOperations']['add'](_0x3093c7),this['_bufferedOperations']['push'](_0x3093c7),this['_pendingAction']||'marker'==_0x3093c7['type']&&!_0x3093c7['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x3dc608=!0x1){!_0x3dc608&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x5142ef=>{_0x5142ef&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x2c424c=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x2afe29){return _0x2afe29['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2afe29['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x2afe29['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x2c424c)||this['_crash'](_0x2c424c['message'],_0x2c424c);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x3764aa=>{this['on']('change:_isPendingUpdate',()=>{_0x3764aa();});});}async['_sendBufferedOperations'](){const _0x200cb9=this['editor']['plugins']['get'](V);if(this['_shouldSendSelectionUpdate']()&&(_0x200cb9['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x5c6825=[...this['_bufferedOperations']];for(const _0x390790 of _0x5c6825)_0x390790['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x390790);const _0x5622fd=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x5c6825),_0xc4c0d9=G++,_0x218b73=this['_compressOperations'](_0x5c6825),_0x5bf8b3=await this['_service']['sendOperations'](_0x218b73,_0x218b73['baseVersion'],_0x5622fd);try{return await this['_handleServerResponse'](_0x5c6825,_0x5bf8b3,_0xc4c0d9);}catch(_0x4ddb76){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x4ddb76);}}async['_handleServerResponse'](_0x653508,_0x44c797,_0x1a2632){if('error'in _0x44c797)throw _0x44c797['error'];let _0x3c8397=!0x1;if(_0x44c797['wereChangesApplied']){_0x44c797['lastOperationId']&&(this['_lastSyncedOperationId']=_0x44c797['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x2715b8=>!_0x653508['includes'](_0x2715b8));for(const _0x6bd953 of _0x653508)_0x6bd953['createdAt']='lastOperationAcceptedAt'in _0x44c797&&_0x44c797['lastOperationAcceptedAt']||void 0x0;K(_0x653508,_0x44c797['version']-_0x653508['length']),this['_updateServerHistory'](_0x653508);const _0x17e97d=_0x653508['filter'](_0x5db4bb=>{if(!_0x5db4bb['_isInit'])return!0x1;const _0x17f5ca=this['_getAffectedRoot'](_0x5db4bb);return _0x17f5ca&&!this['_knownRootNames']['has'](_0x17f5ca);});K(_0x17e97d,this['_document']['version']),this['_applyOperationsSet'](_0x17e97d),_0x3c8397=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x2a8069=this['_decompressOperations'](_0x44c797['data'],_0x44c797['metadata'])['filter'](_0x3d5e65=>_0x3d5e65['baseVersion']>=this['_lastServerVersion']);_0x2a8069['forEach'](_0x4cffc9=>this['_addKnownRoot'](_0x4cffc9)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x20de7e=>!_0x20de7e['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x20de7e))),this['_bufferedOperations']['length']&&K(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x2a8069),_0x3c8397=this['_handleExternalOperations'](_0x2a8069,_0x44c797['version'],_0x44c797['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x3c8397?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x2eb4fa,_0x2b94b3,_0x3c3d0f){try{const _0x180fe6={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x1d105c,operationsB:_0x3fa376,originalOperations:_0x3a7f6a}=_0x315a78(_0x2eb4fa,this['_bufferedOperations'],_0x180fe6);K(_0x1d105c,this['_document']['version']),K(_0x3fa376,_0x2b94b3);for(const _0x4828e2 of _0x1d105c){const _0x3a64cb=_0x3a7f6a['get'](_0x4828e2);_0x4828e2['_authorId']=_0x3a64cb?_0x3a64cb['_authorId']:null;}_0x3c3d0f&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2eb4fa,_0x3c3d0f),this['_lastSyncedOperationId']=_0x3c3d0f),this['_bufferedOperations']=[..._0x3fa376],this['_applyOperationsSet'](_0x1d105c),this['_updateServerHistory'](_0x2eb4fa);}catch(_0x3aec96){return console['error'](_0x3aec96),!0x1;}return!0x0;}['_applyOperationsSet'](_0x4abe86,_0x909dec=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x41dcda=>{for(const _0x1a2f5f of _0x4abe86)this['_knownOperations']['add'](_0x1a2f5f),this['_addKnownRoot'](_0x1a2f5f),_0x41dcda['batch']['addOperation'](_0x1a2f5f),this['editor']['model']['applyOperation'](_0x1a2f5f);});}['_addKnownRoot'](_0x50d9ea){const _0x9c1c44=this['_getAffectedRoot'](_0x50d9ea);_0x9c1c44&&this['_knownRootNames']['add'](_0x9c1c44);}['_getAffectedRoot'](_0xeddc45){let _0x4953c6,_0x587fdc;switch(_0xeddc45['type']){case'insert':_0x4953c6=_0xeddc45['position']['root'];break;case'marker':if(_0x587fdc=_0xeddc45['newRange'],!_0x587fdc)return null;_0x4953c6=_0x587fdc['root'];break;case'addRootAttribute':_0x4953c6=_0xeddc45['root'];break;case'addRoot':_0x4953c6=_0xeddc45['affectedSelectable'];break;case'move':_0x4953c6=_0xeddc45['targetPosition']['root'];break;default:return null;}return _0x4953c6['rootName'];}['_updateServerHistory'](_0x339d4e){_0x339d4e['forEach'](_0x11dfb2=>{const _0x28cd9f=_0x11dfb2['clone']();_0x28cd9f['_authorId']=_0x11dfb2['_authorId'],_0x28cd9f['_isInit']=!!_0x11dfb2['_isInit'],_0x28cd9f['createdAt']=_0x11dfb2['createdAt'],_0x28cd9f['baseVersion']+=this['_offset'],_0x11dfb2['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x28cd9f),this['serverHistory']['addOperation'](_0x28cd9f);});}['_handleReconnectionError'](_0x458cd9){const _0x49ddf7=this['editor']['plugins']['get']('Notification'),_0x5eaca5=this['editor']['locale'];_0x458cd9||(_0x458cd9=W(_0x5eaca5,'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.')),_0x49ddf7['showWarning'](_0x458cd9,{'title':W(_0x5eaca5,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](n)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x41c5b4)['add'](W(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x41c5b4)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x5aea92){const _0xf331aa=_0x5aea92['map'](_0x1ebf77=>_0x1ebf77['toJSON']());return this['_compressor']['compress'](_0xf331aa);}['_decompressOperations'](_0x451efc,_0x215865){return this['_compressor']['decompress'](_0x451efc)['map']((_0x56bc47,_0xf6af12)=>{const _0x5c8fd2='init'==_0x215865[_0xf6af12]['type'];if('InsertOperation'==_0x56bc47['__className']){const _0xff43db=_0x56bc47['position']['root'];!this['_document']['getRoot'](_0xff43db)&&(this['_document']['createRoot']('$root',_0xff43db)['_isAttached']=!0x1);}const _0x1e255d=_0xdad854['fromJSON'](_0x56bc47,this['_document']);return _0x1e255d['wasUndone']=_0x56bc47['wasUndone'],_0x1e255d['_isInit']=_0x5c8fd2,_0x1e255d['_authorId']=_0x5c8fd2?null:_0x215865[_0xf6af12]['userId'],_0x1e255d['_isDisconnection']='cs:removeUser'===_0x215865[_0xf6af12]['type'],_0x1e255d['createdAt']=_0x215865[_0xf6af12]['createdAt'],_0x1e255d;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x8659f0=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x8659f0&&_0x8659f0['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class $ extends Error{}function K(_0x293d1b,_0x420b44){for(const _0x4bee31 of _0x293d1b)_0x4bee31['baseVersion']=_0x420b44++;}class J{['_ignoredOperations'];['_operationToId'];constructor(_0x1a10e1){this['_ignoredOperations']=_0x1a10e1,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x2cd3a4){let _0x2ed1f9=_0x2cd3a4['length'];for(;_0x2ed1f9--;){const _0x3c77ee=_0x2cd3a4[_0x2ed1f9];if(!this['_ignoredOperations']['has'](_0x3c77ee)){if(!this['_operationToId']['has'](_0x3c77ee)){const _0xbf3b7f=_0x2761ba()['slice'](0x1,0x12);this['_operationToId']['set'](_0x3c77ee,_0xbf3b7f);}return this['_operationToId']['get'](_0x3c77ee);}}}['setIdForTheLastOperation'](_0x26b622,_0x137693){if(!_0x137693)return;let _0x3a644b=_0x26b622['length'];for(;_0x3a644b--;){const _0x73304a=_0x26b622[_0x3a644b];this['_ignoredOperations']['has'](_0x73304a)||this['_operationToId']['set'](_0x73304a,_0x137693);}}}class a extends _0x4a0bed{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class s extends _0x9e975b{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x58dead)());['_services'];static get['requires'](){return[n,'CommentsRepository',i,_0x1a686c];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x47682b){super(_0x47682b),this['_services']=new Map();}async['init'](){const _0x7a408b=this['context'],_0x50dd4d=_0x7a408b['plugins']['get']('CommentsRepository');if(_0x7a408b['plugins']['get'](n)['addToReconnectionStack'](this),_0x50dd4d['adapter']={'addCommentThread':async({channelId:_0x15ce06,threadId:_0x3c790b,comments:_0x56a045,resolvedAt:_0x22a352,resolvedBy:_0x23cea7,context:_0x1d0dce,attributes:_0x38f1a5})=>{const _0x328d56=await this['_getService'](_0x15ce06)['addCommentThread']({'commentThreadId':_0x3c790b,'comments':_0x56a045['map'](_0x4c0adf=>function(_0x1faab0,_0x331565,_0x2a9690){return{'commentThreadId':_0x2a9690,'commentId':_0x1faab0['commentId'],'userId':_0x1faab0['authorId'],'content':_0x1faab0['content'],'documentId':_0x331565,'createdAt':_0x1faab0['createdAt'],'attributes':_0x1faab0['attributes']||{}};}(_0x4c0adf,_0x15ce06,_0x3c790b)),'resolvedAt':_0x22a352,'resolvedBy':_0x23cea7,'context':_0x1d0dce,'attributes':_0x38f1a5})['catch'](dt);return{'threadId':_0x328d56['commentThreadId'],'comments':_0x328d56['comments']};},'getCommentThread':async({channelId:_0x58e4cc,threadId:_0x5dcb40})=>{const _0x6640d3=await this['_getService'](_0x58e4cc)['getCommentThread'](_0x5dcb40)['catch'](dt);return _0x6640d3['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x6640d3]),{'threadId':_0x6640d3['commentThreadId'],'comments':_0x6640d3['comments']['map'](p),'context':_0x6640d3['context'],'resolvedAt':_0x6640d3['resolvedAt'],'resolvedBy':_0x6640d3['resolvedBy'],'attributes':_0x6640d3['attributes']||{}});},'updateCommentThread':async({channelId:_0x13a4cf,threadId:_0x1e67b6,context:_0x17963d,unlinkedAt:_0x55b942,attributes:_0x2c9a4d})=>this['_getService'](_0x13a4cf)['updateCommentThread']({'commentThreadId':_0x1e67b6,'context':_0x17963d,'attributes':_0x2c9a4d,'unlinkedAt':_0x55b942})['catch'](v)['catch'](dt),'resolveCommentThread':async({channelId:_0x47169c,threadId:_0x28556e})=>{const _0x2a1090=await this['_getService'](_0x47169c)['resolveCommentThread'](_0x28556e)['catch'](v)['catch'](dt);return{'threadId':_0x2a1090['commentThreadId'],'resolvedAt':_0x2a1090['resolvedAt'],'resolvedBy':_0x2a1090['resolvedBy']};},'reopenCommentThread':async({channelId:_0x1a9b30,threadId:_0x55dca6})=>this['_getService'](_0x1a9b30)['reopenCommentThread'](_0x55dca6)['catch'](v)['catch'](dt),'removeCommentThread':({channelId:_0x5b6104,threadId:_0x9232c5})=>this['_getService'](_0x5b6104)['removeCommentThread'](_0x9232c5)['catch'](v)['catch'](dt),'addComment':({channelId:_0x5236b1,threadId:_0x4e8a33,commentId:_0x3d9d71,content:_0x30cc06,attributes:_0x175056})=>this['_getService'](_0x5236b1)['addComment'](_0x4e8a33,_0x3d9d71,_0x30cc06,_0x175056)['catch'](dt),'updateComment':({channelId:_0x50b684,threadId:_0x536c28,commentId:_0x112082,content:_0x4313b7,attributes:_0x166aee})=>this['_getService'](_0x50b684)['updateComment'](_0x536c28,_0x112082,_0x4313b7,_0x166aee)['catch'](v)['catch'](dt),'removeComment':({channelId:_0x29caed,threadId:_0x386909,commentId:_0x5b0a2f})=>this['_getService'](_0x29caed)['removeComment'](_0x386909,_0x5b0a2f)['catch'](v)['catch'](dt)},_0x7a408b instanceof _0x531905){const _0xc19921=_0x7a408b['config']['get']('collaboration.channelId'),_0x171dc0=_0x7a408b['plugins']['get'](i);await this['_setUpService'](_0xc19921);const _0x1ca0e3=await this['_services']['get'](_0xc19921)['getConnectedSessions']();this['listenTo'](_0x171dc0,'sessionAdd:'+_0xc19921,(_0x39a4f5,{session:_0x2dfc64})=>{_0x2dfc64['id']===_0x171dc0['mySessionId']&&(_0x39a4f5['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x2dfc64['permissions'],_0xc19921));}),_0x171dc0['register'](_0xc19921,_0x1ca0e3);}}async['_setUpService'](_0x58585f){if(this['_services']['has'](_0x58585f))throw new _0x54c6c0('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x58585f});const _0x265815=this['context']['plugins']['get']('CommentsRepository'),_0x1f4b92=new s['CommentsService'](_0x58585f);this['_services']['set'](_0x58585f,_0x1f4b92),this['listenTo'](_0x1f4b92,'commentThreadAdded',(_0x5b43e5,_0x268f56)=>{const {commentThreadId:_0x517e87,documentId:_0x1d3fee,context:_0x352ccb,attributes:_0xa79833,resolvedAt:_0x3b2bcb,resolvedBy:_0x414912,comments:_0x3de4c5}=_0x268f56;_0x265815['getCommentThread'](_0x517e87)||_0x265815['addCommentThread']({'threadId':_0x517e87,'channelId':_0x1d3fee,'comments':_0x3de4c5?_0x3de4c5['map'](p):[],'context':_0x352ccb,'attributes':_0xa79833,'resolvedAt':_0x3b2bcb,'resolvedBy':_0x414912,'isFromAdapter':!0x0});}),this['listenTo'](_0x1f4b92,'commentThreadUpdated',(_0x12a19a,{commentThreadId:_0xbcf7d7,documentId:_0x17951f,context:_0x39363e,unlinkedAt:_0x570e05,attributes:_0x233eaa})=>{_0x265815['getCommentThread'](_0xbcf7d7)&&_0x265815['updateCommentThread']({'threadId':_0xbcf7d7,'channelId':_0x17951f,'context':_0x39363e,'unlinkedAt':_0x570e05,'attributes':_0x233eaa,'isFromAdapter':!0x0});}),this['listenTo'](_0x1f4b92,'commentThreadResolved',(_0x4d190c,{commentThreadId:_0x4d0f1e,resolvedBy:_0x31faa1,resolvedAt:_0xaa823})=>{const _0x2d8229=_0x265815['getCommentThread'](_0x4d0f1e);_0x2d8229&&_0x2d8229['resolve']({'resolvedBy':_0x31faa1,'resolvedAt':_0xaa823,'isFromAdapter':!0x0});}),this['listenTo'](_0x1f4b92,'commentThreadReopened',(_0x5a1afe,{commentThreadId:_0x4b9f13})=>{const _0xb0d237=_0x265815['getCommentThread'](_0x4b9f13);_0xb0d237&&_0xb0d237['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1f4b92,'commentThreadRemoved',(_0x5ee25d,{commentThreadId:_0x16eb1c})=>{const _0x2c02ec=_0x265815['getCommentThread'](_0x16eb1c);_0x2c02ec&&_0x2c02ec['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1f4b92,'commentAdded',(_0xfaefe7,_0xe9bdb1)=>{const _0x3eff4f=_0xe9bdb1['commentThreadId'],_0x95a4ae=_0x265815['getCommentThread'](_0x3eff4f);_0x95a4ae&&_0x95a4ae['addComment']({...p(_0xe9bdb1),'isFromAdapter':!0x0});}),this['listenTo'](_0x1f4b92,'commentUpdated',(_0x44d1d4,{commentThreadId:_0x425228,commentId:_0x596b18,content:_0x3502f4,attributes:_0x2ad003})=>{const _0x3f9ea6=_0x265815['getCommentThread'](_0x425228);if(_0x3f9ea6){const _0xfc1fd4=_0x3f9ea6['getComment'](_0x596b18);_0xfc1fd4&&_0xfc1fd4['update']({'content':_0x3502f4,'attributes':_0x2ad003,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1f4b92,'commentRemoved',(_0x3599d0,{commentThreadId:_0x355525,commentId:_0xdb0b70})=>{const _0x430b82=_0x265815['getCommentThread'](_0x355525);if(_0x430b82){const _0x4bcb1e=_0x430b82['getComment'](_0xdb0b70);_0x4bcb1e&&_0x4bcb1e['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x58585f);}['destroy'](){if(this['context']instanceof _0x531905){const _0x1d21b4=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x1d21b4);}}['_terminateService'](_0x4a82e3){if(!this['_services']['has'](_0x4a82e3))throw new _0x54c6c0('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x4a82e3});this['_getService'](_0x4a82e3)['disconnect'](),this['_services']['delete'](_0x4a82e3);}async['reconnect'](){for(const _0x116390 of this['_services']['keys']())await this['_connectService'](_0x116390);if(this['context']instanceof _0x531905){const _0x460768=this['context']['config']['get']('collaboration.channelId'),_0x39a6c1=this['context']['plugins']['get'](i);_0x39a6c1['unregister'](_0x460768);const _0x537a42=await this['_services']['get'](_0x460768)['getConnectedSessions']();_0x39a6c1['register'](_0x460768,_0x537a42);}}async['_connectService'](_0x2a0f1f){const {connection:_0x4a3fbe}=this['context']['plugins']['get'](n),_0x2834d2=this['context']['plugins']['get']('CommentsRepository'),_0x59afa7=this['_services']['get'](_0x2a0f1f),_0x1bb9bc=await _0x59afa7['connect'](_0x4a3fbe);await this['_fetchMissingUsersForThreads'](_0x1bb9bc);const _0x536421=new Set(Array['from'](_0x2834d2['getCommentThreads']({'channelId':_0x2a0f1f}),_0x12c448=>_0x12c448['id']));for(const _0x1f261b of _0x1bb9bc)_0x1f261b['deletedAt']||_0x536421['delete'](_0x1f261b['commentThreadId']);for(const _0x529dcd of _0x536421)_0x2834d2['getCommentThread'](_0x529dcd)['remove']({'isFromAdapter':!0x0});for(const _0x4f064c of _0x1bb9bc){let _0xade3be=_0x2834d2['getCommentThread'](_0x4f064c['commentThreadId']);const {commentThreadId:_0x31160c,context:_0x58649b,attributes:_0x1f875b,resolvedBy:_0x50845f,resolvedAt:_0x9f4238,unlinkedAt:_0x262535,deletedAt:_0x1b2b72}=_0x4f064c;if(_0x1b2b72)continue;_0xade3be||(_0xade3be=_0x2834d2['addCommentThread']({'channelId':_0x2a0f1f,'threadId':_0x31160c,'context':_0x58649b,'attributes':_0x1f875b||{},'resolvedBy':_0x50845f,'resolvedAt':_0x9f4238,'unlinkedAt':_0x262535,'isFromAdapter':!0x0}));const _0x611ffb=new Set(Array['from'](_0xade3be['comments'],_0x3b42a6=>_0x3b42a6['id']));for(const _0x6687c9 of _0x4f064c['comments'])_0x611ffb['delete'](_0x6687c9['commentId']);for(const _0xb91fc5 of _0x611ffb)_0xade3be['getComment'](_0xb91fc5)['remove']({'isFromAdapter':!0x0});for(const _0x29a7a8 of _0x4f064c['comments']){const _0x218a64=_0xade3be['getComment'](_0x29a7a8['commentId']);_0x218a64?_0x218a64['content']!==_0x29a7a8['content']&&_0x218a64['update']({'content':_0x29a7a8['content'],'isFromAdapter':!0x0}):_0xade3be['addComment'](Object['assign'](p(_0x29a7a8),{'isFromAdapter':!0x0}));}}}['_getService'](_0xb4c567){if(!this['_services']['has'](_0xb4c567))throw new _0x54c6c0('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0xb4c567});return this['_services']['get'](_0xb4c567);}async['_fetchMissingUsersForThreads'](_0x3e1aca){const _0x3cb256=this['context']['plugins']['get'](_0x1a686c),{connection:_0xd5f1e9}=this['context']['plugins']['get'](n),_0x1bff33=new Set();for(const {resolvedBy:_0x554dac,comments:_0x52c41e}of _0x3e1aca){_0x554dac&&!_0x3cb256['getUser'](_0x554dac)&&_0x1bff33['add'](_0x554dac);for(const {userId:_0x31d900}of _0x52c41e)_0x3cb256['getUser'](_0x31d900)||_0x1bff33['add'](_0x31d900);}if(0x0===_0x1bff33['size'])return;const _0x1faa03=await lt['getMany'](_0xd5f1e9,Array['from'](_0x1bff33));for(const _0x651a87 of _0x1faa03)_0x3cb256['getUser'](_0x651a87['id'])||_0x3cb256['addUser'](_0x651a87);}}async function v(_0x12083f){if('404'!==_0x12083f['code'])throw _0x12083f;}function dt(_0x49c445){if((_0x2357d8=_0x49c445)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x2357d8['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2357d8['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x2357d8;throw _0x49c445;}function p(_0x3de3c1){return{'threadId':_0x3de3c1['commentThreadId'],'commentId':_0x3de3c1['commentId'],'content':_0x3de3c1['content'],'createdAt':_0x3de3c1['createdAt'],'authorId':_0x3de3c1['userId'],'attributes':_0x3de3c1['attributes']||{}};}class m extends _0x4a0bed{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>et)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[s,'TrackChangesEditing',n];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2bd9fa){super(_0x2bd9fa);const _0x4d0326=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new m['TrackChangesService'](_0x4d0326);}['init'](){const _0x5d75b7=this['editor']['plugins']['get'](n),_0x3372a3=this['editor']['plugins']['get']('TrackChangesEditing');return _0x3372a3['adapter']={'getSuggestion':async _0x2bb467=>{await this['_waitForServiceReady']();const _0x1868ee=await this['_trackChangesService']['get'](_0x2bb467)['catch'](A);return await this['_fetchMissingUsersForThreads']([_0x1868ee]),_0x1868ee;},'addSuggestion':async({id:_0x37dd2c,type:_0x317068,data:_0x33ff1d,originalSuggestionId:_0x4069f0,attributes:_0x5eb6e0})=>{await this['_waitForServiceReady']();const _0x408288={'id':_0x37dd2c,'type':_0x317068,'data':_0x33ff1d,'originalSuggestionId':_0x4069f0,'attributes':_0x5eb6e0},_0x373a73=await this['_trackChangesService']['add'](_0x37dd2c,_0x317068,_0x33ff1d,_0x4069f0,_0x5eb6e0)['catch'](_0xc135c3=>{if(ut(_0xc135c3))return new Promise(_0x3118e1=>{this['_bufferedRequests']['set'](_0x37dd2c,{'resolve':_0x3118e1,'suggestionData':_0x408288});});throw _0xc135c3;});return this['_bufferedRequests']['delete'](_0x37dd2c),_0x373a73;},'updateSuggestion':async(_0x72351b,_0xbfe457)=>{if(await this['_waitForServiceReady'](),'open'!==_0xbfe457['state'])return this['_trackChangesService']['update'](_0x72351b,_0xbfe457)['catch'](A);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x186447,_0x3bc8eb)=>{_0x3372a3['hasSuggestion'](_0x3bc8eb['id'])&&(_0x3372a3['getSuggestion'](_0x3bc8eb['id'])['attributes']=_0x3bc8eb['attributes']);}),this['_trackChangesService']['connect'](_0x5d75b7['connection'])['then'](_0x579bee=>(_0x5d75b7['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x579bee)['then'](()=>{for(const _0x1ff2b9 of _0x579bee){_0x3372a3['addSuggestionData'](_0x1ff2b9)['_saved']=!0x0;}})));}async['reconnect'](){const _0x527730=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x4530a2}=this['editor']['plugins']['get'](n),_0x4e4058=await this['_trackChangesService']['connect'](_0x4530a2);await this['_fetchMissingUsersForThreads'](_0x4e4058);for(const {suggestionData:_0x5e1af7,resolve:_0xe99a93}of this['_bufferedRequests']['values']()){let _0x210420=_0x4e4058['find'](_0x339425=>_0x339425['id']===_0x5e1af7['id']);_0x210420||(_0x210420=await this['_trackChangesService']['add'](_0x5e1af7['id'],_0x5e1af7['type'],_0x5e1af7['data'],_0x5e1af7['originalSuggestionId'])),_0xe99a93(_0x210420);}for(const _0x168631 of _0x4e4058)_0x527730['hasSuggestion'](_0x168631['id'])||_0x527730['addSuggestionData'](_0x168631);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x1d9ac9=>{this['listenTo'](this['_trackChangesService'],'connected',_0x5a4915=>{_0x5a4915['off'](),_0x1d9ac9();});});}async['_fetchMissingUsersForThreads'](_0x2ff019){const _0x449f63=this['editor']['plugins']['get'](_0x1a686c),{connection:_0xf0e709}=this['editor']['plugins']['get'](n),_0x1616a0=new Set();for(const {authorId:_0x10ffd3}of _0x2ff019)_0x449f63['getUser'](_0x10ffd3)||_0x1616a0['add'](_0x10ffd3);if(0x0===_0x1616a0['size'])return;const _0x4ff575=await lt['getMany'](_0xf0e709,Array['from'](_0x1616a0));for(const _0x299a7c of _0x4ff575)_0x449f63['getUser'](_0x299a7c['id'])||_0x449f63['addUser'](_0x299a7c);}}function A(_0x371d31){if(ut(_0x371d31))return new Promise(()=>{});throw _0x371d31;}function ut(_0xfaa3da){return _0xfaa3da['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xfaa3da['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x4a0bed{static get['requires'](){return['Comments',s,a,n];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0xd96d1f=this['editor']['plugins']['get'](n),_0x55bfea=this['editor']['plugins']['get']('CommentsEditing'),_0x118e96=this['editor']['plugins']['get'](s);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0xd96d1f,'change:state',(_0x5ab620,_0x575137,_0x423b68)=>{_0x55bfea['isThreadsLoadingPaused']='connected'!==_0x423b68;});}),this['listenTo'](_0xd96d1f,'change:state',(_0xcaf2b7,_0x183337,_0x3fe9cb)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x3fe9cb);}),_0x118e96['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](s)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class ft extends _0x4a0bed{static get['requires'](){return[g,m,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class c extends _0x4a0bed{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[n,l,'RevisionHistory',i,_0x1a686c];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5bef7f){super(_0x5bef7f);const _0x2c03b4=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new c['RevisionHistoryService'](_0x2c03b4);}async['init'](){const _0x50cbc2=this['editor']['plugins']['get'](l),_0x4dbf5b=_0x50cbc2['serverHistory'],_0x480a7a=this['editor']['plugins']['get'](n);this['_revisionTracker']['setSource']({'history':_0x4dbf5b,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x50cbc2['sessionId']});const _0xe32827=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x1d0b39=await tt['isBundleUploaded'](_0x480a7a['connection'],_0xe32827);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x548b34})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x548b34)),'updateRevisions':async _0x3506ef=>{await this['_waitForServiceReady']();const _0x180a6b=this['_revisionTracker']['currentRevision'];if(_0x1d0b39&&0x1===_0x3506ef['length']&&_0x3506ef[0x0]['id']===_0x180a6b['id'])return _0x3506ef;for(const _0x3aa1e0 of _0x3506ef)_0x3aa1e0['id']===_0x180a6b['id']&&(_0x3aa1e0['isEmptyCurrent']=_0x3aa1e0['fromVersion']===_0x3aa1e0['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x3506ef,this['_lastRequestId'])['then'](_0x3b2031=>(this['_lastRequestId']=_0x3b2031,_0x3506ef))['catch'](_0x327a8b=>{if(st(_0x327a8b)||'400'===_0x327a8b['code']&&void 0x0!==_0x327a8b['data']['wrongRequestId']){for(const _0x2fe59f of _0x3506ef){!this['_revisionTracker']['repository']['getRevision'](_0x2fe59f['id'])||this['_revisionTracker']['_bufferUpdate'](_0x2fe59f['id'],_0x2fe59f,!0x1);}if(st(_0x327a8b))throw _0x327a8b;return _0x3506ef;}throw _0x327a8b;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x1e6d6f,{revisionsData:_0x5bf0c0,requestId:_0x1d5c7b})=>{Math['max'](..._0x5bf0c0['map'](_0x592358=>_0x592358['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x5bf0c0,_0x1d5c7b);}):this['_handleRevisionsUpdate'](_0x5bf0c0,_0x1d5c7b);});const {revisions:_0x3b78f0,requestId:_0x3de211}=await this['_revisionHistoryService']['connect'](_0x480a7a['connection']);_0x480a7a['addToReconnectionStack'](this),this['_lastRequestId']=_0x3de211,await this['_fetchMissingUsers'](_0x3b78f0);for(const _0x36a599 of _0x3b78f0)this['_revisionTracker']['addRevisionData'](_0x36a599);this['listenTo'](_0x50cbc2,'change:_isConnected',(_0x3a91ac,_0x16b626,_0x348aab)=>{_0x348aab&&(this['_oldOffset']=_0x50cbc2['_offset'],_0x3a91ac['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x480a7a,'state',_0x16ca33=>_0x16ca33===te['CONNECTED']);}async['reconnect'](){const _0x3ca060=this['editor']['plugins']['get'](n),_0x49e68b=this['editor']['plugins']['get'](l),_0x40b44f=async()=>{const _0x1dcd4a=this['_revisionTracker']['currentRevision'],_0x4ef4ce=_0x1dcd4a['id'],_0x59550a=_0x4ef4ce!==_0x49e68b['sessionId'];if(_0x59550a){const _0x39c3e9=_0x49e68b['_offset']-this['_oldOffset'],_0x5d05f8=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x1dcd4a['toVersion']+_0x39c3e9!==_0x5d05f8){const _0x252b27=_0x1dcd4a['fromVersion']+_0x39c3e9,_0xcbf427=this['editor']['plugins']['get'](_0x1a686c),_0xc6b9ca=this['_revisionTracker']['buildRevisionData']({'revision':_0x1dcd4a,'from':_0x252b27,'to':_0x5d05f8});_0xc6b9ca['id']=_0x1dcd4a['id'];const _0x47ac97=_0xc6b9ca['authorsIds']['map'](_0x1b0fd6=>_0xcbf427['getUser'](_0x1b0fd6));_0x1dcd4a['_update']({..._0xc6b9ca,'authors':_0x47ac97},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1dcd4a['id'],_0xc6b9ca,!0x0);}this['_revisionTracker']['_startingVersion']=_0x5d05f8,(_0x1dcd4a['toVersion']===_0x1dcd4a['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x4ef4ce)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x4ef4ce),this['_revisionTracker']['_createCurrentRevision'](_0x5d05f8));}const {revisions:_0x150e45,requestId:_0x3885e2}=await this['_revisionHistoryService']['reconnect'](_0x3ca060['connection'],this['_lastRequestId']);_0x59550a&&_0x150e45['length']>0x0?_0x49e68b['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x150e45),this['_handleRevisionsUpdate'](_0x150e45,_0x3885e2),this['_revisionTracker']['sendBufferedUpdates']());};return _0x49e68b['_isConnected']?_0x40b44f():new Promise((_0x8f9726,_0x1898c7)=>{_0x49e68b['once']('change:_isConnected',()=>{_0x40b44f()['then'](_0x8f9726)['catch'](_0x1898c7);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x20dbd1=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x3c3258=>{_0x3c3258['off'](),_0x20dbd1();});});}['_getLatestVersionFromServerOperations'](){const _0xc9edb5=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x71fade of _0xc9edb5)if('marker'!==_0x71fade['type']||_0x71fade['affectsData'])return _0x71fade['baseVersion']+0x1;}['_getLatestVersion'](){const _0x182b2a=this['editor']['plugins']['get'](l);return new Promise(_0x568400=>{_0x182b2a['_isPendingUpdate']?_0x182b2a['once']('change:_isPendingUpdate',()=>{_0x568400(this['_getLatestVersionFromServerOperations']());}):_0x568400(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x2f37a5,_0x3ac032){const _0xa594c1=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3ac032;for(const _0x183a28 of _0x2f37a5){const _0x102cf2=_0xa594c1['getRevision'](_0x183a28['id']);if(_0x102cf2){if((_0x183a28['fromVersion']||_0x183a28['toVersion'])&&(_0x183a28['diffData']=null),_0x102cf2===this['_revisionTracker']['currentRevision']){const _0x1cc60b=Math['max'](_0x102cf2['toVersion'],_0x183a28['toVersion']),_0x5ce2e4=Math['max'](_0x102cf2['fromVersion'],_0x183a28['fromVersion']);let _0x223590;_0x102cf2['toVersion']===_0x183a28['toVersion']&&_0x102cf2['fromVersion']===_0x183a28['fromVersion']?(_0x223590=!0x0,this['_preventResendingRevisionData'](_0x183a28)):_0x183a28['toVersion']===_0x1cc60b&&_0x183a28['fromVersion']===_0x5ce2e4?_0x223590=!0x1:(_0x102cf2['toVersion']===_0x1cc60b&&_0x102cf2['fromVersion']===_0x5ce2e4||this['_fixRevision']({'revision':_0x102cf2,'from':_0x5ce2e4,'to':_0x1cc60b}),_0x223590=!0x0),_0x223590&&(delete _0x183a28['fromVersion'],delete _0x183a28['toVersion'],delete _0x183a28['diffData'],delete _0x183a28['createdAt'],delete _0x183a28['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x183a28),this['_preventResendingRevisionData'](_0x183a28);}else this['_revisionTracker']['addRevisionData'](_0x183a28);}const _0xc7f32f=_0xa594c1['getRevisions']();_0xc7f32f['reverse']();for(let _0x1cb65d=0x0;_0x1cb65d<_0xc7f32f['length']-0x1;_0x1cb65d++){const _0x265433=_0xc7f32f[_0x1cb65d],_0x56cb5c=_0xc7f32f[_0x1cb65d+0x1];if(_0x265433['fromVersion']<_0x56cb5c['toVersion']){const _0x3a44ec=_0x56cb5c['toVersion'],_0x245149=Math['max'](_0x3a44ec,_0x265433['toVersion']);this['_fixRevision']({'revision':_0x265433,'from':_0x3a44ec,'to':_0x245149});}}}['_fixRevision']({revision:_0x43e07,from:_0x53985d,to:_0x28b00b}={}){const _0x385bc7=this['editor']['plugins']['get'](_0x1a686c),_0x2d0ce7=this['_revisionTracker']['buildRevisionData']({'revision':_0x43e07,'from':_0x53985d,'to':_0x28b00b});_0x2d0ce7['authors']=_0x2d0ce7['authorsIds']['map'](_0x570d3c=>_0x385bc7['getUser'](_0x570d3c)),_0x43e07['_update'](_0x2d0ce7);}['_preventResendingRevisionData'](_0x2ab176){const _0x4c7642={};_0x4c7642['id']=_0x2ab176['id'];for(const _0x456f54 of Object['keys'](_0x2ab176))'id'!==_0x456f54&&(_0x4c7642[_0x456f54]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x4c7642['id'],_0x4c7642,!0x0);}async['_fetchMissingUsers'](_0xe76c13){const _0x275d28=this['editor']['plugins']['get'](_0x1a686c),{connection:_0x45d89c}=this['editor']['plugins']['get'](n),_0x26bbdd=new Set();for(const _0x249663 of _0xe76c13){for(const _0xe6e8a4 of _0x249663['authorsIds'])_0x4115bf(_0xe6e8a4);_0x249663['creatorId']&&_0x4115bf(_0x249663['creatorId']);}if(0x0===_0x26bbdd['size'])return;const _0x1b986a=await lt['getMany'](_0x45d89c,Array['from'](_0x26bbdd));for(const _0x20e3db of _0x1b986a)_0x275d28['getUser'](_0x20e3db['id'])||_0x275d28['addUser'](_0x20e3db);function _0x4115bf(_0x5c6db1){_0x275d28['getUser'](_0x5c6db1)||_0x26bbdd['add'](_0x5c6db1);}}}function st(_0xe85e4a){return _0xe85e4a['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xe85e4a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xe85e4a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class mt extends _0x4a0bed{static get['requires'](){return['RevisionHistory',c,a];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class y extends _0x54ed70{['_collapseAt'];constructor(_0x2936ed,_0x48a744=0x6){super(_0x2936ed);const _0x310090=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x48a744,this['bind']('isHidden')['to'](this,'usersCount',_0x4b88e0=>_0x4b88e0<_0x48a744),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x310090['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':_0x310090['to']('usersCount',_0x1debef=>'+'+(_0x1debef-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class is extends _0x54ed70{['items'];['keystrokes'];constructor(_0x5af16e){super(_0x5af16e);const _0x1be8ff=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x48aed2(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x1be8ff['if']('hasPopup'),'aria-expanded':_0x1be8ff['to']('isExpanded',_0x1938e9=>this['hasPopup']&&String(_0x1938e9)),'aria-label':_0x1be8ff['to']('hasPopup',_0x2622c0=>W(_0x5af16e,_0x2622c0?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x1be8ff['to']('hasPopup',_0x2a78f9=>!!_0x2a78f9&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x1be8ff['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x1be8ff['to'](_0x594390=>{const _0x4c8846=_0x594390,_0x267929=document['querySelector']('.ck-presence-list__dropdown-list'),_0x4ac96c=document['querySelector']('.ck-balloon-panel_with-arrow');_0x267929?.['contains'](_0x4c8846['relatedTarget'])||_0x4ac96c?.['contains'](_0x4c8846['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x118a2b,_0x4fdd70,_0x50a6e0)=>{this['element']&&(_0x50a6e0?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class k extends _0x54ed70{['counterView'];['inlineListView'];constructor(_0x3249e2,_0x592a31=0x6){super(_0x3249e2);const _0x10832e=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new y(this['locale'],_0x592a31),this['inlineListView']=new is(_0x3249e2),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x230fdd of this['inlineListView']['items'])_0x230fdd['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',_0x10832e['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class C extends _0x54ed70{['listWrapperView'];constructor(_0x4cd465,_0x23e040){super(_0x4cd465);const _0x3e031f=this['bindTemplate'];this['listWrapperView']=new pt(_0x4cd465,_0x23e040),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':W(_0x4cd465,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x3e031f['to'](_0x311ee8=>{const _0x420145=_0x311ee8,_0x1531c4=document['querySelector']('.ck-presence-list__list'),_0x3c9af1=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1531c4?.['contains'](_0x420145['relatedTarget'])||_0x3c9af1?.['contains'](_0x420145['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class pt extends _0x193b34{constructor(_0x17f459,_0x3ad5e8){super(_0x17f459);const _0x27ab86=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x3ad5e8?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x27ab86['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x27ab86['to']('role'),'aria-label':_0x27ab86['to']('ariaLabel'),'aria-labelledby':_0x27ab86['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x42123c['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x59112a=this['element'];_0x59112a&&(this['_isScrollable']=Math['max'](_0x59112a['scrollHeight'],_0x59112a['clientHeight'])>0.8*window['innerHeight']);}}class P extends rt{['userView'];constructor(_0x2da17a,_0x5a4fde,_0x31902d){super(_0x2da17a);const _0x33bf62=this['bindTemplate'];this['userView']=new ct(_0x2da17a,_0x5a4fde);const _0x502cd5={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5a4fde['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5a4fde['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5a4fde['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x31902d&&(_0x502cd5['tag']='button',_0x502cd5['on']={'click':_0x33bf62['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x502cd5);}['focus'](){this['element']['focus']();}}class _ extends _0x54ed70{['userView'];['markerView'];constructor(_0x1fcb1a,_0x2f57e9,_0x3ee6fc){super(_0x1fcb1a);const _0x5cef8b=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x1fcb1a,_0x2f57e9),this['markerView']=new at(_0x1fcb1a,_0x2f57e9);const _0x38b102=new ot(_0x1fcb1a);_0x38b102['template']['tag']='span',_0x38b102['text']=_0x2f57e9['name'];const _0x5656fa={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5cef8b['to']('isFocusable',_0x3fd21c=>!!_0x3fd21c&&0x0),'aria-labelledby':_0x38b102['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5cef8b['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5cef8b['to']('hasTooltip',_0x2b67c1=>!_0x2b67c1),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x38b102]};_0x3ee6fc&&(_0x5656fa['tag']='button',_0x5656fa['on']={'click':_0x5cef8b['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5656fa);}}class at extends _0x54ed70{constructor(_0x3f1d24,_0x17a075){super(_0x3f1d24),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x17a075['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const U={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x9e975b{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2d0986){super(_0x2d0986),this['context']['config']['define']('presenceList',U);const _0x1060f9=_0x2d0986['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x1060f9)throw new _0x54c6c0('presencelist-collapseat-invalid-format',this);if(_0x1060f9<0x1)throw new _0x54c6c0('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x16c371(),this['balloonPanelView']=new _0x151f25(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x511bb1 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x511bb1);this['listenTo'](this['_allConnectedUsers'],'add',(_0x1416b7,_0x51f811)=>{this['_handleUserAdd'](_0x51f811);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x378f05,_0x3b3688)=>{this['_handleUserRemove'](_0x3b3688);});}['_createView'](){const _0x3d4de2=this['context'],_0x5cc35b=new k(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x38da47=this['balloonPanelView'];if(!_0x208f32(_0x3d4de2['config']['get']('presenceList.container')))throw new _0x54c6c0('presencelist-missing-container',this);return _0x5cc35b['counterView']['bind']('usersCount')['to'](this),_0x5cc35b['bind']('isCollapsed')['to'](this,'usersCount',_0x230d11=>{const {collapseAt:_0x459e6b}=_0x3d4de2['config']['get']('presenceList'),_0x1ef12a=_0x230d11>=_0x459e6b;if(_0x1ef12a&&!_0x5cc35b['inlineListView']['items']['find'](_0x534d75=>_0x534d75 instanceof y)){const _0x3ccff7=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x3ccff7&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x5cc35b['inlineListView']['items']['add'](_0x5cc35b['counterView']);}return _0x1ef12a||this['hideDropdown'](),_0x1ef12a;}),_0x5cc35b['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1296bc=>{const _0x4ffc0b=_0x3d4de2['config']['get']('presenceList'),_0x358c25=new _(_0x3d4de2['locale'],_0x1296bc,!!_0x4ffc0b['onClick']);return _0x358c25['bind']('hasTooltip')['to'](_0x5cc35b,'isCollapsed',_0x49a7b0=>!_0x49a7b0),_0x358c25['bind']('isFocusable')['to'](_0x5cc35b,'isCollapsed',_0x5dae13=>!_0x5dae13),_0x4ffc0b['onClick']&&this['listenTo'](_0x358c25,'execute',()=>{this['view']['isCollapsed']||_0x4ffc0b['onClick'](_0x1296bc,_0x358c25['element']);}),_0x358c25;}),this['listenTo'](_0x5cc35b['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x5cc35b['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x5cc35b['inlineListView']['keystrokes']['set']('Enter',(_0xaff15b,_0x4c0ece)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x4c0ece());}),_0x5cc35b['render'](),_0x38da47['render'](),_0xe3a062({'emitter':_0x5cc35b,'activator':()=>_0x38da47['isVisible'],'contextElements':[_0x38da47['element'],_0x5cc35b['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x3d4de2['config']['get']('presenceList.container')['appendChild'](_0x5cc35b['element']),this['_bodyCollection']=new _0x2b34c6(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x5cc35b;}['_handleUserAdd'](_0x52a8dd){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x52a8dd['isMe'])return;const _0x37d596=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x37d596-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x57670d=_0x52a8dd['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x52a8dd,_0x57670d);}['_handleUserRemove'](_0x1d9553){this['usersCount']--;const {collapseAt:_0x53e4f9}=this['context']['config']['get']('presenceList'),_0x396a83=this['usersCount']>=_0x53e4f9;if(this['currentDisplayedUsers']['get'](_0x1d9553['id']))this['currentDisplayedUsers']['remove'](_0x1d9553['id']);else{if(_0x396a83&&this['currentDisplayedUsers']['length']+0x1===_0x53e4f9-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x396a83?0x1:0x0)<this['usersCount']){for(const _0x3774b7 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x3774b7['id'])&&(this['currentDisplayedUsers']['add'](_0x3774b7,Math['min'](this['currentDisplayedUsers']['length']-(_0x396a83?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x396a83?0x1:0x0)===_0x53e4f9-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x395fff=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new C(this['context']['locale'],!!_0x395fff['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x30bc5d}=this['presenceDropdownView'];_0x30bc5d['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x5858d8=>{if(!_0x395fff['displayMe']&&_0x5858d8['isMe'])return null;const _0x1658f9=new P(this['context']['locale'],_0x5858d8,!!_0x395fff['onClick']);return _0x395fff['onClick']&&this['listenTo'](_0x1658f9,'execute',()=>{_0x395fff['onClick'](_0x5858d8,_0x1658f9['element']);}),_0x1658f9;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x30bc5d['focus'](),_0x30bc5d['checkIfScrollable']();const _0x870f27=(_0x5cf9f3,_0x4ce651)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x4ce651();};_0x30bc5d['keystrokes']['set']('Esc',_0x870f27),_0x30bc5d['keystrokes']['set']('Shift+Tab',_0x870f27),_0x30bc5d['keystrokes']['set']('Tab',(_0x1fcc08,_0x5bf9ec)=>{!function(_0x5dee8b){const _0xabe184=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x27acdf=>_0x27acdf+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x2bf7a5=[...document['body']['querySelectorAll'](_0xabe184)]['filter'](_0x1aabb5=>_0x1aabb5===document['activeElement']||_0x1aabb5['offsetWidth']+_0x1aabb5['offsetHeight']>0x0)['sort']((_0x1073c9,_0x2597d7)=>(_0x1073c9['tabIndex']||0x0)-(_0x2597d7['tabIndex']||0x0)),_0x11ca81=_0x2bf7a5['indexOf'](_0x5dee8b),_0x305ccc=_0x2bf7a5[(_0x11ca81+0x1)%_0x2bf7a5['length']];_0x305ccc&&_0x305ccc['focus']();}(this['view']['element']),this['hideDropdown'](),_0x5bf9ec();}),_0x30bc5d['focusTracker']['add'](this['view']['element']),_0x30bc5d['focusTracker']['on']('change:isFocused',(_0x2f049e,_0x59fb45,_0x4368f8)=>{_0x4368f8||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class gt extends _0x9e975b{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{s as CloudServicesCommentsAdapter,c as CloudServicesRevisionHistoryAdapter,m as CloudServicesTrackChangesAdapter,gt as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,g as RealTimeCollaborativeComments,a as RealTimeCollaborativeEditing,mt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,i as Sessions,n as WebSocketGateway,C as _RtcPresenceDropdownListView,pt as _RtcPresenceDropdownListWrapperView,k as _RtcPresenceListView};
|