@ckeditor/ckeditor5-real-time-collaboration 48.5.1 → 48.5.2-alpha.0

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 _0x5c518d,ContextPlugin as _0x1d7b68,PendingActions as _0x812481,Plugin as _0x141bb2}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x3f94b6,Collection as _0x5ee725,DomEmitterMixin as _0x4aa40b,KeystrokeHandler as _0x4b3894,global as _0x406852,uid as _0x331763,version as _0x1fa917}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x416845,BodyCollection as _0x18622a,LabelView as _0x7bf2a7,ListItemView as _0x494a95,ListView as _0x29ae41,Notification as _0x170bc1,View as _0x1242ab,clickOutsideHandler as _0x23500a}from'@ckeditor/ckeditor5-ui';import{History as _0x2c01e4,InsertOperation as _0x5de342,MarkerOperation as _0x5e9c27,ModelLiveRange as _0xd8180f,NoOperation as _0x5dc8c0,OperationFactory as _0x52750c,RootAttributeOperation as _0x1f81d5,transformOperationSets as _0x40586c}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x85f36a}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x7541ac,CommentsService as _0x225edb,EditorService as _0x3ae9fb,RevisionHistoryService as _0x1bf697,TrackChangesService as _0x258056,User as _0x44e3f4,WEB_SOCKET_GATEWAY_STATES as _0xaeb607,WebSocketGateway as _0x3ba5ab}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x268aa5,Users as _0x41a606}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x18258f}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x5e340b,TrackChangesEditing as _0x160671}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x518e44,CommentsEditing as _0x3f6980,CommentsRepository as _0x8a119d}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x186c36}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x3b247a}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x1d7b68{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
- ((()=>_0x3ba5ab)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x85f36a,_0x170bc1];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5b175d){super(_0x5b175d),this['set']('state',_0xaeb607['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x4aa40b())();}init(){const _0x420b16=this['context'],_0x2cf12e=_0x420b16['plugins']['get'](_0x85f36a),_0x56767c=_0x420b16['plugins']['get'](_0x170bc1);if(!_0x2cf12e['token'])throw new _0x3f94b6('websocketgateway-missing-token',this);if(!_0x2cf12e['webSocketUrl'])throw new _0x3f94b6('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'](_0x2cf12e['token'],_0x2cf12e['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0xaf22a5=>{if(this['connection']=_0xaf22a5,this['bind']('state')['to'](_0xaf22a5,'state',this,'_isBrowserOffline',(_0x40c28e,_0x44ec29)=>('connected'!==_0x40c28e&&(this['_shouldPluginsReconnect']=!0x0),_0x44ec29||_0x40c28e!==_0xaeb607['CONNECTED']?_0xaeb607['DISCONNECTED']:this['state']==_0xaeb607['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0xaeb607['CONNECTING']):_0xaeb607['CONNECTED'])),this['connection']['on']('error',(_0x14937c,_0x37e14f)=>{if('limitExceeded'!==_0x37e14f['code'])throw console['error'](_0x37e14f),new _0x3f94b6('cloudservices-init',null,{'originalError':_0x37e14f});_0x56767c['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'});}),!_0xaf22a5['me'])return new Promise(_0x126c4c=>_0xaf22a5['on']('change:me',_0x126c4c));})['catch'](_0x477d3f=>{throw console['error'](_0x477d3f),new _0x3f94b6('cloudservices-init',null,{'originalError':_0x477d3f});});}addToReconnectionStack(_0x2ad329){if('function'!=typeof _0x2ad329['reconnect'])throw new _0x3f94b6('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x2ad329))throw new _0x3f94b6('websocketgateway-plugin-already-registered',this,{'name':_0x2ad329['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x2ad329);}removeFromReconnectionStack(_0x3991db){this['_reconnectionStack']['delete'](_0x3991db);}isInReconnectionStack(_0x517bf6){return this['_reconnectionStack']['has'](_0x517bf6);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x3a099a=>_0x3a099a['reconnect']())))['then'](()=>this['state']=_0xaeb607['CONNECTED'])['catch'](_0x256c27=>{throw console['error'](_0x256c27),new _0x3f94b6('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0xaeb607['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x1d7b68{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[z,_0x41a606];}constructor(_0x2b1527){super(_0x2b1527),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x5ee725(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x41a606);}init(){const _0x1646b3=this['context']['plugins']['get'](z);this['listenTo'](_0x1646b3,'change:state',(_0x538112,_0xd8cd11,_0x3e3ba0)=>{if('connected'!==_0x3e3ba0)this['channelSessions']['forEach'](_0x581b81=>_0x581b81['clear']()),this['channelConnectedUsers']['forEach'](_0x380176=>_0x380176['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x4d5aa5,_0x46ad79]of this['_registeredSessions'])for(const _0x1c3e43 of _0x46ad79)this['_handleSessionAdd'](_0x4d5aa5,_0x1c3e43);}}),this['_createUser'](_0x1646b3['connection']['me'],!0x0);}register(_0x411858,_0x1a1cc2){if(this['_registeredSessions']['has'](_0x411858))throw new _0x3f94b6('sessions-register-already-registered',null,{'channelId':_0x411858});this['_registeredSessions']['set'](_0x411858,_0x1a1cc2),this['channelSessions']['set'](_0x411858,new _0x5ee725()),this['channelConnectedUsers']['set'](_0x411858,new _0x5ee725()),this['listenTo'](_0x1a1cc2,'add',(_0x471e4c,_0x2b6e1a)=>this['_handleSessionAdd'](_0x411858,_0x2b6e1a)),this['listenTo'](_0x1a1cc2,'remove',(_0x546825,_0x5a282c)=>this['_handleSessionRemove'](_0x411858,_0x5a282c));for(const _0xe820d8 of _0x1a1cc2)this['_handleSessionAdd'](_0x411858,_0xe820d8);}unregister(_0x817f00){if(!this['_registeredSessions']['has'](_0x817f00))throw new _0x3f94b6('sessions-unregister-not-exist',null,{'channelId':_0x817f00});const _0x2bc27a=this['_registeredSessions']['get'](_0x817f00);this['stopListening'](_0x2bc27a);for(const _0x30c20b of _0x2bc27a)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x817f00,_0x30c20b);this['_registeredSessions']['delete'](_0x817f00),this['channelSessions']['delete'](_0x817f00),this['channelConnectedUsers']['delete'](_0x817f00);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x29e7f7){for(const _0x36b08c of this['channelSessions']['values']())for(const _0x496fd4 of _0x36b08c)if(_0x496fd4['id']===_0x29e7f7)return _0x496fd4['user'];}getUserSessions(_0x480b98,_0x3b8811){const _0x209215=_0x3b8811?[this['channelSessions']['get'](_0x3b8811)]:this['channelSessions']['values'](),_0x30ebd9=new Set();for(const _0x5bfc72 of _0x209215)for(const _0x19f60b of _0x5bfc72)_0x19f60b['user']['id']===_0x480b98['id']&&_0x30ebd9['add'](_0x19f60b['id']);return _0x30ebd9;}getUserRole(_0x2b63d0){for(const _0x449480 of this['channelSessions']['values']())for(const _0x22ee9a of _0x449480)if(_0x22ee9a['user']===_0x2b63d0)return _0x22ee9a['role'];}['_handleSessionAdd'](_0x3468d0,_0x43a549){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0xdae64a=_0x43a549['user'],_0x2129a5=this['_users']['getUser'](_0xdae64a['id'])||this['_createUser'](_0xdae64a),_0x29ded2=Object['assign']({},_0x43a549,{'user':_0x2129a5});if(this['channelSessions']['get'](_0x3468d0)['add'](_0x29ded2),!_0xdae64a['hiddenInPresenceList']){const _0x9afb51=this['channelConnectedUsers']['get'](_0x3468d0);_0x9afb51['has'](_0x2129a5['id'])||_0x9afb51['add'](_0x2129a5),this['allConnectedUsers']['has'](_0x2129a5['id'])||_0xdae64a['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x2129a5,_0x2129a5['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x3468d0,{'channelId':_0x3468d0,'session':_0x29ded2});}['_handleSessionRemove'](_0x193e68,_0x38724b){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x1b7ab5=this['channelConnectedUsers']['get'](_0x193e68),_0x2d2efc=_0x38724b['user'];_0x2d2efc['id']&&(this['channelSessions']['get'](_0x193e68)['remove'](_0x38724b['id']),_0x1b7ab5['has'](_0x2d2efc['id'])&&!this['getUserSessions'](_0x2d2efc,_0x193e68)['size']&&_0x1b7ab5['remove'](_0x2d2efc['id']),this['allConnectedUsers']['get'](_0x2d2efc['id'])&&!this['getUserSessions'](_0x2d2efc)['size']&&this['allConnectedUsers']['remove'](_0x2d2efc['id']));}_createUser(_0x442de8,_0x11ab30){const _0x2ac101=this['_users']['addUser'](_0x442de8);return _0x11ab30&&this['_users']['defineMe'](_0x442de8['id']),_0x2ac101['orderNumber']=this['_uniqueUsersCount']++,_0x2ac101;}},K=class extends _0x141bb2{_domEmitter=new(_0x4aa40b())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x5b31cb=this['editor'],_0x5d1323=_0x5b31cb['plugins']['get'](Y);_0x5b31cb['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x4c72ba,{writer:_0x433d9c})=>function(_0x24ce36,_0x1d49b6,_0x50984b,_0x7fe360){const _0x1fcd3a=_0x24ce36['markerName']['split'](':')[0x2],_0x59ef0f=_0x50984b['getUserBySessionId'](_0x1fcd3a);if(!_0x59ef0f||_0x1fcd3a===_0x50984b['mySessionId'])return;if(!_0x7fe360['model']['schema']['checkChild'](_0x24ce36['markerRange']['start'],'$text'))return;const _0x14d48d={'class':'ck-user__marker\x20'+_0x59ef0f['color']['getMarkerClass'](),'style':Q(_0x59ef0f),'data-name':_0x59ef0f['name'],'data-session-id':_0x1fcd3a},_0x2444ce=_0x7fe360['model']['markers']['get'](_0x24ce36['markerName'])['getStart'](),_0x1e6df8=_0x2444ce['nodeAfter'],_0x12358a=_0x7fe360['model']['schema'];if(_0x1e6df8&&_0x12358a['isObject'](_0x1e6df8)&&_0x12358a['isInline'](_0x1e6df8)&&!_0x7fe360['model']['markers']['get']('user:range:'+_0x1fcd3a)['getRange']()['isCollapsed'])return;const _0x597b69=_0x2444ce['parent'];return _0x7fe360['model']['schema']['isLimit'](_0x597b69)&&!_0x7fe360['model']['hasContent'](_0x597b69)&&(_0x14d48d['contenteditable']=!0x1),function(_0x579cc0,_0x39ad04,_0x2143bb){const _0x129a88=_0x579cc0['createUIElement']('span',_0x39ad04);return _0x579cc0['setCustomProperty']('userPositionMarker',!0x0,_0x129a88),_0x129a88['render']=function(_0x46a67d){const _0xa8ae10=this['toDomElement'](_0x46a67d),_0x466a32=document['createElement']('span');return _0x466a32['classList']['add']('ck-user__marker-tooltip'),_0x466a32['setAttribute']('contenteditable','false'),_0x466a32['setAttribute']('spellcheck','false'),_0x466a32['textContent']=_0x2143bb['name'],_0xa8ae10['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x466a32['outerHTML']+'⁠',_0xa8ae10['addEventListener']('mouseenter',()=>{_0xa8ae10['classList']['add']('ck-user__marker_hovered');}),_0xa8ae10['addEventListener']('mouseleave',()=>{_0xa8ae10['classList']['remove']('ck-user__marker_hovered');}),_0xa8ae10;},_0x129a88['isSimilar']=function(_0x2ed2b3){return!(!this['getCustomProperty']('userPositionMarker')||!_0x2ed2b3['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x2ed2b3['getAttribute']('data-session-id'));},_0x129a88;}(_0x1d49b6,_0x14d48d,_0x59ef0f);}(_0x4c72ba,_0x433d9c,_0x5d1323,_0x5b31cb)}),_0x5b31cb['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4bdab8=>function(_0x4c66f0,_0x58ba03){const _0x3a01c6=_0x4c66f0['markerName']['split'](':')[0x2];if(_0x3a01c6===_0x58ba03['mySessionId'])return null;const _0x1d5489=_0x58ba03['getUserBySessionId'](_0x3a01c6);return _0x1d5489?{'id':_0x3a01c6,'classes':['ck-user__selection',_0x1d5489['color']['getSelectionClass']()],'attributes':{'style':Q(_0x1d5489),'data-session-id':_0x3a01c6},'priority':0x7d0+_0x1d5489['orderNumber']}:{'id':_0x3a01c6,'classes':[]};}(_0x4bdab8,_0x5d1323)}),function(_0x126719){const _0x38f79c=_0x126719['model'],_0x570b12=new Map(),_0x14bfc8=_0x126719['plugins']['get'](Y);_0x38f79c['markers']['on']('update:user:range',(_0x3799d2,_0x59698b,_0x567daf,_0x137d01)=>{if(!_0x137d01&&_0x570b12['get'](_0x59698b['name']))return _0x570b12['get'](_0x59698b['name'])['detach'](),void _0x570b12['delete'](_0x59698b['name']);const _0x350f45=_0x59698b['name']['split'](':')[0x2];if(_0x350f45===_0x14bfc8['mySessionId'])return;const _0x3bf073='user:position:'+_0x350f45;_0x38f79c['markers']['has'](_0x3bf073)&&_0x126719['editing']['reconvertMarker'](_0x3bf073),_0x59698b['on']('change:range',(_0x1e46f4,_0x2cde4c,_0x3aa97d)=>{if('$graveyard'!=_0x2cde4c['root']['rootName']&&'$graveyard'==_0x59698b['getRange']()['root']['rootName']&&!_0x570b12['has'](_0x59698b['name'])){const _0x42e55f=_0x38f79c['schema']['getNearestSelectionRange'](_0x3aa97d['deletionPosition']);if(_0x42e55f){const _0x58dc42=_0xd8180f['fromRange'](_0x42e55f);_0x570b12['set'](_0x59698b['name'],_0x58dc42),_0x58dc42['on']('change:range',(_0x2b4dba,_0x31798c,_0x2d319c)=>{if('$graveyard'==_0x58dc42['root']['rootName']){const _0x4acc1c=_0x38f79c['schema']['getNearestSelectionRange'](_0x2d319c['deletionPosition']);_0x4acc1c?(_0x58dc42['start']=_0x4acc1c['start'],_0x58dc42['end']=_0x4acc1c['end']):(_0x570b12['delete'](_0x59698b['name']),_0x58dc42['detach']());}});}}});}),_0x38f79c['document']['on']('change',()=>{_0x570b12['size']>0x0&&_0x38f79c['enqueueChange']({'isUndoable':!0x1},_0x42548c=>{for(const [_0x169c44,_0x1d72eb]of _0x570b12)'$graveyard'==_0x38f79c['markers']['get'](_0x169c44)['getRange']()['root']['rootName']&&(J(_0x169c44['split'](':')[0x2],_0x1d72eb['toRange'](),_0x38f79c,_0x42548c),_0x1d72eb['detach']());_0x570b12['clear']();});});}(_0x5b31cb),this['_domEmitter']['listenTo'](_0x406852['document'],'keydown',(_0x111877,{key:_0x4f8445})=>{'Escape'===_0x4f8445&&function(_0x154c6c){_0x154c6c['editing']['view']['change'](_0x1e1f4e=>{for(const _0x1233a3 of _0x154c6c['model']['markers']){if(!_0x1233a3['name']['startsWith']('user:position'))continue;const _0x558cb6=_0x154c6c['editing']['mapper']['markerNameToElements'](_0x1233a3['name']);if(_0x558cb6){for(const _0x2caf71 of _0x558cb6)_0x1e1f4e['removeClass']('ck-user__marker_hovered',_0x2caf71);}}});}(_0x5b31cb);},{'useCapture':!0x0});}afterInit(){const _0x4cc28d=this['editor'],_0x260377=_0x4cc28d['commands']['get']('undo');_0x260377&&_0x4cc28d['model']['on']('applyOperation',(_0x5112f9,_0x3d9330)=>{const _0x22d4b4=_0x3d9330[0x0];if(!_0x22d4b4['isDocumentOperation'])return;if('marker'!=_0x22d4b4['type']||!_0x22d4b4['name']['startsWith']('user:'))return;const _0x3f64fe=_0x22d4b4['batch'];_0x260377['_createdBatches']['has'](_0x3f64fe)&&(_0x22d4b4['newRange']=_0x22d4b4['oldRange']?_0x4cc28d['model']['createRange'](_0x22d4b4['oldRange']['start'],_0x22d4b4['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x1a0288=this['editor'],_0x23ac39=_0x1a0288['model']['document'],_0x3d8c2f=_0x1a0288['plugins']['get'](Y);_0x1a0288['model']['enqueueChange']({'isUndoable':!0x1},_0xc60576=>{const _0xc4c4a='user:range:'+_0x3d8c2f['mySessionId'],_0x1ea1b2='user:position:'+_0x3d8c2f['mySessionId'],_0x14de7e=_0x1a0288['model']['markers']['has'](_0xc4c4a);_0x1a0288['editing']['view']['hasDomSelection']?J(_0x3d8c2f['mySessionId'],_0x23ac39['selection']['getFirstRange'](),_0x1a0288['model'],_0xc60576):_0x14de7e&&(_0xc60576['removeMarker'](_0xc4c4a),_0xc60576['removeMarker'](_0x1ea1b2));});}};function J(_0x14a499,_0x3c0b85,_0x4304f3,_0x5cf20d){const _0x10da26='user:range:'+_0x14a499,_0x1a9f59='user:position:'+_0x14a499,_0x1aacdb=_0x3c0b85['getContainedElement']();let _0x5baaa0=_0x3c0b85['start'];if(_0x1aacdb&&_0x1aacdb['is']('element','tableCell')){const _0x453fec=function(_0x18e27b,_0x4dc674){for(const _0x4af6d5 of _0x18e27b['getPositions']())if(_0x4dc674['schema']['checkChild'](_0x4af6d5,'$text'))return _0x4af6d5;}(_0x3c0b85,_0x4304f3);_0x453fec&&(_0x5baaa0=_0x453fec,_0x3c0b85=_0x5cf20d['createRange'](_0x5baaa0));}const _0x1143f9=_0x5cf20d['createRange'](_0x5baaa0);_0x4304f3['markers']['has'](_0x10da26)?(_0x5cf20d['updateMarker'](_0x10da26,{'range':_0x3c0b85}),_0x5cf20d['updateMarker'](_0x1a9f59,{'range':_0x1143f9})):(_0x5cf20d['addMarker'](_0x10da26,{'range':_0x3c0b85,'usingOperation':!0x0}),_0x5cf20d['addMarker'](_0x1a9f59,{'range':_0x1143f9,'usingOperation':!0x0}));}function Q(_0x3aa903){return'--ck-user-color:'+_0x3aa903['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x3aa903['color']['getColorAlphaVariable']()+';';}function X(_0x19cb86,_0x501edf,_0x9679c9){const _0x1168f2=_0x19cb86['t'],t=_0x19cb86['t'];switch(_0x501edf){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 _0x1168f2({'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'},_0x9679c9);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x141bb2{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
- ((()=>_0x7541ac)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x812481,_0x41a606,_0x170bc1];}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 _0x2bbf03=this['serverHistory']['getOperations']();for(let _0x495aa4=_0x2bbf03['length']-0x1;_0x495aa4>=0x0;_0x495aa4--){const _0x37a458=_0x2bbf03[_0x495aa4];if(!this['_disconnectionOperations']['has'](_0x37a458))return _0x37a458['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x10e217){if(super(_0x10e217),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x2c01e4(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x3f94b6('collaboration-missing-channelid',this);const _0x3c556f=_0x10e217['config']['get']('cloudServices.bundleVersion')||_0x1fa917;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x3c556f,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x18258f(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new it(this['_disconnectionOperations']);}init(){const _0x444038=this['editor'],_0x5e8678=_0x444038['plugins']['get'](_0x41a606),_0x64a756=_0x444038['plugins']['get'](z);this['listenTo'](_0x5e8678,'getOperationAuthor',(_0x34f8ea,_0x2199ce)=>{const _0xe155fb=_0x2199ce[0x0];_0xe155fb['_authorId']&&(_0x34f8ea['return']=_0x5e8678['getUser'](_0xe155fb['_authorId']),_0x34f8ea['stop']()),null===_0xe155fb['_authorId']&&(_0x34f8ea['return']=null,_0x34f8ea['stop']());},{'priority':'high'}),this['listenTo'](_0x444038['model']['document']['selection'],'change:range',(_0x2fb9bb,_0x1ab3b7)=>{_0x1ab3b7['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x444038['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x444038['model']['on']('applyOperation',(_0x57fad3,_0x386144)=>{const _0x2f78a5=_0x386144[0x0];_0x2f78a5['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x2f78a5),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x64a756,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x3bbc64,_0x4822ac,_0x28f4c7)=>'connected'===_0x3bbc64&&!_0x4822ac&&!_0x28f4c7),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x444038['disableReadOnlyMode']('rtc-offline'):_0x444038['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x444038['disableReadOnlyMode']('rtc-offline'):_0x444038['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x1c276d=this['editor']['plugins']['get'](Y),_0x45ce19=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x1c276d['unregister'](this['_channelId']);const _0xf11c93=await this['_service']['reconnect'](_0x45ce19['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0xf11c93)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x43aea8=await this['_service']['getConnectedSessions']();_0x1c276d['register'](this['_channelId'],_0x43aea8),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x351769){if(function(_0x45e654){return'404'===_0x45e654['code'];}(_0x351769)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x5f1270){return'409'===_0x5f1270['code'];}(_0x351769)){const _0x4f2485=X(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x4f2485);}else{if(!(_0x351769 instanceof et))throw _0x351769;this['_handleReconnectionError']();}}}}destroy(){const _0x439b5a=this['editor']['plugins']['get'](z),_0xafa313=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0xafa313['channelSessions']['has'](this['_channelId'])&&_0xafa313['unregister'](this['_channelId']),_0x439b5a['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0xb971e0){if(this['sessionId']!==_0xb971e0['sessionId']&&this['_lastSyncedOperationId']!==_0xb971e0['lastOperationId'])throw new et();return this['sessionId']=_0xb971e0['sessionId'],this['_handleServerResponse']([],{..._0xb971e0,'wereChangesApplied':!0x1,'data':_0xb971e0['data']},'reconnect');}async _connectService(_0x1a747e,_0x4f4099=!0x1){const {connection:_0x47cab1}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x47cab1,this['_channelId'])['then'](_0x5c5dfe=>this['_initSessionsHandling'](_0x5c5dfe))['catch'](_0x2a26a1=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x2a26a1);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x1b7c6d,_0x50caa9)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x50caa9);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x58d864=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1a747e);this['_isPendingUpdate']=!0x0;const _0xb72c57=await this['_service']['connect'](_0x47cab1,this['_compressOperations'](_0x1a747e),_0x58d864);if(this['sessionId']=_0xb72c57['sessionId'],_0x4f4099){if(!_0xb72c57['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0xb72c57['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x1a747e,_0xb72c57,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0xb72c57,_0x1a747e);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x708672=this['editor']['plugins']['get'](Y),_0x766897=this['editor']['plugins']['get'](K),_0x22955e=_0x708672['channelSessions']['get'](this['_channelId']);_0x22955e&&_0x22955e['length']>0x1?_0x766897['createUserMarkerOperations']():this['listenTo'](_0x708672,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x708672['channelSessions']['get'](this['_channelId'])['length']&&_0x766897['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x47759f,_0x396614,_0x4e8a33,_0xf38bcc){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x396614){const _0x4cfde0=this['_decompressOperations'](_0x4e8a33,_0xf38bcc);await this['_fetchMissingUsers'](_0x4cfde0),this['_handleExternalOperations'](_0x4cfde0,_0x396614,_0x4e8a33['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0xe25ac9}=this['editor'];let _0x16eaf2;try{_0x16eaf2=await this['_service']['getDocumentDetails']();}catch{const _0x529256=X(_0xe25ac9,'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'](_0x529256);}const _0x5366f6=_0x16eaf2['currentDocumentSession']||_0x16eaf2['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x5366f6['lastOperationId']){const _0x1cb7b5=X(_0xe25ac9,'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'](_0x1cb7b5);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x4d67c8=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x4d67c8['connection']||'connected'!==_0x4d67c8['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0xe8f940=this['editor']['plugins']['get'](Y);_0xe8f940['channelSessions']['has'](this['_channelId'])&&_0xe8f940['unregister'](this['_channelId']),_0x4d67c8['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x5b9b4f){const _0x3b5476=this['editor']['plugins']['get'](Y);this['listenTo'](_0x3b5476,'sessionAdd:'+this['_channelId'],(_0x1f7f26,{session:_0xfaf4c6})=>{if(_0xfaf4c6['id']===_0x3b5476['mySessionId']){_0x1f7f26['off']();const _0x211ba6=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x3e9845=_0xfaf4c6['permissions'];_0x211ba6&&_0x211ba6['isEnabled']&&(_0x3e9845=_0x3e9845['filter'](_0x4a9216=>'document:write'!==_0x4a9216)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x3e9845,this['_channelId']);}}),_0x3b5476['register'](this['_channelId'],_0x5b9b4f);}_initThrowingOnDataSet(){const _0x55c824=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x5aef98)=>{if(!_0x5aef98[_0x5aef98['length']-0x1]['suppressErrorInCollaboration'])throw new _0x3f94b6('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x55c824['apply'](this['editor']['data'],_0x5aef98);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x235e56,[_0x1365f5])=>{if(this['_document']['version'])throw new _0x3f94b6('realtimecollaborationclient-init-document-already-initialized',this);_0x235e56['stop'](),this['_setPendingAction']();const _0x41a72b=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x4f84a9])=>!_0x4f84a9['lazyLoad'])['map'](([_0x4f33a6,_0x37b536])=>[_0x4f33a6,_0x37b536['modelAttributes']||{}])),_0x3f8a34=this['_getOperationsFromInitData'](_0x1365f5,_0x41a72b);0x0==_0x3f8a34['length']&&_0x3f8a34['push'](new _0x5dc8c0(0x0)),_0x235e56['return']=this['_connectService'](_0x3f8a34)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x52b1ef=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x52b1ef))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x4b4453,[_0x543337,_0x404abf])=>{_0x4b4453['stop']();const _0x17685f=this['editor']['model']['document']['getRoot'](_0x543337);if(!this['_knownRootNames']['has'](_0x543337)){const _0x44b551=_0x404abf&&_0x404abf['data']?_0x404abf['data']:'',_0x4a9878=_0x404abf&&_0x404abf['attributes']?_0x404abf['attributes']:{};await this['_loadRoot'](_0x543337,_0x44b551,_0x4a9878);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x17685f['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x17685f);});},{'priority':'high'});}async _fetchMissingUsers(_0x2e0f48){const _0xe2cb26=this['editor']['plugins']['get'](_0x41a606),{connection:_0x13fe5d}=this['editor']['plugins']['get'](z),_0x24601b=new Set();for(const _0x25060f of _0x2e0f48){const _0x46057d=_0x25060f['_authorId'];_0x46057d&&!_0xe2cb26['getUser'](_0x46057d)&&_0x24601b['add'](_0x46057d);}if(0x0===_0x24601b['size'])return;const _0x5d2632=await _0x44e3f4['getMany'](_0x13fe5d,Array['from'](_0x24601b));for(const _0x4a3d0d of _0x5d2632)_0xe2cb26['getUser'](_0x4a3d0d['id'])||_0xe2cb26['addUser'](_0x4a3d0d);}_getOperationsFromInitData(_0x4596d6,_0x455462={}){const _0x3e0c2f=this['editor']['model'],_0x596473=[];let _0x118af2=0x0;const _0x6e962='string'==typeof _0x4596d6?{'main':_0x4596d6}:_0x4596d6;for(const _0x4800c4 of Object['keys'](_0x6e962)){if(!this['_document']['roots']['has'](_0x4800c4))throw new _0x3f94b6('realtimecollaborationclient-init-non-existent-root',this);const _0x57a8df=this['_document']['getRoot'](_0x4800c4),_0xeee8b6=this['editor']['data']['parse'](_0x6e962[_0x4800c4],_0x57a8df),_0x174e6a=new _0x5de342(_0x3e0c2f['createPositionAt'](_0x57a8df,0x0),_0xeee8b6,_0x118af2++);_0x596473['push'](_0x174e6a);for(const [_0x4871f3,_0x3af02a]of _0xeee8b6['markers']){const _0x1ef130=_0x3e0c2f['createRange'](_0x3e0c2f['createPositionFromPath'](_0x57a8df,_0x3af02a['start']['path']['slice']()),_0x3e0c2f['createPositionFromPath'](_0x57a8df,_0x3af02a['end']['path']['slice']())),_0x5a4b3b=new _0x5e9c27(_0x4871f3,null,_0x1ef130,_0x3e0c2f['markers'],!0x0,_0x118af2++);_0x596473['push'](_0x5a4b3b);}}if(_0x455462)for(const [_0x480572,_0xde1e53]of Object['entries'](_0x455462)){const _0x1a84c5=_0x3e0c2f['document']['getRoot'](_0x480572);if(!_0x1a84c5)throw new _0x3f94b6('multi-root-editor-root-attributes-no-root',null);for(const [_0x3e6ecf,_0x2ba38f]of Object['entries'](_0xde1e53))if(null!==_0x2ba38f){const _0x4484c0=new _0x1f81d5(_0x1a84c5,_0x3e6ecf,null,_0x2ba38f,_0x118af2++);_0x596473['push'](_0x4484c0);}}return _0x596473;}async _loadRoot(_0x57bbb0,_0x5dcee8,_0x5c5157){this['_getOperationsFromInitData']({[_0x57bbb0]:_0x5dcee8},{[_0x57bbb0]:_0x5c5157})['forEach']((_0x2d3e80,_0x1f629e)=>{_0x2d3e80['baseVersion']=this['_document']['version']+_0x1f629e,_0x2d3e80['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x2d3e80);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x3a3326,_0x53fd1e){let _0x5394c6;this['_offset']=_0x3a3326['offset'];const _0x2cc68b=_0x3a3326['wereChangesApplied']&&!_0x3a3326['initData'],_0x4a5839=_0x2cc68b?0x0:_0x3a3326['data']['baseVersion'];if(_0x53fd1e['forEach'](_0x54ac04=>{_0x54ac04['_isInit']=!0x0,_0x54ac04['createdAt']=_0x3a3326['sessionCreatedAt'],_0x54ac04['_authorId']=null;}),_0x2cc68b)_0x5394c6=_0x53fd1e,this['_applyOperationsSet'](_0x5394c6,_0x2cc68b);else{if(_0x3a3326['initData']){const _0x5d49e3=this['_getOperationsFromInitData'](_0x3a3326['initData']);this['_document']['history']['version']=-_0x5d49e3['length'],_0x5d49e3['forEach'](_0x5edac3=>{_0x5edac3['baseVersion']-=_0x5d49e3['length'],_0x5edac3['createdAt']=_0x3a3326['sessionCreatedAt'],_0x5edac3['_isInit']=!0x0,_0x5edac3['_authorId']=null;}),this['_applyOperationsSet'](_0x5d49e3,!0x0),this['serverHistory']['version']=-_0x5d49e3['length']+this['_offset'],this['_updateServerHistory'](_0x5d49e3);}this['_document']['history']['version']=_0x4a5839,_0x5394c6=this['_decompressOperations'](_0x3a3326['data'],_0x3a3326['metadata']),await this['_fetchMissingUsers'](_0x5394c6),this['_applyOperationsSet'](_0x5394c6,_0x2cc68b);}_0x3a3326['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5394c6,_0x3a3326['lastOperationId']),this['_lastSyncedOperationId']=_0x3a3326['lastOperationId']),this['serverHistory']['version']=_0x4a5839+this['_offset'],this['_updateServerHistory'](_0x5394c6),_0x53fd1e['filter'](_0x442fd8=>{const _0x1cbbd7=this['_getAffectedRoot'](_0x442fd8);return _0x1cbbd7&&!this['_knownRootNames']['has'](_0x1cbbd7);})['forEach']((_0x4d81a0,_0x470d24)=>{_0x4d81a0['baseVersion']=this['_document']['version']+_0x470d24,this['_saveOperationInBuffer'](_0x4d81a0);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x4eb41a,_0x404c3e){const _0x5a6069=_0x404c3e&&_0x404c3e['message'];if(_0x5a6069&&_0x5a6069['startsWith']('realtimecollaborationclient'))throw _0x404c3e;const _0x19a972=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x19a972['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x3f94b6(_0x4eb41a,this['editor'],_0x5a6069?{'originalError':_0x5a6069}:void 0x0);}_saveOperationInBuffer(_0x31c740){this['_knownOperations']['has'](_0x31c740)||(this['_knownOperations']['add'](_0x31c740),this['_bufferedOperations']['push'](_0x31c740),this['_pendingAction']||'marker'==_0x31c740['type']&&!_0x31c740['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x51d574=!0x1){!_0x51d574&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x1e24e7=>{_0x1e24e7&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x150dc4=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x4feb07){return _0x4feb07['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4feb07['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x4feb07['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x150dc4)||this['_crash'](_0x150dc4['message'],_0x150dc4);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x1dc321=>{this['on']('change:_isPendingUpdate',()=>{_0x1dc321();});});}async _sendBufferedOperations(){const _0x346290=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x346290['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x4459ab=[...this['_bufferedOperations']];for(const _0x2b6673 of _0x4459ab)_0x2b6673['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x2b6673);const _0x43e461=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x4459ab),_0x4520b7=Z++,_0x3cfb1f=this['_compressOperations'](_0x4459ab),_0x1f8a12=await this['_service']['sendOperations'](_0x3cfb1f,_0x3cfb1f['baseVersion'],_0x43e461);try{return await this['_handleServerResponse'](_0x4459ab,_0x1f8a12,_0x4520b7);}catch(_0xf813b2){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0xf813b2);}}async['_handleServerResponse'](_0x39a31b,_0x574dd1,_0x2db6de){if('error'in _0x574dd1)throw _0x574dd1['error'];let _0x4af9c4;if(_0x574dd1['wereChangesApplied']){_0x574dd1['lastOperationId']&&(this['_lastSyncedOperationId']=_0x574dd1['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x45f0a6=>!_0x39a31b['includes'](_0x45f0a6));for(const _0x4a4fe4 of _0x39a31b)_0x4a4fe4['createdAt']='lastOperationAcceptedAt'in _0x574dd1&&_0x574dd1['lastOperationAcceptedAt']||void 0x0;st(_0x39a31b,_0x574dd1['version']-_0x39a31b['length']),this['_updateServerHistory'](_0x39a31b);const _0x2cbc23=_0x39a31b['filter'](_0x20a19b=>{if(!_0x20a19b['_isInit'])return!0x1;const _0x550010=this['_getAffectedRoot'](_0x20a19b);return _0x550010&&!this['_knownRootNames']['has'](_0x550010);});st(_0x2cbc23,this['_document']['version']),this['_applyOperationsSet'](_0x2cbc23),_0x4af9c4=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x2fbe29=this['_decompressOperations'](_0x574dd1['data'],_0x574dd1['metadata'])['filter'](_0xeb2ada=>_0xeb2ada['baseVersion']>=this['_lastServerVersion']);_0x2fbe29['forEach'](_0x30f20d=>this['_addKnownRoot'](_0x30f20d)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x33d86e=>!_0x33d86e['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x33d86e))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x2fbe29),_0x4af9c4=this['_handleExternalOperations'](_0x2fbe29,_0x574dd1['version'],_0x574dd1['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x4af9c4?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0xa76d50,_0x17ff71,_0x1aae9d){try{const _0x168e0a={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x36e92b,operationsB:_0x58eb07,originalOperations:_0x534e14}=_0x40586c(_0xa76d50,this['_bufferedOperations'],_0x168e0a);st(_0x36e92b,this['_document']['version']),st(_0x58eb07,_0x17ff71);for(const _0x2d9307 of _0x36e92b){const _0x395ea5=_0x534e14['get'](_0x2d9307);_0x395ea5?(_0x2d9307['_authorId']=_0x395ea5['_authorId'],'noop'!==_0x2d9307['type']&&(_0x2d9307['_aiSource']=_0x395ea5['_aiSource'])):_0x2d9307['_authorId']=null;}for(const _0x2ad0e5 of _0x58eb07)'noop'!==_0x2ad0e5['type']&&(_0x2ad0e5['_aiSource']=_0x534e14['get'](_0x2ad0e5)?.['_aiSource']);_0x1aae9d&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xa76d50,_0x1aae9d),this['_lastSyncedOperationId']=_0x1aae9d),this['_bufferedOperations']=[..._0x58eb07],this['_applyOperationsSet'](_0x36e92b),this['_updateServerHistory'](_0xa76d50);}catch(_0x432470){return console['error'](_0x432470),!0x1;}return!0x0;}_applyOperationsSet(_0x2dbdfc,_0x33c6c9=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x17240d=>{for(const _0x388eb9 of _0x2dbdfc)this['_knownOperations']['add'](_0x388eb9),this['_addKnownRoot'](_0x388eb9),_0x17240d['batch']['addOperation'](_0x388eb9),this['editor']['model']['applyOperation'](_0x388eb9);});}_addKnownRoot(_0x36c92a){const _0x45d36d=this['_getAffectedRoot'](_0x36c92a);_0x45d36d&&this['_knownRootNames']['add'](_0x45d36d);}_getAffectedRoot(_0x1eaf74){let _0xbfb7ff,_0x6081f6;switch(_0x1eaf74['type']){case'insert':_0xbfb7ff=_0x1eaf74['position']['root'];break;case'marker':if(_0x6081f6=_0x1eaf74['newRange'],!_0x6081f6)return null;_0xbfb7ff=_0x6081f6['root'];break;case'addRootAttribute':_0xbfb7ff=_0x1eaf74['root'];break;case'addRoot':_0xbfb7ff=_0x1eaf74['affectedSelectable'];break;case'move':_0xbfb7ff=_0x1eaf74['targetPosition']['root'];break;default:return null;}return _0xbfb7ff['rootName'];}_updateServerHistory(_0x5d27b9){_0x5d27b9['forEach'](_0x4ed876=>{const _0x5aa8e8=_0x4ed876['clone']();_0x5aa8e8['_authorId']=_0x4ed876['_authorId'],_0x5aa8e8['_isInit']=!!_0x4ed876['_isInit'],_0x5aa8e8['_aiSource']=_0x4ed876['_aiSource'],_0x5aa8e8['createdAt']=_0x4ed876['createdAt'],_0x5aa8e8['baseVersion']+=this['_offset'],_0x4ed876['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x5aa8e8),this['serverHistory']['addOperation'](_0x5aa8e8);});}_handleReconnectionError(_0x8c1453){const _0x586b97=this['editor']['plugins']['get']('Notification'),_0x11608d=this['editor']['locale'];_0x8c1453||(_0x8c1453=X(_0x11608d,'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.')),_0x586b97['showWarning'](_0x8c1453,{'title':X(_0x11608d,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x812481)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x812481)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x295e94){const _0x2a6ef7=_0x295e94['map'](_0x260691=>_0x260691['toJSON']());return this['_compressor']['compress'](_0x2a6ef7);}_decompressOperations(_0x217c4e,_0x4b93e0){return this['_compressor']['decompress'](_0x217c4e)['map']((_0x15eba9,_0x4a07d2)=>{const _0x498739='init'==_0x4b93e0[_0x4a07d2]['type'];if('InsertOperation'==_0x15eba9['__className']){const _0x432704=_0x15eba9['position']['root'];!this['_document']['getRoot'](_0x432704)&&(this['_document']['createRoot']('$unknown',_0x432704)['_isAttached']=!0x1);}else{if('RootOperation'==_0x15eba9['__className']){const _0x4ac4c3=this['_document']['getRoot'](_0x15eba9['rootName']);_0x4ac4c3&&'$unknown'==_0x4ac4c3['name']&&_0x15eba9['elementName']!=_0x4ac4c3['name']&&(_0x4ac4c3['name']=_0x15eba9['elementName']);}}const _0x59befd=_0x52750c['fromJSON'](_0x15eba9,this['_document']);return _0x59befd['wasUndone']=_0x15eba9['wasUndone'],_0x59befd['_isInit']=_0x498739,_0x59befd['_authorId']=_0x498739?null:_0x4b93e0[_0x4a07d2]['userId'],_0x59befd['_isDisconnection']='cs:removeUser'===_0x4b93e0[_0x4a07d2]['type'],_0x59befd['_aiSource']=_0x15eba9['_aiSource']||void 0x0,_0x59befd['createdAt']=_0x4b93e0[_0x4a07d2]['createdAt'],_0x59befd;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x3f3b51=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x3f3b51&&_0x3f3b51['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x542b79,_0x209ab4){for(const _0x42a463 of _0x542b79)_0x42a463['baseVersion']=_0x209ab4++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x166250){this['_ignoredOperations']=_0x166250,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x324958){let _0xb3f0e=_0x324958['length'];for(;_0xb3f0e--;){const _0x19b578=_0x324958[_0xb3f0e];if(!this['_ignoredOperations']['has'](_0x19b578)){if(!this['_operationToId']['has'](_0x19b578)){const _0x1e9615=_0x331763()['slice'](0x1,0x12);this['_operationToId']['set'](_0x19b578,_0x1e9615);}return this['_operationToId']['get'](_0x19b578);}}}setIdForTheLastOperation(_0x277630,_0x2a805d){if(!_0x2a805d)return;let _0x4f3a0c=_0x277630['length'];for(;_0x4f3a0c--;){const _0x3d7be4=_0x277630[_0x4f3a0c];this['_ignoredOperations']['has'](_0x3d7be4)||this['_operationToId']['set'](_0x3d7be4,_0x2a805d);}}},nt=class extends _0x141bb2{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x1d7b68{static CommentsService=/* #__PURE__ -- @preserve */
26
- ((()=>_0x225edb)());['_services'];static get requires(){return[z,_0x8a119d,Y,_0x41a606];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5213ce){super(_0x5213ce),this['_services']=new Map();}async init(){const _0x41527c=this['context'],_0x10b7cc=_0x41527c['plugins']['get'](_0x8a119d);if(_0x41527c['plugins']['get'](z)['addToReconnectionStack'](this),_0x10b7cc['adapter']={'addCommentThread':async({channelId:_0x55c990,threadId:_0x553fc4,comments:_0x67ec94,resolvedAt:_0x1ee4ae,resolvedBy:_0x451c36,context:_0x22a8fe,attributes:_0x29d0de})=>{const _0x4a504d=await this['_getService'](_0x55c990)['addCommentThread']({'commentThreadId':_0x553fc4,'comments':_0x67ec94['map'](_0x38976b=>function(_0x303864,_0x4e8aaa,_0x44cd18){return{'commentThreadId':_0x44cd18,'commentId':_0x303864['commentId'],'userId':_0x303864['authorId'],'content':_0x303864['content'],'documentId':_0x4e8aaa,'createdAt':_0x303864['createdAt'],'attributes':_0x303864['attributes']||{}};}(_0x38976b,_0x55c990,_0x553fc4)),'resolvedAt':_0x1ee4ae,'resolvedBy':_0x451c36,'context':_0x22a8fe,'attributes':_0x29d0de})['catch'](ct);return{'threadId':_0x4a504d['commentThreadId'],'comments':_0x4a504d['comments']};},'getCommentThread':async({channelId:_0x3d6d8a,threadId:_0x5b6388})=>{const _0x3b2c1d=await this['_getService'](_0x3d6d8a)['getCommentThread'](_0x5b6388)['catch'](rt)['catch'](ct);return _0x3b2c1d?_0x3b2c1d['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3b2c1d]),{'threadId':_0x3b2c1d['commentThreadId'],'comments':_0x3b2c1d['comments']['map'](at),'context':_0x3b2c1d['context'],'resolvedAt':_0x3b2c1d['resolvedAt'],'resolvedBy':_0x3b2c1d['resolvedBy'],'attributes':_0x3b2c1d['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x5def8a,threadId:_0x420cda,context:_0x156980,unlinkedAt:_0x377aed,attributes:_0x49eecb})=>this['_getService'](_0x5def8a)['updateCommentThread']({'commentThreadId':_0x420cda,'context':_0x156980,'attributes':_0x49eecb,'unlinkedAt':_0x377aed})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x123d63,threadId:_0x4f75aa})=>{const _0x234a29=await this['_getService'](_0x123d63)['resolveCommentThread'](_0x4f75aa)['catch'](rt)['catch'](ct);return{'threadId':_0x234a29['commentThreadId'],'resolvedAt':_0x234a29['resolvedAt'],'resolvedBy':_0x234a29['resolvedBy']};},'reopenCommentThread':async({channelId:_0x44409c,threadId:_0x1548e2})=>this['_getService'](_0x44409c)['reopenCommentThread'](_0x1548e2)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x5e87c2,threadId:_0x363fd6})=>this['_getService'](_0x5e87c2)['removeCommentThread'](_0x363fd6)['catch'](rt)['catch'](ct),'addComment':({channelId:_0xe77915,threadId:_0x2a1077,commentId:_0x51d9bf,content:_0x18db07,attributes:_0x193396})=>this['_getService'](_0xe77915)['addComment'](_0x2a1077,_0x51d9bf,_0x18db07,_0x193396)['catch'](ct),'updateComment':({channelId:_0x23bbec,threadId:_0x11cd0d,commentId:_0x3a4619,content:_0x5f10bc,attributes:_0x6dd6a9})=>this['_getService'](_0x23bbec)['updateComment'](_0x11cd0d,_0x3a4619,_0x5f10bc,_0x6dd6a9)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x4d4043,threadId:_0x58dcee,commentId:_0x287251})=>this['_getService'](_0x4d4043)['removeComment'](_0x58dcee,_0x287251)['catch'](rt)['catch'](ct)},_0x41527c instanceof _0x5c518d){const _0x33b6ab=_0x41527c['config']['get']('collaboration.channelId'),_0x53f90d=_0x41527c['plugins']['get'](Y);await this['_setUpService'](_0x33b6ab);const _0xf85c49=await this['_services']['get'](_0x33b6ab)['getConnectedSessions']();this['listenTo'](_0x53f90d,'sessionAdd:'+_0x33b6ab,(_0x3ed41e,{session:_0x209744})=>{_0x209744['id']===_0x53f90d['mySessionId']&&(_0x3ed41e['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x209744['permissions'],_0x33b6ab));}),_0x53f90d['register'](_0x33b6ab,_0xf85c49);}}async _setUpService(_0x21951e){if(this['_services']['has'](_0x21951e))throw new _0x3f94b6('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x21951e});const _0x5929fa=this['context']['plugins']['get'](_0x8a119d),_0x24f498=new CloudServicesCommentsAdapter['CommentsService'](_0x21951e);this['_services']['set'](_0x21951e,_0x24f498),this['listenTo'](_0x24f498,'commentThreadAdded',(_0x563bef,_0x2cd3f0)=>{const {commentThreadId:_0x324d8f,documentId:_0x56efa4,context:_0x53829a,attributes:_0x1ad30a,resolvedAt:_0x3cd5da,resolvedBy:_0x117497,comments:_0x52ab92}=_0x2cd3f0;_0x5929fa['getCommentThread'](_0x324d8f)||_0x5929fa['addCommentThread']({'threadId':_0x324d8f,'channelId':_0x56efa4,'comments':_0x52ab92?_0x52ab92['map'](at):[],'context':_0x53829a,'attributes':_0x1ad30a,'resolvedAt':_0x3cd5da,'resolvedBy':_0x117497,'isFromAdapter':!0x0});}),this['listenTo'](_0x24f498,'commentThreadUpdated',(_0x47b95b,{commentThreadId:_0x1224b8,documentId:_0x274a07,context:_0x2d4f8b,unlinkedAt:_0x4227fe,attributes:_0x5c4716})=>{_0x5929fa['getCommentThread'](_0x1224b8)&&_0x5929fa['updateCommentThread']({'threadId':_0x1224b8,'channelId':_0x274a07,'context':_0x2d4f8b,'unlinkedAt':_0x4227fe,'attributes':_0x5c4716,'isFromAdapter':!0x0});}),this['listenTo'](_0x24f498,'commentThreadResolved',(_0xe0031b,{commentThreadId:_0x5176ff,resolvedBy:_0x51d88d,resolvedAt:_0x41aea6})=>{const _0x566061=_0x5929fa['getCommentThread'](_0x5176ff);_0x566061&&_0x566061['resolve']({'resolvedBy':_0x51d88d,'resolvedAt':_0x41aea6,'isFromAdapter':!0x0});}),this['listenTo'](_0x24f498,'commentThreadReopened',(_0x2ebe1d,{commentThreadId:_0x4c4a21})=>{const _0x194476=_0x5929fa['getCommentThread'](_0x4c4a21);_0x194476&&_0x194476['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x24f498,'commentThreadRemoved',(_0x147034,{commentThreadId:_0xfb1b51})=>{const _0x511a5b=_0x5929fa['getCommentThread'](_0xfb1b51);_0x511a5b&&_0x511a5b['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x24f498,'commentAdded',(_0x19daa9,_0x48b2ce)=>{const _0x3ce602=_0x48b2ce['commentThreadId'],_0x5dcd0e=_0x5929fa['getCommentThread'](_0x3ce602);_0x5dcd0e&&_0x5dcd0e['addComment']({...at(_0x48b2ce),'isFromAdapter':!0x0});}),this['listenTo'](_0x24f498,'commentUpdated',(_0x488f5e,{commentThreadId:_0x6a3638,commentId:_0x27cf42,content:_0x254215,attributes:_0xdf8929})=>{const _0x5b8eaf=_0x5929fa['getCommentThread'](_0x6a3638);if(_0x5b8eaf){const _0x4e598c=_0x5b8eaf['getComment'](_0x27cf42);_0x4e598c&&_0x4e598c['update']({'content':_0x254215,'attributes':_0xdf8929,'isFromAdapter':!0x0});}}),this['listenTo'](_0x24f498,'commentRemoved',(_0x54a4c3,{commentThreadId:_0x1d6303,commentId:_0x4c966d})=>{const _0x5d9ef7=_0x5929fa['getCommentThread'](_0x1d6303);if(_0x5d9ef7){const _0x24ae63=_0x5d9ef7['getComment'](_0x4c966d);_0x24ae63&&_0x24ae63['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x24f498,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x21951e),this['stopListening'](_0x24f498));}),await this['_connectService'](_0x21951e);}destroy(){if(this['context']instanceof _0x5c518d){const _0x3d8d15=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x3d8d15)&&this['_terminateService'](_0x3d8d15);}}_terminateService(_0x568506){if(!this['_services']['has'](_0x568506))throw new _0x3f94b6('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x568506});this['_getService'](_0x568506)['disconnect'](),this['_services']['delete'](_0x568506);}async reconnect(){for(const _0x209a8f of this['_services']['keys']())await this['_connectService'](_0x209a8f);if(this['context']instanceof _0x5c518d){const _0x4d8674=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x4d8674)){const _0x4665dc=this['context']['plugins']['get'](Y);_0x4665dc['unregister'](_0x4d8674);const _0x44aac6=await this['_services']['get'](_0x4d8674)['getConnectedSessions']();_0x4665dc['register'](_0x4d8674,_0x44aac6);}}}async _connectService(_0x59fb97){const {connection:_0x53fe6c}=this['context']['plugins']['get'](z),_0x29d73b=this['context']['plugins']['get'](_0x8a119d),_0x45abb8=await this['_services']['get'](_0x59fb97)['connect'](_0x53fe6c);await this['_fetchMissingUsersForThreads'](_0x45abb8);const _0x4c6c32=new Set(Array['from'](_0x29d73b['getCommentThreads']({'channelId':_0x59fb97}),_0x1a28db=>_0x1a28db['id']));for(const _0x1c87ce of _0x45abb8)_0x1c87ce['deletedAt']||_0x4c6c32['delete'](_0x1c87ce['commentThreadId']);for(const _0x4ac035 of _0x4c6c32)_0x29d73b['getCommentThread'](_0x4ac035)['remove']({'isFromAdapter':!0x0});for(const _0x14b8aa of _0x45abb8){let _0x1c7f7d=_0x29d73b['getCommentThread'](_0x14b8aa['commentThreadId']);const {commentThreadId:_0x399cbe,context:_0x66de7,attributes:_0x547bde,resolvedBy:_0x7a696c,resolvedAt:_0x30e487,unlinkedAt:_0x2edff6,deletedAt:_0x74906}=_0x14b8aa;if(_0x74906)continue;_0x1c7f7d||(_0x1c7f7d=_0x29d73b['addCommentThread']({'channelId':_0x59fb97,'threadId':_0x399cbe,'context':_0x66de7,'attributes':_0x547bde||{},'resolvedBy':_0x7a696c,'resolvedAt':_0x30e487,'unlinkedAt':_0x2edff6,'isFromAdapter':!0x0}));const _0x3bfcc3=new Set(Array['from'](_0x1c7f7d['comments'],_0x3e0918=>_0x3e0918['id']));for(const _0x492fbb of _0x14b8aa['comments'])_0x3bfcc3['delete'](_0x492fbb['commentId']);for(const _0x301397 of _0x3bfcc3)_0x1c7f7d['getComment'](_0x301397)['remove']({'isFromAdapter':!0x0});for(const _0x3b45e7 of _0x14b8aa['comments']){const _0x545864=_0x1c7f7d['getComment'](_0x3b45e7['commentId']);_0x545864?_0x545864['content']!==_0x3b45e7['content']&&_0x545864['update']({'content':_0x3b45e7['content'],'isFromAdapter':!0x0}):_0x1c7f7d['addComment'](Object['assign'](at(_0x3b45e7),{'isFromAdapter':!0x0}));}}}_getService(_0x4ebcdd){if(!this['_services']['has'](_0x4ebcdd))throw new _0x3f94b6('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4ebcdd});return this['_services']['get'](_0x4ebcdd);}async _fetchMissingUsersForThreads(_0x8b6c9a){const _0x40626d=this['context']['plugins']['get'](_0x41a606),{connection:_0x3ac17b}=this['context']['plugins']['get'](z),_0xfd4bf8=new Set();for(const {resolvedBy:_0x4b744d,comments:_0x19f247}of _0x8b6c9a){_0x4b744d&&!_0x40626d['getUser'](_0x4b744d)&&_0xfd4bf8['add'](_0x4b744d);for(const {userId:_0x39df2b}of _0x19f247)_0x40626d['getUser'](_0x39df2b)||_0xfd4bf8['add'](_0x39df2b);}if(0x0===_0xfd4bf8['size'])return;const _0x5870ea=await _0x44e3f4['getMany'](_0x3ac17b,Array['from'](_0xfd4bf8));for(const _0x36463f of _0x5870ea)_0x40626d['getUser'](_0x36463f['id'])||_0x40626d['addUser'](_0x36463f);}};async function rt(_0x2fe79c){if('404'!==_0x2fe79c['code'])throw _0x2fe79c;}function ct(_0x42f08d){if((_0x37ba8e=_0x42f08d)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x37ba8e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x37ba8e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x37ba8e;throw _0x42f08d;}function at(_0x163c46){return{'threadId':_0x163c46['commentThreadId'],'commentId':_0x163c46['commentId'],'content':_0x163c46['content'],'createdAt':_0x163c46['createdAt'],'authorId':_0x163c46['userId'],'attributes':_0x163c46['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x141bb2{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x258056)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x160671,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1273cb){super(_0x1273cb);const _0xbfce20=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0xbfce20);}init(){const _0x313d2a=this['editor']['plugins']['get'](z),_0x550254=this['editor']['plugins']['get'](_0x160671);return _0x550254['adapter']={'getSuggestion':async _0x391bca=>{await this['_waitForServiceReady']();const _0x469034=await this['_trackChangesService']['get'](_0x391bca)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x469034]),_0x469034;},'addSuggestion':async({id:_0x29ae90,type:_0x39634b,data:_0x48d82a,originalSuggestionId:_0x2a51bc,attributes:_0x131f66})=>{await this['_waitForServiceReady']();const _0x3c078e={'id':_0x29ae90,'type':_0x39634b,'data':_0x48d82a,'originalSuggestionId':_0x2a51bc,'attributes':_0x131f66},_0x583905=await this['_trackChangesService']['add'](_0x29ae90,_0x39634b,_0x48d82a,_0x2a51bc,_0x131f66)['catch'](_0x37b803=>{if(dt(_0x37b803))return new Promise(_0x49425a=>{this['_bufferedRequests']['set'](_0x29ae90,{'resolve':_0x49425a,'suggestionData':_0x3c078e});});throw _0x37b803;});return this['_bufferedRequests']['delete'](_0x29ae90),_0x583905;},'updateSuggestion':async(_0x3926a6,_0x3fac1b)=>{if(await this['_waitForServiceReady'](),'open'!==_0x3fac1b['state'])return this['_trackChangesService']['update'](_0x3926a6,_0x3fac1b)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x3a1361,_0xd62f1a)=>{_0x550254['hasSuggestion'](_0xd62f1a['id'])&&(_0x550254['getSuggestion'](_0xd62f1a['id'])['attributes']=_0xd62f1a['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x313d2a['connection']?.['state']&&(_0x313d2a['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x313d2a['connection'])['then'](_0x57e063=>(_0x313d2a['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x57e063)['then'](()=>{for(const _0xdca64f of _0x57e063){_0x550254['addSuggestionData'](_0xdca64f)['_saved']=!0x0;}})));}async reconnect(){const _0x17db3c=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x3bdac4}=this['editor']['plugins']['get'](z),_0x2e884f=await this['_trackChangesService']['connect'](_0x3bdac4);await this['_fetchMissingUsersForThreads'](_0x2e884f);for(const {suggestionData:_0x362897,resolve:_0x3350ab}of this['_bufferedRequests']['values']()){let _0x2ed80b=_0x2e884f['find'](_0x5cd1d2=>_0x5cd1d2['id']===_0x362897['id']);_0x2ed80b||(_0x2ed80b=await this['_trackChangesService']['add'](_0x362897['id'],_0x362897['type'],_0x362897['data'],_0x362897['originalSuggestionId'])),_0x3350ab(_0x2ed80b);}for(const _0x1ff088 of _0x2e884f)_0x17db3c['hasSuggestion'](_0x1ff088['id'])||_0x17db3c['addSuggestionData'](_0x1ff088);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x4bc721=>{this['listenTo'](this['_trackChangesService'],'connected',_0xce5760=>{_0xce5760['off'](),_0x4bc721();});});}async _fetchMissingUsersForThreads(_0x2a2272){const _0x56a571=this['editor']['plugins']['get'](_0x41a606),{connection:_0x4fa2a3}=this['editor']['plugins']['get'](z),_0x36eb3a=new Set();for(const {authorId:_0x4035f2}of _0x2a2272)_0x56a571['getUser'](_0x4035f2)||_0x36eb3a['add'](_0x4035f2);if(0x0===_0x36eb3a['size'])return;const _0x1ac1e7=await _0x44e3f4['getMany'](_0x4fa2a3,Array['from'](_0x36eb3a));for(const _0x5ab514 of _0x1ac1e7)_0x56a571['getUser'](_0x5ab514['id'])||_0x56a571['addUser'](_0x5ab514);}};function lt(_0x63e0d2){if(dt(_0x63e0d2))return new Promise(()=>{});throw _0x63e0d2;}function dt(_0x294228){return _0x294228['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x294228['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x141bb2{static get requires(){return[_0x518e44,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0xd7816f=this['editor']['plugins']['get'](z),_0x2f786a=this['editor']['plugins']['get'](_0x3f6980),_0xc073c5=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0xd7816f,'change:state',(_0x1116f5,_0xf9c0c5,_0x3c49e0)=>{_0x2f786a['isThreadsLoadingPaused']='connected'!==_0x3c49e0;});}),this['listenTo'](_0xd7816f,'change:state',(_0x46f5b5,_0x397a7e,_0x2e639b)=>{this['editor']['plugins']['get'](_0x8a119d)['switchReadOnly']('connected'!==_0x2e639b);}),_0xc073c5['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x1b9fd3=this['editor']['plugins']['get'](ot),_0x2f77ce=this['editor']['config']['get']('collaboration.channelId');_0x1b9fd3['_services']['has'](_0x2f77ce)&&_0x1b9fd3['_terminateService'](_0x2f77ce),super['destroy']();}},ft=class extends _0x141bb2{static get requires(){return[ut,ht,_0x5e340b];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x141bb2{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
- ((()=>_0x1bf697)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x186c36,Y,_0x41a606];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3ee1fd){super(_0x3ee1fd);const _0x5aab8e=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x5aab8e);}async init(){const _0x51ba36=this['editor']['plugins']['get'](tt),_0x3cb256=_0x51ba36['serverHistory'],_0x28e72b=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x3cb256,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x51ba36['sessionId']});const _0x3e7b1f=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x1fa917,_0x5728fc=await _0x3ae9fb['isBundleUploaded'](_0x28e72b['connection'],_0x3e7b1f);this['editor']['plugins']['get'](_0x186c36)['adapter']={'getRevision':async({revisionId:_0x17cd58})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x17cd58)),'updateRevisions':async _0x237abd=>{await this['_waitForServiceReady']();const _0x3f7137=this['_revisionTracker']['currentRevision'];if(_0x5728fc&&0x1===_0x237abd['length']&&_0x237abd[0x0]['id']===_0x3f7137['id'])return _0x237abd;for(const _0x503e54 of _0x237abd)_0x503e54['id']===_0x3f7137['id']&&(_0x503e54['isEmptyCurrent']=_0x503e54['fromVersion']===_0x503e54['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x237abd,this['_lastRequestId'])['then'](_0x41df41=>(this['_lastRequestId']=_0x41df41,_0x237abd))['catch'](_0x9615e3=>{if(pt(_0x9615e3)||'400'===_0x9615e3['code']&&void 0x0!==_0x9615e3['data']['wrongRequestId']){for(const _0x5eb601 of _0x237abd)this['_revisionTracker']['repository']['getRevision'](_0x5eb601['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x5eb601['id'],_0x5eb601,!0x1);if(pt(_0x9615e3)&&'destroyed'!==this['editor']['state'])throw _0x9615e3;return _0x237abd;}throw _0x9615e3;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x491f31,{revisionsData:_0x4b5eee,requestId:_0x3ce53d})=>{Math['max'](..._0x4b5eee['map'](_0x355ddd=>_0x355ddd['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x4b5eee,_0x3ce53d);}):this['_handleRevisionsUpdate'](_0x4b5eee,_0x3ce53d);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x28e72b['connection']?.['state']&&(_0x28e72b['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x7a9cb4,requestId:_0x3e9bf2}=await this['_revisionHistoryService']['connect'](_0x28e72b['connection']);_0x28e72b['addToReconnectionStack'](this),this['_lastRequestId']=_0x3e9bf2,await this['_fetchMissingUsers'](_0x7a9cb4);for(const _0x41b569 of _0x7a9cb4)this['_revisionTracker']['addRevisionData'](_0x41b569);this['listenTo'](_0x51ba36,'change:_isConnected',(_0x29b6f8,_0x3b60bf,_0xed9039)=>{_0xed9039&&(this['_oldOffset']=_0x51ba36['_offset'],_0x29b6f8['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0xa6dca=this['editor']['plugins']['get'](z),_0x3ecf7f=this['editor']['plugins']['get'](tt),_0x2ad7e6=async()=>{const _0x59038a=this['_revisionTracker']['currentRevision'],_0x1b62cb=_0x59038a['id'],_0x25e8c1=_0x1b62cb!==_0x3ecf7f['sessionId'];if(_0x25e8c1){const _0x4f64e3=_0x3ecf7f['_offset']-this['_oldOffset'],_0x3d78da=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x59038a['toVersion']+_0x4f64e3!==_0x3d78da){const _0x8a5733=_0x59038a['fromVersion']+_0x4f64e3,_0x17ea85=this['editor']['plugins']['get'](_0x41a606),_0x3034e4=this['_revisionTracker']['buildRevisionData']({'revision':_0x59038a,'from':_0x8a5733,'to':_0x3d78da});_0x3034e4['id']=_0x59038a['id'];const _0x17ff2b=_0x3034e4['authorsIds']['map'](_0x2b7ca4=>_0x17ea85['getUser'](_0x2b7ca4));_0x59038a['_update']({..._0x3034e4,'authors':_0x17ff2b},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x59038a['id'],_0x3034e4,!0x0);}this['_revisionTracker']['_startingVersion']=_0x3d78da,_0x59038a['toVersion']!==_0x59038a['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x1b62cb)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x1b62cb),this['_revisionTracker']['_createCurrentRevision'](_0x3d78da);}const {revisions:_0x2812be,requestId:_0xc3336d}=await this['_revisionHistoryService']['reconnect'](_0xa6dca['connection'],this['_lastRequestId']);_0x25e8c1&&_0x2812be['length']>0x0?_0x3ecf7f['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x2812be),this['_handleRevisionsUpdate'](_0x2812be,_0xc3336d),this['_revisionTracker']['sendBufferedUpdates']());};return _0x3ecf7f['_isConnected']?_0x2ad7e6():new Promise((_0x1d39a8,_0xe7ed61)=>{_0x3ecf7f['once']('change:_isConnected',()=>{_0x2ad7e6()['then'](_0x1d39a8)['catch'](_0xe7ed61);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x2956e6=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x9f58d6=>{_0x9f58d6['off'](),_0x2956e6();});});}_getLatestVersionFromServerOperations(){const _0x515598=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x4daa5c of _0x515598)if('marker'!==_0x4daa5c['type']||_0x4daa5c['affectsData'])return _0x4daa5c['baseVersion']+0x1;}_getLatestVersion(){const _0x504717=this['editor']['plugins']['get'](tt);return new Promise(_0x553c79=>{_0x504717['_isPendingUpdate']?_0x504717['once']('change:_isPendingUpdate',()=>{_0x553c79(this['_getLatestVersionFromServerOperations']());}):_0x553c79(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x44bdd0,_0x3510ee){const _0x3f9bdf=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3510ee;for(const _0x2a5370 of _0x44bdd0){const _0x49eefe=_0x3f9bdf['getRevision'](_0x2a5370['id']);if(_0x49eefe){if((_0x2a5370['fromVersion']||_0x2a5370['toVersion'])&&(_0x2a5370['diffData']=null),_0x49eefe===this['_revisionTracker']['currentRevision']){const _0x2cacfa=Math['max'](_0x49eefe['toVersion'],_0x2a5370['toVersion']),_0x48e540=Math['max'](_0x49eefe['fromVersion'],_0x2a5370['fromVersion']);let _0xeb5cb3;_0x49eefe['toVersion']===_0x2a5370['toVersion']&&_0x49eefe['fromVersion']===_0x2a5370['fromVersion']?(_0xeb5cb3=!0x0,this['_preventResendingRevisionData'](_0x2a5370)):_0x2a5370['toVersion']===_0x2cacfa&&_0x2a5370['fromVersion']===_0x48e540?_0xeb5cb3=!0x1:(_0x49eefe['toVersion']===_0x2cacfa&&_0x49eefe['fromVersion']===_0x48e540||this['_fixRevision']({'revision':_0x49eefe,'from':_0x48e540,'to':_0x2cacfa}),_0xeb5cb3=!0x0),_0xeb5cb3&&(delete _0x2a5370['fromVersion'],delete _0x2a5370['toVersion'],delete _0x2a5370['diffData'],delete _0x2a5370['createdAt'],delete _0x2a5370['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x2a5370),this['_preventResendingRevisionData'](_0x2a5370);}else this['_revisionTracker']['addRevisionData'](_0x2a5370);}const _0x2ea4b8=_0x3f9bdf['getRevisions']();_0x2ea4b8['reverse']();for(let _0x421ec2=0x0;_0x421ec2<_0x2ea4b8['length']-0x1;_0x421ec2++){const _0x5bbe4=_0x2ea4b8[_0x421ec2],_0x5a9329=_0x2ea4b8[_0x421ec2+0x1];if(_0x5bbe4['fromVersion']<_0x5a9329['toVersion']){const _0x181ef7=_0x5a9329['toVersion'],_0xfb69cc=Math['max'](_0x181ef7,_0x5bbe4['toVersion']);this['_fixRevision']({'revision':_0x5bbe4,'from':_0x181ef7,'to':_0xfb69cc});}}}['_fixRevision']({revision:_0x9ecaf6,from:_0x4fa442,to:_0x1ad0d3}={}){const _0x52c6e5=this['editor']['plugins']['get'](_0x41a606),_0x3117b0=this['_revisionTracker']['buildRevisionData']({'revision':_0x9ecaf6,'from':_0x4fa442,'to':_0x1ad0d3});_0x3117b0['authors']=_0x3117b0['authorsIds']['map'](_0x334f0c=>_0x52c6e5['getUser'](_0x334f0c)),_0x9ecaf6['_update'](_0x3117b0);}_preventResendingRevisionData(_0x1db7fd){const _0x4ad851={};_0x4ad851['id']=_0x1db7fd['id'];for(const _0x2b3bd9 of Object['keys'](_0x1db7fd))'id'!==_0x2b3bd9&&(_0x4ad851[_0x2b3bd9]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x4ad851['id'],_0x4ad851,!0x0);}async _fetchMissingUsers(_0x86e96a){const _0x2acb27=this['editor']['plugins']['get'](_0x41a606),{connection:_0x318c30}=this['editor']['plugins']['get'](z),_0x73554d=new Set();for(const _0x13da72 of _0x86e96a){for(const _0x386ab4 of _0x13da72['authorsIds'])_0x110629(_0x386ab4);_0x13da72['creatorId']&&_0x110629(_0x13da72['creatorId']);}if(0x0===_0x73554d['size'])return;const _0x5078c3=await _0x44e3f4['getMany'](_0x318c30,Array['from'](_0x73554d));for(const _0x43813a of _0x5078c3)_0x2acb27['getUser'](_0x43813a['id'])||_0x2acb27['addUser'](_0x43813a);function _0x110629(_0x55cd88){_0x2acb27['getUser'](_0x55cd88)||_0x73554d['add'](_0x55cd88);}}};function pt(_0x29aa8a){return _0x29aa8a['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x29aa8a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x29aa8a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x141bb2{static get requires(){return[_0x186c36,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x1242ab{_collapseAt;constructor(_0x5c11b5,_0x1e67b7=0x6){super(_0x5c11b5);const _0x49ae8a=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x1e67b7,this['bind']('isHidden')['to'](this,'usersCount',_0x236df8=>_0x236df8<_0x1e67b7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x49ae8a['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':_0x49ae8a['to']('usersCount',_0x986860=>'+'+(_0x986860-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x1242ab{items;keystrokes;constructor(_0x34b53f){super(_0x34b53f);const _0x117177=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x4b3894(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x117177['if']('hasPopup'),'aria-expanded':_0x117177['to']('isExpanded',_0x16d967=>this['hasPopup']&&String(_0x16d967)),'aria-label':_0x117177['to']('hasPopup',_0x56f303=>X(_0x34b53f,_0x56f303?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x117177['to']('hasPopup',_0x5c2713=>!!_0x5c2713&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x117177['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x117177['to'](_0x7bdbd3=>{const _0x594bf8=_0x7bdbd3,_0x448d9f=document['querySelector']('.ck-presence-list__dropdown-list'),_0x3a908e=document['querySelector']('.ck-balloon-panel_with-arrow');_0x448d9f?.['contains'](_0x594bf8['relatedTarget'])||_0x3a908e?.['contains'](_0x594bf8['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x6e2b23,_0xe8cfaa,_0x1e47d7)=>{this['element']&&(_0x1e47d7?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},_t=class extends _0x1242ab{counterView;inlineListView;constructor(_0x1b01bc,_0x40f9f9=0x6){super(_0x1b01bc);const _0x24a253=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x40f9f9),this['inlineListView']=new vt(_0x1b01bc),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x5297f9 of this['inlineListView']['items'])_0x5297f9['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',_0x24a253['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x1242ab{listWrapperView;constructor(_0x17a80c,_0x45acdb){super(_0x17a80c);const _0x20cbde=this['bindTemplate'];this['listWrapperView']=new bt(_0x17a80c,_0x45acdb),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x17a80c,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x20cbde['to'](_0x454315=>{const _0x51ccf7=_0x454315,_0x1ca37d=document['querySelector']('.ck-presence-list__list'),_0x2632d8=document['querySelector']('.ck-balloon-panel_with-arrow');_0x1ca37d?.['contains'](_0x51ccf7['relatedTarget'])||_0x2632d8?.['contains'](_0x51ccf7['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x29ae41{constructor(_0x522e3d,_0x4c56d0){super(_0x522e3d);const _0x4e6082=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x4c56d0?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x4e6082['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x4e6082['to']('role'),'aria-label':_0x4e6082['to']('ariaLabel'),'aria-labelledby':_0x4e6082['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x406852['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x23c3eb=this['element'];_0x23c3eb&&(this['_isScrollable']=Math['max'](_0x23c3eb['scrollHeight'],_0x23c3eb['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x494a95{['userView'];constructor(_0x5b9a5b,_0x1b4d5c,_0x36577b){super(_0x5b9a5b);const _0x19467e=this['bindTemplate'];this['userView']=new _0x268aa5(_0x5b9a5b,_0x1b4d5c);const _0x194d7f={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x1b4d5c['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x1b4d5c['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x1b4d5c['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x1b4d5c['color']['getColorVariable'](),'--ck-user-color-alpha':_0x1b4d5c['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x36577b&&(_0x194d7f['tag']='button',_0x194d7f['on']={'click':_0x19467e['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x194d7f);}['focus'](){this['element']['focus']();}},It=class extends _0x1242ab{['userView'];['markerView'];constructor(_0x17c8d9,_0x34e021,_0x477739){super(_0x17c8d9);const _0x5273f6=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x268aa5(_0x17c8d9,_0x34e021),this['markerView']=new St(_0x17c8d9,_0x34e021);const _0x256ee2=new _0x7bf2a7(_0x17c8d9);_0x256ee2['template']['tag']='span',_0x256ee2['text']=_0x34e021['name'];const _0x3a93c2={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5273f6['to']('isFocusable',_0x55f5d1=>!!_0x55f5d1&&0x0),'aria-labelledby':_0x256ee2['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5273f6['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5273f6['to']('hasTooltip',_0x62a27d=>!_0x62a27d),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x256ee2]};_0x477739&&(_0x3a93c2['tag']='button',_0x3a93c2['on']={'click':_0x5273f6['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x3a93c2);}},St=class extends _0x1242ab{constructor(_0x56226f,_0xbda4d7){super(_0x56226f),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0xbda4d7['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0xbda4d7['color']['getColorVariable'](),'--ck-user-color-alpha':_0xbda4d7['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x1d7b68{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1488f5){super(_0x1488f5),this['context']['config']['define']('presenceList',Tt);const _0x7f8561=_0x1488f5['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x7f8561)throw new _0x3f94b6('presencelist-collapseat-invalid-format',this);if(_0x7f8561<0x1)throw new _0x3f94b6('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x5ee725(),this['balloonPanelView']=new _0x416845(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x1acf46 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x1acf46);this['listenTo'](this['_allConnectedUsers'],'add',(_0x4536ad,_0xd0a467)=>{this['_handleUserAdd'](_0xd0a467);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x4450ce,_0x24a069)=>{this['_handleUserRemove'](_0x24a069);});}_createView(){const _0x23ef5d=this['context'],_0x3dea04=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x5029cc=this['balloonPanelView'];if(!_0x3b247a(_0x23ef5d['config']['get']('presenceList.container')))throw new _0x3f94b6('presencelist-missing-container',this);return _0x3dea04['counterView']['bind']('usersCount')['to'](this),_0x3dea04['bind']('isCollapsed')['to'](this,'usersCount',_0x25afd6=>{const {collapseAt:_0xb1ffc5}=_0x23ef5d['config']['get']('presenceList'),_0x4c2898=_0x25afd6>=_0xb1ffc5;if(_0x4c2898&&!_0x3dea04['inlineListView']['items']['find'](_0x567b06=>_0x567b06 instanceof wt)){const _0x74c76e=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x74c76e&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x3dea04['inlineListView']['items']['add'](_0x3dea04['counterView']);}return _0x4c2898||this['hideDropdown'](),_0x4c2898;}),_0x3dea04['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x58b814=>{const _0x2f7d8e=_0x23ef5d['config']['get']('presenceList'),_0x1b38d1=new It(_0x23ef5d['locale'],_0x58b814,!!_0x2f7d8e['onClick']);return _0x1b38d1['bind']('hasTooltip')['to'](_0x3dea04,'isCollapsed',_0x1606f=>!_0x1606f),_0x1b38d1['bind']('isFocusable')['to'](_0x3dea04,'isCollapsed',_0x44b19f=>!_0x44b19f),_0x2f7d8e['onClick']&&this['listenTo'](_0x1b38d1,'execute',()=>{this['view']['isCollapsed']||_0x2f7d8e['onClick'](_0x58b814,_0x1b38d1['element']);}),_0x1b38d1;}),this['listenTo'](_0x3dea04['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x3dea04['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x3dea04['inlineListView']['keystrokes']['set']('Enter',(_0x350da3,_0xef62dd)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0xef62dd());}),_0x3dea04['render'](),_0x5029cc['render'](),_0x23500a({'emitter':_0x3dea04,'activator':()=>_0x5029cc['isVisible'],'contextElements':[_0x5029cc['element'],_0x3dea04['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x23ef5d['config']['get']('presenceList.container')['appendChild'](_0x3dea04['element']),this['_bodyCollection']=new _0x18622a(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x3dea04;}['_handleUserAdd'](_0x48873b){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x48873b['isMe'])return;const _0x34e8f4=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x34e8f4-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x30312d=_0x48873b['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x48873b,_0x30312d);}['_handleUserRemove'](_0x17541c){this['usersCount']--;const {collapseAt:_0x47276a}=this['context']['config']['get']('presenceList'),_0xce4203=this['usersCount']>=_0x47276a;if(this['currentDisplayedUsers']['get'](_0x17541c['id']))this['currentDisplayedUsers']['remove'](_0x17541c['id']);else{if(_0xce4203&&this['currentDisplayedUsers']['length']+0x1===_0x47276a-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0xce4203?0x1:0x0)<this['usersCount']){for(const _0x57c1e5 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x57c1e5['id'])&&(this['currentDisplayedUsers']['add'](_0x57c1e5,Math['min'](this['currentDisplayedUsers']['length']-(_0xce4203?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0xce4203?0x1:0x0)===_0x47276a-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x286f8a=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x286f8a['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x2967e4}=this['presenceDropdownView'];_0x2967e4['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x5c582b=>{if(!_0x286f8a['displayMe']&&_0x5c582b['isMe'])return null;const _0x404f63=new kt(this['context']['locale'],_0x5c582b,!!_0x286f8a['onClick']);return _0x286f8a['onClick']&&this['listenTo'](_0x404f63,'execute',()=>{_0x286f8a['onClick'](_0x5c582b,_0x404f63['element']);}),_0x404f63;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x2967e4['focus'](),_0x2967e4['checkIfScrollable']();const _0x5c415c=(_0x3ff6b5,_0x345fad)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x345fad();};_0x2967e4['keystrokes']['set']('Esc',_0x5c415c),_0x2967e4['keystrokes']['set']('Shift+Tab',_0x5c415c),_0x2967e4['keystrokes']['set']('Tab',(_0x1e1826,_0x564bfc)=>{!function(_0x3a5fdb){const _0x2993cc=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x249ff7=>_0x249ff7+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x2b5dce=[...document['body']['querySelectorAll'](_0x2993cc)]['filter'](_0x49dc8a=>_0x49dc8a===document['activeElement']||_0x49dc8a['offsetWidth']+_0x49dc8a['offsetHeight']>0x0)['sort']((_0x4e35c2,_0x450b82)=>(_0x4e35c2['tabIndex']||0x0)-(_0x450b82['tabIndex']||0x0)),_0x157b11=_0x2b5dce[(_0x2b5dce['indexOf'](_0x3a5fdb)+0x1)%_0x2b5dce['length']];_0x157b11&&_0x157b11['focus']();}(this['view']['element']),this['hideDropdown'](),_0x564bfc();}),_0x2967e4['focusTracker']['add'](this['view']['element']),_0x2967e4['focusTracker']['on']('change:isFocused',(_0x548920,_0x22ccf7,_0x5f3e35)=>{_0x5f3e35||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}},At=class extends _0x1d7b68{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};
23
+ import{Context as _0x4be23b,ContextPlugin as _0x5383fe,PendingActions as _0x4f34ce,Plugin as _0x182d58}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x3793cd,Collection as _0x43ba52,DomEmitterMixin as _0x5eaf0b,KeystrokeHandler as _0x48672d,global as _0x415cf5,uid as _0x26b079,version as _0x4b7de2}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x41d86b,BodyCollection as _0x2c3ba0,LabelView as _0x79a609,ListItemView as _0x2c05db,ListView as _0x4410a0,Notification as _0x41498b,View as _0x4fcb28,clickOutsideHandler as _0x1ef56d}from'@ckeditor/ckeditor5-ui';import{History as _0xd1004d,InsertOperation as _0x812ce,MarkerOperation as _0x4955a2,ModelLiveRange as _0x1db5d4,NoOperation as _0x48d7e0,OperationFactory as _0x3db4a7,RootAttributeOperation as _0x4ece14,transformOperationSets as _0x53ed02}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0xfb615}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x30f8d9,CommentsService as _0x5c5423,EditorService as _0xb6b90c,RevisionHistoryService as _0x142660,TrackChangesService as _0x4a2ecf,User as _0x198d99,WEB_SOCKET_GATEWAY_STATES as _0x45097b,WebSocketGateway as _0x43643c}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x4e3739,Users as _0x326fdb}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x567ad9}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x18abce,TrackChangesEditing as _0x31da8d}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x4ddf0e,CommentsEditing as _0x4ad914,CommentsRepository as _0xc1d332}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x5f0e50}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x4b1f95}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x5383fe{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
+ ((()=>_0x43643c)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0xfb615,_0x41498b];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xbc0a3b){super(_0xbc0a3b),this['set']('state',_0x45097b['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x5eaf0b())();}init(){const _0x164d36=this['context'],_0x4f451b=_0x164d36['plugins']['get'](_0xfb615),_0x1a0158=_0x164d36['plugins']['get'](_0x41498b);if(!_0x4f451b['token'])throw new _0x3793cd('websocketgateway-missing-token',this);if(!_0x4f451b['webSocketUrl'])throw new _0x3793cd('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'](_0x4f451b['token'],_0x4f451b['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x7bd6b8=>{if(this['connection']=_0x7bd6b8,this['bind']('state')['to'](_0x7bd6b8,'state',this,'_isBrowserOffline',(_0x3a23fa,_0x404b6f)=>('connected'!==_0x3a23fa&&(this['_shouldPluginsReconnect']=!0x0),_0x404b6f||_0x3a23fa!==_0x45097b['CONNECTED']?_0x45097b['DISCONNECTED']:this['state']==_0x45097b['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x45097b['CONNECTING']):_0x45097b['CONNECTED'])),this['connection']['on']('error',(_0x21947e,_0x1b7d37)=>{if('limitExceeded'!==_0x1b7d37['code'])throw console['error'](_0x1b7d37),new _0x3793cd('cloudservices-init',null,{'originalError':_0x1b7d37});_0x1a0158['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'});}),!_0x7bd6b8['me'])return new Promise(_0x3ec281=>_0x7bd6b8['on']('change:me',_0x3ec281));})['catch'](_0x18eb8a=>{throw console['error'](_0x18eb8a),new _0x3793cd('cloudservices-init',null,{'originalError':_0x18eb8a});});}addToReconnectionStack(_0x23fbbf){if('function'!=typeof _0x23fbbf['reconnect'])throw new _0x3793cd('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x23fbbf))throw new _0x3793cd('websocketgateway-plugin-already-registered',this,{'name':_0x23fbbf['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x23fbbf);}removeFromReconnectionStack(_0x181f24){this['_reconnectionStack']['delete'](_0x181f24);}isInReconnectionStack(_0x1e1035){return this['_reconnectionStack']['has'](_0x1e1035);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x2af609=>_0x2af609['reconnect']())))['then'](()=>this['state']=_0x45097b['CONNECTED'])['catch'](_0x406341=>{throw console['error'](_0x406341),new _0x3793cd('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x45097b['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x5383fe{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[z,_0x326fdb];}constructor(_0x340179){super(_0x340179),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x43ba52(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x326fdb);}init(){const _0x2f85e4=this['context']['plugins']['get'](z);this['listenTo'](_0x2f85e4,'change:state',(_0x58f8e6,_0x406277,_0x27737d)=>{if('connected'!==_0x27737d)this['channelSessions']['forEach'](_0x2ae407=>_0x2ae407['clear']()),this['channelConnectedUsers']['forEach'](_0x12cf8f=>_0x12cf8f['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x87181c,_0x54ce3a]of this['_registeredSessions'])for(const _0x5bf723 of _0x54ce3a)this['_handleSessionAdd'](_0x87181c,_0x5bf723);}}),this['_createUser'](_0x2f85e4['connection']['me'],!0x0);}register(_0x178528,_0x2afeb0){if(this['_registeredSessions']['has'](_0x178528))throw new _0x3793cd('sessions-register-already-registered',null,{'channelId':_0x178528});this['_registeredSessions']['set'](_0x178528,_0x2afeb0),this['channelSessions']['set'](_0x178528,new _0x43ba52()),this['channelConnectedUsers']['set'](_0x178528,new _0x43ba52()),this['listenTo'](_0x2afeb0,'add',(_0x235255,_0x30ff74)=>this['_handleSessionAdd'](_0x178528,_0x30ff74)),this['listenTo'](_0x2afeb0,'remove',(_0x2eebcf,_0x16f3b4)=>this['_handleSessionRemove'](_0x178528,_0x16f3b4));for(const _0x18c048 of _0x2afeb0)this['_handleSessionAdd'](_0x178528,_0x18c048);}unregister(_0x2b75b1){if(!this['_registeredSessions']['has'](_0x2b75b1))throw new _0x3793cd('sessions-unregister-not-exist',null,{'channelId':_0x2b75b1});const _0x292f2d=this['_registeredSessions']['get'](_0x2b75b1);this['stopListening'](_0x292f2d);for(const _0x1695a6 of _0x292f2d)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x2b75b1,_0x1695a6);this['_registeredSessions']['delete'](_0x2b75b1),this['channelSessions']['delete'](_0x2b75b1),this['channelConnectedUsers']['delete'](_0x2b75b1);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x326aac){for(const _0x5ee189 of this['channelSessions']['values']())for(const _0x2b43a3 of _0x5ee189)if(_0x2b43a3['id']===_0x326aac)return _0x2b43a3['user'];}getUserSessions(_0x3ca5c5,_0x1ca343){const _0x6795b6=_0x1ca343?[this['channelSessions']['get'](_0x1ca343)]:this['channelSessions']['values'](),_0x11bd71=new Set();for(const _0x6fd794 of _0x6795b6)for(const _0x3bce13 of _0x6fd794)_0x3bce13['user']['id']===_0x3ca5c5['id']&&_0x11bd71['add'](_0x3bce13['id']);return _0x11bd71;}getUserRole(_0x510644){for(const _0x598a71 of this['channelSessions']['values']())for(const _0x31ce6a of _0x598a71)if(_0x31ce6a['user']===_0x510644)return _0x31ce6a['role'];}['_handleSessionAdd'](_0x4fc309,_0x3b8164){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x41d194=_0x3b8164['user'],_0x59e9ae=this['_users']['getUser'](_0x41d194['id'])||this['_createUser'](_0x41d194),_0x710129=Object['assign']({},_0x3b8164,{'user':_0x59e9ae});if(this['channelSessions']['get'](_0x4fc309)['add'](_0x710129),!_0x41d194['hiddenInPresenceList']){const _0xb664ac=this['channelConnectedUsers']['get'](_0x4fc309);_0xb664ac['has'](_0x59e9ae['id'])||_0xb664ac['add'](_0x59e9ae),this['allConnectedUsers']['has'](_0x59e9ae['id'])||_0x41d194['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x59e9ae,_0x59e9ae['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x4fc309,{'channelId':_0x4fc309,'session':_0x710129});}['_handleSessionRemove'](_0x237bbd,_0x529197){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x5bbd14=this['channelConnectedUsers']['get'](_0x237bbd),_0x3d0a91=_0x529197['user'];_0x3d0a91['id']&&(this['channelSessions']['get'](_0x237bbd)['remove'](_0x529197['id']),_0x5bbd14['has'](_0x3d0a91['id'])&&!this['getUserSessions'](_0x3d0a91,_0x237bbd)['size']&&_0x5bbd14['remove'](_0x3d0a91['id']),this['allConnectedUsers']['get'](_0x3d0a91['id'])&&!this['getUserSessions'](_0x3d0a91)['size']&&this['allConnectedUsers']['remove'](_0x3d0a91['id']));}_createUser(_0x4815c9,_0x261088){const _0x1540f0=this['_users']['addUser'](_0x4815c9);return _0x261088&&this['_users']['defineMe'](_0x4815c9['id']),_0x1540f0['orderNumber']=this['_uniqueUsersCount']++,_0x1540f0;}},K=class extends _0x182d58{_domEmitter=new(_0x5eaf0b())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x2c4fb7=this['editor'],_0x40d607=_0x2c4fb7['plugins']['get'](Y);_0x2c4fb7['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x55b15a,{writer:_0x2d4981})=>function(_0x57ce35,_0x288390,_0x295017,_0x2ef0e2){const _0x4bba1c=_0x57ce35['markerName']['split'](':')[0x2],_0x3c35a7=_0x295017['getUserBySessionId'](_0x4bba1c);if(!_0x3c35a7||_0x4bba1c===_0x295017['mySessionId'])return;if(!_0x2ef0e2['model']['schema']['checkChild'](_0x57ce35['markerRange']['start'],'$text'))return;const _0x328035={'class':'ck-user__marker\x20'+_0x3c35a7['color']['getMarkerClass'](),'style':Q(_0x3c35a7),'data-name':_0x3c35a7['name'],'data-session-id':_0x4bba1c},_0xadac99=_0x2ef0e2['model']['markers']['get'](_0x57ce35['markerName'])['getStart'](),_0x35dd5c=_0xadac99['nodeAfter'],_0x23c06a=_0x2ef0e2['model']['schema'];if(_0x35dd5c&&_0x23c06a['isObject'](_0x35dd5c)&&_0x23c06a['isInline'](_0x35dd5c)&&!_0x2ef0e2['model']['markers']['get']('user:range:'+_0x4bba1c)['getRange']()['isCollapsed'])return;const _0x37b4c9=_0xadac99['parent'];return _0x2ef0e2['model']['schema']['isLimit'](_0x37b4c9)&&!_0x2ef0e2['model']['hasContent'](_0x37b4c9)&&(_0x328035['contenteditable']=!0x1),function(_0x4b6374,_0x35b671,_0x5bd3b6){const _0xbfac4c=_0x4b6374['createUIElement']('span',_0x35b671);return _0x4b6374['setCustomProperty']('userPositionMarker',!0x0,_0xbfac4c),_0xbfac4c['render']=function(_0x58a194){const _0x68e6e5=this['toDomElement'](_0x58a194),_0x24312e=document['createElement']('span');return _0x24312e['classList']['add']('ck-user__marker-tooltip'),_0x24312e['setAttribute']('contenteditable','false'),_0x24312e['setAttribute']('spellcheck','false'),_0x24312e['textContent']=_0x5bd3b6['name'],_0x68e6e5['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x24312e['outerHTML']+'⁠',_0x68e6e5['addEventListener']('mouseenter',()=>{_0x68e6e5['classList']['add']('ck-user__marker_hovered');}),_0x68e6e5['addEventListener']('mouseleave',()=>{_0x68e6e5['classList']['remove']('ck-user__marker_hovered');}),_0x68e6e5;},_0xbfac4c['isSimilar']=function(_0xa8a42a){return!(!this['getCustomProperty']('userPositionMarker')||!_0xa8a42a['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0xa8a42a['getAttribute']('data-session-id'));},_0xbfac4c;}(_0x288390,_0x328035,_0x3c35a7);}(_0x55b15a,_0x2d4981,_0x40d607,_0x2c4fb7)}),_0x2c4fb7['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x95329f=>function(_0x34f01e,_0x37e457){const _0x44e217=_0x34f01e['markerName']['split'](':')[0x2];if(_0x44e217===_0x37e457['mySessionId'])return null;const _0x4ee6a8=_0x37e457['getUserBySessionId'](_0x44e217);return _0x4ee6a8?{'id':_0x44e217,'classes':['ck-user__selection',_0x4ee6a8['color']['getSelectionClass']()],'attributes':{'style':Q(_0x4ee6a8),'data-session-id':_0x44e217},'priority':0x7d0+_0x4ee6a8['orderNumber']}:{'id':_0x44e217,'classes':[]};}(_0x95329f,_0x40d607)}),function(_0xb95c91){const _0x5d4f9f=_0xb95c91['model'],_0x2c3cb8=new Map(),_0x2e3740=_0xb95c91['plugins']['get'](Y);_0x5d4f9f['markers']['on']('update:user:range',(_0x3736d5,_0x3c95fd,_0x3e1f77,_0x80afbb)=>{if(!_0x80afbb&&_0x2c3cb8['get'](_0x3c95fd['name']))return _0x2c3cb8['get'](_0x3c95fd['name'])['detach'](),void _0x2c3cb8['delete'](_0x3c95fd['name']);const _0x187877=_0x3c95fd['name']['split'](':')[0x2];if(_0x187877===_0x2e3740['mySessionId'])return;const _0x518024='user:position:'+_0x187877;_0x5d4f9f['markers']['has'](_0x518024)&&_0xb95c91['editing']['reconvertMarker'](_0x518024),_0x3c95fd['on']('change:range',(_0xf872b,_0x182c0a,_0x23dcb9)=>{if('$graveyard'!=_0x182c0a['root']['rootName']&&'$graveyard'==_0x3c95fd['getRange']()['root']['rootName']&&!_0x2c3cb8['has'](_0x3c95fd['name'])){const _0x146679=_0x5d4f9f['schema']['getNearestSelectionRange'](_0x23dcb9['deletionPosition']);if(_0x146679){const _0x5f5692=_0x1db5d4['fromRange'](_0x146679);_0x2c3cb8['set'](_0x3c95fd['name'],_0x5f5692),_0x5f5692['on']('change:range',(_0x21571,_0x11cfeb,_0x43db17)=>{if('$graveyard'==_0x5f5692['root']['rootName']){const _0x3f1705=_0x5d4f9f['schema']['getNearestSelectionRange'](_0x43db17['deletionPosition']);_0x3f1705?(_0x5f5692['start']=_0x3f1705['start'],_0x5f5692['end']=_0x3f1705['end']):(_0x2c3cb8['delete'](_0x3c95fd['name']),_0x5f5692['detach']());}});}}});}),_0x5d4f9f['document']['on']('change',()=>{_0x2c3cb8['size']>0x0&&_0x5d4f9f['enqueueChange']({'isUndoable':!0x1},_0x1adaf6=>{for(const [_0x1dffa3,_0xf2df5a]of _0x2c3cb8)'$graveyard'==_0x5d4f9f['markers']['get'](_0x1dffa3)['getRange']()['root']['rootName']&&(J(_0x1dffa3['split'](':')[0x2],_0xf2df5a['toRange'](),_0x5d4f9f,_0x1adaf6),_0xf2df5a['detach']());_0x2c3cb8['clear']();});});}(_0x2c4fb7),this['_domEmitter']['listenTo'](_0x415cf5['document'],'keydown',(_0x745298,{key:_0x57a51a})=>{'Escape'===_0x57a51a&&function(_0x5de076){_0x5de076['editing']['view']['change'](_0x42cc75=>{for(const _0x2dbbe9 of _0x5de076['model']['markers']){if(!_0x2dbbe9['name']['startsWith']('user:position'))continue;const _0x1f1689=_0x5de076['editing']['mapper']['markerNameToElements'](_0x2dbbe9['name']);if(_0x1f1689){for(const _0x101b54 of _0x1f1689)_0x42cc75['removeClass']('ck-user__marker_hovered',_0x101b54);}}});}(_0x2c4fb7);},{'useCapture':!0x0});}afterInit(){const _0x26d221=this['editor'],_0x1860c8=_0x26d221['commands']['get']('undo');_0x1860c8&&_0x26d221['model']['on']('applyOperation',(_0x2703ed,_0x2619c0)=>{const _0x363a0b=_0x2619c0[0x0];if(!_0x363a0b['isDocumentOperation'])return;if('marker'!=_0x363a0b['type']||!_0x363a0b['name']['startsWith']('user:'))return;const _0xf127e0=_0x363a0b['batch'];_0x1860c8['_createdBatches']['has'](_0xf127e0)&&(_0x363a0b['newRange']=_0x363a0b['oldRange']?_0x26d221['model']['createRange'](_0x363a0b['oldRange']['start'],_0x363a0b['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x429ba1=this['editor'],_0x11bff4=_0x429ba1['model']['document'],_0xfe38e0=_0x429ba1['plugins']['get'](Y);_0x429ba1['model']['enqueueChange']({'isUndoable':!0x1},_0x16490d=>{const _0x1e621e='user:range:'+_0xfe38e0['mySessionId'],_0x3f84fc='user:position:'+_0xfe38e0['mySessionId'],_0x181a09=_0x429ba1['model']['markers']['has'](_0x1e621e);_0x429ba1['editing']['view']['hasDomSelection']?J(_0xfe38e0['mySessionId'],_0x11bff4['selection']['getFirstRange'](),_0x429ba1['model'],_0x16490d):_0x181a09&&(_0x16490d['removeMarker'](_0x1e621e),_0x16490d['removeMarker'](_0x3f84fc));});}};function J(_0x5ab3d9,_0x4278d0,_0x239ad2,_0xbf9805){const _0x4368da='user:range:'+_0x5ab3d9,_0x393ad9='user:position:'+_0x5ab3d9,_0x21bf63=_0x4278d0['getContainedElement']();let _0x518dff=_0x4278d0['start'];if(_0x21bf63&&_0x21bf63['is']('element','tableCell')){const _0x34d8ee=function(_0x16f517,_0x322a23){for(const _0xca68 of _0x16f517['getPositions']())if(_0x322a23['schema']['checkChild'](_0xca68,'$text'))return _0xca68;}(_0x4278d0,_0x239ad2);_0x34d8ee&&(_0x518dff=_0x34d8ee,_0x4278d0=_0xbf9805['createRange'](_0x518dff));}const _0x155432=_0xbf9805['createRange'](_0x518dff);_0x239ad2['markers']['has'](_0x4368da)?(_0xbf9805['updateMarker'](_0x4368da,{'range':_0x4278d0}),_0xbf9805['updateMarker'](_0x393ad9,{'range':_0x155432})):(_0xbf9805['addMarker'](_0x4368da,{'range':_0x4278d0,'usingOperation':!0x0}),_0xbf9805['addMarker'](_0x393ad9,{'range':_0x155432,'usingOperation':!0x0}));}function Q(_0x502ea9){return'--ck-user-color:'+_0x502ea9['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x502ea9['color']['getColorAlphaVariable']()+';';}function X(_0x568c1f,_0x72db53,_0x3886e1){const _0x443ca3=_0x568c1f['t'],t=_0x568c1f['t'];switch(_0x72db53){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 _0x443ca3({'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'},_0x3886e1);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x182d58{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x30f8d9)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x4f34ce,_0x326fdb,_0x41498b];}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 _0x4c20a9=this['serverHistory']['getOperations']();for(let _0xf40ce6=_0x4c20a9['length']-0x1;_0xf40ce6>=0x0;_0xf40ce6--){const _0x31a309=_0x4c20a9[_0xf40ce6];if(!this['_disconnectionOperations']['has'](_0x31a309))return _0x31a309['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x163aaa){if(super(_0x163aaa),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0xd1004d(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x3793cd('collaboration-missing-channelid',this);const _0x73e9d4=_0x163aaa['config']['get']('cloudServices.bundleVersion')||_0x4b7de2;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x73e9d4,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x567ad9(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new it(this['_disconnectionOperations']);}init(){const _0x162aff=this['editor'],_0x50a1c3=_0x162aff['plugins']['get'](_0x326fdb),_0x3486a0=_0x162aff['plugins']['get'](z);this['listenTo'](_0x50a1c3,'getOperationAuthor',(_0x4a762f,_0x561147)=>{const _0x2abccf=_0x561147[0x0];_0x2abccf['_authorId']&&(_0x4a762f['return']=_0x50a1c3['getUser'](_0x2abccf['_authorId']),_0x4a762f['stop']()),null===_0x2abccf['_authorId']&&(_0x4a762f['return']=null,_0x4a762f['stop']());},{'priority':'high'}),this['listenTo'](_0x162aff['model']['document']['selection'],'change:range',(_0x23a4ae,_0x30008e)=>{_0x30008e['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x162aff['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x162aff['model']['on']('applyOperation',(_0x4b5eb,_0x2f3223)=>{const _0x57ee36=_0x2f3223[0x0];_0x57ee36['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x57ee36),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x3486a0,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x28e267,_0x2b29bc,_0x3b8a67)=>'connected'===_0x28e267&&!_0x2b29bc&&!_0x3b8a67),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x162aff['disableReadOnlyMode']('rtc-offline'):_0x162aff['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x162aff['disableReadOnlyMode']('rtc-offline'):_0x162aff['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x2c6253=this['editor']['plugins']['get'](Y),_0x19fe19=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x2c6253['unregister'](this['_channelId']);const _0x1ab637=await this['_service']['reconnect'](_0x19fe19['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x1ab637)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x5a1e07=await this['_service']['getConnectedSessions']();_0x2c6253['register'](this['_channelId'],_0x5a1e07),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x57cc32){if(function(_0x4cd1fa){return'404'===_0x4cd1fa['code'];}(_0x57cc32)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0xca52d){return'409'===_0xca52d['code'];}(_0x57cc32)){const _0x749678=X(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x749678);}else{if(!(_0x57cc32 instanceof et))throw _0x57cc32;this['_handleReconnectionError']();}}}}destroy(){const _0x39698b=this['editor']['plugins']['get'](z),_0x2b95ee=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x2b95ee['channelSessions']['has'](this['_channelId'])&&_0x2b95ee['unregister'](this['_channelId']),_0x39698b['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x563e93){if(this['sessionId']!==_0x563e93['sessionId']&&this['_lastSyncedOperationId']!==_0x563e93['lastOperationId'])throw new et();return this['sessionId']=_0x563e93['sessionId'],this['_handleServerResponse']([],{..._0x563e93,'wereChangesApplied':!0x1,'data':_0x563e93['data']},'reconnect');}async _connectService(_0x551f60,_0x3e9fce=!0x1){const {connection:_0x1da318}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x1da318,this['_channelId'])['then'](_0x581228=>this['_initSessionsHandling'](_0x581228))['catch'](_0x292a6d=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x292a6d);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x55e2ea,_0x1681bc)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x1681bc);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x1901aa=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x551f60);this['_isPendingUpdate']=!0x0;const _0x19b290=await this['_service']['connect'](_0x1da318,this['_compressOperations'](_0x551f60),_0x1901aa);if(this['sessionId']=_0x19b290['sessionId'],_0x3e9fce){if(!_0x19b290['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x19b290['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x551f60,_0x19b290,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x19b290,_0x551f60);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x3d7aa1=this['editor']['plugins']['get'](Y),_0x3f6773=this['editor']['plugins']['get'](K),_0x4d9f06=_0x3d7aa1['channelSessions']['get'](this['_channelId']);_0x4d9f06&&_0x4d9f06['length']>0x1?_0x3f6773['createUserMarkerOperations']():this['listenTo'](_0x3d7aa1,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x3d7aa1['channelSessions']['get'](this['_channelId'])['length']&&_0x3f6773['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x434915,_0x2f8e03,_0x1fcfba,_0x2493ff){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x2f8e03){const _0x10d36d=this['_decompressOperations'](_0x1fcfba,_0x2493ff);await this['_fetchMissingUsers'](_0x10d36d),this['_handleExternalOperations'](_0x10d36d,_0x2f8e03,_0x1fcfba['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x2f3d7f}=this['editor'];let _0x21d273;try{_0x21d273=await this['_service']['getDocumentDetails']();}catch{const _0x4836d9=X(_0x2f3d7f,'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'](_0x4836d9);}const _0x1d34f0=_0x21d273['currentDocumentSession']||_0x21d273['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x1d34f0['lastOperationId']){const _0x539828=X(_0x2f3d7f,'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'](_0x539828);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x437013=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x437013['connection']||'connected'!==_0x437013['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x478648=this['editor']['plugins']['get'](Y);_0x478648['channelSessions']['has'](this['_channelId'])&&_0x478648['unregister'](this['_channelId']),_0x437013['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x18de96){const _0x36c605=this['editor']['plugins']['get'](Y);this['listenTo'](_0x36c605,'sessionAdd:'+this['_channelId'],(_0x1c6704,{session:_0x28e4f8})=>{if(_0x28e4f8['id']===_0x36c605['mySessionId']){_0x1c6704['off']();const _0x442a7f=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x3b97b3=_0x28e4f8['permissions'];_0x442a7f&&_0x442a7f['isEnabled']&&(_0x3b97b3=_0x3b97b3['filter'](_0x5a366f=>'document:write'!==_0x5a366f)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x3b97b3,this['_channelId']);}}),_0x36c605['register'](this['_channelId'],_0x18de96);}_initThrowingOnDataSet(){const _0x158276=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x5a8f6c)=>{if(!_0x5a8f6c[_0x5a8f6c['length']-0x1]['suppressErrorInCollaboration'])throw new _0x3793cd('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x158276['apply'](this['editor']['data'],_0x5a8f6c);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x4d9912,[_0x1edd54])=>{if(this['_document']['version'])throw new _0x3793cd('realtimecollaborationclient-init-document-already-initialized',this);_0x4d9912['stop'](),this['_setPendingAction']();const _0x3eae75=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x516743])=>!_0x516743['lazyLoad'])['map'](([_0x7bb452,_0x525d68])=>[_0x7bb452,_0x525d68['modelAttributes']||{}])),_0x1ecb4f=this['_getOperationsFromInitData'](_0x1edd54,_0x3eae75);0x0==_0x1ecb4f['length']&&_0x1ecb4f['push'](new _0x48d7e0(0x0)),_0x4d9912['return']=this['_connectService'](_0x1ecb4f)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x1b4bc8=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x1b4bc8))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2067ed,[_0x2477b7,_0x4f444f])=>{_0x2067ed['stop']();const _0x3d09c8=this['editor']['model']['document']['getRoot'](_0x2477b7);if(!this['_knownRootNames']['has'](_0x2477b7)){const _0x411834=_0x4f444f&&_0x4f444f['data']?_0x4f444f['data']:'',_0x4ac733=_0x4f444f&&_0x4f444f['attributes']?_0x4f444f['attributes']:{};await this['_loadRoot'](_0x2477b7,_0x411834,_0x4ac733);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x3d09c8['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x3d09c8);});},{'priority':'high'});}async _fetchMissingUsers(_0x2d1175){const _0x560787=this['editor']['plugins']['get'](_0x326fdb),{connection:_0x41e75e}=this['editor']['plugins']['get'](z),_0x747a55=new Set();for(const _0x5967df of _0x2d1175){const _0x159327=_0x5967df['_authorId'];_0x159327&&!_0x560787['getUser'](_0x159327)&&_0x747a55['add'](_0x159327);}if(0x0===_0x747a55['size'])return;const _0x2bacb2=await _0x198d99['getMany'](_0x41e75e,Array['from'](_0x747a55));for(const _0x2a01bb of _0x2bacb2)_0x560787['getUser'](_0x2a01bb['id'])||_0x560787['addUser'](_0x2a01bb);}_getOperationsFromInitData(_0x28e7e1,_0x6b6aa3={}){const _0x1a5dda=this['editor']['model'],_0x27c33b=[];let _0x17affc=0x0;const _0x181a79='string'==typeof _0x28e7e1?{'main':_0x28e7e1}:_0x28e7e1;for(const _0x3302a1 of Object['keys'](_0x181a79)){if(!this['_document']['roots']['has'](_0x3302a1))throw new _0x3793cd('realtimecollaborationclient-init-non-existent-root',this);const _0x58cadb=this['_document']['getRoot'](_0x3302a1),_0x30d6c4=this['editor']['data']['parse'](_0x181a79[_0x3302a1],_0x58cadb),_0x5c6c8e=new _0x812ce(_0x1a5dda['createPositionAt'](_0x58cadb,0x0),_0x30d6c4,_0x17affc++);_0x27c33b['push'](_0x5c6c8e);for(const [_0x342d87,_0x2c9fd9]of _0x30d6c4['markers']){const _0x32a0f0=_0x1a5dda['createRange'](_0x1a5dda['createPositionFromPath'](_0x58cadb,_0x2c9fd9['start']['path']['slice']()),_0x1a5dda['createPositionFromPath'](_0x58cadb,_0x2c9fd9['end']['path']['slice']())),_0x502fa3=new _0x4955a2(_0x342d87,null,_0x32a0f0,_0x1a5dda['markers'],!0x0,_0x17affc++);_0x27c33b['push'](_0x502fa3);}}if(_0x6b6aa3)for(const [_0x191285,_0x1250fb]of Object['entries'](_0x6b6aa3)){const _0x7e4bed=_0x1a5dda['document']['getRoot'](_0x191285);if(!_0x7e4bed)throw new _0x3793cd('multi-root-editor-root-attributes-no-root',null);for(const [_0x2e50ee,_0x32e05d]of Object['entries'](_0x1250fb))if(null!==_0x32e05d){const _0x1b1f50=new _0x4ece14(_0x7e4bed,_0x2e50ee,null,_0x32e05d,_0x17affc++);_0x27c33b['push'](_0x1b1f50);}}return _0x27c33b;}async _loadRoot(_0xc3e647,_0x2fdba1,_0x3f0c2f){this['_getOperationsFromInitData']({[_0xc3e647]:_0x2fdba1},{[_0xc3e647]:_0x3f0c2f})['forEach']((_0x1ab4af,_0x204085)=>{_0x1ab4af['baseVersion']=this['_document']['version']+_0x204085,_0x1ab4af['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x1ab4af);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x41f684,_0x3d3254){let _0x13b78b;this['_offset']=_0x41f684['offset'];const _0x2f66fd=_0x41f684['wereChangesApplied']&&!_0x41f684['initData'],_0xa1f038=_0x2f66fd?0x0:_0x41f684['data']['baseVersion'];if(_0x3d3254['forEach'](_0x3bc580=>{_0x3bc580['_isInit']=!0x0,_0x3bc580['createdAt']=_0x41f684['sessionCreatedAt'],_0x3bc580['_authorId']=null;}),_0x2f66fd)_0x13b78b=_0x3d3254,this['_applyOperationsSet'](_0x13b78b,_0x2f66fd);else{if(_0x41f684['initData']){const _0x37f6da=this['_getOperationsFromInitData'](_0x41f684['initData']);this['_document']['history']['version']=-_0x37f6da['length'],_0x37f6da['forEach'](_0x53efbf=>{_0x53efbf['baseVersion']-=_0x37f6da['length'],_0x53efbf['createdAt']=_0x41f684['sessionCreatedAt'],_0x53efbf['_isInit']=!0x0,_0x53efbf['_authorId']=null;}),this['_applyOperationsSet'](_0x37f6da,!0x0),this['serverHistory']['version']=-_0x37f6da['length']+this['_offset'],this['_updateServerHistory'](_0x37f6da);}this['_document']['history']['version']=_0xa1f038,_0x13b78b=this['_decompressOperations'](_0x41f684['data'],_0x41f684['metadata']),await this['_fetchMissingUsers'](_0x13b78b),this['_applyOperationsSet'](_0x13b78b,_0x2f66fd);}_0x41f684['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x13b78b,_0x41f684['lastOperationId']),this['_lastSyncedOperationId']=_0x41f684['lastOperationId']),this['serverHistory']['version']=_0xa1f038+this['_offset'],this['_updateServerHistory'](_0x13b78b),_0x3d3254['filter'](_0x31841e=>{const _0x4c279f=this['_getAffectedRoot'](_0x31841e);return _0x4c279f&&!this['_knownRootNames']['has'](_0x4c279f);})['forEach']((_0x9347f6,_0x5a819f)=>{_0x9347f6['baseVersion']=this['_document']['version']+_0x5a819f,this['_saveOperationInBuffer'](_0x9347f6);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x3bd39d,_0xdfd9cc){const _0x3670c5=_0xdfd9cc&&_0xdfd9cc['message'];if(_0x3670c5&&_0x3670c5['startsWith']('realtimecollaborationclient'))throw _0xdfd9cc;const _0x15b0d6=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x15b0d6['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x3793cd(_0x3bd39d,this['editor'],_0x3670c5?{'originalError':_0x3670c5}:void 0x0);}_saveOperationInBuffer(_0x295c38){this['_knownOperations']['has'](_0x295c38)||(this['_knownOperations']['add'](_0x295c38),this['_bufferedOperations']['push'](_0x295c38),this['_pendingAction']||'marker'==_0x295c38['type']&&!_0x295c38['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x3be581=!0x1){!_0x3be581&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x4a4bf5=>{_0x4a4bf5&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x1e2f0f=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x2c17e2){return _0x2c17e2['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2c17e2['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x2c17e2['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x1e2f0f)||this['_crash'](_0x1e2f0f['message'],_0x1e2f0f);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x57feac=>{this['on']('change:_isPendingUpdate',()=>{_0x57feac();});});}async _sendBufferedOperations(){const _0x314e07=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x314e07['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x10fc27=[...this['_bufferedOperations']];for(const _0xc9c52f of _0x10fc27)_0xc9c52f['wasUndone']=this['_document']['history']['isUndoneOperation'](_0xc9c52f);const _0x1f66b9=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x10fc27),_0x324cef=Z++,_0xd39cea=this['_compressOperations'](_0x10fc27),_0x5185e9=await this['_service']['sendOperations'](_0xd39cea,_0xd39cea['baseVersion'],_0x1f66b9);try{return await this['_handleServerResponse'](_0x10fc27,_0x5185e9,_0x324cef);}catch(_0x3f6f91){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3f6f91);}}async['_handleServerResponse'](_0x385cf2,_0x23c6b9,_0x5997e3){if('error'in _0x23c6b9)throw _0x23c6b9['error'];let _0x1c9f5a;if(_0x23c6b9['wereChangesApplied']){_0x23c6b9['lastOperationId']&&(this['_lastSyncedOperationId']=_0x23c6b9['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1a26a0=>!_0x385cf2['includes'](_0x1a26a0));for(const _0x370cab of _0x385cf2)_0x370cab['createdAt']='lastOperationAcceptedAt'in _0x23c6b9&&_0x23c6b9['lastOperationAcceptedAt']||void 0x0;st(_0x385cf2,_0x23c6b9['version']-_0x385cf2['length']),this['_updateServerHistory'](_0x385cf2);const _0x4a8d7a=_0x385cf2['filter'](_0x547178=>{if(!_0x547178['_isInit'])return!0x1;const _0x485ad1=this['_getAffectedRoot'](_0x547178);return _0x485ad1&&!this['_knownRootNames']['has'](_0x485ad1);});st(_0x4a8d7a,this['_document']['version']),this['_applyOperationsSet'](_0x4a8d7a),_0x1c9f5a=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0xc02c1f=this['_decompressOperations'](_0x23c6b9['data'],_0x23c6b9['metadata'])['filter'](_0x2c2236=>_0x2c2236['baseVersion']>=this['_lastServerVersion']);_0xc02c1f['forEach'](_0x574c96=>this['_addKnownRoot'](_0x574c96)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x53014f=>!_0x53014f['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x53014f))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0xc02c1f),_0x1c9f5a=this['_handleExternalOperations'](_0xc02c1f,_0x23c6b9['version'],_0x23c6b9['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x1c9f5a?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x109fc9,_0xad4fdb,_0x5db956){try{const _0x3e348a={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x3601be,operationsB:_0x1e8d15,originalOperations:_0x315ec1}=_0x53ed02(_0x109fc9,this['_bufferedOperations'],_0x3e348a);st(_0x3601be,this['_document']['version']),st(_0x1e8d15,_0xad4fdb);for(const _0x316dc7 of _0x3601be){const _0x56b13b=_0x315ec1['get'](_0x316dc7);_0x56b13b?(_0x316dc7['_authorId']=_0x56b13b['_authorId'],'noop'!==_0x316dc7['type']&&(_0x316dc7['_aiSource']=_0x56b13b['_aiSource'])):_0x316dc7['_authorId']=null;}for(const _0x210427 of _0x1e8d15)'noop'!==_0x210427['type']&&(_0x210427['_aiSource']=_0x315ec1['get'](_0x210427)?.['_aiSource']);_0x5db956&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x109fc9,_0x5db956),this['_lastSyncedOperationId']=_0x5db956),this['_bufferedOperations']=[..._0x1e8d15],this['_applyOperationsSet'](_0x3601be),this['_updateServerHistory'](_0x109fc9);}catch(_0x4383f1){return console['error'](_0x4383f1),!0x1;}return!0x0;}_applyOperationsSet(_0x572c95,_0x246770=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x457ea7=>{for(const _0x4c47f9 of _0x572c95)this['_knownOperations']['add'](_0x4c47f9),this['_addKnownRoot'](_0x4c47f9),_0x457ea7['batch']['addOperation'](_0x4c47f9),this['editor']['model']['applyOperation'](_0x4c47f9);});}_addKnownRoot(_0x400f30){const _0x33e0f6=this['_getAffectedRoot'](_0x400f30);_0x33e0f6&&this['_knownRootNames']['add'](_0x33e0f6);}_getAffectedRoot(_0x33386b){let _0x29ecee,_0x1d516d;switch(_0x33386b['type']){case'insert':_0x29ecee=_0x33386b['position']['root'];break;case'marker':if(_0x1d516d=_0x33386b['newRange'],!_0x1d516d)return null;_0x29ecee=_0x1d516d['root'];break;case'addRootAttribute':_0x29ecee=_0x33386b['root'];break;case'addRoot':_0x29ecee=_0x33386b['affectedSelectable'];break;case'move':_0x29ecee=_0x33386b['targetPosition']['root'];break;default:return null;}return _0x29ecee['rootName'];}_updateServerHistory(_0x4c11fb){_0x4c11fb['forEach'](_0x4bca50=>{const _0x4f7d4d=_0x4bca50['clone']();_0x4f7d4d['_authorId']=_0x4bca50['_authorId'],_0x4f7d4d['_isInit']=!!_0x4bca50['_isInit'],_0x4f7d4d['_aiSource']=_0x4bca50['_aiSource'],_0x4f7d4d['createdAt']=_0x4bca50['createdAt'],_0x4f7d4d['baseVersion']+=this['_offset'],_0x4bca50['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x4f7d4d),this['serverHistory']['addOperation'](_0x4f7d4d);});}_handleReconnectionError(_0x1e58ba){const _0x6d605=this['editor']['plugins']['get']('Notification'),_0x4abb26=this['editor']['locale'];_0x1e58ba||(_0x1e58ba=X(_0x4abb26,'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.')),_0x6d605['showWarning'](_0x1e58ba,{'title':X(_0x4abb26,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x4f34ce)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x4f34ce)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x1ecf7d){const _0xc0c0be=_0x1ecf7d['map'](_0x5a680c=>_0x5a680c['toJSON']());return this['_compressor']['compress'](_0xc0c0be);}_decompressOperations(_0x582bfa,_0x334d48){return this['_compressor']['decompress'](_0x582bfa)['map']((_0x380f99,_0x400b0c)=>{const _0x3a600d='init'==_0x334d48[_0x400b0c]['type'];if('InsertOperation'==_0x380f99['__className']){const _0x2c1aa8=_0x380f99['position']['root'];!this['_document']['getRoot'](_0x2c1aa8)&&(this['_document']['createRoot']('$unknown',_0x2c1aa8)['_isAttached']=!0x1);}else{if('RootOperation'==_0x380f99['__className']){const _0x41427f=this['_document']['getRoot'](_0x380f99['rootName']);_0x41427f&&'$unknown'==_0x41427f['name']&&_0x380f99['elementName']!=_0x41427f['name']&&(_0x41427f['name']=_0x380f99['elementName']);}}const _0x2b3443=_0x3db4a7['fromJSON'](_0x380f99,this['_document']);return _0x2b3443['wasUndone']=_0x380f99['wasUndone'],_0x2b3443['_isInit']=_0x3a600d,_0x2b3443['_authorId']=_0x3a600d?null:_0x334d48[_0x400b0c]['userId'],_0x2b3443['_isDisconnection']='cs:removeUser'===_0x334d48[_0x400b0c]['type'],_0x2b3443['_aiSource']=_0x380f99['_aiSource']||void 0x0,_0x2b3443['createdAt']=_0x334d48[_0x400b0c]['createdAt'],_0x2b3443;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x35d4c2=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x35d4c2&&_0x35d4c2['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x475c48,_0x2fa779){for(const _0x1ffd46 of _0x475c48)_0x1ffd46['baseVersion']=_0x2fa779++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x223e01){this['_ignoredOperations']=_0x223e01,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x3c1d6b){let _0xdeb38d=_0x3c1d6b['length'];for(;_0xdeb38d--;){const _0x44cd2c=_0x3c1d6b[_0xdeb38d];if(!this['_ignoredOperations']['has'](_0x44cd2c)){if(!this['_operationToId']['has'](_0x44cd2c)){const _0x21f74d=_0x26b079()['slice'](0x1,0x12);this['_operationToId']['set'](_0x44cd2c,_0x21f74d);}return this['_operationToId']['get'](_0x44cd2c);}}}setIdForTheLastOperation(_0x101ff9,_0x400655){if(!_0x400655)return;let _0x326300=_0x101ff9['length'];for(;_0x326300--;){const _0x539b07=_0x101ff9[_0x326300];this['_ignoredOperations']['has'](_0x539b07)||this['_operationToId']['set'](_0x539b07,_0x400655);}}},nt=class extends _0x182d58{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x5383fe{static CommentsService=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x5c5423)());['_services'];static get requires(){return[z,_0xc1d332,Y,_0x326fdb];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x178daf){super(_0x178daf),this['_services']=new Map();}async init(){const _0x4ffedb=this['context'],_0x220c99=_0x4ffedb['plugins']['get'](_0xc1d332);if(_0x4ffedb['plugins']['get'](z)['addToReconnectionStack'](this),_0x220c99['adapter']={'addCommentThread':async({channelId:_0x1a5103,threadId:_0x14264f,comments:_0x376952,resolvedAt:_0x302d84,resolvedBy:_0x2d563a,context:_0x105304,attributes:_0x321b33})=>{const _0x1f3a56=await this['_getService'](_0x1a5103)['addCommentThread']({'commentThreadId':_0x14264f,'comments':_0x376952['map'](_0x20be87=>function(_0x5d813a,_0x40f8a7,_0x420cd5){return{'commentThreadId':_0x420cd5,'commentId':_0x5d813a['commentId'],'userId':_0x5d813a['authorId'],'content':_0x5d813a['content'],'documentId':_0x40f8a7,'createdAt':_0x5d813a['createdAt'],'attributes':_0x5d813a['attributes']||{}};}(_0x20be87,_0x1a5103,_0x14264f)),'resolvedAt':_0x302d84,'resolvedBy':_0x2d563a,'context':_0x105304,'attributes':_0x321b33})['catch'](ct);return{'threadId':_0x1f3a56['commentThreadId'],'comments':_0x1f3a56['comments']};},'getCommentThread':async({channelId:_0x3097c8,threadId:_0x517e17})=>{const _0x57dd88=await this['_getService'](_0x3097c8)['getCommentThread'](_0x517e17)['catch'](rt)['catch'](ct);return _0x57dd88?_0x57dd88['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x57dd88]),{'threadId':_0x57dd88['commentThreadId'],'comments':_0x57dd88['comments']['map'](at),'context':_0x57dd88['context'],'resolvedAt':_0x57dd88['resolvedAt'],'resolvedBy':_0x57dd88['resolvedBy'],'attributes':_0x57dd88['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x3b085d,threadId:_0x46be81,context:_0x18c918,unlinkedAt:_0x1831b9,attributes:_0x263ab1})=>this['_getService'](_0x3b085d)['updateCommentThread']({'commentThreadId':_0x46be81,'context':_0x18c918,'attributes':_0x263ab1,'unlinkedAt':_0x1831b9})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x6afdb8,threadId:_0x5ad0da})=>{const _0x1181e9=await this['_getService'](_0x6afdb8)['resolveCommentThread'](_0x5ad0da)['catch'](rt)['catch'](ct);return{'threadId':_0x1181e9['commentThreadId'],'resolvedAt':_0x1181e9['resolvedAt'],'resolvedBy':_0x1181e9['resolvedBy']};},'reopenCommentThread':async({channelId:_0x1dc277,threadId:_0x58daaa})=>this['_getService'](_0x1dc277)['reopenCommentThread'](_0x58daaa)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x24cfb7,threadId:_0x91c29c})=>this['_getService'](_0x24cfb7)['removeCommentThread'](_0x91c29c)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x11225a,threadId:_0x55b922,commentId:_0x1bc696,content:_0x126c59,attributes:_0x3a7104})=>this['_getService'](_0x11225a)['addComment'](_0x55b922,_0x1bc696,_0x126c59,_0x3a7104)['catch'](ct),'updateComment':({channelId:_0x40060f,threadId:_0x21f9f3,commentId:_0x56f38f,content:_0x47dc31,attributes:_0xb0dca7})=>this['_getService'](_0x40060f)['updateComment'](_0x21f9f3,_0x56f38f,_0x47dc31,_0xb0dca7)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x1ac2f0,threadId:_0x53beab,commentId:_0x34b746})=>this['_getService'](_0x1ac2f0)['removeComment'](_0x53beab,_0x34b746)['catch'](rt)['catch'](ct)},_0x4ffedb instanceof _0x4be23b){const _0x5b783d=_0x4ffedb['config']['get']('collaboration.channelId'),_0x26fe01=_0x4ffedb['plugins']['get'](Y);await this['_setUpService'](_0x5b783d);const _0x3918ea=await this['_services']['get'](_0x5b783d)['getConnectedSessions']();this['listenTo'](_0x26fe01,'sessionAdd:'+_0x5b783d,(_0x3af277,{session:_0x5886d2})=>{_0x5886d2['id']===_0x26fe01['mySessionId']&&(_0x3af277['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x5886d2['permissions'],_0x5b783d));}),_0x26fe01['register'](_0x5b783d,_0x3918ea);}}async _setUpService(_0x48192){if(this['_services']['has'](_0x48192))throw new _0x3793cd('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x48192});const _0xbe483e=this['context']['plugins']['get'](_0xc1d332),_0x1099fd=new CloudServicesCommentsAdapter['CommentsService'](_0x48192);this['_services']['set'](_0x48192,_0x1099fd),this['listenTo'](_0x1099fd,'commentThreadAdded',(_0x5e33b6,_0x36d34d)=>{const {commentThreadId:_0x45661a,documentId:_0x1d6fec,context:_0x11605f,attributes:_0x270e5a,resolvedAt:_0x3794e6,resolvedBy:_0x57f939,comments:_0xdd377d}=_0x36d34d;_0xbe483e['getCommentThread'](_0x45661a)||_0xbe483e['addCommentThread']({'threadId':_0x45661a,'channelId':_0x1d6fec,'comments':_0xdd377d?_0xdd377d['map'](at):[],'context':_0x11605f,'attributes':_0x270e5a,'resolvedAt':_0x3794e6,'resolvedBy':_0x57f939,'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentThreadUpdated',(_0x2897ca,{commentThreadId:_0x19d315,documentId:_0x48ba58,context:_0x15e591,unlinkedAt:_0x3a58ca,attributes:_0x1f4341})=>{_0xbe483e['getCommentThread'](_0x19d315)&&_0xbe483e['updateCommentThread']({'threadId':_0x19d315,'channelId':_0x48ba58,'context':_0x15e591,'unlinkedAt':_0x3a58ca,'attributes':_0x1f4341,'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentThreadResolved',(_0x386a2e,{commentThreadId:_0xab1aac,resolvedBy:_0x1a7cad,resolvedAt:_0x19b806})=>{const _0x40806e=_0xbe483e['getCommentThread'](_0xab1aac);_0x40806e&&_0x40806e['resolve']({'resolvedBy':_0x1a7cad,'resolvedAt':_0x19b806,'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentThreadReopened',(_0x5a58ed,{commentThreadId:_0x223a8b})=>{const _0x580824=_0xbe483e['getCommentThread'](_0x223a8b);_0x580824&&_0x580824['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentThreadRemoved',(_0x2589a7,{commentThreadId:_0x5bdda6})=>{const _0x284ff2=_0xbe483e['getCommentThread'](_0x5bdda6);_0x284ff2&&_0x284ff2['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentAdded',(_0x2e275b,_0x1d13d3)=>{const _0x4e5c14=_0x1d13d3['commentThreadId'],_0x3b653d=_0xbe483e['getCommentThread'](_0x4e5c14);_0x3b653d&&_0x3b653d['addComment']({...at(_0x1d13d3),'isFromAdapter':!0x0});}),this['listenTo'](_0x1099fd,'commentUpdated',(_0xdcc506,{commentThreadId:_0x433fa7,commentId:_0x5995b4,content:_0x191087,attributes:_0x48cfa0})=>{const _0x57d29d=_0xbe483e['getCommentThread'](_0x433fa7);if(_0x57d29d){const _0x2faf1e=_0x57d29d['getComment'](_0x5995b4);_0x2faf1e&&_0x2faf1e['update']({'content':_0x191087,'attributes':_0x48cfa0,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1099fd,'commentRemoved',(_0x3fccaa,{commentThreadId:_0x54704f,commentId:_0x754bf3})=>{const _0x22b696=_0xbe483e['getCommentThread'](_0x54704f);if(_0x22b696){const _0xad336b=_0x22b696['getComment'](_0x754bf3);_0xad336b&&_0xad336b['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x1099fd,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x48192),this['stopListening'](_0x1099fd));}),await this['_connectService'](_0x48192);}destroy(){if(this['context']instanceof _0x4be23b){const _0x513387=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x513387)&&this['_terminateService'](_0x513387);}}_terminateService(_0x51d838){if(!this['_services']['has'](_0x51d838))throw new _0x3793cd('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x51d838});this['_getService'](_0x51d838)['disconnect'](),this['_services']['delete'](_0x51d838);}async reconnect(){for(const _0x354646 of this['_services']['keys']())await this['_connectService'](_0x354646);if(this['context']instanceof _0x4be23b){const _0x2174ff=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x2174ff)){const _0x5cc79a=this['context']['plugins']['get'](Y);_0x5cc79a['unregister'](_0x2174ff);const _0x4e5af2=await this['_services']['get'](_0x2174ff)['getConnectedSessions']();_0x5cc79a['register'](_0x2174ff,_0x4e5af2);}}}async _connectService(_0x25754c){const {connection:_0x24345d}=this['context']['plugins']['get'](z),_0x172abb=this['context']['plugins']['get'](_0xc1d332),_0xbd62=await this['_services']['get'](_0x25754c)['connect'](_0x24345d);await this['_fetchMissingUsersForThreads'](_0xbd62);const _0x152c65=new Set(Array['from'](_0x172abb['getCommentThreads']({'channelId':_0x25754c}),_0x46a394=>_0x46a394['id']));for(const _0x330a70 of _0xbd62)_0x330a70['deletedAt']||_0x152c65['delete'](_0x330a70['commentThreadId']);for(const _0x4ab74b of _0x152c65)_0x172abb['getCommentThread'](_0x4ab74b)['remove']({'isFromAdapter':!0x0});for(const _0x1c319c of _0xbd62){let _0x594e25=_0x172abb['getCommentThread'](_0x1c319c['commentThreadId']);const {commentThreadId:_0x2166a3,context:_0x46f958,attributes:_0x24d8f9,resolvedBy:_0x20eef0,resolvedAt:_0x5c3013,unlinkedAt:_0x547867,deletedAt:_0x55c106}=_0x1c319c;if(_0x55c106)continue;_0x594e25||(_0x594e25=_0x172abb['addCommentThread']({'channelId':_0x25754c,'threadId':_0x2166a3,'context':_0x46f958,'attributes':_0x24d8f9||{},'resolvedBy':_0x20eef0,'resolvedAt':_0x5c3013,'unlinkedAt':_0x547867,'isFromAdapter':!0x0}));const _0x479809=new Set(Array['from'](_0x594e25['comments'],_0x30aca5=>_0x30aca5['id']));for(const _0x285989 of _0x1c319c['comments'])_0x479809['delete'](_0x285989['commentId']);for(const _0xa96d09 of _0x479809)_0x594e25['getComment'](_0xa96d09)['remove']({'isFromAdapter':!0x0});for(const _0x29d771 of _0x1c319c['comments']){const _0x51180d=_0x594e25['getComment'](_0x29d771['commentId']);_0x51180d?_0x51180d['content']!==_0x29d771['content']&&_0x51180d['update']({'content':_0x29d771['content'],'isFromAdapter':!0x0}):_0x594e25['addComment'](Object['assign'](at(_0x29d771),{'isFromAdapter':!0x0}));}}}_getService(_0x1fac26){if(!this['_services']['has'](_0x1fac26))throw new _0x3793cd('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x1fac26});return this['_services']['get'](_0x1fac26);}async _fetchMissingUsersForThreads(_0x4cbbdc){const _0xe62fd9=this['context']['plugins']['get'](_0x326fdb),{connection:_0x2f45f8}=this['context']['plugins']['get'](z),_0x4122f0=new Set();for(const {resolvedBy:_0x241c6e,comments:_0x5748cf}of _0x4cbbdc){_0x241c6e&&!_0xe62fd9['getUser'](_0x241c6e)&&_0x4122f0['add'](_0x241c6e);for(const {userId:_0x141fcb}of _0x5748cf)_0xe62fd9['getUser'](_0x141fcb)||_0x4122f0['add'](_0x141fcb);}if(0x0===_0x4122f0['size'])return;const _0x4e6ae4=await _0x198d99['getMany'](_0x2f45f8,Array['from'](_0x4122f0));for(const _0x4545e1 of _0x4e6ae4)_0xe62fd9['getUser'](_0x4545e1['id'])||_0xe62fd9['addUser'](_0x4545e1);}};async function rt(_0x5ed07f){if('404'!==_0x5ed07f['code'])throw _0x5ed07f;}function ct(_0x42857a){if((_0x5b949f=_0x42857a)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x5b949f['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x5b949f['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x5b949f;throw _0x42857a;}function at(_0x301e79){return{'threadId':_0x301e79['commentThreadId'],'commentId':_0x301e79['commentId'],'content':_0x301e79['content'],'createdAt':_0x301e79['createdAt'],'authorId':_0x301e79['userId'],'attributes':_0x301e79['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x182d58{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>_0x4a2ecf)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x31da8d,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x335a7d){super(_0x335a7d);const _0x31c49e=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x31c49e);}init(){const _0x13ffb0=this['editor']['plugins']['get'](z),_0x554093=this['editor']['plugins']['get'](_0x31da8d);return _0x554093['adapter']={'getSuggestion':async _0x16507c=>{await this['_waitForServiceReady']();const _0xd5e306=await this['_trackChangesService']['get'](_0x16507c)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0xd5e306]),_0xd5e306;},'addSuggestion':async({id:_0x3f6ecf,type:_0x364366,data:_0x2a2e01,originalSuggestionId:_0x44aedd,attributes:_0x5243f8})=>{await this['_waitForServiceReady']();const _0x123e01={'id':_0x3f6ecf,'type':_0x364366,'data':_0x2a2e01,'originalSuggestionId':_0x44aedd,'attributes':_0x5243f8},_0x43b3a8=await this['_trackChangesService']['add'](_0x3f6ecf,_0x364366,_0x2a2e01,_0x44aedd,_0x5243f8)['catch'](_0x54f40a=>{if(dt(_0x54f40a))return new Promise(_0x1691e4=>{this['_bufferedRequests']['set'](_0x3f6ecf,{'resolve':_0x1691e4,'suggestionData':_0x123e01});});throw _0x54f40a;});return this['_bufferedRequests']['delete'](_0x3f6ecf),_0x43b3a8;},'updateSuggestion':async(_0x245b4e,_0x4e4d3d)=>{if(await this['_waitForServiceReady'](),'open'!==_0x4e4d3d['state'])return this['_trackChangesService']['update'](_0x245b4e,_0x4e4d3d)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x1ef248,_0x4494af)=>{_0x554093['hasSuggestion'](_0x4494af['id'])&&(_0x554093['getSuggestion'](_0x4494af['id'])['attributes']=_0x4494af['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x13ffb0['connection']?.['state']&&(_0x13ffb0['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x13ffb0['connection'])['then'](_0x234712=>(_0x13ffb0['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x234712)['then'](()=>{for(const _0x2e8bb2 of _0x234712){_0x554093['addSuggestionData'](_0x2e8bb2)['_saved']=!0x0;}})));}async reconnect(){const _0x3f97f2=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x5d9b5a}=this['editor']['plugins']['get'](z),_0x1109ff=await this['_trackChangesService']['connect'](_0x5d9b5a);await this['_fetchMissingUsersForThreads'](_0x1109ff);for(const {suggestionData:_0x4374c7,resolve:_0x462df1}of this['_bufferedRequests']['values']()){let _0x5b4fb2=_0x1109ff['find'](_0x4877e7=>_0x4877e7['id']===_0x4374c7['id']);_0x5b4fb2||(_0x5b4fb2=await this['_trackChangesService']['add'](_0x4374c7['id'],_0x4374c7['type'],_0x4374c7['data'],_0x4374c7['originalSuggestionId'])),_0x462df1(_0x5b4fb2);}for(const _0x9588b1 of _0x1109ff)_0x3f97f2['hasSuggestion'](_0x9588b1['id'])||_0x3f97f2['addSuggestionData'](_0x9588b1);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x6f71d0=>{this['listenTo'](this['_trackChangesService'],'connected',_0x37eddc=>{_0x37eddc['off'](),_0x6f71d0();});});}async _fetchMissingUsersForThreads(_0x3f6b44){const _0x5c913d=this['editor']['plugins']['get'](_0x326fdb),{connection:_0x40e7c3}=this['editor']['plugins']['get'](z),_0x3557f2=new Set();for(const {authorId:_0x4094a0}of _0x3f6b44)_0x5c913d['getUser'](_0x4094a0)||_0x3557f2['add'](_0x4094a0);if(0x0===_0x3557f2['size'])return;const _0x55f542=await _0x198d99['getMany'](_0x40e7c3,Array['from'](_0x3557f2));for(const _0x335b23 of _0x55f542)_0x5c913d['getUser'](_0x335b23['id'])||_0x5c913d['addUser'](_0x335b23);}};function lt(_0x94fa0f){if(dt(_0x94fa0f))return new Promise(()=>{});throw _0x94fa0f;}function dt(_0x19a52a){return _0x19a52a['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x19a52a['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x182d58{static get requires(){return[_0x4ddf0e,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x5d13c=this['editor']['plugins']['get'](z),_0x967f0a=this['editor']['plugins']['get'](_0x4ad914),_0xe2db2a=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x5d13c,'change:state',(_0x39bee7,_0x3febce,_0x367d5b)=>{_0x967f0a['isThreadsLoadingPaused']='connected'!==_0x367d5b;});}),this['listenTo'](_0x5d13c,'change:state',(_0xa432b0,_0x573705,_0x41304e)=>{this['editor']['plugins']['get'](_0xc1d332)['switchReadOnly']('connected'!==_0x41304e);}),_0xe2db2a['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x53fdbc=this['editor']['plugins']['get'](ot),_0x3d955b=this['editor']['config']['get']('collaboration.channelId');_0x53fdbc['_services']['has'](_0x3d955b)&&_0x53fdbc['_terminateService'](_0x3d955b),super['destroy']();}},ft=class extends _0x182d58{static get requires(){return[ut,ht,_0x18abce];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x182d58{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
+ ((()=>_0x142660)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x5f0e50,Y,_0x326fdb];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xb845f8){super(_0xb845f8);const _0x407079=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x407079);}async init(){const _0x48df2f=this['editor']['plugins']['get'](tt),_0x28bb6c=_0x48df2f['serverHistory'],_0x494ce7=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x28bb6c,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x48df2f['sessionId']});const _0x5ebd8c=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x4b7de2,_0x375849=await _0xb6b90c['isBundleUploaded'](_0x494ce7['connection'],_0x5ebd8c);this['editor']['plugins']['get'](_0x5f0e50)['adapter']={'getRevision':async({revisionId:_0x13ce8c})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x13ce8c)),'updateRevisions':async _0x2df615=>{await this['_waitForServiceReady']();const _0x5736a2=this['_revisionTracker']['currentRevision'];if(_0x375849&&0x1===_0x2df615['length']&&_0x2df615[0x0]['id']===_0x5736a2['id'])return _0x2df615;for(const _0x5bbd27 of _0x2df615)_0x5bbd27['id']===_0x5736a2['id']&&(_0x5bbd27['isEmptyCurrent']=_0x5bbd27['fromVersion']===_0x5bbd27['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x2df615,this['_lastRequestId'])['then'](_0x2ba981=>(this['_lastRequestId']=_0x2ba981,_0x2df615))['catch'](_0xfea5f1=>{if(pt(_0xfea5f1)||'400'===_0xfea5f1['code']&&void 0x0!==_0xfea5f1['data']['wrongRequestId']){for(const _0x509260 of _0x2df615)this['_revisionTracker']['repository']['getRevision'](_0x509260['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x509260['id'],_0x509260,!0x1);if(pt(_0xfea5f1)&&'destroyed'!==this['editor']['state'])throw _0xfea5f1;return _0x2df615;}throw _0xfea5f1;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3ec62a,{revisionsData:_0x5bbd3c,requestId:_0x2d9036})=>{Math['max'](..._0x5bbd3c['map'](_0x4d6952=>_0x4d6952['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x5bbd3c,_0x2d9036);}):this['_handleRevisionsUpdate'](_0x5bbd3c,_0x2d9036);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x494ce7['connection']?.['state']&&(_0x494ce7['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x378450,requestId:_0x2551b0}=await this['_revisionHistoryService']['connect'](_0x494ce7['connection']);_0x494ce7['addToReconnectionStack'](this),this['_lastRequestId']=_0x2551b0,await this['_fetchMissingUsers'](_0x378450);for(const _0x49af90 of _0x378450)this['_revisionTracker']['addRevisionData'](_0x49af90);this['listenTo'](_0x48df2f,'change:_isConnected',(_0x2e9ebd,_0x4d1486,_0x20dca9)=>{_0x20dca9&&(this['_oldOffset']=_0x48df2f['_offset'],_0x2e9ebd['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x40e422=this['editor']['plugins']['get'](z),_0x45f675=this['editor']['plugins']['get'](tt),_0x4e6c53=async()=>{const _0x3b0245=this['_revisionTracker']['currentRevision'],_0x225e6e=_0x3b0245['id'],_0x457f4e=_0x225e6e!==_0x45f675['sessionId'];if(_0x457f4e){const _0xf3b93d=_0x45f675['_offset']-this['_oldOffset'],_0x514de7=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x3b0245['toVersion']+_0xf3b93d!==_0x514de7){const _0xd2b49d=_0x3b0245['fromVersion']+_0xf3b93d,_0x198ff0=this['editor']['plugins']['get'](_0x326fdb),_0x41212f=this['_revisionTracker']['buildRevisionData']({'revision':_0x3b0245,'from':_0xd2b49d,'to':_0x514de7});_0x41212f['id']=_0x3b0245['id'];const _0x13fe1a=_0x41212f['authorsIds']['map'](_0x30fd66=>_0x198ff0['getUser'](_0x30fd66));_0x3b0245['_update']({..._0x41212f,'authors':_0x13fe1a},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x3b0245['id'],_0x41212f,!0x0);}this['_revisionTracker']['_startingVersion']=_0x514de7,_0x3b0245['toVersion']!==_0x3b0245['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x225e6e)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x225e6e),this['_revisionTracker']['_createCurrentRevision'](_0x514de7);}const {revisions:_0x610379,requestId:_0x20494a}=await this['_revisionHistoryService']['reconnect'](_0x40e422['connection'],this['_lastRequestId']);_0x457f4e&&_0x610379['length']>0x0?_0x45f675['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x610379),this['_handleRevisionsUpdate'](_0x610379,_0x20494a),this['_revisionTracker']['sendBufferedUpdates']());};return _0x45f675['_isConnected']?_0x4e6c53():new Promise((_0x560c12,_0x51d756)=>{_0x45f675['once']('change:_isConnected',()=>{_0x4e6c53()['then'](_0x560c12)['catch'](_0x51d756);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x42760f=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x260169=>{_0x260169['off'](),_0x42760f();});});}_getLatestVersionFromServerOperations(){const _0xc49f4b=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x25cced of _0xc49f4b)if('marker'!==_0x25cced['type']||_0x25cced['affectsData'])return _0x25cced['baseVersion']+0x1;}_getLatestVersion(){const _0x488492=this['editor']['plugins']['get'](tt);return new Promise(_0x90d794=>{_0x488492['_isPendingUpdate']?_0x488492['once']('change:_isPendingUpdate',()=>{_0x90d794(this['_getLatestVersionFromServerOperations']());}):_0x90d794(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x421667,_0x20d470){const _0x13b3a2=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x20d470;for(const _0x1f4a22 of _0x421667){const _0xc63e1b=_0x13b3a2['getRevision'](_0x1f4a22['id']);if(_0xc63e1b){if((_0x1f4a22['fromVersion']||_0x1f4a22['toVersion'])&&(_0x1f4a22['diffData']=null),_0xc63e1b===this['_revisionTracker']['currentRevision']){const _0x1b5018=Math['max'](_0xc63e1b['toVersion'],_0x1f4a22['toVersion']),_0xffe728=Math['max'](_0xc63e1b['fromVersion'],_0x1f4a22['fromVersion']);let _0x247944;_0xc63e1b['toVersion']===_0x1f4a22['toVersion']&&_0xc63e1b['fromVersion']===_0x1f4a22['fromVersion']?(_0x247944=!0x0,this['_preventResendingRevisionData'](_0x1f4a22)):_0x1f4a22['toVersion']===_0x1b5018&&_0x1f4a22['fromVersion']===_0xffe728?_0x247944=!0x1:(_0xc63e1b['toVersion']===_0x1b5018&&_0xc63e1b['fromVersion']===_0xffe728||this['_fixRevision']({'revision':_0xc63e1b,'from':_0xffe728,'to':_0x1b5018}),_0x247944=!0x0),_0x247944&&(delete _0x1f4a22['fromVersion'],delete _0x1f4a22['toVersion'],delete _0x1f4a22['diffData'],delete _0x1f4a22['createdAt'],delete _0x1f4a22['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x1f4a22),this['_preventResendingRevisionData'](_0x1f4a22);}else this['_revisionTracker']['addRevisionData'](_0x1f4a22);}const _0x18c4df=_0x13b3a2['getRevisions']();_0x18c4df['reverse']();for(let _0x7a2330=0x0;_0x7a2330<_0x18c4df['length']-0x1;_0x7a2330++){const _0x2cf06a=_0x18c4df[_0x7a2330],_0x3096a=_0x18c4df[_0x7a2330+0x1];if(_0x2cf06a['fromVersion']<_0x3096a['toVersion']){const _0x6cce8f=_0x3096a['toVersion'],_0x5ab973=Math['max'](_0x6cce8f,_0x2cf06a['toVersion']);this['_fixRevision']({'revision':_0x2cf06a,'from':_0x6cce8f,'to':_0x5ab973});}}}['_fixRevision']({revision:_0x3a423d,from:_0x5ad7c1,to:_0x3372bd}={}){const _0x15e1e7=this['editor']['plugins']['get'](_0x326fdb),_0x458e48=this['_revisionTracker']['buildRevisionData']({'revision':_0x3a423d,'from':_0x5ad7c1,'to':_0x3372bd});_0x458e48['authors']=_0x458e48['authorsIds']['map'](_0x1797b8=>_0x15e1e7['getUser'](_0x1797b8)),_0x3a423d['_update'](_0x458e48);}_preventResendingRevisionData(_0x472cd8){const _0xaa09e1={};_0xaa09e1['id']=_0x472cd8['id'];for(const _0x54288f of Object['keys'](_0x472cd8))'id'!==_0x54288f&&(_0xaa09e1[_0x54288f]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0xaa09e1['id'],_0xaa09e1,!0x0);}async _fetchMissingUsers(_0x300b77){const _0x18e48a=this['editor']['plugins']['get'](_0x326fdb),{connection:_0x42262c}=this['editor']['plugins']['get'](z),_0x42968e=new Set();for(const _0x8aad2b of _0x300b77){for(const _0x4d5438 of _0x8aad2b['authorsIds'])_0x4218c3(_0x4d5438);_0x8aad2b['creatorId']&&_0x4218c3(_0x8aad2b['creatorId']);}if(0x0===_0x42968e['size'])return;const _0xf051bb=await _0x198d99['getMany'](_0x42262c,Array['from'](_0x42968e));for(const _0x6026a5 of _0xf051bb)_0x18e48a['getUser'](_0x6026a5['id'])||_0x18e48a['addUser'](_0x6026a5);function _0x4218c3(_0x59db7b){_0x18e48a['getUser'](_0x59db7b)||_0x42968e['add'](_0x59db7b);}}};function pt(_0x2485ab){return _0x2485ab['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2485ab['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2485ab['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x182d58{static get requires(){return[_0x5f0e50,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x4fcb28{_collapseAt;constructor(_0x1ef3e5,_0x316620=0x6){super(_0x1ef3e5);const _0xca0f7=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x316620,this['bind']('isHidden')['to'](this,'usersCount',_0x549f11=>_0x549f11<_0x316620),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0xca0f7['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':_0xca0f7['to']('usersCount',_0x1b7abe=>'+'+(_0x1b7abe-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x4fcb28{items;keystrokes;constructor(_0x1707c4){super(_0x1707c4);const _0x39dfda=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x48672d(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x39dfda['if']('hasPopup'),'aria-expanded':_0x39dfda['to']('isExpanded',_0x75fce0=>this['hasPopup']&&String(_0x75fce0)),'aria-label':_0x39dfda['to']('hasPopup',_0x58925d=>X(_0x1707c4,_0x58925d?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x39dfda['to']('hasPopup',_0x1cb497=>!!_0x1cb497&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x39dfda['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x39dfda['to'](_0x447588=>{const _0x439892=_0x447588,_0x272226=document['querySelector']('.ck-presence-list__dropdown-list'),_0x2be7c1=document['querySelector']('.ck-balloon-panel_with-arrow');_0x272226?.['contains'](_0x439892['relatedTarget'])||_0x2be7c1?.['contains'](_0x439892['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x354d04,_0x3a5e1a,_0x54dd01)=>{this['element']&&(_0x54dd01?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},_t=class extends _0x4fcb28{counterView;inlineListView;constructor(_0x4d75e6,_0x44f8a0=0x6){super(_0x4d75e6);const _0x2cddc8=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x44f8a0),this['inlineListView']=new vt(_0x4d75e6),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x27813d of this['inlineListView']['items'])_0x27813d['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',_0x2cddc8['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x4fcb28{listWrapperView;constructor(_0x46b5f9,_0x3ae42c){super(_0x46b5f9);const _0x362352=this['bindTemplate'];this['listWrapperView']=new bt(_0x46b5f9,_0x3ae42c),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x46b5f9,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x362352['to'](_0x5bd87d=>{const _0x3115a2=_0x5bd87d,_0x3ed2a9=document['querySelector']('.ck-presence-list__list'),_0x2e0419=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3ed2a9?.['contains'](_0x3115a2['relatedTarget'])||_0x2e0419?.['contains'](_0x3115a2['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x4410a0{constructor(_0x75b8f4,_0x573ef3){super(_0x75b8f4);const _0x11daf3=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x573ef3?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x11daf3['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x11daf3['to']('role'),'aria-label':_0x11daf3['to']('ariaLabel'),'aria-labelledby':_0x11daf3['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x415cf5['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x1d4106=this['element'];_0x1d4106&&(this['_isScrollable']=Math['max'](_0x1d4106['scrollHeight'],_0x1d4106['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x2c05db{['userView'];constructor(_0x30d555,_0x565d1b,_0x2fecfc){super(_0x30d555);const _0x5b6fd6=this['bindTemplate'];this['userView']=new _0x4e3739(_0x30d555,_0x565d1b);const _0x41b3c1={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x565d1b['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x565d1b['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x565d1b['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x565d1b['color']['getColorVariable'](),'--ck-user-color-alpha':_0x565d1b['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x2fecfc&&(_0x41b3c1['tag']='button',_0x41b3c1['on']={'click':_0x5b6fd6['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x41b3c1);}['focus'](){this['element']['focus']();}},It=class extends _0x4fcb28{['userView'];['markerView'];constructor(_0x3f4496,_0x3ad6c2,_0xd69b91){super(_0x3f4496);const _0x13aa3d=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x4e3739(_0x3f4496,_0x3ad6c2),this['markerView']=new St(_0x3f4496,_0x3ad6c2);const _0x54c930=new _0x79a609(_0x3f4496);_0x54c930['template']['tag']='span',_0x54c930['text']=_0x3ad6c2['name'];const _0x2e8e70={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x13aa3d['to']('isFocusable',_0x28ad58=>!!_0x28ad58&&0x0),'aria-labelledby':_0x54c930['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x13aa3d['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x13aa3d['to']('hasTooltip',_0x2511c3=>!_0x2511c3),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x54c930]};_0xd69b91&&(_0x2e8e70['tag']='button',_0x2e8e70['on']={'click':_0x13aa3d['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2e8e70);}},St=class extends _0x4fcb28{constructor(_0x3ae204,_0x3aee1d){super(_0x3ae204),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3aee1d['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x3aee1d['color']['getColorVariable'](),'--ck-user-color-alpha':_0x3aee1d['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x5383fe{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5eec6a){super(_0x5eec6a),this['context']['config']['define']('presenceList',Tt);const _0x24afa9=_0x5eec6a['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x24afa9)throw new _0x3793cd('presencelist-collapseat-invalid-format',this);if(_0x24afa9<0x1)throw new _0x3793cd('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x43ba52(),this['balloonPanelView']=new _0x41d86b(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x237b97 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x237b97);this['listenTo'](this['_allConnectedUsers'],'add',(_0x26e96a,_0x27bad7)=>{this['_handleUserAdd'](_0x27bad7);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x7f0bf3,_0x4abe1f)=>{this['_handleUserRemove'](_0x4abe1f);});}_createView(){const _0x3c8016=this['context'],_0x2ee260=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x1181c0=this['balloonPanelView'];if(!_0x4b1f95(_0x3c8016['config']['get']('presenceList.container')))throw new _0x3793cd('presencelist-missing-container',this);return _0x2ee260['counterView']['bind']('usersCount')['to'](this),_0x2ee260['bind']('isCollapsed')['to'](this,'usersCount',_0x440970=>{const {collapseAt:_0x46511f}=_0x3c8016['config']['get']('presenceList'),_0x439ee3=_0x440970>=_0x46511f;if(_0x439ee3&&!_0x2ee260['inlineListView']['items']['find'](_0x4df0f2=>_0x4df0f2 instanceof wt)){const _0x108475=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x108475&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x2ee260['inlineListView']['items']['add'](_0x2ee260['counterView']);}return _0x439ee3||this['hideDropdown'](),_0x439ee3;}),_0x2ee260['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x4c4c7d=>{const _0x4e46e8=_0x3c8016['config']['get']('presenceList'),_0x34ed3f=new It(_0x3c8016['locale'],_0x4c4c7d,!!_0x4e46e8['onClick']);return _0x34ed3f['bind']('hasTooltip')['to'](_0x2ee260,'isCollapsed',_0x180e69=>!_0x180e69),_0x34ed3f['bind']('isFocusable')['to'](_0x2ee260,'isCollapsed',_0xae2272=>!_0xae2272),_0x4e46e8['onClick']&&this['listenTo'](_0x34ed3f,'execute',()=>{this['view']['isCollapsed']||_0x4e46e8['onClick'](_0x4c4c7d,_0x34ed3f['element']);}),_0x34ed3f;}),this['listenTo'](_0x2ee260['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x2ee260['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x2ee260['inlineListView']['keystrokes']['set']('Enter',(_0xb47333,_0x6ca41b)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x6ca41b());}),_0x2ee260['render'](),_0x1181c0['render'](),_0x1ef56d({'emitter':_0x2ee260,'activator':()=>_0x1181c0['isVisible'],'contextElements':[_0x1181c0['element'],_0x2ee260['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x3c8016['config']['get']('presenceList.container')['appendChild'](_0x2ee260['element']),this['_bodyCollection']=new _0x2c3ba0(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x2ee260;}['_handleUserAdd'](_0x410b86){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x410b86['isMe'])return;const _0x5455e6=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x5455e6-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x32decc=_0x410b86['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x410b86,_0x32decc);}['_handleUserRemove'](_0x2c349b){this['usersCount']--;const {collapseAt:_0x5174de}=this['context']['config']['get']('presenceList'),_0x1a3737=this['usersCount']>=_0x5174de;if(this['currentDisplayedUsers']['get'](_0x2c349b['id']))this['currentDisplayedUsers']['remove'](_0x2c349b['id']);else{if(_0x1a3737&&this['currentDisplayedUsers']['length']+0x1===_0x5174de-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x1a3737?0x1:0x0)<this['usersCount']){for(const _0x52f80a of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x52f80a['id'])&&(this['currentDisplayedUsers']['add'](_0x52f80a,Math['min'](this['currentDisplayedUsers']['length']-(_0x1a3737?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x1a3737?0x1:0x0)===_0x5174de-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x49f2ba=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x49f2ba['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x293352}=this['presenceDropdownView'];_0x293352['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x113bd4=>{if(!_0x49f2ba['displayMe']&&_0x113bd4['isMe'])return null;const _0xddf5e0=new kt(this['context']['locale'],_0x113bd4,!!_0x49f2ba['onClick']);return _0x49f2ba['onClick']&&this['listenTo'](_0xddf5e0,'execute',()=>{_0x49f2ba['onClick'](_0x113bd4,_0xddf5e0['element']);}),_0xddf5e0;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x293352['focus'](),_0x293352['checkIfScrollable']();const _0x21a4f5=(_0x273153,_0x36e335)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x36e335();};_0x293352['keystrokes']['set']('Esc',_0x21a4f5),_0x293352['keystrokes']['set']('Shift+Tab',_0x21a4f5),_0x293352['keystrokes']['set']('Tab',(_0x237fa0,_0x7eba9f)=>{!function(_0x520690){const _0x327783=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x5e99e7=>_0x5e99e7+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x14c959=[...document['body']['querySelectorAll'](_0x327783)]['filter'](_0x20215b=>_0x20215b===document['activeElement']||_0x20215b['offsetWidth']+_0x20215b['offsetHeight']>0x0)['sort']((_0x2335de,_0x26d4ed)=>(_0x2335de['tabIndex']||0x0)-(_0x26d4ed['tabIndex']||0x0)),_0xbd2cbb=_0x14c959[(_0x14c959['indexOf'](_0x520690)+0x1)%_0x14c959['length']];_0xbd2cbb&&_0xbd2cbb['focus']();}(this['view']['element']),this['hideDropdown'](),_0x7eba9f();}),_0x293352['focusTracker']['add'](this['view']['element']),_0x293352['focusTracker']['on']('change:isFocused',(_0x5aa5b9,_0x254a56,_0x545f8b)=>{_0x545f8b||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}},At=class extends _0x5383fe{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};