@ckeditor/ckeditor5-real-time-collaboration 49.0.0-alpha.6 → 49.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/index-editor.css +71 -48
  2. package/dist/index.css +71 -48
  3. package/dist/index.js +6 -6
  4. package/dist/translations/af.umd.js +1 -1
  5. package/dist/translations/ar.umd.js +1 -1
  6. package/dist/translations/ast.umd.js +1 -1
  7. package/dist/translations/az.umd.js +1 -1
  8. package/dist/translations/be.umd.js +1 -1
  9. package/dist/translations/bg.umd.js +1 -1
  10. package/dist/translations/bn.umd.js +1 -1
  11. package/dist/translations/bs.umd.js +1 -1
  12. package/dist/translations/ca.umd.js +1 -1
  13. package/dist/translations/cs.umd.js +1 -1
  14. package/dist/translations/da.umd.js +1 -1
  15. package/dist/translations/de-ch.umd.js +1 -1
  16. package/dist/translations/de.umd.js +1 -1
  17. package/dist/translations/el.umd.js +1 -1
  18. package/dist/translations/en-au.umd.js +1 -1
  19. package/dist/translations/en-gb.umd.js +1 -1
  20. package/dist/translations/en.umd.js +1 -1
  21. package/dist/translations/eo.umd.js +1 -1
  22. package/dist/translations/es-co.umd.js +1 -1
  23. package/dist/translations/es.umd.js +1 -1
  24. package/dist/translations/et.umd.js +1 -1
  25. package/dist/translations/eu.umd.js +1 -1
  26. package/dist/translations/fa.umd.js +1 -1
  27. package/dist/translations/fi.umd.js +1 -1
  28. package/dist/translations/fr.umd.js +1 -1
  29. package/dist/translations/gl.umd.js +1 -1
  30. package/dist/translations/gu.umd.js +1 -1
  31. package/dist/translations/he.umd.js +1 -1
  32. package/dist/translations/hi.umd.js +1 -1
  33. package/dist/translations/hr.umd.js +1 -1
  34. package/dist/translations/hu.umd.js +1 -1
  35. package/dist/translations/hy.umd.js +1 -1
  36. package/dist/translations/id.umd.js +1 -1
  37. package/dist/translations/it.umd.js +1 -1
  38. package/dist/translations/ja.umd.js +1 -1
  39. package/dist/translations/jv.umd.js +1 -1
  40. package/dist/translations/kk.umd.js +1 -1
  41. package/dist/translations/km.umd.js +1 -1
  42. package/dist/translations/kn.umd.js +1 -1
  43. package/dist/translations/ko.umd.js +1 -1
  44. package/dist/translations/ku.umd.js +1 -1
  45. package/dist/translations/lt.umd.js +1 -1
  46. package/dist/translations/lv.umd.js +1 -1
  47. package/dist/translations/ms.umd.js +1 -1
  48. package/dist/translations/nb.umd.js +1 -1
  49. package/dist/translations/ne.umd.js +1 -1
  50. package/dist/translations/nl.umd.js +1 -1
  51. package/dist/translations/no.umd.js +1 -1
  52. package/dist/translations/oc.umd.js +1 -1
  53. package/dist/translations/pl.umd.js +1 -1
  54. package/dist/translations/pt-br.umd.js +1 -1
  55. package/dist/translations/pt.umd.js +1 -1
  56. package/dist/translations/ro.umd.js +1 -1
  57. package/dist/translations/ru.umd.js +1 -1
  58. package/dist/translations/si.umd.js +1 -1
  59. package/dist/translations/sk.umd.js +1 -1
  60. package/dist/translations/sl.umd.js +1 -1
  61. package/dist/translations/sq.umd.js +1 -1
  62. package/dist/translations/sr-latn.umd.js +1 -1
  63. package/dist/translations/sr.umd.js +1 -1
  64. package/dist/translations/sv.umd.js +1 -1
  65. package/dist/translations/th.umd.js +1 -1
  66. package/dist/translations/ti.umd.js +1 -1
  67. package/dist/translations/tk.umd.js +1 -1
  68. package/dist/translations/tr.umd.js +1 -1
  69. package/dist/translations/tt.umd.js +1 -1
  70. package/dist/translations/ug.umd.js +1 -1
  71. package/dist/translations/uk.umd.js +1 -1
  72. package/dist/translations/ur.umd.js +1 -1
  73. package/dist/translations/uz.umd.js +1 -1
  74. package/dist/translations/vi.umd.js +1 -1
  75. package/dist/translations/zh-cn.umd.js +1 -1
  76. package/dist/translations/zh.umd.js +1 -1
  77. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Context as _0x570df0,ContextPlugin as _0x35619e,PendingActions as _0x573997,Plugin as _0x184fd3}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x4aa6b2,Collection as _0x1f253d,DomEmitterMixin as _0x4192c7,KeystrokeHandler as _0x4a20eb,getOverlayMountRoot as _0x432c87,global as _0x530d5e,trustedHtml as _0x4d10b4,uid as _0x378125,version as _0x110cfc}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x1b91d3,LabelView as _0x3cf6aa,ListItemView as _0x550a9f,ListView as _0x504fdf,Notification as _0x2073ef,OverlayHost as _0x565793,View as _0x3e1902,clickOutsideHandler as _0x21bc0f}from'@ckeditor/ckeditor5-ui';import{History as _0x832863,InsertOperation as _0x52b205,MarkerOperation as _0x34bab7,ModelLiveRange as _0x2e6bd2,NoOperation as _0x1aa07a,OperationFactory as _0x2df5c2,RootAttributeOperation as _0x8400b6,transformOperationSets as _0x5c3fcc}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x472ed3}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x101e41,CommentsService as _0x49580d,EditorService as _0x49ae78,RevisionHistoryService as _0x2bbd58,TrackChangesService as _0x410fdb,User as _0xbfb52f,WEB_SOCKET_GATEWAY_STATES as _0x282513,WebSocketGateway as _0x3a22fd}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x151f2b,Users as _0x53a800,isPointerStillOver as _0x3a6c3e}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x37b49c}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x2e68c1,TrackChangesEditing as _0x41ce2c}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x18221d,CommentsEditing as _0x3f60f2,CommentsRepository as _0x432ec3}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x18afd8}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x15e8aa}from'es-toolkit/compat';var J=class WebSocketGateway extends _0x35619e{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
- ((()=>_0x3a22fd)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x472ed3,_0x2073ef];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x473555){super(_0x473555),this['set']('state',_0x282513['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x4192c7())();}init(){const _0x4ec66d=this['context'],_0x546c81=_0x4ec66d['plugins']['get'](_0x472ed3),_0x36777d=_0x4ec66d['plugins']['get'](_0x2073ef);if(!_0x546c81['token'])throw new _0x4aa6b2('websocketgateway-missing-token',this);if(!_0x546c81['webSocketUrl'])throw new _0x4aa6b2('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'](_0x546c81['token'],_0x546c81['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x326853=>{if(this['connection']=_0x326853,this['bind']('state')['to'](_0x326853,'state',this,'_isBrowserOffline',(_0x1b4145,_0x239351)=>('connected'!==_0x1b4145&&(this['_shouldPluginsReconnect']=!0x0),_0x239351||_0x1b4145!==_0x282513['CONNECTED']?_0x282513['DISCONNECTED']:this['state']==_0x282513['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x282513['CONNECTING']):_0x282513['CONNECTED'])),this['connection']['on']('error',(_0x3fc129,_0xacc839)=>{if('limitExceeded'!==_0xacc839['code'])throw console['error'](_0xacc839),new _0x4aa6b2('cloudservices-init',null,{'originalError':_0xacc839});_0x36777d['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'});}),!_0x326853['me'])return new Promise(_0x1ea8fc=>_0x326853['on']('change:me',_0x1ea8fc));})['catch'](_0x56e113=>{throw console['error'](_0x56e113),new _0x4aa6b2('cloudservices-init',null,{'originalError':_0x56e113});});}addToReconnectionStack(_0x66db75){if('function'!=typeof _0x66db75['reconnect'])throw new _0x4aa6b2('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x66db75))throw new _0x4aa6b2('websocketgateway-plugin-already-registered',this,{'name':_0x66db75['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x66db75);}removeFromReconnectionStack(_0x231e13){this['_reconnectionStack']['delete'](_0x231e13);}isInReconnectionStack(_0x4ab048){return this['_reconnectionStack']['has'](_0x4ab048);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x51ac83=>_0x51ac83['reconnect']())))['then'](()=>this['state']=_0x282513['CONNECTED'])['catch'](_0x145cad=>{throw console['error'](_0x145cad),new _0x4aa6b2('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x282513['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x35619e{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[J,_0x53a800];}constructor(_0x358159){super(_0x358159),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x1f253d(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x53a800);}init(){const _0x232b2e=this['context']['plugins']['get'](J);this['listenTo'](_0x232b2e,'change:state',(_0x352bc8,_0x7e840a,_0x5f16d3)=>{if('connected'!==_0x5f16d3)this['channelSessions']['forEach'](_0x5027dd=>_0x5027dd['clear']()),this['channelConnectedUsers']['forEach'](_0x4afe65=>_0x4afe65['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x425655,_0x91a234]of this['_registeredSessions'])for(const _0x59d8b1 of _0x91a234)this['_handleSessionAdd'](_0x425655,_0x59d8b1);}}),this['_createUser'](_0x232b2e['connection']['me'],!0x0);}register(_0x52448d,_0x2778a1){if(this['_registeredSessions']['has'](_0x52448d))throw new _0x4aa6b2('sessions-register-already-registered',null,{'channelId':_0x52448d});this['_registeredSessions']['set'](_0x52448d,_0x2778a1),this['channelSessions']['set'](_0x52448d,new _0x1f253d()),this['channelConnectedUsers']['set'](_0x52448d,new _0x1f253d()),this['listenTo'](_0x2778a1,'add',(_0x253b50,_0x56bbf4)=>this['_handleSessionAdd'](_0x52448d,_0x56bbf4)),this['listenTo'](_0x2778a1,'remove',(_0x26de36,_0x49112a)=>this['_handleSessionRemove'](_0x52448d,_0x49112a));for(const _0x46fcf5 of _0x2778a1)this['_handleSessionAdd'](_0x52448d,_0x46fcf5);}unregister(_0x49dc96){if(!this['_registeredSessions']['has'](_0x49dc96))throw new _0x4aa6b2('sessions-unregister-not-exist',null,{'channelId':_0x49dc96});const _0x68637e=this['_registeredSessions']['get'](_0x49dc96);this['stopListening'](_0x68637e);for(const _0x503d67 of _0x68637e)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x49dc96,_0x503d67);this['_registeredSessions']['delete'](_0x49dc96),this['channelSessions']['delete'](_0x49dc96),this['channelConnectedUsers']['delete'](_0x49dc96);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0x46b544){for(const _0x3dcb65 of this['channelSessions']['values']())for(const _0x341cf6 of _0x3dcb65)if(_0x341cf6['id']===_0x46b544)return _0x341cf6['user'];}getUserSessions(_0x1ede90,_0x2fc59e){const _0x29588d=_0x2fc59e?[this['channelSessions']['get'](_0x2fc59e)]:this['channelSessions']['values'](),_0x5dc66a=new Set();for(const _0x3f17aa of _0x29588d)for(const _0x33e732 of _0x3f17aa)_0x33e732['user']['id']===_0x1ede90['id']&&_0x5dc66a['add'](_0x33e732['id']);return _0x5dc66a;}getUserRole(_0x49d89b){for(const _0x52c9cf of this['channelSessions']['values']())for(const _0x42306a of _0x52c9cf)if(_0x42306a['user']===_0x49d89b)return _0x42306a['role'];}['_handleSessionAdd'](_0x225093,_0xb294c0){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x2fe138=_0xb294c0['user'],_0x162fa2=this['_users']['getUser'](_0x2fe138['id'])||this['_createUser'](_0x2fe138),_0x4b1721=Object['assign']({},_0xb294c0,{'user':_0x162fa2});if(this['channelSessions']['get'](_0x225093)['add'](_0x4b1721),!_0x2fe138['hiddenInPresenceList']){const _0x30293b=this['channelConnectedUsers']['get'](_0x225093);_0x30293b['has'](_0x162fa2['id'])||_0x30293b['add'](_0x162fa2),this['allConnectedUsers']['has'](_0x162fa2['id'])||_0x2fe138['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x162fa2,_0x162fa2['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x225093,{'channelId':_0x225093,'session':_0x4b1721});}['_handleSessionRemove'](_0xca56f9,_0x532275){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x4dc148=this['channelConnectedUsers']['get'](_0xca56f9),_0x4fbb8f=_0x532275['user'];_0x4fbb8f['id']&&(this['channelSessions']['get'](_0xca56f9)['remove'](_0x532275['id']),_0x4dc148['has'](_0x4fbb8f['id'])&&!this['getUserSessions'](_0x4fbb8f,_0xca56f9)['size']&&_0x4dc148['remove'](_0x4fbb8f['id']),this['allConnectedUsers']['get'](_0x4fbb8f['id'])&&!this['getUserSessions'](_0x4fbb8f)['size']&&this['allConnectedUsers']['remove'](_0x4fbb8f['id']));}_createUser(_0x4a5a65,_0x5e0f84){const _0xcdb612=this['_users']['addUser'](_0x4a5a65);return _0x5e0f84&&this['_users']['defineMe'](_0x4a5a65['id']),_0xcdb612['orderNumber']=this['_uniqueUsersCount']++,_0xcdb612;}},X=class extends _0x184fd3{_domEmitter=new(_0x4192c7())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x4872cd=this['editor'],_0x30e8ed=_0x4872cd['plugins']['get'](Q);_0x4872cd['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x18ab28,{writer:_0x5f30ae})=>function(_0x5a4776,_0x54968c,_0x4d3d98,_0x2ba8b8){const _0x1d8e97=_0x5a4776['markerName']['split'](':')[0x2],_0x48f094=_0x4d3d98['getUserBySessionId'](_0x1d8e97);if(!_0x48f094||_0x1d8e97===_0x4d3d98['mySessionId'])return;if(!_0x2ba8b8['model']['schema']['checkChild'](_0x5a4776['markerRange']['start'],'$text'))return;const _0x41b4af={'class':'ck-user__marker\x20'+_0x48f094['color']['getMarkerClass'](),'style':tt(_0x48f094),'data-name':_0x48f094['name'],'data-session-id':_0x1d8e97},_0x44c326=_0x2ba8b8['model']['markers']['get'](_0x5a4776['markerName'])['getStart'](),_0x391d6d=_0x44c326['nodeAfter'],_0x1ad4d9=_0x2ba8b8['model']['schema'];if(_0x391d6d&&_0x1ad4d9['isObject'](_0x391d6d)&&_0x1ad4d9['isInline'](_0x391d6d)&&!_0x2ba8b8['model']['markers']['get']('user:range:'+_0x1d8e97)['getRange']()['isCollapsed'])return;const _0x250699=_0x44c326['parent'];return _0x2ba8b8['model']['schema']['isLimit'](_0x250699)&&!_0x2ba8b8['model']['hasContent'](_0x250699)&&(_0x41b4af['contenteditable']=!0x1),function(_0x5550ee,_0x44e409,_0x52706a){const _0x9df548=_0x5550ee['createUIElement']('span',_0x44e409);return _0x5550ee['setCustomProperty']('userPositionMarker',!0x0,_0x9df548),_0x9df548['render']=function(_0x56f0a3){const _0x102166=this['toDomElement'](_0x56f0a3),_0x4919f3=document['createElement']('span');return _0x4919f3['classList']['add']('ck-user__marker-tooltip'),_0x4919f3['setAttribute']('contenteditable','false'),_0x4919f3['setAttribute']('spellcheck','false'),_0x4919f3['textContent']=_0x52706a['name'],_0x102166['innerHTML']=_0x4d10b4('⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x4919f3['outerHTML']+'⁠'),_0x102166['addEventListener']('mouseenter',()=>{_0x102166['classList']['add']('ck-user__marker_hovered');}),_0x102166['addEventListener']('mouseleave',()=>{_0x102166['classList']['remove']('ck-user__marker_hovered');}),_0x102166;},_0x9df548['isSimilar']=function(_0x47a913){return!(!this['getCustomProperty']('userPositionMarker')||!_0x47a913['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x47a913['getAttribute']('data-session-id'));},_0x9df548;}(_0x54968c,_0x41b4af,_0x48f094);}(_0x18ab28,_0x5f30ae,_0x30e8ed,_0x4872cd)}),_0x4872cd['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x1d9287=>function(_0x1c8e41,_0x4ce71e){const _0x2d4584=_0x1c8e41['markerName']['split'](':')[0x2];if(_0x2d4584===_0x4ce71e['mySessionId'])return null;const _0x3fe924=_0x4ce71e['getUserBySessionId'](_0x2d4584);return _0x3fe924?{'id':_0x2d4584,'classes':['ck-user__selection',_0x3fe924['color']['getSelectionClass']()],'attributes':{'style':tt(_0x3fe924),'data-session-id':_0x2d4584},'priority':0x7d0+_0x3fe924['orderNumber']}:{'id':_0x2d4584,'classes':[]};}(_0x1d9287,_0x30e8ed)}),function(_0x23492d){const _0x3e572a=_0x23492d['model'],_0x22e283=new Map(),_0x5172b0=_0x23492d['plugins']['get'](Q);_0x3e572a['markers']['on']('update:user:range',(_0x5acecb,_0xbe185,_0x43c041,_0x467abd)=>{if(!_0x467abd&&_0x22e283['get'](_0xbe185['name']))return _0x22e283['get'](_0xbe185['name'])['detach'](),void _0x22e283['delete'](_0xbe185['name']);const _0x589099=_0xbe185['name']['split'](':')[0x2];if(_0x589099===_0x5172b0['mySessionId'])return;const _0x56119b='user:position:'+_0x589099;_0x3e572a['markers']['has'](_0x56119b)&&_0x23492d['editing']['reconvertMarker'](_0x56119b),_0xbe185['on']('change:range',(_0x3ca0f0,_0x3ff2a1,_0x48a10d)=>{if('$graveyard'!=_0x3ff2a1['root']['rootName']&&'$graveyard'==_0xbe185['getRange']()['root']['rootName']&&!_0x22e283['has'](_0xbe185['name'])){const _0x10c2d5=_0x3e572a['schema']['getNearestSelectionRange'](_0x48a10d['deletionPosition']);if(_0x10c2d5){const _0x5228e5=_0x2e6bd2['fromRange'](_0x10c2d5);_0x22e283['set'](_0xbe185['name'],_0x5228e5),_0x5228e5['on']('change:range',(_0x6cd958,_0x3b7aa0,_0x54075d)=>{if('$graveyard'==_0x5228e5['root']['rootName']){const _0x387bb5=_0x3e572a['schema']['getNearestSelectionRange'](_0x54075d['deletionPosition']);_0x387bb5?(_0x5228e5['start']=_0x387bb5['start'],_0x5228e5['end']=_0x387bb5['end']):(_0x22e283['delete'](_0xbe185['name']),_0x5228e5['detach']());}});}}});}),_0x3e572a['document']['on']('change',()=>{_0x22e283['size']>0x0&&_0x3e572a['enqueueChange']({'isUndoable':!0x1},_0x467c4d=>{for(const [_0x43d993,_0x5e2979]of _0x22e283)'$graveyard'==_0x3e572a['markers']['get'](_0x43d993)['getRange']()['root']['rootName']&&(Z(_0x43d993['split'](':')[0x2],_0x5e2979['toRange'](),_0x3e572a,_0x467c4d),_0x5e2979['detach']());_0x22e283['clear']();});});}(_0x4872cd),this['_domEmitter']['listenTo'](_0x530d5e['document'],'keydown',(_0x1d133d,{key:_0x4d004e})=>{'Escape'===_0x4d004e&&function(_0x4947d7){_0x4947d7['editing']['view']['change'](_0x467883=>{for(const _0x2fcadc of _0x4947d7['model']['markers']){if(!_0x2fcadc['name']['startsWith']('user:position'))continue;const _0x3afa16=_0x4947d7['editing']['mapper']['markerNameToElements'](_0x2fcadc['name']);if(_0x3afa16){for(const _0x5aa45e of _0x3afa16)_0x467883['removeClass']('ck-user__marker_hovered',_0x5aa45e);}}});}(_0x4872cd);},{'useCapture':!0x0});}afterInit(){const _0x5eb5df=this['editor'],_0x22babf=_0x5eb5df['commands']['get']('undo');_0x22babf&&_0x5eb5df['model']['on']('applyOperation',(_0x52f813,_0x5f0c78)=>{const _0x21f619=_0x5f0c78[0x0];if(!_0x21f619['isDocumentOperation'])return;if('marker'!=_0x21f619['type']||!_0x21f619['name']['startsWith']('user:'))return;const _0x1e2bb1=_0x21f619['batch'];_0x22babf['_createdBatches']['has'](_0x1e2bb1)&&(_0x21f619['newRange']=_0x21f619['oldRange']?_0x5eb5df['model']['createRange'](_0x21f619['oldRange']['start'],_0x21f619['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x8c006d=this['editor'],_0x474b75=_0x8c006d['model']['document'],_0x21919c=_0x8c006d['plugins']['get'](Q);_0x8c006d['model']['enqueueChange']({'isUndoable':!0x1},_0x18313d=>{const _0xbbef3b='user:range:'+_0x21919c['mySessionId'],_0x1a2209='user:position:'+_0x21919c['mySessionId'],_0xa76910=_0x8c006d['model']['markers']['has'](_0xbbef3b);_0x8c006d['editing']['view']['hasDomSelection']?Z(_0x21919c['mySessionId'],_0x474b75['selection']['getFirstRange'](),_0x8c006d['model'],_0x18313d):_0xa76910&&(_0x18313d['removeMarker'](_0xbbef3b),_0x18313d['removeMarker'](_0x1a2209));});}};function Z(_0x13229c,_0x167269,_0x53198b,_0x162039){const _0x1a67d8='user:range:'+_0x13229c,_0x2a6ee0='user:position:'+_0x13229c,_0x63b7a2=_0x167269['getContainedElement']();let _0x16ebbd=_0x167269['start'];if(_0x63b7a2&&_0x63b7a2['is']('element','tableCell')){const _0x4d4c42=function(_0x500555,_0x56c1a2){for(const _0x516883 of _0x500555['getPositions']())if(_0x56c1a2['schema']['checkChild'](_0x516883,'$text'))return _0x516883;}(_0x167269,_0x53198b);_0x4d4c42&&(_0x16ebbd=_0x4d4c42,_0x167269=_0x162039['createRange'](_0x16ebbd));}const _0x3c3b22=_0x162039['createRange'](_0x16ebbd);_0x53198b['markers']['has'](_0x1a67d8)?(_0x162039['updateMarker'](_0x1a67d8,{'range':_0x167269}),_0x162039['updateMarker'](_0x2a6ee0,{'range':_0x3c3b22})):(_0x162039['addMarker'](_0x1a67d8,{'range':_0x167269,'usingOperation':!0x0}),_0x162039['addMarker'](_0x2a6ee0,{'range':_0x3c3b22,'usingOperation':!0x0}));}function tt(_0x3cf8bd){return'--ck-user-color:'+_0x3cf8bd['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x3cf8bd['color']['getColorAlphaVariable']()+';';}function et(_0x2afec0,_0x5ba8b3,_0x5ebd0a){const _0x5ea15d=_0x2afec0['t'],t=_0x2afec0['t'];switch(_0x5ba8b3){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 _0x5ea15d({'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'},_0x5ebd0a);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x184fd3{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
- ((()=>_0x101e41)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[J,Q,X,_0x573997,_0x53a800,_0x2073ef];}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 _0x3f6890=this['serverHistory']['getOperations']();for(let _0x323f2c=_0x3f6890['length']-0x1;_0x323f2c>=0x0;_0x323f2c--){const _0x4651ca=_0x3f6890[_0x323f2c];if(!this['_disconnectionOperations']['has'](_0x4651ca))return _0x4651ca['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x244006){if(super(_0x244006),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x832863(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x4aa6b2('collaboration-missing-channelid',this);const _0x148a67=_0x244006['config']['get']('cloudServices.bundleVersion')||_0x110cfc;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x148a67,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x37b49c(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new rt(this['_disconnectionOperations']);}init(){const _0x12ddfc=this['editor'],_0x4c987d=_0x12ddfc['plugins']['get'](_0x53a800),_0x53f5f4=_0x12ddfc['plugins']['get'](J);this['listenTo'](_0x4c987d,'getOperationAuthor',(_0x1d2311,_0x1b3790)=>{const _0x4ebe2a=_0x1b3790[0x0];_0x4ebe2a['_authorId']&&(_0x1d2311['return']=_0x4c987d['getUser'](_0x4ebe2a['_authorId']),_0x1d2311['stop']()),null===_0x4ebe2a['_authorId']&&(_0x1d2311['return']=null,_0x1d2311['stop']());},{'priority':'high'}),this['listenTo'](_0x12ddfc['model']['document']['selection'],'change:range',(_0x1288ba,_0x315732)=>{_0x315732['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x12ddfc['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x12ddfc['model']['on']('applyOperation',(_0x4beab7,_0x3a3c22)=>{const _0x2db519=_0x3a3c22[0x0];_0x2db519['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x2db519),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x53f5f4,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x248f89,_0x5a1d41,_0x1b5a3a)=>'connected'===_0x248f89&&!_0x5a1d41&&!_0x1b5a3a),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x12ddfc['disableReadOnlyMode']('rtc-offline'):_0x12ddfc['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x12ddfc['disableReadOnlyMode']('rtc-offline'):_0x12ddfc['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x5ca742=this['editor']['plugins']['get'](Q),_0x3bf957=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0x5ca742['unregister'](this['_channelId']);const _0x5872cf=await this['_service']['reconnect'](_0x3bf957['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x5872cf)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x1906db=await this['_service']['getConnectedSessions']();_0x5ca742['register'](this['_channelId'],_0x1906db),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4aaee2){if(function(_0x2d5d65){return'404'===_0x2d5d65['code'];}(_0x4aaee2)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4e9847){return'409'===_0x4e9847['code'];}(_0x4aaee2)){const _0x25dcc6=et(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x25dcc6);}else{if(!(_0x4aaee2 instanceof nt))throw _0x4aaee2;this['_handleReconnectionError']();}}}}destroy(){const _0x19998f=this['editor']['plugins']['get'](J),_0x531c25=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x531c25['channelSessions']['has'](this['_channelId'])&&_0x531c25['unregister'](this['_channelId']),_0x19998f['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x4067fa){if(this['sessionId']!==_0x4067fa['sessionId']&&this['_lastSyncedOperationId']!==_0x4067fa['lastOperationId'])throw new nt();return this['sessionId']=_0x4067fa['sessionId'],this['_handleServerResponse']([],{..._0x4067fa,'wereChangesApplied':!0x1,'data':_0x4067fa['data']},'reconnect');}async _connectService(_0x3a87a5,_0x45858f=!0x1){const {connection:_0x5499f3}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x5499f3,this['_channelId'])['then'](_0x5b6687=>this['_initSessionsHandling'](_0x5b6687))['catch'](_0x50b204=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x50b204);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x1ba1c3,_0x330a4c)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x330a4c);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x2246ae=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3a87a5);this['_isPendingUpdate']=!0x0;const _0x2b8115=await this['_service']['connect'](_0x5499f3,this['_compressOperations'](_0x3a87a5),_0x2246ae);if(this['sessionId']=_0x2b8115['sessionId'],_0x45858f){if(!_0x2b8115['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x2b8115['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x3a87a5,_0x2b8115,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x2b8115,_0x3a87a5);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x2d5905=this['editor']['plugins']['get'](Q),_0x1aea27=this['editor']['plugins']['get'](X),_0x38b8ee=_0x2d5905['channelSessions']['get'](this['_channelId']);_0x38b8ee&&_0x38b8ee['length']>0x1?_0x1aea27['createUserMarkerOperations']():this['listenTo'](_0x2d5905,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x2d5905['channelSessions']['get'](this['_channelId'])['length']&&_0x1aea27['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x35186e,_0x1d7a64,_0x28a276,_0x2b0e75){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x1d7a64){const _0x182da8=this['_decompressOperations'](_0x28a276,_0x2b0e75);await this['_fetchMissingUsers'](_0x182da8),this['_handleExternalOperations'](_0x182da8,_0x1d7a64,_0x28a276['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x5bb388}=this['editor'];let _0x2ef84b;try{_0x2ef84b=await this['_service']['getDocumentDetails']();}catch{const _0x599254=et(_0x5bb388,'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'](_0x599254);}const _0x2146e7=_0x2ef84b['currentDocumentSession']||_0x2ef84b['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x2146e7['lastOperationId']){const _0xd5749=et(_0x5bb388,'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'](_0xd5749);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0xbdb853=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0xbdb853['connection']||'connected'!==_0xbdb853['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x246e00=this['editor']['plugins']['get'](Q);_0x246e00['channelSessions']['has'](this['_channelId'])&&_0x246e00['unregister'](this['_channelId']),_0xbdb853['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x2f5f88){const _0x32874b=this['editor']['plugins']['get'](Q);this['listenTo'](_0x32874b,'sessionAdd:'+this['_channelId'],(_0x541063,{session:_0x25f55e})=>{if(_0x25f55e['id']===_0x32874b['mySessionId']){_0x541063['off']();const _0x9d8851=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x3c43b1=_0x25f55e['permissions'];_0x9d8851&&_0x9d8851['isEnabled']&&(_0x3c43b1=_0x3c43b1['filter'](_0x5951ca=>'document:write'!==_0x5951ca)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x3c43b1,this['_channelId']);}}),_0x32874b['register'](this['_channelId'],_0x2f5f88);}_initThrowingOnDataSet(){const _0x3dc065=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x1c4a37)=>{if(!_0x1c4a37[_0x1c4a37['length']-0x1]['suppressErrorInCollaboration'])throw new _0x4aa6b2('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x3dc065['apply'](this['editor']['data'],_0x1c4a37);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x4500b4,[_0x591e2f])=>{if(this['_document']['version'])throw new _0x4aa6b2('realtimecollaborationclient-init-document-already-initialized',this);_0x4500b4['stop'](),this['_setPendingAction']();const _0x3adbc5=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x3518dc])=>!_0x3518dc['lazyLoad'])['map'](([_0xc11a6,_0x58b9bc])=>[_0xc11a6,_0x58b9bc['modelAttributes']||{}])),_0x236e50=this['_getOperationsFromInitData'](_0x591e2f,_0x3adbc5);0x0==_0x236e50['length']&&_0x236e50['push'](new _0x1aa07a(0x0)),_0x4500b4['return']=this['_connectService'](_0x236e50)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x40c0e2=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x40c0e2))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2742cb,[_0x349f98,_0x121b77])=>{_0x2742cb['stop']();const _0x77a5c8=this['editor']['model']['document']['getRoot'](_0x349f98);if(!this['_knownRootNames']['has'](_0x349f98)){const _0x1d871d=_0x121b77&&_0x121b77['data']?_0x121b77['data']:'',_0x33054d=_0x121b77&&_0x121b77['attributes']?_0x121b77['attributes']:{};await this['_loadRoot'](_0x349f98,_0x1d871d,_0x33054d);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x77a5c8['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x77a5c8);});},{'priority':'high'});}async _fetchMissingUsers(_0x54d834){const _0x585993=this['editor']['plugins']['get'](_0x53a800),{connection:_0x24d600}=this['editor']['plugins']['get'](J),_0x13c935=new Set();for(const _0x38dcfa of _0x54d834){const _0x118741=_0x38dcfa['_authorId'];_0x118741&&!_0x585993['getUser'](_0x118741)&&_0x13c935['add'](_0x118741);}if(0x0===_0x13c935['size'])return;const _0x4bff63=await _0xbfb52f['getMany'](_0x24d600,Array['from'](_0x13c935));for(const _0x4f209d of _0x4bff63)_0x585993['getUser'](_0x4f209d['id'])||_0x585993['addUser'](_0x4f209d);}_getOperationsFromInitData(_0x1e8f77,_0x1b6396={}){const _0x47ddaf=this['editor']['model'],_0x4aac95=[];let _0xaeb80d=0x0;const _0x5666cc='string'==typeof _0x1e8f77?{'main':_0x1e8f77}:_0x1e8f77;for(const _0x17599c of Object['keys'](_0x5666cc)){if(!this['_document']['roots']['has'](_0x17599c))throw new _0x4aa6b2('realtimecollaborationclient-init-non-existent-root',this);const _0x46c138=this['_document']['getRoot'](_0x17599c),_0x1e2d1e=this['editor']['data']['parse'](_0x5666cc[_0x17599c],_0x46c138),_0x6ce0dd=new _0x52b205(_0x47ddaf['createPositionAt'](_0x46c138,0x0),_0x1e2d1e,_0xaeb80d++);_0x4aac95['push'](_0x6ce0dd);for(const [_0x3d4889,_0x48c531]of _0x1e2d1e['markers']){const _0x42936e=_0x47ddaf['createRange'](_0x47ddaf['createPositionFromPath'](_0x46c138,_0x48c531['start']['path']['slice']()),_0x47ddaf['createPositionFromPath'](_0x46c138,_0x48c531['end']['path']['slice']())),_0x372149=new _0x34bab7(_0x3d4889,null,_0x42936e,_0x47ddaf['markers'],!0x0,_0xaeb80d++);_0x4aac95['push'](_0x372149);}}if(_0x1b6396)for(const [_0x458f6e,_0x25b860]of Object['entries'](_0x1b6396)){const _0x268910=_0x47ddaf['document']['getRoot'](_0x458f6e);if(!_0x268910)throw new _0x4aa6b2('multi-root-editor-root-attributes-no-root',null);for(const [_0x5078ff,_0xe585bf]of Object['entries'](_0x25b860))if(null!==_0xe585bf){const _0x1aeb74=new _0x8400b6(_0x268910,_0x5078ff,null,_0xe585bf,_0xaeb80d++);_0x4aac95['push'](_0x1aeb74);}}return _0x4aac95;}async _loadRoot(_0x199cb6,_0x37b4a2,_0x207093){this['_getOperationsFromInitData']({[_0x199cb6]:_0x37b4a2},{[_0x199cb6]:_0x207093})['forEach']((_0x4c32b4,_0x50611c)=>{_0x4c32b4['baseVersion']=this['_document']['version']+_0x50611c,_0x4c32b4['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x4c32b4);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x1a6ab4,_0x5019a6){let _0x1083e1;this['_offset']=_0x1a6ab4['offset'];const _0x78ea7c=_0x1a6ab4['wereChangesApplied']&&!_0x1a6ab4['initData'],_0x211200=_0x78ea7c?0x0:_0x1a6ab4['data']['baseVersion'];if(_0x5019a6['forEach'](_0x3729ee=>{_0x3729ee['_isInit']=!0x0,_0x3729ee['createdAt']=_0x1a6ab4['sessionCreatedAt'],_0x3729ee['_authorId']=null;}),_0x78ea7c)_0x1083e1=_0x5019a6,this['_applyOperationsSet'](_0x1083e1,_0x78ea7c);else{if(_0x1a6ab4['initData']){const _0x5cb7a3=this['_getOperationsFromInitData'](_0x1a6ab4['initData']);this['_document']['history']['version']=-_0x5cb7a3['length'],_0x5cb7a3['forEach'](_0x4ef79d=>{_0x4ef79d['baseVersion']-=_0x5cb7a3['length'],_0x4ef79d['createdAt']=_0x1a6ab4['sessionCreatedAt'],_0x4ef79d['_isInit']=!0x0,_0x4ef79d['_authorId']=null;}),this['_applyOperationsSet'](_0x5cb7a3,!0x0),this['serverHistory']['version']=-_0x5cb7a3['length']+this['_offset'],this['_updateServerHistory'](_0x5cb7a3);}this['_document']['history']['version']=_0x211200,_0x1083e1=this['_decompressOperations'](_0x1a6ab4['data'],_0x1a6ab4['metadata']),await this['_fetchMissingUsers'](_0x1083e1),this['_applyOperationsSet'](_0x1083e1,_0x78ea7c);}_0x1a6ab4['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x1083e1,_0x1a6ab4['lastOperationId']),this['_lastSyncedOperationId']=_0x1a6ab4['lastOperationId']),this['serverHistory']['version']=_0x211200+this['_offset'],this['_updateServerHistory'](_0x1083e1),_0x5019a6['filter'](_0x5f0f59=>{const _0x32db28=this['_getAffectedRoot'](_0x5f0f59);return _0x32db28&&!this['_knownRootNames']['has'](_0x32db28);})['forEach']((_0x1e638b,_0x46fbfc)=>{_0x1e638b['baseVersion']=this['_document']['version']+_0x46fbfc,this['_saveOperationInBuffer'](_0x1e638b);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x36c582,_0x336d07){const _0x4afeb6=_0x336d07&&_0x336d07['message'];if(_0x4afeb6&&_0x4afeb6['startsWith']('realtimecollaborationclient'))throw _0x336d07;const _0x446da5=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0x446da5['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x4aa6b2(_0x36c582,this['editor'],_0x4afeb6?{'originalError':_0x4afeb6}:void 0x0);}_saveOperationInBuffer(_0x563c7c){this['_knownOperations']['has'](_0x563c7c)||(this['_knownOperations']['add'](_0x563c7c),this['_bufferedOperations']['push'](_0x563c7c),this['_pendingAction']||'marker'==_0x563c7c['type']&&!_0x563c7c['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x2faf67=!0x1){!_0x2faf67&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x239c3b=>{_0x239c3b&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0xcda18=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x1ca104){return _0x1ca104['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1ca104['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x1ca104['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0xcda18)||this['_crash'](_0xcda18['message'],_0xcda18);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x529555=>{this['on']('change:_isPendingUpdate',()=>{_0x529555();});});}async _sendBufferedOperations(){const _0x1fbda4=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0x1fbda4['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x18ab89=[...this['_bufferedOperations']];for(const _0x17a323 of _0x18ab89)_0x17a323['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x17a323);const _0x3039b9=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x18ab89),_0x4b6015=st++,_0x100af5=this['_compressOperations'](_0x18ab89),_0x5a93f2=await this['_service']['sendOperations'](_0x100af5,_0x100af5['baseVersion'],_0x3039b9);try{return await this['_handleServerResponse'](_0x18ab89,_0x5a93f2,_0x4b6015);}catch(_0x1bcc51){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x1bcc51);}}async['_handleServerResponse'](_0x668ba8,_0x30bfaf,_0x23f049){if('error'in _0x30bfaf)throw _0x30bfaf['error'];let _0x10ae47;if(_0x30bfaf['wereChangesApplied']){_0x30bfaf['lastOperationId']&&(this['_lastSyncedOperationId']=_0x30bfaf['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5020e6=>!_0x668ba8['includes'](_0x5020e6));for(const _0x3f2717 of _0x668ba8)_0x3f2717['createdAt']='lastOperationAcceptedAt'in _0x30bfaf&&_0x30bfaf['lastOperationAcceptedAt']||void 0x0;ot(_0x668ba8,_0x30bfaf['version']-_0x668ba8['length']),this['_updateServerHistory'](_0x668ba8);const _0x4bf67b=_0x668ba8['filter'](_0x282343=>{if(!_0x282343['_isInit'])return!0x1;const _0x2eac5f=this['_getAffectedRoot'](_0x282343);return _0x2eac5f&&!this['_knownRootNames']['has'](_0x2eac5f);});ot(_0x4bf67b,this['_document']['version']),this['_applyOperationsSet'](_0x4bf67b),_0x10ae47=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x4a0739=this['_decompressOperations'](_0x30bfaf['data'],_0x30bfaf['metadata'])['filter'](_0x11e9b9=>_0x11e9b9['baseVersion']>=this['_lastServerVersion']);_0x4a0739['forEach'](_0x2dfb62=>this['_addKnownRoot'](_0x2dfb62)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x1e4fe=>!_0x1e4fe['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x1e4fe))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x4a0739),_0x10ae47=this['_handleExternalOperations'](_0x4a0739,_0x30bfaf['version'],_0x30bfaf['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x10ae47?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x217ee6,_0x50018b,_0x55e4fe){try{const _0x21f53b={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0xfef99f,operationsB:_0x5e9c6d,originalOperations:_0x1078a6}=_0x5c3fcc(_0x217ee6,this['_bufferedOperations'],_0x21f53b);ot(_0xfef99f,this['_document']['version']),ot(_0x5e9c6d,_0x50018b);for(const _0x33f2f0 of _0xfef99f){const _0x1f84d5=_0x1078a6['get'](_0x33f2f0);_0x1f84d5?(_0x33f2f0['_authorId']=_0x1f84d5['_authorId'],'noop'!==_0x33f2f0['type']&&(_0x33f2f0['_aiSource']=_0x1f84d5['_aiSource'])):_0x33f2f0['_authorId']=null;}for(const _0x4c5214 of _0x5e9c6d)'noop'!==_0x4c5214['type']&&(_0x4c5214['_aiSource']=_0x1078a6['get'](_0x4c5214)?.['_aiSource']);_0x55e4fe&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x217ee6,_0x55e4fe),this['_lastSyncedOperationId']=_0x55e4fe),this['_bufferedOperations']=[..._0x5e9c6d],this['_applyOperationsSet'](_0xfef99f),this['_updateServerHistory'](_0x217ee6);}catch(_0x16013a){return console['error'](_0x16013a),!0x1;}return!0x0;}_applyOperationsSet(_0x35a63f,_0x33ea38=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x2fce31=>{for(const _0x226b2c of _0x35a63f)this['_knownOperations']['add'](_0x226b2c),this['_addKnownRoot'](_0x226b2c),_0x2fce31['batch']['addOperation'](_0x226b2c),this['editor']['model']['applyOperation'](_0x226b2c);});}_addKnownRoot(_0x2b688c){const _0x58e030=this['_getAffectedRoot'](_0x2b688c);_0x58e030&&this['_knownRootNames']['add'](_0x58e030);}_getAffectedRoot(_0x44bce5){let _0x4e983a,_0x465f01;switch(_0x44bce5['type']){case'insert':_0x4e983a=_0x44bce5['position']['root'];break;case'marker':if(_0x465f01=_0x44bce5['newRange'],!_0x465f01)return null;_0x4e983a=_0x465f01['root'];break;case'addRootAttribute':_0x4e983a=_0x44bce5['root'];break;case'addRoot':_0x4e983a=_0x44bce5['affectedSelectable'];break;case'move':_0x4e983a=_0x44bce5['targetPosition']['root'];break;default:return null;}return _0x4e983a['rootName'];}_updateServerHistory(_0x769a4d){_0x769a4d['forEach'](_0x1a38c9=>{const _0x330960=_0x1a38c9['clone']();_0x330960['_authorId']=_0x1a38c9['_authorId'],_0x330960['_isInit']=!!_0x1a38c9['_isInit'],_0x330960['_aiSource']=_0x1a38c9['_aiSource'],_0x330960['createdAt']=_0x1a38c9['createdAt'],_0x330960['baseVersion']+=this['_offset'],_0x1a38c9['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x330960),this['serverHistory']['addOperation'](_0x330960);});}_handleReconnectionError(_0x205e35){const _0x521456=this['editor']['plugins']['get']('Notification'),_0x5adf6b=this['editor']['locale'];_0x205e35||(_0x205e35=et(_0x5adf6b,'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.')),_0x521456['showWarning'](_0x205e35,{'title':et(_0x5adf6b,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](J)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x573997)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x573997)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x1b8942){const _0x2c5cd9=_0x1b8942['map'](_0x313f12=>_0x313f12['toJSON']());return this['_compressor']['compress'](_0x2c5cd9);}_decompressOperations(_0x5c12df,_0x1a90ea){return this['_compressor']['decompress'](_0x5c12df)['map']((_0x49e348,_0x350045)=>{const _0x31ef09='init'==_0x1a90ea[_0x350045]['type'];if('InsertOperation'==_0x49e348['__className']){const _0x5a83a7=_0x49e348['position']['root'];!this['_document']['getRoot'](_0x5a83a7)&&(this['_document']['createRoot']('$unknown',_0x5a83a7)['_isAttached']=!0x1);}else{if('RootOperation'==_0x49e348['__className']){const _0x5effc2=this['_document']['getRoot'](_0x49e348['rootName']);_0x5effc2&&'$unknown'==_0x5effc2['name']&&_0x49e348['elementName']!=_0x5effc2['name']&&(_0x5effc2['name']=_0x49e348['elementName']);}}const _0x39a12f=_0x2df5c2['fromJSON'](_0x49e348,this['_document']);return _0x39a12f['wasUndone']=_0x49e348['wasUndone'],_0x39a12f['_isInit']=_0x31ef09,_0x39a12f['_authorId']=_0x31ef09?null:_0x1a90ea[_0x350045]['userId'],_0x39a12f['_isDisconnection']='cs:removeUser'===_0x1a90ea[_0x350045]['type'],_0x39a12f['_aiSource']=_0x49e348['_aiSource']||void 0x0,_0x39a12f['createdAt']=_0x1a90ea[_0x350045]['createdAt'],_0x39a12f;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x4af598=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x4af598&&_0x4af598['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x14bd0a,_0x426cf1){for(const _0x54fd97 of _0x14bd0a)_0x54fd97['baseVersion']=_0x426cf1++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0x87d7ca){this['_ignoredOperations']=_0x87d7ca,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x2e6ac2){let _0x15ffb5=_0x2e6ac2['length'];for(;_0x15ffb5--;){const _0x5ccc7c=_0x2e6ac2[_0x15ffb5];if(!this['_ignoredOperations']['has'](_0x5ccc7c)){if(!this['_operationToId']['has'](_0x5ccc7c)){const _0x3440d1=_0x378125()['slice'](0x1,0x12);this['_operationToId']['set'](_0x5ccc7c,_0x3440d1);}return this['_operationToId']['get'](_0x5ccc7c);}}}setIdForTheLastOperation(_0x440a06,_0x43899a){if(!_0x43899a)return;let _0x142ac7=_0x440a06['length'];for(;_0x142ac7--;){const _0x40e983=_0x440a06[_0x142ac7];this['_ignoredOperations']['has'](_0x40e983)||this['_operationToId']['set'](_0x40e983,_0x43899a);}}},ct=class extends _0x184fd3{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x35619e{static CommentsService=/* #__PURE__ -- @preserve */
26
- ((()=>_0x49580d)());['_services'];static get requires(){return[J,_0x432ec3,Q,_0x53a800];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x48d327){super(_0x48d327),this['_services']=new Map();}async init(){const _0x2cdcf7=this['context'],_0x431ac6=_0x2cdcf7['plugins']['get'](_0x432ec3);if(_0x2cdcf7['plugins']['get'](J)['addToReconnectionStack'](this),_0x431ac6['adapter']={'addCommentThread':async({channelId:_0x179120,threadId:_0x3364bb,comments:_0x67e851,resolvedAt:_0x58c59b,resolvedBy:_0x3d18ee,context:_0x107738,attributes:_0x1ccc97})=>{const _0xea914a=await this['_getService'](_0x179120)['addCommentThread']({'commentThreadId':_0x3364bb,'comments':_0x67e851['map'](_0x502aae=>function(_0x544937,_0x2ce709,_0xec219e){return{'commentThreadId':_0xec219e,'commentId':_0x544937['commentId'],'userId':_0x544937['authorId'],'content':_0x544937['content'],'documentId':_0x2ce709,'createdAt':_0x544937['createdAt'],'attributes':_0x544937['attributes']||{}};}(_0x502aae,_0x179120,_0x3364bb)),'resolvedAt':_0x58c59b,'resolvedBy':_0x3d18ee,'context':_0x107738,'attributes':_0x1ccc97})['catch'](lt);return{'threadId':_0xea914a['commentThreadId'],'comments':_0xea914a['comments']};},'getCommentThread':async({channelId:_0x14f938,threadId:_0x309706})=>{const _0x1e6a62=await this['_getService'](_0x14f938)['getCommentThread'](_0x309706)['catch'](ht)['catch'](lt);return _0x1e6a62?_0x1e6a62['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x1e6a62]),{'threadId':_0x1e6a62['commentThreadId'],'comments':_0x1e6a62['comments']['map'](dt),'context':_0x1e6a62['context'],'resolvedAt':_0x1e6a62['resolvedAt'],'resolvedBy':_0x1e6a62['resolvedBy'],'attributes':_0x1e6a62['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x37d3fc,threadId:_0x1d91e4,context:_0x57233d,unlinkedAt:_0x47f3ae,attributes:_0xf1ca34})=>this['_getService'](_0x37d3fc)['updateCommentThread']({'commentThreadId':_0x1d91e4,'context':_0x57233d,'attributes':_0xf1ca34,'unlinkedAt':_0x47f3ae})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x146b28,threadId:_0xd0f808})=>{const _0x4987ac=await this['_getService'](_0x146b28)['resolveCommentThread'](_0xd0f808)['catch'](ht)['catch'](lt);return{'threadId':_0x4987ac['commentThreadId'],'resolvedAt':_0x4987ac['resolvedAt'],'resolvedBy':_0x4987ac['resolvedBy']};},'reopenCommentThread':async({channelId:_0x1afd24,threadId:_0x35488b})=>this['_getService'](_0x1afd24)['reopenCommentThread'](_0x35488b)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x3ae7d0,threadId:_0x253929})=>this['_getService'](_0x3ae7d0)['removeCommentThread'](_0x253929)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x4ef6ca,threadId:_0x225c26,commentId:_0x2a1ba3,content:_0x555948,attributes:_0x4c76cf})=>this['_getService'](_0x4ef6ca)['addComment'](_0x225c26,_0x2a1ba3,_0x555948,_0x4c76cf)['catch'](lt),'updateComment':({channelId:_0x2e1cb9,threadId:_0x492ad4,commentId:_0x5365f9,content:_0x8cb79d,attributes:_0x15d7f1})=>this['_getService'](_0x2e1cb9)['updateComment'](_0x492ad4,_0x5365f9,_0x8cb79d,_0x15d7f1)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x217eb8,threadId:_0x4cbc93,commentId:_0x51308d})=>this['_getService'](_0x217eb8)['removeComment'](_0x4cbc93,_0x51308d)['catch'](ht)['catch'](lt)},_0x2cdcf7 instanceof _0x570df0){const _0x250b6a=_0x2cdcf7['config']['get']('collaboration.channelId'),_0x1e7a36=_0x2cdcf7['plugins']['get'](Q);await this['_setUpService'](_0x250b6a);const _0x44a657=await this['_services']['get'](_0x250b6a)['getConnectedSessions']();this['listenTo'](_0x1e7a36,'sessionAdd:'+_0x250b6a,(_0x10be0f,{session:_0x96fc65})=>{_0x96fc65['id']===_0x1e7a36['mySessionId']&&(_0x10be0f['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x96fc65['permissions'],_0x250b6a));}),_0x1e7a36['register'](_0x250b6a,_0x44a657);}}async _setUpService(_0xb5a0e4){if(this['_services']['has'](_0xb5a0e4))throw new _0x4aa6b2('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0xb5a0e4});const _0x2691ec=this['context']['plugins']['get'](_0x432ec3),_0x38f7d1=new CloudServicesCommentsAdapter['CommentsService'](_0xb5a0e4);this['_services']['set'](_0xb5a0e4,_0x38f7d1),this['listenTo'](_0x38f7d1,'commentThreadAdded',(_0x32183f,_0x13fe79)=>{const {commentThreadId:_0x2ca277,documentId:_0x40cec5,context:_0x20729b,attributes:_0x3210da,resolvedAt:_0x3142fa,resolvedBy:_0x39e840,comments:_0x6dfe62}=_0x13fe79;_0x2691ec['getCommentThread'](_0x2ca277)||_0x2691ec['addCommentThread']({'threadId':_0x2ca277,'channelId':_0x40cec5,'comments':_0x6dfe62?_0x6dfe62['map'](dt):[],'context':_0x20729b,'attributes':_0x3210da,'resolvedAt':_0x3142fa,'resolvedBy':_0x39e840,'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentThreadUpdated',(_0x78e0b3,{commentThreadId:_0x5abce4,documentId:_0x125296,context:_0x5903a9,unlinkedAt:_0x1fe8cb,attributes:_0x163bc0})=>{_0x2691ec['getCommentThread'](_0x5abce4)&&_0x2691ec['updateCommentThread']({'threadId':_0x5abce4,'channelId':_0x125296,'context':_0x5903a9,'unlinkedAt':_0x1fe8cb,'attributes':_0x163bc0,'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentThreadResolved',(_0x53d3d3,{commentThreadId:_0x30b96b,resolvedBy:_0x4a519,resolvedAt:_0x449e8c})=>{const _0xde99bb=_0x2691ec['getCommentThread'](_0x30b96b);_0xde99bb&&_0xde99bb['resolve']({'resolvedBy':_0x4a519,'resolvedAt':_0x449e8c,'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentThreadReopened',(_0x21da35,{commentThreadId:_0x715d39})=>{const _0x4d174c=_0x2691ec['getCommentThread'](_0x715d39);_0x4d174c&&_0x4d174c['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentThreadRemoved',(_0x5adc70,{commentThreadId:_0x58a962})=>{const _0x23b010=_0x2691ec['getCommentThread'](_0x58a962);_0x23b010&&_0x23b010['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentAdded',(_0x22153b,_0x4882a4)=>{const _0x5b996a=_0x4882a4['commentThreadId'],_0x2576b4=_0x2691ec['getCommentThread'](_0x5b996a);_0x2576b4&&_0x2576b4['addComment']({...dt(_0x4882a4),'isFromAdapter':!0x0});}),this['listenTo'](_0x38f7d1,'commentUpdated',(_0x208c8e,{commentThreadId:_0x237b83,commentId:_0x2b83c6,content:_0x48657c,attributes:_0xca2b40})=>{const _0x130d2b=_0x2691ec['getCommentThread'](_0x237b83);if(_0x130d2b){const _0x5a66ae=_0x130d2b['getComment'](_0x2b83c6);_0x5a66ae&&_0x5a66ae['update']({'content':_0x48657c,'attributes':_0xca2b40,'isFromAdapter':!0x0});}}),this['listenTo'](_0x38f7d1,'commentRemoved',(_0x26eb6b,{commentThreadId:_0x226004,commentId:_0x41fa63})=>{const _0x326ed9=_0x2691ec['getCommentThread'](_0x226004);if(_0x326ed9){const _0x402f24=_0x326ed9['getComment'](_0x41fa63);_0x402f24&&_0x402f24['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x38f7d1,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0xb5a0e4),this['stopListening'](_0x38f7d1));}),await this['_connectService'](_0xb5a0e4);}destroy(){if(this['context']instanceof _0x570df0){const _0x5c48df=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x5c48df)&&this['_terminateService'](_0x5c48df);}}_terminateService(_0x5098b4){if(!this['_services']['has'](_0x5098b4))throw new _0x4aa6b2('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x5098b4});this['_getService'](_0x5098b4)['disconnect'](),this['_services']['delete'](_0x5098b4);}async reconnect(){for(const _0x5523d2 of this['_services']['keys']())await this['_connectService'](_0x5523d2);if(this['context']instanceof _0x570df0){const _0x5a13d=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x5a13d)){const _0x3f638d=this['context']['plugins']['get'](Q);_0x3f638d['unregister'](_0x5a13d);const _0x3e5827=await this['_services']['get'](_0x5a13d)['getConnectedSessions']();_0x3f638d['register'](_0x5a13d,_0x3e5827);}}}async _connectService(_0x45cc5c){const {connection:_0x413cad}=this['context']['plugins']['get'](J),_0xf8d126=this['context']['plugins']['get'](_0x432ec3),_0x4fae3f=await this['_services']['get'](_0x45cc5c)['connect'](_0x413cad);await this['_fetchMissingUsersForThreads'](_0x4fae3f);const _0x72ed37=new Set(Array['from'](_0xf8d126['getCommentThreads']({'channelId':_0x45cc5c}),_0x3d82b4=>_0x3d82b4['id']));for(const _0x1ba70a of _0x4fae3f)_0x1ba70a['deletedAt']||_0x72ed37['delete'](_0x1ba70a['commentThreadId']);for(const _0x110447 of _0x72ed37)_0xf8d126['getCommentThread'](_0x110447)['remove']({'isFromAdapter':!0x0});for(const _0x1ef8b2 of _0x4fae3f){let _0x1b4da2=_0xf8d126['getCommentThread'](_0x1ef8b2['commentThreadId']);const {commentThreadId:_0x48761a,context:_0x508960,attributes:_0x4a1af8,resolvedBy:_0x48e41d,resolvedAt:_0xbcf268,unlinkedAt:_0x4ed32a,deletedAt:_0x3ba057}=_0x1ef8b2;if(_0x3ba057)continue;_0x1b4da2||(_0x1b4da2=_0xf8d126['addCommentThread']({'channelId':_0x45cc5c,'threadId':_0x48761a,'context':_0x508960,'attributes':_0x4a1af8||{},'resolvedBy':_0x48e41d,'resolvedAt':_0xbcf268,'unlinkedAt':_0x4ed32a,'isFromAdapter':!0x0}));const _0x4ea87f=new Set(Array['from'](_0x1b4da2['comments'],_0x507bcf=>_0x507bcf['id']));for(const _0xb0d8f9 of _0x1ef8b2['comments'])_0x4ea87f['delete'](_0xb0d8f9['commentId']);for(const _0x45ac1d of _0x4ea87f)_0x1b4da2['getComment'](_0x45ac1d)['remove']({'isFromAdapter':!0x0});for(const _0x3a257b of _0x1ef8b2['comments']){const _0x160251=_0x1b4da2['getComment'](_0x3a257b['commentId']);_0x160251?_0x160251['content']!==_0x3a257b['content']&&_0x160251['update']({'content':_0x3a257b['content'],'isFromAdapter':!0x0}):_0x1b4da2['addComment'](Object['assign'](dt(_0x3a257b),{'isFromAdapter':!0x0}));}}}_getService(_0x52c341){if(!this['_services']['has'](_0x52c341))throw new _0x4aa6b2('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x52c341});return this['_services']['get'](_0x52c341);}async _fetchMissingUsersForThreads(_0x268f15){const _0xe9147c=this['context']['plugins']['get'](_0x53a800),{connection:_0x267e33}=this['context']['plugins']['get'](J),_0x36dc9c=new Set();for(const {resolvedBy:_0x3321d5,comments:_0x8a6458}of _0x268f15){_0x3321d5&&!_0xe9147c['getUser'](_0x3321d5)&&_0x36dc9c['add'](_0x3321d5);for(const {userId:_0x5746b0}of _0x8a6458)_0xe9147c['getUser'](_0x5746b0)||_0x36dc9c['add'](_0x5746b0);}if(0x0===_0x36dc9c['size'])return;const _0xcef3d8=await _0xbfb52f['getMany'](_0x267e33,Array['from'](_0x36dc9c));for(const _0x462235 of _0xcef3d8)_0xe9147c['getUser'](_0x462235['id'])||_0xe9147c['addUser'](_0x462235);}};async function ht(_0xc7fc93){if('404'!==_0xc7fc93['code'])throw _0xc7fc93;}function lt(_0x50e6b5){if((_0x550262=_0x50e6b5)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x550262['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x550262['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x550262;throw _0x50e6b5;}function dt(_0x5a0113){return{'threadId':_0x5a0113['commentThreadId'],'commentId':_0x5a0113['commentId'],'content':_0x5a0113['content'],'createdAt':_0x5a0113['createdAt'],'authorId':_0x5a0113['userId'],'attributes':_0x5a0113['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x184fd3{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x410fdb)());_bufferedRequests;_trackChangesService;static get requires(){return[at,_0x41ce2c,J];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3f439a){super(_0x3f439a);const _0x107494=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x107494);}init(){const _0x374001=this['editor']['plugins']['get'](J),_0xa957ae=this['editor']['plugins']['get'](_0x41ce2c);return _0xa957ae['adapter']={'getSuggestion':async _0x40b2bf=>{await this['_waitForServiceReady']();const _0x515314=await this['_trackChangesService']['get'](_0x40b2bf)['catch'](ft);return await this['_fetchMissingUsersForThreads']([_0x515314]),_0x515314;},'addSuggestion':async({id:_0xf5688a,type:_0x487710,data:_0x2c4eb1,originalSuggestionId:_0x212ecf,attributes:_0x168350})=>{await this['_waitForServiceReady']();const _0xc71770={'id':_0xf5688a,'type':_0x487710,'data':_0x2c4eb1,'originalSuggestionId':_0x212ecf,'attributes':_0x168350},_0x4f177d=await this['_trackChangesService']['add'](_0xf5688a,_0x487710,_0x2c4eb1,_0x212ecf,_0x168350)['catch'](_0x46c0c0=>{if(mt(_0x46c0c0))return new Promise(_0x5e8568=>{this['_bufferedRequests']['set'](_0xf5688a,{'resolve':_0x5e8568,'suggestionData':_0xc71770});});throw _0x46c0c0;});return this['_bufferedRequests']['delete'](_0xf5688a),_0x4f177d;},'updateSuggestion':async(_0x394519,_0x40ab53)=>{if(await this['_waitForServiceReady'](),'open'!==_0x40ab53['state'])return this['_trackChangesService']['update'](_0x394519,_0x40ab53)['catch'](ft);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x1c677c,_0x514604)=>{_0xa957ae['hasSuggestion'](_0x514604['id'])&&(_0xa957ae['getSuggestion'](_0x514604['id'])['attributes']=_0x514604['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x374001['connection']?.['state']&&(_0x374001['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x374001['connection'])['then'](_0x392d86=>(_0x374001['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x392d86)['then'](()=>{for(const _0x1df9ff of _0x392d86){_0xa957ae['addSuggestionData'](_0x1df9ff)['_saved']=!0x0;}})));}async reconnect(){const _0x10d0b8=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x33859d}=this['editor']['plugins']['get'](J),_0xc279dd=await this['_trackChangesService']['connect'](_0x33859d);await this['_fetchMissingUsersForThreads'](_0xc279dd);for(const {suggestionData:_0x25f54d,resolve:_0x295c60}of this['_bufferedRequests']['values']()){let _0x23aaa0=_0xc279dd['find'](_0x58af64=>_0x58af64['id']===_0x25f54d['id']);_0x23aaa0||(_0x23aaa0=await this['_trackChangesService']['add'](_0x25f54d['id'],_0x25f54d['type'],_0x25f54d['data'],_0x25f54d['originalSuggestionId'])),_0x295c60(_0x23aaa0);}for(const _0xc74e5 of _0xc279dd)_0x10d0b8['hasSuggestion'](_0xc74e5['id'])||_0x10d0b8['addSuggestionData'](_0xc74e5);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x139515=>{this['listenTo'](this['_trackChangesService'],'connected',_0x438b8c=>{_0x438b8c['off'](),_0x139515();});});}async _fetchMissingUsersForThreads(_0x360b0a){const _0x39d0a7=this['editor']['plugins']['get'](_0x53a800),{connection:_0x1bba5f}=this['editor']['plugins']['get'](J),_0x38a6d8=new Set();for(const {authorId:_0x5b45d4}of _0x360b0a)_0x39d0a7['getUser'](_0x5b45d4)||_0x38a6d8['add'](_0x5b45d4);if(0x0===_0x38a6d8['size'])return;const _0x295ff4=await _0xbfb52f['getMany'](_0x1bba5f,Array['from'](_0x38a6d8));for(const _0x3f91d5 of _0x295ff4)_0x39d0a7['getUser'](_0x3f91d5['id'])||_0x39d0a7['addUser'](_0x3f91d5);}};function ft(_0x2631eb){if(mt(_0x2631eb))return new Promise(()=>{});throw _0x2631eb;}function mt(_0x1602fc){return _0x1602fc['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1602fc['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var pt=class extends _0x184fd3{static get requires(){return[_0x18221d,at,ct,J];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x633400=this['editor']['plugins']['get'](J),_0xea1038=this['editor']['plugins']['get'](_0x3f60f2),_0x1dbf1d=this['editor']['plugins']['get'](at);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x633400,'change:state',(_0x2592ac,_0x20e97a,_0x5ba016)=>{_0xea1038['isThreadsLoadingPaused']='connected'!==_0x5ba016;});}),this['listenTo'](_0x633400,'change:state',(_0x443ef2,_0x3b4377,_0x27e642)=>{this['editor']['plugins']['get'](_0x432ec3)['switchReadOnly']('connected'!==_0x27e642);}),_0x1dbf1d['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x2aaa39=this['editor']['plugins']['get'](at),_0xf94f0d=this['editor']['config']['get']('collaboration.channelId');_0x2aaa39['_services']['has'](_0xf94f0d)&&_0x2aaa39['_terminateService'](_0xf94f0d),super['destroy']();}},gt=class extends _0x184fd3{static get requires(){return[pt,ut,_0x2e68c1];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class CloudServicesRevisionHistoryAdapter extends _0x184fd3{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
- ((()=>_0x2bbd58)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0x18afd8,Q,_0x53a800];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x508d31){super(_0x508d31);const _0x173f9=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x173f9);}async init(){const _0xbc2b65=this['editor']['plugins']['get'](it),_0x585d67=_0xbc2b65['serverHistory'],_0x91fd59=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x585d67,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0xbc2b65['sessionId']});const _0x456157=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x110cfc,_0x115042=await _0x49ae78['isBundleUploaded'](_0x91fd59['connection'],_0x456157);this['editor']['plugins']['get'](_0x18afd8)['adapter']={'getRevision':async({revisionId:_0x27a2b8})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x27a2b8)),'updateRevisions':async _0x470ef8=>{await this['_waitForServiceReady']();const _0x41f2f9=this['_revisionTracker']['currentRevision'];if(_0x115042&&0x1===_0x470ef8['length']&&_0x470ef8[0x0]['id']===_0x41f2f9['id'])return _0x470ef8;for(const _0x3bd89c of _0x470ef8)_0x3bd89c['id']===_0x41f2f9['id']&&(_0x3bd89c['isEmptyCurrent']=_0x3bd89c['fromVersion']===_0x3bd89c['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x470ef8,this['_lastRequestId'])['then'](_0x49bc31=>(this['_lastRequestId']=_0x49bc31,_0x470ef8))['catch'](_0x54c95f=>{if(vt(_0x54c95f)||'400'===_0x54c95f['code']&&void 0x0!==_0x54c95f['data']['wrongRequestId']){for(const _0x9746d1 of _0x470ef8)this['_revisionTracker']['repository']['getRevision'](_0x9746d1['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x9746d1['id'],_0x9746d1,!0x1);if(vt(_0x54c95f)&&'destroyed'!==this['editor']['state'])throw _0x54c95f;return _0x470ef8;}throw _0x54c95f;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x490d75,{revisionsData:_0x571c83,requestId:_0x1a282b})=>{Math['max'](..._0x571c83['map'](_0x4f9d44=>_0x4f9d44['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x571c83,_0x1a282b);}):this['_handleRevisionsUpdate'](_0x571c83,_0x1a282b);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x91fd59['connection']?.['state']&&(_0x91fd59['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x2134c7,requestId:_0x37e549}=await this['_revisionHistoryService']['connect'](_0x91fd59['connection']);_0x91fd59['addToReconnectionStack'](this),this['_lastRequestId']=_0x37e549,await this['_fetchMissingUsers'](_0x2134c7);for(const _0x217ecd of _0x2134c7)this['_revisionTracker']['addRevisionData'](_0x217ecd);this['listenTo'](_0xbc2b65,'change:_isConnected',(_0x36d90b,_0x29e1f1,_0x5153a8)=>{_0x5153a8&&(this['_oldOffset']=_0xbc2b65['_offset'],_0x36d90b['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x17a754=this['editor']['plugins']['get'](J),_0x5f50d3=this['editor']['plugins']['get'](it),_0x3b029f=async()=>{const _0x1c85c1=this['_revisionTracker']['currentRevision'],_0x2adcc1=_0x1c85c1['id'],_0x35a4b7=_0x2adcc1!==_0x5f50d3['sessionId'];if(_0x35a4b7){const _0x7bf721=_0x5f50d3['_offset']-this['_oldOffset'],_0x12463b=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x1c85c1['toVersion']+_0x7bf721!==_0x12463b){const _0x3499ab=_0x1c85c1['fromVersion']+_0x7bf721,_0x280567=this['editor']['plugins']['get'](_0x53a800),_0x11ed5a=this['_revisionTracker']['buildRevisionData']({'revision':_0x1c85c1,'from':_0x3499ab,'to':_0x12463b});_0x11ed5a['id']=_0x1c85c1['id'];const _0x18cc57=_0x11ed5a['authorsIds']['map'](_0x1b08ce=>_0x280567['getUser'](_0x1b08ce));_0x1c85c1['_update']({..._0x11ed5a,'authors':_0x18cc57},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x1c85c1['id'],_0x11ed5a,!0x0);}this['_revisionTracker']['_startingVersion']=_0x12463b,_0x1c85c1['toVersion']!==_0x1c85c1['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x2adcc1)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x2adcc1),this['_revisionTracker']['_createCurrentRevision'](_0x12463b);}const {revisions:_0x3f6420,requestId:_0x36a2d5}=await this['_revisionHistoryService']['reconnect'](_0x17a754['connection'],this['_lastRequestId']);_0x35a4b7&&_0x3f6420['length']>0x0?_0x5f50d3['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x3f6420),this['_handleRevisionsUpdate'](_0x3f6420,_0x36a2d5),this['_revisionTracker']['sendBufferedUpdates']());};return _0x5f50d3['_isConnected']?_0x3b029f():new Promise((_0x19e2f4,_0x1b2f01)=>{_0x5f50d3['once']('change:_isConnected',()=>{_0x3b029f()['then'](_0x19e2f4)['catch'](_0x1b2f01);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x3cc7b7=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x2626d1=>{_0x2626d1['off'](),_0x3cc7b7();});});}_getLatestVersionFromServerOperations(){const _0x1e8bc1=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0x32917a of _0x1e8bc1)if('marker'!==_0x32917a['type']||_0x32917a['affectsData'])return _0x32917a['baseVersion']+0x1;}_getLatestVersion(){const _0x5b68ae=this['editor']['plugins']['get'](it);return new Promise(_0x590db1=>{_0x5b68ae['_isPendingUpdate']?_0x5b68ae['once']('change:_isPendingUpdate',()=>{_0x590db1(this['_getLatestVersionFromServerOperations']());}):_0x590db1(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x291172,_0x3507f0){const _0x8c0995=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3507f0;for(const _0x3787d2 of _0x291172){const _0x591b64=_0x8c0995['getRevision'](_0x3787d2['id']);if(_0x591b64){if((_0x3787d2['fromVersion']||_0x3787d2['toVersion'])&&(_0x3787d2['diffData']=null),_0x591b64===this['_revisionTracker']['currentRevision']){const _0x2dfac3=Math['max'](_0x591b64['toVersion'],_0x3787d2['toVersion']),_0x28eebf=Math['max'](_0x591b64['fromVersion'],_0x3787d2['fromVersion']);let _0x3c6239;_0x591b64['toVersion']===_0x3787d2['toVersion']&&_0x591b64['fromVersion']===_0x3787d2['fromVersion']?(_0x3c6239=!0x0,this['_preventResendingRevisionData'](_0x3787d2)):_0x3787d2['toVersion']===_0x2dfac3&&_0x3787d2['fromVersion']===_0x28eebf?_0x3c6239=!0x1:(_0x591b64['toVersion']===_0x2dfac3&&_0x591b64['fromVersion']===_0x28eebf||this['_fixRevision']({'revision':_0x591b64,'from':_0x28eebf,'to':_0x2dfac3}),_0x3c6239=!0x0),_0x3c6239&&(delete _0x3787d2['fromVersion'],delete _0x3787d2['toVersion'],delete _0x3787d2['diffData'],delete _0x3787d2['createdAt'],delete _0x3787d2['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x3787d2),this['_preventResendingRevisionData'](_0x3787d2);}else this['_revisionTracker']['addRevisionData'](_0x3787d2);}const _0x48fae0=_0x8c0995['getRevisions']();_0x48fae0['reverse']();for(let _0xb304c5=0x0;_0xb304c5<_0x48fae0['length']-0x1;_0xb304c5++){const _0x460af7=_0x48fae0[_0xb304c5],_0x31cf95=_0x48fae0[_0xb304c5+0x1];if(_0x460af7['fromVersion']<_0x31cf95['toVersion']){const _0x24cdf0=_0x31cf95['toVersion'],_0x355b41=Math['max'](_0x24cdf0,_0x460af7['toVersion']);this['_fixRevision']({'revision':_0x460af7,'from':_0x24cdf0,'to':_0x355b41});}}}['_fixRevision']({revision:_0x4ce410,from:_0x290bbe,to:_0x3a3325}={}){const _0x2007dd=this['editor']['plugins']['get'](_0x53a800),_0x41438b=this['_revisionTracker']['buildRevisionData']({'revision':_0x4ce410,'from':_0x290bbe,'to':_0x3a3325});_0x41438b['authors']=_0x41438b['authorsIds']['map'](_0xd0a24=>_0x2007dd['getUser'](_0xd0a24)),_0x4ce410['_update'](_0x41438b);}_preventResendingRevisionData(_0x2792b9){const _0x8e1e14={};_0x8e1e14['id']=_0x2792b9['id'];for(const _0x30933d of Object['keys'](_0x2792b9))'id'!==_0x30933d&&(_0x8e1e14[_0x30933d]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x8e1e14['id'],_0x8e1e14,!0x0);}async _fetchMissingUsers(_0x1e47a2){const _0x38eead=this['editor']['plugins']['get'](_0x53a800),{connection:_0x2de608}=this['editor']['plugins']['get'](J),_0x3c5de0=new Set();for(const _0xbddb01 of _0x1e47a2){for(const _0x23672f of _0xbddb01['authorsIds'])_0x145d4e(_0x23672f);_0xbddb01['creatorId']&&_0x145d4e(_0xbddb01['creatorId']);}if(0x0===_0x3c5de0['size'])return;const _0x1361f0=await _0xbfb52f['getMany'](_0x2de608,Array['from'](_0x3c5de0));for(const _0x1dc96b of _0x1361f0)_0x38eead['getUser'](_0x1dc96b['id'])||_0x38eead['addUser'](_0x1dc96b);function _0x145d4e(_0x297736){_0x38eead['getUser'](_0x297736)||_0x3c5de0['add'](_0x297736);}}};function vt(_0x2834fd){return _0x2834fd['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x2834fd['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2834fd['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x184fd3{static get requires(){return[_0x18afd8,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x3e1902{_collapseAt;constructor(_0x522eae,_0x414c23=0x6){super(_0x522eae);const _0x110759=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x414c23,this['bind']('isHidden')['to'](this,'usersCount',_0x52780b=>_0x52780b<_0x414c23),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x110759['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':_0x110759['to']('usersCount',_0x24cd9e=>'+'+(_0x24cd9e-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x3e1902{items;keystrokes;constructor(_0x1d4ef8){super(_0x1d4ef8);const _0x10770a=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x4a20eb(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x10770a['if']('hasPopup'),'aria-expanded':_0x10770a['to']('isExpanded',_0x14097c=>this['hasPopup']&&String(_0x14097c)),'aria-label':_0x10770a['to']('hasPopup',_0x49ddf=>et(_0x1d4ef8,_0x49ddf?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x10770a['to']('hasPopup',_0x3d0bb5=>!!_0x3d0bb5&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0x4128c7,_0x45d6c7,_0x201e44)=>{this['element']&&(_0x201e44?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},kt=class extends _0x3e1902{counterView;inlineListView;constructor(_0x1ee0a4,_0x64e2d=0x6){super(_0x1ee0a4);const _0x4a08e0=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0x64e2d),this['inlineListView']=new bt(_0x1ee0a4),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4a1457 of this['inlineListView']['items'])_0x4a1457['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',_0x4a08e0['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x3e1902{listWrapperView;constructor(_0x210cf0,_0x5cc536){super(_0x210cf0),this['listWrapperView']=new St(_0x210cf0,_0x5cc536),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0x210cf0,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0x504fdf{constructor(_0x10f4ac,_0x3aeaa0){super(_0x10f4ac);const _0x36224d=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x3aeaa0?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x36224d['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x36224d['to']('role'),'aria-label':_0x36224d['to']('ariaLabel'),'aria-labelledby':_0x36224d['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x530d5e['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x15c150=this['element'];_0x15c150&&(this['_isScrollable']=Math['max'](_0x15c150['scrollHeight'],_0x15c150['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0x550a9f{['userView'];constructor(_0x5c0d13,_0x4806e8,_0x14e352){super(_0x5c0d13);const _0x507ca1=this['bindTemplate'];this['userView']=new _0x151f2b(_0x5c0d13,_0x4806e8);const _0x409a9b={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x4806e8['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x4806e8['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4806e8['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x4806e8['color']['getColorVariable'](),'--ck-user-color-alpha':_0x4806e8['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x14e352&&(_0x409a9b['tag']='button',_0x409a9b['on']={'click':_0x507ca1['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x409a9b);}['focus'](){this['element']['focus']();}},Ct=class extends _0x3e1902{['userView'];['markerView'];constructor(_0x7156bf,_0x57efae,_0x1ee68e){super(_0x7156bf);const _0x348059=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x151f2b(_0x7156bf,_0x57efae),this['markerView']=new At(_0x7156bf,_0x57efae);const _0x45c599=new _0x3cf6aa(_0x7156bf);_0x45c599['template']['tag']='span',_0x45c599['text']=_0x57efae['name'];const _0x23d2cf={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x348059['to']('isFocusable',_0x3aabd6=>!!_0x3aabd6&&0x0),'aria-labelledby':_0x45c599['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x348059['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x348059['to']('hasTooltip',_0xa93557=>!_0xa93557),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x45c599]};_0x1ee68e&&(_0x23d2cf['tag']='button',_0x23d2cf['on']={'click':_0x348059['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x23d2cf);}},At=class extends _0x3e1902{constructor(_0xbe8493,_0x12ebd1){super(_0xbe8493),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x12ebd1['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x12ebd1['color']['getColorVariable'](),'--ck-user-color-alpha':_0x12ebd1['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x35619e{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3f9c45){super(_0x3f9c45),this['context']['config']['define']('presenceList',Pt);const _0x4f2fb0=_0x3f9c45['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x4f2fb0)throw new _0x4aa6b2('presencelist-collapseat-invalid-format',this);if(_0x4f2fb0<0x1)throw new _0x4aa6b2('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x1f253d(),this['balloonPanelView']=new _0x1b91d3(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x1ef040 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x1ef040);this['listenTo'](this['_allConnectedUsers'],'add',(_0x4a112e,_0x3fe51e)=>{this['_handleUserAdd'](_0x3fe51e);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x37c210,_0x51ff7a)=>{this['_handleUserRemove'](_0x51ff7a);});}_createView(){const _0x4f0a4c=this['context'],_0xad52ca=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x4bf16e=this['balloonPanelView'];if(!_0x15e8aa(_0x4f0a4c['config']['get']('presenceList.container')))throw new _0x4aa6b2('presencelist-missing-container',this);_0xad52ca['counterView']['bind']('usersCount')['to'](this),_0xad52ca['bind']('isCollapsed')['to'](this,'usersCount',_0x8be97d=>{const {collapseAt:_0x3a39a2}=_0x4f0a4c['config']['get']('presenceList'),_0x500f9f=_0x8be97d>=_0x3a39a2;if(_0x500f9f&&!_0xad52ca['inlineListView']['items']['find'](_0x37a7c0=>_0x37a7c0 instanceof yt)){const _0x1eedfd=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x1eedfd&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0xad52ca['inlineListView']['items']['add'](_0xad52ca['counterView']);}return _0x500f9f||this['hideDropdown'](),_0x500f9f;}),_0xad52ca['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x4cd0c1=>{const _0x13aca4=_0x4f0a4c['config']['get']('presenceList'),_0x84cd6=new Ct(_0x4f0a4c['locale'],_0x4cd0c1,!!_0x13aca4['onClick']);return _0x84cd6['bind']('hasTooltip')['to'](_0xad52ca,'isCollapsed',_0x40e535=>!_0x40e535),_0x84cd6['bind']('isFocusable')['to'](_0xad52ca,'isCollapsed',_0x1ec435=>!_0x1ec435),_0x13aca4['onClick']&&this['listenTo'](_0x84cd6,'execute',()=>{this['view']['isCollapsed']||_0x13aca4['onClick'](_0x4cd0c1,_0x84cd6['element']);}),_0x84cd6;}),_0xad52ca['inlineListView']['keystrokes']['set']('Enter',(_0x382b07,_0x5c5217)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x5c5217());}),_0xad52ca['render'](),_0x4bf16e['render'](),_0xad52ca['listenTo'](_0xad52ca['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x2ffbf6=(_0xe744da,_0x412d53)=>{this['_hideDropdownUnlessPointerInside'](_0x412d53);};return _0xad52ca['listenTo'](_0xad52ca['inlineListView']['element'],'mouseleave',_0x2ffbf6),_0xad52ca['listenTo'](_0x4bf16e['element'],'mouseleave',_0x2ffbf6),_0x21bc0f({'emitter':_0xad52ca,'activator':()=>_0x4bf16e['isVisible'],'contextElements':[_0x4bf16e['element'],_0xad52ca['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x4f0a4c['config']['get']('presenceList.container')['appendChild'](_0xad52ca['element']),this['_overlayHost']=new _0x565793(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0xad52ca;}_resolveOverlayTarget(){const _0x1e43a4=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0x1e43a4)return _0x1e43a4;const _0x2e7fe3=this['context']['config']['get']('presenceList.container');return _0x2e7fe3?_0x432c87(_0x2e7fe3):null;}['_handleUserAdd'](_0x2bf2dd){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x2bf2dd['isMe'])return;const _0x4c52d6=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x4c52d6-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x1713b0=_0x2bf2dd['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x2bf2dd,_0x1713b0);}['_handleUserRemove'](_0x370544){this['usersCount']--;const {collapseAt:_0x1dc6ff}=this['context']['config']['get']('presenceList'),_0x38061f=this['usersCount']>=_0x1dc6ff;if(this['currentDisplayedUsers']['get'](_0x370544['id']))this['currentDisplayedUsers']['remove'](_0x370544['id']);else{if(_0x38061f&&this['currentDisplayedUsers']['length']+0x1===_0x1dc6ff-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x38061f?0x1:0x0)<this['usersCount']){for(const _0x1472bc of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x1472bc['id'])&&(this['currentDisplayedUsers']['add'](_0x1472bc,Math['min'](this['currentDisplayedUsers']['length']-(_0x38061f?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x38061f?0x1:0x0)===_0x1dc6ff-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0xcf8a54=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0xcf8a54['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x18e2d1}=this['presenceDropdownView'];_0x18e2d1['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x52cc46=>{if(!_0xcf8a54['displayMe']&&_0x52cc46['isMe'])return null;const _0x68cf57=new Tt(this['context']['locale'],_0x52cc46,!!_0xcf8a54['onClick']);return _0xcf8a54['onClick']&&this['listenTo'](_0x68cf57,'execute',()=>{_0xcf8a54['onClick'](_0x52cc46,_0x68cf57['element']);}),_0x68cf57;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x18e2d1['focus'](),_0x18e2d1['checkIfScrollable']();const _0x828dd4=(_0x4dc4cd,_0x9014b8)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x9014b8();};_0x18e2d1['keystrokes']['set']('Esc',_0x828dd4),_0x18e2d1['keystrokes']['set']('Shift+Tab',_0x828dd4),_0x18e2d1['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x18e2d1['focusTracker']['add'](this['view']['element']),_0x18e2d1['focusTracker']['on']('change:isFocused',(_0x1a4d12,_0x54295d,_0x27c511)=>{_0x27c511||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}_hideDropdownUnlessPointerInside(_0x495379){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x39dd87=>_0x3a6c3e(_0x39dd87,_0x495379))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x35619e{static get requires(){return[Q,Ot];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{at as CloudServicesCommentsAdapter,wt as CloudServicesRevisionHistoryAdapter,ut as CloudServicesTrackChangesAdapter,xt as PresenceList,Ot as PresenceListUI,it as RealTimeCollaborationClient,pt as RealTimeCollaborativeComments,ct as RealTimeCollaborativeEditing,_t as RealTimeCollaborativeRevisionHistory,gt as RealTimeCollaborativeTrackChanges,Q as Sessions,J as WebSocketGateway};
23
+ import{Context as _0x3acbaa,ContextPlugin as _0x438626,PendingActions as _0x5ddea2,Plugin as _0x15a09f}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x285801,Collection as _0x265f56,DomEmitterMixin as _0x22893b,KeystrokeHandler as _0x2ce588,getOverlayMountRoot as _0xe1b5ee,global as _0x5e4f24,trustedHtml as _0x19fe19,uid as _0x41c486,version as _0x39faf5}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x30be94,LabelView as _0x3782ba,ListItemView as _0x6981e8,ListView as _0x5b42d9,Notification as _0x530464,OverlayHost as _0x31c53a,View as _0x3703cb,clickOutsideHandler as _0x27e434}from'@ckeditor/ckeditor5-ui';import{History as _0x3bea19,InsertOperation as _0x3f58af,MarkerOperation as _0x379f17,ModelLiveRange as _0x135767,NoOperation as _0x147a36,OperationFactory as _0x284e3a,RootAttributeOperation as _0x3b940f,transformOperationSets as _0xf848a}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x48b051}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x5143d3,CommentsService as _0x321ef2,EditorService as _0x56d4ea,RevisionHistoryService as _0x2b9e5e,TrackChangesService as _0x386301,User as _0x3df04e,WEB_SOCKET_GATEWAY_STATES as _0x2a4354,WebSocketGateway as _0x198653}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0xb3ff22,Users as _0x3f8d3d,isPointerStillOver as _0x5b648d}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x58afcf}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x43ff1a,TrackChangesEditing as _0x2ea9f5}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x3bac5c,CommentsEditing as _0x3cf71e,CommentsRepository as _0x2739e7}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x1c9ff7}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x49cf94}from'es-toolkit/compat';var J=class WebSocketGateway extends _0x438626{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
+ ((()=>_0x198653)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x48b051,_0x530464];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3cd0a3){super(_0x3cd0a3),this['set']('state',_0x2a4354['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x22893b())();}init(){const _0x1b4e75=this['context'],_0x20ebef=_0x1b4e75['plugins']['get'](_0x48b051),_0x3e5fc0=_0x1b4e75['plugins']['get'](_0x530464);if(!_0x20ebef['token'])throw new _0x285801('websocketgateway-missing-token',this);if(!_0x20ebef['webSocketUrl'])throw new _0x285801('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'](_0x20ebef['token'],_0x20ebef['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x5c7de5=>{if(this['connection']=_0x5c7de5,this['bind']('state')['to'](_0x5c7de5,'state',this,'_isBrowserOffline',(_0x39eefb,_0x54f1f0)=>('connected'!==_0x39eefb&&(this['_shouldPluginsReconnect']=!0x0),_0x54f1f0||_0x39eefb!==_0x2a4354['CONNECTED']?_0x2a4354['DISCONNECTED']:this['state']==_0x2a4354['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x2a4354['CONNECTING']):_0x2a4354['CONNECTED'])),this['connection']['on']('error',(_0x472ead,_0x4478ce)=>{if('limitExceeded'!==_0x4478ce['code'])throw console['error'](_0x4478ce),new _0x285801('cloudservices-init',null,{'originalError':_0x4478ce});_0x3e5fc0['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'});}),!_0x5c7de5['me'])return new Promise(_0x3ad2d0=>_0x5c7de5['on']('change:me',_0x3ad2d0));})['catch'](_0x4e62dc=>{throw console['error'](_0x4e62dc),new _0x285801('cloudservices-init',null,{'originalError':_0x4e62dc});});}addToReconnectionStack(_0x16172c){if('function'!=typeof _0x16172c['reconnect'])throw new _0x285801('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x16172c))throw new _0x285801('websocketgateway-plugin-already-registered',this,{'name':_0x16172c['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x16172c);}removeFromReconnectionStack(_0x1986b7){this['_reconnectionStack']['delete'](_0x1986b7);}isInReconnectionStack(_0x34c9f5){return this['_reconnectionStack']['has'](_0x34c9f5);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0xd17145=>_0xd17145['reconnect']())))['then'](()=>this['state']=_0x2a4354['CONNECTED'])['catch'](_0x1f9d8d=>{throw console['error'](_0x1f9d8d),new _0x285801('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x2a4354['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x438626{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[J,_0x3f8d3d];}constructor(_0x50af85){super(_0x50af85),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x265f56(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x3f8d3d);}init(){const _0x27a0c9=this['context']['plugins']['get'](J);this['listenTo'](_0x27a0c9,'change:state',(_0x189b86,_0x48179e,_0x3bbcde)=>{if('connected'!==_0x3bbcde)this['channelSessions']['forEach'](_0x4b4b93=>_0x4b4b93['clear']()),this['channelConnectedUsers']['forEach'](_0x230f99=>_0x230f99['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x2709be,_0x1925f6]of this['_registeredSessions'])for(const _0x469928 of _0x1925f6)this['_handleSessionAdd'](_0x2709be,_0x469928);}}),this['_createUser'](_0x27a0c9['connection']['me'],!0x0);}register(_0x8f6c7f,_0x48f48f){if(this['_registeredSessions']['has'](_0x8f6c7f))throw new _0x285801('sessions-register-already-registered',null,{'channelId':_0x8f6c7f});this['_registeredSessions']['set'](_0x8f6c7f,_0x48f48f),this['channelSessions']['set'](_0x8f6c7f,new _0x265f56()),this['channelConnectedUsers']['set'](_0x8f6c7f,new _0x265f56()),this['listenTo'](_0x48f48f,'add',(_0x4506c4,_0x407416)=>this['_handleSessionAdd'](_0x8f6c7f,_0x407416)),this['listenTo'](_0x48f48f,'remove',(_0x13d023,_0x1aae8e)=>this['_handleSessionRemove'](_0x8f6c7f,_0x1aae8e));for(const _0xe1b43a of _0x48f48f)this['_handleSessionAdd'](_0x8f6c7f,_0xe1b43a);}unregister(_0x6f032){if(!this['_registeredSessions']['has'](_0x6f032))throw new _0x285801('sessions-unregister-not-exist',null,{'channelId':_0x6f032});const _0x1bde75=this['_registeredSessions']['get'](_0x6f032);this['stopListening'](_0x1bde75);for(const _0x1f707a of _0x1bde75)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x6f032,_0x1f707a);this['_registeredSessions']['delete'](_0x6f032),this['channelSessions']['delete'](_0x6f032),this['channelConnectedUsers']['delete'](_0x6f032);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0x2b7f00){for(const _0x4741b4 of this['channelSessions']['values']())for(const _0x4b7ecd of _0x4741b4)if(_0x4b7ecd['id']===_0x2b7f00)return _0x4b7ecd['user'];}getUserSessions(_0x2740ec,_0x28142e){const _0x5bb9ad=_0x28142e?[this['channelSessions']['get'](_0x28142e)]:this['channelSessions']['values'](),_0x31b368=new Set();for(const _0x5be9c0 of _0x5bb9ad)for(const _0x499922 of _0x5be9c0)_0x499922['user']['id']===_0x2740ec['id']&&_0x31b368['add'](_0x499922['id']);return _0x31b368;}getUserRole(_0x44f89e){for(const _0x517781 of this['channelSessions']['values']())for(const _0x11ae0e of _0x517781)if(_0x11ae0e['user']===_0x44f89e)return _0x11ae0e['role'];}['_handleSessionAdd'](_0x2d9353,_0x50a5ce){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x5eeff3=_0x50a5ce['user'],_0x4db0a9=this['_users']['getUser'](_0x5eeff3['id'])||this['_createUser'](_0x5eeff3),_0x1af5df=Object['assign']({},_0x50a5ce,{'user':_0x4db0a9});if(this['channelSessions']['get'](_0x2d9353)['add'](_0x1af5df),!_0x5eeff3['hiddenInPresenceList']){const _0x4e56d0=this['channelConnectedUsers']['get'](_0x2d9353);_0x4e56d0['has'](_0x4db0a9['id'])||_0x4e56d0['add'](_0x4db0a9),this['allConnectedUsers']['has'](_0x4db0a9['id'])||_0x5eeff3['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x4db0a9,_0x4db0a9['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x2d9353,{'channelId':_0x2d9353,'session':_0x1af5df});}['_handleSessionRemove'](_0xb0c68,_0x17c59e){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0xd1f586=this['channelConnectedUsers']['get'](_0xb0c68),_0x1d5619=_0x17c59e['user'];_0x1d5619['id']&&(this['channelSessions']['get'](_0xb0c68)['remove'](_0x17c59e['id']),_0xd1f586['has'](_0x1d5619['id'])&&!this['getUserSessions'](_0x1d5619,_0xb0c68)['size']&&_0xd1f586['remove'](_0x1d5619['id']),this['allConnectedUsers']['get'](_0x1d5619['id'])&&!this['getUserSessions'](_0x1d5619)['size']&&this['allConnectedUsers']['remove'](_0x1d5619['id']));}_createUser(_0x489599,_0x56a36c){const _0x4bec94=this['_users']['addUser'](_0x489599);return _0x56a36c&&this['_users']['defineMe'](_0x489599['id']),_0x4bec94['orderNumber']=this['_uniqueUsersCount']++,_0x4bec94;}},X=class extends _0x15a09f{_domEmitter=new(_0x22893b())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x15043a=this['editor'],_0x189854=_0x15043a['plugins']['get'](Q);_0x15043a['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x141b89,{writer:_0x3072f9})=>function(_0x1de7a0,_0x112b77,_0x4feb9f,_0x133221){const _0x5dbc88=_0x1de7a0['markerName']['split'](':')[0x2],_0x4cfc45=_0x4feb9f['getUserBySessionId'](_0x5dbc88);if(!_0x4cfc45||_0x5dbc88===_0x4feb9f['mySessionId'])return;if(!_0x133221['model']['schema']['checkChild'](_0x1de7a0['markerRange']['start'],'$text'))return;const _0x5c31e9={'class':'ck-user__marker\x20'+_0x4cfc45['color']['getMarkerClass'](),'style':tt(_0x4cfc45),'data-name':_0x4cfc45['name'],'data-session-id':_0x5dbc88},_0x21776d=_0x133221['model']['markers']['get'](_0x1de7a0['markerName'])['getStart'](),_0x290119=_0x21776d['nodeAfter'],_0x519cd5=_0x133221['model']['schema'];if(_0x290119&&_0x519cd5['isObject'](_0x290119)&&_0x519cd5['isInline'](_0x290119)&&!_0x133221['model']['markers']['get']('user:range:'+_0x5dbc88)['getRange']()['isCollapsed'])return;const _0x530cb=_0x21776d['parent'];return _0x133221['model']['schema']['isLimit'](_0x530cb)&&!_0x133221['model']['hasContent'](_0x530cb)&&(_0x5c31e9['contenteditable']=!0x1),function(_0x208737,_0x3dc2f2,_0x25d2c7){const _0x5806af=_0x208737['createUIElement']('span',_0x3dc2f2);return _0x208737['setCustomProperty']('userPositionMarker',!0x0,_0x5806af),_0x5806af['render']=function(_0x535066){const _0x423513=this['toDomElement'](_0x535066),_0x521ab7=document['createElement']('span');return _0x521ab7['classList']['add']('ck-user__marker-tooltip'),_0x521ab7['setAttribute']('contenteditable','false'),_0x521ab7['setAttribute']('spellcheck','false'),_0x521ab7['textContent']=_0x25d2c7['name'],_0x423513['innerHTML']=_0x19fe19('⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x521ab7['outerHTML']+'⁠'),_0x423513['addEventListener']('mouseenter',()=>{_0x423513['classList']['add']('ck-user__marker_hovered');}),_0x423513['addEventListener']('mouseleave',()=>{_0x423513['classList']['remove']('ck-user__marker_hovered');}),_0x423513;},_0x5806af['isSimilar']=function(_0x189c08){return!(!this['getCustomProperty']('userPositionMarker')||!_0x189c08['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x189c08['getAttribute']('data-session-id'));},_0x5806af;}(_0x112b77,_0x5c31e9,_0x4cfc45);}(_0x141b89,_0x3072f9,_0x189854,_0x15043a)}),_0x15043a['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x29e7e8=>function(_0x315cad,_0x3ec869){const _0x601e61=_0x315cad['markerName']['split'](':')[0x2];if(_0x601e61===_0x3ec869['mySessionId'])return null;const _0x97609d=_0x3ec869['getUserBySessionId'](_0x601e61);return _0x97609d?{'id':_0x601e61,'classes':['ck-user__selection',_0x97609d['color']['getSelectionClass']()],'attributes':{'style':tt(_0x97609d),'data-session-id':_0x601e61},'priority':0x7d0+_0x97609d['orderNumber']}:{'id':_0x601e61,'classes':[]};}(_0x29e7e8,_0x189854)}),function(_0x59b624){const _0x5104bb=_0x59b624['model'],_0x347577=new Map(),_0x2bfbc9=_0x59b624['plugins']['get'](Q);_0x5104bb['markers']['on']('update:user:range',(_0x2272a6,_0x1c733e,_0x42577a,_0x29985e)=>{if(!_0x29985e&&_0x347577['get'](_0x1c733e['name']))return _0x347577['get'](_0x1c733e['name'])['detach'](),void _0x347577['delete'](_0x1c733e['name']);const _0x4c1f0b=_0x1c733e['name']['split'](':')[0x2];if(_0x4c1f0b===_0x2bfbc9['mySessionId'])return;const _0x3f7451='user:position:'+_0x4c1f0b;_0x5104bb['markers']['has'](_0x3f7451)&&_0x59b624['editing']['reconvertMarker'](_0x3f7451),_0x1c733e['on']('change:range',(_0x4047a8,_0x4c4bbb,_0x3328ca)=>{if('$graveyard'!=_0x4c4bbb['root']['rootName']&&'$graveyard'==_0x1c733e['getRange']()['root']['rootName']&&!_0x347577['has'](_0x1c733e['name'])){const _0x14b4a7=_0x5104bb['schema']['getNearestSelectionRange'](_0x3328ca['deletionPosition']);if(_0x14b4a7){const _0x465132=_0x135767['fromRange'](_0x14b4a7);_0x347577['set'](_0x1c733e['name'],_0x465132),_0x465132['on']('change:range',(_0x46c614,_0xb654eb,_0x54bcc0)=>{if('$graveyard'==_0x465132['root']['rootName']){const _0x583794=_0x5104bb['schema']['getNearestSelectionRange'](_0x54bcc0['deletionPosition']);_0x583794?(_0x465132['start']=_0x583794['start'],_0x465132['end']=_0x583794['end']):(_0x347577['delete'](_0x1c733e['name']),_0x465132['detach']());}});}}});}),_0x5104bb['document']['on']('change',()=>{_0x347577['size']>0x0&&_0x5104bb['enqueueChange']({'isUndoable':!0x1},_0x1c6f51=>{for(const [_0xfc1eca,_0x5df19c]of _0x347577)'$graveyard'==_0x5104bb['markers']['get'](_0xfc1eca)['getRange']()['root']['rootName']&&(Z(_0xfc1eca['split'](':')[0x2],_0x5df19c['toRange'](),_0x5104bb,_0x1c6f51),_0x5df19c['detach']());_0x347577['clear']();});});}(_0x15043a),this['_domEmitter']['listenTo'](_0x5e4f24['document'],'keydown',(_0x3b2398,{key:_0x36c0f2})=>{'Escape'===_0x36c0f2&&function(_0x2044d8){_0x2044d8['editing']['view']['change'](_0x6ed479=>{for(const _0x1326f6 of _0x2044d8['model']['markers']){if(!_0x1326f6['name']['startsWith']('user:position'))continue;const _0x36de22=_0x2044d8['editing']['mapper']['markerNameToElements'](_0x1326f6['name']);if(_0x36de22){for(const _0x203b84 of _0x36de22)_0x6ed479['removeClass']('ck-user__marker_hovered',_0x203b84);}}});}(_0x15043a);},{'useCapture':!0x0});}afterInit(){const _0x4e8d09=this['editor'],_0xb4d96d=_0x4e8d09['commands']['get']('undo');_0xb4d96d&&_0x4e8d09['model']['on']('applyOperation',(_0x3b68c8,_0x4058bf)=>{const _0x3cf8db=_0x4058bf[0x0];if(!_0x3cf8db['isDocumentOperation'])return;if('marker'!=_0x3cf8db['type']||!_0x3cf8db['name']['startsWith']('user:'))return;const _0x2b950d=_0x3cf8db['batch'];_0xb4d96d['_createdBatches']['has'](_0x2b950d)&&(_0x3cf8db['newRange']=_0x3cf8db['oldRange']?_0x4e8d09['model']['createRange'](_0x3cf8db['oldRange']['start'],_0x3cf8db['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x570d6c=this['editor'],_0x4c1b7a=_0x570d6c['model']['document'],_0x54d448=_0x570d6c['plugins']['get'](Q);_0x570d6c['model']['enqueueChange']({'isUndoable':!0x1},_0x49379d=>{const _0x37b6db='user:range:'+_0x54d448['mySessionId'],_0x429d64='user:position:'+_0x54d448['mySessionId'],_0x5be489=_0x570d6c['model']['markers']['has'](_0x37b6db);_0x570d6c['editing']['view']['hasDomSelection']?Z(_0x54d448['mySessionId'],_0x4c1b7a['selection']['getFirstRange'](),_0x570d6c['model'],_0x49379d):_0x5be489&&(_0x49379d['removeMarker'](_0x37b6db),_0x49379d['removeMarker'](_0x429d64));});}};function Z(_0x455c43,_0x2d32af,_0x49d040,_0x2ef8f1){const _0x33b240='user:range:'+_0x455c43,_0x582227='user:position:'+_0x455c43,_0x293a22=_0x2d32af['getContainedElement']();let _0xd15db7=_0x2d32af['start'];if(_0x293a22&&_0x293a22['is']('element','tableCell')){const _0x30eaea=function(_0x4c3da9,_0x549064){for(const _0x157401 of _0x4c3da9['getPositions']())if(_0x549064['schema']['checkChild'](_0x157401,'$text'))return _0x157401;}(_0x2d32af,_0x49d040);_0x30eaea&&(_0xd15db7=_0x30eaea,_0x2d32af=_0x2ef8f1['createRange'](_0xd15db7));}const _0x459aba=_0x2ef8f1['createRange'](_0xd15db7);_0x49d040['markers']['has'](_0x33b240)?(_0x2ef8f1['updateMarker'](_0x33b240,{'range':_0x2d32af}),_0x2ef8f1['updateMarker'](_0x582227,{'range':_0x459aba})):(_0x2ef8f1['addMarker'](_0x33b240,{'range':_0x2d32af,'usingOperation':!0x0}),_0x2ef8f1['addMarker'](_0x582227,{'range':_0x459aba,'usingOperation':!0x0}));}function tt(_0x629744){return'--ck-user-color:'+_0x629744['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x629744['color']['getColorAlphaVariable']()+';';}function et(_0x5b0cdd,_0x5da44a,_0x2976f5){const _0x2efc16=_0x5b0cdd['t'],t=_0x5b0cdd['t'];switch(_0x5da44a){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 _0x2efc16({'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'},_0x2976f5);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x15a09f{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x5143d3)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[J,Q,X,_0x5ddea2,_0x3f8d3d,_0x530464];}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 _0x3ee44b=this['serverHistory']['getOperations']();for(let _0x368642=_0x3ee44b['length']-0x1;_0x368642>=0x0;_0x368642--){const _0x1ba332=_0x3ee44b[_0x368642];if(!this['_disconnectionOperations']['has'](_0x1ba332))return _0x1ba332['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x1c870a){if(super(_0x1c870a),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x3bea19(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x285801('collaboration-missing-channelid',this);const _0x2b077e=_0x1c870a['config']['get']('cloudServices.bundleVersion')||_0x39faf5;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x2b077e,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x58afcf(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new rt(this['_disconnectionOperations']);}init(){const _0x467cb2=this['editor'],_0x46d723=_0x467cb2['plugins']['get'](_0x3f8d3d),_0x4a436e=_0x467cb2['plugins']['get'](J);this['listenTo'](_0x46d723,'getOperationAuthor',(_0x26a2c5,_0x51a1b7)=>{const _0x25144a=_0x51a1b7[0x0];_0x25144a['_authorId']&&(_0x26a2c5['return']=_0x46d723['getUser'](_0x25144a['_authorId']),_0x26a2c5['stop']()),null===_0x25144a['_authorId']&&(_0x26a2c5['return']=null,_0x26a2c5['stop']());},{'priority':'high'}),this['listenTo'](_0x467cb2['model']['document']['selection'],'change:range',(_0x49584c,_0x3d37d6)=>{_0x3d37d6['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x467cb2['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x467cb2['model']['on']('applyOperation',(_0x5f295f,_0x5510b0)=>{const _0x18470f=_0x5510b0[0x0];_0x18470f['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x18470f),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x4a436e,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x5177ef,_0x4118a5,_0x19519d)=>'connected'===_0x5177ef&&!_0x4118a5&&!_0x19519d),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x467cb2['disableReadOnlyMode']('rtc-offline'):_0x467cb2['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x467cb2['disableReadOnlyMode']('rtc-offline'):_0x467cb2['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x57b2f4=this['editor']['plugins']['get'](Q),_0x273846=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0x57b2f4['unregister'](this['_channelId']);const _0xc3bf3f=await this['_service']['reconnect'](_0x273846['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0xc3bf3f)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x543b16=await this['_service']['getConnectedSessions']();_0x57b2f4['register'](this['_channelId'],_0x543b16),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4f45ce){if(function(_0x523e19){return'404'===_0x523e19['code'];}(_0x4f45ce)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4b1062){return'409'===_0x4b1062['code'];}(_0x4f45ce)){const _0x634a44=et(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x634a44);}else{if(!(_0x4f45ce instanceof nt))throw _0x4f45ce;this['_handleReconnectionError']();}}}}destroy(){const _0x5393c3=this['editor']['plugins']['get'](J),_0x2e3b36=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x2e3b36['channelSessions']['has'](this['_channelId'])&&_0x2e3b36['unregister'](this['_channelId']),_0x5393c3['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x299c9f){if(this['sessionId']!==_0x299c9f['sessionId']&&this['_lastSyncedOperationId']!==_0x299c9f['lastOperationId'])throw new nt();return this['sessionId']=_0x299c9f['sessionId'],this['_handleServerResponse']([],{..._0x299c9f,'wereChangesApplied':!0x1,'data':_0x299c9f['data']},'reconnect');}async _connectService(_0x35ce71,_0x160bc5=!0x1){const {connection:_0x5626f4}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x5626f4,this['_channelId'])['then'](_0x5004e9=>this['_initSessionsHandling'](_0x5004e9))['catch'](_0x3750e4=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x3750e4);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x5d866a,_0x2b58a5)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x2b58a5);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x506c09=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x35ce71);this['_isPendingUpdate']=!0x0;const _0x36bb7f=await this['_service']['connect'](_0x5626f4,this['_compressOperations'](_0x35ce71),_0x506c09);if(this['sessionId']=_0x36bb7f['sessionId'],_0x160bc5){if(!_0x36bb7f['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x36bb7f['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x35ce71,_0x36bb7f,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x36bb7f,_0x35ce71);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x76a0f3=this['editor']['plugins']['get'](Q),_0xc6695e=this['editor']['plugins']['get'](X),_0x1cc54d=_0x76a0f3['channelSessions']['get'](this['_channelId']);_0x1cc54d&&_0x1cc54d['length']>0x1?_0xc6695e['createUserMarkerOperations']():this['listenTo'](_0x76a0f3,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x76a0f3['channelSessions']['get'](this['_channelId'])['length']&&_0xc6695e['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x225a6f,_0x379ab7,_0x139e24,_0x7787dd){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x379ab7){const _0x13da7c=this['_decompressOperations'](_0x139e24,_0x7787dd);await this['_fetchMissingUsers'](_0x13da7c),this['_handleExternalOperations'](_0x13da7c,_0x379ab7,_0x139e24['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x545afd}=this['editor'];let _0xdd58f;try{_0xdd58f=await this['_service']['getDocumentDetails']();}catch{const _0x40c7d6=et(_0x545afd,'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'](_0x40c7d6);}const _0x463496=_0xdd58f['currentDocumentSession']||_0xdd58f['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x463496['lastOperationId']){const _0x30610c=et(_0x545afd,'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'](_0x30610c);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x31d8cc=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0x31d8cc['connection']||'connected'!==_0x31d8cc['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0xd1c343=this['editor']['plugins']['get'](Q);_0xd1c343['channelSessions']['has'](this['_channelId'])&&_0xd1c343['unregister'](this['_channelId']),_0x31d8cc['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x557291){const _0x14945e=this['editor']['plugins']['get'](Q);this['listenTo'](_0x14945e,'sessionAdd:'+this['_channelId'],(_0x4230c4,{session:_0x4b946d})=>{if(_0x4b946d['id']===_0x14945e['mySessionId']){_0x4230c4['off']();const _0x237113=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0xa5892=_0x4b946d['permissions'];_0x237113&&_0x237113['isEnabled']&&(_0xa5892=_0xa5892['filter'](_0x770b47=>'document:write'!==_0x770b47)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0xa5892,this['_channelId']);}}),_0x14945e['register'](this['_channelId'],_0x557291);}_initThrowingOnDataSet(){const _0x26ebdb=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x37ae62)=>{if(!_0x37ae62[_0x37ae62['length']-0x1]['suppressErrorInCollaboration'])throw new _0x285801('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x26ebdb['apply'](this['editor']['data'],_0x37ae62);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x50041a,[_0x52ad1b])=>{if(this['_document']['version'])throw new _0x285801('realtimecollaborationclient-init-document-already-initialized',this);_0x50041a['stop'](),this['_setPendingAction']();const _0x51fecc=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x48d53a])=>!_0x48d53a['lazyLoad'])['map'](([_0x329bef,_0x1e5a15])=>[_0x329bef,_0x1e5a15['modelAttributes']||{}])),_0x3ceee4=this['_getOperationsFromInitData'](_0x52ad1b,_0x51fecc);0x0==_0x3ceee4['length']&&_0x3ceee4['push'](new _0x147a36(0x0)),_0x50041a['return']=this['_connectService'](_0x3ceee4)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x5ed73c=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x5ed73c))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x924802,[_0x2846f5,_0x5d84ad])=>{_0x924802['stop']();const _0x251387=this['editor']['model']['document']['getRoot'](_0x2846f5);if(!this['_knownRootNames']['has'](_0x2846f5)){const _0x5bdd9b=_0x5d84ad&&_0x5d84ad['data']?_0x5d84ad['data']:'',_0x2e2cd5=_0x5d84ad&&_0x5d84ad['attributes']?_0x5d84ad['attributes']:{};await this['_loadRoot'](_0x2846f5,_0x5bdd9b,_0x2e2cd5);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x251387['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x251387);});},{'priority':'high'});}async _fetchMissingUsers(_0x42ba38){const _0x328477=this['editor']['plugins']['get'](_0x3f8d3d),{connection:_0xf37a93}=this['editor']['plugins']['get'](J),_0x4cccf7=new Set();for(const _0xea4e31 of _0x42ba38){const _0x2d9505=_0xea4e31['_authorId'];_0x2d9505&&!_0x328477['getUser'](_0x2d9505)&&_0x4cccf7['add'](_0x2d9505);}if(0x0===_0x4cccf7['size'])return;const _0xfa43c8=await _0x3df04e['getMany'](_0xf37a93,Array['from'](_0x4cccf7));for(const _0x5afe2a of _0xfa43c8)_0x328477['getUser'](_0x5afe2a['id'])||_0x328477['addUser'](_0x5afe2a);}_getOperationsFromInitData(_0x1f2574,_0x2db806={}){const _0x554275=this['editor']['model'],_0x3b203=[];let _0x3911cb=0x0;const _0x15cd64='string'==typeof _0x1f2574?{'main':_0x1f2574}:_0x1f2574;for(const _0x3c564c of Object['keys'](_0x15cd64)){if(!this['_document']['roots']['has'](_0x3c564c))throw new _0x285801('realtimecollaborationclient-init-non-existent-root',this);const _0x566b20=this['_document']['getRoot'](_0x3c564c),_0x66381a=this['editor']['data']['parse'](_0x15cd64[_0x3c564c],_0x566b20),_0x30da05=new _0x3f58af(_0x554275['createPositionAt'](_0x566b20,0x0),_0x66381a,_0x3911cb++);_0x3b203['push'](_0x30da05);for(const [_0x37ca62,_0x3d079c]of _0x66381a['markers']){const _0x224904=_0x554275['createRange'](_0x554275['createPositionFromPath'](_0x566b20,_0x3d079c['start']['path']['slice']()),_0x554275['createPositionFromPath'](_0x566b20,_0x3d079c['end']['path']['slice']())),_0x39d9cc=new _0x379f17(_0x37ca62,null,_0x224904,_0x554275['markers'],!0x0,_0x3911cb++);_0x3b203['push'](_0x39d9cc);}}if(_0x2db806)for(const [_0x35187a,_0x3a3cc3]of Object['entries'](_0x2db806)){const _0x217167=_0x554275['document']['getRoot'](_0x35187a);if(!_0x217167)throw new _0x285801('multi-root-editor-root-attributes-no-root',null);for(const [_0x1b693e,_0x37f497]of Object['entries'](_0x3a3cc3))if(null!==_0x37f497){const _0x39f2c2=new _0x3b940f(_0x217167,_0x1b693e,null,_0x37f497,_0x3911cb++);_0x3b203['push'](_0x39f2c2);}}return _0x3b203;}async _loadRoot(_0x2cb34c,_0x295337,_0x395ada){this['_getOperationsFromInitData']({[_0x2cb34c]:_0x295337},{[_0x2cb34c]:_0x395ada})['forEach']((_0x1a403f,_0x2c6b97)=>{_0x1a403f['baseVersion']=this['_document']['version']+_0x2c6b97,_0x1a403f['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x1a403f);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x2007b1,_0x3f5f64){let _0x23b6d8;this['_offset']=_0x2007b1['offset'];const _0xde241d=_0x2007b1['wereChangesApplied']&&!_0x2007b1['initData'],_0x15a7a2=_0xde241d?0x0:_0x2007b1['data']['baseVersion'];if(_0x3f5f64['forEach'](_0x409246=>{_0x409246['_isInit']=!0x0,_0x409246['createdAt']=_0x2007b1['sessionCreatedAt'],_0x409246['_authorId']=null;}),_0xde241d)_0x23b6d8=_0x3f5f64,this['_applyOperationsSet'](_0x23b6d8,_0xde241d);else{if(_0x2007b1['initData']){const _0x1ff93e=this['_getOperationsFromInitData'](_0x2007b1['initData']);this['_document']['history']['version']=-_0x1ff93e['length'],_0x1ff93e['forEach'](_0xf459f7=>{_0xf459f7['baseVersion']-=_0x1ff93e['length'],_0xf459f7['createdAt']=_0x2007b1['sessionCreatedAt'],_0xf459f7['_isInit']=!0x0,_0xf459f7['_authorId']=null;}),this['_applyOperationsSet'](_0x1ff93e,!0x0),this['serverHistory']['version']=-_0x1ff93e['length']+this['_offset'],this['_updateServerHistory'](_0x1ff93e);}this['_document']['history']['version']=_0x15a7a2,_0x23b6d8=this['_decompressOperations'](_0x2007b1['data'],_0x2007b1['metadata']),await this['_fetchMissingUsers'](_0x23b6d8),this['_applyOperationsSet'](_0x23b6d8,_0xde241d);}_0x2007b1['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x23b6d8,_0x2007b1['lastOperationId']),this['_lastSyncedOperationId']=_0x2007b1['lastOperationId']),this['serverHistory']['version']=_0x15a7a2+this['_offset'],this['_updateServerHistory'](_0x23b6d8),_0x3f5f64['filter'](_0x588d6d=>{const _0x2a5480=this['_getAffectedRoot'](_0x588d6d);return _0x2a5480&&!this['_knownRootNames']['has'](_0x2a5480);})['forEach']((_0x3c9bb3,_0x5906f3)=>{_0x3c9bb3['baseVersion']=this['_document']['version']+_0x5906f3,this['_saveOperationInBuffer'](_0x3c9bb3);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x1cfd06,_0x4c57d6){const _0x56e65c=_0x4c57d6&&_0x4c57d6['message'];if(_0x56e65c&&_0x56e65c['startsWith']('realtimecollaborationclient'))throw _0x4c57d6;const _0x16e3da=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0x16e3da['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x285801(_0x1cfd06,this['editor'],_0x56e65c?{'originalError':_0x56e65c}:void 0x0);}_saveOperationInBuffer(_0x4c4810){this['_knownOperations']['has'](_0x4c4810)||(this['_knownOperations']['add'](_0x4c4810),this['_bufferedOperations']['push'](_0x4c4810),this['_pendingAction']||'marker'==_0x4c4810['type']&&!_0x4c4810['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x558c59=!0x1){!_0x558c59&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x45762f=>{_0x45762f&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x2c9615=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x2ffe12){return _0x2ffe12['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2ffe12['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x2ffe12['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x2c9615)||this['_crash'](_0x2c9615['message'],_0x2c9615);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x26915e=>{this['on']('change:_isPendingUpdate',()=>{_0x26915e();});});}async _sendBufferedOperations(){const _0x4234c7=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0x4234c7['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x3fcc28=[...this['_bufferedOperations']];for(const _0x53872a of _0x3fcc28)_0x53872a['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x53872a);const _0x130e1f=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3fcc28),_0x68d941=st++,_0x35b88e=this['_compressOperations'](_0x3fcc28),_0x26d42f=await this['_service']['sendOperations'](_0x35b88e,_0x35b88e['baseVersion'],_0x130e1f);try{return await this['_handleServerResponse'](_0x3fcc28,_0x26d42f,_0x68d941);}catch(_0x256e6f){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x256e6f);}}async['_handleServerResponse'](_0x39af75,_0x17a5ee,_0x25d618){if('error'in _0x17a5ee)throw _0x17a5ee['error'];let _0xe8797e;if(_0x17a5ee['wereChangesApplied']){_0x17a5ee['lastOperationId']&&(this['_lastSyncedOperationId']=_0x17a5ee['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x33b434=>!_0x39af75['includes'](_0x33b434));for(const _0x3fd815 of _0x39af75)_0x3fd815['createdAt']='lastOperationAcceptedAt'in _0x17a5ee&&_0x17a5ee['lastOperationAcceptedAt']||void 0x0;ot(_0x39af75,_0x17a5ee['version']-_0x39af75['length']),this['_updateServerHistory'](_0x39af75);const _0x38d1ec=_0x39af75['filter'](_0x379c51=>{if(!_0x379c51['_isInit'])return!0x1;const _0x7d0bb7=this['_getAffectedRoot'](_0x379c51);return _0x7d0bb7&&!this['_knownRootNames']['has'](_0x7d0bb7);});ot(_0x38d1ec,this['_document']['version']),this['_applyOperationsSet'](_0x38d1ec),_0xe8797e=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x3b8268=this['_decompressOperations'](_0x17a5ee['data'],_0x17a5ee['metadata'])['filter'](_0x3846d7=>_0x3846d7['baseVersion']>=this['_lastServerVersion']);_0x3b8268['forEach'](_0x216b7b=>this['_addKnownRoot'](_0x216b7b)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x21e916=>!_0x21e916['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x21e916))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x3b8268),_0xe8797e=this['_handleExternalOperations'](_0x3b8268,_0x17a5ee['version'],_0x17a5ee['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0xe8797e?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x3bc490,_0x2a688d,_0x49e0ba){try{const _0x144c92={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x527648,operationsB:_0x33b124,originalOperations:_0x24fcc9}=_0xf848a(_0x3bc490,this['_bufferedOperations'],_0x144c92);ot(_0x527648,this['_document']['version']),ot(_0x33b124,_0x2a688d);for(const _0x865c8f of _0x527648){const _0x4e3254=_0x24fcc9['get'](_0x865c8f);_0x4e3254?(_0x865c8f['_authorId']=_0x4e3254['_authorId'],'noop'!==_0x865c8f['type']&&(_0x865c8f['_aiSource']=_0x4e3254['_aiSource'])):_0x865c8f['_authorId']=null;}for(const _0x33aec4 of _0x33b124)'noop'!==_0x33aec4['type']&&(_0x33aec4['_aiSource']=_0x24fcc9['get'](_0x33aec4)?.['_aiSource']);_0x49e0ba&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x3bc490,_0x49e0ba),this['_lastSyncedOperationId']=_0x49e0ba),this['_bufferedOperations']=[..._0x33b124],this['_applyOperationsSet'](_0x527648),this['_updateServerHistory'](_0x3bc490);}catch(_0x31f864){return console['error'](_0x31f864),!0x1;}return!0x0;}_applyOperationsSet(_0x14ddb9,_0x1e88fb=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x347cb6=>{for(const _0x57b75e of _0x14ddb9)this['_knownOperations']['add'](_0x57b75e),this['_addKnownRoot'](_0x57b75e),_0x347cb6['batch']['addOperation'](_0x57b75e),this['editor']['model']['applyOperation'](_0x57b75e);});}_addKnownRoot(_0x434f1d){const _0x297ea7=this['_getAffectedRoot'](_0x434f1d);_0x297ea7&&this['_knownRootNames']['add'](_0x297ea7);}_getAffectedRoot(_0x1971b2){let _0x1fd2e2,_0x124e3c;switch(_0x1971b2['type']){case'insert':_0x1fd2e2=_0x1971b2['position']['root'];break;case'marker':if(_0x124e3c=_0x1971b2['newRange'],!_0x124e3c)return null;_0x1fd2e2=_0x124e3c['root'];break;case'addRootAttribute':_0x1fd2e2=_0x1971b2['root'];break;case'addRoot':_0x1fd2e2=_0x1971b2['affectedSelectable'];break;case'move':_0x1fd2e2=_0x1971b2['targetPosition']['root'];break;default:return null;}return _0x1fd2e2['rootName'];}_updateServerHistory(_0x4961f7){_0x4961f7['forEach'](_0x4523a6=>{const _0x474563=_0x4523a6['clone']();_0x474563['_authorId']=_0x4523a6['_authorId'],_0x474563['_isInit']=!!_0x4523a6['_isInit'],_0x474563['_aiSource']=_0x4523a6['_aiSource'],_0x474563['createdAt']=_0x4523a6['createdAt'],_0x474563['baseVersion']+=this['_offset'],_0x4523a6['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x474563),this['serverHistory']['addOperation'](_0x474563);});}_handleReconnectionError(_0x51c396){const _0x4e219e=this['editor']['plugins']['get']('Notification'),_0x191b27=this['editor']['locale'];_0x51c396||(_0x51c396=et(_0x191b27,'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.')),_0x4e219e['showWarning'](_0x51c396,{'title':et(_0x191b27,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](J)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x5ddea2)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x5ddea2)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x83e734){const _0x32a69b=_0x83e734['map'](_0x5b6b42=>_0x5b6b42['toJSON']());return this['_compressor']['compress'](_0x32a69b);}_decompressOperations(_0x4fd275,_0x5ac950){return this['_compressor']['decompress'](_0x4fd275)['map']((_0x9b32ac,_0x31218b)=>{const _0x2c2330='init'==_0x5ac950[_0x31218b]['type'];if('InsertOperation'==_0x9b32ac['__className']){const _0x1367d9=_0x9b32ac['position']['root'];!this['_document']['getRoot'](_0x1367d9)&&(this['_document']['createRoot']('$unknown',_0x1367d9)['_isAttached']=!0x1);}else{if('RootOperation'==_0x9b32ac['__className']){const _0x365e62=this['_document']['getRoot'](_0x9b32ac['rootName']);_0x365e62&&'$unknown'==_0x365e62['name']&&_0x9b32ac['elementName']!=_0x365e62['name']&&(_0x365e62['name']=_0x9b32ac['elementName']);}}const _0x488acf=_0x284e3a['fromJSON'](_0x9b32ac,this['_document']);return _0x488acf['wasUndone']=_0x9b32ac['wasUndone'],_0x488acf['_isInit']=_0x2c2330,_0x488acf['_authorId']=_0x2c2330?null:_0x5ac950[_0x31218b]['userId'],_0x488acf['_isDisconnection']='cs:removeUser'===_0x5ac950[_0x31218b]['type'],_0x488acf['_aiSource']=_0x9b32ac['_aiSource']||void 0x0,_0x488acf['createdAt']=_0x5ac950[_0x31218b]['createdAt'],_0x488acf;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x193f82=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x193f82&&_0x193f82['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x3a1576,_0x517166){for(const _0x14af23 of _0x3a1576)_0x14af23['baseVersion']=_0x517166++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0x2f2962){this['_ignoredOperations']=_0x2f2962,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x31ebf9){let _0x59941a=_0x31ebf9['length'];for(;_0x59941a--;){const _0x61effe=_0x31ebf9[_0x59941a];if(!this['_ignoredOperations']['has'](_0x61effe)){if(!this['_operationToId']['has'](_0x61effe)){const _0x6989dc=_0x41c486()['slice'](0x1,0x12);this['_operationToId']['set'](_0x61effe,_0x6989dc);}return this['_operationToId']['get'](_0x61effe);}}}setIdForTheLastOperation(_0x4c2d31,_0x2509d2){if(!_0x2509d2)return;let _0x4d130d=_0x4c2d31['length'];for(;_0x4d130d--;){const _0x354abf=_0x4c2d31[_0x4d130d];this['_ignoredOperations']['has'](_0x354abf)||this['_operationToId']['set'](_0x354abf,_0x2509d2);}}},ct=class extends _0x15a09f{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x438626{static CommentsService=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x321ef2)());['_services'];static get requires(){return[J,_0x2739e7,Q,_0x3f8d3d];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x18c7c7){super(_0x18c7c7),this['_services']=new Map();}async init(){const _0x1f9af6=this['context'],_0x1c2f51=_0x1f9af6['plugins']['get'](_0x2739e7);if(_0x1f9af6['plugins']['get'](J)['addToReconnectionStack'](this),_0x1c2f51['adapter']={'addCommentThread':async({channelId:_0x21a46f,threadId:_0x375829,comments:_0x4e7aca,resolvedAt:_0x584b62,resolvedBy:_0x543789,context:_0x3934b1,attributes:_0x5d3677})=>{const _0x1005c5=await this['_getService'](_0x21a46f)['addCommentThread']({'commentThreadId':_0x375829,'comments':_0x4e7aca['map'](_0x17cacd=>function(_0xeac3d8,_0x41c590,_0x3a1f5d){return{'commentThreadId':_0x3a1f5d,'commentId':_0xeac3d8['commentId'],'userId':_0xeac3d8['authorId'],'content':_0xeac3d8['content'],'documentId':_0x41c590,'createdAt':_0xeac3d8['createdAt'],'attributes':_0xeac3d8['attributes']||{}};}(_0x17cacd,_0x21a46f,_0x375829)),'resolvedAt':_0x584b62,'resolvedBy':_0x543789,'context':_0x3934b1,'attributes':_0x5d3677})['catch'](lt);return{'threadId':_0x1005c5['commentThreadId'],'comments':_0x1005c5['comments']};},'getCommentThread':async({channelId:_0x46b343,threadId:_0xf68a5f})=>{const _0x28d17d=await this['_getService'](_0x46b343)['getCommentThread'](_0xf68a5f)['catch'](ht)['catch'](lt);return _0x28d17d?_0x28d17d['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x28d17d]),{'threadId':_0x28d17d['commentThreadId'],'comments':_0x28d17d['comments']['map'](dt),'context':_0x28d17d['context'],'resolvedAt':_0x28d17d['resolvedAt'],'resolvedBy':_0x28d17d['resolvedBy'],'attributes':_0x28d17d['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x4d58e9,threadId:_0x3383f3,context:_0x24a4da,unlinkedAt:_0x209b07,attributes:_0x300085})=>this['_getService'](_0x4d58e9)['updateCommentThread']({'commentThreadId':_0x3383f3,'context':_0x24a4da,'attributes':_0x300085,'unlinkedAt':_0x209b07})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x15852c,threadId:_0x15c122})=>{const _0x2bcbe1=await this['_getService'](_0x15852c)['resolveCommentThread'](_0x15c122)['catch'](ht)['catch'](lt);return{'threadId':_0x2bcbe1['commentThreadId'],'resolvedAt':_0x2bcbe1['resolvedAt'],'resolvedBy':_0x2bcbe1['resolvedBy']};},'reopenCommentThread':async({channelId:_0x56459f,threadId:_0x2aac0d})=>this['_getService'](_0x56459f)['reopenCommentThread'](_0x2aac0d)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x1a492c,threadId:_0x9857a1})=>this['_getService'](_0x1a492c)['removeCommentThread'](_0x9857a1)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x27b7c4,threadId:_0x452d8f,commentId:_0xfeb3f4,content:_0x5025a1,attributes:_0x32056b})=>this['_getService'](_0x27b7c4)['addComment'](_0x452d8f,_0xfeb3f4,_0x5025a1,_0x32056b)['catch'](lt),'updateComment':({channelId:_0x48c649,threadId:_0x1525b9,commentId:_0x584497,content:_0x54734d,attributes:_0x31cbd3})=>this['_getService'](_0x48c649)['updateComment'](_0x1525b9,_0x584497,_0x54734d,_0x31cbd3)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x27b666,threadId:_0x473fea,commentId:_0xb58e9b})=>this['_getService'](_0x27b666)['removeComment'](_0x473fea,_0xb58e9b)['catch'](ht)['catch'](lt)},_0x1f9af6 instanceof _0x3acbaa){const _0x1d7eeb=_0x1f9af6['config']['get']('collaboration.channelId'),_0x3d94c8=_0x1f9af6['plugins']['get'](Q);await this['_setUpService'](_0x1d7eeb);const _0x3211aa=await this['_services']['get'](_0x1d7eeb)['getConnectedSessions']();this['listenTo'](_0x3d94c8,'sessionAdd:'+_0x1d7eeb,(_0x33de35,{session:_0x1811d2})=>{_0x1811d2['id']===_0x3d94c8['mySessionId']&&(_0x33de35['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x1811d2['permissions'],_0x1d7eeb));}),_0x3d94c8['register'](_0x1d7eeb,_0x3211aa);}}async _setUpService(_0x229efb){if(this['_services']['has'](_0x229efb))throw new _0x285801('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x229efb});const _0x1e53d9=this['context']['plugins']['get'](_0x2739e7),_0x558239=new CloudServicesCommentsAdapter['CommentsService'](_0x229efb);this['_services']['set'](_0x229efb,_0x558239),this['listenTo'](_0x558239,'commentThreadAdded',(_0x258354,_0x3b0aae)=>{const {commentThreadId:_0x3f12a0,documentId:_0x458c83,context:_0x2599fe,attributes:_0x532016,resolvedAt:_0x76444f,resolvedBy:_0x198748,comments:_0x5d7cab}=_0x3b0aae;_0x1e53d9['getCommentThread'](_0x3f12a0)||_0x1e53d9['addCommentThread']({'threadId':_0x3f12a0,'channelId':_0x458c83,'comments':_0x5d7cab?_0x5d7cab['map'](dt):[],'context':_0x2599fe,'attributes':_0x532016,'resolvedAt':_0x76444f,'resolvedBy':_0x198748,'isFromAdapter':!0x0});}),this['listenTo'](_0x558239,'commentThreadUpdated',(_0x154399,{commentThreadId:_0x409868,documentId:_0x32066f,context:_0x515e99,unlinkedAt:_0x3d7ed1,attributes:_0x3caae4})=>{_0x1e53d9['getCommentThread'](_0x409868)&&_0x1e53d9['updateCommentThread']({'threadId':_0x409868,'channelId':_0x32066f,'context':_0x515e99,'unlinkedAt':_0x3d7ed1,'attributes':_0x3caae4,'isFromAdapter':!0x0});}),this['listenTo'](_0x558239,'commentThreadResolved',(_0x361e1b,{commentThreadId:_0x2ca076,resolvedBy:_0x5e980a,resolvedAt:_0x5a03d9})=>{const _0x4edbae=_0x1e53d9['getCommentThread'](_0x2ca076);_0x4edbae&&_0x4edbae['resolve']({'resolvedBy':_0x5e980a,'resolvedAt':_0x5a03d9,'isFromAdapter':!0x0});}),this['listenTo'](_0x558239,'commentThreadReopened',(_0x25c66b,{commentThreadId:_0x337c48})=>{const _0x5910ef=_0x1e53d9['getCommentThread'](_0x337c48);_0x5910ef&&_0x5910ef['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x558239,'commentThreadRemoved',(_0x3249f5,{commentThreadId:_0x1e6680})=>{const _0xd9e01=_0x1e53d9['getCommentThread'](_0x1e6680);_0xd9e01&&_0xd9e01['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x558239,'commentAdded',(_0x28268a,_0x3d0019)=>{const _0x1d4e18=_0x3d0019['commentThreadId'],_0x3d52bf=_0x1e53d9['getCommentThread'](_0x1d4e18);_0x3d52bf&&_0x3d52bf['addComment']({...dt(_0x3d0019),'isFromAdapter':!0x0});}),this['listenTo'](_0x558239,'commentUpdated',(_0x53b7d1,{commentThreadId:_0x155bb0,commentId:_0x5b72a6,content:_0x25c8d2,attributes:_0x3ff805})=>{const _0x2ca846=_0x1e53d9['getCommentThread'](_0x155bb0);if(_0x2ca846){const _0x13e992=_0x2ca846['getComment'](_0x5b72a6);_0x13e992&&_0x13e992['update']({'content':_0x25c8d2,'attributes':_0x3ff805,'isFromAdapter':!0x0});}}),this['listenTo'](_0x558239,'commentRemoved',(_0x555a3c,{commentThreadId:_0x5b7671,commentId:_0x58c8f4})=>{const _0xde73bd=_0x1e53d9['getCommentThread'](_0x5b7671);if(_0xde73bd){const _0x558219=_0xde73bd['getComment'](_0x58c8f4);_0x558219&&_0x558219['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x558239,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0x229efb),this['stopListening'](_0x558239));}),await this['_connectService'](_0x229efb);}destroy(){if(this['context']instanceof _0x3acbaa){const _0x463473=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x463473)&&this['_terminateService'](_0x463473);}}_terminateService(_0x2a806e){if(!this['_services']['has'](_0x2a806e))throw new _0x285801('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x2a806e});this['_getService'](_0x2a806e)['disconnect'](),this['_services']['delete'](_0x2a806e);}async reconnect(){for(const _0x5b2390 of this['_services']['keys']())await this['_connectService'](_0x5b2390);if(this['context']instanceof _0x3acbaa){const _0x5b3b5d=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x5b3b5d)){const _0x55c2cf=this['context']['plugins']['get'](Q);_0x55c2cf['unregister'](_0x5b3b5d);const _0x14c9f2=await this['_services']['get'](_0x5b3b5d)['getConnectedSessions']();_0x55c2cf['register'](_0x5b3b5d,_0x14c9f2);}}}async _connectService(_0x16f184){const {connection:_0x58219b}=this['context']['plugins']['get'](J),_0x12e411=this['context']['plugins']['get'](_0x2739e7),_0x2b5b01=await this['_services']['get'](_0x16f184)['connect'](_0x58219b);await this['_fetchMissingUsersForThreads'](_0x2b5b01);const _0x1e1bbf=new Set(Array['from'](_0x12e411['getCommentThreads']({'channelId':_0x16f184}),_0xaba73c=>_0xaba73c['id']));for(const _0x3842df of _0x2b5b01)_0x3842df['deletedAt']||_0x1e1bbf['delete'](_0x3842df['commentThreadId']);for(const _0x37d96a of _0x1e1bbf)_0x12e411['getCommentThread'](_0x37d96a)['remove']({'isFromAdapter':!0x0});for(const _0x3db823 of _0x2b5b01){let _0x1e06c4=_0x12e411['getCommentThread'](_0x3db823['commentThreadId']);const {commentThreadId:_0x5bd864,context:_0x2b7386,attributes:_0x286d02,resolvedBy:_0x55b44d,resolvedAt:_0x1a8c9c,unlinkedAt:_0x21e943,deletedAt:_0x89b40e}=_0x3db823;if(_0x89b40e)continue;_0x1e06c4||(_0x1e06c4=_0x12e411['addCommentThread']({'channelId':_0x16f184,'threadId':_0x5bd864,'context':_0x2b7386,'attributes':_0x286d02||{},'resolvedBy':_0x55b44d,'resolvedAt':_0x1a8c9c,'unlinkedAt':_0x21e943,'isFromAdapter':!0x0}));const _0x1a2b91=new Set(Array['from'](_0x1e06c4['comments'],_0x25c4a8=>_0x25c4a8['id']));for(const _0x5ef533 of _0x3db823['comments'])_0x1a2b91['delete'](_0x5ef533['commentId']);for(const _0x465c74 of _0x1a2b91)_0x1e06c4['getComment'](_0x465c74)['remove']({'isFromAdapter':!0x0});for(const _0x1a5c38 of _0x3db823['comments']){const _0x2bb0db=_0x1e06c4['getComment'](_0x1a5c38['commentId']);_0x2bb0db?_0x2bb0db['content']!==_0x1a5c38['content']&&_0x2bb0db['update']({'content':_0x1a5c38['content'],'isFromAdapter':!0x0}):_0x1e06c4['addComment'](Object['assign'](dt(_0x1a5c38),{'isFromAdapter':!0x0}));}}}_getService(_0x1e8d6e){if(!this['_services']['has'](_0x1e8d6e))throw new _0x285801('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x1e8d6e});return this['_services']['get'](_0x1e8d6e);}async _fetchMissingUsersForThreads(_0x563fd8){const _0x14d53b=this['context']['plugins']['get'](_0x3f8d3d),{connection:_0x3d91a2}=this['context']['plugins']['get'](J),_0x257175=new Set();for(const {resolvedBy:_0x52d7c7,comments:_0x43ea49}of _0x563fd8){_0x52d7c7&&!_0x14d53b['getUser'](_0x52d7c7)&&_0x257175['add'](_0x52d7c7);for(const {userId:_0x591e64}of _0x43ea49)_0x14d53b['getUser'](_0x591e64)||_0x257175['add'](_0x591e64);}if(0x0===_0x257175['size'])return;const _0x525ec2=await _0x3df04e['getMany'](_0x3d91a2,Array['from'](_0x257175));for(const _0x2ab1a5 of _0x525ec2)_0x14d53b['getUser'](_0x2ab1a5['id'])||_0x14d53b['addUser'](_0x2ab1a5);}};async function ht(_0xc9859c){if('404'!==_0xc9859c['code'])throw _0xc9859c;}function lt(_0x2b29d0){if((_0x2d922d=_0x2b29d0)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x2d922d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2d922d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x2d922d;throw _0x2b29d0;}function dt(_0x15f379){return{'threadId':_0x15f379['commentThreadId'],'commentId':_0x15f379['commentId'],'content':_0x15f379['content'],'createdAt':_0x15f379['createdAt'],'authorId':_0x15f379['userId'],'attributes':_0x15f379['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x15a09f{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>_0x386301)());_bufferedRequests;_trackChangesService;static get requires(){return[at,_0x2ea9f5,J];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x16de5f){super(_0x16de5f);const _0x26cc4c=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x26cc4c);}init(){const _0x5b4d72=this['editor']['plugins']['get'](J),_0x30582e=this['editor']['plugins']['get'](_0x2ea9f5);return _0x30582e['adapter']={'getSuggestion':async _0x221414=>{await this['_waitForServiceReady']();const _0x329406=await this['_trackChangesService']['get'](_0x221414)['catch'](ft);return await this['_fetchMissingUsersForThreads']([_0x329406]),_0x329406;},'addSuggestion':async({id:_0x1a76c8,type:_0x52d714,data:_0x29733,originalSuggestionId:_0x23953c,attributes:_0x2d07d3})=>{await this['_waitForServiceReady']();const _0x499038={'id':_0x1a76c8,'type':_0x52d714,'data':_0x29733,'originalSuggestionId':_0x23953c,'attributes':_0x2d07d3},_0x946a12=await this['_trackChangesService']['add'](_0x1a76c8,_0x52d714,_0x29733,_0x23953c,_0x2d07d3)['catch'](_0x30dd4a=>{if(mt(_0x30dd4a))return new Promise(_0x2ff597=>{this['_bufferedRequests']['set'](_0x1a76c8,{'resolve':_0x2ff597,'suggestionData':_0x499038});});throw _0x30dd4a;});return this['_bufferedRequests']['delete'](_0x1a76c8),_0x946a12;},'updateSuggestion':async(_0x5ea9c0,_0xfc5adf)=>{if(await this['_waitForServiceReady'](),'open'!==_0xfc5adf['state'])return this['_trackChangesService']['update'](_0x5ea9c0,_0xfc5adf)['catch'](ft);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x5cc8f6,_0x18709a)=>{_0x30582e['hasSuggestion'](_0x18709a['id'])&&(_0x30582e['getSuggestion'](_0x18709a['id'])['attributes']=_0x18709a['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x5b4d72['connection']?.['state']&&(_0x5b4d72['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x5b4d72['connection'])['then'](_0x3b2188=>(_0x5b4d72['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x3b2188)['then'](()=>{for(const _0x2692b9 of _0x3b2188){_0x30582e['addSuggestionData'](_0x2692b9)['_saved']=!0x0;}})));}async reconnect(){const _0x4ca4a7=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x276933}=this['editor']['plugins']['get'](J),_0x39ad33=await this['_trackChangesService']['connect'](_0x276933);await this['_fetchMissingUsersForThreads'](_0x39ad33);for(const {suggestionData:_0x5de72b,resolve:_0x49c9b7}of this['_bufferedRequests']['values']()){let _0x2630fc=_0x39ad33['find'](_0x179653=>_0x179653['id']===_0x5de72b['id']);_0x2630fc||(_0x2630fc=await this['_trackChangesService']['add'](_0x5de72b['id'],_0x5de72b['type'],_0x5de72b['data'],_0x5de72b['originalSuggestionId'])),_0x49c9b7(_0x2630fc);}for(const _0x37479d of _0x39ad33)_0x4ca4a7['hasSuggestion'](_0x37479d['id'])||_0x4ca4a7['addSuggestionData'](_0x37479d);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x404eac=>{this['listenTo'](this['_trackChangesService'],'connected',_0x431b69=>{_0x431b69['off'](),_0x404eac();});});}async _fetchMissingUsersForThreads(_0x39c8c9){const _0x2be2ad=this['editor']['plugins']['get'](_0x3f8d3d),{connection:_0x5b0ced}=this['editor']['plugins']['get'](J),_0x3caad1=new Set();for(const {authorId:_0x42d4fa}of _0x39c8c9)_0x2be2ad['getUser'](_0x42d4fa)||_0x3caad1['add'](_0x42d4fa);if(0x0===_0x3caad1['size'])return;const _0x3c64bf=await _0x3df04e['getMany'](_0x5b0ced,Array['from'](_0x3caad1));for(const _0x362cd1 of _0x3c64bf)_0x2be2ad['getUser'](_0x362cd1['id'])||_0x2be2ad['addUser'](_0x362cd1);}};function ft(_0x3cf997){if(mt(_0x3cf997))return new Promise(()=>{});throw _0x3cf997;}function mt(_0x143a72){return _0x143a72['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x143a72['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var pt=class extends _0x15a09f{static get requires(){return[_0x3bac5c,at,ct,J];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x21db18=this['editor']['plugins']['get'](J),_0x1cafa5=this['editor']['plugins']['get'](_0x3cf71e),_0x232fba=this['editor']['plugins']['get'](at);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x21db18,'change:state',(_0x35062c,_0x410e7,_0x12e9da)=>{_0x1cafa5['isThreadsLoadingPaused']='connected'!==_0x12e9da;});}),this['listenTo'](_0x21db18,'change:state',(_0x1760d6,_0x197bf5,_0x29141d)=>{this['editor']['plugins']['get'](_0x2739e7)['switchReadOnly']('connected'!==_0x29141d);}),_0x232fba['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x45148d=this['editor']['plugins']['get'](at),_0x4ab9b1=this['editor']['config']['get']('collaboration.channelId');_0x45148d['_services']['has'](_0x4ab9b1)&&_0x45148d['_terminateService'](_0x4ab9b1),super['destroy']();}},gt=class extends _0x15a09f{static get requires(){return[pt,ut,_0x43ff1a];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class CloudServicesRevisionHistoryAdapter extends _0x15a09f{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
+ ((()=>_0x2b9e5e)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0x1c9ff7,Q,_0x3f8d3d];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xb08bd0){super(_0xb08bd0);const _0x3dce37=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x3dce37);}async init(){const _0x3dc9f0=this['editor']['plugins']['get'](it),_0x453db0=_0x3dc9f0['serverHistory'],_0x52336b=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x453db0,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x3dc9f0['sessionId']});const _0x1bf236=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x39faf5,_0x254039=await _0x56d4ea['isBundleUploaded'](_0x52336b['connection'],_0x1bf236);this['editor']['plugins']['get'](_0x1c9ff7)['adapter']={'getRevision':async({revisionId:_0x1b3d5c})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x1b3d5c)),'updateRevisions':async _0x17691f=>{await this['_waitForServiceReady']();const _0x14e061=this['_revisionTracker']['currentRevision'];if(_0x254039&&0x1===_0x17691f['length']&&_0x17691f[0x0]['id']===_0x14e061['id'])return _0x17691f;for(const _0x33ca07 of _0x17691f)_0x33ca07['id']===_0x14e061['id']&&(_0x33ca07['isEmptyCurrent']=_0x33ca07['fromVersion']===_0x33ca07['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x17691f,this['_lastRequestId'])['then'](_0x2facba=>(this['_lastRequestId']=_0x2facba,_0x17691f))['catch'](_0x387363=>{if(vt(_0x387363)||'400'===_0x387363['code']&&void 0x0!==_0x387363['data']['wrongRequestId']){for(const _0x44ea21 of _0x17691f)this['_revisionTracker']['repository']['getRevision'](_0x44ea21['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x44ea21['id'],_0x44ea21,!0x1);if(vt(_0x387363)&&'destroyed'!==this['editor']['state'])throw _0x387363;return _0x17691f;}throw _0x387363;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x15a62c,{revisionsData:_0x3d2432,requestId:_0x1df668})=>{Math['max'](..._0x3d2432['map'](_0x35c25d=>_0x35c25d['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x3d2432,_0x1df668);}):this['_handleRevisionsUpdate'](_0x3d2432,_0x1df668);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x52336b['connection']?.['state']&&(_0x52336b['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x130262,requestId:_0x3449db}=await this['_revisionHistoryService']['connect'](_0x52336b['connection']);_0x52336b['addToReconnectionStack'](this),this['_lastRequestId']=_0x3449db,await this['_fetchMissingUsers'](_0x130262);for(const _0x5077ef of _0x130262)this['_revisionTracker']['addRevisionData'](_0x5077ef);this['listenTo'](_0x3dc9f0,'change:_isConnected',(_0x30a95b,_0x13771b,_0x4146a9)=>{_0x4146a9&&(this['_oldOffset']=_0x3dc9f0['_offset'],_0x30a95b['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x593704=this['editor']['plugins']['get'](J),_0x33929b=this['editor']['plugins']['get'](it),_0x588a76=async()=>{const _0x480d53=this['_revisionTracker']['currentRevision'],_0xfffbbc=_0x480d53['id'],_0x24d8f5=_0xfffbbc!==_0x33929b['sessionId'];if(_0x24d8f5){const _0x4566e8=_0x33929b['_offset']-this['_oldOffset'],_0x4f41df=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x480d53['toVersion']+_0x4566e8!==_0x4f41df){const _0x3bc56e=_0x480d53['fromVersion']+_0x4566e8,_0x28c93e=this['editor']['plugins']['get'](_0x3f8d3d),_0x3a14ea=this['_revisionTracker']['buildRevisionData']({'revision':_0x480d53,'from':_0x3bc56e,'to':_0x4f41df});_0x3a14ea['id']=_0x480d53['id'];const _0x3f4ca8=_0x3a14ea['authorsIds']['map'](_0x4cf5cd=>_0x28c93e['getUser'](_0x4cf5cd));_0x480d53['_update']({..._0x3a14ea,'authors':_0x3f4ca8},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x480d53['id'],_0x3a14ea,!0x0);}this['_revisionTracker']['_startingVersion']=_0x4f41df,_0x480d53['toVersion']!==_0x480d53['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0xfffbbc)||this['_revisionTracker']['repository']['_revisions']['remove'](_0xfffbbc),this['_revisionTracker']['_createCurrentRevision'](_0x4f41df);}const {revisions:_0x466b2c,requestId:_0x4d2cab}=await this['_revisionHistoryService']['reconnect'](_0x593704['connection'],this['_lastRequestId']);_0x24d8f5&&_0x466b2c['length']>0x0?_0x33929b['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x466b2c),this['_handleRevisionsUpdate'](_0x466b2c,_0x4d2cab),this['_revisionTracker']['sendBufferedUpdates']());};return _0x33929b['_isConnected']?_0x588a76():new Promise((_0x43ca10,_0x2551e7)=>{_0x33929b['once']('change:_isConnected',()=>{_0x588a76()['then'](_0x43ca10)['catch'](_0x2551e7);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x41e477=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x7e7c=>{_0x7e7c['off'](),_0x41e477();});});}_getLatestVersionFromServerOperations(){const _0x51289c=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0x44e9f6 of _0x51289c)if('marker'!==_0x44e9f6['type']||_0x44e9f6['affectsData'])return _0x44e9f6['baseVersion']+0x1;}_getLatestVersion(){const _0x751660=this['editor']['plugins']['get'](it);return new Promise(_0x20be7c=>{_0x751660['_isPendingUpdate']?_0x751660['once']('change:_isPendingUpdate',()=>{_0x20be7c(this['_getLatestVersionFromServerOperations']());}):_0x20be7c(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x142c91,_0x1da3e5){const _0x3af8ee=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x1da3e5;for(const _0x1177b2 of _0x142c91){const _0x489f47=_0x3af8ee['getRevision'](_0x1177b2['id']);if(_0x489f47){if((_0x1177b2['fromVersion']||_0x1177b2['toVersion'])&&(_0x1177b2['diffData']=null),_0x489f47===this['_revisionTracker']['currentRevision']){const _0x282469=Math['max'](_0x489f47['toVersion'],_0x1177b2['toVersion']),_0x589ae9=Math['max'](_0x489f47['fromVersion'],_0x1177b2['fromVersion']);let _0x3b9929;_0x489f47['toVersion']===_0x1177b2['toVersion']&&_0x489f47['fromVersion']===_0x1177b2['fromVersion']?(_0x3b9929=!0x0,this['_preventResendingRevisionData'](_0x1177b2)):_0x1177b2['toVersion']===_0x282469&&_0x1177b2['fromVersion']===_0x589ae9?_0x3b9929=!0x1:(_0x489f47['toVersion']===_0x282469&&_0x489f47['fromVersion']===_0x589ae9||this['_fixRevision']({'revision':_0x489f47,'from':_0x589ae9,'to':_0x282469}),_0x3b9929=!0x0),_0x3b9929&&(delete _0x1177b2['fromVersion'],delete _0x1177b2['toVersion'],delete _0x1177b2['diffData'],delete _0x1177b2['createdAt'],delete _0x1177b2['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x1177b2),this['_preventResendingRevisionData'](_0x1177b2);}else this['_revisionTracker']['addRevisionData'](_0x1177b2);}const _0x10c74f=_0x3af8ee['getRevisions']();_0x10c74f['reverse']();for(let _0xf9149d=0x0;_0xf9149d<_0x10c74f['length']-0x1;_0xf9149d++){const _0x1314d4=_0x10c74f[_0xf9149d],_0x3e3471=_0x10c74f[_0xf9149d+0x1];if(_0x1314d4['fromVersion']<_0x3e3471['toVersion']){const _0x1d5b3a=_0x3e3471['toVersion'],_0x183576=Math['max'](_0x1d5b3a,_0x1314d4['toVersion']);this['_fixRevision']({'revision':_0x1314d4,'from':_0x1d5b3a,'to':_0x183576});}}}['_fixRevision']({revision:_0x4d2eb7,from:_0x1edd1e,to:_0x2ccadc}={}){const _0x3201a2=this['editor']['plugins']['get'](_0x3f8d3d),_0x49d101=this['_revisionTracker']['buildRevisionData']({'revision':_0x4d2eb7,'from':_0x1edd1e,'to':_0x2ccadc});_0x49d101['authors']=_0x49d101['authorsIds']['map'](_0x32afbd=>_0x3201a2['getUser'](_0x32afbd)),_0x4d2eb7['_update'](_0x49d101);}_preventResendingRevisionData(_0xac25aa){const _0x4b606f={};_0x4b606f['id']=_0xac25aa['id'];for(const _0x44e798 of Object['keys'](_0xac25aa))'id'!==_0x44e798&&(_0x4b606f[_0x44e798]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x4b606f['id'],_0x4b606f,!0x0);}async _fetchMissingUsers(_0x40ae2e){const _0x12c2f6=this['editor']['plugins']['get'](_0x3f8d3d),{connection:_0x545364}=this['editor']['plugins']['get'](J),_0x3dd7d1=new Set();for(const _0x370a4e of _0x40ae2e){for(const _0x21f8dd of _0x370a4e['authorsIds'])_0x2a16bd(_0x21f8dd);_0x370a4e['creatorId']&&_0x2a16bd(_0x370a4e['creatorId']);}if(0x0===_0x3dd7d1['size'])return;const _0x33c47e=await _0x3df04e['getMany'](_0x545364,Array['from'](_0x3dd7d1));for(const _0x371b2d of _0x33c47e)_0x12c2f6['getUser'](_0x371b2d['id'])||_0x12c2f6['addUser'](_0x371b2d);function _0x2a16bd(_0x556b5d){_0x12c2f6['getUser'](_0x556b5d)||_0x3dd7d1['add'](_0x556b5d);}}};function vt(_0xd64d07){return _0xd64d07['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xd64d07['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xd64d07['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x15a09f{static get requires(){return[_0x1c9ff7,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x3703cb{_collapseAt;constructor(_0x31b96b,_0x24f198=0x6){super(_0x31b96b);const _0x32cf86=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x24f198,this['bind']('isHidden')['to'](this,'usersCount',_0x54c54c=>_0x54c54c<_0x24f198),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x32cf86['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':_0x32cf86['to']('usersCount',_0x4f6e18=>'+'+(_0x4f6e18-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x3703cb{items;keystrokes;constructor(_0x3f240c){super(_0x3f240c);const _0x4c39b6=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x2ce588(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x4c39b6['if']('hasPopup'),'aria-expanded':_0x4c39b6['to']('isExpanded',_0x52c666=>this['hasPopup']&&String(_0x52c666)),'aria-label':_0x4c39b6['to']('hasPopup',_0x28b164=>et(_0x3f240c,_0x28b164?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x4c39b6['to']('hasPopup',_0x490931=>!!_0x490931&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0x226f49,_0x20db38,_0x56859b)=>{this['element']&&(_0x56859b?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},kt=class extends _0x3703cb{counterView;inlineListView;constructor(_0x14ba71,_0xf4e471=0x6){super(_0x14ba71);const _0x18e4c1=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0xf4e471),this['inlineListView']=new bt(_0x14ba71),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4207c9 of this['inlineListView']['items'])_0x4207c9['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',_0x18e4c1['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x3703cb{listWrapperView;constructor(_0x350df3,_0x1dadb9){super(_0x350df3),this['listWrapperView']=new St(_0x350df3,_0x1dadb9),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0x350df3,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0x5b42d9{constructor(_0x12568e,_0x362578){super(_0x12568e);const _0x4e3f6a=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x362578?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x4e3f6a['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x4e3f6a['to']('role'),'aria-label':_0x4e3f6a['to']('ariaLabel'),'aria-labelledby':_0x4e3f6a['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x5e4f24['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x5cd894=this['element'];_0x5cd894&&(this['_isScrollable']=Math['max'](_0x5cd894['scrollHeight'],_0x5cd894['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0x6981e8{['userView'];constructor(_0x5b453b,_0x332f63,_0x553301){super(_0x5b453b);const _0x116871=this['bindTemplate'];this['userView']=new _0xb3ff22(_0x5b453b,_0x332f63);const _0x15c7c8={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x332f63['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x332f63['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x332f63['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x332f63['color']['getColorVariable'](),'--ck-user-color-alpha':_0x332f63['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x553301&&(_0x15c7c8['tag']='button',_0x15c7c8['on']={'click':_0x116871['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x15c7c8);}['focus'](){this['element']['focus']();}},Ct=class extends _0x3703cb{['userView'];['markerView'];constructor(_0x245bc4,_0x1d4d2f,_0x6cd9c7){super(_0x245bc4);const _0x5ce5a0=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0xb3ff22(_0x245bc4,_0x1d4d2f),this['markerView']=new At(_0x245bc4,_0x1d4d2f);const _0x44b580=new _0x3782ba(_0x245bc4);_0x44b580['template']['tag']='span',_0x44b580['text']=_0x1d4d2f['name'];const _0x2ccf73={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5ce5a0['to']('isFocusable',_0x385423=>_0x385423?0x0:-0x1),'aria-labelledby':_0x44b580['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5ce5a0['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5ce5a0['to']('hasTooltip',_0x1805f5=>!_0x1805f5),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x44b580]};_0x6cd9c7&&(_0x2ccf73['tag']='button',_0x2ccf73['on']={'click':_0x5ce5a0['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2ccf73);}},At=class extends _0x3703cb{constructor(_0x5ba5b3,_0x408a04){super(_0x5ba5b3),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x408a04['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x408a04['color']['getColorVariable'](),'--ck-user-color-alpha':_0x408a04['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x438626{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1d5813){super(_0x1d5813),this['context']['config']['define']('presenceList',Pt);const _0x392627=_0x1d5813['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x392627)throw new _0x285801('presencelist-collapseat-invalid-format',this);if(_0x392627<0x1)throw new _0x285801('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x265f56(),this['balloonPanelView']=new _0x30be94(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x32de19 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x32de19);this['listenTo'](this['_allConnectedUsers'],'add',(_0x4d8033,_0x8f2579)=>{this['_handleUserAdd'](_0x8f2579);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x3b86c9,_0x41f5ba)=>{this['_handleUserRemove'](_0x41f5ba);});}_createView(){const _0x190312=this['context'],_0x39094c=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x160b6a=this['balloonPanelView'];if(!_0x49cf94(_0x190312['config']['get']('presenceList.container')))throw new _0x285801('presencelist-missing-container',this);_0x39094c['counterView']['bind']('usersCount')['to'](this),_0x39094c['bind']('isCollapsed')['to'](this,'usersCount',_0x33b068=>{const {collapseAt:_0x2cec62}=_0x190312['config']['get']('presenceList'),_0x2cd909=_0x33b068>=_0x2cec62;if(_0x2cd909&&!_0x39094c['inlineListView']['items']['find'](_0x39af61=>_0x39af61 instanceof yt)){const _0x40794c=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x40794c&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x39094c['inlineListView']['items']['add'](_0x39094c['counterView']);}return _0x2cd909||this['hideDropdown'](),_0x2cd909;}),_0x39094c['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x2e90=>{const _0x3575e4=_0x190312['config']['get']('presenceList'),_0x1fc6c9=new Ct(_0x190312['locale'],_0x2e90,!!_0x3575e4['onClick']);return _0x1fc6c9['bind']('hasTooltip')['to'](_0x39094c,'isCollapsed',_0x192579=>!_0x192579),_0x1fc6c9['bind']('isFocusable')['to'](_0x39094c,'isCollapsed',_0x28cc84=>!_0x28cc84),_0x3575e4['onClick']&&this['listenTo'](_0x1fc6c9,'execute',()=>{this['view']['isCollapsed']||_0x3575e4['onClick'](_0x2e90,_0x1fc6c9['element']);}),_0x1fc6c9;}),_0x39094c['inlineListView']['keystrokes']['set']('Enter',(_0x207652,_0x31295a)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x31295a());}),_0x39094c['render'](),_0x160b6a['render'](),_0x39094c['listenTo'](_0x39094c['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x395fad=(_0x2ca938,_0x51d2df)=>{this['_hideDropdownUnlessPointerInside'](_0x51d2df);};return _0x39094c['listenTo'](_0x39094c['inlineListView']['element'],'mouseleave',_0x395fad),_0x39094c['listenTo'](_0x160b6a['element'],'mouseleave',_0x395fad),_0x27e434({'emitter':_0x39094c,'activator':()=>_0x160b6a['isVisible'],'contextElements':[_0x160b6a['element'],_0x39094c['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x190312['config']['get']('presenceList.container')['appendChild'](_0x39094c['element']),this['_overlayHost']=new _0x31c53a(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0x39094c;}_resolveOverlayTarget(){const _0x1e7879=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0x1e7879)return _0x1e7879;const _0x32a4aa=this['context']['config']['get']('presenceList.container');return _0x32a4aa?_0xe1b5ee(_0x32a4aa):null;}['_handleUserAdd'](_0x1c0e3e){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x1c0e3e['isMe'])return;const _0x250d9c=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x250d9c-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x286417=_0x1c0e3e['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x1c0e3e,_0x286417);}['_handleUserRemove'](_0x3fa84e){this['usersCount']--;const {collapseAt:_0x2ebf7a}=this['context']['config']['get']('presenceList'),_0x5d34fe=this['usersCount']>=_0x2ebf7a;if(this['currentDisplayedUsers']['get'](_0x3fa84e['id']))this['currentDisplayedUsers']['remove'](_0x3fa84e['id']);else{if(_0x5d34fe&&this['currentDisplayedUsers']['length']+0x1===_0x2ebf7a-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x5d34fe?0x1:0x0)<this['usersCount']){for(const _0x226866 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x226866['id'])&&(this['currentDisplayedUsers']['add'](_0x226866,Math['min'](this['currentDisplayedUsers']['length']-(_0x5d34fe?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x5d34fe?0x1:0x0)===_0x2ebf7a-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x461bc6=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0x461bc6['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x197145}=this['presenceDropdownView'];_0x197145['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x1d2bcf=>{if(!_0x461bc6['displayMe']&&_0x1d2bcf['isMe'])return null;const _0x42baa7=new Tt(this['context']['locale'],_0x1d2bcf,!!_0x461bc6['onClick']);return _0x461bc6['onClick']&&this['listenTo'](_0x42baa7,'execute',()=>{_0x461bc6['onClick'](_0x1d2bcf,_0x42baa7['element']);}),_0x42baa7;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']);const _0x27f335=_0x30be94['generatePositions']({'heightOffset':0x3,'config':{'withArrow':!0x1}});this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element'],'positions':[_0x27f335['southArrowNorth'],_0x27f335['southArrowNorthMiddleWest'],_0x27f335['southArrowNorthMiddleEast'],_0x27f335['southArrowNorthWest'],_0x27f335['southArrowNorthEast'],_0x27f335['northArrowSouth'],_0x27f335['northArrowSouthMiddleWest'],_0x27f335['northArrowSouthMiddleEast'],_0x27f335['northArrowSouthWest'],_0x27f335['northArrowSouthEast'],_0x27f335['viewportStickyNorth']]}),_0x197145['focus'](),_0x197145['checkIfScrollable']();const _0x4b637e=(_0x1e2c5e,_0x6f4890)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x6f4890();};_0x197145['keystrokes']['set']('Esc',_0x4b637e),_0x197145['keystrokes']['set']('Shift+Tab',_0x4b637e),_0x197145['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x197145['focusTracker']['add'](this['view']['element']),_0x197145['focusTracker']['on']('change:isFocused',(_0x176da2,_0x15bbda,_0x226927)=>{_0x226927||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}_hideDropdownUnlessPointerInside(_0xc6ace9){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x132fcd=>_0x5b648d(_0x132fcd,_0xc6ace9))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x438626{static get requires(){return[Q,Ot];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{at as CloudServicesCommentsAdapter,wt as CloudServicesRevisionHistoryAdapter,ut as CloudServicesTrackChangesAdapter,xt as PresenceList,Ot as PresenceListUI,it as RealTimeCollaborationClient,pt as RealTimeCollaborativeComments,ct as RealTimeCollaborativeEditing,_t as RealTimeCollaborativeRevisionHistory,gt as RealTimeCollaborativeTrackChanges,Q as Sessions,J as WebSocketGateway};