@ckeditor/ckeditor5-real-time-collaboration 49.0.0-alpha.2 → 49.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/translations/af.umd.js +1 -1
  3. package/dist/translations/ar.umd.js +1 -1
  4. package/dist/translations/ast.umd.js +1 -1
  5. package/dist/translations/az.umd.js +1 -1
  6. package/dist/translations/be.umd.js +1 -1
  7. package/dist/translations/bg.umd.js +1 -1
  8. package/dist/translations/bn.umd.js +1 -1
  9. package/dist/translations/bs.umd.js +1 -1
  10. package/dist/translations/ca.umd.js +1 -1
  11. package/dist/translations/cs.umd.js +1 -1
  12. package/dist/translations/da.umd.js +1 -1
  13. package/dist/translations/de-ch.umd.js +1 -1
  14. package/dist/translations/de.umd.js +1 -1
  15. package/dist/translations/el.umd.js +1 -1
  16. package/dist/translations/en-au.umd.js +1 -1
  17. package/dist/translations/en-gb.umd.js +1 -1
  18. package/dist/translations/en.umd.js +1 -1
  19. package/dist/translations/eo.umd.js +1 -1
  20. package/dist/translations/es-co.umd.js +1 -1
  21. package/dist/translations/es.umd.js +1 -1
  22. package/dist/translations/et.umd.js +1 -1
  23. package/dist/translations/eu.umd.js +1 -1
  24. package/dist/translations/fa.umd.js +1 -1
  25. package/dist/translations/fi.umd.js +1 -1
  26. package/dist/translations/fr.umd.js +1 -1
  27. package/dist/translations/gl.umd.js +1 -1
  28. package/dist/translations/gu.umd.js +1 -1
  29. package/dist/translations/he.umd.js +1 -1
  30. package/dist/translations/hi.umd.js +1 -1
  31. package/dist/translations/hr.umd.js +1 -1
  32. package/dist/translations/hu.umd.js +1 -1
  33. package/dist/translations/hy.umd.js +1 -1
  34. package/dist/translations/id.umd.js +1 -1
  35. package/dist/translations/it.umd.js +1 -1
  36. package/dist/translations/ja.umd.js +1 -1
  37. package/dist/translations/jv.umd.js +1 -1
  38. package/dist/translations/kk.umd.js +1 -1
  39. package/dist/translations/km.umd.js +1 -1
  40. package/dist/translations/kn.umd.js +1 -1
  41. package/dist/translations/ko.umd.js +1 -1
  42. package/dist/translations/ku.umd.js +1 -1
  43. package/dist/translations/lt.umd.js +1 -1
  44. package/dist/translations/lv.umd.js +1 -1
  45. package/dist/translations/ms.umd.js +1 -1
  46. package/dist/translations/nb.umd.js +1 -1
  47. package/dist/translations/ne.umd.js +1 -1
  48. package/dist/translations/nl.umd.js +1 -1
  49. package/dist/translations/no.umd.js +1 -1
  50. package/dist/translations/oc.umd.js +1 -1
  51. package/dist/translations/pl.umd.js +1 -1
  52. package/dist/translations/pt-br.umd.js +1 -1
  53. package/dist/translations/pt.umd.js +1 -1
  54. package/dist/translations/ro.umd.js +1 -1
  55. package/dist/translations/ru.umd.js +1 -1
  56. package/dist/translations/si.umd.js +1 -1
  57. package/dist/translations/sk.umd.js +1 -1
  58. package/dist/translations/sl.umd.js +1 -1
  59. package/dist/translations/sq.umd.js +1 -1
  60. package/dist/translations/sr-latn.umd.js +1 -1
  61. package/dist/translations/sr.umd.js +1 -1
  62. package/dist/translations/sv.umd.js +1 -1
  63. package/dist/translations/th.umd.js +1 -1
  64. package/dist/translations/ti.umd.js +1 -1
  65. package/dist/translations/tk.umd.js +1 -1
  66. package/dist/translations/tr.umd.js +1 -1
  67. package/dist/translations/tt.umd.js +1 -1
  68. package/dist/translations/ug.umd.js +1 -1
  69. package/dist/translations/uk.umd.js +1 -1
  70. package/dist/translations/ur.umd.js +1 -1
  71. package/dist/translations/uz.umd.js +1 -1
  72. package/dist/translations/vi.umd.js +1 -1
  73. package/dist/translations/zh-cn.umd.js +1 -1
  74. package/dist/translations/zh.umd.js +1 -1
  75. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Context as _0x24b052,ContextPlugin as _0x40687c,PendingActions as _0x46b075,Plugin as _0x42c452}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x18c6f6,Collection as _0x1c9906,DomEmitterMixin as _0x383f17,KeystrokeHandler as _0x362adb,getOverlayMountRoot as _0x42ec83,global as _0x4ce874,trustedHtml as _0x1c6d73,uid as _0x1a59ca,version as _0xfc776a}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0xa07487,LabelView as _0x4257d6,ListItemView as _0x1a0ed4,ListView as _0x492574,Notification as _0x463ec2,OverlayHost as _0x94d82e,View as _0x51c765,clickOutsideHandler as _0x5074c4}from'@ckeditor/ckeditor5-ui';import{History as _0x144afa,InsertOperation as _0x23e4aa,MarkerOperation as _0x336d67,ModelLiveRange as _0xbf4ce7,NoOperation as _0x2cb42f,OperationFactory as _0x4573e3,RootAttributeOperation as _0x4e4ab8,transformOperationSets as _0x1d7d93}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x3d8009}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0xcc0716,CommentsService as _0x4e0964,EditorService as _0x3c7c32,RevisionHistoryService as _0x1faca0,TrackChangesService as _0x52527a,User as _0x4e1e1e,WEB_SOCKET_GATEWAY_STATES as _0x4f05a5,WebSocketGateway as _0x41cf6c}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x61d070,Users as _0x1f9655,isPointerStillOver as _0x1a1620}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x2d43fb}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x15dd8e,TrackChangesEditing as _0x4a0de4}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x12fcfb,CommentsEditing as _0x3a4fbd,CommentsRepository as _0x2f6c6e}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x595b6f}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x42df98}from'es-toolkit/compat';var J=class WebSocketGateway extends _0x40687c{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
- ((()=>_0x41cf6c)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x3d8009,_0x463ec2];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x53a012){super(_0x53a012),this['set']('state',_0x4f05a5['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x383f17())();}init(){const _0x16b891=this['context'],_0x51fd4d=_0x16b891['plugins']['get'](_0x3d8009),_0x4adf6f=_0x16b891['plugins']['get'](_0x463ec2);if(!_0x51fd4d['token'])throw new _0x18c6f6('websocketgateway-missing-token',this);if(!_0x51fd4d['webSocketUrl'])throw new _0x18c6f6('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'](_0x51fd4d['token'],_0x51fd4d['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0xe6cf2a=>{if(this['connection']=_0xe6cf2a,this['bind']('state')['to'](_0xe6cf2a,'state',this,'_isBrowserOffline',(_0x292797,_0x2e8d18)=>('connected'!==_0x292797&&(this['_shouldPluginsReconnect']=!0x0),_0x2e8d18||_0x292797!==_0x4f05a5['CONNECTED']?_0x4f05a5['DISCONNECTED']:this['state']==_0x4f05a5['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x4f05a5['CONNECTING']):_0x4f05a5['CONNECTED'])),this['connection']['on']('error',(_0x26d596,_0x51f1eb)=>{if('limitExceeded'!==_0x51f1eb['code'])throw console['error'](_0x51f1eb),new _0x18c6f6('cloudservices-init',null,{'originalError':_0x51f1eb});_0x4adf6f['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'});}),!_0xe6cf2a['me'])return new Promise(_0x2ce652=>_0xe6cf2a['on']('change:me',_0x2ce652));})['catch'](_0x4b0775=>{throw console['error'](_0x4b0775),new _0x18c6f6('cloudservices-init',null,{'originalError':_0x4b0775});});}addToReconnectionStack(_0x153cbe){if('function'!=typeof _0x153cbe['reconnect'])throw new _0x18c6f6('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x153cbe))throw new _0x18c6f6('websocketgateway-plugin-already-registered',this,{'name':_0x153cbe['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x153cbe);}removeFromReconnectionStack(_0x3ae201){this['_reconnectionStack']['delete'](_0x3ae201);}isInReconnectionStack(_0x49dc4a){return this['_reconnectionStack']['has'](_0x49dc4a);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x518791=>_0x518791['reconnect']())))['then'](()=>this['state']=_0x4f05a5['CONNECTED'])['catch'](_0x3ecfce=>{throw console['error'](_0x3ecfce),new _0x18c6f6('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x4f05a5['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x40687c{['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,_0x1f9655];}constructor(_0x2c3cce){super(_0x2c3cce),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x1c9906(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1f9655);}init(){const _0x33119a=this['context']['plugins']['get'](J);this['listenTo'](_0x33119a,'change:state',(_0x57563e,_0xfbfdf8,_0x5139df)=>{if('connected'!==_0x5139df)this['channelSessions']['forEach'](_0x3c0d86=>_0x3c0d86['clear']()),this['channelConnectedUsers']['forEach'](_0x28c2e2=>_0x28c2e2['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x8b3075,_0x27e5a6]of this['_registeredSessions'])for(const _0x49e444 of _0x27e5a6)this['_handleSessionAdd'](_0x8b3075,_0x49e444);}}),this['_createUser'](_0x33119a['connection']['me'],!0x0);}register(_0xb6e14f,_0x2b4514){if(this['_registeredSessions']['has'](_0xb6e14f))throw new _0x18c6f6('sessions-register-already-registered',null,{'channelId':_0xb6e14f});this['_registeredSessions']['set'](_0xb6e14f,_0x2b4514),this['channelSessions']['set'](_0xb6e14f,new _0x1c9906()),this['channelConnectedUsers']['set'](_0xb6e14f,new _0x1c9906()),this['listenTo'](_0x2b4514,'add',(_0x14bee3,_0x21c0c8)=>this['_handleSessionAdd'](_0xb6e14f,_0x21c0c8)),this['listenTo'](_0x2b4514,'remove',(_0x3ecdda,_0x12f200)=>this['_handleSessionRemove'](_0xb6e14f,_0x12f200));for(const _0x44afee of _0x2b4514)this['_handleSessionAdd'](_0xb6e14f,_0x44afee);}unregister(_0x277685){if(!this['_registeredSessions']['has'](_0x277685))throw new _0x18c6f6('sessions-unregister-not-exist',null,{'channelId':_0x277685});const _0x413550=this['_registeredSessions']['get'](_0x277685);this['stopListening'](_0x413550);for(const _0x2d9200 of _0x413550)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x277685,_0x2d9200);this['_registeredSessions']['delete'](_0x277685),this['channelSessions']['delete'](_0x277685),this['channelConnectedUsers']['delete'](_0x277685);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0xa1bfdb){for(const _0x5e1ce3 of this['channelSessions']['values']())for(const _0x1dc8dd of _0x5e1ce3)if(_0x1dc8dd['id']===_0xa1bfdb)return _0x1dc8dd['user'];}getUserSessions(_0x30aea1,_0x21a382){const _0x8f5a12=_0x21a382?[this['channelSessions']['get'](_0x21a382)]:this['channelSessions']['values'](),_0x19cc82=new Set();for(const _0x217bc7 of _0x8f5a12)for(const _0x2d45ba of _0x217bc7)_0x2d45ba['user']['id']===_0x30aea1['id']&&_0x19cc82['add'](_0x2d45ba['id']);return _0x19cc82;}getUserRole(_0x27b44e){for(const _0x1bf383 of this['channelSessions']['values']())for(const _0x5ee4b0 of _0x1bf383)if(_0x5ee4b0['user']===_0x27b44e)return _0x5ee4b0['role'];}['_handleSessionAdd'](_0x107c5a,_0x25c6bf){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x7c29b=_0x25c6bf['user'],_0x417644=this['_users']['getUser'](_0x7c29b['id'])||this['_createUser'](_0x7c29b),_0x49da43=Object['assign']({},_0x25c6bf,{'user':_0x417644});if(this['channelSessions']['get'](_0x107c5a)['add'](_0x49da43),!_0x7c29b['hiddenInPresenceList']){const _0x18c5b1=this['channelConnectedUsers']['get'](_0x107c5a);_0x18c5b1['has'](_0x417644['id'])||_0x18c5b1['add'](_0x417644),this['allConnectedUsers']['has'](_0x417644['id'])||_0x7c29b['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x417644,_0x417644['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x107c5a,{'channelId':_0x107c5a,'session':_0x49da43});}['_handleSessionRemove'](_0x201fd4,_0x4b7846){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x461ec3=this['channelConnectedUsers']['get'](_0x201fd4),_0x2602a9=_0x4b7846['user'];_0x2602a9['id']&&(this['channelSessions']['get'](_0x201fd4)['remove'](_0x4b7846['id']),_0x461ec3['has'](_0x2602a9['id'])&&!this['getUserSessions'](_0x2602a9,_0x201fd4)['size']&&_0x461ec3['remove'](_0x2602a9['id']),this['allConnectedUsers']['get'](_0x2602a9['id'])&&!this['getUserSessions'](_0x2602a9)['size']&&this['allConnectedUsers']['remove'](_0x2602a9['id']));}_createUser(_0x41f7d3,_0x5b5da2){const _0x261380=this['_users']['addUser'](_0x41f7d3);return _0x5b5da2&&this['_users']['defineMe'](_0x41f7d3['id']),_0x261380['orderNumber']=this['_uniqueUsersCount']++,_0x261380;}},X=class extends _0x42c452{_domEmitter=new(_0x383f17())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x23b108=this['editor'],_0x3acd3e=_0x23b108['plugins']['get'](Q);_0x23b108['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0xe991de,{writer:_0x4908aa})=>function(_0x4d491c,_0x4692f8,_0xcbf04e,_0x16bf46){const _0x173049=_0x4d491c['markerName']['split'](':')[0x2],_0x2d38aa=_0xcbf04e['getUserBySessionId'](_0x173049);if(!_0x2d38aa||_0x173049===_0xcbf04e['mySessionId'])return;if(!_0x16bf46['model']['schema']['checkChild'](_0x4d491c['markerRange']['start'],'$text'))return;const _0x54f6e9={'class':'ck-user__marker\x20'+_0x2d38aa['color']['getMarkerClass'](),'style':tt(_0x2d38aa),'data-name':_0x2d38aa['name'],'data-session-id':_0x173049},_0x48858e=_0x16bf46['model']['markers']['get'](_0x4d491c['markerName'])['getStart'](),_0x53c250=_0x48858e['nodeAfter'],_0x57c725=_0x16bf46['model']['schema'];if(_0x53c250&&_0x57c725['isObject'](_0x53c250)&&_0x57c725['isInline'](_0x53c250)&&!_0x16bf46['model']['markers']['get']('user:range:'+_0x173049)['getRange']()['isCollapsed'])return;const _0x41d212=_0x48858e['parent'];return _0x16bf46['model']['schema']['isLimit'](_0x41d212)&&!_0x16bf46['model']['hasContent'](_0x41d212)&&(_0x54f6e9['contenteditable']=!0x1),function(_0x328e6b,_0x37e1fa,_0xb41596){const _0x467e86=_0x328e6b['createUIElement']('span',_0x37e1fa);return _0x328e6b['setCustomProperty']('userPositionMarker',!0x0,_0x467e86),_0x467e86['render']=function(_0x266cb5){const _0x3bdf29=this['toDomElement'](_0x266cb5),_0x4c16f5=document['createElement']('span');return _0x4c16f5['classList']['add']('ck-user__marker-tooltip'),_0x4c16f5['setAttribute']('contenteditable','false'),_0x4c16f5['setAttribute']('spellcheck','false'),_0x4c16f5['textContent']=_0xb41596['name'],_0x3bdf29['innerHTML']=_0x1c6d73('⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x4c16f5['outerHTML']+'⁠'),_0x3bdf29['addEventListener']('mouseenter',()=>{_0x3bdf29['classList']['add']('ck-user__marker_hovered');}),_0x3bdf29['addEventListener']('mouseleave',()=>{_0x3bdf29['classList']['remove']('ck-user__marker_hovered');}),_0x3bdf29;},_0x467e86['isSimilar']=function(_0x3b9789){return!(!this['getCustomProperty']('userPositionMarker')||!_0x3b9789['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x3b9789['getAttribute']('data-session-id'));},_0x467e86;}(_0x4692f8,_0x54f6e9,_0x2d38aa);}(_0xe991de,_0x4908aa,_0x3acd3e,_0x23b108)}),_0x23b108['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x3d5b21=>function(_0xbcc5e5,_0x5577d0){const _0x456d9d=_0xbcc5e5['markerName']['split'](':')[0x2];if(_0x456d9d===_0x5577d0['mySessionId'])return null;const _0x753909=_0x5577d0['getUserBySessionId'](_0x456d9d);return _0x753909?{'id':_0x456d9d,'classes':['ck-user__selection',_0x753909['color']['getSelectionClass']()],'attributes':{'style':tt(_0x753909),'data-session-id':_0x456d9d},'priority':0x7d0+_0x753909['orderNumber']}:{'id':_0x456d9d,'classes':[]};}(_0x3d5b21,_0x3acd3e)}),function(_0x1491ab){const _0x3bc4bb=_0x1491ab['model'],_0x2965c7=new Map(),_0x310690=_0x1491ab['plugins']['get'](Q);_0x3bc4bb['markers']['on']('update:user:range',(_0x50183b,_0xdf81f4,_0x163d51,_0x8f7e80)=>{if(!_0x8f7e80&&_0x2965c7['get'](_0xdf81f4['name']))return _0x2965c7['get'](_0xdf81f4['name'])['detach'](),void _0x2965c7['delete'](_0xdf81f4['name']);const _0xcbc09b=_0xdf81f4['name']['split'](':')[0x2];if(_0xcbc09b===_0x310690['mySessionId'])return;const _0x3f4dcb='user:position:'+_0xcbc09b;_0x3bc4bb['markers']['has'](_0x3f4dcb)&&_0x1491ab['editing']['reconvertMarker'](_0x3f4dcb),_0xdf81f4['on']('change:range',(_0x451ea5,_0x18333a,_0x923dac)=>{if('$graveyard'!=_0x18333a['root']['rootName']&&'$graveyard'==_0xdf81f4['getRange']()['root']['rootName']&&!_0x2965c7['has'](_0xdf81f4['name'])){const _0x29d6a7=_0x3bc4bb['schema']['getNearestSelectionRange'](_0x923dac['deletionPosition']);if(_0x29d6a7){const _0x3846cc=_0xbf4ce7['fromRange'](_0x29d6a7);_0x2965c7['set'](_0xdf81f4['name'],_0x3846cc),_0x3846cc['on']('change:range',(_0xc3b250,_0x366d80,_0x139baf)=>{if('$graveyard'==_0x3846cc['root']['rootName']){const _0x122c40=_0x3bc4bb['schema']['getNearestSelectionRange'](_0x139baf['deletionPosition']);_0x122c40?(_0x3846cc['start']=_0x122c40['start'],_0x3846cc['end']=_0x122c40['end']):(_0x2965c7['delete'](_0xdf81f4['name']),_0x3846cc['detach']());}});}}});}),_0x3bc4bb['document']['on']('change',()=>{_0x2965c7['size']>0x0&&_0x3bc4bb['enqueueChange']({'isUndoable':!0x1},_0x15262b=>{for(const [_0x49259b,_0x47f3a0]of _0x2965c7)'$graveyard'==_0x3bc4bb['markers']['get'](_0x49259b)['getRange']()['root']['rootName']&&(Z(_0x49259b['split'](':')[0x2],_0x47f3a0['toRange'](),_0x3bc4bb,_0x15262b),_0x47f3a0['detach']());_0x2965c7['clear']();});});}(_0x23b108),this['_domEmitter']['listenTo'](_0x4ce874['document'],'keydown',(_0x62bc8e,{key:_0x3a0ed8})=>{'Escape'===_0x3a0ed8&&function(_0x1a311f){_0x1a311f['editing']['view']['change'](_0x35190a=>{for(const _0x5b5079 of _0x1a311f['model']['markers']){if(!_0x5b5079['name']['startsWith']('user:position'))continue;const _0x182801=_0x1a311f['editing']['mapper']['markerNameToElements'](_0x5b5079['name']);if(_0x182801){for(const _0x2028b6 of _0x182801)_0x35190a['removeClass']('ck-user__marker_hovered',_0x2028b6);}}});}(_0x23b108);},{'useCapture':!0x0});}afterInit(){const _0x3a3178=this['editor'],_0x3ee36b=_0x3a3178['commands']['get']('undo');_0x3ee36b&&_0x3a3178['model']['on']('applyOperation',(_0x423dcd,_0xac20dc)=>{const _0x33d96b=_0xac20dc[0x0];if(!_0x33d96b['isDocumentOperation'])return;if('marker'!=_0x33d96b['type']||!_0x33d96b['name']['startsWith']('user:'))return;const _0x4552e3=_0x33d96b['batch'];_0x3ee36b['_createdBatches']['has'](_0x4552e3)&&(_0x33d96b['newRange']=_0x33d96b['oldRange']?_0x3a3178['model']['createRange'](_0x33d96b['oldRange']['start'],_0x33d96b['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x111bd1=this['editor'],_0x5f2d4f=_0x111bd1['model']['document'],_0x259dab=_0x111bd1['plugins']['get'](Q);_0x111bd1['model']['enqueueChange']({'isUndoable':!0x1},_0xbde811=>{const _0x5881f7='user:range:'+_0x259dab['mySessionId'],_0x3b5592='user:position:'+_0x259dab['mySessionId'],_0x30ebb5=_0x111bd1['model']['markers']['has'](_0x5881f7);_0x111bd1['editing']['view']['hasDomSelection']?Z(_0x259dab['mySessionId'],_0x5f2d4f['selection']['getFirstRange'](),_0x111bd1['model'],_0xbde811):_0x30ebb5&&(_0xbde811['removeMarker'](_0x5881f7),_0xbde811['removeMarker'](_0x3b5592));});}};function Z(_0x169399,_0x58aa7f,_0x18f81b,_0x33d3a5){const _0x1e973f='user:range:'+_0x169399,_0x56481e='user:position:'+_0x169399,_0x2eada9=_0x58aa7f['getContainedElement']();let _0x252a8b=_0x58aa7f['start'];if(_0x2eada9&&_0x2eada9['is']('element','tableCell')){const _0x3353be=function(_0x37be86,_0x4883d0){for(const _0x4c6e4f of _0x37be86['getPositions']())if(_0x4883d0['schema']['checkChild'](_0x4c6e4f,'$text'))return _0x4c6e4f;}(_0x58aa7f,_0x18f81b);_0x3353be&&(_0x252a8b=_0x3353be,_0x58aa7f=_0x33d3a5['createRange'](_0x252a8b));}const _0x3993f6=_0x33d3a5['createRange'](_0x252a8b);_0x18f81b['markers']['has'](_0x1e973f)?(_0x33d3a5['updateMarker'](_0x1e973f,{'range':_0x58aa7f}),_0x33d3a5['updateMarker'](_0x56481e,{'range':_0x3993f6})):(_0x33d3a5['addMarker'](_0x1e973f,{'range':_0x58aa7f,'usingOperation':!0x0}),_0x33d3a5['addMarker'](_0x56481e,{'range':_0x3993f6,'usingOperation':!0x0}));}function tt(_0x409273){return'--ck-user-color:'+_0x409273['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x409273['color']['getColorAlphaVariable']()+';';}function et(_0x48ccdf,_0x59a7b1,_0x32577d){const _0x2f8dab=_0x48ccdf['t'],t=_0x48ccdf['t'];switch(_0x59a7b1){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 _0x2f8dab({'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'},_0x32577d);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x42c452{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
- ((()=>_0xcc0716)());_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,_0x46b075,_0x1f9655,_0x463ec2];}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 _0x21827c=this['serverHistory']['getOperations']();for(let _0x54ed06=_0x21827c['length']-0x1;_0x54ed06>=0x0;_0x54ed06--){const _0x29977e=_0x21827c[_0x54ed06];if(!this['_disconnectionOperations']['has'](_0x29977e))return _0x29977e['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x269f80){if(super(_0x269f80),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x144afa(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x18c6f6('collaboration-missing-channelid',this);const _0xfb32ab=_0x269f80['config']['get']('cloudServices.bundleVersion')||_0xfc776a;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0xfb32ab,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x2d43fb(),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 _0x2092cc=this['editor'],_0x1f93b5=_0x2092cc['plugins']['get'](_0x1f9655),_0x3d4d21=_0x2092cc['plugins']['get'](J);this['listenTo'](_0x1f93b5,'getOperationAuthor',(_0x4ad0a8,_0x19ce89)=>{const _0x46a218=_0x19ce89[0x0];_0x46a218['_authorId']&&(_0x4ad0a8['return']=_0x1f93b5['getUser'](_0x46a218['_authorId']),_0x4ad0a8['stop']()),null===_0x46a218['_authorId']&&(_0x4ad0a8['return']=null,_0x4ad0a8['stop']());},{'priority':'high'}),this['listenTo'](_0x2092cc['model']['document']['selection'],'change:range',(_0x2df34d,_0x3eb03a)=>{_0x3eb03a['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x2092cc['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x2092cc['model']['on']('applyOperation',(_0x5897b2,_0x270ac1)=>{const _0x58180e=_0x270ac1[0x0];_0x58180e['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x58180e),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x3d4d21,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x28a6bd,_0x138020,_0x273d24)=>'connected'===_0x28a6bd&&!_0x138020&&!_0x273d24),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x2092cc['disableReadOnlyMode']('rtc-offline'):_0x2092cc['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x2092cc['disableReadOnlyMode']('rtc-offline'):_0x2092cc['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0xfd4de9=this['editor']['plugins']['get'](Q),_0x1b0654=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0xfd4de9['unregister'](this['_channelId']);const _0x512060=await this['_service']['reconnect'](_0x1b0654['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x512060)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x505a3b=await this['_service']['getConnectedSessions']();_0xfd4de9['register'](this['_channelId'],_0x505a3b),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x259129){if(function(_0x59c1e6){return'404'===_0x59c1e6['code'];}(_0x259129)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4a50b0){return'409'===_0x4a50b0['code'];}(_0x259129)){const _0x4ea1b0=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'](_0x4ea1b0);}else{if(!(_0x259129 instanceof nt))throw _0x259129;this['_handleReconnectionError']();}}}}destroy(){const _0x16c1ff=this['editor']['plugins']['get'](J),_0x48ec2c=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x48ec2c['channelSessions']['has'](this['_channelId'])&&_0x48ec2c['unregister'](this['_channelId']),_0x16c1ff['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x74e2bd){if(this['sessionId']!==_0x74e2bd['sessionId']&&this['_lastSyncedOperationId']!==_0x74e2bd['lastOperationId'])throw new nt();return this['sessionId']=_0x74e2bd['sessionId'],this['_handleServerResponse']([],{..._0x74e2bd,'wereChangesApplied':!0x1,'data':_0x74e2bd['data']},'reconnect');}async _connectService(_0x37e61b,_0x46d726=!0x1){const {connection:_0xc4f689}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0xc4f689,this['_channelId'])['then'](_0x96b3a1=>this['_initSessionsHandling'](_0x96b3a1))['catch'](_0x43136c=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x43136c);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4482da,_0x2ffdfe)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x2ffdfe);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0xafba83=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x37e61b);this['_isPendingUpdate']=!0x0;const _0x36abfb=await this['_service']['connect'](_0xc4f689,this['_compressOperations'](_0x37e61b),_0xafba83);if(this['sessionId']=_0x36abfb['sessionId'],_0x46d726){if(!_0x36abfb['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x36abfb['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x37e61b,_0x36abfb,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x36abfb,_0x37e61b);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x4a071c=this['editor']['plugins']['get'](Q),_0x2bb2f6=this['editor']['plugins']['get'](X),_0x1cb1c4=_0x4a071c['channelSessions']['get'](this['_channelId']);_0x1cb1c4&&_0x1cb1c4['length']>0x1?_0x2bb2f6['createUserMarkerOperations']():this['listenTo'](_0x4a071c,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x4a071c['channelSessions']['get'](this['_channelId'])['length']&&_0x2bb2f6['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x4c2ea3,_0x378dc9,_0x54093d,_0x1430b0){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x378dc9){const _0x441c80=this['_decompressOperations'](_0x54093d,_0x1430b0);await this['_fetchMissingUsers'](_0x441c80),this['_handleExternalOperations'](_0x441c80,_0x378dc9,_0x54093d['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x4ebb9d}=this['editor'];let _0x397c8f;try{_0x397c8f=await this['_service']['getDocumentDetails']();}catch{const _0x389ef4=et(_0x4ebb9d,'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'](_0x389ef4);}const _0x4f2c74=_0x397c8f['currentDocumentSession']||_0x397c8f['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x4f2c74['lastOperationId']){const _0x1a101a=et(_0x4ebb9d,'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'](_0x1a101a);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x2cfc21=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0x2cfc21['connection']||'connected'!==_0x2cfc21['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0xf5be93=this['editor']['plugins']['get'](Q);_0xf5be93['channelSessions']['has'](this['_channelId'])&&_0xf5be93['unregister'](this['_channelId']),_0x2cfc21['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x505533){const _0x5259f8=this['editor']['plugins']['get'](Q);this['listenTo'](_0x5259f8,'sessionAdd:'+this['_channelId'],(_0x3d695c,{session:_0x29749a})=>{if(_0x29749a['id']===_0x5259f8['mySessionId']){_0x3d695c['off']();const _0x848dd=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x207193=_0x29749a['permissions'];_0x848dd&&_0x848dd['isEnabled']&&(_0x207193=_0x207193['filter'](_0x1a63b4=>'document:write'!==_0x1a63b4)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x207193,this['_channelId']);}}),_0x5259f8['register'](this['_channelId'],_0x505533);}_initThrowingOnDataSet(){const _0x4d9855=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x26ad99)=>{if(!_0x26ad99[_0x26ad99['length']-0x1]['suppressErrorInCollaboration'])throw new _0x18c6f6('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x4d9855['apply'](this['editor']['data'],_0x26ad99);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x5ecf83,[_0x129f9f])=>{if(this['_document']['version'])throw new _0x18c6f6('realtimecollaborationclient-init-document-already-initialized',this);_0x5ecf83['stop'](),this['_setPendingAction']();const _0x3b6344=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x35a568])=>!_0x35a568['lazyLoad'])['map'](([_0x3d7022,_0x50efcd])=>[_0x3d7022,_0x50efcd['modelAttributes']||{}])),_0x3e0508=this['_getOperationsFromInitData'](_0x129f9f,_0x3b6344);0x0==_0x3e0508['length']&&_0x3e0508['push'](new _0x2cb42f(0x0)),_0x5ecf83['return']=this['_connectService'](_0x3e0508)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1d9ff6=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1d9ff6))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x31d6f5,[_0x2d0ad7,_0x282a24])=>{_0x31d6f5['stop']();const _0x5a266c=this['editor']['model']['document']['getRoot'](_0x2d0ad7);if(!this['_knownRootNames']['has'](_0x2d0ad7)){const _0x15d748=_0x282a24&&_0x282a24['data']?_0x282a24['data']:'',_0x44bb54=_0x282a24&&_0x282a24['attributes']?_0x282a24['attributes']:{};await this['_loadRoot'](_0x2d0ad7,_0x15d748,_0x44bb54);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x5a266c['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x5a266c);});},{'priority':'high'});}async _fetchMissingUsers(_0xda788d){const _0x5f4236=this['editor']['plugins']['get'](_0x1f9655),{connection:_0x13d55b}=this['editor']['plugins']['get'](J),_0x34f384=new Set();for(const _0x42d085 of _0xda788d){const _0x38066f=_0x42d085['_authorId'];_0x38066f&&!_0x5f4236['getUser'](_0x38066f)&&_0x34f384['add'](_0x38066f);}if(0x0===_0x34f384['size'])return;const _0x4330dc=await _0x4e1e1e['getMany'](_0x13d55b,Array['from'](_0x34f384));for(const _0x1fe438 of _0x4330dc)_0x5f4236['getUser'](_0x1fe438['id'])||_0x5f4236['addUser'](_0x1fe438);}_getOperationsFromInitData(_0x18ee19,_0x78701a={}){const _0x44b2bf=this['editor']['model'],_0x36417a=[];let _0xc4cb43=0x0;const _0x12bcae='string'==typeof _0x18ee19?{'main':_0x18ee19}:_0x18ee19;for(const _0x47a3c2 of Object['keys'](_0x12bcae)){if(!this['_document']['roots']['has'](_0x47a3c2))throw new _0x18c6f6('realtimecollaborationclient-init-non-existent-root',this);const _0x2b67fa=this['_document']['getRoot'](_0x47a3c2),_0xdf5463=this['editor']['data']['parse'](_0x12bcae[_0x47a3c2],_0x2b67fa),_0x5cbf7c=new _0x23e4aa(_0x44b2bf['createPositionAt'](_0x2b67fa,0x0),_0xdf5463,_0xc4cb43++);_0x36417a['push'](_0x5cbf7c);for(const [_0x3645fc,_0x2cf076]of _0xdf5463['markers']){const _0x439597=_0x44b2bf['createRange'](_0x44b2bf['createPositionFromPath'](_0x2b67fa,_0x2cf076['start']['path']['slice']()),_0x44b2bf['createPositionFromPath'](_0x2b67fa,_0x2cf076['end']['path']['slice']())),_0x20040f=new _0x336d67(_0x3645fc,null,_0x439597,_0x44b2bf['markers'],!0x0,_0xc4cb43++);_0x36417a['push'](_0x20040f);}}if(_0x78701a)for(const [_0x351e56,_0x3de879]of Object['entries'](_0x78701a)){const _0x55a1ec=_0x44b2bf['document']['getRoot'](_0x351e56);if(!_0x55a1ec)throw new _0x18c6f6('multi-root-editor-root-attributes-no-root',null);for(const [_0x29aadd,_0x159684]of Object['entries'](_0x3de879))if(null!==_0x159684){const _0x1e460e=new _0x4e4ab8(_0x55a1ec,_0x29aadd,null,_0x159684,_0xc4cb43++);_0x36417a['push'](_0x1e460e);}}return _0x36417a;}async _loadRoot(_0xc139b7,_0x2c3634,_0x3fd2af){this['_getOperationsFromInitData']({[_0xc139b7]:_0x2c3634},{[_0xc139b7]:_0x3fd2af})['forEach']((_0x529aed,_0x2b3e6c)=>{_0x529aed['baseVersion']=this['_document']['version']+_0x2b3e6c,_0x529aed['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x529aed);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x33d03b,_0x385c8f){let _0x26e23e;this['_offset']=_0x33d03b['offset'];const _0x5cebdc=_0x33d03b['wereChangesApplied']&&!_0x33d03b['initData'],_0x211050=_0x5cebdc?0x0:_0x33d03b['data']['baseVersion'];if(_0x385c8f['forEach'](_0x2e6f2e=>{_0x2e6f2e['_isInit']=!0x0,_0x2e6f2e['createdAt']=_0x33d03b['sessionCreatedAt'],_0x2e6f2e['_authorId']=null;}),_0x5cebdc)_0x26e23e=_0x385c8f,this['_applyOperationsSet'](_0x26e23e,_0x5cebdc);else{if(_0x33d03b['initData']){const _0x1ac03f=this['_getOperationsFromInitData'](_0x33d03b['initData']);this['_document']['history']['version']=-_0x1ac03f['length'],_0x1ac03f['forEach'](_0x330165=>{_0x330165['baseVersion']-=_0x1ac03f['length'],_0x330165['createdAt']=_0x33d03b['sessionCreatedAt'],_0x330165['_isInit']=!0x0,_0x330165['_authorId']=null;}),this['_applyOperationsSet'](_0x1ac03f,!0x0),this['serverHistory']['version']=-_0x1ac03f['length']+this['_offset'],this['_updateServerHistory'](_0x1ac03f);}this['_document']['history']['version']=_0x211050,_0x26e23e=this['_decompressOperations'](_0x33d03b['data'],_0x33d03b['metadata']),await this['_fetchMissingUsers'](_0x26e23e),this['_applyOperationsSet'](_0x26e23e,_0x5cebdc);}_0x33d03b['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x26e23e,_0x33d03b['lastOperationId']),this['_lastSyncedOperationId']=_0x33d03b['lastOperationId']),this['serverHistory']['version']=_0x211050+this['_offset'],this['_updateServerHistory'](_0x26e23e),_0x385c8f['filter'](_0x30d8b8=>{const _0x2375bb=this['_getAffectedRoot'](_0x30d8b8);return _0x2375bb&&!this['_knownRootNames']['has'](_0x2375bb);})['forEach']((_0x3359a8,_0x28c356)=>{_0x3359a8['baseVersion']=this['_document']['version']+_0x28c356,this['_saveOperationInBuffer'](_0x3359a8);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x95648,_0x269b60){const _0x400b32=_0x269b60&&_0x269b60['message'];if(_0x400b32&&_0x400b32['startsWith']('realtimecollaborationclient'))throw _0x269b60;const _0xe8f10b=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0xe8f10b['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x18c6f6(_0x95648,this['editor'],_0x400b32?{'originalError':_0x400b32}:void 0x0);}_saveOperationInBuffer(_0x542ff6){this['_knownOperations']['has'](_0x542ff6)||(this['_knownOperations']['add'](_0x542ff6),this['_bufferedOperations']['push'](_0x542ff6),this['_pendingAction']||'marker'==_0x542ff6['type']&&!_0x542ff6['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x539d2d=!0x1){!_0x539d2d&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x34658d=>{_0x34658d&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x19ce10=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x39e752){return _0x39e752['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x39e752['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x39e752['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x19ce10)||this['_crash'](_0x19ce10['message'],_0x19ce10);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x38009d=>{this['on']('change:_isPendingUpdate',()=>{_0x38009d();});});}async _sendBufferedOperations(){const _0x448333=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0x448333['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x4e1fed=[...this['_bufferedOperations']];for(const _0x4750a0 of _0x4e1fed)_0x4750a0['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x4750a0);const _0x3bca38=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4e1fed),_0xcaf594=st++,_0x2c2d72=this['_compressOperations'](_0x4e1fed),_0x58f197=await this['_service']['sendOperations'](_0x2c2d72,_0x2c2d72['baseVersion'],_0x3bca38);try{return await this['_handleServerResponse'](_0x4e1fed,_0x58f197,_0xcaf594);}catch(_0x2a4d65){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x2a4d65);}}async['_handleServerResponse'](_0x5eeb65,_0x6f7ffd,_0x355a8a){if('error'in _0x6f7ffd)throw _0x6f7ffd['error'];let _0x51467d;if(_0x6f7ffd['wereChangesApplied']){_0x6f7ffd['lastOperationId']&&(this['_lastSyncedOperationId']=_0x6f7ffd['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x76a347=>!_0x5eeb65['includes'](_0x76a347));for(const _0x1b3146 of _0x5eeb65)_0x1b3146['createdAt']='lastOperationAcceptedAt'in _0x6f7ffd&&_0x6f7ffd['lastOperationAcceptedAt']||void 0x0;ot(_0x5eeb65,_0x6f7ffd['version']-_0x5eeb65['length']),this['_updateServerHistory'](_0x5eeb65);const _0x4381eb=_0x5eeb65['filter'](_0x5d489c=>{if(!_0x5d489c['_isInit'])return!0x1;const _0x2cbe5d=this['_getAffectedRoot'](_0x5d489c);return _0x2cbe5d&&!this['_knownRootNames']['has'](_0x2cbe5d);});ot(_0x4381eb,this['_document']['version']),this['_applyOperationsSet'](_0x4381eb),_0x51467d=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x5ee2fd=this['_decompressOperations'](_0x6f7ffd['data'],_0x6f7ffd['metadata'])['filter'](_0x2599b8=>_0x2599b8['baseVersion']>=this['_lastServerVersion']);_0x5ee2fd['forEach'](_0x13c9a1=>this['_addKnownRoot'](_0x13c9a1)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0xde9d3a=>!_0xde9d3a['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0xde9d3a))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x5ee2fd),_0x51467d=this['_handleExternalOperations'](_0x5ee2fd,_0x6f7ffd['version'],_0x6f7ffd['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x51467d?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x14f024,_0x3d2a5e,_0x44f2c5){try{const _0x2f4210={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x2e4ad2,operationsB:_0x2129b8,originalOperations:_0x58b3f1}=_0x1d7d93(_0x14f024,this['_bufferedOperations'],_0x2f4210);ot(_0x2e4ad2,this['_document']['version']),ot(_0x2129b8,_0x3d2a5e);for(const _0x397897 of _0x2e4ad2){const _0x31f4fd=_0x58b3f1['get'](_0x397897);_0x31f4fd?(_0x397897['_authorId']=_0x31f4fd['_authorId'],'noop'!==_0x397897['type']&&(_0x397897['_aiSource']=_0x31f4fd['_aiSource'])):_0x397897['_authorId']=null;}for(const _0x3254a0 of _0x2129b8)'noop'!==_0x3254a0['type']&&(_0x3254a0['_aiSource']=_0x58b3f1['get'](_0x3254a0)?.['_aiSource']);_0x44f2c5&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x14f024,_0x44f2c5),this['_lastSyncedOperationId']=_0x44f2c5),this['_bufferedOperations']=[..._0x2129b8],this['_applyOperationsSet'](_0x2e4ad2),this['_updateServerHistory'](_0x14f024);}catch(_0x540735){return console['error'](_0x540735),!0x1;}return!0x0;}_applyOperationsSet(_0x326662,_0x26ee94=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x5e38a=>{for(const _0x6f604a of _0x326662)this['_knownOperations']['add'](_0x6f604a),this['_addKnownRoot'](_0x6f604a),_0x5e38a['batch']['addOperation'](_0x6f604a),this['editor']['model']['applyOperation'](_0x6f604a);});}_addKnownRoot(_0x292db8){const _0xf79bd8=this['_getAffectedRoot'](_0x292db8);_0xf79bd8&&this['_knownRootNames']['add'](_0xf79bd8);}_getAffectedRoot(_0x4d196c){let _0x1a9e90,_0x381ad8;switch(_0x4d196c['type']){case'insert':_0x1a9e90=_0x4d196c['position']['root'];break;case'marker':if(_0x381ad8=_0x4d196c['newRange'],!_0x381ad8)return null;_0x1a9e90=_0x381ad8['root'];break;case'addRootAttribute':_0x1a9e90=_0x4d196c['root'];break;case'addRoot':_0x1a9e90=_0x4d196c['affectedSelectable'];break;case'move':_0x1a9e90=_0x4d196c['targetPosition']['root'];break;default:return null;}return _0x1a9e90['rootName'];}_updateServerHistory(_0x4e0708){_0x4e0708['forEach'](_0x3b37c0=>{const _0x5c1aa3=_0x3b37c0['clone']();_0x5c1aa3['_authorId']=_0x3b37c0['_authorId'],_0x5c1aa3['_isInit']=!!_0x3b37c0['_isInit'],_0x5c1aa3['_aiSource']=_0x3b37c0['_aiSource'],_0x5c1aa3['createdAt']=_0x3b37c0['createdAt'],_0x5c1aa3['baseVersion']+=this['_offset'],_0x3b37c0['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x5c1aa3),this['serverHistory']['addOperation'](_0x5c1aa3);});}_handleReconnectionError(_0x744e09){const _0x3136c2=this['editor']['plugins']['get']('Notification'),_0x4c2b09=this['editor']['locale'];_0x744e09||(_0x744e09=et(_0x4c2b09,'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.')),_0x3136c2['showWarning'](_0x744e09,{'title':et(_0x4c2b09,'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'](_0x46b075)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x46b075)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x31b2f7){const _0x53b684=_0x31b2f7['map'](_0x62f78e=>_0x62f78e['toJSON']());return this['_compressor']['compress'](_0x53b684);}_decompressOperations(_0x2611b4,_0x52a067){return this['_compressor']['decompress'](_0x2611b4)['map']((_0x44a038,_0x2585fb)=>{const _0x333360='init'==_0x52a067[_0x2585fb]['type'];if('InsertOperation'==_0x44a038['__className']){const _0x19774b=_0x44a038['position']['root'];!this['_document']['getRoot'](_0x19774b)&&(this['_document']['createRoot']('$unknown',_0x19774b)['_isAttached']=!0x1);}else{if('RootOperation'==_0x44a038['__className']){const _0x195c50=this['_document']['getRoot'](_0x44a038['rootName']);_0x195c50&&'$unknown'==_0x195c50['name']&&_0x44a038['elementName']!=_0x195c50['name']&&(_0x195c50['name']=_0x44a038['elementName']);}}const _0x445c7d=_0x4573e3['fromJSON'](_0x44a038,this['_document']);return _0x445c7d['wasUndone']=_0x44a038['wasUndone'],_0x445c7d['_isInit']=_0x333360,_0x445c7d['_authorId']=_0x333360?null:_0x52a067[_0x2585fb]['userId'],_0x445c7d['_isDisconnection']='cs:removeUser'===_0x52a067[_0x2585fb]['type'],_0x445c7d['_aiSource']=_0x44a038['_aiSource']||void 0x0,_0x445c7d['createdAt']=_0x52a067[_0x2585fb]['createdAt'],_0x445c7d;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x351dd1=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x351dd1&&_0x351dd1['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x28687f,_0x4a1265){for(const _0x4c98af of _0x28687f)_0x4c98af['baseVersion']=_0x4a1265++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0x5bcf65){this['_ignoredOperations']=_0x5bcf65,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x1dbeaf){let _0x30b7bc=_0x1dbeaf['length'];for(;_0x30b7bc--;){const _0x44b70a=_0x1dbeaf[_0x30b7bc];if(!this['_ignoredOperations']['has'](_0x44b70a)){if(!this['_operationToId']['has'](_0x44b70a)){const _0x42dfd5=_0x1a59ca()['slice'](0x1,0x12);this['_operationToId']['set'](_0x44b70a,_0x42dfd5);}return this['_operationToId']['get'](_0x44b70a);}}}setIdForTheLastOperation(_0xfa7adf,_0x5dddd1){if(!_0x5dddd1)return;let _0x20742f=_0xfa7adf['length'];for(;_0x20742f--;){const _0x5a6153=_0xfa7adf[_0x20742f];this['_ignoredOperations']['has'](_0x5a6153)||this['_operationToId']['set'](_0x5a6153,_0x5dddd1);}}},ct=class extends _0x42c452{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x40687c{static CommentsService=/* #__PURE__ -- @preserve */
26
- ((()=>_0x4e0964)());['_services'];static get requires(){return[J,_0x2f6c6e,Q,_0x1f9655];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x423651){super(_0x423651),this['_services']=new Map();}async init(){const _0x57acdc=this['context'],_0x38d40e=_0x57acdc['plugins']['get'](_0x2f6c6e);if(_0x57acdc['plugins']['get'](J)['addToReconnectionStack'](this),_0x38d40e['adapter']={'addCommentThread':async({channelId:_0x517e98,threadId:_0x41d9bb,comments:_0xc6d214,resolvedAt:_0x578702,resolvedBy:_0x4e8da1,context:_0x14d961,attributes:_0x4b90cc})=>{const _0x286cca=await this['_getService'](_0x517e98)['addCommentThread']({'commentThreadId':_0x41d9bb,'comments':_0xc6d214['map'](_0x553969=>function(_0x59ba4a,_0x406ed5,_0x48fb65){return{'commentThreadId':_0x48fb65,'commentId':_0x59ba4a['commentId'],'userId':_0x59ba4a['authorId'],'content':_0x59ba4a['content'],'documentId':_0x406ed5,'createdAt':_0x59ba4a['createdAt'],'attributes':_0x59ba4a['attributes']||{}};}(_0x553969,_0x517e98,_0x41d9bb)),'resolvedAt':_0x578702,'resolvedBy':_0x4e8da1,'context':_0x14d961,'attributes':_0x4b90cc})['catch'](lt);return{'threadId':_0x286cca['commentThreadId'],'comments':_0x286cca['comments']};},'getCommentThread':async({channelId:_0x37fa2c,threadId:_0x18c629})=>{const _0x2007b5=await this['_getService'](_0x37fa2c)['getCommentThread'](_0x18c629)['catch'](ht)['catch'](lt);return _0x2007b5?_0x2007b5['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x2007b5]),{'threadId':_0x2007b5['commentThreadId'],'comments':_0x2007b5['comments']['map'](dt),'context':_0x2007b5['context'],'resolvedAt':_0x2007b5['resolvedAt'],'resolvedBy':_0x2007b5['resolvedBy'],'attributes':_0x2007b5['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x108af8,threadId:_0x1eddde,context:_0x5e61e4,unlinkedAt:_0x4d9a4c,attributes:_0x5a8437})=>this['_getService'](_0x108af8)['updateCommentThread']({'commentThreadId':_0x1eddde,'context':_0x5e61e4,'attributes':_0x5a8437,'unlinkedAt':_0x4d9a4c})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x4fc847,threadId:_0xf61baa})=>{const _0x5eda9d=await this['_getService'](_0x4fc847)['resolveCommentThread'](_0xf61baa)['catch'](ht)['catch'](lt);return{'threadId':_0x5eda9d['commentThreadId'],'resolvedAt':_0x5eda9d['resolvedAt'],'resolvedBy':_0x5eda9d['resolvedBy']};},'reopenCommentThread':async({channelId:_0x4dd6f8,threadId:_0x2b3155})=>this['_getService'](_0x4dd6f8)['reopenCommentThread'](_0x2b3155)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x2600cb,threadId:_0x1db97d})=>this['_getService'](_0x2600cb)['removeCommentThread'](_0x1db97d)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x58e942,threadId:_0x23fa7a,commentId:_0x201d33,content:_0x4c4714,attributes:_0x28fa26})=>this['_getService'](_0x58e942)['addComment'](_0x23fa7a,_0x201d33,_0x4c4714,_0x28fa26)['catch'](lt),'updateComment':({channelId:_0x5eab2b,threadId:_0x90315f,commentId:_0x1c5caf,content:_0x33b759,attributes:_0x5ab704})=>this['_getService'](_0x5eab2b)['updateComment'](_0x90315f,_0x1c5caf,_0x33b759,_0x5ab704)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x19c15e,threadId:_0x5a1120,commentId:_0x48e9b4})=>this['_getService'](_0x19c15e)['removeComment'](_0x5a1120,_0x48e9b4)['catch'](ht)['catch'](lt)},_0x57acdc instanceof _0x24b052){const _0x193639=_0x57acdc['config']['get']('collaboration.channelId'),_0x3f452f=_0x57acdc['plugins']['get'](Q);await this['_setUpService'](_0x193639);const _0x4b511a=await this['_services']['get'](_0x193639)['getConnectedSessions']();this['listenTo'](_0x3f452f,'sessionAdd:'+_0x193639,(_0x2a78b8,{session:_0x34f227})=>{_0x34f227['id']===_0x3f452f['mySessionId']&&(_0x2a78b8['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x34f227['permissions'],_0x193639));}),_0x3f452f['register'](_0x193639,_0x4b511a);}}async _setUpService(_0x13e88b){if(this['_services']['has'](_0x13e88b))throw new _0x18c6f6('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x13e88b});const _0x473e01=this['context']['plugins']['get'](_0x2f6c6e),_0x100673=new CloudServicesCommentsAdapter['CommentsService'](_0x13e88b);this['_services']['set'](_0x13e88b,_0x100673),this['listenTo'](_0x100673,'commentThreadAdded',(_0x20f063,_0x3fb2a4)=>{const {commentThreadId:_0x327fe9,documentId:_0x29aa2d,context:_0x19774c,attributes:_0x59023c,resolvedAt:_0x3cb751,resolvedBy:_0x3fe0eb,comments:_0x2ecbaa}=_0x3fb2a4;_0x473e01['getCommentThread'](_0x327fe9)||_0x473e01['addCommentThread']({'threadId':_0x327fe9,'channelId':_0x29aa2d,'comments':_0x2ecbaa?_0x2ecbaa['map'](dt):[],'context':_0x19774c,'attributes':_0x59023c,'resolvedAt':_0x3cb751,'resolvedBy':_0x3fe0eb,'isFromAdapter':!0x0});}),this['listenTo'](_0x100673,'commentThreadUpdated',(_0x5423e2,{commentThreadId:_0x4a1abb,documentId:_0x16b6cf,context:_0x4cd655,unlinkedAt:_0x2dd3d0,attributes:_0x363251})=>{_0x473e01['getCommentThread'](_0x4a1abb)&&_0x473e01['updateCommentThread']({'threadId':_0x4a1abb,'channelId':_0x16b6cf,'context':_0x4cd655,'unlinkedAt':_0x2dd3d0,'attributes':_0x363251,'isFromAdapter':!0x0});}),this['listenTo'](_0x100673,'commentThreadResolved',(_0x1d56a5,{commentThreadId:_0x17ab98,resolvedBy:_0xe2dd61,resolvedAt:_0x15d8b2})=>{const _0x4672e7=_0x473e01['getCommentThread'](_0x17ab98);_0x4672e7&&_0x4672e7['resolve']({'resolvedBy':_0xe2dd61,'resolvedAt':_0x15d8b2,'isFromAdapter':!0x0});}),this['listenTo'](_0x100673,'commentThreadReopened',(_0x2d98d6,{commentThreadId:_0x283173})=>{const _0x3c3572=_0x473e01['getCommentThread'](_0x283173);_0x3c3572&&_0x3c3572['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x100673,'commentThreadRemoved',(_0x1138e2,{commentThreadId:_0x510c79})=>{const _0xe1eb9=_0x473e01['getCommentThread'](_0x510c79);_0xe1eb9&&_0xe1eb9['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x100673,'commentAdded',(_0x5acade,_0x414f7d)=>{const _0x2884=_0x414f7d['commentThreadId'],_0x1bb1bc=_0x473e01['getCommentThread'](_0x2884);_0x1bb1bc&&_0x1bb1bc['addComment']({...dt(_0x414f7d),'isFromAdapter':!0x0});}),this['listenTo'](_0x100673,'commentUpdated',(_0x1f0c5e,{commentThreadId:_0x4c5599,commentId:_0x1ef91f,content:_0x40a7f2,attributes:_0x59d7ac})=>{const _0xf63a3f=_0x473e01['getCommentThread'](_0x4c5599);if(_0xf63a3f){const _0xb17870=_0xf63a3f['getComment'](_0x1ef91f);_0xb17870&&_0xb17870['update']({'content':_0x40a7f2,'attributes':_0x59d7ac,'isFromAdapter':!0x0});}}),this['listenTo'](_0x100673,'commentRemoved',(_0xf370e,{commentThreadId:_0x6481a1,commentId:_0x19a3a9})=>{const _0x33e8d6=_0x473e01['getCommentThread'](_0x6481a1);if(_0x33e8d6){const _0x324e14=_0x33e8d6['getComment'](_0x19a3a9);_0x324e14&&_0x324e14['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x100673,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0x13e88b),this['stopListening'](_0x100673));}),await this['_connectService'](_0x13e88b);}destroy(){if(this['context']instanceof _0x24b052){const _0x36b70e=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x36b70e)&&this['_terminateService'](_0x36b70e);}}_terminateService(_0x322610){if(!this['_services']['has'](_0x322610))throw new _0x18c6f6('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x322610});this['_getService'](_0x322610)['disconnect'](),this['_services']['delete'](_0x322610);}async reconnect(){for(const _0x15b8b1 of this['_services']['keys']())await this['_connectService'](_0x15b8b1);if(this['context']instanceof _0x24b052){const _0xab9dec=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0xab9dec)){const _0x22bf7a=this['context']['plugins']['get'](Q);_0x22bf7a['unregister'](_0xab9dec);const _0x538663=await this['_services']['get'](_0xab9dec)['getConnectedSessions']();_0x22bf7a['register'](_0xab9dec,_0x538663);}}}async _connectService(_0x4efd12){const {connection:_0x1ac40f}=this['context']['plugins']['get'](J),_0x49d443=this['context']['plugins']['get'](_0x2f6c6e),_0x403f56=await this['_services']['get'](_0x4efd12)['connect'](_0x1ac40f);await this['_fetchMissingUsersForThreads'](_0x403f56);const _0x15cede=new Set(Array['from'](_0x49d443['getCommentThreads']({'channelId':_0x4efd12}),_0x13c684=>_0x13c684['id']));for(const _0x3d83a8 of _0x403f56)_0x3d83a8['deletedAt']||_0x15cede['delete'](_0x3d83a8['commentThreadId']);for(const _0x28199f of _0x15cede)_0x49d443['getCommentThread'](_0x28199f)['remove']({'isFromAdapter':!0x0});for(const _0x197b3f of _0x403f56){let _0x40182c=_0x49d443['getCommentThread'](_0x197b3f['commentThreadId']);const {commentThreadId:_0x451a32,context:_0x5b132b,attributes:_0x1e502c,resolvedBy:_0x2e58e6,resolvedAt:_0x7de2d0,unlinkedAt:_0x4ff7fc,deletedAt:_0x4aea08}=_0x197b3f;if(_0x4aea08)continue;_0x40182c||(_0x40182c=_0x49d443['addCommentThread']({'channelId':_0x4efd12,'threadId':_0x451a32,'context':_0x5b132b,'attributes':_0x1e502c||{},'resolvedBy':_0x2e58e6,'resolvedAt':_0x7de2d0,'unlinkedAt':_0x4ff7fc,'isFromAdapter':!0x0}));const _0x42d22f=new Set(Array['from'](_0x40182c['comments'],_0x1034f4=>_0x1034f4['id']));for(const _0x5da895 of _0x197b3f['comments'])_0x42d22f['delete'](_0x5da895['commentId']);for(const _0x3729d8 of _0x42d22f)_0x40182c['getComment'](_0x3729d8)['remove']({'isFromAdapter':!0x0});for(const _0x1ca44a of _0x197b3f['comments']){const _0x5a8b53=_0x40182c['getComment'](_0x1ca44a['commentId']);_0x5a8b53?_0x5a8b53['content']!==_0x1ca44a['content']&&_0x5a8b53['update']({'content':_0x1ca44a['content'],'isFromAdapter':!0x0}):_0x40182c['addComment'](Object['assign'](dt(_0x1ca44a),{'isFromAdapter':!0x0}));}}}_getService(_0x43c916){if(!this['_services']['has'](_0x43c916))throw new _0x18c6f6('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x43c916});return this['_services']['get'](_0x43c916);}async _fetchMissingUsersForThreads(_0x2ce49a){const _0x1265c2=this['context']['plugins']['get'](_0x1f9655),{connection:_0x413f3d}=this['context']['plugins']['get'](J),_0x2e7707=new Set();for(const {resolvedBy:_0x557b1a,comments:_0xb52a8a}of _0x2ce49a){_0x557b1a&&!_0x1265c2['getUser'](_0x557b1a)&&_0x2e7707['add'](_0x557b1a);for(const {userId:_0x3bddc9}of _0xb52a8a)_0x1265c2['getUser'](_0x3bddc9)||_0x2e7707['add'](_0x3bddc9);}if(0x0===_0x2e7707['size'])return;const _0x547291=await _0x4e1e1e['getMany'](_0x413f3d,Array['from'](_0x2e7707));for(const _0x13d2f7 of _0x547291)_0x1265c2['getUser'](_0x13d2f7['id'])||_0x1265c2['addUser'](_0x13d2f7);}};async function ht(_0x135b53){if('404'!==_0x135b53['code'])throw _0x135b53;}function lt(_0x22c8da){if((_0x371f09=_0x22c8da)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x371f09['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x371f09['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x371f09;throw _0x22c8da;}function dt(_0xb1a44a){return{'threadId':_0xb1a44a['commentThreadId'],'commentId':_0xb1a44a['commentId'],'content':_0xb1a44a['content'],'createdAt':_0xb1a44a['createdAt'],'authorId':_0xb1a44a['userId'],'attributes':_0xb1a44a['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x42c452{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x52527a)());_bufferedRequests;_trackChangesService;static get requires(){return[at,_0x4a0de4,J];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x557562){super(_0x557562);const _0x22e44b=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x22e44b);}init(){const _0x254c64=this['editor']['plugins']['get'](J),_0x5d291d=this['editor']['plugins']['get'](_0x4a0de4);return _0x5d291d['adapter']={'getSuggestion':async _0x540693=>{await this['_waitForServiceReady']();const _0x2be801=await this['_trackChangesService']['get'](_0x540693)['catch'](ft);return await this['_fetchMissingUsersForThreads']([_0x2be801]),_0x2be801;},'addSuggestion':async({id:_0x5cd7f8,type:_0x3ae985,data:_0x1213a0,originalSuggestionId:_0x32d9c1,attributes:_0x234f6e})=>{await this['_waitForServiceReady']();const _0x2df1eb={'id':_0x5cd7f8,'type':_0x3ae985,'data':_0x1213a0,'originalSuggestionId':_0x32d9c1,'attributes':_0x234f6e},_0x25a384=await this['_trackChangesService']['add'](_0x5cd7f8,_0x3ae985,_0x1213a0,_0x32d9c1,_0x234f6e)['catch'](_0x5bad03=>{if(mt(_0x5bad03))return new Promise(_0x1ed25a=>{this['_bufferedRequests']['set'](_0x5cd7f8,{'resolve':_0x1ed25a,'suggestionData':_0x2df1eb});});throw _0x5bad03;});return this['_bufferedRequests']['delete'](_0x5cd7f8),_0x25a384;},'updateSuggestion':async(_0x513557,_0x136a5a)=>{if(await this['_waitForServiceReady'](),'open'!==_0x136a5a['state'])return this['_trackChangesService']['update'](_0x513557,_0x136a5a)['catch'](ft);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x39a996,_0x57964e)=>{_0x5d291d['hasSuggestion'](_0x57964e['id'])&&(_0x5d291d['getSuggestion'](_0x57964e['id'])['attributes']=_0x57964e['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x254c64['connection']?.['state']&&(_0x254c64['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x254c64['connection'])['then'](_0x2c239a=>(_0x254c64['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x2c239a)['then'](()=>{for(const _0x22e63c of _0x2c239a){_0x5d291d['addSuggestionData'](_0x22e63c)['_saved']=!0x0;}})));}async reconnect(){const _0x1520c5=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x42c350}=this['editor']['plugins']['get'](J),_0x4ac40a=await this['_trackChangesService']['connect'](_0x42c350);await this['_fetchMissingUsersForThreads'](_0x4ac40a);for(const {suggestionData:_0x28efe5,resolve:_0x4ab4b2}of this['_bufferedRequests']['values']()){let _0x34d3d2=_0x4ac40a['find'](_0x385782=>_0x385782['id']===_0x28efe5['id']);_0x34d3d2||(_0x34d3d2=await this['_trackChangesService']['add'](_0x28efe5['id'],_0x28efe5['type'],_0x28efe5['data'],_0x28efe5['originalSuggestionId'])),_0x4ab4b2(_0x34d3d2);}for(const _0x1fad02 of _0x4ac40a)_0x1520c5['hasSuggestion'](_0x1fad02['id'])||_0x1520c5['addSuggestionData'](_0x1fad02);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x2b53ae=>{this['listenTo'](this['_trackChangesService'],'connected',_0x37d296=>{_0x37d296['off'](),_0x2b53ae();});});}async _fetchMissingUsersForThreads(_0xad8616){const _0x209e22=this['editor']['plugins']['get'](_0x1f9655),{connection:_0x4463be}=this['editor']['plugins']['get'](J),_0x54766f=new Set();for(const {authorId:_0x154f1d}of _0xad8616)_0x209e22['getUser'](_0x154f1d)||_0x54766f['add'](_0x154f1d);if(0x0===_0x54766f['size'])return;const _0x22371d=await _0x4e1e1e['getMany'](_0x4463be,Array['from'](_0x54766f));for(const _0x3c54c5 of _0x22371d)_0x209e22['getUser'](_0x3c54c5['id'])||_0x209e22['addUser'](_0x3c54c5);}};function ft(_0x1410c2){if(mt(_0x1410c2))return new Promise(()=>{});throw _0x1410c2;}function mt(_0xea9897){return _0xea9897['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xea9897['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var pt=class extends _0x42c452{static get requires(){return[_0x12fcfb,at,ct,J];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0xd688a8=this['editor']['plugins']['get'](J),_0x4c78aa=this['editor']['plugins']['get'](_0x3a4fbd),_0x156d79=this['editor']['plugins']['get'](at);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0xd688a8,'change:state',(_0xd7dd9b,_0x3b258a,_0x2e3e3f)=>{_0x4c78aa['isThreadsLoadingPaused']='connected'!==_0x2e3e3f;});}),this['listenTo'](_0xd688a8,'change:state',(_0x29d5e4,_0x1c2006,_0x5ab7fb)=>{this['editor']['plugins']['get'](_0x2f6c6e)['switchReadOnly']('connected'!==_0x5ab7fb);}),_0x156d79['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x1016ab=this['editor']['plugins']['get'](at),_0x23cf7e=this['editor']['config']['get']('collaboration.channelId');_0x1016ab['_services']['has'](_0x23cf7e)&&_0x1016ab['_terminateService'](_0x23cf7e),super['destroy']();}},gt=class extends _0x42c452{static get requires(){return[pt,ut,_0x15dd8e];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class CloudServicesRevisionHistoryAdapter extends _0x42c452{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
- ((()=>_0x1faca0)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0x595b6f,Q,_0x1f9655];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x30317d){super(_0x30317d);const _0x2abe73=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x2abe73);}async init(){const _0xc3757b=this['editor']['plugins']['get'](it),_0x528792=_0xc3757b['serverHistory'],_0x587413=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x528792,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0xc3757b['sessionId']});const _0x6d2f0e=this['editor']['config']['get']('cloudServices.bundleVersion')||_0xfc776a,_0x3f5bea=await _0x3c7c32['isBundleUploaded'](_0x587413['connection'],_0x6d2f0e);this['editor']['plugins']['get'](_0x595b6f)['adapter']={'getRevision':async({revisionId:_0x5bb9b1})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x5bb9b1)),'updateRevisions':async _0x1f5213=>{await this['_waitForServiceReady']();const _0x21c7e3=this['_revisionTracker']['currentRevision'];if(_0x3f5bea&&0x1===_0x1f5213['length']&&_0x1f5213[0x0]['id']===_0x21c7e3['id'])return _0x1f5213;for(const _0x2c584c of _0x1f5213)_0x2c584c['id']===_0x21c7e3['id']&&(_0x2c584c['isEmptyCurrent']=_0x2c584c['fromVersion']===_0x2c584c['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1f5213,this['_lastRequestId'])['then'](_0x116263=>(this['_lastRequestId']=_0x116263,_0x1f5213))['catch'](_0x18bcf5=>{if(vt(_0x18bcf5)||'400'===_0x18bcf5['code']&&void 0x0!==_0x18bcf5['data']['wrongRequestId']){for(const _0x16913a of _0x1f5213)this['_revisionTracker']['repository']['getRevision'](_0x16913a['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x16913a['id'],_0x16913a,!0x1);if(vt(_0x18bcf5)&&'destroyed'!==this['editor']['state'])throw _0x18bcf5;return _0x1f5213;}throw _0x18bcf5;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x5da766,{revisionsData:_0xc2e097,requestId:_0x214230})=>{Math['max'](..._0xc2e097['map'](_0x2e14f0=>_0x2e14f0['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0xc2e097,_0x214230);}):this['_handleRevisionsUpdate'](_0xc2e097,_0x214230);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x587413['connection']?.['state']&&(_0x587413['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x333beb,requestId:_0x44c888}=await this['_revisionHistoryService']['connect'](_0x587413['connection']);_0x587413['addToReconnectionStack'](this),this['_lastRequestId']=_0x44c888,await this['_fetchMissingUsers'](_0x333beb);for(const _0x234caa of _0x333beb)this['_revisionTracker']['addRevisionData'](_0x234caa);this['listenTo'](_0xc3757b,'change:_isConnected',(_0x120f49,_0x36f609,_0x4b5642)=>{_0x4b5642&&(this['_oldOffset']=_0xc3757b['_offset'],_0x120f49['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x4ab650=this['editor']['plugins']['get'](J),_0x92892f=this['editor']['plugins']['get'](it),_0x42dcdd=async()=>{const _0x45913a=this['_revisionTracker']['currentRevision'],_0x5e904e=_0x45913a['id'],_0x52a8c0=_0x5e904e!==_0x92892f['sessionId'];if(_0x52a8c0){const _0x5038ec=_0x92892f['_offset']-this['_oldOffset'],_0x2246f1=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x45913a['toVersion']+_0x5038ec!==_0x2246f1){const _0x74a597=_0x45913a['fromVersion']+_0x5038ec,_0x10b014=this['editor']['plugins']['get'](_0x1f9655),_0x1b4b6e=this['_revisionTracker']['buildRevisionData']({'revision':_0x45913a,'from':_0x74a597,'to':_0x2246f1});_0x1b4b6e['id']=_0x45913a['id'];const _0x104567=_0x1b4b6e['authorsIds']['map'](_0x108004=>_0x10b014['getUser'](_0x108004));_0x45913a['_update']({..._0x1b4b6e,'authors':_0x104567},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x45913a['id'],_0x1b4b6e,!0x0);}this['_revisionTracker']['_startingVersion']=_0x2246f1,_0x45913a['toVersion']!==_0x45913a['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x5e904e)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x5e904e),this['_revisionTracker']['_createCurrentRevision'](_0x2246f1);}const {revisions:_0x170ed1,requestId:_0x3bceb4}=await this['_revisionHistoryService']['reconnect'](_0x4ab650['connection'],this['_lastRequestId']);_0x52a8c0&&_0x170ed1['length']>0x0?_0x92892f['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x170ed1),this['_handleRevisionsUpdate'](_0x170ed1,_0x3bceb4),this['_revisionTracker']['sendBufferedUpdates']());};return _0x92892f['_isConnected']?_0x42dcdd():new Promise((_0x1853fd,_0xb0ce87)=>{_0x92892f['once']('change:_isConnected',()=>{_0x42dcdd()['then'](_0x1853fd)['catch'](_0xb0ce87);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x336ce5=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x5e0c05=>{_0x5e0c05['off'](),_0x336ce5();});});}_getLatestVersionFromServerOperations(){const _0x5afef8=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0x34b8ac of _0x5afef8)if('marker'!==_0x34b8ac['type']||_0x34b8ac['affectsData'])return _0x34b8ac['baseVersion']+0x1;}_getLatestVersion(){const _0x4a606b=this['editor']['plugins']['get'](it);return new Promise(_0x55bc22=>{_0x4a606b['_isPendingUpdate']?_0x4a606b['once']('change:_isPendingUpdate',()=>{_0x55bc22(this['_getLatestVersionFromServerOperations']());}):_0x55bc22(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x2200b1,_0x4babd2){const _0xe17c72=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x4babd2;for(const _0x5b25bc of _0x2200b1){const _0x5a2adc=_0xe17c72['getRevision'](_0x5b25bc['id']);if(_0x5a2adc){if((_0x5b25bc['fromVersion']||_0x5b25bc['toVersion'])&&(_0x5b25bc['diffData']=null),_0x5a2adc===this['_revisionTracker']['currentRevision']){const _0x410453=Math['max'](_0x5a2adc['toVersion'],_0x5b25bc['toVersion']),_0x70b7a4=Math['max'](_0x5a2adc['fromVersion'],_0x5b25bc['fromVersion']);let _0x16d23c;_0x5a2adc['toVersion']===_0x5b25bc['toVersion']&&_0x5a2adc['fromVersion']===_0x5b25bc['fromVersion']?(_0x16d23c=!0x0,this['_preventResendingRevisionData'](_0x5b25bc)):_0x5b25bc['toVersion']===_0x410453&&_0x5b25bc['fromVersion']===_0x70b7a4?_0x16d23c=!0x1:(_0x5a2adc['toVersion']===_0x410453&&_0x5a2adc['fromVersion']===_0x70b7a4||this['_fixRevision']({'revision':_0x5a2adc,'from':_0x70b7a4,'to':_0x410453}),_0x16d23c=!0x0),_0x16d23c&&(delete _0x5b25bc['fromVersion'],delete _0x5b25bc['toVersion'],delete _0x5b25bc['diffData'],delete _0x5b25bc['createdAt'],delete _0x5b25bc['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x5b25bc),this['_preventResendingRevisionData'](_0x5b25bc);}else this['_revisionTracker']['addRevisionData'](_0x5b25bc);}const _0x503a1f=_0xe17c72['getRevisions']();_0x503a1f['reverse']();for(let _0x845d15=0x0;_0x845d15<_0x503a1f['length']-0x1;_0x845d15++){const _0x2105f7=_0x503a1f[_0x845d15],_0x261e2f=_0x503a1f[_0x845d15+0x1];if(_0x2105f7['fromVersion']<_0x261e2f['toVersion']){const _0x4e4285=_0x261e2f['toVersion'],_0x2edc81=Math['max'](_0x4e4285,_0x2105f7['toVersion']);this['_fixRevision']({'revision':_0x2105f7,'from':_0x4e4285,'to':_0x2edc81});}}}['_fixRevision']({revision:_0x3103d9,from:_0x14b829,to:_0x18af0b}={}){const _0x596901=this['editor']['plugins']['get'](_0x1f9655),_0x53a456=this['_revisionTracker']['buildRevisionData']({'revision':_0x3103d9,'from':_0x14b829,'to':_0x18af0b});_0x53a456['authors']=_0x53a456['authorsIds']['map'](_0x31f5c8=>_0x596901['getUser'](_0x31f5c8)),_0x3103d9['_update'](_0x53a456);}_preventResendingRevisionData(_0x3ab3df){const _0xfabaad={};_0xfabaad['id']=_0x3ab3df['id'];for(const _0x20280b of Object['keys'](_0x3ab3df))'id'!==_0x20280b&&(_0xfabaad[_0x20280b]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0xfabaad['id'],_0xfabaad,!0x0);}async _fetchMissingUsers(_0x218ed9){const _0x194763=this['editor']['plugins']['get'](_0x1f9655),{connection:_0x28edb4}=this['editor']['plugins']['get'](J),_0x30ec26=new Set();for(const _0x11b2ed of _0x218ed9){for(const _0xc596e6 of _0x11b2ed['authorsIds'])_0x2a8f3a(_0xc596e6);_0x11b2ed['creatorId']&&_0x2a8f3a(_0x11b2ed['creatorId']);}if(0x0===_0x30ec26['size'])return;const _0x14015b=await _0x4e1e1e['getMany'](_0x28edb4,Array['from'](_0x30ec26));for(const _0x5b084e of _0x14015b)_0x194763['getUser'](_0x5b084e['id'])||_0x194763['addUser'](_0x5b084e);function _0x2a8f3a(_0x56e2c9){_0x194763['getUser'](_0x56e2c9)||_0x30ec26['add'](_0x56e2c9);}}};function vt(_0x39eb5f){return _0x39eb5f['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x39eb5f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x39eb5f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x42c452{static get requires(){return[_0x595b6f,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x51c765{_collapseAt;constructor(_0x318374,_0xb4d0e8=0x6){super(_0x318374);const _0x269ff4=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0xb4d0e8,this['bind']('isHidden')['to'](this,'usersCount',_0x31db65=>_0x31db65<_0xb4d0e8),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x269ff4['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':_0x269ff4['to']('usersCount',_0x4f973a=>'+'+(_0x4f973a-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x51c765{items;keystrokes;constructor(_0x55057a){super(_0x55057a);const _0x2dc45c=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x362adb(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x2dc45c['if']('hasPopup'),'aria-expanded':_0x2dc45c['to']('isExpanded',_0x55c555=>this['hasPopup']&&String(_0x55c555)),'aria-label':_0x2dc45c['to']('hasPopup',_0x21fa5f=>et(_0x55057a,_0x21fa5f?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x2dc45c['to']('hasPopup',_0x5cb9b0=>!!_0x5cb9b0&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0xda7ce5,_0x1aa4f0,_0x35663e)=>{this['element']&&(_0x35663e?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 _0x51c765{counterView;inlineListView;constructor(_0x1c82d9,_0x19a580=0x6){super(_0x1c82d9);const _0x1f881c=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0x19a580),this['inlineListView']=new bt(_0x1c82d9),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4ddc8e of this['inlineListView']['items'])_0x4ddc8e['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',_0x1f881c['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x51c765{listWrapperView;constructor(_0x4aa4b4,_0x2ea421){super(_0x4aa4b4),this['listWrapperView']=new St(_0x4aa4b4,_0x2ea421),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0x4aa4b4,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0x492574{constructor(_0x258e0e,_0x3b64cd){super(_0x258e0e);const _0x342847=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x3b64cd?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x342847['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x342847['to']('role'),'aria-label':_0x342847['to']('ariaLabel'),'aria-labelledby':_0x342847['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x4ce874['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x4261c8=this['element'];_0x4261c8&&(this['_isScrollable']=Math['max'](_0x4261c8['scrollHeight'],_0x4261c8['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0x1a0ed4{['userView'];constructor(_0x278ab8,_0x9acefb,_0x123e29){super(_0x278ab8);const _0xdd8298=this['bindTemplate'];this['userView']=new _0x61d070(_0x278ab8,_0x9acefb);const _0x5becaa={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x9acefb['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x9acefb['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x9acefb['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x9acefb['color']['getColorVariable'](),'--ck-user-color-alpha':_0x9acefb['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x123e29&&(_0x5becaa['tag']='button',_0x5becaa['on']={'click':_0xdd8298['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5becaa);}['focus'](){this['element']['focus']();}},Ct=class extends _0x51c765{['userView'];['markerView'];constructor(_0x45c610,_0x19e856,_0x1c396f){super(_0x45c610);const _0x10dbbf=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x61d070(_0x45c610,_0x19e856),this['markerView']=new At(_0x45c610,_0x19e856);const _0x446e84=new _0x4257d6(_0x45c610);_0x446e84['template']['tag']='span',_0x446e84['text']=_0x19e856['name'];const _0x1d5c85={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x10dbbf['to']('isFocusable',_0x5c91a6=>!!_0x5c91a6&&0x0),'aria-labelledby':_0x446e84['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x10dbbf['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x10dbbf['to']('hasTooltip',_0x24fb3b=>!_0x24fb3b),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x446e84]};_0x1c396f&&(_0x1d5c85['tag']='button',_0x1d5c85['on']={'click':_0x10dbbf['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x1d5c85);}},At=class extends _0x51c765{constructor(_0x54942e,_0x53abd2){super(_0x54942e),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x53abd2['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x53abd2['color']['getColorVariable'](),'--ck-user-color-alpha':_0x53abd2['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x40687c{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1c5874){super(_0x1c5874),this['context']['config']['define']('presenceList',Pt);const _0x3f8643=_0x1c5874['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x3f8643)throw new _0x18c6f6('presencelist-collapseat-invalid-format',this);if(_0x3f8643<0x1)throw new _0x18c6f6('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x1c9906(),this['balloonPanelView']=new _0xa07487(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x1f9874 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x1f9874);this['listenTo'](this['_allConnectedUsers'],'add',(_0x2f1328,_0x55d8b9)=>{this['_handleUserAdd'](_0x55d8b9);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x571a18,_0x24f356)=>{this['_handleUserRemove'](_0x24f356);});}_createView(){const _0x3a8f25=this['context'],_0x2cff01=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x46b228=this['balloonPanelView'];if(!_0x42df98(_0x3a8f25['config']['get']('presenceList.container')))throw new _0x18c6f6('presencelist-missing-container',this);_0x2cff01['counterView']['bind']('usersCount')['to'](this),_0x2cff01['bind']('isCollapsed')['to'](this,'usersCount',_0x37ef41=>{const {collapseAt:_0x31845c}=_0x3a8f25['config']['get']('presenceList'),_0x19a081=_0x37ef41>=_0x31845c;if(_0x19a081&&!_0x2cff01['inlineListView']['items']['find'](_0x58d3d4=>_0x58d3d4 instanceof yt)){const _0x57b983=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x57b983&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2cff01['inlineListView']['items']['add'](_0x2cff01['counterView']);}return _0x19a081||this['hideDropdown'](),_0x19a081;}),_0x2cff01['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x47c9ce=>{const _0x28c94f=_0x3a8f25['config']['get']('presenceList'),_0x4c7f2a=new Ct(_0x3a8f25['locale'],_0x47c9ce,!!_0x28c94f['onClick']);return _0x4c7f2a['bind']('hasTooltip')['to'](_0x2cff01,'isCollapsed',_0xa18fbc=>!_0xa18fbc),_0x4c7f2a['bind']('isFocusable')['to'](_0x2cff01,'isCollapsed',_0x3f4214=>!_0x3f4214),_0x28c94f['onClick']&&this['listenTo'](_0x4c7f2a,'execute',()=>{this['view']['isCollapsed']||_0x28c94f['onClick'](_0x47c9ce,_0x4c7f2a['element']);}),_0x4c7f2a;}),_0x2cff01['inlineListView']['keystrokes']['set']('Enter',(_0x511a65,_0x1da447)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x1da447());}),_0x2cff01['render'](),_0x46b228['render'](),_0x2cff01['listenTo'](_0x2cff01['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x400451=(_0x1231b0,_0x1d29e5)=>{this['_hideDropdownUnlessPointerInside'](_0x1d29e5);};return _0x2cff01['listenTo'](_0x2cff01['inlineListView']['element'],'mouseleave',_0x400451),_0x2cff01['listenTo'](_0x46b228['element'],'mouseleave',_0x400451),_0x5074c4({'emitter':_0x2cff01,'activator':()=>_0x46b228['isVisible'],'contextElements':[_0x46b228['element'],_0x2cff01['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x3a8f25['config']['get']('presenceList.container')['appendChild'](_0x2cff01['element']),this['_overlayHost']=new _0x94d82e(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0x2cff01;}_resolveOverlayTarget(){const _0x39d46d=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0x39d46d)return _0x39d46d;const _0x1de8dc=this['context']['config']['get']('presenceList.container');return _0x1de8dc?_0x42ec83(_0x1de8dc):null;}['_handleUserAdd'](_0x4cb64a){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x4cb64a['isMe'])return;const _0x25bbdb=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x25bbdb-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x3ec0ed=_0x4cb64a['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x4cb64a,_0x3ec0ed);}['_handleUserRemove'](_0x325e58){this['usersCount']--;const {collapseAt:_0x11177d}=this['context']['config']['get']('presenceList'),_0x5ba0bc=this['usersCount']>=_0x11177d;if(this['currentDisplayedUsers']['get'](_0x325e58['id']))this['currentDisplayedUsers']['remove'](_0x325e58['id']);else{if(_0x5ba0bc&&this['currentDisplayedUsers']['length']+0x1===_0x11177d-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x5ba0bc?0x1:0x0)<this['usersCount']){for(const _0x4f8e78 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x4f8e78['id'])&&(this['currentDisplayedUsers']['add'](_0x4f8e78,Math['min'](this['currentDisplayedUsers']['length']-(_0x5ba0bc?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x5ba0bc?0x1:0x0)===_0x11177d-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x52575b=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0x52575b['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x284289}=this['presenceDropdownView'];_0x284289['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x4637be=>{if(!_0x52575b['displayMe']&&_0x4637be['isMe'])return null;const _0x4f9340=new Tt(this['context']['locale'],_0x4637be,!!_0x52575b['onClick']);return _0x52575b['onClick']&&this['listenTo'](_0x4f9340,'execute',()=>{_0x52575b['onClick'](_0x4637be,_0x4f9340['element']);}),_0x4f9340;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x284289['focus'](),_0x284289['checkIfScrollable']();const _0x280b74=(_0x2f3d73,_0x25ee10)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x25ee10();};_0x284289['keystrokes']['set']('Esc',_0x280b74),_0x284289['keystrokes']['set']('Shift+Tab',_0x280b74),_0x284289['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x284289['focusTracker']['add'](this['view']['element']),_0x284289['focusTracker']['on']('change:isFocused',(_0x33a2b9,_0x107147,_0x25c62e)=>{_0x25c62e||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(_0x54733a){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x2c4935=>_0x1a1620(_0x2c4935,_0x54733a))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x40687c{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 _0x54e3f1,ContextPlugin as _0x3d5c65,PendingActions as _0x265a77,Plugin as _0x31fc40}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x544475,Collection as _0x5e9f23,DomEmitterMixin as _0x5a848a,KeystrokeHandler as _0x1e4d88,getOverlayMountRoot as _0x14ab56,global as _0x48a199,trustedHtml as _0xdbfc54,uid as _0x3fa067,version as _0x5643f0}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x4167d7,LabelView as _0x27bdd1,ListItemView as _0x3ebef7,ListView as _0x2fc7d0,Notification as _0x21e178,OverlayHost as _0x3a31c7,View as _0x521af7,clickOutsideHandler as _0x2a0934}from'@ckeditor/ckeditor5-ui';import{History as _0x1b5fd5,InsertOperation as _0x2deb91,MarkerOperation as _0x54255b,ModelLiveRange as _0x1e7aff,NoOperation as _0x4ac29a,OperationFactory as _0x4aa6c3,RootAttributeOperation as _0x1af6e4,transformOperationSets as _0x4e0779}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x1cdced}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x3ab55b,CommentsService as _0x2d2254,EditorService as _0x49285b,RevisionHistoryService as _0x44fe60,TrackChangesService as _0xe48cc6,User as _0x57eb50,WEB_SOCKET_GATEWAY_STATES as _0x4248be,WebSocketGateway as _0x17bb73}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x13ed79,Users as _0x2de45a,isPointerStillOver as _0x155aa1}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x62edef}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x22666b,TrackChangesEditing as _0x53e314}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x1b2357,CommentsEditing as _0x164838,CommentsRepository as _0x4a59f5}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x2f93b0}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x70fece}from'es-toolkit/compat';var J=class WebSocketGateway extends _0x3d5c65{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
+ ((()=>_0x17bb73)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x1cdced,_0x21e178];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1d1b93){super(_0x1d1b93),this['set']('state',_0x4248be['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x5a848a())();}init(){const _0x3c421b=this['context'],_0x57535c=_0x3c421b['plugins']['get'](_0x1cdced),_0x334bae=_0x3c421b['plugins']['get'](_0x21e178);if(!_0x57535c['token'])throw new _0x544475('websocketgateway-missing-token',this);if(!_0x57535c['webSocketUrl'])throw new _0x544475('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'](_0x57535c['token'],_0x57535c['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x3abe9c=>{if(this['connection']=_0x3abe9c,this['bind']('state')['to'](_0x3abe9c,'state',this,'_isBrowserOffline',(_0x654a58,_0x1a2fe9)=>('connected'!==_0x654a58&&(this['_shouldPluginsReconnect']=!0x0),_0x1a2fe9||_0x654a58!==_0x4248be['CONNECTED']?_0x4248be['DISCONNECTED']:this['state']==_0x4248be['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x4248be['CONNECTING']):_0x4248be['CONNECTED'])),this['connection']['on']('error',(_0x332ae2,_0x34a600)=>{if('limitExceeded'!==_0x34a600['code'])throw console['error'](_0x34a600),new _0x544475('cloudservices-init',null,{'originalError':_0x34a600});_0x334bae['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'});}),!_0x3abe9c['me'])return new Promise(_0x43037e=>_0x3abe9c['on']('change:me',_0x43037e));})['catch'](_0x43717d=>{throw console['error'](_0x43717d),new _0x544475('cloudservices-init',null,{'originalError':_0x43717d});});}addToReconnectionStack(_0x2464f9){if('function'!=typeof _0x2464f9['reconnect'])throw new _0x544475('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x2464f9))throw new _0x544475('websocketgateway-plugin-already-registered',this,{'name':_0x2464f9['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x2464f9);}removeFromReconnectionStack(_0x51bd38){this['_reconnectionStack']['delete'](_0x51bd38);}isInReconnectionStack(_0x268dfe){return this['_reconnectionStack']['has'](_0x268dfe);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x5cda29=>_0x5cda29['reconnect']())))['then'](()=>this['state']=_0x4248be['CONNECTED'])['catch'](_0x5135ce=>{throw console['error'](_0x5135ce),new _0x544475('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x4248be['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x3d5c65{['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,_0x2de45a];}constructor(_0x518394){super(_0x518394),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x5e9f23(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x2de45a);}init(){const _0x2af450=this['context']['plugins']['get'](J);this['listenTo'](_0x2af450,'change:state',(_0x378b15,_0x1dfb02,_0x9cf0ac)=>{if('connected'!==_0x9cf0ac)this['channelSessions']['forEach'](_0x4193bf=>_0x4193bf['clear']()),this['channelConnectedUsers']['forEach'](_0x1f721d=>_0x1f721d['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x451823,_0x18ee4f]of this['_registeredSessions'])for(const _0x573979 of _0x18ee4f)this['_handleSessionAdd'](_0x451823,_0x573979);}}),this['_createUser'](_0x2af450['connection']['me'],!0x0);}register(_0x5b9d14,_0x308d94){if(this['_registeredSessions']['has'](_0x5b9d14))throw new _0x544475('sessions-register-already-registered',null,{'channelId':_0x5b9d14});this['_registeredSessions']['set'](_0x5b9d14,_0x308d94),this['channelSessions']['set'](_0x5b9d14,new _0x5e9f23()),this['channelConnectedUsers']['set'](_0x5b9d14,new _0x5e9f23()),this['listenTo'](_0x308d94,'add',(_0x24a711,_0x310937)=>this['_handleSessionAdd'](_0x5b9d14,_0x310937)),this['listenTo'](_0x308d94,'remove',(_0x37a717,_0x5bab38)=>this['_handleSessionRemove'](_0x5b9d14,_0x5bab38));for(const _0x5e0583 of _0x308d94)this['_handleSessionAdd'](_0x5b9d14,_0x5e0583);}unregister(_0x35ff5e){if(!this['_registeredSessions']['has'](_0x35ff5e))throw new _0x544475('sessions-unregister-not-exist',null,{'channelId':_0x35ff5e});const _0x51760a=this['_registeredSessions']['get'](_0x35ff5e);this['stopListening'](_0x51760a);for(const _0x40092b of _0x51760a)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x35ff5e,_0x40092b);this['_registeredSessions']['delete'](_0x35ff5e),this['channelSessions']['delete'](_0x35ff5e),this['channelConnectedUsers']['delete'](_0x35ff5e);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0x4dd7dd){for(const _0x255b44 of this['channelSessions']['values']())for(const _0x40b2c9 of _0x255b44)if(_0x40b2c9['id']===_0x4dd7dd)return _0x40b2c9['user'];}getUserSessions(_0x10806a,_0x50b1a1){const _0x22f775=_0x50b1a1?[this['channelSessions']['get'](_0x50b1a1)]:this['channelSessions']['values'](),_0x255d77=new Set();for(const _0x47efa6 of _0x22f775)for(const _0xeebc5c of _0x47efa6)_0xeebc5c['user']['id']===_0x10806a['id']&&_0x255d77['add'](_0xeebc5c['id']);return _0x255d77;}getUserRole(_0x1a75a7){for(const _0xa1d099 of this['channelSessions']['values']())for(const _0x4b5c9c of _0xa1d099)if(_0x4b5c9c['user']===_0x1a75a7)return _0x4b5c9c['role'];}['_handleSessionAdd'](_0x26ac9c,_0x2538a4){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x326a2b=_0x2538a4['user'],_0x2b9ecf=this['_users']['getUser'](_0x326a2b['id'])||this['_createUser'](_0x326a2b),_0x4242f9=Object['assign']({},_0x2538a4,{'user':_0x2b9ecf});if(this['channelSessions']['get'](_0x26ac9c)['add'](_0x4242f9),!_0x326a2b['hiddenInPresenceList']){const _0x39b341=this['channelConnectedUsers']['get'](_0x26ac9c);_0x39b341['has'](_0x2b9ecf['id'])||_0x39b341['add'](_0x2b9ecf),this['allConnectedUsers']['has'](_0x2b9ecf['id'])||_0x326a2b['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x2b9ecf,_0x2b9ecf['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x26ac9c,{'channelId':_0x26ac9c,'session':_0x4242f9});}['_handleSessionRemove'](_0x5483ae,_0x23d04c){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x373456=this['channelConnectedUsers']['get'](_0x5483ae),_0x58bb65=_0x23d04c['user'];_0x58bb65['id']&&(this['channelSessions']['get'](_0x5483ae)['remove'](_0x23d04c['id']),_0x373456['has'](_0x58bb65['id'])&&!this['getUserSessions'](_0x58bb65,_0x5483ae)['size']&&_0x373456['remove'](_0x58bb65['id']),this['allConnectedUsers']['get'](_0x58bb65['id'])&&!this['getUserSessions'](_0x58bb65)['size']&&this['allConnectedUsers']['remove'](_0x58bb65['id']));}_createUser(_0x36e943,_0x34e5e9){const _0x26a2d5=this['_users']['addUser'](_0x36e943);return _0x34e5e9&&this['_users']['defineMe'](_0x36e943['id']),_0x26a2d5['orderNumber']=this['_uniqueUsersCount']++,_0x26a2d5;}},X=class extends _0x31fc40{_domEmitter=new(_0x5a848a())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x43ea38=this['editor'],_0x4dc889=_0x43ea38['plugins']['get'](Q);_0x43ea38['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x471fec,{writer:_0x22e9d2})=>function(_0x59d41f,_0x2816fd,_0x2c249b,_0x4c2a22){const _0x5a79d5=_0x59d41f['markerName']['split'](':')[0x2],_0x3a2238=_0x2c249b['getUserBySessionId'](_0x5a79d5);if(!_0x3a2238||_0x5a79d5===_0x2c249b['mySessionId'])return;if(!_0x4c2a22['model']['schema']['checkChild'](_0x59d41f['markerRange']['start'],'$text'))return;const _0x3abf6b={'class':'ck-user__marker\x20'+_0x3a2238['color']['getMarkerClass'](),'style':tt(_0x3a2238),'data-name':_0x3a2238['name'],'data-session-id':_0x5a79d5},_0x4300e6=_0x4c2a22['model']['markers']['get'](_0x59d41f['markerName'])['getStart'](),_0x4c7376=_0x4300e6['nodeAfter'],_0x497914=_0x4c2a22['model']['schema'];if(_0x4c7376&&_0x497914['isObject'](_0x4c7376)&&_0x497914['isInline'](_0x4c7376)&&!_0x4c2a22['model']['markers']['get']('user:range:'+_0x5a79d5)['getRange']()['isCollapsed'])return;const _0x5e313f=_0x4300e6['parent'];return _0x4c2a22['model']['schema']['isLimit'](_0x5e313f)&&!_0x4c2a22['model']['hasContent'](_0x5e313f)&&(_0x3abf6b['contenteditable']=!0x1),function(_0x3aa635,_0x582ed4,_0xfadf42){const _0x2b3f3f=_0x3aa635['createUIElement']('span',_0x582ed4);return _0x3aa635['setCustomProperty']('userPositionMarker',!0x0,_0x2b3f3f),_0x2b3f3f['render']=function(_0x5a61d6){const _0x547624=this['toDomElement'](_0x5a61d6),_0x15a13d=document['createElement']('span');return _0x15a13d['classList']['add']('ck-user__marker-tooltip'),_0x15a13d['setAttribute']('contenteditable','false'),_0x15a13d['setAttribute']('spellcheck','false'),_0x15a13d['textContent']=_0xfadf42['name'],_0x547624['innerHTML']=_0xdbfc54('⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x15a13d['outerHTML']+'⁠'),_0x547624['addEventListener']('mouseenter',()=>{_0x547624['classList']['add']('ck-user__marker_hovered');}),_0x547624['addEventListener']('mouseleave',()=>{_0x547624['classList']['remove']('ck-user__marker_hovered');}),_0x547624;},_0x2b3f3f['isSimilar']=function(_0x12ba35){return!(!this['getCustomProperty']('userPositionMarker')||!_0x12ba35['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x12ba35['getAttribute']('data-session-id'));},_0x2b3f3f;}(_0x2816fd,_0x3abf6b,_0x3a2238);}(_0x471fec,_0x22e9d2,_0x4dc889,_0x43ea38)}),_0x43ea38['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x3d7cea=>function(_0x28caa5,_0x4625fb){const _0x4477dd=_0x28caa5['markerName']['split'](':')[0x2];if(_0x4477dd===_0x4625fb['mySessionId'])return null;const _0x422508=_0x4625fb['getUserBySessionId'](_0x4477dd);return _0x422508?{'id':_0x4477dd,'classes':['ck-user__selection',_0x422508['color']['getSelectionClass']()],'attributes':{'style':tt(_0x422508),'data-session-id':_0x4477dd},'priority':0x7d0+_0x422508['orderNumber']}:{'id':_0x4477dd,'classes':[]};}(_0x3d7cea,_0x4dc889)}),function(_0x479bba){const _0x937a4e=_0x479bba['model'],_0x58b81b=new Map(),_0x1ad7b2=_0x479bba['plugins']['get'](Q);_0x937a4e['markers']['on']('update:user:range',(_0x44f303,_0x53d72a,_0x24084f,_0x575937)=>{if(!_0x575937&&_0x58b81b['get'](_0x53d72a['name']))return _0x58b81b['get'](_0x53d72a['name'])['detach'](),void _0x58b81b['delete'](_0x53d72a['name']);const _0x48c0bf=_0x53d72a['name']['split'](':')[0x2];if(_0x48c0bf===_0x1ad7b2['mySessionId'])return;const _0x54ed7d='user:position:'+_0x48c0bf;_0x937a4e['markers']['has'](_0x54ed7d)&&_0x479bba['editing']['reconvertMarker'](_0x54ed7d),_0x53d72a['on']('change:range',(_0xd59218,_0x4c28ea,_0x508beb)=>{if('$graveyard'!=_0x4c28ea['root']['rootName']&&'$graveyard'==_0x53d72a['getRange']()['root']['rootName']&&!_0x58b81b['has'](_0x53d72a['name'])){const _0x2a6fed=_0x937a4e['schema']['getNearestSelectionRange'](_0x508beb['deletionPosition']);if(_0x2a6fed){const _0x960a14=_0x1e7aff['fromRange'](_0x2a6fed);_0x58b81b['set'](_0x53d72a['name'],_0x960a14),_0x960a14['on']('change:range',(_0x692852,_0x5e3e41,_0x328ebf)=>{if('$graveyard'==_0x960a14['root']['rootName']){const _0x1eaa45=_0x937a4e['schema']['getNearestSelectionRange'](_0x328ebf['deletionPosition']);_0x1eaa45?(_0x960a14['start']=_0x1eaa45['start'],_0x960a14['end']=_0x1eaa45['end']):(_0x58b81b['delete'](_0x53d72a['name']),_0x960a14['detach']());}});}}});}),_0x937a4e['document']['on']('change',()=>{_0x58b81b['size']>0x0&&_0x937a4e['enqueueChange']({'isUndoable':!0x1},_0x161203=>{for(const [_0x31d53c,_0x2637d5]of _0x58b81b)'$graveyard'==_0x937a4e['markers']['get'](_0x31d53c)['getRange']()['root']['rootName']&&(Z(_0x31d53c['split'](':')[0x2],_0x2637d5['toRange'](),_0x937a4e,_0x161203),_0x2637d5['detach']());_0x58b81b['clear']();});});}(_0x43ea38),this['_domEmitter']['listenTo'](_0x48a199['document'],'keydown',(_0x4341ce,{key:_0x5b57a1})=>{'Escape'===_0x5b57a1&&function(_0x28c800){_0x28c800['editing']['view']['change'](_0x5b2e02=>{for(const _0xe8890f of _0x28c800['model']['markers']){if(!_0xe8890f['name']['startsWith']('user:position'))continue;const _0x924a56=_0x28c800['editing']['mapper']['markerNameToElements'](_0xe8890f['name']);if(_0x924a56){for(const _0x3dfdc4 of _0x924a56)_0x5b2e02['removeClass']('ck-user__marker_hovered',_0x3dfdc4);}}});}(_0x43ea38);},{'useCapture':!0x0});}afterInit(){const _0x11c7d3=this['editor'],_0x523248=_0x11c7d3['commands']['get']('undo');_0x523248&&_0x11c7d3['model']['on']('applyOperation',(_0x5b92e7,_0x44ae40)=>{const _0x17756c=_0x44ae40[0x0];if(!_0x17756c['isDocumentOperation'])return;if('marker'!=_0x17756c['type']||!_0x17756c['name']['startsWith']('user:'))return;const _0x11c6dc=_0x17756c['batch'];_0x523248['_createdBatches']['has'](_0x11c6dc)&&(_0x17756c['newRange']=_0x17756c['oldRange']?_0x11c7d3['model']['createRange'](_0x17756c['oldRange']['start'],_0x17756c['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0xf391c2=this['editor'],_0x21ccc4=_0xf391c2['model']['document'],_0x3b459e=_0xf391c2['plugins']['get'](Q);_0xf391c2['model']['enqueueChange']({'isUndoable':!0x1},_0x472471=>{const _0x46ebf6='user:range:'+_0x3b459e['mySessionId'],_0x25fc9e='user:position:'+_0x3b459e['mySessionId'],_0xeeb668=_0xf391c2['model']['markers']['has'](_0x46ebf6);_0xf391c2['editing']['view']['hasDomSelection']?Z(_0x3b459e['mySessionId'],_0x21ccc4['selection']['getFirstRange'](),_0xf391c2['model'],_0x472471):_0xeeb668&&(_0x472471['removeMarker'](_0x46ebf6),_0x472471['removeMarker'](_0x25fc9e));});}};function Z(_0x309181,_0x323cad,_0x569237,_0x18bd50){const _0x411be4='user:range:'+_0x309181,_0x24e6ad='user:position:'+_0x309181,_0x3fa14e=_0x323cad['getContainedElement']();let _0x46b133=_0x323cad['start'];if(_0x3fa14e&&_0x3fa14e['is']('element','tableCell')){const _0xa46232=function(_0x217648,_0x5474d4){for(const _0x2211a0 of _0x217648['getPositions']())if(_0x5474d4['schema']['checkChild'](_0x2211a0,'$text'))return _0x2211a0;}(_0x323cad,_0x569237);_0xa46232&&(_0x46b133=_0xa46232,_0x323cad=_0x18bd50['createRange'](_0x46b133));}const _0x54a678=_0x18bd50['createRange'](_0x46b133);_0x569237['markers']['has'](_0x411be4)?(_0x18bd50['updateMarker'](_0x411be4,{'range':_0x323cad}),_0x18bd50['updateMarker'](_0x24e6ad,{'range':_0x54a678})):(_0x18bd50['addMarker'](_0x411be4,{'range':_0x323cad,'usingOperation':!0x0}),_0x18bd50['addMarker'](_0x24e6ad,{'range':_0x54a678,'usingOperation':!0x0}));}function tt(_0x426bd0){return'--ck-user-color:'+_0x426bd0['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x426bd0['color']['getColorAlphaVariable']()+';';}function et(_0x64762a,_0x5969be,_0x4a6b41){const _0x3d2276=_0x64762a['t'],t=_0x64762a['t'];switch(_0x5969be){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 _0x3d2276({'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'},_0x4a6b41);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x31fc40{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x3ab55b)());_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,_0x265a77,_0x2de45a,_0x21e178];}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 _0x512de6=this['serverHistory']['getOperations']();for(let _0x5a1ebd=_0x512de6['length']-0x1;_0x5a1ebd>=0x0;_0x5a1ebd--){const _0x279747=_0x512de6[_0x5a1ebd];if(!this['_disconnectionOperations']['has'](_0x279747))return _0x279747['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x5bdabe){if(super(_0x5bdabe),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x1b5fd5(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x544475('collaboration-missing-channelid',this);const _0x405081=_0x5bdabe['config']['get']('cloudServices.bundleVersion')||_0x5643f0;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x405081,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x62edef(),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 _0x5c7a45=this['editor'],_0x654067=_0x5c7a45['plugins']['get'](_0x2de45a),_0x28297e=_0x5c7a45['plugins']['get'](J);this['listenTo'](_0x654067,'getOperationAuthor',(_0xff96f0,_0x2092b5)=>{const _0x2ee9d1=_0x2092b5[0x0];_0x2ee9d1['_authorId']&&(_0xff96f0['return']=_0x654067['getUser'](_0x2ee9d1['_authorId']),_0xff96f0['stop']()),null===_0x2ee9d1['_authorId']&&(_0xff96f0['return']=null,_0xff96f0['stop']());},{'priority':'high'}),this['listenTo'](_0x5c7a45['model']['document']['selection'],'change:range',(_0x152a78,_0x577c61)=>{_0x577c61['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x5c7a45['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x5c7a45['model']['on']('applyOperation',(_0x31e1e4,_0x3cea2a)=>{const _0x555bf6=_0x3cea2a[0x0];_0x555bf6['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x555bf6),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x28297e,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x1e69bc,_0x4a511a,_0xf80f26)=>'connected'===_0x1e69bc&&!_0x4a511a&&!_0xf80f26),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x5c7a45['disableReadOnlyMode']('rtc-offline'):_0x5c7a45['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x5c7a45['disableReadOnlyMode']('rtc-offline'):_0x5c7a45['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x3ea21b=this['editor']['plugins']['get'](Q),_0x20e4dd=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0x3ea21b['unregister'](this['_channelId']);const _0x1b72cd=await this['_service']['reconnect'](_0x20e4dd['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1b72cd)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x39d34c=await this['_service']['getConnectedSessions']();_0x3ea21b['register'](this['_channelId'],_0x39d34c),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x3d712b){if(function(_0x172768){return'404'===_0x172768['code'];}(_0x3d712b)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x7c302){return'409'===_0x7c302['code'];}(_0x3d712b)){const _0x541bf9=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'](_0x541bf9);}else{if(!(_0x3d712b instanceof nt))throw _0x3d712b;this['_handleReconnectionError']();}}}}destroy(){const _0x144bc8=this['editor']['plugins']['get'](J),_0x39937d=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x39937d['channelSessions']['has'](this['_channelId'])&&_0x39937d['unregister'](this['_channelId']),_0x144bc8['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x55fcac){if(this['sessionId']!==_0x55fcac['sessionId']&&this['_lastSyncedOperationId']!==_0x55fcac['lastOperationId'])throw new nt();return this['sessionId']=_0x55fcac['sessionId'],this['_handleServerResponse']([],{..._0x55fcac,'wereChangesApplied':!0x1,'data':_0x55fcac['data']},'reconnect');}async _connectService(_0x250f8e,_0x357001=!0x1){const {connection:_0x27fdb6}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x27fdb6,this['_channelId'])['then'](_0x38654a=>this['_initSessionsHandling'](_0x38654a))['catch'](_0x5db841=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x5db841);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x632880,_0x54f271)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x54f271);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x30f04b=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x250f8e);this['_isPendingUpdate']=!0x0;const _0x32347c=await this['_service']['connect'](_0x27fdb6,this['_compressOperations'](_0x250f8e),_0x30f04b);if(this['sessionId']=_0x32347c['sessionId'],_0x357001){if(!_0x32347c['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x32347c['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x250f8e,_0x32347c,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x32347c,_0x250f8e);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x2c8a5c=this['editor']['plugins']['get'](Q),_0x5cc903=this['editor']['plugins']['get'](X),_0x46dd3e=_0x2c8a5c['channelSessions']['get'](this['_channelId']);_0x46dd3e&&_0x46dd3e['length']>0x1?_0x5cc903['createUserMarkerOperations']():this['listenTo'](_0x2c8a5c,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x2c8a5c['channelSessions']['get'](this['_channelId'])['length']&&_0x5cc903['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x1d2986,_0x2d2235,_0x2b3617,_0x38595e){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x2d2235){const _0x596a44=this['_decompressOperations'](_0x2b3617,_0x38595e);await this['_fetchMissingUsers'](_0x596a44),this['_handleExternalOperations'](_0x596a44,_0x2d2235,_0x2b3617['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x457420}=this['editor'];let _0x187949;try{_0x187949=await this['_service']['getDocumentDetails']();}catch{const _0x35f7d0=et(_0x457420,'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'](_0x35f7d0);}const _0x542bef=_0x187949['currentDocumentSession']||_0x187949['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x542bef['lastOperationId']){const _0x20ff36=et(_0x457420,'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'](_0x20ff36);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x33286b=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0x33286b['connection']||'connected'!==_0x33286b['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0xdeacba=this['editor']['plugins']['get'](Q);_0xdeacba['channelSessions']['has'](this['_channelId'])&&_0xdeacba['unregister'](this['_channelId']),_0x33286b['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x3f451b){const _0xb8699d=this['editor']['plugins']['get'](Q);this['listenTo'](_0xb8699d,'sessionAdd:'+this['_channelId'],(_0x3b7f4b,{session:_0x136c11})=>{if(_0x136c11['id']===_0xb8699d['mySessionId']){_0x3b7f4b['off']();const _0xbcb219=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x185ff0=_0x136c11['permissions'];_0xbcb219&&_0xbcb219['isEnabled']&&(_0x185ff0=_0x185ff0['filter'](_0xe4e775=>'document:write'!==_0xe4e775)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x185ff0,this['_channelId']);}}),_0xb8699d['register'](this['_channelId'],_0x3f451b);}_initThrowingOnDataSet(){const _0x503e8d=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x39dcc2)=>{if(!_0x39dcc2[_0x39dcc2['length']-0x1]['suppressErrorInCollaboration'])throw new _0x544475('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x503e8d['apply'](this['editor']['data'],_0x39dcc2);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x19eeb0,[_0x2661f7])=>{if(this['_document']['version'])throw new _0x544475('realtimecollaborationclient-init-document-already-initialized',this);_0x19eeb0['stop'](),this['_setPendingAction']();const _0x327197=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x1fabdb])=>!_0x1fabdb['lazyLoad'])['map'](([_0xa2595,_0x168478])=>[_0xa2595,_0x168478['modelAttributes']||{}])),_0x4f0df9=this['_getOperationsFromInitData'](_0x2661f7,_0x327197);0x0==_0x4f0df9['length']&&_0x4f0df9['push'](new _0x4ac29a(0x0)),_0x19eeb0['return']=this['_connectService'](_0x4f0df9)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x469fe0=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x469fe0))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2390df,[_0x5b33b8,_0x1a20a4])=>{_0x2390df['stop']();const _0x493b2f=this['editor']['model']['document']['getRoot'](_0x5b33b8);if(!this['_knownRootNames']['has'](_0x5b33b8)){const _0x1fe731=_0x1a20a4&&_0x1a20a4['data']?_0x1a20a4['data']:'',_0x1e59dd=_0x1a20a4&&_0x1a20a4['attributes']?_0x1a20a4['attributes']:{};await this['_loadRoot'](_0x5b33b8,_0x1fe731,_0x1e59dd);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x493b2f['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x493b2f);});},{'priority':'high'});}async _fetchMissingUsers(_0x1d61e1){const _0x1f019e=this['editor']['plugins']['get'](_0x2de45a),{connection:_0x2976ba}=this['editor']['plugins']['get'](J),_0xb481d0=new Set();for(const _0x228117 of _0x1d61e1){const _0x72c5e7=_0x228117['_authorId'];_0x72c5e7&&!_0x1f019e['getUser'](_0x72c5e7)&&_0xb481d0['add'](_0x72c5e7);}if(0x0===_0xb481d0['size'])return;const _0x1447af=await _0x57eb50['getMany'](_0x2976ba,Array['from'](_0xb481d0));for(const _0x373066 of _0x1447af)_0x1f019e['getUser'](_0x373066['id'])||_0x1f019e['addUser'](_0x373066);}_getOperationsFromInitData(_0x54e33f,_0x40a593={}){const _0x3a3afb=this['editor']['model'],_0x43fda9=[];let _0x2a658a=0x0;const _0x2eb1d7='string'==typeof _0x54e33f?{'main':_0x54e33f}:_0x54e33f;for(const _0x49ba17 of Object['keys'](_0x2eb1d7)){if(!this['_document']['roots']['has'](_0x49ba17))throw new _0x544475('realtimecollaborationclient-init-non-existent-root',this);const _0x2771ee=this['_document']['getRoot'](_0x49ba17),_0x3bc99c=this['editor']['data']['parse'](_0x2eb1d7[_0x49ba17],_0x2771ee),_0x443e20=new _0x2deb91(_0x3a3afb['createPositionAt'](_0x2771ee,0x0),_0x3bc99c,_0x2a658a++);_0x43fda9['push'](_0x443e20);for(const [_0x1b4fec,_0x20cd93]of _0x3bc99c['markers']){const _0x5e3051=_0x3a3afb['createRange'](_0x3a3afb['createPositionFromPath'](_0x2771ee,_0x20cd93['start']['path']['slice']()),_0x3a3afb['createPositionFromPath'](_0x2771ee,_0x20cd93['end']['path']['slice']())),_0x290ead=new _0x54255b(_0x1b4fec,null,_0x5e3051,_0x3a3afb['markers'],!0x0,_0x2a658a++);_0x43fda9['push'](_0x290ead);}}if(_0x40a593)for(const [_0x1771ff,_0x277ffd]of Object['entries'](_0x40a593)){const _0xb85148=_0x3a3afb['document']['getRoot'](_0x1771ff);if(!_0xb85148)throw new _0x544475('multi-root-editor-root-attributes-no-root',null);for(const [_0x1f67a7,_0x3c7a5b]of Object['entries'](_0x277ffd))if(null!==_0x3c7a5b){const _0x26bcac=new _0x1af6e4(_0xb85148,_0x1f67a7,null,_0x3c7a5b,_0x2a658a++);_0x43fda9['push'](_0x26bcac);}}return _0x43fda9;}async _loadRoot(_0x398525,_0x866332,_0x4a9fc8){this['_getOperationsFromInitData']({[_0x398525]:_0x866332},{[_0x398525]:_0x4a9fc8})['forEach']((_0x42be49,_0x484d0c)=>{_0x42be49['baseVersion']=this['_document']['version']+_0x484d0c,_0x42be49['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x42be49);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x1aa51f,_0x332536){let _0x1822af;this['_offset']=_0x1aa51f['offset'];const _0x2d95e2=_0x1aa51f['wereChangesApplied']&&!_0x1aa51f['initData'],_0x5f1fa0=_0x2d95e2?0x0:_0x1aa51f['data']['baseVersion'];if(_0x332536['forEach'](_0x5becd3=>{_0x5becd3['_isInit']=!0x0,_0x5becd3['createdAt']=_0x1aa51f['sessionCreatedAt'],_0x5becd3['_authorId']=null;}),_0x2d95e2)_0x1822af=_0x332536,this['_applyOperationsSet'](_0x1822af,_0x2d95e2);else{if(_0x1aa51f['initData']){const _0x190fd5=this['_getOperationsFromInitData'](_0x1aa51f['initData']);this['_document']['history']['version']=-_0x190fd5['length'],_0x190fd5['forEach'](_0x10e40f=>{_0x10e40f['baseVersion']-=_0x190fd5['length'],_0x10e40f['createdAt']=_0x1aa51f['sessionCreatedAt'],_0x10e40f['_isInit']=!0x0,_0x10e40f['_authorId']=null;}),this['_applyOperationsSet'](_0x190fd5,!0x0),this['serverHistory']['version']=-_0x190fd5['length']+this['_offset'],this['_updateServerHistory'](_0x190fd5);}this['_document']['history']['version']=_0x5f1fa0,_0x1822af=this['_decompressOperations'](_0x1aa51f['data'],_0x1aa51f['metadata']),await this['_fetchMissingUsers'](_0x1822af),this['_applyOperationsSet'](_0x1822af,_0x2d95e2);}_0x1aa51f['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1822af,_0x1aa51f['lastOperationId']),this['_lastSyncedOperationId']=_0x1aa51f['lastOperationId']),this['serverHistory']['version']=_0x5f1fa0+this['_offset'],this['_updateServerHistory'](_0x1822af),_0x332536['filter'](_0x167c22=>{const _0x5ce6e9=this['_getAffectedRoot'](_0x167c22);return _0x5ce6e9&&!this['_knownRootNames']['has'](_0x5ce6e9);})['forEach']((_0x13daef,_0x176d8a)=>{_0x13daef['baseVersion']=this['_document']['version']+_0x176d8a,this['_saveOperationInBuffer'](_0x13daef);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0xaf168,_0x39b197){const _0x1ac563=_0x39b197&&_0x39b197['message'];if(_0x1ac563&&_0x1ac563['startsWith']('realtimecollaborationclient'))throw _0x39b197;const _0x3956b6=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0x3956b6['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x544475(_0xaf168,this['editor'],_0x1ac563?{'originalError':_0x1ac563}:void 0x0);}_saveOperationInBuffer(_0x45b560){this['_knownOperations']['has'](_0x45b560)||(this['_knownOperations']['add'](_0x45b560),this['_bufferedOperations']['push'](_0x45b560),this['_pendingAction']||'marker'==_0x45b560['type']&&!_0x45b560['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x40ef05=!0x1){!_0x40ef05&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x52da22=>{_0x52da22&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x31df7b=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x324abd){return _0x324abd['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x324abd['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x324abd['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x31df7b)||this['_crash'](_0x31df7b['message'],_0x31df7b);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0xfda154=>{this['on']('change:_isPendingUpdate',()=>{_0xfda154();});});}async _sendBufferedOperations(){const _0xd8d2e=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0xd8d2e['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x34677d=[...this['_bufferedOperations']];for(const _0x10886d of _0x34677d)_0x10886d['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x10886d);const _0x36e27d=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x34677d),_0x4801af=st++,_0x553565=this['_compressOperations'](_0x34677d),_0x38bf7c=await this['_service']['sendOperations'](_0x553565,_0x553565['baseVersion'],_0x36e27d);try{return await this['_handleServerResponse'](_0x34677d,_0x38bf7c,_0x4801af);}catch(_0x4009e1){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x4009e1);}}async['_handleServerResponse'](_0x1b7d93,_0x7d9b14,_0x1fb21a){if('error'in _0x7d9b14)throw _0x7d9b14['error'];let _0x2c05e9;if(_0x7d9b14['wereChangesApplied']){_0x7d9b14['lastOperationId']&&(this['_lastSyncedOperationId']=_0x7d9b14['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x9f335a=>!_0x1b7d93['includes'](_0x9f335a));for(const _0x1ef836 of _0x1b7d93)_0x1ef836['createdAt']='lastOperationAcceptedAt'in _0x7d9b14&&_0x7d9b14['lastOperationAcceptedAt']||void 0x0;ot(_0x1b7d93,_0x7d9b14['version']-_0x1b7d93['length']),this['_updateServerHistory'](_0x1b7d93);const _0x2b5bbd=_0x1b7d93['filter'](_0x7004b4=>{if(!_0x7004b4['_isInit'])return!0x1;const _0x146eb9=this['_getAffectedRoot'](_0x7004b4);return _0x146eb9&&!this['_knownRootNames']['has'](_0x146eb9);});ot(_0x2b5bbd,this['_document']['version']),this['_applyOperationsSet'](_0x2b5bbd),_0x2c05e9=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x39ed2e=this['_decompressOperations'](_0x7d9b14['data'],_0x7d9b14['metadata'])['filter'](_0xe1324c=>_0xe1324c['baseVersion']>=this['_lastServerVersion']);_0x39ed2e['forEach'](_0x5e1aad=>this['_addKnownRoot'](_0x5e1aad)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5a05ba=>!_0x5a05ba['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x5a05ba))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x39ed2e),_0x2c05e9=this['_handleExternalOperations'](_0x39ed2e,_0x7d9b14['version'],_0x7d9b14['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x2c05e9?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0xd3b379,_0x107e3e,_0x4dba2b){try{const _0x2a8f04={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x1a91d0,operationsB:_0x1239a7,originalOperations:_0x99d31c}=_0x4e0779(_0xd3b379,this['_bufferedOperations'],_0x2a8f04);ot(_0x1a91d0,this['_document']['version']),ot(_0x1239a7,_0x107e3e);for(const _0x825c0 of _0x1a91d0){const _0xf948d5=_0x99d31c['get'](_0x825c0);_0xf948d5?(_0x825c0['_authorId']=_0xf948d5['_authorId'],'noop'!==_0x825c0['type']&&(_0x825c0['_aiSource']=_0xf948d5['_aiSource'])):_0x825c0['_authorId']=null;}for(const _0x400338 of _0x1239a7)'noop'!==_0x400338['type']&&(_0x400338['_aiSource']=_0x99d31c['get'](_0x400338)?.['_aiSource']);_0x4dba2b&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xd3b379,_0x4dba2b),this['_lastSyncedOperationId']=_0x4dba2b),this['_bufferedOperations']=[..._0x1239a7],this['_applyOperationsSet'](_0x1a91d0),this['_updateServerHistory'](_0xd3b379);}catch(_0x4e360e){return console['error'](_0x4e360e),!0x1;}return!0x0;}_applyOperationsSet(_0x2a4d81,_0x4328ea=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x21deff=>{for(const _0x31fa79 of _0x2a4d81)this['_knownOperations']['add'](_0x31fa79),this['_addKnownRoot'](_0x31fa79),_0x21deff['batch']['addOperation'](_0x31fa79),this['editor']['model']['applyOperation'](_0x31fa79);});}_addKnownRoot(_0x10310e){const _0x296b45=this['_getAffectedRoot'](_0x10310e);_0x296b45&&this['_knownRootNames']['add'](_0x296b45);}_getAffectedRoot(_0xe48478){let _0x5377de,_0x5630c0;switch(_0xe48478['type']){case'insert':_0x5377de=_0xe48478['position']['root'];break;case'marker':if(_0x5630c0=_0xe48478['newRange'],!_0x5630c0)return null;_0x5377de=_0x5630c0['root'];break;case'addRootAttribute':_0x5377de=_0xe48478['root'];break;case'addRoot':_0x5377de=_0xe48478['affectedSelectable'];break;case'move':_0x5377de=_0xe48478['targetPosition']['root'];break;default:return null;}return _0x5377de['rootName'];}_updateServerHistory(_0x2a14af){_0x2a14af['forEach'](_0x52d209=>{const _0x3ea7dd=_0x52d209['clone']();_0x3ea7dd['_authorId']=_0x52d209['_authorId'],_0x3ea7dd['_isInit']=!!_0x52d209['_isInit'],_0x3ea7dd['_aiSource']=_0x52d209['_aiSource'],_0x3ea7dd['createdAt']=_0x52d209['createdAt'],_0x3ea7dd['baseVersion']+=this['_offset'],_0x52d209['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x3ea7dd),this['serverHistory']['addOperation'](_0x3ea7dd);});}_handleReconnectionError(_0x58635d){const _0x301476=this['editor']['plugins']['get']('Notification'),_0x1f66a=this['editor']['locale'];_0x58635d||(_0x58635d=et(_0x1f66a,'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.')),_0x301476['showWarning'](_0x58635d,{'title':et(_0x1f66a,'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'](_0x265a77)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x265a77)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x243f34){const _0x4b49e1=_0x243f34['map'](_0x2bc913=>_0x2bc913['toJSON']());return this['_compressor']['compress'](_0x4b49e1);}_decompressOperations(_0x4005c6,_0x5c3eb7){return this['_compressor']['decompress'](_0x4005c6)['map']((_0x2a0363,_0x2dc423)=>{const _0x1d11a3='init'==_0x5c3eb7[_0x2dc423]['type'];if('InsertOperation'==_0x2a0363['__className']){const _0x189297=_0x2a0363['position']['root'];!this['_document']['getRoot'](_0x189297)&&(this['_document']['createRoot']('$unknown',_0x189297)['_isAttached']=!0x1);}else{if('RootOperation'==_0x2a0363['__className']){const _0x5d1935=this['_document']['getRoot'](_0x2a0363['rootName']);_0x5d1935&&'$unknown'==_0x5d1935['name']&&_0x2a0363['elementName']!=_0x5d1935['name']&&(_0x5d1935['name']=_0x2a0363['elementName']);}}const _0x3f457d=_0x4aa6c3['fromJSON'](_0x2a0363,this['_document']);return _0x3f457d['wasUndone']=_0x2a0363['wasUndone'],_0x3f457d['_isInit']=_0x1d11a3,_0x3f457d['_authorId']=_0x1d11a3?null:_0x5c3eb7[_0x2dc423]['userId'],_0x3f457d['_isDisconnection']='cs:removeUser'===_0x5c3eb7[_0x2dc423]['type'],_0x3f457d['_aiSource']=_0x2a0363['_aiSource']||void 0x0,_0x3f457d['createdAt']=_0x5c3eb7[_0x2dc423]['createdAt'],_0x3f457d;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x432e8f=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x432e8f&&_0x432e8f['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x3eda1f,_0x454582){for(const _0x186769 of _0x3eda1f)_0x186769['baseVersion']=_0x454582++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0x45ded0){this['_ignoredOperations']=_0x45ded0,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0xd45480){let _0x35d329=_0xd45480['length'];for(;_0x35d329--;){const _0x35b9a2=_0xd45480[_0x35d329];if(!this['_ignoredOperations']['has'](_0x35b9a2)){if(!this['_operationToId']['has'](_0x35b9a2)){const _0x59cd63=_0x3fa067()['slice'](0x1,0x12);this['_operationToId']['set'](_0x35b9a2,_0x59cd63);}return this['_operationToId']['get'](_0x35b9a2);}}}setIdForTheLastOperation(_0x36925b,_0x4e0f2a){if(!_0x4e0f2a)return;let _0x4f81fa=_0x36925b['length'];for(;_0x4f81fa--;){const _0x540d91=_0x36925b[_0x4f81fa];this['_ignoredOperations']['has'](_0x540d91)||this['_operationToId']['set'](_0x540d91,_0x4e0f2a);}}},ct=class extends _0x31fc40{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x3d5c65{static CommentsService=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x2d2254)());['_services'];static get requires(){return[J,_0x4a59f5,Q,_0x2de45a];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x11df24){super(_0x11df24),this['_services']=new Map();}async init(){const _0x524cb1=this['context'],_0x8646bb=_0x524cb1['plugins']['get'](_0x4a59f5);if(_0x524cb1['plugins']['get'](J)['addToReconnectionStack'](this),_0x8646bb['adapter']={'addCommentThread':async({channelId:_0xad858f,threadId:_0x2cedab,comments:_0x5de4e9,resolvedAt:_0x10182e,resolvedBy:_0x2cec46,context:_0x193a70,attributes:_0x3102d0})=>{const _0xb1ad57=await this['_getService'](_0xad858f)['addCommentThread']({'commentThreadId':_0x2cedab,'comments':_0x5de4e9['map'](_0x49a721=>function(_0x400bf0,_0x55c520,_0x1d1bc6){return{'commentThreadId':_0x1d1bc6,'commentId':_0x400bf0['commentId'],'userId':_0x400bf0['authorId'],'content':_0x400bf0['content'],'documentId':_0x55c520,'createdAt':_0x400bf0['createdAt'],'attributes':_0x400bf0['attributes']||{}};}(_0x49a721,_0xad858f,_0x2cedab)),'resolvedAt':_0x10182e,'resolvedBy':_0x2cec46,'context':_0x193a70,'attributes':_0x3102d0})['catch'](lt);return{'threadId':_0xb1ad57['commentThreadId'],'comments':_0xb1ad57['comments']};},'getCommentThread':async({channelId:_0x40fb97,threadId:_0x260074})=>{const _0x42d643=await this['_getService'](_0x40fb97)['getCommentThread'](_0x260074)['catch'](ht)['catch'](lt);return _0x42d643?_0x42d643['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x42d643]),{'threadId':_0x42d643['commentThreadId'],'comments':_0x42d643['comments']['map'](dt),'context':_0x42d643['context'],'resolvedAt':_0x42d643['resolvedAt'],'resolvedBy':_0x42d643['resolvedBy'],'attributes':_0x42d643['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x1abc5e,threadId:_0x55b85d,context:_0x161d76,unlinkedAt:_0x44bfdd,attributes:_0x4f7558})=>this['_getService'](_0x1abc5e)['updateCommentThread']({'commentThreadId':_0x55b85d,'context':_0x161d76,'attributes':_0x4f7558,'unlinkedAt':_0x44bfdd})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x5b4c45,threadId:_0x505162})=>{const _0xefbb5e=await this['_getService'](_0x5b4c45)['resolveCommentThread'](_0x505162)['catch'](ht)['catch'](lt);return{'threadId':_0xefbb5e['commentThreadId'],'resolvedAt':_0xefbb5e['resolvedAt'],'resolvedBy':_0xefbb5e['resolvedBy']};},'reopenCommentThread':async({channelId:_0x353f6a,threadId:_0x4627e2})=>this['_getService'](_0x353f6a)['reopenCommentThread'](_0x4627e2)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x2a324d,threadId:_0x9883c3})=>this['_getService'](_0x2a324d)['removeCommentThread'](_0x9883c3)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x1c8b9c,threadId:_0x50f649,commentId:_0x56fa52,content:_0x292e70,attributes:_0x11846a})=>this['_getService'](_0x1c8b9c)['addComment'](_0x50f649,_0x56fa52,_0x292e70,_0x11846a)['catch'](lt),'updateComment':({channelId:_0x33af6f,threadId:_0x24f2a2,commentId:_0x119af5,content:_0x5cf49a,attributes:_0x8bc34})=>this['_getService'](_0x33af6f)['updateComment'](_0x24f2a2,_0x119af5,_0x5cf49a,_0x8bc34)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x167525,threadId:_0x50fdca,commentId:_0x197d11})=>this['_getService'](_0x167525)['removeComment'](_0x50fdca,_0x197d11)['catch'](ht)['catch'](lt)},_0x524cb1 instanceof _0x54e3f1){const _0x124873=_0x524cb1['config']['get']('collaboration.channelId'),_0x3c6fc2=_0x524cb1['plugins']['get'](Q);await this['_setUpService'](_0x124873);const _0x1b0af0=await this['_services']['get'](_0x124873)['getConnectedSessions']();this['listenTo'](_0x3c6fc2,'sessionAdd:'+_0x124873,(_0x2997aa,{session:_0x2b5442})=>{_0x2b5442['id']===_0x3c6fc2['mySessionId']&&(_0x2997aa['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x2b5442['permissions'],_0x124873));}),_0x3c6fc2['register'](_0x124873,_0x1b0af0);}}async _setUpService(_0x4dd643){if(this['_services']['has'](_0x4dd643))throw new _0x544475('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x4dd643});const _0xb87cd8=this['context']['plugins']['get'](_0x4a59f5),_0x1d0438=new CloudServicesCommentsAdapter['CommentsService'](_0x4dd643);this['_services']['set'](_0x4dd643,_0x1d0438),this['listenTo'](_0x1d0438,'commentThreadAdded',(_0x4cd647,_0xe2caa3)=>{const {commentThreadId:_0x1c0869,documentId:_0x440ab7,context:_0x497697,attributes:_0x1f50dc,resolvedAt:_0x3c97f9,resolvedBy:_0xf4622c,comments:_0x2235ba}=_0xe2caa3;_0xb87cd8['getCommentThread'](_0x1c0869)||_0xb87cd8['addCommentThread']({'threadId':_0x1c0869,'channelId':_0x440ab7,'comments':_0x2235ba?_0x2235ba['map'](dt):[],'context':_0x497697,'attributes':_0x1f50dc,'resolvedAt':_0x3c97f9,'resolvedBy':_0xf4622c,'isFromAdapter':!0x0});}),this['listenTo'](_0x1d0438,'commentThreadUpdated',(_0x399e81,{commentThreadId:_0x56f63a,documentId:_0x4b69d0,context:_0x2486b4,unlinkedAt:_0x2d7a93,attributes:_0x148e68})=>{_0xb87cd8['getCommentThread'](_0x56f63a)&&_0xb87cd8['updateCommentThread']({'threadId':_0x56f63a,'channelId':_0x4b69d0,'context':_0x2486b4,'unlinkedAt':_0x2d7a93,'attributes':_0x148e68,'isFromAdapter':!0x0});}),this['listenTo'](_0x1d0438,'commentThreadResolved',(_0x1efe7e,{commentThreadId:_0x57c9bd,resolvedBy:_0x4c9e51,resolvedAt:_0x4472b6})=>{const _0xd14fc=_0xb87cd8['getCommentThread'](_0x57c9bd);_0xd14fc&&_0xd14fc['resolve']({'resolvedBy':_0x4c9e51,'resolvedAt':_0x4472b6,'isFromAdapter':!0x0});}),this['listenTo'](_0x1d0438,'commentThreadReopened',(_0x426a46,{commentThreadId:_0x554e69})=>{const _0x590c78=_0xb87cd8['getCommentThread'](_0x554e69);_0x590c78&&_0x590c78['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1d0438,'commentThreadRemoved',(_0x499845,{commentThreadId:_0x2832cc})=>{const _0x3fe2b0=_0xb87cd8['getCommentThread'](_0x2832cc);_0x3fe2b0&&_0x3fe2b0['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1d0438,'commentAdded',(_0xb774fe,_0x48cc21)=>{const _0x21471f=_0x48cc21['commentThreadId'],_0x36369f=_0xb87cd8['getCommentThread'](_0x21471f);_0x36369f&&_0x36369f['addComment']({...dt(_0x48cc21),'isFromAdapter':!0x0});}),this['listenTo'](_0x1d0438,'commentUpdated',(_0x862e52,{commentThreadId:_0x1c8c4d,commentId:_0x439cbd,content:_0xaa9e7f,attributes:_0x208291})=>{const _0x59f0a9=_0xb87cd8['getCommentThread'](_0x1c8c4d);if(_0x59f0a9){const _0x413fae=_0x59f0a9['getComment'](_0x439cbd);_0x413fae&&_0x413fae['update']({'content':_0xaa9e7f,'attributes':_0x208291,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1d0438,'commentRemoved',(_0x573796,{commentThreadId:_0x265c48,commentId:_0x30bd3d})=>{const _0x24d09b=_0xb87cd8['getCommentThread'](_0x265c48);if(_0x24d09b){const _0x4f83cf=_0x24d09b['getComment'](_0x30bd3d);_0x4f83cf&&_0x4f83cf['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x1d0438,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0x4dd643),this['stopListening'](_0x1d0438));}),await this['_connectService'](_0x4dd643);}destroy(){if(this['context']instanceof _0x54e3f1){const _0x14041d=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x14041d)&&this['_terminateService'](_0x14041d);}}_terminateService(_0x481616){if(!this['_services']['has'](_0x481616))throw new _0x544475('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x481616});this['_getService'](_0x481616)['disconnect'](),this['_services']['delete'](_0x481616);}async reconnect(){for(const _0x477e0c of this['_services']['keys']())await this['_connectService'](_0x477e0c);if(this['context']instanceof _0x54e3f1){const _0x250dc5=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x250dc5)){const _0x39b7ad=this['context']['plugins']['get'](Q);_0x39b7ad['unregister'](_0x250dc5);const _0x5f2428=await this['_services']['get'](_0x250dc5)['getConnectedSessions']();_0x39b7ad['register'](_0x250dc5,_0x5f2428);}}}async _connectService(_0xb7f563){const {connection:_0x3957ff}=this['context']['plugins']['get'](J),_0x1dcf0e=this['context']['plugins']['get'](_0x4a59f5),_0xec544a=await this['_services']['get'](_0xb7f563)['connect'](_0x3957ff);await this['_fetchMissingUsersForThreads'](_0xec544a);const _0x55d757=new Set(Array['from'](_0x1dcf0e['getCommentThreads']({'channelId':_0xb7f563}),_0x2e2fc6=>_0x2e2fc6['id']));for(const _0xd1e896 of _0xec544a)_0xd1e896['deletedAt']||_0x55d757['delete'](_0xd1e896['commentThreadId']);for(const _0x21e2c6 of _0x55d757)_0x1dcf0e['getCommentThread'](_0x21e2c6)['remove']({'isFromAdapter':!0x0});for(const _0x14c484 of _0xec544a){let _0x423cfe=_0x1dcf0e['getCommentThread'](_0x14c484['commentThreadId']);const {commentThreadId:_0x30661e,context:_0x3cfa38,attributes:_0x35b5af,resolvedBy:_0x5c5c93,resolvedAt:_0xd25ddd,unlinkedAt:_0x13e5b2,deletedAt:_0x43df0d}=_0x14c484;if(_0x43df0d)continue;_0x423cfe||(_0x423cfe=_0x1dcf0e['addCommentThread']({'channelId':_0xb7f563,'threadId':_0x30661e,'context':_0x3cfa38,'attributes':_0x35b5af||{},'resolvedBy':_0x5c5c93,'resolvedAt':_0xd25ddd,'unlinkedAt':_0x13e5b2,'isFromAdapter':!0x0}));const _0x2a8eb3=new Set(Array['from'](_0x423cfe['comments'],_0x57bfc0=>_0x57bfc0['id']));for(const _0x1adac2 of _0x14c484['comments'])_0x2a8eb3['delete'](_0x1adac2['commentId']);for(const _0x2f06ea of _0x2a8eb3)_0x423cfe['getComment'](_0x2f06ea)['remove']({'isFromAdapter':!0x0});for(const _0x30bd34 of _0x14c484['comments']){const _0x5be074=_0x423cfe['getComment'](_0x30bd34['commentId']);_0x5be074?_0x5be074['content']!==_0x30bd34['content']&&_0x5be074['update']({'content':_0x30bd34['content'],'isFromAdapter':!0x0}):_0x423cfe['addComment'](Object['assign'](dt(_0x30bd34),{'isFromAdapter':!0x0}));}}}_getService(_0x354af2){if(!this['_services']['has'](_0x354af2))throw new _0x544475('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x354af2});return this['_services']['get'](_0x354af2);}async _fetchMissingUsersForThreads(_0x44cc6e){const _0x440f3c=this['context']['plugins']['get'](_0x2de45a),{connection:_0xff8897}=this['context']['plugins']['get'](J),_0x59b28=new Set();for(const {resolvedBy:_0x2cbc56,comments:_0x49135d}of _0x44cc6e){_0x2cbc56&&!_0x440f3c['getUser'](_0x2cbc56)&&_0x59b28['add'](_0x2cbc56);for(const {userId:_0x46687d}of _0x49135d)_0x440f3c['getUser'](_0x46687d)||_0x59b28['add'](_0x46687d);}if(0x0===_0x59b28['size'])return;const _0x7eaa89=await _0x57eb50['getMany'](_0xff8897,Array['from'](_0x59b28));for(const _0x2144f0 of _0x7eaa89)_0x440f3c['getUser'](_0x2144f0['id'])||_0x440f3c['addUser'](_0x2144f0);}};async function ht(_0x4b0d00){if('404'!==_0x4b0d00['code'])throw _0x4b0d00;}function lt(_0x406e57){if((_0x483d47=_0x406e57)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x483d47['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x483d47['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x483d47;throw _0x406e57;}function dt(_0x5aedaa){return{'threadId':_0x5aedaa['commentThreadId'],'commentId':_0x5aedaa['commentId'],'content':_0x5aedaa['content'],'createdAt':_0x5aedaa['createdAt'],'authorId':_0x5aedaa['userId'],'attributes':_0x5aedaa['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x31fc40{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>_0xe48cc6)());_bufferedRequests;_trackChangesService;static get requires(){return[at,_0x53e314,J];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1e4d27){super(_0x1e4d27);const _0x4b3143=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x4b3143);}init(){const _0xbedd38=this['editor']['plugins']['get'](J),_0x50d168=this['editor']['plugins']['get'](_0x53e314);return _0x50d168['adapter']={'getSuggestion':async _0x2bdf08=>{await this['_waitForServiceReady']();const _0x34fa93=await this['_trackChangesService']['get'](_0x2bdf08)['catch'](ft);return await this['_fetchMissingUsersForThreads']([_0x34fa93]),_0x34fa93;},'addSuggestion':async({id:_0x160b15,type:_0x3513fc,data:_0x4056d2,originalSuggestionId:_0x522f85,attributes:_0x361d3d})=>{await this['_waitForServiceReady']();const _0x3b9f57={'id':_0x160b15,'type':_0x3513fc,'data':_0x4056d2,'originalSuggestionId':_0x522f85,'attributes':_0x361d3d},_0x4de8ba=await this['_trackChangesService']['add'](_0x160b15,_0x3513fc,_0x4056d2,_0x522f85,_0x361d3d)['catch'](_0x36c52f=>{if(mt(_0x36c52f))return new Promise(_0x39e569=>{this['_bufferedRequests']['set'](_0x160b15,{'resolve':_0x39e569,'suggestionData':_0x3b9f57});});throw _0x36c52f;});return this['_bufferedRequests']['delete'](_0x160b15),_0x4de8ba;},'updateSuggestion':async(_0x27de9d,_0x3c76f3)=>{if(await this['_waitForServiceReady'](),'open'!==_0x3c76f3['state'])return this['_trackChangesService']['update'](_0x27de9d,_0x3c76f3)['catch'](ft);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x2cbc9d,_0x428124)=>{_0x50d168['hasSuggestion'](_0x428124['id'])&&(_0x50d168['getSuggestion'](_0x428124['id'])['attributes']=_0x428124['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0xbedd38['connection']?.['state']&&(_0xbedd38['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0xbedd38['connection'])['then'](_0x330954=>(_0xbedd38['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x330954)['then'](()=>{for(const _0x5397e2 of _0x330954){_0x50d168['addSuggestionData'](_0x5397e2)['_saved']=!0x0;}})));}async reconnect(){const _0x278777=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x12a99e}=this['editor']['plugins']['get'](J),_0x234067=await this['_trackChangesService']['connect'](_0x12a99e);await this['_fetchMissingUsersForThreads'](_0x234067);for(const {suggestionData:_0x3fa1f3,resolve:_0x2604b9}of this['_bufferedRequests']['values']()){let _0x42ea80=_0x234067['find'](_0x58cc20=>_0x58cc20['id']===_0x3fa1f3['id']);_0x42ea80||(_0x42ea80=await this['_trackChangesService']['add'](_0x3fa1f3['id'],_0x3fa1f3['type'],_0x3fa1f3['data'],_0x3fa1f3['originalSuggestionId'])),_0x2604b9(_0x42ea80);}for(const _0x29ec47 of _0x234067)_0x278777['hasSuggestion'](_0x29ec47['id'])||_0x278777['addSuggestionData'](_0x29ec47);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x58dfdc=>{this['listenTo'](this['_trackChangesService'],'connected',_0x4e22d6=>{_0x4e22d6['off'](),_0x58dfdc();});});}async _fetchMissingUsersForThreads(_0x18b278){const _0x36fcd7=this['editor']['plugins']['get'](_0x2de45a),{connection:_0x196a62}=this['editor']['plugins']['get'](J),_0x1c3e31=new Set();for(const {authorId:_0x53a1a5}of _0x18b278)_0x36fcd7['getUser'](_0x53a1a5)||_0x1c3e31['add'](_0x53a1a5);if(0x0===_0x1c3e31['size'])return;const _0x203beb=await _0x57eb50['getMany'](_0x196a62,Array['from'](_0x1c3e31));for(const _0x4f4b60 of _0x203beb)_0x36fcd7['getUser'](_0x4f4b60['id'])||_0x36fcd7['addUser'](_0x4f4b60);}};function ft(_0x42783c){if(mt(_0x42783c))return new Promise(()=>{});throw _0x42783c;}function mt(_0x239b14){return _0x239b14['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x239b14['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var pt=class extends _0x31fc40{static get requires(){return[_0x1b2357,at,ct,J];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x3202a7=this['editor']['plugins']['get'](J),_0x57fecd=this['editor']['plugins']['get'](_0x164838),_0x3193d6=this['editor']['plugins']['get'](at);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x3202a7,'change:state',(_0x2c5649,_0x53d16b,_0x58daca)=>{_0x57fecd['isThreadsLoadingPaused']='connected'!==_0x58daca;});}),this['listenTo'](_0x3202a7,'change:state',(_0x1d1cdd,_0x1aafd5,_0x30a2c5)=>{this['editor']['plugins']['get'](_0x4a59f5)['switchReadOnly']('connected'!==_0x30a2c5);}),_0x3193d6['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x4abfea=this['editor']['plugins']['get'](at),_0x123e65=this['editor']['config']['get']('collaboration.channelId');_0x4abfea['_services']['has'](_0x123e65)&&_0x4abfea['_terminateService'](_0x123e65),super['destroy']();}},gt=class extends _0x31fc40{static get requires(){return[pt,ut,_0x22666b];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class CloudServicesRevisionHistoryAdapter extends _0x31fc40{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
+ ((()=>_0x44fe60)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0x2f93b0,Q,_0x2de45a];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4de69a){super(_0x4de69a);const _0xfa808e=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0xfa808e);}async init(){const _0x5f17e4=this['editor']['plugins']['get'](it),_0x37424b=_0x5f17e4['serverHistory'],_0xbc0b23=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x37424b,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x5f17e4['sessionId']});const _0x9f6e0=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x5643f0,_0x43889f=await _0x49285b['isBundleUploaded'](_0xbc0b23['connection'],_0x9f6e0);this['editor']['plugins']['get'](_0x2f93b0)['adapter']={'getRevision':async({revisionId:_0x309190})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x309190)),'updateRevisions':async _0x1be171=>{await this['_waitForServiceReady']();const _0x126b86=this['_revisionTracker']['currentRevision'];if(_0x43889f&&0x1===_0x1be171['length']&&_0x1be171[0x0]['id']===_0x126b86['id'])return _0x1be171;for(const _0x5b2fcb of _0x1be171)_0x5b2fcb['id']===_0x126b86['id']&&(_0x5b2fcb['isEmptyCurrent']=_0x5b2fcb['fromVersion']===_0x5b2fcb['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1be171,this['_lastRequestId'])['then'](_0x51b20d=>(this['_lastRequestId']=_0x51b20d,_0x1be171))['catch'](_0x4511b4=>{if(vt(_0x4511b4)||'400'===_0x4511b4['code']&&void 0x0!==_0x4511b4['data']['wrongRequestId']){for(const _0x3d1f61 of _0x1be171)this['_revisionTracker']['repository']['getRevision'](_0x3d1f61['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x3d1f61['id'],_0x3d1f61,!0x1);if(vt(_0x4511b4)&&'destroyed'!==this['editor']['state'])throw _0x4511b4;return _0x1be171;}throw _0x4511b4;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x237cd5,{revisionsData:_0x399ca5,requestId:_0x253532})=>{Math['max'](..._0x399ca5['map'](_0x583691=>_0x583691['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x399ca5,_0x253532);}):this['_handleRevisionsUpdate'](_0x399ca5,_0x253532);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0xbc0b23['connection']?.['state']&&(_0xbc0b23['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x514fa6,requestId:_0x22b4da}=await this['_revisionHistoryService']['connect'](_0xbc0b23['connection']);_0xbc0b23['addToReconnectionStack'](this),this['_lastRequestId']=_0x22b4da,await this['_fetchMissingUsers'](_0x514fa6);for(const _0xf7ff69 of _0x514fa6)this['_revisionTracker']['addRevisionData'](_0xf7ff69);this['listenTo'](_0x5f17e4,'change:_isConnected',(_0x10eb72,_0x41093b,_0x3fc7cf)=>{_0x3fc7cf&&(this['_oldOffset']=_0x5f17e4['_offset'],_0x10eb72['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x4026cd=this['editor']['plugins']['get'](J),_0x53b204=this['editor']['plugins']['get'](it),_0x192c91=async()=>{const _0x38bdca=this['_revisionTracker']['currentRevision'],_0x4afea5=_0x38bdca['id'],_0x437a0f=_0x4afea5!==_0x53b204['sessionId'];if(_0x437a0f){const _0x22ec27=_0x53b204['_offset']-this['_oldOffset'],_0x1429bf=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x38bdca['toVersion']+_0x22ec27!==_0x1429bf){const _0x115111=_0x38bdca['fromVersion']+_0x22ec27,_0x3e53f3=this['editor']['plugins']['get'](_0x2de45a),_0x21bed7=this['_revisionTracker']['buildRevisionData']({'revision':_0x38bdca,'from':_0x115111,'to':_0x1429bf});_0x21bed7['id']=_0x38bdca['id'];const _0x1bcef6=_0x21bed7['authorsIds']['map'](_0x20dafe=>_0x3e53f3['getUser'](_0x20dafe));_0x38bdca['_update']({..._0x21bed7,'authors':_0x1bcef6},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x38bdca['id'],_0x21bed7,!0x0);}this['_revisionTracker']['_startingVersion']=_0x1429bf,_0x38bdca['toVersion']!==_0x38bdca['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x4afea5)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x4afea5),this['_revisionTracker']['_createCurrentRevision'](_0x1429bf);}const {revisions:_0x3260d7,requestId:_0x19b419}=await this['_revisionHistoryService']['reconnect'](_0x4026cd['connection'],this['_lastRequestId']);_0x437a0f&&_0x3260d7['length']>0x0?_0x53b204['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x3260d7),this['_handleRevisionsUpdate'](_0x3260d7,_0x19b419),this['_revisionTracker']['sendBufferedUpdates']());};return _0x53b204['_isConnected']?_0x192c91():new Promise((_0x22e388,_0x59668b)=>{_0x53b204['once']('change:_isConnected',()=>{_0x192c91()['then'](_0x22e388)['catch'](_0x59668b);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5ccafc=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x855eba=>{_0x855eba['off'](),_0x5ccafc();});});}_getLatestVersionFromServerOperations(){const _0x4143e7=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0xfecbc5 of _0x4143e7)if('marker'!==_0xfecbc5['type']||_0xfecbc5['affectsData'])return _0xfecbc5['baseVersion']+0x1;}_getLatestVersion(){const _0x418d62=this['editor']['plugins']['get'](it);return new Promise(_0x391ec7=>{_0x418d62['_isPendingUpdate']?_0x418d62['once']('change:_isPendingUpdate',()=>{_0x391ec7(this['_getLatestVersionFromServerOperations']());}):_0x391ec7(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x231f34,_0x344f3e){const _0x3a70a0=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x344f3e;for(const _0x1f9a85 of _0x231f34){const _0x581c44=_0x3a70a0['getRevision'](_0x1f9a85['id']);if(_0x581c44){if((_0x1f9a85['fromVersion']||_0x1f9a85['toVersion'])&&(_0x1f9a85['diffData']=null),_0x581c44===this['_revisionTracker']['currentRevision']){const _0x26a1b3=Math['max'](_0x581c44['toVersion'],_0x1f9a85['toVersion']),_0x387fae=Math['max'](_0x581c44['fromVersion'],_0x1f9a85['fromVersion']);let _0x39c5df;_0x581c44['toVersion']===_0x1f9a85['toVersion']&&_0x581c44['fromVersion']===_0x1f9a85['fromVersion']?(_0x39c5df=!0x0,this['_preventResendingRevisionData'](_0x1f9a85)):_0x1f9a85['toVersion']===_0x26a1b3&&_0x1f9a85['fromVersion']===_0x387fae?_0x39c5df=!0x1:(_0x581c44['toVersion']===_0x26a1b3&&_0x581c44['fromVersion']===_0x387fae||this['_fixRevision']({'revision':_0x581c44,'from':_0x387fae,'to':_0x26a1b3}),_0x39c5df=!0x0),_0x39c5df&&(delete _0x1f9a85['fromVersion'],delete _0x1f9a85['toVersion'],delete _0x1f9a85['diffData'],delete _0x1f9a85['createdAt'],delete _0x1f9a85['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x1f9a85),this['_preventResendingRevisionData'](_0x1f9a85);}else this['_revisionTracker']['addRevisionData'](_0x1f9a85);}const _0x4d1229=_0x3a70a0['getRevisions']();_0x4d1229['reverse']();for(let _0x2152c2=0x0;_0x2152c2<_0x4d1229['length']-0x1;_0x2152c2++){const _0x29bc38=_0x4d1229[_0x2152c2],_0x1537f4=_0x4d1229[_0x2152c2+0x1];if(_0x29bc38['fromVersion']<_0x1537f4['toVersion']){const _0x1270b6=_0x1537f4['toVersion'],_0x4ce2af=Math['max'](_0x1270b6,_0x29bc38['toVersion']);this['_fixRevision']({'revision':_0x29bc38,'from':_0x1270b6,'to':_0x4ce2af});}}}['_fixRevision']({revision:_0x49baa4,from:_0x28d11a,to:_0x3d34c7}={}){const _0x3c425=this['editor']['plugins']['get'](_0x2de45a),_0x365b2b=this['_revisionTracker']['buildRevisionData']({'revision':_0x49baa4,'from':_0x28d11a,'to':_0x3d34c7});_0x365b2b['authors']=_0x365b2b['authorsIds']['map'](_0x383f5a=>_0x3c425['getUser'](_0x383f5a)),_0x49baa4['_update'](_0x365b2b);}_preventResendingRevisionData(_0x53c79d){const _0x49b487={};_0x49b487['id']=_0x53c79d['id'];for(const _0x1095af of Object['keys'](_0x53c79d))'id'!==_0x1095af&&(_0x49b487[_0x1095af]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x49b487['id'],_0x49b487,!0x0);}async _fetchMissingUsers(_0x39518c){const _0x3e71fb=this['editor']['plugins']['get'](_0x2de45a),{connection:_0x35e760}=this['editor']['plugins']['get'](J),_0x4c967b=new Set();for(const _0x412ec5 of _0x39518c){for(const _0x23bb99 of _0x412ec5['authorsIds'])_0x499e02(_0x23bb99);_0x412ec5['creatorId']&&_0x499e02(_0x412ec5['creatorId']);}if(0x0===_0x4c967b['size'])return;const _0x50ef6c=await _0x57eb50['getMany'](_0x35e760,Array['from'](_0x4c967b));for(const _0x42c6e9 of _0x50ef6c)_0x3e71fb['getUser'](_0x42c6e9['id'])||_0x3e71fb['addUser'](_0x42c6e9);function _0x499e02(_0x2a461b){_0x3e71fb['getUser'](_0x2a461b)||_0x4c967b['add'](_0x2a461b);}}};function vt(_0x59b54d){return _0x59b54d['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x59b54d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x59b54d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x31fc40{static get requires(){return[_0x2f93b0,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x521af7{_collapseAt;constructor(_0x5bbbae,_0x158a40=0x6){super(_0x5bbbae);const _0x398280=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x158a40,this['bind']('isHidden')['to'](this,'usersCount',_0x38d28f=>_0x38d28f<_0x158a40),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x398280['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':_0x398280['to']('usersCount',_0x7334fd=>'+'+(_0x7334fd-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x521af7{items;keystrokes;constructor(_0x501a04){super(_0x501a04);const _0x4c96ef=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x1e4d88(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x4c96ef['if']('hasPopup'),'aria-expanded':_0x4c96ef['to']('isExpanded',_0xe237d1=>this['hasPopup']&&String(_0xe237d1)),'aria-label':_0x4c96ef['to']('hasPopup',_0x5c9a86=>et(_0x501a04,_0x5c9a86?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x4c96ef['to']('hasPopup',_0xbaa985=>!!_0xbaa985&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0x305909,_0x3fef3f,_0x354b3d)=>{this['element']&&(_0x354b3d?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 _0x521af7{counterView;inlineListView;constructor(_0x2ea932,_0x3430e2=0x6){super(_0x2ea932);const _0x5128b5=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0x3430e2),this['inlineListView']=new bt(_0x2ea932),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5731b4 of this['inlineListView']['items'])_0x5731b4['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',_0x5128b5['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x521af7{listWrapperView;constructor(_0x1a35cb,_0x58e8cb){super(_0x1a35cb),this['listWrapperView']=new St(_0x1a35cb,_0x58e8cb),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0x1a35cb,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0x2fc7d0{constructor(_0x4782d1,_0x27508a){super(_0x4782d1);const _0x4a2233=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x27508a?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x4a2233['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x4a2233['to']('role'),'aria-label':_0x4a2233['to']('ariaLabel'),'aria-labelledby':_0x4a2233['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x48a199['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x2f815c=this['element'];_0x2f815c&&(this['_isScrollable']=Math['max'](_0x2f815c['scrollHeight'],_0x2f815c['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0x3ebef7{['userView'];constructor(_0x4d67c2,_0x2ce5d6,_0xcea305){super(_0x4d67c2);const _0x496f56=this['bindTemplate'];this['userView']=new _0x13ed79(_0x4d67c2,_0x2ce5d6);const _0x227ea9={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x2ce5d6['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x2ce5d6['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x2ce5d6['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x2ce5d6['color']['getColorVariable'](),'--ck-user-color-alpha':_0x2ce5d6['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0xcea305&&(_0x227ea9['tag']='button',_0x227ea9['on']={'click':_0x496f56['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x227ea9);}['focus'](){this['element']['focus']();}},Ct=class extends _0x521af7{['userView'];['markerView'];constructor(_0xde400e,_0x4a4a68,_0x46d555){super(_0xde400e);const _0x44a5e7=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x13ed79(_0xde400e,_0x4a4a68),this['markerView']=new At(_0xde400e,_0x4a4a68);const _0x106e2e=new _0x27bdd1(_0xde400e);_0x106e2e['template']['tag']='span',_0x106e2e['text']=_0x4a4a68['name'];const _0xc70262={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x44a5e7['to']('isFocusable',_0x17e397=>!!_0x17e397&&0x0),'aria-labelledby':_0x106e2e['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x44a5e7['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x44a5e7['to']('hasTooltip',_0x3576b0=>!_0x3576b0),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x106e2e]};_0x46d555&&(_0xc70262['tag']='button',_0xc70262['on']={'click':_0x44a5e7['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0xc70262);}},At=class extends _0x521af7{constructor(_0xfcb451,_0x364225){super(_0xfcb451),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x364225['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x364225['color']['getColorVariable'](),'--ck-user-color-alpha':_0x364225['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x3d5c65{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x410f9e){super(_0x410f9e),this['context']['config']['define']('presenceList',Pt);const _0x230d1c=_0x410f9e['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x230d1c)throw new _0x544475('presencelist-collapseat-invalid-format',this);if(_0x230d1c<0x1)throw new _0x544475('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x5e9f23(),this['balloonPanelView']=new _0x4167d7(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x4b2461 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x4b2461);this['listenTo'](this['_allConnectedUsers'],'add',(_0xd7e968,_0x34622e)=>{this['_handleUserAdd'](_0x34622e);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x1ca83b,_0x32b8e0)=>{this['_handleUserRemove'](_0x32b8e0);});}_createView(){const _0x132ec3=this['context'],_0x2359e4=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x3fd56f=this['balloonPanelView'];if(!_0x70fece(_0x132ec3['config']['get']('presenceList.container')))throw new _0x544475('presencelist-missing-container',this);_0x2359e4['counterView']['bind']('usersCount')['to'](this),_0x2359e4['bind']('isCollapsed')['to'](this,'usersCount',_0x59a207=>{const {collapseAt:_0x188c2f}=_0x132ec3['config']['get']('presenceList'),_0x2b8847=_0x59a207>=_0x188c2f;if(_0x2b8847&&!_0x2359e4['inlineListView']['items']['find'](_0x90d7e=>_0x90d7e instanceof yt)){const _0x24f37d=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x24f37d&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2359e4['inlineListView']['items']['add'](_0x2359e4['counterView']);}return _0x2b8847||this['hideDropdown'](),_0x2b8847;}),_0x2359e4['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x5d81f2=>{const _0xf67ba2=_0x132ec3['config']['get']('presenceList'),_0x55a78c=new Ct(_0x132ec3['locale'],_0x5d81f2,!!_0xf67ba2['onClick']);return _0x55a78c['bind']('hasTooltip')['to'](_0x2359e4,'isCollapsed',_0x1b492c=>!_0x1b492c),_0x55a78c['bind']('isFocusable')['to'](_0x2359e4,'isCollapsed',_0x289b89=>!_0x289b89),_0xf67ba2['onClick']&&this['listenTo'](_0x55a78c,'execute',()=>{this['view']['isCollapsed']||_0xf67ba2['onClick'](_0x5d81f2,_0x55a78c['element']);}),_0x55a78c;}),_0x2359e4['inlineListView']['keystrokes']['set']('Enter',(_0x30d250,_0x3d8650)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x3d8650());}),_0x2359e4['render'](),_0x3fd56f['render'](),_0x2359e4['listenTo'](_0x2359e4['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x52c840=(_0x3245cc,_0x5150f5)=>{this['_hideDropdownUnlessPointerInside'](_0x5150f5);};return _0x2359e4['listenTo'](_0x2359e4['inlineListView']['element'],'mouseleave',_0x52c840),_0x2359e4['listenTo'](_0x3fd56f['element'],'mouseleave',_0x52c840),_0x2a0934({'emitter':_0x2359e4,'activator':()=>_0x3fd56f['isVisible'],'contextElements':[_0x3fd56f['element'],_0x2359e4['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x132ec3['config']['get']('presenceList.container')['appendChild'](_0x2359e4['element']),this['_overlayHost']=new _0x3a31c7(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0x2359e4;}_resolveOverlayTarget(){const _0x23c5c7=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0x23c5c7)return _0x23c5c7;const _0x46d90d=this['context']['config']['get']('presenceList.container');return _0x46d90d?_0x14ab56(_0x46d90d):null;}['_handleUserAdd'](_0x46a3ef){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x46a3ef['isMe'])return;const _0x49eb51=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x49eb51-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x210b82=_0x46a3ef['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x46a3ef,_0x210b82);}['_handleUserRemove'](_0x2709cd){this['usersCount']--;const {collapseAt:_0x34a079}=this['context']['config']['get']('presenceList'),_0x542546=this['usersCount']>=_0x34a079;if(this['currentDisplayedUsers']['get'](_0x2709cd['id']))this['currentDisplayedUsers']['remove'](_0x2709cd['id']);else{if(_0x542546&&this['currentDisplayedUsers']['length']+0x1===_0x34a079-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x542546?0x1:0x0)<this['usersCount']){for(const _0x42b5e2 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x42b5e2['id'])&&(this['currentDisplayedUsers']['add'](_0x42b5e2,Math['min'](this['currentDisplayedUsers']['length']-(_0x542546?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x542546?0x1:0x0)===_0x34a079-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x28a584=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0x28a584['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x289fff}=this['presenceDropdownView'];_0x289fff['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1a818a=>{if(!_0x28a584['displayMe']&&_0x1a818a['isMe'])return null;const _0x4d765f=new Tt(this['context']['locale'],_0x1a818a,!!_0x28a584['onClick']);return _0x28a584['onClick']&&this['listenTo'](_0x4d765f,'execute',()=>{_0x28a584['onClick'](_0x1a818a,_0x4d765f['element']);}),_0x4d765f;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x289fff['focus'](),_0x289fff['checkIfScrollable']();const _0x3c5037=(_0x365fe1,_0x33adf7)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x33adf7();};_0x289fff['keystrokes']['set']('Esc',_0x3c5037),_0x289fff['keystrokes']['set']('Shift+Tab',_0x3c5037),_0x289fff['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x289fff['focusTracker']['add'](this['view']['element']),_0x289fff['focusTracker']['on']('change:isFocused',(_0x299d5f,_0x35d7bc,_0x62bc40)=>{_0x62bc40||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(_0x648ba7){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x592931=>_0x155aa1(_0x592931,_0x648ba7))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x3d5c65{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};