@ckeditor/ckeditor5-real-time-collaboration 49.0.0-alpha.9 → 49.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/translations/af.umd.js +1 -1
  3. package/dist/translations/ar.umd.js +1 -1
  4. package/dist/translations/ast.umd.js +1 -1
  5. package/dist/translations/az.umd.js +1 -1
  6. package/dist/translations/be.umd.js +1 -1
  7. package/dist/translations/bg.umd.js +1 -1
  8. package/dist/translations/bn.umd.js +1 -1
  9. package/dist/translations/bs.umd.js +1 -1
  10. package/dist/translations/ca.umd.js +1 -1
  11. package/dist/translations/cs.umd.js +1 -1
  12. package/dist/translations/da.umd.js +1 -1
  13. package/dist/translations/de-ch.umd.js +1 -1
  14. package/dist/translations/de.umd.js +1 -1
  15. package/dist/translations/el.umd.js +1 -1
  16. package/dist/translations/en-au.umd.js +1 -1
  17. package/dist/translations/en-gb.umd.js +1 -1
  18. package/dist/translations/en.umd.js +1 -1
  19. package/dist/translations/eo.umd.js +1 -1
  20. package/dist/translations/es-co.umd.js +1 -1
  21. package/dist/translations/es.umd.js +1 -1
  22. package/dist/translations/et.umd.js +1 -1
  23. package/dist/translations/eu.umd.js +1 -1
  24. package/dist/translations/fa.umd.js +1 -1
  25. package/dist/translations/fi.umd.js +1 -1
  26. package/dist/translations/fr.umd.js +1 -1
  27. package/dist/translations/gl.umd.js +1 -1
  28. package/dist/translations/gu.umd.js +1 -1
  29. package/dist/translations/he.umd.js +1 -1
  30. package/dist/translations/hi.umd.js +1 -1
  31. package/dist/translations/hr.umd.js +1 -1
  32. package/dist/translations/hu.umd.js +1 -1
  33. package/dist/translations/hy.umd.js +1 -1
  34. package/dist/translations/id.umd.js +1 -1
  35. package/dist/translations/it.umd.js +1 -1
  36. package/dist/translations/ja.umd.js +1 -1
  37. package/dist/translations/jv.umd.js +1 -1
  38. package/dist/translations/kk.umd.js +1 -1
  39. package/dist/translations/km.umd.js +1 -1
  40. package/dist/translations/kn.umd.js +1 -1
  41. package/dist/translations/ko.umd.js +1 -1
  42. package/dist/translations/ku.umd.js +1 -1
  43. package/dist/translations/lt.umd.js +1 -1
  44. package/dist/translations/lv.umd.js +1 -1
  45. package/dist/translations/ms.umd.js +1 -1
  46. package/dist/translations/nb.umd.js +1 -1
  47. package/dist/translations/ne.umd.js +1 -1
  48. package/dist/translations/nl.umd.js +1 -1
  49. package/dist/translations/no.umd.js +1 -1
  50. package/dist/translations/oc.umd.js +1 -1
  51. package/dist/translations/pl.umd.js +1 -1
  52. package/dist/translations/pt-br.umd.js +1 -1
  53. package/dist/translations/pt.umd.js +1 -1
  54. package/dist/translations/ro.umd.js +1 -1
  55. package/dist/translations/ru.umd.js +1 -1
  56. package/dist/translations/si.umd.js +1 -1
  57. package/dist/translations/sk.umd.js +1 -1
  58. package/dist/translations/sl.umd.js +1 -1
  59. package/dist/translations/sq.umd.js +1 -1
  60. package/dist/translations/sr-latn.umd.js +1 -1
  61. package/dist/translations/sr.umd.js +1 -1
  62. package/dist/translations/sv.umd.js +1 -1
  63. package/dist/translations/th.umd.js +1 -1
  64. package/dist/translations/ti.umd.js +1 -1
  65. package/dist/translations/tk.umd.js +1 -1
  66. package/dist/translations/tr.umd.js +1 -1
  67. package/dist/translations/tt.umd.js +1 -1
  68. package/dist/translations/ug.umd.js +1 -1
  69. package/dist/translations/uk.umd.js +1 -1
  70. package/dist/translations/ur.umd.js +1 -1
  71. package/dist/translations/uz.umd.js +1 -1
  72. package/dist/translations/vi.umd.js +1 -1
  73. package/dist/translations/zh-cn.umd.js +1 -1
  74. package/dist/translations/zh.umd.js +1 -1
  75. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -20,9 +20,9 @@
20
20
  *
21
21
  *
22
22
  */
