@ckeditor/ckeditor5-real-time-collaboration 48.5.0-alpha.0 → 48.5.0-alpha.2

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.
Files changed (75) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/translations/af.umd.js +1 -1
  3. package/dist/translations/ar.umd.js +1 -1
  4. package/dist/translations/ast.umd.js +1 -1
  5. package/dist/translations/az.umd.js +1 -1
  6. package/dist/translations/be.umd.js +1 -1
  7. package/dist/translations/bg.umd.js +1 -1
  8. package/dist/translations/bn.umd.js +1 -1
  9. package/dist/translations/bs.umd.js +1 -1
  10. package/dist/translations/ca.umd.js +1 -1
  11. package/dist/translations/cs.umd.js +1 -1
  12. package/dist/translations/da.umd.js +1 -1
  13. package/dist/translations/de-ch.umd.js +1 -1
  14. package/dist/translations/de.umd.js +1 -1
  15. package/dist/translations/el.umd.js +1 -1
  16. package/dist/translations/en-au.umd.js +1 -1
  17. package/dist/translations/en-gb.umd.js +1 -1
  18. package/dist/translations/en.umd.js +1 -1
  19. package/dist/translations/eo.umd.js +1 -1
  20. package/dist/translations/es-co.umd.js +1 -1
  21. package/dist/translations/es.umd.js +1 -1
  22. package/dist/translations/et.umd.js +1 -1
  23. package/dist/translations/eu.umd.js +1 -1
  24. package/dist/translations/fa.umd.js +1 -1
  25. package/dist/translations/fi.umd.js +1 -1
  26. package/dist/translations/fr.umd.js +1 -1
  27. package/dist/translations/gl.umd.js +1 -1
  28. package/dist/translations/gu.umd.js +1 -1
  29. package/dist/translations/he.umd.js +1 -1
  30. package/dist/translations/hi.umd.js +1 -1
  31. package/dist/translations/hr.umd.js +1 -1
  32. package/dist/translations/hu.umd.js +1 -1
  33. package/dist/translations/hy.umd.js +1 -1
  34. package/dist/translations/id.umd.js +1 -1
  35. package/dist/translations/it.umd.js +1 -1
  36. package/dist/translations/ja.umd.js +1 -1
  37. package/dist/translations/jv.umd.js +1 -1
  38. package/dist/translations/kk.umd.js +1 -1
  39. package/dist/translations/km.umd.js +1 -1
  40. package/dist/translations/kn.umd.js +1 -1
  41. package/dist/translations/ko.umd.js +1 -1
  42. package/dist/translations/ku.umd.js +1 -1
  43. package/dist/translations/lt.umd.js +1 -1
  44. package/dist/translations/lv.umd.js +1 -1
  45. package/dist/translations/ms.umd.js +1 -1
  46. package/dist/translations/nb.umd.js +1 -1
  47. package/dist/translations/ne.umd.js +1 -1
  48. package/dist/translations/nl.umd.js +1 -1
  49. package/dist/translations/no.umd.js +1 -1
  50. package/dist/translations/oc.umd.js +1 -1
  51. package/dist/translations/pl.umd.js +1 -1
  52. package/dist/translations/pt-br.umd.js +1 -1
  53. package/dist/translations/pt.umd.js +1 -1
  54. package/dist/translations/ro.umd.js +1 -1
  55. package/dist/translations/ru.umd.js +1 -1
  56. package/dist/translations/si.umd.js +1 -1
  57. package/dist/translations/sk.umd.js +1 -1
  58. package/dist/translations/sl.umd.js +1 -1
  59. package/dist/translations/sq.umd.js +1 -1
  60. package/dist/translations/sr-latn.umd.js +1 -1
  61. package/dist/translations/sr.umd.js +1 -1
  62. package/dist/translations/sv.umd.js +1 -1
  63. package/dist/translations/th.umd.js +1 -1
  64. package/dist/translations/ti.umd.js +1 -1
  65. package/dist/translations/tk.umd.js +1 -1
  66. package/dist/translations/tr.umd.js +1 -1
  67. package/dist/translations/tt.umd.js +1 -1
  68. package/dist/translations/ug.umd.js +1 -1
  69. package/dist/translations/uk.umd.js +1 -1
  70. package/dist/translations/ur.umd.js +1 -1
  71. package/dist/translations/uz.umd.js +1 -1
  72. package/dist/translations/vi.umd.js +1 -1
  73. package/dist/translations/zh-cn.umd.js +1 -1
  74. package/dist/translations/zh.umd.js +1 -1
  75. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Context as _0x4fe616,ContextPlugin as _0x3db858,PendingActions as _0x16dea5,Plugin as _0x1e2c35}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x1cd844,Collection as _0x2188d9,DomEmitterMixin as _0x3ddb20,KeystrokeHandler as _0x348589,global as _0x56e72d,uid as _0x5a8841,version as _0x5737c2}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x4e07dc,BodyCollection as _0xb9107e,LabelView as _0x286fa8,ListItemView as _0x5d3968,ListView as _0x1a0a9b,Notification as _0x4178d7,View as _0x4f13ad,clickOutsideHandler as _0x3c456b}from'@ckeditor/ckeditor5-ui';import{History as _0x274768,InsertOperation as _0x3df20c,MarkerOperation as _0x20bd43,ModelLiveRange as _0x2b80bc,NoOperation as _0x49e919,OperationFactory as _0x52f4f9,RootAttributeOperation as _0x4494bb,transformOperationSets as _0x178582}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x2f9fd4}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x5e6c3a,CommentsService as _0x294775,EditorService as _0x1ddb48,RevisionHistoryService as _0x33a6ab,TrackChangesService as _0x53df18,User as _0x197c00,WEB_SOCKET_GATEWAY_STATES as _0x302c46,WebSocketGateway as _0xfbeae0}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x494d84,Users as _0x4e8b99}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x43f8be}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x4fb15c,TrackChangesEditing as _0x27597a}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x5db2b7,CommentsEditing as _0x54e2b9,CommentsRepository as _0x46916a}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x5c26c3}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x20a13c}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x3db858{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
- ((()=>_0xfbeae0)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x2f9fd4,_0x4178d7];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3a2453){super(_0x3a2453),this['set']('state',_0x302c46['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x3ddb20())();}init(){const _0x106289=this['context'],_0x385cd7=_0x106289['plugins']['get'](_0x2f9fd4),_0x268e86=_0x106289['plugins']['get'](_0x4178d7);if(!_0x385cd7['token'])throw new _0x1cd844('websocketgateway-missing-token',this);if(!_0x385cd7['webSocketUrl'])throw new _0x1cd844('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),WebSocketGateway['WebSocketGateway']['connect'](_0x385cd7['token'],_0x385cd7['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x200280=>{if(this['connection']=_0x200280,this['bind']('state')['to'](_0x200280,'state',this,'_isBrowserOffline',(_0x40e68d,_0x1fb744)=>('connected'!==_0x40e68d&&(this['_shouldPluginsReconnect']=!0x0),_0x1fb744||_0x40e68d!==_0x302c46['CONNECTED']?_0x302c46['DISCONNECTED']:this['state']==_0x302c46['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x302c46['CONNECTING']):_0x302c46['CONNECTED'])),this['connection']['on']('error',(_0x47b378,_0x4e1076)=>{if('limitExceeded'!==_0x4e1076['code'])throw console['error'](_0x4e1076),new _0x1cd844('cloudservices-init',null,{'originalError':_0x4e1076});_0x268e86['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'});}),!_0x200280['me'])return new Promise(_0x4e8c9f=>_0x200280['on']('change:me',_0x4e8c9f));})['catch'](_0x2d5f9e=>{throw console['error'](_0x2d5f9e),new _0x1cd844('cloudservices-init',null,{'originalError':_0x2d5f9e});});}addToReconnectionStack(_0x12ee8e){if('function'!=typeof _0x12ee8e['reconnect'])throw new _0x1cd844('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x12ee8e))throw new _0x1cd844('websocketgateway-plugin-already-registered',this,{'name':_0x12ee8e['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x12ee8e);}removeFromReconnectionStack(_0x12cc57){this['_reconnectionStack']['delete'](_0x12cc57);}isInReconnectionStack(_0x3dab19){return this['_reconnectionStack']['has'](_0x3dab19);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x45080e=>_0x45080e['reconnect']())))['then'](()=>this['state']=_0x302c46['CONNECTED'])['catch'](_0x3bd3c5=>{throw console['error'](_0x3bd3c5),new _0x1cd844('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x302c46['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x3db858{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[z,_0x4e8b99];}constructor(_0x160bb2){super(_0x160bb2),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x2188d9(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x4e8b99);}init(){const _0x206800=this['context']['plugins']['get'](z);this['listenTo'](_0x206800,'change:state',(_0x55c4b6,_0x3cdfeb,_0x549e9f)=>{if('connected'!==_0x549e9f)this['channelSessions']['forEach'](_0xa915f8=>_0xa915f8['clear']()),this['channelConnectedUsers']['forEach'](_0x526bca=>_0x526bca['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x11cf18,_0x58d388]of this['_registeredSessions'])for(const _0x5e12db of _0x58d388)this['_handleSessionAdd'](_0x11cf18,_0x5e12db);}}),this['_createUser'](_0x206800['connection']['me'],!0x0);}register(_0x580217,_0x387eb5){if(this['_registeredSessions']['has'](_0x580217))throw new _0x1cd844('sessions-register-already-registered',null,{'channelId':_0x580217});this['_registeredSessions']['set'](_0x580217,_0x387eb5),this['channelSessions']['set'](_0x580217,new _0x2188d9()),this['channelConnectedUsers']['set'](_0x580217,new _0x2188d9()),this['listenTo'](_0x387eb5,'add',(_0x4255b7,_0x1bd60a)=>this['_handleSessionAdd'](_0x580217,_0x1bd60a)),this['listenTo'](_0x387eb5,'remove',(_0x123f6a,_0x16004c)=>this['_handleSessionRemove'](_0x580217,_0x16004c));for(const _0x4e75be of _0x387eb5)this['_handleSessionAdd'](_0x580217,_0x4e75be);}unregister(_0x420673){if(!this['_registeredSessions']['has'](_0x420673))throw new _0x1cd844('sessions-unregister-not-exist',null,{'channelId':_0x420673});const _0x236fe2=this['_registeredSessions']['get'](_0x420673);this['stopListening'](_0x236fe2);for(const _0x31fe67 of _0x236fe2)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x420673,_0x31fe67);this['_registeredSessions']['delete'](_0x420673),this['channelSessions']['delete'](_0x420673),this['channelConnectedUsers']['delete'](_0x420673);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0xe4af45){for(const _0x12ee88 of this['channelSessions']['values']())for(const _0x24594b of _0x12ee88)if(_0x24594b['id']===_0xe4af45)return _0x24594b['user'];}getUserSessions(_0x201eb6,_0x379484){const _0x5abfea=_0x379484?[this['channelSessions']['get'](_0x379484)]:this['channelSessions']['values'](),_0x14bfc6=new Set();for(const _0x591485 of _0x5abfea)for(const _0x4d2d6d of _0x591485)_0x4d2d6d['user']['id']===_0x201eb6['id']&&_0x14bfc6['add'](_0x4d2d6d['id']);return _0x14bfc6;}getUserRole(_0x5baddd){for(const _0x3d0987 of this['channelSessions']['values']())for(const _0x4f6630 of _0x3d0987)if(_0x4f6630['user']===_0x5baddd)return _0x4f6630['role'];}['_handleSessionAdd'](_0x22fd7f,_0x26d599){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x3621e3=_0x26d599['user'],_0x14569f=this['_users']['getUser'](_0x3621e3['id'])||this['_createUser'](_0x3621e3),_0x4f2bbe=Object['assign']({},_0x26d599,{'user':_0x14569f});if(this['channelSessions']['get'](_0x22fd7f)['add'](_0x4f2bbe),!_0x3621e3['hiddenInPresenceList']){const _0xb2e80c=this['channelConnectedUsers']['get'](_0x22fd7f);_0xb2e80c['has'](_0x14569f['id'])||_0xb2e80c['add'](_0x14569f),this['allConnectedUsers']['has'](_0x14569f['id'])||_0x3621e3['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x14569f,_0x14569f['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x22fd7f,{'channelId':_0x22fd7f,'session':_0x4f2bbe});}['_handleSessionRemove'](_0x37bdd4,_0x56d218){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x39bfab=this['channelConnectedUsers']['get'](_0x37bdd4),_0x34ddab=_0x56d218['user'];_0x34ddab['id']&&(this['channelSessions']['get'](_0x37bdd4)['remove'](_0x56d218['id']),_0x39bfab['has'](_0x34ddab['id'])&&!this['getUserSessions'](_0x34ddab,_0x37bdd4)['size']&&_0x39bfab['remove'](_0x34ddab['id']),this['allConnectedUsers']['get'](_0x34ddab['id'])&&!this['getUserSessions'](_0x34ddab)['size']&&this['allConnectedUsers']['remove'](_0x34ddab['id']));}_createUser(_0x3f0167,_0x56af83){const _0x8f58bb=this['_users']['addUser'](_0x3f0167);return _0x56af83&&this['_users']['defineMe'](_0x3f0167['id']),_0x8f58bb['orderNumber']=this['_uniqueUsersCount']++,_0x8f58bb;}},K=class extends _0x1e2c35{_domEmitter=new(_0x3ddb20())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x3ee4d4=this['editor'],_0x41253f=_0x3ee4d4['plugins']['get'](Y);_0x3ee4d4['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x3e710f,{writer:_0x313b7f})=>function(_0x364f87,_0x5d5aed,_0x123d43,_0x23ed35){const _0x28656f=_0x364f87['markerName']['split'](':')[0x2],_0x3156f3=_0x123d43['getUserBySessionId'](_0x28656f);if(!_0x3156f3||_0x28656f===_0x123d43['mySessionId'])return;if(!_0x23ed35['model']['schema']['checkChild'](_0x364f87['markerRange']['start'],'$text'))return;const _0x3da8a9={'class':'ck-user__marker\x20'+_0x3156f3['color']['getMarkerClass'](),'style':Q(_0x3156f3),'data-name':_0x3156f3['name'],'data-session-id':_0x28656f},_0x61e679=_0x23ed35['model']['markers']['get'](_0x364f87['markerName'])['getStart'](),_0x7e9810=_0x61e679['nodeAfter'],_0x72c2e1=_0x23ed35['model']['schema'];if(_0x7e9810&&_0x72c2e1['isObject'](_0x7e9810)&&_0x72c2e1['isInline'](_0x7e9810)&&!_0x23ed35['model']['markers']['get']('user:range:'+_0x28656f)['getRange']()['isCollapsed'])return;const _0x452be8=_0x61e679['parent'];return _0x23ed35['model']['schema']['isLimit'](_0x452be8)&&!_0x23ed35['model']['hasContent'](_0x452be8)&&(_0x3da8a9['contenteditable']=!0x1),function(_0x1c3701,_0x1c7655,_0x53ced4){const _0x31966=_0x1c3701['createUIElement']('span',_0x1c7655);return _0x1c3701['setCustomProperty']('userPositionMarker',!0x0,_0x31966),_0x31966['render']=function(_0x248e87){const _0x2b4302=this['toDomElement'](_0x248e87),_0x866c11=document['createElement']('span');return _0x866c11['classList']['add']('ck-user__marker-tooltip'),_0x866c11['setAttribute']('contenteditable','false'),_0x866c11['setAttribute']('spellcheck','false'),_0x866c11['textContent']=_0x53ced4['name'],_0x2b4302['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x866c11['outerHTML']+'⁠',_0x2b4302['addEventListener']('mouseenter',()=>{_0x2b4302['classList']['add']('ck-user__marker_hovered');}),_0x2b4302['addEventListener']('mouseleave',()=>{_0x2b4302['classList']['remove']('ck-user__marker_hovered');}),_0x2b4302;},_0x31966['isSimilar']=function(_0x19235b){return!(!this['getCustomProperty']('userPositionMarker')||!_0x19235b['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x19235b['getAttribute']('data-session-id'));},_0x31966;}(_0x5d5aed,_0x3da8a9,_0x3156f3);}(_0x3e710f,_0x313b7f,_0x41253f,_0x3ee4d4)}),_0x3ee4d4['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x493a9c=>function(_0x2fff74,_0x45213b){const _0xec1116=_0x2fff74['markerName']['split'](':')[0x2];if(_0xec1116===_0x45213b['mySessionId'])return null;const _0x498100=_0x45213b['getUserBySessionId'](_0xec1116);return _0x498100?{'id':_0xec1116,'classes':['ck-user__selection',_0x498100['color']['getSelectionClass']()],'attributes':{'style':Q(_0x498100),'data-session-id':_0xec1116},'priority':0x7d0+_0x498100['orderNumber']}:{'id':_0xec1116,'classes':[]};}(_0x493a9c,_0x41253f)}),function(_0x5f213e){const _0x1aba77=_0x5f213e['model'],_0x509a93=new Map(),_0x29a975=_0x5f213e['plugins']['get'](Y);_0x1aba77['markers']['on']('update:user:range',(_0x34fbc2,_0xa19076,_0x2e7df1,_0x537d85)=>{if(!_0x537d85&&_0x509a93['get'](_0xa19076['name']))return _0x509a93['get'](_0xa19076['name'])['detach'](),void _0x509a93['delete'](_0xa19076['name']);const _0x4de1fa=_0xa19076['name']['split'](':')[0x2];if(_0x4de1fa===_0x29a975['mySessionId'])return;const _0x5cdad6='user:position:'+_0x4de1fa;_0x1aba77['markers']['has'](_0x5cdad6)&&_0x5f213e['editing']['reconvertMarker'](_0x5cdad6),_0xa19076['on']('change:range',(_0x1972d7,_0x1e74e1,_0x20c172)=>{if('$graveyard'!=_0x1e74e1['root']['rootName']&&'$graveyard'==_0xa19076['getRange']()['root']['rootName']&&!_0x509a93['has'](_0xa19076['name'])){const _0x332c44=_0x1aba77['schema']['getNearestSelectionRange'](_0x20c172['deletionPosition']);if(_0x332c44){const _0x229088=_0x2b80bc['fromRange'](_0x332c44);_0x509a93['set'](_0xa19076['name'],_0x229088),_0x229088['on']('change:range',(_0x43171c,_0x391f0f,_0x4609ba)=>{if('$graveyard'==_0x229088['root']['rootName']){const _0x365f84=_0x1aba77['schema']['getNearestSelectionRange'](_0x4609ba['deletionPosition']);_0x365f84?(_0x229088['start']=_0x365f84['start'],_0x229088['end']=_0x365f84['end']):(_0x509a93['delete'](_0xa19076['name']),_0x229088['detach']());}});}}});}),_0x1aba77['document']['on']('change',()=>{_0x509a93['size']>0x0&&_0x1aba77['enqueueChange']({'isUndoable':!0x1},_0x13b4ac=>{for(const [_0x10a88b,_0x47e723]of _0x509a93)'$graveyard'==_0x1aba77['markers']['get'](_0x10a88b)['getRange']()['root']['rootName']&&(J(_0x10a88b['split'](':')[0x2],_0x47e723['toRange'](),_0x1aba77,_0x13b4ac),_0x47e723['detach']());_0x509a93['clear']();});});}(_0x3ee4d4),this['_domEmitter']['listenTo'](_0x56e72d['document'],'keydown',(_0x810a95,{key:_0x5e8aed})=>{'Escape'===_0x5e8aed&&function(_0x28c10b){_0x28c10b['editing']['view']['change'](_0x10bbba=>{for(const _0x1634f9 of _0x28c10b['model']['markers']){if(!_0x1634f9['name']['startsWith']('user:position'))continue;const _0x4b56e6=_0x28c10b['editing']['mapper']['markerNameToElements'](_0x1634f9['name']);if(_0x4b56e6){for(const _0x2ab504 of _0x4b56e6)_0x10bbba['removeClass']('ck-user__marker_hovered',_0x2ab504);}}});}(_0x3ee4d4);},{'useCapture':!0x0});}afterInit(){const _0x18e094=this['editor'],_0x417bd8=_0x18e094['commands']['get']('undo');_0x417bd8&&_0x18e094['model']['on']('applyOperation',(_0x3e9b30,_0x4740c2)=>{const _0x32fd93=_0x4740c2[0x0];if(!_0x32fd93['isDocumentOperation'])return;if('marker'!=_0x32fd93['type']||!_0x32fd93['name']['startsWith']('user:'))return;const _0x42be0a=_0x32fd93['batch'];_0x417bd8['_createdBatches']['has'](_0x42be0a)&&(_0x32fd93['newRange']=_0x32fd93['oldRange']?_0x18e094['model']['createRange'](_0x32fd93['oldRange']['start'],_0x32fd93['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x182d63=this['editor'],_0x588ab9=_0x182d63['model']['document'],_0x3de47e=_0x182d63['plugins']['get'](Y);_0x182d63['model']['enqueueChange']({'isUndoable':!0x1},_0x49d611=>{const _0x299d0a='user:range:'+_0x3de47e['mySessionId'],_0xb6e84a='user:position:'+_0x3de47e['mySessionId'],_0x45fe31=_0x182d63['model']['markers']['has'](_0x299d0a);_0x182d63['editing']['view']['hasDomSelection']?J(_0x3de47e['mySessionId'],_0x588ab9['selection']['getFirstRange'](),_0x182d63['model'],_0x49d611):_0x45fe31&&(_0x49d611['removeMarker'](_0x299d0a),_0x49d611['removeMarker'](_0xb6e84a));});}};function J(_0x26aaea,_0x4e6896,_0x1b09c0,_0x2046e5){const _0x24c573='user:range:'+_0x26aaea,_0x34245f='user:position:'+_0x26aaea,_0x387ea1=_0x4e6896['getContainedElement']();let _0x1f2017=_0x4e6896['start'];if(_0x387ea1&&_0x387ea1['is']('element','tableCell')){const _0x2856dc=function(_0x1ae964,_0x5d7a90){for(const _0x1d4435 of _0x1ae964['getPositions']())if(_0x5d7a90['schema']['checkChild'](_0x1d4435,'$text'))return _0x1d4435;}(_0x4e6896,_0x1b09c0);_0x2856dc&&(_0x1f2017=_0x2856dc,_0x4e6896=_0x2046e5['createRange'](_0x1f2017));}const _0x1c3762=_0x2046e5['createRange'](_0x1f2017);_0x1b09c0['markers']['has'](_0x24c573)?(_0x2046e5['updateMarker'](_0x24c573,{'range':_0x4e6896}),_0x2046e5['updateMarker'](_0x34245f,{'range':_0x1c3762})):(_0x2046e5['addMarker'](_0x24c573,{'range':_0x4e6896,'usingOperation':!0x0}),_0x2046e5['addMarker'](_0x34245f,{'range':_0x1c3762,'usingOperation':!0x0}));}function Q(_0x57d79d){return'--ck-user-color:'+_0x57d79d['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x57d79d['color']['getColorAlphaVariable']()+';';}function X(_0x10291f,_0xff2637,_0x248f4b){const _0x145b54=_0x10291f['t'],t=_0x10291f['t'];switch(_0xff2637){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 _0x145b54({'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'},_0x248f4b);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x1e2c35{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
- ((()=>_0x5e6c3a)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x16dea5,_0x4e8b99,_0x4178d7];}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 _0x4f55b8=this['serverHistory']['getOperations']();for(let _0x14724d=_0x4f55b8['length']-0x1;_0x14724d>=0x0;_0x14724d--){const _0x4ce991=_0x4f55b8[_0x14724d];if(!this['_disconnectionOperations']['has'](_0x4ce991))return _0x4ce991['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0xe66c84){if(super(_0xe66c84),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x274768(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1cd844('collaboration-missing-channelid',this);const _0x10ac9c=_0xe66c84['config']['get']('cloudServices.bundleVersion')||_0x5737c2;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x10ac9c,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x43f8be(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new it(this['_disconnectionOperations']);}init(){const _0x9c8645=this['editor'],_0x510198=_0x9c8645['plugins']['get'](_0x4e8b99),_0x573ff6=_0x9c8645['plugins']['get'](z);this['listenTo'](_0x510198,'getOperationAuthor',(_0x42c30e,_0x35cd75)=>{const _0x407ea2=_0x35cd75[0x0];_0x407ea2['_authorId']&&(_0x42c30e['return']=_0x510198['getUser'](_0x407ea2['_authorId']),_0x42c30e['stop']()),null===_0x407ea2['_authorId']&&(_0x42c30e['return']=null,_0x42c30e['stop']());},{'priority':'high'}),this['listenTo'](_0x9c8645['model']['document']['selection'],'change:range',(_0x538277,_0x3ffa98)=>{_0x3ffa98['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x9c8645['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x9c8645['model']['on']('applyOperation',(_0x87cf5d,_0x19a3f2)=>{const _0xffef23=_0x19a3f2[0x0];_0xffef23['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0xffef23),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x573ff6,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0xf60257,_0x587cc1,_0x4b0a43)=>'connected'===_0xf60257&&!_0x587cc1&&!_0x4b0a43),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x9c8645['disableReadOnlyMode']('rtc-offline'):_0x9c8645['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x9c8645['disableReadOnlyMode']('rtc-offline'):_0x9c8645['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x50836e=this['editor']['plugins']['get'](Y),_0x594cc0=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x50836e['unregister'](this['_channelId']);const _0x1c68cb=await this['_service']['reconnect'](_0x594cc0['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1c68cb)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x81bc10=await this['_service']['getConnectedSessions']();_0x50836e['register'](this['_channelId'],_0x81bc10),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x17273f){if(function(_0x2bb10a){return'404'===_0x2bb10a['code'];}(_0x17273f)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x5c418d){return'409'===_0x5c418d['code'];}(_0x17273f)){const _0x4b674e=X(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x4b674e);}else{if(!(_0x17273f instanceof et))throw _0x17273f;this['_handleReconnectionError']();}}}}destroy(){const _0x1d98b1=this['editor']['plugins']['get'](z),_0x10de87=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x10de87['channelSessions']['has'](this['_channelId'])&&_0x10de87['unregister'](this['_channelId']),_0x1d98b1['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x3c6e91){if(this['sessionId']!==_0x3c6e91['sessionId']&&this['_lastSyncedOperationId']!==_0x3c6e91['lastOperationId'])throw new et();return this['sessionId']=_0x3c6e91['sessionId'],this['_handleServerResponse']([],{..._0x3c6e91,'wereChangesApplied':!0x1,'data':_0x3c6e91['data']},'reconnect');}async _connectService(_0xea1c63,_0xe6938c=!0x1){const {connection:_0x5efada}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x5efada,this['_channelId'])['then'](_0x1abf3f=>this['_initSessionsHandling'](_0x1abf3f))['catch'](_0x3d8ffe=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x3d8ffe);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4ab80a,_0x3a3b74)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x3a3b74);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0xce41d1=this['_operationIdentifier']['getIdOfTheLastOperation'](_0xea1c63);this['_isPendingUpdate']=!0x0;const _0x57e1ed=await this['_service']['connect'](_0x5efada,this['_compressOperations'](_0xea1c63),_0xce41d1);if(this['sessionId']=_0x57e1ed['sessionId'],_0xe6938c){if(!_0x57e1ed['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x57e1ed['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0xea1c63,_0x57e1ed,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x57e1ed,_0xea1c63);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x2d878f=this['editor']['plugins']['get'](Y),_0x505ebe=this['editor']['plugins']['get'](K),_0x3cbc3a=_0x2d878f['channelSessions']['get'](this['_channelId']);_0x3cbc3a&&_0x3cbc3a['length']>0x1?_0x505ebe['createUserMarkerOperations']():this['listenTo'](_0x2d878f,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x2d878f['channelSessions']['get'](this['_channelId'])['length']&&_0x505ebe['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x3de68f,_0x461bbd,_0x28541b,_0x471d0b){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x461bbd){const _0x59e43=this['_decompressOperations'](_0x28541b,_0x471d0b);await this['_fetchMissingUsers'](_0x59e43),this['_handleExternalOperations'](_0x59e43,_0x461bbd,_0x28541b['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x45b445}=this['editor'];let _0x3a89bd;try{_0x3a89bd=await this['_service']['getDocumentDetails']();}catch{const _0x4767f7=X(_0x45b445,'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'](_0x4767f7);}const _0x5be258=_0x3a89bd['currentDocumentSession']||_0x3a89bd['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x5be258['lastOperationId']){const _0x42b05e=X(_0x45b445,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x42b05e);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x132fce=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x132fce['connection']||'connected'!==_0x132fce['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x32a3d5=this['editor']['plugins']['get'](Y);_0x32a3d5['channelSessions']['has'](this['_channelId'])&&_0x32a3d5['unregister'](this['_channelId']),_0x132fce['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x5b9b7a){const _0x244607=this['editor']['plugins']['get'](Y);this['listenTo'](_0x244607,'sessionAdd:'+this['_channelId'],(_0x2f00ff,{session:_0x3ea644})=>{if(_0x3ea644['id']===_0x244607['mySessionId']){_0x2f00ff['off']();const _0x1b69ad=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x2cb28b=_0x3ea644['permissions'];_0x1b69ad&&_0x1b69ad['isEnabled']&&(_0x2cb28b=_0x2cb28b['filter'](_0x3b76fe=>'document:write'!==_0x3b76fe)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x2cb28b,this['_channelId']);}}),_0x244607['register'](this['_channelId'],_0x5b9b7a);}_initThrowingOnDataSet(){const _0x106556=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x30c595)=>{if(!_0x30c595[_0x30c595['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1cd844('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x106556['apply'](this['editor']['data'],_0x30c595);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x5543ee,[_0x26dc9f])=>{if(this['_document']['version'])throw new _0x1cd844('realtimecollaborationclient-init-document-already-initialized',this);_0x5543ee['stop'](),this['_setPendingAction']();const _0x391127=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x2fffac])=>!_0x2fffac['lazyLoad'])['map'](([_0x2e2c19,_0x25d019])=>[_0x2e2c19,_0x25d019['modelAttributes']||{}])),_0x5be148=this['_getOperationsFromInitData'](_0x26dc9f,_0x391127);0x0==_0x5be148['length']&&_0x5be148['push'](new _0x49e919(0x0)),_0x5543ee['return']=this['_connectService'](_0x5be148)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x35b911=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x35b911))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x3959e8,[_0x256245,_0x4ecaea])=>{_0x3959e8['stop']();const _0x2422b3=this['editor']['model']['document']['getRoot'](_0x256245);if(!this['_knownRootNames']['has'](_0x256245)){const _0x4d649f=_0x4ecaea&&_0x4ecaea['data']?_0x4ecaea['data']:'',_0x2a77a3=_0x4ecaea&&_0x4ecaea['attributes']?_0x4ecaea['attributes']:{};await this['_loadRoot'](_0x256245,_0x4d649f,_0x2a77a3);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x2422b3['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x2422b3);});},{'priority':'high'});}async _fetchMissingUsers(_0x5c260f){const _0xcaf1c5=this['editor']['plugins']['get'](_0x4e8b99),{connection:_0x25a5c2}=this['editor']['plugins']['get'](z),_0x11970c=new Set();for(const _0x13cb75 of _0x5c260f){const _0x2a045d=_0x13cb75['_authorId'];_0x2a045d&&!_0xcaf1c5['getUser'](_0x2a045d)&&_0x11970c['add'](_0x2a045d);}if(0x0===_0x11970c['size'])return;const _0x5074c7=await _0x197c00['getMany'](_0x25a5c2,Array['from'](_0x11970c));for(const _0x34514d of _0x5074c7)_0xcaf1c5['getUser'](_0x34514d['id'])||_0xcaf1c5['addUser'](_0x34514d);}_getOperationsFromInitData(_0x47708a,_0x1a1d30={}){const _0x2f8461=this['editor']['model'],_0x13cfa2=[];let _0x4c0608=0x0;const _0x1ed836='string'==typeof _0x47708a?{'main':_0x47708a}:_0x47708a;for(const _0x33fa34 of Object['keys'](_0x1ed836)){if(!this['_document']['roots']['has'](_0x33fa34))throw new _0x1cd844('realtimecollaborationclient-init-non-existent-root',this);const _0x1b9499=this['_document']['getRoot'](_0x33fa34),_0x169ace=this['editor']['data']['parse'](_0x1ed836[_0x33fa34],_0x1b9499),_0x467725=new _0x3df20c(_0x2f8461['createPositionAt'](_0x1b9499,0x0),_0x169ace,_0x4c0608++);_0x13cfa2['push'](_0x467725);for(const [_0x5350f1,_0x358bf7]of _0x169ace['markers']){const _0x50465e=_0x2f8461['createRange'](_0x2f8461['createPositionFromPath'](_0x1b9499,_0x358bf7['start']['path']['slice']()),_0x2f8461['createPositionFromPath'](_0x1b9499,_0x358bf7['end']['path']['slice']())),_0x2e9c91=new _0x20bd43(_0x5350f1,null,_0x50465e,_0x2f8461['markers'],!0x0,_0x4c0608++);_0x13cfa2['push'](_0x2e9c91);}}if(_0x1a1d30)for(const [_0x5976b2,_0x244438]of Object['entries'](_0x1a1d30)){const _0x178dcb=_0x2f8461['document']['getRoot'](_0x5976b2);if(!_0x178dcb)throw new _0x1cd844('multi-root-editor-root-attributes-no-root',null);for(const [_0x22f1e3,_0x3e4fdf]of Object['entries'](_0x244438))if(null!==_0x3e4fdf){const _0x5039f5=new _0x4494bb(_0x178dcb,_0x22f1e3,null,_0x3e4fdf,_0x4c0608++);_0x13cfa2['push'](_0x5039f5);}}return _0x13cfa2;}async _loadRoot(_0x5d94ac,_0x3346a8,_0x339b9a){this['_getOperationsFromInitData']({[_0x5d94ac]:_0x3346a8},{[_0x5d94ac]:_0x339b9a})['forEach']((_0x4c680b,_0x458070)=>{_0x4c680b['baseVersion']=this['_document']['version']+_0x458070,_0x4c680b['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x4c680b);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0xa55f73,_0x16e4a6){let _0xb6e355;this['_offset']=_0xa55f73['offset'];const _0x307234=_0xa55f73['wereChangesApplied']&&!_0xa55f73['initData'],_0x2dac19=_0x307234?0x0:_0xa55f73['data']['baseVersion'];if(_0x16e4a6['forEach'](_0x4a3e7=>{_0x4a3e7['_isInit']=!0x0,_0x4a3e7['createdAt']=_0xa55f73['sessionCreatedAt'],_0x4a3e7['_authorId']=null;}),_0x307234)_0xb6e355=_0x16e4a6,this['_applyOperationsSet'](_0xb6e355,_0x307234);else{if(_0xa55f73['initData']){const _0xea968d=this['_getOperationsFromInitData'](_0xa55f73['initData']);this['_document']['history']['version']=-_0xea968d['length'],_0xea968d['forEach'](_0x13a57c=>{_0x13a57c['baseVersion']-=_0xea968d['length'],_0x13a57c['createdAt']=_0xa55f73['sessionCreatedAt'],_0x13a57c['_isInit']=!0x0,_0x13a57c['_authorId']=null;}),this['_applyOperationsSet'](_0xea968d,!0x0),this['serverHistory']['version']=-_0xea968d['length']+this['_offset'],this['_updateServerHistory'](_0xea968d);}this['_document']['history']['version']=_0x2dac19,_0xb6e355=this['_decompressOperations'](_0xa55f73['data'],_0xa55f73['metadata']),await this['_fetchMissingUsers'](_0xb6e355),this['_applyOperationsSet'](_0xb6e355,_0x307234);}_0xa55f73['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xb6e355,_0xa55f73['lastOperationId']),this['_lastSyncedOperationId']=_0xa55f73['lastOperationId']),this['serverHistory']['version']=_0x2dac19+this['_offset'],this['_updateServerHistory'](_0xb6e355),_0x16e4a6['filter'](_0x217fac=>{const _0x3c94a3=this['_getAffectedRoot'](_0x217fac);return _0x3c94a3&&!this['_knownRootNames']['has'](_0x3c94a3);})['forEach']((_0x5e2947,_0x22f97f)=>{_0x5e2947['baseVersion']=this['_document']['version']+_0x22f97f,this['_saveOperationInBuffer'](_0x5e2947);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x2b786f,_0x340cc6){const _0x643faf=_0x340cc6&&_0x340cc6['message'];if(_0x643faf&&_0x643faf['startsWith']('realtimecollaborationclient'))throw _0x340cc6;const _0x34dd7b=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x34dd7b['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1cd844(_0x2b786f,this['editor'],_0x643faf?{'originalError':_0x643faf}:void 0x0);}_saveOperationInBuffer(_0x1dd048){this['_knownOperations']['has'](_0x1dd048)||(this['_knownOperations']['add'](_0x1dd048),this['_bufferedOperations']['push'](_0x1dd048),this['_pendingAction']||'marker'==_0x1dd048['type']&&!_0x1dd048['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x440506=!0x1){!_0x440506&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x213940=>{_0x213940&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x57a779=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x5d8caf){return _0x5d8caf['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5d8caf['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x5d8caf['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x57a779)||this['_crash'](_0x57a779['message'],_0x57a779);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x5ececb=>{this['on']('change:_isPendingUpdate',()=>{_0x5ececb();});});}async _sendBufferedOperations(){const _0x29e275=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x29e275['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x5a5d77=[...this['_bufferedOperations']];for(const _0x4a6963 of _0x5a5d77)_0x4a6963['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x4a6963);const _0x1b17ba=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x5a5d77),_0x1abbbe=Z++,_0x2fc016=this['_compressOperations'](_0x5a5d77),_0xd81fb3=await this['_service']['sendOperations'](_0x2fc016,_0x2fc016['baseVersion'],_0x1b17ba);try{return await this['_handleServerResponse'](_0x5a5d77,_0xd81fb3,_0x1abbbe);}catch(_0x2425c9){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x2425c9);}}async['_handleServerResponse'](_0x433bef,_0x4963ab,_0x1c7d69){if('error'in _0x4963ab)throw _0x4963ab['error'];let _0x3b9173;if(_0x4963ab['wereChangesApplied']){_0x4963ab['lastOperationId']&&(this['_lastSyncedOperationId']=_0x4963ab['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x3340e7=>!_0x433bef['includes'](_0x3340e7));for(const _0x1d5505 of _0x433bef)_0x1d5505['createdAt']='lastOperationAcceptedAt'in _0x4963ab&&_0x4963ab['lastOperationAcceptedAt']||void 0x0;st(_0x433bef,_0x4963ab['version']-_0x433bef['length']),this['_updateServerHistory'](_0x433bef);const _0xa34ef6=_0x433bef['filter'](_0x1f8964=>{if(!_0x1f8964['_isInit'])return!0x1;const _0x1b03ab=this['_getAffectedRoot'](_0x1f8964);return _0x1b03ab&&!this['_knownRootNames']['has'](_0x1b03ab);});st(_0xa34ef6,this['_document']['version']),this['_applyOperationsSet'](_0xa34ef6),_0x3b9173=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x209162=this['_decompressOperations'](_0x4963ab['data'],_0x4963ab['metadata'])['filter'](_0x38f0a6=>_0x38f0a6['baseVersion']>=this['_lastServerVersion']);_0x209162['forEach'](_0x57a074=>this['_addKnownRoot'](_0x57a074)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x4d1fa6=>!_0x4d1fa6['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x4d1fa6))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x209162),_0x3b9173=this['_handleExternalOperations'](_0x209162,_0x4963ab['version'],_0x4963ab['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x3b9173?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x561c1a,_0x4a804d,_0x572195){try{const _0x3007c5={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x480632,operationsB:_0x46ee95,originalOperations:_0x18ee3d}=_0x178582(_0x561c1a,this['_bufferedOperations'],_0x3007c5);st(_0x480632,this['_document']['version']),st(_0x46ee95,_0x4a804d);for(const _0x5c5c6a of _0x480632){const _0x427907=_0x18ee3d['get'](_0x5c5c6a);_0x427907?(_0x5c5c6a['_authorId']=_0x427907['_authorId'],'noop'!==_0x5c5c6a['type']&&(_0x5c5c6a['_aiSource']=_0x427907['_aiSource'])):_0x5c5c6a['_authorId']=null;}for(const _0x3d483c of _0x46ee95)'noop'!==_0x3d483c['type']&&(_0x3d483c['_aiSource']=_0x18ee3d['get'](_0x3d483c)?.['_aiSource']);_0x572195&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x561c1a,_0x572195),this['_lastSyncedOperationId']=_0x572195),this['_bufferedOperations']=[..._0x46ee95],this['_applyOperationsSet'](_0x480632),this['_updateServerHistory'](_0x561c1a);}catch(_0x2bdba2){return console['error'](_0x2bdba2),!0x1;}return!0x0;}_applyOperationsSet(_0x555bb4,_0x6ca95c=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x5b62d6=>{for(const _0x455673 of _0x555bb4)this['_knownOperations']['add'](_0x455673),this['_addKnownRoot'](_0x455673),_0x5b62d6['batch']['addOperation'](_0x455673),this['editor']['model']['applyOperation'](_0x455673);});}_addKnownRoot(_0x3586cd){const _0x441ebd=this['_getAffectedRoot'](_0x3586cd);_0x441ebd&&this['_knownRootNames']['add'](_0x441ebd);}_getAffectedRoot(_0x5298ea){let _0x225daa,_0x3189b7;switch(_0x5298ea['type']){case'insert':_0x225daa=_0x5298ea['position']['root'];break;case'marker':if(_0x3189b7=_0x5298ea['newRange'],!_0x3189b7)return null;_0x225daa=_0x3189b7['root'];break;case'addRootAttribute':_0x225daa=_0x5298ea['root'];break;case'addRoot':_0x225daa=_0x5298ea['affectedSelectable'];break;case'move':_0x225daa=_0x5298ea['targetPosition']['root'];break;default:return null;}return _0x225daa['rootName'];}_updateServerHistory(_0x4ce837){_0x4ce837['forEach'](_0x329b82=>{const _0x3ade23=_0x329b82['clone']();_0x3ade23['_authorId']=_0x329b82['_authorId'],_0x3ade23['_isInit']=!!_0x329b82['_isInit'],_0x3ade23['_aiSource']=_0x329b82['_aiSource'],_0x3ade23['createdAt']=_0x329b82['createdAt'],_0x3ade23['baseVersion']+=this['_offset'],_0x329b82['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x3ade23),this['serverHistory']['addOperation'](_0x3ade23);});}_handleReconnectionError(_0x23e257){const _0x42282e=this['editor']['plugins']['get']('Notification'),_0x4645b0=this['editor']['locale'];_0x23e257||(_0x23e257=X(_0x4645b0,'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.')),_0x42282e['showWarning'](_0x23e257,{'title':X(_0x4645b0,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x16dea5)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x16dea5)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x170c7e){const _0x33c16e=_0x170c7e['map'](_0x35f9cf=>_0x35f9cf['toJSON']());return this['_compressor']['compress'](_0x33c16e);}_decompressOperations(_0x23a9ee,_0x53e494){return this['_compressor']['decompress'](_0x23a9ee)['map']((_0x40dcf2,_0x2cff24)=>{const _0x28ee2d='init'==_0x53e494[_0x2cff24]['type'];if('InsertOperation'==_0x40dcf2['__className']){const _0x3ff533=_0x40dcf2['position']['root'];!this['_document']['getRoot'](_0x3ff533)&&(this['_document']['createRoot']('$unknown',_0x3ff533)['_isAttached']=!0x1);}else{if('RootOperation'==_0x40dcf2['__className']){const _0x181816=this['_document']['getRoot'](_0x40dcf2['rootName']);_0x181816&&'$unknown'==_0x181816['name']&&_0x40dcf2['elementName']!=_0x181816['name']&&(_0x181816['name']=_0x40dcf2['elementName']);}}const _0x126b1c=_0x52f4f9['fromJSON'](_0x40dcf2,this['_document']);return _0x126b1c['wasUndone']=_0x40dcf2['wasUndone'],_0x126b1c['_isInit']=_0x28ee2d,_0x126b1c['_authorId']=_0x28ee2d?null:_0x53e494[_0x2cff24]['userId'],_0x126b1c['_isDisconnection']='cs:removeUser'===_0x53e494[_0x2cff24]['type'],_0x126b1c['_aiSource']=_0x40dcf2['_aiSource']||void 0x0,_0x126b1c['createdAt']=_0x53e494[_0x2cff24]['createdAt'],_0x126b1c;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x1d8b60=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x1d8b60&&_0x1d8b60['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x54e620,_0x578ee4){for(const _0x1ce716 of _0x54e620)_0x1ce716['baseVersion']=_0x578ee4++;}var it=class{_ignoredOperations;_operationToId;constructor(_0xf17517){this['_ignoredOperations']=_0xf17517,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x2a5355){let _0x300d0a=_0x2a5355['length'];for(;_0x300d0a--;){const _0x55e567=_0x2a5355[_0x300d0a];if(!this['_ignoredOperations']['has'](_0x55e567)){if(!this['_operationToId']['has'](_0x55e567)){const _0x3d19bd=_0x5a8841()['slice'](0x1,0x12);this['_operationToId']['set'](_0x55e567,_0x3d19bd);}return this['_operationToId']['get'](_0x55e567);}}}setIdForTheLastOperation(_0x49ea04,_0x35a573){if(!_0x35a573)return;let _0x1baa83=_0x49ea04['length'];for(;_0x1baa83--;){const _0x52b851=_0x49ea04[_0x1baa83];this['_ignoredOperations']['has'](_0x52b851)||this['_operationToId']['set'](_0x52b851,_0x35a573);}}},nt=class extends _0x1e2c35{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x3db858{static CommentsService=/* #__PURE__ -- @preserve */
26
- ((()=>_0x294775)());['_services'];static get requires(){return[z,_0x46916a,Y,_0x4e8b99];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x42aaac){super(_0x42aaac),this['_services']=new Map();}async init(){const _0x33860f=this['context'],_0x1473f1=_0x33860f['plugins']['get'](_0x46916a);if(_0x33860f['plugins']['get'](z)['addToReconnectionStack'](this),_0x1473f1['adapter']={'addCommentThread':async({channelId:_0x1da791,threadId:_0x278a00,comments:_0x299bdc,resolvedAt:_0x1612fe,resolvedBy:_0x57adf3,context:_0x22386a,attributes:_0xb2ad06})=>{const _0x59885a=await this['_getService'](_0x1da791)['addCommentThread']({'commentThreadId':_0x278a00,'comments':_0x299bdc['map'](_0x2ca7f2=>function(_0x27d605,_0x11c5e6,_0x4b5f18){return{'commentThreadId':_0x4b5f18,'commentId':_0x27d605['commentId'],'userId':_0x27d605['authorId'],'content':_0x27d605['content'],'documentId':_0x11c5e6,'createdAt':_0x27d605['createdAt'],'attributes':_0x27d605['attributes']||{}};}(_0x2ca7f2,_0x1da791,_0x278a00)),'resolvedAt':_0x1612fe,'resolvedBy':_0x57adf3,'context':_0x22386a,'attributes':_0xb2ad06})['catch'](ct);return{'threadId':_0x59885a['commentThreadId'],'comments':_0x59885a['comments']};},'getCommentThread':async({channelId:_0x53b773,threadId:_0x445e80})=>{const _0x42a034=await this['_getService'](_0x53b773)['getCommentThread'](_0x445e80)['catch'](rt)['catch'](ct);return _0x42a034?_0x42a034['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x42a034]),{'threadId':_0x42a034['commentThreadId'],'comments':_0x42a034['comments']['map'](at),'context':_0x42a034['context'],'resolvedAt':_0x42a034['resolvedAt'],'resolvedBy':_0x42a034['resolvedBy'],'attributes':_0x42a034['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x8d78e5,threadId:_0x4eb317,context:_0xe5b1fa,unlinkedAt:_0x40d3be,attributes:_0x3a6d51})=>this['_getService'](_0x8d78e5)['updateCommentThread']({'commentThreadId':_0x4eb317,'context':_0xe5b1fa,'attributes':_0x3a6d51,'unlinkedAt':_0x40d3be})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0xc9c6c,threadId:_0x4d6583})=>{const _0x3f32c0=await this['_getService'](_0xc9c6c)['resolveCommentThread'](_0x4d6583)['catch'](rt)['catch'](ct);return{'threadId':_0x3f32c0['commentThreadId'],'resolvedAt':_0x3f32c0['resolvedAt'],'resolvedBy':_0x3f32c0['resolvedBy']};},'reopenCommentThread':async({channelId:_0x37fbb2,threadId:_0x1f983c})=>this['_getService'](_0x37fbb2)['reopenCommentThread'](_0x1f983c)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x580964,threadId:_0x41fbf4})=>this['_getService'](_0x580964)['removeCommentThread'](_0x41fbf4)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x16893e,threadId:_0x4ec83b,commentId:_0x4741bd,content:_0x4ffe0e,attributes:_0x264d37})=>this['_getService'](_0x16893e)['addComment'](_0x4ec83b,_0x4741bd,_0x4ffe0e,_0x264d37)['catch'](ct),'updateComment':({channelId:_0x33718c,threadId:_0x2eb5a9,commentId:_0x46caa6,content:_0x120e94,attributes:_0x5a69a1})=>this['_getService'](_0x33718c)['updateComment'](_0x2eb5a9,_0x46caa6,_0x120e94,_0x5a69a1)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x56aa68,threadId:_0x55f42b,commentId:_0x2b5fee})=>this['_getService'](_0x56aa68)['removeComment'](_0x55f42b,_0x2b5fee)['catch'](rt)['catch'](ct)},_0x33860f instanceof _0x4fe616){const _0x4ca370=_0x33860f['config']['get']('collaboration.channelId'),_0x1614f3=_0x33860f['plugins']['get'](Y);await this['_setUpService'](_0x4ca370);const _0x115eef=await this['_services']['get'](_0x4ca370)['getConnectedSessions']();this['listenTo'](_0x1614f3,'sessionAdd:'+_0x4ca370,(_0x5af504,{session:_0x5c8d12})=>{_0x5c8d12['id']===_0x1614f3['mySessionId']&&(_0x5af504['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x5c8d12['permissions'],_0x4ca370));}),_0x1614f3['register'](_0x4ca370,_0x115eef);}}async _setUpService(_0x9a8c31){if(this['_services']['has'](_0x9a8c31))throw new _0x1cd844('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x9a8c31});const _0x385fcf=this['context']['plugins']['get'](_0x46916a),_0x20f35d=new CloudServicesCommentsAdapter['CommentsService'](_0x9a8c31);this['_services']['set'](_0x9a8c31,_0x20f35d),this['listenTo'](_0x20f35d,'commentThreadAdded',(_0x524f04,_0x34b09a)=>{const {commentThreadId:_0x571d47,documentId:_0x4da4e8,context:_0x1e01bc,attributes:_0x4da4b0,resolvedAt:_0x2973b6,resolvedBy:_0x2bce91,comments:_0x173bd1}=_0x34b09a;_0x385fcf['getCommentThread'](_0x571d47)||_0x385fcf['addCommentThread']({'threadId':_0x571d47,'channelId':_0x4da4e8,'comments':_0x173bd1?_0x173bd1['map'](at):[],'context':_0x1e01bc,'attributes':_0x4da4b0,'resolvedAt':_0x2973b6,'resolvedBy':_0x2bce91,'isFromAdapter':!0x0});}),this['listenTo'](_0x20f35d,'commentThreadUpdated',(_0x5a8321,{commentThreadId:_0x525463,documentId:_0x34f8c0,context:_0x4a0495,unlinkedAt:_0x54c5c2,attributes:_0x2a4098})=>{_0x385fcf['getCommentThread'](_0x525463)&&_0x385fcf['updateCommentThread']({'threadId':_0x525463,'channelId':_0x34f8c0,'context':_0x4a0495,'unlinkedAt':_0x54c5c2,'attributes':_0x2a4098,'isFromAdapter':!0x0});}),this['listenTo'](_0x20f35d,'commentThreadResolved',(_0x10932b,{commentThreadId:_0xc9c931,resolvedBy:_0x555ec6,resolvedAt:_0x173f44})=>{const _0x36b7fd=_0x385fcf['getCommentThread'](_0xc9c931);_0x36b7fd&&_0x36b7fd['resolve']({'resolvedBy':_0x555ec6,'resolvedAt':_0x173f44,'isFromAdapter':!0x0});}),this['listenTo'](_0x20f35d,'commentThreadReopened',(_0x4a5c0c,{commentThreadId:_0x12f8ec})=>{const _0x52b4fa=_0x385fcf['getCommentThread'](_0x12f8ec);_0x52b4fa&&_0x52b4fa['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x20f35d,'commentThreadRemoved',(_0x5ad05e,{commentThreadId:_0x8e6a1c})=>{const _0x5f8b5e=_0x385fcf['getCommentThread'](_0x8e6a1c);_0x5f8b5e&&_0x5f8b5e['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x20f35d,'commentAdded',(_0x1c350b,_0x40339a)=>{const _0x1baf74=_0x40339a['commentThreadId'],_0xe14354=_0x385fcf['getCommentThread'](_0x1baf74);_0xe14354&&_0xe14354['addComment']({...at(_0x40339a),'isFromAdapter':!0x0});}),this['listenTo'](_0x20f35d,'commentUpdated',(_0x4e9bca,{commentThreadId:_0x5475a8,commentId:_0xb5a297,content:_0x23b5f8,attributes:_0x1f4e8e})=>{const _0x1f182e=_0x385fcf['getCommentThread'](_0x5475a8);if(_0x1f182e){const _0x2113e0=_0x1f182e['getComment'](_0xb5a297);_0x2113e0&&_0x2113e0['update']({'content':_0x23b5f8,'attributes':_0x1f4e8e,'isFromAdapter':!0x0});}}),this['listenTo'](_0x20f35d,'commentRemoved',(_0x412ff3,{commentThreadId:_0x258e3f,commentId:_0x5825e5})=>{const _0xdade60=_0x385fcf['getCommentThread'](_0x258e3f);if(_0xdade60){const _0x21c38d=_0xdade60['getComment'](_0x5825e5);_0x21c38d&&_0x21c38d['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x20f35d,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x9a8c31),this['stopListening'](_0x20f35d));}),await this['_connectService'](_0x9a8c31);}destroy(){if(this['context']instanceof _0x4fe616){const _0x53828=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x53828)&&this['_terminateService'](_0x53828);}}_terminateService(_0x149945){if(!this['_services']['has'](_0x149945))throw new _0x1cd844('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x149945});this['_getService'](_0x149945)['disconnect'](),this['_services']['delete'](_0x149945);}async reconnect(){for(const _0x5062a7 of this['_services']['keys']())await this['_connectService'](_0x5062a7);if(this['context']instanceof _0x4fe616){const _0x9c46c2=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x9c46c2)){const _0x5ec098=this['context']['plugins']['get'](Y);_0x5ec098['unregister'](_0x9c46c2);const _0x5c0cbc=await this['_services']['get'](_0x9c46c2)['getConnectedSessions']();_0x5ec098['register'](_0x9c46c2,_0x5c0cbc);}}}async _connectService(_0x398fcb){const {connection:_0x1a6cbf}=this['context']['plugins']['get'](z),_0x27de4b=this['context']['plugins']['get'](_0x46916a),_0x4fee0d=await this['_services']['get'](_0x398fcb)['connect'](_0x1a6cbf);await this['_fetchMissingUsersForThreads'](_0x4fee0d);const _0x37cb8f=new Set(Array['from'](_0x27de4b['getCommentThreads']({'channelId':_0x398fcb}),_0x3a7119=>_0x3a7119['id']));for(const _0x14e4a6 of _0x4fee0d)_0x14e4a6['deletedAt']||_0x37cb8f['delete'](_0x14e4a6['commentThreadId']);for(const _0x289e8a of _0x37cb8f)_0x27de4b['getCommentThread'](_0x289e8a)['remove']({'isFromAdapter':!0x0});for(const _0x1d97e7 of _0x4fee0d){let _0x18b664=_0x27de4b['getCommentThread'](_0x1d97e7['commentThreadId']);const {commentThreadId:_0x560ff3,context:_0x23f67c,attributes:_0x7d57d7,resolvedBy:_0x1fc5df,resolvedAt:_0x4f6089,unlinkedAt:_0x1a1174,deletedAt:_0x4b3908}=_0x1d97e7;if(_0x4b3908)continue;_0x18b664||(_0x18b664=_0x27de4b['addCommentThread']({'channelId':_0x398fcb,'threadId':_0x560ff3,'context':_0x23f67c,'attributes':_0x7d57d7||{},'resolvedBy':_0x1fc5df,'resolvedAt':_0x4f6089,'unlinkedAt':_0x1a1174,'isFromAdapter':!0x0}));const _0x1f31ac=new Set(Array['from'](_0x18b664['comments'],_0x1508e5=>_0x1508e5['id']));for(const _0x53ef7b of _0x1d97e7['comments'])_0x1f31ac['delete'](_0x53ef7b['commentId']);for(const _0x3aa641 of _0x1f31ac)_0x18b664['getComment'](_0x3aa641)['remove']({'isFromAdapter':!0x0});for(const _0x58c171 of _0x1d97e7['comments']){const _0xc1e411=_0x18b664['getComment'](_0x58c171['commentId']);_0xc1e411?_0xc1e411['content']!==_0x58c171['content']&&_0xc1e411['update']({'content':_0x58c171['content'],'isFromAdapter':!0x0}):_0x18b664['addComment'](Object['assign'](at(_0x58c171),{'isFromAdapter':!0x0}));}}}_getService(_0x295fd8){if(!this['_services']['has'](_0x295fd8))throw new _0x1cd844('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x295fd8});return this['_services']['get'](_0x295fd8);}async _fetchMissingUsersForThreads(_0x15398b){const _0x42d393=this['context']['plugins']['get'](_0x4e8b99),{connection:_0x233080}=this['context']['plugins']['get'](z),_0x5403aa=new Set();for(const {resolvedBy:_0x5f5585,comments:_0x2836e9}of _0x15398b){_0x5f5585&&!_0x42d393['getUser'](_0x5f5585)&&_0x5403aa['add'](_0x5f5585);for(const {userId:_0x3d8256}of _0x2836e9)_0x42d393['getUser'](_0x3d8256)||_0x5403aa['add'](_0x3d8256);}if(0x0===_0x5403aa['size'])return;const _0x365276=await _0x197c00['getMany'](_0x233080,Array['from'](_0x5403aa));for(const _0x313f76 of _0x365276)_0x42d393['getUser'](_0x313f76['id'])||_0x42d393['addUser'](_0x313f76);}};async function rt(_0x356422){if('404'!==_0x356422['code'])throw _0x356422;}function ct(_0x4d3f81){if((_0x37996e=_0x4d3f81)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x37996e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x37996e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x37996e;throw _0x4d3f81;}function at(_0xa5029d){return{'threadId':_0xa5029d['commentThreadId'],'commentId':_0xa5029d['commentId'],'content':_0xa5029d['content'],'createdAt':_0xa5029d['createdAt'],'authorId':_0xa5029d['userId'],'attributes':_0xa5029d['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x1e2c35{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x53df18)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x27597a,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x198768){super(_0x198768);const _0xf53acc=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0xf53acc);}init(){const _0x388423=this['editor']['plugins']['get'](z),_0x5bb914=this['editor']['plugins']['get'](_0x27597a);return _0x5bb914['adapter']={'getSuggestion':async _0x247e74=>{await this['_waitForServiceReady']();const _0x15814b=await this['_trackChangesService']['get'](_0x247e74)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x15814b]),_0x15814b;},'addSuggestion':async({id:_0x233f3a,type:_0x5baeaf,data:_0x324926,originalSuggestionId:_0x305131,attributes:_0x4dea5f})=>{await this['_waitForServiceReady']();const _0x4ae227={'id':_0x233f3a,'type':_0x5baeaf,'data':_0x324926,'originalSuggestionId':_0x305131,'attributes':_0x4dea5f},_0x49d285=await this['_trackChangesService']['add'](_0x233f3a,_0x5baeaf,_0x324926,_0x305131,_0x4dea5f)['catch'](_0x5e417f=>{if(dt(_0x5e417f))return new Promise(_0x200093=>{this['_bufferedRequests']['set'](_0x233f3a,{'resolve':_0x200093,'suggestionData':_0x4ae227});});throw _0x5e417f;});return this['_bufferedRequests']['delete'](_0x233f3a),_0x49d285;},'updateSuggestion':async(_0xb82d4d,_0x137154)=>{if(await this['_waitForServiceReady'](),'open'!==_0x137154['state'])return this['_trackChangesService']['update'](_0xb82d4d,_0x137154)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x1bcf28,_0x2734a6)=>{_0x5bb914['hasSuggestion'](_0x2734a6['id'])&&(_0x5bb914['getSuggestion'](_0x2734a6['id'])['attributes']=_0x2734a6['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x388423['connection']?.['state']&&(_0x388423['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x388423['connection'])['then'](_0x5f1397=>(_0x388423['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x5f1397)['then'](()=>{for(const _0x5b1e3d of _0x5f1397){_0x5bb914['addSuggestionData'](_0x5b1e3d)['_saved']=!0x0;}})));}async reconnect(){const _0xedcbf6=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x510295}=this['editor']['plugins']['get'](z),_0x3563ae=await this['_trackChangesService']['connect'](_0x510295);await this['_fetchMissingUsersForThreads'](_0x3563ae);for(const {suggestionData:_0x1f5958,resolve:_0x2aa9fd}of this['_bufferedRequests']['values']()){let _0x55a7f6=_0x3563ae['find'](_0x2ff75c=>_0x2ff75c['id']===_0x1f5958['id']);_0x55a7f6||(_0x55a7f6=await this['_trackChangesService']['add'](_0x1f5958['id'],_0x1f5958['type'],_0x1f5958['data'],_0x1f5958['originalSuggestionId'])),_0x2aa9fd(_0x55a7f6);}for(const _0x3bb7eb of _0x3563ae)_0xedcbf6['hasSuggestion'](_0x3bb7eb['id'])||_0xedcbf6['addSuggestionData'](_0x3bb7eb);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x5e0f4f=>{this['listenTo'](this['_trackChangesService'],'connected',_0x5834e3=>{_0x5834e3['off'](),_0x5e0f4f();});});}async _fetchMissingUsersForThreads(_0x5393c8){const _0xb1bfcd=this['editor']['plugins']['get'](_0x4e8b99),{connection:_0x4ef1c7}=this['editor']['plugins']['get'](z),_0x2d7be6=new Set();for(const {authorId:_0x48d822}of _0x5393c8)_0xb1bfcd['getUser'](_0x48d822)||_0x2d7be6['add'](_0x48d822);if(0x0===_0x2d7be6['size'])return;const _0x43cd7a=await _0x197c00['getMany'](_0x4ef1c7,Array['from'](_0x2d7be6));for(const _0x5d98de of _0x43cd7a)_0xb1bfcd['getUser'](_0x5d98de['id'])||_0xb1bfcd['addUser'](_0x5d98de);}};function lt(_0x54c315){if(dt(_0x54c315))return new Promise(()=>{});throw _0x54c315;}function dt(_0x3ab29b){return _0x3ab29b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3ab29b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x1e2c35{static get requires(){return[_0x5db2b7,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x1c7d9e=this['editor']['plugins']['get'](z),_0x1c7d2a=this['editor']['plugins']['get'](_0x54e2b9),_0x3a14bf=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x1c7d9e,'change:state',(_0x2c6232,_0x14210f,_0x3f972a)=>{_0x1c7d2a['isThreadsLoadingPaused']='connected'!==_0x3f972a;});}),this['listenTo'](_0x1c7d9e,'change:state',(_0x585ca8,_0xfa8f74,_0x4401b1)=>{this['editor']['plugins']['get'](_0x46916a)['switchReadOnly']('connected'!==_0x4401b1);}),_0x3a14bf['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0xa036f9=this['editor']['plugins']['get'](ot),_0x3c9ff8=this['editor']['config']['get']('collaboration.channelId');_0xa036f9['_services']['has'](_0x3c9ff8)&&_0xa036f9['_terminateService'](_0x3c9ff8),super['destroy']();}},ft=class extends _0x1e2c35{static get requires(){return[ut,ht,_0x4fb15c];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x1e2c35{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
- ((()=>_0x33a6ab)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x5c26c3,Y,_0x4e8b99];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x12cbd){super(_0x12cbd);const _0x2f2109=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x2f2109);}async init(){const _0x2de463=this['editor']['plugins']['get'](tt),_0x83112c=_0x2de463['serverHistory'],_0x5ce42c=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x83112c,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x2de463['sessionId']});const _0x4695fe=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x5737c2,_0x1f4500=await _0x1ddb48['isBundleUploaded'](_0x5ce42c['connection'],_0x4695fe);this['editor']['plugins']['get'](_0x5c26c3)['adapter']={'getRevision':async({revisionId:_0x1f9115})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x1f9115)),'updateRevisions':async _0x2eb666=>{await this['_waitForServiceReady']();const _0x3cec29=this['_revisionTracker']['currentRevision'];if(_0x1f4500&&0x1===_0x2eb666['length']&&_0x2eb666[0x0]['id']===_0x3cec29['id'])return _0x2eb666;for(const _0x4cff26 of _0x2eb666)_0x4cff26['id']===_0x3cec29['id']&&(_0x4cff26['isEmptyCurrent']=_0x4cff26['fromVersion']===_0x4cff26['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x2eb666,this['_lastRequestId'])['then'](_0x3be236=>(this['_lastRequestId']=_0x3be236,_0x2eb666))['catch'](_0x1178e2=>{if(pt(_0x1178e2)||'400'===_0x1178e2['code']&&void 0x0!==_0x1178e2['data']['wrongRequestId']){for(const _0x53a1f8 of _0x2eb666)this['_revisionTracker']['repository']['getRevision'](_0x53a1f8['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x53a1f8['id'],_0x53a1f8,!0x1);if(pt(_0x1178e2)&&'destroyed'!==this['editor']['state'])throw _0x1178e2;return _0x2eb666;}throw _0x1178e2;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x341e25,{revisionsData:_0x301742,requestId:_0xcf2810})=>{Math['max'](..._0x301742['map'](_0x121f6e=>_0x121f6e['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x301742,_0xcf2810);}):this['_handleRevisionsUpdate'](_0x301742,_0xcf2810);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x5ce42c['connection']?.['state']&&(_0x5ce42c['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x2cf8c6,requestId:_0x51b122}=await this['_revisionHistoryService']['connect'](_0x5ce42c['connection']);_0x5ce42c['addToReconnectionStack'](this),this['_lastRequestId']=_0x51b122,await this['_fetchMissingUsers'](_0x2cf8c6);for(const _0x5ac0a0 of _0x2cf8c6)this['_revisionTracker']['addRevisionData'](_0x5ac0a0);this['listenTo'](_0x2de463,'change:_isConnected',(_0x4ed2bb,_0x276eab,_0x3d8bb1)=>{_0x3d8bb1&&(this['_oldOffset']=_0x2de463['_offset'],_0x4ed2bb['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x479fbe=this['editor']['plugins']['get'](z),_0xe5371b=this['editor']['plugins']['get'](tt),_0x2b7241=async()=>{const _0x301634=this['_revisionTracker']['currentRevision'],_0x52a56a=_0x301634['id'],_0x3eaf86=_0x52a56a!==_0xe5371b['sessionId'];if(_0x3eaf86){const _0x315c3d=_0xe5371b['_offset']-this['_oldOffset'],_0x323f21=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x301634['toVersion']+_0x315c3d!==_0x323f21){const _0x4ec243=_0x301634['fromVersion']+_0x315c3d,_0x506317=this['editor']['plugins']['get'](_0x4e8b99),_0x4ccfea=this['_revisionTracker']['buildRevisionData']({'revision':_0x301634,'from':_0x4ec243,'to':_0x323f21});_0x4ccfea['id']=_0x301634['id'];const _0x2eab4a=_0x4ccfea['authorsIds']['map'](_0x1afd58=>_0x506317['getUser'](_0x1afd58));_0x301634['_update']({..._0x4ccfea,'authors':_0x2eab4a},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x301634['id'],_0x4ccfea,!0x0);}this['_revisionTracker']['_startingVersion']=_0x323f21,_0x301634['toVersion']!==_0x301634['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x52a56a)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x52a56a),this['_revisionTracker']['_createCurrentRevision'](_0x323f21);}const {revisions:_0x1e9abd,requestId:_0x8bf9bd}=await this['_revisionHistoryService']['reconnect'](_0x479fbe['connection'],this['_lastRequestId']);_0x3eaf86&&_0x1e9abd['length']>0x0?_0xe5371b['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x1e9abd),this['_handleRevisionsUpdate'](_0x1e9abd,_0x8bf9bd),this['_revisionTracker']['sendBufferedUpdates']());};return _0xe5371b['_isConnected']?_0x2b7241():new Promise((_0x39a04c,_0x2d49c4)=>{_0xe5371b['once']('change:_isConnected',()=>{_0x2b7241()['then'](_0x39a04c)['catch'](_0x2d49c4);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x424eef=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x6ef46=>{_0x6ef46['off'](),_0x424eef();});});}_getLatestVersionFromServerOperations(){const _0x39cdf3=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0xa4a81 of _0x39cdf3)if('marker'!==_0xa4a81['type']||_0xa4a81['affectsData'])return _0xa4a81['baseVersion']+0x1;}_getLatestVersion(){const _0x4a2fea=this['editor']['plugins']['get'](tt);return new Promise(_0x302a82=>{_0x4a2fea['_isPendingUpdate']?_0x4a2fea['once']('change:_isPendingUpdate',()=>{_0x302a82(this['_getLatestVersionFromServerOperations']());}):_0x302a82(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x40959f,_0x2ec523){const _0x1830f5=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x2ec523;for(const _0x56a794 of _0x40959f){const _0xee1b61=_0x1830f5['getRevision'](_0x56a794['id']);if(_0xee1b61){if((_0x56a794['fromVersion']||_0x56a794['toVersion'])&&(_0x56a794['diffData']=null),_0xee1b61===this['_revisionTracker']['currentRevision']){const _0x4ee41a=Math['max'](_0xee1b61['toVersion'],_0x56a794['toVersion']),_0x59ec52=Math['max'](_0xee1b61['fromVersion'],_0x56a794['fromVersion']);let _0x1accad;_0xee1b61['toVersion']===_0x56a794['toVersion']&&_0xee1b61['fromVersion']===_0x56a794['fromVersion']?(_0x1accad=!0x0,this['_preventResendingRevisionData'](_0x56a794)):_0x56a794['toVersion']===_0x4ee41a&&_0x56a794['fromVersion']===_0x59ec52?_0x1accad=!0x1:(_0xee1b61['toVersion']===_0x4ee41a&&_0xee1b61['fromVersion']===_0x59ec52||this['_fixRevision']({'revision':_0xee1b61,'from':_0x59ec52,'to':_0x4ee41a}),_0x1accad=!0x0),_0x1accad&&(delete _0x56a794['fromVersion'],delete _0x56a794['toVersion'],delete _0x56a794['diffData'],delete _0x56a794['createdAt'],delete _0x56a794['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x56a794),this['_preventResendingRevisionData'](_0x56a794);}else this['_revisionTracker']['addRevisionData'](_0x56a794);}const _0x226696=_0x1830f5['getRevisions']();_0x226696['reverse']();for(let _0x34e6c2=0x0;_0x34e6c2<_0x226696['length']-0x1;_0x34e6c2++){const _0x17e714=_0x226696[_0x34e6c2],_0x55a381=_0x226696[_0x34e6c2+0x1];if(_0x17e714['fromVersion']<_0x55a381['toVersion']){const _0x14abb1=_0x55a381['toVersion'],_0x5830d1=Math['max'](_0x14abb1,_0x17e714['toVersion']);this['_fixRevision']({'revision':_0x17e714,'from':_0x14abb1,'to':_0x5830d1});}}}['_fixRevision']({revision:_0x253fcd,from:_0x3e387e,to:_0x4fd2a4}={}){const _0x11dee1=this['editor']['plugins']['get'](_0x4e8b99),_0x5f1713=this['_revisionTracker']['buildRevisionData']({'revision':_0x253fcd,'from':_0x3e387e,'to':_0x4fd2a4});_0x5f1713['authors']=_0x5f1713['authorsIds']['map'](_0x22b645=>_0x11dee1['getUser'](_0x22b645)),_0x253fcd['_update'](_0x5f1713);}_preventResendingRevisionData(_0x2351ca){const _0x54b22f={};_0x54b22f['id']=_0x2351ca['id'];for(const _0x2613dc of Object['keys'](_0x2351ca))'id'!==_0x2613dc&&(_0x54b22f[_0x2613dc]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x54b22f['id'],_0x54b22f,!0x0);}async _fetchMissingUsers(_0x108b9d){const _0x4de267=this['editor']['plugins']['get'](_0x4e8b99),{connection:_0x9ebce}=this['editor']['plugins']['get'](z),_0x586db8=new Set();for(const _0x28574f of _0x108b9d){for(const _0x3cd6d6 of _0x28574f['authorsIds'])_0x27b989(_0x3cd6d6);_0x28574f['creatorId']&&_0x27b989(_0x28574f['creatorId']);}if(0x0===_0x586db8['size'])return;const _0x4ba735=await _0x197c00['getMany'](_0x9ebce,Array['from'](_0x586db8));for(const _0x361fc8 of _0x4ba735)_0x4de267['getUser'](_0x361fc8['id'])||_0x4de267['addUser'](_0x361fc8);function _0x27b989(_0x211b53){_0x4de267['getUser'](_0x211b53)||_0x586db8['add'](_0x211b53);}}};function pt(_0xd5cfb1){return _0xd5cfb1['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xd5cfb1['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xd5cfb1['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x1e2c35{static get requires(){return[_0x5c26c3,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x4f13ad{_collapseAt;constructor(_0xeb8d74,_0x10aaaf=0x6){super(_0xeb8d74);const _0x4c0ef5=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x10aaaf,this['bind']('isHidden')['to'](this,'usersCount',_0x421a84=>_0x421a84<_0x10aaaf),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x4c0ef5['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':_0x4c0ef5['to']('usersCount',_0x59490a=>'+'+(_0x59490a-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x4f13ad{items;keystrokes;constructor(_0xded95){super(_0xded95);const _0x4e4d0d=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x348589(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x4e4d0d['if']('hasPopup'),'aria-expanded':_0x4e4d0d['to']('isExpanded',_0x365bda=>this['hasPopup']&&String(_0x365bda)),'aria-label':_0x4e4d0d['to']('hasPopup',_0x31d569=>X(_0xded95,_0x31d569?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x4e4d0d['to']('hasPopup',_0x2d7e42=>!!_0x2d7e42&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x4e4d0d['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x4e4d0d['to'](_0x120d7a=>{const _0x5434ab=_0x120d7a,_0x1d72e2=document['querySelector']('.ck-presence-list__dropdown-list'),_0x1b8a94=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1d72e2?.['contains'](_0x5434ab['relatedTarget'])||_0x1b8a94?.['contains'](_0x5434ab['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x2d8b08,_0x4d09d1,_0xb98b86)=>{this['element']&&(_0xb98b86?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},_t=class extends _0x4f13ad{counterView;inlineListView;constructor(_0x122223,_0x38ae22=0x6){super(_0x122223);const _0x462ba6=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x38ae22),this['inlineListView']=new vt(_0x122223),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x563c83 of this['inlineListView']['items'])_0x563c83['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',_0x462ba6['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x4f13ad{listWrapperView;constructor(_0x4e98b5,_0x42bc22){super(_0x4e98b5);const _0x18396e=this['bindTemplate'];this['listWrapperView']=new bt(_0x4e98b5,_0x42bc22),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x4e98b5,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x18396e['to'](_0x2012e2=>{const _0x19d445=_0x2012e2,_0x3d874a=document['querySelector']('.ck-presence-list__list'),_0x11b1dd=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3d874a?.['contains'](_0x19d445['relatedTarget'])||_0x11b1dd?.['contains'](_0x19d445['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x1a0a9b{constructor(_0x295318,_0xc9648d){super(_0x295318);const _0x2bfc0c=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0xc9648d?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2bfc0c['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2bfc0c['to']('role'),'aria-label':_0x2bfc0c['to']('ariaLabel'),'aria-labelledby':_0x2bfc0c['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x56e72d['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x2a0ffb=this['element'];_0x2a0ffb&&(this['_isScrollable']=Math['max'](_0x2a0ffb['scrollHeight'],_0x2a0ffb['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x5d3968{['userView'];constructor(_0x262aaa,_0x46cb52,_0x53a70b){super(_0x262aaa);const _0x2abc47=this['bindTemplate'];this['userView']=new _0x494d84(_0x262aaa,_0x46cb52);const _0x540c3e={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x46cb52['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x46cb52['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x46cb52['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x46cb52['color']['getColorVariable'](),'--ck-user-color-alpha':_0x46cb52['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x53a70b&&(_0x540c3e['tag']='button',_0x540c3e['on']={'click':_0x2abc47['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x540c3e);}['focus'](){this['element']['focus']();}},It=class extends _0x4f13ad{['userView'];['markerView'];constructor(_0x1eee6a,_0x593e6a,_0x2e8667){super(_0x1eee6a);const _0x29701b=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x494d84(_0x1eee6a,_0x593e6a),this['markerView']=new St(_0x1eee6a,_0x593e6a);const _0x134bf7=new _0x286fa8(_0x1eee6a);_0x134bf7['template']['tag']='span',_0x134bf7['text']=_0x593e6a['name'];const _0x40413f={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x29701b['to']('isFocusable',_0x5b4a08=>!!_0x5b4a08&&0x0),'aria-labelledby':_0x134bf7['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x29701b['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x29701b['to']('hasTooltip',_0x459e7e=>!_0x459e7e),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x134bf7]};_0x2e8667&&(_0x40413f['tag']='button',_0x40413f['on']={'click':_0x29701b['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x40413f);}},St=class extends _0x4f13ad{constructor(_0x24d6a7,_0x4abcab){super(_0x24d6a7),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4abcab['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x4abcab['color']['getColorVariable'](),'--ck-user-color-alpha':_0x4abcab['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x3db858{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xcdd337){super(_0xcdd337),this['context']['config']['define']('presenceList',Tt);const _0x26a106=_0xcdd337['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x26a106)throw new _0x1cd844('presencelist-collapseat-invalid-format',this);if(_0x26a106<0x1)throw new _0x1cd844('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x2188d9(),this['balloonPanelView']=new _0x4e07dc(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x570d74 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x570d74);this['listenTo'](this['_allConnectedUsers'],'add',(_0x7504e7,_0x381f7d)=>{this['_handleUserAdd'](_0x381f7d);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x53a74d,_0xa6f04d)=>{this['_handleUserRemove'](_0xa6f04d);});}_createView(){const _0xaa8e0=this['context'],_0x50bbca=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x4799d7=this['balloonPanelView'];if(!_0x20a13c(_0xaa8e0['config']['get']('presenceList.container')))throw new _0x1cd844('presencelist-missing-container',this);return _0x50bbca['counterView']['bind']('usersCount')['to'](this),_0x50bbca['bind']('isCollapsed')['to'](this,'usersCount',_0x5a0294=>{const {collapseAt:_0x389cbf}=_0xaa8e0['config']['get']('presenceList'),_0x42773d=_0x5a0294>=_0x389cbf;if(_0x42773d&&!_0x50bbca['inlineListView']['items']['find'](_0x53cc95=>_0x53cc95 instanceof wt)){const _0xae843b=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0xae843b&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x50bbca['inlineListView']['items']['add'](_0x50bbca['counterView']);}return _0x42773d||this['hideDropdown'](),_0x42773d;}),_0x50bbca['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x2092da=>{const _0x5c4258=_0xaa8e0['config']['get']('presenceList'),_0x1678f8=new It(_0xaa8e0['locale'],_0x2092da,!!_0x5c4258['onClick']);return _0x1678f8['bind']('hasTooltip')['to'](_0x50bbca,'isCollapsed',_0x5ab8fd=>!_0x5ab8fd),_0x1678f8['bind']('isFocusable')['to'](_0x50bbca,'isCollapsed',_0x32bde9=>!_0x32bde9),_0x5c4258['onClick']&&this['listenTo'](_0x1678f8,'execute',()=>{this['view']['isCollapsed']||_0x5c4258['onClick'](_0x2092da,_0x1678f8['element']);}),_0x1678f8;}),this['listenTo'](_0x50bbca['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x50bbca['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x50bbca['inlineListView']['keystrokes']['set']('Enter',(_0x47713b,_0x4513)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x4513());}),_0x50bbca['render'](),_0x4799d7['render'](),_0x3c456b({'emitter':_0x50bbca,'activator':()=>_0x4799d7['isVisible'],'contextElements':[_0x4799d7['element'],_0x50bbca['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0xaa8e0['config']['get']('presenceList.container')['appendChild'](_0x50bbca['element']),this['_bodyCollection']=new _0xb9107e(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x50bbca;}['_handleUserAdd'](_0x1af15f){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x1af15f['isMe'])return;const _0x3c2c2a=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x3c2c2a-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x1dbd3d=_0x1af15f['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x1af15f,_0x1dbd3d);}['_handleUserRemove'](_0x1ba05b){this['usersCount']--;const {collapseAt:_0x2bd17b}=this['context']['config']['get']('presenceList'),_0x4606c4=this['usersCount']>=_0x2bd17b;if(this['currentDisplayedUsers']['get'](_0x1ba05b['id']))this['currentDisplayedUsers']['remove'](_0x1ba05b['id']);else{if(_0x4606c4&&this['currentDisplayedUsers']['length']+0x1===_0x2bd17b-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x4606c4?0x1:0x0)<this['usersCount']){for(const _0x2325f8 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x2325f8['id'])&&(this['currentDisplayedUsers']['add'](_0x2325f8,Math['min'](this['currentDisplayedUsers']['length']-(_0x4606c4?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x4606c4?0x1:0x0)===_0x2bd17b-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1bd86d=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x1bd86d['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x3d0d95}=this['presenceDropdownView'];_0x3d0d95['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x56aec3=>{if(!_0x1bd86d['displayMe']&&_0x56aec3['isMe'])return null;const _0x4d34b1=new kt(this['context']['locale'],_0x56aec3,!!_0x1bd86d['onClick']);return _0x1bd86d['onClick']&&this['listenTo'](_0x4d34b1,'execute',()=>{_0x1bd86d['onClick'](_0x56aec3,_0x4d34b1['element']);}),_0x4d34b1;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x3d0d95['focus'](),_0x3d0d95['checkIfScrollable']();const _0x37fefe=(_0x2592bb,_0x1def3c)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x1def3c();};_0x3d0d95['keystrokes']['set']('Esc',_0x37fefe),_0x3d0d95['keystrokes']['set']('Shift+Tab',_0x37fefe),_0x3d0d95['keystrokes']['set']('Tab',(_0x330753,_0x1077ef)=>{!function(_0x3c670a){const _0x32bd96=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x56bf72=>_0x56bf72+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x22aadc=[...document['body']['querySelectorAll'](_0x32bd96)]['filter'](_0x11896f=>_0x11896f===document['activeElement']||_0x11896f['offsetWidth']+_0x11896f['offsetHeight']>0x0)['sort']((_0x32d965,_0xcd16a0)=>(_0x32d965['tabIndex']||0x0)-(_0xcd16a0['tabIndex']||0x0)),_0x3f6c99=_0x22aadc[(_0x22aadc['indexOf'](_0x3c670a)+0x1)%_0x22aadc['length']];_0x3f6c99&&_0x3f6c99['focus']();}(this['view']['element']),this['hideDropdown'](),_0x1077ef();}),_0x3d0d95['focusTracker']['add'](this['view']['element']),_0x3d0d95['focusTracker']['on']('change:isFocused',(_0x1beeba,_0x31739f,_0x4cddfe)=>{_0x4cddfe||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}},At=class extends _0x3db858{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};
23
+ import{Context as _0x2d68c5,ContextPlugin as _0xc4d6aa,PendingActions as _0x36d6a1,Plugin as _0x36abf4}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x2e8d1b,Collection as _0xed46ed,DomEmitterMixin as _0x2f59e2,KeystrokeHandler as _0x2a8a0f,global as _0x81b33,uid as _0x3e36f4,version as _0x40ea60}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x532b6f,BodyCollection as _0x367670,LabelView as _0xd0dd83,ListItemView as _0x5d7bc4,ListView as _0x584c4e,Notification as _0x35fa26,View as _0x56b2c8,clickOutsideHandler as _0x53dee}from'@ckeditor/ckeditor5-ui';import{History as _0x2acc88,InsertOperation as _0xa72021,MarkerOperation as _0x53a5d6,ModelLiveRange as _0x57f87f,NoOperation as _0x469700,OperationFactory as _0x50c70e,RootAttributeOperation as _0x1d12c1,transformOperationSets as _0x1ef915}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x404a83}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x2dbe7d,CommentsService as _0x5e88d2,EditorService as _0x2742b2,RevisionHistoryService as _0x361b61,TrackChangesService as _0x43b8a5,User as _0xad2f00,WEB_SOCKET_GATEWAY_STATES as _0x398bd1,WebSocketGateway as _0x412666}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x3b6bb4,Users as _0x4a1da9}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x157e03}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x112efb,TrackChangesEditing as _0x59abfe}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x4663d3,CommentsEditing as _0x116785,CommentsRepository as _0x6bab61}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x230608}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x359a2e}from'es-toolkit/compat';var z=class WebSocketGateway extends _0xc4d6aa{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
+ ((()=>_0x412666)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x404a83,_0x35fa26];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x34e1d0){super(_0x34e1d0),this['set']('state',_0x398bd1['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x2f59e2())();}init(){const _0x2f2535=this['context'],_0xafa8a=_0x2f2535['plugins']['get'](_0x404a83),_0x575c3e=_0x2f2535['plugins']['get'](_0x35fa26);if(!_0xafa8a['token'])throw new _0x2e8d1b('websocketgateway-missing-token',this);if(!_0xafa8a['webSocketUrl'])throw new _0x2e8d1b('websocketgateway-missing-websocket-url',this);return this['_domEmitter']['listenTo'](window,'offline',()=>this['_isBrowserOffline']=!0x0),this['_domEmitter']['listenTo'](window,'online',()=>this['_isBrowserOffline']=!0x1),this['context']['config']['define']('cloudServices.connectionTimeout',0xa),this['context']['config']['define']('cloudServices.requestTimeout',0x14),WebSocketGateway['WebSocketGateway']['connect'](_0xafa8a['token'],_0xafa8a['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x2b38dd=>{if(this['connection']=_0x2b38dd,this['bind']('state')['to'](_0x2b38dd,'state',this,'_isBrowserOffline',(_0x549b8e,_0x25827f)=>('connected'!==_0x549b8e&&(this['_shouldPluginsReconnect']=!0x0),_0x25827f||_0x549b8e!==_0x398bd1['CONNECTED']?_0x398bd1['DISCONNECTED']:this['state']==_0x398bd1['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x398bd1['CONNECTING']):_0x398bd1['CONNECTED'])),this['connection']['on']('error',(_0x35d2f1,_0x145762)=>{if('limitExceeded'!==_0x145762['code'])throw console['error'](_0x145762),new _0x2e8d1b('cloudservices-init',null,{'originalError':_0x145762});_0x575c3e['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'});}),!_0x2b38dd['me'])return new Promise(_0x2a4655=>_0x2b38dd['on']('change:me',_0x2a4655));})['catch'](_0x2d8256=>{throw console['error'](_0x2d8256),new _0x2e8d1b('cloudservices-init',null,{'originalError':_0x2d8256});});}addToReconnectionStack(_0x166b4a){if('function'!=typeof _0x166b4a['reconnect'])throw new _0x2e8d1b('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x166b4a))throw new _0x2e8d1b('websocketgateway-plugin-already-registered',this,{'name':_0x166b4a['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x166b4a);}removeFromReconnectionStack(_0x3640cb){this['_reconnectionStack']['delete'](_0x3640cb);}isInReconnectionStack(_0xf06e53){return this['_reconnectionStack']['has'](_0xf06e53);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x47aac8=>_0x47aac8['reconnect']())))['then'](()=>this['state']=_0x398bd1['CONNECTED'])['catch'](_0x39e876=>{throw console['error'](_0x39e876),new _0x2e8d1b('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x398bd1['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0xc4d6aa{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[z,_0x4a1da9];}constructor(_0x3f4c33){super(_0x3f4c33),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0xed46ed(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x4a1da9);}init(){const _0x4bea1b=this['context']['plugins']['get'](z);this['listenTo'](_0x4bea1b,'change:state',(_0x332388,_0x431240,_0x203b11)=>{if('connected'!==_0x203b11)this['channelSessions']['forEach'](_0x5e3d6e=>_0x5e3d6e['clear']()),this['channelConnectedUsers']['forEach'](_0xcc4193=>_0xcc4193['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x19f464,_0x2b351]of this['_registeredSessions'])for(const _0x3b7661 of _0x2b351)this['_handleSessionAdd'](_0x19f464,_0x3b7661);}}),this['_createUser'](_0x4bea1b['connection']['me'],!0x0);}register(_0x3a5de4,_0x67c5f){if(this['_registeredSessions']['has'](_0x3a5de4))throw new _0x2e8d1b('sessions-register-already-registered',null,{'channelId':_0x3a5de4});this['_registeredSessions']['set'](_0x3a5de4,_0x67c5f),this['channelSessions']['set'](_0x3a5de4,new _0xed46ed()),this['channelConnectedUsers']['set'](_0x3a5de4,new _0xed46ed()),this['listenTo'](_0x67c5f,'add',(_0x2dd282,_0x3a3945)=>this['_handleSessionAdd'](_0x3a5de4,_0x3a3945)),this['listenTo'](_0x67c5f,'remove',(_0x282fe9,_0x5a610c)=>this['_handleSessionRemove'](_0x3a5de4,_0x5a610c));for(const _0x3d1a27 of _0x67c5f)this['_handleSessionAdd'](_0x3a5de4,_0x3d1a27);}unregister(_0xaf2f2b){if(!this['_registeredSessions']['has'](_0xaf2f2b))throw new _0x2e8d1b('sessions-unregister-not-exist',null,{'channelId':_0xaf2f2b});const _0x4a7209=this['_registeredSessions']['get'](_0xaf2f2b);this['stopListening'](_0x4a7209);for(const _0x438f62 of _0x4a7209)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0xaf2f2b,_0x438f62);this['_registeredSessions']['delete'](_0xaf2f2b),this['channelSessions']['delete'](_0xaf2f2b),this['channelConnectedUsers']['delete'](_0xaf2f2b);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x6b8184){for(const _0x40ee05 of this['channelSessions']['values']())for(const _0x4fa396 of _0x40ee05)if(_0x4fa396['id']===_0x6b8184)return _0x4fa396['user'];}getUserSessions(_0x36fe35,_0x41bb1d){const _0x3def36=_0x41bb1d?[this['channelSessions']['get'](_0x41bb1d)]:this['channelSessions']['values'](),_0x4d3135=new Set();for(const _0x5765e4 of _0x3def36)for(const _0x7b1286 of _0x5765e4)_0x7b1286['user']['id']===_0x36fe35['id']&&_0x4d3135['add'](_0x7b1286['id']);return _0x4d3135;}getUserRole(_0x2e0e3a){for(const _0x1b055b of this['channelSessions']['values']())for(const _0x15ba99 of _0x1b055b)if(_0x15ba99['user']===_0x2e0e3a)return _0x15ba99['role'];}['_handleSessionAdd'](_0x105079,_0x5ef549){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0xc3a595=_0x5ef549['user'],_0x22f0c0=this['_users']['getUser'](_0xc3a595['id'])||this['_createUser'](_0xc3a595),_0x4d8861=Object['assign']({},_0x5ef549,{'user':_0x22f0c0});if(this['channelSessions']['get'](_0x105079)['add'](_0x4d8861),!_0xc3a595['hiddenInPresenceList']){const _0x43ac0f=this['channelConnectedUsers']['get'](_0x105079);_0x43ac0f['has'](_0x22f0c0['id'])||_0x43ac0f['add'](_0x22f0c0),this['allConnectedUsers']['has'](_0x22f0c0['id'])||_0xc3a595['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x22f0c0,_0x22f0c0['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x105079,{'channelId':_0x105079,'session':_0x4d8861});}['_handleSessionRemove'](_0x300854,_0x29b1d6){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x7d9bd5=this['channelConnectedUsers']['get'](_0x300854),_0x4c9985=_0x29b1d6['user'];_0x4c9985['id']&&(this['channelSessions']['get'](_0x300854)['remove'](_0x29b1d6['id']),_0x7d9bd5['has'](_0x4c9985['id'])&&!this['getUserSessions'](_0x4c9985,_0x300854)['size']&&_0x7d9bd5['remove'](_0x4c9985['id']),this['allConnectedUsers']['get'](_0x4c9985['id'])&&!this['getUserSessions'](_0x4c9985)['size']&&this['allConnectedUsers']['remove'](_0x4c9985['id']));}_createUser(_0x3ad9a6,_0x570841){const _0xa7de5a=this['_users']['addUser'](_0x3ad9a6);return _0x570841&&this['_users']['defineMe'](_0x3ad9a6['id']),_0xa7de5a['orderNumber']=this['_uniqueUsersCount']++,_0xa7de5a;}},K=class extends _0x36abf4{_domEmitter=new(_0x2f59e2())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x1123dd=this['editor'],_0x5b3069=_0x1123dd['plugins']['get'](Y);_0x1123dd['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x38e18a,{writer:_0x47f268})=>function(_0x4c9792,_0x36e3ea,_0x13b180,_0x4b4358){const _0x16aae6=_0x4c9792['markerName']['split'](':')[0x2],_0x4a326c=_0x13b180['getUserBySessionId'](_0x16aae6);if(!_0x4a326c||_0x16aae6===_0x13b180['mySessionId'])return;if(!_0x4b4358['model']['schema']['checkChild'](_0x4c9792['markerRange']['start'],'$text'))return;const _0x5bb08f={'class':'ck-user__marker\x20'+_0x4a326c['color']['getMarkerClass'](),'style':Q(_0x4a326c),'data-name':_0x4a326c['name'],'data-session-id':_0x16aae6},_0x4d5517=_0x4b4358['model']['markers']['get'](_0x4c9792['markerName'])['getStart'](),_0x484202=_0x4d5517['nodeAfter'],_0x142f71=_0x4b4358['model']['schema'];if(_0x484202&&_0x142f71['isObject'](_0x484202)&&_0x142f71['isInline'](_0x484202)&&!_0x4b4358['model']['markers']['get']('user:range:'+_0x16aae6)['getRange']()['isCollapsed'])return;const _0x1961df=_0x4d5517['parent'];return _0x4b4358['model']['schema']['isLimit'](_0x1961df)&&!_0x4b4358['model']['hasContent'](_0x1961df)&&(_0x5bb08f['contenteditable']=!0x1),function(_0x4c985a,_0x5b1926,_0x4343ec){const _0x4a9321=_0x4c985a['createUIElement']('span',_0x5b1926);return _0x4c985a['setCustomProperty']('userPositionMarker',!0x0,_0x4a9321),_0x4a9321['render']=function(_0x495b99){const _0x101a79=this['toDomElement'](_0x495b99),_0x10cd36=document['createElement']('span');return _0x10cd36['classList']['add']('ck-user__marker-tooltip'),_0x10cd36['setAttribute']('contenteditable','false'),_0x10cd36['setAttribute']('spellcheck','false'),_0x10cd36['textContent']=_0x4343ec['name'],_0x101a79['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x10cd36['outerHTML']+'⁠',_0x101a79['addEventListener']('mouseenter',()=>{_0x101a79['classList']['add']('ck-user__marker_hovered');}),_0x101a79['addEventListener']('mouseleave',()=>{_0x101a79['classList']['remove']('ck-user__marker_hovered');}),_0x101a79;},_0x4a9321['isSimilar']=function(_0x9dd706){return!(!this['getCustomProperty']('userPositionMarker')||!_0x9dd706['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x9dd706['getAttribute']('data-session-id'));},_0x4a9321;}(_0x36e3ea,_0x5bb08f,_0x4a326c);}(_0x38e18a,_0x47f268,_0x5b3069,_0x1123dd)}),_0x1123dd['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x56842f=>function(_0x3b639a,_0x2ca63b){const _0x113d27=_0x3b639a['markerName']['split'](':')[0x2];if(_0x113d27===_0x2ca63b['mySessionId'])return null;const _0x15394a=_0x2ca63b['getUserBySessionId'](_0x113d27);return _0x15394a?{'id':_0x113d27,'classes':['ck-user__selection',_0x15394a['color']['getSelectionClass']()],'attributes':{'style':Q(_0x15394a),'data-session-id':_0x113d27},'priority':0x7d0+_0x15394a['orderNumber']}:{'id':_0x113d27,'classes':[]};}(_0x56842f,_0x5b3069)}),function(_0x1fbc9c){const _0x1424b4=_0x1fbc9c['model'],_0x375cfb=new Map(),_0x1ff3e1=_0x1fbc9c['plugins']['get'](Y);_0x1424b4['markers']['on']('update:user:range',(_0x20848b,_0xbfc53d,_0x325882,_0x35fc42)=>{if(!_0x35fc42&&_0x375cfb['get'](_0xbfc53d['name']))return _0x375cfb['get'](_0xbfc53d['name'])['detach'](),void _0x375cfb['delete'](_0xbfc53d['name']);const _0x499fe4=_0xbfc53d['name']['split'](':')[0x2];if(_0x499fe4===_0x1ff3e1['mySessionId'])return;const _0x27e709='user:position:'+_0x499fe4;_0x1424b4['markers']['has'](_0x27e709)&&_0x1fbc9c['editing']['reconvertMarker'](_0x27e709),_0xbfc53d['on']('change:range',(_0xd913ae,_0x2f0ef9,_0x260dba)=>{if('$graveyard'!=_0x2f0ef9['root']['rootName']&&'$graveyard'==_0xbfc53d['getRange']()['root']['rootName']&&!_0x375cfb['has'](_0xbfc53d['name'])){const _0x260af2=_0x1424b4['schema']['getNearestSelectionRange'](_0x260dba['deletionPosition']);if(_0x260af2){const _0x29bfe5=_0x57f87f['fromRange'](_0x260af2);_0x375cfb['set'](_0xbfc53d['name'],_0x29bfe5),_0x29bfe5['on']('change:range',(_0x2b71db,_0x311c92,_0x130b7a)=>{if('$graveyard'==_0x29bfe5['root']['rootName']){const _0x1bdd92=_0x1424b4['schema']['getNearestSelectionRange'](_0x130b7a['deletionPosition']);_0x1bdd92?(_0x29bfe5['start']=_0x1bdd92['start'],_0x29bfe5['end']=_0x1bdd92['end']):(_0x375cfb['delete'](_0xbfc53d['name']),_0x29bfe5['detach']());}});}}});}),_0x1424b4['document']['on']('change',()=>{_0x375cfb['size']>0x0&&_0x1424b4['enqueueChange']({'isUndoable':!0x1},_0x1025d1=>{for(const [_0x2090e2,_0xafbe52]of _0x375cfb)'$graveyard'==_0x1424b4['markers']['get'](_0x2090e2)['getRange']()['root']['rootName']&&(J(_0x2090e2['split'](':')[0x2],_0xafbe52['toRange'](),_0x1424b4,_0x1025d1),_0xafbe52['detach']());_0x375cfb['clear']();});});}(_0x1123dd),this['_domEmitter']['listenTo'](_0x81b33['document'],'keydown',(_0x247dd6,{key:_0x4217c3})=>{'Escape'===_0x4217c3&&function(_0x1157a5){_0x1157a5['editing']['view']['change'](_0x9092c0=>{for(const _0x167227 of _0x1157a5['model']['markers']){if(!_0x167227['name']['startsWith']('user:position'))continue;const _0x3e4779=_0x1157a5['editing']['mapper']['markerNameToElements'](_0x167227['name']);if(_0x3e4779){for(const _0x1c87d4 of _0x3e4779)_0x9092c0['removeClass']('ck-user__marker_hovered',_0x1c87d4);}}});}(_0x1123dd);},{'useCapture':!0x0});}afterInit(){const _0x492e4f=this['editor'],_0x2e64bf=_0x492e4f['commands']['get']('undo');_0x2e64bf&&_0x492e4f['model']['on']('applyOperation',(_0x5ba115,_0x10ea1a)=>{const _0x3edc93=_0x10ea1a[0x0];if(!_0x3edc93['isDocumentOperation'])return;if('marker'!=_0x3edc93['type']||!_0x3edc93['name']['startsWith']('user:'))return;const _0x2330a4=_0x3edc93['batch'];_0x2e64bf['_createdBatches']['has'](_0x2330a4)&&(_0x3edc93['newRange']=_0x3edc93['oldRange']?_0x492e4f['model']['createRange'](_0x3edc93['oldRange']['start'],_0x3edc93['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x5c784e=this['editor'],_0xe6714e=_0x5c784e['model']['document'],_0x282ed9=_0x5c784e['plugins']['get'](Y);_0x5c784e['model']['enqueueChange']({'isUndoable':!0x1},_0x5348f6=>{const _0x448064='user:range:'+_0x282ed9['mySessionId'],_0x11490d='user:position:'+_0x282ed9['mySessionId'],_0x141a24=_0x5c784e['model']['markers']['has'](_0x448064);_0x5c784e['editing']['view']['hasDomSelection']?J(_0x282ed9['mySessionId'],_0xe6714e['selection']['getFirstRange'](),_0x5c784e['model'],_0x5348f6):_0x141a24&&(_0x5348f6['removeMarker'](_0x448064),_0x5348f6['removeMarker'](_0x11490d));});}};function J(_0x4f6086,_0x4e634a,_0x5e252a,_0x502262){const _0x444572='user:range:'+_0x4f6086,_0x140bd5='user:position:'+_0x4f6086,_0x3832e8=_0x4e634a['getContainedElement']();let _0x48f23d=_0x4e634a['start'];if(_0x3832e8&&_0x3832e8['is']('element','tableCell')){const _0x29b1b9=function(_0x2d1639,_0x1dc312){for(const _0x3b2e4e of _0x2d1639['getPositions']())if(_0x1dc312['schema']['checkChild'](_0x3b2e4e,'$text'))return _0x3b2e4e;}(_0x4e634a,_0x5e252a);_0x29b1b9&&(_0x48f23d=_0x29b1b9,_0x4e634a=_0x502262['createRange'](_0x48f23d));}const _0x565d27=_0x502262['createRange'](_0x48f23d);_0x5e252a['markers']['has'](_0x444572)?(_0x502262['updateMarker'](_0x444572,{'range':_0x4e634a}),_0x502262['updateMarker'](_0x140bd5,{'range':_0x565d27})):(_0x502262['addMarker'](_0x444572,{'range':_0x4e634a,'usingOperation':!0x0}),_0x502262['addMarker'](_0x140bd5,{'range':_0x565d27,'usingOperation':!0x0}));}function Q(_0x5aeeac){return'--ck-user-color:'+_0x5aeeac['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x5aeeac['color']['getColorAlphaVariable']()+';';}function X(_0x20d245,_0x4d4773,_0x251dd3){const _0x2aec13=_0x20d245['t'],t=_0x20d245['t'];switch(_0x4d4773){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 _0x2aec13({'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'},_0x251dd3);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x36abf4{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x2dbe7d)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x36d6a1,_0x4a1da9,_0x35fa26];}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 _0x1e71aa=this['serverHistory']['getOperations']();for(let _0x59ab52=_0x1e71aa['length']-0x1;_0x59ab52>=0x0;_0x59ab52--){const _0x161605=_0x1e71aa[_0x59ab52];if(!this['_disconnectionOperations']['has'](_0x161605))return _0x161605['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x13668f){if(super(_0x13668f),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x2acc88(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x2e8d1b('collaboration-missing-channelid',this);const _0x20750c=_0x13668f['config']['get']('cloudServices.bundleVersion')||_0x40ea60;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x20750c,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x157e03(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new it(this['_disconnectionOperations']);}init(){const _0x265787=this['editor'],_0x12ef7c=_0x265787['plugins']['get'](_0x4a1da9),_0x2966a2=_0x265787['plugins']['get'](z);this['listenTo'](_0x12ef7c,'getOperationAuthor',(_0x51fe8a,_0x3d989f)=>{const _0x45f2b5=_0x3d989f[0x0];_0x45f2b5['_authorId']&&(_0x51fe8a['return']=_0x12ef7c['getUser'](_0x45f2b5['_authorId']),_0x51fe8a['stop']()),null===_0x45f2b5['_authorId']&&(_0x51fe8a['return']=null,_0x51fe8a['stop']());},{'priority':'high'}),this['listenTo'](_0x265787['model']['document']['selection'],'change:range',(_0x3ea474,_0x1a18f)=>{_0x1a18f['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x265787['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x265787['model']['on']('applyOperation',(_0x15f32a,_0x60e13e)=>{const _0x5277ee=_0x60e13e[0x0];_0x5277ee['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x5277ee),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x2966a2,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x3f019b,_0x17b1db,_0x5ead16)=>'connected'===_0x3f019b&&!_0x17b1db&&!_0x5ead16),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x265787['disableReadOnlyMode']('rtc-offline'):_0x265787['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x265787['disableReadOnlyMode']('rtc-offline'):_0x265787['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x1bef33=this['editor']['plugins']['get'](Y),_0x3a9b11=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x1bef33['unregister'](this['_channelId']);const _0x45b1b5=await this['_service']['reconnect'](_0x3a9b11['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x45b1b5)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x552e92=await this['_service']['getConnectedSessions']();_0x1bef33['register'](this['_channelId'],_0x552e92),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x10bf23){if(function(_0x5f25da){return'404'===_0x5f25da['code'];}(_0x10bf23)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x442043){return'409'===_0x442043['code'];}(_0x10bf23)){const _0x4f53b5=X(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x4f53b5);}else{if(!(_0x10bf23 instanceof et))throw _0x10bf23;this['_handleReconnectionError']();}}}}destroy(){const _0x331c35=this['editor']['plugins']['get'](z),_0x2a2df6=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x2a2df6['channelSessions']['has'](this['_channelId'])&&_0x2a2df6['unregister'](this['_channelId']),_0x331c35['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x3ef749){if(this['sessionId']!==_0x3ef749['sessionId']&&this['_lastSyncedOperationId']!==_0x3ef749['lastOperationId'])throw new et();return this['sessionId']=_0x3ef749['sessionId'],this['_handleServerResponse']([],{..._0x3ef749,'wereChangesApplied':!0x1,'data':_0x3ef749['data']},'reconnect');}async _connectService(_0x469b77,_0x44c422=!0x1){const {connection:_0x161f04}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x161f04,this['_channelId'])['then'](_0x5cb598=>this['_initSessionsHandling'](_0x5cb598))['catch'](_0x5aafc8=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x5aafc8);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x54d2f8,_0x48940a)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x48940a);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x40a13d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x469b77);this['_isPendingUpdate']=!0x0;const _0x394ec6=await this['_service']['connect'](_0x161f04,this['_compressOperations'](_0x469b77),_0x40a13d);if(this['sessionId']=_0x394ec6['sessionId'],_0x44c422){if(!_0x394ec6['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x394ec6['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x469b77,_0x394ec6,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x394ec6,_0x469b77);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x2491db=this['editor']['plugins']['get'](Y),_0x331f8b=this['editor']['plugins']['get'](K),_0x325c29=_0x2491db['channelSessions']['get'](this['_channelId']);_0x325c29&&_0x325c29['length']>0x1?_0x331f8b['createUserMarkerOperations']():this['listenTo'](_0x2491db,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x2491db['channelSessions']['get'](this['_channelId'])['length']&&_0x331f8b['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x3f5c7b,_0x1dcb10,_0x209898,_0x432de2){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1dcb10){const _0x5171f1=this['_decompressOperations'](_0x209898,_0x432de2);await this['_fetchMissingUsers'](_0x5171f1),this['_handleExternalOperations'](_0x5171f1,_0x1dcb10,_0x209898['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x2a64be}=this['editor'];let _0x4379b2;try{_0x4379b2=await this['_service']['getDocumentDetails']();}catch{const _0x5b86dc=X(_0x2a64be,'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'](_0x5b86dc);}const _0x1679d8=_0x4379b2['currentDocumentSession']||_0x4379b2['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x1679d8['lastOperationId']){const _0x56ab99=X(_0x2a64be,'The\x20last\x20saved\x20version\x20of\x20the\x20document\x20does\x20not\x20match\x20the\x20local\x20version.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');return void this['_handleReconnectionError'](_0x56ab99);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x1086f4=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x1086f4['connection']||'connected'!==_0x1086f4['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x281457=this['editor']['plugins']['get'](Y);_0x281457['channelSessions']['has'](this['_channelId'])&&_0x281457['unregister'](this['_channelId']),_0x1086f4['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x57f1df){const _0x1be2ef=this['editor']['plugins']['get'](Y);this['listenTo'](_0x1be2ef,'sessionAdd:'+this['_channelId'],(_0x1de840,{session:_0x3b247b})=>{if(_0x3b247b['id']===_0x1be2ef['mySessionId']){_0x1de840['off']();const _0x46eeb9=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x549ed2=_0x3b247b['permissions'];_0x46eeb9&&_0x46eeb9['isEnabled']&&(_0x549ed2=_0x549ed2['filter'](_0x4f297c=>'document:write'!==_0x4f297c)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x549ed2,this['_channelId']);}}),_0x1be2ef['register'](this['_channelId'],_0x57f1df);}_initThrowingOnDataSet(){const _0x5c2e35=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x101756)=>{if(!_0x101756[_0x101756['length']-0x1]['suppressErrorInCollaboration'])throw new _0x2e8d1b('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x5c2e35['apply'](this['editor']['data'],_0x101756);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x172bdd,[_0x10ae96])=>{if(this['_document']['version'])throw new _0x2e8d1b('realtimecollaborationclient-init-document-already-initialized',this);_0x172bdd['stop'](),this['_setPendingAction']();const _0x5a882c=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x59ae8c])=>!_0x59ae8c['lazyLoad'])['map'](([_0x3fd39f,_0x45371f])=>[_0x3fd39f,_0x45371f['modelAttributes']||{}])),_0x4f5f27=this['_getOperationsFromInitData'](_0x10ae96,_0x5a882c);0x0==_0x4f5f27['length']&&_0x4f5f27['push'](new _0x469700(0x0)),_0x172bdd['return']=this['_connectService'](_0x4f5f27)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1346a6=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1346a6))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x58b402,[_0x1e65a4,_0x37f789])=>{_0x58b402['stop']();const _0x130d19=this['editor']['model']['document']['getRoot'](_0x1e65a4);if(!this['_knownRootNames']['has'](_0x1e65a4)){const _0x2cb128=_0x37f789&&_0x37f789['data']?_0x37f789['data']:'',_0x47d76c=_0x37f789&&_0x37f789['attributes']?_0x37f789['attributes']:{};await this['_loadRoot'](_0x1e65a4,_0x2cb128,_0x47d76c);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x130d19['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x130d19);});},{'priority':'high'});}async _fetchMissingUsers(_0x53fdad){const _0x3c13b7=this['editor']['plugins']['get'](_0x4a1da9),{connection:_0x56f991}=this['editor']['plugins']['get'](z),_0x51b1be=new Set();for(const _0x4470fa of _0x53fdad){const _0x36e5e2=_0x4470fa['_authorId'];_0x36e5e2&&!_0x3c13b7['getUser'](_0x36e5e2)&&_0x51b1be['add'](_0x36e5e2);}if(0x0===_0x51b1be['size'])return;const _0x231661=await _0xad2f00['getMany'](_0x56f991,Array['from'](_0x51b1be));for(const _0x45deb1 of _0x231661)_0x3c13b7['getUser'](_0x45deb1['id'])||_0x3c13b7['addUser'](_0x45deb1);}_getOperationsFromInitData(_0x534916,_0x31022f={}){const _0x2cb4fd=this['editor']['model'],_0x347c61=[];let _0x4c2ca4=0x0;const _0x39b61d='string'==typeof _0x534916?{'main':_0x534916}:_0x534916;for(const _0x1f98cd of Object['keys'](_0x39b61d)){if(!this['_document']['roots']['has'](_0x1f98cd))throw new _0x2e8d1b('realtimecollaborationclient-init-non-existent-root',this);const _0x320e6a=this['_document']['getRoot'](_0x1f98cd),_0x3878dc=this['editor']['data']['parse'](_0x39b61d[_0x1f98cd],_0x320e6a),_0x1a999c=new _0xa72021(_0x2cb4fd['createPositionAt'](_0x320e6a,0x0),_0x3878dc,_0x4c2ca4++);_0x347c61['push'](_0x1a999c);for(const [_0x5975c9,_0x3c1527]of _0x3878dc['markers']){const _0x5a8b9a=_0x2cb4fd['createRange'](_0x2cb4fd['createPositionFromPath'](_0x320e6a,_0x3c1527['start']['path']['slice']()),_0x2cb4fd['createPositionFromPath'](_0x320e6a,_0x3c1527['end']['path']['slice']())),_0x57796f=new _0x53a5d6(_0x5975c9,null,_0x5a8b9a,_0x2cb4fd['markers'],!0x0,_0x4c2ca4++);_0x347c61['push'](_0x57796f);}}if(_0x31022f)for(const [_0x6112d4,_0x1ca91f]of Object['entries'](_0x31022f)){const _0x11bbf0=_0x2cb4fd['document']['getRoot'](_0x6112d4);if(!_0x11bbf0)throw new _0x2e8d1b('multi-root-editor-root-attributes-no-root',null);for(const [_0x4a5062,_0x2aba88]of Object['entries'](_0x1ca91f))if(null!==_0x2aba88){const _0x5c4358=new _0x1d12c1(_0x11bbf0,_0x4a5062,null,_0x2aba88,_0x4c2ca4++);_0x347c61['push'](_0x5c4358);}}return _0x347c61;}async _loadRoot(_0x21399f,_0x4fc50e,_0x4af755){this['_getOperationsFromInitData']({[_0x21399f]:_0x4fc50e},{[_0x21399f]:_0x4af755})['forEach']((_0x37cb3a,_0x5e2c30)=>{_0x37cb3a['baseVersion']=this['_document']['version']+_0x5e2c30,_0x37cb3a['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x37cb3a);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x2f81d4,_0xdc3fbf){let _0x261f1f;this['_offset']=_0x2f81d4['offset'];const _0x560920=_0x2f81d4['wereChangesApplied']&&!_0x2f81d4['initData'],_0x5eac5a=_0x560920?0x0:_0x2f81d4['data']['baseVersion'];if(_0xdc3fbf['forEach'](_0x102e3c=>{_0x102e3c['_isInit']=!0x0,_0x102e3c['createdAt']=_0x2f81d4['sessionCreatedAt'],_0x102e3c['_authorId']=null;}),_0x560920)_0x261f1f=_0xdc3fbf,this['_applyOperationsSet'](_0x261f1f,_0x560920);else{if(_0x2f81d4['initData']){const _0x4f9951=this['_getOperationsFromInitData'](_0x2f81d4['initData']);this['_document']['history']['version']=-_0x4f9951['length'],_0x4f9951['forEach'](_0x4a9a9b=>{_0x4a9a9b['baseVersion']-=_0x4f9951['length'],_0x4a9a9b['createdAt']=_0x2f81d4['sessionCreatedAt'],_0x4a9a9b['_isInit']=!0x0,_0x4a9a9b['_authorId']=null;}),this['_applyOperationsSet'](_0x4f9951,!0x0),this['serverHistory']['version']=-_0x4f9951['length']+this['_offset'],this['_updateServerHistory'](_0x4f9951);}this['_document']['history']['version']=_0x5eac5a,_0x261f1f=this['_decompressOperations'](_0x2f81d4['data'],_0x2f81d4['metadata']),await this['_fetchMissingUsers'](_0x261f1f),this['_applyOperationsSet'](_0x261f1f,_0x560920);}_0x2f81d4['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x261f1f,_0x2f81d4['lastOperationId']),this['_lastSyncedOperationId']=_0x2f81d4['lastOperationId']),this['serverHistory']['version']=_0x5eac5a+this['_offset'],this['_updateServerHistory'](_0x261f1f),_0xdc3fbf['filter'](_0x2e1d07=>{const _0xd1b0e1=this['_getAffectedRoot'](_0x2e1d07);return _0xd1b0e1&&!this['_knownRootNames']['has'](_0xd1b0e1);})['forEach']((_0x38e525,_0x22bb3b)=>{_0x38e525['baseVersion']=this['_document']['version']+_0x22bb3b,this['_saveOperationInBuffer'](_0x38e525);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x96e08d,_0x111f57){const _0x1682f2=_0x111f57&&_0x111f57['message'];if(_0x1682f2&&_0x1682f2['startsWith']('realtimecollaborationclient'))throw _0x111f57;const _0x2b3e32=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x2b3e32['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x2e8d1b(_0x96e08d,this['editor'],_0x1682f2?{'originalError':_0x1682f2}:void 0x0);}_saveOperationInBuffer(_0x31ca54){this['_knownOperations']['has'](_0x31ca54)||(this['_knownOperations']['add'](_0x31ca54),this['_bufferedOperations']['push'](_0x31ca54),this['_pendingAction']||'marker'==_0x31ca54['type']&&!_0x31ca54['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x30b02b=!0x1){!_0x30b02b&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x4aa4bb=>{_0x4aa4bb&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x56911c=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x2f9097){return _0x2f9097['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2f9097['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x2f9097['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x56911c)||this['_crash'](_0x56911c['message'],_0x56911c);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x2c9234=>{this['on']('change:_isPendingUpdate',()=>{_0x2c9234();});});}async _sendBufferedOperations(){const _0x4dd8ff=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x4dd8ff['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x4ed897=[...this['_bufferedOperations']];for(const _0x432497 of _0x4ed897)_0x432497['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x432497);const _0x2ddb90=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4ed897),_0x3c0114=Z++,_0x421732=this['_compressOperations'](_0x4ed897),_0x23684c=await this['_service']['sendOperations'](_0x421732,_0x421732['baseVersion'],_0x2ddb90);try{return await this['_handleServerResponse'](_0x4ed897,_0x23684c,_0x3c0114);}catch(_0x504c03){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x504c03);}}async['_handleServerResponse'](_0x25c43c,_0x5efb72,_0x9dc150){if('error'in _0x5efb72)throw _0x5efb72['error'];let _0x5484c3;if(_0x5efb72['wereChangesApplied']){_0x5efb72['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5efb72['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x2d0d11=>!_0x25c43c['includes'](_0x2d0d11));for(const _0x3628a4 of _0x25c43c)_0x3628a4['createdAt']='lastOperationAcceptedAt'in _0x5efb72&&_0x5efb72['lastOperationAcceptedAt']||void 0x0;st(_0x25c43c,_0x5efb72['version']-_0x25c43c['length']),this['_updateServerHistory'](_0x25c43c);const _0x2a78c4=_0x25c43c['filter'](_0x360be8=>{if(!_0x360be8['_isInit'])return!0x1;const _0x12d02d=this['_getAffectedRoot'](_0x360be8);return _0x12d02d&&!this['_knownRootNames']['has'](_0x12d02d);});st(_0x2a78c4,this['_document']['version']),this['_applyOperationsSet'](_0x2a78c4),_0x5484c3=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x4dee3e=this['_decompressOperations'](_0x5efb72['data'],_0x5efb72['metadata'])['filter'](_0x252a88=>_0x252a88['baseVersion']>=this['_lastServerVersion']);_0x4dee3e['forEach'](_0x5cad86=>this['_addKnownRoot'](_0x5cad86)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1d42e3=>!_0x1d42e3['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x1d42e3))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x4dee3e),_0x5484c3=this['_handleExternalOperations'](_0x4dee3e,_0x5efb72['version'],_0x5efb72['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x5484c3?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0xf402b8,_0x2fed73,_0x2727da){try{const _0x463b7a={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x4a3b8b,operationsB:_0x5bd1f8,originalOperations:_0x5f5cfa}=_0x1ef915(_0xf402b8,this['_bufferedOperations'],_0x463b7a);st(_0x4a3b8b,this['_document']['version']),st(_0x5bd1f8,_0x2fed73);for(const _0x1c9d08 of _0x4a3b8b){const _0x2f7253=_0x5f5cfa['get'](_0x1c9d08);_0x2f7253?(_0x1c9d08['_authorId']=_0x2f7253['_authorId'],'noop'!==_0x1c9d08['type']&&(_0x1c9d08['_aiSource']=_0x2f7253['_aiSource'])):_0x1c9d08['_authorId']=null;}for(const _0xbe9fa4 of _0x5bd1f8)'noop'!==_0xbe9fa4['type']&&(_0xbe9fa4['_aiSource']=_0x5f5cfa['get'](_0xbe9fa4)?.['_aiSource']);_0x2727da&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xf402b8,_0x2727da),this['_lastSyncedOperationId']=_0x2727da),this['_bufferedOperations']=[..._0x5bd1f8],this['_applyOperationsSet'](_0x4a3b8b),this['_updateServerHistory'](_0xf402b8);}catch(_0xb7bbc4){return console['error'](_0xb7bbc4),!0x1;}return!0x0;}_applyOperationsSet(_0x37d459,_0x310810=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x3a5486=>{for(const _0x2bb2f8 of _0x37d459)this['_knownOperations']['add'](_0x2bb2f8),this['_addKnownRoot'](_0x2bb2f8),_0x3a5486['batch']['addOperation'](_0x2bb2f8),this['editor']['model']['applyOperation'](_0x2bb2f8);});}_addKnownRoot(_0x3d304a){const _0x3677df=this['_getAffectedRoot'](_0x3d304a);_0x3677df&&this['_knownRootNames']['add'](_0x3677df);}_getAffectedRoot(_0x411ba1){let _0x2d7ee9,_0x498d01;switch(_0x411ba1['type']){case'insert':_0x2d7ee9=_0x411ba1['position']['root'];break;case'marker':if(_0x498d01=_0x411ba1['newRange'],!_0x498d01)return null;_0x2d7ee9=_0x498d01['root'];break;case'addRootAttribute':_0x2d7ee9=_0x411ba1['root'];break;case'addRoot':_0x2d7ee9=_0x411ba1['affectedSelectable'];break;case'move':_0x2d7ee9=_0x411ba1['targetPosition']['root'];break;default:return null;}return _0x2d7ee9['rootName'];}_updateServerHistory(_0x528211){_0x528211['forEach'](_0x5c43ec=>{const _0x445f4f=_0x5c43ec['clone']();_0x445f4f['_authorId']=_0x5c43ec['_authorId'],_0x445f4f['_isInit']=!!_0x5c43ec['_isInit'],_0x445f4f['_aiSource']=_0x5c43ec['_aiSource'],_0x445f4f['createdAt']=_0x5c43ec['createdAt'],_0x445f4f['baseVersion']+=this['_offset'],_0x5c43ec['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x445f4f),this['serverHistory']['addOperation'](_0x445f4f);});}_handleReconnectionError(_0x2e20d7){const _0x41b1fd=this['editor']['plugins']['get']('Notification'),_0x5855d8=this['editor']['locale'];_0x2e20d7||(_0x2e20d7=X(_0x5855d8,'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.')),_0x41b1fd['showWarning'](_0x2e20d7,{'title':X(_0x5855d8,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x36d6a1)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x36d6a1)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x1cb706){const _0x1f536b=_0x1cb706['map'](_0x499b71=>_0x499b71['toJSON']());return this['_compressor']['compress'](_0x1f536b);}_decompressOperations(_0x95f80e,_0x47be78){return this['_compressor']['decompress'](_0x95f80e)['map']((_0xb60ef7,_0x538de0)=>{const _0x3758d8='init'==_0x47be78[_0x538de0]['type'];if('InsertOperation'==_0xb60ef7['__className']){const _0x48f60f=_0xb60ef7['position']['root'];!this['_document']['getRoot'](_0x48f60f)&&(this['_document']['createRoot']('$unknown',_0x48f60f)['_isAttached']=!0x1);}else{if('RootOperation'==_0xb60ef7['__className']){const _0x5b54af=this['_document']['getRoot'](_0xb60ef7['rootName']);_0x5b54af&&'$unknown'==_0x5b54af['name']&&_0xb60ef7['elementName']!=_0x5b54af['name']&&(_0x5b54af['name']=_0xb60ef7['elementName']);}}const _0xb995bd=_0x50c70e['fromJSON'](_0xb60ef7,this['_document']);return _0xb995bd['wasUndone']=_0xb60ef7['wasUndone'],_0xb995bd['_isInit']=_0x3758d8,_0xb995bd['_authorId']=_0x3758d8?null:_0x47be78[_0x538de0]['userId'],_0xb995bd['_isDisconnection']='cs:removeUser'===_0x47be78[_0x538de0]['type'],_0xb995bd['_aiSource']=_0xb60ef7['_aiSource']||void 0x0,_0xb995bd['createdAt']=_0x47be78[_0x538de0]['createdAt'],_0xb995bd;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x3b8b24=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3b8b24&&_0x3b8b24['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x554c61,_0x50a83e){for(const _0x1dde46 of _0x554c61)_0x1dde46['baseVersion']=_0x50a83e++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x56c59b){this['_ignoredOperations']=_0x56c59b,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x572cbe){let _0x3f5241=_0x572cbe['length'];for(;_0x3f5241--;){const _0x537ae5=_0x572cbe[_0x3f5241];if(!this['_ignoredOperations']['has'](_0x537ae5)){if(!this['_operationToId']['has'](_0x537ae5)){const _0x169e24=_0x3e36f4()['slice'](0x1,0x12);this['_operationToId']['set'](_0x537ae5,_0x169e24);}return this['_operationToId']['get'](_0x537ae5);}}}setIdForTheLastOperation(_0x233be2,_0x1d1ddd){if(!_0x1d1ddd)return;let _0x202d23=_0x233be2['length'];for(;_0x202d23--;){const _0x22c308=_0x233be2[_0x202d23];this['_ignoredOperations']['has'](_0x22c308)||this['_operationToId']['set'](_0x22c308,_0x1d1ddd);}}},nt=class extends _0x36abf4{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0xc4d6aa{static CommentsService=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x5e88d2)());['_services'];static get requires(){return[z,_0x6bab61,Y,_0x4a1da9];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x418951){super(_0x418951),this['_services']=new Map();}async init(){const _0x40dbeb=this['context'],_0x55d4b1=_0x40dbeb['plugins']['get'](_0x6bab61);if(_0x40dbeb['plugins']['get'](z)['addToReconnectionStack'](this),_0x55d4b1['adapter']={'addCommentThread':async({channelId:_0x5339fa,threadId:_0x1874ca,comments:_0x2296fe,resolvedAt:_0x364108,resolvedBy:_0x5877ec,context:_0x3f18d9,attributes:_0x2f75e6})=>{const _0xb27e0c=await this['_getService'](_0x5339fa)['addCommentThread']({'commentThreadId':_0x1874ca,'comments':_0x2296fe['map'](_0x9e18f1=>function(_0x5c887f,_0x2dba8e,_0xfa414e){return{'commentThreadId':_0xfa414e,'commentId':_0x5c887f['commentId'],'userId':_0x5c887f['authorId'],'content':_0x5c887f['content'],'documentId':_0x2dba8e,'createdAt':_0x5c887f['createdAt'],'attributes':_0x5c887f['attributes']||{}};}(_0x9e18f1,_0x5339fa,_0x1874ca)),'resolvedAt':_0x364108,'resolvedBy':_0x5877ec,'context':_0x3f18d9,'attributes':_0x2f75e6})['catch'](ct);return{'threadId':_0xb27e0c['commentThreadId'],'comments':_0xb27e0c['comments']};},'getCommentThread':async({channelId:_0xf56ad3,threadId:_0x340454})=>{const _0x46a5c9=await this['_getService'](_0xf56ad3)['getCommentThread'](_0x340454)['catch'](rt)['catch'](ct);return _0x46a5c9?_0x46a5c9['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x46a5c9]),{'threadId':_0x46a5c9['commentThreadId'],'comments':_0x46a5c9['comments']['map'](at),'context':_0x46a5c9['context'],'resolvedAt':_0x46a5c9['resolvedAt'],'resolvedBy':_0x46a5c9['resolvedBy'],'attributes':_0x46a5c9['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x1bdb88,threadId:_0x49870f,context:_0x57db21,unlinkedAt:_0x4578e2,attributes:_0x209527})=>this['_getService'](_0x1bdb88)['updateCommentThread']({'commentThreadId':_0x49870f,'context':_0x57db21,'attributes':_0x209527,'unlinkedAt':_0x4578e2})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x3ce4a0,threadId:_0x5fd68e})=>{const _0x4c2a82=await this['_getService'](_0x3ce4a0)['resolveCommentThread'](_0x5fd68e)['catch'](rt)['catch'](ct);return{'threadId':_0x4c2a82['commentThreadId'],'resolvedAt':_0x4c2a82['resolvedAt'],'resolvedBy':_0x4c2a82['resolvedBy']};},'reopenCommentThread':async({channelId:_0x459037,threadId:_0x4c23f8})=>this['_getService'](_0x459037)['reopenCommentThread'](_0x4c23f8)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x4d52f6,threadId:_0x31fe78})=>this['_getService'](_0x4d52f6)['removeCommentThread'](_0x31fe78)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x4b3a54,threadId:_0x1c2828,commentId:_0x306a91,content:_0x270297,attributes:_0x69f5f9})=>this['_getService'](_0x4b3a54)['addComment'](_0x1c2828,_0x306a91,_0x270297,_0x69f5f9)['catch'](ct),'updateComment':({channelId:_0xa860ae,threadId:_0x33a2c2,commentId:_0x51c008,content:_0x1cda63,attributes:_0x19ed32})=>this['_getService'](_0xa860ae)['updateComment'](_0x33a2c2,_0x51c008,_0x1cda63,_0x19ed32)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x15a9bb,threadId:_0xaba2aa,commentId:_0x1f2a44})=>this['_getService'](_0x15a9bb)['removeComment'](_0xaba2aa,_0x1f2a44)['catch'](rt)['catch'](ct)},_0x40dbeb instanceof _0x2d68c5){const _0x20c33c=_0x40dbeb['config']['get']('collaboration.channelId'),_0x577063=_0x40dbeb['plugins']['get'](Y);await this['_setUpService'](_0x20c33c);const _0x52b233=await this['_services']['get'](_0x20c33c)['getConnectedSessions']();this['listenTo'](_0x577063,'sessionAdd:'+_0x20c33c,(_0x476b71,{session:_0x584e71})=>{_0x584e71['id']===_0x577063['mySessionId']&&(_0x476b71['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x584e71['permissions'],_0x20c33c));}),_0x577063['register'](_0x20c33c,_0x52b233);}}async _setUpService(_0x4ea89e){if(this['_services']['has'](_0x4ea89e))throw new _0x2e8d1b('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x4ea89e});const _0x2fc50a=this['context']['plugins']['get'](_0x6bab61),_0x477db2=new CloudServicesCommentsAdapter['CommentsService'](_0x4ea89e);this['_services']['set'](_0x4ea89e,_0x477db2),this['listenTo'](_0x477db2,'commentThreadAdded',(_0x224c3d,_0x8b45d9)=>{const {commentThreadId:_0x88b497,documentId:_0x1a77e7,context:_0x53f77d,attributes:_0x1bf07a,resolvedAt:_0x1b7e3c,resolvedBy:_0x3154d0,comments:_0x25670c}=_0x8b45d9;_0x2fc50a['getCommentThread'](_0x88b497)||_0x2fc50a['addCommentThread']({'threadId':_0x88b497,'channelId':_0x1a77e7,'comments':_0x25670c?_0x25670c['map'](at):[],'context':_0x53f77d,'attributes':_0x1bf07a,'resolvedAt':_0x1b7e3c,'resolvedBy':_0x3154d0,'isFromAdapter':!0x0});}),this['listenTo'](_0x477db2,'commentThreadUpdated',(_0x4b9a9c,{commentThreadId:_0x45e052,documentId:_0x3d480c,context:_0x188e81,unlinkedAt:_0x25b775,attributes:_0x2aaf4f})=>{_0x2fc50a['getCommentThread'](_0x45e052)&&_0x2fc50a['updateCommentThread']({'threadId':_0x45e052,'channelId':_0x3d480c,'context':_0x188e81,'unlinkedAt':_0x25b775,'attributes':_0x2aaf4f,'isFromAdapter':!0x0});}),this['listenTo'](_0x477db2,'commentThreadResolved',(_0x283a38,{commentThreadId:_0x5f5899,resolvedBy:_0x3afffc,resolvedAt:_0x265264})=>{const _0x5ade48=_0x2fc50a['getCommentThread'](_0x5f5899);_0x5ade48&&_0x5ade48['resolve']({'resolvedBy':_0x3afffc,'resolvedAt':_0x265264,'isFromAdapter':!0x0});}),this['listenTo'](_0x477db2,'commentThreadReopened',(_0x116f9f,{commentThreadId:_0x597d7c})=>{const _0x10f674=_0x2fc50a['getCommentThread'](_0x597d7c);_0x10f674&&_0x10f674['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x477db2,'commentThreadRemoved',(_0x41720c,{commentThreadId:_0x5b83ed})=>{const _0x45180d=_0x2fc50a['getCommentThread'](_0x5b83ed);_0x45180d&&_0x45180d['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x477db2,'commentAdded',(_0x55a6da,_0x2bd8c4)=>{const _0x298717=_0x2bd8c4['commentThreadId'],_0x20d8a6=_0x2fc50a['getCommentThread'](_0x298717);_0x20d8a6&&_0x20d8a6['addComment']({...at(_0x2bd8c4),'isFromAdapter':!0x0});}),this['listenTo'](_0x477db2,'commentUpdated',(_0x402ae1,{commentThreadId:_0x1dbf57,commentId:_0x5eec08,content:_0x32858a,attributes:_0x359799})=>{const _0x3b1905=_0x2fc50a['getCommentThread'](_0x1dbf57);if(_0x3b1905){const _0x120e80=_0x3b1905['getComment'](_0x5eec08);_0x120e80&&_0x120e80['update']({'content':_0x32858a,'attributes':_0x359799,'isFromAdapter':!0x0});}}),this['listenTo'](_0x477db2,'commentRemoved',(_0x1b28d4,{commentThreadId:_0x259a63,commentId:_0x4a36cc})=>{const _0x6ad753=_0x2fc50a['getCommentThread'](_0x259a63);if(_0x6ad753){const _0x1cec61=_0x6ad753['getComment'](_0x4a36cc);_0x1cec61&&_0x1cec61['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x477db2,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x4ea89e),this['stopListening'](_0x477db2));}),await this['_connectService'](_0x4ea89e);}destroy(){if(this['context']instanceof _0x2d68c5){const _0x4537a4=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x4537a4)&&this['_terminateService'](_0x4537a4);}}_terminateService(_0x3db8dd){if(!this['_services']['has'](_0x3db8dd))throw new _0x2e8d1b('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x3db8dd});this['_getService'](_0x3db8dd)['disconnect'](),this['_services']['delete'](_0x3db8dd);}async reconnect(){for(const _0x5e2f1d of this['_services']['keys']())await this['_connectService'](_0x5e2f1d);if(this['context']instanceof _0x2d68c5){const _0xa997ec=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0xa997ec)){const _0x17b667=this['context']['plugins']['get'](Y);_0x17b667['unregister'](_0xa997ec);const _0x25dfad=await this['_services']['get'](_0xa997ec)['getConnectedSessions']();_0x17b667['register'](_0xa997ec,_0x25dfad);}}}async _connectService(_0x416c23){const {connection:_0x15c786}=this['context']['plugins']['get'](z),_0x5bf302=this['context']['plugins']['get'](_0x6bab61),_0x343c71=await this['_services']['get'](_0x416c23)['connect'](_0x15c786);await this['_fetchMissingUsersForThreads'](_0x343c71);const _0xda6178=new Set(Array['from'](_0x5bf302['getCommentThreads']({'channelId':_0x416c23}),_0x10502c=>_0x10502c['id']));for(const _0x3f7437 of _0x343c71)_0x3f7437['deletedAt']||_0xda6178['delete'](_0x3f7437['commentThreadId']);for(const _0x2d843f of _0xda6178)_0x5bf302['getCommentThread'](_0x2d843f)['remove']({'isFromAdapter':!0x0});for(const _0x3fa210 of _0x343c71){let _0x2d3c4a=_0x5bf302['getCommentThread'](_0x3fa210['commentThreadId']);const {commentThreadId:_0x422bbe,context:_0x333e4c,attributes:_0x2b6ec8,resolvedBy:_0x49ee36,resolvedAt:_0x5c54a0,unlinkedAt:_0x3a2561,deletedAt:_0x39f375}=_0x3fa210;if(_0x39f375)continue;_0x2d3c4a||(_0x2d3c4a=_0x5bf302['addCommentThread']({'channelId':_0x416c23,'threadId':_0x422bbe,'context':_0x333e4c,'attributes':_0x2b6ec8||{},'resolvedBy':_0x49ee36,'resolvedAt':_0x5c54a0,'unlinkedAt':_0x3a2561,'isFromAdapter':!0x0}));const _0x3e5f4c=new Set(Array['from'](_0x2d3c4a['comments'],_0x4f7469=>_0x4f7469['id']));for(const _0x12355c of _0x3fa210['comments'])_0x3e5f4c['delete'](_0x12355c['commentId']);for(const _0x425788 of _0x3e5f4c)_0x2d3c4a['getComment'](_0x425788)['remove']({'isFromAdapter':!0x0});for(const _0x146683 of _0x3fa210['comments']){const _0x13bd77=_0x2d3c4a['getComment'](_0x146683['commentId']);_0x13bd77?_0x13bd77['content']!==_0x146683['content']&&_0x13bd77['update']({'content':_0x146683['content'],'isFromAdapter':!0x0}):_0x2d3c4a['addComment'](Object['assign'](at(_0x146683),{'isFromAdapter':!0x0}));}}}_getService(_0x5551d8){if(!this['_services']['has'](_0x5551d8))throw new _0x2e8d1b('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x5551d8});return this['_services']['get'](_0x5551d8);}async _fetchMissingUsersForThreads(_0x552edd){const _0x23ea12=this['context']['plugins']['get'](_0x4a1da9),{connection:_0x404b96}=this['context']['plugins']['get'](z),_0x17d127=new Set();for(const {resolvedBy:_0xa649b4,comments:_0xe002cb}of _0x552edd){_0xa649b4&&!_0x23ea12['getUser'](_0xa649b4)&&_0x17d127['add'](_0xa649b4);for(const {userId:_0x2411f4}of _0xe002cb)_0x23ea12['getUser'](_0x2411f4)||_0x17d127['add'](_0x2411f4);}if(0x0===_0x17d127['size'])return;const _0x18e43c=await _0xad2f00['getMany'](_0x404b96,Array['from'](_0x17d127));for(const _0x2a76f1 of _0x18e43c)_0x23ea12['getUser'](_0x2a76f1['id'])||_0x23ea12['addUser'](_0x2a76f1);}};async function rt(_0x55fe93){if('404'!==_0x55fe93['code'])throw _0x55fe93;}function ct(_0x43b696){if((_0x32892f=_0x43b696)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x32892f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x32892f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x32892f;throw _0x43b696;}function at(_0x1adb13){return{'threadId':_0x1adb13['commentThreadId'],'commentId':_0x1adb13['commentId'],'content':_0x1adb13['content'],'createdAt':_0x1adb13['createdAt'],'authorId':_0x1adb13['userId'],'attributes':_0x1adb13['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x36abf4{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>_0x43b8a5)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x59abfe,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5ea5fe){super(_0x5ea5fe);const _0x5a87f5=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x5a87f5);}init(){const _0x3539b8=this['editor']['plugins']['get'](z),_0x2562dd=this['editor']['plugins']['get'](_0x59abfe);return _0x2562dd['adapter']={'getSuggestion':async _0xf8ea2=>{await this['_waitForServiceReady']();const _0x4ea98b=await this['_trackChangesService']['get'](_0xf8ea2)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x4ea98b]),_0x4ea98b;},'addSuggestion':async({id:_0x2a004c,type:_0xe271d6,data:_0x569dff,originalSuggestionId:_0x23f679,attributes:_0xe4f6e6})=>{await this['_waitForServiceReady']();const _0x35dddc={'id':_0x2a004c,'type':_0xe271d6,'data':_0x569dff,'originalSuggestionId':_0x23f679,'attributes':_0xe4f6e6},_0x4b1e4b=await this['_trackChangesService']['add'](_0x2a004c,_0xe271d6,_0x569dff,_0x23f679,_0xe4f6e6)['catch'](_0x77a3c2=>{if(dt(_0x77a3c2))return new Promise(_0x30d699=>{this['_bufferedRequests']['set'](_0x2a004c,{'resolve':_0x30d699,'suggestionData':_0x35dddc});});throw _0x77a3c2;});return this['_bufferedRequests']['delete'](_0x2a004c),_0x4b1e4b;},'updateSuggestion':async(_0x21bd8d,_0x24bea7)=>{if(await this['_waitForServiceReady'](),'open'!==_0x24bea7['state'])return this['_trackChangesService']['update'](_0x21bd8d,_0x24bea7)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x3ef492,_0x49a94d)=>{_0x2562dd['hasSuggestion'](_0x49a94d['id'])&&(_0x2562dd['getSuggestion'](_0x49a94d['id'])['attributes']=_0x49a94d['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x3539b8['connection']?.['state']&&(_0x3539b8['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x3539b8['connection'])['then'](_0x3752d5=>(_0x3539b8['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x3752d5)['then'](()=>{for(const _0xce8ab4 of _0x3752d5){_0x2562dd['addSuggestionData'](_0xce8ab4)['_saved']=!0x0;}})));}async reconnect(){const _0x4a655d=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x152552}=this['editor']['plugins']['get'](z),_0x18f4a3=await this['_trackChangesService']['connect'](_0x152552);await this['_fetchMissingUsersForThreads'](_0x18f4a3);for(const {suggestionData:_0x1f83f5,resolve:_0xa8d4b2}of this['_bufferedRequests']['values']()){let _0x39fcf7=_0x18f4a3['find'](_0x39fd7b=>_0x39fd7b['id']===_0x1f83f5['id']);_0x39fcf7||(_0x39fcf7=await this['_trackChangesService']['add'](_0x1f83f5['id'],_0x1f83f5['type'],_0x1f83f5['data'],_0x1f83f5['originalSuggestionId'])),_0xa8d4b2(_0x39fcf7);}for(const _0x488f85 of _0x18f4a3)_0x4a655d['hasSuggestion'](_0x488f85['id'])||_0x4a655d['addSuggestionData'](_0x488f85);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x233332=>{this['listenTo'](this['_trackChangesService'],'connected',_0x22c17c=>{_0x22c17c['off'](),_0x233332();});});}async _fetchMissingUsersForThreads(_0x2e5d74){const _0x4ed948=this['editor']['plugins']['get'](_0x4a1da9),{connection:_0x4d1c13}=this['editor']['plugins']['get'](z),_0x397f95=new Set();for(const {authorId:_0x47503d}of _0x2e5d74)_0x4ed948['getUser'](_0x47503d)||_0x397f95['add'](_0x47503d);if(0x0===_0x397f95['size'])return;const _0x392a1f=await _0xad2f00['getMany'](_0x4d1c13,Array['from'](_0x397f95));for(const _0x2ce7e0 of _0x392a1f)_0x4ed948['getUser'](_0x2ce7e0['id'])||_0x4ed948['addUser'](_0x2ce7e0);}};function lt(_0x46fce8){if(dt(_0x46fce8))return new Promise(()=>{});throw _0x46fce8;}function dt(_0x3ab926){return _0x3ab926['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3ab926['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x36abf4{static get requires(){return[_0x4663d3,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x1572bc=this['editor']['plugins']['get'](z),_0x5ac4ea=this['editor']['plugins']['get'](_0x116785),_0x29c6fc=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x1572bc,'change:state',(_0x144a21,_0x308715,_0x8374c4)=>{_0x5ac4ea['isThreadsLoadingPaused']='connected'!==_0x8374c4;});}),this['listenTo'](_0x1572bc,'change:state',(_0x2c9e36,_0x39ab8f,_0x5aeb93)=>{this['editor']['plugins']['get'](_0x6bab61)['switchReadOnly']('connected'!==_0x5aeb93);}),_0x29c6fc['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x482e6=this['editor']['plugins']['get'](ot),_0x261e5a=this['editor']['config']['get']('collaboration.channelId');_0x482e6['_services']['has'](_0x261e5a)&&_0x482e6['_terminateService'](_0x261e5a),super['destroy']();}},ft=class extends _0x36abf4{static get requires(){return[ut,ht,_0x112efb];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x36abf4{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
+ ((()=>_0x361b61)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x230608,Y,_0x4a1da9];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x293570){super(_0x293570);const _0x225cbe=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x225cbe);}async init(){const _0x173fed=this['editor']['plugins']['get'](tt),_0x5161ce=_0x173fed['serverHistory'],_0x10582b=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x5161ce,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x173fed['sessionId']});const _0x4cbe00=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x40ea60,_0x4d8971=await _0x2742b2['isBundleUploaded'](_0x10582b['connection'],_0x4cbe00);this['editor']['plugins']['get'](_0x230608)['adapter']={'getRevision':async({revisionId:_0x55f589})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x55f589)),'updateRevisions':async _0x5a5436=>{await this['_waitForServiceReady']();const _0x2d58b9=this['_revisionTracker']['currentRevision'];if(_0x4d8971&&0x1===_0x5a5436['length']&&_0x5a5436[0x0]['id']===_0x2d58b9['id'])return _0x5a5436;for(const _0x351a59 of _0x5a5436)_0x351a59['id']===_0x2d58b9['id']&&(_0x351a59['isEmptyCurrent']=_0x351a59['fromVersion']===_0x351a59['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x5a5436,this['_lastRequestId'])['then'](_0x34e4b8=>(this['_lastRequestId']=_0x34e4b8,_0x5a5436))['catch'](_0x15f91a=>{if(pt(_0x15f91a)||'400'===_0x15f91a['code']&&void 0x0!==_0x15f91a['data']['wrongRequestId']){for(const _0x466e9e of _0x5a5436)this['_revisionTracker']['repository']['getRevision'](_0x466e9e['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x466e9e['id'],_0x466e9e,!0x1);if(pt(_0x15f91a)&&'destroyed'!==this['editor']['state'])throw _0x15f91a;return _0x5a5436;}throw _0x15f91a;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x48df05,{revisionsData:_0x58e6ec,requestId:_0x2e65ac})=>{Math['max'](..._0x58e6ec['map'](_0x493e03=>_0x493e03['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x58e6ec,_0x2e65ac);}):this['_handleRevisionsUpdate'](_0x58e6ec,_0x2e65ac);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x10582b['connection']?.['state']&&(_0x10582b['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x520abc,requestId:_0x2375cc}=await this['_revisionHistoryService']['connect'](_0x10582b['connection']);_0x10582b['addToReconnectionStack'](this),this['_lastRequestId']=_0x2375cc,await this['_fetchMissingUsers'](_0x520abc);for(const _0x2a9a73 of _0x520abc)this['_revisionTracker']['addRevisionData'](_0x2a9a73);this['listenTo'](_0x173fed,'change:_isConnected',(_0xf99ce0,_0x192e1a,_0x481d09)=>{_0x481d09&&(this['_oldOffset']=_0x173fed['_offset'],_0xf99ce0['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x486481=this['editor']['plugins']['get'](z),_0x1bb513=this['editor']['plugins']['get'](tt),_0x1f27e0=async()=>{const _0x809dc0=this['_revisionTracker']['currentRevision'],_0x488d06=_0x809dc0['id'],_0x16fec3=_0x488d06!==_0x1bb513['sessionId'];if(_0x16fec3){const _0x2373e4=_0x1bb513['_offset']-this['_oldOffset'],_0x38b4fc=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x809dc0['toVersion']+_0x2373e4!==_0x38b4fc){const _0x1122fd=_0x809dc0['fromVersion']+_0x2373e4,_0x205524=this['editor']['plugins']['get'](_0x4a1da9),_0x28798d=this['_revisionTracker']['buildRevisionData']({'revision':_0x809dc0,'from':_0x1122fd,'to':_0x38b4fc});_0x28798d['id']=_0x809dc0['id'];const _0x4ec026=_0x28798d['authorsIds']['map'](_0x41aafc=>_0x205524['getUser'](_0x41aafc));_0x809dc0['_update']({..._0x28798d,'authors':_0x4ec026},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x809dc0['id'],_0x28798d,!0x0);}this['_revisionTracker']['_startingVersion']=_0x38b4fc,_0x809dc0['toVersion']!==_0x809dc0['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x488d06)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x488d06),this['_revisionTracker']['_createCurrentRevision'](_0x38b4fc);}const {revisions:_0x2a3d3e,requestId:_0xe22a7d}=await this['_revisionHistoryService']['reconnect'](_0x486481['connection'],this['_lastRequestId']);_0x16fec3&&_0x2a3d3e['length']>0x0?_0x1bb513['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x2a3d3e),this['_handleRevisionsUpdate'](_0x2a3d3e,_0xe22a7d),this['_revisionTracker']['sendBufferedUpdates']());};return _0x1bb513['_isConnected']?_0x1f27e0():new Promise((_0x150ec5,_0x337831)=>{_0x1bb513['once']('change:_isConnected',()=>{_0x1f27e0()['then'](_0x150ec5)['catch'](_0x337831);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x37581d=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x4d1113=>{_0x4d1113['off'](),_0x37581d();});});}_getLatestVersionFromServerOperations(){const _0x15428e=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x2a69b2 of _0x15428e)if('marker'!==_0x2a69b2['type']||_0x2a69b2['affectsData'])return _0x2a69b2['baseVersion']+0x1;}_getLatestVersion(){const _0x2ee9d7=this['editor']['plugins']['get'](tt);return new Promise(_0x5efc31=>{_0x2ee9d7['_isPendingUpdate']?_0x2ee9d7['once']('change:_isPendingUpdate',()=>{_0x5efc31(this['_getLatestVersionFromServerOperations']());}):_0x5efc31(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x127ddd,_0x2fec25){const _0x1a9f8a=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x2fec25;for(const _0x2842df of _0x127ddd){const _0xcfd3cb=_0x1a9f8a['getRevision'](_0x2842df['id']);if(_0xcfd3cb){if((_0x2842df['fromVersion']||_0x2842df['toVersion'])&&(_0x2842df['diffData']=null),_0xcfd3cb===this['_revisionTracker']['currentRevision']){const _0x1ccea0=Math['max'](_0xcfd3cb['toVersion'],_0x2842df['toVersion']),_0x2ae936=Math['max'](_0xcfd3cb['fromVersion'],_0x2842df['fromVersion']);let _0x16fa68;_0xcfd3cb['toVersion']===_0x2842df['toVersion']&&_0xcfd3cb['fromVersion']===_0x2842df['fromVersion']?(_0x16fa68=!0x0,this['_preventResendingRevisionData'](_0x2842df)):_0x2842df['toVersion']===_0x1ccea0&&_0x2842df['fromVersion']===_0x2ae936?_0x16fa68=!0x1:(_0xcfd3cb['toVersion']===_0x1ccea0&&_0xcfd3cb['fromVersion']===_0x2ae936||this['_fixRevision']({'revision':_0xcfd3cb,'from':_0x2ae936,'to':_0x1ccea0}),_0x16fa68=!0x0),_0x16fa68&&(delete _0x2842df['fromVersion'],delete _0x2842df['toVersion'],delete _0x2842df['diffData'],delete _0x2842df['createdAt'],delete _0x2842df['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x2842df),this['_preventResendingRevisionData'](_0x2842df);}else this['_revisionTracker']['addRevisionData'](_0x2842df);}const _0x253256=_0x1a9f8a['getRevisions']();_0x253256['reverse']();for(let _0x5a2d4c=0x0;_0x5a2d4c<_0x253256['length']-0x1;_0x5a2d4c++){const _0x583209=_0x253256[_0x5a2d4c],_0x2026e1=_0x253256[_0x5a2d4c+0x1];if(_0x583209['fromVersion']<_0x2026e1['toVersion']){const _0x51f1e5=_0x2026e1['toVersion'],_0x3a28c8=Math['max'](_0x51f1e5,_0x583209['toVersion']);this['_fixRevision']({'revision':_0x583209,'from':_0x51f1e5,'to':_0x3a28c8});}}}['_fixRevision']({revision:_0x3ba6b2,from:_0x40a84b,to:_0x438b8e}={}){const _0x143118=this['editor']['plugins']['get'](_0x4a1da9),_0x21d44e=this['_revisionTracker']['buildRevisionData']({'revision':_0x3ba6b2,'from':_0x40a84b,'to':_0x438b8e});_0x21d44e['authors']=_0x21d44e['authorsIds']['map'](_0x3ef2f0=>_0x143118['getUser'](_0x3ef2f0)),_0x3ba6b2['_update'](_0x21d44e);}_preventResendingRevisionData(_0x1e6b26){const _0x19bf53={};_0x19bf53['id']=_0x1e6b26['id'];for(const _0x42bad9 of Object['keys'](_0x1e6b26))'id'!==_0x42bad9&&(_0x19bf53[_0x42bad9]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x19bf53['id'],_0x19bf53,!0x0);}async _fetchMissingUsers(_0x114d0e){const _0x50fbcc=this['editor']['plugins']['get'](_0x4a1da9),{connection:_0x56fd1a}=this['editor']['plugins']['get'](z),_0x246192=new Set();for(const _0x434666 of _0x114d0e){for(const _0x170bfb of _0x434666['authorsIds'])_0x3e5aa3(_0x170bfb);_0x434666['creatorId']&&_0x3e5aa3(_0x434666['creatorId']);}if(0x0===_0x246192['size'])return;const _0x1b7187=await _0xad2f00['getMany'](_0x56fd1a,Array['from'](_0x246192));for(const _0x5d7760 of _0x1b7187)_0x50fbcc['getUser'](_0x5d7760['id'])||_0x50fbcc['addUser'](_0x5d7760);function _0x3e5aa3(_0x453db7){_0x50fbcc['getUser'](_0x453db7)||_0x246192['add'](_0x453db7);}}};function pt(_0xa45738){return _0xa45738['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xa45738['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xa45738['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x36abf4{static get requires(){return[_0x230608,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x56b2c8{_collapseAt;constructor(_0x2d06a2,_0x3bc539=0x6){super(_0x2d06a2);const _0x166139=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x3bc539,this['bind']('isHidden')['to'](this,'usersCount',_0x3a8f6c=>_0x3a8f6c<_0x3bc539),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x166139['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':_0x166139['to']('usersCount',_0x5b1529=>'+'+(_0x5b1529-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x56b2c8{items;keystrokes;constructor(_0xc69f12){super(_0xc69f12);const _0x5860ea=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x2a8a0f(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x5860ea['if']('hasPopup'),'aria-expanded':_0x5860ea['to']('isExpanded',_0x2286fa=>this['hasPopup']&&String(_0x2286fa)),'aria-label':_0x5860ea['to']('hasPopup',_0x179589=>X(_0xc69f12,_0x179589?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x5860ea['to']('hasPopup',_0x9f8850=>!!_0x9f8850&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x5860ea['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x5860ea['to'](_0x495501=>{const _0xc7c9ab=_0x495501,_0x17733c=document['querySelector']('.ck-presence-list__dropdown-list'),_0x4b98d2=document['querySelector']('.ck-balloon-panel_with-arrow');_0x17733c?.['contains'](_0xc7c9ab['relatedTarget'])||_0x4b98d2?.['contains'](_0xc7c9ab['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x214b4f,_0x260d4e,_0x5c142f)=>{this['element']&&(_0x5c142f?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},_t=class extends _0x56b2c8{counterView;inlineListView;constructor(_0x2f10f8,_0x31ea1d=0x6){super(_0x2f10f8);const _0x15699a=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x31ea1d),this['inlineListView']=new vt(_0x2f10f8),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5c05d4 of this['inlineListView']['items'])_0x5c05d4['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',_0x15699a['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x56b2c8{listWrapperView;constructor(_0x24456b,_0x2cf6cb){super(_0x24456b);const _0x53c801=this['bindTemplate'];this['listWrapperView']=new bt(_0x24456b,_0x2cf6cb),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x24456b,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x53c801['to'](_0x3f7c90=>{const _0x3b0319=_0x3f7c90,_0x10ead0=document['querySelector']('.ck-presence-list__list'),_0x5d7c07=document['querySelector']('.ck-balloon-panel_with-arrow');_0x10ead0?.['contains'](_0x3b0319['relatedTarget'])||_0x5d7c07?.['contains'](_0x3b0319['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x584c4e{constructor(_0x5645bc,_0x53d9ad){super(_0x5645bc);const _0x9df8ff=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x53d9ad?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x9df8ff['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x9df8ff['to']('role'),'aria-label':_0x9df8ff['to']('ariaLabel'),'aria-labelledby':_0x9df8ff['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x81b33['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x209944=this['element'];_0x209944&&(this['_isScrollable']=Math['max'](_0x209944['scrollHeight'],_0x209944['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x5d7bc4{['userView'];constructor(_0x2dace1,_0x5c4b19,_0x7c54f0){super(_0x2dace1);const _0x420ede=this['bindTemplate'];this['userView']=new _0x3b6bb4(_0x2dace1,_0x5c4b19);const _0x2905fa={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5c4b19['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5c4b19['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5c4b19['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x5c4b19['color']['getColorVariable'](),'--ck-user-color-alpha':_0x5c4b19['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x7c54f0&&(_0x2905fa['tag']='button',_0x2905fa['on']={'click':_0x420ede['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2905fa);}['focus'](){this['element']['focus']();}},It=class extends _0x56b2c8{['userView'];['markerView'];constructor(_0x4825bd,_0x2c2bee,_0x2fb832){super(_0x4825bd);const _0x4bf32e=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x3b6bb4(_0x4825bd,_0x2c2bee),this['markerView']=new St(_0x4825bd,_0x2c2bee);const _0x3cd587=new _0xd0dd83(_0x4825bd);_0x3cd587['template']['tag']='span',_0x3cd587['text']=_0x2c2bee['name'];const _0x266c8f={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x4bf32e['to']('isFocusable',_0x532cf3=>!!_0x532cf3&&0x0),'aria-labelledby':_0x3cd587['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x4bf32e['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x4bf32e['to']('hasTooltip',_0x112471=>!_0x112471),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x3cd587]};_0x2fb832&&(_0x266c8f['tag']='button',_0x266c8f['on']={'click':_0x4bf32e['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x266c8f);}},St=class extends _0x56b2c8{constructor(_0x2b67eb,_0x1b5031){super(_0x2b67eb),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1b5031['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x1b5031['color']['getColorVariable'](),'--ck-user-color-alpha':_0x1b5031['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0xc4d6aa{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1c4289){super(_0x1c4289),this['context']['config']['define']('presenceList',Tt);const _0x2e67e9=_0x1c4289['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x2e67e9)throw new _0x2e8d1b('presencelist-collapseat-invalid-format',this);if(_0x2e67e9<0x1)throw new _0x2e8d1b('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0xed46ed(),this['balloonPanelView']=new _0x532b6f(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x2c2ac0 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x2c2ac0);this['listenTo'](this['_allConnectedUsers'],'add',(_0x1b432f,_0x2c813a)=>{this['_handleUserAdd'](_0x2c813a);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x1b68f3,_0xb5a436)=>{this['_handleUserRemove'](_0xb5a436);});}_createView(){const _0xf832ea=this['context'],_0xad3045=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x25388d=this['balloonPanelView'];if(!_0x359a2e(_0xf832ea['config']['get']('presenceList.container')))throw new _0x2e8d1b('presencelist-missing-container',this);return _0xad3045['counterView']['bind']('usersCount')['to'](this),_0xad3045['bind']('isCollapsed')['to'](this,'usersCount',_0xc64c16=>{const {collapseAt:_0x2aeb90}=_0xf832ea['config']['get']('presenceList'),_0x10eb5a=_0xc64c16>=_0x2aeb90;if(_0x10eb5a&&!_0xad3045['inlineListView']['items']['find'](_0x219857=>_0x219857 instanceof wt)){const _0x2d2d27=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x2d2d27&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0xad3045['inlineListView']['items']['add'](_0xad3045['counterView']);}return _0x10eb5a||this['hideDropdown'](),_0x10eb5a;}),_0xad3045['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1309db=>{const _0x26b23c=_0xf832ea['config']['get']('presenceList'),_0xc1a9a=new It(_0xf832ea['locale'],_0x1309db,!!_0x26b23c['onClick']);return _0xc1a9a['bind']('hasTooltip')['to'](_0xad3045,'isCollapsed',_0x453ba3=>!_0x453ba3),_0xc1a9a['bind']('isFocusable')['to'](_0xad3045,'isCollapsed',_0x514af7=>!_0x514af7),_0x26b23c['onClick']&&this['listenTo'](_0xc1a9a,'execute',()=>{this['view']['isCollapsed']||_0x26b23c['onClick'](_0x1309db,_0xc1a9a['element']);}),_0xc1a9a;}),this['listenTo'](_0xad3045['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0xad3045['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0xad3045['inlineListView']['keystrokes']['set']('Enter',(_0x5d0e9a,_0x4e00ed)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x4e00ed());}),_0xad3045['render'](),_0x25388d['render'](),_0x53dee({'emitter':_0xad3045,'activator':()=>_0x25388d['isVisible'],'contextElements':[_0x25388d['element'],_0xad3045['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0xf832ea['config']['get']('presenceList.container')['appendChild'](_0xad3045['element']),this['_bodyCollection']=new _0x367670(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0xad3045;}['_handleUserAdd'](_0x454c62){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x454c62['isMe'])return;const _0x3f783c=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x3f783c-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x1aba11=_0x454c62['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x454c62,_0x1aba11);}['_handleUserRemove'](_0xaf23f){this['usersCount']--;const {collapseAt:_0x5f4a93}=this['context']['config']['get']('presenceList'),_0x580594=this['usersCount']>=_0x5f4a93;if(this['currentDisplayedUsers']['get'](_0xaf23f['id']))this['currentDisplayedUsers']['remove'](_0xaf23f['id']);else{if(_0x580594&&this['currentDisplayedUsers']['length']+0x1===_0x5f4a93-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x580594?0x1:0x0)<this['usersCount']){for(const _0x33c8da of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x33c8da['id'])&&(this['currentDisplayedUsers']['add'](_0x33c8da,Math['min'](this['currentDisplayedUsers']['length']-(_0x580594?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x580594?0x1:0x0)===_0x5f4a93-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x4527b0=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x4527b0['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x207dfa}=this['presenceDropdownView'];_0x207dfa['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x5bf4c9=>{if(!_0x4527b0['displayMe']&&_0x5bf4c9['isMe'])return null;const _0x24a340=new kt(this['context']['locale'],_0x5bf4c9,!!_0x4527b0['onClick']);return _0x4527b0['onClick']&&this['listenTo'](_0x24a340,'execute',()=>{_0x4527b0['onClick'](_0x5bf4c9,_0x24a340['element']);}),_0x24a340;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x207dfa['focus'](),_0x207dfa['checkIfScrollable']();const _0x3a0114=(_0x2c3343,_0x542147)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x542147();};_0x207dfa['keystrokes']['set']('Esc',_0x3a0114),_0x207dfa['keystrokes']['set']('Shift+Tab',_0x3a0114),_0x207dfa['keystrokes']['set']('Tab',(_0x30c4cd,_0x66909d)=>{!function(_0x2b6291){const _0x3f57e3=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x5c419d=>_0x5c419d+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x100a24=[...document['body']['querySelectorAll'](_0x3f57e3)]['filter'](_0x1b0fdc=>_0x1b0fdc===document['activeElement']||_0x1b0fdc['offsetWidth']+_0x1b0fdc['offsetHeight']>0x0)['sort']((_0x19ecdc,_0xaaee79)=>(_0x19ecdc['tabIndex']||0x0)-(_0xaaee79['tabIndex']||0x0)),_0x55a074=_0x100a24[(_0x100a24['indexOf'](_0x2b6291)+0x1)%_0x100a24['length']];_0x55a074&&_0x55a074['focus']();}(this['view']['element']),this['hideDropdown'](),_0x66909d();}),_0x207dfa['focusTracker']['add'](this['view']['element']),_0x207dfa['focusTracker']['on']('change:isFocused',(_0x521003,_0x41c324,_0x4b76db)=>{_0x4b76db||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}},At=class extends _0xc4d6aa{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};