@ckeditor/ckeditor5-real-time-collaboration 49.0.0-alpha.1 → 49.0.0-alpha.11

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 (77) hide show
  1. package/dist/index-editor.css +79 -56
  2. package/dist/index.css +79 -56
  3. package/dist/index.js +6 -6
  4. package/dist/translations/af.umd.js +1 -1
  5. package/dist/translations/ar.umd.js +1 -1
  6. package/dist/translations/ast.umd.js +1 -1
  7. package/dist/translations/az.umd.js +1 -1
  8. package/dist/translations/be.umd.js +1 -1
  9. package/dist/translations/bg.umd.js +1 -1
  10. package/dist/translations/bn.umd.js +1 -1
  11. package/dist/translations/bs.umd.js +1 -1
  12. package/dist/translations/ca.umd.js +1 -1
  13. package/dist/translations/cs.umd.js +1 -1
  14. package/dist/translations/da.umd.js +1 -1
  15. package/dist/translations/de-ch.umd.js +1 -1
  16. package/dist/translations/de.umd.js +1 -1
  17. package/dist/translations/el.umd.js +1 -1
  18. package/dist/translations/en-au.umd.js +1 -1
  19. package/dist/translations/en-gb.umd.js +1 -1
  20. package/dist/translations/en.umd.js +1 -1
  21. package/dist/translations/eo.umd.js +1 -1
  22. package/dist/translations/es-co.umd.js +1 -1
  23. package/dist/translations/es.umd.js +1 -1
  24. package/dist/translations/et.umd.js +1 -1
  25. package/dist/translations/eu.umd.js +1 -1
  26. package/dist/translations/fa.umd.js +1 -1
  27. package/dist/translations/fi.umd.js +1 -1
  28. package/dist/translations/fr.umd.js +1 -1
  29. package/dist/translations/gl.umd.js +1 -1
  30. package/dist/translations/gu.umd.js +1 -1
  31. package/dist/translations/he.umd.js +1 -1
  32. package/dist/translations/hi.umd.js +1 -1
  33. package/dist/translations/hr.umd.js +1 -1
  34. package/dist/translations/hu.umd.js +1 -1
  35. package/dist/translations/hy.umd.js +1 -1
  36. package/dist/translations/id.umd.js +1 -1
  37. package/dist/translations/it.umd.js +1 -1
  38. package/dist/translations/ja.umd.js +1 -1
  39. package/dist/translations/jv.umd.js +1 -1
  40. package/dist/translations/kk.umd.js +1 -1
  41. package/dist/translations/km.umd.js +1 -1
  42. package/dist/translations/kn.umd.js +1 -1
  43. package/dist/translations/ko.umd.js +1 -1
  44. package/dist/translations/ku.umd.js +1 -1
  45. package/dist/translations/lt.umd.js +1 -1
  46. package/dist/translations/lv.umd.js +1 -1
  47. package/dist/translations/ms.umd.js +1 -1
  48. package/dist/translations/nb.umd.js +1 -1
  49. package/dist/translations/ne.umd.js +1 -1
  50. package/dist/translations/nl.umd.js +1 -1
  51. package/dist/translations/no.umd.js +1 -1
  52. package/dist/translations/oc.umd.js +1 -1
  53. package/dist/translations/pl.umd.js +1 -1
  54. package/dist/translations/pt-br.umd.js +1 -1
  55. package/dist/translations/pt.umd.js +1 -1
  56. package/dist/translations/ro.umd.js +1 -1
  57. package/dist/translations/ru.umd.js +1 -1
  58. package/dist/translations/si.umd.js +1 -1
  59. package/dist/translations/sk.umd.js +1 -1
  60. package/dist/translations/sl.umd.js +1 -1
  61. package/dist/translations/sq.umd.js +1 -1
  62. package/dist/translations/sr-latn.umd.js +1 -1
  63. package/dist/translations/sr.umd.js +1 -1
  64. package/dist/translations/sv.umd.js +1 -1
  65. package/dist/translations/th.umd.js +1 -1
  66. package/dist/translations/ti.umd.js +1 -1
  67. package/dist/translations/tk.umd.js +1 -1
  68. package/dist/translations/tr.umd.js +1 -1
  69. package/dist/translations/tt.umd.js +1 -1
  70. package/dist/translations/ug.umd.js +1 -1
  71. package/dist/translations/uk.umd.js +1 -1
  72. package/dist/translations/ur.umd.js +1 -1
  73. package/dist/translations/uz.umd.js +1 -1
  74. package/dist/translations/vi.umd.js +1 -1
  75. package/dist/translations/zh-cn.umd.js +1 -1
  76. package/dist/translations/zh.umd.js +1 -1
  77. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Context as _0x11e827,ContextPlugin as _0x2ea2c1,PendingActions as _0x41c0d3,Plugin as _0x656eb}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x38db3a,Collection as _0x5a6c78,DomEmitterMixin as _0x27e801,KeystrokeHandler as _0x514268,getOverlayMountRoot as _0x414ce5,global as _0x45a7d1,trustedHtml as _0x6e09db,uid as _0x501ece,version as _0x1ccdda}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x2ec557,LabelView as _0xf81f2a,ListItemView as _0x5b7322,ListView as _0x41cbcd,Notification as _0x32fb04,OverlayHost as _0x1d7a4d,View as _0x3c10c0,clickOutsideHandler as _0x4f49cd}from'@ckeditor/ckeditor5-ui';import{History as _0x13a7ed,InsertOperation as _0x3fa927,MarkerOperation as _0x4523b0,ModelLiveRange as _0x19479d,NoOperation as _0x1daaae,OperationFactory as _0x13b377,RootAttributeOperation as _0x56775c,transformOperationSets as _0x9f7926}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x190a06}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0xa3a082,CommentsService as _0x2936da,EditorService as _0x53555b,RevisionHistoryService as _0x339e16,TrackChangesService as _0x291e29,User as _0x4be4c6,WEB_SOCKET_GATEWAY_STATES as _0x2244a6,WebSocketGateway as _0x469fcf}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0xd0b1dd,Users as _0x52f463,isPointerStillOver as _0x48de1b}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x1a3620}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x17f480,TrackChangesEditing as _0x5457f9}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x4aa167,CommentsEditing as _0x3ac6ed,CommentsRepository as _0x8fe529}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x2e230e}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x50144a}from'es-toolkit/compat';var J=class WebSocketGateway extends _0x2ea2c1{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
- ((()=>_0x469fcf)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x190a06,_0x32fb04];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x45295a){super(_0x45295a),this['set']('state',_0x2244a6['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x27e801())();}init(){const _0x28a669=this['context'],_0xa8b186=_0x28a669['plugins']['get'](_0x190a06),_0x1e9f75=_0x28a669['plugins']['get'](_0x32fb04);if(!_0xa8b186['token'])throw new _0x38db3a('websocketgateway-missing-token',this);if(!_0xa8b186['webSocketUrl'])throw new _0x38db3a('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'](_0xa8b186['token'],_0xa8b186['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x3b277b=>{if(this['connection']=_0x3b277b,this['bind']('state')['to'](_0x3b277b,'state',this,'_isBrowserOffline',(_0x4517e5,_0x190262)=>('connected'!==_0x4517e5&&(this['_shouldPluginsReconnect']=!0x0),_0x190262||_0x4517e5!==_0x2244a6['CONNECTED']?_0x2244a6['DISCONNECTED']:this['state']==_0x2244a6['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x2244a6['CONNECTING']):_0x2244a6['CONNECTED'])),this['connection']['on']('error',(_0x27c62a,_0x1328e8)=>{if('limitExceeded'!==_0x1328e8['code'])throw console['error'](_0x1328e8),new _0x38db3a('cloudservices-init',null,{'originalError':_0x1328e8});_0x1e9f75['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'});}),!_0x3b277b['me'])return new Promise(_0x33aa5a=>_0x3b277b['on']('change:me',_0x33aa5a));})['catch'](_0xe0d60e=>{throw console['error'](_0xe0d60e),new _0x38db3a('cloudservices-init',null,{'originalError':_0xe0d60e});});}addToReconnectionStack(_0xd1f23c){if('function'!=typeof _0xd1f23c['reconnect'])throw new _0x38db3a('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0xd1f23c))throw new _0x38db3a('websocketgateway-plugin-already-registered',this,{'name':_0xd1f23c['constructor']['pluginName']});this['_reconnectionStack']['add'](_0xd1f23c);}removeFromReconnectionStack(_0x35f371){this['_reconnectionStack']['delete'](_0x35f371);}isInReconnectionStack(_0x507c86){return this['_reconnectionStack']['has'](_0x507c86);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0xf460b9=>_0xf460b9['reconnect']())))['then'](()=>this['state']=_0x2244a6['CONNECTED'])['catch'](_0x48b456=>{throw console['error'](_0x48b456),new _0x38db3a('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x2244a6['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x2ea2c1{['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[J,_0x52f463];}constructor(_0x192045){super(_0x192045),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x5a6c78(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x52f463);}init(){const _0x1cb1db=this['context']['plugins']['get'](J);this['listenTo'](_0x1cb1db,'change:state',(_0x5554ed,_0x5f0b86,_0x360bcc)=>{if('connected'!==_0x360bcc)this['channelSessions']['forEach'](_0x267443=>_0x267443['clear']()),this['channelConnectedUsers']['forEach'](_0x471e65=>_0x471e65['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x171276,_0x506f57]of this['_registeredSessions'])for(const _0x2f4527 of _0x506f57)this['_handleSessionAdd'](_0x171276,_0x2f4527);}}),this['_createUser'](_0x1cb1db['connection']['me'],!0x0);}register(_0x1c3260,_0x57a99f){if(this['_registeredSessions']['has'](_0x1c3260))throw new _0x38db3a('sessions-register-already-registered',null,{'channelId':_0x1c3260});this['_registeredSessions']['set'](_0x1c3260,_0x57a99f),this['channelSessions']['set'](_0x1c3260,new _0x5a6c78()),this['channelConnectedUsers']['set'](_0x1c3260,new _0x5a6c78()),this['listenTo'](_0x57a99f,'add',(_0x25dbf7,_0x594347)=>this['_handleSessionAdd'](_0x1c3260,_0x594347)),this['listenTo'](_0x57a99f,'remove',(_0x3a52c4,_0x4c83ae)=>this['_handleSessionRemove'](_0x1c3260,_0x4c83ae));for(const _0x4e64da of _0x57a99f)this['_handleSessionAdd'](_0x1c3260,_0x4e64da);}unregister(_0x41aaea){if(!this['_registeredSessions']['has'](_0x41aaea))throw new _0x38db3a('sessions-unregister-not-exist',null,{'channelId':_0x41aaea});const _0x21ed14=this['_registeredSessions']['get'](_0x41aaea);this['stopListening'](_0x21ed14);for(const _0x486173 of _0x21ed14)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x41aaea,_0x486173);this['_registeredSessions']['delete'](_0x41aaea),this['channelSessions']['delete'](_0x41aaea),this['channelConnectedUsers']['delete'](_0x41aaea);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0x1ed18a){for(const _0x318950 of this['channelSessions']['values']())for(const _0x15b91f of _0x318950)if(_0x15b91f['id']===_0x1ed18a)return _0x15b91f['user'];}getUserSessions(_0x49a5df,_0xfeb6b0){const _0x583b3a=_0xfeb6b0?[this['channelSessions']['get'](_0xfeb6b0)]:this['channelSessions']['values'](),_0x4113fc=new Set();for(const _0x204b86 of _0x583b3a)for(const _0x16008b of _0x204b86)_0x16008b['user']['id']===_0x49a5df['id']&&_0x4113fc['add'](_0x16008b['id']);return _0x4113fc;}getUserRole(_0x62019d){for(const _0x5ecf9f of this['channelSessions']['values']())for(const _0x228a69 of _0x5ecf9f)if(_0x228a69['user']===_0x62019d)return _0x228a69['role'];}['_handleSessionAdd'](_0x5d920c,_0x4ea17a){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x8f7e7d=_0x4ea17a['user'],_0x5c5dbb=this['_users']['getUser'](_0x8f7e7d['id'])||this['_createUser'](_0x8f7e7d),_0x51818f=Object['assign']({},_0x4ea17a,{'user':_0x5c5dbb});if(this['channelSessions']['get'](_0x5d920c)['add'](_0x51818f),!_0x8f7e7d['hiddenInPresenceList']){const _0x459cb0=this['channelConnectedUsers']['get'](_0x5d920c);_0x459cb0['has'](_0x5c5dbb['id'])||_0x459cb0['add'](_0x5c5dbb),this['allConnectedUsers']['has'](_0x5c5dbb['id'])||_0x8f7e7d['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x5c5dbb,_0x5c5dbb['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x5d920c,{'channelId':_0x5d920c,'session':_0x51818f});}['_handleSessionRemove'](_0x10a1a6,_0x4cddd2){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x7c2969=this['channelConnectedUsers']['get'](_0x10a1a6),_0x38126a=_0x4cddd2['user'];_0x38126a['id']&&(this['channelSessions']['get'](_0x10a1a6)['remove'](_0x4cddd2['id']),_0x7c2969['has'](_0x38126a['id'])&&!this['getUserSessions'](_0x38126a,_0x10a1a6)['size']&&_0x7c2969['remove'](_0x38126a['id']),this['allConnectedUsers']['get'](_0x38126a['id'])&&!this['getUserSessions'](_0x38126a)['size']&&this['allConnectedUsers']['remove'](_0x38126a['id']));}_createUser(_0x3efd3c,_0x1a246e){const _0x5b3c5f=this['_users']['addUser'](_0x3efd3c);return _0x1a246e&&this['_users']['defineMe'](_0x3efd3c['id']),_0x5b3c5f['orderNumber']=this['_uniqueUsersCount']++,_0x5b3c5f;}},X=class extends _0x656eb{_domEmitter=new(_0x27e801())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x3569c7=this['editor'],_0x5c8e60=_0x3569c7['plugins']['get'](Q);_0x3569c7['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x48eebb,{writer:_0x27dd3b})=>function(_0x2d05c7,_0x520dd3,_0x559412,_0x481a48){const _0xb95bbf=_0x2d05c7['markerName']['split'](':')[0x2],_0x4b77b2=_0x559412['getUserBySessionId'](_0xb95bbf);if(!_0x4b77b2||_0xb95bbf===_0x559412['mySessionId'])return;if(!_0x481a48['model']['schema']['checkChild'](_0x2d05c7['markerRange']['start'],'$text'))return;const _0x924a13={'class':'ck-user__marker\x20'+_0x4b77b2['color']['getMarkerClass'](),'style':tt(_0x4b77b2),'data-name':_0x4b77b2['name'],'data-session-id':_0xb95bbf},_0x1747e5=_0x481a48['model']['markers']['get'](_0x2d05c7['markerName'])['getStart'](),_0x16ea43=_0x1747e5['nodeAfter'],_0x2ccbb4=_0x481a48['model']['schema'];if(_0x16ea43&&_0x2ccbb4['isObject'](_0x16ea43)&&_0x2ccbb4['isInline'](_0x16ea43)&&!_0x481a48['model']['markers']['get']('user:range:'+_0xb95bbf)['getRange']()['isCollapsed'])return;const _0x1868d0=_0x1747e5['parent'];return _0x481a48['model']['schema']['isLimit'](_0x1868d0)&&!_0x481a48['model']['hasContent'](_0x1868d0)&&(_0x924a13['contenteditable']=!0x1),function(_0x2d3cec,_0x5887d1,_0x58a9eb){const _0x3c2ed3=_0x2d3cec['createUIElement']('span',_0x5887d1);return _0x2d3cec['setCustomProperty']('userPositionMarker',!0x0,_0x3c2ed3),_0x3c2ed3['render']=function(_0x517fa7){const _0x1fa656=this['toDomElement'](_0x517fa7),_0x4efbb1=document['createElement']('span');return _0x4efbb1['classList']['add']('ck-user__marker-tooltip'),_0x4efbb1['setAttribute']('contenteditable','false'),_0x4efbb1['setAttribute']('spellcheck','false'),_0x4efbb1['textContent']=_0x58a9eb['name'],_0x1fa656['innerHTML']=_0x6e09db('⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x4efbb1['outerHTML']+'⁠'),_0x1fa656['addEventListener']('mouseenter',()=>{_0x1fa656['classList']['add']('ck-user__marker_hovered');}),_0x1fa656['addEventListener']('mouseleave',()=>{_0x1fa656['classList']['remove']('ck-user__marker_hovered');}),_0x1fa656;},_0x3c2ed3['isSimilar']=function(_0x469c5a){return!(!this['getCustomProperty']('userPositionMarker')||!_0x469c5a['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x469c5a['getAttribute']('data-session-id'));},_0x3c2ed3;}(_0x520dd3,_0x924a13,_0x4b77b2);}(_0x48eebb,_0x27dd3b,_0x5c8e60,_0x3569c7)}),_0x3569c7['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4f0f86=>function(_0x4b3e8e,_0x2a8100){const _0x43c7c3=_0x4b3e8e['markerName']['split'](':')[0x2];if(_0x43c7c3===_0x2a8100['mySessionId'])return null;const _0x157894=_0x2a8100['getUserBySessionId'](_0x43c7c3);return _0x157894?{'id':_0x43c7c3,'classes':['ck-user__selection',_0x157894['color']['getSelectionClass']()],'attributes':{'style':tt(_0x157894),'data-session-id':_0x43c7c3},'priority':0x7d0+_0x157894['orderNumber']}:{'id':_0x43c7c3,'classes':[]};}(_0x4f0f86,_0x5c8e60)}),function(_0x7254f7){const _0x16484b=_0x7254f7['model'],_0x20b81e=new Map(),_0x401b03=_0x7254f7['plugins']['get'](Q);_0x16484b['markers']['on']('update:user:range',(_0xe6db49,_0x424325,_0x43172d,_0x83e50c)=>{if(!_0x83e50c&&_0x20b81e['get'](_0x424325['name']))return _0x20b81e['get'](_0x424325['name'])['detach'](),void _0x20b81e['delete'](_0x424325['name']);const _0x37741f=_0x424325['name']['split'](':')[0x2];if(_0x37741f===_0x401b03['mySessionId'])return;const _0x3629c4='user:position:'+_0x37741f;_0x16484b['markers']['has'](_0x3629c4)&&_0x7254f7['editing']['reconvertMarker'](_0x3629c4),_0x424325['on']('change:range',(_0x4e8221,_0x657fcb,_0x41b84e)=>{if('$graveyard'!=_0x657fcb['root']['rootName']&&'$graveyard'==_0x424325['getRange']()['root']['rootName']&&!_0x20b81e['has'](_0x424325['name'])){const _0x4b98d5=_0x16484b['schema']['getNearestSelectionRange'](_0x41b84e['deletionPosition']);if(_0x4b98d5){const _0x2431a7=_0x19479d['fromRange'](_0x4b98d5);_0x20b81e['set'](_0x424325['name'],_0x2431a7),_0x2431a7['on']('change:range',(_0x3dd03d,_0x3e5fd6,_0x3141c2)=>{if('$graveyard'==_0x2431a7['root']['rootName']){const _0x531949=_0x16484b['schema']['getNearestSelectionRange'](_0x3141c2['deletionPosition']);_0x531949?(_0x2431a7['start']=_0x531949['start'],_0x2431a7['end']=_0x531949['end']):(_0x20b81e['delete'](_0x424325['name']),_0x2431a7['detach']());}});}}});}),_0x16484b['document']['on']('change',()=>{_0x20b81e['size']>0x0&&_0x16484b['enqueueChange']({'isUndoable':!0x1},_0x5be7bb=>{for(const [_0x6d148d,_0x5b9732]of _0x20b81e)'$graveyard'==_0x16484b['markers']['get'](_0x6d148d)['getRange']()['root']['rootName']&&(Z(_0x6d148d['split'](':')[0x2],_0x5b9732['toRange'](),_0x16484b,_0x5be7bb),_0x5b9732['detach']());_0x20b81e['clear']();});});}(_0x3569c7),this['_domEmitter']['listenTo'](_0x45a7d1['document'],'keydown',(_0x331c7b,{key:_0x6bc4ed})=>{'Escape'===_0x6bc4ed&&function(_0x37bbc5){_0x37bbc5['editing']['view']['change'](_0xbf8aa6=>{for(const _0x3fcdcd of _0x37bbc5['model']['markers']){if(!_0x3fcdcd['name']['startsWith']('user:position'))continue;const _0x1abb1d=_0x37bbc5['editing']['mapper']['markerNameToElements'](_0x3fcdcd['name']);if(_0x1abb1d){for(const _0x180749 of _0x1abb1d)_0xbf8aa6['removeClass']('ck-user__marker_hovered',_0x180749);}}});}(_0x3569c7);},{'useCapture':!0x0});}afterInit(){const _0x553262=this['editor'],_0x2a6c53=_0x553262['commands']['get']('undo');_0x2a6c53&&_0x553262['model']['on']('applyOperation',(_0x4798a1,_0x16a28a)=>{const _0x37edb6=_0x16a28a[0x0];if(!_0x37edb6['isDocumentOperation'])return;if('marker'!=_0x37edb6['type']||!_0x37edb6['name']['startsWith']('user:'))return;const _0x249515=_0x37edb6['batch'];_0x2a6c53['_createdBatches']['has'](_0x249515)&&(_0x37edb6['newRange']=_0x37edb6['oldRange']?_0x553262['model']['createRange'](_0x37edb6['oldRange']['start'],_0x37edb6['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x3dd466=this['editor'],_0x89a1aa=_0x3dd466['model']['document'],_0x4ada29=_0x3dd466['plugins']['get'](Q);_0x3dd466['model']['enqueueChange']({'isUndoable':!0x1},_0x1af9b0=>{const _0x2a4b4b='user:range:'+_0x4ada29['mySessionId'],_0x4da227='user:position:'+_0x4ada29['mySessionId'],_0x15c586=_0x3dd466['model']['markers']['has'](_0x2a4b4b);_0x3dd466['editing']['view']['hasDomSelection']?Z(_0x4ada29['mySessionId'],_0x89a1aa['selection']['getFirstRange'](),_0x3dd466['model'],_0x1af9b0):_0x15c586&&(_0x1af9b0['removeMarker'](_0x2a4b4b),_0x1af9b0['removeMarker'](_0x4da227));});}};function Z(_0x4e480d,_0x1aa86a,_0x5734c7,_0x347d41){const _0x36b516='user:range:'+_0x4e480d,_0x1adc70='user:position:'+_0x4e480d,_0x4b565a=_0x1aa86a['getContainedElement']();let _0x5ee38b=_0x1aa86a['start'];if(_0x4b565a&&_0x4b565a['is']('element','tableCell')){const _0x3011db=function(_0x4d0d1a,_0x345961){for(const _0x431a2b of _0x4d0d1a['getPositions']())if(_0x345961['schema']['checkChild'](_0x431a2b,'$text'))return _0x431a2b;}(_0x1aa86a,_0x5734c7);_0x3011db&&(_0x5ee38b=_0x3011db,_0x1aa86a=_0x347d41['createRange'](_0x5ee38b));}const _0x52470a=_0x347d41['createRange'](_0x5ee38b);_0x5734c7['markers']['has'](_0x36b516)?(_0x347d41['updateMarker'](_0x36b516,{'range':_0x1aa86a}),_0x347d41['updateMarker'](_0x1adc70,{'range':_0x52470a})):(_0x347d41['addMarker'](_0x36b516,{'range':_0x1aa86a,'usingOperation':!0x0}),_0x347d41['addMarker'](_0x1adc70,{'range':_0x52470a,'usingOperation':!0x0}));}function tt(_0x1fbec5){return'--ck-user-color:'+_0x1fbec5['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x1fbec5['color']['getColorAlphaVariable']()+';';}function et(_0x2406db,_0x29ee03,_0x17be16){const _0x509ab4=_0x2406db['t'],t=_0x2406db['t'];switch(_0x29ee03){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 _0x509ab4({'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'},_0x17be16);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x656eb{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
- ((()=>_0xa3a082)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[J,Q,X,_0x41c0d3,_0x52f463,_0x32fb04];}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 _0xb17a80=this['serverHistory']['getOperations']();for(let _0x323b83=_0xb17a80['length']-0x1;_0x323b83>=0x0;_0x323b83--){const _0x198eee=_0xb17a80[_0x323b83];if(!this['_disconnectionOperations']['has'](_0x198eee))return _0x198eee['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x4f6e94){if(super(_0x4f6e94),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x13a7ed(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x38db3a('collaboration-missing-channelid',this);const _0x2df346=_0x4f6e94['config']['get']('cloudServices.bundleVersion')||_0x1ccdda;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x2df346,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x1a3620(),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 rt(this['_disconnectionOperations']);}init(){const _0x37909b=this['editor'],_0x30ba12=_0x37909b['plugins']['get'](_0x52f463),_0x2aae85=_0x37909b['plugins']['get'](J);this['listenTo'](_0x30ba12,'getOperationAuthor',(_0x7e17ec,_0x6b89cb)=>{const _0x275b50=_0x6b89cb[0x0];_0x275b50['_authorId']&&(_0x7e17ec['return']=_0x30ba12['getUser'](_0x275b50['_authorId']),_0x7e17ec['stop']()),null===_0x275b50['_authorId']&&(_0x7e17ec['return']=null,_0x7e17ec['stop']());},{'priority':'high'}),this['listenTo'](_0x37909b['model']['document']['selection'],'change:range',(_0x357914,_0x1dbeb8)=>{_0x1dbeb8['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x37909b['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x37909b['model']['on']('applyOperation',(_0x5c6157,_0x4ff9fe)=>{const _0x5189e4=_0x4ff9fe[0x0];_0x5189e4['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x5189e4),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x2aae85,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x664315,_0x4ba3ea,_0x23b977)=>'connected'===_0x664315&&!_0x4ba3ea&&!_0x23b977),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x37909b['disableReadOnlyMode']('rtc-offline'):_0x37909b['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x37909b['disableReadOnlyMode']('rtc-offline'):_0x37909b['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x3c8731=this['editor']['plugins']['get'](Q),_0x26f289=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0x3c8731['unregister'](this['_channelId']);const _0x15691c=await this['_service']['reconnect'](_0x26f289['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x15691c)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0xc890ec=await this['_service']['getConnectedSessions']();_0x3c8731['register'](this['_channelId'],_0xc890ec),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x3fdd8b){if(function(_0x547f94){return'404'===_0x547f94['code'];}(_0x3fdd8b)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x285a4d){return'409'===_0x285a4d['code'];}(_0x3fdd8b)){const _0x3201c4=et(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'](_0x3201c4);}else{if(!(_0x3fdd8b instanceof nt))throw _0x3fdd8b;this['_handleReconnectionError']();}}}}destroy(){const _0xd7b3f7=this['editor']['plugins']['get'](J),_0x3bf26b=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x3bf26b['channelSessions']['has'](this['_channelId'])&&_0x3bf26b['unregister'](this['_channelId']),_0xd7b3f7['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x5469ac){if(this['sessionId']!==_0x5469ac['sessionId']&&this['_lastSyncedOperationId']!==_0x5469ac['lastOperationId'])throw new nt();return this['sessionId']=_0x5469ac['sessionId'],this['_handleServerResponse']([],{..._0x5469ac,'wereChangesApplied':!0x1,'data':_0x5469ac['data']},'reconnect');}async _connectService(_0x203ca6,_0x6d92e9=!0x1){const {connection:_0x3d80e1}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x3d80e1,this['_channelId'])['then'](_0xea716f=>this['_initSessionsHandling'](_0xea716f))['catch'](_0x57a34f=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x57a34f);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x14fd48,_0x229a2e)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x229a2e);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x341e11=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x203ca6);this['_isPendingUpdate']=!0x0;const _0x11b6bf=await this['_service']['connect'](_0x3d80e1,this['_compressOperations'](_0x203ca6),_0x341e11);if(this['sessionId']=_0x11b6bf['sessionId'],_0x6d92e9){if(!_0x11b6bf['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x11b6bf['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x203ca6,_0x11b6bf,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x11b6bf,_0x203ca6);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x1441da=this['editor']['plugins']['get'](Q),_0x3e46a0=this['editor']['plugins']['get'](X),_0x29f32c=_0x1441da['channelSessions']['get'](this['_channelId']);_0x29f32c&&_0x29f32c['length']>0x1?_0x3e46a0['createUserMarkerOperations']():this['listenTo'](_0x1441da,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x1441da['channelSessions']['get'](this['_channelId'])['length']&&_0x3e46a0['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x315f34,_0x137c5e,_0x3f8bde,_0x483fc7){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x137c5e){const _0x320e58=this['_decompressOperations'](_0x3f8bde,_0x483fc7);await this['_fetchMissingUsers'](_0x320e58),this['_handleExternalOperations'](_0x320e58,_0x137c5e,_0x3f8bde['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x468b64}=this['editor'];let _0x59c4f1;try{_0x59c4f1=await this['_service']['getDocumentDetails']();}catch{const _0x4edaa2=et(_0x468b64,'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'](_0x4edaa2);}const _0x426bf2=_0x59c4f1['currentDocumentSession']||_0x59c4f1['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x426bf2['lastOperationId']){const _0x1d47f8=et(_0x468b64,'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'](_0x1d47f8);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x1f04e0=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0x1f04e0['connection']||'connected'!==_0x1f04e0['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x370cc5=this['editor']['plugins']['get'](Q);_0x370cc5['channelSessions']['has'](this['_channelId'])&&_0x370cc5['unregister'](this['_channelId']),_0x1f04e0['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x3d2542){const _0x3dcfd0=this['editor']['plugins']['get'](Q);this['listenTo'](_0x3dcfd0,'sessionAdd:'+this['_channelId'],(_0xd550cf,{session:_0x3e01e7})=>{if(_0x3e01e7['id']===_0x3dcfd0['mySessionId']){_0xd550cf['off']();const _0x5b5df4=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x417e19=_0x3e01e7['permissions'];_0x5b5df4&&_0x5b5df4['isEnabled']&&(_0x417e19=_0x417e19['filter'](_0x4e1aed=>'document:write'!==_0x4e1aed)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x417e19,this['_channelId']);}}),_0x3dcfd0['register'](this['_channelId'],_0x3d2542);}_initThrowingOnDataSet(){const _0x21959b=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x30f70d)=>{if(!_0x30f70d[_0x30f70d['length']-0x1]['suppressErrorInCollaboration'])throw new _0x38db3a('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x21959b['apply'](this['editor']['data'],_0x30f70d);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x204968,[_0x56cdbb])=>{if(this['_document']['version'])throw new _0x38db3a('realtimecollaborationclient-init-document-already-initialized',this);_0x204968['stop'](),this['_setPendingAction']();const _0x31859b=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x30cbed])=>!_0x30cbed['lazyLoad'])['map'](([_0x356774,_0x6465ce])=>[_0x356774,_0x6465ce['modelAttributes']||{}])),_0x1b83e0=this['_getOperationsFromInitData'](_0x56cdbb,_0x31859b);0x0==_0x1b83e0['length']&&_0x1b83e0['push'](new _0x1daaae(0x0)),_0x204968['return']=this['_connectService'](_0x1b83e0)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x5749b2=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x5749b2))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x4ca307,[_0x4b08cc,_0x831adb])=>{_0x4ca307['stop']();const _0x556cc9=this['editor']['model']['document']['getRoot'](_0x4b08cc);if(!this['_knownRootNames']['has'](_0x4b08cc)){const _0x43d76f=_0x831adb&&_0x831adb['data']?_0x831adb['data']:'',_0x188f31=_0x831adb&&_0x831adb['attributes']?_0x831adb['attributes']:{};await this['_loadRoot'](_0x4b08cc,_0x43d76f,_0x188f31);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x556cc9['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x556cc9);});},{'priority':'high'});}async _fetchMissingUsers(_0x13d523){const _0x3c4317=this['editor']['plugins']['get'](_0x52f463),{connection:_0xcbf421}=this['editor']['plugins']['get'](J),_0x5e24f1=new Set();for(const _0x102ff4 of _0x13d523){const _0x1f5a74=_0x102ff4['_authorId'];_0x1f5a74&&!_0x3c4317['getUser'](_0x1f5a74)&&_0x5e24f1['add'](_0x1f5a74);}if(0x0===_0x5e24f1['size'])return;const _0x4da6e3=await _0x4be4c6['getMany'](_0xcbf421,Array['from'](_0x5e24f1));for(const _0x1b5ed8 of _0x4da6e3)_0x3c4317['getUser'](_0x1b5ed8['id'])||_0x3c4317['addUser'](_0x1b5ed8);}_getOperationsFromInitData(_0x1981a9,_0x187579={}){const _0xa713c2=this['editor']['model'],_0x262f2e=[];let _0x41c43c=0x0;const _0x1d5f2b='string'==typeof _0x1981a9?{'main':_0x1981a9}:_0x1981a9;for(const _0x253769 of Object['keys'](_0x1d5f2b)){if(!this['_document']['roots']['has'](_0x253769))throw new _0x38db3a('realtimecollaborationclient-init-non-existent-root',this);const _0x490ad0=this['_document']['getRoot'](_0x253769),_0x3d19c9=this['editor']['data']['parse'](_0x1d5f2b[_0x253769],_0x490ad0),_0x23bdc4=new _0x3fa927(_0xa713c2['createPositionAt'](_0x490ad0,0x0),_0x3d19c9,_0x41c43c++);_0x262f2e['push'](_0x23bdc4);for(const [_0x4dd7db,_0x4efb64]of _0x3d19c9['markers']){const _0x2cc4aa=_0xa713c2['createRange'](_0xa713c2['createPositionFromPath'](_0x490ad0,_0x4efb64['start']['path']['slice']()),_0xa713c2['createPositionFromPath'](_0x490ad0,_0x4efb64['end']['path']['slice']())),_0x1055f0=new _0x4523b0(_0x4dd7db,null,_0x2cc4aa,_0xa713c2['markers'],!0x0,_0x41c43c++);_0x262f2e['push'](_0x1055f0);}}if(_0x187579)for(const [_0x449f9a,_0x2b3395]of Object['entries'](_0x187579)){const _0x1a3ae9=_0xa713c2['document']['getRoot'](_0x449f9a);if(!_0x1a3ae9)throw new _0x38db3a('multi-root-editor-root-attributes-no-root',null);for(const [_0x46ad09,_0x108d55]of Object['entries'](_0x2b3395))if(null!==_0x108d55){const _0x1f4ee7=new _0x56775c(_0x1a3ae9,_0x46ad09,null,_0x108d55,_0x41c43c++);_0x262f2e['push'](_0x1f4ee7);}}return _0x262f2e;}async _loadRoot(_0x3340fe,_0x4d7fda,_0x2c2ad7){this['_getOperationsFromInitData']({[_0x3340fe]:_0x4d7fda},{[_0x3340fe]:_0x2c2ad7})['forEach']((_0x40b537,_0x2285f3)=>{_0x40b537['baseVersion']=this['_document']['version']+_0x2285f3,_0x40b537['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x40b537);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x33a015,_0xb7b2c9){let _0x20527b;this['_offset']=_0x33a015['offset'];const _0x3296b0=_0x33a015['wereChangesApplied']&&!_0x33a015['initData'],_0x48aa51=_0x3296b0?0x0:_0x33a015['data']['baseVersion'];if(_0xb7b2c9['forEach'](_0x1e13fd=>{_0x1e13fd['_isInit']=!0x0,_0x1e13fd['createdAt']=_0x33a015['sessionCreatedAt'],_0x1e13fd['_authorId']=null;}),_0x3296b0)_0x20527b=_0xb7b2c9,this['_applyOperationsSet'](_0x20527b,_0x3296b0);else{if(_0x33a015['initData']){const _0x267f49=this['_getOperationsFromInitData'](_0x33a015['initData']);this['_document']['history']['version']=-_0x267f49['length'],_0x267f49['forEach'](_0x112c07=>{_0x112c07['baseVersion']-=_0x267f49['length'],_0x112c07['createdAt']=_0x33a015['sessionCreatedAt'],_0x112c07['_isInit']=!0x0,_0x112c07['_authorId']=null;}),this['_applyOperationsSet'](_0x267f49,!0x0),this['serverHistory']['version']=-_0x267f49['length']+this['_offset'],this['_updateServerHistory'](_0x267f49);}this['_document']['history']['version']=_0x48aa51,_0x20527b=this['_decompressOperations'](_0x33a015['data'],_0x33a015['metadata']),await this['_fetchMissingUsers'](_0x20527b),this['_applyOperationsSet'](_0x20527b,_0x3296b0);}_0x33a015['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x20527b,_0x33a015['lastOperationId']),this['_lastSyncedOperationId']=_0x33a015['lastOperationId']),this['serverHistory']['version']=_0x48aa51+this['_offset'],this['_updateServerHistory'](_0x20527b),_0xb7b2c9['filter'](_0x383975=>{const _0x118754=this['_getAffectedRoot'](_0x383975);return _0x118754&&!this['_knownRootNames']['has'](_0x118754);})['forEach']((_0x1d70be,_0x2e2150)=>{_0x1d70be['baseVersion']=this['_document']['version']+_0x2e2150,this['_saveOperationInBuffer'](_0x1d70be);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x346ce2,_0x294f68){const _0x503179=_0x294f68&&_0x294f68['message'];if(_0x503179&&_0x503179['startsWith']('realtimecollaborationclient'))throw _0x294f68;const _0x57552f=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0x57552f['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x38db3a(_0x346ce2,this['editor'],_0x503179?{'originalError':_0x503179}:void 0x0);}_saveOperationInBuffer(_0x538efc){this['_knownOperations']['has'](_0x538efc)||(this['_knownOperations']['add'](_0x538efc),this['_bufferedOperations']['push'](_0x538efc),this['_pendingAction']||'marker'==_0x538efc['type']&&!_0x538efc['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x25ba0e=!0x1){!_0x25ba0e&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x332bef=>{_0x332bef&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x10f0ad=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3b3ac7){return _0x3b3ac7['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3b3ac7['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3b3ac7['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x10f0ad)||this['_crash'](_0x10f0ad['message'],_0x10f0ad);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x2a22b7=>{this['on']('change:_isPendingUpdate',()=>{_0x2a22b7();});});}async _sendBufferedOperations(){const _0x4a4b75=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0x4a4b75['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x2544c6=[...this['_bufferedOperations']];for(const _0x3ca40b of _0x2544c6)_0x3ca40b['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x3ca40b);const _0x170dd4=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x2544c6),_0x5df008=st++,_0xfe878d=this['_compressOperations'](_0x2544c6),_0x1c4142=await this['_service']['sendOperations'](_0xfe878d,_0xfe878d['baseVersion'],_0x170dd4);try{return await this['_handleServerResponse'](_0x2544c6,_0x1c4142,_0x5df008);}catch(_0x2a1785){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x2a1785);}}async['_handleServerResponse'](_0x227fcd,_0x5f79f4,_0x2d2b99){if('error'in _0x5f79f4)throw _0x5f79f4['error'];let _0x275a50;if(_0x5f79f4['wereChangesApplied']){_0x5f79f4['lastOperationId']&&(this['_lastSyncedOperationId']=_0x5f79f4['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0xbd84b6=>!_0x227fcd['includes'](_0xbd84b6));for(const _0x4b8b93 of _0x227fcd)_0x4b8b93['createdAt']='lastOperationAcceptedAt'in _0x5f79f4&&_0x5f79f4['lastOperationAcceptedAt']||void 0x0;ot(_0x227fcd,_0x5f79f4['version']-_0x227fcd['length']),this['_updateServerHistory'](_0x227fcd);const _0x286f52=_0x227fcd['filter'](_0x1a1b19=>{if(!_0x1a1b19['_isInit'])return!0x1;const _0xa5721=this['_getAffectedRoot'](_0x1a1b19);return _0xa5721&&!this['_knownRootNames']['has'](_0xa5721);});ot(_0x286f52,this['_document']['version']),this['_applyOperationsSet'](_0x286f52),_0x275a50=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x2d1e0a=this['_decompressOperations'](_0x5f79f4['data'],_0x5f79f4['metadata'])['filter'](_0x14d7b0=>_0x14d7b0['baseVersion']>=this['_lastServerVersion']);_0x2d1e0a['forEach'](_0x10ce11=>this['_addKnownRoot'](_0x10ce11)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x2392ec=>!_0x2392ec['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x2392ec))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x2d1e0a),_0x275a50=this['_handleExternalOperations'](_0x2d1e0a,_0x5f79f4['version'],_0x5f79f4['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x275a50?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x1c3f91,_0x31a08a,_0x1044f6){try{const _0x598c1b={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x29a9dc,operationsB:_0x5606d8,originalOperations:_0x5f3252}=_0x9f7926(_0x1c3f91,this['_bufferedOperations'],_0x598c1b);ot(_0x29a9dc,this['_document']['version']),ot(_0x5606d8,_0x31a08a);for(const _0x1e97ac of _0x29a9dc){const _0x20d8d0=_0x5f3252['get'](_0x1e97ac);_0x20d8d0?(_0x1e97ac['_authorId']=_0x20d8d0['_authorId'],'noop'!==_0x1e97ac['type']&&(_0x1e97ac['_aiSource']=_0x20d8d0['_aiSource'])):_0x1e97ac['_authorId']=null;}for(const _0x2426d7 of _0x5606d8)'noop'!==_0x2426d7['type']&&(_0x2426d7['_aiSource']=_0x5f3252['get'](_0x2426d7)?.['_aiSource']);_0x1044f6&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1c3f91,_0x1044f6),this['_lastSyncedOperationId']=_0x1044f6),this['_bufferedOperations']=[..._0x5606d8],this['_applyOperationsSet'](_0x29a9dc),this['_updateServerHistory'](_0x1c3f91);}catch(_0x1dcfaa){return console['error'](_0x1dcfaa),!0x1;}return!0x0;}_applyOperationsSet(_0x34d447,_0x331e88=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x2aee36=>{for(const _0x50d838 of _0x34d447)this['_knownOperations']['add'](_0x50d838),this['_addKnownRoot'](_0x50d838),_0x2aee36['batch']['addOperation'](_0x50d838),this['editor']['model']['applyOperation'](_0x50d838);});}_addKnownRoot(_0x2a4766){const _0x68424=this['_getAffectedRoot'](_0x2a4766);_0x68424&&this['_knownRootNames']['add'](_0x68424);}_getAffectedRoot(_0x7289ce){let _0x4f5d51,_0x4a8e01;switch(_0x7289ce['type']){case'insert':_0x4f5d51=_0x7289ce['position']['root'];break;case'marker':if(_0x4a8e01=_0x7289ce['newRange'],!_0x4a8e01)return null;_0x4f5d51=_0x4a8e01['root'];break;case'addRootAttribute':_0x4f5d51=_0x7289ce['root'];break;case'addRoot':_0x4f5d51=_0x7289ce['affectedSelectable'];break;case'move':_0x4f5d51=_0x7289ce['targetPosition']['root'];break;default:return null;}return _0x4f5d51['rootName'];}_updateServerHistory(_0x17b010){_0x17b010['forEach'](_0x5a0314=>{const _0xac95ed=_0x5a0314['clone']();_0xac95ed['_authorId']=_0x5a0314['_authorId'],_0xac95ed['_isInit']=!!_0x5a0314['_isInit'],_0xac95ed['_aiSource']=_0x5a0314['_aiSource'],_0xac95ed['createdAt']=_0x5a0314['createdAt'],_0xac95ed['baseVersion']+=this['_offset'],_0x5a0314['_isDisconnection']&&this['_disconnectionOperations']['add'](_0xac95ed),this['serverHistory']['addOperation'](_0xac95ed);});}_handleReconnectionError(_0x277b3c){const _0x528bd4=this['editor']['plugins']['get']('Notification'),_0x4504de=this['editor']['locale'];_0x277b3c||(_0x277b3c=et(_0x4504de,'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.')),_0x528bd4['showWarning'](_0x277b3c,{'title':et(_0x4504de,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](J)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x41c0d3)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x41c0d3)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x3aa4e8){const _0x37e115=_0x3aa4e8['map'](_0x5a5bed=>_0x5a5bed['toJSON']());return this['_compressor']['compress'](_0x37e115);}_decompressOperations(_0x87fde2,_0xa05f6b){return this['_compressor']['decompress'](_0x87fde2)['map']((_0x5199f8,_0x4c8f94)=>{const _0x2c1a60='init'==_0xa05f6b[_0x4c8f94]['type'];if('InsertOperation'==_0x5199f8['__className']){const _0x8b44a4=_0x5199f8['position']['root'];!this['_document']['getRoot'](_0x8b44a4)&&(this['_document']['createRoot']('$unknown',_0x8b44a4)['_isAttached']=!0x1);}else{if('RootOperation'==_0x5199f8['__className']){const _0x593ac9=this['_document']['getRoot'](_0x5199f8['rootName']);_0x593ac9&&'$unknown'==_0x593ac9['name']&&_0x5199f8['elementName']!=_0x593ac9['name']&&(_0x593ac9['name']=_0x5199f8['elementName']);}}const _0x1c04ba=_0x13b377['fromJSON'](_0x5199f8,this['_document']);return _0x1c04ba['wasUndone']=_0x5199f8['wasUndone'],_0x1c04ba['_isInit']=_0x2c1a60,_0x1c04ba['_authorId']=_0x2c1a60?null:_0xa05f6b[_0x4c8f94]['userId'],_0x1c04ba['_isDisconnection']='cs:removeUser'===_0xa05f6b[_0x4c8f94]['type'],_0x1c04ba['_aiSource']=_0x5199f8['_aiSource']||void 0x0,_0x1c04ba['createdAt']=_0xa05f6b[_0x4c8f94]['createdAt'],_0x1c04ba;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x25fb8e=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x25fb8e&&_0x25fb8e['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x1f33c8,_0x1386ea){for(const _0x3558d2 of _0x1f33c8)_0x3558d2['baseVersion']=_0x1386ea++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0x4c06dc){this['_ignoredOperations']=_0x4c06dc,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x2163db){let _0x2a0af6=_0x2163db['length'];for(;_0x2a0af6--;){const _0x2c676a=_0x2163db[_0x2a0af6];if(!this['_ignoredOperations']['has'](_0x2c676a)){if(!this['_operationToId']['has'](_0x2c676a)){const _0x1a4277=_0x501ece()['slice'](0x1,0x12);this['_operationToId']['set'](_0x2c676a,_0x1a4277);}return this['_operationToId']['get'](_0x2c676a);}}}setIdForTheLastOperation(_0x3c9fdf,_0xa19ccb){if(!_0xa19ccb)return;let _0x211105=_0x3c9fdf['length'];for(;_0x211105--;){const _0x3929c5=_0x3c9fdf[_0x211105];this['_ignoredOperations']['has'](_0x3929c5)||this['_operationToId']['set'](_0x3929c5,_0xa19ccb);}}},ct=class extends _0x656eb{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x2ea2c1{static CommentsService=/* #__PURE__ -- @preserve */
26
- ((()=>_0x2936da)());['_services'];static get requires(){return[J,_0x8fe529,Q,_0x52f463];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x852d0a){super(_0x852d0a),this['_services']=new Map();}async init(){const _0x5d3e77=this['context'],_0x54375c=_0x5d3e77['plugins']['get'](_0x8fe529);if(_0x5d3e77['plugins']['get'](J)['addToReconnectionStack'](this),_0x54375c['adapter']={'addCommentThread':async({channelId:_0x3da0d4,threadId:_0x196818,comments:_0x37daaa,resolvedAt:_0x4d99ac,resolvedBy:_0x858b43,context:_0x24cdad,attributes:_0x241a3c})=>{const _0x4bc981=await this['_getService'](_0x3da0d4)['addCommentThread']({'commentThreadId':_0x196818,'comments':_0x37daaa['map'](_0x367b0b=>function(_0x245b7e,_0xf8ea5,_0x3b1751){return{'commentThreadId':_0x3b1751,'commentId':_0x245b7e['commentId'],'userId':_0x245b7e['authorId'],'content':_0x245b7e['content'],'documentId':_0xf8ea5,'createdAt':_0x245b7e['createdAt'],'attributes':_0x245b7e['attributes']||{}};}(_0x367b0b,_0x3da0d4,_0x196818)),'resolvedAt':_0x4d99ac,'resolvedBy':_0x858b43,'context':_0x24cdad,'attributes':_0x241a3c})['catch'](lt);return{'threadId':_0x4bc981['commentThreadId'],'comments':_0x4bc981['comments']};},'getCommentThread':async({channelId:_0x436aeb,threadId:_0x11d29d})=>{const _0x27768e=await this['_getService'](_0x436aeb)['getCommentThread'](_0x11d29d)['catch'](ht)['catch'](lt);return _0x27768e?_0x27768e['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x27768e]),{'threadId':_0x27768e['commentThreadId'],'comments':_0x27768e['comments']['map'](dt),'context':_0x27768e['context'],'resolvedAt':_0x27768e['resolvedAt'],'resolvedBy':_0x27768e['resolvedBy'],'attributes':_0x27768e['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x1a4f0a,threadId:_0x2f1f2e,context:_0x173805,unlinkedAt:_0x124443,attributes:_0x5acf3a})=>this['_getService'](_0x1a4f0a)['updateCommentThread']({'commentThreadId':_0x2f1f2e,'context':_0x173805,'attributes':_0x5acf3a,'unlinkedAt':_0x124443})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x1ea8d2,threadId:_0x4d6c0c})=>{const _0xedfa4b=await this['_getService'](_0x1ea8d2)['resolveCommentThread'](_0x4d6c0c)['catch'](ht)['catch'](lt);return{'threadId':_0xedfa4b['commentThreadId'],'resolvedAt':_0xedfa4b['resolvedAt'],'resolvedBy':_0xedfa4b['resolvedBy']};},'reopenCommentThread':async({channelId:_0x59b3db,threadId:_0x24169a})=>this['_getService'](_0x59b3db)['reopenCommentThread'](_0x24169a)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x307139,threadId:_0x601e9})=>this['_getService'](_0x307139)['removeCommentThread'](_0x601e9)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x43da61,threadId:_0x9a19f5,commentId:_0xadb6ea,content:_0x113fd3,attributes:_0x82bea0})=>this['_getService'](_0x43da61)['addComment'](_0x9a19f5,_0xadb6ea,_0x113fd3,_0x82bea0)['catch'](lt),'updateComment':({channelId:_0x4362fe,threadId:_0x48dbd5,commentId:_0x5504c1,content:_0x48399e,attributes:_0x8ef200})=>this['_getService'](_0x4362fe)['updateComment'](_0x48dbd5,_0x5504c1,_0x48399e,_0x8ef200)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x350a8f,threadId:_0x1d829c,commentId:_0x41c628})=>this['_getService'](_0x350a8f)['removeComment'](_0x1d829c,_0x41c628)['catch'](ht)['catch'](lt)},_0x5d3e77 instanceof _0x11e827){const _0x17699f=_0x5d3e77['config']['get']('collaboration.channelId'),_0x515b38=_0x5d3e77['plugins']['get'](Q);await this['_setUpService'](_0x17699f);const _0x2636e1=await this['_services']['get'](_0x17699f)['getConnectedSessions']();this['listenTo'](_0x515b38,'sessionAdd:'+_0x17699f,(_0x30687d,{session:_0x39c84e})=>{_0x39c84e['id']===_0x515b38['mySessionId']&&(_0x30687d['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x39c84e['permissions'],_0x17699f));}),_0x515b38['register'](_0x17699f,_0x2636e1);}}async _setUpService(_0x3e36ae){if(this['_services']['has'](_0x3e36ae))throw new _0x38db3a('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x3e36ae});const _0x54f0da=this['context']['plugins']['get'](_0x8fe529),_0x5e46c9=new CloudServicesCommentsAdapter['CommentsService'](_0x3e36ae);this['_services']['set'](_0x3e36ae,_0x5e46c9),this['listenTo'](_0x5e46c9,'commentThreadAdded',(_0x4806b3,_0x5aeda7)=>{const {commentThreadId:_0x4073ed,documentId:_0x9bef3f,context:_0x563e44,attributes:_0x4a87c8,resolvedAt:_0x37372e,resolvedBy:_0x502a04,comments:_0x59bb7c}=_0x5aeda7;_0x54f0da['getCommentThread'](_0x4073ed)||_0x54f0da['addCommentThread']({'threadId':_0x4073ed,'channelId':_0x9bef3f,'comments':_0x59bb7c?_0x59bb7c['map'](dt):[],'context':_0x563e44,'attributes':_0x4a87c8,'resolvedAt':_0x37372e,'resolvedBy':_0x502a04,'isFromAdapter':!0x0});}),this['listenTo'](_0x5e46c9,'commentThreadUpdated',(_0x94d61b,{commentThreadId:_0x30355c,documentId:_0x5b400e,context:_0x581320,unlinkedAt:_0x173575,attributes:_0x2a2c71})=>{_0x54f0da['getCommentThread'](_0x30355c)&&_0x54f0da['updateCommentThread']({'threadId':_0x30355c,'channelId':_0x5b400e,'context':_0x581320,'unlinkedAt':_0x173575,'attributes':_0x2a2c71,'isFromAdapter':!0x0});}),this['listenTo'](_0x5e46c9,'commentThreadResolved',(_0x6938bf,{commentThreadId:_0x3ef5bd,resolvedBy:_0x1e0919,resolvedAt:_0x342d51})=>{const _0x769b2c=_0x54f0da['getCommentThread'](_0x3ef5bd);_0x769b2c&&_0x769b2c['resolve']({'resolvedBy':_0x1e0919,'resolvedAt':_0x342d51,'isFromAdapter':!0x0});}),this['listenTo'](_0x5e46c9,'commentThreadReopened',(_0x437622,{commentThreadId:_0x18a6e8})=>{const _0x392d2d=_0x54f0da['getCommentThread'](_0x18a6e8);_0x392d2d&&_0x392d2d['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5e46c9,'commentThreadRemoved',(_0x4f7de8,{commentThreadId:_0x33f143})=>{const _0x97ae34=_0x54f0da['getCommentThread'](_0x33f143);_0x97ae34&&_0x97ae34['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x5e46c9,'commentAdded',(_0x7e85ad,_0x5cd6d6)=>{const _0x42c1e0=_0x5cd6d6['commentThreadId'],_0x55dd94=_0x54f0da['getCommentThread'](_0x42c1e0);_0x55dd94&&_0x55dd94['addComment']({...dt(_0x5cd6d6),'isFromAdapter':!0x0});}),this['listenTo'](_0x5e46c9,'commentUpdated',(_0x2d7797,{commentThreadId:_0x18ce12,commentId:_0x33a73f,content:_0x279496,attributes:_0x2c69e9})=>{const _0x27ce43=_0x54f0da['getCommentThread'](_0x18ce12);if(_0x27ce43){const _0x4ec0b1=_0x27ce43['getComment'](_0x33a73f);_0x4ec0b1&&_0x4ec0b1['update']({'content':_0x279496,'attributes':_0x2c69e9,'isFromAdapter':!0x0});}}),this['listenTo'](_0x5e46c9,'commentRemoved',(_0x246652,{commentThreadId:_0x4f7f05,commentId:_0x3aed59})=>{const _0xfaa42e=_0x54f0da['getCommentThread'](_0x4f7f05);if(_0xfaa42e){const _0x2a6bbf=_0xfaa42e['getComment'](_0x3aed59);_0x2a6bbf&&_0x2a6bbf['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x5e46c9,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0x3e36ae),this['stopListening'](_0x5e46c9));}),await this['_connectService'](_0x3e36ae);}destroy(){if(this['context']instanceof _0x11e827){const _0x4fdc8b=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x4fdc8b)&&this['_terminateService'](_0x4fdc8b);}}_terminateService(_0x4afba8){if(!this['_services']['has'](_0x4afba8))throw new _0x38db3a('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x4afba8});this['_getService'](_0x4afba8)['disconnect'](),this['_services']['delete'](_0x4afba8);}async reconnect(){for(const _0x3207ee of this['_services']['keys']())await this['_connectService'](_0x3207ee);if(this['context']instanceof _0x11e827){const _0x59a2d4=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x59a2d4)){const _0x5e3da3=this['context']['plugins']['get'](Q);_0x5e3da3['unregister'](_0x59a2d4);const _0x5af9cb=await this['_services']['get'](_0x59a2d4)['getConnectedSessions']();_0x5e3da3['register'](_0x59a2d4,_0x5af9cb);}}}async _connectService(_0x205f9e){const {connection:_0x4b13cd}=this['context']['plugins']['get'](J),_0x21fed0=this['context']['plugins']['get'](_0x8fe529),_0xcf56e0=await this['_services']['get'](_0x205f9e)['connect'](_0x4b13cd);await this['_fetchMissingUsersForThreads'](_0xcf56e0);const _0x4ec603=new Set(Array['from'](_0x21fed0['getCommentThreads']({'channelId':_0x205f9e}),_0x5995a2=>_0x5995a2['id']));for(const _0x5e5027 of _0xcf56e0)_0x5e5027['deletedAt']||_0x4ec603['delete'](_0x5e5027['commentThreadId']);for(const _0x1b22c2 of _0x4ec603)_0x21fed0['getCommentThread'](_0x1b22c2)['remove']({'isFromAdapter':!0x0});for(const _0x22e03a of _0xcf56e0){let _0x20f653=_0x21fed0['getCommentThread'](_0x22e03a['commentThreadId']);const {commentThreadId:_0x4b570e,context:_0x938064,attributes:_0x253992,resolvedBy:_0x279f89,resolvedAt:_0x86fdec,unlinkedAt:_0x3850ec,deletedAt:_0x2d91e5}=_0x22e03a;if(_0x2d91e5)continue;_0x20f653||(_0x20f653=_0x21fed0['addCommentThread']({'channelId':_0x205f9e,'threadId':_0x4b570e,'context':_0x938064,'attributes':_0x253992||{},'resolvedBy':_0x279f89,'resolvedAt':_0x86fdec,'unlinkedAt':_0x3850ec,'isFromAdapter':!0x0}));const _0xd9ebc4=new Set(Array['from'](_0x20f653['comments'],_0x36dd7f=>_0x36dd7f['id']));for(const _0x4da3f9 of _0x22e03a['comments'])_0xd9ebc4['delete'](_0x4da3f9['commentId']);for(const _0x3b96f3 of _0xd9ebc4)_0x20f653['getComment'](_0x3b96f3)['remove']({'isFromAdapter':!0x0});for(const _0x4d44db of _0x22e03a['comments']){const _0x3debab=_0x20f653['getComment'](_0x4d44db['commentId']);_0x3debab?_0x3debab['content']!==_0x4d44db['content']&&_0x3debab['update']({'content':_0x4d44db['content'],'isFromAdapter':!0x0}):_0x20f653['addComment'](Object['assign'](dt(_0x4d44db),{'isFromAdapter':!0x0}));}}}_getService(_0x443599){if(!this['_services']['has'](_0x443599))throw new _0x38db3a('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x443599});return this['_services']['get'](_0x443599);}async _fetchMissingUsersForThreads(_0x304ef8){const _0x4fdc09=this['context']['plugins']['get'](_0x52f463),{connection:_0x52e21f}=this['context']['plugins']['get'](J),_0x47b7c9=new Set();for(const {resolvedBy:_0x372f1e,comments:_0x241d2c}of _0x304ef8){_0x372f1e&&!_0x4fdc09['getUser'](_0x372f1e)&&_0x47b7c9['add'](_0x372f1e);for(const {userId:_0x4d3ddd}of _0x241d2c)_0x4fdc09['getUser'](_0x4d3ddd)||_0x47b7c9['add'](_0x4d3ddd);}if(0x0===_0x47b7c9['size'])return;const _0xe9210=await _0x4be4c6['getMany'](_0x52e21f,Array['from'](_0x47b7c9));for(const _0x2e25d2 of _0xe9210)_0x4fdc09['getUser'](_0x2e25d2['id'])||_0x4fdc09['addUser'](_0x2e25d2);}};async function ht(_0x20393d){if('404'!==_0x20393d['code'])throw _0x20393d;}function lt(_0x374564){if((_0x14c38f=_0x374564)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x14c38f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x14c38f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x14c38f;throw _0x374564;}function dt(_0x355908){return{'threadId':_0x355908['commentThreadId'],'commentId':_0x355908['commentId'],'content':_0x355908['content'],'createdAt':_0x355908['createdAt'],'authorId':_0x355908['userId'],'attributes':_0x355908['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x656eb{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x291e29)());_bufferedRequests;_trackChangesService;static get requires(){return[at,_0x5457f9,J];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3af080){super(_0x3af080);const _0x405586=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x405586);}init(){const _0x3e36b0=this['editor']['plugins']['get'](J),_0x46aa26=this['editor']['plugins']['get'](_0x5457f9);return _0x46aa26['adapter']={'getSuggestion':async _0x3c42a0=>{await this['_waitForServiceReady']();const _0x3967d9=await this['_trackChangesService']['get'](_0x3c42a0)['catch'](ft);return await this['_fetchMissingUsersForThreads']([_0x3967d9]),_0x3967d9;},'addSuggestion':async({id:_0x1fb6fc,type:_0x5e459c,data:_0x5d448f,originalSuggestionId:_0x11c0b0,attributes:_0x2b2f6d})=>{await this['_waitForServiceReady']();const _0x7c3004={'id':_0x1fb6fc,'type':_0x5e459c,'data':_0x5d448f,'originalSuggestionId':_0x11c0b0,'attributes':_0x2b2f6d},_0x314710=await this['_trackChangesService']['add'](_0x1fb6fc,_0x5e459c,_0x5d448f,_0x11c0b0,_0x2b2f6d)['catch'](_0x64cab4=>{if(mt(_0x64cab4))return new Promise(_0x2de110=>{this['_bufferedRequests']['set'](_0x1fb6fc,{'resolve':_0x2de110,'suggestionData':_0x7c3004});});throw _0x64cab4;});return this['_bufferedRequests']['delete'](_0x1fb6fc),_0x314710;},'updateSuggestion':async(_0x51a319,_0x3efed3)=>{if(await this['_waitForServiceReady'](),'open'!==_0x3efed3['state'])return this['_trackChangesService']['update'](_0x51a319,_0x3efed3)['catch'](ft);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x860fbb,_0x192473)=>{_0x46aa26['hasSuggestion'](_0x192473['id'])&&(_0x46aa26['getSuggestion'](_0x192473['id'])['attributes']=_0x192473['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x3e36b0['connection']?.['state']&&(_0x3e36b0['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x3e36b0['connection'])['then'](_0x54673b=>(_0x3e36b0['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x54673b)['then'](()=>{for(const _0x481b7e of _0x54673b){_0x46aa26['addSuggestionData'](_0x481b7e)['_saved']=!0x0;}})));}async reconnect(){const _0x2ce1be=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x1b1ee0}=this['editor']['plugins']['get'](J),_0x24d08d=await this['_trackChangesService']['connect'](_0x1b1ee0);await this['_fetchMissingUsersForThreads'](_0x24d08d);for(const {suggestionData:_0x5e2c25,resolve:_0x1a34fb}of this['_bufferedRequests']['values']()){let _0x29e7b0=_0x24d08d['find'](_0x101d91=>_0x101d91['id']===_0x5e2c25['id']);_0x29e7b0||(_0x29e7b0=await this['_trackChangesService']['add'](_0x5e2c25['id'],_0x5e2c25['type'],_0x5e2c25['data'],_0x5e2c25['originalSuggestionId'])),_0x1a34fb(_0x29e7b0);}for(const _0x1327d2 of _0x24d08d)_0x2ce1be['hasSuggestion'](_0x1327d2['id'])||_0x2ce1be['addSuggestionData'](_0x1327d2);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x23d3c9=>{this['listenTo'](this['_trackChangesService'],'connected',_0x26b973=>{_0x26b973['off'](),_0x23d3c9();});});}async _fetchMissingUsersForThreads(_0x3f1dab){const _0x149fef=this['editor']['plugins']['get'](_0x52f463),{connection:_0x4b6b0b}=this['editor']['plugins']['get'](J),_0x3a653d=new Set();for(const {authorId:_0x12b26c}of _0x3f1dab)_0x149fef['getUser'](_0x12b26c)||_0x3a653d['add'](_0x12b26c);if(0x0===_0x3a653d['size'])return;const _0x5188e0=await _0x4be4c6['getMany'](_0x4b6b0b,Array['from'](_0x3a653d));for(const _0x4f90a5 of _0x5188e0)_0x149fef['getUser'](_0x4f90a5['id'])||_0x149fef['addUser'](_0x4f90a5);}};function ft(_0x29f095){if(mt(_0x29f095))return new Promise(()=>{});throw _0x29f095;}function mt(_0x64b863){return _0x64b863['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x64b863['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var pt=class extends _0x656eb{static get requires(){return[_0x4aa167,at,ct,J];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x1400cf=this['editor']['plugins']['get'](J),_0x42d3b1=this['editor']['plugins']['get'](_0x3ac6ed),_0x4c0fee=this['editor']['plugins']['get'](at);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x1400cf,'change:state',(_0x59b270,_0x10fb36,_0x547d90)=>{_0x42d3b1['isThreadsLoadingPaused']='connected'!==_0x547d90;});}),this['listenTo'](_0x1400cf,'change:state',(_0x405b0a,_0x1ab341,_0x3f1260)=>{this['editor']['plugins']['get'](_0x8fe529)['switchReadOnly']('connected'!==_0x3f1260);}),_0x4c0fee['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x406883=this['editor']['plugins']['get'](at),_0xc36711=this['editor']['config']['get']('collaboration.channelId');_0x406883['_services']['has'](_0xc36711)&&_0x406883['_terminateService'](_0xc36711),super['destroy']();}},gt=class extends _0x656eb{static get requires(){return[pt,ut,_0x17f480];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class CloudServicesRevisionHistoryAdapter extends _0x656eb{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
- ((()=>_0x339e16)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0x2e230e,Q,_0x52f463];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x12a39f){super(_0x12a39f);const _0x621349=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x621349);}async init(){const _0x44913f=this['editor']['plugins']['get'](it),_0x290293=_0x44913f['serverHistory'],_0x35dc26=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x290293,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x44913f['sessionId']});const _0x5601cc=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x1ccdda,_0x4f71b2=await _0x53555b['isBundleUploaded'](_0x35dc26['connection'],_0x5601cc);this['editor']['plugins']['get'](_0x2e230e)['adapter']={'getRevision':async({revisionId:_0x386d62})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x386d62)),'updateRevisions':async _0x3f30c4=>{await this['_waitForServiceReady']();const _0x16b211=this['_revisionTracker']['currentRevision'];if(_0x4f71b2&&0x1===_0x3f30c4['length']&&_0x3f30c4[0x0]['id']===_0x16b211['id'])return _0x3f30c4;for(const _0x187d30 of _0x3f30c4)_0x187d30['id']===_0x16b211['id']&&(_0x187d30['isEmptyCurrent']=_0x187d30['fromVersion']===_0x187d30['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x3f30c4,this['_lastRequestId'])['then'](_0x437651=>(this['_lastRequestId']=_0x437651,_0x3f30c4))['catch'](_0x2911d0=>{if(vt(_0x2911d0)||'400'===_0x2911d0['code']&&void 0x0!==_0x2911d0['data']['wrongRequestId']){for(const _0x23e0da of _0x3f30c4)this['_revisionTracker']['repository']['getRevision'](_0x23e0da['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x23e0da['id'],_0x23e0da,!0x1);if(vt(_0x2911d0)&&'destroyed'!==this['editor']['state'])throw _0x2911d0;return _0x3f30c4;}throw _0x2911d0;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x4d2d0c,{revisionsData:_0x188a4b,requestId:_0x3ffe28})=>{Math['max'](..._0x188a4b['map'](_0x568b94=>_0x568b94['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x188a4b,_0x3ffe28);}):this['_handleRevisionsUpdate'](_0x188a4b,_0x3ffe28);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x35dc26['connection']?.['state']&&(_0x35dc26['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x2b3d79,requestId:_0xa0a202}=await this['_revisionHistoryService']['connect'](_0x35dc26['connection']);_0x35dc26['addToReconnectionStack'](this),this['_lastRequestId']=_0xa0a202,await this['_fetchMissingUsers'](_0x2b3d79);for(const _0x27704f of _0x2b3d79)this['_revisionTracker']['addRevisionData'](_0x27704f);this['listenTo'](_0x44913f,'change:_isConnected',(_0x4cb4b4,_0x378a81,_0x15715f)=>{_0x15715f&&(this['_oldOffset']=_0x44913f['_offset'],_0x4cb4b4['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x55c188=this['editor']['plugins']['get'](J),_0x47a497=this['editor']['plugins']['get'](it),_0x1359be=async()=>{const _0x2485c1=this['_revisionTracker']['currentRevision'],_0xb5cebd=_0x2485c1['id'],_0x1cdd87=_0xb5cebd!==_0x47a497['sessionId'];if(_0x1cdd87){const _0x4b1d21=_0x47a497['_offset']-this['_oldOffset'],_0x334eed=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x2485c1['toVersion']+_0x4b1d21!==_0x334eed){const _0x400538=_0x2485c1['fromVersion']+_0x4b1d21,_0x24674e=this['editor']['plugins']['get'](_0x52f463),_0xea68d4=this['_revisionTracker']['buildRevisionData']({'revision':_0x2485c1,'from':_0x400538,'to':_0x334eed});_0xea68d4['id']=_0x2485c1['id'];const _0x4ffae3=_0xea68d4['authorsIds']['map'](_0x52dd47=>_0x24674e['getUser'](_0x52dd47));_0x2485c1['_update']({..._0xea68d4,'authors':_0x4ffae3},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x2485c1['id'],_0xea68d4,!0x0);}this['_revisionTracker']['_startingVersion']=_0x334eed,_0x2485c1['toVersion']!==_0x2485c1['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0xb5cebd)||this['_revisionTracker']['repository']['_revisions']['remove'](_0xb5cebd),this['_revisionTracker']['_createCurrentRevision'](_0x334eed);}const {revisions:_0x298835,requestId:_0x2a22b2}=await this['_revisionHistoryService']['reconnect'](_0x55c188['connection'],this['_lastRequestId']);_0x1cdd87&&_0x298835['length']>0x0?_0x47a497['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x298835),this['_handleRevisionsUpdate'](_0x298835,_0x2a22b2),this['_revisionTracker']['sendBufferedUpdates']());};return _0x47a497['_isConnected']?_0x1359be():new Promise((_0x48c7d4,_0x398ee1)=>{_0x47a497['once']('change:_isConnected',()=>{_0x1359be()['then'](_0x48c7d4)['catch'](_0x398ee1);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5527d0=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x1e3db5=>{_0x1e3db5['off'](),_0x5527d0();});});}_getLatestVersionFromServerOperations(){const _0xc7dd5f=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0x1ba724 of _0xc7dd5f)if('marker'!==_0x1ba724['type']||_0x1ba724['affectsData'])return _0x1ba724['baseVersion']+0x1;}_getLatestVersion(){const _0x1287b6=this['editor']['plugins']['get'](it);return new Promise(_0x3913f8=>{_0x1287b6['_isPendingUpdate']?_0x1287b6['once']('change:_isPendingUpdate',()=>{_0x3913f8(this['_getLatestVersionFromServerOperations']());}):_0x3913f8(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x213a00,_0x16f57d){const _0x21967e=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x16f57d;for(const _0x5d5de8 of _0x213a00){const _0x2884ba=_0x21967e['getRevision'](_0x5d5de8['id']);if(_0x2884ba){if((_0x5d5de8['fromVersion']||_0x5d5de8['toVersion'])&&(_0x5d5de8['diffData']=null),_0x2884ba===this['_revisionTracker']['currentRevision']){const _0x32276e=Math['max'](_0x2884ba['toVersion'],_0x5d5de8['toVersion']),_0x21ed9a=Math['max'](_0x2884ba['fromVersion'],_0x5d5de8['fromVersion']);let _0x158d1a;_0x2884ba['toVersion']===_0x5d5de8['toVersion']&&_0x2884ba['fromVersion']===_0x5d5de8['fromVersion']?(_0x158d1a=!0x0,this['_preventResendingRevisionData'](_0x5d5de8)):_0x5d5de8['toVersion']===_0x32276e&&_0x5d5de8['fromVersion']===_0x21ed9a?_0x158d1a=!0x1:(_0x2884ba['toVersion']===_0x32276e&&_0x2884ba['fromVersion']===_0x21ed9a||this['_fixRevision']({'revision':_0x2884ba,'from':_0x21ed9a,'to':_0x32276e}),_0x158d1a=!0x0),_0x158d1a&&(delete _0x5d5de8['fromVersion'],delete _0x5d5de8['toVersion'],delete _0x5d5de8['diffData'],delete _0x5d5de8['createdAt'],delete _0x5d5de8['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x5d5de8),this['_preventResendingRevisionData'](_0x5d5de8);}else this['_revisionTracker']['addRevisionData'](_0x5d5de8);}const _0x8935f3=_0x21967e['getRevisions']();_0x8935f3['reverse']();for(let _0x476b40=0x0;_0x476b40<_0x8935f3['length']-0x1;_0x476b40++){const _0x45c2aa=_0x8935f3[_0x476b40],_0x674f32=_0x8935f3[_0x476b40+0x1];if(_0x45c2aa['fromVersion']<_0x674f32['toVersion']){const _0x1b5b7c=_0x674f32['toVersion'],_0x4e0df1=Math['max'](_0x1b5b7c,_0x45c2aa['toVersion']);this['_fixRevision']({'revision':_0x45c2aa,'from':_0x1b5b7c,'to':_0x4e0df1});}}}['_fixRevision']({revision:_0x3d0c34,from:_0x358eba,to:_0x25b365}={}){const _0x58ed3d=this['editor']['plugins']['get'](_0x52f463),_0x127ee4=this['_revisionTracker']['buildRevisionData']({'revision':_0x3d0c34,'from':_0x358eba,'to':_0x25b365});_0x127ee4['authors']=_0x127ee4['authorsIds']['map'](_0x3db010=>_0x58ed3d['getUser'](_0x3db010)),_0x3d0c34['_update'](_0x127ee4);}_preventResendingRevisionData(_0x472c69){const _0x24a9ae={};_0x24a9ae['id']=_0x472c69['id'];for(const _0x1ba158 of Object['keys'](_0x472c69))'id'!==_0x1ba158&&(_0x24a9ae[_0x1ba158]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x24a9ae['id'],_0x24a9ae,!0x0);}async _fetchMissingUsers(_0x3b4d68){const _0x16f647=this['editor']['plugins']['get'](_0x52f463),{connection:_0x2d462b}=this['editor']['plugins']['get'](J),_0x4685df=new Set();for(const _0x3ac152 of _0x3b4d68){for(const _0x5ebe17 of _0x3ac152['authorsIds'])_0xbce3fd(_0x5ebe17);_0x3ac152['creatorId']&&_0xbce3fd(_0x3ac152['creatorId']);}if(0x0===_0x4685df['size'])return;const _0x5821f1=await _0x4be4c6['getMany'](_0x2d462b,Array['from'](_0x4685df));for(const _0x2d7cf6 of _0x5821f1)_0x16f647['getUser'](_0x2d7cf6['id'])||_0x16f647['addUser'](_0x2d7cf6);function _0xbce3fd(_0x35d446){_0x16f647['getUser'](_0x35d446)||_0x4685df['add'](_0x35d446);}}};function vt(_0x40e9d9){return _0x40e9d9['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x40e9d9['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x40e9d9['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x656eb{static get requires(){return[_0x2e230e,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x3c10c0{_collapseAt;constructor(_0x2493b4,_0x210f36=0x6){super(_0x2493b4);const _0x467ef4=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x210f36,this['bind']('isHidden')['to'](this,'usersCount',_0x37fbd0=>_0x37fbd0<_0x210f36),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x467ef4['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':_0x467ef4['to']('usersCount',_0xec4330=>'+'+(_0xec4330-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x3c10c0{items;keystrokes;constructor(_0x239049){super(_0x239049);const _0x35ac7c=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x514268(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x35ac7c['if']('hasPopup'),'aria-expanded':_0x35ac7c['to']('isExpanded',_0x3a93df=>this['hasPopup']&&String(_0x3a93df)),'aria-label':_0x35ac7c['to']('hasPopup',_0x4aee0b=>et(_0x239049,_0x4aee0b?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x35ac7c['to']('hasPopup',_0x1ba9c2=>!!_0x1ba9c2&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0x156560,_0x23b45e,_0x5a5eca)=>{this['element']&&(_0x5a5eca?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']);}},kt=class extends _0x3c10c0{counterView;inlineListView;constructor(_0x180f1a,_0x47f330=0x6){super(_0x180f1a);const _0x50e753=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0x47f330),this['inlineListView']=new bt(_0x180f1a),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0xf0176f of this['inlineListView']['items'])_0xf0176f['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',_0x50e753['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x3c10c0{listWrapperView;constructor(_0xd9c7f4,_0x2a3050){super(_0xd9c7f4),this['listWrapperView']=new St(_0xd9c7f4,_0x2a3050),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0xd9c7f4,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0x41cbcd{constructor(_0x360a9f,_0x58aa7e){super(_0x360a9f);const _0x402cd4=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x58aa7e?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x402cd4['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x402cd4['to']('role'),'aria-label':_0x402cd4['to']('ariaLabel'),'aria-labelledby':_0x402cd4['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x45a7d1['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x24cc8e=this['element'];_0x24cc8e&&(this['_isScrollable']=Math['max'](_0x24cc8e['scrollHeight'],_0x24cc8e['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0x5b7322{['userView'];constructor(_0x1ecdcd,_0x5bae86,_0x206495){super(_0x1ecdcd);const _0x3b3378=this['bindTemplate'];this['userView']=new _0xd0b1dd(_0x1ecdcd,_0x5bae86);const _0xfad9c3={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5bae86['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5bae86['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5bae86['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x5bae86['color']['getColorVariable'](),'--ck-user-color-alpha':_0x5bae86['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x206495&&(_0xfad9c3['tag']='button',_0xfad9c3['on']={'click':_0x3b3378['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0xfad9c3);}['focus'](){this['element']['focus']();}},Ct=class extends _0x3c10c0{['userView'];['markerView'];constructor(_0x4ed2b9,_0x1cb9ad,_0x25e038){super(_0x4ed2b9);const _0xa1766d=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0xd0b1dd(_0x4ed2b9,_0x1cb9ad),this['markerView']=new At(_0x4ed2b9,_0x1cb9ad);const _0x28a998=new _0xf81f2a(_0x4ed2b9);_0x28a998['template']['tag']='span',_0x28a998['text']=_0x1cb9ad['name'];const _0x293ce8={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0xa1766d['to']('isFocusable',_0x55dcf0=>!!_0x55dcf0&&0x0),'aria-labelledby':_0x28a998['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0xa1766d['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0xa1766d['to']('hasTooltip',_0x12cd4c=>!_0x12cd4c),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x28a998]};_0x25e038&&(_0x293ce8['tag']='button',_0x293ce8['on']={'click':_0xa1766d['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x293ce8);}},At=class extends _0x3c10c0{constructor(_0x2e8102,_0x4ba49e){super(_0x2e8102),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4ba49e['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x4ba49e['color']['getColorVariable'](),'--ck-user-color-alpha':_0x4ba49e['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x2ea2c1{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x616a5e){super(_0x616a5e),this['context']['config']['define']('presenceList',Pt);const _0x425bb9=_0x616a5e['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x425bb9)throw new _0x38db3a('presencelist-collapseat-invalid-format',this);if(_0x425bb9<0x1)throw new _0x38db3a('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x5a6c78(),this['balloonPanelView']=new _0x2ec557(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x1ac724 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x1ac724);this['listenTo'](this['_allConnectedUsers'],'add',(_0x34f42d,_0x5c609c)=>{this['_handleUserAdd'](_0x5c609c);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x59ff66,_0x420f6f)=>{this['_handleUserRemove'](_0x420f6f);});}_createView(){const _0x38ba60=this['context'],_0x54c008=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x301c98=this['balloonPanelView'];if(!_0x50144a(_0x38ba60['config']['get']('presenceList.container')))throw new _0x38db3a('presencelist-missing-container',this);_0x54c008['counterView']['bind']('usersCount')['to'](this),_0x54c008['bind']('isCollapsed')['to'](this,'usersCount',_0x6dcfe5=>{const {collapseAt:_0x5f20c7}=_0x38ba60['config']['get']('presenceList'),_0x2e08f8=_0x6dcfe5>=_0x5f20c7;if(_0x2e08f8&&!_0x54c008['inlineListView']['items']['find'](_0x2699ea=>_0x2699ea instanceof yt)){const _0x1705af=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x1705af&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x54c008['inlineListView']['items']['add'](_0x54c008['counterView']);}return _0x2e08f8||this['hideDropdown'](),_0x2e08f8;}),_0x54c008['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x1eed55=>{const _0x454662=_0x38ba60['config']['get']('presenceList'),_0xf68ebc=new Ct(_0x38ba60['locale'],_0x1eed55,!!_0x454662['onClick']);return _0xf68ebc['bind']('hasTooltip')['to'](_0x54c008,'isCollapsed',_0xc39ed4=>!_0xc39ed4),_0xf68ebc['bind']('isFocusable')['to'](_0x54c008,'isCollapsed',_0x3c4c8f=>!_0x3c4c8f),_0x454662['onClick']&&this['listenTo'](_0xf68ebc,'execute',()=>{this['view']['isCollapsed']||_0x454662['onClick'](_0x1eed55,_0xf68ebc['element']);}),_0xf68ebc;}),_0x54c008['inlineListView']['keystrokes']['set']('Enter',(_0x33325e,_0x109c9b)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x109c9b());}),_0x54c008['render'](),_0x301c98['render'](),_0x54c008['listenTo'](_0x54c008['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x3835e5=(_0x229bea,_0x54f941)=>{this['_hideDropdownUnlessPointerInside'](_0x54f941);};return _0x54c008['listenTo'](_0x54c008['inlineListView']['element'],'mouseleave',_0x3835e5),_0x54c008['listenTo'](_0x301c98['element'],'mouseleave',_0x3835e5),_0x4f49cd({'emitter':_0x54c008,'activator':()=>_0x301c98['isVisible'],'contextElements':[_0x301c98['element'],_0x54c008['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x38ba60['config']['get']('presenceList.container')['appendChild'](_0x54c008['element']),this['_overlayHost']=new _0x1d7a4d(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0x54c008;}_resolveOverlayTarget(){const _0xadef89=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0xadef89)return _0xadef89;const _0x535442=this['context']['config']['get']('presenceList.container');return _0x535442?_0x414ce5(_0x535442):null;}['_handleUserAdd'](_0x6fb81f){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x6fb81f['isMe'])return;const _0x320bf6=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x320bf6-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x161693=_0x6fb81f['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x6fb81f,_0x161693);}['_handleUserRemove'](_0x41ea1b){this['usersCount']--;const {collapseAt:_0xf2dddd}=this['context']['config']['get']('presenceList'),_0x4a3aa4=this['usersCount']>=_0xf2dddd;if(this['currentDisplayedUsers']['get'](_0x41ea1b['id']))this['currentDisplayedUsers']['remove'](_0x41ea1b['id']);else{if(_0x4a3aa4&&this['currentDisplayedUsers']['length']+0x1===_0xf2dddd-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x4a3aa4?0x1:0x0)<this['usersCount']){for(const _0x16e920 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x16e920['id'])&&(this['currentDisplayedUsers']['add'](_0x16e920,Math['min'](this['currentDisplayedUsers']['length']-(_0x4a3aa4?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x4a3aa4?0x1:0x0)===_0xf2dddd-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0xf35e25=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0xf35e25['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x1b19db}=this['presenceDropdownView'];_0x1b19db['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1871e3=>{if(!_0xf35e25['displayMe']&&_0x1871e3['isMe'])return null;const _0x2ccc2c=new Tt(this['context']['locale'],_0x1871e3,!!_0xf35e25['onClick']);return _0xf35e25['onClick']&&this['listenTo'](_0x2ccc2c,'execute',()=>{_0xf35e25['onClick'](_0x1871e3,_0x2ccc2c['element']);}),_0x2ccc2c;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x1b19db['focus'](),_0x1b19db['checkIfScrollable']();const _0x32d068=(_0x43a2c4,_0x1d8eed)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x1d8eed();};_0x1b19db['keystrokes']['set']('Esc',_0x32d068),_0x1b19db['keystrokes']['set']('Shift+Tab',_0x32d068),_0x1b19db['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x1b19db['focusTracker']['add'](this['view']['element']),_0x1b19db['focusTracker']['on']('change:isFocused',(_0x33fc24,_0xdccfa,_0x39d07e)=>{_0x39d07e||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);}_hideDropdownUnlessPointerInside(_0x53e0bf){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x4a6389=>_0x48de1b(_0x4a6389,_0x53e0bf))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x2ea2c1{static get requires(){return[Q,Ot];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{at as CloudServicesCommentsAdapter,wt as CloudServicesRevisionHistoryAdapter,ut as CloudServicesTrackChangesAdapter,xt as PresenceList,Ot as PresenceListUI,it as RealTimeCollaborationClient,pt as RealTimeCollaborativeComments,ct as RealTimeCollaborativeEditing,_t as RealTimeCollaborativeRevisionHistory,gt as RealTimeCollaborativeTrackChanges,Q as Sessions,J as WebSocketGateway};
23
+ import{Context as _0x528c5a,ContextPlugin as _0x573424,PendingActions as _0x3427cf,Plugin as _0x3b0285}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x1f4bac,Collection as _0xe27579,DomEmitterMixin as _0x16ac06,KeystrokeHandler as _0xf89fc5,getOverlayMountRoot as _0x1a0178,global as _0x2de15f,trustedHtml as _0x35ebe6,uid as _0x5a3f6c,version as _0x3ee978}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x364ce9,LabelView as _0x3c3eed,ListItemView as _0xf2227d,ListView as _0x4e0adb,Notification as _0x2e8fab,OverlayHost as _0x4ce28e,View as _0x2aa6e7,clickOutsideHandler as _0x18eeb2}from'@ckeditor/ckeditor5-ui';import{History as _0x1be3af,InsertOperation as _0x4c8305,MarkerOperation as _0x43552f,ModelLiveRange as _0x7a0909,NoOperation as _0x12872d,OperationFactory as _0x1ea669,RootAttributeOperation as _0x439da5,transformOperationSets as _0x218fdf}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x5ec7db}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x1539b1,CommentsService as _0x5bb917,EditorService as _0x48db14,RevisionHistoryService as _0x4d5139,TrackChangesService as _0x53868b,User as _0x3317f4,WEB_SOCKET_GATEWAY_STATES as _0x3f3bfc,WebSocketGateway as _0x51ae80}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x3ee386,Users as _0x5a638a,isPointerStillOver as _0x22725e}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x25fc3d}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x2ac1a8,TrackChangesEditing as _0x1570ae}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x47a9b6,CommentsEditing as _0x288390,CommentsRepository as _0x195514}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x210853}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x5b48c6}from'es-toolkit/compat';var J=class WebSocketGateway extends _0x573424{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
+ ((()=>_0x51ae80)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x5ec7db,_0x2e8fab];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x13c71d){super(_0x13c71d),this['set']('state',_0x3f3bfc['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x16ac06())();}init(){const _0x553a39=this['context'],_0x14e7e5=_0x553a39['plugins']['get'](_0x5ec7db),_0x4ad2ff=_0x553a39['plugins']['get'](_0x2e8fab);if(!_0x14e7e5['token'])throw new _0x1f4bac('websocketgateway-missing-token',this);if(!_0x14e7e5['webSocketUrl'])throw new _0x1f4bac('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'](_0x14e7e5['token'],_0x14e7e5['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x2bde95=>{if(this['connection']=_0x2bde95,this['bind']('state')['to'](_0x2bde95,'state',this,'_isBrowserOffline',(_0x464163,_0x24f414)=>('connected'!==_0x464163&&(this['_shouldPluginsReconnect']=!0x0),_0x24f414||_0x464163!==_0x3f3bfc['CONNECTED']?_0x3f3bfc['DISCONNECTED']:this['state']==_0x3f3bfc['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x3f3bfc['CONNECTING']):_0x3f3bfc['CONNECTED'])),this['connection']['on']('error',(_0x9cd024,_0x12ff5d)=>{if('limitExceeded'!==_0x12ff5d['code'])throw console['error'](_0x12ff5d),new _0x1f4bac('cloudservices-init',null,{'originalError':_0x12ff5d});_0x4ad2ff['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'});}),!_0x2bde95['me'])return new Promise(_0x1b6186=>_0x2bde95['on']('change:me',_0x1b6186));})['catch'](_0xd6d5b0=>{throw console['error'](_0xd6d5b0),new _0x1f4bac('cloudservices-init',null,{'originalError':_0xd6d5b0});});}addToReconnectionStack(_0x3fe995){if('function'!=typeof _0x3fe995['reconnect'])throw new _0x1f4bac('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x3fe995))throw new _0x1f4bac('websocketgateway-plugin-already-registered',this,{'name':_0x3fe995['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x3fe995);}removeFromReconnectionStack(_0x38e846){this['_reconnectionStack']['delete'](_0x38e846);}isInReconnectionStack(_0x2e5eb2){return this['_reconnectionStack']['has'](_0x2e5eb2);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x46304d=>_0x46304d['reconnect']())))['then'](()=>this['state']=_0x3f3bfc['CONNECTED'])['catch'](_0x380cee=>{throw console['error'](_0x380cee),new _0x1f4bac('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x3f3bfc['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x573424{['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[J,_0x5a638a];}constructor(_0x1af4de){super(_0x1af4de),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0xe27579(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x5a638a);}init(){const _0x3665a1=this['context']['plugins']['get'](J);this['listenTo'](_0x3665a1,'change:state',(_0x2d5858,_0x9ed038,_0x4bc775)=>{if('connected'!==_0x4bc775)this['channelSessions']['forEach'](_0x3e188c=>_0x3e188c['clear']()),this['channelConnectedUsers']['forEach'](_0x5ce4e7=>_0x5ce4e7['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x43f377,_0x165144]of this['_registeredSessions'])for(const _0x415eb6 of _0x165144)this['_handleSessionAdd'](_0x43f377,_0x415eb6);}}),this['_createUser'](_0x3665a1['connection']['me'],!0x0);}register(_0x8fa838,_0x204871){if(this['_registeredSessions']['has'](_0x8fa838))throw new _0x1f4bac('sessions-register-already-registered',null,{'channelId':_0x8fa838});this['_registeredSessions']['set'](_0x8fa838,_0x204871),this['channelSessions']['set'](_0x8fa838,new _0xe27579()),this['channelConnectedUsers']['set'](_0x8fa838,new _0xe27579()),this['listenTo'](_0x204871,'add',(_0x3dac15,_0xe92170)=>this['_handleSessionAdd'](_0x8fa838,_0xe92170)),this['listenTo'](_0x204871,'remove',(_0x466bfd,_0x22b77e)=>this['_handleSessionRemove'](_0x8fa838,_0x22b77e));for(const _0x406e7c of _0x204871)this['_handleSessionAdd'](_0x8fa838,_0x406e7c);}unregister(_0x32ff80){if(!this['_registeredSessions']['has'](_0x32ff80))throw new _0x1f4bac('sessions-unregister-not-exist',null,{'channelId':_0x32ff80});const _0x4ece0c=this['_registeredSessions']['get'](_0x32ff80);this['stopListening'](_0x4ece0c);for(const _0x222488 of _0x4ece0c)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x32ff80,_0x222488);this['_registeredSessions']['delete'](_0x32ff80),this['channelSessions']['delete'](_0x32ff80),this['channelConnectedUsers']['delete'](_0x32ff80);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0x40e215){for(const _0x5910e6 of this['channelSessions']['values']())for(const _0x2969b4 of _0x5910e6)if(_0x2969b4['id']===_0x40e215)return _0x2969b4['user'];}getUserSessions(_0xe5cb8e,_0x31929a){const _0x31d39e=_0x31929a?[this['channelSessions']['get'](_0x31929a)]:this['channelSessions']['values'](),_0x554bdb=new Set();for(const _0x169376 of _0x31d39e)for(const _0x5ee14b of _0x169376)_0x5ee14b['user']['id']===_0xe5cb8e['id']&&_0x554bdb['add'](_0x5ee14b['id']);return _0x554bdb;}getUserRole(_0x8e9d9){for(const _0x1a1b4d of this['channelSessions']['values']())for(const _0x38a8b8 of _0x1a1b4d)if(_0x38a8b8['user']===_0x8e9d9)return _0x38a8b8['role'];}['_handleSessionAdd'](_0x3568a2,_0x1fe055){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x275cc3=_0x1fe055['user'],_0x144ff9=this['_users']['getUser'](_0x275cc3['id'])||this['_createUser'](_0x275cc3),_0x343bad=Object['assign']({},_0x1fe055,{'user':_0x144ff9});if(this['channelSessions']['get'](_0x3568a2)['add'](_0x343bad),!_0x275cc3['hiddenInPresenceList']){const _0x38521d=this['channelConnectedUsers']['get'](_0x3568a2);_0x38521d['has'](_0x144ff9['id'])||_0x38521d['add'](_0x144ff9),this['allConnectedUsers']['has'](_0x144ff9['id'])||_0x275cc3['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x144ff9,_0x144ff9['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x3568a2,{'channelId':_0x3568a2,'session':_0x343bad});}['_handleSessionRemove'](_0x22694e,_0x2bd076){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x66eceb=this['channelConnectedUsers']['get'](_0x22694e),_0x25bd54=_0x2bd076['user'];_0x25bd54['id']&&(this['channelSessions']['get'](_0x22694e)['remove'](_0x2bd076['id']),_0x66eceb['has'](_0x25bd54['id'])&&!this['getUserSessions'](_0x25bd54,_0x22694e)['size']&&_0x66eceb['remove'](_0x25bd54['id']),this['allConnectedUsers']['get'](_0x25bd54['id'])&&!this['getUserSessions'](_0x25bd54)['size']&&this['allConnectedUsers']['remove'](_0x25bd54['id']));}_createUser(_0x11b527,_0x1479bd){const _0x1f3ca4=this['_users']['addUser'](_0x11b527);return _0x1479bd&&this['_users']['defineMe'](_0x11b527['id']),_0x1f3ca4['orderNumber']=this['_uniqueUsersCount']++,_0x1f3ca4;}},X=class extends _0x3b0285{_domEmitter=new(_0x16ac06())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x320dec=this['editor'],_0x31e10b=_0x320dec['plugins']['get'](Q);_0x320dec['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x37c871,{writer:_0x4e2857})=>function(_0x4c16b6,_0x25d7c9,_0x2a2f2f,_0x4e2c66){const _0x53b803=_0x4c16b6['markerName']['split'](':')[0x2],_0x465fd5=_0x2a2f2f['getUserBySessionId'](_0x53b803);if(!_0x465fd5||_0x53b803===_0x2a2f2f['mySessionId'])return;if(!_0x4e2c66['model']['schema']['checkChild'](_0x4c16b6['markerRange']['start'],'$text'))return;const _0x3ded2e={'class':'ck-user__marker\x20'+_0x465fd5['color']['getMarkerClass'](),'style':tt(_0x465fd5),'data-name':_0x465fd5['name'],'data-session-id':_0x53b803},_0x32c511=_0x4e2c66['model']['markers']['get'](_0x4c16b6['markerName'])['getStart'](),_0x5447bf=_0x32c511['nodeAfter'],_0x30a1fc=_0x4e2c66['model']['schema'];if(_0x5447bf&&_0x30a1fc['isObject'](_0x5447bf)&&_0x30a1fc['isInline'](_0x5447bf)&&!_0x4e2c66['model']['markers']['get']('user:range:'+_0x53b803)['getRange']()['isCollapsed'])return;const _0x36a8be=_0x32c511['parent'];return _0x4e2c66['model']['schema']['isLimit'](_0x36a8be)&&!_0x4e2c66['model']['hasContent'](_0x36a8be)&&(_0x3ded2e['contenteditable']=!0x1),function(_0x435404,_0x52f8b2,_0x4d459e){const _0x3066c8=_0x435404['createUIElement']('span',_0x52f8b2);return _0x435404['setCustomProperty']('userPositionMarker',!0x0,_0x3066c8),_0x3066c8['render']=function(_0x151441){const _0x4511ce=this['toDomElement'](_0x151441),_0x1ce532=document['createElement']('span');return _0x1ce532['classList']['add']('ck-user__marker-tooltip'),_0x1ce532['setAttribute']('contenteditable','false'),_0x1ce532['setAttribute']('spellcheck','false'),_0x1ce532['textContent']=_0x4d459e['name'],_0x4511ce['innerHTML']=_0x35ebe6('⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x1ce532['outerHTML']+'⁠'),_0x4511ce['addEventListener']('mouseenter',()=>{_0x4511ce['classList']['add']('ck-user__marker_hovered');}),_0x4511ce['addEventListener']('mouseleave',()=>{_0x4511ce['classList']['remove']('ck-user__marker_hovered');}),_0x4511ce;},_0x3066c8['isSimilar']=function(_0x2d6921){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2d6921['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2d6921['getAttribute']('data-session-id'));},_0x3066c8;}(_0x25d7c9,_0x3ded2e,_0x465fd5);}(_0x37c871,_0x4e2857,_0x31e10b,_0x320dec)}),_0x320dec['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x480563=>function(_0x10b3fb,_0x238c7c){const _0x146459=_0x10b3fb['markerName']['split'](':')[0x2];if(_0x146459===_0x238c7c['mySessionId'])return null;const _0x4cb184=_0x238c7c['getUserBySessionId'](_0x146459);return _0x4cb184?{'id':_0x146459,'classes':['ck-user__selection',_0x4cb184['color']['getSelectionClass']()],'attributes':{'style':tt(_0x4cb184),'data-session-id':_0x146459},'priority':0x7d0+_0x4cb184['orderNumber']}:{'id':_0x146459,'classes':[]};}(_0x480563,_0x31e10b)}),function(_0x491c91){const _0x2e736b=_0x491c91['model'],_0x2a1225=new Map(),_0x57c29c=_0x491c91['plugins']['get'](Q);_0x2e736b['markers']['on']('update:user:range',(_0x1d3634,_0x5e3340,_0x230979,_0x196243)=>{if(!_0x196243&&_0x2a1225['get'](_0x5e3340['name']))return _0x2a1225['get'](_0x5e3340['name'])['detach'](),void _0x2a1225['delete'](_0x5e3340['name']);const _0x57e478=_0x5e3340['name']['split'](':')[0x2];if(_0x57e478===_0x57c29c['mySessionId'])return;const _0x2b1938='user:position:'+_0x57e478;_0x2e736b['markers']['has'](_0x2b1938)&&_0x491c91['editing']['reconvertMarker'](_0x2b1938),_0x5e3340['on']('change:range',(_0x658b52,_0x15f9bf,_0xa81246)=>{if('$graveyard'!=_0x15f9bf['root']['rootName']&&'$graveyard'==_0x5e3340['getRange']()['root']['rootName']&&!_0x2a1225['has'](_0x5e3340['name'])){const _0x4e5525=_0x2e736b['schema']['getNearestSelectionRange'](_0xa81246['deletionPosition']);if(_0x4e5525){const _0x1a30ff=_0x7a0909['fromRange'](_0x4e5525);_0x2a1225['set'](_0x5e3340['name'],_0x1a30ff),_0x1a30ff['on']('change:range',(_0x304720,_0x1ba529,_0x2f84c2)=>{if('$graveyard'==_0x1a30ff['root']['rootName']){const _0x268ffb=_0x2e736b['schema']['getNearestSelectionRange'](_0x2f84c2['deletionPosition']);_0x268ffb?(_0x1a30ff['start']=_0x268ffb['start'],_0x1a30ff['end']=_0x268ffb['end']):(_0x2a1225['delete'](_0x5e3340['name']),_0x1a30ff['detach']());}});}}});}),_0x2e736b['document']['on']('change',()=>{_0x2a1225['size']>0x0&&_0x2e736b['enqueueChange']({'isUndoable':!0x1},_0x4f35a1=>{for(const [_0x497b4d,_0x2d0bc0]of _0x2a1225)'$graveyard'==_0x2e736b['markers']['get'](_0x497b4d)['getRange']()['root']['rootName']&&(Z(_0x497b4d['split'](':')[0x2],_0x2d0bc0['toRange'](),_0x2e736b,_0x4f35a1),_0x2d0bc0['detach']());_0x2a1225['clear']();});});}(_0x320dec),this['_domEmitter']['listenTo'](_0x2de15f['document'],'keydown',(_0x474880,{key:_0x171210})=>{'Escape'===_0x171210&&function(_0x1b1b5d){_0x1b1b5d['editing']['view']['change'](_0x39899e=>{for(const _0x2fd38f of _0x1b1b5d['model']['markers']){if(!_0x2fd38f['name']['startsWith']('user:position'))continue;const _0x49758b=_0x1b1b5d['editing']['mapper']['markerNameToElements'](_0x2fd38f['name']);if(_0x49758b){for(const _0x1656d7 of _0x49758b)_0x39899e['removeClass']('ck-user__marker_hovered',_0x1656d7);}}});}(_0x320dec);},{'useCapture':!0x0});}afterInit(){const _0x1f80ad=this['editor'],_0x4e312e=_0x1f80ad['commands']['get']('undo');_0x4e312e&&_0x1f80ad['model']['on']('applyOperation',(_0x23d790,_0x13172c)=>{const _0x193c2d=_0x13172c[0x0];if(!_0x193c2d['isDocumentOperation'])return;if('marker'!=_0x193c2d['type']||!_0x193c2d['name']['startsWith']('user:'))return;const _0x8c6642=_0x193c2d['batch'];_0x4e312e['_createdBatches']['has'](_0x8c6642)&&(_0x193c2d['newRange']=_0x193c2d['oldRange']?_0x1f80ad['model']['createRange'](_0x193c2d['oldRange']['start'],_0x193c2d['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x3a0ff5=this['editor'],_0x3736b2=_0x3a0ff5['model']['document'],_0x152706=_0x3a0ff5['plugins']['get'](Q);_0x3a0ff5['model']['enqueueChange']({'isUndoable':!0x1},_0xb42a7e=>{const _0x3e8d18='user:range:'+_0x152706['mySessionId'],_0x5754cc='user:position:'+_0x152706['mySessionId'],_0x360a76=_0x3a0ff5['model']['markers']['has'](_0x3e8d18);_0x3a0ff5['editing']['view']['hasDomSelection']?Z(_0x152706['mySessionId'],_0x3736b2['selection']['getFirstRange'](),_0x3a0ff5['model'],_0xb42a7e):_0x360a76&&(_0xb42a7e['removeMarker'](_0x3e8d18),_0xb42a7e['removeMarker'](_0x5754cc));});}};function Z(_0x158f03,_0x5906f3,_0x1bc85c,_0x118a13){const _0x5280b2='user:range:'+_0x158f03,_0x2e90c0='user:position:'+_0x158f03,_0x383e37=_0x5906f3['getContainedElement']();let _0x5b4cbf=_0x5906f3['start'];if(_0x383e37&&_0x383e37['is']('element','tableCell')){const _0x558944=function(_0x5ddd7e,_0x12e74c){for(const _0xd7f29f of _0x5ddd7e['getPositions']())if(_0x12e74c['schema']['checkChild'](_0xd7f29f,'$text'))return _0xd7f29f;}(_0x5906f3,_0x1bc85c);_0x558944&&(_0x5b4cbf=_0x558944,_0x5906f3=_0x118a13['createRange'](_0x5b4cbf));}const _0x4c288f=_0x118a13['createRange'](_0x5b4cbf);_0x1bc85c['markers']['has'](_0x5280b2)?(_0x118a13['updateMarker'](_0x5280b2,{'range':_0x5906f3}),_0x118a13['updateMarker'](_0x2e90c0,{'range':_0x4c288f})):(_0x118a13['addMarker'](_0x5280b2,{'range':_0x5906f3,'usingOperation':!0x0}),_0x118a13['addMarker'](_0x2e90c0,{'range':_0x4c288f,'usingOperation':!0x0}));}function tt(_0x43cd73){return'--ck-user-color:'+_0x43cd73['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x43cd73['color']['getColorAlphaVariable']()+';';}function et(_0x490b70,_0x463fd4,_0x328f4f){const _0x52bdec=_0x490b70['t'],t=_0x490b70['t'];switch(_0x463fd4){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 _0x52bdec({'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'},_0x328f4f);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x3b0285{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x1539b1)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[J,Q,X,_0x3427cf,_0x5a638a,_0x2e8fab];}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 _0x41174c=this['serverHistory']['getOperations']();for(let _0x71ea30=_0x41174c['length']-0x1;_0x71ea30>=0x0;_0x71ea30--){const _0x5397aa=_0x41174c[_0x71ea30];if(!this['_disconnectionOperations']['has'](_0x5397aa))return _0x5397aa['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x50909a){if(super(_0x50909a),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x1be3af(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x1f4bac('collaboration-missing-channelid',this);const _0x2c7957=_0x50909a['config']['get']('cloudServices.bundleVersion')||_0x3ee978;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x2c7957,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x25fc3d(),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 rt(this['_disconnectionOperations']);}init(){const _0x130666=this['editor'],_0x160db5=_0x130666['plugins']['get'](_0x5a638a),_0x5b971c=_0x130666['plugins']['get'](J);this['listenTo'](_0x160db5,'getOperationAuthor',(_0x409f93,_0x578aa0)=>{const _0x666b0b=_0x578aa0[0x0];_0x666b0b['_authorId']&&(_0x409f93['return']=_0x160db5['getUser'](_0x666b0b['_authorId']),_0x409f93['stop']()),null===_0x666b0b['_authorId']&&(_0x409f93['return']=null,_0x409f93['stop']());},{'priority':'high'}),this['listenTo'](_0x130666['model']['document']['selection'],'change:range',(_0x386cb7,_0x370d75)=>{_0x370d75['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x130666['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x130666['model']['on']('applyOperation',(_0x12491b,_0x264f2a)=>{const _0xf9ddb2=_0x264f2a[0x0];_0xf9ddb2['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0xf9ddb2),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x5b971c,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x677c88,_0x18e8e3,_0x53755e)=>'connected'===_0x677c88&&!_0x18e8e3&&!_0x53755e),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x130666['disableReadOnlyMode']('rtc-offline'):_0x130666['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x130666['disableReadOnlyMode']('rtc-offline'):_0x130666['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x5579e3=this['editor']['plugins']['get'](Q),_0xcc20c9=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0x5579e3['unregister'](this['_channelId']);const _0x309d25=await this['_service']['reconnect'](_0xcc20c9['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x309d25)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x39ed31=await this['_service']['getConnectedSessions']();_0x5579e3['register'](this['_channelId'],_0x39ed31),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x505fb0){if(function(_0x58b789){return'404'===_0x58b789['code'];}(_0x505fb0)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4f5d7a){return'409'===_0x4f5d7a['code'];}(_0x505fb0)){const _0x52bc54=et(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'](_0x52bc54);}else{if(!(_0x505fb0 instanceof nt))throw _0x505fb0;this['_handleReconnectionError']();}}}}destroy(){const _0x3b2313=this['editor']['plugins']['get'](J),_0x132a39=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x132a39['channelSessions']['has'](this['_channelId'])&&_0x132a39['unregister'](this['_channelId']),_0x3b2313['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x43cb46){if(this['sessionId']!==_0x43cb46['sessionId']&&this['_lastSyncedOperationId']!==_0x43cb46['lastOperationId'])throw new nt();return this['sessionId']=_0x43cb46['sessionId'],this['_handleServerResponse']([],{..._0x43cb46,'wereChangesApplied':!0x1,'data':_0x43cb46['data']},'reconnect');}async _connectService(_0x538e50,_0x1565ea=!0x1){const {connection:_0x4c5595}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x4c5595,this['_channelId'])['then'](_0x129032=>this['_initSessionsHandling'](_0x129032))['catch'](_0x1c58ba=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x1c58ba);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x5d6465,_0x537fcb)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x537fcb);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x266514=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x538e50);this['_isPendingUpdate']=!0x0;const _0x2ee0fb=await this['_service']['connect'](_0x4c5595,this['_compressOperations'](_0x538e50),_0x266514);if(this['sessionId']=_0x2ee0fb['sessionId'],_0x1565ea){if(!_0x2ee0fb['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x2ee0fb['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x538e50,_0x2ee0fb,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x2ee0fb,_0x538e50);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x4a575a=this['editor']['plugins']['get'](Q),_0x5cf382=this['editor']['plugins']['get'](X),_0x3e41d6=_0x4a575a['channelSessions']['get'](this['_channelId']);_0x3e41d6&&_0x3e41d6['length']>0x1?_0x5cf382['createUserMarkerOperations']():this['listenTo'](_0x4a575a,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x4a575a['channelSessions']['get'](this['_channelId'])['length']&&_0x5cf382['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x330efa,_0x354474,_0x19060c,_0x3e8387){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x354474){const _0x561e64=this['_decompressOperations'](_0x19060c,_0x3e8387);await this['_fetchMissingUsers'](_0x561e64),this['_handleExternalOperations'](_0x561e64,_0x354474,_0x19060c['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x1cd7b0}=this['editor'];let _0x45c1c6;try{_0x45c1c6=await this['_service']['getDocumentDetails']();}catch{const _0x3580ba=et(_0x1cd7b0,'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'](_0x3580ba);}const _0x243032=_0x45c1c6['currentDocumentSession']||_0x45c1c6['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x243032['lastOperationId']){const _0x10b516=et(_0x1cd7b0,'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'](_0x10b516);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x267b98=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0x267b98['connection']||'connected'!==_0x267b98['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x506150=this['editor']['plugins']['get'](Q);_0x506150['channelSessions']['has'](this['_channelId'])&&_0x506150['unregister'](this['_channelId']),_0x267b98['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x4e696d){const _0x40f982=this['editor']['plugins']['get'](Q);this['listenTo'](_0x40f982,'sessionAdd:'+this['_channelId'],(_0x10f7ff,{session:_0xdc8b2b})=>{if(_0xdc8b2b['id']===_0x40f982['mySessionId']){_0x10f7ff['off']();const _0x5b0765=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x274597=_0xdc8b2b['permissions'];_0x5b0765&&_0x5b0765['isEnabled']&&(_0x274597=_0x274597['filter'](_0x4f0b80=>'document:write'!==_0x4f0b80)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x274597,this['_channelId']);}}),_0x40f982['register'](this['_channelId'],_0x4e696d);}_initThrowingOnDataSet(){const _0x1a7e8d=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x29c12f)=>{if(!_0x29c12f[_0x29c12f['length']-0x1]['suppressErrorInCollaboration'])throw new _0x1f4bac('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x1a7e8d['apply'](this['editor']['data'],_0x29c12f);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x3202d4,[_0x3a4ef3])=>{if(this['_document']['version'])throw new _0x1f4bac('realtimecollaborationclient-init-document-already-initialized',this);_0x3202d4['stop'](),this['_setPendingAction']();const _0x98d8a=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x196fdb])=>!_0x196fdb['lazyLoad'])['map'](([_0x502930,_0x465be8])=>[_0x502930,_0x465be8['modelAttributes']||{}])),_0x53a8c2=this['_getOperationsFromInitData'](_0x3a4ef3,_0x98d8a);0x0==_0x53a8c2['length']&&_0x53a8c2['push'](new _0x12872d(0x0)),_0x3202d4['return']=this['_connectService'](_0x53a8c2)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x38410e=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x38410e))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2cc499,[_0x53adfa,_0x302d01])=>{_0x2cc499['stop']();const _0x3421e6=this['editor']['model']['document']['getRoot'](_0x53adfa);if(!this['_knownRootNames']['has'](_0x53adfa)){const _0x2d5bd0=_0x302d01&&_0x302d01['data']?_0x302d01['data']:'',_0x1903fa=_0x302d01&&_0x302d01['attributes']?_0x302d01['attributes']:{};await this['_loadRoot'](_0x53adfa,_0x2d5bd0,_0x1903fa);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x3421e6['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x3421e6);});},{'priority':'high'});}async _fetchMissingUsers(_0x2ae506){const _0x53f5f1=this['editor']['plugins']['get'](_0x5a638a),{connection:_0x269291}=this['editor']['plugins']['get'](J),_0x5d076f=new Set();for(const _0x29067d of _0x2ae506){const _0x3152f5=_0x29067d['_authorId'];_0x3152f5&&!_0x53f5f1['getUser'](_0x3152f5)&&_0x5d076f['add'](_0x3152f5);}if(0x0===_0x5d076f['size'])return;const _0x5ce682=await _0x3317f4['getMany'](_0x269291,Array['from'](_0x5d076f));for(const _0xcee6e of _0x5ce682)_0x53f5f1['getUser'](_0xcee6e['id'])||_0x53f5f1['addUser'](_0xcee6e);}_getOperationsFromInitData(_0x4a9e81,_0x1e4367={}){const _0x3f7d3a=this['editor']['model'],_0x382f17=[];let _0x2a6e58=0x0;const _0x2d56d2='string'==typeof _0x4a9e81?{'main':_0x4a9e81}:_0x4a9e81;for(const _0x3b945e of Object['keys'](_0x2d56d2)){if(!this['_document']['roots']['has'](_0x3b945e))throw new _0x1f4bac('realtimecollaborationclient-init-non-existent-root',this);const _0x2925be=this['_document']['getRoot'](_0x3b945e),_0x148e73=this['editor']['data']['parse'](_0x2d56d2[_0x3b945e],_0x2925be),_0x38a703=new _0x4c8305(_0x3f7d3a['createPositionAt'](_0x2925be,0x0),_0x148e73,_0x2a6e58++);_0x382f17['push'](_0x38a703);for(const [_0x5af181,_0x5edde3]of _0x148e73['markers']){const _0x244036=_0x3f7d3a['createRange'](_0x3f7d3a['createPositionFromPath'](_0x2925be,_0x5edde3['start']['path']['slice']()),_0x3f7d3a['createPositionFromPath'](_0x2925be,_0x5edde3['end']['path']['slice']())),_0x5e8038=new _0x43552f(_0x5af181,null,_0x244036,_0x3f7d3a['markers'],!0x0,_0x2a6e58++);_0x382f17['push'](_0x5e8038);}}if(_0x1e4367)for(const [_0x3edb6f,_0x269781]of Object['entries'](_0x1e4367)){const _0xed7867=_0x3f7d3a['document']['getRoot'](_0x3edb6f);if(!_0xed7867)throw new _0x1f4bac('multi-root-editor-root-attributes-no-root',null);for(const [_0x42f440,_0x21e9e9]of Object['entries'](_0x269781))if(null!==_0x21e9e9){const _0x34d714=new _0x439da5(_0xed7867,_0x42f440,null,_0x21e9e9,_0x2a6e58++);_0x382f17['push'](_0x34d714);}}return _0x382f17;}async _loadRoot(_0x4e73ac,_0x23300c,_0x5b3115){this['_getOperationsFromInitData']({[_0x4e73ac]:_0x23300c},{[_0x4e73ac]:_0x5b3115})['forEach']((_0x2b6349,_0x5c0f51)=>{_0x2b6349['baseVersion']=this['_document']['version']+_0x5c0f51,_0x2b6349['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2b6349);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x443959,_0x2a1b35){let _0x31b8a4;this['_offset']=_0x443959['offset'];const _0xd135ee=_0x443959['wereChangesApplied']&&!_0x443959['initData'],_0x2d32b7=_0xd135ee?0x0:_0x443959['data']['baseVersion'];if(_0x2a1b35['forEach'](_0x2d48d5=>{_0x2d48d5['_isInit']=!0x0,_0x2d48d5['createdAt']=_0x443959['sessionCreatedAt'],_0x2d48d5['_authorId']=null;}),_0xd135ee)_0x31b8a4=_0x2a1b35,this['_applyOperationsSet'](_0x31b8a4,_0xd135ee);else{if(_0x443959['initData']){const _0x33a719=this['_getOperationsFromInitData'](_0x443959['initData']);this['_document']['history']['version']=-_0x33a719['length'],_0x33a719['forEach'](_0x1d72ba=>{_0x1d72ba['baseVersion']-=_0x33a719['length'],_0x1d72ba['createdAt']=_0x443959['sessionCreatedAt'],_0x1d72ba['_isInit']=!0x0,_0x1d72ba['_authorId']=null;}),this['_applyOperationsSet'](_0x33a719,!0x0),this['serverHistory']['version']=-_0x33a719['length']+this['_offset'],this['_updateServerHistory'](_0x33a719);}this['_document']['history']['version']=_0x2d32b7,_0x31b8a4=this['_decompressOperations'](_0x443959['data'],_0x443959['metadata']),await this['_fetchMissingUsers'](_0x31b8a4),this['_applyOperationsSet'](_0x31b8a4,_0xd135ee);}_0x443959['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x31b8a4,_0x443959['lastOperationId']),this['_lastSyncedOperationId']=_0x443959['lastOperationId']),this['serverHistory']['version']=_0x2d32b7+this['_offset'],this['_updateServerHistory'](_0x31b8a4),_0x2a1b35['filter'](_0x228d7a=>{const _0x2f4ab9=this['_getAffectedRoot'](_0x228d7a);return _0x2f4ab9&&!this['_knownRootNames']['has'](_0x2f4ab9);})['forEach']((_0x48277b,_0x36fcc2)=>{_0x48277b['baseVersion']=this['_document']['version']+_0x36fcc2,this['_saveOperationInBuffer'](_0x48277b);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x42290b,_0x57af25){const _0x516e08=_0x57af25&&_0x57af25['message'];if(_0x516e08&&_0x516e08['startsWith']('realtimecollaborationclient'))throw _0x57af25;const _0x1247c8=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0x1247c8['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x1f4bac(_0x42290b,this['editor'],_0x516e08?{'originalError':_0x516e08}:void 0x0);}_saveOperationInBuffer(_0x2b20f8){this['_knownOperations']['has'](_0x2b20f8)||(this['_knownOperations']['add'](_0x2b20f8),this['_bufferedOperations']['push'](_0x2b20f8),this['_pendingAction']||'marker'==_0x2b20f8['type']&&!_0x2b20f8['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x46171b=!0x1){!_0x46171b&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x341d3e=>{_0x341d3e&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x27f9fe=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x59f52b){return _0x59f52b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x59f52b['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x59f52b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x27f9fe)||this['_crash'](_0x27f9fe['message'],_0x27f9fe);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x36e222=>{this['on']('change:_isPendingUpdate',()=>{_0x36e222();});});}async _sendBufferedOperations(){const _0x34c4e1=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0x34c4e1['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x39ecb0=[...this['_bufferedOperations']];for(const _0x544493 of _0x39ecb0)_0x544493['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x544493);const _0x5675bf=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x39ecb0),_0x23a5ea=st++,_0x3d4537=this['_compressOperations'](_0x39ecb0),_0x4fbb82=await this['_service']['sendOperations'](_0x3d4537,_0x3d4537['baseVersion'],_0x5675bf);try{return await this['_handleServerResponse'](_0x39ecb0,_0x4fbb82,_0x23a5ea);}catch(_0x4a04a7){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x4a04a7);}}async['_handleServerResponse'](_0x222af0,_0x32dad2,_0x547ecc){if('error'in _0x32dad2)throw _0x32dad2['error'];let _0x31194f;if(_0x32dad2['wereChangesApplied']){_0x32dad2['lastOperationId']&&(this['_lastSyncedOperationId']=_0x32dad2['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x42bc71=>!_0x222af0['includes'](_0x42bc71));for(const _0x1719c5 of _0x222af0)_0x1719c5['createdAt']='lastOperationAcceptedAt'in _0x32dad2&&_0x32dad2['lastOperationAcceptedAt']||void 0x0;ot(_0x222af0,_0x32dad2['version']-_0x222af0['length']),this['_updateServerHistory'](_0x222af0);const _0x527efd=_0x222af0['filter'](_0x2f88d9=>{if(!_0x2f88d9['_isInit'])return!0x1;const _0x475f28=this['_getAffectedRoot'](_0x2f88d9);return _0x475f28&&!this['_knownRootNames']['has'](_0x475f28);});ot(_0x527efd,this['_document']['version']),this['_applyOperationsSet'](_0x527efd),_0x31194f=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0xb150ba=this['_decompressOperations'](_0x32dad2['data'],_0x32dad2['metadata'])['filter'](_0x394a53=>_0x394a53['baseVersion']>=this['_lastServerVersion']);_0xb150ba['forEach'](_0x58f16a=>this['_addKnownRoot'](_0x58f16a)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x552f43=>!_0x552f43['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x552f43))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0xb150ba),_0x31194f=this['_handleExternalOperations'](_0xb150ba,_0x32dad2['version'],_0x32dad2['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x31194f?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x14f314,_0x1901f3,_0x588c5b){try{const _0x25b6e7={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x766b6f,operationsB:_0xc1fdf8,originalOperations:_0x3bef0b}=_0x218fdf(_0x14f314,this['_bufferedOperations'],_0x25b6e7);ot(_0x766b6f,this['_document']['version']),ot(_0xc1fdf8,_0x1901f3);for(const _0x413a01 of _0x766b6f){const _0xae0ea1=_0x3bef0b['get'](_0x413a01);_0xae0ea1?(_0x413a01['_authorId']=_0xae0ea1['_authorId'],'noop'!==_0x413a01['type']&&(_0x413a01['_aiSource']=_0xae0ea1['_aiSource'])):_0x413a01['_authorId']=null;}for(const _0x4bed76 of _0xc1fdf8)'noop'!==_0x4bed76['type']&&(_0x4bed76['_aiSource']=_0x3bef0b['get'](_0x4bed76)?.['_aiSource']);_0x588c5b&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x14f314,_0x588c5b),this['_lastSyncedOperationId']=_0x588c5b),this['_bufferedOperations']=[..._0xc1fdf8],this['_applyOperationsSet'](_0x766b6f),this['_updateServerHistory'](_0x14f314);}catch(_0x1c3fa9){return console['error'](_0x1c3fa9),!0x1;}return!0x0;}_applyOperationsSet(_0xd3b659,_0x10a270=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x3fce5c=>{for(const _0x37474d of _0xd3b659)this['_knownOperations']['add'](_0x37474d),this['_addKnownRoot'](_0x37474d),_0x3fce5c['batch']['addOperation'](_0x37474d),this['editor']['model']['applyOperation'](_0x37474d);});}_addKnownRoot(_0x358088){const _0x100660=this['_getAffectedRoot'](_0x358088);_0x100660&&this['_knownRootNames']['add'](_0x100660);}_getAffectedRoot(_0x13e5bf){let _0x41a088,_0x4b3a92;switch(_0x13e5bf['type']){case'insert':_0x41a088=_0x13e5bf['position']['root'];break;case'marker':if(_0x4b3a92=_0x13e5bf['newRange'],!_0x4b3a92)return null;_0x41a088=_0x4b3a92['root'];break;case'addRootAttribute':_0x41a088=_0x13e5bf['root'];break;case'addRoot':_0x41a088=_0x13e5bf['affectedSelectable'];break;case'move':_0x41a088=_0x13e5bf['targetPosition']['root'];break;default:return null;}return _0x41a088['rootName'];}_updateServerHistory(_0xd34142){_0xd34142['forEach'](_0x559c7c=>{const _0x3fd205=_0x559c7c['clone']();_0x3fd205['_authorId']=_0x559c7c['_authorId'],_0x3fd205['_isInit']=!!_0x559c7c['_isInit'],_0x3fd205['_aiSource']=_0x559c7c['_aiSource'],_0x3fd205['createdAt']=_0x559c7c['createdAt'],_0x3fd205['baseVersion']+=this['_offset'],_0x559c7c['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x3fd205),this['serverHistory']['addOperation'](_0x3fd205);});}_handleReconnectionError(_0x563154){const _0x1bb867=this['editor']['plugins']['get']('Notification'),_0x3e7a66=this['editor']['locale'];_0x563154||(_0x563154=et(_0x3e7a66,'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.')),_0x1bb867['showWarning'](_0x563154,{'title':et(_0x3e7a66,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](J)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x3427cf)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x3427cf)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x55fdc6){const _0x3bb199=_0x55fdc6['map'](_0x6b0f6a=>_0x6b0f6a['toJSON']());return this['_compressor']['compress'](_0x3bb199);}_decompressOperations(_0x51d545,_0x3b84ab){return this['_compressor']['decompress'](_0x51d545)['map']((_0x3553e4,_0x49ea1c)=>{const _0x4cb264='init'==_0x3b84ab[_0x49ea1c]['type'];if('InsertOperation'==_0x3553e4['__className']){const _0x3371af=_0x3553e4['position']['root'];!this['_document']['getRoot'](_0x3371af)&&(this['_document']['createRoot']('$unknown',_0x3371af)['_isAttached']=!0x1);}else{if('RootOperation'==_0x3553e4['__className']){const _0x914502=this['_document']['getRoot'](_0x3553e4['rootName']);_0x914502&&'$unknown'==_0x914502['name']&&_0x3553e4['elementName']!=_0x914502['name']&&(_0x914502['name']=_0x3553e4['elementName']);}}const _0x250151=_0x1ea669['fromJSON'](_0x3553e4,this['_document']);return _0x250151['wasUndone']=_0x3553e4['wasUndone'],_0x250151['_isInit']=_0x4cb264,_0x250151['_authorId']=_0x4cb264?null:_0x3b84ab[_0x49ea1c]['userId'],_0x250151['_isDisconnection']='cs:removeUser'===_0x3b84ab[_0x49ea1c]['type'],_0x250151['_aiSource']=_0x3553e4['_aiSource']||void 0x0,_0x250151['createdAt']=_0x3b84ab[_0x49ea1c]['createdAt'],_0x250151;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x4e90ad=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x4e90ad&&_0x4e90ad['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x4c7b96,_0x861301){for(const _0xc60e71 of _0x4c7b96)_0xc60e71['baseVersion']=_0x861301++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0x3f4fe8){this['_ignoredOperations']=_0x3f4fe8,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x5d3114){let _0x256cbd=_0x5d3114['length'];for(;_0x256cbd--;){const _0x5c2177=_0x5d3114[_0x256cbd];if(!this['_ignoredOperations']['has'](_0x5c2177)){if(!this['_operationToId']['has'](_0x5c2177)){const _0x5813d8=_0x5a3f6c()['slice'](0x1,0x12);this['_operationToId']['set'](_0x5c2177,_0x5813d8);}return this['_operationToId']['get'](_0x5c2177);}}}setIdForTheLastOperation(_0x37a0d3,_0x5286d7){if(!_0x5286d7)return;let _0x418cd4=_0x37a0d3['length'];for(;_0x418cd4--;){const _0x2603dc=_0x37a0d3[_0x418cd4];this['_ignoredOperations']['has'](_0x2603dc)||this['_operationToId']['set'](_0x2603dc,_0x5286d7);}}},ct=class extends _0x3b0285{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x573424{static CommentsService=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x5bb917)());['_services'];static get requires(){return[J,_0x195514,Q,_0x5a638a];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x35d6b7){super(_0x35d6b7),this['_services']=new Map();}async init(){const _0x3609e9=this['context'],_0x11decc=_0x3609e9['plugins']['get'](_0x195514);if(_0x3609e9['plugins']['get'](J)['addToReconnectionStack'](this),_0x11decc['adapter']={'addCommentThread':async({channelId:_0x50db73,threadId:_0x6d450d,comments:_0x785706,resolvedAt:_0x41da4d,resolvedBy:_0x5e919d,context:_0x5b71fb,attributes:_0x30f36d})=>{const _0x57406c=await this['_getService'](_0x50db73)['addCommentThread']({'commentThreadId':_0x6d450d,'comments':_0x785706['map'](_0x55f6fa=>function(_0x7360a9,_0x3ecd72,_0x501b4f){return{'commentThreadId':_0x501b4f,'commentId':_0x7360a9['commentId'],'userId':_0x7360a9['authorId'],'content':_0x7360a9['content'],'documentId':_0x3ecd72,'createdAt':_0x7360a9['createdAt'],'attributes':_0x7360a9['attributes']||{}};}(_0x55f6fa,_0x50db73,_0x6d450d)),'resolvedAt':_0x41da4d,'resolvedBy':_0x5e919d,'context':_0x5b71fb,'attributes':_0x30f36d})['catch'](lt);return{'threadId':_0x57406c['commentThreadId'],'comments':_0x57406c['comments']};},'getCommentThread':async({channelId:_0x9499d9,threadId:_0x5d233a})=>{const _0xdd3953=await this['_getService'](_0x9499d9)['getCommentThread'](_0x5d233a)['catch'](ht)['catch'](lt);return _0xdd3953?_0xdd3953['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0xdd3953]),{'threadId':_0xdd3953['commentThreadId'],'comments':_0xdd3953['comments']['map'](dt),'context':_0xdd3953['context'],'resolvedAt':_0xdd3953['resolvedAt'],'resolvedBy':_0xdd3953['resolvedBy'],'attributes':_0xdd3953['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0xb3e2c0,threadId:_0xd5dfe7,context:_0x245aa8,unlinkedAt:_0x5297fe,attributes:_0x1b040d})=>this['_getService'](_0xb3e2c0)['updateCommentThread']({'commentThreadId':_0xd5dfe7,'context':_0x245aa8,'attributes':_0x1b040d,'unlinkedAt':_0x5297fe})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x3560e4,threadId:_0x4d421f})=>{const _0x811a8=await this['_getService'](_0x3560e4)['resolveCommentThread'](_0x4d421f)['catch'](ht)['catch'](lt);return{'threadId':_0x811a8['commentThreadId'],'resolvedAt':_0x811a8['resolvedAt'],'resolvedBy':_0x811a8['resolvedBy']};},'reopenCommentThread':async({channelId:_0x5172af,threadId:_0x476478})=>this['_getService'](_0x5172af)['reopenCommentThread'](_0x476478)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x3f668f,threadId:_0x2e9632})=>this['_getService'](_0x3f668f)['removeCommentThread'](_0x2e9632)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x52a671,threadId:_0x12e918,commentId:_0x245754,content:_0x206da4,attributes:_0xb8d638})=>this['_getService'](_0x52a671)['addComment'](_0x12e918,_0x245754,_0x206da4,_0xb8d638)['catch'](lt),'updateComment':({channelId:_0x596f0b,threadId:_0x29e2d2,commentId:_0x507745,content:_0x40f2bb,attributes:_0x315e33})=>this['_getService'](_0x596f0b)['updateComment'](_0x29e2d2,_0x507745,_0x40f2bb,_0x315e33)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x54708f,threadId:_0x1daed2,commentId:_0x352530})=>this['_getService'](_0x54708f)['removeComment'](_0x1daed2,_0x352530)['catch'](ht)['catch'](lt)},_0x3609e9 instanceof _0x528c5a){const _0x315974=_0x3609e9['config']['get']('collaboration.channelId'),_0x3bfee5=_0x3609e9['plugins']['get'](Q);await this['_setUpService'](_0x315974);const _0x3d23f9=await this['_services']['get'](_0x315974)['getConnectedSessions']();this['listenTo'](_0x3bfee5,'sessionAdd:'+_0x315974,(_0x8d1a49,{session:_0xacae69})=>{_0xacae69['id']===_0x3bfee5['mySessionId']&&(_0x8d1a49['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0xacae69['permissions'],_0x315974));}),_0x3bfee5['register'](_0x315974,_0x3d23f9);}}async _setUpService(_0x19ba93){if(this['_services']['has'](_0x19ba93))throw new _0x1f4bac('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x19ba93});const _0x59a99b=this['context']['plugins']['get'](_0x195514),_0x2bd156=new CloudServicesCommentsAdapter['CommentsService'](_0x19ba93);this['_services']['set'](_0x19ba93,_0x2bd156),this['listenTo'](_0x2bd156,'commentThreadAdded',(_0x4437d0,_0x15a348)=>{const {commentThreadId:_0x1a58ec,documentId:_0x8bb782,context:_0x52c605,attributes:_0x588964,resolvedAt:_0x513c52,resolvedBy:_0x2fe2fb,comments:_0x3e68b4}=_0x15a348;_0x59a99b['getCommentThread'](_0x1a58ec)||_0x59a99b['addCommentThread']({'threadId':_0x1a58ec,'channelId':_0x8bb782,'comments':_0x3e68b4?_0x3e68b4['map'](dt):[],'context':_0x52c605,'attributes':_0x588964,'resolvedAt':_0x513c52,'resolvedBy':_0x2fe2fb,'isFromAdapter':!0x0});}),this['listenTo'](_0x2bd156,'commentThreadUpdated',(_0x59176e,{commentThreadId:_0x5a5639,documentId:_0x25b6bf,context:_0x1b42df,unlinkedAt:_0x1b986c,attributes:_0x4a5d13})=>{_0x59a99b['getCommentThread'](_0x5a5639)&&_0x59a99b['updateCommentThread']({'threadId':_0x5a5639,'channelId':_0x25b6bf,'context':_0x1b42df,'unlinkedAt':_0x1b986c,'attributes':_0x4a5d13,'isFromAdapter':!0x0});}),this['listenTo'](_0x2bd156,'commentThreadResolved',(_0x2dcad4,{commentThreadId:_0x13a607,resolvedBy:_0x7f5931,resolvedAt:_0x1444de})=>{const _0x1ff5d3=_0x59a99b['getCommentThread'](_0x13a607);_0x1ff5d3&&_0x1ff5d3['resolve']({'resolvedBy':_0x7f5931,'resolvedAt':_0x1444de,'isFromAdapter':!0x0});}),this['listenTo'](_0x2bd156,'commentThreadReopened',(_0x45d6bb,{commentThreadId:_0x32c9c2})=>{const _0x3e45ad=_0x59a99b['getCommentThread'](_0x32c9c2);_0x3e45ad&&_0x3e45ad['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x2bd156,'commentThreadRemoved',(_0x2034df,{commentThreadId:_0xc721e0})=>{const _0x49e9cc=_0x59a99b['getCommentThread'](_0xc721e0);_0x49e9cc&&_0x49e9cc['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x2bd156,'commentAdded',(_0x2eff94,_0x4b5adb)=>{const _0x4fbcd0=_0x4b5adb['commentThreadId'],_0x326b9a=_0x59a99b['getCommentThread'](_0x4fbcd0);_0x326b9a&&_0x326b9a['addComment']({...dt(_0x4b5adb),'isFromAdapter':!0x0});}),this['listenTo'](_0x2bd156,'commentUpdated',(_0x25483b,{commentThreadId:_0x1ea718,commentId:_0xd0c7f0,content:_0x18bb0a,attributes:_0x496688})=>{const _0x257731=_0x59a99b['getCommentThread'](_0x1ea718);if(_0x257731){const _0x1ef0b2=_0x257731['getComment'](_0xd0c7f0);_0x1ef0b2&&_0x1ef0b2['update']({'content':_0x18bb0a,'attributes':_0x496688,'isFromAdapter':!0x0});}}),this['listenTo'](_0x2bd156,'commentRemoved',(_0x21f01b,{commentThreadId:_0x55f3b6,commentId:_0x865794})=>{const _0x355f71=_0x59a99b['getCommentThread'](_0x55f3b6);if(_0x355f71){const _0x195f5d=_0x355f71['getComment'](_0x865794);_0x195f5d&&_0x195f5d['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x2bd156,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0x19ba93),this['stopListening'](_0x2bd156));}),await this['_connectService'](_0x19ba93);}destroy(){if(this['context']instanceof _0x528c5a){const _0x4c42b5=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x4c42b5)&&this['_terminateService'](_0x4c42b5);}}_terminateService(_0x294f1d){if(!this['_services']['has'](_0x294f1d))throw new _0x1f4bac('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x294f1d});this['_getService'](_0x294f1d)['disconnect'](),this['_services']['delete'](_0x294f1d);}async reconnect(){for(const _0x35f46d of this['_services']['keys']())await this['_connectService'](_0x35f46d);if(this['context']instanceof _0x528c5a){const _0xab5d3b=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0xab5d3b)){const _0x25e22e=this['context']['plugins']['get'](Q);_0x25e22e['unregister'](_0xab5d3b);const _0x37b8d5=await this['_services']['get'](_0xab5d3b)['getConnectedSessions']();_0x25e22e['register'](_0xab5d3b,_0x37b8d5);}}}async _connectService(_0x54e00c){const {connection:_0x122a57}=this['context']['plugins']['get'](J),_0x47dd81=this['context']['plugins']['get'](_0x195514),_0x4f650b=await this['_services']['get'](_0x54e00c)['connect'](_0x122a57);await this['_fetchMissingUsersForThreads'](_0x4f650b);const _0x3eb547=new Set(Array['from'](_0x47dd81['getCommentThreads']({'channelId':_0x54e00c}),_0x2defe4=>_0x2defe4['id']));for(const _0x2fe8f9 of _0x4f650b)_0x2fe8f9['deletedAt']||_0x3eb547['delete'](_0x2fe8f9['commentThreadId']);for(const _0x26a921 of _0x3eb547)_0x47dd81['getCommentThread'](_0x26a921)['remove']({'isFromAdapter':!0x0});for(const _0x1fbea2 of _0x4f650b){let _0x589c77=_0x47dd81['getCommentThread'](_0x1fbea2['commentThreadId']);const {commentThreadId:_0xfc32c2,context:_0x4651ae,attributes:_0x41bb67,resolvedBy:_0x32ebfb,resolvedAt:_0x318c30,unlinkedAt:_0x1ee039,deletedAt:_0x1c6230}=_0x1fbea2;if(_0x1c6230)continue;_0x589c77||(_0x589c77=_0x47dd81['addCommentThread']({'channelId':_0x54e00c,'threadId':_0xfc32c2,'context':_0x4651ae,'attributes':_0x41bb67||{},'resolvedBy':_0x32ebfb,'resolvedAt':_0x318c30,'unlinkedAt':_0x1ee039,'isFromAdapter':!0x0}));const _0x53b291=new Set(Array['from'](_0x589c77['comments'],_0xa548bc=>_0xa548bc['id']));for(const _0x2875c6 of _0x1fbea2['comments'])_0x53b291['delete'](_0x2875c6['commentId']);for(const _0x3d86a3 of _0x53b291)_0x589c77['getComment'](_0x3d86a3)['remove']({'isFromAdapter':!0x0});for(const _0x37c009 of _0x1fbea2['comments']){const _0x2dc4a1=_0x589c77['getComment'](_0x37c009['commentId']);_0x2dc4a1?_0x2dc4a1['content']!==_0x37c009['content']&&_0x2dc4a1['update']({'content':_0x37c009['content'],'isFromAdapter':!0x0}):_0x589c77['addComment'](Object['assign'](dt(_0x37c009),{'isFromAdapter':!0x0}));}}}_getService(_0x51d129){if(!this['_services']['has'](_0x51d129))throw new _0x1f4bac('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x51d129});return this['_services']['get'](_0x51d129);}async _fetchMissingUsersForThreads(_0xf367cb){const _0x3b333f=this['context']['plugins']['get'](_0x5a638a),{connection:_0x2136c0}=this['context']['plugins']['get'](J),_0x2eea29=new Set();for(const {resolvedBy:_0x1640e6,comments:_0x48c935}of _0xf367cb){_0x1640e6&&!_0x3b333f['getUser'](_0x1640e6)&&_0x2eea29['add'](_0x1640e6);for(const {userId:_0x5b97e9}of _0x48c935)_0x3b333f['getUser'](_0x5b97e9)||_0x2eea29['add'](_0x5b97e9);}if(0x0===_0x2eea29['size'])return;const _0x25f794=await _0x3317f4['getMany'](_0x2136c0,Array['from'](_0x2eea29));for(const _0x543efb of _0x25f794)_0x3b333f['getUser'](_0x543efb['id'])||_0x3b333f['addUser'](_0x543efb);}};async function ht(_0x57981a){if('404'!==_0x57981a['code'])throw _0x57981a;}function lt(_0x23dfe9){if((_0xee275f=_0x23dfe9)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0xee275f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xee275f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0xee275f;throw _0x23dfe9;}function dt(_0x26137a){return{'threadId':_0x26137a['commentThreadId'],'commentId':_0x26137a['commentId'],'content':_0x26137a['content'],'createdAt':_0x26137a['createdAt'],'authorId':_0x26137a['userId'],'attributes':_0x26137a['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x3b0285{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>_0x53868b)());_bufferedRequests;_trackChangesService;static get requires(){return[at,_0x1570ae,J];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5c913f){super(_0x5c913f);const _0xe5c163=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0xe5c163);}init(){const _0x107576=this['editor']['plugins']['get'](J),_0x3f3868=this['editor']['plugins']['get'](_0x1570ae);return _0x3f3868['adapter']={'getSuggestion':async _0x24c59e=>{await this['_waitForServiceReady']();const _0x535296=await this['_trackChangesService']['get'](_0x24c59e)['catch'](ft);return await this['_fetchMissingUsersForThreads']([_0x535296]),_0x535296;},'addSuggestion':async({id:_0x58e31c,type:_0x51a259,data:_0x5320c3,originalSuggestionId:_0x39efbc,attributes:_0x1dcf35})=>{await this['_waitForServiceReady']();const _0x268af8={'id':_0x58e31c,'type':_0x51a259,'data':_0x5320c3,'originalSuggestionId':_0x39efbc,'attributes':_0x1dcf35},_0x562873=await this['_trackChangesService']['add'](_0x58e31c,_0x51a259,_0x5320c3,_0x39efbc,_0x1dcf35)['catch'](_0x540dfa=>{if(mt(_0x540dfa))return new Promise(_0x551fca=>{this['_bufferedRequests']['set'](_0x58e31c,{'resolve':_0x551fca,'suggestionData':_0x268af8});});throw _0x540dfa;});return this['_bufferedRequests']['delete'](_0x58e31c),_0x562873;},'updateSuggestion':async(_0x41637b,_0x1f8d7f)=>{if(await this['_waitForServiceReady'](),'open'!==_0x1f8d7f['state'])return this['_trackChangesService']['update'](_0x41637b,_0x1f8d7f)['catch'](ft);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x13720b,_0x2d7490)=>{_0x3f3868['hasSuggestion'](_0x2d7490['id'])&&(_0x3f3868['getSuggestion'](_0x2d7490['id'])['attributes']=_0x2d7490['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x107576['connection']?.['state']&&(_0x107576['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x107576['connection'])['then'](_0x474c8f=>(_0x107576['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x474c8f)['then'](()=>{for(const _0x1a9de1 of _0x474c8f){_0x3f3868['addSuggestionData'](_0x1a9de1)['_saved']=!0x0;}})));}async reconnect(){const _0x453fde=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x3a22d5}=this['editor']['plugins']['get'](J),_0x3fa853=await this['_trackChangesService']['connect'](_0x3a22d5);await this['_fetchMissingUsersForThreads'](_0x3fa853);for(const {suggestionData:_0x39dc91,resolve:_0x4ed372}of this['_bufferedRequests']['values']()){let _0x5d5424=_0x3fa853['find'](_0x5d94af=>_0x5d94af['id']===_0x39dc91['id']);_0x5d5424||(_0x5d5424=await this['_trackChangesService']['add'](_0x39dc91['id'],_0x39dc91['type'],_0x39dc91['data'],_0x39dc91['originalSuggestionId'])),_0x4ed372(_0x5d5424);}for(const _0x5df17c of _0x3fa853)_0x453fde['hasSuggestion'](_0x5df17c['id'])||_0x453fde['addSuggestionData'](_0x5df17c);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x46e693=>{this['listenTo'](this['_trackChangesService'],'connected',_0x349815=>{_0x349815['off'](),_0x46e693();});});}async _fetchMissingUsersForThreads(_0x3ae361){const _0x1f6cc7=this['editor']['plugins']['get'](_0x5a638a),{connection:_0xb36bde}=this['editor']['plugins']['get'](J),_0x1137d0=new Set();for(const {authorId:_0x5a9497}of _0x3ae361)_0x1f6cc7['getUser'](_0x5a9497)||_0x1137d0['add'](_0x5a9497);if(0x0===_0x1137d0['size'])return;const _0x40dd63=await _0x3317f4['getMany'](_0xb36bde,Array['from'](_0x1137d0));for(const _0x45964e of _0x40dd63)_0x1f6cc7['getUser'](_0x45964e['id'])||_0x1f6cc7['addUser'](_0x45964e);}};function ft(_0xb14841){if(mt(_0xb14841))return new Promise(()=>{});throw _0xb14841;}function mt(_0x94c04a){return _0x94c04a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x94c04a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var pt=class extends _0x3b0285{static get requires(){return[_0x47a9b6,at,ct,J];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x566ff8=this['editor']['plugins']['get'](J),_0x374136=this['editor']['plugins']['get'](_0x288390),_0x544c64=this['editor']['plugins']['get'](at);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x566ff8,'change:state',(_0x49def6,_0x12e7bc,_0x3be0dc)=>{_0x374136['isThreadsLoadingPaused']='connected'!==_0x3be0dc;});}),this['listenTo'](_0x566ff8,'change:state',(_0x3398cb,_0x3c4060,_0x53c651)=>{this['editor']['plugins']['get'](_0x195514)['switchReadOnly']('connected'!==_0x53c651);}),_0x544c64['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x5427db=this['editor']['plugins']['get'](at),_0x346870=this['editor']['config']['get']('collaboration.channelId');_0x5427db['_services']['has'](_0x346870)&&_0x5427db['_terminateService'](_0x346870),super['destroy']();}},gt=class extends _0x3b0285{static get requires(){return[pt,ut,_0x2ac1a8];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class CloudServicesRevisionHistoryAdapter extends _0x3b0285{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
+ ((()=>_0x4d5139)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0x210853,Q,_0x5a638a];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xcd5adc){super(_0xcd5adc);const _0x4716cf=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x4716cf);}async init(){const _0x1f98af=this['editor']['plugins']['get'](it),_0x26fa85=_0x1f98af['serverHistory'],_0x138109=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x26fa85,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x1f98af['sessionId']});const _0xa8426e=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x3ee978,_0xa59eb5=await _0x48db14['isBundleUploaded'](_0x138109['connection'],_0xa8426e);this['editor']['plugins']['get'](_0x210853)['adapter']={'getRevision':async({revisionId:_0x372a02})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x372a02)),'updateRevisions':async _0x4a9d0e=>{await this['_waitForServiceReady']();const _0x420c65=this['_revisionTracker']['currentRevision'];if(_0xa59eb5&&0x1===_0x4a9d0e['length']&&_0x4a9d0e[0x0]['id']===_0x420c65['id'])return _0x4a9d0e;for(const _0x2560ac of _0x4a9d0e)_0x2560ac['id']===_0x420c65['id']&&(_0x2560ac['isEmptyCurrent']=_0x2560ac['fromVersion']===_0x2560ac['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x4a9d0e,this['_lastRequestId'])['then'](_0xe6d5e1=>(this['_lastRequestId']=_0xe6d5e1,_0x4a9d0e))['catch'](_0x5ad475=>{if(vt(_0x5ad475)||'400'===_0x5ad475['code']&&void 0x0!==_0x5ad475['data']['wrongRequestId']){for(const _0x4dd4a9 of _0x4a9d0e)this['_revisionTracker']['repository']['getRevision'](_0x4dd4a9['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x4dd4a9['id'],_0x4dd4a9,!0x1);if(vt(_0x5ad475)&&'destroyed'!==this['editor']['state'])throw _0x5ad475;return _0x4a9d0e;}throw _0x5ad475;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3d410c,{revisionsData:_0x2dbe04,requestId:_0x2c957a})=>{Math['max'](..._0x2dbe04['map'](_0x3d64a5=>_0x3d64a5['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x2dbe04,_0x2c957a);}):this['_handleRevisionsUpdate'](_0x2dbe04,_0x2c957a);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x138109['connection']?.['state']&&(_0x138109['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x2f14c1,requestId:_0x358519}=await this['_revisionHistoryService']['connect'](_0x138109['connection']);_0x138109['addToReconnectionStack'](this),this['_lastRequestId']=_0x358519,await this['_fetchMissingUsers'](_0x2f14c1);for(const _0x449ca6 of _0x2f14c1)this['_revisionTracker']['addRevisionData'](_0x449ca6);this['listenTo'](_0x1f98af,'change:_isConnected',(_0x4721cd,_0x38ae69,_0x46913c)=>{_0x46913c&&(this['_oldOffset']=_0x1f98af['_offset'],_0x4721cd['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x3ba3f8=this['editor']['plugins']['get'](J),_0x3db575=this['editor']['plugins']['get'](it),_0x228b18=async()=>{const _0x1f2e6d=this['_revisionTracker']['currentRevision'],_0x6cf235=_0x1f2e6d['id'],_0x5a41cd=_0x6cf235!==_0x3db575['sessionId'];if(_0x5a41cd){const _0x40cea5=_0x3db575['_offset']-this['_oldOffset'],_0x16c3cf=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x1f2e6d['toVersion']+_0x40cea5!==_0x16c3cf){const _0x5a5abf=_0x1f2e6d['fromVersion']+_0x40cea5,_0x48e1d0=this['editor']['plugins']['get'](_0x5a638a),_0x29ba83=this['_revisionTracker']['buildRevisionData']({'revision':_0x1f2e6d,'from':_0x5a5abf,'to':_0x16c3cf});_0x29ba83['id']=_0x1f2e6d['id'];const _0x55c804=_0x29ba83['authorsIds']['map'](_0x510a61=>_0x48e1d0['getUser'](_0x510a61));_0x1f2e6d['_update']({..._0x29ba83,'authors':_0x55c804},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1f2e6d['id'],_0x29ba83,!0x0);}this['_revisionTracker']['_startingVersion']=_0x16c3cf,_0x1f2e6d['toVersion']!==_0x1f2e6d['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x6cf235)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x6cf235),this['_revisionTracker']['_createCurrentRevision'](_0x16c3cf);}const {revisions:_0x35a250,requestId:_0x38e7e1}=await this['_revisionHistoryService']['reconnect'](_0x3ba3f8['connection'],this['_lastRequestId']);_0x5a41cd&&_0x35a250['length']>0x0?_0x3db575['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x35a250),this['_handleRevisionsUpdate'](_0x35a250,_0x38e7e1),this['_revisionTracker']['sendBufferedUpdates']());};return _0x3db575['_isConnected']?_0x228b18():new Promise((_0x288f8d,_0x579326)=>{_0x3db575['once']('change:_isConnected',()=>{_0x228b18()['then'](_0x288f8d)['catch'](_0x579326);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5d2ae6=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x1cef19=>{_0x1cef19['off'](),_0x5d2ae6();});});}_getLatestVersionFromServerOperations(){const _0x3869af=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0x2500ba of _0x3869af)if('marker'!==_0x2500ba['type']||_0x2500ba['affectsData'])return _0x2500ba['baseVersion']+0x1;}_getLatestVersion(){const _0x3091ea=this['editor']['plugins']['get'](it);return new Promise(_0x340595=>{_0x3091ea['_isPendingUpdate']?_0x3091ea['once']('change:_isPendingUpdate',()=>{_0x340595(this['_getLatestVersionFromServerOperations']());}):_0x340595(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x3b55b6,_0x3c948a){const _0x441596=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3c948a;for(const _0x4cb76d of _0x3b55b6){const _0x2f5c6a=_0x441596['getRevision'](_0x4cb76d['id']);if(_0x2f5c6a){if((_0x4cb76d['fromVersion']||_0x4cb76d['toVersion'])&&(_0x4cb76d['diffData']=null),_0x2f5c6a===this['_revisionTracker']['currentRevision']){const _0x10e3e6=Math['max'](_0x2f5c6a['toVersion'],_0x4cb76d['toVersion']),_0x1b75da=Math['max'](_0x2f5c6a['fromVersion'],_0x4cb76d['fromVersion']);let _0x29b01d;_0x2f5c6a['toVersion']===_0x4cb76d['toVersion']&&_0x2f5c6a['fromVersion']===_0x4cb76d['fromVersion']?(_0x29b01d=!0x0,this['_preventResendingRevisionData'](_0x4cb76d)):_0x4cb76d['toVersion']===_0x10e3e6&&_0x4cb76d['fromVersion']===_0x1b75da?_0x29b01d=!0x1:(_0x2f5c6a['toVersion']===_0x10e3e6&&_0x2f5c6a['fromVersion']===_0x1b75da||this['_fixRevision']({'revision':_0x2f5c6a,'from':_0x1b75da,'to':_0x10e3e6}),_0x29b01d=!0x0),_0x29b01d&&(delete _0x4cb76d['fromVersion'],delete _0x4cb76d['toVersion'],delete _0x4cb76d['diffData'],delete _0x4cb76d['createdAt'],delete _0x4cb76d['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x4cb76d),this['_preventResendingRevisionData'](_0x4cb76d);}else this['_revisionTracker']['addRevisionData'](_0x4cb76d);}const _0x44aa04=_0x441596['getRevisions']();_0x44aa04['reverse']();for(let _0x492c64=0x0;_0x492c64<_0x44aa04['length']-0x1;_0x492c64++){const _0x166223=_0x44aa04[_0x492c64],_0xef5f94=_0x44aa04[_0x492c64+0x1];if(_0x166223['fromVersion']<_0xef5f94['toVersion']){const _0x3b436a=_0xef5f94['toVersion'],_0x5bdb8d=Math['max'](_0x3b436a,_0x166223['toVersion']);this['_fixRevision']({'revision':_0x166223,'from':_0x3b436a,'to':_0x5bdb8d});}}}['_fixRevision']({revision:_0x2e5ed4,from:_0x38e141,to:_0x39f57a}={}){const _0x449913=this['editor']['plugins']['get'](_0x5a638a),_0x14208a=this['_revisionTracker']['buildRevisionData']({'revision':_0x2e5ed4,'from':_0x38e141,'to':_0x39f57a});_0x14208a['authors']=_0x14208a['authorsIds']['map'](_0x1001de=>_0x449913['getUser'](_0x1001de)),_0x2e5ed4['_update'](_0x14208a);}_preventResendingRevisionData(_0x889531){const _0x2d2fb2={};_0x2d2fb2['id']=_0x889531['id'];for(const _0x43e93e of Object['keys'](_0x889531))'id'!==_0x43e93e&&(_0x2d2fb2[_0x43e93e]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x2d2fb2['id'],_0x2d2fb2,!0x0);}async _fetchMissingUsers(_0x76a965){const _0x54a347=this['editor']['plugins']['get'](_0x5a638a),{connection:_0x23ad7b}=this['editor']['plugins']['get'](J),_0x1e0a0e=new Set();for(const _0x556ef8 of _0x76a965){for(const _0x3c0207 of _0x556ef8['authorsIds'])_0x29d579(_0x3c0207);_0x556ef8['creatorId']&&_0x29d579(_0x556ef8['creatorId']);}if(0x0===_0x1e0a0e['size'])return;const _0x43b7c2=await _0x3317f4['getMany'](_0x23ad7b,Array['from'](_0x1e0a0e));for(const _0x3d8a2d of _0x43b7c2)_0x54a347['getUser'](_0x3d8a2d['id'])||_0x54a347['addUser'](_0x3d8a2d);function _0x29d579(_0x1d4031){_0x54a347['getUser'](_0x1d4031)||_0x1e0a0e['add'](_0x1d4031);}}};function vt(_0x5adbb7){return _0x5adbb7['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x5adbb7['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5adbb7['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x3b0285{static get requires(){return[_0x210853,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x2aa6e7{_collapseAt;constructor(_0x4a535c,_0x189f6d=0x6){super(_0x4a535c);const _0x311025=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x189f6d,this['bind']('isHidden')['to'](this,'usersCount',_0x595c58=>_0x595c58<_0x189f6d),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x311025['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':_0x311025['to']('usersCount',_0x424010=>'+'+(_0x424010-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x2aa6e7{items;keystrokes;constructor(_0x2576fa){super(_0x2576fa);const _0x199c72=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0xf89fc5(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x199c72['if']('hasPopup'),'aria-expanded':_0x199c72['to']('isExpanded',_0x4ff0ca=>this['hasPopup']&&String(_0x4ff0ca)),'aria-label':_0x199c72['to']('hasPopup',_0x38fc65=>et(_0x2576fa,_0x38fc65?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x199c72['to']('hasPopup',_0x4148da=>!!_0x4148da&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0x179393,_0x3d991e,_0x2d15f2)=>{this['element']&&(_0x2d15f2?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']);}},kt=class extends _0x2aa6e7{counterView;inlineListView;constructor(_0x5264b7,_0x2181f8=0x6){super(_0x5264b7);const _0x558103=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0x2181f8),this['inlineListView']=new bt(_0x5264b7),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x42a027 of this['inlineListView']['items'])_0x42a027['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',_0x558103['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x2aa6e7{listWrapperView;constructor(_0x205e19,_0x1f1ec8){super(_0x205e19),this['listWrapperView']=new St(_0x205e19,_0x1f1ec8),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0x205e19,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0x4e0adb{constructor(_0x5f85b2,_0x4c64ca){super(_0x5f85b2);const _0x2e221b=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x4c64ca?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2e221b['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2e221b['to']('role'),'aria-label':_0x2e221b['to']('ariaLabel'),'aria-labelledby':_0x2e221b['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x2de15f['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x691e28=this['element'];_0x691e28&&(this['_isScrollable']=Math['max'](_0x691e28['scrollHeight'],_0x691e28['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0xf2227d{['userView'];constructor(_0x463645,_0x165910,_0x43aaf2){super(_0x463645);const _0x228638=this['bindTemplate'];this['userView']=new _0x3ee386(_0x463645,_0x165910);const _0x5a8a51={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x165910['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x165910['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x165910['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x165910['color']['getColorVariable'](),'--ck-user-color-alpha':_0x165910['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x43aaf2&&(_0x5a8a51['tag']='button',_0x5a8a51['on']={'click':_0x228638['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5a8a51);}['focus'](){this['element']['focus']();}},Ct=class extends _0x2aa6e7{['userView'];['markerView'];constructor(_0x479554,_0x1dc658,_0x547b09){super(_0x479554);const _0x4b9522=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x3ee386(_0x479554,_0x1dc658),this['markerView']=new At(_0x479554,_0x1dc658);const _0x10754a=new _0x3c3eed(_0x479554);_0x10754a['template']['tag']='span',_0x10754a['text']=_0x1dc658['name'];const _0x4d707e={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x4b9522['to']('isFocusable',_0x2a3195=>_0x2a3195?0x0:-0x1),'aria-labelledby':_0x10754a['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x4b9522['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x4b9522['to']('hasTooltip',_0x15bbb1=>!_0x15bbb1),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x10754a]};_0x547b09&&(_0x4d707e['tag']='button',_0x4d707e['on']={'click':_0x4b9522['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4d707e);}},At=class extends _0x2aa6e7{constructor(_0x3edb07,_0x1bc0e1){super(_0x3edb07),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1bc0e1['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x1bc0e1['color']['getColorVariable'](),'--ck-user-color-alpha':_0x1bc0e1['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x573424{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xe335ba){super(_0xe335ba),this['context']['config']['define']('presenceList',Pt);const _0x1fb691=_0xe335ba['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x1fb691)throw new _0x1f4bac('presencelist-collapseat-invalid-format',this);if(_0x1fb691<0x1)throw new _0x1f4bac('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0xe27579(),this['balloonPanelView']=new _0x364ce9(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x4f3dfe of this['_allConnectedUsers'])this['_handleUserAdd'](_0x4f3dfe);this['listenTo'](this['_allConnectedUsers'],'add',(_0x3e16b6,_0x50cf25)=>{this['_handleUserAdd'](_0x50cf25);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3fd616,_0x7a1873)=>{this['_handleUserRemove'](_0x7a1873);});}_createView(){const _0x56d5e7=this['context'],_0x139edd=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x150f21=this['balloonPanelView'];if(!_0x5b48c6(_0x56d5e7['config']['get']('presenceList.container')))throw new _0x1f4bac('presencelist-missing-container',this);_0x139edd['counterView']['bind']('usersCount')['to'](this),_0x139edd['bind']('isCollapsed')['to'](this,'usersCount',_0x1a7d26=>{const {collapseAt:_0x3d55c4}=_0x56d5e7['config']['get']('presenceList'),_0x783302=_0x1a7d26>=_0x3d55c4;if(_0x783302&&!_0x139edd['inlineListView']['items']['find'](_0x19a6de=>_0x19a6de instanceof yt)){const _0x509072=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x509072&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x139edd['inlineListView']['items']['add'](_0x139edd['counterView']);}return _0x783302||this['hideDropdown'](),_0x783302;}),_0x139edd['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x5287fd=>{const _0x339d4f=_0x56d5e7['config']['get']('presenceList'),_0x543b6d=new Ct(_0x56d5e7['locale'],_0x5287fd,!!_0x339d4f['onClick']);return _0x543b6d['bind']('hasTooltip')['to'](_0x139edd,'isCollapsed',_0x3b3cd=>!_0x3b3cd),_0x543b6d['bind']('isFocusable')['to'](_0x139edd,'isCollapsed',_0xe8e90f=>!_0xe8e90f),_0x339d4f['onClick']&&this['listenTo'](_0x543b6d,'execute',()=>{this['view']['isCollapsed']||_0x339d4f['onClick'](_0x5287fd,_0x543b6d['element']);}),_0x543b6d;}),_0x139edd['inlineListView']['keystrokes']['set']('Enter',(_0x24c48a,_0x12b15e)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x12b15e());}),_0x139edd['render'](),_0x150f21['render'](),_0x139edd['listenTo'](_0x139edd['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x10f212=(_0xe9ceea,_0x55957b)=>{this['_hideDropdownUnlessPointerInside'](_0x55957b);};return _0x139edd['listenTo'](_0x139edd['inlineListView']['element'],'mouseleave',_0x10f212),_0x139edd['listenTo'](_0x150f21['element'],'mouseleave',_0x10f212),_0x18eeb2({'emitter':_0x139edd,'activator':()=>_0x150f21['isVisible'],'contextElements':[_0x150f21['element'],_0x139edd['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x56d5e7['config']['get']('presenceList.container')['appendChild'](_0x139edd['element']),this['_overlayHost']=new _0x4ce28e(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0x139edd;}_resolveOverlayTarget(){const _0x5527c5=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0x5527c5)return _0x5527c5;const _0x437d8c=this['context']['config']['get']('presenceList.container');return _0x437d8c?_0x1a0178(_0x437d8c):null;}['_handleUserAdd'](_0x16d6fc){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x16d6fc['isMe'])return;const _0x3a325e=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x3a325e-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x3e6c46=_0x16d6fc['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x16d6fc,_0x3e6c46);}['_handleUserRemove'](_0x4dc7e1){this['usersCount']--;const {collapseAt:_0xdbd4fd}=this['context']['config']['get']('presenceList'),_0x4fab42=this['usersCount']>=_0xdbd4fd;if(this['currentDisplayedUsers']['get'](_0x4dc7e1['id']))this['currentDisplayedUsers']['remove'](_0x4dc7e1['id']);else{if(_0x4fab42&&this['currentDisplayedUsers']['length']+0x1===_0xdbd4fd-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x4fab42?0x1:0x0)<this['usersCount']){for(const _0xa4b93f of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0xa4b93f['id'])&&(this['currentDisplayedUsers']['add'](_0xa4b93f,Math['min'](this['currentDisplayedUsers']['length']-(_0x4fab42?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x4fab42?0x1:0x0)===_0xdbd4fd-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x44314f=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0x44314f['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x3eb8b2}=this['presenceDropdownView'];_0x3eb8b2['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x2b4c46=>{if(!_0x44314f['displayMe']&&_0x2b4c46['isMe'])return null;const _0x53314e=new Tt(this['context']['locale'],_0x2b4c46,!!_0x44314f['onClick']);return _0x44314f['onClick']&&this['listenTo'](_0x53314e,'execute',()=>{_0x44314f['onClick'](_0x2b4c46,_0x53314e['element']);}),_0x53314e;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']);const _0x21caae=_0x364ce9['generatePositions']({'heightOffset':0x3,'config':{'withArrow':!0x1}});this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element'],'positions':[_0x21caae['southArrowNorth'],_0x21caae['southArrowNorthMiddleWest'],_0x21caae['southArrowNorthMiddleEast'],_0x21caae['southArrowNorthWest'],_0x21caae['southArrowNorthEast'],_0x21caae['northArrowSouth'],_0x21caae['northArrowSouthMiddleWest'],_0x21caae['northArrowSouthMiddleEast'],_0x21caae['northArrowSouthWest'],_0x21caae['northArrowSouthEast'],_0x21caae['viewportStickyNorth']]}),_0x3eb8b2['focus'](),_0x3eb8b2['checkIfScrollable']();const _0x535006=(_0x4813b9,_0x2eea0c)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x2eea0c();};_0x3eb8b2['keystrokes']['set']('Esc',_0x535006),_0x3eb8b2['keystrokes']['set']('Shift+Tab',_0x535006),_0x3eb8b2['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x3eb8b2['focusTracker']['add'](this['view']['element']),_0x3eb8b2['focusTracker']['on']('change:isFocused',(_0x518a08,_0x4d85f2,_0x3d0783)=>{_0x3d0783||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);}_hideDropdownUnlessPointerInside(_0x179b49){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x512835=>_0x22725e(_0x512835,_0x179b49))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x573424{static get requires(){return[Q,Ot];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{at as CloudServicesCommentsAdapter,wt as CloudServicesRevisionHistoryAdapter,ut as CloudServicesTrackChangesAdapter,xt as PresenceList,Ot as PresenceListUI,it as RealTimeCollaborationClient,pt as RealTimeCollaborativeComments,ct as RealTimeCollaborativeEditing,_t as RealTimeCollaborativeRevisionHistory,gt as RealTimeCollaborativeTrackChanges,Q as Sessions,J as WebSocketGateway};