"use strict";(self.rspackChunk_jupyter_collaboration_extension=self.rspackChunk_jupyter_collaboration_extension||[]).push([[97],{7198(t,e,s){let l=Array.from,r=Array.isArray;s.d(e,{},{HT:l,cy:r})},6527(t,e,s){var l=s(7198),r=s(6132);let a=(t,e)=>{if(null==t||null==e)return t===e;if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:if(t.byteLength!==e.byteLength)return!1;for(let s=0;s<t.length;s++)if(t[s]!==e[s])return!1;break;case Set:if(t.size!==e.size)return!1;for(let s of t)if(!e.has(s))return!1;break;case Map:if(t.size!==e.size)return!1;for(let s of t.keys())if(!e.has(s)||!a(t.get(s),e.get(s)))return!1;break;case Object:if(r.Bw(t)!==r.Bw(e))return!1;for(let s in t)if(!r.i5(t,s)||!a(t[s],e[s]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!a(t[s],e[s]))return!1;break;default:return!1}return!0};l.cy,s.d(e,{},{EK:(t,e)=>e.includes(t),vo:a})},6505(t,e,s){s.d(e,{},{_4:(t,e,s)=>{let l=t.get(e);return void 0===l&&t.set(e,l=s()),l},vt:()=>new Map})},6132(t,e,s){let l=Object.keys;s.d(e,{},{Bw:t=>l(t).length,Tj:(t,e)=>{let s=[];for(let l in t)s.push(e(t[l],l));return s},i5:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})},1370(t,e,s){var l=s(6505),r=s(9279),a=s(7198);class n{constructor(){this._observers=l.vt()}on(t,e){l._4(this._observers,t,r.vt).add(e)}once(t,e){let s=(...l)=>{this.off(t,s),e(...l)};this.on(t,s)}off(t,e){let s=this._observers.get(t);void 0!==s&&(s.delete(e),0===s.size&&this._observers.delete(t))}emit(t,e){return a.HT((this._observers.get(t)||l.vt()).values()).forEach(t=>t(...e))}destroy(){this._observers=l.vt()}}s.d(e,{c:()=>n})},9279(t,e,s){s.d(e,{},{vt:()=>new Set})},482(t,e,s){let l=Date.now;s.d(e,{},{_g:l})},7784(t,e,s){var l=s(6214),r=s(1926),a=s(482),n=s(801),i=s(1370),h=s(6527);s(7581);class o extends i.c{constructor(t){super(),this.doc=t,this.clientID=t.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let t=a._g();null!==this.getLocalState()&&15e3<=t-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let e=[];this.meta.forEach((s,l)=>{l!==this.clientID&&3e4<=t-s.lastUpdated&&this.states.has(l)&&e.push(l)}),e.length>0&&c(this,e,"timeout")},n.RI(3e3)),t.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(t){let e=this.clientID,s=this.meta.get(e),l=void 0===s?0:s.clock+1,r=this.states.get(e);null===t?this.states.delete(e):this.states.set(e,t),this.meta.set(e,{clock:l,lastUpdated:a._g()});let n=[],i=[],o=[],c=[];null===t?c.push(e):null==r?null!=t&&n.push(e):(i.push(e),h.vo(r,t)||o.push(e)),(n.length>0||o.length>0||c.length>0)&&this.emit("change",[{added:n,updated:o,removed:c},"local"]),this.emit("update",[{added:n,updated:i,removed:c},"local"])}setLocalStateField(t,e){let s=this.getLocalState();null!==s&&this.setLocalState({...s,[t]:e})}getStates(){return this.states}}let c=(t,e,s)=>{let l=[];for(let s=0;s<e.length;s++){let r=e[s];if(t.states.has(r)){if(t.states.delete(r),r===t.clientID){let e=t.meta.get(r);t.meta.set(r,{clock:e.clock+1,lastUpdated:a._g()})}l.push(r)}}l.length>0&&(t.emit("change",[{added:[],updated:[],removed:l},s]),t.emit("update",[{added:[],updated:[],removed:l},s]))};s.d(e,{ww:()=>o},{X3:(t,e,s=t.states)=>{let r=e.length,a=l.xv();l.zd(a,r);for(let n=0;n<r;n++){let r=e[n],i=s.get(r)||null,h=t.meta.get(r).clock;l.zd(a,r),l.zd(a,h),l.Qj(a,JSON.stringify(i))}return l.Fo(a)},_g:c,tQ:(t,e,s)=>{let l=r.$C(e),n=a._g(),i=[],o=[],c=[],u=[],d=r.cw(l);for(let e=0;e<d;e++){let e=r.cw(l),s=r.cw(l),a=JSON.parse(r.t3(l)),d=t.meta.get(e),g=t.states.get(e),f=void 0===d?0:d.clock;(f<s||f===s&&null===a&&t.states.has(e))&&(null===a?e===t.clientID&&null!=t.getLocalState()?s++:t.states.delete(e):t.states.set(e,a),t.meta.set(e,{clock:s,lastUpdated:n}),void 0===d&&null!==a?i.push(e):void 0!==d&&null===a?u.push(e):null!==a&&(h.vo(a,g)||c.push(e),o.push(e)))}(i.length>0||c.length>0||u.length>0)&&t.emit("change",[{added:i,updated:c,removed:u},s]),(i.length>0||o.length>0||u.length>0)&&t.emit("update",[{added:i,updated:o,removed:u},s])}})}}]);