@ckeditor/ckeditor5-real-time-collaboration 45.0.0-alpha.3 → 45.0.0-alpha.4
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/view/presencedropdownlistitemview.js +1 -1
- package/src/presencelist/view/presencedropdownlistview.js +1 -1
- package/src/presencelist/view/presenceinlinelistitemview.js +1 -1
- package/src/presencelist/view/presenceinlinelistview.js +1 -1
- package/src/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
|
-
((()=>mt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x2bf0ca];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x56186d){super(_0x56186d),this['set']('state',_0x5dd3c7['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x154155);}['init'](){const _0x5c45bd=this['context'],_0x5f20dc=_0x5c45bd['plugins']['get']('CloudServices'),_0x441a4b=_0x5c45bd['plugins']['get'](_0x2bf0ca);if(!_0x5f20dc['token'])throw new _0x18d37c('websocketgateway-missing-token',this);if(!_0x5f20dc['webSocketUrl'])throw new _0x18d37c('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),c['WebSocketGateway']['connect'](_0x5f20dc['token'],_0x5f20dc['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x52be66=>{if(this['connection']=_0x52be66,this['bind']('state')['to'](_0x52be66,'state',this,'_isBrowserOffline',(_0x57c83b,_0xc7fa87)=>('connected'!==_0x57c83b&&(this['_shouldPluginsReconnect']=!0x0),_0xc7fa87||_0x57c83b!==_0x5dd3c7['CONNECTED']?_0x5dd3c7['DISCONNECTED']:this['state']==_0x5dd3c7['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x5dd3c7['CONNECTING']):_0x5dd3c7['CONNECTED'])),this['connection']['on']('error',(_0x4fcc6d,_0x135983)=>{if('limitExceeded'!==_0x135983['code'])throw console['error'](_0x135983),new _0x18d37c('cloudservices-init',null,{'originalError':_0x135983});_0x441a4b['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'});}),!_0x52be66['me'])return new Promise(_0x49a421=>_0x52be66['on']('change:me',_0x49a421));})['catch'](_0xd75cbe=>{throw console['error'](_0xd75cbe),new _0x18d37c('cloudservices-init',null,{'originalError':_0xd75cbe});});}['addToReconnectionStack'](_0x13c36e){if('function'!=typeof _0x13c36e['reconnect'])throw new _0x18d37c('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x13c36e))throw new _0x18d37c('websocketgateway-plugin-already-registered',this,{'name':_0x13c36e['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x13c36e);}['removeFromReconnectionStack'](_0x489472){this['_reconnectionStack']['delete'](_0x489472);}['isInReconnectionStack'](_0x2d23bf){return this['_reconnectionStack']['has'](_0x2d23bf);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x58093e=>_0x58093e['reconnect']())))['then'](()=>this['state']=_0x5dd3c7['CONNECTED'])['catch'](_0x35b8a4=>{throw console['error'](_0x35b8a4),new _0x18d37c('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x5dd3c7['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x5ac5e7{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[c,_0x472340];}constructor(_0x2dc802){super(_0x2dc802),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x198913(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x472340);}['init'](){const _0x30638b=this['context']['plugins']['get'](c);this['listenTo'](_0x30638b,'change:state',(_0x5952cd,_0x1b8b22,_0x16452f)=>{if('connected'!==_0x16452f)this['channelSessions']['forEach'](_0x3004ad=>_0x3004ad['clear']()),this['channelConnectedUsers']['forEach'](_0x5c68e2=>_0x5c68e2['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x4dafd1,_0x59f173]of this['_registeredSessions'])for(const _0x280233 of _0x59f173)this['_handleSessionAdd'](_0x4dafd1,_0x280233);}}),this['_createUser'](_0x30638b['connection']['me'],!0x0);}['register'](_0x549e40,_0x50993b){if(this['_registeredSessions']['has'](_0x549e40))throw new _0x18d37c('sessions-register-already-registered',null,{'channelId':_0x549e40});this['_registeredSessions']['set'](_0x549e40,_0x50993b),this['channelSessions']['set'](_0x549e40,new _0x198913()),this['channelConnectedUsers']['set'](_0x549e40,new _0x198913()),this['listenTo'](_0x50993b,'add',(_0x127b59,_0x5ba032)=>this['_handleSessionAdd'](_0x549e40,_0x5ba032)),this['listenTo'](_0x50993b,'remove',(_0x5a70b3,_0x27e5c4)=>this['_handleSessionRemove'](_0x549e40,_0x27e5c4));for(const _0x3e8d98 of _0x50993b)this['_handleSessionAdd'](_0x549e40,_0x3e8d98);}['unregister'](_0x55e3ee){if(!this['_registeredSessions']['has'](_0x55e3ee))throw new _0x18d37c('sessions-unregister-not-exist',null,{'channelId':_0x55e3ee});const _0x5dfabb=this['_registeredSessions']['get'](_0x55e3ee);this['stopListening'](_0x5dfabb);for(const _0x564b4d of _0x5dfabb)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x55e3ee,_0x564b4d);this['_registeredSessions']['delete'](_0x55e3ee),this['channelSessions']['delete'](_0x55e3ee),this['channelConnectedUsers']['delete'](_0x55e3ee);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x4f765c){for(const _0x5f1a54 of this['channelSessions']['values']())for(const _0x4e93ce of _0x5f1a54)if(_0x4e93ce['id']===_0x4f765c)return _0x4e93ce['user'];}['getUserSessions'](_0x3ac863,_0x40e4c6){const _0x2b5b9b=_0x40e4c6?[this['channelSessions']['get'](_0x40e4c6)]:this['channelSessions']['values'](),_0xeac75d=new Set();for(const _0x3838e2 of _0x2b5b9b)for(const _0x3f9e98 of _0x3838e2)_0x3f9e98['user']['id']===_0x3ac863['id']&&_0xeac75d['add'](_0x3f9e98['id']);return _0xeac75d;}['getUserRole'](_0x5dd775){for(const _0x1703e6 of this['channelSessions']['values']())for(const _0x2a891d of _0x1703e6)if(_0x2a891d['user']===_0x5dd775)return _0x2a891d['role'];}['_handleSessionAdd'](_0x413e00,_0x5dda){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x1396fa=_0x5dda['user'],_0x28aa=this['_users']['getUser'](_0x1396fa['id'])||this['_createUser'](_0x1396fa),_0x33b088=Object['assign']({},_0x5dda,{'user':_0x28aa});this['channelSessions']['get'](_0x413e00)['add'](_0x33b088);const _0x56b1e9=this['channelConnectedUsers']['get'](_0x413e00);_0x56b1e9['has'](_0x28aa['id'])||_0x56b1e9['add'](_0x28aa),this['allConnectedUsers']['has'](_0x28aa['id'])||this['allConnectedUsers']['add'](_0x28aa,_0x28aa['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x413e00,{'channelId':_0x413e00,'session':_0x33b088});}['_handleSessionRemove'](_0x4b5ac2,_0x3ca15d){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x2de573=this['channelConnectedUsers']['get'](_0x4b5ac2),_0x4a18ee=_0x3ca15d['user'];_0x4a18ee['id']&&(this['channelSessions']['get'](_0x4b5ac2)['remove'](_0x3ca15d['id']),_0x2de573['has'](_0x4a18ee['id'])&&!this['getUserSessions'](_0x4a18ee,_0x4b5ac2)['size']&&_0x2de573['remove'](_0x4a18ee['id']),this['allConnectedUsers']['get'](_0x4a18ee['id'])&&!this['getUserSessions'](_0x4a18ee)['size']&&this['allConnectedUsers']['remove'](_0x4a18ee['id']));}['_createUser'](_0x2a76e5,_0x12ea45){const _0x1c8d8b=this['_users']['addUser'](_0x2a76e5);return _0x12ea45&&this['_users']['defineMe'](_0x2a76e5['id']),_0x1c8d8b['orderNumber']=this['_uniqueUsersCount']++,_0x1c8d8b;}}class B extends _0x1aa6b7{['_domEmitter']=new(_0x154155())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x508040=this['editor'],_0x38be52=_0x508040['plugins']['get'](i);_0x508040['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x56ba68,{writer:_0x330254})=>function(_0x40ffdc,_0x5d0dd4,_0x2b51d5,_0x365ac6){const _0x45d96c=_0x40ffdc['markerName']['split'](':')[0x2],_0x32bda4=_0x2b51d5['getUserBySessionId'](_0x45d96c);if(!_0x32bda4||_0x45d96c===_0x2b51d5['mySessionId'])return;if(!_0x365ac6['model']['schema']['checkChild'](_0x40ffdc['markerRange']['start'],'$text'))return;const _0x383f48={'class':'ck-user__marker\x20'+_0x32bda4['color']['getMarkerClass'](),'data-name':_0x32bda4['name'],'data-session-id':_0x45d96c},_0x4b9e37=_0x365ac6['model']['markers']['get'](_0x40ffdc['markerName']),_0x5ab645=_0x4b9e37['getStart'](),_0x442194=_0x5ab645['nodeAfter'],_0x3ca993=_0x365ac6['model']['schema'];if(_0x442194&&_0x3ca993['isObject'](_0x442194)&&_0x3ca993['isInline'](_0x442194)&&!_0x365ac6['model']['markers']['get']('user:range:'+_0x45d96c)['getRange']()['isCollapsed'])return;const _0xbfa6d2=_0x5ab645['parent'];return _0x365ac6['model']['schema']['isLimit'](_0xbfa6d2)&&!_0x365ac6['model']['hasContent'](_0xbfa6d2)&&(_0x383f48['contenteditable']=!0x1),function(_0x1f0bde,_0x13be4f,_0x17be8a){const _0x47b8d4=_0x1f0bde['createUIElement']('span',_0x13be4f);return _0x1f0bde['setCustomProperty']('userPositionMarker',!0x0,_0x47b8d4),_0x47b8d4['render']=function(_0x2c2c7f){const _0x5a1d2a=this['toDomElement'](_0x2c2c7f),_0x4f0cae=document['createElement']('span');return _0x4f0cae['classList']['add']('ck-user__marker-tooltip'),_0x4f0cae['setAttribute']('contenteditable','false'),_0x4f0cae['setAttribute']('spellcheck','false'),_0x4f0cae['textContent']=_0x17be8a['name'],_0x5a1d2a['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x4f0cae['outerHTML']+'',_0x5a1d2a['addEventListener']('mouseenter',()=>{_0x5a1d2a['classList']['add']('ck-user__marker_hovered');}),_0x5a1d2a['addEventListener']('mouseleave',()=>{_0x5a1d2a['classList']['remove']('ck-user__marker_hovered');}),_0x5a1d2a;},_0x47b8d4['isSimilar']=function(_0x41250a){return!(!this['getCustomProperty']('userPositionMarker')||!_0x41250a['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x41250a['getAttribute']('data-session-id'));},_0x47b8d4;}(_0x5d0dd4,_0x383f48,_0x32bda4);}(_0x56ba68,_0x330254,_0x38be52,_0x508040)}),_0x508040['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x227ce3=>function(_0x4218c7,_0x4f561d){const _0xb2454d=_0x4218c7['markerName']['split'](':')[0x2];if(_0xb2454d===_0x4f561d['mySessionId'])return null;const _0x3fcc77=_0x4f561d['getUserBySessionId'](_0xb2454d);if(!_0x3fcc77)return{'id':_0xb2454d,'classes':[]};return{'id':_0xb2454d,'classes':['ck-user__selection',_0x3fcc77['color']['getSelectionClass']()],'attributes':{'data-session-id':_0xb2454d},'priority':0x7d0+_0x3fcc77['orderNumber']};}(_0x227ce3,_0x38be52)}),function(_0x3edc5f){const _0x4cd535=_0x3edc5f['model'],_0x571c5d=new Map(),_0x356536=_0x3edc5f['plugins']['get'](i);_0x4cd535['markers']['on']('update:user:range',(_0x4dfdbe,_0x120866,_0x13bfdb,_0x191418)=>{if(!_0x191418&&_0x571c5d['get'](_0x120866['name']))return _0x571c5d['get'](_0x120866['name'])['detach'](),void _0x571c5d['delete'](_0x120866['name']);const _0xda8548=_0x120866['name']['split'](':')[0x2];if(_0xda8548===_0x356536['mySessionId'])return;const _0x368b96='user:position:'+_0xda8548;_0x4cd535['markers']['has'](_0x368b96)&&_0x3edc5f['editing']['reconvertMarker'](_0x368b96),_0x120866['on']('change:range',(_0x10c35b,_0x4bcca0,_0x49028f)=>{if('$graveyard'!=_0x4bcca0['root']['rootName']&&'$graveyard'==_0x120866['getRange']()['root']['rootName']&&!_0x571c5d['has'](_0x120866['name'])){const _0x42a4cc=_0x4cd535['schema']['getNearestSelectionRange'](_0x49028f['deletionPosition']);if(_0x42a4cc){const _0x3a4afc=ft['fromRange'](_0x42a4cc);_0x571c5d['set'](_0x120866['name'],_0x3a4afc),_0x3a4afc['on']('change:range',(_0x123f01,_0x12692e,_0x2ef967)=>{if('$graveyard'==_0x3a4afc['root']['rootName']){const _0x362a3e=_0x4cd535['schema']['getNearestSelectionRange'](_0x2ef967['deletionPosition']);_0x362a3e?(_0x3a4afc['start']=_0x362a3e['start'],_0x3a4afc['end']=_0x362a3e['end']):(_0x571c5d['delete'](_0x120866['name']),_0x3a4afc['detach']());}});}}});}),_0x4cd535['document']['on']('change',()=>{_0x571c5d['size']>0x0&&_0x4cd535['enqueueChange']({'isUndoable':!0x1},_0x521aa4=>{for(const [_0x116f8c,_0x5e914c]of _0x571c5d)'$graveyard'==_0x4cd535['markers']['get'](_0x116f8c)['getRange']()['root']['rootName']&&(X(_0x116f8c['split'](':')[0x2],_0x5e914c['toRange'](),_0x4cd535,_0x521aa4),_0x5e914c['detach']());_0x571c5d['clear']();});});}(_0x508040),this['_domEmitter']['listenTo'](_0x5d6a2f['document'],'keydown',(_0x357ac7,{key:_0x2b4f4e})=>{'Escape'===_0x2b4f4e&&function(_0x13934a){_0x13934a['editing']['view']['change'](_0xfa0833=>{for(const _0x160cde of _0x13934a['model']['markers']){if(!_0x160cde['name']['startsWith']('user:position'))continue;const _0x78bae7=_0x13934a['editing']['mapper']['markerNameToElements'](_0x160cde['name']);if(_0x78bae7){for(const _0x106dc4 of _0x78bae7)_0xfa0833['removeClass']('ck-user__marker_hovered',_0x106dc4);}}});}(_0x508040);},{'useCapture':!0x0});}['afterInit'](){const _0xe99fac=this['editor'],_0x265e4d=_0xe99fac['commands']['get']('undo');_0x265e4d&&_0xe99fac['model']['on']('applyOperation',(_0x4f9265,_0xe34abd)=>{const _0xe71f8e=_0xe34abd[0x0];if(!_0xe71f8e['isDocumentOperation'])return;if('marker'!=_0xe71f8e['type']||!_0xe71f8e['name']['startsWith']('user:'))return;const _0x27deed=_0xe71f8e['batch'];_0x265e4d['_createdBatches']['has'](_0x27deed)&&(_0xe71f8e['newRange']=_0xe71f8e['oldRange']?_0xe99fac['model']['createRange'](_0xe71f8e['oldRange']['start'],_0xe71f8e['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x26f36d=this['editor'],_0x3d582b=_0x26f36d['model']['document'],_0x1b99be=_0x26f36d['plugins']['get'](i);_0x26f36d['model']['enqueueChange']({'isUndoable':!0x1},_0x4864dd=>{const _0x354758='user:range:'+_0x1b99be['mySessionId'],_0x2994c1='user:position:'+_0x1b99be['mySessionId'],_0x518466=_0x26f36d['model']['markers']['has'](_0x354758);_0x26f36d['editing']['view']['hasDomSelection']?X(_0x1b99be['mySessionId'],_0x3d582b['selection']['getFirstRange'](),_0x26f36d['model'],_0x4864dd):_0x518466&&(_0x4864dd['removeMarker'](_0x354758),_0x4864dd['removeMarker'](_0x2994c1));});}}function X(_0xfd7ab6,_0x3dc7c7,_0xf9053,_0x53c8f7){const _0x523065='user:range:'+_0xfd7ab6,_0x203ccb='user:position:'+_0xfd7ab6,_0x1d1a4a=_0x3dc7c7['getContainedElement']();let _0x4d3ed6=_0x3dc7c7['start'];_0x1d1a4a&&_0x1d1a4a['is']('element','tableCell')&&(_0x4d3ed6=function(_0x16cae7,_0x3c0cb0){for(const _0x15d8e8 of _0x16cae7['getPositions']())if(_0x3c0cb0['schema']['checkChild'](_0x15d8e8,'$text'))return _0x15d8e8;}(_0x3dc7c7,_0xf9053),_0x3dc7c7=_0x53c8f7['createRange'](_0x4d3ed6));const _0x4ce377=_0x53c8f7['createRange'](_0x4d3ed6);_0xf9053['markers']['has'](_0x523065)?(_0x53c8f7['updateMarker'](_0x523065,{'range':_0x3dc7c7}),_0x53c8f7['updateMarker'](_0x203ccb,{'range':_0x4ce377})):(_0x53c8f7['addMarker'](_0x523065,{'range':_0x3dc7c7,'usingOperation':!0x0}),_0x53c8f7['addMarker'](_0x203ccb,{'range':_0x4ce377,'usingOperation':!0x0}));}function M(_0x122c01,_0x13574d,_0x4d4122){const _0x2851d4=_0x122c01['t'],t=_0x122c01['t'];switch(_0x13574d){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 _0x2851d4({'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'},_0x4d4122);default:return'';}}let F=0x1;class l extends _0x1aa6b7{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
-
((()=>_0x37472b)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,B,_0x438715,_0x472340,_0x2bf0ca];}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 _0x478263=this['serverHistory']['getOperations']();for(let _0x36f8c6=_0x478263['length']-0x1;_0x36f8c6>=0x0;_0x36f8c6--){const _0x549487=_0x478263[_0x36f8c6];if(!this['_disconnectionOperations']['has'](_0x549487))return _0x549487['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x375fb6){if(super(_0x375fb6),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x3f8b70(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x18d37c('collaboration-missing-channelid',this);const _0x2eaf62=_0x375fb6['config']['get']('cloudServices.bundleVersion')||ht;this['_service']=new l['CollaborativeEditingService'](_0x2eaf62,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x5698b3(),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 $(this['_disconnectionOperations']);}['init'](){const _0x45ba3e=this['editor'],_0x5e2c65=_0x45ba3e['plugins']['get'](_0x472340),_0x2394a7=_0x45ba3e['plugins']['get'](c);this['listenTo'](_0x5e2c65,'getOperationAuthor',(_0x34936f,_0x44d394)=>{const _0xd1fefc=_0x44d394[0x0];_0xd1fefc['_authorId']&&(_0x34936f['return']=_0x5e2c65['getUser'](_0xd1fefc['_authorId']),_0x34936f['stop']()),null===_0xd1fefc['_authorId']&&(_0x34936f['return']=null,_0x34936f['stop']());},{'priority':'high'}),this['listenTo'](_0x45ba3e['model']['document']['selection'],'change:range',(_0x506b8f,_0x55a4ec)=>{_0x55a4ec['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x45ba3e['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x45ba3e['model']['on']('applyOperation',(_0x220212,_0x1b4ccb)=>{const _0x4ce218=_0x1b4ccb[0x0];_0x4ce218['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x4ce218),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x2394a7,'state',this,'_hasSynchronizationProblem',(_0x1d48fe,_0x47524c)=>'connected'===_0x1d48fe&&!_0x47524c),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x45ba3e['disableReadOnlyMode']('rtc-offline'):_0x45ba3e['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x45ba3e['disableReadOnlyMode']('rtc-offline'):_0x45ba3e['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x422f64=this['editor']['plugins']['get'](i),_0x548aca=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x422f64['unregister'](this['_channelId']);const _0x3c264f=await this['_service']['reconnect'](_0x548aca['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x3c264f)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x4b396f=await this['_service']['getConnectedSessions']();_0x422f64['register'](this['_channelId'],_0x4b396f),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x32e278){if(function(_0x233d0a){return'404'===_0x233d0a['code'];}(_0x32e278)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x1729c8){return'409'===_0x1729c8['code'];}(_0x32e278)){const _0x80783c=M(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'](_0x80783c);}else{if(!(_0x32e278 instanceof q))throw _0x32e278;this['_handleReconnectionError']();}}}}['destroy'](){const _0x1d0936=this['editor']['plugins']['get'](c),_0x14cfca=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x14cfca['channelSessions']['has'](this['_channelId'])&&_0x14cfca['unregister'](this['_channelId']),_0x1d0936['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x23a1b6){if(this['sessionId']!==_0x23a1b6['sessionId']&&this['_lastSyncedOperationId']!==_0x23a1b6['lastOperationId'])throw new q();return this['sessionId']=_0x23a1b6['sessionId'],this['_handleServerResponse']([],{..._0x23a1b6,'wereChangesApplied':!0x1,'data':_0x23a1b6['data']},'reconnect');}async['_connectService'](_0x543d61,_0x51b17b=!0x1){const {connection:_0x3960b8}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x3960b8,this['_channelId'])['then'](_0x1e435a=>this['_initSessionsHandling'](_0x1e435a))['catch'](_0x363a4b=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x363a4b);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x30c399,_0xf96ccf)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0xf96ccf);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x2e6d76=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x543d61);this['_isPendingUpdate']=!0x0;const _0x144f24=await this['_service']['connect'](_0x3960b8,this['_compressOperations'](_0x543d61),_0x2e6d76);if(this['sessionId']=_0x144f24['sessionId'],_0x51b17b){if(!_0x144f24['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x144f24['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x543d61,_0x144f24,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x144f24,_0x543d61);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x1505e7=this['editor']['plugins']['get'](i),_0x24499f=this['editor']['plugins']['get'](B),_0x280708=_0x1505e7['channelSessions']['get'](this['_channelId']);_0x280708&&_0x280708['length']>0x1?_0x24499f['createUserMarkerOperations']():this['listenTo'](_0x1505e7,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x1505e7['channelSessions']['get'](this['_channelId'])['length']&&_0x24499f['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0x3efb42,_0x59ceb4,_0x279268,_0xc44283){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x59ceb4){const _0x1f2e68=this['_decompressOperations'](_0x279268,_0xc44283);await this['_fetchMissingUsers'](_0x1f2e68),this['_handleExternalOperations'](_0x1f2e68,_0x59ceb4,_0x279268['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x4cd882}=this['editor'];let _0x2dc585;try{_0x2dc585=await this['_service']['getDocumentDetails']();}catch(_0x489d47){const _0x350cf3=M(_0x4cd882,'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'](_0x350cf3);}const _0x24f486=_0x2dc585['currentDocumentSession']||_0x2dc585['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0x24f486['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x1ae63b=M(_0x4cd882,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x1ae63b);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x292cfa){const _0x40f29b=this['editor']['plugins']['get'](i);this['listenTo'](_0x40f29b,'sessionAdd:'+this['_channelId'],(_0x1526a4,{session:_0x5f4c6d})=>{if(_0x5f4c6d['id']===_0x40f29b['mySessionId']){_0x1526a4['off']();const _0x550d0b=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x47c761=_0x5f4c6d['permissions'];_0x550d0b&&_0x550d0b['isEnabled']&&(_0x47c761=_0x47c761['filter'](_0x3809d8=>'document:write'!==_0x3809d8)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x47c761,this['_channelId']);}}),_0x40f29b['register'](this['_channelId'],_0x292cfa);}['_initThrowingOnDataSet'](){const _0x2cfdb5=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x23b606)=>{if(!_0x23b606[_0x23b606['length']-0x1]['suppressErrorInCollaboration'])throw new _0x18d37c('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x2cfdb5['apply'](this['editor']['data'],_0x23b606);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x1cae70,[_0x1c40c6])=>{if(this['_document']['version'])throw new _0x18d37c('realtimecollaborationclient-init-document-already-initialized',this);_0x1cae70['stop'](),this['_setPendingAction']();const _0x121fb6=this['editor']['config']['get']('rootsAttributes'),_0x2ec10b=this['_getOperationsFromInitData'](_0x1c40c6,_0x121fb6);0x0==_0x2ec10b['length']&&_0x2ec10b['push'](new _0x57b523(0x0)),_0x1cae70['return']=this['_connectService'](_0x2ec10b)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x5a14f9=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x5a14f9))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x42a46a,[_0x1198c2,_0x3755cd])=>{_0x42a46a['stop']();const _0x55d6fa=this['editor']['model']['document']['getRoot'](_0x1198c2);if(!this['_knownRootNames']['has'](_0x1198c2)){const _0x3721f1=_0x3755cd&&_0x3755cd['data']?_0x3755cd['data']:'',_0x587801=_0x3755cd&&_0x3755cd['attributes']?_0x3755cd['attributes']:{};await this['_loadRoot'](_0x1198c2,_0x3721f1,_0x587801);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x55d6fa['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x55d6fa);});},{'priority':'high'});}async['_fetchMissingUsers'](_0xb22a1d){const _0x5696e3=this['editor']['plugins']['get'](_0x472340),{connection:_0x1ef912}=this['editor']['plugins']['get'](c),_0x129d57=new Set();for(const _0x1d6559 of _0xb22a1d){const _0x43303d=_0x1d6559['_authorId'];_0x43303d&&!_0x5696e3['getUser'](_0x43303d)&&_0x129d57['add'](_0x43303d);}if(0x0===_0x129d57['size'])return;const _0xdfb5f5=await gt['getMany'](_0x1ef912,Array['from'](_0x129d57));for(const _0x12727f of _0xdfb5f5)_0x5696e3['getUser'](_0x12727f['id'])||_0x5696e3['addUser'](_0x12727f);}['_getOperationsFromInitData'](_0x517b0c,_0x20d1ef={}){const _0x13953e=this['editor']['model'],_0x147b0e=[];let _0x369f32=0x0;const _0x177aca='string'==typeof _0x517b0c?{'main':_0x517b0c}:_0x517b0c;for(const _0x1e3a69 of Object['keys'](_0x177aca)){if(!this['_document']['roots']['has'](_0x1e3a69))throw new _0x18d37c('realtimecollaborationclient-init-non-existent-root',this);const _0x35069a=this['editor']['data']['parse'](_0x177aca[_0x1e3a69]),_0x2d1427=this['_document']['getRoot'](_0x1e3a69),_0x16a44c=new _0x201492(_0x13953e['createPositionAt'](_0x2d1427,0x0),_0x35069a,_0x369f32++);_0x147b0e['push'](_0x16a44c);for(const [_0x3f576a,_0x346308]of _0x35069a['markers']){const _0x2ab766=_0x13953e['createRange'](_0x13953e['createPositionFromPath'](_0x2d1427,_0x346308['start']['path']['slice']()),_0x13953e['createPositionFromPath'](_0x2d1427,_0x346308['end']['path']['slice']())),_0x4bd2cb=new _0x3b8081(_0x3f576a,null,_0x2ab766,_0x13953e['markers'],!0x0,_0x369f32++);_0x147b0e['push'](_0x4bd2cb);}}if(_0x20d1ef)for(const [_0x4f3a87,_0x18982d]of Object['entries'](_0x20d1ef)){const _0x48670f=_0x13953e['document']['getRoot'](_0x4f3a87);if(!_0x48670f)throw new _0x18d37c('multi-root-editor-root-attributes-no-root',null);for(const [_0x31ead7,_0x54eebd]of Object['entries'](_0x18982d))if(null!==_0x54eebd){const _0x412fe9=new _0x1ec889(_0x48670f,_0x31ead7,null,_0x54eebd,_0x369f32++);_0x147b0e['push'](_0x412fe9);}}return _0x147b0e;}async['_loadRoot'](_0x2055dd,_0x5abe94,_0x482f7e){this['_getOperationsFromInitData']({[_0x2055dd]:_0x5abe94},{[_0x2055dd]:_0x482f7e})['forEach']((_0x210626,_0x3ad8fa)=>{_0x210626['baseVersion']=this['_document']['version']+_0x3ad8fa,_0x210626['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x210626);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0xc931da,_0xc81324){let _0xe45589;this['_offset']=_0xc931da['offset'];const _0x57b9b3=_0xc931da['wereChangesApplied']&&!_0xc931da['initData'],_0x3e05df=_0x57b9b3?0x0:_0xc931da['data']['baseVersion'];if(_0xc81324['forEach'](_0x321079=>{_0x321079['_isInit']=!0x0,_0x321079['createdAt']=_0xc931da['sessionCreatedAt'],_0x321079['_authorId']=null;}),_0x57b9b3)_0xe45589=_0xc81324,this['_applyOperationsSet'](_0xe45589,_0x57b9b3);else{if(_0xc931da['initData']){const _0xf7498=this['_getOperationsFromInitData'](_0xc931da['initData']);this['_document']['history']['version']=-_0xf7498['length'],_0xf7498['forEach'](_0x50e3d2=>{_0x50e3d2['baseVersion']-=_0xf7498['length'],_0x50e3d2['createdAt']=_0xc931da['sessionCreatedAt'],_0x50e3d2['_isInit']=!0x0,_0x50e3d2['_authorId']=null;}),this['_applyOperationsSet'](_0xf7498,!0x0),this['serverHistory']['version']=-_0xf7498['length']+this['_offset'],this['_updateServerHistory'](_0xf7498);}this['_document']['history']['version']=_0x3e05df,_0xe45589=this['_decompressOperations'](_0xc931da['data'],_0xc931da['metadata']),await this['_fetchMissingUsers'](_0xe45589),this['_applyOperationsSet'](_0xe45589,_0x57b9b3);}_0xc931da['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xe45589,_0xc931da['lastOperationId']),this['_lastSyncedOperationId']=_0xc931da['lastOperationId']),this['serverHistory']['version']=_0x3e05df+this['_offset'],this['_updateServerHistory'](_0xe45589),_0xc81324['filter'](_0x2cebe6=>{const _0x57a460=this['_getAffectedRoot'](_0x2cebe6);return _0x57a460&&!this['_knownRootNames']['has'](_0x57a460);})['forEach']((_0x305258,_0x55d3a4)=>{_0x305258['baseVersion']=this['_document']['version']+_0x55d3a4,this['_saveOperationInBuffer'](_0x305258);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x4da0d6,_0x197a35){const _0x88ac36=_0x197a35&&_0x197a35['message'];if(_0x88ac36&&_0x88ac36['startsWith']('realtimecollaborationclient'))throw _0x197a35;const _0x3639f0=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0x3639f0['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x18d37c(_0x4da0d6,this['editor'],_0x88ac36?{'originalError':_0x88ac36}:void 0x0);}['_saveOperationInBuffer'](_0x1a661f){this['_knownOperations']['has'](_0x1a661f)||(this['_knownOperations']['add'](_0x1a661f),this['_bufferedOperations']['push'](_0x1a661f),this['_pendingAction']||'marker'==_0x1a661f['type']&&!_0x1a661f['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x386fbd=!0x1){!_0x386fbd&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x3719e1=>{_0x3719e1&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x4d2384=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x5b7549){return _0x5b7549['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5b7549['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x5b7549['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x4d2384)||this['_crash'](_0x4d2384['message'],_0x4d2384);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x16a00c=>{this['on']('change:_isPendingUpdate',()=>{_0x16a00c();});});}async['_sendBufferedOperations'](){const _0x8fe68=this['editor']['plugins']['get'](B);if(this['_shouldSendSelectionUpdate']()&&(_0x8fe68['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x3fc4d1=[...this['_bufferedOperations']];for(const _0xe28a7d of _0x3fc4d1)_0xe28a7d['wasUndone']=this['_document']['history']['isUndoneOperation'](_0xe28a7d);const _0x563b8d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3fc4d1),_0x1d4d01=F++,_0x5d342e=this['_compressOperations'](_0x3fc4d1),_0x41250f=await this['_service']['sendOperations'](_0x5d342e,_0x5d342e['baseVersion'],_0x563b8d);try{return await this['_handleServerResponse'](_0x3fc4d1,_0x41250f,_0x1d4d01);}catch(_0x2ebba8){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x2ebba8);}}async['_handleServerResponse'](_0x5c70b5,_0x51609b,_0x12aecd){if('error'in _0x51609b)throw _0x51609b['error'];let _0x2ae146=!0x1;if(_0x51609b['wereChangesApplied']){_0x51609b['lastOperationId']&&(this['_lastSyncedOperationId']=_0x51609b['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5cad25=>!_0x5c70b5['includes'](_0x5cad25));for(const _0x4f8f19 of _0x5c70b5)_0x4f8f19['createdAt']='lastOperationAcceptedAt'in _0x51609b&&_0x51609b['lastOperationAcceptedAt']||void 0x0;G(_0x5c70b5,_0x51609b['version']-_0x5c70b5['length']),this['_updateServerHistory'](_0x5c70b5);const _0x48fba8=_0x5c70b5['filter'](_0x221643=>{if(!_0x221643['_isInit'])return!0x1;const _0x2763a0=this['_getAffectedRoot'](_0x221643);return _0x2763a0&&!this['_knownRootNames']['has'](_0x2763a0);});G(_0x48fba8,this['_document']['version']),this['_applyOperationsSet'](_0x48fba8),_0x2ae146=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x497d9c=this['_decompressOperations'](_0x51609b['data'],_0x51609b['metadata'])['filter'](_0x4ca9d8=>_0x4ca9d8['baseVersion']>=this['_lastServerVersion']);_0x497d9c['forEach'](_0x3bf5a9=>this['_addKnownRoot'](_0x3bf5a9)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x182098=>!_0x182098['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x182098))),this['_bufferedOperations']['length']&&G(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x497d9c),_0x2ae146=this['_handleExternalOperations'](_0x497d9c,_0x51609b['version'],_0x51609b['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x2ae146?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x38bf0e,_0x4d7ca3,_0x4c0fa1){try{const _0x380f6e={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x1315f5,operationsB:_0x48b396,originalOperations:_0x4a6f8e}=_0x1c3c22(_0x38bf0e,this['_bufferedOperations'],_0x380f6e);G(_0x1315f5,this['_document']['version']),G(_0x48b396,_0x4d7ca3);for(const _0x4ab0fb of _0x1315f5){const _0x501abd=_0x4a6f8e['get'](_0x4ab0fb);_0x4ab0fb['_authorId']=_0x501abd?_0x501abd['_authorId']:null;}_0x4c0fa1&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x38bf0e,_0x4c0fa1),this['_lastSyncedOperationId']=_0x4c0fa1),this['_bufferedOperations']=[..._0x48b396],this['_applyOperationsSet'](_0x1315f5),this['_updateServerHistory'](_0x38bf0e);}catch(_0x1f568f){return console['error'](_0x1f568f),!0x1;}return!0x0;}['_applyOperationsSet'](_0x4ecf32,_0x186ae0=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x2e5a68=>{for(const _0x298c00 of _0x4ecf32)this['_knownOperations']['add'](_0x298c00),this['_addKnownRoot'](_0x298c00),_0x2e5a68['batch']['addOperation'](_0x298c00),this['editor']['model']['applyOperation'](_0x298c00);});}['_addKnownRoot'](_0x1e0c58){const _0xe31973=this['_getAffectedRoot'](_0x1e0c58);_0xe31973&&this['_knownRootNames']['add'](_0xe31973);}['_getAffectedRoot'](_0x2601d3){let _0x2273ff,_0x392e83;switch(_0x2601d3['type']){case'insert':_0x2273ff=_0x2601d3['position']['root'];break;case'marker':if(_0x392e83=_0x2601d3['newRange'],!_0x392e83)return null;_0x2273ff=_0x392e83['root'];break;case'addRootAttribute':_0x2273ff=_0x2601d3['root'];break;case'addRoot':_0x2273ff=_0x2601d3['affectedSelectable'];break;case'move':_0x2273ff=_0x2601d3['targetPosition']['root'];break;default:return null;}return _0x2273ff['rootName'];}['_updateServerHistory'](_0x1c513b){_0x1c513b['forEach'](_0x2110d4=>{const _0x2fb60b=_0x2110d4['clone']();_0x2fb60b['_authorId']=_0x2110d4['_authorId'],_0x2fb60b['_isInit']=!!_0x2110d4['_isInit'],_0x2fb60b['createdAt']=_0x2110d4['createdAt'],_0x2fb60b['baseVersion']+=this['_offset'],_0x2110d4['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x2fb60b),this['serverHistory']['addOperation'](_0x2fb60b);});}['_handleReconnectionError'](_0x3a02ab){const _0x29b4ec=this['editor']['plugins']['get']('Notification'),_0x30b562=this['editor']['locale'];_0x3a02ab||(_0x3a02ab=M(_0x30b562,'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.')),_0x29b4ec['showWarning'](_0x3a02ab,{'title':M(_0x30b562,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x438715)['add'](M(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x438715)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x552991){const _0x34204a=_0x552991['map'](_0x217ea5=>_0x217ea5['toJSON']());return this['_compressor']['compress'](_0x34204a);}['_decompressOperations'](_0x2a51a2,_0x3163a8){return this['_compressor']['decompress'](_0x2a51a2)['map']((_0x1d4c98,_0x5aa456)=>{const _0xd5d00a='init'==_0x3163a8[_0x5aa456]['type'];if('InsertOperation'==_0x1d4c98['__className']){const _0xadccb0=_0x1d4c98['position']['root'];!this['_document']['getRoot'](_0xadccb0)&&(this['_document']['createRoot']('$root',_0xadccb0)['_isAttached']=!0x1);}const _0x1559d7=_0x37a7c2['fromJSON'](_0x1d4c98,this['_document']);return _0x1559d7['wasUndone']=_0x1d4c98['wasUndone'],_0x1559d7['_isInit']=_0xd5d00a,_0x1559d7['_authorId']=_0xd5d00a?null:_0x3163a8[_0x5aa456]['userId'],_0x1559d7['_isDisconnection']='cs:removeUser'===_0x3163a8[_0x5aa456]['type'],_0x1559d7['createdAt']=_0x3163a8[_0x5aa456]['createdAt'],_0x1559d7;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x590a4c=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x590a4c&&_0x590a4c['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class q extends Error{}function G(_0x24b5f7,_0x48559c){for(const _0x643d33 of _0x24b5f7)_0x643d33['baseVersion']=_0x48559c++;}class ${['_ignoredOperations'];['_operationToId'];constructor(_0x1880cc){this['_ignoredOperations']=_0x1880cc,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x4741fa){let _0x31ff4c=_0x4741fa['length'];for(;_0x31ff4c--;){const _0x334a22=_0x4741fa[_0x31ff4c];if(!this['_ignoredOperations']['has'](_0x334a22)){if(!this['_operationToId']['has'](_0x334a22)){const _0xc50cc5=_0xdfcc0()['slice'](0x1,0x12);this['_operationToId']['set'](_0x334a22,_0xc50cc5);}return this['_operationToId']['get'](_0x334a22);}}}['setIdForTheLastOperation'](_0x573882,_0x49453b){if(!_0x49453b)return;let _0x26d343=_0x573882['length'];for(;_0x26d343--;){const _0x5ab842=_0x573882[_0x26d343];this['_ignoredOperations']['has'](_0x5ab842)||this['_operationToId']['set'](_0x5ab842,_0x49453b);}}}class n extends _0x1aa6b7{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x5ac5e7{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
-
((()=>ot)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x472340];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x460a9c){super(_0x460a9c),this['_services']=new Map();}async['init'](){const _0x581449=this['context'],_0x3500a2=_0x581449['plugins']['get']('CommentsRepository');if(_0x581449['plugins']['get'](c)['addToReconnectionStack'](this),_0x3500a2['adapter']={'addCommentThread':async({channelId:_0x29626e,threadId:_0x3b4be5,comments:_0x253eee,resolvedAt:_0x440595,resolvedBy:_0x5c0c2a,context:_0x37338a,attributes:_0xe23af})=>{const _0x4c0663=await this['_getService'](_0x29626e)['addCommentThread']({'commentThreadId':_0x3b4be5,'comments':_0x253eee['map'](_0x2c24ad=>function(_0x2c6eb9,_0x2c8920,_0x326cd9){return{'commentThreadId':_0x326cd9,'commentId':_0x2c6eb9['commentId'],'userId':_0x2c6eb9['authorId'],'content':_0x2c6eb9['content'],'documentId':_0x2c8920,'createdAt':_0x2c6eb9['createdAt'],'attributes':_0x2c6eb9['attributes']||{}};}(_0x2c24ad,_0x29626e,_0x3b4be5)),'resolvedAt':_0x440595,'resolvedBy':_0x5c0c2a,'context':_0x37338a,'attributes':_0xe23af})['catch'](wt);return{'threadId':_0x4c0663['commentThreadId'],'comments':_0x4c0663['comments']};},'getCommentThread':async({channelId:_0x26fc24,threadId:_0x1ab062})=>{const _0x3c7e45=await this['_getService'](_0x26fc24)['getCommentThread'](_0x1ab062)['catch'](wt);return _0x3c7e45['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3c7e45]),{'threadId':_0x3c7e45['commentThreadId'],'comments':_0x3c7e45['comments']['map'](ct),'context':_0x3c7e45['context'],'resolvedAt':_0x3c7e45['resolvedAt'],'resolvedBy':_0x3c7e45['resolvedBy'],'attributes':_0x3c7e45['attributes']||{}});},'updateCommentThread':async({channelId:_0xb4dcb1,threadId:_0x17a265,context:_0x5f1e84,unlinkedAt:_0xd0120f,attributes:_0x299ae4})=>this['_getService'](_0xb4dcb1)['updateCommentThread']({'commentThreadId':_0x17a265,'context':_0x5f1e84,'attributes':_0x299ae4,'unlinkedAt':_0xd0120f})['catch'](nt)['catch'](wt),'resolveCommentThread':async({channelId:_0x39ec13,threadId:_0x3c98e9})=>{const _0xfa06c1=await this['_getService'](_0x39ec13)['resolveCommentThread'](_0x3c98e9)['catch'](nt)['catch'](wt);return{'threadId':_0xfa06c1['commentThreadId'],'resolvedAt':_0xfa06c1['resolvedAt'],'resolvedBy':_0xfa06c1['resolvedBy']};},'reopenCommentThread':async({channelId:_0x5ce633,threadId:_0x47efc4})=>this['_getService'](_0x5ce633)['reopenCommentThread'](_0x47efc4)['catch'](nt)['catch'](wt),'removeCommentThread':({channelId:_0x2499d1,threadId:_0x3e0ccd})=>this['_getService'](_0x2499d1)['removeCommentThread'](_0x3e0ccd)['catch'](nt)['catch'](wt),'addComment':({channelId:_0x550e60,threadId:_0x2304ee,commentId:_0x51e894,content:_0x5e6903,attributes:_0x387828})=>this['_getService'](_0x550e60)['addComment'](_0x2304ee,_0x51e894,_0x5e6903,_0x387828)['catch'](wt),'updateComment':({channelId:_0x4f5851,threadId:_0x47c41f,commentId:_0x23980f,content:_0x2f00ea,attributes:_0x361bb2})=>this['_getService'](_0x4f5851)['updateComment'](_0x47c41f,_0x23980f,_0x2f00ea,_0x361bb2)['catch'](nt)['catch'](wt),'removeComment':({channelId:_0x35f0a2,threadId:_0x3b09cd,commentId:_0x3f1ab5})=>this['_getService'](_0x35f0a2)['removeComment'](_0x3b09cd,_0x3f1ab5)['catch'](nt)['catch'](wt)},_0x581449 instanceof et){const _0x2e74ca=_0x581449['config']['get']('collaboration.channelId'),_0x17441d=_0x581449['plugins']['get'](i);await this['_setUpService'](_0x2e74ca);const _0x5def3c=await this['_services']['get'](_0x2e74ca)['getConnectedSessions']();this['listenTo'](_0x17441d,'sessionAdd:'+_0x2e74ca,(_0x3b9773,{session:_0x114ab0})=>{_0x114ab0['id']===_0x17441d['mySessionId']&&(_0x3b9773['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x114ab0['permissions'],_0x2e74ca));}),_0x17441d['register'](_0x2e74ca,_0x5def3c);}}async['_setUpService'](_0x37a9bb){if(this['_services']['has'](_0x37a9bb))throw new _0x18d37c('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x37a9bb});const _0x177ba8=this['context']['plugins']['get']('CommentsRepository'),_0xb3c537=new a['CommentsService'](_0x37a9bb);this['_services']['set'](_0x37a9bb,_0xb3c537),this['listenTo'](_0xb3c537,'commentThreadAdded',(_0x1861bc,_0xc13f3d)=>{const {commentThreadId:_0x484c44,documentId:_0x5ba256,context:_0xbc7712,attributes:_0x17c565,resolvedAt:_0xc78022,resolvedBy:_0x32e644,comments:_0x1f4e55}=_0xc13f3d;_0x177ba8['getCommentThread'](_0x484c44)||_0x177ba8['addCommentThread']({'threadId':_0x484c44,'channelId':_0x5ba256,'comments':_0x1f4e55?_0x1f4e55['map'](ct):[],'context':_0xbc7712,'attributes':_0x17c565,'resolvedAt':_0xc78022,'resolvedBy':_0x32e644,'isFromAdapter':!0x0});}),this['listenTo'](_0xb3c537,'commentThreadUpdated',(_0x3e39a5,{commentThreadId:_0x4f002c,documentId:_0x5e4d97,context:_0xb820ab,unlinkedAt:_0x308678,attributes:_0x3337db})=>{_0x177ba8['getCommentThread'](_0x4f002c)&&_0x177ba8['updateCommentThread']({'threadId':_0x4f002c,'channelId':_0x5e4d97,'context':_0xb820ab,'unlinkedAt':_0x308678,'attributes':_0x3337db,'isFromAdapter':!0x0});}),this['listenTo'](_0xb3c537,'commentThreadResolved',(_0x3cc56c,{commentThreadId:_0x494b88,resolvedBy:_0x5266ab,resolvedAt:_0x5efd61})=>{const _0x8cfe25=_0x177ba8['getCommentThread'](_0x494b88);_0x8cfe25&&_0x8cfe25['resolve']({'resolvedBy':_0x5266ab,'resolvedAt':_0x5efd61,'isFromAdapter':!0x0});}),this['listenTo'](_0xb3c537,'commentThreadReopened',(_0x30114d,{commentThreadId:_0x244097})=>{const _0x494e42=_0x177ba8['getCommentThread'](_0x244097);_0x494e42&&_0x494e42['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0xb3c537,'commentThreadRemoved',(_0x67793,{commentThreadId:_0x5bd076})=>{const _0x101a9a=_0x177ba8['getCommentThread'](_0x5bd076);_0x101a9a&&_0x101a9a['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0xb3c537,'commentAdded',(_0x29bee4,_0x19e10a)=>{const _0x3e96d8=_0x19e10a['commentThreadId'],_0x4322d4=_0x177ba8['getCommentThread'](_0x3e96d8);_0x4322d4&&_0x4322d4['addComment']({...ct(_0x19e10a),'isFromAdapter':!0x0});}),this['listenTo'](_0xb3c537,'commentUpdated',(_0x210c85,{commentThreadId:_0x48a2c6,commentId:_0x30c2cb,content:_0x181aa0,attributes:_0x429fb3})=>{const _0x2caaf2=_0x177ba8['getCommentThread'](_0x48a2c6);if(_0x2caaf2){const _0x1ee0f0=_0x2caaf2['getComment'](_0x30c2cb);_0x1ee0f0&&_0x1ee0f0['update']({'content':_0x181aa0,'attributes':_0x429fb3,'isFromAdapter':!0x0});}}),this['listenTo'](_0xb3c537,'commentRemoved',(_0x1b5927,{commentThreadId:_0x37f7f5,commentId:_0xfd874c})=>{const _0x67d024=_0x177ba8['getCommentThread'](_0x37f7f5);if(_0x67d024){const _0x37f29e=_0x67d024['getComment'](_0xfd874c);_0x37f29e&&_0x37f29e['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x37a9bb);}['destroy'](){if(this['context']instanceof et){const _0x279fc2=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x279fc2);}}['_terminateService'](_0x80e83d){if(!this['_services']['has'](_0x80e83d))throw new _0x18d37c('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x80e83d});this['_getService'](_0x80e83d)['disconnect'](),this['_services']['delete'](_0x80e83d);}async['reconnect'](){for(const _0xd0b5fa of this['_services']['keys']())await this['_connectService'](_0xd0b5fa);if(this['context']instanceof et){const _0xde86a3=this['context']['config']['get']('collaboration.channelId'),_0x44a486=this['context']['plugins']['get'](i);_0x44a486['unregister'](_0xde86a3);const _0x10561d=await this['_services']['get'](_0xde86a3)['getConnectedSessions']();_0x44a486['register'](_0xde86a3,_0x10561d);}}async['_connectService'](_0x555d3b){const {connection:_0x4c5357}=this['context']['plugins']['get'](c),_0x2231fc=this['context']['plugins']['get']('CommentsRepository'),_0x998b9d=this['_services']['get'](_0x555d3b),_0x50f407=await _0x998b9d['connect'](_0x4c5357);await this['_fetchMissingUsersForThreads'](_0x50f407);const _0x58fdc3=new Set(Array['from'](_0x2231fc['getCommentThreads']({'channelId':_0x555d3b}),_0x190019=>_0x190019['id']));for(const _0x426390 of _0x50f407)_0x426390['deletedAt']||_0x58fdc3['delete'](_0x426390['commentThreadId']);for(const _0x232756 of _0x58fdc3)_0x2231fc['getCommentThread'](_0x232756)['remove']({'isFromAdapter':!0x0});for(const _0xd3a9f8 of _0x50f407){let _0x1fe4ff=_0x2231fc['getCommentThread'](_0xd3a9f8['commentThreadId']);const {commentThreadId:_0x3e2460,context:_0x49774c,attributes:_0xfbd689,resolvedBy:_0x179d37,resolvedAt:_0x2f5048,unlinkedAt:_0x455e3a,deletedAt:_0x4f9e71}=_0xd3a9f8;if(_0x4f9e71)continue;_0x1fe4ff||(_0x1fe4ff=_0x2231fc['addCommentThread']({'channelId':_0x555d3b,'threadId':_0x3e2460,'context':_0x49774c,'attributes':_0xfbd689||{},'resolvedBy':_0x179d37,'resolvedAt':_0x2f5048,'unlinkedAt':_0x455e3a,'isFromAdapter':!0x0}));const _0x324c3=new Set(Array['from'](_0x1fe4ff['comments'],_0x46d4c8=>_0x46d4c8['id']));for(const _0x4ebf69 of _0xd3a9f8['comments'])_0x324c3['delete'](_0x4ebf69['commentId']);for(const _0x38a8e5 of _0x324c3)_0x1fe4ff['getComment'](_0x38a8e5)['remove']({'isFromAdapter':!0x0});for(const _0x564f02 of _0xd3a9f8['comments']){const _0xcb7406=_0x1fe4ff['getComment'](_0x564f02['commentId']);_0xcb7406?_0xcb7406['content']!==_0x564f02['content']&&_0xcb7406['update']({'content':_0x564f02['content'],'isFromAdapter':!0x0}):_0x1fe4ff['addComment'](Object['assign'](ct(_0x564f02),{'isFromAdapter':!0x0}));}}}['_getService'](_0x191f28){if(!this['_services']['has'](_0x191f28))throw new _0x18d37c('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x191f28});return this['_services']['get'](_0x191f28);}async['_fetchMissingUsersForThreads'](_0x479b9d){const _0x331ce0=this['context']['plugins']['get'](_0x472340),{connection:_0x3086a9}=this['context']['plugins']['get'](c),_0xb0148b=new Set();for(const {resolvedBy:_0x25d597,comments:_0x7234af}of _0x479b9d){_0x25d597&&!_0x331ce0['getUser'](_0x25d597)&&_0xb0148b['add'](_0x25d597);for(const {userId:_0xe4067b}of _0x7234af)_0x331ce0['getUser'](_0xe4067b)||_0xb0148b['add'](_0xe4067b);}if(0x0===_0xb0148b['size'])return;const _0x10f4fd=await gt['getMany'](_0x3086a9,Array['from'](_0xb0148b));for(const _0x3ff36e of _0x10f4fd)_0x331ce0['getUser'](_0x3ff36e['id'])||_0x331ce0['addUser'](_0x3ff36e);}}async function nt(_0x253540){if('404'!==_0x253540['code'])throw _0x253540;}function wt(_0x382e7d){if((_0x4d3e84=_0x382e7d)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x4d3e84['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4d3e84['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x4d3e84;throw _0x382e7d;}function ct(_0x3863e9){return{'threadId':_0x3863e9['commentThreadId'],'commentId':_0x3863e9['commentId'],'content':_0x3863e9['content'],'createdAt':_0x3863e9['createdAt'],'authorId':_0x3863e9['userId'],'attributes':_0x3863e9['attributes']||{}};}class f extends _0x1aa6b7{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
-
((()=>
|
|
28
|
-
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x472340];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x594b1c){super(_0x594b1c);const _0x2febbf=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x2febbf);}async['init'](){const _0x42d325=this['editor']['plugins']['get'](l),_0x3b77c5=_0x42d325['serverHistory'],_0x3e52e1=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x3b77c5,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x42d325['sessionId']});const _0x548413=this['editor']['config']['get']('cloudServices.bundleVersion')||ht,_0x655bc7=await tt['isBundleUploaded'](_0x3e52e1['connection'],_0x548413);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x8d77ca})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x8d77ca)),'updateRevisions':async _0x46b830=>{await this['_waitForServiceReady']();const _0x4f5b0a=this['_revisionTracker']['currentRevision'];if(_0x655bc7&&0x1===_0x46b830['length']&&_0x46b830[0x0]['id']===_0x4f5b0a['id'])return _0x46b830;for(const _0x2c02c8 of _0x46b830)_0x2c02c8['id']===_0x4f5b0a['id']&&(_0x2c02c8['isEmptyCurrent']=_0x2c02c8['fromVersion']===_0x2c02c8['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x46b830,this['_lastRequestId'])['then'](_0x54083f=>(this['_lastRequestId']=_0x54083f,_0x46b830))['catch'](_0x559448=>{if(st(_0x559448)||'400'===_0x559448['code']&&void 0x0!==_0x559448['data']['wrongRequestId']){for(const _0x5d0d37 of _0x46b830){!this['_revisionTracker']['repository']['getRevision'](_0x5d0d37['id'])||this['_revisionTracker']['_bufferUpdate'](_0x5d0d37['id'],_0x5d0d37,!0x1);}if(st(_0x559448))throw _0x559448;return _0x46b830;}throw _0x559448;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x1bef75,{revisionsData:_0x2f277d,requestId:_0x17e7bc})=>{Math['max'](..._0x2f277d['map'](_0x5f3f09=>_0x5f3f09['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x2f277d,_0x17e7bc);}):this['_handleRevisionsUpdate'](_0x2f277d,_0x17e7bc);});const {revisions:_0x2c4f9c,requestId:_0x400dc6}=await this['_revisionHistoryService']['connect'](_0x3e52e1['connection']);_0x3e52e1['addToReconnectionStack'](this),this['_lastRequestId']=_0x400dc6,await this['_fetchMissingUsers'](_0x2c4f9c);for(const _0xbdb94 of _0x2c4f9c)this['_revisionTracker']['addRevisionData'](_0xbdb94);this['listenTo'](_0x42d325,'change:_isConnected',(_0x46826d,_0x265798,_0xec55ee)=>{_0xec55ee&&(this['_oldOffset']=_0x42d325['_offset'],_0x46826d['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x3e52e1,'state',_0x1f02ce=>_0x1f02ce===_0x5dd3c7['CONNECTED']);}async['reconnect'](){const _0x348276=this['editor']['plugins']['get'](c),_0x207d68=this['editor']['plugins']['get'](l),_0x4c6ecb=async()=>{const _0x25441b=this['_revisionTracker']['currentRevision'],_0x524bec=_0x25441b['id'],_0x383eb9=_0x524bec!==_0x207d68['sessionId'];if(_0x383eb9){const _0x22d30e=_0x207d68['_offset']-this['_oldOffset'],_0x1a307b=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x25441b['toVersion']+_0x22d30e!==_0x1a307b){const _0x48ed5a=_0x25441b['fromVersion']+_0x22d30e,_0x319e74=this['editor']['plugins']['get'](_0x472340),_0xd00217=this['_revisionTracker']['buildRevisionData']({'revision':_0x25441b,'from':_0x48ed5a,'to':_0x1a307b});_0xd00217['id']=_0x25441b['id'];const _0x4483ee=_0xd00217['authorsIds']['map'](_0xd87779=>_0x319e74['getUser'](_0xd87779));_0x25441b['_update']({..._0xd00217,'authors':_0x4483ee},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x25441b['id'],_0xd00217,!0x0);}this['_revisionTracker']['_startingVersion']=_0x1a307b,(_0x25441b['toVersion']===_0x25441b['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x524bec)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x524bec),this['_revisionTracker']['_createCurrentRevision'](_0x1a307b));}const {revisions:_0x143010,requestId:_0x50b3fe}=await this['_revisionHistoryService']['reconnect'](_0x348276['connection'],this['_lastRequestId']);_0x383eb9&&_0x143010['length']>0x0?_0x207d68['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x143010),this['_handleRevisionsUpdate'](_0x143010,_0x50b3fe),this['_revisionTracker']['sendBufferedUpdates']());};return _0x207d68['_isConnected']?_0x4c6ecb():new Promise((_0x54766b,_0x5e8d24)=>{_0x207d68['once']('change:_isConnected',()=>{_0x4c6ecb()['then'](_0x54766b)['catch'](_0x5e8d24);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x1b2d76=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x26395c=>{_0x26395c['off'](),_0x1b2d76();});});}['_getLatestVersionFromServerOperations'](){const _0x526d96=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x13d3a9 of _0x526d96)if('marker'!==_0x13d3a9['type']||_0x13d3a9['affectsData'])return _0x13d3a9['baseVersion']+0x1;}['_getLatestVersion'](){const _0x2c1513=this['editor']['plugins']['get'](l);return new Promise(_0xa33b61=>{_0x2c1513['_isPendingUpdate']?_0x2c1513['once']('change:_isPendingUpdate',()=>{_0xa33b61(this['_getLatestVersionFromServerOperations']());}):_0xa33b61(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x109475,_0x5232b6){const _0x763941=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x5232b6;for(const _0x21312b of _0x109475){const _0x52ff5e=_0x763941['getRevision'](_0x21312b['id']);if(_0x52ff5e){if((_0x21312b['fromVersion']||_0x21312b['toVersion'])&&(_0x21312b['diffData']=null),_0x52ff5e===this['_revisionTracker']['currentRevision']){const _0x534e32=Math['max'](_0x52ff5e['toVersion'],_0x21312b['toVersion']),_0x516981=Math['max'](_0x52ff5e['fromVersion'],_0x21312b['fromVersion']);let _0x646a5a;_0x52ff5e['toVersion']===_0x21312b['toVersion']&&_0x52ff5e['fromVersion']===_0x21312b['fromVersion']?(_0x646a5a=!0x0,this['_preventResendingRevisionData'](_0x21312b)):_0x21312b['toVersion']===_0x534e32&&_0x21312b['fromVersion']===_0x516981?_0x646a5a=!0x1:(_0x52ff5e['toVersion']===_0x534e32&&_0x52ff5e['fromVersion']===_0x516981||this['_fixRevision']({'revision':_0x52ff5e,'from':_0x516981,'to':_0x534e32}),_0x646a5a=!0x0),_0x646a5a&&(delete _0x21312b['fromVersion'],delete _0x21312b['toVersion'],delete _0x21312b['diffData'],delete _0x21312b['createdAt'],delete _0x21312b['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x21312b),this['_preventResendingRevisionData'](_0x21312b);}else this['_revisionTracker']['addRevisionData'](_0x21312b);}const _0x2be276=_0x763941['getRevisions']();_0x2be276['reverse']();for(let _0x3702e7=0x0;_0x3702e7<_0x2be276['length']-0x1;_0x3702e7++){const _0x544f2e=_0x2be276[_0x3702e7],_0x16f9f9=_0x2be276[_0x3702e7+0x1];if(_0x544f2e['fromVersion']<_0x16f9f9['toVersion']){const _0x106e17=_0x16f9f9['toVersion'],_0x22f6d7=Math['max'](_0x106e17,_0x544f2e['toVersion']);this['_fixRevision']({'revision':_0x544f2e,'from':_0x106e17,'to':_0x22f6d7});}}}['_fixRevision']({revision:_0x134acd,from:_0x1f7aa9,to:_0x545189}={}){const _0x30bf50=this['editor']['plugins']['get'](_0x472340),_0x58b33f=this['_revisionTracker']['buildRevisionData']({'revision':_0x134acd,'from':_0x1f7aa9,'to':_0x545189});_0x58b33f['authors']=_0x58b33f['authorsIds']['map'](_0x5c91fe=>_0x30bf50['getUser'](_0x5c91fe)),_0x134acd['_update'](_0x58b33f);}['_preventResendingRevisionData'](_0x358773){const _0x54ad4e={};_0x54ad4e['id']=_0x358773['id'];for(const _0x2ef693 of Object['keys'](_0x358773))'id'!==_0x2ef693&&(_0x54ad4e[_0x2ef693]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x54ad4e['id'],_0x54ad4e,!0x0);}async['_fetchMissingUsers'](_0x3f0c4a){const _0x2851ee=this['editor']['plugins']['get'](_0x472340),{connection:_0x2d8852}=this['editor']['plugins']['get'](c),_0x124dff=new Set();for(const _0xd7ef45 of _0x3f0c4a){for(const _0x2dce10 of _0xd7ef45['authorsIds'])_0x39b7a3(_0x2dce10);_0xd7ef45['creatorId']&&_0x39b7a3(_0xd7ef45['creatorId']);}if(0x0===_0x124dff['size'])return;const _0x292d5c=await gt['getMany'](_0x2d8852,Array['from'](_0x124dff));for(const _0x1b70ea of _0x292d5c)_0x2851ee['getUser'](_0x1b70ea['id'])||_0x2851ee['addUser'](_0x1b70ea);function _0x39b7a3(_0x130529){_0x2851ee['getUser'](_0x130529)||_0x124dff['add'](_0x130529);}}}function st(_0x7fbd97){return _0x7fbd97['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x7fbd97['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x7fbd97['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x1aa6b7{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class A extends _0x47d96b{['_collapseAt'];constructor(_0x41c17b,_0x458da6=0x6){super(_0x41c17b);const _0x3ad5fc=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x458da6,this['bind']('isHidden')['to'](this,'usersCount',_0x59c7e8=>_0x59c7e8<_0x458da6),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x3ad5fc['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':_0x3ad5fc['to']('usersCount',_0xdf06cd=>'+'+(_0xdf06cd-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x47d96b{['items'];['keystrokes'];constructor(_0x3dc22a){super(_0x3dc22a);const _0x25bc69=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x983a0a(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x25bc69['if']('hasPopup'),'aria-expanded':_0x25bc69['to']('isExpanded',_0x50fff3=>this['hasPopup']&&String(_0x50fff3)),'aria-label':_0x25bc69['to']('hasPopup',_0x25ef4d=>M(_0x3dc22a,_0x25ef4d?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x25bc69['to']('hasPopup',_0x11fba4=>!!_0x11fba4&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x25bc69['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x25bc69['to'](_0x562004=>{const _0x3a8208=_0x562004,_0x2cc9cb=document['querySelector']('.ck-presence-list__dropdown-list'),_0xb66f40=document['querySelector']('.ck-balloon-panel_with-arrow');_0x2cc9cb?.['contains'](_0x3a8208['relatedTarget'])||_0xb66f40?.['contains'](_0x3a8208['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x347077,_0x457c39,_0x5772bf)=>{this['element']&&(_0x5772bf?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class j extends _0x47d96b{['counterView'];['inlineListView'];constructor(_0x589adf,_0x334508=0x6){super(_0x589adf);const _0x4e92f5=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new A(this['locale'],_0x334508),this['inlineListView']=new ts(_0x589adf),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x1f1a31 of this['inlineListView']['items'])_0x1f1a31['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',_0x4e92f5['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class x extends _0x47d96b{['listWrapperView'];constructor(_0x1c1b9a,_0x3c7c5b){super(_0x1c1b9a);const _0x597a23=this['bindTemplate'];this['listWrapperView']=new _t(_0x1c1b9a,_0x3c7c5b),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':M(_0x1c1b9a,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x597a23['to'](_0x40ef8d=>{const _0xde1965=_0x40ef8d,_0x4a34a5=document['querySelector']('.ck-presence-list__list'),_0x51a65b=document['querySelector']('.ck-balloon-panel_with-arrow');_0x4a34a5?.['contains'](_0xde1965['relatedTarget'])||_0x51a65b?.['contains'](_0xde1965['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class _t extends _0x315988{constructor(_0x51996f,_0x4b4849){super(_0x51996f);const _0x4a8289=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x4b4849?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x4a8289['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x4a8289['to']('role'),'aria-label':_0x4a8289['to']('ariaLabel'),'aria-labelledby':_0x4a8289['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x5d6a2f['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x15db48=this['element'];_0x15db48&&(this['_isScrollable']=Math['max'](_0x15db48['scrollHeight'],_0x15db48['clientHeight'])>0.8*window['innerHeight']);}}class k extends lt{['userView'];constructor(_0x58cdbe,_0x27530c,_0x4a3714){super(_0x58cdbe);const _0xb88a24=this['bindTemplate'];this['userView']=new ut(_0x58cdbe,_0x27530c);const _0x1772f2={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x27530c['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x27530c['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x27530c['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x4a3714&&(_0x1772f2['tag']='button',_0x1772f2['on']={'click':_0xb88a24['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1772f2);}['focus'](){this['element']['focus']();}}class y extends _0x47d96b{['userView'];['markerView'];constructor(_0x57aec6,_0x5bb1f3,_0x51d165){super(_0x57aec6);const _0x443e0e=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ut(_0x57aec6,_0x5bb1f3),this['markerView']=new dt(_0x57aec6,_0x5bb1f3);const _0xc66972=new pt(_0x57aec6);_0xc66972['template']['tag']='span',_0xc66972['text']=_0x5bb1f3['name'];const _0x2bb1bd={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x443e0e['to']('isFocusable',_0x2ad2eb=>!!_0x2ad2eb&&0x0),'aria-labelledby':_0xc66972['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x443e0e['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x443e0e['to']('hasTooltip',_0x2bdf77=>!_0x2bdf77),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0xc66972]};_0x51d165&&(_0x2bb1bd['tag']='button',_0x2bb1bd['on']={'click':_0x443e0e['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2bb1bd);}}class dt extends _0x47d96b{constructor(_0x9d1046,_0x1c3a19){super(_0x9d1046),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1c3a19['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const C={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x5ac5e7{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x56ad50){super(_0x56ad50),this['context']['config']['define']('presenceList',C);const _0x555f4e=_0x56ad50['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x555f4e)throw new _0x18d37c('presencelist-collapseat-invalid-format',this);if(_0x555f4e<0x1)throw new _0x18d37c('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x198913(),this['balloonPanelView']=new _0xfb9262(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x361db2 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x361db2);this['listenTo'](this['_allConnectedUsers'],'add',(_0x1a9566,_0x1ab36a)=>{this['_handleUserAdd'](_0x1ab36a);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x47f974,_0xad939b)=>{this['_handleUserRemove'](_0xad939b);});}['_createView'](){const _0x2ec955=this['context'],_0x4c3a1e=new j(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x595336=this['balloonPanelView'];if(!_0x4f211d(_0x2ec955['config']['get']('presenceList.container')))throw new _0x18d37c('presencelist-missing-container',this);return _0x4c3a1e['counterView']['bind']('usersCount')['to'](this),_0x4c3a1e['bind']('isCollapsed')['to'](this,'usersCount',_0x9dcb9f=>{const {collapseAt:_0xd451f2}=_0x2ec955['config']['get']('presenceList'),_0x4ab659=_0x9dcb9f>=_0xd451f2;if(_0x4ab659&&!_0x4c3a1e['inlineListView']['items']['find'](_0x180261=>_0x180261 instanceof A)){const _0x1183d0=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x1183d0&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x4c3a1e['inlineListView']['items']['add'](_0x4c3a1e['counterView']);}return _0x4ab659||this['hideDropdown'](),_0x4ab659;}),_0x4c3a1e['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x66a06c=>{const _0x45f84b=_0x2ec955['config']['get']('presenceList'),_0x321c6d=new y(_0x2ec955['locale'],_0x66a06c,!!_0x45f84b['onClick']);return _0x321c6d['bind']('hasTooltip')['to'](_0x4c3a1e,'isCollapsed',_0x55a3a9=>!_0x55a3a9),_0x321c6d['bind']('isFocusable')['to'](_0x4c3a1e,'isCollapsed',_0x2aadc9=>!_0x2aadc9),_0x45f84b['onClick']&&this['listenTo'](_0x321c6d,'execute',()=>{this['view']['isCollapsed']||_0x45f84b['onClick'](_0x66a06c,_0x321c6d['element']);}),_0x321c6d;}),this['listenTo'](_0x4c3a1e['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x4c3a1e['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x4c3a1e['inlineListView']['keystrokes']['set']('Enter',(_0x277d58,_0x3c5451)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x3c5451());}),_0x4c3a1e['render'](),_0x595336['render'](),_0x41e088({'emitter':_0x4c3a1e,'activator':()=>_0x595336['isVisible'],'contextElements':[_0x595336['element'],_0x4c3a1e['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x2ec955['config']['get']('presenceList.container')['appendChild'](_0x4c3a1e['element']),this['_bodyCollection']=new _0x290223(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x4c3a1e;}['_handleUserAdd'](_0x2a4506){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x2a4506['isMe'])return;const _0x19ba61=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x19ba61-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x46ec28=_0x2a4506['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x2a4506,_0x46ec28);}['_handleUserRemove'](_0x1b954b){this['usersCount']--;const {collapseAt:_0x51a250}=this['context']['config']['get']('presenceList'),_0x579d0f=this['usersCount']>=_0x51a250;if(this['currentDisplayedUsers']['get'](_0x1b954b['id']))this['currentDisplayedUsers']['remove'](_0x1b954b['id']);else{if(_0x579d0f&&this['currentDisplayedUsers']['length']+0x1===_0x51a250-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x579d0f?0x1:0x0)<this['usersCount']){for(const _0x4c05a9 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x4c05a9['id'])&&(this['currentDisplayedUsers']['add'](_0x4c05a9,Math['min'](this['currentDisplayedUsers']['length']-(_0x579d0f?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x579d0f?0x1:0x0)===_0x51a250-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x5ab4a8=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new x(this['context']['locale'],!!_0x5ab4a8['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x4d9a66}=this['presenceDropdownView'];_0x4d9a66['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x5d4fdc=>{if(!_0x5ab4a8['displayMe']&&_0x5d4fdc['isMe'])return null;const _0x1e99ff=new k(this['context']['locale'],_0x5d4fdc,!!_0x5ab4a8['onClick']);return _0x5ab4a8['onClick']&&this['listenTo'](_0x1e99ff,'execute',()=>{_0x5ab4a8['onClick'](_0x5d4fdc,_0x1e99ff['element']);}),_0x1e99ff;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x4d9a66['focus'](),_0x4d9a66['checkIfScrollable']();const _0x51bffb=(_0x557cf1,_0x35d6a8)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x35d6a8();};_0x4d9a66['keystrokes']['set']('Esc',_0x51bffb),_0x4d9a66['keystrokes']['set']('Shift+Tab',_0x51bffb),_0x4d9a66['keystrokes']['set']('Tab',(_0x24d841,_0x482224)=>{!function(_0x307b5f){const _0x15645b=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x327ef4=>_0x327ef4+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x270f63=[...document['body']['querySelectorAll'](_0x15645b)]['filter'](_0x35faec=>_0x35faec===document['activeElement']||_0x35faec['offsetWidth']+_0x35faec['offsetHeight']>0x0)['sort']((_0x92eab3,_0x296bc8)=>(_0x92eab3['tabIndex']||0x0)-(_0x296bc8['tabIndex']||0x0)),_0x13f844=_0x270f63['indexOf'](_0x307b5f),_0x4184ea=_0x270f63[(_0x13f844+0x1)%_0x270f63['length']];_0x4184ea&&_0x4184ea['focus']();}(this['view']['element']),this['hideDropdown'](),_0x482224();}),_0x4d9a66['focusTracker']['add'](this['view']['element']),_0x4d9a66['focusTracker']['on']('change:isFocused',(_0x663181,_0x191886,_0x376401)=>{_0x376401||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class s extends _0x5ac5e7{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges,i as Sessions};
|
|
23
|
+
import{ContextPlugin as _0x92af73,Plugin as _0x209efd,PendingActions as _0x4440f0,Context as _0x8f62a}from'@ckeditor/ckeditor5-core/dist/index.js';import{DomEmitterMixin as _0x18b481,CKEditorError as _0x5bf925,Collection as _0xce3908,global as _0x3ae409,version as nt,uid as _0x2891ce,KeystrokeHandler as _0x4fbca3}from'@ckeditor/ckeditor5-utils/dist/index.js';import{Notification as _0x6535bd,View as _0x407c4a,ListView as _0x15aced,ListItemView as rt,LabelView as ot,BalloonPanelView as _0x196f93,clickOutsideHandler as _0x1f3952,BodyCollection as _0x4b9063}from'@ckeditor/ckeditor5-ui/dist/index.js';import{LiveRange as ht,History as _0x34ed6b,NoOperation as _0x4283a4,InsertOperation as _0x4719f1,MarkerOperation as _0x1a9f01,RootAttributeOperation as _0x57948c,transformSets as _0x4f6485,OperationFactory as _0x1bf20f}from'@ckeditor/ckeditor5-engine/dist/index.js';import{WebSocketGateway as lt,WEB_SOCKET_GATEWAY_STATES as _0x462527,CollaborativeEditingService as _0x3f11bb,User as dt,CommentsService as _0x35384d,TrackChangesService as et,RevisionHistoryService as it,EditorService as tt}from'@ckeditor/ckeditor-cloud-services-collaboration/dist/index.js';import{Users as _0x302dba,UserView as ct}from'ckeditor5-collaboration/dist/index.js';import{Compressor as _0x182859}from'@ckeditor/ckeditor5-operations-compressor/dist/index.js';import{isElement as _0x3975ce}from'es-toolkit/compat';class c extends _0x92af73{static ['WebSocketGateway']=/* #__PURE__ -- @preserve */
|
|
24
|
+
((()=>lt)());static ['initialReconnectionInterval']=0x3e8;['connection'];['_reconnectionStack'];['_shouldPluginsReconnect'];['_domEmitter'];static get['requires'](){return['CloudServices',_0x6535bd];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x74b75c){super(_0x74b75c),this['set']('state',_0x462527['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=Object['create'](_0x18b481);}['init'](){const _0x3803fc=this['context'],_0x2ba424=_0x3803fc['plugins']['get']('CloudServices'),_0x21aa76=_0x3803fc['plugins']['get'](_0x6535bd);if(!_0x2ba424['token'])throw new _0x5bf925('websocketgateway-missing-token',this);if(!_0x2ba424['webSocketUrl'])throw new _0x5bf925('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),c['WebSocketGateway']['connect'](_0x2ba424['token'],_0x2ba424['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x4abe5=>{if(this['connection']=_0x4abe5,this['bind']('state')['to'](_0x4abe5,'state',this,'_isBrowserOffline',(_0x318a3c,_0x10314e)=>('connected'!==_0x318a3c&&(this['_shouldPluginsReconnect']=!0x0),_0x10314e||_0x318a3c!==_0x462527['CONNECTED']?_0x462527['DISCONNECTED']:this['state']==_0x462527['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x462527['CONNECTING']):_0x462527['CONNECTED'])),this['connection']['on']('error',(_0x457657,_0x2bc977)=>{if('limitExceeded'!==_0x2bc977['code'])throw console['error'](_0x2bc977),new _0x5bf925('cloudservices-init',null,{'originalError':_0x2bc977});_0x21aa76['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'});}),!_0x4abe5['me'])return new Promise(_0x230ea6=>_0x4abe5['on']('change:me',_0x230ea6));})['catch'](_0x50e2b1=>{throw console['error'](_0x50e2b1),new _0x5bf925('cloudservices-init',null,{'originalError':_0x50e2b1});});}['addToReconnectionStack'](_0x58d6b5){if('function'!=typeof _0x58d6b5['reconnect'])throw new _0x5bf925('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x58d6b5))throw new _0x5bf925('websocketgateway-plugin-already-registered',this,{'name':_0x58d6b5['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x58d6b5);}['removeFromReconnectionStack'](_0x3abb2c){this['_reconnectionStack']['delete'](_0x3abb2c);}['isInReconnectionStack'](_0x26f670){return this['_reconnectionStack']['has'](_0x26f670);}['_reconnect'](){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x5d5799=>_0x5d5799['reconnect']())))['then'](()=>this['state']=_0x462527['CONNECTED'])['catch'](_0x38070e=>{throw console['error'](_0x38070e),new _0x5bf925('cloudservices-reconnection-error',this['context']);});}['disconnect'](){this['connection']&&this['connection']['disconnect'](),this['state']=_0x462527['DISCONNECTED'],this['_domEmitter']['stopListening']();}['destroy'](){this['disconnect'](),super['destroy']();}}class i extends _0x92af73{['channelSessions'];['channelConnectedUsers'];['allConnectedUsers'];['_registeredSessions'];['_uniqueUsersCount'];['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get['requires'](){return[c,_0x302dba];}constructor(_0x411090){super(_0x411090),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0xce3908(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x302dba);}['init'](){const _0x139037=this['context']['plugins']['get'](c);this['listenTo'](_0x139037,'change:state',(_0x132d52,_0x5bff4d,_0x1045e7)=>{if('connected'!==_0x1045e7)this['channelSessions']['forEach'](_0x492762=>_0x492762['clear']()),this['channelConnectedUsers']['forEach'](_0x26a057=>_0x26a057['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x2654c8,_0x4be2a5]of this['_registeredSessions'])for(const _0xd54a05 of _0x4be2a5)this['_handleSessionAdd'](_0x2654c8,_0xd54a05);}}),this['_createUser'](_0x139037['connection']['me'],!0x0);}['register'](_0x29548e,_0x136cb9){if(this['_registeredSessions']['has'](_0x29548e))throw new _0x5bf925('sessions-register-already-registered',null,{'channelId':_0x29548e});this['_registeredSessions']['set'](_0x29548e,_0x136cb9),this['channelSessions']['set'](_0x29548e,new _0xce3908()),this['channelConnectedUsers']['set'](_0x29548e,new _0xce3908()),this['listenTo'](_0x136cb9,'add',(_0x5f045d,_0x2f8414)=>this['_handleSessionAdd'](_0x29548e,_0x2f8414)),this['listenTo'](_0x136cb9,'remove',(_0x1bedef,_0x22ab46)=>this['_handleSessionRemove'](_0x29548e,_0x22ab46));for(const _0x4e3637 of _0x136cb9)this['_handleSessionAdd'](_0x29548e,_0x4e3637);}['unregister'](_0x3225fe){if(!this['_registeredSessions']['has'](_0x3225fe))throw new _0x5bf925('sessions-unregister-not-exist',null,{'channelId':_0x3225fe});const _0x2366e0=this['_registeredSessions']['get'](_0x3225fe);this['stopListening'](_0x2366e0);for(const _0x538a4e of _0x2366e0)'connected'===this['context']['plugins']['get'](c)['state']&&this['_handleSessionRemove'](_0x3225fe,_0x538a4e);this['_registeredSessions']['delete'](_0x3225fe),this['channelSessions']['delete'](_0x3225fe),this['channelConnectedUsers']['delete'](_0x3225fe);}get['mySessionId'](){return this['context']['plugins']['get'](c)['connection']['sessionId'];}['getUserBySessionId'](_0x51ad59){for(const _0x5766ac of this['channelSessions']['values']())for(const _0x4339a8 of _0x5766ac)if(_0x4339a8['id']===_0x51ad59)return _0x4339a8['user'];}['getUserSessions'](_0x237abe,_0xffe443){const _0x3f62b6=_0xffe443?[this['channelSessions']['get'](_0xffe443)]:this['channelSessions']['values'](),_0x5dc416=new Set();for(const _0x1c2f46 of _0x3f62b6)for(const _0x574ac4 of _0x1c2f46)_0x574ac4['user']['id']===_0x237abe['id']&&_0x5dc416['add'](_0x574ac4['id']);return _0x5dc416;}['getUserRole'](_0xaeb67a){for(const _0x1cb89a of this['channelSessions']['values']())for(const _0x5d1770 of _0x1cb89a)if(_0x5d1770['user']===_0xaeb67a)return _0x5d1770['role'];}['_handleSessionAdd'](_0x572591,_0x2f9160){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x61c8d0=_0x2f9160['user'],_0x4774fd=this['_users']['getUser'](_0x61c8d0['id'])||this['_createUser'](_0x61c8d0),_0x254212=Object['assign']({},_0x2f9160,{'user':_0x4774fd});this['channelSessions']['get'](_0x572591)['add'](_0x254212);const _0x50125d=this['channelConnectedUsers']['get'](_0x572591);_0x50125d['has'](_0x4774fd['id'])||_0x50125d['add'](_0x4774fd),this['allConnectedUsers']['has'](_0x4774fd['id'])||this['allConnectedUsers']['add'](_0x4774fd,_0x4774fd['isMe']?0x0:void 0x0),this['fire']('sessionAdd:'+_0x572591,{'channelId':_0x572591,'session':_0x254212});}['_handleSessionRemove'](_0x8492aa,_0x29cb1a){if('connected'!==this['context']['plugins']['get'](c)['state'])return;const _0x4a968f=this['channelConnectedUsers']['get'](_0x8492aa),_0x2a7f16=_0x29cb1a['user'];_0x2a7f16['id']&&(this['channelSessions']['get'](_0x8492aa)['remove'](_0x29cb1a['id']),_0x4a968f['has'](_0x2a7f16['id'])&&!this['getUserSessions'](_0x2a7f16,_0x8492aa)['size']&&_0x4a968f['remove'](_0x2a7f16['id']),this['allConnectedUsers']['get'](_0x2a7f16['id'])&&!this['getUserSessions'](_0x2a7f16)['size']&&this['allConnectedUsers']['remove'](_0x2a7f16['id']));}['_createUser'](_0xa1562a,_0x3d6b41){const _0x5665c5=this['_users']['addUser'](_0xa1562a);return _0x3d6b41&&this['_users']['defineMe'](_0xa1562a['id']),_0x5665c5['orderNumber']=this['_uniqueUsersCount']++,_0x5665c5;}}class q extends _0x209efd{['_domEmitter']=new(_0x18b481())();static get['requires'](){return[i];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x17005a=this['editor'],_0x22c128=_0x17005a['plugins']['get'](i);_0x17005a['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x11ef81,{writer:_0x527e97})=>function(_0x375f86,_0x3e16e0,_0x25a8e7,_0x5d70b6){const _0x64962a=_0x375f86['markerName']['split'](':')[0x2],_0x1c757c=_0x25a8e7['getUserBySessionId'](_0x64962a);if(!_0x1c757c||_0x64962a===_0x25a8e7['mySessionId'])return;if(!_0x5d70b6['model']['schema']['checkChild'](_0x375f86['markerRange']['start'],'$text'))return;const _0x1afef0={'class':'ck-user__marker\x20'+_0x1c757c['color']['getMarkerClass'](),'data-name':_0x1c757c['name'],'data-session-id':_0x64962a},_0x2ed422=_0x5d70b6['model']['markers']['get'](_0x375f86['markerName']),_0x2a3494=_0x2ed422['getStart'](),_0x1cdd4a=_0x2a3494['nodeAfter'],_0x5c385d=_0x5d70b6['model']['schema'];if(_0x1cdd4a&&_0x5c385d['isObject'](_0x1cdd4a)&&_0x5c385d['isInline'](_0x1cdd4a)&&!_0x5d70b6['model']['markers']['get']('user:range:'+_0x64962a)['getRange']()['isCollapsed'])return;const _0x2ece7e=_0x2a3494['parent'];return _0x5d70b6['model']['schema']['isLimit'](_0x2ece7e)&&!_0x5d70b6['model']['hasContent'](_0x2ece7e)&&(_0x1afef0['contenteditable']=!0x1),function(_0x3ce81d,_0x5c6c83,_0x428a59){const _0xa07c59=_0x3ce81d['createUIElement']('span',_0x5c6c83);return _0x3ce81d['setCustomProperty']('userPositionMarker',!0x0,_0xa07c59),_0xa07c59['render']=function(_0x5ca0e3){const _0x514715=this['toDomElement'](_0x5ca0e3),_0x56b235=document['createElement']('span');return _0x56b235['classList']['add']('ck-user__marker-tooltip'),_0x56b235['setAttribute']('contenteditable','false'),_0x56b235['setAttribute']('spellcheck','false'),_0x56b235['textContent']=_0x428a59['name'],_0x514715['innerHTML']='<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x56b235['outerHTML']+'',_0x514715['addEventListener']('mouseenter',()=>{_0x514715['classList']['add']('ck-user__marker_hovered');}),_0x514715['addEventListener']('mouseleave',()=>{_0x514715['classList']['remove']('ck-user__marker_hovered');}),_0x514715;},_0xa07c59['isSimilar']=function(_0x2ef8ad){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2ef8ad['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2ef8ad['getAttribute']('data-session-id'));},_0xa07c59;}(_0x3e16e0,_0x1afef0,_0x1c757c);}(_0x11ef81,_0x527e97,_0x22c128,_0x17005a)}),_0x17005a['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x200a4c=>function(_0x45ec74,_0x3e5af6){const _0x386e14=_0x45ec74['markerName']['split'](':')[0x2];if(_0x386e14===_0x3e5af6['mySessionId'])return null;const _0x4981c1=_0x3e5af6['getUserBySessionId'](_0x386e14);if(!_0x4981c1)return{'id':_0x386e14,'classes':[]};return{'id':_0x386e14,'classes':['ck-user__selection',_0x4981c1['color']['getSelectionClass']()],'attributes':{'data-session-id':_0x386e14},'priority':0x7d0+_0x4981c1['orderNumber']};}(_0x200a4c,_0x22c128)}),function(_0x50ff90){const _0x167099=_0x50ff90['model'],_0xa1cbd2=new Map(),_0x8d2d36=_0x50ff90['plugins']['get'](i);_0x167099['markers']['on']('update:user:range',(_0x347710,_0x4162fc,_0x2b5e2f,_0x4d9393)=>{if(!_0x4d9393&&_0xa1cbd2['get'](_0x4162fc['name']))return _0xa1cbd2['get'](_0x4162fc['name'])['detach'](),void _0xa1cbd2['delete'](_0x4162fc['name']);const _0x26b474=_0x4162fc['name']['split'](':')[0x2];if(_0x26b474===_0x8d2d36['mySessionId'])return;const _0x2fd281='user:position:'+_0x26b474;_0x167099['markers']['has'](_0x2fd281)&&_0x50ff90['editing']['reconvertMarker'](_0x2fd281),_0x4162fc['on']('change:range',(_0x4d40fb,_0x3e3854,_0x468481)=>{if('$graveyard'!=_0x3e3854['root']['rootName']&&'$graveyard'==_0x4162fc['getRange']()['root']['rootName']&&!_0xa1cbd2['has'](_0x4162fc['name'])){const _0x389bab=_0x167099['schema']['getNearestSelectionRange'](_0x468481['deletionPosition']);if(_0x389bab){const _0x3ac40a=ht['fromRange'](_0x389bab);_0xa1cbd2['set'](_0x4162fc['name'],_0x3ac40a),_0x3ac40a['on']('change:range',(_0x4d729e,_0x2ab349,_0x40e63f)=>{if('$graveyard'==_0x3ac40a['root']['rootName']){const _0x9fb0e7=_0x167099['schema']['getNearestSelectionRange'](_0x40e63f['deletionPosition']);_0x9fb0e7?(_0x3ac40a['start']=_0x9fb0e7['start'],_0x3ac40a['end']=_0x9fb0e7['end']):(_0xa1cbd2['delete'](_0x4162fc['name']),_0x3ac40a['detach']());}});}}});}),_0x167099['document']['on']('change',()=>{_0xa1cbd2['size']>0x0&&_0x167099['enqueueChange']({'isUndoable':!0x1},_0x4f1c29=>{for(const [_0x4e5e70,_0x5f37b0]of _0xa1cbd2)'$graveyard'==_0x167099['markers']['get'](_0x4e5e70)['getRange']()['root']['rootName']&&(te(_0x4e5e70['split'](':')[0x2],_0x5f37b0['toRange'](),_0x167099,_0x4f1c29),_0x5f37b0['detach']());_0xa1cbd2['clear']();});});}(_0x17005a),this['_domEmitter']['listenTo'](_0x3ae409['document'],'keydown',(_0x1660d9,{key:_0xe5f14d})=>{'Escape'===_0xe5f14d&&function(_0x3f6d6d){_0x3f6d6d['editing']['view']['change'](_0x11f129=>{for(const _0x40e7e8 of _0x3f6d6d['model']['markers']){if(!_0x40e7e8['name']['startsWith']('user:position'))continue;const _0x43da3e=_0x3f6d6d['editing']['mapper']['markerNameToElements'](_0x40e7e8['name']);if(_0x43da3e){for(const _0x1dabc1 of _0x43da3e)_0x11f129['removeClass']('ck-user__marker_hovered',_0x1dabc1);}}});}(_0x17005a);},{'useCapture':!0x0});}['afterInit'](){const _0x2fa4e1=this['editor'],_0x4d6416=_0x2fa4e1['commands']['get']('undo');_0x4d6416&&_0x2fa4e1['model']['on']('applyOperation',(_0x17539f,_0x1db76d)=>{const _0x3497f0=_0x1db76d[0x0];if(!_0x3497f0['isDocumentOperation'])return;if('marker'!=_0x3497f0['type']||!_0x3497f0['name']['startsWith']('user:'))return;const _0x4fe24b=_0x3497f0['batch'];_0x4d6416['_createdBatches']['has'](_0x4fe24b)&&(_0x3497f0['newRange']=_0x3497f0['oldRange']?_0x2fa4e1['model']['createRange'](_0x3497f0['oldRange']['start'],_0x3497f0['oldRange']['end']):null);},{'priority':'highest'});}['destroy'](){return this['_domEmitter']['stopListening'](),super['destroy']();}['createUserMarkerOperations'](){const _0x38ebca=this['editor'],_0x372dde=_0x38ebca['model']['document'],_0x2827ae=_0x38ebca['plugins']['get'](i);_0x38ebca['model']['enqueueChange']({'isUndoable':!0x1},_0x5c03c4=>{const _0x53915f='user:range:'+_0x2827ae['mySessionId'],_0x333e8c='user:position:'+_0x2827ae['mySessionId'],_0x2c5272=_0x38ebca['model']['markers']['has'](_0x53915f);_0x38ebca['editing']['view']['hasDomSelection']?te(_0x2827ae['mySessionId'],_0x372dde['selection']['getFirstRange'](),_0x38ebca['model'],_0x5c03c4):_0x2c5272&&(_0x5c03c4['removeMarker'](_0x53915f),_0x5c03c4['removeMarker'](_0x333e8c));});}}function te(_0x1036a7,_0x9346b7,_0x21fa96,_0x1483d0){const _0x28a0dd='user:range:'+_0x1036a7,_0xbe6db9='user:position:'+_0x1036a7,_0x114029=_0x9346b7['getContainedElement']();let _0x1a9d7f=_0x9346b7['start'];_0x114029&&_0x114029['is']('element','tableCell')&&(_0x1a9d7f=function(_0x4eb18a,_0x5d8565){for(const _0x4b1251 of _0x4eb18a['getPositions']())if(_0x5d8565['schema']['checkChild'](_0x4b1251,'$text'))return _0x4b1251;}(_0x9346b7,_0x21fa96),_0x9346b7=_0x1483d0['createRange'](_0x1a9d7f));const _0x593f5d=_0x1483d0['createRange'](_0x1a9d7f);_0x21fa96['markers']['has'](_0x28a0dd)?(_0x1483d0['updateMarker'](_0x28a0dd,{'range':_0x9346b7}),_0x1483d0['updateMarker'](_0xbe6db9,{'range':_0x593f5d})):(_0x1483d0['addMarker'](_0x28a0dd,{'range':_0x9346b7,'usingOperation':!0x0}),_0x1483d0['addMarker'](_0xbe6db9,{'range':_0x593f5d,'usingOperation':!0x0}));}function G(_0x1cb9f6,_0x28b3c4,_0x312171){const _0x377a49=_0x1cb9f6['t'],t=_0x1cb9f6['t'];switch(_0x28b3c4){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 _0x377a49({'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'},_0x312171);default:return'';}}let J=0x1;class l extends _0x209efd{static ['CollaborativeEditingService']=/* #__PURE__ -- @preserve */
|
|
25
|
+
((()=>_0x3f11bb)());['_offset'];['sessionId'];['serverHistory'];['_channelId'];['_service'];['_document'];['_compressor'];['_bufferedOperations'];['_knownOperations'];['_knownRootNames'];['_pendingAction'];['_hasSelectionChanged'];['_sendBufferedOperationsDelayId'];['_baseBufferDelay'];['_currentBufferDelay'];['_lastSyncedOperationId'];['_disconnectionOperations'];['_operationIdentifier'];static get['requires'](){return[c,i,q,_0x4440f0,_0x302dba,_0x6535bd];}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 _0x59eed6=this['serverHistory']['getOperations']();for(let _0x5de3b2=_0x59eed6['length']-0x1;_0x5de3b2>=0x0;_0x5de3b2--){const _0x1c88e3=_0x59eed6[_0x5de3b2];if(!this['_disconnectionOperations']['has'](_0x1c88e3))return _0x1c88e3['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x543f77){if(super(_0x543f77),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x34ed6b(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x5bf925('collaboration-missing-channelid',this);const _0x13feb0=_0x543f77['config']['get']('cloudServices.bundleVersion')||nt;this['_service']=new l['CollaborativeEditingService'](_0x13feb0,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x182859(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new Y(this['_disconnectionOperations']);}['init'](){const _0x514b09=this['editor'],_0x4fb62e=_0x514b09['plugins']['get'](_0x302dba),_0x2eb881=_0x514b09['plugins']['get'](c);this['listenTo'](_0x4fb62e,'getOperationAuthor',(_0x295625,_0x3100e0)=>{const _0x35ac60=_0x3100e0[0x0];_0x35ac60['_authorId']&&(_0x295625['return']=_0x4fb62e['getUser'](_0x35ac60['_authorId']),_0x295625['stop']()),null===_0x35ac60['_authorId']&&(_0x295625['return']=null,_0x295625['stop']());},{'priority':'high'}),this['listenTo'](_0x514b09['model']['document']['selection'],'change:range',(_0x52f480,_0xd3e830)=>{_0xd3e830['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x514b09['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x514b09['model']['on']('applyOperation',(_0x3dfd77,_0x47e36a)=>{const _0x411c56=_0x47e36a[0x0];_0x411c56['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x411c56),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['bind']('_isEditingAllowed')['to'](_0x2eb881,'state',this,'_hasSynchronizationProblem',(_0x39ede4,_0x215262)=>'connected'===_0x39ede4&&!_0x215262),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x514b09['disableReadOnlyMode']('rtc-offline'):_0x514b09['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x514b09['disableReadOnlyMode']('rtc-offline'):_0x514b09['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async['reconnect'](){const _0x37e955=this['editor']['plugins']['get'](i),_0x3cbf24=this['editor']['plugins']['get'](c);try{this['_isPendingUpdate']=!0x0,_0x37e955['unregister'](this['_channelId']);const _0x390161=await this['_service']['reconnect'](_0x3cbf24['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x390161)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x2bc69b=await this['_service']['getConnectedSessions']();_0x37e955['register'](this['_channelId'],_0x2bc69b),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x3aac0e){if(function(_0x16e1da){return'404'===_0x16e1da['code'];}(_0x3aac0e)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x51e1a2){return'409'===_0x51e1a2['code'];}(_0x3aac0e)){const _0x297b72=G(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x297b72);}else{if(!(_0x3aac0e instanceof Q))throw _0x3aac0e;this['_handleReconnectionError']();}}}}['destroy'](){const _0x3c4e73=this['editor']['plugins']['get'](c),_0x11b374=this['editor']['plugins']['get'](i);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x11b374['channelSessions']['has'](this['_channelId'])&&_0x11b374['unregister'](this['_channelId']),_0x3c4e73['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async['_handleReconnectionResponse'](_0x5ee94a){if(this['sessionId']!==_0x5ee94a['sessionId']&&this['_lastSyncedOperationId']!==_0x5ee94a['lastOperationId'])throw new Q();return this['sessionId']=_0x5ee94a['sessionId'],this['_handleServerResponse']([],{..._0x5ee94a,'wereChangesApplied':!0x1,'data':_0x5ee94a['data']},'reconnect');}async['_connectService'](_0x47f0e2,_0xdc2abe=!0x1){const {connection:_0x4fdfb2}=this['editor']['plugins']['get'](c);l['CollaborativeEditingService']['getConnectedSessions'](_0x4fdfb2,this['_channelId'])['then'](_0x4010ed=>this['_initSessionsHandling'](_0x4010ed))['catch'](_0x486dc3=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x486dc3);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x3a26cc,_0x33c3fa)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x33c3fa);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_isConnected']=!0x1;});const _0x3fce54=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x47f0e2);this['_isPendingUpdate']=!0x0;const _0x28723f=await this['_service']['connect'](_0x4fdfb2,this['_compressOperations'](_0x47f0e2),_0x3fce54);if(this['sessionId']=_0x28723f['sessionId'],_0xdc2abe){if(!_0x28723f['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x28723f['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x47f0e2,_0x28723f,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x28723f,_0x47f0e2);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}['_handleSendingSelectionMarkers'](){const _0x3bae7b=this['editor']['plugins']['get'](i),_0x4bc89d=this['editor']['plugins']['get'](q),_0x5a84d7=_0x3bae7b['channelSessions']['get'](this['_channelId']);_0x5a84d7&&_0x5a84d7['length']>0x1?_0x4bc89d['createUserMarkerOperations']():this['listenTo'](_0x3bae7b,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x3bae7b['channelSessions']['get'](this['_channelId'])['length']&&_0x4bc89d['createUserMarkerOperations']();});}async['_handleReceivedOperations'](_0xf5a8cc,_0x5c8c2e,_0x5b3009,_0x21f155){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x5c8c2e){const _0x27d234=this['_decompressOperations'](_0x5b3009,_0x21f155);await this['_fetchMissingUsers'](_0x27d234),this['_handleExternalOperations'](_0x27d234,_0x5c8c2e,_0x5b3009['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async['_connectAfterSessionHasBeenFlushed'](){this['_disconnectService']();const {locale:_0x200533}=this['editor'];let _0x2c3425;try{_0x2c3425=await this['_service']['getDocumentDetails']();}catch(_0x3c6f49){const _0x3c059b=G(_0x200533,'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'](_0x3c059b);}const _0xa119f7=_0x2c3425['currentDocumentSession']||_0x2c3425['lastDocumentSession'];if(this['_lastSyncedOperationId']===_0xa119f7['lastOperationId'])await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);else{const _0x2d4095=G(_0x200533,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x2d4095);}}['_disconnectService'](){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['stopListening'](this['_service']);}['_initSessionsHandling'](_0x556d1f){const _0x337124=this['editor']['plugins']['get'](i);this['listenTo'](_0x337124,'sessionAdd:'+this['_channelId'],(_0x3e424a,{session:_0x5cc424})=>{if(_0x5cc424['id']===_0x337124['mySessionId']){_0x3e424a['off']();const _0x43c67f=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x49e3de=_0x5cc424['permissions'];_0x43c67f&&_0x43c67f['isEnabled']&&(_0x49e3de=_0x49e3de['filter'](_0xa47bb9=>'document:write'!==_0xa47bb9)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x49e3de,this['_channelId']);}}),_0x337124['register'](this['_channelId'],_0x556d1f);}['_initThrowingOnDataSet'](){const _0x18cd80=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x587943)=>{if(!_0x587943[_0x587943['length']-0x1]['suppressErrorInCollaboration'])throw new _0x5bf925('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x18cd80['apply'](this['editor']['data'],_0x587943);};}['_setUpDataInit'](){this['editor']['data']['on']('init',(_0x487d03,[_0x4f1aa8])=>{if(this['_document']['version'])throw new _0x5bf925('realtimecollaborationclient-init-document-already-initialized',this);_0x487d03['stop'](),this['_setPendingAction']();const _0x3190dc=this['editor']['config']['get']('rootsAttributes'),_0x11a833=this['_getOperationsFromInitData'](_0x4f1aa8,_0x3190dc);0x0==_0x11a833['length']&&_0x11a833['push'](new _0x4283a4(0x0)),_0x487d03['return']=this['_connectService'](_0x11a833)['then'](()=>{this['editor']['plugins']['get'](c)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x5067a1=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x5067a1))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x269556,[_0x2e60b0,_0x3127c2])=>{_0x269556['stop']();const _0x32b72a=this['editor']['model']['document']['getRoot'](_0x2e60b0);if(!this['_knownRootNames']['has'](_0x2e60b0)){const _0x317069=_0x3127c2&&_0x3127c2['data']?_0x3127c2['data']:'',_0x3290fa=_0x3127c2&&_0x3127c2['attributes']?_0x3127c2['attributes']:{};await this['_loadRoot'](_0x2e60b0,_0x317069,_0x3290fa);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x32b72a['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x32b72a);});},{'priority':'high'});}async['_fetchMissingUsers'](_0x591251){const _0x355125=this['editor']['plugins']['get'](_0x302dba),{connection:_0x38c409}=this['editor']['plugins']['get'](c),_0x578f4d=new Set();for(const _0x1cfaa1 of _0x591251){const _0x59aeb6=_0x1cfaa1['_authorId'];_0x59aeb6&&!_0x355125['getUser'](_0x59aeb6)&&_0x578f4d['add'](_0x59aeb6);}if(0x0===_0x578f4d['size'])return;const _0x335e03=await dt['getMany'](_0x38c409,Array['from'](_0x578f4d));for(const _0x13641c of _0x335e03)_0x355125['getUser'](_0x13641c['id'])||_0x355125['addUser'](_0x13641c);}['_getOperationsFromInitData'](_0x82a153,_0xda4ec8={}){const _0xc88233=this['editor']['model'],_0x13a268=[];let _0x3524f9=0x0;const _0x4d68f5='string'==typeof _0x82a153?{'main':_0x82a153}:_0x82a153;for(const _0x156484 of Object['keys'](_0x4d68f5)){if(!this['_document']['roots']['has'](_0x156484))throw new _0x5bf925('realtimecollaborationclient-init-non-existent-root',this);const _0x412383=this['editor']['data']['parse'](_0x4d68f5[_0x156484]),_0x52042f=this['_document']['getRoot'](_0x156484),_0xeb5f0f=new _0x4719f1(_0xc88233['createPositionAt'](_0x52042f,0x0),_0x412383,_0x3524f9++);_0x13a268['push'](_0xeb5f0f);for(const [_0x5b7acc,_0x4e1ba8]of _0x412383['markers']){const _0x4c127f=_0xc88233['createRange'](_0xc88233['createPositionFromPath'](_0x52042f,_0x4e1ba8['start']['path']['slice']()),_0xc88233['createPositionFromPath'](_0x52042f,_0x4e1ba8['end']['path']['slice']())),_0x1a55c4=new _0x1a9f01(_0x5b7acc,null,_0x4c127f,_0xc88233['markers'],!0x0,_0x3524f9++);_0x13a268['push'](_0x1a55c4);}}if(_0xda4ec8)for(const [_0x3eeb18,_0x24e98a]of Object['entries'](_0xda4ec8)){const _0x55504d=_0xc88233['document']['getRoot'](_0x3eeb18);if(!_0x55504d)throw new _0x5bf925('multi-root-editor-root-attributes-no-root',null);for(const [_0xed810c,_0x132985]of Object['entries'](_0x24e98a))if(null!==_0x132985){const _0x27d6e9=new _0x57948c(_0x55504d,_0xed810c,null,_0x132985,_0x3524f9++);_0x13a268['push'](_0x27d6e9);}}return _0x13a268;}async['_loadRoot'](_0x5582b4,_0x36bfe9,_0x2c65f2){this['_getOperationsFromInitData']({[_0x5582b4]:_0x36bfe9},{[_0x5582b4]:_0x2c65f2})['forEach']((_0x53fbd8,_0x2bb457)=>{_0x53fbd8['baseVersion']=this['_document']['version']+_0x2bb457,_0x53fbd8['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x53fbd8);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async['_handleInitialConnectionData'](_0x44adec,_0x17edf4){let _0x48fad0;this['_offset']=_0x44adec['offset'];const _0x24efc9=_0x44adec['wereChangesApplied']&&!_0x44adec['initData'],_0x2c08fa=_0x24efc9?0x0:_0x44adec['data']['baseVersion'];if(_0x17edf4['forEach'](_0x1a5eee=>{_0x1a5eee['_isInit']=!0x0,_0x1a5eee['createdAt']=_0x44adec['sessionCreatedAt'],_0x1a5eee['_authorId']=null;}),_0x24efc9)_0x48fad0=_0x17edf4,this['_applyOperationsSet'](_0x48fad0,_0x24efc9);else{if(_0x44adec['initData']){const _0x5158f2=this['_getOperationsFromInitData'](_0x44adec['initData']);this['_document']['history']['version']=-_0x5158f2['length'],_0x5158f2['forEach'](_0x58945b=>{_0x58945b['baseVersion']-=_0x5158f2['length'],_0x58945b['createdAt']=_0x44adec['sessionCreatedAt'],_0x58945b['_isInit']=!0x0,_0x58945b['_authorId']=null;}),this['_applyOperationsSet'](_0x5158f2,!0x0),this['serverHistory']['version']=-_0x5158f2['length']+this['_offset'],this['_updateServerHistory'](_0x5158f2);}this['_document']['history']['version']=_0x2c08fa,_0x48fad0=this['_decompressOperations'](_0x44adec['data'],_0x44adec['metadata']),await this['_fetchMissingUsers'](_0x48fad0),this['_applyOperationsSet'](_0x48fad0,_0x24efc9);}_0x44adec['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x48fad0,_0x44adec['lastOperationId']),this['_lastSyncedOperationId']=_0x44adec['lastOperationId']),this['serverHistory']['version']=_0x2c08fa+this['_offset'],this['_updateServerHistory'](_0x48fad0),_0x17edf4['filter'](_0x65c810=>{const _0x439e66=this['_getAffectedRoot'](_0x65c810);return _0x439e66&&!this['_knownRootNames']['has'](_0x439e66);})['forEach']((_0x33488c,_0x2cf8a3)=>{_0x33488c['baseVersion']=this['_document']['version']+_0x2cf8a3,this['_saveOperationInBuffer'](_0x33488c);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x554e89,_0x57e4fa){const _0x1c19e9=_0x57e4fa&&_0x57e4fa['message'];if(_0x1c19e9&&_0x1c19e9['startsWith']('realtimecollaborationclient'))throw _0x57e4fa;const _0x57d30a=this['editor']['plugins']['get'](c);throw this['_isPendingUpdate']=!0x0,_0x57d30a['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x5bf925(_0x554e89,this['editor'],_0x1c19e9?{'originalError':_0x1c19e9}:void 0x0);}['_saveOperationInBuffer'](_0x7bd999){this['_knownOperations']['has'](_0x7bd999)||(this['_knownOperations']['add'](_0x7bd999),this['_bufferedOperations']['push'](_0x7bd999),this['_pendingAction']||'marker'==_0x7bd999['type']&&!_0x7bd999['affectsData']||this['_setPendingAction']());}['_sendBufferedOperationsDelayed'](_0x17356e=!0x1){!_0x17356e&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x307c3f=>{_0x307c3f&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x129c69=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x319726){return _0x319726['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x319726['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x319726['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x129c69)||this['_crash'](_0x129c69['message'],_0x129c69);});},this['_currentBufferDelay']));}['_waitUntilSynced'](){return new Promise(_0x489ed4=>{this['on']('change:_isPendingUpdate',()=>{_0x489ed4();});});}async['_sendBufferedOperations'](){const _0xbe9af3=this['editor']['plugins']['get'](q);if(this['_shouldSendSelectionUpdate']()&&(_0xbe9af3['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x1be4a8=[...this['_bufferedOperations']];for(const _0x23de3b of _0x1be4a8)_0x23de3b['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x23de3b);const _0x592ece=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1be4a8),_0x46a053=J++,_0x2a83a5=this['_compressOperations'](_0x1be4a8),_0x1030ca=await this['_service']['sendOperations'](_0x2a83a5,_0x2a83a5['baseVersion'],_0x592ece);try{return await this['_handleServerResponse'](_0x1be4a8,_0x1030ca,_0x46a053);}catch(_0x66d398){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x66d398);}}async['_handleServerResponse'](_0x4be201,_0xccd236,_0x389638){if('error'in _0xccd236)throw _0xccd236['error'];let _0x10100b=!0x1;if(_0xccd236['wereChangesApplied']){_0xccd236['lastOperationId']&&(this['_lastSyncedOperationId']=_0xccd236['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3f924a=>!_0x4be201['includes'](_0x3f924a));for(const _0x1df9b2 of _0x4be201)_0x1df9b2['createdAt']='lastOperationAcceptedAt'in _0xccd236&&_0xccd236['lastOperationAcceptedAt']||void 0x0;X(_0x4be201,_0xccd236['version']-_0x4be201['length']),this['_updateServerHistory'](_0x4be201);const _0x4e9770=_0x4be201['filter'](_0x5c8e90=>{if(!_0x5c8e90['_isInit'])return!0x1;const _0x15c1ae=this['_getAffectedRoot'](_0x5c8e90);return _0x15c1ae&&!this['_knownRootNames']['has'](_0x15c1ae);});X(_0x4e9770,this['_document']['version']),this['_applyOperationsSet'](_0x4e9770),_0x10100b=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x417d42=this['_decompressOperations'](_0xccd236['data'],_0xccd236['metadata'])['filter'](_0x3460fa=>_0x3460fa['baseVersion']>=this['_lastServerVersion']);_0x417d42['forEach'](_0x2d93ef=>this['_addKnownRoot'](_0x2d93ef)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x263c9c=>!_0x263c9c['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x263c9c))),this['_bufferedOperations']['length']&&X(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x417d42),_0x10100b=this['_handleExternalOperations'](_0x417d42,_0xccd236['version'],_0xccd236['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x10100b?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}['_handleExternalOperations'](_0x4148c8,_0x4d1b51,_0x224c84){try{const _0x435097={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x3ca070,operationsB:_0x388ca8,originalOperations:_0x4cd55b}=_0x4f6485(_0x4148c8,this['_bufferedOperations'],_0x435097);X(_0x3ca070,this['_document']['version']),X(_0x388ca8,_0x4d1b51);for(const _0x56740f of _0x3ca070){const _0x3258e8=_0x4cd55b['get'](_0x56740f);_0x56740f['_authorId']=_0x3258e8?_0x3258e8['_authorId']:null;}_0x224c84&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x4148c8,_0x224c84),this['_lastSyncedOperationId']=_0x224c84),this['_bufferedOperations']=[..._0x388ca8],this['_applyOperationsSet'](_0x3ca070),this['_updateServerHistory'](_0x4148c8);}catch(_0x24a09b){return console['error'](_0x24a09b),!0x1;}return!0x0;}['_applyOperationsSet'](_0x55d0ed,_0x485067=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x153878=>{for(const _0x1b166c of _0x55d0ed)this['_knownOperations']['add'](_0x1b166c),this['_addKnownRoot'](_0x1b166c),_0x153878['batch']['addOperation'](_0x1b166c),this['editor']['model']['applyOperation'](_0x1b166c);});}['_addKnownRoot'](_0x307668){const _0x208030=this['_getAffectedRoot'](_0x307668);_0x208030&&this['_knownRootNames']['add'](_0x208030);}['_getAffectedRoot'](_0x326b7c){let _0x4c0424,_0x5b7252;switch(_0x326b7c['type']){case'insert':_0x4c0424=_0x326b7c['position']['root'];break;case'marker':if(_0x5b7252=_0x326b7c['newRange'],!_0x5b7252)return null;_0x4c0424=_0x5b7252['root'];break;case'addRootAttribute':_0x4c0424=_0x326b7c['root'];break;case'addRoot':_0x4c0424=_0x326b7c['affectedSelectable'];break;case'move':_0x4c0424=_0x326b7c['targetPosition']['root'];break;default:return null;}return _0x4c0424['rootName'];}['_updateServerHistory'](_0x206ef5){_0x206ef5['forEach'](_0x196999=>{const _0x4b254e=_0x196999['clone']();_0x4b254e['_authorId']=_0x196999['_authorId'],_0x4b254e['_isInit']=!!_0x196999['_isInit'],_0x4b254e['createdAt']=_0x196999['createdAt'],_0x4b254e['baseVersion']+=this['_offset'],_0x196999['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x4b254e),this['serverHistory']['addOperation'](_0x4b254e);});}['_handleReconnectionError'](_0x2eefa0){const _0x3c9cfc=this['editor']['plugins']['get']('Notification'),_0x4df70d=this['editor']['locale'];_0x2eefa0||(_0x2eefa0=G(_0x4df70d,'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.')),_0x3c9cfc['showWarning'](_0x2eefa0,{'title':G(_0x4df70d,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](c)['disconnect']();}['_setPendingAction'](){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x4440f0)['add'](G(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}['_clearPendingAction'](){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x4440f0)['remove'](this['_pendingAction']),this['_pendingAction']=null);}['_compressOperations'](_0x21b9d3){const _0xeca975=_0x21b9d3['map'](_0x48226e=>_0x48226e['toJSON']());return this['_compressor']['compress'](_0xeca975);}['_decompressOperations'](_0x35eafe,_0x2d6e05){return this['_compressor']['decompress'](_0x35eafe)['map']((_0x4d7f6b,_0x164507)=>{const _0x105621='init'==_0x2d6e05[_0x164507]['type'];if('InsertOperation'==_0x4d7f6b['__className']){const _0x2b6be9=_0x4d7f6b['position']['root'];!this['_document']['getRoot'](_0x2b6be9)&&(this['_document']['createRoot']('$root',_0x2b6be9)['_isAttached']=!0x1);}const _0x14b4d4=_0x1bf20f['fromJSON'](_0x4d7f6b,this['_document']);return _0x14b4d4['wasUndone']=_0x4d7f6b['wasUndone'],_0x14b4d4['_isInit']=_0x105621,_0x14b4d4['_authorId']=_0x105621?null:_0x2d6e05[_0x164507]['userId'],_0x14b4d4['_isDisconnection']='cs:removeUser'===_0x2d6e05[_0x164507]['type'],_0x14b4d4['createdAt']=_0x2d6e05[_0x164507]['createdAt'],_0x14b4d4;});}['_refreshUserSelectionMarkers'](){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}['_shouldSendSelectionUpdate'](){const _0x566e11=this['editor']['plugins']['get'](i)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x566e11&&_0x566e11['length']>0x1&&this['_hasSelectionChanged'];}['_shouldSendUpdate'](){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}}class Q extends Error{}function X(_0x442cfd,_0x2b564c){for(const _0x457885 of _0x442cfd)_0x457885['baseVersion']=_0x2b564c++;}class Y{['_ignoredOperations'];['_operationToId'];constructor(_0x1f9320){this['_ignoredOperations']=_0x1f9320,this['_operationToId']=new WeakMap();}['getIdOfTheLastOperation'](_0x26abfd){let _0x3b61f2=_0x26abfd['length'];for(;_0x3b61f2--;){const _0xbd2474=_0x26abfd[_0x3b61f2];if(!this['_ignoredOperations']['has'](_0xbd2474)){if(!this['_operationToId']['has'](_0xbd2474)){const _0x1285df=_0x2891ce()['slice'](0x1,0x12);this['_operationToId']['set'](_0xbd2474,_0x1285df);}return this['_operationToId']['get'](_0xbd2474);}}}['setIdForTheLastOperation'](_0x4c8b37,_0x3fcd7c){if(!_0x3fcd7c)return;let _0x20dba2=_0x4c8b37['length'];for(;_0x20dba2--;){const _0x780eab=_0x4c8b37[_0x20dba2];this['_ignoredOperations']['has'](_0x780eab)||this['_operationToId']['set'](_0x780eab,_0x3fcd7c);}}}class n extends _0x209efd{static get['requires'](){return[l];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class a extends _0x92af73{static ['CommentsService']=/* #__PURE__ -- @preserve */
|
|
26
|
+
((()=>_0x35384d)());['_services'];static get['requires'](){return[c,'CommentsRepository',i,_0x302dba];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3c8264){super(_0x3c8264),this['_services']=new Map();}async['init'](){const _0x5988b9=this['context'],_0x36afcd=_0x5988b9['plugins']['get']('CommentsRepository');if(_0x5988b9['plugins']['get'](c)['addToReconnectionStack'](this),_0x36afcd['adapter']={'addCommentThread':async({channelId:_0xf33a32,threadId:_0x1c4cdb,comments:_0x294227,resolvedAt:_0x1aaae4,resolvedBy:_0x41552e,context:_0x47aef4,attributes:_0x101f77})=>{const _0x28a4ba=await this['_getService'](_0xf33a32)['addCommentThread']({'commentThreadId':_0x1c4cdb,'comments':_0x294227['map'](_0x32f9ef=>function(_0x3388ae,_0x55b6be,_0x5a9955){return{'commentThreadId':_0x5a9955,'commentId':_0x3388ae['commentId'],'userId':_0x3388ae['authorId'],'content':_0x3388ae['content'],'documentId':_0x55b6be,'createdAt':_0x3388ae['createdAt'],'attributes':_0x3388ae['attributes']||{}};}(_0x32f9ef,_0xf33a32,_0x1c4cdb)),'resolvedAt':_0x1aaae4,'resolvedBy':_0x41552e,'context':_0x47aef4,'attributes':_0x101f77})['catch'](ut);return{'threadId':_0x28a4ba['commentThreadId'],'comments':_0x28a4ba['comments']};},'getCommentThread':async({channelId:_0x414074,threadId:_0x4ef4e4})=>{const _0x17ea08=await this['_getService'](_0x414074)['getCommentThread'](_0x4ef4e4)['catch'](ut);return _0x17ea08['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x17ea08]),{'threadId':_0x17ea08['commentThreadId'],'comments':_0x17ea08['comments']['map'](_),'context':_0x17ea08['context'],'resolvedAt':_0x17ea08['resolvedAt'],'resolvedBy':_0x17ea08['resolvedBy'],'attributes':_0x17ea08['attributes']||{}});},'updateCommentThread':async({channelId:_0x1edc2f,threadId:_0x5dd16c,context:_0x1eab69,unlinkedAt:_0x268fb0,attributes:_0x885743})=>this['_getService'](_0x1edc2f)['updateCommentThread']({'commentThreadId':_0x5dd16c,'context':_0x1eab69,'attributes':_0x885743,'unlinkedAt':_0x268fb0})['catch'](S)['catch'](ut),'resolveCommentThread':async({channelId:_0x872ed0,threadId:_0x212c21})=>{const _0x4ef20c=await this['_getService'](_0x872ed0)['resolveCommentThread'](_0x212c21)['catch'](S)['catch'](ut);return{'threadId':_0x4ef20c['commentThreadId'],'resolvedAt':_0x4ef20c['resolvedAt'],'resolvedBy':_0x4ef20c['resolvedBy']};},'reopenCommentThread':async({channelId:_0x4a4c9c,threadId:_0x186567})=>this['_getService'](_0x4a4c9c)['reopenCommentThread'](_0x186567)['catch'](S)['catch'](ut),'removeCommentThread':({channelId:_0xd0d753,threadId:_0xe4ee4})=>this['_getService'](_0xd0d753)['removeCommentThread'](_0xe4ee4)['catch'](S)['catch'](ut),'addComment':({channelId:_0x420c5c,threadId:_0x2224e5,commentId:_0x3c5076,content:_0x1bd310,attributes:_0x464f97})=>this['_getService'](_0x420c5c)['addComment'](_0x2224e5,_0x3c5076,_0x1bd310,_0x464f97)['catch'](ut),'updateComment':({channelId:_0x343263,threadId:_0x58b103,commentId:_0x927dc2,content:_0x512b28,attributes:_0x11ea55})=>this['_getService'](_0x343263)['updateComment'](_0x58b103,_0x927dc2,_0x512b28,_0x11ea55)['catch'](S)['catch'](ut),'removeComment':({channelId:_0x36a9c3,threadId:_0x438025,commentId:_0x506527})=>this['_getService'](_0x36a9c3)['removeComment'](_0x438025,_0x506527)['catch'](S)['catch'](ut)},_0x5988b9 instanceof _0x8f62a){const _0x457390=_0x5988b9['config']['get']('collaboration.channelId'),_0x4a2510=_0x5988b9['plugins']['get'](i);await this['_setUpService'](_0x457390);const _0x55a43b=await this['_services']['get'](_0x457390)['getConnectedSessions']();this['listenTo'](_0x4a2510,'sessionAdd:'+_0x457390,(_0x51fb74,{session:_0x928054})=>{_0x928054['id']===_0x4a2510['mySessionId']&&(_0x51fb74['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x928054['permissions'],_0x457390));}),_0x4a2510['register'](_0x457390,_0x55a43b);}}async['_setUpService'](_0x351bc8){if(this['_services']['has'](_0x351bc8))throw new _0x5bf925('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x351bc8});const _0x2f66a6=this['context']['plugins']['get']('CommentsRepository'),_0x538cf7=new a['CommentsService'](_0x351bc8);this['_services']['set'](_0x351bc8,_0x538cf7),this['listenTo'](_0x538cf7,'commentThreadAdded',(_0x29e78b,_0x26835d)=>{const {commentThreadId:_0x4abdc9,documentId:_0x322811,context:_0x4cddbb,attributes:_0x5a0996,resolvedAt:_0x112394,resolvedBy:_0x381297,comments:_0x6d7b24}=_0x26835d;_0x2f66a6['getCommentThread'](_0x4abdc9)||_0x2f66a6['addCommentThread']({'threadId':_0x4abdc9,'channelId':_0x322811,'comments':_0x6d7b24?_0x6d7b24['map'](_):[],'context':_0x4cddbb,'attributes':_0x5a0996,'resolvedAt':_0x112394,'resolvedBy':_0x381297,'isFromAdapter':!0x0});}),this['listenTo'](_0x538cf7,'commentThreadUpdated',(_0x4c4204,{commentThreadId:_0xf8ba9e,documentId:_0x10a201,context:_0x4c3128,unlinkedAt:_0x47dbbc,attributes:_0x3eef69})=>{_0x2f66a6['getCommentThread'](_0xf8ba9e)&&_0x2f66a6['updateCommentThread']({'threadId':_0xf8ba9e,'channelId':_0x10a201,'context':_0x4c3128,'unlinkedAt':_0x47dbbc,'attributes':_0x3eef69,'isFromAdapter':!0x0});}),this['listenTo'](_0x538cf7,'commentThreadResolved',(_0x3c3ea6,{commentThreadId:_0x3a1eed,resolvedBy:_0x4d234d,resolvedAt:_0xbcf9f5})=>{const _0x4e1605=_0x2f66a6['getCommentThread'](_0x3a1eed);_0x4e1605&&_0x4e1605['resolve']({'resolvedBy':_0x4d234d,'resolvedAt':_0xbcf9f5,'isFromAdapter':!0x0});}),this['listenTo'](_0x538cf7,'commentThreadReopened',(_0x18e71e,{commentThreadId:_0x5702bf})=>{const _0x4947ba=_0x2f66a6['getCommentThread'](_0x5702bf);_0x4947ba&&_0x4947ba['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x538cf7,'commentThreadRemoved',(_0x35d4c1,{commentThreadId:_0x3d1b99})=>{const _0x39b0a6=_0x2f66a6['getCommentThread'](_0x3d1b99);_0x39b0a6&&_0x39b0a6['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x538cf7,'commentAdded',(_0x1913f4,_0x100d4)=>{const _0x4ea5ce=_0x100d4['commentThreadId'],_0x1db11f=_0x2f66a6['getCommentThread'](_0x4ea5ce);_0x1db11f&&_0x1db11f['addComment']({..._(_0x100d4),'isFromAdapter':!0x0});}),this['listenTo'](_0x538cf7,'commentUpdated',(_0x1d389c,{commentThreadId:_0x282037,commentId:_0xcb788b,content:_0x14873a,attributes:_0x4e91a1})=>{const _0x34cdb2=_0x2f66a6['getCommentThread'](_0x282037);if(_0x34cdb2){const _0x3aab41=_0x34cdb2['getComment'](_0xcb788b);_0x3aab41&&_0x3aab41['update']({'content':_0x14873a,'attributes':_0x4e91a1,'isFromAdapter':!0x0});}}),this['listenTo'](_0x538cf7,'commentRemoved',(_0x261ce8,{commentThreadId:_0xde3bb6,commentId:_0x30d8ca})=>{const _0x483de3=_0x2f66a6['getCommentThread'](_0xde3bb6);if(_0x483de3){const _0xc874c8=_0x483de3['getComment'](_0x30d8ca);_0xc874c8&&_0xc874c8['remove']({'isFromAdapter':!0x0});}}),await this['_connectService'](_0x351bc8);}['destroy'](){if(this['context']instanceof _0x8f62a){const _0x33b2c5=this['context']['config']['get']('collaboration.channelId');this['_terminateService'](_0x33b2c5);}}['_terminateService'](_0x50eaee){if(!this['_services']['has'](_0x50eaee))throw new _0x5bf925('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x50eaee});this['_getService'](_0x50eaee)['disconnect'](),this['_services']['delete'](_0x50eaee);}async['reconnect'](){for(const _0x54b4f2 of this['_services']['keys']())await this['_connectService'](_0x54b4f2);if(this['context']instanceof _0x8f62a){const _0x3eb2af=this['context']['config']['get']('collaboration.channelId'),_0x1438a8=this['context']['plugins']['get'](i);_0x1438a8['unregister'](_0x3eb2af);const _0x3013ba=await this['_services']['get'](_0x3eb2af)['getConnectedSessions']();_0x1438a8['register'](_0x3eb2af,_0x3013ba);}}async['_connectService'](_0x26e3a4){const {connection:_0x43457a}=this['context']['plugins']['get'](c),_0x1464f4=this['context']['plugins']['get']('CommentsRepository'),_0xe93736=this['_services']['get'](_0x26e3a4),_0x5aaaac=await _0xe93736['connect'](_0x43457a);await this['_fetchMissingUsersForThreads'](_0x5aaaac);const _0x56f9a8=new Set(Array['from'](_0x1464f4['getCommentThreads']({'channelId':_0x26e3a4}),_0x5c2562=>_0x5c2562['id']));for(const _0x1c99cd of _0x5aaaac)_0x1c99cd['deletedAt']||_0x56f9a8['delete'](_0x1c99cd['commentThreadId']);for(const _0x3df5e2 of _0x56f9a8)_0x1464f4['getCommentThread'](_0x3df5e2)['remove']({'isFromAdapter':!0x0});for(const _0x21dd11 of _0x5aaaac){let _0x20bf36=_0x1464f4['getCommentThread'](_0x21dd11['commentThreadId']);const {commentThreadId:_0x1ef565,context:_0xd2ee3e,attributes:_0xc19c45,resolvedBy:_0x19ba97,resolvedAt:_0x5bb29d,unlinkedAt:_0x475bdf,deletedAt:_0x1bec8b}=_0x21dd11;if(_0x1bec8b)continue;_0x20bf36||(_0x20bf36=_0x1464f4['addCommentThread']({'channelId':_0x26e3a4,'threadId':_0x1ef565,'context':_0xd2ee3e,'attributes':_0xc19c45||{},'resolvedBy':_0x19ba97,'resolvedAt':_0x5bb29d,'unlinkedAt':_0x475bdf,'isFromAdapter':!0x0}));const _0x27984a=new Set(Array['from'](_0x20bf36['comments'],_0x30d6af=>_0x30d6af['id']));for(const _0x40b3b4 of _0x21dd11['comments'])_0x27984a['delete'](_0x40b3b4['commentId']);for(const _0x10ca69 of _0x27984a)_0x20bf36['getComment'](_0x10ca69)['remove']({'isFromAdapter':!0x0});for(const _0xc01cf1 of _0x21dd11['comments']){const _0xef37ca=_0x20bf36['getComment'](_0xc01cf1['commentId']);_0xef37ca?_0xef37ca['content']!==_0xc01cf1['content']&&_0xef37ca['update']({'content':_0xc01cf1['content'],'isFromAdapter':!0x0}):_0x20bf36['addComment'](Object['assign'](_(_0xc01cf1),{'isFromAdapter':!0x0}));}}}['_getService'](_0x1caccf){if(!this['_services']['has'](_0x1caccf))throw new _0x5bf925('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x1caccf});return this['_services']['get'](_0x1caccf);}async['_fetchMissingUsersForThreads'](_0x227bc7){const _0x4bbf90=this['context']['plugins']['get'](_0x302dba),{connection:_0x23d259}=this['context']['plugins']['get'](c),_0x2e2689=new Set();for(const {resolvedBy:_0x5983ec,comments:_0x227c77}of _0x227bc7){_0x5983ec&&!_0x4bbf90['getUser'](_0x5983ec)&&_0x2e2689['add'](_0x5983ec);for(const {userId:_0x42944c}of _0x227c77)_0x4bbf90['getUser'](_0x42944c)||_0x2e2689['add'](_0x42944c);}if(0x0===_0x2e2689['size'])return;const _0x5a61bb=await dt['getMany'](_0x23d259,Array['from'](_0x2e2689));for(const _0x3e7840 of _0x5a61bb)_0x4bbf90['getUser'](_0x3e7840['id'])||_0x4bbf90['addUser'](_0x3e7840);}}async function S(_0xdc6e83){if('404'!==_0xdc6e83['code'])throw _0xdc6e83;}function ut(_0x201946){if((_0x44a032=_0x201946)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x44a032['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x44a032['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x44a032;throw _0x201946;}function _(_0x4b9be5){return{'threadId':_0x4b9be5['commentThreadId'],'commentId':_0x4b9be5['commentId'],'content':_0x4b9be5['content'],'createdAt':_0x4b9be5['createdAt'],'authorId':_0x4b9be5['userId'],'attributes':_0x4b9be5['attributes']||{}};}class f extends _0x209efd{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
|
|
27
|
+
((()=>et)());['_bufferedRequests'];['_trackChangesService'];static get['requires'](){return[a,'TrackChangesEditing',c];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2bc166){super(_0x2bc166);const _0x3baa18=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new f['TrackChangesService'](_0x3baa18);}['init'](){const _0x8122b5=this['editor']['plugins']['get'](c),_0x503235=this['editor']['plugins']['get']('TrackChangesEditing');return _0x503235['adapter']={'getSuggestion':async _0x2ae720=>{await this['_waitForServiceReady']();const _0x234d8f=await this['_trackChangesService']['get'](_0x2ae720)['catch'](R);return await this['_fetchMissingUsersForThreads']([_0x234d8f]),_0x234d8f;},'addSuggestion':async({id:_0x438cf9,type:_0x277f5b,data:_0x47384b,originalSuggestionId:_0x2ba977,attributes:_0x55bdc2})=>{await this['_waitForServiceReady']();const _0x404e02={'id':_0x438cf9,'type':_0x277f5b,'data':_0x47384b,'originalSuggestionId':_0x2ba977,'attributes':_0x55bdc2},_0x1babd5=await this['_trackChangesService']['add'](_0x438cf9,_0x277f5b,_0x47384b,_0x2ba977,_0x55bdc2)['catch'](_0x3a6bdf=>{if(ft(_0x3a6bdf))return new Promise(_0x3e7ce9=>{this['_bufferedRequests']['set'](_0x438cf9,{'resolve':_0x3e7ce9,'suggestionData':_0x404e02});});throw _0x3a6bdf;});return this['_bufferedRequests']['delete'](_0x438cf9),_0x1babd5;},'updateSuggestion':async(_0x3fc576,_0x1e8051)=>{if(await this['_waitForServiceReady'](),'open'!==_0x1e8051['state'])return this['_trackChangesService']['update'](_0x3fc576,_0x1e8051)['catch'](R);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x2b5950,_0x514b8e)=>{_0x503235['hasSuggestion'](_0x514b8e['id'])&&(_0x503235['getSuggestion'](_0x514b8e['id'])['attributes']=_0x514b8e['attributes']);}),this['_trackChangesService']['connect'](_0x8122b5['connection'])['then'](_0x10b216=>(_0x8122b5['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x10b216)['then'](()=>{for(const _0x4bf9df of _0x10b216){_0x503235['addSuggestionData'](_0x4bf9df)['_saved']=!0x0;}})));}async['reconnect'](){const _0x502678=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x2ce64f}=this['editor']['plugins']['get'](c),_0x87b2b6=await this['_trackChangesService']['connect'](_0x2ce64f);await this['_fetchMissingUsersForThreads'](_0x87b2b6);for(const {suggestionData:_0x2fa8a5,resolve:_0x466612}of this['_bufferedRequests']['values']()){let _0x23f3a3=_0x87b2b6['find'](_0x5e950a=>_0x5e950a['id']===_0x2fa8a5['id']);_0x23f3a3||(_0x23f3a3=await this['_trackChangesService']['add'](_0x2fa8a5['id'],_0x2fa8a5['type'],_0x2fa8a5['data'],_0x2fa8a5['originalSuggestionId'])),_0x466612(_0x23f3a3);}for(const _0x17183e of _0x87b2b6)_0x502678['hasSuggestion'](_0x17183e['id'])||_0x502678['addSuggestionData'](_0x17183e);}async['_waitForServiceReady'](){this['_trackChangesService']['isConnected']||await new Promise(_0x3979ee=>{this['listenTo'](this['_trackChangesService'],'connected',_0x464e2f=>{_0x464e2f['off'](),_0x3979ee();});});}async['_fetchMissingUsersForThreads'](_0x7aa395){const _0xf3696f=this['editor']['plugins']['get'](_0x302dba),{connection:_0x50e6c5}=this['editor']['plugins']['get'](c),_0x16276a=new Set();for(const {authorId:_0x34fc08}of _0x7aa395)_0xf3696f['getUser'](_0x34fc08)||_0x16276a['add'](_0x34fc08);if(0x0===_0x16276a['size'])return;const _0x13efca=await dt['getMany'](_0x50e6c5,Array['from'](_0x16276a));for(const _0x1fcd8a of _0x13efca)_0xf3696f['getUser'](_0x1fcd8a['id'])||_0xf3696f['addUser'](_0x1fcd8a);}}function R(_0x7aa4d4){if(ft(_0x7aa4d4))return new Promise(()=>{});throw _0x7aa4d4;}function ft(_0x103491){return _0x103491['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x103491['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class m extends _0x209efd{static get['requires'](){return['Comments',a,n,c];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}['init'](){const _0x560a1d=this['editor']['plugins']['get'](c),_0x3ef8c0=this['editor']['plugins']['get']('CommentsEditing'),_0x5582ad=this['editor']['plugins']['get'](a);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x560a1d,'change:state',(_0x5adfe8,_0x9bfc48,_0x227e3f)=>{_0x3ef8c0['isThreadsLoadingPaused']='connected'!==_0x227e3f;});}),this['listenTo'](_0x560a1d,'change:state',(_0x1e739d,_0x1e6960,_0x26c066)=>{this['editor']['plugins']['get']('CommentsRepository')['switchReadOnly']('connected'!==_0x26c066);}),_0x5582ad['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}['destroy'](){this['editor']['plugins']['get'](a)['_terminateService'](this['editor']['config']['get']('collaboration.channelId')),super['destroy']();}}class p extends _0x209efd{static get['requires'](){return[m,f,'TrackChanges'];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class u extends _0x209efd{static ['RevisionHistoryService']=/* #__PURE__ -- @preserve */
|
|
28
|
+
((()=>it)());['_lastRequestId'];['_revisionTracker'];['_revisionHistoryService'];['_oldOffset'];static get['requires'](){return[c,l,'RevisionHistory',i,_0x302dba];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xe4c698){super(_0xe4c698);const _0x1a3bbc=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new u['RevisionHistoryService'](_0x1a3bbc);}async['init'](){const _0x62ec09=this['editor']['plugins']['get'](l),_0x5225a6=_0x62ec09['serverHistory'],_0x5aed3f=this['editor']['plugins']['get'](c);this['_revisionTracker']['setSource']({'history':_0x5225a6,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x62ec09['sessionId']});const _0x26567b=this['editor']['config']['get']('cloudServices.bundleVersion')||nt,_0x7adeba=await tt['isBundleUploaded'](_0x5aed3f['connection'],_0x26567b);this['editor']['plugins']['get']('RevisionHistory')['adapter']={'getRevision':async({revisionId:_0x1fc2f3})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x1fc2f3)),'updateRevisions':async _0xde774=>{await this['_waitForServiceReady']();const _0x216a3e=this['_revisionTracker']['currentRevision'];if(_0x7adeba&&0x1===_0xde774['length']&&_0xde774[0x0]['id']===_0x216a3e['id'])return _0xde774;for(const _0x2cb2a4 of _0xde774)_0x2cb2a4['id']===_0x216a3e['id']&&(_0x2cb2a4['isEmptyCurrent']=_0x2cb2a4['fromVersion']===_0x2cb2a4['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0xde774,this['_lastRequestId'])['then'](_0x5a4abb=>(this['_lastRequestId']=_0x5a4abb,_0xde774))['catch'](_0x421aba=>{if(st(_0x421aba)||'400'===_0x421aba['code']&&void 0x0!==_0x421aba['data']['wrongRequestId']){for(const _0x5b1cd8 of _0xde774){!this['_revisionTracker']['repository']['getRevision'](_0x5b1cd8['id'])||this['_revisionTracker']['_bufferUpdate'](_0x5b1cd8['id'],_0x5b1cd8,!0x1);}if(st(_0x421aba))throw _0x421aba;return _0xde774;}throw _0x421aba;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x49956b,{revisionsData:_0x5f1d8a,requestId:_0x3e4756})=>{Math['max'](..._0x5f1d8a['map'](_0x2fd131=>_0x2fd131['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x5f1d8a,_0x3e4756);}):this['_handleRevisionsUpdate'](_0x5f1d8a,_0x3e4756);});const {revisions:_0x7956d,requestId:_0xe7e6c0}=await this['_revisionHistoryService']['connect'](_0x5aed3f['connection']);_0x5aed3f['addToReconnectionStack'](this),this['_lastRequestId']=_0xe7e6c0,await this['_fetchMissingUsers'](_0x7956d);for(const _0x4081a2 of _0x7956d)this['_revisionTracker']['addRevisionData'](_0x4081a2);this['listenTo'](_0x62ec09,'change:_isConnected',(_0xfb2986,_0x5c32db,_0x45dd7b)=>{_0x45dd7b&&(this['_oldOffset']=_0x62ec09['_offset'],_0xfb2986['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](_0x5aed3f,'state',_0x3a3207=>_0x3a3207===_0x462527['CONNECTED']);}async['reconnect'](){const _0x2dc967=this['editor']['plugins']['get'](c),_0x52918d=this['editor']['plugins']['get'](l),_0x3ad702=async()=>{const _0x1b2cc0=this['_revisionTracker']['currentRevision'],_0x232d96=_0x1b2cc0['id'],_0x560526=_0x232d96!==_0x52918d['sessionId'];if(_0x560526){const _0x5ca83e=_0x52918d['_offset']-this['_oldOffset'],_0x2ea9a0=this['_getLatestVersionFromServerOperations']();this['_revisionTracker']['_revisionDataBuilder']['reInit']();if(_0x1b2cc0['toVersion']+_0x5ca83e!==_0x2ea9a0){const _0xe6bd27=_0x1b2cc0['fromVersion']+_0x5ca83e,_0x487b6e=this['editor']['plugins']['get'](_0x302dba),_0x503f05=this['_revisionTracker']['buildRevisionData']({'revision':_0x1b2cc0,'from':_0xe6bd27,'to':_0x2ea9a0});_0x503f05['id']=_0x1b2cc0['id'];const _0x3ecaa8=_0x503f05['authorsIds']['map'](_0x365248=>_0x487b6e['getUser'](_0x365248));_0x1b2cc0['_update']({..._0x503f05,'authors':_0x3ecaa8},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1b2cc0['id'],_0x503f05,!0x0);}this['_revisionTracker']['_startingVersion']=_0x2ea9a0,(_0x1b2cc0['toVersion']===_0x1b2cc0['fromVersion']&&!this['_revisionTracker']['_bufferedUpdates']['has'](_0x232d96)&&this['_revisionTracker']['repository']['_revisions']['remove'](_0x232d96),this['_revisionTracker']['_createCurrentRevision'](_0x2ea9a0));}const {revisions:_0x442b36,requestId:_0x3ede28}=await this['_revisionHistoryService']['reconnect'](_0x2dc967['connection'],this['_lastRequestId']);_0x560526&&_0x442b36['length']>0x0?_0x52918d['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x442b36),this['_handleRevisionsUpdate'](_0x442b36,_0x3ede28),this['_revisionTracker']['sendBufferedUpdates']());};return _0x52918d['_isConnected']?_0x3ad702():new Promise((_0x4e9e4b,_0x5e3b34)=>{_0x52918d['once']('change:_isConnected',()=>{_0x3ad702()['then'](_0x4e9e4b)['catch'](_0x5e3b34);});});}['destroy'](){super['destroy']();}async['_waitForServiceReady'](){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5a63b5=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x59da00=>{_0x59da00['off'](),_0x5a63b5();});});}['_getLatestVersionFromServerOperations'](){const _0x537f62=this['editor']['plugins']['get'](l)['serverHistory']['getOperations']()['reverse']();for(const _0x5933a6 of _0x537f62)if('marker'!==_0x5933a6['type']||_0x5933a6['affectsData'])return _0x5933a6['baseVersion']+0x1;}['_getLatestVersion'](){const _0x559503=this['editor']['plugins']['get'](l);return new Promise(_0xd6ef27=>{_0x559503['_isPendingUpdate']?_0x559503['once']('change:_isPendingUpdate',()=>{_0xd6ef27(this['_getLatestVersionFromServerOperations']());}):_0xd6ef27(this['_getLatestVersionFromServerOperations']());});}['_handleRevisionsUpdate'](_0x33fa0e,_0x5be896){const _0x12f967=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x5be896;for(const _0x569c6a of _0x33fa0e){const _0x22b84e=_0x12f967['getRevision'](_0x569c6a['id']);if(_0x22b84e){if((_0x569c6a['fromVersion']||_0x569c6a['toVersion'])&&(_0x569c6a['diffData']=null),_0x22b84e===this['_revisionTracker']['currentRevision']){const _0x1db06e=Math['max'](_0x22b84e['toVersion'],_0x569c6a['toVersion']),_0x15a9d3=Math['max'](_0x22b84e['fromVersion'],_0x569c6a['fromVersion']);let _0x4eef47;_0x22b84e['toVersion']===_0x569c6a['toVersion']&&_0x22b84e['fromVersion']===_0x569c6a['fromVersion']?(_0x4eef47=!0x0,this['_preventResendingRevisionData'](_0x569c6a)):_0x569c6a['toVersion']===_0x1db06e&&_0x569c6a['fromVersion']===_0x15a9d3?_0x4eef47=!0x1:(_0x22b84e['toVersion']===_0x1db06e&&_0x22b84e['fromVersion']===_0x15a9d3||this['_fixRevision']({'revision':_0x22b84e,'from':_0x15a9d3,'to':_0x1db06e}),_0x4eef47=!0x0),_0x4eef47&&(delete _0x569c6a['fromVersion'],delete _0x569c6a['toVersion'],delete _0x569c6a['diffData'],delete _0x569c6a['createdAt'],delete _0x569c6a['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x569c6a),this['_preventResendingRevisionData'](_0x569c6a);}else this['_revisionTracker']['addRevisionData'](_0x569c6a);}const _0x3834d6=_0x12f967['getRevisions']();_0x3834d6['reverse']();for(let _0x5826f4=0x0;_0x5826f4<_0x3834d6['length']-0x1;_0x5826f4++){const _0x2b9a27=_0x3834d6[_0x5826f4],_0x51b80e=_0x3834d6[_0x5826f4+0x1];if(_0x2b9a27['fromVersion']<_0x51b80e['toVersion']){const _0x199515=_0x51b80e['toVersion'],_0x2692d3=Math['max'](_0x199515,_0x2b9a27['toVersion']);this['_fixRevision']({'revision':_0x2b9a27,'from':_0x199515,'to':_0x2692d3});}}}['_fixRevision']({revision:_0x25ca5c,from:_0x55c1c0,to:_0x291a25}={}){const _0xbd7a7d=this['editor']['plugins']['get'](_0x302dba),_0x312e1e=this['_revisionTracker']['buildRevisionData']({'revision':_0x25ca5c,'from':_0x55c1c0,'to':_0x291a25});_0x312e1e['authors']=_0x312e1e['authorsIds']['map'](_0x5990de=>_0xbd7a7d['getUser'](_0x5990de)),_0x25ca5c['_update'](_0x312e1e);}['_preventResendingRevisionData'](_0x390ea0){const _0x5e6085={};_0x5e6085['id']=_0x390ea0['id'];for(const _0x4d11f2 of Object['keys'](_0x390ea0))'id'!==_0x4d11f2&&(_0x5e6085[_0x4d11f2]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x5e6085['id'],_0x5e6085,!0x0);}async['_fetchMissingUsers'](_0x376f08){const _0x22d64d=this['editor']['plugins']['get'](_0x302dba),{connection:_0x1344b0}=this['editor']['plugins']['get'](c),_0x5dd227=new Set();for(const _0x4630f3 of _0x376f08){for(const _0x496af4 of _0x4630f3['authorsIds'])_0x4e0051(_0x496af4);_0x4630f3['creatorId']&&_0x4e0051(_0x4630f3['creatorId']);}if(0x0===_0x5dd227['size'])return;const _0x6a3e9f=await dt['getMany'](_0x1344b0,Array['from'](_0x5dd227));for(const _0x150f4b of _0x6a3e9f)_0x22d64d['getUser'](_0x150f4b['id'])||_0x22d64d['addUser'](_0x150f4b);function _0x4e0051(_0x1ab82a){_0x22d64d['getUser'](_0x1ab82a)||_0x5dd227['add'](_0x1ab82a);}}}function st(_0x46cff5){return _0x46cff5['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x46cff5['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x46cff5['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}class g extends _0x209efd{static get['requires'](){return['RevisionHistory',u,n];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}class A extends _0x407c4a{['_collapseAt'];constructor(_0x97d138,_0x249726=0x6){super(_0x97d138);const _0x864b70=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x249726,this['bind']('isHidden')['to'](this,'usersCount',_0xf0cd44=>_0xf0cd44<_0x249726),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x864b70['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':_0x864b70['to']('usersCount',_0xd0233c=>'+'+(_0xd0233c-this['_collapseAt']+0x2)['toString']())}]}]}]});}}class ts extends _0x407c4a{['items'];['keystrokes'];constructor(_0x48e864){super(_0x48e864);const _0xb5fd6a=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x4fbca3(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0xb5fd6a['if']('hasPopup'),'aria-expanded':_0xb5fd6a['to']('isExpanded',_0x3bb57d=>this['hasPopup']&&String(_0x3bb57d)),'aria-label':_0xb5fd6a['to']('hasPopup',_0x46b045=>G(_0x48e864,_0x46b045?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0xb5fd6a['to']('hasPopup',_0xb0ad54=>!!_0xb0ad54&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0xb5fd6a['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0xb5fd6a['to'](_0x13f85b=>{const _0x1c7095=_0x13f85b,_0x50bb07=document['querySelector']('.ck-presence-list__dropdown-list'),_0x593bb3=document['querySelector']('.ck-balloon-panel_with-arrow');_0x50bb07?.['contains'](_0x1c7095['relatedTarget'])||_0x593bb3?.['contains'](_0x1c7095['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x2af752,_0x46057e,_0x16c612)=>{this['element']&&(_0x16c612?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}}class j extends _0x407c4a{['counterView'];['inlineListView'];constructor(_0x30407a,_0x2d1f56=0x6){super(_0x30407a);const _0x1d5c82=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new A(this['locale'],_0x2d1f56),this['inlineListView']=new ts(_0x30407a),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x274d0c of this['inlineListView']['items'])_0x274d0c['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',_0x1d5c82['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}}class x extends _0x407c4a{['listWrapperView'];constructor(_0x4a1a8e,_0x1950c8){super(_0x4a1a8e);const _0x59177c=this['bindTemplate'];this['listWrapperView']=new mt(_0x4a1a8e,_0x1950c8),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':G(_0x4a1a8e,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x59177c['to'](_0x22313b=>{const _0x49965e=_0x22313b,_0x42bc5f=document['querySelector']('.ck-presence-list__list'),_0x172dc2=document['querySelector']('.ck-balloon-panel_with-arrow');_0x42bc5f?.['contains'](_0x49965e['relatedTarget'])||_0x172dc2?.['contains'](_0x49965e['relatedTarget'])||this['fire']('presencelist:hide');})}});}}class mt extends _0x15aced{constructor(_0x2fb3f5,_0x574ed1){super(_0x2fb3f5);const _0x505645=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x574ed1?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x505645['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x505645['to']('role'),'aria-label':_0x505645['to']('ariaLabel'),'aria-labelledby':_0x505645['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x3ae409['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0xa37338=this['element'];_0xa37338&&(this['_isScrollable']=Math['max'](_0xa37338['scrollHeight'],_0xa37338['clientHeight'])>0.8*window['innerHeight']);}}class k extends rt{['userView'];constructor(_0x3fe901,_0x3768e8,_0x1e7568){super(_0x3fe901);const _0x5e414b=this['bindTemplate'];this['userView']=new ct(_0x3fe901,_0x3768e8);const _0x8ee00b={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x3768e8['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x3768e8['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3768e8['color']['getBackgroundColorClass']()],'aria-hidden':'true'}}]};_0x1e7568&&(_0x8ee00b['tag']='button',_0x8ee00b['on']={'click':_0x5e414b['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x8ee00b);}['focus'](){this['element']['focus']();}}class y extends _0x407c4a{['userView'];['markerView'];constructor(_0x36f6fd,_0x398a6d,_0x5a0e81){super(_0x36f6fd);const _0x4442fa=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new ct(_0x36f6fd,_0x398a6d),this['markerView']=new at(_0x36f6fd,_0x398a6d);const _0x51d664=new ot(_0x36f6fd);_0x51d664['template']['tag']='span',_0x51d664['text']=_0x398a6d['name'];const _0x1eee35={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x4442fa['to']('isFocusable',_0x2bd6bc=>!!_0x2bd6bc&&0x0),'aria-labelledby':_0x51d664['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x4442fa['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x4442fa['to']('hasTooltip',_0x3c876a=>!_0x3c876a),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x51d664]};_0x5a0e81&&(_0x1eee35['tag']='button',_0x1eee35['on']={'click':_0x4442fa['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1eee35);}}class at extends _0x407c4a{constructor(_0x29938d,_0x275374){super(_0x29938d),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x275374['color']['getBackgroundColorClass']()],'aria-hidden':'true'}});}}const C={'collapseAt':0x6,'displayMe':!0x0};class r extends _0x92af73{['currentDisplayedUsers'];['balloonPanelView'];['view'];['presenceDropdownView'];['_bodyCollection']=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x376b02){super(_0x376b02),this['context']['config']['define']('presenceList',C);const _0x1ac6d9=_0x376b02['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x1ac6d9)throw new _0x5bf925('presencelist-collapseat-invalid-format',this);if(_0x1ac6d9<0x1)throw new _0x5bf925('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](i)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0xce3908(),this['balloonPanelView']=new _0x196f93(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get['requires'](){return[i];}['init'](){for(const _0x4e4f4a of this['_allConnectedUsers'])this['_handleUserAdd'](_0x4e4f4a);this['listenTo'](this['_allConnectedUsers'],'add',(_0x4b9189,_0x44539d)=>{this['_handleUserAdd'](_0x44539d);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x409553,_0x2f1bde)=>{this['_handleUserRemove'](_0x2f1bde);});}['_createView'](){const _0x232dc1=this['context'],_0x44b2df=new j(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x161632=this['balloonPanelView'];if(!_0x3975ce(_0x232dc1['config']['get']('presenceList.container')))throw new _0x5bf925('presencelist-missing-container',this);return _0x44b2df['counterView']['bind']('usersCount')['to'](this),_0x44b2df['bind']('isCollapsed')['to'](this,'usersCount',_0x17aef7=>{const {collapseAt:_0x570ba5}=_0x232dc1['config']['get']('presenceList'),_0x329b12=_0x17aef7>=_0x570ba5;if(_0x329b12&&!_0x44b2df['inlineListView']['items']['find'](_0x131a6b=>_0x131a6b instanceof A)){const _0x290c41=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x290c41&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x44b2df['inlineListView']['items']['add'](_0x44b2df['counterView']);}return _0x329b12||this['hideDropdown'](),_0x329b12;}),_0x44b2df['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x52f8a=>{const _0x35be0a=_0x232dc1['config']['get']('presenceList'),_0x48607e=new y(_0x232dc1['locale'],_0x52f8a,!!_0x35be0a['onClick']);return _0x48607e['bind']('hasTooltip')['to'](_0x44b2df,'isCollapsed',_0x1a74c9=>!_0x1a74c9),_0x48607e['bind']('isFocusable')['to'](_0x44b2df,'isCollapsed',_0x1411a8=>!_0x1411a8),_0x35be0a['onClick']&&this['listenTo'](_0x48607e,'execute',()=>{this['view']['isCollapsed']||_0x35be0a['onClick'](_0x52f8a,_0x48607e['element']);}),_0x48607e;}),this['listenTo'](_0x44b2df['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x44b2df['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x44b2df['inlineListView']['keystrokes']['set']('Enter',(_0x4fb576,_0x210009)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x210009());}),_0x44b2df['render'](),_0x161632['render'](),_0x1f3952({'emitter':_0x44b2df,'activator':()=>_0x161632['isVisible'],'contextElements':[_0x161632['element'],_0x44b2df['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x232dc1['config']['get']('presenceList.container')['appendChild'](_0x44b2df['element']),this['_bodyCollection']=new _0x4b9063(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x44b2df;}['_handleUserAdd'](_0x549b6e){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x549b6e['isMe'])return;const _0x5974f2=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x5974f2-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x3200fb=_0x549b6e['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x549b6e,_0x3200fb);}['_handleUserRemove'](_0x5385d9){this['usersCount']--;const {collapseAt:_0x28952c}=this['context']['config']['get']('presenceList'),_0x55a673=this['usersCount']>=_0x28952c;if(this['currentDisplayedUsers']['get'](_0x5385d9['id']))this['currentDisplayedUsers']['remove'](_0x5385d9['id']);else{if(_0x55a673&&this['currentDisplayedUsers']['length']+0x1===_0x28952c-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x55a673?0x1:0x0)<this['usersCount']){for(const _0x372881 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x372881['id'])&&(this['currentDisplayedUsers']['add'](_0x372881,Math['min'](this['currentDisplayedUsers']['length']-(_0x55a673?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x55a673?0x1:0x0)===_0x28952c-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x3e24d5=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new x(this['context']['locale'],!!_0x3e24d5['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x262f5f}=this['presenceDropdownView'];_0x262f5f['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x5aa84d=>{if(!_0x3e24d5['displayMe']&&_0x5aa84d['isMe'])return null;const _0x49bffe=new k(this['context']['locale'],_0x5aa84d,!!_0x3e24d5['onClick']);return _0x3e24d5['onClick']&&this['listenTo'](_0x49bffe,'execute',()=>{_0x3e24d5['onClick'](_0x5aa84d,_0x49bffe['element']);}),_0x49bffe;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x262f5f['focus'](),_0x262f5f['checkIfScrollable']();const _0x2c6d15=(_0x2e6411,_0x35f8d1)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x35f8d1();};_0x262f5f['keystrokes']['set']('Esc',_0x2c6d15),_0x262f5f['keystrokes']['set']('Shift+Tab',_0x2c6d15),_0x262f5f['keystrokes']['set']('Tab',(_0x4b5c74,_0x4abf41)=>{!function(_0x3334f4){const _0x59ec7e=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x5f2ca2=>_0x5f2ca2+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x45f8b4=[...document['body']['querySelectorAll'](_0x59ec7e)]['filter'](_0x124ca3=>_0x124ca3===document['activeElement']||_0x124ca3['offsetWidth']+_0x124ca3['offsetHeight']>0x0)['sort']((_0x2eb6a5,_0x998ccd)=>(_0x2eb6a5['tabIndex']||0x0)-(_0x998ccd['tabIndex']||0x0)),_0x1e3e11=_0x45f8b4['indexOf'](_0x3334f4),_0x1ba877=_0x45f8b4[(_0x1e3e11+0x1)%_0x45f8b4['length']];_0x1ba877&&_0x1ba877['focus']();}(this['view']['element']),this['hideDropdown'](),_0x4abf41();}),_0x262f5f['focusTracker']['add'](this['view']['element']),_0x262f5f['focusTracker']['on']('change:isFocused',(_0x2f658d,_0x516e69,_0xdaf3fe)=>{_0xdaf3fe||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}['destroy'](){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}}class s extends _0x92af73{static get['requires'](){return[i,r];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}}export{a as CloudServicesCommentsAdapter,u as CloudServicesRevisionHistoryAdapter,f as CloudServicesTrackChangesAdapter,s as PresenceList,r as PresenceListUI,l as RealTimeCollaborationClient,m as RealTimeCollaborativeComments,n as RealTimeCollaborativeEditing,g as RealTimeCollaborativeRevisionHistory,p as RealTimeCollaborativeTrackChanges,i as Sessions};
|