@ckeditor/ckeditor5-real-time-collaboration 48.4.0-alpha.1 → 48.4.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/translations/af.js +1 -1
  3. package/dist/translations/af.umd.js +1 -1
  4. package/dist/translations/ar.js +1 -1
  5. package/dist/translations/ar.umd.js +1 -1
  6. package/dist/translations/ast.js +1 -1
  7. package/dist/translations/ast.umd.js +1 -1
  8. package/dist/translations/az.js +1 -1
  9. package/dist/translations/az.umd.js +1 -1
  10. package/dist/translations/be.js +1 -1
  11. package/dist/translations/be.umd.js +1 -1
  12. package/dist/translations/bg.js +1 -1
  13. package/dist/translations/bg.umd.js +1 -1
  14. package/dist/translations/bn.js +1 -1
  15. package/dist/translations/bn.umd.js +1 -1
  16. package/dist/translations/bs.js +1 -1
  17. package/dist/translations/bs.umd.js +1 -1
  18. package/dist/translations/ca.js +1 -1
  19. package/dist/translations/ca.umd.js +1 -1
  20. package/dist/translations/cs.js +1 -1
  21. package/dist/translations/cs.umd.js +1 -1
  22. package/dist/translations/da.js +1 -1
  23. package/dist/translations/da.umd.js +1 -1
  24. package/dist/translations/de-ch.js +1 -1
  25. package/dist/translations/de-ch.umd.js +1 -1
  26. package/dist/translations/de.js +1 -1
  27. package/dist/translations/de.umd.js +1 -1
  28. package/dist/translations/el.js +1 -1
  29. package/dist/translations/el.umd.js +1 -1
  30. package/dist/translations/en-au.js +1 -1
  31. package/dist/translations/en-au.umd.js +1 -1
  32. package/dist/translations/en-gb.js +1 -1
  33. package/dist/translations/en-gb.umd.js +1 -1
  34. package/dist/translations/en.js +1 -1
  35. package/dist/translations/en.umd.js +1 -1
  36. package/dist/translations/eo.js +1 -1
  37. package/dist/translations/eo.umd.js +1 -1
  38. package/dist/translations/es-co.js +1 -1
  39. package/dist/translations/es-co.umd.js +1 -1
  40. package/dist/translations/es.js +1 -1
  41. package/dist/translations/es.umd.js +1 -1
  42. package/dist/translations/et.js +1 -1
  43. package/dist/translations/et.umd.js +1 -1
  44. package/dist/translations/eu.js +1 -1
  45. package/dist/translations/eu.umd.js +1 -1
  46. package/dist/translations/fa.js +1 -1
  47. package/dist/translations/fa.umd.js +1 -1
  48. package/dist/translations/fi.js +1 -1
  49. package/dist/translations/fi.umd.js +1 -1
  50. package/dist/translations/fr.js +1 -1
  51. package/dist/translations/fr.umd.js +1 -1
  52. package/dist/translations/gl.js +1 -1
  53. package/dist/translations/gl.umd.js +1 -1
  54. package/dist/translations/gu.js +1 -1
  55. package/dist/translations/gu.umd.js +1 -1
  56. package/dist/translations/he.js +1 -1
  57. package/dist/translations/he.umd.js +1 -1
  58. package/dist/translations/hi.js +1 -1
  59. package/dist/translations/hi.umd.js +1 -1
  60. package/dist/translations/hr.js +1 -1
  61. package/dist/translations/hr.umd.js +1 -1
  62. package/dist/translations/hu.js +1 -1
  63. package/dist/translations/hu.umd.js +1 -1
  64. package/dist/translations/hy.js +1 -1
  65. package/dist/translations/hy.umd.js +1 -1
  66. package/dist/translations/id.js +1 -1
  67. package/dist/translations/id.umd.js +1 -1
  68. package/dist/translations/it.js +1 -1
  69. package/dist/translations/it.umd.js +1 -1
  70. package/dist/translations/ja.js +1 -1
  71. package/dist/translations/ja.umd.js +1 -1
  72. package/dist/translations/jv.js +1 -1
  73. package/dist/translations/jv.umd.js +1 -1
  74. package/dist/translations/kk.js +1 -1
  75. package/dist/translations/kk.umd.js +1 -1
  76. package/dist/translations/km.js +1 -1
  77. package/dist/translations/km.umd.js +1 -1
  78. package/dist/translations/kn.js +1 -1
  79. package/dist/translations/kn.umd.js +1 -1
  80. package/dist/translations/ko.js +1 -1
  81. package/dist/translations/ko.umd.js +1 -1
  82. package/dist/translations/ku.js +1 -1
  83. package/dist/translations/ku.umd.js +1 -1
  84. package/dist/translations/lt.js +1 -1
  85. package/dist/translations/lt.umd.js +1 -1
  86. package/dist/translations/lv.js +1 -1
  87. package/dist/translations/lv.umd.js +1 -1
  88. package/dist/translations/ms.js +1 -1
  89. package/dist/translations/ms.umd.js +1 -1
  90. package/dist/translations/nb.js +1 -1
  91. package/dist/translations/nb.umd.js +1 -1
  92. package/dist/translations/ne.js +1 -1
  93. package/dist/translations/ne.umd.js +1 -1
  94. package/dist/translations/nl.js +1 -1
  95. package/dist/translations/nl.umd.js +1 -1
  96. package/dist/translations/no.js +1 -1
  97. package/dist/translations/no.umd.js +1 -1
  98. package/dist/translations/oc.js +1 -1
  99. package/dist/translations/oc.umd.js +1 -1
  100. package/dist/translations/pl.js +1 -1
  101. package/dist/translations/pl.umd.js +1 -1
  102. package/dist/translations/pt-br.js +1 -1
  103. package/dist/translations/pt-br.umd.js +1 -1
  104. package/dist/translations/pt.js +1 -1
  105. package/dist/translations/pt.umd.js +1 -1
  106. package/dist/translations/ro.js +1 -1
  107. package/dist/translations/ro.umd.js +1 -1
  108. package/dist/translations/ru.js +1 -1
  109. package/dist/translations/ru.umd.js +1 -1
  110. package/dist/translations/si.js +1 -1
  111. package/dist/translations/si.umd.js +1 -1
  112. package/dist/translations/sk.js +1 -1
  113. package/dist/translations/sk.umd.js +1 -1
  114. package/dist/translations/sl.js +1 -1
  115. package/dist/translations/sl.umd.js +1 -1
  116. package/dist/translations/sq.js +1 -1
  117. package/dist/translations/sq.umd.js +1 -1
  118. package/dist/translations/sr-latn.js +1 -1
  119. package/dist/translations/sr-latn.umd.js +1 -1
  120. package/dist/translations/sr.js +1 -1
  121. package/dist/translations/sr.umd.js +1 -1
  122. package/dist/translations/sv.js +1 -1
  123. package/dist/translations/sv.umd.js +1 -1
  124. package/dist/translations/th.js +1 -1
  125. package/dist/translations/th.umd.js +1 -1
  126. package/dist/translations/ti.js +1 -1
  127. package/dist/translations/ti.umd.js +1 -1
  128. package/dist/translations/tk.js +1 -1
  129. package/dist/translations/tk.umd.js +1 -1
  130. package/dist/translations/tr.js +1 -1
  131. package/dist/translations/tr.umd.js +1 -1
  132. package/dist/translations/tt.js +1 -1
  133. package/dist/translations/tt.umd.js +1 -1
  134. package/dist/translations/ug.js +1 -1
  135. package/dist/translations/ug.umd.js +1 -1
  136. package/dist/translations/uk.js +1 -1
  137. package/dist/translations/uk.umd.js +1 -1
  138. package/dist/translations/ur.js +1 -1
  139. package/dist/translations/ur.umd.js +1 -1
  140. package/dist/translations/uz.js +1 -1
  141. package/dist/translations/uz.umd.js +1 -1
  142. package/dist/translations/vi.js +1 -1
  143. package/dist/translations/vi.umd.js +1 -1
  144. package/dist/translations/zh-cn.js +1 -1
  145. package/dist/translations/zh-cn.umd.js +1 -1
  146. package/dist/translations/zh.js +1 -1
  147. package/dist/translations/zh.umd.js +1 -1
  148. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Context as _0x40150f,ContextPlugin as _0x1b8d8d,PendingActions as _0x308caf,Plugin as _0x198537}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x470142,Collection as _0x19921a,DomEmitterMixin as _0x188623,KeystrokeHandler as _0x2be03b,global as _0x1a9e1f,uid as _0x4ff846,version as _0x6ba88b}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x5157c9,BodyCollection as _0x5cfc09,LabelView as _0x305df9,ListItemView as _0x216f28,ListView as _0x3bbda9,Notification as _0x4b7247,View as _0x3c9057,clickOutsideHandler as _0x258569}from'@ckeditor/ckeditor5-ui';import{History as _0x402f9e,InsertOperation as _0x17d254,MarkerOperation as _0x573d35,ModelLiveRange as _0x267371,NoOperation as _0x1bd6a0,OperationFactory as _0x565114,RootAttributeOperation as _0x3ea597,transformOperationSets as _0x117acd}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x1297af}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x5a4319,CommentsService as _0x26b101,EditorService as _0x360e87,RevisionHistoryService as _0x4f20e5,TrackChangesService as _0x3c1634,User as _0xfaa43,WEB_SOCKET_GATEWAY_STATES as _0x3d94fb,WebSocketGateway as _0x9624bb}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x484af1,Users as _0x452795}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x1daf1d}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x165a37,TrackChangesEditing as _0x39fbf8}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x19436d,CommentsEditing as _0x520bc4,CommentsRepository as _0x2d3c83}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x22abf6}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x4afda6}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x1b8d8d{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
- ((()=>_0x9624bb)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x1297af,_0x4b7247];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x411921){super(_0x411921),this['set']('state',_0x3d94fb['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x188623())();}init(){const _0x282393=this['context'],_0x57d2c9=_0x282393['plugins']['get'](_0x1297af),_0xc91f3e=_0x282393['plugins']['get'](_0x4b7247);if(!_0x57d2c9['token'])throw new _0x470142('websocketgateway-missing-token',this);if(!_0x57d2c9['webSocketUrl'])throw new _0x470142('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'](_0x57d2c9['token'],_0x57d2c9['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x53de42=>{if(this['connection']=_0x53de42,this['bind']('state')['to'](_0x53de42,'state',this,'_isBrowserOffline',(_0x15c130,_0x1c6972)=>('connected'!==_0x15c130&&(this['_shouldPluginsReconnect']=!0x0),_0x1c6972||_0x15c130!==_0x3d94fb['CONNECTED']?_0x3d94fb['DISCONNECTED']:this['state']==_0x3d94fb['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x3d94fb['CONNECTING']):_0x3d94fb['CONNECTED'])),this['connection']['on']('error',(_0x2880b7,_0x52ee63)=>{if('limitExceeded'!==_0x52ee63['code'])throw console['error'](_0x52ee63),new _0x470142('cloudservices-init',null,{'originalError':_0x52ee63});_0xc91f3e['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'});}),!_0x53de42['me'])return new Promise(_0x16e768=>_0x53de42['on']('change:me',_0x16e768));})['catch'](_0x4c5454=>{throw console['error'](_0x4c5454),new _0x470142('cloudservices-init',null,{'originalError':_0x4c5454});});}addToReconnectionStack(_0x3454db){if('function'!=typeof _0x3454db['reconnect'])throw new _0x470142('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x3454db))throw new _0x470142('websocketgateway-plugin-already-registered',this,{'name':_0x3454db['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x3454db);}removeFromReconnectionStack(_0x19337f){this['_reconnectionStack']['delete'](_0x19337f);}isInReconnectionStack(_0x3b3f41){return this['_reconnectionStack']['has'](_0x3b3f41);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x59fd78=>_0x59fd78['reconnect']())))['then'](()=>this['state']=_0x3d94fb['CONNECTED'])['catch'](_0x17c282=>{throw console['error'](_0x17c282),new _0x470142('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x3d94fb['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x1b8d8d{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[z,_0x452795];}constructor(_0x56cccf){super(_0x56cccf),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x19921a(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x452795);}init(){const _0x1a9a8c=this['context']['plugins']['get'](z);this['listenTo'](_0x1a9a8c,'change:state',(_0x119633,_0x5d9f94,_0x392e53)=>{if('connected'!==_0x392e53)this['channelSessions']['forEach'](_0x4cf1c7=>_0x4cf1c7['clear']()),this['channelConnectedUsers']['forEach'](_0x56800f=>_0x56800f['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x4a361b,_0x567846]of this['_registeredSessions'])for(const _0x1f1cee of _0x567846)this['_handleSessionAdd'](_0x4a361b,_0x1f1cee);}}),this['_createUser'](_0x1a9a8c['connection']['me'],!0x0);}register(_0x1b99b6,_0x4ee935){if(this['_registeredSessions']['has'](_0x1b99b6))throw new _0x470142('sessions-register-already-registered',null,{'channelId':_0x1b99b6});this['_registeredSessions']['set'](_0x1b99b6,_0x4ee935),this['channelSessions']['set'](_0x1b99b6,new _0x19921a()),this['channelConnectedUsers']['set'](_0x1b99b6,new _0x19921a()),this['listenTo'](_0x4ee935,'add',(_0x30078d,_0x1d22b0)=>this['_handleSessionAdd'](_0x1b99b6,_0x1d22b0)),this['listenTo'](_0x4ee935,'remove',(_0x1820ee,_0x23c2fd)=>this['_handleSessionRemove'](_0x1b99b6,_0x23c2fd));for(const _0x4032aa of _0x4ee935)this['_handleSessionAdd'](_0x1b99b6,_0x4032aa);}unregister(_0x4eba44){if(!this['_registeredSessions']['has'](_0x4eba44))throw new _0x470142('sessions-unregister-not-exist',null,{'channelId':_0x4eba44});const _0x54af09=this['_registeredSessions']['get'](_0x4eba44);this['stopListening'](_0x54af09);for(const _0x26a3bd of _0x54af09)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x4eba44,_0x26a3bd);this['_registeredSessions']['delete'](_0x4eba44),this['channelSessions']['delete'](_0x4eba44),this['channelConnectedUsers']['delete'](_0x4eba44);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x2545c1){for(const _0x293257 of this['channelSessions']['values']())for(const _0x1a9ce8 of _0x293257)if(_0x1a9ce8['id']===_0x2545c1)return _0x1a9ce8['user'];}getUserSessions(_0x18a958,_0x22f590){const _0x148c68=_0x22f590?[this['channelSessions']['get'](_0x22f590)]:this['channelSessions']['values'](),_0x205af5=new Set();for(const _0x4050fd of _0x148c68)for(const _0x383649 of _0x4050fd)_0x383649['user']['id']===_0x18a958['id']&&_0x205af5['add'](_0x383649['id']);return _0x205af5;}getUserRole(_0x1d8a2a){for(const _0x2423fa of this['channelSessions']['values']())for(const _0x1da008 of _0x2423fa)if(_0x1da008['user']===_0x1d8a2a)return _0x1da008['role'];}['_handleSessionAdd'](_0x2c4070,_0x57560a){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x5e787b=_0x57560a['user'],_0x17a59b=this['_users']['getUser'](_0x5e787b['id'])||this['_createUser'](_0x5e787b),_0x17de86=Object['assign']({},_0x57560a,{'user':_0x17a59b});if(this['channelSessions']['get'](_0x2c4070)['add'](_0x17de86),!_0x5e787b['hiddenInPresenceList']){const _0x319936=this['channelConnectedUsers']['get'](_0x2c4070);_0x319936['has'](_0x17a59b['id'])||_0x319936['add'](_0x17a59b),this['allConnectedUsers']['has'](_0x17a59b['id'])||_0x5e787b['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x17a59b,_0x17a59b['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x2c4070,{'channelId':_0x2c4070,'session':_0x17de86});}['_handleSessionRemove'](_0x3d92bd,_0x5d6200){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x45a67a=this['channelConnectedUsers']['get'](_0x3d92bd),_0xb03e4d=_0x5d6200['user'];_0xb03e4d['id']&&(this['channelSessions']['get'](_0x3d92bd)['remove'](_0x5d6200['id']),_0x45a67a['has'](_0xb03e4d['id'])&&!this['getUserSessions'](_0xb03e4d,_0x3d92bd)['size']&&_0x45a67a['remove'](_0xb03e4d['id']),this['allConnectedUsers']['get'](_0xb03e4d['id'])&&!this['getUserSessions'](_0xb03e4d)['size']&&this['allConnectedUsers']['remove'](_0xb03e4d['id']));}_createUser(_0x42b80e,_0x4d2204){const _0xc3b74a=this['_users']['addUser'](_0x42b80e);return _0x4d2204&&this['_users']['defineMe'](_0x42b80e['id']),_0xc3b74a['orderNumber']=this['_uniqueUsersCount']++,_0xc3b74a;}},K=class extends _0x198537{_domEmitter=new(_0x188623())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x3f82e2=this['editor'],_0x2313db=_0x3f82e2['plugins']['get'](Y);_0x3f82e2['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x257ba9,{writer:_0x284b19})=>function(_0x4e4207,_0xd2e64b,_0x281b78,_0x464a6e){const _0x1a062e=_0x4e4207['markerName']['split'](':')[0x2],_0xb8afa0=_0x281b78['getUserBySessionId'](_0x1a062e);if(!_0xb8afa0||_0x1a062e===_0x281b78['mySessionId'])return;if(!_0x464a6e['model']['schema']['checkChild'](_0x4e4207['markerRange']['start'],'$text'))return;const _0x16ac52={'class':'ck-user__marker\x20'+_0xb8afa0['color']['getMarkerClass'](),'style':Q(_0xb8afa0),'data-name':_0xb8afa0['name'],'data-session-id':_0x1a062e},_0x2c3765=_0x464a6e['model']['markers']['get'](_0x4e4207['markerName'])['getStart'](),_0x350715=_0x2c3765['nodeAfter'],_0x14b7f9=_0x464a6e['model']['schema'];if(_0x350715&&_0x14b7f9['isObject'](_0x350715)&&_0x14b7f9['isInline'](_0x350715)&&!_0x464a6e['model']['markers']['get']('user:range:'+_0x1a062e)['getRange']()['isCollapsed'])return;const _0x2b151d=_0x2c3765['parent'];return _0x464a6e['model']['schema']['isLimit'](_0x2b151d)&&!_0x464a6e['model']['hasContent'](_0x2b151d)&&(_0x16ac52['contenteditable']=!0x1),function(_0x32a942,_0x5d9c25,_0x26a6fc){const _0x2cde49=_0x32a942['createUIElement']('span',_0x5d9c25);return _0x32a942['setCustomProperty']('userPositionMarker',!0x0,_0x2cde49),_0x2cde49['render']=function(_0x201d89){const _0x183a46=this['toDomElement'](_0x201d89),_0x37599d=document['createElement']('span');return _0x37599d['classList']['add']('ck-user__marker-tooltip'),_0x37599d['setAttribute']('contenteditable','false'),_0x37599d['setAttribute']('spellcheck','false'),_0x37599d['textContent']=_0x26a6fc['name'],_0x183a46['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x37599d['outerHTML']+'⁠',_0x183a46['addEventListener']('mouseenter',()=>{_0x183a46['classList']['add']('ck-user__marker_hovered');}),_0x183a46['addEventListener']('mouseleave',()=>{_0x183a46['classList']['remove']('ck-user__marker_hovered');}),_0x183a46;},_0x2cde49['isSimilar']=function(_0xab327){return!(!this['getCustomProperty']('userPositionMarker')||!_0xab327['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0xab327['getAttribute']('data-session-id'));},_0x2cde49;}(_0xd2e64b,_0x16ac52,_0xb8afa0);}(_0x257ba9,_0x284b19,_0x2313db,_0x3f82e2)}),_0x3f82e2['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x3cd5d2=>function(_0x54b663,_0x1c961d){const _0xf18cf8=_0x54b663['markerName']['split'](':')[0x2];if(_0xf18cf8===_0x1c961d['mySessionId'])return null;const _0x4db49f=_0x1c961d['getUserBySessionId'](_0xf18cf8);return _0x4db49f?{'id':_0xf18cf8,'classes':['ck-user__selection',_0x4db49f['color']['getSelectionClass']()],'attributes':{'style':Q(_0x4db49f),'data-session-id':_0xf18cf8},'priority':0x7d0+_0x4db49f['orderNumber']}:{'id':_0xf18cf8,'classes':[]};}(_0x3cd5d2,_0x2313db)}),function(_0x87b138){const _0x2c8b22=_0x87b138['model'],_0x5403b8=new Map(),_0x4906c4=_0x87b138['plugins']['get'](Y);_0x2c8b22['markers']['on']('update:user:range',(_0x329b03,_0x299f18,_0x4fc0ad,_0x260025)=>{if(!_0x260025&&_0x5403b8['get'](_0x299f18['name']))return _0x5403b8['get'](_0x299f18['name'])['detach'](),void _0x5403b8['delete'](_0x299f18['name']);const _0x25a5f0=_0x299f18['name']['split'](':')[0x2];if(_0x25a5f0===_0x4906c4['mySessionId'])return;const _0x393258='user:position:'+_0x25a5f0;_0x2c8b22['markers']['has'](_0x393258)&&_0x87b138['editing']['reconvertMarker'](_0x393258),_0x299f18['on']('change:range',(_0x1efb3a,_0x109d88,_0x3a1b34)=>{if('$graveyard'!=_0x109d88['root']['rootName']&&'$graveyard'==_0x299f18['getRange']()['root']['rootName']&&!_0x5403b8['has'](_0x299f18['name'])){const _0x283fac=_0x2c8b22['schema']['getNearestSelectionRange'](_0x3a1b34['deletionPosition']);if(_0x283fac){const _0x46e623=_0x267371['fromRange'](_0x283fac);_0x5403b8['set'](_0x299f18['name'],_0x46e623),_0x46e623['on']('change:range',(_0x3e027a,_0x12adea,_0xfa73d6)=>{if('$graveyard'==_0x46e623['root']['rootName']){const _0x4b769d=_0x2c8b22['schema']['getNearestSelectionRange'](_0xfa73d6['deletionPosition']);_0x4b769d?(_0x46e623['start']=_0x4b769d['start'],_0x46e623['end']=_0x4b769d['end']):(_0x5403b8['delete'](_0x299f18['name']),_0x46e623['detach']());}});}}});}),_0x2c8b22['document']['on']('change',()=>{_0x5403b8['size']>0x0&&_0x2c8b22['enqueueChange']({'isUndoable':!0x1},_0x432149=>{for(const [_0x154e77,_0x20dc0f]of _0x5403b8)'$graveyard'==_0x2c8b22['markers']['get'](_0x154e77)['getRange']()['root']['rootName']&&(J(_0x154e77['split'](':')[0x2],_0x20dc0f['toRange'](),_0x2c8b22,_0x432149),_0x20dc0f['detach']());_0x5403b8['clear']();});});}(_0x3f82e2),this['_domEmitter']['listenTo'](_0x1a9e1f['document'],'keydown',(_0x472df1,{key:_0x5581d8})=>{'Escape'===_0x5581d8&&function(_0x4f5b6d){_0x4f5b6d['editing']['view']['change'](_0x49cf70=>{for(const _0x58857c of _0x4f5b6d['model']['markers']){if(!_0x58857c['name']['startsWith']('user:position'))continue;const _0x19b667=_0x4f5b6d['editing']['mapper']['markerNameToElements'](_0x58857c['name']);if(_0x19b667){for(const _0x578607 of _0x19b667)_0x49cf70['removeClass']('ck-user__marker_hovered',_0x578607);}}});}(_0x3f82e2);},{'useCapture':!0x0});}afterInit(){const _0x2af7e9=this['editor'],_0x92d534=_0x2af7e9['commands']['get']('undo');_0x92d534&&_0x2af7e9['model']['on']('applyOperation',(_0x4f53ba,_0x594479)=>{const _0x2c865f=_0x594479[0x0];if(!_0x2c865f['isDocumentOperation'])return;if('marker'!=_0x2c865f['type']||!_0x2c865f['name']['startsWith']('user:'))return;const _0x1c7df9=_0x2c865f['batch'];_0x92d534['_createdBatches']['has'](_0x1c7df9)&&(_0x2c865f['newRange']=_0x2c865f['oldRange']?_0x2af7e9['model']['createRange'](_0x2c865f['oldRange']['start'],_0x2c865f['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x49260f=this['editor'],_0x2f561c=_0x49260f['model']['document'],_0x5b1729=_0x49260f['plugins']['get'](Y);_0x49260f['model']['enqueueChange']({'isUndoable':!0x1},_0x3bb41b=>{const _0x249f24='user:range:'+_0x5b1729['mySessionId'],_0x2e8a33='user:position:'+_0x5b1729['mySessionId'],_0x2a30da=_0x49260f['model']['markers']['has'](_0x249f24);_0x49260f['editing']['view']['hasDomSelection']?J(_0x5b1729['mySessionId'],_0x2f561c['selection']['getFirstRange'](),_0x49260f['model'],_0x3bb41b):_0x2a30da&&(_0x3bb41b['removeMarker'](_0x249f24),_0x3bb41b['removeMarker'](_0x2e8a33));});}};function J(_0x54be85,_0x2b99b9,_0x49a06d,_0x1437eb){const _0x46b1d9='user:range:'+_0x54be85,_0x10fa7f='user:position:'+_0x54be85,_0x63c989=_0x2b99b9['getContainedElement']();let _0x2c11a9=_0x2b99b9['start'];if(_0x63c989&&_0x63c989['is']('element','tableCell')){const _0x9858e9=function(_0x4bcda8,_0x1a4d5e){for(const _0x45a928 of _0x4bcda8['getPositions']())if(_0x1a4d5e['schema']['checkChild'](_0x45a928,'$text'))return _0x45a928;}(_0x2b99b9,_0x49a06d);_0x9858e9&&(_0x2c11a9=_0x9858e9,_0x2b99b9=_0x1437eb['createRange'](_0x2c11a9));}const _0x4e4772=_0x1437eb['createRange'](_0x2c11a9);_0x49a06d['markers']['has'](_0x46b1d9)?(_0x1437eb['updateMarker'](_0x46b1d9,{'range':_0x2b99b9}),_0x1437eb['updateMarker'](_0x10fa7f,{'range':_0x4e4772})):(_0x1437eb['addMarker'](_0x46b1d9,{'range':_0x2b99b9,'usingOperation':!0x0}),_0x1437eb['addMarker'](_0x10fa7f,{'range':_0x4e4772,'usingOperation':!0x0}));}function Q(_0x55f5a9){return'--ck-user-color:'+_0x55f5a9['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x55f5a9['color']['getColorAlphaVariable']()+';';}function X(_0x2279ed,_0x12691b,_0x55d121){const _0xa846d6=_0x2279ed['t'],t=_0x2279ed['t'];switch(_0x12691b){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 _0xa846d6({'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'},_0x55d121);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x198537{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
- ((()=>_0x5a4319)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x308caf,_0x452795,_0x4b7247];}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 _0x77e21=this['serverHistory']['getOperations']();for(let _0x6ceb=_0x77e21['length']-0x1;_0x6ceb>=0x0;_0x6ceb--){const _0x3ff8e9=_0x77e21[_0x6ceb];if(!this['_disconnectionOperations']['has'](_0x3ff8e9))return _0x3ff8e9['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x20d785){if(super(_0x20d785),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x402f9e(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x470142('collaboration-missing-channelid',this);const _0x358eea=_0x20d785['config']['get']('cloudServices.bundleVersion')||_0x6ba88b;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x358eea,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x1daf1d(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new it(this['_disconnectionOperations']);}init(){const _0x495810=this['editor'],_0x1ea7cc=_0x495810['plugins']['get'](_0x452795),_0x4eef19=_0x495810['plugins']['get'](z);this['listenTo'](_0x1ea7cc,'getOperationAuthor',(_0x5ef32f,_0x59bfdf)=>{const _0x2e5daa=_0x59bfdf[0x0];_0x2e5daa['_authorId']&&(_0x5ef32f['return']=_0x1ea7cc['getUser'](_0x2e5daa['_authorId']),_0x5ef32f['stop']()),null===_0x2e5daa['_authorId']&&(_0x5ef32f['return']=null,_0x5ef32f['stop']());},{'priority':'high'}),this['listenTo'](_0x495810['model']['document']['selection'],'change:range',(_0x25ca7d,_0x25fb22)=>{_0x25fb22['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x495810['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x495810['model']['on']('applyOperation',(_0x623177,_0x21688d)=>{const _0x1972ea=_0x21688d[0x0];_0x1972ea['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x1972ea),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x4eef19,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x33aefb,_0x377f92,_0x4c76ee)=>'connected'===_0x33aefb&&!_0x377f92&&!_0x4c76ee),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x495810['disableReadOnlyMode']('rtc-offline'):_0x495810['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x495810['disableReadOnlyMode']('rtc-offline'):_0x495810['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x1e5c84=this['editor']['plugins']['get'](Y),_0x4e7299=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x1e5c84['unregister'](this['_channelId']);const _0x9d9cbc=await this['_service']['reconnect'](_0x4e7299['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x9d9cbc)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x185817=await this['_service']['getConnectedSessions']();_0x1e5c84['register'](this['_channelId'],_0x185817),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x23fc99){if(function(_0x2fc85d){return'404'===_0x2fc85d['code'];}(_0x23fc99)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x4890d0){return'409'===_0x4890d0['code'];}(_0x23fc99)){const _0x50ab3b=X(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x50ab3b);}else{if(!(_0x23fc99 instanceof et))throw _0x23fc99;this['_handleReconnectionError']();}}}}destroy(){const _0x5984e1=this['editor']['plugins']['get'](z),_0xb44e9b=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0xb44e9b['channelSessions']['has'](this['_channelId'])&&_0xb44e9b['unregister'](this['_channelId']),_0x5984e1['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x1be2ba){if(this['sessionId']!==_0x1be2ba['sessionId']&&this['_lastSyncedOperationId']!==_0x1be2ba['lastOperationId'])throw new et();return this['sessionId']=_0x1be2ba['sessionId'],this['_handleServerResponse']([],{..._0x1be2ba,'wereChangesApplied':!0x1,'data':_0x1be2ba['data']},'reconnect');}async _connectService(_0x41ae68,_0x9f7629=!0x1){const {connection:_0x115742}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x115742,this['_channelId'])['then'](_0x2d0132=>this['_initSessionsHandling'](_0x2d0132))['catch'](_0x14e8f2=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x14e8f2);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x4ae159,_0x382875)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x382875);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x5b0f87=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x41ae68);this['_isPendingUpdate']=!0x0;const _0x50fbb6=await this['_service']['connect'](_0x115742,this['_compressOperations'](_0x41ae68),_0x5b0f87);if(this['sessionId']=_0x50fbb6['sessionId'],_0x9f7629){if(!_0x50fbb6['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x50fbb6['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x41ae68,_0x50fbb6,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x50fbb6,_0x41ae68);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x302b53=this['editor']['plugins']['get'](Y),_0x2dc07b=this['editor']['plugins']['get'](K),_0x5e958a=_0x302b53['channelSessions']['get'](this['_channelId']);_0x5e958a&&_0x5e958a['length']>0x1?_0x2dc07b['createUserMarkerOperations']():this['listenTo'](_0x302b53,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x302b53['channelSessions']['get'](this['_channelId'])['length']&&_0x2dc07b['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x1383ad,_0x4b6ab4,_0x543cf9,_0x18f7ae){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x4b6ab4){const _0x355bc9=this['_decompressOperations'](_0x543cf9,_0x18f7ae);await this['_fetchMissingUsers'](_0x355bc9),this['_handleExternalOperations'](_0x355bc9,_0x4b6ab4,_0x543cf9['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x456bcf}=this['editor'];let _0x41c5f2;try{_0x41c5f2=await this['_service']['getDocumentDetails']();}catch{const _0x562f51=X(_0x456bcf,'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'](_0x562f51);}const _0x205d02=_0x41c5f2['currentDocumentSession']||_0x41c5f2['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x205d02['lastOperationId']){const _0x50c1a9=X(_0x456bcf,'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'](_0x50c1a9);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x654fe0=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x654fe0['connection']||'connected'!==_0x654fe0['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x18513e=this['editor']['plugins']['get'](Y);_0x18513e['channelSessions']['has'](this['_channelId'])&&_0x18513e['unregister'](this['_channelId']),_0x654fe0['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x336fdf){const _0x459c7b=this['editor']['plugins']['get'](Y);this['listenTo'](_0x459c7b,'sessionAdd:'+this['_channelId'],(_0x13a09b,{session:_0x546e32})=>{if(_0x546e32['id']===_0x459c7b['mySessionId']){_0x13a09b['off']();const _0x81a745=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x566750=_0x546e32['permissions'];_0x81a745&&_0x81a745['isEnabled']&&(_0x566750=_0x566750['filter'](_0x3de608=>'document:write'!==_0x3de608)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x566750,this['_channelId']);}}),_0x459c7b['register'](this['_channelId'],_0x336fdf);}_initThrowingOnDataSet(){const _0x3b82b2=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x54d093)=>{if(!_0x54d093[_0x54d093['length']-0x1]['suppressErrorInCollaboration'])throw new _0x470142('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x3b82b2['apply'](this['editor']['data'],_0x54d093);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x1efa00,[_0x5f55ac])=>{if(this['_document']['version'])throw new _0x470142('realtimecollaborationclient-init-document-already-initialized',this);_0x1efa00['stop'](),this['_setPendingAction']();const _0x876517=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x9b32aa])=>!_0x9b32aa['lazyLoad'])['map'](([_0x13ebba,_0x480e6c])=>[_0x13ebba,_0x480e6c['modelAttributes']||{}])),_0x433885=this['_getOperationsFromInitData'](_0x5f55ac,_0x876517);0x0==_0x433885['length']&&_0x433885['push'](new _0x1bd6a0(0x0)),_0x1efa00['return']=this['_connectService'](_0x433885)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x43138a=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x43138a))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x4ab2e8,[_0x309a19,_0x525bc4])=>{_0x4ab2e8['stop']();const _0x1f95e0=this['editor']['model']['document']['getRoot'](_0x309a19);if(!this['_knownRootNames']['has'](_0x309a19)){const _0x118ef7=_0x525bc4&&_0x525bc4['data']?_0x525bc4['data']:'',_0x4efbb1=_0x525bc4&&_0x525bc4['attributes']?_0x525bc4['attributes']:{};await this['_loadRoot'](_0x309a19,_0x118ef7,_0x4efbb1);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x1f95e0['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x1f95e0);});},{'priority':'high'});}async _fetchMissingUsers(_0x258f3d){const _0x24d2e0=this['editor']['plugins']['get'](_0x452795),{connection:_0x2373b7}=this['editor']['plugins']['get'](z),_0x34ba5c=new Set();for(const _0x1d7841 of _0x258f3d){const _0xab4911=_0x1d7841['_authorId'];_0xab4911&&!_0x24d2e0['getUser'](_0xab4911)&&_0x34ba5c['add'](_0xab4911);}if(0x0===_0x34ba5c['size'])return;const _0x5d618e=await _0xfaa43['getMany'](_0x2373b7,Array['from'](_0x34ba5c));for(const _0x224baf of _0x5d618e)_0x24d2e0['getUser'](_0x224baf['id'])||_0x24d2e0['addUser'](_0x224baf);}_getOperationsFromInitData(_0x6892a4,_0x28993d={}){const _0x127706=this['editor']['model'],_0x1af921=[];let _0x5da225=0x0;const _0x172ac0='string'==typeof _0x6892a4?{'main':_0x6892a4}:_0x6892a4;for(const _0x73bcc4 of Object['keys'](_0x172ac0)){if(!this['_document']['roots']['has'](_0x73bcc4))throw new _0x470142('realtimecollaborationclient-init-non-existent-root',this);const _0x410b81=this['_document']['getRoot'](_0x73bcc4),_0x1f4efd=this['editor']['data']['parse'](_0x172ac0[_0x73bcc4],_0x410b81),_0x34c5bc=new _0x17d254(_0x127706['createPositionAt'](_0x410b81,0x0),_0x1f4efd,_0x5da225++);_0x1af921['push'](_0x34c5bc);for(const [_0x59cbe3,_0x511bd1]of _0x1f4efd['markers']){const _0x381781=new _0x573d35(_0x59cbe3,null,_0x127706['createRange'](_0x127706['createPositionFromPath'](_0x410b81,_0x511bd1['start']['path']['slice']()),_0x127706['createPositionFromPath'](_0x410b81,_0x511bd1['end']['path']['slice']())),_0x127706['markers'],!0x0,_0x5da225++);_0x1af921['push'](_0x381781);}}if(_0x28993d)for(const [_0x2e4de4,_0x58d9d7]of Object['entries'](_0x28993d)){const _0x1018f3=_0x127706['document']['getRoot'](_0x2e4de4);if(!_0x1018f3)throw new _0x470142('multi-root-editor-root-attributes-no-root',null);for(const [_0x6a8a2,_0x5229f1]of Object['entries'](_0x58d9d7))if(null!==_0x5229f1){const _0x3feea3=new _0x3ea597(_0x1018f3,_0x6a8a2,null,_0x5229f1,_0x5da225++);_0x1af921['push'](_0x3feea3);}}return _0x1af921;}async _loadRoot(_0xbd37da,_0x2f7f12,_0xd1ecbe){this['_getOperationsFromInitData']({[_0xbd37da]:_0x2f7f12},{[_0xbd37da]:_0xd1ecbe})['forEach']((_0x544424,_0x2836f6)=>{_0x544424['baseVersion']=this['_document']['version']+_0x2836f6,_0x544424['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x544424);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x2c9ccf,_0x7bce73){let _0x2b10cf;this['_offset']=_0x2c9ccf['offset'];const _0x5a0423=_0x2c9ccf['wereChangesApplied']&&!_0x2c9ccf['initData'],_0x5f1379=_0x5a0423?0x0:_0x2c9ccf['data']['baseVersion'];if(_0x7bce73['forEach'](_0x2b19c3=>{_0x2b19c3['_isInit']=!0x0,_0x2b19c3['createdAt']=_0x2c9ccf['sessionCreatedAt'],_0x2b19c3['_authorId']=null;}),_0x5a0423)_0x2b10cf=_0x7bce73,this['_applyOperationsSet'](_0x2b10cf,_0x5a0423);else{if(_0x2c9ccf['initData']){const _0x241554=this['_getOperationsFromInitData'](_0x2c9ccf['initData']);this['_document']['history']['version']=-_0x241554['length'],_0x241554['forEach'](_0x5de4c6=>{_0x5de4c6['baseVersion']-=_0x241554['length'],_0x5de4c6['createdAt']=_0x2c9ccf['sessionCreatedAt'],_0x5de4c6['_isInit']=!0x0,_0x5de4c6['_authorId']=null;}),this['_applyOperationsSet'](_0x241554,!0x0),this['serverHistory']['version']=-_0x241554['length']+this['_offset'],this['_updateServerHistory'](_0x241554);}this['_document']['history']['version']=_0x5f1379,_0x2b10cf=this['_decompressOperations'](_0x2c9ccf['data'],_0x2c9ccf['metadata']),await this['_fetchMissingUsers'](_0x2b10cf),this['_applyOperationsSet'](_0x2b10cf,_0x5a0423);}_0x2c9ccf['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x2b10cf,_0x2c9ccf['lastOperationId']),this['_lastSyncedOperationId']=_0x2c9ccf['lastOperationId']),this['serverHistory']['version']=_0x5f1379+this['_offset'],this['_updateServerHistory'](_0x2b10cf),_0x7bce73['filter'](_0x211316=>{const _0x5ae195=this['_getAffectedRoot'](_0x211316);return _0x5ae195&&!this['_knownRootNames']['has'](_0x5ae195);})['forEach']((_0x244c6b,_0x5c402b)=>{_0x244c6b['baseVersion']=this['_document']['version']+_0x5c402b,this['_saveOperationInBuffer'](_0x244c6b);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x285357,_0x269eb2){const _0x527b32=_0x269eb2&&_0x269eb2['message'];if(_0x527b32&&_0x527b32['startsWith']('realtimecollaborationclient'))throw _0x269eb2;const _0xb32b7d=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0xb32b7d['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x470142(_0x285357,this['editor'],_0x527b32?{'originalError':_0x527b32}:void 0x0);}_saveOperationInBuffer(_0x2ded21){this['_knownOperations']['has'](_0x2ded21)||(this['_knownOperations']['add'](_0x2ded21),this['_bufferedOperations']['push'](_0x2ded21),this['_pendingAction']||'marker'==_0x2ded21['type']&&!_0x2ded21['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x2b80db=!0x1){!_0x2b80db&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x483b20=>{_0x483b20&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x8c5463=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x16581d){return _0x16581d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x16581d['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x16581d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x8c5463)||this['_crash'](_0x8c5463['message'],_0x8c5463);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x435ddc=>{this['on']('change:_isPendingUpdate',()=>{_0x435ddc();});});}async _sendBufferedOperations(){const _0x1dcf23=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x1dcf23['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x1279fd=[...this['_bufferedOperations']];for(const _0x90faf2 of _0x1279fd)_0x90faf2['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x90faf2);const _0x2805a0=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1279fd),_0x3638ad=Z++,_0xeec778=this['_compressOperations'](_0x1279fd),_0x32d539=await this['_service']['sendOperations'](_0xeec778,_0xeec778['baseVersion'],_0x2805a0);try{return await this['_handleServerResponse'](_0x1279fd,_0x32d539,_0x3638ad);}catch(_0x5e89a5){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x5e89a5);}}async['_handleServerResponse'](_0x20d489,_0x3eb623,_0x42c323){if('error'in _0x3eb623)throw _0x3eb623['error'];let _0xfa7918;if(_0x3eb623['wereChangesApplied']){_0x3eb623['lastOperationId']&&(this['_lastSyncedOperationId']=_0x3eb623['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x47673c=>!_0x20d489['includes'](_0x47673c));for(const _0x15de43 of _0x20d489)_0x15de43['createdAt']='lastOperationAcceptedAt'in _0x3eb623&&_0x3eb623['lastOperationAcceptedAt']||void 0x0;st(_0x20d489,_0x3eb623['version']-_0x20d489['length']),this['_updateServerHistory'](_0x20d489);const _0x52a969=_0x20d489['filter'](_0x483e0b=>{if(!_0x483e0b['_isInit'])return!0x1;const _0x57689b=this['_getAffectedRoot'](_0x483e0b);return _0x57689b&&!this['_knownRootNames']['has'](_0x57689b);});st(_0x52a969,this['_document']['version']),this['_applyOperationsSet'](_0x52a969),_0xfa7918=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x23e454=this['_decompressOperations'](_0x3eb623['data'],_0x3eb623['metadata'])['filter'](_0x3bee07=>_0x3bee07['baseVersion']>=this['_lastServerVersion']);_0x23e454['forEach'](_0x281112=>this['_addKnownRoot'](_0x281112)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x557ff2=>!_0x557ff2['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x557ff2))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x23e454),_0xfa7918=this['_handleExternalOperations'](_0x23e454,_0x3eb623['version'],_0x3eb623['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0xfa7918?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x28b526,_0x525763,_0x1e5694){try{const _0x3a22a2={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x4ef4c6,operationsB:_0x11f9f4,originalOperations:_0x626dae}=_0x117acd(_0x28b526,this['_bufferedOperations'],_0x3a22a2);st(_0x4ef4c6,this['_document']['version']),st(_0x11f9f4,_0x525763);for(const _0x33b400 of _0x4ef4c6){const _0x1a68a9=_0x626dae['get'](_0x33b400);_0x1a68a9?(_0x33b400['_authorId']=_0x1a68a9['_authorId'],'noop'!==_0x33b400['type']&&(_0x33b400['_aiSource']=_0x1a68a9['_aiSource'])):_0x33b400['_authorId']=null;}for(const _0x456382 of _0x11f9f4)'noop'!==_0x456382['type']&&(_0x456382['_aiSource']=_0x626dae['get'](_0x456382)?.['_aiSource']);_0x1e5694&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x28b526,_0x1e5694),this['_lastSyncedOperationId']=_0x1e5694),this['_bufferedOperations']=[..._0x11f9f4],this['_applyOperationsSet'](_0x4ef4c6),this['_updateServerHistory'](_0x28b526);}catch(_0x55fa7a){return console['error'](_0x55fa7a),!0x1;}return!0x0;}_applyOperationsSet(_0x117ecf,_0x27a616=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x26f565=>{for(const _0x535f0f of _0x117ecf)this['_knownOperations']['add'](_0x535f0f),this['_addKnownRoot'](_0x535f0f),_0x26f565['batch']['addOperation'](_0x535f0f),this['editor']['model']['applyOperation'](_0x535f0f);});}_addKnownRoot(_0x1bb9f7){const _0x47bc75=this['_getAffectedRoot'](_0x1bb9f7);_0x47bc75&&this['_knownRootNames']['add'](_0x47bc75);}_getAffectedRoot(_0x1085db){let _0x39f005,_0x3fad81;switch(_0x1085db['type']){case'insert':_0x39f005=_0x1085db['position']['root'];break;case'marker':if(_0x3fad81=_0x1085db['newRange'],!_0x3fad81)return null;_0x39f005=_0x3fad81['root'];break;case'addRootAttribute':_0x39f005=_0x1085db['root'];break;case'addRoot':_0x39f005=_0x1085db['affectedSelectable'];break;case'move':_0x39f005=_0x1085db['targetPosition']['root'];break;default:return null;}return _0x39f005['rootName'];}_updateServerHistory(_0x243c88){_0x243c88['forEach'](_0x64bc59=>{const _0x323101=_0x64bc59['clone']();_0x323101['_authorId']=_0x64bc59['_authorId'],_0x323101['_isInit']=!!_0x64bc59['_isInit'],_0x323101['_aiSource']=_0x64bc59['_aiSource'],_0x323101['createdAt']=_0x64bc59['createdAt'],_0x323101['baseVersion']+=this['_offset'],_0x64bc59['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x323101),this['serverHistory']['addOperation'](_0x323101);});}_handleReconnectionError(_0x49d88f){const _0x51a21f=this['editor']['plugins']['get']('Notification'),_0x3c1d00=this['editor']['locale'];_0x49d88f||(_0x49d88f=X(_0x3c1d00,'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.')),_0x51a21f['showWarning'](_0x49d88f,{'title':X(_0x3c1d00,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x308caf)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x308caf)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x135ab6){const _0x53aff0=_0x135ab6['map'](_0x12064d=>_0x12064d['toJSON']());return this['_compressor']['compress'](_0x53aff0);}_decompressOperations(_0x55bbb1,_0x164f09){return this['_compressor']['decompress'](_0x55bbb1)['map']((_0x53ba4c,_0x44b95d)=>{const _0x18a8a4='init'==_0x164f09[_0x44b95d]['type'];if('InsertOperation'==_0x53ba4c['__className']){const _0x4e067c=_0x53ba4c['position']['root'];!this['_document']['getRoot'](_0x4e067c)&&(this['_document']['createRoot']('$unknown',_0x4e067c)['_isAttached']=!0x1);}else{if('RootOperation'==_0x53ba4c['__className']){const _0x258ecf=this['_document']['getRoot'](_0x53ba4c['rootName']);_0x258ecf&&'$unknown'==_0x258ecf['name']&&_0x53ba4c['elementName']!=_0x258ecf['name']&&(_0x258ecf['name']=_0x53ba4c['elementName']);}}const _0x5c72f6=_0x565114['fromJSON'](_0x53ba4c,this['_document']);return _0x5c72f6['wasUndone']=_0x53ba4c['wasUndone'],_0x5c72f6['_isInit']=_0x18a8a4,_0x5c72f6['_authorId']=_0x18a8a4?null:_0x164f09[_0x44b95d]['userId'],_0x5c72f6['_isDisconnection']='cs:removeUser'===_0x164f09[_0x44b95d]['type'],_0x5c72f6['_aiSource']=_0x53ba4c['_aiSource']||void 0x0,_0x5c72f6['createdAt']=_0x164f09[_0x44b95d]['createdAt'],_0x5c72f6;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x18901f=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x18901f&&_0x18901f['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x106ae6,_0x19591c){for(const _0x11d29a of _0x106ae6)_0x11d29a['baseVersion']=_0x19591c++;}var it=class{_ignoredOperations;_operationToId;constructor(_0x54e693){this['_ignoredOperations']=_0x54e693,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x288a58){let _0x16cb5c=_0x288a58['length'];for(;_0x16cb5c--;){const _0x18b24b=_0x288a58[_0x16cb5c];if(!this['_ignoredOperations']['has'](_0x18b24b)){if(!this['_operationToId']['has'](_0x18b24b)){const _0x1e9175=_0x4ff846()['slice'](0x1,0x12);this['_operationToId']['set'](_0x18b24b,_0x1e9175);}return this['_operationToId']['get'](_0x18b24b);}}}setIdForTheLastOperation(_0x184bfc,_0x535ee1){if(!_0x535ee1)return;let _0x5e74f7=_0x184bfc['length'];for(;_0x5e74f7--;){const _0x211481=_0x184bfc[_0x5e74f7];this['_ignoredOperations']['has'](_0x211481)||this['_operationToId']['set'](_0x211481,_0x535ee1);}}},nt=class extends _0x198537{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x1b8d8d{static CommentsService=/* #__PURE__ -- @preserve */
26
- ((()=>_0x26b101)());['_services'];static get requires(){return[z,_0x2d3c83,Y,_0x452795];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x1e0544){super(_0x1e0544),this['_services']=new Map();}async init(){const _0x56240e=this['context'],_0x2b2e0f=_0x56240e['plugins']['get'](_0x2d3c83);if(_0x56240e['plugins']['get'](z)['addToReconnectionStack'](this),_0x2b2e0f['adapter']={'addCommentThread':async({channelId:_0x5eb518,threadId:_0x3bdfae,comments:_0x50f719,resolvedAt:_0x26ac4f,resolvedBy:_0x7b6fcf,context:_0x10103c,attributes:_0x21494d})=>{const _0xc58438=await this['_getService'](_0x5eb518)['addCommentThread']({'commentThreadId':_0x3bdfae,'comments':_0x50f719['map'](_0x4a5705=>function(_0x59170f,_0x10a6e3,_0x52d8fc){return{'commentThreadId':_0x52d8fc,'commentId':_0x59170f['commentId'],'userId':_0x59170f['authorId'],'content':_0x59170f['content'],'documentId':_0x10a6e3,'createdAt':_0x59170f['createdAt'],'attributes':_0x59170f['attributes']||{}};}(_0x4a5705,_0x5eb518,_0x3bdfae)),'resolvedAt':_0x26ac4f,'resolvedBy':_0x7b6fcf,'context':_0x10103c,'attributes':_0x21494d})['catch'](ct);return{'threadId':_0xc58438['commentThreadId'],'comments':_0xc58438['comments']};},'getCommentThread':async({channelId:_0x86bff,threadId:_0x2b5f98})=>{const _0x3c7304=await this['_getService'](_0x86bff)['getCommentThread'](_0x2b5f98)['catch'](rt)['catch'](ct);return _0x3c7304?_0x3c7304['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3c7304]),{'threadId':_0x3c7304['commentThreadId'],'comments':_0x3c7304['comments']['map'](at),'context':_0x3c7304['context'],'resolvedAt':_0x3c7304['resolvedAt'],'resolvedBy':_0x3c7304['resolvedBy'],'attributes':_0x3c7304['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x4c7fbf,threadId:_0x521a66,context:_0x2c8dad,unlinkedAt:_0x47333b,attributes:_0x1aa0e2})=>this['_getService'](_0x4c7fbf)['updateCommentThread']({'commentThreadId':_0x521a66,'context':_0x2c8dad,'attributes':_0x1aa0e2,'unlinkedAt':_0x47333b})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x51116a,threadId:_0x2e51a8})=>{const _0x40b74f=await this['_getService'](_0x51116a)['resolveCommentThread'](_0x2e51a8)['catch'](rt)['catch'](ct);return{'threadId':_0x40b74f['commentThreadId'],'resolvedAt':_0x40b74f['resolvedAt'],'resolvedBy':_0x40b74f['resolvedBy']};},'reopenCommentThread':async({channelId:_0x560a07,threadId:_0x555d88})=>this['_getService'](_0x560a07)['reopenCommentThread'](_0x555d88)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x42efc8,threadId:_0x4fc6b2})=>this['_getService'](_0x42efc8)['removeCommentThread'](_0x4fc6b2)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x20f71c,threadId:_0x79691,commentId:_0x374713,content:_0x2887d3,attributes:_0x7fe738})=>this['_getService'](_0x20f71c)['addComment'](_0x79691,_0x374713,_0x2887d3,_0x7fe738)['catch'](ct),'updateComment':({channelId:_0x4f6374,threadId:_0x5bf46c,commentId:_0x5c36e4,content:_0x5f045d,attributes:_0x16c7c0})=>this['_getService'](_0x4f6374)['updateComment'](_0x5bf46c,_0x5c36e4,_0x5f045d,_0x16c7c0)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0xad690a,threadId:_0x407053,commentId:_0x59d30d})=>this['_getService'](_0xad690a)['removeComment'](_0x407053,_0x59d30d)['catch'](rt)['catch'](ct)},_0x56240e instanceof _0x40150f){const _0x31d301=_0x56240e['config']['get']('collaboration.channelId'),_0x10b045=_0x56240e['plugins']['get'](Y);await this['_setUpService'](_0x31d301);const _0x4f29d6=await this['_services']['get'](_0x31d301)['getConnectedSessions']();this['listenTo'](_0x10b045,'sessionAdd:'+_0x31d301,(_0x50b302,{session:_0x2c1fc4})=>{_0x2c1fc4['id']===_0x10b045['mySessionId']&&(_0x50b302['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x2c1fc4['permissions'],_0x31d301));}),_0x10b045['register'](_0x31d301,_0x4f29d6);}}async _setUpService(_0x59c3c4){if(this['_services']['has'](_0x59c3c4))throw new _0x470142('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x59c3c4});const _0x2335f4=this['context']['plugins']['get'](_0x2d3c83),_0x4b2dfa=new CloudServicesCommentsAdapter['CommentsService'](_0x59c3c4);this['_services']['set'](_0x59c3c4,_0x4b2dfa),this['listenTo'](_0x4b2dfa,'commentThreadAdded',(_0x1ad2c1,_0x400a21)=>{const {commentThreadId:_0x1e421d,documentId:_0x19c2bd,context:_0x12da12,attributes:_0x1cea7a,resolvedAt:_0x5881f5,resolvedBy:_0x102d9f,comments:_0x32e517}=_0x400a21;_0x2335f4['getCommentThread'](_0x1e421d)||_0x2335f4['addCommentThread']({'threadId':_0x1e421d,'channelId':_0x19c2bd,'comments':_0x32e517?_0x32e517['map'](at):[],'context':_0x12da12,'attributes':_0x1cea7a,'resolvedAt':_0x5881f5,'resolvedBy':_0x102d9f,'isFromAdapter':!0x0});}),this['listenTo'](_0x4b2dfa,'commentThreadUpdated',(_0x4564ba,{commentThreadId:_0x590b41,documentId:_0x18b7a4,context:_0x5aaafb,unlinkedAt:_0x158df5,attributes:_0xe6980d})=>{_0x2335f4['getCommentThread'](_0x590b41)&&_0x2335f4['updateCommentThread']({'threadId':_0x590b41,'channelId':_0x18b7a4,'context':_0x5aaafb,'unlinkedAt':_0x158df5,'attributes':_0xe6980d,'isFromAdapter':!0x0});}),this['listenTo'](_0x4b2dfa,'commentThreadResolved',(_0x594cc3,{commentThreadId:_0x1406a1,resolvedBy:_0xcd9bb0,resolvedAt:_0x2b551f})=>{const _0x483647=_0x2335f4['getCommentThread'](_0x1406a1);_0x483647&&_0x483647['resolve']({'resolvedBy':_0xcd9bb0,'resolvedAt':_0x2b551f,'isFromAdapter':!0x0});}),this['listenTo'](_0x4b2dfa,'commentThreadReopened',(_0x1e8736,{commentThreadId:_0x282938})=>{const _0x3047fa=_0x2335f4['getCommentThread'](_0x282938);_0x3047fa&&_0x3047fa['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4b2dfa,'commentThreadRemoved',(_0x52d2e3,{commentThreadId:_0x54f725})=>{const _0x5574f0=_0x2335f4['getCommentThread'](_0x54f725);_0x5574f0&&_0x5574f0['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4b2dfa,'commentAdded',(_0x531ee4,_0x5e2059)=>{const _0x2cced8=_0x5e2059['commentThreadId'],_0x10f1c9=_0x2335f4['getCommentThread'](_0x2cced8);_0x10f1c9&&_0x10f1c9['addComment']({...at(_0x5e2059),'isFromAdapter':!0x0});}),this['listenTo'](_0x4b2dfa,'commentUpdated',(_0x4c401c,{commentThreadId:_0x5325ad,commentId:_0x5728a5,content:_0xeebf3c,attributes:_0x581679})=>{const _0x56afec=_0x2335f4['getCommentThread'](_0x5325ad);if(_0x56afec){const _0x118825=_0x56afec['getComment'](_0x5728a5);_0x118825&&_0x118825['update']({'content':_0xeebf3c,'attributes':_0x581679,'isFromAdapter':!0x0});}}),this['listenTo'](_0x4b2dfa,'commentRemoved',(_0x46196f,{commentThreadId:_0x6afe30,commentId:_0x752b3f})=>{const _0x3a1a77=_0x2335f4['getCommentThread'](_0x6afe30);if(_0x3a1a77){const _0x1dd763=_0x3a1a77['getComment'](_0x752b3f);_0x1dd763&&_0x1dd763['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x4b2dfa,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x59c3c4),this['stopListening'](_0x4b2dfa));}),await this['_connectService'](_0x59c3c4);}destroy(){if(this['context']instanceof _0x40150f){const _0x4c080f=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x4c080f)&&this['_terminateService'](_0x4c080f);}}_terminateService(_0x6dd3a6){if(!this['_services']['has'](_0x6dd3a6))throw new _0x470142('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x6dd3a6});this['_getService'](_0x6dd3a6)['disconnect'](),this['_services']['delete'](_0x6dd3a6);}async reconnect(){for(const _0x36024e of this['_services']['keys']())await this['_connectService'](_0x36024e);if(this['context']instanceof _0x40150f){const _0x3b4f19=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x3b4f19)){const _0x5e7a7e=this['context']['plugins']['get'](Y);_0x5e7a7e['unregister'](_0x3b4f19);const _0x11e0a8=await this['_services']['get'](_0x3b4f19)['getConnectedSessions']();_0x5e7a7e['register'](_0x3b4f19,_0x11e0a8);}}}async _connectService(_0x35bd5c){const {connection:_0x589bab}=this['context']['plugins']['get'](z),_0xaabd99=this['context']['plugins']['get'](_0x2d3c83),_0x8e4fc7=await this['_services']['get'](_0x35bd5c)['connect'](_0x589bab);await this['_fetchMissingUsersForThreads'](_0x8e4fc7);const _0x586960=new Set(Array['from'](_0xaabd99['getCommentThreads']({'channelId':_0x35bd5c}),_0x2ea22d=>_0x2ea22d['id']));for(const _0x23e827 of _0x8e4fc7)_0x23e827['deletedAt']||_0x586960['delete'](_0x23e827['commentThreadId']);for(const _0x57f17a of _0x586960)_0xaabd99['getCommentThread'](_0x57f17a)['remove']({'isFromAdapter':!0x0});for(const _0x5c5147 of _0x8e4fc7){let _0x15eee6=_0xaabd99['getCommentThread'](_0x5c5147['commentThreadId']);const {commentThreadId:_0xadcd1a,context:_0x52c434,attributes:_0x247aab,resolvedBy:_0x1a305d,resolvedAt:_0xda1d79,unlinkedAt:_0x286c5b,deletedAt:_0x53d5eb}=_0x5c5147;if(_0x53d5eb)continue;_0x15eee6||(_0x15eee6=_0xaabd99['addCommentThread']({'channelId':_0x35bd5c,'threadId':_0xadcd1a,'context':_0x52c434,'attributes':_0x247aab||{},'resolvedBy':_0x1a305d,'resolvedAt':_0xda1d79,'unlinkedAt':_0x286c5b,'isFromAdapter':!0x0}));const _0x15b674=new Set(Array['from'](_0x15eee6['comments'],_0x2660e6=>_0x2660e6['id']));for(const _0x4176a5 of _0x5c5147['comments'])_0x15b674['delete'](_0x4176a5['commentId']);for(const _0x49197e of _0x15b674)_0x15eee6['getComment'](_0x49197e)['remove']({'isFromAdapter':!0x0});for(const _0x3e2d2e of _0x5c5147['comments']){const _0x4722d4=_0x15eee6['getComment'](_0x3e2d2e['commentId']);_0x4722d4?_0x4722d4['content']!==_0x3e2d2e['content']&&_0x4722d4['update']({'content':_0x3e2d2e['content'],'isFromAdapter':!0x0}):_0x15eee6['addComment'](Object['assign'](at(_0x3e2d2e),{'isFromAdapter':!0x0}));}}}_getService(_0x6a6253){if(!this['_services']['has'](_0x6a6253))throw new _0x470142('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x6a6253});return this['_services']['get'](_0x6a6253);}async _fetchMissingUsersForThreads(_0x247a8a){const _0x594a51=this['context']['plugins']['get'](_0x452795),{connection:_0x348409}=this['context']['plugins']['get'](z),_0x285e1a=new Set();for(const {resolvedBy:_0x344d80,comments:_0x3483b3}of _0x247a8a){_0x344d80&&!_0x594a51['getUser'](_0x344d80)&&_0x285e1a['add'](_0x344d80);for(const {userId:_0x37a667}of _0x3483b3)_0x594a51['getUser'](_0x37a667)||_0x285e1a['add'](_0x37a667);}if(0x0===_0x285e1a['size'])return;const _0x58bc2b=await _0xfaa43['getMany'](_0x348409,Array['from'](_0x285e1a));for(const _0x3f42d2 of _0x58bc2b)_0x594a51['getUser'](_0x3f42d2['id'])||_0x594a51['addUser'](_0x3f42d2);}};async function rt(_0x5834e0){if('404'!==_0x5834e0['code'])throw _0x5834e0;}function ct(_0xeae318){if((_0x3ebb38=_0xeae318)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x3ebb38['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3ebb38['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x3ebb38;throw _0xeae318;}function at(_0x493bb3){return{'threadId':_0x493bb3['commentThreadId'],'commentId':_0x493bb3['commentId'],'content':_0x493bb3['content'],'createdAt':_0x493bb3['createdAt'],'authorId':_0x493bb3['userId'],'attributes':_0x493bb3['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x198537{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x3c1634)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x39fbf8,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x407009){super(_0x407009);const _0x184e93=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x184e93);}init(){const _0x105b65=this['editor']['plugins']['get'](z),_0x48b03b=this['editor']['plugins']['get'](_0x39fbf8);return _0x48b03b['adapter']={'getSuggestion':async _0x5d217d=>{await this['_waitForServiceReady']();const _0x16a485=await this['_trackChangesService']['get'](_0x5d217d)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x16a485]),_0x16a485;},'addSuggestion':async({id:_0x4f7fad,type:_0x42d45c,data:_0x26fc4d,originalSuggestionId:_0x3ee4fa,attributes:_0x4feb83})=>{await this['_waitForServiceReady']();const _0x5650e9={'id':_0x4f7fad,'type':_0x42d45c,'data':_0x26fc4d,'originalSuggestionId':_0x3ee4fa,'attributes':_0x4feb83},_0x30b0fb=await this['_trackChangesService']['add'](_0x4f7fad,_0x42d45c,_0x26fc4d,_0x3ee4fa,_0x4feb83)['catch'](_0x4c75f3=>{if(dt(_0x4c75f3))return new Promise(_0x2e9415=>{this['_bufferedRequests']['set'](_0x4f7fad,{'resolve':_0x2e9415,'suggestionData':_0x5650e9});});throw _0x4c75f3;});return this['_bufferedRequests']['delete'](_0x4f7fad),_0x30b0fb;},'updateSuggestion':async(_0x1f6ba7,_0x2e10f1)=>{if(await this['_waitForServiceReady'](),'open'!==_0x2e10f1['state'])return this['_trackChangesService']['update'](_0x1f6ba7,_0x2e10f1)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x22e851,_0x25586d)=>{_0x48b03b['hasSuggestion'](_0x25586d['id'])&&(_0x48b03b['getSuggestion'](_0x25586d['id'])['attributes']=_0x25586d['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x105b65['connection']?.['state']&&(_0x105b65['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x105b65['connection'])['then'](_0x59f694=>(_0x105b65['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x59f694)['then'](()=>{for(const _0x5243b0 of _0x59f694){_0x48b03b['addSuggestionData'](_0x5243b0)['_saved']=!0x0;}})));}async reconnect(){const _0x46fb3e=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x394a0e}=this['editor']['plugins']['get'](z),_0x289930=await this['_trackChangesService']['connect'](_0x394a0e);await this['_fetchMissingUsersForThreads'](_0x289930);for(const {suggestionData:_0x36c3be,resolve:_0xa1d685}of this['_bufferedRequests']['values']()){let _0x14c16a=_0x289930['find'](_0x33a521=>_0x33a521['id']===_0x36c3be['id']);_0x14c16a||(_0x14c16a=await this['_trackChangesService']['add'](_0x36c3be['id'],_0x36c3be['type'],_0x36c3be['data'],_0x36c3be['originalSuggestionId'])),_0xa1d685(_0x14c16a);}for(const _0x490e48 of _0x289930)_0x46fb3e['hasSuggestion'](_0x490e48['id'])||_0x46fb3e['addSuggestionData'](_0x490e48);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x2689df=>{this['listenTo'](this['_trackChangesService'],'connected',_0x2c64a8=>{_0x2c64a8['off'](),_0x2689df();});});}async _fetchMissingUsersForThreads(_0x50f86d){const _0x1e3a93=this['editor']['plugins']['get'](_0x452795),{connection:_0x4ba0fa}=this['editor']['plugins']['get'](z),_0x1d567d=new Set();for(const {authorId:_0x1a2e36}of _0x50f86d)_0x1e3a93['getUser'](_0x1a2e36)||_0x1d567d['add'](_0x1a2e36);if(0x0===_0x1d567d['size'])return;const _0x55c804=await _0xfaa43['getMany'](_0x4ba0fa,Array['from'](_0x1d567d));for(const _0x4c7307 of _0x55c804)_0x1e3a93['getUser'](_0x4c7307['id'])||_0x1e3a93['addUser'](_0x4c7307);}};function lt(_0x1c15b3){if(dt(_0x1c15b3))return new Promise(()=>{});throw _0x1c15b3;}function dt(_0x4c66e5){return _0x4c66e5['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x4c66e5['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x198537{static get requires(){return[_0x19436d,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x55e768=this['editor']['plugins']['get'](z),_0x46d47e=this['editor']['plugins']['get'](_0x520bc4),_0x4b74b1=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x55e768,'change:state',(_0xda5c19,_0x42736d,_0xc24faf)=>{_0x46d47e['isThreadsLoadingPaused']='connected'!==_0xc24faf;});}),this['listenTo'](_0x55e768,'change:state',(_0x552d9e,_0x406b9c,_0x6ef03c)=>{this['editor']['plugins']['get'](_0x2d3c83)['switchReadOnly']('connected'!==_0x6ef03c);}),_0x4b74b1['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x3497f6=this['editor']['plugins']['get'](ot),_0x2f37c0=this['editor']['config']['get']('collaboration.channelId');_0x3497f6['_services']['has'](_0x2f37c0)&&_0x3497f6['_terminateService'](_0x2f37c0),super['destroy']();}},ft=class extends _0x198537{static get requires(){return[ut,ht,_0x165a37];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x198537{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
- ((()=>_0x4f20e5)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0x22abf6,Y,_0x452795];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5a10a5){super(_0x5a10a5);const _0x2e54e9=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x2e54e9);}async init(){const _0x4614f4=this['editor']['plugins']['get'](tt),_0x543652=_0x4614f4['serverHistory'],_0x13e42f=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x543652,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x4614f4['sessionId']});const _0x16a722=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x6ba88b,_0x6e0204=await _0x360e87['isBundleUploaded'](_0x13e42f['connection'],_0x16a722);this['editor']['plugins']['get'](_0x22abf6)['adapter']={'getRevision':async({revisionId:_0x419925})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x419925)),'updateRevisions':async _0x13864f=>{await this['_waitForServiceReady']();const _0x411d94=this['_revisionTracker']['currentRevision'];if(_0x6e0204&&0x1===_0x13864f['length']&&_0x13864f[0x0]['id']===_0x411d94['id'])return _0x13864f;for(const _0x5c07ff of _0x13864f)_0x5c07ff['id']===_0x411d94['id']&&(_0x5c07ff['isEmptyCurrent']=_0x5c07ff['fromVersion']===_0x5c07ff['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x13864f,this['_lastRequestId'])['then'](_0x1f6b41=>(this['_lastRequestId']=_0x1f6b41,_0x13864f))['catch'](_0x20f70b=>{if(pt(_0x20f70b)||'400'===_0x20f70b['code']&&void 0x0!==_0x20f70b['data']['wrongRequestId']){for(const _0x1754e6 of _0x13864f)this['_revisionTracker']['repository']['getRevision'](_0x1754e6['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x1754e6['id'],_0x1754e6,!0x1);if(pt(_0x20f70b)&&'destroyed'!==this['editor']['state'])throw _0x20f70b;return _0x13864f;}throw _0x20f70b;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0xbcde78,{revisionsData:_0xbd4b20,requestId:_0x48710c})=>{Math['max'](..._0xbd4b20['map'](_0x4e7c63=>_0x4e7c63['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0xbd4b20,_0x48710c);}):this['_handleRevisionsUpdate'](_0xbd4b20,_0x48710c);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x13e42f['connection']?.['state']&&(_0x13e42f['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x38c9f6,requestId:_0x5104aa}=await this['_revisionHistoryService']['connect'](_0x13e42f['connection']);_0x13e42f['addToReconnectionStack'](this),this['_lastRequestId']=_0x5104aa,await this['_fetchMissingUsers'](_0x38c9f6);for(const _0x504f40 of _0x38c9f6)this['_revisionTracker']['addRevisionData'](_0x504f40);this['listenTo'](_0x4614f4,'change:_isConnected',(_0xa69f28,_0x459749,_0x587dd5)=>{_0x587dd5&&(this['_oldOffset']=_0x4614f4['_offset'],_0xa69f28['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x1ee30f=this['editor']['plugins']['get'](z),_0x3b8e7a=this['editor']['plugins']['get'](tt),_0x2d5613=async()=>{const _0x249e62=this['_revisionTracker']['currentRevision'],_0x4ff2c3=_0x249e62['id'],_0x41f9ae=_0x4ff2c3!==_0x3b8e7a['sessionId'];if(_0x41f9ae){const _0x163d27=_0x3b8e7a['_offset']-this['_oldOffset'],_0xc43df5=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x249e62['toVersion']+_0x163d27!==_0xc43df5){const _0x403ab0=_0x249e62['fromVersion']+_0x163d27,_0xb56998=this['editor']['plugins']['get'](_0x452795),_0x4595b2=this['_revisionTracker']['buildRevisionData']({'revision':_0x249e62,'from':_0x403ab0,'to':_0xc43df5});_0x4595b2['id']=_0x249e62['id'];const _0x300bcc=_0x4595b2['authorsIds']['map'](_0x59fd6c=>_0xb56998['getUser'](_0x59fd6c));_0x249e62['_update']({..._0x4595b2,'authors':_0x300bcc},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x249e62['id'],_0x4595b2,!0x0);}this['_revisionTracker']['_startingVersion']=_0xc43df5,_0x249e62['toVersion']!==_0x249e62['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x4ff2c3)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x4ff2c3),this['_revisionTracker']['_createCurrentRevision'](_0xc43df5);}const {revisions:_0x3136f2,requestId:_0x3c28df}=await this['_revisionHistoryService']['reconnect'](_0x1ee30f['connection'],this['_lastRequestId']);_0x41f9ae&&_0x3136f2['length']>0x0?_0x3b8e7a['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x3136f2),this['_handleRevisionsUpdate'](_0x3136f2,_0x3c28df),this['_revisionTracker']['sendBufferedUpdates']());};return _0x3b8e7a['_isConnected']?_0x2d5613():new Promise((_0x5a5134,_0x3fbcb9)=>{_0x3b8e7a['once']('change:_isConnected',()=>{_0x2d5613()['then'](_0x5a5134)['catch'](_0x3fbcb9);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x324f7a=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x276599=>{_0x276599['off'](),_0x324f7a();});});}_getLatestVersionFromServerOperations(){const _0x2fd075=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0x1f5a42 of _0x2fd075)if('marker'!==_0x1f5a42['type']||_0x1f5a42['affectsData'])return _0x1f5a42['baseVersion']+0x1;}_getLatestVersion(){const _0x21ea9e=this['editor']['plugins']['get'](tt);return new Promise(_0x29a28e=>{_0x21ea9e['_isPendingUpdate']?_0x21ea9e['once']('change:_isPendingUpdate',()=>{_0x29a28e(this['_getLatestVersionFromServerOperations']());}):_0x29a28e(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x2bf055,_0x3ddbea){const _0x5049db=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3ddbea;for(const _0x50f3ee of _0x2bf055){const _0x1b2b6b=_0x5049db['getRevision'](_0x50f3ee['id']);if(_0x1b2b6b){if((_0x50f3ee['fromVersion']||_0x50f3ee['toVersion'])&&(_0x50f3ee['diffData']=null),_0x1b2b6b===this['_revisionTracker']['currentRevision']){const _0x3f2669=Math['max'](_0x1b2b6b['toVersion'],_0x50f3ee['toVersion']),_0x3fd495=Math['max'](_0x1b2b6b['fromVersion'],_0x50f3ee['fromVersion']);let _0x56934f;_0x1b2b6b['toVersion']===_0x50f3ee['toVersion']&&_0x1b2b6b['fromVersion']===_0x50f3ee['fromVersion']?(_0x56934f=!0x0,this['_preventResendingRevisionData'](_0x50f3ee)):_0x50f3ee['toVersion']===_0x3f2669&&_0x50f3ee['fromVersion']===_0x3fd495?_0x56934f=!0x1:(_0x1b2b6b['toVersion']===_0x3f2669&&_0x1b2b6b['fromVersion']===_0x3fd495||this['_fixRevision']({'revision':_0x1b2b6b,'from':_0x3fd495,'to':_0x3f2669}),_0x56934f=!0x0),_0x56934f&&(delete _0x50f3ee['fromVersion'],delete _0x50f3ee['toVersion'],delete _0x50f3ee['diffData'],delete _0x50f3ee['createdAt'],delete _0x50f3ee['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x50f3ee),this['_preventResendingRevisionData'](_0x50f3ee);}else this['_revisionTracker']['addRevisionData'](_0x50f3ee);}const _0x370b62=_0x5049db['getRevisions']();_0x370b62['reverse']();for(let _0x50cf44=0x0;_0x50cf44<_0x370b62['length']-0x1;_0x50cf44++){const _0x4d2091=_0x370b62[_0x50cf44],_0x250569=_0x370b62[_0x50cf44+0x1];if(_0x4d2091['fromVersion']<_0x250569['toVersion']){const _0x1a6917=_0x250569['toVersion'],_0x3a6f5b=Math['max'](_0x1a6917,_0x4d2091['toVersion']);this['_fixRevision']({'revision':_0x4d2091,'from':_0x1a6917,'to':_0x3a6f5b});}}}['_fixRevision']({revision:_0x5b3aa4,from:_0x22a66a,to:_0xdfd202}={}){const _0x9b5529=this['editor']['plugins']['get'](_0x452795),_0x4916f0=this['_revisionTracker']['buildRevisionData']({'revision':_0x5b3aa4,'from':_0x22a66a,'to':_0xdfd202});_0x4916f0['authors']=_0x4916f0['authorsIds']['map'](_0xe2e261=>_0x9b5529['getUser'](_0xe2e261)),_0x5b3aa4['_update'](_0x4916f0);}_preventResendingRevisionData(_0x3bfd84){const _0xdcc12c={};_0xdcc12c['id']=_0x3bfd84['id'];for(const _0x4300ec of Object['keys'](_0x3bfd84))'id'!==_0x4300ec&&(_0xdcc12c[_0x4300ec]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0xdcc12c['id'],_0xdcc12c,!0x0);}async _fetchMissingUsers(_0x522c41){const _0x32d6f6=this['editor']['plugins']['get'](_0x452795),{connection:_0x505569}=this['editor']['plugins']['get'](z),_0x3e3885=new Set();for(const _0x52991f of _0x522c41){for(const _0x3a955a of _0x52991f['authorsIds'])_0x56ad91(_0x3a955a);_0x52991f['creatorId']&&_0x56ad91(_0x52991f['creatorId']);}if(0x0===_0x3e3885['size'])return;const _0x71ee40=await _0xfaa43['getMany'](_0x505569,Array['from'](_0x3e3885));for(const _0x1476f3 of _0x71ee40)_0x32d6f6['getUser'](_0x1476f3['id'])||_0x32d6f6['addUser'](_0x1476f3);function _0x56ad91(_0x14ae86){_0x32d6f6['getUser'](_0x14ae86)||_0x3e3885['add'](_0x14ae86);}}};function pt(_0x104c27){return _0x104c27['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x104c27['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x104c27['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x198537{static get requires(){return[_0x22abf6,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x3c9057{_collapseAt;constructor(_0x3c83f2,_0x25257a=0x6){super(_0x3c83f2);const _0x5bb02c=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x25257a,this['bind']('isHidden')['to'](this,'usersCount',_0x592e3b=>_0x592e3b<_0x25257a),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x5bb02c['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':_0x5bb02c['to']('usersCount',_0x4efed2=>'+'+(_0x4efed2-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x3c9057{items;keystrokes;constructor(_0x31b40f){super(_0x31b40f);const _0x599f82=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x2be03b(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x599f82['if']('hasPopup'),'aria-expanded':_0x599f82['to']('isExpanded',_0x2bf298=>this['hasPopup']&&String(_0x2bf298)),'aria-label':_0x599f82['to']('hasPopup',_0x266109=>X(_0x31b40f,_0x266109?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x599f82['to']('hasPopup',_0x3c6ba2=>!!_0x3c6ba2&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x599f82['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x599f82['to'](_0x51762a=>{const _0x7fefab=_0x51762a,_0xe69af4=document['querySelector']('.ck-presence-list__dropdown-list'),_0x17be96=document['querySelector']('.ck-balloon-panel_with-arrow');_0xe69af4?.['contains'](_0x7fefab['relatedTarget'])||_0x17be96?.['contains'](_0x7fefab['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x4ffb48,_0x3dd177,_0xb380fa)=>{this['element']&&(_0xb380fa?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},_t=class extends _0x3c9057{counterView;inlineListView;constructor(_0x54c444,_0x22311e=0x6){super(_0x54c444);const _0x180265=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x22311e),this['inlineListView']=new vt(_0x54c444),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x4cb357 of this['inlineListView']['items'])_0x4cb357['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',_0x180265['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x3c9057{listWrapperView;constructor(_0x83227a,_0x2447b1){super(_0x83227a);const _0x144a88=this['bindTemplate'];this['listWrapperView']=new bt(_0x83227a,_0x2447b1),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x83227a,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x144a88['to'](_0x51cce9=>{const _0x4d5992=_0x51cce9,_0x3549ea=document['querySelector']('.ck-presence-list__list'),_0x2292ad=document['querySelector']('.ck-balloon-panel_with-arrow');_0x3549ea?.['contains'](_0x4d5992['relatedTarget'])||_0x2292ad?.['contains'](_0x4d5992['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x3bbda9{constructor(_0x5da2d3,_0x8d9a96){super(_0x5da2d3);const _0x2d01b9=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x8d9a96?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2d01b9['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2d01b9['to']('role'),'aria-label':_0x2d01b9['to']('ariaLabel'),'aria-labelledby':_0x2d01b9['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x1a9e1f['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0xb76255=this['element'];_0xb76255&&(this['_isScrollable']=Math['max'](_0xb76255['scrollHeight'],_0xb76255['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x216f28{['userView'];constructor(_0x388419,_0x4fad95,_0x395328){super(_0x388419);const _0x180a1f=this['bindTemplate'];this['userView']=new _0x484af1(_0x388419,_0x4fad95);const _0x2c55ab={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x4fad95['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x4fad95['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4fad95['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x4fad95['color']['getColorVariable'](),'--ck-user-color-alpha':_0x4fad95['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x395328&&(_0x2c55ab['tag']='button',_0x2c55ab['on']={'click':_0x180a1f['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2c55ab);}['focus'](){this['element']['focus']();}},It=class extends _0x3c9057{['userView'];['markerView'];constructor(_0x398d46,_0x313367,_0x471d6d){super(_0x398d46);const _0x5bb0a4=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x484af1(_0x398d46,_0x313367),this['markerView']=new St(_0x398d46,_0x313367);const _0x204f06=new _0x305df9(_0x398d46);_0x204f06['template']['tag']='span',_0x204f06['text']=_0x313367['name'];const _0x4707b9={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x5bb0a4['to']('isFocusable',_0x2a4da3=>!!_0x2a4da3&&0x0),'aria-labelledby':_0x204f06['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x5bb0a4['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x5bb0a4['to']('hasTooltip',_0xcc1a5f=>!_0xcc1a5f),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x204f06]};_0x471d6d&&(_0x4707b9['tag']='button',_0x4707b9['on']={'click':_0x5bb0a4['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4707b9);}},St=class extends _0x3c9057{constructor(_0x4402bf,_0x585ef0){super(_0x4402bf),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x585ef0['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x585ef0['color']['getColorVariable'](),'--ck-user-color-alpha':_0x585ef0['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x1b8d8d{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3e616e){super(_0x3e616e),this['context']['config']['define']('presenceList',Tt);const _0x50223f=_0x3e616e['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x50223f)throw new _0x470142('presencelist-collapseat-invalid-format',this);if(_0x50223f<0x1)throw new _0x470142('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x19921a(),this['balloonPanelView']=new _0x5157c9(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x25b926 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x25b926);this['listenTo'](this['_allConnectedUsers'],'add',(_0x36a2f4,_0x31c5a1)=>{this['_handleUserAdd'](_0x31c5a1);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x5a4c28,_0xa60737)=>{this['_handleUserRemove'](_0xa60737);});}_createView(){const _0x5acfcd=this['context'],_0x3cb595=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x2723ed=this['balloonPanelView'];if(!_0x4afda6(_0x5acfcd['config']['get']('presenceList.container')))throw new _0x470142('presencelist-missing-container',this);return _0x3cb595['counterView']['bind']('usersCount')['to'](this),_0x3cb595['bind']('isCollapsed')['to'](this,'usersCount',_0x208219=>{const {collapseAt:_0x2db2f5}=_0x5acfcd['config']['get']('presenceList'),_0x5489e8=_0x208219>=_0x2db2f5;if(_0x5489e8&&!_0x3cb595['inlineListView']['items']['find'](_0x32ed4f=>_0x32ed4f instanceof wt)){const _0x39d36b=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x39d36b&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x3cb595['inlineListView']['items']['add'](_0x3cb595['counterView']);}return _0x5489e8||this['hideDropdown'](),_0x5489e8;}),_0x3cb595['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x4fff1d=>{const _0x141dc2=_0x5acfcd['config']['get']('presenceList'),_0x129695=new It(_0x5acfcd['locale'],_0x4fff1d,!!_0x141dc2['onClick']);return _0x129695['bind']('hasTooltip')['to'](_0x3cb595,'isCollapsed',_0x147663=>!_0x147663),_0x129695['bind']('isFocusable')['to'](_0x3cb595,'isCollapsed',_0x195fca=>!_0x195fca),_0x141dc2['onClick']&&this['listenTo'](_0x129695,'execute',()=>{this['view']['isCollapsed']||_0x141dc2['onClick'](_0x4fff1d,_0x129695['element']);}),_0x129695;}),this['listenTo'](_0x3cb595['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x3cb595['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x3cb595['inlineListView']['keystrokes']['set']('Enter',(_0x56c8ef,_0x25fee7)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x25fee7());}),_0x3cb595['render'](),_0x2723ed['render'](),_0x258569({'emitter':_0x3cb595,'activator':()=>_0x2723ed['isVisible'],'contextElements':[_0x2723ed['element'],_0x3cb595['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x5acfcd['config']['get']('presenceList.container')['appendChild'](_0x3cb595['element']),this['_bodyCollection']=new _0x5cfc09(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x3cb595;}['_handleUserAdd'](_0x45caef){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x45caef['isMe'])return;const _0x379b6f=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x379b6f-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x5e01f5=_0x45caef['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x45caef,_0x5e01f5);}['_handleUserRemove'](_0x44284d){this['usersCount']--;const {collapseAt:_0x149f1f}=this['context']['config']['get']('presenceList'),_0x54d3ed=this['usersCount']>=_0x149f1f;if(this['currentDisplayedUsers']['get'](_0x44284d['id']))this['currentDisplayedUsers']['remove'](_0x44284d['id']);else{if(_0x54d3ed&&this['currentDisplayedUsers']['length']+0x1===_0x149f1f-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x54d3ed?0x1:0x0)<this['usersCount']){for(const _0x2dee28 of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x2dee28['id'])&&(this['currentDisplayedUsers']['add'](_0x2dee28,Math['min'](this['currentDisplayedUsers']['length']-(_0x54d3ed?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x54d3ed?0x1:0x0)===_0x149f1f-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x1e746c=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x1e746c['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x58b7ca}=this['presenceDropdownView'];_0x58b7ca['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x4f7049=>{if(!_0x1e746c['displayMe']&&_0x4f7049['isMe'])return null;const _0x3ccd6c=new kt(this['context']['locale'],_0x4f7049,!!_0x1e746c['onClick']);return _0x1e746c['onClick']&&this['listenTo'](_0x3ccd6c,'execute',()=>{_0x1e746c['onClick'](_0x4f7049,_0x3ccd6c['element']);}),_0x3ccd6c;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x58b7ca['focus'](),_0x58b7ca['checkIfScrollable']();const _0x2f800d=(_0x78914c,_0x14f5ba)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x14f5ba();};_0x58b7ca['keystrokes']['set']('Esc',_0x2f800d),_0x58b7ca['keystrokes']['set']('Shift+Tab',_0x2f800d),_0x58b7ca['keystrokes']['set']('Tab',(_0x2e55ff,_0x53bf63)=>{!function(_0x5bc260){const _0x52df99=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x9381cf=>_0x9381cf+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0xd4d14d=[...document['body']['querySelectorAll'](_0x52df99)]['filter'](_0x223227=>_0x223227===document['activeElement']||_0x223227['offsetWidth']+_0x223227['offsetHeight']>0x0)['sort']((_0x506900,_0x45378f)=>(_0x506900['tabIndex']||0x0)-(_0x45378f['tabIndex']||0x0)),_0xbf4f10=_0xd4d14d[(_0xd4d14d['indexOf'](_0x5bc260)+0x1)%_0xd4d14d['length']];_0xbf4f10&&_0xbf4f10['focus']();}(this['view']['element']),this['hideDropdown'](),_0x53bf63();}),_0x58b7ca['focusTracker']['add'](this['view']['element']),_0x58b7ca['focusTracker']['on']('change:isFocused',(_0x2d174d,_0x3d1387,_0x48d6e4)=>{_0x48d6e4||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}},At=class extends _0x1b8d8d{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};
23
+ import{Context as _0x855411,ContextPlugin as _0x11ffbd,PendingActions as _0x472682,Plugin as _0x2e5ad8}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x30c218,Collection as _0x5b4d4a,DomEmitterMixin as _0x173edc,KeystrokeHandler as _0x4d6505,global as _0x427e20,uid as _0x5a42e3,version as _0x85d46}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x2199bb,BodyCollection as _0x4262b2,LabelView as _0x22b7f8,ListItemView as _0x536567,ListView as _0x4d8a9f,Notification as _0x3261b0,View as _0x654501,clickOutsideHandler as _0x3b3d4f}from'@ckeditor/ckeditor5-ui';import{History as _0x5c4e54,InsertOperation as _0x4b34d3,MarkerOperation as _0x41e66f,ModelLiveRange as _0x3805a3,NoOperation as _0x459d94,OperationFactory as _0x30ba1f,RootAttributeOperation as _0x4a4045,transformOperationSets as _0x3000cc}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x15db02}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x125b8b,CommentsService as _0x2adcb2,EditorService as _0x2f65d1,RevisionHistoryService as _0x4ace97,TrackChangesService as _0x3f43ee,User as _0x2d27a3,WEB_SOCKET_GATEWAY_STATES as _0x36a3fe,WebSocketGateway as _0x5d6b32}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x441670,Users as _0x1633f9}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x13b0c0}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x4b8fa6,TrackChangesEditing as _0x5ce213}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x54b47c,CommentsEditing as _0x244bb0,CommentsRepository as _0x63208d}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0xcbaa40}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0xc8a0f4}from'es-toolkit/compat';var z=class WebSocketGateway extends _0x11ffbd{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
+ ((()=>_0x5d6b32)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x15db02,_0x3261b0];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x3e0e06){super(_0x3e0e06),this['set']('state',_0x36a3fe['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x173edc())();}init(){const _0x3ac49e=this['context'],_0x2bcf38=_0x3ac49e['plugins']['get'](_0x15db02),_0x29498f=_0x3ac49e['plugins']['get'](_0x3261b0);if(!_0x2bcf38['token'])throw new _0x30c218('websocketgateway-missing-token',this);if(!_0x2bcf38['webSocketUrl'])throw new _0x30c218('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'](_0x2bcf38['token'],_0x2bcf38['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x4113a1=>{if(this['connection']=_0x4113a1,this['bind']('state')['to'](_0x4113a1,'state',this,'_isBrowserOffline',(_0x8e57f4,_0x38b261)=>('connected'!==_0x8e57f4&&(this['_shouldPluginsReconnect']=!0x0),_0x38b261||_0x8e57f4!==_0x36a3fe['CONNECTED']?_0x36a3fe['DISCONNECTED']:this['state']==_0x36a3fe['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x36a3fe['CONNECTING']):_0x36a3fe['CONNECTED'])),this['connection']['on']('error',(_0x9cda99,_0x49d696)=>{if('limitExceeded'!==_0x49d696['code'])throw console['error'](_0x49d696),new _0x30c218('cloudservices-init',null,{'originalError':_0x49d696});_0x29498f['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'});}),!_0x4113a1['me'])return new Promise(_0x1e5f0a=>_0x4113a1['on']('change:me',_0x1e5f0a));})['catch'](_0x66d9d8=>{throw console['error'](_0x66d9d8),new _0x30c218('cloudservices-init',null,{'originalError':_0x66d9d8});});}addToReconnectionStack(_0x140ff0){if('function'!=typeof _0x140ff0['reconnect'])throw new _0x30c218('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x140ff0))throw new _0x30c218('websocketgateway-plugin-already-registered',this,{'name':_0x140ff0['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x140ff0);}removeFromReconnectionStack(_0x5290d9){this['_reconnectionStack']['delete'](_0x5290d9);}isInReconnectionStack(_0x39ca21){return this['_reconnectionStack']['has'](_0x39ca21);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x3f78be=>_0x3f78be['reconnect']())))['then'](()=>this['state']=_0x36a3fe['CONNECTED'])['catch'](_0x5bf84f=>{throw console['error'](_0x5bf84f),new _0x30c218('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x36a3fe['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Y=class extends _0x11ffbd{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[z,_0x1633f9];}constructor(_0x1fa7c6){super(_0x1fa7c6),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x5b4d4a(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x1633f9);}init(){const _0x4a98ca=this['context']['plugins']['get'](z);this['listenTo'](_0x4a98ca,'change:state',(_0x1b7441,_0x12b0ce,_0x3a0a1f)=>{if('connected'!==_0x3a0a1f)this['channelSessions']['forEach'](_0x49f03e=>_0x49f03e['clear']()),this['channelConnectedUsers']['forEach'](_0x18bcba=>_0x18bcba['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x2e88b0,_0x3161ee]of this['_registeredSessions'])for(const _0x45598e of _0x3161ee)this['_handleSessionAdd'](_0x2e88b0,_0x45598e);}}),this['_createUser'](_0x4a98ca['connection']['me'],!0x0);}register(_0x2036d4,_0x33d52d){if(this['_registeredSessions']['has'](_0x2036d4))throw new _0x30c218('sessions-register-already-registered',null,{'channelId':_0x2036d4});this['_registeredSessions']['set'](_0x2036d4,_0x33d52d),this['channelSessions']['set'](_0x2036d4,new _0x5b4d4a()),this['channelConnectedUsers']['set'](_0x2036d4,new _0x5b4d4a()),this['listenTo'](_0x33d52d,'add',(_0x18ea25,_0x4236b9)=>this['_handleSessionAdd'](_0x2036d4,_0x4236b9)),this['listenTo'](_0x33d52d,'remove',(_0x261145,_0x5bd87b)=>this['_handleSessionRemove'](_0x2036d4,_0x5bd87b));for(const _0x1c013f of _0x33d52d)this['_handleSessionAdd'](_0x2036d4,_0x1c013f);}unregister(_0x1eccd8){if(!this['_registeredSessions']['has'](_0x1eccd8))throw new _0x30c218('sessions-unregister-not-exist',null,{'channelId':_0x1eccd8});const _0x154ab3=this['_registeredSessions']['get'](_0x1eccd8);this['stopListening'](_0x154ab3);for(const _0x32a41d of _0x154ab3)'connected'===this['context']['plugins']['get'](z)['state']&&this['_handleSessionRemove'](_0x1eccd8,_0x32a41d);this['_registeredSessions']['delete'](_0x1eccd8),this['channelSessions']['delete'](_0x1eccd8),this['channelConnectedUsers']['delete'](_0x1eccd8);}get['mySessionId'](){return this['context']['plugins']['get'](z)['connection']['sessionId'];}getUserBySessionId(_0x359ef5){for(const _0x4f36d9 of this['channelSessions']['values']())for(const _0x5d3623 of _0x4f36d9)if(_0x5d3623['id']===_0x359ef5)return _0x5d3623['user'];}getUserSessions(_0x202c5f,_0x330b65){const _0x5b9149=_0x330b65?[this['channelSessions']['get'](_0x330b65)]:this['channelSessions']['values'](),_0xb60691=new Set();for(const _0x585ded of _0x5b9149)for(const _0x4520af of _0x585ded)_0x4520af['user']['id']===_0x202c5f['id']&&_0xb60691['add'](_0x4520af['id']);return _0xb60691;}getUserRole(_0x5a4fd3){for(const _0x38f575 of this['channelSessions']['values']())for(const _0x575b51 of _0x38f575)if(_0x575b51['user']===_0x5a4fd3)return _0x575b51['role'];}['_handleSessionAdd'](_0x3865fa,_0x5a8b02){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x17621b=_0x5a8b02['user'],_0x3f3f92=this['_users']['getUser'](_0x17621b['id'])||this['_createUser'](_0x17621b),_0x146426=Object['assign']({},_0x5a8b02,{'user':_0x3f3f92});if(this['channelSessions']['get'](_0x3865fa)['add'](_0x146426),!_0x17621b['hiddenInPresenceList']){const _0x492004=this['channelConnectedUsers']['get'](_0x3865fa);_0x492004['has'](_0x3f3f92['id'])||_0x492004['add'](_0x3f3f92),this['allConnectedUsers']['has'](_0x3f3f92['id'])||_0x17621b['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x3f3f92,_0x3f3f92['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x3865fa,{'channelId':_0x3865fa,'session':_0x146426});}['_handleSessionRemove'](_0x57bccd,_0x585fa5){if('connected'!==this['context']['plugins']['get'](z)['state'])return;const _0x34b2f8=this['channelConnectedUsers']['get'](_0x57bccd),_0x257f3d=_0x585fa5['user'];_0x257f3d['id']&&(this['channelSessions']['get'](_0x57bccd)['remove'](_0x585fa5['id']),_0x34b2f8['has'](_0x257f3d['id'])&&!this['getUserSessions'](_0x257f3d,_0x57bccd)['size']&&_0x34b2f8['remove'](_0x257f3d['id']),this['allConnectedUsers']['get'](_0x257f3d['id'])&&!this['getUserSessions'](_0x257f3d)['size']&&this['allConnectedUsers']['remove'](_0x257f3d['id']));}_createUser(_0x39a45c,_0x3c7589){const _0x193903=this['_users']['addUser'](_0x39a45c);return _0x3c7589&&this['_users']['defineMe'](_0x39a45c['id']),_0x193903['orderNumber']=this['_uniqueUsersCount']++,_0x193903;}},K=class extends _0x2e5ad8{_domEmitter=new(_0x173edc())();static get requires(){return[Y];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x38e826=this['editor'],_0x3bc07f=_0x38e826['plugins']['get'](Y);_0x38e826['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x348bd2,{writer:_0x10b455})=>function(_0x2af3cf,_0x4ccb13,_0x2efcc3,_0x52b4f0){const _0x13003e=_0x2af3cf['markerName']['split'](':')[0x2],_0x13faf5=_0x2efcc3['getUserBySessionId'](_0x13003e);if(!_0x13faf5||_0x13003e===_0x2efcc3['mySessionId'])return;if(!_0x52b4f0['model']['schema']['checkChild'](_0x2af3cf['markerRange']['start'],'$text'))return;const _0x36adeb={'class':'ck-user__marker\x20'+_0x13faf5['color']['getMarkerClass'](),'style':Q(_0x13faf5),'data-name':_0x13faf5['name'],'data-session-id':_0x13003e},_0x5cf0fa=_0x52b4f0['model']['markers']['get'](_0x2af3cf['markerName'])['getStart'](),_0x5ea8ac=_0x5cf0fa['nodeAfter'],_0x5af623=_0x52b4f0['model']['schema'];if(_0x5ea8ac&&_0x5af623['isObject'](_0x5ea8ac)&&_0x5af623['isInline'](_0x5ea8ac)&&!_0x52b4f0['model']['markers']['get']('user:range:'+_0x13003e)['getRange']()['isCollapsed'])return;const _0x1d5773=_0x5cf0fa['parent'];return _0x52b4f0['model']['schema']['isLimit'](_0x1d5773)&&!_0x52b4f0['model']['hasContent'](_0x1d5773)&&(_0x36adeb['contenteditable']=!0x1),function(_0x38b092,_0x3c93f8,_0x22aae0){const _0x4e03a6=_0x38b092['createUIElement']('span',_0x3c93f8);return _0x38b092['setCustomProperty']('userPositionMarker',!0x0,_0x4e03a6),_0x4e03a6['render']=function(_0x5baad3){const _0x42f70b=this['toDomElement'](_0x5baad3),_0x39cf11=document['createElement']('span');return _0x39cf11['classList']['add']('ck-user__marker-tooltip'),_0x39cf11['setAttribute']('contenteditable','false'),_0x39cf11['setAttribute']('spellcheck','false'),_0x39cf11['textContent']=_0x22aae0['name'],_0x42f70b['innerHTML']='⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x39cf11['outerHTML']+'⁠',_0x42f70b['addEventListener']('mouseenter',()=>{_0x42f70b['classList']['add']('ck-user__marker_hovered');}),_0x42f70b['addEventListener']('mouseleave',()=>{_0x42f70b['classList']['remove']('ck-user__marker_hovered');}),_0x42f70b;},_0x4e03a6['isSimilar']=function(_0x16bbc3){return!(!this['getCustomProperty']('userPositionMarker')||!_0x16bbc3['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x16bbc3['getAttribute']('data-session-id'));},_0x4e03a6;}(_0x4ccb13,_0x36adeb,_0x13faf5);}(_0x348bd2,_0x10b455,_0x3bc07f,_0x38e826)}),_0x38e826['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x4e8cb2=>function(_0x3e0ae4,_0x4f4e8f){const _0x3b0d8c=_0x3e0ae4['markerName']['split'](':')[0x2];if(_0x3b0d8c===_0x4f4e8f['mySessionId'])return null;const _0x22513e=_0x4f4e8f['getUserBySessionId'](_0x3b0d8c);return _0x22513e?{'id':_0x3b0d8c,'classes':['ck-user__selection',_0x22513e['color']['getSelectionClass']()],'attributes':{'style':Q(_0x22513e),'data-session-id':_0x3b0d8c},'priority':0x7d0+_0x22513e['orderNumber']}:{'id':_0x3b0d8c,'classes':[]};}(_0x4e8cb2,_0x3bc07f)}),function(_0x23dcf4){const _0x5aeb61=_0x23dcf4['model'],_0x45803d=new Map(),_0x4e8fda=_0x23dcf4['plugins']['get'](Y);_0x5aeb61['markers']['on']('update:user:range',(_0x5f20f1,_0x25f475,_0x5a0fa1,_0x20df09)=>{if(!_0x20df09&&_0x45803d['get'](_0x25f475['name']))return _0x45803d['get'](_0x25f475['name'])['detach'](),void _0x45803d['delete'](_0x25f475['name']);const _0x2fbeb6=_0x25f475['name']['split'](':')[0x2];if(_0x2fbeb6===_0x4e8fda['mySessionId'])return;const _0x200d26='user:position:'+_0x2fbeb6;_0x5aeb61['markers']['has'](_0x200d26)&&_0x23dcf4['editing']['reconvertMarker'](_0x200d26),_0x25f475['on']('change:range',(_0x2338e6,_0x11ed47,_0x167506)=>{if('$graveyard'!=_0x11ed47['root']['rootName']&&'$graveyard'==_0x25f475['getRange']()['root']['rootName']&&!_0x45803d['has'](_0x25f475['name'])){const _0x393bf2=_0x5aeb61['schema']['getNearestSelectionRange'](_0x167506['deletionPosition']);if(_0x393bf2){const _0x1edbca=_0x3805a3['fromRange'](_0x393bf2);_0x45803d['set'](_0x25f475['name'],_0x1edbca),_0x1edbca['on']('change:range',(_0x4d5094,_0x295b6c,_0x495e79)=>{if('$graveyard'==_0x1edbca['root']['rootName']){const _0x475e00=_0x5aeb61['schema']['getNearestSelectionRange'](_0x495e79['deletionPosition']);_0x475e00?(_0x1edbca['start']=_0x475e00['start'],_0x1edbca['end']=_0x475e00['end']):(_0x45803d['delete'](_0x25f475['name']),_0x1edbca['detach']());}});}}});}),_0x5aeb61['document']['on']('change',()=>{_0x45803d['size']>0x0&&_0x5aeb61['enqueueChange']({'isUndoable':!0x1},_0x46c42c=>{for(const [_0x5ac5b6,_0xe8d638]of _0x45803d)'$graveyard'==_0x5aeb61['markers']['get'](_0x5ac5b6)['getRange']()['root']['rootName']&&(J(_0x5ac5b6['split'](':')[0x2],_0xe8d638['toRange'](),_0x5aeb61,_0x46c42c),_0xe8d638['detach']());_0x45803d['clear']();});});}(_0x38e826),this['_domEmitter']['listenTo'](_0x427e20['document'],'keydown',(_0x18ecc9,{key:_0x56a2ed})=>{'Escape'===_0x56a2ed&&function(_0x4664cd){_0x4664cd['editing']['view']['change'](_0x389cad=>{for(const _0x4dec96 of _0x4664cd['model']['markers']){if(!_0x4dec96['name']['startsWith']('user:position'))continue;const _0x1d5830=_0x4664cd['editing']['mapper']['markerNameToElements'](_0x4dec96['name']);if(_0x1d5830){for(const _0x276f11 of _0x1d5830)_0x389cad['removeClass']('ck-user__marker_hovered',_0x276f11);}}});}(_0x38e826);},{'useCapture':!0x0});}afterInit(){const _0x162a91=this['editor'],_0x5cc658=_0x162a91['commands']['get']('undo');_0x5cc658&&_0x162a91['model']['on']('applyOperation',(_0x31528f,_0x5c9e3f)=>{const _0x159f94=_0x5c9e3f[0x0];if(!_0x159f94['isDocumentOperation'])return;if('marker'!=_0x159f94['type']||!_0x159f94['name']['startsWith']('user:'))return;const _0x225618=_0x159f94['batch'];_0x5cc658['_createdBatches']['has'](_0x225618)&&(_0x159f94['newRange']=_0x159f94['oldRange']?_0x162a91['model']['createRange'](_0x159f94['oldRange']['start'],_0x159f94['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x460aa7=this['editor'],_0x7a76f7=_0x460aa7['model']['document'],_0x3c9b20=_0x460aa7['plugins']['get'](Y);_0x460aa7['model']['enqueueChange']({'isUndoable':!0x1},_0x89991d=>{const _0xe0bd4a='user:range:'+_0x3c9b20['mySessionId'],_0x89e3e4='user:position:'+_0x3c9b20['mySessionId'],_0x52788e=_0x460aa7['model']['markers']['has'](_0xe0bd4a);_0x460aa7['editing']['view']['hasDomSelection']?J(_0x3c9b20['mySessionId'],_0x7a76f7['selection']['getFirstRange'](),_0x460aa7['model'],_0x89991d):_0x52788e&&(_0x89991d['removeMarker'](_0xe0bd4a),_0x89991d['removeMarker'](_0x89e3e4));});}};function J(_0x42578f,_0xaa142,_0x39bd33,_0x23d9be){const _0x41ee94='user:range:'+_0x42578f,_0x52e91c='user:position:'+_0x42578f,_0x17f119=_0xaa142['getContainedElement']();let _0x47bb1a=_0xaa142['start'];if(_0x17f119&&_0x17f119['is']('element','tableCell')){const _0x2bf778=function(_0x3338df,_0x1c03ec){for(const _0x39f00f of _0x3338df['getPositions']())if(_0x1c03ec['schema']['checkChild'](_0x39f00f,'$text'))return _0x39f00f;}(_0xaa142,_0x39bd33);_0x2bf778&&(_0x47bb1a=_0x2bf778,_0xaa142=_0x23d9be['createRange'](_0x47bb1a));}const _0x3592f5=_0x23d9be['createRange'](_0x47bb1a);_0x39bd33['markers']['has'](_0x41ee94)?(_0x23d9be['updateMarker'](_0x41ee94,{'range':_0xaa142}),_0x23d9be['updateMarker'](_0x52e91c,{'range':_0x3592f5})):(_0x23d9be['addMarker'](_0x41ee94,{'range':_0xaa142,'usingOperation':!0x0}),_0x23d9be['addMarker'](_0x52e91c,{'range':_0x3592f5,'usingOperation':!0x0}));}function Q(_0x59de58){return'--ck-user-color:'+_0x59de58['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x59de58['color']['getColorAlphaVariable']()+';';}function X(_0x161226,_0x38d76d,_0xf9964b){const _0x20e508=_0x161226['t'],t=_0x161226['t'];switch(_0x38d76d){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 _0x20e508({'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'},_0xf9964b);default:return'';}}let Z=0x1;var tt=class RealTimeCollaborationClient extends _0x2e5ad8{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x125b8b)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[z,Y,K,_0x472682,_0x1633f9,_0x3261b0];}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 _0x17371e=this['serverHistory']['getOperations']();for(let _0x3c1128=_0x17371e['length']-0x1;_0x3c1128>=0x0;_0x3c1128--){const _0x562bf8=_0x17371e[_0x3c1128];if(!this['_disconnectionOperations']['has'](_0x562bf8))return _0x562bf8['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x6e1b60){if(super(_0x6e1b60),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x5c4e54(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x30c218('collaboration-missing-channelid',this);const _0x1f0cf0=_0x6e1b60['config']['get']('cloudServices.bundleVersion')||_0x85d46;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x1f0cf0,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x13b0c0(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new it(this['_disconnectionOperations']);}init(){const _0x388f93=this['editor'],_0x21e98a=_0x388f93['plugins']['get'](_0x1633f9),_0x37cafd=_0x388f93['plugins']['get'](z);this['listenTo'](_0x21e98a,'getOperationAuthor',(_0x201436,_0x3c1716)=>{const _0xfcddb9=_0x3c1716[0x0];_0xfcddb9['_authorId']&&(_0x201436['return']=_0x21e98a['getUser'](_0xfcddb9['_authorId']),_0x201436['stop']()),null===_0xfcddb9['_authorId']&&(_0x201436['return']=null,_0x201436['stop']());},{'priority':'high'}),this['listenTo'](_0x388f93['model']['document']['selection'],'change:range',(_0x48ef84,_0x59bf05)=>{_0x59bf05['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x388f93['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x388f93['model']['on']('applyOperation',(_0x178336,_0x4bc94a)=>{const _0x1bccc9=_0x4bc94a[0x0];_0x1bccc9['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x1bccc9),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x37cafd,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x4d0b5e,_0x5f05fa,_0x23916c)=>'connected'===_0x4d0b5e&&!_0x5f05fa&&!_0x23916c),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x388f93['disableReadOnlyMode']('rtc-offline'):_0x388f93['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x388f93['disableReadOnlyMode']('rtc-offline'):_0x388f93['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x4a6f51=this['editor']['plugins']['get'](Y),_0x56a2c8=this['editor']['plugins']['get'](z);try{this['_isPendingUpdate']=!0x0,_0x4a6f51['unregister'](this['_channelId']);const _0x37bdf3=await this['_service']['reconnect'](_0x56a2c8['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x37bdf3)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x9320b9=await this['_service']['getConnectedSessions']();_0x4a6f51['register'](this['_channelId'],_0x9320b9),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x4e0569){if(function(_0x5785e3){return'404'===_0x5785e3['code'];}(_0x4e0569)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x2342d1){return'409'===_0x2342d1['code'];}(_0x4e0569)){const _0x5f25ba=X(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x5f25ba);}else{if(!(_0x4e0569 instanceof et))throw _0x4e0569;this['_handleReconnectionError']();}}}}destroy(){const _0x679ab6=this['editor']['plugins']['get'](z),_0x52c996=this['editor']['plugins']['get'](Y);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x52c996['channelSessions']['has'](this['_channelId'])&&_0x52c996['unregister'](this['_channelId']),_0x679ab6['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x1e76a6){if(this['sessionId']!==_0x1e76a6['sessionId']&&this['_lastSyncedOperationId']!==_0x1e76a6['lastOperationId'])throw new et();return this['sessionId']=_0x1e76a6['sessionId'],this['_handleServerResponse']([],{..._0x1e76a6,'wereChangesApplied':!0x1,'data':_0x1e76a6['data']},'reconnect');}async _connectService(_0x387bf3,_0x35a71a=!0x1){const {connection:_0x12aeb4}=this['editor']['plugins']['get'](z);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x12aeb4,this['_channelId'])['then'](_0x2106fc=>this['_initSessionsHandling'](_0x2106fc))['catch'](_0x5e2759=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x5e2759);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x2dc5d8,_0x53b0c6)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x53b0c6);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x34d8ab=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x387bf3);this['_isPendingUpdate']=!0x0;const _0x5e76cf=await this['_service']['connect'](_0x12aeb4,this['_compressOperations'](_0x387bf3),_0x34d8ab);if(this['sessionId']=_0x5e76cf['sessionId'],_0x35a71a){if(!_0x5e76cf['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x5e76cf['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x387bf3,_0x5e76cf,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x5e76cf,_0x387bf3);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x1ab2af=this['editor']['plugins']['get'](Y),_0x911151=this['editor']['plugins']['get'](K),_0x4283ec=_0x1ab2af['channelSessions']['get'](this['_channelId']);_0x4283ec&&_0x4283ec['length']>0x1?_0x911151['createUserMarkerOperations']():this['listenTo'](_0x1ab2af,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x1ab2af['channelSessions']['get'](this['_channelId'])['length']&&_0x911151['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x2d9167,_0x572141,_0x5630e4,_0x31efa8){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x572141){const _0x471d07=this['_decompressOperations'](_0x5630e4,_0x31efa8);await this['_fetchMissingUsers'](_0x471d07),this['_handleExternalOperations'](_0x471d07,_0x572141,_0x5630e4['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x329db0}=this['editor'];let _0x589d1c;try{_0x589d1c=await this['_service']['getDocumentDetails']();}catch{const _0x3f1969=X(_0x329db0,'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'](_0x3f1969);}const _0x346da1=_0x589d1c['currentDocumentSession']||_0x589d1c['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x346da1['lastOperationId']){const _0x1f1138=X(_0x329db0,'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'](_0x1f1138);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x4f4d97=this['editor']['plugins']['get'](z);if(this['_isConnected']=!0x1,!_0x4f4d97['connection']||'connected'!==_0x4f4d97['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x468130=this['editor']['plugins']['get'](Y);_0x468130['channelSessions']['has'](this['_channelId'])&&_0x468130['unregister'](this['_channelId']),_0x4f4d97['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x955fdb){const _0x1a742d=this['editor']['plugins']['get'](Y);this['listenTo'](_0x1a742d,'sessionAdd:'+this['_channelId'],(_0x380a03,{session:_0x36d8d0})=>{if(_0x36d8d0['id']===_0x1a742d['mySessionId']){_0x380a03['off']();const _0x546a60=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x41746e=_0x36d8d0['permissions'];_0x546a60&&_0x546a60['isEnabled']&&(_0x41746e=_0x41746e['filter'](_0x2d0e71=>'document:write'!==_0x2d0e71)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x41746e,this['_channelId']);}}),_0x1a742d['register'](this['_channelId'],_0x955fdb);}_initThrowingOnDataSet(){const _0x459779=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x35954c)=>{if(!_0x35954c[_0x35954c['length']-0x1]['suppressErrorInCollaboration'])throw new _0x30c218('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x459779['apply'](this['editor']['data'],_0x35954c);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x1cfc71,[_0x2a0306])=>{if(this['_document']['version'])throw new _0x30c218('realtimecollaborationclient-init-document-already-initialized',this);_0x1cfc71['stop'](),this['_setPendingAction']();const _0x35b11b=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x4df86f])=>!_0x4df86f['lazyLoad'])['map'](([_0x2577f5,_0x58d061])=>[_0x2577f5,_0x58d061['modelAttributes']||{}])),_0x4e4507=this['_getOperationsFromInitData'](_0x2a0306,_0x35b11b);0x0==_0x4e4507['length']&&_0x4e4507['push'](new _0x459d94(0x0)),_0x1cfc71['return']=this['_connectService'](_0x4e4507)['then'](()=>{this['editor']['plugins']['get'](z)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x3b8829=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x3b8829))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x2fdf28,[_0x171cdf,_0x5bca01])=>{_0x2fdf28['stop']();const _0x3e1dd2=this['editor']['model']['document']['getRoot'](_0x171cdf);if(!this['_knownRootNames']['has'](_0x171cdf)){const _0x152c98=_0x5bca01&&_0x5bca01['data']?_0x5bca01['data']:'',_0x373659=_0x5bca01&&_0x5bca01['attributes']?_0x5bca01['attributes']:{};await this['_loadRoot'](_0x171cdf,_0x152c98,_0x373659);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x3e1dd2['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x3e1dd2);});},{'priority':'high'});}async _fetchMissingUsers(_0x4339fc){const _0x2ce31f=this['editor']['plugins']['get'](_0x1633f9),{connection:_0x1f257f}=this['editor']['plugins']['get'](z),_0x4205de=new Set();for(const _0x5869e6 of _0x4339fc){const _0x2caaeb=_0x5869e6['_authorId'];_0x2caaeb&&!_0x2ce31f['getUser'](_0x2caaeb)&&_0x4205de['add'](_0x2caaeb);}if(0x0===_0x4205de['size'])return;const _0x20581b=await _0x2d27a3['getMany'](_0x1f257f,Array['from'](_0x4205de));for(const _0x29baa4 of _0x20581b)_0x2ce31f['getUser'](_0x29baa4['id'])||_0x2ce31f['addUser'](_0x29baa4);}_getOperationsFromInitData(_0x46ca1f,_0xad5f86={}){const _0x3089aa=this['editor']['model'],_0x4a99f4=[];let _0xa052da=0x0;const _0x213d4e='string'==typeof _0x46ca1f?{'main':_0x46ca1f}:_0x46ca1f;for(const _0x6cc87a of Object['keys'](_0x213d4e)){if(!this['_document']['roots']['has'](_0x6cc87a))throw new _0x30c218('realtimecollaborationclient-init-non-existent-root',this);const _0x1bc4d1=this['_document']['getRoot'](_0x6cc87a),_0x353e4b=this['editor']['data']['parse'](_0x213d4e[_0x6cc87a],_0x1bc4d1),_0x162d94=new _0x4b34d3(_0x3089aa['createPositionAt'](_0x1bc4d1,0x0),_0x353e4b,_0xa052da++);_0x4a99f4['push'](_0x162d94);for(const [_0x378c3a,_0x47faf1]of _0x353e4b['markers']){const _0x421794=new _0x41e66f(_0x378c3a,null,_0x3089aa['createRange'](_0x3089aa['createPositionFromPath'](_0x1bc4d1,_0x47faf1['start']['path']['slice']()),_0x3089aa['createPositionFromPath'](_0x1bc4d1,_0x47faf1['end']['path']['slice']())),_0x3089aa['markers'],!0x0,_0xa052da++);_0x4a99f4['push'](_0x421794);}}if(_0xad5f86)for(const [_0x1a0597,_0x2a67bd]of Object['entries'](_0xad5f86)){const _0x1e5294=_0x3089aa['document']['getRoot'](_0x1a0597);if(!_0x1e5294)throw new _0x30c218('multi-root-editor-root-attributes-no-root',null);for(const [_0x3757e3,_0x1ef12b]of Object['entries'](_0x2a67bd))if(null!==_0x1ef12b){const _0x399168=new _0x4a4045(_0x1e5294,_0x3757e3,null,_0x1ef12b,_0xa052da++);_0x4a99f4['push'](_0x399168);}}return _0x4a99f4;}async _loadRoot(_0x51b4b6,_0x3357cc,_0x523c74){this['_getOperationsFromInitData']({[_0x51b4b6]:_0x3357cc},{[_0x51b4b6]:_0x523c74})['forEach']((_0x4f39b6,_0x48ef5e)=>{_0x4f39b6['baseVersion']=this['_document']['version']+_0x48ef5e,_0x4f39b6['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x4f39b6);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x435ebe,_0x511e66){let _0x43305d;this['_offset']=_0x435ebe['offset'];const _0x266a5a=_0x435ebe['wereChangesApplied']&&!_0x435ebe['initData'],_0x149065=_0x266a5a?0x0:_0x435ebe['data']['baseVersion'];if(_0x511e66['forEach'](_0x362564=>{_0x362564['_isInit']=!0x0,_0x362564['createdAt']=_0x435ebe['sessionCreatedAt'],_0x362564['_authorId']=null;}),_0x266a5a)_0x43305d=_0x511e66,this['_applyOperationsSet'](_0x43305d,_0x266a5a);else{if(_0x435ebe['initData']){const _0x5d733d=this['_getOperationsFromInitData'](_0x435ebe['initData']);this['_document']['history']['version']=-_0x5d733d['length'],_0x5d733d['forEach'](_0x5281bc=>{_0x5281bc['baseVersion']-=_0x5d733d['length'],_0x5281bc['createdAt']=_0x435ebe['sessionCreatedAt'],_0x5281bc['_isInit']=!0x0,_0x5281bc['_authorId']=null;}),this['_applyOperationsSet'](_0x5d733d,!0x0),this['serverHistory']['version']=-_0x5d733d['length']+this['_offset'],this['_updateServerHistory'](_0x5d733d);}this['_document']['history']['version']=_0x149065,_0x43305d=this['_decompressOperations'](_0x435ebe['data'],_0x435ebe['metadata']),await this['_fetchMissingUsers'](_0x43305d),this['_applyOperationsSet'](_0x43305d,_0x266a5a);}_0x435ebe['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x43305d,_0x435ebe['lastOperationId']),this['_lastSyncedOperationId']=_0x435ebe['lastOperationId']),this['serverHistory']['version']=_0x149065+this['_offset'],this['_updateServerHistory'](_0x43305d),_0x511e66['filter'](_0xff8297=>{const _0x313a9b=this['_getAffectedRoot'](_0xff8297);return _0x313a9b&&!this['_knownRootNames']['has'](_0x313a9b);})['forEach']((_0x1e433d,_0x341e31)=>{_0x1e433d['baseVersion']=this['_document']['version']+_0x341e31,this['_saveOperationInBuffer'](_0x1e433d);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x598430,_0x1bc9b8){const _0x5a0b08=_0x1bc9b8&&_0x1bc9b8['message'];if(_0x5a0b08&&_0x5a0b08['startsWith']('realtimecollaborationclient'))throw _0x1bc9b8;const _0x1fac6f=this['editor']['plugins']['get'](z);throw this['_isPendingUpdate']=!0x0,_0x1fac6f['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x30c218(_0x598430,this['editor'],_0x5a0b08?{'originalError':_0x5a0b08}:void 0x0);}_saveOperationInBuffer(_0x123958){this['_knownOperations']['has'](_0x123958)||(this['_knownOperations']['add'](_0x123958),this['_bufferedOperations']['push'](_0x123958),this['_pendingAction']||'marker'==_0x123958['type']&&!_0x123958['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0xe98e11=!0x1){!_0xe98e11&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x1fa22f=>{_0x1fa22f&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x47ceff=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0xbcdf43){return _0xbcdf43['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xbcdf43['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0xbcdf43['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x47ceff)||this['_crash'](_0x47ceff['message'],_0x47ceff);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x51b324=>{this['on']('change:_isPendingUpdate',()=>{_0x51b324();});});}async _sendBufferedOperations(){const _0x2d1493=this['editor']['plugins']['get'](K);if(this['_shouldSendSelectionUpdate']()&&(_0x2d1493['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x19874b=[...this['_bufferedOperations']];for(const _0x382e6a of _0x19874b)_0x382e6a['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x382e6a);const _0x38fc59=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x19874b),_0x34a0ea=Z++,_0x40241f=this['_compressOperations'](_0x19874b),_0x400d94=await this['_service']['sendOperations'](_0x40241f,_0x40241f['baseVersion'],_0x38fc59);try{return await this['_handleServerResponse'](_0x19874b,_0x400d94,_0x34a0ea);}catch(_0x33ae88){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x33ae88);}}async['_handleServerResponse'](_0x5875cf,_0x49b907,_0x350fe7){if('error'in _0x49b907)throw _0x49b907['error'];let _0x5e6d96;if(_0x49b907['wereChangesApplied']){_0x49b907['lastOperationId']&&(this['_lastSyncedOperationId']=_0x49b907['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x393948=>!_0x5875cf['includes'](_0x393948));for(const _0x330bc9 of _0x5875cf)_0x330bc9['createdAt']='lastOperationAcceptedAt'in _0x49b907&&_0x49b907['lastOperationAcceptedAt']||void 0x0;st(_0x5875cf,_0x49b907['version']-_0x5875cf['length']),this['_updateServerHistory'](_0x5875cf);const _0xd9305f=_0x5875cf['filter'](_0x2350de=>{if(!_0x2350de['_isInit'])return!0x1;const _0x5b4e39=this['_getAffectedRoot'](_0x2350de);return _0x5b4e39&&!this['_knownRootNames']['has'](_0x5b4e39);});st(_0xd9305f,this['_document']['version']),this['_applyOperationsSet'](_0xd9305f),_0x5e6d96=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x53c1fd=this['_decompressOperations'](_0x49b907['data'],_0x49b907['metadata'])['filter'](_0x45ec45=>_0x45ec45['baseVersion']>=this['_lastServerVersion']);_0x53c1fd['forEach'](_0x12d568=>this['_addKnownRoot'](_0x12d568)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x5160a9=>!_0x5160a9['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x5160a9))),this['_bufferedOperations']['length']&&st(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x53c1fd),_0x5e6d96=this['_handleExternalOperations'](_0x53c1fd,_0x49b907['version'],_0x49b907['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x5e6d96?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0xd2181d,_0x223b73,_0x2be061){try{const _0x558de7={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x1dea5b,operationsB:_0x31a548,originalOperations:_0xe01164}=_0x3000cc(_0xd2181d,this['_bufferedOperations'],_0x558de7);st(_0x1dea5b,this['_document']['version']),st(_0x31a548,_0x223b73);for(const _0x115ec8 of _0x1dea5b){const _0xce8b4a=_0xe01164['get'](_0x115ec8);_0xce8b4a?(_0x115ec8['_authorId']=_0xce8b4a['_authorId'],'noop'!==_0x115ec8['type']&&(_0x115ec8['_aiSource']=_0xce8b4a['_aiSource'])):_0x115ec8['_authorId']=null;}for(const _0xa00980 of _0x31a548)'noop'!==_0xa00980['type']&&(_0xa00980['_aiSource']=_0xe01164['get'](_0xa00980)?.['_aiSource']);_0x2be061&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0xd2181d,_0x2be061),this['_lastSyncedOperationId']=_0x2be061),this['_bufferedOperations']=[..._0x31a548],this['_applyOperationsSet'](_0x1dea5b),this['_updateServerHistory'](_0xd2181d);}catch(_0x4a0b94){return console['error'](_0x4a0b94),!0x1;}return!0x0;}_applyOperationsSet(_0x113f7f,_0x213b0a=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0xd74172=>{for(const _0x3db41b of _0x113f7f)this['_knownOperations']['add'](_0x3db41b),this['_addKnownRoot'](_0x3db41b),_0xd74172['batch']['addOperation'](_0x3db41b),this['editor']['model']['applyOperation'](_0x3db41b);});}_addKnownRoot(_0x513c1c){const _0x173459=this['_getAffectedRoot'](_0x513c1c);_0x173459&&this['_knownRootNames']['add'](_0x173459);}_getAffectedRoot(_0xe0fa03){let _0x2dfce6,_0x2ff507;switch(_0xe0fa03['type']){case'insert':_0x2dfce6=_0xe0fa03['position']['root'];break;case'marker':if(_0x2ff507=_0xe0fa03['newRange'],!_0x2ff507)return null;_0x2dfce6=_0x2ff507['root'];break;case'addRootAttribute':_0x2dfce6=_0xe0fa03['root'];break;case'addRoot':_0x2dfce6=_0xe0fa03['affectedSelectable'];break;case'move':_0x2dfce6=_0xe0fa03['targetPosition']['root'];break;default:return null;}return _0x2dfce6['rootName'];}_updateServerHistory(_0x9f35b8){_0x9f35b8['forEach'](_0x2d75cc=>{const _0x591e36=_0x2d75cc['clone']();_0x591e36['_authorId']=_0x2d75cc['_authorId'],_0x591e36['_isInit']=!!_0x2d75cc['_isInit'],_0x591e36['_aiSource']=_0x2d75cc['_aiSource'],_0x591e36['createdAt']=_0x2d75cc['createdAt'],_0x591e36['baseVersion']+=this['_offset'],_0x2d75cc['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x591e36),this['serverHistory']['addOperation'](_0x591e36);});}_handleReconnectionError(_0x500b3b){const _0x3f9dc9=this['editor']['plugins']['get']('Notification'),_0x5811a7=this['editor']['locale'];_0x500b3b||(_0x500b3b=X(_0x5811a7,'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.')),_0x3f9dc9['showWarning'](_0x500b3b,{'title':X(_0x5811a7,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](z)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x472682)['add'](X(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x472682)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x49be04){const _0x217c1a=_0x49be04['map'](_0x37f2b5=>_0x37f2b5['toJSON']());return this['_compressor']['compress'](_0x217c1a);}_decompressOperations(_0x533d14,_0x46a472){return this['_compressor']['decompress'](_0x533d14)['map']((_0x2df34b,_0x2340f2)=>{const _0x343d4d='init'==_0x46a472[_0x2340f2]['type'];if('InsertOperation'==_0x2df34b['__className']){const _0x4d3447=_0x2df34b['position']['root'];!this['_document']['getRoot'](_0x4d3447)&&(this['_document']['createRoot']('$unknown',_0x4d3447)['_isAttached']=!0x1);}else{if('RootOperation'==_0x2df34b['__className']){const _0xe13017=this['_document']['getRoot'](_0x2df34b['rootName']);_0xe13017&&'$unknown'==_0xe13017['name']&&_0x2df34b['elementName']!=_0xe13017['name']&&(_0xe13017['name']=_0x2df34b['elementName']);}}const _0x536ae5=_0x30ba1f['fromJSON'](_0x2df34b,this['_document']);return _0x536ae5['wasUndone']=_0x2df34b['wasUndone'],_0x536ae5['_isInit']=_0x343d4d,_0x536ae5['_authorId']=_0x343d4d?null:_0x46a472[_0x2340f2]['userId'],_0x536ae5['_isDisconnection']='cs:removeUser'===_0x46a472[_0x2340f2]['type'],_0x536ae5['_aiSource']=_0x2df34b['_aiSource']||void 0x0,_0x536ae5['createdAt']=_0x46a472[_0x2340f2]['createdAt'],_0x536ae5;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0xde0c0e=this['editor']['plugins']['get'](Y)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0xde0c0e&&_0xde0c0e['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},et=class extends Error{};function st(_0x342615,_0x261bbd){for(const _0x7ae2eb of _0x342615)_0x7ae2eb['baseVersion']=_0x261bbd++;}var it=class{_ignoredOperations;_operationToId;constructor(_0xcc016e){this['_ignoredOperations']=_0xcc016e,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x122988){let _0x4af815=_0x122988['length'];for(;_0x4af815--;){const _0x44528e=_0x122988[_0x4af815];if(!this['_ignoredOperations']['has'](_0x44528e)){if(!this['_operationToId']['has'](_0x44528e)){const _0x4e5166=_0x5a42e3()['slice'](0x1,0x12);this['_operationToId']['set'](_0x44528e,_0x4e5166);}return this['_operationToId']['get'](_0x44528e);}}}setIdForTheLastOperation(_0x4a3e75,_0x15b115){if(!_0x15b115)return;let _0x16bddd=_0x4a3e75['length'];for(;_0x16bddd--;){const _0x1c32c8=_0x4a3e75[_0x16bddd];this['_ignoredOperations']['has'](_0x1c32c8)||this['_operationToId']['set'](_0x1c32c8,_0x15b115);}}},nt=class extends _0x2e5ad8{static get requires(){return[tt];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},ot=class CloudServicesCommentsAdapter extends _0x11ffbd{static CommentsService=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x2adcb2)());['_services'];static get requires(){return[z,_0x63208d,Y,_0x1633f9];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2df3ce){super(_0x2df3ce),this['_services']=new Map();}async init(){const _0x305cb6=this['context'],_0x346767=_0x305cb6['plugins']['get'](_0x63208d);if(_0x305cb6['plugins']['get'](z)['addToReconnectionStack'](this),_0x346767['adapter']={'addCommentThread':async({channelId:_0x3c6c02,threadId:_0x2e6d21,comments:_0x3c1330,resolvedAt:_0x14889f,resolvedBy:_0x96d884,context:_0x2e7eea,attributes:_0x1744c8})=>{const _0x14c136=await this['_getService'](_0x3c6c02)['addCommentThread']({'commentThreadId':_0x2e6d21,'comments':_0x3c1330['map'](_0x74b25b=>function(_0x1c96cb,_0x2d1044,_0x5aa853){return{'commentThreadId':_0x5aa853,'commentId':_0x1c96cb['commentId'],'userId':_0x1c96cb['authorId'],'content':_0x1c96cb['content'],'documentId':_0x2d1044,'createdAt':_0x1c96cb['createdAt'],'attributes':_0x1c96cb['attributes']||{}};}(_0x74b25b,_0x3c6c02,_0x2e6d21)),'resolvedAt':_0x14889f,'resolvedBy':_0x96d884,'context':_0x2e7eea,'attributes':_0x1744c8})['catch'](ct);return{'threadId':_0x14c136['commentThreadId'],'comments':_0x14c136['comments']};},'getCommentThread':async({channelId:_0x3eb3bf,threadId:_0x309117})=>{const _0x3e124c=await this['_getService'](_0x3eb3bf)['getCommentThread'](_0x309117)['catch'](rt)['catch'](ct);return _0x3e124c?_0x3e124c['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x3e124c]),{'threadId':_0x3e124c['commentThreadId'],'comments':_0x3e124c['comments']['map'](at),'context':_0x3e124c['context'],'resolvedAt':_0x3e124c['resolvedAt'],'resolvedBy':_0x3e124c['resolvedBy'],'attributes':_0x3e124c['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0xf6082e,threadId:_0x499ab2,context:_0x13be8b,unlinkedAt:_0x11da90,attributes:_0x1b726a})=>this['_getService'](_0xf6082e)['updateCommentThread']({'commentThreadId':_0x499ab2,'context':_0x13be8b,'attributes':_0x1b726a,'unlinkedAt':_0x11da90})['catch'](rt)['catch'](ct),'resolveCommentThread':async({channelId:_0x3d00dd,threadId:_0x4ce98b})=>{const _0x36132d=await this['_getService'](_0x3d00dd)['resolveCommentThread'](_0x4ce98b)['catch'](rt)['catch'](ct);return{'threadId':_0x36132d['commentThreadId'],'resolvedAt':_0x36132d['resolvedAt'],'resolvedBy':_0x36132d['resolvedBy']};},'reopenCommentThread':async({channelId:_0x5b8e05,threadId:_0x32b3d0})=>this['_getService'](_0x5b8e05)['reopenCommentThread'](_0x32b3d0)['catch'](rt)['catch'](ct),'removeCommentThread':({channelId:_0x413f05,threadId:_0x47fc0c})=>this['_getService'](_0x413f05)['removeCommentThread'](_0x47fc0c)['catch'](rt)['catch'](ct),'addComment':({channelId:_0x39e61c,threadId:_0x22471c,commentId:_0x2596c1,content:_0x5a9819,attributes:_0xeb9428})=>this['_getService'](_0x39e61c)['addComment'](_0x22471c,_0x2596c1,_0x5a9819,_0xeb9428)['catch'](ct),'updateComment':({channelId:_0x2bd8c1,threadId:_0x519f62,commentId:_0x29bf9a,content:_0x27a923,attributes:_0x40055e})=>this['_getService'](_0x2bd8c1)['updateComment'](_0x519f62,_0x29bf9a,_0x27a923,_0x40055e)['catch'](rt)['catch'](ct),'removeComment':({channelId:_0x544a17,threadId:_0x3d83b0,commentId:_0x11ffda})=>this['_getService'](_0x544a17)['removeComment'](_0x3d83b0,_0x11ffda)['catch'](rt)['catch'](ct)},_0x305cb6 instanceof _0x855411){const _0xacadda=_0x305cb6['config']['get']('collaboration.channelId'),_0x5e199a=_0x305cb6['plugins']['get'](Y);await this['_setUpService'](_0xacadda);const _0x49a358=await this['_services']['get'](_0xacadda)['getConnectedSessions']();this['listenTo'](_0x5e199a,'sessionAdd:'+_0xacadda,(_0x2b6921,{session:_0x330c36})=>{_0x330c36['id']===_0x5e199a['mySessionId']&&(_0x2b6921['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x330c36['permissions'],_0xacadda));}),_0x5e199a['register'](_0xacadda,_0x49a358);}}async _setUpService(_0x52ad92){if(this['_services']['has'](_0x52ad92))throw new _0x30c218('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x52ad92});const _0x4a842e=this['context']['plugins']['get'](_0x63208d),_0x2adfaf=new CloudServicesCommentsAdapter['CommentsService'](_0x52ad92);this['_services']['set'](_0x52ad92,_0x2adfaf),this['listenTo'](_0x2adfaf,'commentThreadAdded',(_0x2be3e0,_0x1b6859)=>{const {commentThreadId:_0x471a27,documentId:_0x3196bf,context:_0x2ac0f6,attributes:_0x4e85d9,resolvedAt:_0x210683,resolvedBy:_0xd384b2,comments:_0x441f02}=_0x1b6859;_0x4a842e['getCommentThread'](_0x471a27)||_0x4a842e['addCommentThread']({'threadId':_0x471a27,'channelId':_0x3196bf,'comments':_0x441f02?_0x441f02['map'](at):[],'context':_0x2ac0f6,'attributes':_0x4e85d9,'resolvedAt':_0x210683,'resolvedBy':_0xd384b2,'isFromAdapter':!0x0});}),this['listenTo'](_0x2adfaf,'commentThreadUpdated',(_0x750c91,{commentThreadId:_0x4b637a,documentId:_0x332b9b,context:_0x42ac72,unlinkedAt:_0x24d638,attributes:_0x2e5ead})=>{_0x4a842e['getCommentThread'](_0x4b637a)&&_0x4a842e['updateCommentThread']({'threadId':_0x4b637a,'channelId':_0x332b9b,'context':_0x42ac72,'unlinkedAt':_0x24d638,'attributes':_0x2e5ead,'isFromAdapter':!0x0});}),this['listenTo'](_0x2adfaf,'commentThreadResolved',(_0x39b4e9,{commentThreadId:_0x35bf5a,resolvedBy:_0x512f11,resolvedAt:_0x256573})=>{const _0x14a1a1=_0x4a842e['getCommentThread'](_0x35bf5a);_0x14a1a1&&_0x14a1a1['resolve']({'resolvedBy':_0x512f11,'resolvedAt':_0x256573,'isFromAdapter':!0x0});}),this['listenTo'](_0x2adfaf,'commentThreadReopened',(_0x6f416f,{commentThreadId:_0x6defb7})=>{const _0x284492=_0x4a842e['getCommentThread'](_0x6defb7);_0x284492&&_0x284492['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x2adfaf,'commentThreadRemoved',(_0x497a37,{commentThreadId:_0x38ae48})=>{const _0x3c6a3b=_0x4a842e['getCommentThread'](_0x38ae48);_0x3c6a3b&&_0x3c6a3b['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x2adfaf,'commentAdded',(_0x444a02,_0x58783e)=>{const _0xbb2e46=_0x58783e['commentThreadId'],_0x2a8a00=_0x4a842e['getCommentThread'](_0xbb2e46);_0x2a8a00&&_0x2a8a00['addComment']({...at(_0x58783e),'isFromAdapter':!0x0});}),this['listenTo'](_0x2adfaf,'commentUpdated',(_0x14193d,{commentThreadId:_0x27c4b1,commentId:_0x3f4f47,content:_0x27b814,attributes:_0x2297df})=>{const _0x2969e3=_0x4a842e['getCommentThread'](_0x27c4b1);if(_0x2969e3){const _0x64c1ba=_0x2969e3['getComment'](_0x3f4f47);_0x64c1ba&&_0x64c1ba['update']({'content':_0x27b814,'attributes':_0x2297df,'isFromAdapter':!0x0});}}),this['listenTo'](_0x2adfaf,'commentRemoved',(_0x34429e,{commentThreadId:_0x2e5dfb,commentId:_0x484de1})=>{const _0x20043f=_0x4a842e['getCommentThread'](_0x2e5dfb);if(_0x20043f){const _0x24043a=_0x20043f['getComment'](_0x484de1);_0x24043a&&_0x24043a['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x2adfaf,'disconnected',()=>{'connected'===this['context']['plugins']['get'](z)['connection']?.['state']&&(this['_services']['delete'](_0x52ad92),this['stopListening'](_0x2adfaf));}),await this['_connectService'](_0x52ad92);}destroy(){if(this['context']instanceof _0x855411){const _0xae243c=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0xae243c)&&this['_terminateService'](_0xae243c);}}_terminateService(_0x2e4308){if(!this['_services']['has'](_0x2e4308))throw new _0x30c218('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x2e4308});this['_getService'](_0x2e4308)['disconnect'](),this['_services']['delete'](_0x2e4308);}async reconnect(){for(const _0x5ea0fa of this['_services']['keys']())await this['_connectService'](_0x5ea0fa);if(this['context']instanceof _0x855411){const _0x222d42=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x222d42)){const _0x349df6=this['context']['plugins']['get'](Y);_0x349df6['unregister'](_0x222d42);const _0x3c1fdf=await this['_services']['get'](_0x222d42)['getConnectedSessions']();_0x349df6['register'](_0x222d42,_0x3c1fdf);}}}async _connectService(_0x21320b){const {connection:_0x30f961}=this['context']['plugins']['get'](z),_0x28437f=this['context']['plugins']['get'](_0x63208d),_0x3be224=await this['_services']['get'](_0x21320b)['connect'](_0x30f961);await this['_fetchMissingUsersForThreads'](_0x3be224);const _0x5e156e=new Set(Array['from'](_0x28437f['getCommentThreads']({'channelId':_0x21320b}),_0x70c72a=>_0x70c72a['id']));for(const _0x28d207 of _0x3be224)_0x28d207['deletedAt']||_0x5e156e['delete'](_0x28d207['commentThreadId']);for(const _0x2147c4 of _0x5e156e)_0x28437f['getCommentThread'](_0x2147c4)['remove']({'isFromAdapter':!0x0});for(const _0x312ac1 of _0x3be224){let _0x242acc=_0x28437f['getCommentThread'](_0x312ac1['commentThreadId']);const {commentThreadId:_0x38883c,context:_0x54feec,attributes:_0x55c09a,resolvedBy:_0x302ba5,resolvedAt:_0x25c141,unlinkedAt:_0x3924b2,deletedAt:_0x4c81e7}=_0x312ac1;if(_0x4c81e7)continue;_0x242acc||(_0x242acc=_0x28437f['addCommentThread']({'channelId':_0x21320b,'threadId':_0x38883c,'context':_0x54feec,'attributes':_0x55c09a||{},'resolvedBy':_0x302ba5,'resolvedAt':_0x25c141,'unlinkedAt':_0x3924b2,'isFromAdapter':!0x0}));const _0x1aefbc=new Set(Array['from'](_0x242acc['comments'],_0x4edec2=>_0x4edec2['id']));for(const _0xd4240d of _0x312ac1['comments'])_0x1aefbc['delete'](_0xd4240d['commentId']);for(const _0x5aa5be of _0x1aefbc)_0x242acc['getComment'](_0x5aa5be)['remove']({'isFromAdapter':!0x0});for(const _0x450e2b of _0x312ac1['comments']){const _0x277c60=_0x242acc['getComment'](_0x450e2b['commentId']);_0x277c60?_0x277c60['content']!==_0x450e2b['content']&&_0x277c60['update']({'content':_0x450e2b['content'],'isFromAdapter':!0x0}):_0x242acc['addComment'](Object['assign'](at(_0x450e2b),{'isFromAdapter':!0x0}));}}}_getService(_0x4e14e6){if(!this['_services']['has'](_0x4e14e6))throw new _0x30c218('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x4e14e6});return this['_services']['get'](_0x4e14e6);}async _fetchMissingUsersForThreads(_0x1136cf){const _0x482ca5=this['context']['plugins']['get'](_0x1633f9),{connection:_0x3b162b}=this['context']['plugins']['get'](z),_0x83b89c=new Set();for(const {resolvedBy:_0x1b88f3,comments:_0x47ace5}of _0x1136cf){_0x1b88f3&&!_0x482ca5['getUser'](_0x1b88f3)&&_0x83b89c['add'](_0x1b88f3);for(const {userId:_0x266068}of _0x47ace5)_0x482ca5['getUser'](_0x266068)||_0x83b89c['add'](_0x266068);}if(0x0===_0x83b89c['size'])return;const _0x5c5332=await _0x2d27a3['getMany'](_0x3b162b,Array['from'](_0x83b89c));for(const _0x52ec16 of _0x5c5332)_0x482ca5['getUser'](_0x52ec16['id'])||_0x482ca5['addUser'](_0x52ec16);}};async function rt(_0x2aec03){if('404'!==_0x2aec03['code'])throw _0x2aec03;}function ct(_0x429065){if((_0x561264=_0x429065)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x561264['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x561264['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x561264;throw _0x429065;}function at(_0x196ef6){return{'threadId':_0x196ef6['commentThreadId'],'commentId':_0x196ef6['commentId'],'content':_0x196ef6['content'],'createdAt':_0x196ef6['createdAt'],'authorId':_0x196ef6['userId'],'attributes':_0x196ef6['attributes']||{}};}var ht=class CloudServicesTrackChangesAdapter extends _0x2e5ad8{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>_0x3f43ee)());_bufferedRequests;_trackChangesService;static get requires(){return[ot,_0x5ce213,z];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x2da672){super(_0x2da672);const _0xe2aa9e=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0xe2aa9e);}init(){const _0x5504b2=this['editor']['plugins']['get'](z),_0x4e9791=this['editor']['plugins']['get'](_0x5ce213);return _0x4e9791['adapter']={'getSuggestion':async _0x279915=>{await this['_waitForServiceReady']();const _0x582e07=await this['_trackChangesService']['get'](_0x279915)['catch'](lt);return await this['_fetchMissingUsersForThreads']([_0x582e07]),_0x582e07;},'addSuggestion':async({id:_0x155d4b,type:_0x4e04e6,data:_0x228a81,originalSuggestionId:_0x5c6a9d,attributes:_0x7a0cd9})=>{await this['_waitForServiceReady']();const _0x2877e2={'id':_0x155d4b,'type':_0x4e04e6,'data':_0x228a81,'originalSuggestionId':_0x5c6a9d,'attributes':_0x7a0cd9},_0x24ea10=await this['_trackChangesService']['add'](_0x155d4b,_0x4e04e6,_0x228a81,_0x5c6a9d,_0x7a0cd9)['catch'](_0x147507=>{if(dt(_0x147507))return new Promise(_0x2214d1=>{this['_bufferedRequests']['set'](_0x155d4b,{'resolve':_0x2214d1,'suggestionData':_0x2877e2});});throw _0x147507;});return this['_bufferedRequests']['delete'](_0x155d4b),_0x24ea10;},'updateSuggestion':async(_0xf6aba3,_0x102cda)=>{if(await this['_waitForServiceReady'](),'open'!==_0x102cda['state'])return this['_trackChangesService']['update'](_0xf6aba3,_0x102cda)['catch'](lt);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x4948eb,_0x1dedb6)=>{_0x4e9791['hasSuggestion'](_0x1dedb6['id'])&&(_0x4e9791['getSuggestion'](_0x1dedb6['id'])['attributes']=_0x1dedb6['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x5504b2['connection']?.['state']&&(_0x5504b2['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x5504b2['connection'])['then'](_0x20905a=>(_0x5504b2['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x20905a)['then'](()=>{for(const _0x379176 of _0x20905a){_0x4e9791['addSuggestionData'](_0x379176)['_saved']=!0x0;}})));}async reconnect(){const _0x1e9707=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0xeac2f3}=this['editor']['plugins']['get'](z),_0x339843=await this['_trackChangesService']['connect'](_0xeac2f3);await this['_fetchMissingUsersForThreads'](_0x339843);for(const {suggestionData:_0x3159b1,resolve:_0x2df47e}of this['_bufferedRequests']['values']()){let _0x4e2029=_0x339843['find'](_0x335cbd=>_0x335cbd['id']===_0x3159b1['id']);_0x4e2029||(_0x4e2029=await this['_trackChangesService']['add'](_0x3159b1['id'],_0x3159b1['type'],_0x3159b1['data'],_0x3159b1['originalSuggestionId'])),_0x2df47e(_0x4e2029);}for(const _0x3cb70f of _0x339843)_0x1e9707['hasSuggestion'](_0x3cb70f['id'])||_0x1e9707['addSuggestionData'](_0x3cb70f);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x3d0978=>{this['listenTo'](this['_trackChangesService'],'connected',_0x2f4de4=>{_0x2f4de4['off'](),_0x3d0978();});});}async _fetchMissingUsersForThreads(_0x14bb03){const _0x19f347=this['editor']['plugins']['get'](_0x1633f9),{connection:_0x15fbe1}=this['editor']['plugins']['get'](z),_0x1a6fdb=new Set();for(const {authorId:_0x43e542}of _0x14bb03)_0x19f347['getUser'](_0x43e542)||_0x1a6fdb['add'](_0x43e542);if(0x0===_0x1a6fdb['size'])return;const _0x423aae=await _0x2d27a3['getMany'](_0x15fbe1,Array['from'](_0x1a6fdb));for(const _0x349ee6 of _0x423aae)_0x19f347['getUser'](_0x349ee6['id'])||_0x19f347['addUser'](_0x349ee6);}};function lt(_0x5393ea){if(dt(_0x5393ea))return new Promise(()=>{});throw _0x5393ea;}function dt(_0x1fd2e7){return _0x1fd2e7['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1fd2e7['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var ut=class extends _0x2e5ad8{static get requires(){return[_0x54b47c,ot,nt,z];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x38857b=this['editor']['plugins']['get'](z),_0x4a4d38=this['editor']['plugins']['get'](_0x244bb0),_0x4e7358=this['editor']['plugins']['get'](ot);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x38857b,'change:state',(_0x358ef4,_0x30044b,_0xd0599c)=>{_0x4a4d38['isThreadsLoadingPaused']='connected'!==_0xd0599c;});}),this['listenTo'](_0x38857b,'change:state',(_0x37ba78,_0x34c0d9,_0x39fac3)=>{this['editor']['plugins']['get'](_0x63208d)['switchReadOnly']('connected'!==_0x39fac3);}),_0x4e7358['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x288fe4=this['editor']['plugins']['get'](ot),_0x2eb783=this['editor']['config']['get']('collaboration.channelId');_0x288fe4['_services']['has'](_0x2eb783)&&_0x288fe4['_terminateService'](_0x2eb783),super['destroy']();}},ft=class extends _0x2e5ad8{static get requires(){return[ut,ht,_0x4b8fa6];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},mt=class CloudServicesRevisionHistoryAdapter extends _0x2e5ad8{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
+ ((()=>_0x4ace97)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[z,tt,_0xcbaa40,Y,_0x1633f9];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x52643e){super(_0x52643e);const _0x3fcf9a=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x3fcf9a);}async init(){const _0x59fd18=this['editor']['plugins']['get'](tt),_0x5b35da=_0x59fd18['serverHistory'],_0x538b37=this['editor']['plugins']['get'](z);this['_revisionTracker']['setSource']({'history':_0x5b35da,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x59fd18['sessionId']});const _0x5a5379=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x85d46,_0x3823e4=await _0x2f65d1['isBundleUploaded'](_0x538b37['connection'],_0x5a5379);this['editor']['plugins']['get'](_0xcbaa40)['adapter']={'getRevision':async({revisionId:_0xaf4441})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0xaf4441)),'updateRevisions':async _0x1911f6=>{await this['_waitForServiceReady']();const _0x2144c1=this['_revisionTracker']['currentRevision'];if(_0x3823e4&&0x1===_0x1911f6['length']&&_0x1911f6[0x0]['id']===_0x2144c1['id'])return _0x1911f6;for(const _0xdcde6e of _0x1911f6)_0xdcde6e['id']===_0x2144c1['id']&&(_0xdcde6e['isEmptyCurrent']=_0xdcde6e['fromVersion']===_0xdcde6e['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x1911f6,this['_lastRequestId'])['then'](_0x3e8e59=>(this['_lastRequestId']=_0x3e8e59,_0x1911f6))['catch'](_0x533910=>{if(pt(_0x533910)||'400'===_0x533910['code']&&void 0x0!==_0x533910['data']['wrongRequestId']){for(const _0x1becbe of _0x1911f6)this['_revisionTracker']['repository']['getRevision'](_0x1becbe['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x1becbe['id'],_0x1becbe,!0x1);if(pt(_0x533910)&&'destroyed'!==this['editor']['state'])throw _0x533910;return _0x1911f6;}throw _0x533910;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x3d29c6,{revisionsData:_0x561253,requestId:_0x4fa3be})=>{Math['max'](..._0x561253['map'](_0x6d265d=>_0x6d265d['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x561253,_0x4fa3be);}):this['_handleRevisionsUpdate'](_0x561253,_0x4fa3be);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x538b37['connection']?.['state']&&(_0x538b37['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0xe2acd5,requestId:_0xb9f005}=await this['_revisionHistoryService']['connect'](_0x538b37['connection']);_0x538b37['addToReconnectionStack'](this),this['_lastRequestId']=_0xb9f005,await this['_fetchMissingUsers'](_0xe2acd5);for(const _0x1765ad of _0xe2acd5)this['_revisionTracker']['addRevisionData'](_0x1765ad);this['listenTo'](_0x59fd18,'change:_isConnected',(_0xdf68ec,_0x185908,_0x179e02)=>{_0x179e02&&(this['_oldOffset']=_0x59fd18['_offset'],_0xdf68ec['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x16ae71=this['editor']['plugins']['get'](z),_0x107d64=this['editor']['plugins']['get'](tt),_0x58fbc8=async()=>{const _0x43d531=this['_revisionTracker']['currentRevision'],_0x4c2140=_0x43d531['id'],_0x4fd535=_0x4c2140!==_0x107d64['sessionId'];if(_0x4fd535){const _0x5982bb=_0x107d64['_offset']-this['_oldOffset'],_0x5c04b2=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x43d531['toVersion']+_0x5982bb!==_0x5c04b2){const _0xb5fdb1=_0x43d531['fromVersion']+_0x5982bb,_0x5f5bee=this['editor']['plugins']['get'](_0x1633f9),_0x2e03ea=this['_revisionTracker']['buildRevisionData']({'revision':_0x43d531,'from':_0xb5fdb1,'to':_0x5c04b2});_0x2e03ea['id']=_0x43d531['id'];const _0x4d2b80=_0x2e03ea['authorsIds']['map'](_0x2227f9=>_0x5f5bee['getUser'](_0x2227f9));_0x43d531['_update']({..._0x2e03ea,'authors':_0x4d2b80},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x43d531['id'],_0x2e03ea,!0x0);}this['_revisionTracker']['_startingVersion']=_0x5c04b2,_0x43d531['toVersion']!==_0x43d531['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x4c2140)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x4c2140),this['_revisionTracker']['_createCurrentRevision'](_0x5c04b2);}const {revisions:_0x130aef,requestId:_0x53ec8c}=await this['_revisionHistoryService']['reconnect'](_0x16ae71['connection'],this['_lastRequestId']);_0x4fd535&&_0x130aef['length']>0x0?_0x107d64['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x130aef),this['_handleRevisionsUpdate'](_0x130aef,_0x53ec8c),this['_revisionTracker']['sendBufferedUpdates']());};return _0x107d64['_isConnected']?_0x58fbc8():new Promise((_0x466fb5,_0x3d3c14)=>{_0x107d64['once']('change:_isConnected',()=>{_0x58fbc8()['then'](_0x466fb5)['catch'](_0x3d3c14);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5edfb4=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0xfb4312=>{_0xfb4312['off'](),_0x5edfb4();});});}_getLatestVersionFromServerOperations(){const _0x381760=this['editor']['plugins']['get'](tt)['serverHistory']['getOperations']()['reverse']();for(const _0xf05dd5 of _0x381760)if('marker'!==_0xf05dd5['type']||_0xf05dd5['affectsData'])return _0xf05dd5['baseVersion']+0x1;}_getLatestVersion(){const _0x54290c=this['editor']['plugins']['get'](tt);return new Promise(_0x5aa72a=>{_0x54290c['_isPendingUpdate']?_0x54290c['once']('change:_isPendingUpdate',()=>{_0x5aa72a(this['_getLatestVersionFromServerOperations']());}):_0x5aa72a(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x3a3131,_0x2df5e7){const _0x52dae6=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x2df5e7;for(const _0x3f2307 of _0x3a3131){const _0x43eab5=_0x52dae6['getRevision'](_0x3f2307['id']);if(_0x43eab5){if((_0x3f2307['fromVersion']||_0x3f2307['toVersion'])&&(_0x3f2307['diffData']=null),_0x43eab5===this['_revisionTracker']['currentRevision']){const _0x34189c=Math['max'](_0x43eab5['toVersion'],_0x3f2307['toVersion']),_0x22fa6f=Math['max'](_0x43eab5['fromVersion'],_0x3f2307['fromVersion']);let _0xede8fe;_0x43eab5['toVersion']===_0x3f2307['toVersion']&&_0x43eab5['fromVersion']===_0x3f2307['fromVersion']?(_0xede8fe=!0x0,this['_preventResendingRevisionData'](_0x3f2307)):_0x3f2307['toVersion']===_0x34189c&&_0x3f2307['fromVersion']===_0x22fa6f?_0xede8fe=!0x1:(_0x43eab5['toVersion']===_0x34189c&&_0x43eab5['fromVersion']===_0x22fa6f||this['_fixRevision']({'revision':_0x43eab5,'from':_0x22fa6f,'to':_0x34189c}),_0xede8fe=!0x0),_0xede8fe&&(delete _0x3f2307['fromVersion'],delete _0x3f2307['toVersion'],delete _0x3f2307['diffData'],delete _0x3f2307['createdAt'],delete _0x3f2307['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x3f2307),this['_preventResendingRevisionData'](_0x3f2307);}else this['_revisionTracker']['addRevisionData'](_0x3f2307);}const _0x4d0767=_0x52dae6['getRevisions']();_0x4d0767['reverse']();for(let _0x1b9d99=0x0;_0x1b9d99<_0x4d0767['length']-0x1;_0x1b9d99++){const _0x207eda=_0x4d0767[_0x1b9d99],_0xa9bc8=_0x4d0767[_0x1b9d99+0x1];if(_0x207eda['fromVersion']<_0xa9bc8['toVersion']){const _0x3bf71f=_0xa9bc8['toVersion'],_0x130f96=Math['max'](_0x3bf71f,_0x207eda['toVersion']);this['_fixRevision']({'revision':_0x207eda,'from':_0x3bf71f,'to':_0x130f96});}}}['_fixRevision']({revision:_0x4239a8,from:_0x80bd24,to:_0x29a0a1}={}){const _0x43bb23=this['editor']['plugins']['get'](_0x1633f9),_0x2ac478=this['_revisionTracker']['buildRevisionData']({'revision':_0x4239a8,'from':_0x80bd24,'to':_0x29a0a1});_0x2ac478['authors']=_0x2ac478['authorsIds']['map'](_0x2afb32=>_0x43bb23['getUser'](_0x2afb32)),_0x4239a8['_update'](_0x2ac478);}_preventResendingRevisionData(_0x52ff0a){const _0x3bfa83={};_0x3bfa83['id']=_0x52ff0a['id'];for(const _0x1f5219 of Object['keys'](_0x52ff0a))'id'!==_0x1f5219&&(_0x3bfa83[_0x1f5219]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x3bfa83['id'],_0x3bfa83,!0x0);}async _fetchMissingUsers(_0x5ca845){const _0x50069f=this['editor']['plugins']['get'](_0x1633f9),{connection:_0x307973}=this['editor']['plugins']['get'](z),_0x2665c5=new Set();for(const _0x51b47e of _0x5ca845){for(const _0x4d934f of _0x51b47e['authorsIds'])_0x5c8dd0(_0x4d934f);_0x51b47e['creatorId']&&_0x5c8dd0(_0x51b47e['creatorId']);}if(0x0===_0x2665c5['size'])return;const _0x337dcb=await _0x2d27a3['getMany'](_0x307973,Array['from'](_0x2665c5));for(const _0x57e212 of _0x337dcb)_0x50069f['getUser'](_0x57e212['id'])||_0x50069f['addUser'](_0x57e212);function _0x5c8dd0(_0x512341){_0x50069f['getUser'](_0x512341)||_0x2665c5['add'](_0x512341);}}};function pt(_0x46d79e){return _0x46d79e['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x46d79e['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x46d79e['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var gt=class extends _0x2e5ad8{static get requires(){return[_0xcbaa40,mt,nt];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class extends _0x654501{_collapseAt;constructor(_0x5e7e29,_0x536a21=0x6){super(_0x5e7e29);const _0x5ba877=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x536a21,this['bind']('isHidden')['to'](this,'usersCount',_0x5034d5=>_0x5034d5<_0x536a21),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x5ba877['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':_0x5ba877['to']('usersCount',_0x405997=>'+'+(_0x405997-this['_collapseAt']+0x2)['toString']())}]}]}]});}},vt=class extends _0x654501{items;keystrokes;constructor(_0x9f412f){super(_0x9f412f);const _0x2132f4=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x4d6505(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x2132f4['if']('hasPopup'),'aria-expanded':_0x2132f4['to']('isExpanded',_0x2c60d4=>this['hasPopup']&&String(_0x2c60d4)),'aria-label':_0x2132f4['to']('hasPopup',_0x378075=>X(_0x9f412f,_0x378075?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x2132f4['to']('hasPopup',_0x47a9b0=>!!_0x47a9b0&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items'],'on':{'mouseenter':_0x2132f4['to'](()=>this['fire']('presencelist:show')),'mouseleave':_0x2132f4['to'](_0x3e06d5=>{const _0x3a58ef=_0x3e06d5,_0x167f3b=document['querySelector']('.ck-presence-list__dropdown-list'),_0x51ffb9=document['querySelector']('.ck-balloon-panel_with-arrow');_0x167f3b?.['contains'](_0x3a58ef['relatedTarget'])||_0x51ffb9?.['contains'](_0x3a58ef['relatedTarget'])||this['fire']('presencelist:hide');})}}),this['on']('change:hasPopup',(_0x2bb560,_0x2b8607,_0x297c7f)=>{this['element']&&(_0x297c7f?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},_t=class extends _0x654501{counterView;inlineListView;constructor(_0x59f2f3,_0x50b11c=0x6){super(_0x59f2f3);const _0x1ca2c7=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new wt(this['locale'],_0x50b11c),this['inlineListView']=new vt(_0x59f2f3),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x55d27a of this['inlineListView']['items'])_0x55d27a['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',_0x1ca2c7['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},yt=class extends _0x654501{listWrapperView;constructor(_0x2fed8c,_0x4e085c){super(_0x2fed8c);const _0x525c5c=this['bindTemplate'];this['listWrapperView']=new bt(_0x2fed8c,_0x4e085c),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':X(_0x2fed8c,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']],'on':{'mouseleave':_0x525c5c['to'](_0x22eccd=>{const _0x10150a=_0x22eccd,_0x2bb140=document['querySelector']('.ck-presence-list__list'),_0x5c56d3=document['querySelector']('.ck-balloon-panel_with-arrow');_0x2bb140?.['contains'](_0x10150a['relatedTarget'])||_0x5c56d3?.['contains'](_0x10150a['relatedTarget'])||this['fire']('presencelist:hide');})}});}},bt=class extends _0x4d8a9f{constructor(_0x19e888,_0x41079d){super(_0x19e888);const _0x20c3df=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x41079d?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x20c3df['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x20c3df['to']('role'),'aria-label':_0x20c3df['to']('ariaLabel'),'aria-labelledby':_0x20c3df['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x427e20['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x250967=this['element'];_0x250967&&(this['_isScrollable']=Math['max'](_0x250967['scrollHeight'],_0x250967['clientHeight'])>0.8*window['innerHeight']);}},kt=class extends _0x536567{['userView'];constructor(_0x3b560d,_0x5a57d8,_0x346cef){super(_0x3b560d);const _0x5bc3b9=this['bindTemplate'];this['userView']=new _0x441670(_0x3b560d,_0x5a57d8);const _0x5f49b8={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x5a57d8['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x5a57d8['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x5a57d8['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x5a57d8['color']['getColorVariable'](),'--ck-user-color-alpha':_0x5a57d8['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x346cef&&(_0x5f49b8['tag']='button',_0x5f49b8['on']={'click':_0x5bc3b9['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x5f49b8);}['focus'](){this['element']['focus']();}},It=class extends _0x654501{['userView'];['markerView'];constructor(_0x11281b,_0xf03727,_0x873a58){super(_0x11281b);const _0x12780b=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x441670(_0x11281b,_0xf03727),this['markerView']=new St(_0x11281b,_0xf03727);const _0xab926a=new _0x22b7f8(_0x11281b);_0xab926a['template']['tag']='span',_0xab926a['text']=_0xf03727['name'];const _0xd90cf9={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x12780b['to']('isFocusable',_0x614d4f=>!!_0x614d4f&&0x0),'aria-labelledby':_0xab926a['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x12780b['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x12780b['to']('hasTooltip',_0x4cd1ea=>!_0x4cd1ea),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0xab926a]};_0x873a58&&(_0xd90cf9['tag']='button',_0xd90cf9['on']={'click':_0x12780b['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0xd90cf9);}},St=class extends _0x654501{constructor(_0x27a127,_0x58c0f7){super(_0x27a127),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x58c0f7['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x58c0f7['color']['getColorVariable'](),'--ck-user-color-alpha':_0x58c0f7['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Tt={'collapseAt':0x6,'displayMe':!0x0};var Ct=class extends _0x11ffbd{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_bodyCollection=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x347d6b){super(_0x347d6b),this['context']['config']['define']('presenceList',Tt);const _0x5202cb=_0x347d6b['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x5202cb)throw new _0x30c218('presencelist-collapseat-invalid-format',this);if(_0x5202cb<0x1)throw new _0x30c218('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Y)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x5b4d4a(),this['balloonPanelView']=new _0x2199bb(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Y];}init(){for(const _0x31cf6e of this['_allConnectedUsers'])this['_handleUserAdd'](_0x31cf6e);this['listenTo'](this['_allConnectedUsers'],'add',(_0xca830b,_0x5f20c7)=>{this['_handleUserAdd'](_0x5f20c7);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0xb3a4e3,_0x3bb63)=>{this['_handleUserRemove'](_0x3bb63);});}_createView(){const _0x41ee15=this['context'],_0x309ac4=new _t(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x32f0af=this['balloonPanelView'];if(!_0xc8a0f4(_0x41ee15['config']['get']('presenceList.container')))throw new _0x30c218('presencelist-missing-container',this);return _0x309ac4['counterView']['bind']('usersCount')['to'](this),_0x309ac4['bind']('isCollapsed')['to'](this,'usersCount',_0x56f002=>{const {collapseAt:_0x17748b}=_0x41ee15['config']['get']('presenceList'),_0x4dabbd=_0x56f002>=_0x17748b;if(_0x4dabbd&&!_0x309ac4['inlineListView']['items']['find'](_0x54336e=>_0x54336e instanceof wt)){const _0x6ed723=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x6ed723&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x309ac4['inlineListView']['items']['add'](_0x309ac4['counterView']);}return _0x4dabbd||this['hideDropdown'](),_0x4dabbd;}),_0x309ac4['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x31ddbe=>{const _0x1e74e4=_0x41ee15['config']['get']('presenceList'),_0x50511f=new It(_0x41ee15['locale'],_0x31ddbe,!!_0x1e74e4['onClick']);return _0x50511f['bind']('hasTooltip')['to'](_0x309ac4,'isCollapsed',_0x34f902=>!_0x34f902),_0x50511f['bind']('isFocusable')['to'](_0x309ac4,'isCollapsed',_0x2bc656=>!_0x2bc656),_0x1e74e4['onClick']&&this['listenTo'](_0x50511f,'execute',()=>{this['view']['isCollapsed']||_0x1e74e4['onClick'](_0x31ddbe,_0x50511f['element']);}),_0x50511f;}),this['listenTo'](_0x309ac4['inlineListView'],'presencelist:show',()=>{this['view']['isCollapsed']&&this['showDropdown']();}),this['listenTo'](_0x309ac4['inlineListView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();}),_0x309ac4['inlineListView']['keystrokes']['set']('Enter',(_0x17d435,_0x580d1b)=>{this['view']['isCollapsed']&&(this['showDropdown'](),_0x580d1b());}),_0x309ac4['render'](),_0x32f0af['render'](),_0x3b3d4f({'emitter':_0x309ac4,'activator':()=>_0x32f0af['isVisible'],'contextElements':[_0x32f0af['element'],_0x309ac4['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x41ee15['config']['get']('presenceList.container')['appendChild'](_0x309ac4['element']),this['_bodyCollection']=new _0x4262b2(this['context']['locale']),this['_bodyCollection']['attachToDom'](),this['_bodyCollection']['add'](this['balloonPanelView']),_0x309ac4;}['_handleUserAdd'](_0x519da1){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x519da1['isMe'])return;const _0x194a51=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x194a51-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x2da304=_0x519da1['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x519da1,_0x2da304);}['_handleUserRemove'](_0x4a75e9){this['usersCount']--;const {collapseAt:_0x5bfaf6}=this['context']['config']['get']('presenceList'),_0x406f3d=this['usersCount']>=_0x5bfaf6;if(this['currentDisplayedUsers']['get'](_0x4a75e9['id']))this['currentDisplayedUsers']['remove'](_0x4a75e9['id']);else{if(_0x406f3d&&this['currentDisplayedUsers']['length']+0x1===_0x5bfaf6-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x406f3d?0x1:0x0)<this['usersCount']){for(const _0x5dc64d of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x5dc64d['id'])&&(this['currentDisplayedUsers']['add'](_0x5dc64d,Math['min'](this['currentDisplayedUsers']['length']-(_0x406f3d?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x406f3d?0x1:0x0)===_0x5bfaf6-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x353b5a=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new yt(this['context']['locale'],!!_0x353b5a['onClick']),this['view']['inlineListView']['isExpanded']=!0x0,this['listenTo'](this['presenceDropdownView'],'presencelist:hide',()=>{this['presenceDropdownView']&&this['hideDropdown']();});const {listWrapperView:_0x2b03bf}=this['presenceDropdownView'];_0x2b03bf['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x302ccd=>{if(!_0x353b5a['displayMe']&&_0x302ccd['isMe'])return null;const _0x184e4b=new kt(this['context']['locale'],_0x302ccd,!!_0x353b5a['onClick']);return _0x353b5a['onClick']&&this['listenTo'](_0x184e4b,'execute',()=>{_0x353b5a['onClick'](_0x302ccd,_0x184e4b['element']);}),_0x184e4b;}),this['balloonPanelView']['content']['add'](this['presenceDropdownView']),this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element']}),_0x2b03bf['focus'](),_0x2b03bf['checkIfScrollable']();const _0x32fbce=(_0x35343a,_0x5237e4)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x5237e4();};_0x2b03bf['keystrokes']['set']('Esc',_0x32fbce),_0x2b03bf['keystrokes']['set']('Shift+Tab',_0x32fbce),_0x2b03bf['keystrokes']['set']('Tab',(_0x558511,_0x55e23c)=>{!function(_0x5bae6a){const _0x4780ad=['a','button','input','select','textarea','[tabindex]','[contenteditable]']['map'](_0x231189=>_0x231189+':not([disabled]):not([tabindex=\x22-1\x22])')['join'](','),_0x52acdd=[...document['body']['querySelectorAll'](_0x4780ad)]['filter'](_0x2c4f10=>_0x2c4f10===document['activeElement']||_0x2c4f10['offsetWidth']+_0x2c4f10['offsetHeight']>0x0)['sort']((_0x50ae50,_0x3b9539)=>(_0x50ae50['tabIndex']||0x0)-(_0x3b9539['tabIndex']||0x0)),_0x394b39=_0x52acdd[(_0x52acdd['indexOf'](_0x5bae6a)+0x1)%_0x52acdd['length']];_0x394b39&&_0x394b39['focus']();}(this['view']['element']),this['hideDropdown'](),_0x55e23c();}),_0x2b03bf['focusTracker']['add'](this['view']['element']),_0x2b03bf['focusTracker']['on']('change:isFocused',(_0x874a1e,_0x46bb33,_0x522b35)=>{_0x522b35||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_bodyCollection']&&(this['_bodyCollection']['detachFromDom'](),this['_bodyCollection']['destroy'](),this['_bodyCollection']=null);}},At=class extends _0x11ffbd{static get requires(){return[Y,Ct];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{ot as CloudServicesCommentsAdapter,mt as CloudServicesRevisionHistoryAdapter,ht as CloudServicesTrackChangesAdapter,At as PresenceList,Ct as PresenceListUI,tt as RealTimeCollaborationClient,ut as RealTimeCollaborativeComments,nt as RealTimeCollaborativeEditing,gt as RealTimeCollaborativeRevisionHistory,ft as RealTimeCollaborativeTrackChanges,Y as Sessions,z as WebSocketGateway};