"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[7821],{77821:(t,e,s)=>{s.r(e),s.d(e,{ConflatableMessage:()=>a,Message:()=>o,MessageLoop:()=>n});var i,n,r=s(39233);class l{constructor(){this._first=null,this._last=null,this._size=0}get isEmpty(){return 0===this._size}get size(){return this._size}get length(){return this._size}get first(){return this._first?this._first.value:void 0}get last(){return this._last?this._last.value:void 0}get firstNode(){return this._first}get lastNode(){return this._last}*[Symbol.iterator](){let t=this._first;for(;t;)yield t.value,t=t.next}*retro(){let t=this._last;for(;t;)yield t.value,t=t.prev}*nodes(){let t=this._first;for(;t;)yield t,t=t.next}*retroNodes(){let t=this._last;for(;t;)yield t,t=t.prev}assign(t){this.clear();for(const e of t)this.addLast(e)}push(t){this.addLast(t)}pop(){return this.removeLast()}shift(t){this.addFirst(t)}unshift(){return this.removeFirst()}addFirst(t){let e=new i.LinkedListNode(this,t);return this._first?(e.next=this._first,this._first.prev=e,this._first=e):(this._first=e,this._last=e),this._size++,e}addLast(t){let e=new i.LinkedListNode(this,t);return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._first=e,this._last=e),this._size++,e}insertBefore(t,e){if(!e||e===this._first)return this.addFirst(t);if(!(e instanceof i.LinkedListNode)||e.list!==this)throw new Error("Reference node is not owned by the list.");let s=new i.LinkedListNode(this,t),n=e,r=n.prev;return s.next=n,s.prev=r,n.prev=s,r.next=s,this._size++,s}insertAfter(t,e){if(!e||e===this._last)return this.addLast(t);if(!(e instanceof i.LinkedListNode)||e.list!==this)throw new Error("Reference node is not owned by the list.");let s=new i.LinkedListNode(this,t),n=e,r=n.next;return s.next=r,s.prev=n,n.next=s,r.prev=s,this._size++,s}removeFirst(){let t=this._first;if(t)return t===this._last?(this._first=null,this._last=null):(this._first=t.next,this._first.prev=null),t.list=null,t.next=null,t.prev=null,this._size--,t.value}removeLast(){let t=this._last;if(t)return t===this._first?(this._first=null,this._last=null):(this._last=t.prev,this._last.next=null),t.list=null,t.next=null,t.prev=null,this._size--,t.value}removeNode(t){if(!(t instanceof i.LinkedListNode)||t.list!==this)throw new Error("Node is not owned by the list.");let e=t;e===this._first&&e===this._last?(this._first=null,this._last=null):e===this._first?(this._first=e.next,this._first.prev=null):e===this._last?(this._last=e.prev,this._last.next=null):(e.next.prev=e.prev,e.prev.next=e.next),e.list=null,e.next=null,e.prev=null,this._size--}clear(){let t=this._first;for(;t;){let e=t.next;t.list=null,t.prev=null,t.next=null,t=e}this._first=null,this._last=null,this._size=0}}!function(t){t.from=function(e){let s=new t;return s.assign(e),s}}(l||(l={})),function(t){t.LinkedListNode=class{constructor(t,e){this.list=null,this.next=null,this.prev=null,this.list=t,this.value=e}}}(i||(i={}));class o{constructor(t){this.type=t}get isConflatable(){return!1}conflate(t){return!1}}class a extends o{get isConflatable(){return!0}conflate(t){return!0}}!function(t){function e(t,e){let s=i.get(t);if(!s||0===s.length)return void d(t,e);let n=(0,r.every)((0,r.retro)(s),(s=>!s||function(t,e,s){let i=!0;try{i="function"==typeof t?t(e,s):t.messageHook(e,s)}catch(t){o(t)}return i}(s,t,e)));n&&d(t,e)}t.sendMessage=e,t.postMessage=function(t,e){e.isConflatable&&(0,r.some)(s,(s=>s.handler===t&&!!s.msg&&s.msg.type===e.type&&!!s.msg.isConflatable&&s.msg.conflate(e)))||_(t,e)},t.installMessageHook=function(t,e){let s=i.get(t);s&&-1!==s.indexOf(e)||(s?s.push(e):i.set(t,[e]))},t.removeMessageHook=function(t,e){let s=i.get(t);if(!s)return;let n=s.indexOf(e);-1!==n&&(s[n]=null,p(s))},t.clearData=function(t){let e=i.get(t);e&&e.length>0&&(r.ArrayExt.fill(e,null),p(e));for(const e of s)e.handler===t&&(e.handler=null,e.msg=null)},t.flush=function(){h||0===a||(f(a),h=!0,c(),h=!1)},t.getExceptionHandler=function(){return o},t.setExceptionHandler=function(t){let e=o;return o=t,e};const s=new l,i=new WeakMap,n=new Set;let o=t=>{console.error(t)},a=0,h=!1;const u="function"==typeof requestAnimationFrame?requestAnimationFrame:setImmediate,f="function"==typeof cancelAnimationFrame?cancelAnimationFrame:clearImmediate;function d(t,e){try{t.processMessage(e)}catch(t){o(t)}}function _(t,e){s.addLast({handler:t,msg:e}),0===a&&(a=u(c))}function c(){if(a=0,s.isEmpty)return;let t={handler:null,msg:null};for(s.addLast(t);;){let i=s.removeFirst();if(i===t)return;i.handler&&i.msg&&e(i.handler,i.msg)}}function p(t){0===n.size&&u(v),n.add(t)}function v(){n.forEach(g),n.clear()}function g(t){r.ArrayExt.removeAllWhere(t,m)}function m(t){return null===t}}(n||(n={}))}}]);