23
- import{Context as _0x2be8e3,ContextPlugin as _0x34398c,PendingActions as _0x29e1d0,Plugin as _0x423a3d}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x5c3d75,Collection as _0x1da6c7,DomEmitterMixin as _0x21794c,KeystrokeHandler as _0x15f4f2,getOverlayMountRoot as _0x464101,global as _0x2ef3b1,trustedHtml as _0x7d8c03,uid as _0x258125,version as _0x476e6c}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x4e8836,LabelView as _0x242656,ListItemView as _0x47215c,ListView as _0xadd891,Notification as _0x208c4a,OverlayHost as _0x35fbbe,View as _0x3498d3,clickOutsideHandler as _0x3cf34f}from'@ckeditor/ckeditor5-ui';import{History as _0x31ea40,InsertOperation as _0x2ba444,MarkerOperation as _0x3a9e6e,ModelLiveRange as _0x1d985f,NoOperation as _0x478618,OperationFactory as _0x1f2734,RootAttributeOperation as _0x5d5507,transformOperationSets as _0x3653f3}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x360986}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x23bff5,CommentsService as _0x4a16ff,EditorService as _0x100712,RevisionHistoryService as _0x4935ea,TrackChangesService as _0x4efdb1,User as _0x3786e3,WEB_SOCKET_GATEWAY_STATES as _0x2265bc,WebSocketGateway as _0x1ed494}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0x289284,Users as _0x45a2eb,isPointerStillOver as _0x3de2c2}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x2c797b}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x2e3025,TrackChangesEditing as _0x31f5e8}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x11e141,CommentsEditing as _0x3947f9,CommentsRepository as _0x2182ce}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0xa7ea16}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x17bcfc}from'es-toolkit/compat';var J=class WebSocketGateway extends _0x34398c{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
- ((()=>_0x1ed494)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x360986,_0x208c4a];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x51015d){super(_0x51015d),this['set']('state',_0x2265bc['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x21794c())();}init(){const _0x1766b1=this['context'],_0x4257ff=_0x1766b1['plugins']['get'](_0x360986),_0x1cf92c=_0x1766b1['plugins']['get'](_0x208c4a);if(!_0x4257ff['token'])throw new _0x5c3d75('websocketgateway-missing-token',this);if(!_0x4257ff['webSocketUrl'])throw new _0x5c3d75('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'](_0x4257ff['token'],_0x4257ff['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0xeb5246=>{if(this['connection']=_0xeb5246,this['bind']('state')['to'](_0xeb5246,'state',this,'_isBrowserOffline',(_0x56c1ef,_0x42db71)=>('connected'!==_0x56c1ef&&(this['_shouldPluginsReconnect']=!0x0),_0x42db71||_0x56c1ef!==_0x2265bc['CONNECTED']?_0x2265bc['DISCONNECTED']:this['state']==_0x2265bc['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x2265bc['CONNECTING']):_0x2265bc['CONNECTED'])),this['connection']['on']('error',(_0x2bef85,_0x31be35)=>{if('limitExceeded'!==_0x31be35['code'])throw console['error'](_0x31be35),new _0x5c3d75('cloudservices-init',null,{'originalError':_0x31be35});_0x1cf92c['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'});}),!_0xeb5246['me'])return new Promise(_0x2e4fcb=>_0xeb5246['on']('change:me',_0x2e4fcb));})['catch'](_0xefe07f=>{throw console['error'](_0xefe07f),new _0x5c3d75('cloudservices-init',null,{'originalError':_0xefe07f});});}addToReconnectionStack(_0x497029){if('function'!=typeof _0x497029['reconnect'])throw new _0x5c3d75('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x497029))throw new _0x5c3d75('websocketgateway-plugin-already-registered',this,{'name':_0x497029['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x497029);}removeFromReconnectionStack(_0x312680){this['_reconnectionStack']['delete'](_0x312680);}isInReconnectionStack(_0x1ae9b8){return this['_reconnectionStack']['has'](_0x1ae9b8);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x5b66a7=>_0x5b66a7['reconnect']())))['then'](()=>this['state']=_0x2265bc['CONNECTED'])['catch'](_0x3d5d27=>{throw console['error'](_0x3d5d27),new _0x5c3d75('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x2265bc['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x34398c{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[J,_0x45a2eb];}constructor(_0x1fe319){super(_0x1fe319),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x1da6c7(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x45a2eb);}init(){const _0x2f5c30=this['context']['plugins']['get'](J);this['listenTo'](_0x2f5c30,'change:state',(_0x309aa0,_0x2007a7,_0xbda926)=>{if('connected'!==_0xbda926)this['channelSessions']['forEach'](_0x16773c=>_0x16773c['clear']()),this['channelConnectedUsers']['forEach'](_0x5b0981=>_0x5b0981['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x1d07a2,_0x40b37b]of this['_registeredSessions'])for(const _0x396660 of _0x40b37b)this['_handleSessionAdd'](_0x1d07a2,_0x396660);}}),this['_createUser'](_0x2f5c30['connection']['me'],!0x0);}register(_0x38f1e8,_0x3f662a){if(this['_registeredSessions']['has'](_0x38f1e8))throw new _0x5c3d75('sessions-register-already-registered',null,{'channelId':_0x38f1e8});this['_registeredSessions']['set'](_0x38f1e8,_0x3f662a),this['channelSessions']['set'](_0x38f1e8,new _0x1da6c7()),this['channelConnectedUsers']['set'](_0x38f1e8,new _0x1da6c7()),this['listenTo'](_0x3f662a,'add',(_0x18ca2e,_0x568bee)=>this['_handleSessionAdd'](_0x38f1e8,_0x568bee)),this['listenTo'](_0x3f662a,'remove',(_0x462f18,_0x2a37fa)=>this['_handleSessionRemove'](_0x38f1e8,_0x2a37fa));for(const _0x2040b7 of _0x3f662a)this['_handleSessionAdd'](_0x38f1e8,_0x2040b7);}unregister(_0x596ad1){if(!this['_registeredSessions']['has'](_0x596ad1))throw new _0x5c3d75('sessions-unregister-not-exist',null,{'channelId':_0x596ad1});const _0x1e499e=this['_registeredSessions']['get'](_0x596ad1);this['stopListening'](_0x1e499e);for(const _0x5c5746 of _0x1e499e)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x596ad1,_0x5c5746);this['_registeredSessions']['delete'](_0x596ad1),this['channelSessions']['delete'](_0x596ad1),this['channelConnectedUsers']['delete'](_0x596ad1);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0x2c63c1){for(const _0x325348 of this['channelSessions']['values']())for(const _0x528a14 of _0x325348)if(_0x528a14['id']===_0x2c63c1)return _0x528a14['user'];}getUserSessions(_0x2f6ee9,_0x4c7682){const _0xb45c67=_0x4c7682?[this['channelSessions']['get'](_0x4c7682)]:this['channelSessions']['values'](),_0x400897=new Set();for(const _0x2de164 of _0xb45c67)for(const _0x9708e8 of _0x2de164)_0x9708e8['user']['id']===_0x2f6ee9['id']&&_0x400897['add'](_0x9708e8['id']);return _0x400897;}getUserRole(_0x16d137){for(const _0x3a4038 of this['channelSessions']['values']())for(const _0x33017a of _0x3a4038)if(_0x33017a['user']===_0x16d137)return _0x33017a['role'];}['_handleSessionAdd'](_0x5894fd,_0x29d77f){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x19430f=_0x29d77f['user'],_0x43fd4b=this['_users']['getUser'](_0x19430f['id'])||this['_createUser'](_0x19430f),_0x5a9149=Object['assign']({},_0x29d77f,{'user':_0x43fd4b});if(this['channelSessions']['get'](_0x5894fd)['add'](_0x5a9149),!_0x19430f['hiddenInPresenceList']){const _0x1c7174=this['channelConnectedUsers']['get'](_0x5894fd);_0x1c7174['has'](_0x43fd4b['id'])||_0x1c7174['add'](_0x43fd4b),this['allConnectedUsers']['has'](_0x43fd4b['id'])||_0x19430f['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0x43fd4b,_0x43fd4b['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x5894fd,{'channelId':_0x5894fd,'session':_0x5a9149});}['_handleSessionRemove'](_0x30cc20,_0x56e97f){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x19066e=this['channelConnectedUsers']['get'](_0x30cc20),_0x6c4fdc=_0x56e97f['user'];_0x6c4fdc['id']&&(this['channelSessions']['get'](_0x30cc20)['remove'](_0x56e97f['id']),_0x19066e['has'](_0x6c4fdc['id'])&&!this['getUserSessions'](_0x6c4fdc,_0x30cc20)['size']&&_0x19066e['remove'](_0x6c4fdc['id']),this['allConnectedUsers']['get'](_0x6c4fdc['id'])&&!this['getUserSessions'](_0x6c4fdc)['size']&&this['allConnectedUsers']['remove'](_0x6c4fdc['id']));}_createUser(_0x36c3cf,_0x236a77){const _0x9005f1=this['_users']['addUser'](_0x36c3cf);return _0x236a77&&this['_users']['defineMe'](_0x36c3cf['id']),_0x9005f1['orderNumber']=this['_uniqueUsersCount']++,_0x9005f1;}},X=class extends _0x423a3d{_domEmitter=new(_0x21794c())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x41ce88=this['editor'],_0x2839a3=_0x41ce88['plugins']['get'](Q);_0x41ce88['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x5562bd,{writer:_0x221b61})=>function(_0x3a2983,_0x11fe20,_0x29cc24,_0x22420e){const _0x38a8c8=_0x3a2983['markerName']['split'](':')[0x2],_0x331063=_0x29cc24['getUserBySessionId'](_0x38a8c8);if(!_0x331063||_0x38a8c8===_0x29cc24['mySessionId'])return;if(!_0x22420e['model']['schema']['checkChild'](_0x3a2983['markerRange']['start'],'$text'))return;const _0x33f9c1={'class':'ck-user__marker\x20'+_0x331063['color']['getMarkerClass'](),'style':tt(_0x331063),'data-name':_0x331063['name'],'data-session-id':_0x38a8c8},_0x5ef861=_0x22420e['model']['markers']['get'](_0x3a2983['markerName'])['getStart'](),_0x1d16d8=_0x5ef861['nodeAfter'],_0x122534=_0x22420e['model']['schema'];if(_0x1d16d8&&_0x122534['isObject'](_0x1d16d8)&&_0x122534['isInline'](_0x1d16d8)&&!_0x22420e['model']['markers']['get']('user:range:'+_0x38a8c8)['getRange']()['isCollapsed'])return;const _0x56cc17=_0x5ef861['parent'];return _0x22420e['model']['schema']['isLimit'](_0x56cc17)&&!_0x22420e['model']['hasContent'](_0x56cc17)&&(_0x33f9c1['contenteditable']=!0x1),function(_0x28bfa6,_0x3e6df9,_0xb9c1ba){const _0x4b55cf=_0x28bfa6['createUIElement']('span',_0x3e6df9);return _0x28bfa6['setCustomProperty']('userPositionMarker',!0x0,_0x4b55cf),_0x4b55cf['render']=function(_0x23ec81){const _0x4227d9=this['toDomElement'](_0x23ec81),_0x515a58=document['createElement']('span');return _0x515a58['classList']['add']('ck-user__marker-tooltip'),_0x515a58['setAttribute']('contenteditable','false'),_0x515a58['setAttribute']('spellcheck','false'),_0x515a58['textContent']=_0xb9c1ba['name'],_0x4227d9['innerHTML']=_0x7d8c03('⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x515a58['outerHTML']+'⁠'),_0x4227d9['addEventListener']('mouseenter',()=>{_0x4227d9['classList']['add']('ck-user__marker_hovered');}),_0x4227d9['addEventListener']('mouseleave',()=>{_0x4227d9['classList']['remove']('ck-user__marker_hovered');}),_0x4227d9;},_0x4b55cf['isSimilar']=function(_0xc8824f){return!(!this['getCustomProperty']('userPositionMarker')||!_0xc8824f['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0xc8824f['getAttribute']('data-session-id'));},_0x4b55cf;}(_0x11fe20,_0x33f9c1,_0x331063);}(_0x5562bd,_0x221b61,_0x2839a3,_0x41ce88)}),_0x41ce88['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x842bff=>function(_0x31c682,_0x388e46){const _0x480657=_0x31c682['markerName']['split'](':')[0x2];if(_0x480657===_0x388e46['mySessionId'])return null;const _0x2dde9b=_0x388e46['getUserBySessionId'](_0x480657);return _0x2dde9b?{'id':_0x480657,'classes':['ck-user__selection',_0x2dde9b['color']['getSelectionClass']()],'attributes':{'style':tt(_0x2dde9b),'data-session-id':_0x480657},'priority':0x7d0+_0x2dde9b['orderNumber']}:{'id':_0x480657,'classes':[]};}(_0x842bff,_0x2839a3)}),function(_0x58df40){const _0x283791=_0x58df40['model'],_0xe30cf0=new Map(),_0x5e2fa6=_0x58df40['plugins']['get'](Q);_0x283791['markers']['on']('update:user:range',(_0x18e308,_0x2b3b3b,_0x4b7cf4,_0x49cc89)=>{if(!_0x49cc89&&_0xe30cf0['get'](_0x2b3b3b['name']))return _0xe30cf0['get'](_0x2b3b3b['name'])['detach'](),void _0xe30cf0['delete'](_0x2b3b3b['name']);const _0x3cf59f=_0x2b3b3b['name']['split'](':')[0x2];if(_0x3cf59f===_0x5e2fa6['mySessionId'])return;const _0x4c8973='user:position:'+_0x3cf59f;_0x283791['markers']['has'](_0x4c8973)&&_0x58df40['editing']['reconvertMarker'](_0x4c8973),_0x2b3b3b['on']('change:range',(_0x24267a,_0x3a3817,_0x3c04f2)=>{if('$graveyard'!=_0x3a3817['root']['rootName']&&'$graveyard'==_0x2b3b3b['getRange']()['root']['rootName']&&!_0xe30cf0['has'](_0x2b3b3b['name'])){const _0x4f89ef=_0x283791['schema']['getNearestSelectionRange'](_0x3c04f2['deletionPosition']);if(_0x4f89ef){const _0x397168=_0x1d985f['fromRange'](_0x4f89ef);_0xe30cf0['set'](_0x2b3b3b['name'],_0x397168),_0x397168['on']('change:range',(_0x15afc4,_0x486077,_0x516135)=>{if('$graveyard'==_0x397168['root']['rootName']){const _0x4cb50f=_0x283791['schema']['getNearestSelectionRange'](_0x516135['deletionPosition']);_0x4cb50f?(_0x397168['start']=_0x4cb50f['start'],_0x397168['end']=_0x4cb50f['end']):(_0xe30cf0['delete'](_0x2b3b3b['name']),_0x397168['detach']());}});}}});}),_0x283791['document']['on']('change',()=>{_0xe30cf0['size']>0x0&&_0x283791['enqueueChange']({'isUndoable':!0x1},_0x2fc3ca=>{for(const [_0x5d703e,_0x4fc197]of _0xe30cf0)'$graveyard'==_0x283791['markers']['get'](_0x5d703e)['getRange']()['root']['rootName']&&(Z(_0x5d703e['split'](':')[0x2],_0x4fc197['toRange'](),_0x283791,_0x2fc3ca),_0x4fc197['detach']());_0xe30cf0['clear']();});});}(_0x41ce88),this['_domEmitter']['listenTo'](_0x2ef3b1['document'],'keydown',(_0x903beb,{key:_0x27f651})=>{'Escape'===_0x27f651&&function(_0x103dca){_0x103dca['editing']['view']['change'](_0x4c1a6c=>{for(const _0x73771d of _0x103dca['model']['markers']){if(!_0x73771d['name']['startsWith']('user:position'))continue;const _0x599e4c=_0x103dca['editing']['mapper']['markerNameToElements'](_0x73771d['name']);if(_0x599e4c){for(const _0x20a3e9 of _0x599e4c)_0x4c1a6c['removeClass']('ck-user__marker_hovered',_0x20a3e9);}}});}(_0x41ce88);},{'useCapture':!0x0});}afterInit(){const _0x202ca0=this['editor'],_0x328640=_0x202ca0['commands']['get']('undo');_0x328640&&_0x202ca0['model']['on']('applyOperation',(_0x30074a,_0x269ffc)=>{const _0x1f13ee=_0x269ffc[0x0];if(!_0x1f13ee['isDocumentOperation'])return;if('marker'!=_0x1f13ee['type']||!_0x1f13ee['name']['startsWith']('user:'))return;const _0x106368=_0x1f13ee['batch'];_0x328640['_createdBatches']['has'](_0x106368)&&(_0x1f13ee['newRange']=_0x1f13ee['oldRange']?_0x202ca0['model']['createRange'](_0x1f13ee['oldRange']['start'],_0x1f13ee['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x24dab0=this['editor'],_0x469500=_0x24dab0['model']['document'],_0x49a225=_0x24dab0['plugins']['get'](Q);_0x24dab0['model']['enqueueChange']({'isUndoable':!0x1},_0x1a0998=>{const _0x399890='user:range:'+_0x49a225['mySessionId'],_0x97369a='user:position:'+_0x49a225['mySessionId'],_0x55b2c5=_0x24dab0['model']['markers']['has'](_0x399890);_0x24dab0['editing']['view']['hasDomSelection']?Z(_0x49a225['mySessionId'],_0x469500['selection']['getFirstRange'](),_0x24dab0['model'],_0x1a0998):_0x55b2c5&&(_0x1a0998['removeMarker'](_0x399890),_0x1a0998['removeMarker'](_0x97369a));});}};function Z(_0x97f627,_0xe87c24,_0x4fa6ca,_0x3b281b){const _0x31c71a='user:range:'+_0x97f627,_0x384cb6='user:position:'+_0x97f627,_0x1bd80c=_0xe87c24['getContainedElement']();let _0x299e52=_0xe87c24['start'];if(_0x1bd80c&&_0x1bd80c['is']('element','tableCell')){const _0x34927e=function(_0x8b0ec3,_0x2f1c01){for(const _0x24a7e1 of _0x8b0ec3['getPositions']())if(_0x2f1c01['schema']['checkChild'](_0x24a7e1,'$text'))return _0x24a7e1;}(_0xe87c24,_0x4fa6ca);_0x34927e&&(_0x299e52=_0x34927e,_0xe87c24=_0x3b281b['createRange'](_0x299e52));}const _0x387adf=_0x3b281b['createRange'](_0x299e52);_0x4fa6ca['markers']['has'](_0x31c71a)?(_0x3b281b['updateMarker'](_0x31c71a,{'range':_0xe87c24}),_0x3b281b['updateMarker'](_0x384cb6,{'range':_0x387adf})):(_0x3b281b['addMarker'](_0x31c71a,{'range':_0xe87c24,'usingOperation':!0x0}),_0x3b281b['addMarker'](_0x384cb6,{'range':_0x387adf,'usingOperation':!0x0}));}function tt(_0x1cf85c){return'--ck-user-color:'+_0x1cf85c['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x1cf85c['color']['getColorAlphaVariable']()+';';}function et(_0xc63a8b,_0x4632e7,_0x4ed3ca){const _0x101f19=_0xc63a8b['t'],t=_0xc63a8b['t'];switch(_0x4632e7){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 _0x101f19({'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'},_0x4ed3ca);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x423a3d{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
- ((()=>_0x23bff5)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[J,Q,X,_0x29e1d0,_0x45a2eb,_0x208c4a];}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 _0x394a5f=this['serverHistory']['getOperations']();for(let _0x4af9d6=_0x394a5f['length']-0x1;_0x4af9d6>=0x0;_0x4af9d6--){const _0x2bac3f=_0x394a5f[_0x4af9d6];if(!this['_disconnectionOperations']['has'](_0x2bac3f))return _0x2bac3f['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x434e3b){if(super(_0x434e3b),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x31ea40(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x5c3d75('collaboration-missing-channelid',this);const _0x515465=_0x434e3b['config']['get']('cloudServices.bundleVersion')||_0x476e6c;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0x515465,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x2c797b(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new rt(this['_disconnectionOperations']);}init(){const _0x523e4a=this['editor'],_0x5e7fac=_0x523e4a['plugins']['get'](_0x45a2eb),_0x580bf6=_0x523e4a['plugins']['get'](J);this['listenTo'](_0x5e7fac,'getOperationAuthor',(_0x592b08,_0x530ee8)=>{const _0x9c0dc2=_0x530ee8[0x0];_0x9c0dc2['_authorId']&&(_0x592b08['return']=_0x5e7fac['getUser'](_0x9c0dc2['_authorId']),_0x592b08['stop']()),null===_0x9c0dc2['_authorId']&&(_0x592b08['return']=null,_0x592b08['stop']());},{'priority':'high'}),this['listenTo'](_0x523e4a['model']['document']['selection'],'change:range',(_0x5c4800,_0x16510c)=>{_0x16510c['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x523e4a['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x523e4a['model']['on']('applyOperation',(_0x457385,_0x259183)=>{const _0x4336bb=_0x259183[0x0];_0x4336bb['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x4336bb),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x580bf6,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x914119,_0xeda2af,_0x93263c)=>'connected'===_0x914119&&!_0xeda2af&&!_0x93263c),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x523e4a['disableReadOnlyMode']('rtc-offline'):_0x523e4a['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x523e4a['disableReadOnlyMode']('rtc-offline'):_0x523e4a['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x23f53a=this['editor']['plugins']['get'](Q),_0x47940d=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0x23f53a['unregister'](this['_channelId']);const _0x167d7c=await this['_service']['reconnect'](_0x47940d['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x167d7c)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x580efc=await this['_service']['getConnectedSessions']();_0x23f53a['register'](this['_channelId'],_0x580efc),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x177fd0){if(function(_0x24f5d1){return'404'===_0x24f5d1['code'];}(_0x177fd0)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x431ee8){return'409'===_0x431ee8['code'];}(_0x177fd0)){const _0x39eb42=et(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x39eb42);}else{if(!(_0x177fd0 instanceof nt))throw _0x177fd0;this['_handleReconnectionError']();}}}}destroy(){const _0x2f4703=this['editor']['plugins']['get'](J),_0x19eeb6=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x19eeb6['channelSessions']['has'](this['_channelId'])&&_0x19eeb6['unregister'](this['_channelId']),_0x2f4703['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x234c53){if(this['sessionId']!==_0x234c53['sessionId']&&this['_lastSyncedOperationId']!==_0x234c53['lastOperationId'])throw new nt();return this['sessionId']=_0x234c53['sessionId'],this['_handleServerResponse']([],{..._0x234c53,'wereChangesApplied':!0x1,'data':_0x234c53['data']},'reconnect');}async _connectService(_0xdda5c9,_0x40752a=!0x1){const {connection:_0x3e7223}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0x3e7223,this['_channelId'])['then'](_0xccd6d9=>this['_initSessionsHandling'](_0xccd6d9))['catch'](_0x577248=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x577248);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x532149,_0x420769)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x420769);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x42fa0f=this['_operationIdentifier']['getIdOfTheLastOperation'](_0xdda5c9);this['_isPendingUpdate']=!0x0;const _0x3cc33a=await this['_service']['connect'](_0x3e7223,this['_compressOperations'](_0xdda5c9),_0x42fa0f);if(this['sessionId']=_0x3cc33a['sessionId'],_0x40752a){if(!_0x3cc33a['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x3cc33a['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0xdda5c9,_0x3cc33a,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x3cc33a,_0xdda5c9);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x529340=this['editor']['plugins']['get'](Q),_0x3a4071=this['editor']['plugins']['get'](X),_0x101189=_0x529340['channelSessions']['get'](this['_channelId']);_0x101189&&_0x101189['length']>0x1?_0x3a4071['createUserMarkerOperations']():this['listenTo'](_0x529340,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x529340['channelSessions']['get'](this['_channelId'])['length']&&_0x3a4071['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x4c3d9d,_0x41abf2,_0x3563f9,_0x532385){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x41abf2){const _0x58cd2c=this['_decompressOperations'](_0x3563f9,_0x532385);await this['_fetchMissingUsers'](_0x58cd2c),this['_handleExternalOperations'](_0x58cd2c,_0x41abf2,_0x3563f9['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x372fb3}=this['editor'];let _0x43382b;try{_0x43382b=await this['_service']['getDocumentDetails']();}catch{const _0x99ef72=et(_0x372fb3,'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'](_0x99ef72);}const _0x4c4a78=_0x43382b['currentDocumentSession']||_0x43382b['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x4c4a78['lastOperationId']){const _0x1e7fe0=et(_0x372fb3,'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'](_0x1e7fe0);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x263a55=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0x263a55['connection']||'connected'!==_0x263a55['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x329e1b=this['editor']['plugins']['get'](Q);_0x329e1b['channelSessions']['has'](this['_channelId'])&&_0x329e1b['unregister'](this['_channelId']),_0x263a55['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x1adc4d){const _0x178804=this['editor']['plugins']['get'](Q);this['listenTo'](_0x178804,'sessionAdd:'+this['_channelId'],(_0x5aee65,{session:_0x3ff1f6})=>{if(_0x3ff1f6['id']===_0x178804['mySessionId']){_0x5aee65['off']();const _0x5c04d1=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x4697ad=_0x3ff1f6['permissions'];_0x5c04d1&&_0x5c04d1['isEnabled']&&(_0x4697ad=_0x4697ad['filter'](_0x1f546b=>'document:write'!==_0x1f546b)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x4697ad,this['_channelId']);}}),_0x178804['register'](this['_channelId'],_0x1adc4d);}_initThrowingOnDataSet(){const _0x29dc5f=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x5543f2)=>{if(!_0x5543f2[_0x5543f2['length']-0x1]['suppressErrorInCollaboration'])throw new _0x5c3d75('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x29dc5f['apply'](this['editor']['data'],_0x5543f2);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x550487,[_0x4de9a8])=>{if(this['_document']['version'])throw new _0x5c3d75('realtimecollaborationclient-init-document-already-initialized',this);_0x550487['stop'](),this['_setPendingAction']();const _0x56736b=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x14fb76])=>!_0x14fb76['lazyLoad'])['map'](([_0x5fe70b,_0x1dc2fb])=>[_0x5fe70b,_0x1dc2fb['modelAttributes']||{}])),_0x44f3e5=this['_getOperationsFromInitData'](_0x4de9a8,_0x56736b);0x0==_0x44f3e5['length']&&_0x44f3e5['push'](new _0x478618(0x0)),_0x550487['return']=this['_connectService'](_0x44f3e5)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x38f4b2=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x38f4b2))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x284066,[_0x2cc54b,_0x4610db])=>{_0x284066['stop']();const _0xbc7bd8=this['editor']['model']['document']['getRoot'](_0x2cc54b);if(!this['_knownRootNames']['has'](_0x2cc54b)){const _0x3e2f82=_0x4610db&&_0x4610db['data']?_0x4610db['data']:'',_0x57f427=_0x4610db&&_0x4610db['attributes']?_0x4610db['attributes']:{};await this['_loadRoot'](_0x2cc54b,_0x3e2f82,_0x57f427);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0xbc7bd8['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0xbc7bd8);});},{'priority':'high'});}async _fetchMissingUsers(_0x4430b2){const _0x32d37e=this['editor']['plugins']['get'](_0x45a2eb),{connection:_0x1b9b5e}=this['editor']['plugins']['get'](J),_0x59a44c=new Set();for(const _0x3568a8 of _0x4430b2){const _0xcf6a7=_0x3568a8['_authorId'];_0xcf6a7&&!_0x32d37e['getUser'](_0xcf6a7)&&_0x59a44c['add'](_0xcf6a7);}if(0x0===_0x59a44c['size'])return;const _0x278fdc=await _0x3786e3['getMany'](_0x1b9b5e,Array['from'](_0x59a44c));for(const _0x383aef of _0x278fdc)_0x32d37e['getUser'](_0x383aef['id'])||_0x32d37e['addUser'](_0x383aef);}_getOperationsFromInitData(_0x537a22,_0x4936d4={}){const _0x34914e=this['editor']['model'],_0x4766e8=[];let _0x4c5a97=0x0;const _0x123530='string'==typeof _0x537a22?{'main':_0x537a22}:_0x537a22;for(const _0x4977f9 of Object['keys'](_0x123530)){if(!this['_document']['roots']['has'](_0x4977f9))throw new _0x5c3d75('realtimecollaborationclient-init-non-existent-root',this);const _0x50929e=this['_document']['getRoot'](_0x4977f9),_0x569440=this['editor']['data']['parse'](_0x123530[_0x4977f9],_0x50929e),_0x4a7a1d=new _0x2ba444(_0x34914e['createPositionAt'](_0x50929e,0x0),_0x569440,_0x4c5a97++);_0x4766e8['push'](_0x4a7a1d);for(const [_0x3f5e4c,_0x468c7b]of _0x569440['markers']){const _0x261933=_0x34914e['createRange'](_0x34914e['createPositionFromPath'](_0x50929e,_0x468c7b['start']['path']['slice']()),_0x34914e['createPositionFromPath'](_0x50929e,_0x468c7b['end']['path']['slice']())),_0x33a1e6=new _0x3a9e6e(_0x3f5e4c,null,_0x261933,_0x34914e['markers'],!0x0,_0x4c5a97++);_0x4766e8['push'](_0x33a1e6);}}if(_0x4936d4)for(const [_0x478460,_0x1b749e]of Object['entries'](_0x4936d4)){const _0x1d4a66=_0x34914e['document']['getRoot'](_0x478460);if(!_0x1d4a66)throw new _0x5c3d75('multi-root-editor-root-attributes-no-root',null);for(const [_0x502e1b,_0x4a8db7]of Object['entries'](_0x1b749e))if(null!==_0x4a8db7){const _0x155ce4=new _0x5d5507(_0x1d4a66,_0x502e1b,null,_0x4a8db7,_0x4c5a97++);_0x4766e8['push'](_0x155ce4);}}return _0x4766e8;}async _loadRoot(_0x23461d,_0x3b74a1,_0x2bc8ed){this['_getOperationsFromInitData']({[_0x23461d]:_0x3b74a1},{[_0x23461d]:_0x2bc8ed})['forEach']((_0x242cbc,_0x7c6bee)=>{_0x242cbc['baseVersion']=this['_document']['version']+_0x7c6bee,_0x242cbc['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x242cbc);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x54b994,_0x29fa47){let _0x17587a;this['_offset']=_0x54b994['offset'];const _0x300d15=_0x54b994['wereChangesApplied']&&!_0x54b994['initData'],_0xc853dc=_0x300d15?0x0:_0x54b994['data']['baseVersion'];if(_0x29fa47['forEach'](_0x5eab9c=>{_0x5eab9c['_isInit']=!0x0,_0x5eab9c['createdAt']=_0x54b994['sessionCreatedAt'],_0x5eab9c['_authorId']=null;}),_0x300d15)_0x17587a=_0x29fa47,this['_applyOperationsSet'](_0x17587a,_0x300d15);else{if(_0x54b994['initData']){const _0x41d2ec=this['_getOperationsFromInitData'](_0x54b994['initData']);this['_document']['history']['version']=-_0x41d2ec['length'],_0x41d2ec['forEach'](_0x17e29a=>{_0x17e29a['baseVersion']-=_0x41d2ec['length'],_0x17e29a['createdAt']=_0x54b994['sessionCreatedAt'],_0x17e29a['_isInit']=!0x0,_0x17e29a['_authorId']=null;}),this['_applyOperationsSet'](_0x41d2ec,!0x0),this['serverHistory']['version']=-_0x41d2ec['length']+this['_offset'],this['_updateServerHistory'](_0x41d2ec);}this['_document']['history']['version']=_0xc853dc,_0x17587a=this['_decompressOperations'](_0x54b994['data'],_0x54b994['metadata']),await this['_fetchMissingUsers'](_0x17587a),this['_applyOperationsSet'](_0x17587a,_0x300d15);}_0x54b994['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x17587a,_0x54b994['lastOperationId']),this['_lastSyncedOperationId']=_0x54b994['lastOperationId']),this['serverHistory']['version']=_0xc853dc+this['_offset'],this['_updateServerHistory'](_0x17587a),_0x29fa47['filter'](_0x5f677b=>{const _0x552f64=this['_getAffectedRoot'](_0x5f677b);return _0x552f64&&!this['_knownRootNames']['has'](_0x552f64);})['forEach']((_0x38c2ab,_0x4def9f)=>{_0x38c2ab['baseVersion']=this['_document']['version']+_0x4def9f,this['_saveOperationInBuffer'](_0x38c2ab);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x145365,_0x10b48c){const _0x3aec39=_0x10b48c&&_0x10b48c['message'];if(_0x3aec39&&_0x3aec39['startsWith']('realtimecollaborationclient'))throw _0x10b48c;const _0x552583=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0x552583['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x5c3d75(_0x145365,this['editor'],_0x3aec39?{'originalError':_0x3aec39}:void 0x0);}_saveOperationInBuffer(_0x448f8a){this['_knownOperations']['has'](_0x448f8a)||(this['_knownOperations']['add'](_0x448f8a),this['_bufferedOperations']['push'](_0x448f8a),this['_pendingAction']||'marker'==_0x448f8a['type']&&!_0x448f8a['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0xfc24a1=!0x1){!_0xfc24a1&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x3cf171=>{_0x3cf171&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x30a3c1=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x1c1741){return _0x1c1741['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x1c1741['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x1c1741['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x30a3c1)||this['_crash'](_0x30a3c1['message'],_0x30a3c1);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x3a477f=>{this['on']('change:_isPendingUpdate',()=>{_0x3a477f();});});}async _sendBufferedOperations(){const _0x47eb19=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0x47eb19['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0x3eaf90=[...this['_bufferedOperations']];for(const _0x25809f of _0x3eaf90)_0x25809f['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x25809f);const _0x363267=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x3eaf90),_0x48ad2f=st++,_0x30da7d=this['_compressOperations'](_0x3eaf90),_0x2958a0=await this['_service']['sendOperations'](_0x30da7d,_0x30da7d['baseVersion'],_0x363267);try{return await this['_handleServerResponse'](_0x3eaf90,_0x2958a0,_0x48ad2f);}catch(_0x319e81){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x319e81);}}async['_handleServerResponse'](_0x1451d5,_0x264af8,_0x125a73){if('error'in _0x264af8)throw _0x264af8['error'];let _0x360231;if(_0x264af8['wereChangesApplied']){_0x264af8['lastOperationId']&&(this['_lastSyncedOperationId']=_0x264af8['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x4d97db=>!_0x1451d5['includes'](_0x4d97db));for(const _0x45b192 of _0x1451d5)_0x45b192['createdAt']='lastOperationAcceptedAt'in _0x264af8&&_0x264af8['lastOperationAcceptedAt']||void 0x0;ot(_0x1451d5,_0x264af8['version']-_0x1451d5['length']),this['_updateServerHistory'](_0x1451d5);const _0x5232e9=_0x1451d5['filter'](_0x24106c=>{if(!_0x24106c['_isInit'])return!0x1;const _0x4acb7a=this['_getAffectedRoot'](_0x24106c);return _0x4acb7a&&!this['_knownRootNames']['has'](_0x4acb7a);});ot(_0x5232e9,this['_document']['version']),this['_applyOperationsSet'](_0x5232e9),_0x360231=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x4902b0=this['_decompressOperations'](_0x264af8['data'],_0x264af8['metadata'])['filter'](_0x450b05=>_0x450b05['baseVersion']>=this['_lastServerVersion']);_0x4902b0['forEach'](_0x51955f=>this['_addKnownRoot'](_0x51955f)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x54ac20=>!_0x54ac20['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x54ac20))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x4902b0),_0x360231=this['_handleExternalOperations'](_0x4902b0,_0x264af8['version'],_0x264af8['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x360231?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x5bddea,_0xff2f2f,_0x9e2210){try{const _0x248661={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x6ae19a,operationsB:_0x3055a3,originalOperations:_0x264503}=_0x3653f3(_0x5bddea,this['_bufferedOperations'],_0x248661);ot(_0x6ae19a,this['_document']['version']),ot(_0x3055a3,_0xff2f2f);for(const _0x5acbfe of _0x6ae19a){const _0x1a0495=_0x264503['get'](_0x5acbfe);_0x1a0495?(_0x5acbfe['_authorId']=_0x1a0495['_authorId'],'noop'!==_0x5acbfe['type']&&(_0x5acbfe['_aiSource']=_0x1a0495['_aiSource'])):_0x5acbfe['_authorId']=null;}for(const _0xd47cf0 of _0x3055a3)'noop'!==_0xd47cf0['type']&&(_0xd47cf0['_aiSource']=_0x264503['get'](_0xd47cf0)?.['_aiSource']);_0x9e2210&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x5bddea,_0x9e2210),this['_lastSyncedOperationId']=_0x9e2210),this['_bufferedOperations']=[..._0x3055a3],this['_applyOperationsSet'](_0x6ae19a),this['_updateServerHistory'](_0x5bddea);}catch(_0x1bafb1){return console['error'](_0x1bafb1),!0x1;}return!0x0;}_applyOperationsSet(_0xf6ff69,_0x4a8a2b=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x1b16f2=>{for(const _0x4188e3 of _0xf6ff69)this['_knownOperations']['add'](_0x4188e3),this['_addKnownRoot'](_0x4188e3),_0x1b16f2['batch']['addOperation'](_0x4188e3),this['editor']['model']['applyOperation'](_0x4188e3);});}_addKnownRoot(_0x19b582){const _0x2a658d=this['_getAffectedRoot'](_0x19b582);_0x2a658d&&this['_knownRootNames']['add'](_0x2a658d);}_getAffectedRoot(_0x150648){let _0x289a93,_0x3f0419;switch(_0x150648['type']){case'insert':_0x289a93=_0x150648['position']['root'];break;case'marker':if(_0x3f0419=_0x150648['newRange'],!_0x3f0419)return null;_0x289a93=_0x3f0419['root'];break;case'addRootAttribute':_0x289a93=_0x150648['root'];break;case'addRoot':_0x289a93=_0x150648['affectedSelectable'];break;case'move':_0x289a93=_0x150648['targetPosition']['root'];break;default:return null;}return _0x289a93['rootName'];}_updateServerHistory(_0x10a32){_0x10a32['forEach'](_0x36ff3c=>{const _0x58e16d=_0x36ff3c['clone']();_0x58e16d['_authorId']=_0x36ff3c['_authorId'],_0x58e16d['_isInit']=!!_0x36ff3c['_isInit'],_0x58e16d['_aiSource']=_0x36ff3c['_aiSource'],_0x58e16d['createdAt']=_0x36ff3c['createdAt'],_0x58e16d['baseVersion']+=this['_offset'],_0x36ff3c['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x58e16d),this['serverHistory']['addOperation'](_0x58e16d);});}_handleReconnectionError(_0x4094ef){const _0x237cdc=this['editor']['plugins']['get']('Notification'),_0x3ed8d1=this['editor']['locale'];_0x4094ef||(_0x4094ef=et(_0x3ed8d1,'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.')),_0x237cdc['showWarning'](_0x4094ef,{'title':et(_0x3ed8d1,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](J)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x29e1d0)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x29e1d0)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x1c69f0){const _0x336ac0=_0x1c69f0['map'](_0x6b3dc8=>_0x6b3dc8['toJSON']());return this['_compressor']['compress'](_0x336ac0);}_decompressOperations(_0x5e5b51,_0x350294){return this['_compressor']['decompress'](_0x5e5b51)['map']((_0x59af78,_0x50d4de)=>{const _0x20480c='init'==_0x350294[_0x50d4de]['type'];if('InsertOperation'==_0x59af78['__className']){const _0x1df58b=_0x59af78['position']['root'];!this['_document']['getRoot'](_0x1df58b)&&(this['_document']['createRoot']('$unknown',_0x1df58b)['_isAttached']=!0x1);}else{if('RootOperation'==_0x59af78['__className']){const _0x3db1b4=this['_document']['getRoot'](_0x59af78['rootName']);_0x3db1b4&&'$unknown'==_0x3db1b4['name']&&_0x59af78['elementName']!=_0x3db1b4['name']&&(_0x3db1b4['name']=_0x59af78['elementName']);}}const _0x2f9f18=_0x1f2734['fromJSON'](_0x59af78,this['_document']);return _0x2f9f18['wasUndone']=_0x59af78['wasUndone'],_0x2f9f18['_isInit']=_0x20480c,_0x2f9f18['_authorId']=_0x20480c?null:_0x350294[_0x50d4de]['userId'],_0x2f9f18['_isDisconnection']='cs:removeUser'===_0x350294[_0x50d4de]['type'],_0x2f9f18['_aiSource']=_0x59af78['_aiSource']||void 0x0,_0x2f9f18['createdAt']=_0x350294[_0x50d4de]['createdAt'],_0x2f9f18;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x1f12e0=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x1f12e0&&_0x1f12e0['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x4d7247,_0xdc45c8){for(const _0x2cccc1 of _0x4d7247)_0x2cccc1['baseVersion']=_0xdc45c8++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0x242a0b){this['_ignoredOperations']=_0x242a0b,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x5a8f62){let _0x129464=_0x5a8f62['length'];for(;_0x129464--;){const _0x318e61=_0x5a8f62[_0x129464];if(!this['_ignoredOperations']['has'](_0x318e61)){if(!this['_operationToId']['has'](_0x318e61)){const _0x2b54d8=_0x258125()['slice'](0x1,0x12);this['_operationToId']['set'](_0x318e61,_0x2b54d8);}return this['_operationToId']['get'](_0x318e61);}}}setIdForTheLastOperation(_0xb6b70f,_0x515981){if(!_0x515981)return;let _0x2bd541=_0xb6b70f['length'];for(;_0x2bd541--;){const _0x57193c=_0xb6b70f[_0x2bd541];this['_ignoredOperations']['has'](_0x57193c)||this['_operationToId']['set'](_0x57193c,_0x515981);}}},ct=class extends _0x423a3d{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x34398c{static CommentsService=/* #__PURE__ -- @preserve */
26
- ((()=>_0x4a16ff)());['_services'];static get requires(){return[J,_0x2182ce,Q,_0x45a2eb];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x31c1db){super(_0x31c1db),this['_services']=new Map();}async init(){const _0x2bd9ac=this['context'],_0x404b3a=_0x2bd9ac['plugins']['get'](_0x2182ce);if(_0x2bd9ac['plugins']['get'](J)['addToReconnectionStack'](this),_0x404b3a['adapter']={'addCommentThread':async({channelId:_0x2d6294,threadId:_0x4213a2,comments:_0xa7274f,resolvedAt:_0x32277e,resolvedBy:_0x1ffcc2,context:_0x452f0e,attributes:_0x24b506})=>{const _0x3847fd=await this['_getService'](_0x2d6294)['addCommentThread']({'commentThreadId':_0x4213a2,'comments':_0xa7274f['map'](_0x2948d5=>function(_0x491665,_0x5768fb,_0x8259fb){return{'commentThreadId':_0x8259fb,'commentId':_0x491665['commentId'],'userId':_0x491665['authorId'],'content':_0x491665['content'],'documentId':_0x5768fb,'createdAt':_0x491665['createdAt'],'attributes':_0x491665['attributes']||{}};}(_0x2948d5,_0x2d6294,_0x4213a2)),'resolvedAt':_0x32277e,'resolvedBy':_0x1ffcc2,'context':_0x452f0e,'attributes':_0x24b506})['catch'](lt);return{'threadId':_0x3847fd['commentThreadId'],'comments':_0x3847fd['comments']};},'getCommentThread':async({channelId:_0x4f7337,threadId:_0x317ba0})=>{const _0xc2b10e=await this['_getService'](_0x4f7337)['getCommentThread'](_0x317ba0)['catch'](ht)['catch'](lt);return _0xc2b10e?_0xc2b10e['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0xc2b10e]),{'threadId':_0xc2b10e['commentThreadId'],'comments':_0xc2b10e['comments']['map'](dt),'context':_0xc2b10e['context'],'resolvedAt':_0xc2b10e['resolvedAt'],'resolvedBy':_0xc2b10e['resolvedBy'],'attributes':_0xc2b10e['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0xa8f385,threadId:_0x2c8754,context:_0x1c1a34,unlinkedAt:_0x154839,attributes:_0x331d5f})=>this['_getService'](_0xa8f385)['updateCommentThread']({'commentThreadId':_0x2c8754,'context':_0x1c1a34,'attributes':_0x331d5f,'unlinkedAt':_0x154839})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x17bcd7,threadId:_0x4396de})=>{const _0x2d01b3=await this['_getService'](_0x17bcd7)['resolveCommentThread'](_0x4396de)['catch'](ht)['catch'](lt);return{'threadId':_0x2d01b3['commentThreadId'],'resolvedAt':_0x2d01b3['resolvedAt'],'resolvedBy':_0x2d01b3['resolvedBy']};},'reopenCommentThread':async({channelId:_0x2ceb27,threadId:_0x108a34})=>this['_getService'](_0x2ceb27)['reopenCommentThread'](_0x108a34)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x3d913c,threadId:_0xb76709})=>this['_getService'](_0x3d913c)['removeCommentThread'](_0xb76709)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x487e09,threadId:_0xa6aedb,commentId:_0x357d51,content:_0x1c382e,attributes:_0x4d644a})=>this['_getService'](_0x487e09)['addComment'](_0xa6aedb,_0x357d51,_0x1c382e,_0x4d644a)['catch'](lt),'updateComment':({channelId:_0x13c6fa,threadId:_0x21aa38,commentId:_0x4ed33b,content:_0x601d2,attributes:_0x56bed2})=>this['_getService'](_0x13c6fa)['updateComment'](_0x21aa38,_0x4ed33b,_0x601d2,_0x56bed2)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x47f543,threadId:_0x3258ef,commentId:_0x375afd})=>this['_getService'](_0x47f543)['removeComment'](_0x3258ef,_0x375afd)['catch'](ht)['catch'](lt)},_0x2bd9ac instanceof _0x2be8e3){const _0x577668=_0x2bd9ac['config']['get']('collaboration.channelId'),_0x50a0d2=_0x2bd9ac['plugins']['get'](Q);await this['_setUpService'](_0x577668);const _0x2b3196=await this['_services']['get'](_0x577668)['getConnectedSessions']();this['listenTo'](_0x50a0d2,'sessionAdd:'+_0x577668,(_0x2e6c72,{session:_0x18f2ad})=>{_0x18f2ad['id']===_0x50a0d2['mySessionId']&&(_0x2e6c72['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x18f2ad['permissions'],_0x577668));}),_0x50a0d2['register'](_0x577668,_0x2b3196);}}async _setUpService(_0x357105){if(this['_services']['has'](_0x357105))throw new _0x5c3d75('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x357105});const _0x5990c9=this['context']['plugins']['get'](_0x2182ce),_0x4e2c09=new CloudServicesCommentsAdapter['CommentsService'](_0x357105);this['_services']['set'](_0x357105,_0x4e2c09),this['listenTo'](_0x4e2c09,'commentThreadAdded',(_0x3d5c04,_0x551515)=>{const {commentThreadId:_0x505088,documentId:_0x42438a,context:_0x4aa0b4,attributes:_0xd56efe,resolvedAt:_0x2ed790,resolvedBy:_0x9d7d3d,comments:_0x2a9135}=_0x551515;_0x5990c9['getCommentThread'](_0x505088)||_0x5990c9['addCommentThread']({'threadId':_0x505088,'channelId':_0x42438a,'comments':_0x2a9135?_0x2a9135['map'](dt):[],'context':_0x4aa0b4,'attributes':_0xd56efe,'resolvedAt':_0x2ed790,'resolvedBy':_0x9d7d3d,'isFromAdapter':!0x0});}),this['listenTo'](_0x4e2c09,'commentThreadUpdated',(_0x576875,{commentThreadId:_0xa64bcb,documentId:_0x1fa59d,context:_0x80aeb,unlinkedAt:_0x19e662,attributes:_0x2b47be})=>{_0x5990c9['getCommentThread'](_0xa64bcb)&&_0x5990c9['updateCommentThread']({'threadId':_0xa64bcb,'channelId':_0x1fa59d,'context':_0x80aeb,'unlinkedAt':_0x19e662,'attributes':_0x2b47be,'isFromAdapter':!0x0});}),this['listenTo'](_0x4e2c09,'commentThreadResolved',(_0x352396,{commentThreadId:_0x531f9b,resolvedBy:_0x5dc822,resolvedAt:_0xb5408f})=>{const _0x4881db=_0x5990c9['getCommentThread'](_0x531f9b);_0x4881db&&_0x4881db['resolve']({'resolvedBy':_0x5dc822,'resolvedAt':_0xb5408f,'isFromAdapter':!0x0});}),this['listenTo'](_0x4e2c09,'commentThreadReopened',(_0x52b366,{commentThreadId:_0x235ae3})=>{const _0x50b16d=_0x5990c9['getCommentThread'](_0x235ae3);_0x50b16d&&_0x50b16d['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4e2c09,'commentThreadRemoved',(_0x7018c2,{commentThreadId:_0x2816a9})=>{const _0x1b7c9d=_0x5990c9['getCommentThread'](_0x2816a9);_0x1b7c9d&&_0x1b7c9d['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x4e2c09,'commentAdded',(_0x578d3f,_0x251ef8)=>{const _0x51d1a5=_0x251ef8['commentThreadId'],_0x3b80ee=_0x5990c9['getCommentThread'](_0x51d1a5);_0x3b80ee&&_0x3b80ee['addComment']({...dt(_0x251ef8),'isFromAdapter':!0x0});}),this['listenTo'](_0x4e2c09,'commentUpdated',(_0x30e2c0,{commentThreadId:_0x556d7,commentId:_0x24b47f,content:_0x142432,attributes:_0x300456})=>{const _0x1ba1d4=_0x5990c9['getCommentThread'](_0x556d7);if(_0x1ba1d4){const _0x32dbff=_0x1ba1d4['getComment'](_0x24b47f);_0x32dbff&&_0x32dbff['update']({'content':_0x142432,'attributes':_0x300456,'isFromAdapter':!0x0});}}),this['listenTo'](_0x4e2c09,'commentRemoved',(_0x2a753e,{commentThreadId:_0x1e55a0,commentId:_0x46d116})=>{const _0x3d3c9a=_0x5990c9['getCommentThread'](_0x1e55a0);if(_0x3d3c9a){const _0x7ae96f=_0x3d3c9a['getComment'](_0x46d116);_0x7ae96f&&_0x7ae96f['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x4e2c09,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0x357105),this['stopListening'](_0x4e2c09));}),await this['_connectService'](_0x357105);}destroy(){if(this['context']instanceof _0x2be8e3){const _0x5249a6=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x5249a6)&&this['_terminateService'](_0x5249a6);}}_terminateService(_0xb29271){if(!this['_services']['has'](_0xb29271))throw new _0x5c3d75('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0xb29271});this['_getService'](_0xb29271)['disconnect'](),this['_services']['delete'](_0xb29271);}async reconnect(){for(const _0x13c385 of this['_services']['keys']())await this['_connectService'](_0x13c385);if(this['context']instanceof _0x2be8e3){const _0x1e994a=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x1e994a)){const _0x2ef76a=this['context']['plugins']['get'](Q);_0x2ef76a['unregister'](_0x1e994a);const _0x58abef=await this['_services']['get'](_0x1e994a)['getConnectedSessions']();_0x2ef76a['register'](_0x1e994a,_0x58abef);}}}async _connectService(_0xd9d61e){const {connection:_0x537eb6}=this['context']['plugins']['get'](J),_0x202b1c=this['context']['plugins']['get'](_0x2182ce),_0x222dcd=await this['_services']['get'](_0xd9d61e)['connect'](_0x537eb6);await this['_fetchMissingUsersForThreads'](_0x222dcd);const _0x74a911=new Set(Array['from'](_0x202b1c['getCommentThreads']({'channelId':_0xd9d61e}),_0x308542=>_0x308542['id']));for(const _0x1a7b82 of _0x222dcd)_0x1a7b82['deletedAt']||_0x74a911['delete'](_0x1a7b82['commentThreadId']);for(const _0x288630 of _0x74a911)_0x202b1c['getCommentThread'](_0x288630)['remove']({'isFromAdapter':!0x0});for(const _0xd92998 of _0x222dcd){let _0x1a15c0=_0x202b1c['getCommentThread'](_0xd92998['commentThreadId']);const {commentThreadId:_0x406e9a,context:_0x528e70,attributes:_0x4aef73,resolvedBy:_0x2644d4,resolvedAt:_0x364e4e,unlinkedAt:_0x1d8e12,deletedAt:_0x4ec1ae}=_0xd92998;if(_0x4ec1ae)continue;_0x1a15c0||(_0x1a15c0=_0x202b1c['addCommentThread']({'channelId':_0xd9d61e,'threadId':_0x406e9a,'context':_0x528e70,'attributes':_0x4aef73||{},'resolvedBy':_0x2644d4,'resolvedAt':_0x364e4e,'unlinkedAt':_0x1d8e12,'isFromAdapter':!0x0}));const _0x5a26c2=new Set(Array['from'](_0x1a15c0['comments'],_0x17222c=>_0x17222c['id']));for(const _0x6e9cfc of _0xd92998['comments'])_0x5a26c2['delete'](_0x6e9cfc['commentId']);for(const _0x41573c of _0x5a26c2)_0x1a15c0['getComment'](_0x41573c)['remove']({'isFromAdapter':!0x0});for(const _0x39d6ea of _0xd92998['comments']){const _0x3d7090=_0x1a15c0['getComment'](_0x39d6ea['commentId']);_0x3d7090?_0x3d7090['content']!==_0x39d6ea['content']&&_0x3d7090['update']({'content':_0x39d6ea['content'],'isFromAdapter':!0x0}):_0x1a15c0['addComment'](Object['assign'](dt(_0x39d6ea),{'isFromAdapter':!0x0}));}}}_getService(_0x18891b){if(!this['_services']['has'](_0x18891b))throw new _0x5c3d75('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x18891b});return this['_services']['get'](_0x18891b);}async _fetchMissingUsersForThreads(_0x4a5511){const _0x458a88=this['context']['plugins']['get'](_0x45a2eb),{connection:_0x457fd4}=this['context']['plugins']['get'](J),_0x3131b1=new Set();for(const {resolvedBy:_0x16aedf,comments:_0xbe0b93}of _0x4a5511){_0x16aedf&&!_0x458a88['getUser'](_0x16aedf)&&_0x3131b1['add'](_0x16aedf);for(const {userId:_0x585862}of _0xbe0b93)_0x458a88['getUser'](_0x585862)||_0x3131b1['add'](_0x585862);}if(0x0===_0x3131b1['size'])return;const _0x51c3f9=await _0x3786e3['getMany'](_0x457fd4,Array['from'](_0x3131b1));for(const _0x55eda6 of _0x51c3f9)_0x458a88['getUser'](_0x55eda6['id'])||_0x458a88['addUser'](_0x55eda6);}};async function ht(_0x2812af){if('404'!==_0x2812af['code'])throw _0x2812af;}function lt(_0x306c2b){if((_0x2dd3cf=_0x306c2b)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x2dd3cf['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x2dd3cf['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x2dd3cf;throw _0x306c2b;}function dt(_0x2ef43b){return{'threadId':_0x2ef43b['commentThreadId'],'commentId':_0x2ef43b['commentId'],'content':_0x2ef43b['content'],'createdAt':_0x2ef43b['createdAt'],'authorId':_0x2ef43b['userId'],'attributes':_0x2ef43b['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x423a3d{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
- ((()=>_0x4efdb1)());_bufferedRequests;_trackChangesService;static get requires(){return[at,_0x31f5e8,J];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4cfeb3){super(_0x4cfeb3);const _0xcefc8a=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0xcefc8a);}init(){const _0x57006f=this['editor']['plugins']['get'](J),_0xbe1a7d=this['editor']['plugins']['get'](_0x31f5e8);return _0xbe1a7d['adapter']={'getSuggestion':async _0x2670b9=>{await this['_waitForServiceReady']();const _0x4d10be=await this['_trackChangesService']['get'](_0x2670b9)['catch'](ft);return await this['_fetchMissingUsersForThreads']([_0x4d10be]),_0x4d10be;},'addSuggestion':async({id:_0x4bd3ec,type:_0x401bbd,data:_0x3ae613,originalSuggestionId:_0x55ba0a,attributes:_0x13a7ed})=>{await this['_waitForServiceReady']();const _0x56b8a0={'id':_0x4bd3ec,'type':_0x401bbd,'data':_0x3ae613,'originalSuggestionId':_0x55ba0a,'attributes':_0x13a7ed},_0x3892e6=await this['_trackChangesService']['add'](_0x4bd3ec,_0x401bbd,_0x3ae613,_0x55ba0a,_0x13a7ed)['catch'](_0x4779b2=>{if(mt(_0x4779b2))return new Promise(_0x238baf=>{this['_bufferedRequests']['set'](_0x4bd3ec,{'resolve':_0x238baf,'suggestionData':_0x56b8a0});});throw _0x4779b2;});return this['_bufferedRequests']['delete'](_0x4bd3ec),_0x3892e6;},'updateSuggestion':async(_0x19d86e,_0x5d0181)=>{if(await this['_waitForServiceReady'](),'open'!==_0x5d0181['state'])return this['_trackChangesService']['update'](_0x19d86e,_0x5d0181)['catch'](ft);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0x19df57,_0x3e6dda)=>{_0xbe1a7d['hasSuggestion'](_0x3e6dda['id'])&&(_0xbe1a7d['getSuggestion'](_0x3e6dda['id'])['attributes']=_0x3e6dda['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x57006f['connection']?.['state']&&(_0x57006f['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x57006f['connection'])['then'](_0x39f2b8=>(_0x57006f['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0x39f2b8)['then'](()=>{for(const _0x12d3ab of _0x39f2b8){_0xbe1a7d['addSuggestionData'](_0x12d3ab)['_saved']=!0x0;}})));}async reconnect(){const _0x487380=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x2ab51b}=this['editor']['plugins']['get'](J),_0x274902=await this['_trackChangesService']['connect'](_0x2ab51b);await this['_fetchMissingUsersForThreads'](_0x274902);for(const {suggestionData:_0x4c1762,resolve:_0x52b50a}of this['_bufferedRequests']['values']()){let _0x16d1dc=_0x274902['find'](_0x26f977=>_0x26f977['id']===_0x4c1762['id']);_0x16d1dc||(_0x16d1dc=await this['_trackChangesService']['add'](_0x4c1762['id'],_0x4c1762['type'],_0x4c1762['data'],_0x4c1762['originalSuggestionId'])),_0x52b50a(_0x16d1dc);}for(const _0x5e55ee of _0x274902)_0x487380['hasSuggestion'](_0x5e55ee['id'])||_0x487380['addSuggestionData'](_0x5e55ee);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x78943f=>{this['listenTo'](this['_trackChangesService'],'connected',_0x2967c5=>{_0x2967c5['off'](),_0x78943f();});});}async _fetchMissingUsersForThreads(_0x2cac29){const _0x248777=this['editor']['plugins']['get'](_0x45a2eb),{connection:_0x3c67df}=this['editor']['plugins']['get'](J),_0x5b3d77=new Set();for(const {authorId:_0x36f3d7}of _0x2cac29)_0x248777['getUser'](_0x36f3d7)||_0x5b3d77['add'](_0x36f3d7);if(0x0===_0x5b3d77['size'])return;const _0x4fb74b=await _0x3786e3['getMany'](_0x3c67df,Array['from'](_0x5b3d77));for(const _0x2e09c5 of _0x4fb74b)_0x248777['getUser'](_0x2e09c5['id'])||_0x248777['addUser'](_0x2e09c5);}};function ft(_0x5531f9){if(mt(_0x5531f9))return new Promise(()=>{});throw _0x5531f9;}function mt(_0x24679b){return _0x24679b['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x24679b['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var pt=class extends _0x423a3d{static get requires(){return[_0x11e141,at,ct,J];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x197547=this['editor']['plugins']['get'](J),_0x2316d9=this['editor']['plugins']['get'](_0x3947f9),_0x38e760=this['editor']['plugins']['get'](at);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x197547,'change:state',(_0x5af3cd,_0x2b4689,_0x535b6c)=>{_0x2316d9['isThreadsLoadingPaused']='connected'!==_0x535b6c;});}),this['listenTo'](_0x197547,'change:state',(_0x2fb35c,_0x4589cb,_0x498f58)=>{this['editor']['plugins']['get'](_0x2182ce)['switchReadOnly']('connected'!==_0x498f58);}),_0x38e760['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x291f42=this['editor']['plugins']['get'](at),_0x167a6e=this['editor']['config']['get']('collaboration.channelId');_0x291f42['_services']['has'](_0x167a6e)&&_0x291f42['_terminateService'](_0x167a6e),super['destroy']();}},gt=class extends _0x423a3d{static get requires(){return[pt,ut,_0x2e3025];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class CloudServicesRevisionHistoryAdapter extends _0x423a3d{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
- ((()=>_0x4935ea)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0xa7ea16,Q,_0x45a2eb];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x969ee7){super(_0x969ee7);const _0x58c65f=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x58c65f);}async init(){const _0x550937=this['editor']['plugins']['get'](it),_0x591376=_0x550937['serverHistory'],_0x15d13b=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x591376,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x550937['sessionId']});const _0x57c3f8=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x476e6c,_0x4113e8=await _0x100712['isBundleUploaded'](_0x15d13b['connection'],_0x57c3f8);this['editor']['plugins']['get'](_0xa7ea16)['adapter']={'getRevision':async({revisionId:_0x53b5da})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x53b5da)),'updateRevisions':async _0x57d8a6=>{await this['_waitForServiceReady']();const _0x5cd800=this['_revisionTracker']['currentRevision'];if(_0x4113e8&&0x1===_0x57d8a6['length']&&_0x57d8a6[0x0]['id']===_0x5cd800['id'])return _0x57d8a6;for(const _0x19cfcb of _0x57d8a6)_0x19cfcb['id']===_0x5cd800['id']&&(_0x19cfcb['isEmptyCurrent']=_0x19cfcb['fromVersion']===_0x19cfcb['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x57d8a6,this['_lastRequestId'])['then'](_0x2c6dab=>(this['_lastRequestId']=_0x2c6dab,_0x57d8a6))['catch'](_0x3a0f44=>{if(vt(_0x3a0f44)||'400'===_0x3a0f44['code']&&void 0x0!==_0x3a0f44['data']['wrongRequestId']){for(const _0x509b28 of _0x57d8a6)this['_revisionTracker']['repository']['getRevision'](_0x509b28['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x509b28['id'],_0x509b28,!0x1);if(vt(_0x3a0f44)&&'destroyed'!==this['editor']['state'])throw _0x3a0f44;return _0x57d8a6;}throw _0x3a0f44;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x19ba4b,{revisionsData:_0x179755,requestId:_0x49ab94})=>{Math['max'](..._0x179755['map'](_0x2628c9=>_0x2628c9['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x179755,_0x49ab94);}):this['_handleRevisionsUpdate'](_0x179755,_0x49ab94);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x15d13b['connection']?.['state']&&(_0x15d13b['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x2ed10e,requestId:_0x1fed13}=await this['_revisionHistoryService']['connect'](_0x15d13b['connection']);_0x15d13b['addToReconnectionStack'](this),this['_lastRequestId']=_0x1fed13,await this['_fetchMissingUsers'](_0x2ed10e);for(const _0x446125 of _0x2ed10e)this['_revisionTracker']['addRevisionData'](_0x446125);this['listenTo'](_0x550937,'change:_isConnected',(_0x1d2855,_0x165d6c,_0xb61dbb)=>{_0xb61dbb&&(this['_oldOffset']=_0x550937['_offset'],_0x1d2855['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0x5c4289=this['editor']['plugins']['get'](J),_0x27c0e2=this['editor']['plugins']['get'](it),_0x59b3eb=async()=>{const _0x57cc43=this['_revisionTracker']['currentRevision'],_0x1da7f0=_0x57cc43['id'],_0x27d5cd=_0x1da7f0!==_0x27c0e2['sessionId'];if(_0x27d5cd){const _0x45c9d7=_0x27c0e2['_offset']-this['_oldOffset'],_0x337fbe=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x57cc43['toVersion']+_0x45c9d7!==_0x337fbe){const _0x488287=_0x57cc43['fromVersion']+_0x45c9d7,_0x2799c2=this['editor']['plugins']['get'](_0x45a2eb),_0x11f8d6=this['_revisionTracker']['buildRevisionData']({'revision':_0x57cc43,'from':_0x488287,'to':_0x337fbe});_0x11f8d6['id']=_0x57cc43['id'];const _0x4df7c3=_0x11f8d6['authorsIds']['map'](_0x19425e=>_0x2799c2['getUser'](_0x19425e));_0x57cc43['_update']({..._0x11f8d6,'authors':_0x4df7c3},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x57cc43['id'],_0x11f8d6,!0x0);}this['_revisionTracker']['_startingVersion']=_0x337fbe,_0x57cc43['toVersion']!==_0x57cc43['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x1da7f0)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x1da7f0),this['_revisionTracker']['_createCurrentRevision'](_0x337fbe);}const {revisions:_0x4935dd,requestId:_0x33e733}=await this['_revisionHistoryService']['reconnect'](_0x5c4289['connection'],this['_lastRequestId']);_0x27d5cd&&_0x4935dd['length']>0x0?_0x27c0e2['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x4935dd),this['_handleRevisionsUpdate'](_0x4935dd,_0x33e733),this['_revisionTracker']['sendBufferedUpdates']());};return _0x27c0e2['_isConnected']?_0x59b3eb():new Promise((_0x2d1233,_0x403f0d)=>{_0x27c0e2['once']('change:_isConnected',()=>{_0x59b3eb()['then'](_0x2d1233)['catch'](_0x403f0d);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x5e2001=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x3cf56f=>{_0x3cf56f['off'](),_0x5e2001();});});}_getLatestVersionFromServerOperations(){const _0x14900c=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0x48a680 of _0x14900c)if('marker'!==_0x48a680['type']||_0x48a680['affectsData'])return _0x48a680['baseVersion']+0x1;}_getLatestVersion(){const _0x3fa302=this['editor']['plugins']['get'](it);return new Promise(_0x2312ce=>{_0x3fa302['_isPendingUpdate']?_0x3fa302['once']('change:_isPendingUpdate',()=>{_0x2312ce(this['_getLatestVersionFromServerOperations']());}):_0x2312ce(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x40e118,_0x5b74b8){const _0x56be9f=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x5b74b8;for(const _0xa44fdf of _0x40e118){const _0x26de67=_0x56be9f['getRevision'](_0xa44fdf['id']);if(_0x26de67){if((_0xa44fdf['fromVersion']||_0xa44fdf['toVersion'])&&(_0xa44fdf['diffData']=null),_0x26de67===this['_revisionTracker']['currentRevision']){const _0x6b2c0f=Math['max'](_0x26de67['toVersion'],_0xa44fdf['toVersion']),_0x2efdee=Math['max'](_0x26de67['fromVersion'],_0xa44fdf['fromVersion']);let _0x26f0f1;_0x26de67['toVersion']===_0xa44fdf['toVersion']&&_0x26de67['fromVersion']===_0xa44fdf['fromVersion']?(_0x26f0f1=!0x0,this['_preventResendingRevisionData'](_0xa44fdf)):_0xa44fdf['toVersion']===_0x6b2c0f&&_0xa44fdf['fromVersion']===_0x2efdee?_0x26f0f1=!0x1:(_0x26de67['toVersion']===_0x6b2c0f&&_0x26de67['fromVersion']===_0x2efdee||this['_fixRevision']({'revision':_0x26de67,'from':_0x2efdee,'to':_0x6b2c0f}),_0x26f0f1=!0x0),_0x26f0f1&&(delete _0xa44fdf['fromVersion'],delete _0xa44fdf['toVersion'],delete _0xa44fdf['diffData'],delete _0xa44fdf['createdAt'],delete _0xa44fdf['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0xa44fdf),this['_preventResendingRevisionData'](_0xa44fdf);}else this['_revisionTracker']['addRevisionData'](_0xa44fdf);}const _0x17a3b2=_0x56be9f['getRevisions']();_0x17a3b2['reverse']();for(let _0x2ff8fe=0x0;_0x2ff8fe<_0x17a3b2['length']-0x1;_0x2ff8fe++){const _0x4c52a1=_0x17a3b2[_0x2ff8fe],_0x196087=_0x17a3b2[_0x2ff8fe+0x1];if(_0x4c52a1['fromVersion']<_0x196087['toVersion']){const _0x196844=_0x196087['toVersion'],_0x13c978=Math['max'](_0x196844,_0x4c52a1['toVersion']);this['_fixRevision']({'revision':_0x4c52a1,'from':_0x196844,'to':_0x13c978});}}}['_fixRevision']({revision:_0x2cac92,from:_0x7a5062,to:_0x3eac50}={}){const _0x320ba7=this['editor']['plugins']['get'](_0x45a2eb),_0x42aa0=this['_revisionTracker']['buildRevisionData']({'revision':_0x2cac92,'from':_0x7a5062,'to':_0x3eac50});_0x42aa0['authors']=_0x42aa0['authorsIds']['map'](_0x4eff5d=>_0x320ba7['getUser'](_0x4eff5d)),_0x2cac92['_update'](_0x42aa0);}_preventResendingRevisionData(_0x3dbfff){const _0x179598={};_0x179598['id']=_0x3dbfff['id'];for(const _0x4d9c95 of Object['keys'](_0x3dbfff))'id'!==_0x4d9c95&&(_0x179598[_0x4d9c95]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x179598['id'],_0x179598,!0x0);}async _fetchMissingUsers(_0x2fc74d){const _0x19b8d6=this['editor']['plugins']['get'](_0x45a2eb),{connection:_0x14f5e1}=this['editor']['plugins']['get'](J),_0x152d1f=new Set();for(const _0x1e16be of _0x2fc74d){for(const _0xc0bd29 of _0x1e16be['authorsIds'])_0x2d0c0f(_0xc0bd29);_0x1e16be['creatorId']&&_0x2d0c0f(_0x1e16be['creatorId']);}if(0x0===_0x152d1f['size'])return;const _0x16f898=await _0x3786e3['getMany'](_0x14f5e1,Array['from'](_0x152d1f));for(const _0x438c32 of _0x16f898)_0x19b8d6['getUser'](_0x438c32['id'])||_0x19b8d6['addUser'](_0x438c32);function _0x2d0c0f(_0x261adf){_0x19b8d6['getUser'](_0x261adf)||_0x152d1f['add'](_0x261adf);}}};function vt(_0x25f4d8){return _0x25f4d8['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0x25f4d8['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x25f4d8['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x423a3d{static get requires(){return[_0xa7ea16,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x3498d3{_collapseAt;constructor(_0x7f0c38,_0x236bd7=0x6){super(_0x7f0c38);const _0x9d5a9b=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x236bd7,this['bind']('isHidden')['to'](this,'usersCount',_0x19d454=>_0x19d454<_0x236bd7),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x9d5a9b['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':_0x9d5a9b['to']('usersCount',_0x535f11=>'+'+(_0x535f11-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x3498d3{items;keystrokes;constructor(_0x488ead){super(_0x488ead);const _0x89b131=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x15f4f2(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x89b131['if']('hasPopup'),'aria-expanded':_0x89b131['to']('isExpanded',_0x342ac6=>this['hasPopup']&&String(_0x342ac6)),'aria-label':_0x89b131['to']('hasPopup',_0x18f167=>et(_0x488ead,_0x18f167?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x89b131['to']('hasPopup',_0x22268c=>!!_0x22268c&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0x2cea51,_0x635067,_0x1826d5)=>{this['element']&&(_0x1826d5?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},kt=class extends _0x3498d3{counterView;inlineListView;constructor(_0x4bc750,_0x1943ed=0x6){super(_0x4bc750);const _0x461499=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0x1943ed),this['inlineListView']=new bt(_0x4bc750),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x394f61 of this['inlineListView']['items'])_0x394f61['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',_0x461499['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x3498d3{listWrapperView;constructor(_0x323801,_0x66e382){super(_0x323801),this['listWrapperView']=new St(_0x323801,_0x66e382),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0x323801,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0xadd891{constructor(_0x34ff65,_0x434c8f){super(_0x34ff65);const _0x556af1=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x434c8f?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x556af1['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x556af1['to']('role'),'aria-label':_0x556af1['to']('ariaLabel'),'aria-labelledby':_0x556af1['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x2ef3b1['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x3516ce=this['element'];_0x3516ce&&(this['_isScrollable']=Math['max'](_0x3516ce['scrollHeight'],_0x3516ce['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0x47215c{['userView'];constructor(_0x5e2031,_0x159daf,_0x1dab2f){super(_0x5e2031);const _0xc46538=this['bindTemplate'];this['userView']=new _0x289284(_0x5e2031,_0x159daf);const _0x2e55ed={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x159daf['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x159daf['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x159daf['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x159daf['color']['getColorVariable'](),'--ck-user-color-alpha':_0x159daf['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x1dab2f&&(_0x2e55ed['tag']='button',_0x2e55ed['on']={'click':_0xc46538['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x2e55ed);}['focus'](){this['element']['focus']();}},Ct=class extends _0x3498d3{['userView'];['markerView'];constructor(_0x4a82f1,_0x31dadb,_0x34515e){super(_0x4a82f1);const _0x2264fe=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0x289284(_0x4a82f1,_0x31dadb),this['markerView']=new At(_0x4a82f1,_0x31dadb);const _0x23f5fd=new _0x242656(_0x4a82f1);_0x23f5fd['template']['tag']='span',_0x23f5fd['text']=_0x31dadb['name'];const _0x57de73={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x2264fe['to']('isFocusable',_0x57c206=>_0x57c206?0x0:-0x1),'aria-labelledby':_0x23f5fd['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x2264fe['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x2264fe['to']('hasTooltip',_0x1fb3f2=>!_0x1fb3f2),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x23f5fd]};_0x34515e&&(_0x57de73['tag']='button',_0x57de73['on']={'click':_0x2264fe['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x57de73);}},At=class extends _0x3498d3{constructor(_0x30a486,_0x4f7b33){super(_0x30a486),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x4f7b33['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x4f7b33['color']['getColorVariable'](),'--ck-user-color-alpha':_0x4f7b33['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x34398c{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x527a65){super(_0x527a65),this['context']['config']['define']('presenceList',Pt);const _0x2ef8bf=_0x527a65['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x2ef8bf)throw new _0x5c3d75('presencelist-collapseat-invalid-format',this);if(_0x2ef8bf<0x1)throw new _0x5c3d75('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x1da6c7(),this['balloonPanelView']=new _0x4e8836(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x1e5dd5 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x1e5dd5);this['listenTo'](this['_allConnectedUsers'],'add',(_0x16e3b5,_0x364f90)=>{this['_handleUserAdd'](_0x364f90);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x4f934e,_0x12e126)=>{this['_handleUserRemove'](_0x12e126);});}_createView(){const _0x546dfd=this['context'],_0x4a8c11=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x10a55d=this['balloonPanelView'];if(!_0x17bcfc(_0x546dfd['config']['get']('presenceList.container')))throw new _0x5c3d75('presencelist-missing-container',this);_0x4a8c11['counterView']['bind']('usersCount')['to'](this),_0x4a8c11['bind']('isCollapsed')['to'](this,'usersCount',_0x4f2978=>{const {collapseAt:_0x9b7b85}=_0x546dfd['config']['get']('presenceList'),_0x21e05d=_0x4f2978>=_0x9b7b85;if(_0x21e05d&&!_0x4a8c11['inlineListView']['items']['find'](_0x289217=>_0x289217 instanceof yt)){const _0x389d82=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x389d82&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x4a8c11['inlineListView']['items']['add'](_0x4a8c11['counterView']);}return _0x21e05d||this['hideDropdown'](),_0x21e05d;}),_0x4a8c11['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x29eb4d=>{const _0xcb047e=_0x546dfd['config']['get']('presenceList'),_0x3ed37f=new Ct(_0x546dfd['locale'],_0x29eb4d,!!_0xcb047e['onClick']);return _0x3ed37f['bind']('hasTooltip')['to'](_0x4a8c11,'isCollapsed',_0x2faeca=>!_0x2faeca),_0x3ed37f['bind']('isFocusable')['to'](_0x4a8c11,'isCollapsed',_0x19e57a=>!_0x19e57a),_0xcb047e['onClick']&&this['listenTo'](_0x3ed37f,'execute',()=>{this['view']['isCollapsed']||_0xcb047e['onClick'](_0x29eb4d,_0x3ed37f['element']);}),_0x3ed37f;}),_0x4a8c11['inlineListView']['keystrokes']['set']('Enter',(_0x257908,_0x211ff6)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x211ff6());}),_0x4a8c11['render'](),_0x10a55d['render'](),_0x4a8c11['listenTo'](_0x4a8c11['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x321878=(_0x4c9792,_0x1bf463)=>{this['_hideDropdownUnlessPointerInside'](_0x1bf463);};return _0x4a8c11['listenTo'](_0x4a8c11['inlineListView']['element'],'mouseleave',_0x321878),_0x4a8c11['listenTo'](_0x10a55d['element'],'mouseleave',_0x321878),_0x3cf34f({'emitter':_0x4a8c11,'activator':()=>_0x10a55d['isVisible'],'contextElements':[_0x10a55d['element'],_0x4a8c11['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0x546dfd['config']['get']('presenceList.container')['appendChild'](_0x4a8c11['element']),this['_overlayHost']=new _0x35fbbe(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0x4a8c11;}_resolveOverlayTarget(){const _0x4fa978=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0x4fa978)return _0x4fa978;const _0x44eff7=this['context']['config']['get']('presenceList.container');return _0x44eff7?_0x464101(_0x44eff7):null;}['_handleUserAdd'](_0x1849ca){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x1849ca['isMe'])return;const _0x195761=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x195761-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x59c866=_0x1849ca['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x1849ca,_0x59c866);}['_handleUserRemove'](_0x170ee6){this['usersCount']--;const {collapseAt:_0x1b8839}=this['context']['config']['get']('presenceList'),_0x1d13f8=this['usersCount']>=_0x1b8839;if(this['currentDisplayedUsers']['get'](_0x170ee6['id']))this['currentDisplayedUsers']['remove'](_0x170ee6['id']);else{if(_0x1d13f8&&this['currentDisplayedUsers']['length']+0x1===_0x1b8839-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x1d13f8?0x1:0x0)<this['usersCount']){for(const _0x2a014c of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x2a014c['id'])&&(this['currentDisplayedUsers']['add'](_0x2a014c,Math['min'](this['currentDisplayedUsers']['length']-(_0x1d13f8?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x1d13f8?0x1:0x0)===_0x1b8839-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x2ca952=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0x2ca952['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x461b30}=this['presenceDropdownView'];_0x461b30['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x3f14c6=>{if(!_0x2ca952['displayMe']&&_0x3f14c6['isMe'])return null;const _0x500d7e=new Tt(this['context']['locale'],_0x3f14c6,!!_0x2ca952['onClick']);return _0x2ca952['onClick']&&this['listenTo'](_0x500d7e,'execute',()=>{_0x2ca952['onClick'](_0x3f14c6,_0x500d7e['element']);}),_0x500d7e;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']);const _0x1205c3=_0x4e8836['generatePositions']({'heightOffset':0x3,'config':{'withArrow':!0x1}});this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element'],'positions':[_0x1205c3['southArrowNorth'],_0x1205c3['southArrowNorthMiddleWest'],_0x1205c3['southArrowNorthMiddleEast'],_0x1205c3['southArrowNorthWest'],_0x1205c3['southArrowNorthEast'],_0x1205c3['northArrowSouth'],_0x1205c3['northArrowSouthMiddleWest'],_0x1205c3['northArrowSouthMiddleEast'],_0x1205c3['northArrowSouthWest'],_0x1205c3['northArrowSouthEast'],_0x1205c3['viewportStickyNorth']]}),_0x461b30['focus'](),_0x461b30['checkIfScrollable']();const _0x2e2bec=(_0x457646,_0x2ecfa2)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x2ecfa2();};_0x461b30['keystrokes']['set']('Esc',_0x2e2bec),_0x461b30['keystrokes']['set']('Shift+Tab',_0x2e2bec),_0x461b30['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x461b30['focusTracker']['add'](this['view']['element']),_0x461b30['focusTracker']['on']('change:isFocused',(_0x501585,_0x4a47dd,_0x2b66bb)=>{_0x2b66bb||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}_hideDropdownUnlessPointerInside(_0x4b7c73){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x1bb759=>_0x3de2c2(_0x1bb759,_0x4b7c73))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x34398c{static get requires(){return[Q,Ot];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{at as CloudServicesCommentsAdapter,wt as CloudServicesRevisionHistoryAdapter,ut as CloudServicesTrackChangesAdapter,xt as PresenceList,Ot as PresenceListUI,it as RealTimeCollaborationClient,pt as RealTimeCollaborativeComments,ct as RealTimeCollaborativeEditing,_t as RealTimeCollaborativeRevisionHistory,gt as RealTimeCollaborativeTrackChanges,Q as Sessions,J as WebSocketGateway};
23
+ import{Context as _0x363235,ContextPlugin as _0x5dbaf5,PendingActions as _0x1040cb,Plugin as _0x52e8ef}from'@ckeditor/ckeditor5-core';import{CKEditorError as _0x18939e,Collection as _0x11a6e2,DomEmitterMixin as _0x32e2a3,KeystrokeHandler as _0x35d8f6,getOverlayMountRoot as _0x9144b7,global as _0x18b49a,trustedHtml as _0x179a4b,uid as _0x4b2f0e,version as _0x3b79db}from'@ckeditor/ckeditor5-utils';import{BalloonPanelView as _0x57bb6a,LabelView as _0x17b8ff,ListItemView as _0x1a8f6c,ListView as _0xdc9acc,Notification as _0x4c22da,OverlayHost as _0x6295c0,View as _0x120ca6,clickOutsideHandler as _0x1398a0}from'@ckeditor/ckeditor5-ui';import{History as _0x42d906,InsertOperation as _0x1daecc,MarkerOperation as _0x43a658,ModelLiveRange as _0x3ecb29,NoOperation as _0x14b2ce,OperationFactory as _0x37dd8e,RootAttributeOperation as _0x4bcd32,transformOperationSets as _0x5e7bcc}from'@ckeditor/ckeditor5-engine';import{CloudServices as _0x5a346f}from'@ckeditor/ckeditor5-cloud-services';import{CollaborativeEditingService as _0x42f616,CommentsService as _0x5c0c92,EditorService as _0x430b33,RevisionHistoryService as _0x13e383,TrackChangesService as _0x127256,User as _0x9bed89,WEB_SOCKET_GATEWAY_STATES as _0x19177b,WebSocketGateway as _0x89423a}from'@ckeditor/ckeditor-cloud-services-collaboration';import{UserView as _0xec502c,Users as _0x867fa1,isPointerStillOver as _0x7e1130}from'@ckeditor/ckeditor5-collaboration-core';import{Compressor as _0x1753d2}from'@ckeditor/ckeditor5-operations-compressor';import{TrackChanges as _0x58dfb9,TrackChangesEditing as _0x66e8c5}from'@ckeditor/ckeditor5-track-changes';import{Comments as _0x381f45,CommentsEditing as _0x1923ce,CommentsRepository as _0x1bbc91}from'@ckeditor/ckeditor5-comments';import{RevisionHistory as _0x31414e}from'@ckeditor/ckeditor5-revision-history';import{isElement as _0x2df90e}from'es-toolkit/compat';var J=class WebSocketGateway extends _0x5dbaf5{static WebSocketGateway=/* #__PURE__ -- @preserve */
24
+ ((()=>_0x89423a)());static initialReconnectionInterval=0x3e8;connection;_reconnectionStack;_shouldPluginsReconnect;_domEmitter;static get requires(){return[_0x5a346f,_0x4c22da];}static get['pluginName'](){return'WebSocketGateway';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x5fe301){super(_0x5fe301),this['set']('state',_0x19177b['CONNECTED']),this['set']('_isBrowserOffline',!0x1),this['_reconnectionStack']=new Set(),this['_shouldPluginsReconnect']=!0x1,this['_domEmitter']=new(_0x32e2a3())();}init(){const _0x5b818b=this['context'],_0x510958=_0x5b818b['plugins']['get'](_0x5a346f),_0x2706cb=_0x5b818b['plugins']['get'](_0x4c22da);if(!_0x510958['token'])throw new _0x18939e('websocketgateway-missing-token',this);if(!_0x510958['webSocketUrl'])throw new _0x18939e('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'](_0x510958['token'],_0x510958['webSocketUrl'],{'timeout':0x3e8*this['context']['config']['get']('cloudServices.connectionTimeout'),'requestTimeout':0x3e8*this['context']['config']['get']('cloudServices.requestTimeout')})['then'](_0x5b4212=>{if(this['connection']=_0x5b4212,this['bind']('state')['to'](_0x5b4212,'state',this,'_isBrowserOffline',(_0x222a07,_0x4a918c)=>('connected'!==_0x222a07&&(this['_shouldPluginsReconnect']=!0x0),_0x4a918c||_0x222a07!==_0x19177b['CONNECTED']?_0x19177b['DISCONNECTED']:this['state']==_0x19177b['DISCONNECTED']&&this['_shouldPluginsReconnect']?(this['_shouldPluginsReconnect']=!0x1,this['_reconnect'](),_0x19177b['CONNECTING']):_0x19177b['CONNECTED'])),this['connection']['on']('error',(_0x382860,_0x4491e3)=>{if('limitExceeded'!==_0x4491e3['code'])throw console['error'](_0x4491e3),new _0x18939e('cloudservices-init',null,{'originalError':_0x4491e3});_0x2706cb['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'});}),!_0x5b4212['me'])return new Promise(_0x351b21=>_0x5b4212['on']('change:me',_0x351b21));})['catch'](_0x1aaba1=>{throw console['error'](_0x1aaba1),new _0x18939e('cloudservices-init',null,{'originalError':_0x1aaba1});});}addToReconnectionStack(_0x11d81e){if('function'!=typeof _0x11d81e['reconnect'])throw new _0x18939e('websocketgateway-invalid-plugin-interface',this);if(this['isInReconnectionStack'](_0x11d81e))throw new _0x18939e('websocketgateway-plugin-already-registered',this,{'name':_0x11d81e['constructor']['pluginName']});this['_reconnectionStack']['add'](_0x11d81e);}removeFromReconnectionStack(_0x107f88){this['_reconnectionStack']['delete'](_0x107f88);}isInReconnectionStack(_0x433d96){return this['_reconnectionStack']['has'](_0x433d96);}_reconnect(){return this['connection']['reconnect']()['then'](()=>Promise['all'](Array['from'](this['_reconnectionStack'],_0x21cac0=>_0x21cac0['reconnect']())))['then'](()=>this['state']=_0x19177b['CONNECTED'])['catch'](_0x2bf2a5=>{throw console['error'](_0x2bf2a5),new _0x18939e('cloudservices-reconnection-error',this['context']);});}disconnect(){this['connection']&&this['connection']['disconnect'](),this['state']=_0x19177b['DISCONNECTED'],this['_domEmitter']['stopListening']();}destroy(){this['disconnect'](),super['destroy']();}},Q=class extends _0x5dbaf5{['channelSessions'];channelConnectedUsers;allConnectedUsers;_registeredSessions;_uniqueUsersCount;['_users'];static get['pluginName'](){return'Sessions';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}static get requires(){return[J,_0x867fa1];}constructor(_0x2e429f){super(_0x2e429f),this['channelSessions']=new Map(),this['channelConnectedUsers']=new Map(),this['allConnectedUsers']=new _0x11a6e2(),this['_registeredSessions']=new Map(),this['_uniqueUsersCount']=0x0,this['_users']=this['context']['plugins']['get'](_0x867fa1);}init(){const _0x2989f6=this['context']['plugins']['get'](J);this['listenTo'](_0x2989f6,'change:state',(_0x2ce78c,_0x20a2d6,_0x59d2cd)=>{if('connected'!==_0x59d2cd)this['channelSessions']['forEach'](_0x36e199=>_0x36e199['clear']()),this['channelConnectedUsers']['forEach'](_0x403b97=>_0x403b97['clear']()),this['allConnectedUsers']['clear']();else{for(const [_0x15d384,_0x4a1227]of this['_registeredSessions'])for(const _0x201826 of _0x4a1227)this['_handleSessionAdd'](_0x15d384,_0x201826);}}),this['_createUser'](_0x2989f6['connection']['me'],!0x0);}register(_0x21f9ba,_0x37aece){if(this['_registeredSessions']['has'](_0x21f9ba))throw new _0x18939e('sessions-register-already-registered',null,{'channelId':_0x21f9ba});this['_registeredSessions']['set'](_0x21f9ba,_0x37aece),this['channelSessions']['set'](_0x21f9ba,new _0x11a6e2()),this['channelConnectedUsers']['set'](_0x21f9ba,new _0x11a6e2()),this['listenTo'](_0x37aece,'add',(_0x5d29e8,_0x56bd40)=>this['_handleSessionAdd'](_0x21f9ba,_0x56bd40)),this['listenTo'](_0x37aece,'remove',(_0x218497,_0x320e0d)=>this['_handleSessionRemove'](_0x21f9ba,_0x320e0d));for(const _0x85b02c of _0x37aece)this['_handleSessionAdd'](_0x21f9ba,_0x85b02c);}unregister(_0x1f4552){if(!this['_registeredSessions']['has'](_0x1f4552))throw new _0x18939e('sessions-unregister-not-exist',null,{'channelId':_0x1f4552});const _0x5793ee=this['_registeredSessions']['get'](_0x1f4552);this['stopListening'](_0x5793ee);for(const _0x2d9993 of _0x5793ee)'connected'===this['context']['plugins']['get'](J)['state']&&this['_handleSessionRemove'](_0x1f4552,_0x2d9993);this['_registeredSessions']['delete'](_0x1f4552),this['channelSessions']['delete'](_0x1f4552),this['channelConnectedUsers']['delete'](_0x1f4552);}get['mySessionId'](){return this['context']['plugins']['get'](J)['connection']['sessionId'];}getUserBySessionId(_0x268423){for(const _0x360099 of this['channelSessions']['values']())for(const _0x2d3ced of _0x360099)if(_0x2d3ced['id']===_0x268423)return _0x2d3ced['user'];}getUserSessions(_0x26d248,_0x3f767){const _0xa97f44=_0x3f767?[this['channelSessions']['get'](_0x3f767)]:this['channelSessions']['values'](),_0x46c0b9=new Set();for(const _0x30ea02 of _0xa97f44)for(const _0x6421d0 of _0x30ea02)_0x6421d0['user']['id']===_0x26d248['id']&&_0x46c0b9['add'](_0x6421d0['id']);return _0x46c0b9;}getUserRole(_0x24b8a9){for(const _0x51a10c of this['channelSessions']['values']())for(const _0x3e82fa of _0x51a10c)if(_0x3e82fa['user']===_0x24b8a9)return _0x3e82fa['role'];}['_handleSessionAdd'](_0x3503c9,_0x4943cd){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x28f577=_0x4943cd['user'],_0xb7f580=this['_users']['getUser'](_0x28f577['id'])||this['_createUser'](_0x28f577),_0x3b7bf5=Object['assign']({},_0x4943cd,{'user':_0xb7f580});if(this['channelSessions']['get'](_0x3503c9)['add'](_0x3b7bf5),!_0x28f577['hiddenInPresenceList']){const _0x37a29a=this['channelConnectedUsers']['get'](_0x3503c9);_0x37a29a['has'](_0xb7f580['id'])||_0x37a29a['add'](_0xb7f580),this['allConnectedUsers']['has'](_0xb7f580['id'])||_0x28f577['hiddenInPresenceList']||this['allConnectedUsers']['add'](_0xb7f580,_0xb7f580['isMe']?0x0:void 0x0);}this['fire']('sessionAdd:'+_0x3503c9,{'channelId':_0x3503c9,'session':_0x3b7bf5});}['_handleSessionRemove'](_0x41cc0f,_0x54bc8d){if('connected'!==this['context']['plugins']['get'](J)['state'])return;const _0x38a431=this['channelConnectedUsers']['get'](_0x41cc0f),_0xe5b8d4=_0x54bc8d['user'];_0xe5b8d4['id']&&(this['channelSessions']['get'](_0x41cc0f)['remove'](_0x54bc8d['id']),_0x38a431['has'](_0xe5b8d4['id'])&&!this['getUserSessions'](_0xe5b8d4,_0x41cc0f)['size']&&_0x38a431['remove'](_0xe5b8d4['id']),this['allConnectedUsers']['get'](_0xe5b8d4['id'])&&!this['getUserSessions'](_0xe5b8d4)['size']&&this['allConnectedUsers']['remove'](_0xe5b8d4['id']));}_createUser(_0x4319cd,_0x22239b){const _0x382cc9=this['_users']['addUser'](_0x4319cd);return _0x22239b&&this['_users']['defineMe'](_0x4319cd['id']),_0x382cc9['orderNumber']=this['_uniqueUsersCount']++,_0x382cc9;}},X=class extends _0x52e8ef{_domEmitter=new(_0x32e2a3())();static get requires(){return[Q];}static get['pluginName'](){return'UserMarkers';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x5f545d=this['editor'],_0x8aa676=_0x5f545d['plugins']['get'](Q);_0x5f545d['conversion']['for']('editingDowncast')['markerToElement']({'model':'user:position','view':(_0x13a2f7,{writer:_0x3c2e4d})=>function(_0x49fcc7,_0x2ed16e,_0x3ee0ec,_0x1eb6cc){const _0x171fb5=_0x49fcc7['markerName']['split'](':')[0x2],_0x2a16c0=_0x3ee0ec['getUserBySessionId'](_0x171fb5);if(!_0x2a16c0||_0x171fb5===_0x3ee0ec['mySessionId'])return;if(!_0x1eb6cc['model']['schema']['checkChild'](_0x49fcc7['markerRange']['start'],'$text'))return;const _0x51f9f6={'class':'ck-user__marker\x20'+_0x2a16c0['color']['getMarkerClass'](),'style':tt(_0x2a16c0),'data-name':_0x2a16c0['name'],'data-session-id':_0x171fb5},_0x7057a1=_0x1eb6cc['model']['markers']['get'](_0x49fcc7['markerName'])['getStart'](),_0x368e75=_0x7057a1['nodeAfter'],_0x4229d4=_0x1eb6cc['model']['schema'];if(_0x368e75&&_0x4229d4['isObject'](_0x368e75)&&_0x4229d4['isInline'](_0x368e75)&&!_0x1eb6cc['model']['markers']['get']('user:range:'+_0x171fb5)['getRange']()['isCollapsed'])return;const _0xa6d5e=_0x7057a1['parent'];return _0x1eb6cc['model']['schema']['isLimit'](_0xa6d5e)&&!_0x1eb6cc['model']['hasContent'](_0xa6d5e)&&(_0x51f9f6['contenteditable']=!0x1),function(_0x2d6d60,_0x20004e,_0x554cc6){const _0x3120de=_0x2d6d60['createUIElement']('span',_0x20004e);return _0x2d6d60['setCustomProperty']('userPositionMarker',!0x0,_0x3120de),_0x3120de['render']=function(_0x2dedff){const _0x48e024=this['toDomElement'](_0x2dedff),_0x1156b6=document['createElement']('span');return _0x1156b6['classList']['add']('ck-user__marker-tooltip'),_0x1156b6['setAttribute']('contenteditable','false'),_0x1156b6['setAttribute']('spellcheck','false'),_0x1156b6['textContent']=_0x554cc6['name'],_0x48e024['innerHTML']=_0x179a4b('⁠<span\x20class=\x22ck-user__marker-line\x22\x20contenteditable=\x22false\x22><span\x20class=\x22ck-user__marker-dot\x22></span></span>'+_0x1156b6['outerHTML']+'⁠'),_0x48e024['addEventListener']('mouseenter',()=>{_0x48e024['classList']['add']('ck-user__marker_hovered');}),_0x48e024['addEventListener']('mouseleave',()=>{_0x48e024['classList']['remove']('ck-user__marker_hovered');}),_0x48e024;},_0x3120de['isSimilar']=function(_0x3dfb1d){return!(!this['getCustomProperty']('userPositionMarker')||!_0x3dfb1d['getCustomProperty']('userPositionMarker')||this['getAttribute']('data-session-id')!=_0x3dfb1d['getAttribute']('data-session-id'));},_0x3120de;}(_0x2ed16e,_0x51f9f6,_0x2a16c0);}(_0x13a2f7,_0x3c2e4d,_0x8aa676,_0x5f545d)}),_0x5f545d['conversion']['for']('editingDowncast')['markerToHighlight']({'model':'user:range','view':_0x409029=>function(_0x5f0d21,_0x2ecca6){const _0xc38f4b=_0x5f0d21['markerName']['split'](':')[0x2];if(_0xc38f4b===_0x2ecca6['mySessionId'])return null;const _0x1b808d=_0x2ecca6['getUserBySessionId'](_0xc38f4b);return _0x1b808d?{'id':_0xc38f4b,'classes':['ck-user__selection',_0x1b808d['color']['getSelectionClass']()],'attributes':{'style':tt(_0x1b808d),'data-session-id':_0xc38f4b},'priority':0x7d0+_0x1b808d['orderNumber']}:{'id':_0xc38f4b,'classes':[]};}(_0x409029,_0x8aa676)}),function(_0x1bfc22){const _0x2deaaf=_0x1bfc22['model'],_0xa43945=new Map(),_0x5e80c6=_0x1bfc22['plugins']['get'](Q);_0x2deaaf['markers']['on']('update:user:range',(_0x7ac01a,_0x19df25,_0x3a357a,_0x3f8578)=>{if(!_0x3f8578&&_0xa43945['get'](_0x19df25['name']))return _0xa43945['get'](_0x19df25['name'])['detach'](),void _0xa43945['delete'](_0x19df25['name']);const _0x22a8bb=_0x19df25['name']['split'](':')[0x2];if(_0x22a8bb===_0x5e80c6['mySessionId'])return;const _0x1c2068='user:position:'+_0x22a8bb;_0x2deaaf['markers']['has'](_0x1c2068)&&_0x1bfc22['editing']['reconvertMarker'](_0x1c2068),_0x19df25['on']('change:range',(_0x2cbe2b,_0x3e3baf,_0x5783f6)=>{if('$graveyard'!=_0x3e3baf['root']['rootName']&&'$graveyard'==_0x19df25['getRange']()['root']['rootName']&&!_0xa43945['has'](_0x19df25['name'])){const _0x236712=_0x2deaaf['schema']['getNearestSelectionRange'](_0x5783f6['deletionPosition']);if(_0x236712){const _0x4d9a0c=_0x3ecb29['fromRange'](_0x236712);_0xa43945['set'](_0x19df25['name'],_0x4d9a0c),_0x4d9a0c['on']('change:range',(_0x451086,_0x4d0b6b,_0xccb261)=>{if('$graveyard'==_0x4d9a0c['root']['rootName']){const _0xcfefa3=_0x2deaaf['schema']['getNearestSelectionRange'](_0xccb261['deletionPosition']);_0xcfefa3?(_0x4d9a0c['start']=_0xcfefa3['start'],_0x4d9a0c['end']=_0xcfefa3['end']):(_0xa43945['delete'](_0x19df25['name']),_0x4d9a0c['detach']());}});}}});}),_0x2deaaf['document']['on']('change',()=>{_0xa43945['size']>0x0&&_0x2deaaf['enqueueChange']({'isUndoable':!0x1},_0x497613=>{for(const [_0x10d309,_0x4b5908]of _0xa43945)'$graveyard'==_0x2deaaf['markers']['get'](_0x10d309)['getRange']()['root']['rootName']&&(Z(_0x10d309['split'](':')[0x2],_0x4b5908['toRange'](),_0x2deaaf,_0x497613),_0x4b5908['detach']());_0xa43945['clear']();});});}(_0x5f545d),this['_domEmitter']['listenTo'](_0x18b49a['document'],'keydown',(_0x570b04,{key:_0xa8cfeb})=>{'Escape'===_0xa8cfeb&&function(_0x4af67b){_0x4af67b['editing']['view']['change'](_0x280293=>{for(const _0x18ccfb of _0x4af67b['model']['markers']){if(!_0x18ccfb['name']['startsWith']('user:position'))continue;const _0x52b648=_0x4af67b['editing']['mapper']['markerNameToElements'](_0x18ccfb['name']);if(_0x52b648){for(const _0x3a3248 of _0x52b648)_0x280293['removeClass']('ck-user__marker_hovered',_0x3a3248);}}});}(_0x5f545d);},{'useCapture':!0x0});}afterInit(){const _0x25ac24=this['editor'],_0x6017ab=_0x25ac24['commands']['get']('undo');_0x6017ab&&_0x25ac24['model']['on']('applyOperation',(_0x1fc87d,_0x1b6339)=>{const _0x1e1acb=_0x1b6339[0x0];if(!_0x1e1acb['isDocumentOperation'])return;if('marker'!=_0x1e1acb['type']||!_0x1e1acb['name']['startsWith']('user:'))return;const _0x1694b6=_0x1e1acb['batch'];_0x6017ab['_createdBatches']['has'](_0x1694b6)&&(_0x1e1acb['newRange']=_0x1e1acb['oldRange']?_0x25ac24['model']['createRange'](_0x1e1acb['oldRange']['start'],_0x1e1acb['oldRange']['end']):null);},{'priority':'highest'});}destroy(){return this['_domEmitter']['stopListening'](),super['destroy']();}createUserMarkerOperations(){const _0x2cbcfe=this['editor'],_0x5dbee1=_0x2cbcfe['model']['document'],_0x55c70d=_0x2cbcfe['plugins']['get'](Q);_0x2cbcfe['model']['enqueueChange']({'isUndoable':!0x1},_0x481740=>{const _0x3868c7='user:range:'+_0x55c70d['mySessionId'],_0x579bea='user:position:'+_0x55c70d['mySessionId'],_0x5f5446=_0x2cbcfe['model']['markers']['has'](_0x3868c7);_0x2cbcfe['editing']['view']['hasDomSelection']?Z(_0x55c70d['mySessionId'],_0x5dbee1['selection']['getFirstRange'](),_0x2cbcfe['model'],_0x481740):_0x5f5446&&(_0x481740['removeMarker'](_0x3868c7),_0x481740['removeMarker'](_0x579bea));});}};function Z(_0x5120bc,_0xa1f1b2,_0x1a6442,_0x2ef8a1){const _0x3947f4='user:range:'+_0x5120bc,_0x111dfe='user:position:'+_0x5120bc,_0x249677=_0xa1f1b2['getContainedElement']();let _0x450b83=_0xa1f1b2['start'];if(_0x249677&&_0x249677['is']('element','tableCell')){const _0x2f9c3b=function(_0x111a89,_0x3b16a4){for(const _0x44846a of _0x111a89['getPositions']())if(_0x3b16a4['schema']['checkChild'](_0x44846a,'$text'))return _0x44846a;}(_0xa1f1b2,_0x1a6442);_0x2f9c3b&&(_0x450b83=_0x2f9c3b,_0xa1f1b2=_0x2ef8a1['createRange'](_0x450b83));}const _0x5e3a45=_0x2ef8a1['createRange'](_0x450b83);_0x1a6442['markers']['has'](_0x3947f4)?(_0x2ef8a1['updateMarker'](_0x3947f4,{'range':_0xa1f1b2}),_0x2ef8a1['updateMarker'](_0x111dfe,{'range':_0x5e3a45})):(_0x2ef8a1['addMarker'](_0x3947f4,{'range':_0xa1f1b2,'usingOperation':!0x0}),_0x2ef8a1['addMarker'](_0x111dfe,{'range':_0x5e3a45,'usingOperation':!0x0}));}function tt(_0x49ba5f){return'--ck-user-color:'+_0x49ba5f['color']['getColorVariable']()+';--ck-user-color-alpha:'+_0x49ba5f['color']['getColorAlphaVariable']()+';';}function et(_0x3db717,_0x3c3428,_0x8ae8d4){const _0x2b360e=_0x3db717['t'],t=_0x3db717['t'];switch(_0x3c3428){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 _0x2b360e({'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'},_0x8ae8d4);default:return'';}}let st=0x1;var it=class RealTimeCollaborationClient extends _0x52e8ef{static CollaborativeEditingService=/* #__PURE__ -- @preserve */
25
+ ((()=>_0x42f616)());_offset;['sessionId'];serverHistory;['_channelId'];['_service'];_document;['_compressor'];_bufferedOperations;_knownOperations;_knownRootNames;_pendingAction;_hasSelectionChanged;_sendBufferedOperationsDelayId;['_baseBufferDelay'];_currentBufferDelay;_lastSyncedOperationId;_disconnectionOperations;_operationIdentifier;static get requires(){return[J,Q,X,_0x1040cb,_0x867fa1,_0x4c22da];}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 _0x7f332d=this['serverHistory']['getOperations']();for(let _0x1879af=_0x7f332d['length']-0x1;_0x1879af>=0x0;_0x1879af--){const _0x3cbc74=_0x7f332d[_0x1879af];if(!this['_disconnectionOperations']['has'](_0x3cbc74))return _0x3cbc74['baseVersion']+0x1-this['_offset'];}return 0x0;}constructor(_0x380bc0){if(super(_0x380bc0),this['_offset']=0x0,this['sessionId']=null,this['serverHistory']=new _0x42d906(),this['editor']['config']['define']('collaboration',{}),this['_channelId']=this['editor']['config']['get']('collaboration.channelId'),!this['_channelId'])throw new _0x18939e('collaboration-missing-channelid',this);const _0xf0c3fa=_0x380bc0['config']['get']('cloudServices.bundleVersion')||_0x3b79db;this['_service']=new RealTimeCollaborationClient['CollaborativeEditingService'](_0xf0c3fa,this['_channelId']),this['_document']=this['editor']['model']['document'],this['_compressor']=new _0x1753d2(),this['_bufferedOperations']=[],this['_knownOperations']=new WeakSet(),this['_knownRootNames']=new Set(),this['set']('_isPendingUpdate',!0x1),this['set']('_hasSynchronizationProblem',!0x1),this['_pendingAction']=null,this['_hasSelectionChanged']=!0x1,this['_sendBufferedOperationsDelayId']=null,this['_baseBufferDelay']=0x12c,this['_currentBufferDelay']=this['_baseBufferDelay'],this['_lastSyncedOperationId']=null,this['_disconnectionOperations']=new WeakSet(),this['_operationIdentifier']=new rt(this['_disconnectionOperations']);}init(){const _0x4ae769=this['editor'],_0x2819e9=_0x4ae769['plugins']['get'](_0x867fa1),_0x5769d7=_0x4ae769['plugins']['get'](J);this['listenTo'](_0x2819e9,'getOperationAuthor',(_0x3256e1,_0x2f174c)=>{const _0x51395e=_0x2f174c[0x0];_0x51395e['_authorId']&&(_0x3256e1['return']=_0x2819e9['getUser'](_0x51395e['_authorId']),_0x3256e1['stop']()),null===_0x51395e['_authorId']&&(_0x3256e1['return']=null,_0x3256e1['stop']());},{'priority':'high'}),this['listenTo'](_0x4ae769['model']['document']['selection'],'change:range',(_0x3c4c13,_0x30546d)=>{_0x30546d['directChange']&&this['_refreshUserSelectionMarkers']();}),this['listenTo'](_0x4ae769['editing']['view'],'change:hasDomSelection',()=>{this['_refreshUserSelectionMarkers']();}),this['_initThrowingOnDataSet'](),_0x4ae769['model']['on']('applyOperation',(_0x3c39fd,_0x2d07f2)=>{const _0x6f42f9=_0x2d07f2[0x0];_0x6f42f9['isDocumentOperation']&&(this['_saveOperationInBuffer'](_0x6f42f9),this['_shouldSendUpdate']()&&this['_sendBufferedOperationsDelayed']());}),this['_setUpDataInit'](),this['set']('_isChannelFlushed',!0x1),this['bind']('_isEditingAllowed')['to'](_0x5769d7,'state',this,'_hasSynchronizationProblem',this,'_isChannelFlushed',(_0x58b88e,_0x2922f0,_0x11788f)=>'connected'===_0x58b88e&&!_0x2922f0&&!_0x11788f),this['on']('change:_isEditingAllowed',()=>{this['_isEditingAllowed']?_0x4ae769['disableReadOnlyMode']('rtc-offline'):_0x4ae769['enableReadOnlyMode']('rtc-offline');}),this['_isEditingAllowed']?_0x4ae769['disableReadOnlyMode']('rtc-offline'):_0x4ae769['enableReadOnlyMode']('rtc-offline'),this['set']('_isConnected',!0x1);}async reconnect(){const _0x3dbfde=this['editor']['plugins']['get'](Q),_0x43db60=this['editor']['plugins']['get'](J);try{this['_isPendingUpdate']=!0x0,_0x3dbfde['unregister'](this['_channelId']);const _0x5606ca=await this['_service']['reconnect'](_0x43db60['connection'],this['lastSyncVersion']);await this['_handleReconnectionResponse'](_0x5606ca)&&(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());const _0x27daaa=await this['_service']['getConnectedSessions']();_0x3dbfde['register'](this['_channelId'],_0x27daaa),this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}catch(_0x2c57de){if(function(_0x3bc97e){return'404'===_0x3bc97e['code'];}(_0x2c57de)&&this['sessionId'])await this['_connectAfterSessionHasBeenFlushed']();else{if(function(_0x2a7441){return'409'===_0x2a7441['code'];}(_0x2c57de)){const _0x2389e4=et(this['editor']['locale'],'The\x20document\x20cannot\x20be\x20connected\x20back\x20to\x20the\x20server.\x20To\x20not\x20lose\x20your\x20content\x20save\x20it\x20locally\x20and\x20refresh\x20the\x20editor.');this['_handleReconnectionError'](_0x2389e4);}else{if(!(_0x2c57de instanceof nt))throw _0x2c57de;this['_handleReconnectionError']();}}}}destroy(){const _0x286162=this['editor']['plugins']['get'](J),_0x470ae6=this['editor']['plugins']['get'](Q);this['editor']['enableReadOnlyMode']('rtc-destroyed'),_0x470ae6['channelSessions']['has'](this['_channelId'])&&_0x470ae6['unregister'](this['_channelId']),_0x286162['removeFromReconnectionStack'](this),this['_disconnectService'](),super['destroy']();}async _handleReconnectionResponse(_0x22b4d7){if(this['sessionId']!==_0x22b4d7['sessionId']&&this['_lastSyncedOperationId']!==_0x22b4d7['lastOperationId'])throw new nt();return this['sessionId']=_0x22b4d7['sessionId'],this['_handleServerResponse']([],{..._0x22b4d7,'wereChangesApplied':!0x1,'data':_0x22b4d7['data']},'reconnect');}async _connectService(_0x1d2dd8,_0x5800f3=!0x1){const {connection:_0xc5dc0b}=this['editor']['plugins']['get'](J);RealTimeCollaborationClient['CollaborativeEditingService']['getConnectedSessions'](_0xc5dc0b,this['_channelId'])['then'](_0xace42f=>this['_initSessionsHandling'](_0xace42f))['catch'](_0x257d6d=>{this['_crash']('realtimecollaborationclient-init-session-connection-error',_0x257d6d);}),this['listenTo'](this['_service'],'operationsReceived',this['_handleReceivedOperations']['bind'](this)),this['listenTo'](this['_service'],'error',(_0x16e214,_0x41a41f)=>{this['_crash']('realtimecollaborationclient-init-service-internal-error',_0x41a41f);}),this['listenTo'](this['_service'],'disconnected',()=>{this['_handleChannelDisconnected']();});const _0x117542=this['_operationIdentifier']['getIdOfTheLastOperation'](_0x1d2dd8);this['_isPendingUpdate']=!0x0;const _0x259978=await this['_service']['connect'](_0xc5dc0b,this['_compressOperations'](_0x1d2dd8),_0x117542);if(this['sessionId']=_0x259978['sessionId'],_0x5800f3){if(!_0x259978['wereChangesApplied'])return void this['_handleReconnectionError']();this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['serverHistory']['reset'](),this['_offset']=_0x259978['offset'],this['serverHistory']['version']=this['_offset'],await this['_handleServerResponse'](_0x1d2dd8,_0x259978,'reconnection:\x20flushed\x20session');}else await this['_handleInitialConnectionData'](_0x259978,_0x1d2dd8);this['_handleSendingSelectionMarkers'](),this['_isConnected']=!0x0;}_handleSendingSelectionMarkers(){const _0x4fc947=this['editor']['plugins']['get'](Q),_0x426fc8=this['editor']['plugins']['get'](X),_0x16e630=_0x4fc947['channelSessions']['get'](this['_channelId']);_0x16e630&&_0x16e630['length']>0x1?_0x426fc8['createUserMarkerOperations']():this['listenTo'](_0x4fc947,'sessionAdd:'+this['_channelId'],()=>{0x2===_0x4fc947['channelSessions']['get'](this['_channelId'])['length']&&_0x426fc8['createUserMarkerOperations']();});}async _handleReceivedOperations(_0x2143c5,_0x2f0f37,_0xdeb6fe,_0x18dbd8){if(!this['_isPendingUpdate']&&this['_document']['version']==_0x2f0f37){const _0x177a94=this['_decompressOperations'](_0xdeb6fe,_0x18dbd8);await this['_fetchMissingUsers'](_0x177a94),this['_handleExternalOperations'](_0x177a94,_0x2f0f37,_0xdeb6fe['lastOperationId'])||this['_crash']('realtimecollaborationclient-init-service-incorrect-server-operation');}}async _connectAfterSessionHasBeenFlushed(){this['_disconnectService']();const {locale:_0x14e0a2}=this['editor'];let _0x28ab40;try{_0x28ab40=await this['_service']['getDocumentDetails']();}catch{const _0x29d660=et(_0x14e0a2,'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'](_0x29d660);}const _0x149449=_0x28ab40['currentDocumentSession']||_0x28ab40['lastDocumentSession'];if(this['_lastSyncedOperationId']!==_0x149449['lastOperationId']){const _0x1c492f=et(_0x14e0a2,'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'](_0x1c492f);}await this['_connectService'](this['editor']['model']['document']['history']['getOperations'](),!0x0);}_handleChannelDisconnected(){const _0x3e628b=this['editor']['plugins']['get'](J);if(this['_isConnected']=!0x1,!_0x3e628b['connection']||'connected'!==_0x3e628b['connection']['state'])return;this['_isChannelFlushed']=!0x0;const _0x43fe09=this['editor']['plugins']['get'](Q);_0x43fe09['channelSessions']['has'](this['_channelId'])&&_0x43fe09['unregister'](this['_channelId']),_0x3e628b['removeFromReconnectionStack'](this),this['_disconnectService']();}_disconnectService(){this['_service']['disconnect'](),this['_bufferedOperations']=[],clearTimeout(this['_sendBufferedOperationsDelayId']),this['_isPendingUpdate']=!0x1,this['_clearPendingAction'](),this['stopListening'](this['_service']);}_initSessionsHandling(_0x49b1a6){const _0x372e91=this['editor']['plugins']['get'](Q);this['listenTo'](_0x372e91,'sessionAdd:'+this['_channelId'],(_0x3b62dc,{session:_0x17cebe})=>{if(_0x17cebe['id']===_0x372e91['mySessionId']){_0x3b62dc['off']();const _0x3dfd1f=this['editor']['plugins']['has']('CommentsOnly')&&this['editor']['plugins']['get']('CommentsOnly');let _0x4df350=_0x17cebe['permissions'];_0x3dfd1f&&_0x3dfd1f['isEnabled']&&(_0x4df350=_0x4df350['filter'](_0x67d5fb=>'document:write'!==_0x67d5fb)),this['editor']['plugins']['get']('Permissions')['setPermissions'](_0x4df350,this['_channelId']);}}),_0x372e91['register'](this['_channelId'],_0x49b1a6);}_initThrowingOnDataSet(){const _0x262a78=this['editor']['data']['set'];this['editor']['data']['set']=(..._0x4a892)=>{if(!_0x4a892[_0x4a892['length']-0x1]['suppressErrorInCollaboration'])throw new _0x18939e('realtimecollaborationclient-editor-setdata-and-editor-data-set-are-forbidden-in-real-time-collaboration',this);_0x262a78['apply'](this['editor']['data'],_0x4a892);};}_setUpDataInit(){this['editor']['data']['on']('init',(_0x2d7fa8,[_0x2fb6e4])=>{if(this['_document']['version'])throw new _0x18939e('realtimecollaborationclient-init-document-already-initialized',this);_0x2d7fa8['stop'](),this['_setPendingAction']();const _0x343714=Object['fromEntries'](Object['entries'](this['editor']['config']['get']('roots')||{})['filter'](([,_0x5e209d])=>!_0x5e209d['lazyLoad'])['map'](([_0x30def2,_0x5200b5])=>[_0x30def2,_0x5200b5['modelAttributes']||{}])),_0x5c08b4=this['_getOperationsFromInitData'](_0x2fb6e4,_0x343714);0x0==_0x5c08b4['length']&&_0x5c08b4['push'](new _0x14b2ce(0x0)),_0x2d7fa8['return']=this['_connectService'](_0x5c08b4)['then'](()=>{this['editor']['plugins']['get'](J)['addToReconnectionStack'](this),this['editor']['data']['fire']('ready');})['catch'](_0x4bfcea=>this['_crash']('realtimecollaborationclient-init-connection-failed',_0x4bfcea))['finally'](()=>this['_clearPendingAction']());},{'priority':'high'}),this['editor']['on']('loadRoot',async(_0x3fac09,[_0x46268c,_0x4ba14e])=>{_0x3fac09['stop']();const _0x4303ef=this['editor']['model']['document']['getRoot'](_0x46268c);if(!this['_knownRootNames']['has'](_0x46268c)){const _0x359fe7=_0x4ba14e&&_0x4ba14e['data']?_0x4ba14e['data']:'',_0x2a032a=_0x4ba14e&&_0x4ba14e['attributes']?_0x4ba14e['attributes']:{};await this['_loadRoot'](_0x46268c,_0x359fe7,_0x2a032a);}this['editor']['model']['enqueueChange']({'isUndoable':!0x1},()=>{_0x4303ef['_isLoaded']=!0x0,this['editor']['model']['document']['differ']['_bufferRootLoad'](_0x4303ef);});},{'priority':'high'});}async _fetchMissingUsers(_0x1d3882){const _0x3d57dc=this['editor']['plugins']['get'](_0x867fa1),{connection:_0x207c17}=this['editor']['plugins']['get'](J),_0xd1e5f3=new Set();for(const _0x5015f2 of _0x1d3882){const _0x207bff=_0x5015f2['_authorId'];_0x207bff&&!_0x3d57dc['getUser'](_0x207bff)&&_0xd1e5f3['add'](_0x207bff);}if(0x0===_0xd1e5f3['size'])return;const _0x46f8b2=await _0x9bed89['getMany'](_0x207c17,Array['from'](_0xd1e5f3));for(const _0x401e88 of _0x46f8b2)_0x3d57dc['getUser'](_0x401e88['id'])||_0x3d57dc['addUser'](_0x401e88);}_getOperationsFromInitData(_0x5d0015,_0x2a25af={}){const _0x5f41fb=this['editor']['model'],_0x4a1c2f=[];let _0x11dc23=0x0;const _0x2a951a='string'==typeof _0x5d0015?{'main':_0x5d0015}:_0x5d0015;for(const _0x1b73c7 of Object['keys'](_0x2a951a)){if(!this['_document']['roots']['has'](_0x1b73c7))throw new _0x18939e('realtimecollaborationclient-init-non-existent-root',this);const _0x3c8121=this['_document']['getRoot'](_0x1b73c7),_0xd20530=this['editor']['data']['parse'](_0x2a951a[_0x1b73c7],_0x3c8121),_0x5bfd7f=new _0x1daecc(_0x5f41fb['createPositionAt'](_0x3c8121,0x0),_0xd20530,_0x11dc23++);_0x4a1c2f['push'](_0x5bfd7f);for(const [_0x2d20c4,_0x107e1e]of _0xd20530['markers']){const _0x5c5525=_0x5f41fb['createRange'](_0x5f41fb['createPositionFromPath'](_0x3c8121,_0x107e1e['start']['path']['slice']()),_0x5f41fb['createPositionFromPath'](_0x3c8121,_0x107e1e['end']['path']['slice']())),_0x5f1606=new _0x43a658(_0x2d20c4,null,_0x5c5525,_0x5f41fb['markers'],!0x0,_0x11dc23++);_0x4a1c2f['push'](_0x5f1606);}}if(_0x2a25af)for(const [_0x29ec14,_0x56e112]of Object['entries'](_0x2a25af)){const _0x1b384e=_0x5f41fb['document']['getRoot'](_0x29ec14);if(!_0x1b384e)throw new _0x18939e('multi-root-editor-root-attributes-no-root',null);for(const [_0x1c695d,_0xc1febd]of Object['entries'](_0x56e112))if(null!==_0xc1febd){const _0x55afe2=new _0x4bcd32(_0x1b384e,_0x1c695d,null,_0xc1febd,_0x11dc23++);_0x4a1c2f['push'](_0x55afe2);}}return _0x4a1c2f;}async _loadRoot(_0x41fd75,_0x151f60,_0x3f128b){this['_getOperationsFromInitData']({[_0x41fd75]:_0x151f60},{[_0x41fd75]:_0x3f128b})['forEach']((_0x395f62,_0x37d94c)=>{_0x395f62['baseVersion']=this['_document']['version']+_0x37d94c,_0x395f62['_isInit']=!0x0,this['_saveOperationInBuffer'](_0x395f62);}),this['_sendBufferedOperationsDelayed'](),await this['_waitUntilSynced']();}async _handleInitialConnectionData(_0x284be8,_0x8071eb){let _0x4e1479;this['_offset']=_0x284be8['offset'];const _0x46ca69=_0x284be8['wereChangesApplied']&&!_0x284be8['initData'],_0x68cdf5=_0x46ca69?0x0:_0x284be8['data']['baseVersion'];if(_0x8071eb['forEach'](_0x1cce84=>{_0x1cce84['_isInit']=!0x0,_0x1cce84['createdAt']=_0x284be8['sessionCreatedAt'],_0x1cce84['_authorId']=null;}),_0x46ca69)_0x4e1479=_0x8071eb,this['_applyOperationsSet'](_0x4e1479,_0x46ca69);else{if(_0x284be8['initData']){const _0x59dbc8=this['_getOperationsFromInitData'](_0x284be8['initData']);this['_document']['history']['version']=-_0x59dbc8['length'],_0x59dbc8['forEach'](_0x6b9a30=>{_0x6b9a30['baseVersion']-=_0x59dbc8['length'],_0x6b9a30['createdAt']=_0x284be8['sessionCreatedAt'],_0x6b9a30['_isInit']=!0x0,_0x6b9a30['_authorId']=null;}),this['_applyOperationsSet'](_0x59dbc8,!0x0),this['serverHistory']['version']=-_0x59dbc8['length']+this['_offset'],this['_updateServerHistory'](_0x59dbc8);}this['_document']['history']['version']=_0x68cdf5,_0x4e1479=this['_decompressOperations'](_0x284be8['data'],_0x284be8['metadata']),await this['_fetchMissingUsers'](_0x4e1479),this['_applyOperationsSet'](_0x4e1479,_0x46ca69);}_0x284be8['lastOperationId']&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x4e1479,_0x284be8['lastOperationId']),this['_lastSyncedOperationId']=_0x284be8['lastOperationId']),this['serverHistory']['version']=_0x68cdf5+this['_offset'],this['_updateServerHistory'](_0x4e1479),_0x8071eb['filter'](_0xfaab52=>{const _0x17a68b=this['_getAffectedRoot'](_0xfaab52);return _0x17a68b&&!this['_knownRootNames']['has'](_0x17a68b);})['forEach']((_0x4bd0c6,_0x2c4b80)=>{_0x4bd0c6['baseVersion']=this['_document']['version']+_0x2c4b80,this['_saveOperationInBuffer'](_0x4bd0c6);}),this['_shouldSendUpdate']()?(this['_currentBufferDelay']=0x0,this['_sendBufferedOperationsDelayed'](!0x0),await this['_waitUntilSynced']()):(this['_isPendingUpdate']=!0x1,this['_clearPendingAction']());}['_crash'](_0x4f132f,_0x248e0a){const _0x288448=_0x248e0a&&_0x248e0a['message'];if(_0x288448&&_0x288448['startsWith']('realtimecollaborationclient'))throw _0x248e0a;const _0x188d8a=this['editor']['plugins']['get'](J);throw this['_isPendingUpdate']=!0x0,_0x188d8a['disconnect'](),this['editor']['enableReadOnlyMode']('realtimecollaborationclient-error'),new _0x18939e(_0x4f132f,this['editor'],_0x288448?{'originalError':_0x288448}:void 0x0);}_saveOperationInBuffer(_0x5e39d0){this['_knownOperations']['has'](_0x5e39d0)||(this['_knownOperations']['add'](_0x5e39d0),this['_bufferedOperations']['push'](_0x5e39d0),this['_pendingAction']||'marker'==_0x5e39d0['type']&&!_0x5e39d0['affectsData']||this['_setPendingAction']());}_sendBufferedOperationsDelayed(_0x30a78b=!0x1){!_0x30a78b&&this['_isPendingUpdate']||(this['_isPendingUpdate']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_sendBufferedOperationsDelayId']=setTimeout(()=>{this['_sendBufferedOperations']()['then'](_0x3a4f2b=>{_0x3a4f2b&&(this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1);})['catch'](_0x44cd20=>{this['_clearPendingAction'](),this['_isPendingUpdate']=!0x1,function(_0x3b9e5d){return _0x3b9e5d['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x3b9e5d['message']['startsWith']('cloud-services-internal-error:\x20Collaborative\x20Editing\x20Service\x20is\x20not\x20connected.')||_0x3b9e5d['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}(_0x44cd20)||this['_crash'](_0x44cd20['message'],_0x44cd20);});},this['_currentBufferDelay']));}_waitUntilSynced(){return new Promise(_0x380104=>{this['on']('change:_isPendingUpdate',()=>{_0x380104();});});}async _sendBufferedOperations(){const _0x59ad7b=this['editor']['plugins']['get'](X);if(this['_shouldSendSelectionUpdate']()&&(_0x59ad7b['createUserMarkerOperations'](),this['_hasSelectionChanged']=!0x1),!this['_shouldSendUpdate']())return!0x0;const _0xe99c03=[...this['_bufferedOperations']];for(const _0x213650 of _0xe99c03)_0x213650['wasUndone']=this['_document']['history']['isUndoneOperation'](_0x213650);const _0x151be7=this['_operationIdentifier']['getIdOfTheLastOperation'](_0xe99c03),_0x3821ce=st++,_0x38e494=this['_compressOperations'](_0xe99c03),_0x3f367e=await this['_service']['sendOperations'](_0x38e494,_0x38e494['baseVersion'],_0x151be7);try{return await this['_handleServerResponse'](_0xe99c03,_0x3f367e,_0x3821ce);}catch(_0x3e79c6){return this['_crash']('realtimecollaborationclient-sendbufferedoperations',_0x3e79c6);}}async['_handleServerResponse'](_0xe44d68,_0x2ab576,_0x2afe1e){if('error'in _0x2ab576)throw _0x2ab576['error'];let _0x32cda6;if(_0x2ab576['wereChangesApplied']){_0x2ab576['lastOperationId']&&(this['_lastSyncedOperationId']=_0x2ab576['lastOperationId']),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x51698e=>!_0xe44d68['includes'](_0x51698e));for(const _0x4208a7 of _0xe44d68)_0x4208a7['createdAt']='lastOperationAcceptedAt'in _0x2ab576&&_0x2ab576['lastOperationAcceptedAt']||void 0x0;ot(_0xe44d68,_0x2ab576['version']-_0xe44d68['length']),this['_updateServerHistory'](_0xe44d68);const _0xf95f1f=_0xe44d68['filter'](_0x4b388f=>{if(!_0x4b388f['_isInit'])return!0x1;const _0x56ffa5=this['_getAffectedRoot'](_0x4b388f);return _0x56ffa5&&!this['_knownRootNames']['has'](_0x56ffa5);});ot(_0xf95f1f,this['_document']['version']),this['_applyOperationsSet'](_0xf95f1f),_0x32cda6=!0x0,this['_currentBufferDelay']=this['_baseBufferDelay'];}else{const _0x1f5b94=this['_decompressOperations'](_0x2ab576['data'],_0x2ab576['metadata'])['filter'](_0x33a11a=>_0x33a11a['baseVersion']>=this['_lastServerVersion']);_0x1f5b94['forEach'](_0x35db8f=>this['_addKnownRoot'](_0x35db8f)),this['_bufferedOperations']=this['_bufferedOperations']['filter'](_0x423cf0=>!_0x423cf0['_isInit']||!this['_knownRootNames']['has'](this['_getAffectedRoot'](_0x423cf0))),this['_bufferedOperations']['length']&&ot(this['_bufferedOperations'],this['_bufferedOperations'][0x0]['baseVersion']),await this['_fetchMissingUsers'](_0x1f5b94),_0x32cda6=this['_handleExternalOperations'](_0x1f5b94,_0x2ab576['version'],_0x2ab576['lastOperationId']),this['_currentBufferDelay']=Math['round'](this['_currentBufferDelay']/0x2);}return _0x32cda6?!this['_shouldSendUpdate']()||(this['_sendBufferedOperationsDelayed'](!0x0),!0x1):this['_crash']('realtimecollaborationclient-handleserverresponse');}_handleExternalOperations(_0x45d29b,_0x54839b,_0x21d761){try{const _0x57b848={'document':this['_document'],'useRelations':!0x1,'padWithNoOps':!0x0},{operationsA:_0x2613fa,operationsB:_0x54971e,originalOperations:_0x385754}=_0x5e7bcc(_0x45d29b,this['_bufferedOperations'],_0x57b848);ot(_0x2613fa,this['_document']['version']),ot(_0x54971e,_0x54839b);for(const _0x3b7d47 of _0x2613fa){const _0x321055=_0x385754['get'](_0x3b7d47);_0x321055?(_0x3b7d47['_authorId']=_0x321055['_authorId'],'noop'!==_0x3b7d47['type']&&(_0x3b7d47['_aiSource']=_0x321055['_aiSource'])):_0x3b7d47['_authorId']=null;}for(const _0xea7158 of _0x54971e)'noop'!==_0xea7158['type']&&(_0xea7158['_aiSource']=_0x385754['get'](_0xea7158)?.['_aiSource']);_0x21d761&&(this['_operationIdentifier']['setIdForTheLastOperation'](_0x45d29b,_0x21d761),this['_lastSyncedOperationId']=_0x21d761),this['_bufferedOperations']=[..._0x54971e],this['_applyOperationsSet'](_0x2613fa),this['_updateServerHistory'](_0x45d29b);}catch(_0x1085b4){return console['error'](_0x1085b4),!0x1;}return!0x0;}_applyOperationsSet(_0x14f957,_0x48578f=!0x1){this['editor']['model']['enqueueChange']({'isUndoable':!0x1,'isLocal':!0x1},_0x9c976d=>{for(const _0xf52a12 of _0x14f957)this['_knownOperations']['add'](_0xf52a12),this['_addKnownRoot'](_0xf52a12),_0x9c976d['batch']['addOperation'](_0xf52a12),this['editor']['model']['applyOperation'](_0xf52a12);});}_addKnownRoot(_0x43a36f){const _0x25b095=this['_getAffectedRoot'](_0x43a36f);_0x25b095&&this['_knownRootNames']['add'](_0x25b095);}_getAffectedRoot(_0xa0c87b){let _0x1cd2f3,_0x56c0fc;switch(_0xa0c87b['type']){case'insert':_0x1cd2f3=_0xa0c87b['position']['root'];break;case'marker':if(_0x56c0fc=_0xa0c87b['newRange'],!_0x56c0fc)return null;_0x1cd2f3=_0x56c0fc['root'];break;case'addRootAttribute':_0x1cd2f3=_0xa0c87b['root'];break;case'addRoot':_0x1cd2f3=_0xa0c87b['affectedSelectable'];break;case'move':_0x1cd2f3=_0xa0c87b['targetPosition']['root'];break;default:return null;}return _0x1cd2f3['rootName'];}_updateServerHistory(_0x50e9a1){_0x50e9a1['forEach'](_0x4f134a=>{const _0x5898e5=_0x4f134a['clone']();_0x5898e5['_authorId']=_0x4f134a['_authorId'],_0x5898e5['_isInit']=!!_0x4f134a['_isInit'],_0x5898e5['_aiSource']=_0x4f134a['_aiSource'],_0x5898e5['createdAt']=_0x4f134a['createdAt'],_0x5898e5['baseVersion']+=this['_offset'],_0x4f134a['_isDisconnection']&&this['_disconnectionOperations']['add'](_0x5898e5),this['serverHistory']['addOperation'](_0x5898e5);});}_handleReconnectionError(_0x47ac4e){const _0xc9204c=this['editor']['plugins']['get']('Notification'),_0x5c5750=this['editor']['locale'];_0x47ac4e||(_0x47ac4e=et(_0x5c5750,'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.')),_0xc9204c['showWarning'](_0x47ac4e,{'title':et(_0x5c5750,'Synchronization\x20issue'),'namespace':'real-time-collaboration'}),this['_hasSynchronizationProblem']=!0x0,clearTimeout(this['_sendBufferedOperationsDelayId']),this['_bufferedOperations']=[],this['editor']['plugins']['get'](J)['disconnect']();}_setPendingAction(){this['_pendingAction']||(this['_pendingAction']=this['editor']['plugins']['get'](_0x1040cb)['add'](et(this['editor']['locale'],'PENDING_ACTION_SENDING_DATA')));}_clearPendingAction(){this['_pendingAction']&&(this['editor']['plugins']['get'](_0x1040cb)['remove'](this['_pendingAction']),this['_pendingAction']=null);}_compressOperations(_0x3e01e4){const _0x122b29=_0x3e01e4['map'](_0x3316a6=>_0x3316a6['toJSON']());return this['_compressor']['compress'](_0x122b29);}_decompressOperations(_0x2c67c9,_0x4b78a4){return this['_compressor']['decompress'](_0x2c67c9)['map']((_0x4752dc,_0x3296f1)=>{const _0x2ccd72='init'==_0x4b78a4[_0x3296f1]['type'];if('InsertOperation'==_0x4752dc['__className']){const _0x497390=_0x4752dc['position']['root'];!this['_document']['getRoot'](_0x497390)&&(this['_document']['createRoot']('$unknown',_0x497390)['_isAttached']=!0x1);}else{if('RootOperation'==_0x4752dc['__className']){const _0x51ce21=this['_document']['getRoot'](_0x4752dc['rootName']);_0x51ce21&&'$unknown'==_0x51ce21['name']&&_0x4752dc['elementName']!=_0x51ce21['name']&&(_0x51ce21['name']=_0x4752dc['elementName']);}}const _0x5a9c07=_0x37dd8e['fromJSON'](_0x4752dc,this['_document']);return _0x5a9c07['wasUndone']=_0x4752dc['wasUndone'],_0x5a9c07['_isInit']=_0x2ccd72,_0x5a9c07['_authorId']=_0x2ccd72?null:_0x4b78a4[_0x3296f1]['userId'],_0x5a9c07['_isDisconnection']='cs:removeUser'===_0x4b78a4[_0x3296f1]['type'],_0x5a9c07['_aiSource']=_0x4752dc['_aiSource']||void 0x0,_0x5a9c07['createdAt']=_0x4b78a4[_0x3296f1]['createdAt'],_0x5a9c07;});}_refreshUserSelectionMarkers(){this['_hasSelectionChanged']=!0x0,this['_shouldSendSelectionUpdate']()?this['_sendBufferedOperationsDelayed']():this['_hasSelectionChanged']=!0x1;}_shouldSendSelectionUpdate(){const _0x5e3359=this['editor']['plugins']['get'](Q)['channelSessions']['get'](this['_channelId']);return!this['editor']['isReadOnly']&&!!_0x5e3359&&_0x5e3359['length']>0x1&&this['_hasSelectionChanged'];}_shouldSendUpdate(){return this['_bufferedOperations']['length']>0x0||this['_shouldSendSelectionUpdate']();}},nt=class extends Error{};function ot(_0x5cf4d2,_0x1c813e){for(const _0x3ac200 of _0x5cf4d2)_0x3ac200['baseVersion']=_0x1c813e++;}var rt=class{_ignoredOperations;_operationToId;constructor(_0xed8675){this['_ignoredOperations']=_0xed8675,this['_operationToId']=new WeakMap();}getIdOfTheLastOperation(_0x96a1e9){let _0xe7fbaf=_0x96a1e9['length'];for(;_0xe7fbaf--;){const _0x5dc7d0=_0x96a1e9[_0xe7fbaf];if(!this['_ignoredOperations']['has'](_0x5dc7d0)){if(!this['_operationToId']['has'](_0x5dc7d0)){const _0x32119b=_0x4b2f0e()['slice'](0x1,0x12);this['_operationToId']['set'](_0x5dc7d0,_0x32119b);}return this['_operationToId']['get'](_0x5dc7d0);}}}setIdForTheLastOperation(_0x2b31a1,_0x2b9728){if(!_0x2b9728)return;let _0x3f7bb3=_0x2b31a1['length'];for(;_0x3f7bb3--;){const _0x2f9348=_0x2b31a1[_0x3f7bb3];this['_ignoredOperations']['has'](_0x2f9348)||this['_operationToId']['set'](_0x2f9348,_0x2b9728);}}},ct=class extends _0x52e8ef{static get requires(){return[it];}static get['pluginName'](){return'RealTimeCollaborativeEditing';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},at=class CloudServicesCommentsAdapter extends _0x5dbaf5{static CommentsService=/* #__PURE__ -- @preserve */
26
+ ((()=>_0x5c0c92)());['_services'];static get requires(){return[J,_0x1bbc91,Q,_0x867fa1];}static get['pluginName'](){return'CloudServicesCommentsAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x52bceb){super(_0x52bceb),this['_services']=new Map();}async init(){const _0x14c9e4=this['context'],_0x2ad3ec=_0x14c9e4['plugins']['get'](_0x1bbc91);if(_0x14c9e4['plugins']['get'](J)['addToReconnectionStack'](this),_0x2ad3ec['adapter']={'addCommentThread':async({channelId:_0x394ca2,threadId:_0x39ac77,comments:_0x372b5d,resolvedAt:_0x454d24,resolvedBy:_0x298856,context:_0x32d92f,attributes:_0x29301e})=>{const _0x2840dd=await this['_getService'](_0x394ca2)['addCommentThread']({'commentThreadId':_0x39ac77,'comments':_0x372b5d['map'](_0x25f214=>function(_0x392528,_0x3d0c85,_0xb89023){return{'commentThreadId':_0xb89023,'commentId':_0x392528['commentId'],'userId':_0x392528['authorId'],'content':_0x392528['content'],'documentId':_0x3d0c85,'createdAt':_0x392528['createdAt'],'attributes':_0x392528['attributes']||{}};}(_0x25f214,_0x394ca2,_0x39ac77)),'resolvedAt':_0x454d24,'resolvedBy':_0x298856,'context':_0x32d92f,'attributes':_0x29301e})['catch'](lt);return{'threadId':_0x2840dd['commentThreadId'],'comments':_0x2840dd['comments']};},'getCommentThread':async({channelId:_0x534c09,threadId:_0x37a05d})=>{const _0x523ec0=await this['_getService'](_0x534c09)['getCommentThread'](_0x37a05d)['catch'](ht)['catch'](lt);return _0x523ec0?_0x523ec0['deletedAt']?null:(await this['_fetchMissingUsersForThreads']([_0x523ec0]),{'threadId':_0x523ec0['commentThreadId'],'comments':_0x523ec0['comments']['map'](dt),'context':_0x523ec0['context'],'resolvedAt':_0x523ec0['resolvedAt'],'resolvedBy':_0x523ec0['resolvedBy'],'attributes':_0x523ec0['attributes']||{}}):null;},'updateCommentThread':async({channelId:_0x5ba0f7,threadId:_0x4f8d56,context:_0x15b639,unlinkedAt:_0x2b24e5,attributes:_0x26f8ac})=>this['_getService'](_0x5ba0f7)['updateCommentThread']({'commentThreadId':_0x4f8d56,'context':_0x15b639,'attributes':_0x26f8ac,'unlinkedAt':_0x2b24e5})['catch'](ht)['catch'](lt),'resolveCommentThread':async({channelId:_0x23d0f9,threadId:_0x2b69b3})=>{const _0x401930=await this['_getService'](_0x23d0f9)['resolveCommentThread'](_0x2b69b3)['catch'](ht)['catch'](lt);return{'threadId':_0x401930['commentThreadId'],'resolvedAt':_0x401930['resolvedAt'],'resolvedBy':_0x401930['resolvedBy']};},'reopenCommentThread':async({channelId:_0x462bbc,threadId:_0x539bef})=>this['_getService'](_0x462bbc)['reopenCommentThread'](_0x539bef)['catch'](ht)['catch'](lt),'removeCommentThread':({channelId:_0x3c03b6,threadId:_0x447fad})=>this['_getService'](_0x3c03b6)['removeCommentThread'](_0x447fad)['catch'](ht)['catch'](lt),'addComment':({channelId:_0x5607b0,threadId:_0x488282,commentId:_0xa9028b,content:_0x49dffa,attributes:_0x4e26a0})=>this['_getService'](_0x5607b0)['addComment'](_0x488282,_0xa9028b,_0x49dffa,_0x4e26a0)['catch'](lt),'updateComment':({channelId:_0xea42f3,threadId:_0xe21269,commentId:_0x5c2982,content:_0x119ca8,attributes:_0x4d2a8d})=>this['_getService'](_0xea42f3)['updateComment'](_0xe21269,_0x5c2982,_0x119ca8,_0x4d2a8d)['catch'](ht)['catch'](lt),'removeComment':({channelId:_0x22bb2a,threadId:_0x1a1862,commentId:_0x201010})=>this['_getService'](_0x22bb2a)['removeComment'](_0x1a1862,_0x201010)['catch'](ht)['catch'](lt)},_0x14c9e4 instanceof _0x363235){const _0x265d09=_0x14c9e4['config']['get']('collaboration.channelId'),_0x24bc08=_0x14c9e4['plugins']['get'](Q);await this['_setUpService'](_0x265d09);const _0x26a70c=await this['_services']['get'](_0x265d09)['getConnectedSessions']();this['listenTo'](_0x24bc08,'sessionAdd:'+_0x265d09,(_0x5a80c2,{session:_0x5084b9})=>{_0x5084b9['id']===_0x24bc08['mySessionId']&&(_0x5a80c2['off'](),this['context']['plugins']['get']('Permissions')['setPermissions'](_0x5084b9['permissions'],_0x265d09));}),_0x24bc08['register'](_0x265d09,_0x26a70c);}}async _setUpService(_0x42e862){if(this['_services']['has'](_0x42e862))throw new _0x18939e('cloudservicescommentsadapter-connect-already-connected',null,{'channelId':_0x42e862});const _0x35e175=this['context']['plugins']['get'](_0x1bbc91),_0x1e6d54=new CloudServicesCommentsAdapter['CommentsService'](_0x42e862);this['_services']['set'](_0x42e862,_0x1e6d54),this['listenTo'](_0x1e6d54,'commentThreadAdded',(_0x587aa5,_0x77cdd)=>{const {commentThreadId:_0x5d8f12,documentId:_0x28849b,context:_0x117e62,attributes:_0x160853,resolvedAt:_0x5e8e07,resolvedBy:_0xb854c2,comments:_0xb66b25}=_0x77cdd;_0x35e175['getCommentThread'](_0x5d8f12)||_0x35e175['addCommentThread']({'threadId':_0x5d8f12,'channelId':_0x28849b,'comments':_0xb66b25?_0xb66b25['map'](dt):[],'context':_0x117e62,'attributes':_0x160853,'resolvedAt':_0x5e8e07,'resolvedBy':_0xb854c2,'isFromAdapter':!0x0});}),this['listenTo'](_0x1e6d54,'commentThreadUpdated',(_0x4375f8,{commentThreadId:_0x3b0714,documentId:_0x264deb,context:_0x7f313d,unlinkedAt:_0x31f3de,attributes:_0x59b603})=>{_0x35e175['getCommentThread'](_0x3b0714)&&_0x35e175['updateCommentThread']({'threadId':_0x3b0714,'channelId':_0x264deb,'context':_0x7f313d,'unlinkedAt':_0x31f3de,'attributes':_0x59b603,'isFromAdapter':!0x0});}),this['listenTo'](_0x1e6d54,'commentThreadResolved',(_0x10ff54,{commentThreadId:_0x3df24a,resolvedBy:_0x5d2c39,resolvedAt:_0x47f9eb})=>{const _0x848fb8=_0x35e175['getCommentThread'](_0x3df24a);_0x848fb8&&_0x848fb8['resolve']({'resolvedBy':_0x5d2c39,'resolvedAt':_0x47f9eb,'isFromAdapter':!0x0});}),this['listenTo'](_0x1e6d54,'commentThreadReopened',(_0x4e907c,{commentThreadId:_0x3402a2})=>{const _0x3ee503=_0x35e175['getCommentThread'](_0x3402a2);_0x3ee503&&_0x3ee503['reopen']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1e6d54,'commentThreadRemoved',(_0xb36b55,{commentThreadId:_0x2172fc})=>{const _0x39d7fc=_0x35e175['getCommentThread'](_0x2172fc);_0x39d7fc&&_0x39d7fc['remove']({'isFromAdapter':!0x0});}),this['listenTo'](_0x1e6d54,'commentAdded',(_0x290671,_0x4a868a)=>{const _0x51118c=_0x4a868a['commentThreadId'],_0x53f92d=_0x35e175['getCommentThread'](_0x51118c);_0x53f92d&&_0x53f92d['addComment']({...dt(_0x4a868a),'isFromAdapter':!0x0});}),this['listenTo'](_0x1e6d54,'commentUpdated',(_0x11f3e2,{commentThreadId:_0x161da0,commentId:_0x1b5f4f,content:_0x26f75c,attributes:_0x520cf6})=>{const _0x132c01=_0x35e175['getCommentThread'](_0x161da0);if(_0x132c01){const _0x1facb9=_0x132c01['getComment'](_0x1b5f4f);_0x1facb9&&_0x1facb9['update']({'content':_0x26f75c,'attributes':_0x520cf6,'isFromAdapter':!0x0});}}),this['listenTo'](_0x1e6d54,'commentRemoved',(_0x2945bf,{commentThreadId:_0x2ba825,commentId:_0x12c538})=>{const _0x2a328b=_0x35e175['getCommentThread'](_0x2ba825);if(_0x2a328b){const _0x4e2a12=_0x2a328b['getComment'](_0x12c538);_0x4e2a12&&_0x4e2a12['remove']({'isFromAdapter':!0x0});}}),this['listenTo'](_0x1e6d54,'disconnected',()=>{'connected'===this['context']['plugins']['get'](J)['connection']?.['state']&&(this['_services']['delete'](_0x42e862),this['stopListening'](_0x1e6d54));}),await this['_connectService'](_0x42e862);}destroy(){if(this['context']instanceof _0x363235){const _0x475d26=this['context']['config']['get']('collaboration.channelId');this['_services']['has'](_0x475d26)&&this['_terminateService'](_0x475d26);}}_terminateService(_0x39a0b3){if(!this['_services']['has'](_0x39a0b3))throw new _0x18939e('cloudservicescommentsadapter-disconnect-not-exist',null,{'channelId':_0x39a0b3});this['_getService'](_0x39a0b3)['disconnect'](),this['_services']['delete'](_0x39a0b3);}async reconnect(){for(const _0x8293e7 of this['_services']['keys']())await this['_connectService'](_0x8293e7);if(this['context']instanceof _0x363235){const _0x1233dd=this['context']['config']['get']('collaboration.channelId');if(this['_services']['has'](_0x1233dd)){const _0x438a33=this['context']['plugins']['get'](Q);_0x438a33['unregister'](_0x1233dd);const _0x341f66=await this['_services']['get'](_0x1233dd)['getConnectedSessions']();_0x438a33['register'](_0x1233dd,_0x341f66);}}}async _connectService(_0x20b4ca){const {connection:_0x1bfb2d}=this['context']['plugins']['get'](J),_0x43a64d=this['context']['plugins']['get'](_0x1bbc91),_0x4a3db1=await this['_services']['get'](_0x20b4ca)['connect'](_0x1bfb2d);await this['_fetchMissingUsersForThreads'](_0x4a3db1);const _0x21f537=new Set(Array['from'](_0x43a64d['getCommentThreads']({'channelId':_0x20b4ca}),_0x34354f=>_0x34354f['id']));for(const _0x4af48e of _0x4a3db1)_0x4af48e['deletedAt']||_0x21f537['delete'](_0x4af48e['commentThreadId']);for(const _0x5683e8 of _0x21f537)_0x43a64d['getCommentThread'](_0x5683e8)['remove']({'isFromAdapter':!0x0});for(const _0x3213c2 of _0x4a3db1){let _0x2128ac=_0x43a64d['getCommentThread'](_0x3213c2['commentThreadId']);const {commentThreadId:_0xfd7bde,context:_0x249f4d,attributes:_0x2201d7,resolvedBy:_0x4b03e9,resolvedAt:_0x2d3272,unlinkedAt:_0x5d38e9,deletedAt:_0x5dab3a}=_0x3213c2;if(_0x5dab3a)continue;_0x2128ac||(_0x2128ac=_0x43a64d['addCommentThread']({'channelId':_0x20b4ca,'threadId':_0xfd7bde,'context':_0x249f4d,'attributes':_0x2201d7||{},'resolvedBy':_0x4b03e9,'resolvedAt':_0x2d3272,'unlinkedAt':_0x5d38e9,'isFromAdapter':!0x0}));const _0x3dab6e=new Set(Array['from'](_0x2128ac['comments'],_0x3fa800=>_0x3fa800['id']));for(const _0x59f007 of _0x3213c2['comments'])_0x3dab6e['delete'](_0x59f007['commentId']);for(const _0x2bcad3 of _0x3dab6e)_0x2128ac['getComment'](_0x2bcad3)['remove']({'isFromAdapter':!0x0});for(const _0x2aa714 of _0x3213c2['comments']){const _0x4a45d3=_0x2128ac['getComment'](_0x2aa714['commentId']);_0x4a45d3?_0x4a45d3['content']!==_0x2aa714['content']&&_0x4a45d3['update']({'content':_0x2aa714['content'],'isFromAdapter':!0x0}):_0x2128ac['addComment'](Object['assign'](dt(_0x2aa714),{'isFromAdapter':!0x0}));}}}_getService(_0x5d8b9f){if(!this['_services']['has'](_0x5d8b9f))throw new _0x18939e('cloudservicescommentsadapter-service-not-exist',null,{'channelId':_0x5d8b9f});return this['_services']['get'](_0x5d8b9f);}async _fetchMissingUsersForThreads(_0x158fda){const _0x5150b0=this['context']['plugins']['get'](_0x867fa1),{connection:_0x438f8a}=this['context']['plugins']['get'](J),_0x1fc98e=new Set();for(const {resolvedBy:_0x3341f9,comments:_0xd2143b}of _0x158fda){_0x3341f9&&!_0x5150b0['getUser'](_0x3341f9)&&_0x1fc98e['add'](_0x3341f9);for(const {userId:_0x411e79}of _0xd2143b)_0x5150b0['getUser'](_0x411e79)||_0x1fc98e['add'](_0x411e79);}if(0x0===_0x1fc98e['size'])return;const _0x50982d=await _0x9bed89['getMany'](_0x438f8a,Array['from'](_0x1fc98e));for(const _0x3117d2 of _0x50982d)_0x5150b0['getUser'](_0x3117d2['id'])||_0x5150b0['addUser'](_0x3117d2);}};async function ht(_0x37486e){if('404'!==_0x37486e['code'])throw _0x37486e;}function lt(_0x59fe5f){if((_0x33c2a8=_0x59fe5f)['message']['startsWith']('cloud-services-internal-error:\x20Comments\x20Service\x20is\x20not\x20connected.')||_0x33c2a8['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x33c2a8['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.'))return new Promise(()=>{});var _0x33c2a8;throw _0x59fe5f;}function dt(_0x3acf4f){return{'threadId':_0x3acf4f['commentThreadId'],'commentId':_0x3acf4f['commentId'],'content':_0x3acf4f['content'],'createdAt':_0x3acf4f['createdAt'],'authorId':_0x3acf4f['userId'],'attributes':_0x3acf4f['attributes']||{}};}var ut=class CloudServicesTrackChangesAdapter extends _0x52e8ef{static ['TrackChangesService']=/* #__PURE__ -- @preserve */
27
+ ((()=>_0x127256)());_bufferedRequests;_trackChangesService;static get requires(){return[at,_0x66e8c5,J];}static get['pluginName'](){return'CloudServicesTrackChangesAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0xf9db65){super(_0xf9db65);const _0x236665=this['editor']['config']['get']('collaboration.channelId');this['_bufferedRequests']=new Map(),this['_trackChangesService']=new CloudServicesTrackChangesAdapter['TrackChangesService'](_0x236665);}init(){const _0x5aa004=this['editor']['plugins']['get'](J),_0x66c637=this['editor']['plugins']['get'](_0x66e8c5);return _0x66c637['adapter']={'getSuggestion':async _0x1aa949=>{await this['_waitForServiceReady']();const _0x4fb7fe=await this['_trackChangesService']['get'](_0x1aa949)['catch'](ft);return await this['_fetchMissingUsersForThreads']([_0x4fb7fe]),_0x4fb7fe;},'addSuggestion':async({id:_0x14620f,type:_0x36bc94,data:_0x29b140,originalSuggestionId:_0x9f54a9,attributes:_0x12b48e})=>{await this['_waitForServiceReady']();const _0x48c8ba={'id':_0x14620f,'type':_0x36bc94,'data':_0x29b140,'originalSuggestionId':_0x9f54a9,'attributes':_0x12b48e},_0x50eefc=await this['_trackChangesService']['add'](_0x14620f,_0x36bc94,_0x29b140,_0x9f54a9,_0x12b48e)['catch'](_0x1e45ff=>{if(mt(_0x1e45ff))return new Promise(_0x2dd89e=>{this['_bufferedRequests']['set'](_0x14620f,{'resolve':_0x2dd89e,'suggestionData':_0x48c8ba});});throw _0x1e45ff;});return this['_bufferedRequests']['delete'](_0x14620f),_0x50eefc;},'updateSuggestion':async(_0x9da2e,_0x397fa5)=>{if(await this['_waitForServiceReady'](),'open'!==_0x397fa5['state'])return this['_trackChangesService']['update'](_0x9da2e,_0x397fa5)['catch'](ft);}},this['listenTo'](this['_trackChangesService'],'suggestionUpdated',(_0xfb889e,_0x1e217f)=>{_0x66c637['hasSuggestion'](_0x1e217f['id'])&&(_0x66c637['getSuggestion'](_0x1e217f['id'])['attributes']=_0x1e217f['attributes']);}),this['listenTo'](this['_trackChangesService'],'disconnected',()=>{'connected'===_0x5aa004['connection']?.['state']&&(_0x5aa004['removeFromReconnectionStack'](this),this['stopListening'](this['_trackChangesService']));}),this['_trackChangesService']['connect'](_0x5aa004['connection'])['then'](_0xce8856=>(_0x5aa004['addToReconnectionStack'](this),this['_fetchMissingUsersForThreads'](_0xce8856)['then'](()=>{for(const _0x323590 of _0xce8856){_0x66c637['addSuggestionData'](_0x323590)['_saved']=!0x0;}})));}async reconnect(){const _0x1a810c=this['editor']['plugins']['get']('TrackChangesEditing'),{connection:_0x24c65d}=this['editor']['plugins']['get'](J),_0xb0a7b7=await this['_trackChangesService']['connect'](_0x24c65d);await this['_fetchMissingUsersForThreads'](_0xb0a7b7);for(const {suggestionData:_0x1e35b4,resolve:_0x353f46}of this['_bufferedRequests']['values']()){let _0xf2e2d8=_0xb0a7b7['find'](_0x3e4d5e=>_0x3e4d5e['id']===_0x1e35b4['id']);_0xf2e2d8||(_0xf2e2d8=await this['_trackChangesService']['add'](_0x1e35b4['id'],_0x1e35b4['type'],_0x1e35b4['data'],_0x1e35b4['originalSuggestionId'])),_0x353f46(_0xf2e2d8);}for(const _0x43fddf of _0xb0a7b7)_0x1a810c['hasSuggestion'](_0x43fddf['id'])||_0x1a810c['addSuggestionData'](_0x43fddf);}async _waitForServiceReady(){this['_trackChangesService']['isConnected']||await new Promise(_0x138c96=>{this['listenTo'](this['_trackChangesService'],'connected',_0x14e757=>{_0x14e757['off'](),_0x138c96();});});}async _fetchMissingUsersForThreads(_0xfae57){const _0x44bcdc=this['editor']['plugins']['get'](_0x867fa1),{connection:_0x63db62}=this['editor']['plugins']['get'](J),_0xcbbe48=new Set();for(const {authorId:_0x19c20e}of _0xfae57)_0x44bcdc['getUser'](_0x19c20e)||_0xcbbe48['add'](_0x19c20e);if(0x0===_0xcbbe48['size'])return;const _0x3f4b64=await _0x9bed89['getMany'](_0x63db62,Array['from'](_0xcbbe48));for(const _0x47e636 of _0x3f4b64)_0x44bcdc['getUser'](_0x47e636['id'])||_0x44bcdc['addUser'](_0x47e636);}};function ft(_0x2474e8){if(mt(_0x2474e8))return new Promise(()=>{});throw _0x2474e8;}function mt(_0x292d61){return _0x292d61['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0x292d61['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var pt=class extends _0x52e8ef{static get requires(){return[_0x381f45,at,ct,J];}static get['pluginName'](){return'RealTimeCollaborativeComments';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}init(){const _0x131483=this['editor']['plugins']['get'](J),_0x2bcf07=this['editor']['plugins']['get'](_0x1923ce),_0x4f78b8=this['editor']['plugins']['get'](at);return this['editor']['data']['once']('ready',()=>{this['listenTo'](_0x131483,'change:state',(_0x5d7c8e,_0x25cdbb,_0x13d8eb)=>{_0x2bcf07['isThreadsLoadingPaused']='connected'!==_0x13d8eb;});}),this['listenTo'](_0x131483,'change:state',(_0x294c1f,_0x3b7b8f,_0x3d8ee7)=>{this['editor']['plugins']['get'](_0x1bbc91)['switchReadOnly']('connected'!==_0x3d8ee7);}),_0x4f78b8['_setUpService'](this['editor']['config']['get']('collaboration.channelId'));}destroy(){const _0x4f8b61=this['editor']['plugins']['get'](at),_0x4b9d46=this['editor']['config']['get']('collaboration.channelId');_0x4f8b61['_services']['has'](_0x4b9d46)&&_0x4f8b61['_terminateService'](_0x4b9d46),super['destroy']();}},gt=class extends _0x52e8ef{static get requires(){return[pt,ut,_0x58dfb9];}static get['pluginName'](){return'RealTimeCollaborativeTrackChanges';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},wt=class CloudServicesRevisionHistoryAdapter extends _0x52e8ef{static RevisionHistoryService=/* #__PURE__ -- @preserve */
28
+ ((()=>_0x13e383)());_lastRequestId;['_revisionTracker'];_revisionHistoryService;_oldOffset;static get requires(){return[J,it,_0x31414e,Q,_0x867fa1];}static get['pluginName'](){return'CloudServicesRevisionHistoryAdapter';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x4eb18c){super(_0x4eb18c);const _0x307584=this['editor']['config']['get']('collaboration.channelId');this['_lastRequestId']=null,this['_revisionTracker']=this['editor']['plugins']['get']('RevisionTracker'),this['_revisionHistoryService']=new CloudServicesRevisionHistoryAdapter['RevisionHistoryService'](_0x307584);}async init(){const _0x106539=this['editor']['plugins']['get'](it),_0x2ae7a8=_0x106539['serverHistory'],_0x5b66f7=this['editor']['plugins']['get'](J);this['_revisionTracker']['setSource']({'history':_0x2ae7a8,'getLatestVersion':()=>this['_getLatestVersion'](),'getCurrentRevisionId':()=>_0x106539['sessionId']});const _0x4df35a=this['editor']['config']['get']('cloudServices.bundleVersion')||_0x3b79db,_0x3176c8=await _0x430b33['isBundleUploaded'](_0x5b66f7['connection'],_0x4df35a);this['editor']['plugins']['get'](_0x31414e)['adapter']={'getRevision':async({revisionId:_0x5d9da6})=>(await this['_waitForServiceReady'](),await this['_revisionHistoryService']['getRevision'](_0x5d9da6)),'updateRevisions':async _0x16585a=>{await this['_waitForServiceReady']();const _0x279901=this['_revisionTracker']['currentRevision'];if(_0x3176c8&&0x1===_0x16585a['length']&&_0x16585a[0x0]['id']===_0x279901['id'])return _0x16585a;for(const _0xcae9ea of _0x16585a)_0xcae9ea['id']===_0x279901['id']&&(_0xcae9ea['isEmptyCurrent']=_0xcae9ea['fromVersion']===_0xcae9ea['toVersion']);return this['_revisionHistoryService']['updateRevisions'](_0x16585a,this['_lastRequestId'])['then'](_0x183b2e=>(this['_lastRequestId']=_0x183b2e,_0x16585a))['catch'](_0x54ca77=>{if(vt(_0x54ca77)||'400'===_0x54ca77['code']&&void 0x0!==_0x54ca77['data']['wrongRequestId']){for(const _0x3b28f7 of _0x16585a)this['_revisionTracker']['repository']['getRevision'](_0x3b28f7['id'])&&this['_revisionTracker']['_bufferUpdate'](_0x3b28f7['id'],_0x3b28f7,!0x1);if(vt(_0x54ca77)&&'destroyed'!==this['editor']['state'])throw _0x54ca77;return _0x16585a;}throw _0x54ca77;});}},this['listenTo'](this['_revisionHistoryService'],'revisionsUpdated',(_0x4b0388,{revisionsData:_0x432019,requestId:_0x1adcc0})=>{Math['max'](..._0x432019['map'](_0x4e489a=>_0x4e489a['toVersion']))>this['_getLatestVersionFromServerOperations']()-0x1?this['_getLatestVersion']()['then'](()=>{this['_handleRevisionsUpdate'](_0x432019,_0x1adcc0);}):this['_handleRevisionsUpdate'](_0x432019,_0x1adcc0);}),this['set']('_isServiceConnected',!0x1),this['listenTo'](this['_revisionHistoryService'],'connected',()=>{this['_isServiceConnected']=!0x0;}),this['listenTo'](this['_revisionHistoryService'],'disconnected',()=>{this['_isServiceConnected']=!0x1,'connected'===_0x5b66f7['connection']?.['state']&&(_0x5b66f7['removeFromReconnectionStack'](this),this['stopListening'](this['_revisionHistoryService']));});const {revisions:_0x264bdc,requestId:_0x5149f6}=await this['_revisionHistoryService']['connect'](_0x5b66f7['connection']);_0x5b66f7['addToReconnectionStack'](this),this['_lastRequestId']=_0x5149f6,await this['_fetchMissingUsers'](_0x264bdc);for(const _0x3fc1eb of _0x264bdc)this['_revisionTracker']['addRevisionData'](_0x3fc1eb);this['listenTo'](_0x106539,'change:_isConnected',(_0x2d2f02,_0x2c8c5a,_0x58c0b5)=>{_0x58c0b5&&(this['_oldOffset']=_0x106539['_offset'],_0x2d2f02['off']());}),this['_revisionTracker']['bind']('isEnabled')['to'](this,'_isServiceConnected');}async reconnect(){const _0xd67fa7=this['editor']['plugins']['get'](J),_0x2695e1=this['editor']['plugins']['get'](it),_0x314d6e=async()=>{const _0x3351f7=this['_revisionTracker']['currentRevision'],_0x1d4da6=_0x3351f7['id'],_0x2225b4=_0x1d4da6!==_0x2695e1['sessionId'];if(_0x2225b4){const _0x23d8f0=_0x2695e1['_offset']-this['_oldOffset'],_0x22ff53=this['_getLatestVersionFromServerOperations']();if(this['_revisionTracker']['_revisionDataBuilder']['reInit'](),_0x3351f7['toVersion']+_0x23d8f0!==_0x22ff53){const _0x3ab16c=_0x3351f7['fromVersion']+_0x23d8f0,_0x594475=this['editor']['plugins']['get'](_0x867fa1),_0x5a4c82=this['_revisionTracker']['buildRevisionData']({'revision':_0x3351f7,'from':_0x3ab16c,'to':_0x22ff53});_0x5a4c82['id']=_0x3351f7['id'];const _0x44cec7=_0x5a4c82['authorsIds']['map'](_0x18c61a=>_0x594475['getUser'](_0x18c61a));_0x3351f7['_update']({..._0x5a4c82,'authors':_0x44cec7},!0x0),this['_revisionTracker']['_bufferUpdate'](_0x3351f7['id'],_0x5a4c82,!0x0);}this['_revisionTracker']['_startingVersion']=_0x22ff53,_0x3351f7['toVersion']!==_0x3351f7['fromVersion']||this['_revisionTracker']['_bufferedUpdates']['has'](_0x1d4da6)||this['_revisionTracker']['repository']['_revisions']['remove'](_0x1d4da6),this['_revisionTracker']['_createCurrentRevision'](_0x22ff53);}const {revisions:_0x3464a6,requestId:_0x3f94a9}=await this['_revisionHistoryService']['reconnect'](_0xd67fa7['connection'],this['_lastRequestId']);_0x2225b4&&_0x3464a6['length']>0x0?_0x2695e1['_handleReconnectionError']():(await this['_fetchMissingUsers'](_0x3464a6),this['_handleRevisionsUpdate'](_0x3464a6,_0x3f94a9),this['_revisionTracker']['sendBufferedUpdates']());};return _0x2695e1['_isConnected']?_0x314d6e():new Promise((_0xc76ac1,_0x2f0d53)=>{_0x2695e1['once']('change:_isConnected',()=>{_0x314d6e()['then'](_0xc76ac1)['catch'](_0x2f0d53);});});}destroy(){super['destroy']();}async _waitForServiceReady(){this['_revisionHistoryService']['isConnected']||await new Promise(_0x12ef27=>{this['listenTo'](this['_revisionHistoryService'],'connected',_0x360279=>{_0x360279['off'](),_0x12ef27();});});}_getLatestVersionFromServerOperations(){const _0x1ae91b=this['editor']['plugins']['get'](it)['serverHistory']['getOperations']()['reverse']();for(const _0x1ed653 of _0x1ae91b)if('marker'!==_0x1ed653['type']||_0x1ed653['affectsData'])return _0x1ed653['baseVersion']+0x1;}_getLatestVersion(){const _0x3fe7fe=this['editor']['plugins']['get'](it);return new Promise(_0x284d88=>{_0x3fe7fe['_isPendingUpdate']?_0x3fe7fe['once']('change:_isPendingUpdate',()=>{_0x284d88(this['_getLatestVersionFromServerOperations']());}):_0x284d88(this['_getLatestVersionFromServerOperations']());});}_handleRevisionsUpdate(_0x46f0c5,_0x3cd700){const _0x5c039d=this['_revisionTracker']['repository'];this['_lastRequestId']=_0x3cd700;for(const _0x359415 of _0x46f0c5){const _0x544518=_0x5c039d['getRevision'](_0x359415['id']);if(_0x544518){if((_0x359415['fromVersion']||_0x359415['toVersion'])&&(_0x359415['diffData']=null),_0x544518===this['_revisionTracker']['currentRevision']){const _0x24487a=Math['max'](_0x544518['toVersion'],_0x359415['toVersion']),_0x53f8d8=Math['max'](_0x544518['fromVersion'],_0x359415['fromVersion']);let _0x16004f;_0x544518['toVersion']===_0x359415['toVersion']&&_0x544518['fromVersion']===_0x359415['fromVersion']?(_0x16004f=!0x0,this['_preventResendingRevisionData'](_0x359415)):_0x359415['toVersion']===_0x24487a&&_0x359415['fromVersion']===_0x53f8d8?_0x16004f=!0x1:(_0x544518['toVersion']===_0x24487a&&_0x544518['fromVersion']===_0x53f8d8||this['_fixRevision']({'revision':_0x544518,'from':_0x53f8d8,'to':_0x24487a}),_0x16004f=!0x0),_0x16004f&&(delete _0x359415['fromVersion'],delete _0x359415['toVersion'],delete _0x359415['diffData'],delete _0x359415['createdAt'],delete _0x359415['authorsIds']);}this['_revisionTracker']['setRevisionData'](_0x359415),this['_preventResendingRevisionData'](_0x359415);}else this['_revisionTracker']['addRevisionData'](_0x359415);}const _0x5d99d8=_0x5c039d['getRevisions']();_0x5d99d8['reverse']();for(let _0x4c4e28=0x0;_0x4c4e28<_0x5d99d8['length']-0x1;_0x4c4e28++){const _0x3032bb=_0x5d99d8[_0x4c4e28],_0x11de62=_0x5d99d8[_0x4c4e28+0x1];if(_0x3032bb['fromVersion']<_0x11de62['toVersion']){const _0x230447=_0x11de62['toVersion'],_0x5de4d5=Math['max'](_0x230447,_0x3032bb['toVersion']);this['_fixRevision']({'revision':_0x3032bb,'from':_0x230447,'to':_0x5de4d5});}}}['_fixRevision']({revision:_0x1b81e9,from:_0x33ac38,to:_0x43359b}={}){const _0x316ce3=this['editor']['plugins']['get'](_0x867fa1),_0x212188=this['_revisionTracker']['buildRevisionData']({'revision':_0x1b81e9,'from':_0x33ac38,'to':_0x43359b});_0x212188['authors']=_0x212188['authorsIds']['map'](_0x36c3fc=>_0x316ce3['getUser'](_0x36c3fc)),_0x1b81e9['_update'](_0x212188);}_preventResendingRevisionData(_0x3e73b9){const _0x8f62ef={};_0x8f62ef['id']=_0x3e73b9['id'];for(const _0x28ba56 of Object['keys'](_0x3e73b9))'id'!==_0x28ba56&&(_0x8f62ef[_0x28ba56]=void 0x0);this['_revisionTracker']['_bufferUpdate'](_0x8f62ef['id'],_0x8f62ef,!0x0);}async _fetchMissingUsers(_0x57b0f1){const _0x12d9c8=this['editor']['plugins']['get'](_0x867fa1),{connection:_0x2a57ae}=this['editor']['plugins']['get'](J),_0x2be504=new Set();for(const _0x2f622a of _0x57b0f1){for(const _0x276a5d of _0x2f622a['authorsIds'])_0x43bfa2(_0x276a5d);_0x2f622a['creatorId']&&_0x43bfa2(_0x2f622a['creatorId']);}if(0x0===_0x2be504['size'])return;const _0x2bc70d=await _0x9bed89['getMany'](_0x2a57ae,Array['from'](_0x2be504));for(const _0x7f6fbb of _0x2bc70d)_0x12d9c8['getUser'](_0x7f6fbb['id'])||_0x12d9c8['addUser'](_0x7f6fbb);function _0x43bfa2(_0x2f877d){_0x12d9c8['getUser'](_0x2f877d)||_0x2be504['add'](_0x2f877d);}}};function vt(_0xc69517){return _0xc69517['message']['startsWith']('cloud-services-internal-error:\x20Revision\x20History\x20Service\x20is\x20not\x20connected.')||_0xc69517['message']['startsWith']('cloud-services-internal-error:\x20Not\x20connected.')||_0xc69517['message']['startsWith']('cloud-services-internal-error:\x20Request\x20timeout.');}var _t=class extends _0x52e8ef{static get requires(){return[_0x31414e,wt,ct];}static get['pluginName'](){return'RealTimeCollaborativeRevisionHistory';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}},yt=class extends _0x120ca6{_collapseAt;constructor(_0x24d0ae,_0x260577=0x6){super(_0x24d0ae);const _0x4438e2=this['bindTemplate'];this['set']('isHidden',!0x0),this['set']('usersCount',0x0),this['_collapseAt']=_0x260577,this['bind']('isHidden')['to'](this,'usersCount',_0x11e5ed=>_0x11e5ed<_0x260577),this['setTemplate']({'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item',_0x4438e2['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':_0x4438e2['to']('usersCount',_0x23ab03=>'+'+(_0x23ab03-this['_collapseAt']+0x2)['toString']())}]}]}]});}},bt=class extends _0x120ca6{items;keystrokes;constructor(_0x5eddea){super(_0x5eddea);const _0x45d77e=this['bindTemplate'];this['items']=this['createCollection'](),this['keystrokes']=new _0x35d8f6(),this['set']({'hasPopup':!0x1,'isExpanded':!0x1}),this['setTemplate']({'tag':'div','attributes':{'aria-haspopup':_0x45d77e['if']('hasPopup'),'aria-expanded':_0x45d77e['to']('isExpanded',_0x4b98ef=>this['hasPopup']&&String(_0x4b98ef)),'aria-label':_0x45d77e['to']('hasPopup',_0x48976a=>et(_0x5eddea,_0x48976a?'Collapsed\x20connected\x20users\x20list\x20(press\x20ENTER\x20to\x20open\x20it)':'Connected\x20users\x20list')),'role':'list','tabindex':_0x45d77e['to']('hasPopup',_0x3c84e1=>!!_0x3c84e1&&0x0),'class':['ck','ck-presence-list__list']},'children':this['items']}),this['on']('change:hasPopup',(_0xe0b047,_0x25eead,_0x1ed067)=>{this['element']&&(_0x1ed067?this['element']['setAttribute']('aria-expanded',String(this['isExpanded'])):this['element']['removeAttribute']('aria-expanded'));});}['focus'](){this['element']['focus']();}['render'](){super['render'](),this['keystrokes']['listenTo'](this['element']);}},kt=class extends _0x120ca6{counterView;inlineListView;constructor(_0x21714e,_0x5c3398=0x6){super(_0x21714e);const _0x2c9eb6=this['bindTemplate'];this['set']('isCollapsed',!0x0),this['counterView']=new yt(this['locale'],_0x5c3398),this['inlineListView']=new bt(_0x21714e),this['inlineListView']['bind']('hasPopup')['to'](this,'isCollapsed'),this['listenTo'](this['inlineListView']['items'],'change',()=>{for(const _0x293dc5 of this['inlineListView']['items'])_0x293dc5['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',_0x2c9eb6['if']('isCollapsed','ck-presence-list--collapsed')]},'children':[this['inlineListView']]});}},It=class extends _0x120ca6{listWrapperView;constructor(_0x50615e,_0x54f22a){super(_0x50615e),this['listWrapperView']=new St(_0x50615e,_0x54f22a),this['setTemplate']({'tag':'div','attributes':{'tabindex':-0x1,'role':'application','class':['ck','ck-presence-list__dropdown-list'],'aria-label':et(_0x50615e,'Connected\x20users\x20list\x20dropdown\x20menu')},'children':[this['listWrapperView']]});}},St=class extends _0xdc9acc{constructor(_0x5b14b4,_0x4a1171){super(_0x5b14b4);const _0x2de001=this['bindTemplate'];this['set']('_isScrollable',!0x1),this['setTemplate']({'tag':_0x4a1171?'div':'ul','attributes':{'class':['ck','ck-reset','ck-list','ck-presence-list__dropdown-list-wrapper',_0x2de001['if']('_isScrollable','ck-presence-list__dropdown-list-wrapper_scrollable')],'role':_0x2de001['to']('role'),'aria-label':_0x2de001['to']('ariaLabel'),'aria-labelledby':_0x2de001['to']('ariaLabelledBy')},'children':this['items']}),this['listenTo'](_0x18b49a['window'],'resize',()=>this['checkIfScrollable']()),this['items']['on']('change',()=>this['checkIfScrollable']());}['render'](){super['render'](),this['checkIfScrollable']();}['checkIfScrollable'](){const _0x526e41=this['element'];_0x526e41&&(this['_isScrollable']=Math['max'](_0x526e41['scrollHeight'],_0x526e41['clientHeight'])>0.8*window['innerHeight']);}},Tt=class extends _0x1a8f6c{['userView'];constructor(_0x242a43,_0x15809a,_0x54a947){super(_0x242a43);const _0x449135=this['bindTemplate'];this['userView']=new _0xec502c(_0x242a43,_0x15809a);const _0x40ea67={'tag':'li','attributes':{'class':['ck','ck-presence-list__dropdown-list-item'],'tabindex':-0x1,'role':'presentation','aria-label':_0x15809a['name']},'children':[this['userView'],{'tag':'span','attributes':{'class':['ck','ck-user__full-name']},'children':[{'text':_0x15809a['name']}]},{'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x15809a['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x15809a['color']['getColorVariable'](),'--ck-user-color-alpha':_0x15809a['color']['getColorAlphaVariable']()},'aria-hidden':'true'}}]};_0x54a947&&(_0x40ea67['tag']='button',_0x40ea67['on']={'click':_0x449135['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x40ea67);}['focus'](){this['element']['focus']();}},Ct=class extends _0x120ca6{['userView'];['markerView'];constructor(_0x240f74,_0x27ed43,_0x531c4c){super(_0x240f74);const _0x4a975f=this['bindTemplate'];this['set']('isFocusable',!0x1),this['set']('hasTooltip',!0x0),this['set']('tooltipPosition',''),this['userView']=new _0xec502c(_0x240f74,_0x27ed43),this['markerView']=new At(_0x240f74,_0x27ed43);const _0x42afd6=new _0x17b8ff(_0x240f74);_0x42afd6['template']['tag']='span',_0x42afd6['text']=_0x27ed43['name'];const _0x4297e2={'tag':'div','attributes':{'class':['ck','ck-presence-list__list-item'],'role':'listitem','tabindex':_0x4a975f['to']('isFocusable',_0x400ff7=>_0x400ff7?0x0:-0x1),'aria-labelledby':_0x42afd6['id'],'data-cke-tooltip-text':this['userView']['name'],'data-cke-tooltip-position':_0x4a975f['to']('tooltipPosition'),'data-cke-tooltip-disabled':_0x4a975f['to']('hasTooltip',_0x27030e=>!_0x27030e),'data-cke-tooltip-class':'ck-presence-list__list-item__tooltip'},'children':[this['userView'],this['markerView'],_0x42afd6]};_0x531c4c&&(_0x4297e2['tag']='button',_0x4297e2['on']={'click':_0x4a975f['to'](()=>this['fire']('execute'))}),this['setTemplate'](_0x4297e2);}},At=class extends _0x120ca6{constructor(_0x58699f,_0x3cc333){super(_0x58699f),this['setTemplate']({'tag':'span','attributes':{'class':['ck','ck-presence-list__marker',_0x3cc333['color']['getBackgroundColorClass']()],'style':{'--ck-user-color':_0x3cc333['color']['getColorVariable'](),'--ck-user-color-alpha':_0x3cc333['color']['getColorAlphaVariable']()},'aria-hidden':'true'}});}};const Pt={'collapseAt':0x6,'displayMe':!0x0};var Ot=class extends _0x5dbaf5{currentDisplayedUsers;['balloonPanelView'];['view'];['presenceDropdownView'];_overlayHost=null;static get['pluginName'](){return'PresenceListUI';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}constructor(_0x22d26f){super(_0x22d26f),this['context']['config']['define']('presenceList',Pt);const _0x5d80f2=_0x22d26f['config']['get']('presenceList.collapseAt');if('number'!=typeof _0x5d80f2)throw new _0x18939e('presencelist-collapseat-invalid-format',this);if(_0x5d80f2<0x1)throw new _0x18939e('presencelist-collapseat-invalid-format',this);this['_allConnectedUsers']=this['context']['plugins']['get'](Q)['allConnectedUsers'],this['set']('usersCount',0x0),this['currentDisplayedUsers']=new _0x11a6e2(),this['balloonPanelView']=new _0x57bb6a(),this['balloonPanelView']['class']='ck\x20ck-presence-list__balloon',this['view']=this['_createView'](),this['presenceDropdownView']=void 0x0;}static get requires(){return[Q];}init(){for(const _0x9fdd44 of this['_allConnectedUsers'])this['_handleUserAdd'](_0x9fdd44);this['listenTo'](this['_allConnectedUsers'],'add',(_0x1be8d9,_0x3080df)=>{this['_handleUserAdd'](_0x3080df);}),this['listenTo'](this['_allConnectedUsers'],'remove',(_0x48ae34,_0x16c2d0)=>{this['_handleUserRemove'](_0x16c2d0);});}_createView(){const _0xb9f10a=this['context'],_0x437f67=new kt(this['context']['locale'],this['context']['config']['get']('presenceList.collapseAt')),_0x43ed4c=this['balloonPanelView'];if(!_0x2df90e(_0xb9f10a['config']['get']('presenceList.container')))throw new _0x18939e('presencelist-missing-container',this);_0x437f67['counterView']['bind']('usersCount')['to'](this),_0x437f67['bind']('isCollapsed')['to'](this,'usersCount',_0x7b7343=>{const {collapseAt:_0x1b43eb}=_0xb9f10a['config']['get']('presenceList'),_0x30c9cf=_0x7b7343>=_0x1b43eb;if(_0x30c9cf&&!_0x437f67['inlineListView']['items']['find'](_0x1072b7=>_0x1072b7 instanceof yt)){const _0x32a583=this['context']['config']['get']('presenceList.collapseAt')-0x1;this['currentDisplayedUsers']['length']==_0x32a583&&this['currentDisplayedUsers']['length']>0x1&&this['currentDisplayedUsers']['remove'](this['currentDisplayedUsers']['length']-0x1),_0x437f67['inlineListView']['items']['add'](_0x437f67['counterView']);}return _0x30c9cf||this['hideDropdown'](),_0x30c9cf;}),_0x437f67['inlineListView']['items']['bindTo'](this['currentDisplayedUsers'])['using'](_0x82824d=>{const _0x1492c3=_0xb9f10a['config']['get']('presenceList'),_0x4040bb=new Ct(_0xb9f10a['locale'],_0x82824d,!!_0x1492c3['onClick']);return _0x4040bb['bind']('hasTooltip')['to'](_0x437f67,'isCollapsed',_0xb7938f=>!_0xb7938f),_0x4040bb['bind']('isFocusable')['to'](_0x437f67,'isCollapsed',_0x40f01f=>!_0x40f01f),_0x1492c3['onClick']&&this['listenTo'](_0x4040bb,'execute',()=>{this['view']['isCollapsed']||_0x1492c3['onClick'](_0x82824d,_0x4040bb['element']);}),_0x4040bb;}),_0x437f67['inlineListView']['keystrokes']['set']('Enter',(_0x325666,_0x524cfa)=>{this['view']['isCollapsed']&&(this['showDropdown'](),this['presenceDropdownView']?.['listWrapperView']['focus'](),_0x524cfa());}),_0x437f67['render'](),_0x43ed4c['render'](),_0x437f67['listenTo'](_0x437f67['inlineListView']['element'],'mouseenter',()=>{this['view']['isCollapsed']&&this['showDropdown']();});const _0x45875f=(_0x1a6f84,_0x13f492)=>{this['_hideDropdownUnlessPointerInside'](_0x13f492);};return _0x437f67['listenTo'](_0x437f67['inlineListView']['element'],'mouseleave',_0x45875f),_0x437f67['listenTo'](_0x43ed4c['element'],'mouseleave',_0x45875f),_0x1398a0({'emitter':_0x437f67,'activator':()=>_0x43ed4c['isVisible'],'contextElements':[_0x43ed4c['element'],_0x437f67['inlineListView']['element']],'callback':()=>this['hideDropdown']()}),_0xb9f10a['config']['get']('presenceList.container')['appendChild'](_0x437f67['element']),this['_overlayHost']=new _0x6295c0(this['context']['locale'],{'resolveMountTarget':()=>this['_resolveOverlayTarget'](),'resolveInlineContainer':()=>this['context']['config']['get']('presenceList.container')}),this['_overlayHost']['sync'](),this['_overlayHost']['bodyCollection']['add'](this['balloonPanelView']),_0x437f67;}_resolveOverlayTarget(){const _0x35519b=this['context']['config']['get']('presenceList.overlayContainer')||this['context']['config']['get']('ui.overlayContainer');if(_0x35519b)return _0x35519b;const _0x113a29=this['context']['config']['get']('presenceList.container');return _0x113a29?_0x9144b7(_0x113a29):null;}['_handleUserAdd'](_0x25a1ac){if(!this['context']['config']['get']('presenceList.displayMe')&&_0x25a1ac['isMe'])return;const _0x34346b=this['context']['config']['get']('presenceList.collapseAt')-0x1;for(this['usersCount']++;this['currentDisplayedUsers']['length']>=_0x34346b-(this['view']['isCollapsed']?0x1:0x0)&&this['currentDisplayedUsers']['length']>0x1;)this['currentDisplayedUsers']['remove'](0x1);const _0x314c80=_0x25a1ac['isMe']?0x0:this['currentDisplayedUsers']['length'];this['currentDisplayedUsers']['add'](_0x25a1ac,_0x314c80);}['_handleUserRemove'](_0x456454){this['usersCount']--;const {collapseAt:_0x20176e}=this['context']['config']['get']('presenceList'),_0x433c1a=this['usersCount']>=_0x20176e;if(this['currentDisplayedUsers']['get'](_0x456454['id']))this['currentDisplayedUsers']['remove'](_0x456454['id']);else{if(_0x433c1a&&this['currentDisplayedUsers']['length']+0x1===_0x20176e-0x1)return;}if(this['currentDisplayedUsers']['length']+(_0x433c1a?0x1:0x0)<this['usersCount']){for(const _0x5a2c4b of Array['from'](this['_allConnectedUsers'])['reverse']())if(!this['currentDisplayedUsers']['get'](_0x5a2c4b['id'])&&(this['currentDisplayedUsers']['add'](_0x5a2c4b,Math['min'](this['currentDisplayedUsers']['length']-(_0x433c1a?0x1:0x0),0x1)),this['currentDisplayedUsers']['length']+(_0x433c1a?0x1:0x0)===_0x20176e-0x1))return;}}['showDropdown'](){if(this['presenceDropdownView'])return;const _0x170192=this['context']['config']['get']('presenceList');this['presenceDropdownView']=new It(this['context']['locale'],!!_0x170192['onClick']),this['view']['inlineListView']['isExpanded']=!0x0;const {listWrapperView:_0x113a5b}=this['presenceDropdownView'];_0x113a5b['items']['bindTo'](this['_allConnectedUsers'])['using'](_0x5655fe=>{if(!_0x170192['displayMe']&&_0x5655fe['isMe'])return null;const _0x39d42d=new Tt(this['context']['locale'],_0x5655fe,!!_0x170192['onClick']);return _0x170192['onClick']&&this['listenTo'](_0x39d42d,'execute',()=>{_0x170192['onClick'](_0x5655fe,_0x39d42d['element']);}),_0x39d42d;}),this['_overlayHost']?.['sync'](),this['balloonPanelView']['content']['add'](this['presenceDropdownView']);const _0x1af6c9=_0x57bb6a['generatePositions']({'heightOffset':0x3,'config':{'withArrow':!0x1}});this['balloonPanelView']['pin']({'target':this['view']['inlineListView']['element'],'positions':[_0x1af6c9['southArrowNorth'],_0x1af6c9['southArrowNorthMiddleWest'],_0x1af6c9['southArrowNorthMiddleEast'],_0x1af6c9['southArrowNorthWest'],_0x1af6c9['southArrowNorthEast'],_0x1af6c9['northArrowSouth'],_0x1af6c9['northArrowSouthMiddleWest'],_0x1af6c9['northArrowSouthMiddleEast'],_0x1af6c9['northArrowSouthWest'],_0x1af6c9['northArrowSouthEast'],_0x1af6c9['viewportStickyNorth']]}),_0x113a5b['focus'](),_0x113a5b['checkIfScrollable']();const _0x4a7c84=(_0x3e9c11,_0x48a233)=>{this['hideDropdown'](),this['view']['inlineListView']['focus'](),_0x48a233();};_0x113a5b['keystrokes']['set']('Esc',_0x4a7c84),_0x113a5b['keystrokes']['set']('Shift+Tab',_0x4a7c84),_0x113a5b['keystrokes']['set']('Tab',()=>{this['view']['inlineListView']['focus'](),this['hideDropdown']();}),_0x113a5b['focusTracker']['add'](this['view']['element']),_0x113a5b['focusTracker']['on']('change:isFocused',(_0x558a27,_0x5b3153,_0x35083b)=>{_0x35083b||this['hideDropdown']();});}['hideDropdown'](){this['presenceDropdownView']&&(this['view']['inlineListView']['isExpanded']=!0x1,this['balloonPanelView']['unpin'](),this['balloonPanelView']['content']['remove'](this['presenceDropdownView']),this['presenceDropdownView']['destroy'](),this['presenceDropdownView']=void 0x0);}_hideDropdownUnlessPointerInside(_0x1180a3){this['presenceDropdownView']&&([this['view']['inlineListView']['element'],this['balloonPanelView']['element']]['some'](_0x2e743b=>_0x7e1130(_0x2e743b,_0x1180a3))||this['hideDropdown']());}destroy(){super['destroy'](),this['view']&&this['view']['isRendered']&&this['view']['destroy'](),this['_overlayHost']&&(this['_overlayHost']['destroy'](),this['_overlayHost']=null);}},xt=class extends _0x5dbaf5{static get requires(){return[Q,Ot];}static get['pluginName'](){return'PresenceList';}static get['isOfficialPlugin'](){return!0x0;}static get['isPremiumPlugin'](){return!0x0;}};export{at as CloudServicesCommentsAdapter,wt as CloudServicesRevisionHistoryAdapter,ut as CloudServicesTrackChangesAdapter,xt as PresenceList,Ot as PresenceListUI,it as RealTimeCollaborationClient,pt as RealTimeCollaborativeComments,ct as RealTimeCollaborativeEditing,_t as RealTimeCollaborativeRevisionHistory,gt as RealTimeCollaborativeTrackChanges,Q as Sessions,J as WebSocketGateway};