@jupyterlite/pyodide-kernel 0.6.0-alpha.4 → 0.6.0-alpha.5

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.
@@ -1,13 +1,13 @@
1
- var mo=Object.create;var Gn=Object.defineProperty;var go=Object.getOwnPropertyDescriptor;var _o=Object.getOwnPropertyNames;var vo=Object.getPrototypeOf,yo=Object.prototype.hasOwnProperty;var Ye=(i,e)=>()=>(i&&(e=i(i=0)),e);var E=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),wo=(i,e)=>{for(var t in e)Gn(i,t,{get:e[t],enumerable:!0})},bo=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of _o(e))!yo.call(i,s)&&s!==t&&Gn(i,s,{get:()=>e[s],enumerable:!(n=go(e,s))||n.enumerable});return i};var Ne=(i,e,t)=>(t=i!=null?mo(vo(i)):{},bo(e||!i||!i.__esModule?Gn(t,"default",{value:i,enumerable:!0}):t,i));var Zn=E(($t,Ss)=>{(function(i,e){typeof $t=="object"&&typeof Ss!="undefined"?e($t):typeof define=="function"&&define.amd?define(["exports"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_algorithm={}))})($t,function(i){"use strict";i.ArrayExt=void 0,function(h){function y(b,k,m=0,f=-1){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O){let K=(m+O)%g;if(b[K]===k)return K}return-1}h.firstIndexOf=y;function S(b,k,m=-1,f=0){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;m<f?M=m+1+(g-f):M=m-f+1;for(let O=0;O<M;++O){let K=(m-O+g)%g;if(b[K]===k)return K}return-1}h.lastIndexOf=S;function C(b,k,m=0,f=-1){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O){let K=(m+O)%g;if(k(b[K],K))return K}return-1}h.findFirstIndex=C;function N(b,k,m=-1,f=0){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;m<f?M=m+1+(g-f):M=m-f+1;for(let O=0;O<M;++O){let K=(m-O+g)%g;if(k(b[K],K))return K}return-1}h.findLastIndex=N;function J(b,k,m=0,f=-1){let g=C(b,k,m,f);return g!==-1?b[g]:void 0}h.findFirstValue=J;function z(b,k,m=-1,f=0){let g=N(b,k,m,f);return g!==-1?b[g]:void 0}h.findLastValue=z;function F(b,k,m,f=0,g=-1){let M=b.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),g<0?g=Math.max(0,g+M):g=Math.min(g,M-1);let O=f,K=g-f+1;for(;K>0;){let ye=K>>1,ht=O+ye;m(b[ht],k)<0?(O=ht+1,K-=ye+1):K=ye}return O}h.lowerBound=F;function Y(b,k,m,f=0,g=-1){let M=b.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),g<0?g=Math.max(0,g+M):g=Math.min(g,M-1);let O=f,K=g-f+1;for(;K>0;){let ye=K>>1,ht=O+ye;m(b[ht],k)>0?K=ye:(O=ht+1,K-=ye+1)}return O}h.upperBound=Y;function V(b,k,m){if(b===k)return!0;if(b.length!==k.length)return!1;for(let f=0,g=b.length;f<g;++f)if(m?!m(b[f],k[f]):b[f]!==k[f])return!1;return!0}h.shallowEqual=V;function ee(b,k={}){let{start:m,stop:f,step:g}=k;if(g===void 0&&(g=1),g===0)throw new Error("Slice `step` cannot be zero.");let M=b.length;m===void 0?m=g<0?M-1:0:m<0?m=Math.max(m+M,g<0?-1:0):m>=M&&(m=g<0?M-1:M),f===void 0?f=g<0?-1:M:f<0?f=Math.max(f+M,g<0?-1:0):f>=M&&(f=g<0?M-1:M);let O;g<0&&f>=m||g>0&&m>=f?O=0:g<0?O=Math.floor((f-m+1)/g+1):O=Math.floor((f-m-1)/g+1);let K=[];for(let ye=0;ye<O;++ye)K[ye]=b[m+ye*g];return K}h.slice=ee;function H(b,k,m){let f=b.length;if(f<=1||(k<0?k=Math.max(0,k+f):k=Math.min(k,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1),k===m))return;let g=b[k],M=k<m?1:-1;for(let O=k;O!==m;O+=M)b[O]=b[O+M];b[m]=g}h.move=H;function ce(b,k=0,m=-1){let f=b.length;if(!(f<=1))for(k<0?k=Math.max(0,k+f):k=Math.min(k,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1);k<m;){let g=b[k],M=b[m];b[k++]=M,b[m--]=g}}h.reverse=ce;function Se(b,k,m=0,f=-1){let g=b.length;if(g<=1||(m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1),m>=f))return;let M=f-m+1;if(k>0?k=k%M:k<0&&(k=(k%M+M)%M),k===0)return;let O=m+k;ce(b,m,O-1),ce(b,O,f),ce(b,m,f)}h.rotate=Se;function ke(b,k,m=0,f=-1){let g=b.length;if(g===0)return;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O)b[(m+O)%g]=k}h.fill=ke;function oo(b,k,m){let f=b.length;k<0?k=Math.max(0,k+f):k=Math.min(k,f);for(let g=f;g>k;--g)b[g]=b[g-1];b[k]=m}h.insert=oo;function pt(b,k){let m=b.length;if(k<0&&(k+=m),k<0||k>=m)return;let f=b[k];for(let g=k+1;g<m;++g)b[g-1]=b[g];return b.length=m-1,f}h.removeAt=pt;function lo(b,k,m=0,f=-1){let g=y(b,k,m,f);return g!==-1&&pt(b,g),g}h.removeFirstOf=lo;function co(b,k,m=-1,f=0){let g=S(b,k,m,f);return g!==-1&&pt(b,g),g}h.removeLastOf=co;function uo(b,k,m=0,f=-1){let g=b.length;if(g===0)return 0;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M=0;for(let O=0;O<g;++O)m<=f&&O>=m&&O<=f&&b[O]===k||f<m&&(O<=f||O>=m)&&b[O]===k?M++:M>0&&(b[O-M]=b[O]);return M>0&&(b.length=g-M),M}h.removeAllOf=uo;function po(b,k,m=0,f=-1){let g,M=C(b,k,m,f);return M!==-1&&(g=pt(b,M)),{index:M,value:g}}h.removeFirstWhere=po;function ho(b,k,m=-1,f=0){let g,M=N(b,k,m,f);return M!==-1&&(g=pt(b,M)),{index:M,value:g}}h.removeLastWhere=ho;function fo(b,k,m=0,f=-1){let g=b.length;if(g===0)return 0;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M=0;for(let O=0;O<g;++O)m<=f&&O>=m&&O<=f&&k(b[O],O)||f<m&&(O<=f||O>=m)&&k(b[O],O)?M++:M>0&&(b[O-M]=b[O]);return M>0&&(b.length=g-M),M}h.removeAllWhere=fo}(i.ArrayExt||(i.ArrayExt={}));function*e(...h){for(let y of h)yield*y}function*t(){}function*n(h,y=0){for(let S of h)yield[y++,S]}function*s(h,y){let S=0;for(let C of h)y(C,S++)&&(yield C)}function r(h,y){let S=0;for(let C of h)if(y(C,S++))return C}function a(h,y){let S=0;for(let C of h)if(y(C,S++))return S-1;return-1}function o(h,y){let S;for(let C of h){if(S===void 0){S=C;continue}y(C,S)<0&&(S=C)}return S}function u(h,y){let S;for(let C of h){if(S===void 0){S=C;continue}y(C,S)>0&&(S=C)}return S}function c(h,y){let S=!0,C,N;for(let J of h)S?(C=J,N=J,S=!1):y(J,C)<0?C=J:y(J,N)>0&&(N=J);return S?void 0:[C,N]}function d(h){return Array.from(h)}function l(h){let y={};for(let[S,C]of h)y[S]=C;return y}function p(h,y){let S=0;for(let C of h)if(y(C,S++)===!1)return}function v(h,y){let S=0;for(let C of h)if(y(C,S++)===!1)return!1;return!0}function _(h,y){let S=0;for(let C of h)if(y(C,S++))return!0;return!1}function*I(h,y){let S=0;for(let C of h)yield y(C,S++)}function*P(h,y,S){y===void 0?(y=h,h=0,S=1):S===void 0&&(S=1);let C=D.rangeLength(h,y,S);for(let N=0;N<C;N++)yield h+S*N}var D;(function(h){function y(S,C,N){return N===0?1/0:S>C&&N>0||S<C&&N<0?0:Math.ceil((C-S)/N)}h.rangeLength=y})(D||(D={}));function T(h,y,S){let C=h[Symbol.iterator](),N=0,J=C.next();if(J.done&&S===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(J.done)return S;let z=C.next();if(z.done&&S===void 0)return J.value;if(z.done)return y(S,J.value,N++);let F;S===void 0?F=y(J.value,z.value,N++):F=y(y(S,J.value,N++),z.value,N++);let Y;for(;!(Y=C.next()).done;)F=y(F,Y.value,N++);return F}function*x(h,y){for(;0<y--;)yield h}function*w(h){yield h}function*R(h){if(typeof h.retro=="function")yield*h.retro();else for(let y=h.length-1;y>-1;y--)yield h[y]}function A(h){let y=[],S=new Set,C=new Map;for(let z of h)N(z);for(let[z]of C)J(z);return y;function N(z){let[F,Y]=z,V=C.get(Y);V?V.push(F):C.set(Y,[F])}function J(z){if(S.has(z))return;S.add(z);let F=C.get(z);if(F)for(let Y of F)J(Y);y.push(z)}}function*q(h,y){let S=0;for(let C of h)S++%y===0&&(yield C)}i.StringExt=void 0,function(h){function y(z,F,Y=0){let V=new Array(F.length);for(let ee=0,H=Y,ce=F.length;ee<ce;++ee,++H){if(H=z.indexOf(F[ee],H),H===-1)return null;V[ee]=H}return V}h.findIndices=y;function S(z,F,Y=0){let V=y(z,F,Y);if(!V)return null;let ee=0;for(let H=0,ce=V.length;H<ce;++H){let Se=V[H]-Y;ee+=Se*Se}return{score:ee,indices:V}}h.matchSumOfSquares=S;function C(z,F,Y=0){let V=y(z,F,Y);if(!V)return null;let ee=0,H=Y-1;for(let ce=0,Se=V.length;ce<Se;++ce){let ke=V[ce];ee+=ke-H-1,H=ke}return{score:ee,indices:V}}h.matchSumOfDeltas=C;function N(z,F,Y){let V=[],ee=0,H=0,ce=F.length;for(;ee<ce;){let Se=F[ee],ke=F[ee];for(;++ee<ce&&F[ee]===ke+1;)ke++;H<Se&&V.push(z.slice(H,Se)),Se<ke+1&&V.push(Y(z.slice(Se,ke+1))),H=ke+1}return H<z.length&&V.push(z.slice(H)),V}h.highlight=N;function J(z,F){return z<F?-1:z>F?1:0}h.cmp=J}(i.StringExt||(i.StringExt={}));function*j(h,y){if(y<1)return;let S=h[Symbol.iterator](),C;for(;0<y--&&!(C=S.next()).done;)yield C.value}function*U(...h){let y=h.map(C=>C[Symbol.iterator]()),S=y.map(C=>C.next());for(;v(S,C=>!C.done);S=y.map(C=>C.next()))yield S.map(C=>C.value)}i.chain=e,i.each=p,i.empty=t,i.enumerate=n,i.every=v,i.filter=s,i.find=r,i.findIndex=a,i.map=I,i.max=u,i.min=o,i.minmax=c,i.once=w,i.range=P,i.reduce=T,i.repeat=x,i.retro=R,i.some=_,i.stride=q,i.take=j,i.toArray=d,i.toObject=l,i.topologicSort=A,i.zip=U})});var te=E((Wt,xs)=>{(function(i,e){typeof Wt=="object"&&typeof xs!="undefined"?e(Wt,Zn()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_coreutils={},i.lumino_algorithm))})(Wt,function(i,e){"use strict";i.JSONExt=void 0,function(c){c.emptyObject=Object.freeze({}),c.emptyArray=Object.freeze([]);function d(x){return x===null||typeof x=="boolean"||typeof x=="number"||typeof x=="string"}c.isPrimitive=d;function l(x){return Array.isArray(x)}c.isArray=l;function p(x){return!d(x)&&!l(x)}c.isObject=p;function v(x,w){if(x===w)return!0;if(d(x)||d(w))return!1;let R=l(x),A=l(w);return R!==A?!1:R&&A?I(x,w):P(x,w)}c.deepEqual=v;function _(x){return d(x)?x:l(x)?D(x):T(x)}c.deepCopy=_;function I(x,w){if(x===w)return!0;if(x.length!==w.length)return!1;for(let R=0,A=x.length;R<A;++R)if(!v(x[R],w[R]))return!1;return!0}function P(x,w){if(x===w)return!0;for(let R in x)if(x[R]!==void 0&&!(R in w))return!1;for(let R in w)if(w[R]!==void 0&&!(R in x))return!1;for(let R in x){let A=x[R],q=w[R];if(!(A===void 0&&q===void 0)&&(A===void 0||q===void 0||!v(A,q)))return!1}return!0}function D(x){let w=new Array(x.length);for(let R=0,A=x.length;R<A;++R)w[R]=_(x[R]);return w}function T(x){let w={};for(let R in x){let A=x[R];A!==void 0&&(w[R]=_(A))}return w}}(i.JSONExt||(i.JSONExt={}));class t{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(d){return this._types.indexOf(d)!==-1}getData(d){let l=this._types.indexOf(d);return l!==-1?this._values[l]:void 0}setData(d,l){this.clearData(d),this._types.push(d),this._values.push(l)}clearData(d){let l=this._types.indexOf(d);l!==-1&&(this._types.splice(l,1),this._values.splice(l,1))}clear(){this._types.length=0,this._values.length=0}}class n{constructor(d={}){this._application=null,this._validatePlugin=()=>!0,this._plugins=new Map,this._services=new Map,d.validatePlugin&&(console.info("Plugins may be rejected by the custom validation plugin method."),this._validatePlugin=d.validatePlugin)}get application(){return this._application}set application(d){if(this._application!==null)throw Error("PluginRegistry.application is already set. It cannot be overridden.");this._application=d}get deferredPlugins(){return Array.from(this._plugins).filter(([d,l])=>l.autoStart==="defer").map(([d,l])=>d)}getPluginDescription(d){var l,p;return(p=(l=this._plugins.get(d))===null||l===void 0?void 0:l.description)!==null&&p!==void 0?p:""}hasPlugin(d){return this._plugins.has(d)}isPluginActivated(d){var l,p;return(p=(l=this._plugins.get(d))===null||l===void 0?void 0:l.activated)!==null&&p!==void 0?p:!1}listPlugins(){return Array.from(this._plugins.keys())}registerPlugin(d){if(this._plugins.has(d.id))throw new TypeError(`Plugin '${d.id}' is already registered.`);if(!this._validatePlugin(d))throw new Error(`Plugin '${d.id}' is not valid.`);let l=s.createPluginData(d);s.ensureNoCycle(l,this._plugins,this._services),l.provides&&this._services.set(l.provides,l.id),this._plugins.set(l.id,l)}registerPlugins(d){for(let l of d)this.registerPlugin(l)}deregisterPlugin(d,l){let p=this._plugins.get(d);if(p){if(p.activated&&!l)throw new Error(`Plugin '${d}' is still active.`);this._plugins.delete(d)}}async activatePlugin(d){let l=this._plugins.get(d);if(!l)throw new ReferenceError(`Plugin '${d}' is not registered.`);if(l.activated)return;if(l.promise)return l.promise;let p=l.requires.map(_=>this.resolveRequiredService(_)),v=l.optional.map(_=>this.resolveOptionalService(_));return l.promise=Promise.all([...p,...v]).then(_=>l.activate.apply(void 0,[this.application,..._])).then(_=>{l.service=_,l.activated=!0,l.promise=null}).catch(_=>{throw l.promise=null,_}),l.promise}async activatePlugins(d,l={}){switch(d){case"defer":{let p=this.deferredPlugins.filter(v=>this._plugins.get(v).autoStart).map(v=>this.activatePlugin(v));await Promise.all(p);break}case"startUp":{let v=s.collectStartupPlugins(this._plugins,l).map(async _=>{try{return await this.activatePlugin(_)}catch(I){console.error(`Plugin '${_}' failed to activate.`,I)}});await Promise.all(v);break}}}async deactivatePlugin(d){let l=this._plugins.get(d);if(!l)throw new ReferenceError(`Plugin '${d}' is not registered.`);if(!l.activated)return[];if(!l.deactivate)throw new TypeError(`Plugin '${d}'#deactivate() method missing`);let p=s.findDependents(d,this._plugins,this._services),v=p.map(_=>this._plugins.get(_));for(let _ of v)if(!_.deactivate)throw new TypeError(`Plugin ${_.id}#deactivate() method missing (depends on ${d})`);for(let _ of v){let I=[..._.requires,..._.optional].map(P=>{let D=this._services.get(P);return D?this._plugins.get(D).service:null});await _.deactivate(this.application,...I),_.service=null,_.activated=!1}return p.pop(),p}async resolveRequiredService(d){let l=this._services.get(d);if(!l)throw new TypeError(`No provider for: ${d.name}.`);let p=this._plugins.get(l);return p.activated||await this.activatePlugin(l),p.service}async resolveOptionalService(d){let l=this._services.get(d);if(!l)return null;let p=this._plugins.get(l);if(!p.activated)try{await this.activatePlugin(l)}catch(v){return console.error(v),null}return p.service}}var s;(function(c){class d{constructor(P){var D,T,x,w;this._activated=!1,this._promise=null,this._service=null,this.id=P.id,this.description=(D=P.description)!==null&&D!==void 0?D:"",this.activate=P.activate,this.deactivate=(T=P.deactivate)!==null&&T!==void 0?T:null,this.provides=(x=P.provides)!==null&&x!==void 0?x:null,this.autoStart=(w=P.autoStart)!==null&&w!==void 0?w:!1,this.requires=P.requires?P.requires.slice():[],this.optional=P.optional?P.optional.slice():[]}get activated(){return this._activated}set activated(P){this._activated=P}get service(){return this._service}set service(P){this._service=P}get promise(){return this._promise}set promise(P){this._promise=P}}function l(I){return new d(I)}c.createPluginData=l;function p(I,P,D){let T=[...I.requires,...I.optional],x=R=>{if(R===I.provides)return!0;let A=D.get(R);if(!A)return!1;let q=P.get(A),j=[...q.requires,...q.optional];return j.length===0?!1:(w.push(A),j.some(x)?!0:(w.pop(),!1))};if(!I.provides||T.length===0)return;let w=[I.id];if(T.some(x))throw new ReferenceError(`Cycle detected: ${w.join(" -> ")}.`)}c.ensureNoCycle=p;function v(I,P,D){let T=new Array,x=j=>{let U=P.get(j),h=[...U.requires,...U.optional];T.push(...h.reduce((y,S)=>{let C=D.get(S);return C&&y.push([j,C]),y},[]))};for(let j of P.keys())x(j);let w=T.filter(j=>j[1]===I),R=0;for(;w.length>R;){let j=w.length,U=new Set(w.map(h=>h[0]));for(let h of U)T.filter(y=>y[1]===h).forEach(y=>{w.includes(y)||w.push(y)});R=j}let A=e.topologicSort(w),q=A.findIndex(j=>j===I);return q===-1?[I]:A.slice(0,q+1)}c.findDependents=v;function _(I,P){let D=new Set;for(let T of I.keys())I.get(T).autoStart===!0&&D.add(T);if(P.startPlugins)for(let T of P.startPlugins)D.add(T);if(P.ignorePlugins)for(let T of P.ignorePlugins)D.delete(T);return Array.from(D)}c.collectStartupPlugins=_})(s||(s={}));class r{constructor(){this.promise=new Promise((d,l)=>{this._resolve=d,this._reject=l})}resolve(d){let l=this._resolve;l(d)}reject(d){let l=this._reject;l(d)}}class a{constructor(d,l){this.name=d,this.description=l!=null?l:"",this._tokenStructuralPropertyT=null}}function o(c){let d=0;for(let l=0,p=c.length;l<p;++l)l%4===0&&(d=Math.random()*4294967295>>>0),c[l]=d&255,d>>>=8}i.Random=void 0,function(c){c.getRandomValues=(()=>{let d=typeof window!="undefined"&&(window.crypto||window.msCrypto)||null;return d&&typeof d.getRandomValues=="function"?function(p){return d.getRandomValues(p)}:o})()}(i.Random||(i.Random={}));function u(c){let d=new Uint8Array(16),l=new Array(256);for(let p=0;p<16;++p)l[p]="0"+p.toString(16);for(let p=16;p<256;++p)l[p]=p.toString(16);return function(){return c(d),d[6]=64|d[6]&15,d[8]=128|d[8]&63,l[d[0]]+l[d[1]]+l[d[2]]+l[d[3]]+"-"+l[d[4]]+l[d[5]]+"-"+l[d[6]]+l[d[7]]+"-"+l[d[8]]+l[d[9]]+"-"+l[d[10]]+l[d[11]]+l[d[12]]+l[d[13]]+l[d[14]]+l[d[15]]}}i.UUID=void 0,function(c){c.uuid4=u(i.Random.getRandomValues)}(i.UUID||(i.UUID={})),i.MimeData=t,i.PluginRegistry=n,i.PromiseDelegate=r,i.Token=a})});var X=E((Jt,Cs)=>{(function(i,e){typeof Jt=="object"&&typeof Cs!="undefined"?e(Jt,Zn(),te()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm","@lumino/coreutils"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_signaling={},i.lumino_algorithm,i.lumino_coreutils))})(Jt,function(i,e,t){"use strict";class n{constructor(o){this.sender=o}connect(o,u){return r.connect(this,o,u)}disconnect(o,u){return r.disconnect(this,o,u)}emit(o){r.emit(this,o)}}(function(a){function o(_,I){r.disconnectBetween(_,I)}a.disconnectBetween=o;function u(_){r.disconnectSender(_)}a.disconnectSender=u;function c(_){r.disconnectReceiver(_)}a.disconnectReceiver=c;function d(_){r.disconnectAll(_)}a.disconnectAll=d;function l(_){r.disconnectAll(_)}a.clearData=l;function p(){return r.exceptionHandler}a.getExceptionHandler=p;function v(_){let I=r.exceptionHandler;return r.exceptionHandler=_,I}a.setExceptionHandler=v})(n||(n={}));class s extends n{constructor(){super(...arguments),this._pending=new t.PromiseDelegate}async*[Symbol.asyncIterator](){let o=this._pending;for(;;)try{let{args:u,next:c}=await o.promise;o=c,yield u}catch{return}}emit(o){let u=this._pending,c=this._pending=new t.PromiseDelegate;u.resolve({args:o,next:c}),super.emit(o)}stop(){this._pending.promise.catch(()=>{}),this._pending.reject("stop"),this._pending=new t.PromiseDelegate}}var r;(function(a){a.exceptionHandler=j=>{console.error(j)};function o(j,U,h){h=h||void 0;let y=_.get(j.sender);if(y||(y=[],_.set(j.sender,y)),T(y,j,U,h))return!1;let S=h||U,C=I.get(S);C||(C=[],I.set(S,C));let N={signal:j,slot:U,thisArg:h};return y.push(N),C.push(N),!0}a.connect=o;function u(j,U,h){h=h||void 0;let y=_.get(j.sender);if(!y||y.length===0)return!1;let S=T(y,j,U,h);if(!S)return!1;let C=h||U,N=I.get(C);return S.signal=null,w(y),w(N),!0}a.disconnect=u;function c(j,U){let h=_.get(j);if(!h||h.length===0)return;let y=I.get(U);if(!(!y||y.length===0)){for(let S of y)S.signal&&S.signal.sender===j&&(S.signal=null);w(h),w(y)}}a.disconnectBetween=c;function d(j){let U=_.get(j);if(!(!U||U.length===0)){for(let h of U){if(!h.signal)continue;let y=h.thisArg||h.slot;h.signal=null,w(I.get(y))}w(U)}}a.disconnectSender=d;function l(j){let U=I.get(j);if(!(!U||U.length===0)){for(let h of U){if(!h.signal)continue;let y=h.signal.sender;h.signal=null,w(_.get(y))}w(U)}}a.disconnectReceiver=l;function p(j){d(j),l(j)}a.disconnectAll=p;function v(j,U){let h=_.get(j.sender);if(!(!h||h.length===0))for(let y=0,S=h.length;y<S;++y){let C=h[y];C.signal===j&&x(C,U)}}a.emit=v;let _=new WeakMap,I=new WeakMap,P=new Set,D=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;function T(j,U,h,y){return e.find(j,S=>S.signal===U&&S.slot===h&&S.thisArg===y)}function x(j,U){let{signal:h,slot:y,thisArg:S}=j;try{y.call(S,h.sender,U)}catch(C){a.exceptionHandler(C)}}function w(j){P.size===0&&D(R),P.add(j)}function R(){P.forEach(A),P.clear()}function A(j){e.ArrayExt.removeAllWhere(j,q)}function q(j){return j.signal===null}})(r||(r={})),i.Signal=n,i.Stream=s})});var Ps=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.ActivityMonitor=void 0;var ks=X(),Qn=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new ks.Signal(this),e.signal.connect(this._onSignalFired,this),this._timeout=e.timeout||1e3}get activityStopped(){return this._activityStopped}get timeout(){return this._timeout}set timeout(e){this._timeout=e}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,ks.Signal.clearData(this))}_onSignalFired(e,t){clearTimeout(this._timer),this._sender=e,this._args=t,this._timer=setTimeout(()=>{this._activityStopped.emit({sender:this._sender,args:this._args})},this._timeout)}};Ht.ActivityMonitor=Qn});var Es=E(Ms=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0})});var Rs=E(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.LruCache=void 0;var qo=128,ei=class{constructor(e={}){this._map=new Map,this._maxSize=(e==null?void 0:e.maxSize)||qo}get size(){return this._map.size}clear(){this._map.clear()}get(e){let t=this._map.get(e)||null;return t!=null&&(this._map.delete(e),this._map.set(e,t)),t}set(e,t){this._map.size>=this._maxSize&&this._map.delete(this._map.keys().next().value),this._map.set(e,t)}};Gt.LruCache=ei});var Os=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.MarkdownCodeBlocks=void 0;var Is;(function(i){i.CODE_BLOCK_MARKER="```";let e=[".markdown",".mdown",".mkdn",".md",".mkd",".mdwn",".mdtxt",".mdtext",".text",".txt",".Rmd"];class t{constructor(a){this.startLine=a,this.code="",this.endLine=-1}}i.MarkdownCodeBlock=t;function n(r){return e.indexOf(r)>-1}i.isMarkdown=n;function s(r){if(!r||r==="")return[];let a=r.split(`
1
+ var mo=Object.create;var Xn=Object.defineProperty;var go=Object.getOwnPropertyDescriptor;var _o=Object.getOwnPropertyNames;var vo=Object.getPrototypeOf,yo=Object.prototype.hasOwnProperty;var et=(i,e)=>()=>(i&&(e=i(i=0)),e);var E=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),wo=(i,e)=>{for(var t in e)Xn(i,t,{get:e[t],enumerable:!0})},bo=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of _o(e))!yo.call(i,s)&&s!==t&&Xn(i,s,{get:()=>e[s],enumerable:!(n=go(e,s))||n.enumerable});return i};var Fe=(i,e,t)=>(t=i!=null?mo(vo(i)):{},bo(e||!i||!i.__esModule?Xn(t,"default",{value:i,enumerable:!0}):t,i));var ei=E(($t,xs)=>{(function(i,e){typeof $t=="object"&&typeof xs!="undefined"?e($t):typeof define=="function"&&define.amd?define(["exports"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_algorithm={}))})($t,function(i){"use strict";i.ArrayExt=void 0,function(h){function y(b,k,m=0,f=-1){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O){let K=(m+O)%g;if(b[K]===k)return K}return-1}h.firstIndexOf=y;function S(b,k,m=-1,f=0){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;m<f?M=m+1+(g-f):M=m-f+1;for(let O=0;O<M;++O){let K=(m-O+g)%g;if(b[K]===k)return K}return-1}h.lastIndexOf=S;function C(b,k,m=0,f=-1){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O){let K=(m+O)%g;if(k(b[K],K))return K}return-1}h.findFirstIndex=C;function N(b,k,m=-1,f=0){let g=b.length;if(g===0)return-1;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;m<f?M=m+1+(g-f):M=m-f+1;for(let O=0;O<M;++O){let K=(m-O+g)%g;if(k(b[K],K))return K}return-1}h.findLastIndex=N;function H(b,k,m=0,f=-1){let g=C(b,k,m,f);return g!==-1?b[g]:void 0}h.findFirstValue=H;function L(b,k,m=-1,f=0){let g=N(b,k,m,f);return g!==-1?b[g]:void 0}h.findLastValue=L;function F(b,k,m,f=0,g=-1){let M=b.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),g<0?g=Math.max(0,g+M):g=Math.min(g,M-1);let O=f,K=g-f+1;for(;K>0;){let we=K>>1,pt=O+we;m(b[pt],k)<0?(O=pt+1,K-=we+1):K=we}return O}h.lowerBound=F;function X(b,k,m,f=0,g=-1){let M=b.length;if(M===0)return 0;f<0?f=Math.max(0,f+M):f=Math.min(f,M-1),g<0?g=Math.max(0,g+M):g=Math.min(g,M-1);let O=f,K=g-f+1;for(;K>0;){let we=K>>1,pt=O+we;m(b[pt],k)>0?K=we:(O=pt+1,K-=we+1)}return O}h.upperBound=X;function V(b,k,m){if(b===k)return!0;if(b.length!==k.length)return!1;for(let f=0,g=b.length;f<g;++f)if(m?!m(b[f],k[f]):b[f]!==k[f])return!1;return!0}h.shallowEqual=V;function ee(b,k={}){let{start:m,stop:f,step:g}=k;if(g===void 0&&(g=1),g===0)throw new Error("Slice `step` cannot be zero.");let M=b.length;m===void 0?m=g<0?M-1:0:m<0?m=Math.max(m+M,g<0?-1:0):m>=M&&(m=g<0?M-1:M),f===void 0?f=g<0?-1:M:f<0?f=Math.max(f+M,g<0?-1:0):f>=M&&(f=g<0?M-1:M);let O;g<0&&f>=m||g>0&&m>=f?O=0:g<0?O=Math.floor((f-m+1)/g+1):O=Math.floor((f-m-1)/g+1);let K=[];for(let we=0;we<O;++we)K[we]=b[m+we*g];return K}h.slice=ee;function G(b,k,m){let f=b.length;if(f<=1||(k<0?k=Math.max(0,k+f):k=Math.min(k,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1),k===m))return;let g=b[k],M=k<m?1:-1;for(let O=k;O!==m;O+=M)b[O]=b[O+M];b[m]=g}h.move=G;function ce(b,k=0,m=-1){let f=b.length;if(!(f<=1))for(k<0?k=Math.max(0,k+f):k=Math.min(k,f-1),m<0?m=Math.max(0,m+f):m=Math.min(m,f-1);k<m;){let g=b[k],M=b[m];b[k++]=M,b[m--]=g}}h.reverse=ce;function Ce(b,k,m=0,f=-1){let g=b.length;if(g<=1||(m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1),m>=f))return;let M=f-m+1;if(k>0?k=k%M:k<0&&(k=(k%M+M)%M),k===0)return;let O=m+k;ce(b,m,O-1),ce(b,O,f),ce(b,m,f)}h.rotate=Ce;function Pe(b,k,m=0,f=-1){let g=b.length;if(g===0)return;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M;f<m?M=f+1+(g-m):M=f-m+1;for(let O=0;O<M;++O)b[(m+O)%g]=k}h.fill=Pe;function oo(b,k,m){let f=b.length;k<0?k=Math.max(0,k+f):k=Math.min(k,f);for(let g=f;g>k;--g)b[g]=b[g-1];b[k]=m}h.insert=oo;function ut(b,k){let m=b.length;if(k<0&&(k+=m),k<0||k>=m)return;let f=b[k];for(let g=k+1;g<m;++g)b[g-1]=b[g];return b.length=m-1,f}h.removeAt=ut;function lo(b,k,m=0,f=-1){let g=y(b,k,m,f);return g!==-1&&ut(b,g),g}h.removeFirstOf=lo;function co(b,k,m=-1,f=0){let g=S(b,k,m,f);return g!==-1&&ut(b,g),g}h.removeLastOf=co;function uo(b,k,m=0,f=-1){let g=b.length;if(g===0)return 0;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M=0;for(let O=0;O<g;++O)m<=f&&O>=m&&O<=f&&b[O]===k||f<m&&(O<=f||O>=m)&&b[O]===k?M++:M>0&&(b[O-M]=b[O]);return M>0&&(b.length=g-M),M}h.removeAllOf=uo;function po(b,k,m=0,f=-1){let g,M=C(b,k,m,f);return M!==-1&&(g=ut(b,M)),{index:M,value:g}}h.removeFirstWhere=po;function ho(b,k,m=-1,f=0){let g,M=N(b,k,m,f);return M!==-1&&(g=ut(b,M)),{index:M,value:g}}h.removeLastWhere=ho;function fo(b,k,m=0,f=-1){let g=b.length;if(g===0)return 0;m<0?m=Math.max(0,m+g):m=Math.min(m,g-1),f<0?f=Math.max(0,f+g):f=Math.min(f,g-1);let M=0;for(let O=0;O<g;++O)m<=f&&O>=m&&O<=f&&k(b[O],O)||f<m&&(O<=f||O>=m)&&k(b[O],O)?M++:M>0&&(b[O-M]=b[O]);return M>0&&(b.length=g-M),M}h.removeAllWhere=fo}(i.ArrayExt||(i.ArrayExt={}));function*e(...h){for(let y of h)yield*y}function*t(){}function*n(h,y=0){for(let S of h)yield[y++,S]}function*s(h,y){let S=0;for(let C of h)y(C,S++)&&(yield C)}function r(h,y){let S=0;for(let C of h)if(y(C,S++))return C}function a(h,y){let S=0;for(let C of h)if(y(C,S++))return S-1;return-1}function o(h,y){let S;for(let C of h){if(S===void 0){S=C;continue}y(C,S)<0&&(S=C)}return S}function u(h,y){let S;for(let C of h){if(S===void 0){S=C;continue}y(C,S)>0&&(S=C)}return S}function c(h,y){let S=!0,C,N;for(let H of h)S?(C=H,N=H,S=!1):y(H,C)<0?C=H:y(H,N)>0&&(N=H);return S?void 0:[C,N]}function d(h){return Array.from(h)}function l(h){let y={};for(let[S,C]of h)y[S]=C;return y}function p(h,y){let S=0;for(let C of h)if(y(C,S++)===!1)return}function v(h,y){let S=0;for(let C of h)if(y(C,S++)===!1)return!1;return!0}function _(h,y){let S=0;for(let C of h)if(y(C,S++))return!0;return!1}function*I(h,y){let S=0;for(let C of h)yield y(C,S++)}function*P(h,y,S){y===void 0?(y=h,h=0,S=1):S===void 0&&(S=1);let C=D.rangeLength(h,y,S);for(let N=0;N<C;N++)yield h+S*N}var D;(function(h){function y(S,C,N){return N===0?1/0:S>C&&N>0||S<C&&N<0?0:Math.ceil((C-S)/N)}h.rangeLength=y})(D||(D={}));function q(h,y,S){let C=h[Symbol.iterator](),N=0,H=C.next();if(H.done&&S===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(H.done)return S;let L=C.next();if(L.done&&S===void 0)return H.value;if(L.done)return y(S,H.value,N++);let F;S===void 0?F=y(H.value,L.value,N++):F=y(y(S,H.value,N++),L.value,N++);let X;for(;!(X=C.next()).done;)F=y(F,X.value,N++);return F}function*x(h,y){for(;0<y--;)yield h}function*w(h){yield h}function*R(h){if(typeof h.retro=="function")yield*h.retro();else for(let y=h.length-1;y>-1;y--)yield h[y]}function U(h){let y=[],S=new Set,C=new Map;for(let L of h)N(L);for(let[L]of C)H(L);return y;function N(L){let[F,X]=L,V=C.get(X);V?V.push(F):C.set(X,[F])}function H(L){if(S.has(L))return;S.add(L);let F=C.get(L);if(F)for(let X of F)H(X);y.push(L)}}function*T(h,y){let S=0;for(let C of h)S++%y===0&&(yield C)}i.StringExt=void 0,function(h){function y(L,F,X=0){let V=new Array(F.length);for(let ee=0,G=X,ce=F.length;ee<ce;++ee,++G){if(G=L.indexOf(F[ee],G),G===-1)return null;V[ee]=G}return V}h.findIndices=y;function S(L,F,X=0){let V=y(L,F,X);if(!V)return null;let ee=0;for(let G=0,ce=V.length;G<ce;++G){let Ce=V[G]-X;ee+=Ce*Ce}return{score:ee,indices:V}}h.matchSumOfSquares=S;function C(L,F,X=0){let V=y(L,F,X);if(!V)return null;let ee=0,G=X-1;for(let ce=0,Ce=V.length;ce<Ce;++ce){let Pe=V[ce];ee+=Pe-G-1,G=Pe}return{score:ee,indices:V}}h.matchSumOfDeltas=C;function N(L,F,X){let V=[],ee=0,G=0,ce=F.length;for(;ee<ce;){let Ce=F[ee],Pe=F[ee];for(;++ee<ce&&F[ee]===Pe+1;)Pe++;G<Ce&&V.push(L.slice(G,Ce)),Ce<Pe+1&&V.push(X(L.slice(Ce,Pe+1))),G=Pe+1}return G<L.length&&V.push(L.slice(G)),V}h.highlight=N;function H(L,F){return L<F?-1:L>F?1:0}h.cmp=H}(i.StringExt||(i.StringExt={}));function*j(h,y){if(y<1)return;let S=h[Symbol.iterator](),C;for(;0<y--&&!(C=S.next()).done;)yield C.value}function*A(...h){let y=h.map(C=>C[Symbol.iterator]()),S=y.map(C=>C.next());for(;v(S,C=>!C.done);S=y.map(C=>C.next()))yield S.map(C=>C.value)}i.chain=e,i.each=p,i.empty=t,i.enumerate=n,i.every=v,i.filter=s,i.find=r,i.findIndex=a,i.map=I,i.max=u,i.min=o,i.minmax=c,i.once=w,i.range=P,i.reduce=q,i.repeat=x,i.retro=R,i.some=_,i.stride=T,i.take=j,i.toArray=d,i.toObject=l,i.topologicSort=U,i.zip=A})});var te=E((Wt,Cs)=>{(function(i,e){typeof Wt=="object"&&typeof Cs!="undefined"?e(Wt,ei()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_coreutils={},i.lumino_algorithm))})(Wt,function(i,e){"use strict";i.JSONExt=void 0,function(c){c.emptyObject=Object.freeze({}),c.emptyArray=Object.freeze([]);function d(x){return x===null||typeof x=="boolean"||typeof x=="number"||typeof x=="string"}c.isPrimitive=d;function l(x){return Array.isArray(x)}c.isArray=l;function p(x){return!d(x)&&!l(x)}c.isObject=p;function v(x,w){if(x===w)return!0;if(d(x)||d(w))return!1;let R=l(x),U=l(w);return R!==U?!1:R&&U?I(x,w):P(x,w)}c.deepEqual=v;function _(x){return d(x)?x:l(x)?D(x):q(x)}c.deepCopy=_;function I(x,w){if(x===w)return!0;if(x.length!==w.length)return!1;for(let R=0,U=x.length;R<U;++R)if(!v(x[R],w[R]))return!1;return!0}function P(x,w){if(x===w)return!0;for(let R in x)if(x[R]!==void 0&&!(R in w))return!1;for(let R in w)if(w[R]!==void 0&&!(R in x))return!1;for(let R in x){let U=x[R],T=w[R];if(!(U===void 0&&T===void 0)&&(U===void 0||T===void 0||!v(U,T)))return!1}return!0}function D(x){let w=new Array(x.length);for(let R=0,U=x.length;R<U;++R)w[R]=_(x[R]);return w}function q(x){let w={};for(let R in x){let U=x[R];U!==void 0&&(w[R]=_(U))}return w}}(i.JSONExt||(i.JSONExt={}));class t{constructor(){this._types=[],this._values=[]}types(){return this._types.slice()}hasData(d){return this._types.indexOf(d)!==-1}getData(d){let l=this._types.indexOf(d);return l!==-1?this._values[l]:void 0}setData(d,l){this.clearData(d),this._types.push(d),this._values.push(l)}clearData(d){let l=this._types.indexOf(d);l!==-1&&(this._types.splice(l,1),this._values.splice(l,1))}clear(){this._types.length=0,this._values.length=0}}class n{constructor(d={}){this._application=null,this._validatePlugin=()=>!0,this._plugins=new Map,this._services=new Map,d.validatePlugin&&(console.info("Plugins may be rejected by the custom validation plugin method."),this._validatePlugin=d.validatePlugin)}get application(){return this._application}set application(d){if(this._application!==null)throw Error("PluginRegistry.application is already set. It cannot be overridden.");this._application=d}get deferredPlugins(){return Array.from(this._plugins).filter(([d,l])=>l.autoStart==="defer").map(([d,l])=>d)}getPluginDescription(d){var l,p;return(p=(l=this._plugins.get(d))===null||l===void 0?void 0:l.description)!==null&&p!==void 0?p:""}hasPlugin(d){return this._plugins.has(d)}isPluginActivated(d){var l,p;return(p=(l=this._plugins.get(d))===null||l===void 0?void 0:l.activated)!==null&&p!==void 0?p:!1}listPlugins(){return Array.from(this._plugins.keys())}registerPlugin(d){if(this._plugins.has(d.id))throw new TypeError(`Plugin '${d.id}' is already registered.`);if(!this._validatePlugin(d))throw new Error(`Plugin '${d.id}' is not valid.`);let l=s.createPluginData(d);s.ensureNoCycle(l,this._plugins,this._services),l.provides&&this._services.set(l.provides,l.id),this._plugins.set(l.id,l)}registerPlugins(d){for(let l of d)this.registerPlugin(l)}deregisterPlugin(d,l){let p=this._plugins.get(d);if(p){if(p.activated&&!l)throw new Error(`Plugin '${d}' is still active.`);this._plugins.delete(d)}}async activatePlugin(d){let l=this._plugins.get(d);if(!l)throw new ReferenceError(`Plugin '${d}' is not registered.`);if(l.activated)return;if(l.promise)return l.promise;let p=l.requires.map(_=>this.resolveRequiredService(_)),v=l.optional.map(_=>this.resolveOptionalService(_));return l.promise=Promise.all([...p,...v]).then(_=>l.activate.apply(void 0,[this.application,..._])).then(_=>{l.service=_,l.activated=!0,l.promise=null}).catch(_=>{throw l.promise=null,_}),l.promise}async activatePlugins(d,l={}){switch(d){case"defer":{let p=this.deferredPlugins.filter(v=>this._plugins.get(v).autoStart).map(v=>this.activatePlugin(v));await Promise.all(p);break}case"startUp":{let v=s.collectStartupPlugins(this._plugins,l).map(async _=>{try{return await this.activatePlugin(_)}catch(I){console.error(`Plugin '${_}' failed to activate.`,I)}});await Promise.all(v);break}}}async deactivatePlugin(d){let l=this._plugins.get(d);if(!l)throw new ReferenceError(`Plugin '${d}' is not registered.`);if(!l.activated)return[];if(!l.deactivate)throw new TypeError(`Plugin '${d}'#deactivate() method missing`);let p=s.findDependents(d,this._plugins,this._services),v=p.map(_=>this._plugins.get(_));for(let _ of v)if(!_.deactivate)throw new TypeError(`Plugin ${_.id}#deactivate() method missing (depends on ${d})`);for(let _ of v){let I=[..._.requires,..._.optional].map(P=>{let D=this._services.get(P);return D?this._plugins.get(D).service:null});await _.deactivate(this.application,...I),_.service=null,_.activated=!1}return p.pop(),p}async resolveRequiredService(d){let l=this._services.get(d);if(!l)throw new TypeError(`No provider for: ${d.name}.`);let p=this._plugins.get(l);return p.activated||await this.activatePlugin(l),p.service}async resolveOptionalService(d){let l=this._services.get(d);if(!l)return null;let p=this._plugins.get(l);if(!p.activated)try{await this.activatePlugin(l)}catch(v){return console.error(v),null}return p.service}}var s;(function(c){class d{constructor(P){var D,q,x,w;this._activated=!1,this._promise=null,this._service=null,this.id=P.id,this.description=(D=P.description)!==null&&D!==void 0?D:"",this.activate=P.activate,this.deactivate=(q=P.deactivate)!==null&&q!==void 0?q:null,this.provides=(x=P.provides)!==null&&x!==void 0?x:null,this.autoStart=(w=P.autoStart)!==null&&w!==void 0?w:!1,this.requires=P.requires?P.requires.slice():[],this.optional=P.optional?P.optional.slice():[]}get activated(){return this._activated}set activated(P){this._activated=P}get service(){return this._service}set service(P){this._service=P}get promise(){return this._promise}set promise(P){this._promise=P}}function l(I){return new d(I)}c.createPluginData=l;function p(I,P,D){let q=[...I.requires,...I.optional],x=R=>{if(R===I.provides)return!0;let U=D.get(R);if(!U)return!1;let T=P.get(U),j=[...T.requires,...T.optional];return j.length===0?!1:(w.push(U),j.some(x)?!0:(w.pop(),!1))};if(!I.provides||q.length===0)return;let w=[I.id];if(q.some(x))throw new ReferenceError(`Cycle detected: ${w.join(" -> ")}.`)}c.ensureNoCycle=p;function v(I,P,D){let q=new Array,x=j=>{let A=P.get(j),h=[...A.requires,...A.optional];q.push(...h.reduce((y,S)=>{let C=D.get(S);return C&&y.push([j,C]),y},[]))};for(let j of P.keys())x(j);let w=q.filter(j=>j[1]===I),R=0;for(;w.length>R;){let j=w.length,A=new Set(w.map(h=>h[0]));for(let h of A)q.filter(y=>y[1]===h).forEach(y=>{w.includes(y)||w.push(y)});R=j}let U=e.topologicSort(w),T=U.findIndex(j=>j===I);return T===-1?[I]:U.slice(0,T+1)}c.findDependents=v;function _(I,P){let D=new Set;for(let q of I.keys())I.get(q).autoStart===!0&&D.add(q);if(P.startPlugins)for(let q of P.startPlugins)D.add(q);if(P.ignorePlugins)for(let q of P.ignorePlugins)D.delete(q);return Array.from(D)}c.collectStartupPlugins=_})(s||(s={}));class r{constructor(){this.promise=new Promise((d,l)=>{this._resolve=d,this._reject=l})}resolve(d){let l=this._resolve;l(d)}reject(d){let l=this._reject;l(d)}}class a{constructor(d,l){this.name=d,this.description=l!=null?l:"",this._tokenStructuralPropertyT=null}}function o(c){let d=0;for(let l=0,p=c.length;l<p;++l)l%4===0&&(d=Math.random()*4294967295>>>0),c[l]=d&255,d>>>=8}i.Random=void 0,function(c){c.getRandomValues=(()=>{let d=typeof window!="undefined"&&(window.crypto||window.msCrypto)||null;return d&&typeof d.getRandomValues=="function"?function(p){return d.getRandomValues(p)}:o})()}(i.Random||(i.Random={}));function u(c){let d=new Uint8Array(16),l=new Array(256);for(let p=0;p<16;++p)l[p]="0"+p.toString(16);for(let p=16;p<256;++p)l[p]=p.toString(16);return function(){return c(d),d[6]=64|d[6]&15,d[8]=128|d[8]&63,l[d[0]]+l[d[1]]+l[d[2]]+l[d[3]]+"-"+l[d[4]]+l[d[5]]+"-"+l[d[6]]+l[d[7]]+"-"+l[d[8]]+l[d[9]]+"-"+l[d[10]]+l[d[11]]+l[d[12]]+l[d[13]]+l[d[14]]+l[d[15]]}}i.UUID=void 0,function(c){c.uuid4=u(i.Random.getRandomValues)}(i.UUID||(i.UUID={})),i.MimeData=t,i.PluginRegistry=n,i.PromiseDelegate=r,i.Token=a})});var Z=E((Jt,ks)=>{(function(i,e){typeof Jt=="object"&&typeof ks!="undefined"?e(Jt,ei(),te()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm","@lumino/coreutils"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_signaling={},i.lumino_algorithm,i.lumino_coreutils))})(Jt,function(i,e,t){"use strict";class n{constructor(o){this.sender=o}connect(o,u){return r.connect(this,o,u)}disconnect(o,u){return r.disconnect(this,o,u)}emit(o){r.emit(this,o)}}(function(a){function o(_,I){r.disconnectBetween(_,I)}a.disconnectBetween=o;function u(_){r.disconnectSender(_)}a.disconnectSender=u;function c(_){r.disconnectReceiver(_)}a.disconnectReceiver=c;function d(_){r.disconnectAll(_)}a.disconnectAll=d;function l(_){r.disconnectAll(_)}a.clearData=l;function p(){return r.exceptionHandler}a.getExceptionHandler=p;function v(_){let I=r.exceptionHandler;return r.exceptionHandler=_,I}a.setExceptionHandler=v})(n||(n={}));class s extends n{constructor(){super(...arguments),this._pending=new t.PromiseDelegate}async*[Symbol.asyncIterator](){let o=this._pending;for(;;)try{let{args:u,next:c}=await o.promise;o=c,yield u}catch{return}}emit(o){let u=this._pending,c=this._pending=new t.PromiseDelegate;u.resolve({args:o,next:c}),super.emit(o)}stop(){this._pending.promise.catch(()=>{}),this._pending.reject("stop"),this._pending=new t.PromiseDelegate}}var r;(function(a){a.exceptionHandler=j=>{console.error(j)};function o(j,A,h){h=h||void 0;let y=_.get(j.sender);if(y||(y=[],_.set(j.sender,y)),q(y,j,A,h))return!1;let S=h||A,C=I.get(S);C||(C=[],I.set(S,C));let N={signal:j,slot:A,thisArg:h};return y.push(N),C.push(N),!0}a.connect=o;function u(j,A,h){h=h||void 0;let y=_.get(j.sender);if(!y||y.length===0)return!1;let S=q(y,j,A,h);if(!S)return!1;let C=h||A,N=I.get(C);return S.signal=null,w(y),w(N),!0}a.disconnect=u;function c(j,A){let h=_.get(j);if(!h||h.length===0)return;let y=I.get(A);if(!(!y||y.length===0)){for(let S of y)S.signal&&S.signal.sender===j&&(S.signal=null);w(h),w(y)}}a.disconnectBetween=c;function d(j){let A=_.get(j);if(!(!A||A.length===0)){for(let h of A){if(!h.signal)continue;let y=h.thisArg||h.slot;h.signal=null,w(I.get(y))}w(A)}}a.disconnectSender=d;function l(j){let A=I.get(j);if(!(!A||A.length===0)){for(let h of A){if(!h.signal)continue;let y=h.signal.sender;h.signal=null,w(_.get(y))}w(A)}}a.disconnectReceiver=l;function p(j){d(j),l(j)}a.disconnectAll=p;function v(j,A){let h=_.get(j.sender);if(!(!h||h.length===0))for(let y=0,S=h.length;y<S;++y){let C=h[y];C.signal===j&&x(C,A)}}a.emit=v;let _=new WeakMap,I=new WeakMap,P=new Set,D=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;function q(j,A,h,y){return e.find(j,S=>S.signal===A&&S.slot===h&&S.thisArg===y)}function x(j,A){let{signal:h,slot:y,thisArg:S}=j;try{y.call(S,h.sender,A)}catch(C){a.exceptionHandler(C)}}function w(j){P.size===0&&D(R),P.add(j)}function R(){P.forEach(U),P.clear()}function U(j){e.ArrayExt.removeAllWhere(j,T)}function T(j){return j.signal===null}})(r||(r={})),i.Signal=n,i.Stream=s})});var Ms=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.ActivityMonitor=void 0;var Ps=Z(),ti=class{constructor(e){this._timer=-1,this._timeout=-1,this._isDisposed=!1,this._activityStopped=new Ps.Signal(this),e.signal.connect(this._onSignalFired,this),this._timeout=e.timeout||1e3}get activityStopped(){return this._activityStopped}get timeout(){return this._timeout}set timeout(e){this._timeout=e}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,Ps.Signal.clearData(this))}_onSignalFired(e,t){clearTimeout(this._timer),this._sender=e,this._args=t,this._timer=setTimeout(()=>{this._activityStopped.emit({sender:this._sender,args:this._args})},this._timeout)}};Ht.ActivityMonitor=ti});var Is=E(Es=>{"use strict";Object.defineProperty(Es,"__esModule",{value:!0})});var Rs=E(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.LruCache=void 0;var qo=128,ni=class{constructor(e={}){this._map=new Map,this._maxSize=(e==null?void 0:e.maxSize)||qo}get size(){return this._map.size}clear(){this._map.clear()}get(e){let t=this._map.get(e)||null;return t!=null&&(this._map.delete(e),this._map.set(e,t)),t}set(e,t){this._map.size>=this._maxSize&&this._map.delete(this._map.keys().next().value),this._map.set(e,t)}};Gt.LruCache=ni});var Ds=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.MarkdownCodeBlocks=void 0;var Os;(function(i){i.CODE_BLOCK_MARKER="```";let e=[".markdown",".mdown",".mkdn",".md",".mkd",".mdwn",".mdtxt",".mdtext",".text",".txt",".Rmd"];class t{constructor(a){this.startLine=a,this.code="",this.endLine=-1}}i.MarkdownCodeBlock=t;function n(r){return e.indexOf(r)>-1}i.isMarkdown=n;function s(r){if(!r||r==="")return[];let a=r.split(`
2
2
  `),o=[],u=null;for(let c=0;c<a.length;c++){let d=a[c],l=d.indexOf(i.CODE_BLOCK_MARKER)===0,p=u!=null;if(!(!l&&!p))if(p)u&&(l?(u.endLine=c-1,o.push(u),u=null):u.code+=d+`
3
- `);else{u=new t(c);let v=d.indexOf(i.CODE_BLOCK_MARKER),_=d.lastIndexOf(i.CODE_BLOCK_MARKER);v!==_&&(u.code=d.substring(v+i.CODE_BLOCK_MARKER.length,_),u.endLine=c,o.push(u),u=null)}}return o}i.findMarkdownCodeBlocks=s})(Is||(Yt.MarkdownCodeBlocks=Is={}))});var qs=E((Gd,Ts)=>{"use strict";function Uo(i,e){var t=i;e.slice(0,-1).forEach(function(s){t=t[s]||{}});var n=e[e.length-1];return n in t}function Ds(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function js(i,e){return e==="constructor"&&typeof i[e]=="function"||e==="__proto__"}Ts.exports=function(i,e){e||(e={});var t={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(t.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?t.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(w){t.bools[w]=!0});var n={};function s(w){return n[w].some(function(R){return t.bools[R]})}Object.keys(e.alias||{}).forEach(function(w){n[w]=[].concat(e.alias[w]),n[w].forEach(function(R){n[R]=[w].concat(n[w].filter(function(A){return R!==A}))})}),[].concat(e.string).filter(Boolean).forEach(function(w){t.strings[w]=!0,n[w]&&[].concat(n[w]).forEach(function(R){t.strings[R]=!0})});var r=e.default||{},a={_:[]};function o(w,R){return t.allBools&&/^--[^=]+$/.test(R)||t.strings[w]||t.bools[w]||n[w]}function u(w,R,A){for(var q=w,j=0;j<R.length-1;j++){var U=R[j];if(js(q,U))return;q[U]===void 0&&(q[U]={}),(q[U]===Object.prototype||q[U]===Number.prototype||q[U]===String.prototype)&&(q[U]={}),q[U]===Array.prototype&&(q[U]=[]),q=q[U]}var h=R[R.length-1];js(q,h)||((q===Object.prototype||q===Number.prototype||q===String.prototype)&&(q={}),q===Array.prototype&&(q=[]),q[h]===void 0||t.bools[h]||typeof q[h]=="boolean"?q[h]=A:Array.isArray(q[h])?q[h].push(A):q[h]=[q[h],A])}function c(w,R,A){if(!(A&&t.unknownFn&&!o(w,A)&&t.unknownFn(A)===!1)){var q=!t.strings[w]&&Ds(R)?Number(R):R;u(a,w.split("."),q),(n[w]||[]).forEach(function(j){u(a,j.split("."),q)})}}Object.keys(t.bools).forEach(function(w){c(w,r[w]===void 0?!1:r[w])});var d=[];i.indexOf("--")!==-1&&(d=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var l=0;l<i.length;l++){var p=i[l],v,_;if(/^--.+=/.test(p)){var I=p.match(/^--([^=]+)=([\s\S]*)$/);v=I[1];var P=I[2];t.bools[v]&&(P=P!=="false"),c(v,P,p)}else if(/^--no-.+/.test(p))v=p.match(/^--no-(.+)/)[1],c(v,!1,p);else if(/^--.+/.test(p))v=p.match(/^--(.+)/)[1],_=i[l+1],_!==void 0&&!/^(-|--)[^-]/.test(_)&&!t.bools[v]&&!t.allBools&&(!n[v]||!s(v))?(c(v,_,p),l+=1):/^(true|false)$/.test(_)?(c(v,_==="true",p),l+=1):c(v,t.strings[v]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var D=p.slice(1,-1).split(""),T=!1,x=0;x<D.length;x++){if(_=p.slice(x+2),_==="-"){c(D[x],_,p);continue}if(/[A-Za-z]/.test(D[x])&&_[0]==="="){c(D[x],_.slice(1),p),T=!0;break}if(/[A-Za-z]/.test(D[x])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(_)){c(D[x],_,p),T=!0;break}if(D[x+1]&&D[x+1].match(/\W/)){c(D[x],p.slice(x+2),p),T=!0;break}else c(D[x],t.strings[D[x]]?"":!0,p)}v=p.slice(-1)[0],!T&&v!=="-"&&(i[l+1]&&!/^(-|--)[^-]/.test(i[l+1])&&!t.bools[v]&&(!n[v]||!s(v))?(c(v,i[l+1],p),l+=1):i[l+1]&&/^(true|false)$/.test(i[l+1])?(c(v,i[l+1]==="true",p),l+=1):c(v,t.strings[v]?"":!0,p))}else if((!t.unknownFn||t.unknownFn(p)!==!1)&&a._.push(t.strings._||!Ds(p)?p:Number(p)),e.stopEarly){a._.push.apply(a._,i.slice(l+1));break}}return Object.keys(r).forEach(function(w){Uo(a,w.split("."))||(u(a,w.split("."),r[w]),(n[w]||[]).forEach(function(R){u(a,R.split("."),r[w])}))}),e["--"]?a["--"]=d.slice():d.forEach(function(w){a._.push(w)}),a}});var Xt=E((Yd,As)=>{"use strict";function Pe(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function Us(i,e){for(var t="",n=0,s=-1,r=0,a,o=0;o<=i.length;++o){if(o<i.length)a=i.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||r===1))if(s!==o-1&&r===2){if(t.length<2||n!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var u=t.lastIndexOf("/");if(u!==t.length-1){u===-1?(t="",n=0):(t=t.slice(0,u),n=t.length-1-t.lastIndexOf("/")),s=o,r=0;continue}}else if(t.length===2||t.length===1){t="",n=0,s=o,r=0;continue}}e&&(t.length>0?t+="/..":t="..",n=2)}else t.length>0?t+="/"+i.slice(s+1,o):t=i.slice(s+1,o),n=o-s-1;s=o,r=0}else a===46&&r!==-1?++r:r=-1}return t}function Ao(i,e){var t=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+n:t+i+n:n}var it={resolve:function(){for(var e="",t=!1,n,s=arguments.length-1;s>=-1&&!t;s--){var r;s>=0?r=arguments[s]:(n===void 0&&(n=process.cwd()),r=n),Pe(r),r.length!==0&&(e=r+"/"+e,t=r.charCodeAt(0)===47)}return e=Us(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(Pe(e),e.length===0)return".";var t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Us(e,!t),e.length===0&&!t&&(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return Pe(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];Pe(n),n.length>0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":it.normalize(e)},relative:function(e,t){if(Pe(e),Pe(t),e===t||(e=it.resolve(e),t=it.resolve(t),e===t))return"";for(var n=1;n<e.length&&e.charCodeAt(n)===47;++n);for(var s=e.length,r=s-n,a=1;a<t.length&&t.charCodeAt(a)===47;++a);for(var o=t.length,u=o-a,c=r<u?r:u,d=-1,l=0;l<=c;++l){if(l===c){if(u>c){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else r>c&&(e.charCodeAt(n+l)===47?d=l:l===0&&(d=0));break}var p=e.charCodeAt(n+l),v=t.charCodeAt(a+l);if(p!==v)break;p===47&&(d=l)}var _="";for(l=n+d+1;l<=s;++l)(l===s||e.charCodeAt(l)===47)&&(_.length===0?_+="..":_+="/..");return _.length>0?_+t.slice(a+d):(a+=d,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(Pe(e),e.length===0)return".";for(var t=e.charCodeAt(0),n=t===47,s=-1,r=!0,a=e.length-1;a>=1;--a)if(t=e.charCodeAt(a),t===47){if(!r){s=a;break}}else r=!1;return s===-1?n?"/":".":n&&s===1?"//":e.slice(0,s)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Pe(e);var n=0,s=-1,r=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,u=-1;for(a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(c===47){if(!r){n=a+1;break}}else u===-1&&(r=!1,u=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(s=a):(o=-1,s=u))}return n===s?s=u:s===-1&&(s=e.length),e.slice(n,s)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!r){n=a+1;break}}else s===-1&&(r=!1,s=a+1);return s===-1?"":e.slice(n,s)}},extname:function(e){Pe(e);for(var t=-1,n=0,s=-1,r=!0,a=0,o=e.length-1;o>=0;--o){var u=e.charCodeAt(o);if(u===47){if(!r){n=o+1;break}continue}s===-1&&(r=!1,s=o+1),u===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||s===-1||a===0||a===1&&t===s-1&&t===n+1?"":e.slice(t,s)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return Ao("/",e)},parse:function(e){Pe(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var n=e.charCodeAt(0),s=n===47,r;s?(t.root="/",r=1):r=0;for(var a=-1,o=0,u=-1,c=!0,d=e.length-1,l=0;d>=r;--d){if(n=e.charCodeAt(d),n===47){if(!c){o=d+1;break}continue}u===-1&&(c=!1,u=d+1),n===46?a===-1?a=d:l!==1&&(l=1):a!==-1&&(l=-1)}return a===-1||u===-1||l===0||l===1&&a===u-1&&a===o+1?u!==-1&&(o===0&&s?t.base=t.name=e.slice(1,u):t.base=t.name=e.slice(o,u)):(o===0&&s?(t.name=e.slice(1,a),t.base=e.slice(1,u)):(t.name=e.slice(o,a),t.base=e.slice(o,u)),t.ext=e.slice(a,u)),o>0?t.dir=e.slice(0,o-1):s&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};it.posix=it;As.exports=it});var Ls=E((Xd,Ns)=>{"use strict";Ns.exports=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var Ks=E(ti=>{"use strict";var No=Object.prototype.hasOwnProperty,Lo;function zs(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function Fs(i){try{return encodeURIComponent(i)}catch{return null}}function zo(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},n;n=e.exec(i);){var s=zs(n[1]),r=zs(n[2]);s===null||r===null||s in t||(t[s]=r)}return t}function Fo(i,e){e=e||"";var t=[],n,s;typeof e!="string"&&(e="?");for(s in i)if(No.call(i,s)){if(n=i[s],!n&&(n===null||n===Lo||isNaN(n))&&(n=""),s=Fs(s),n=Fs(n),s===null||n===null)continue;t.push(s+"="+n)}return t.length?e+t.join("&"):""}ti.stringify=Fo;ti.parse=zo});var Ys=E((Qd,Gs)=>{"use strict";var Vs=Ls(),Zt=Ks(),Ko=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,$s=/[\n\r\t]/g,Bo=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Ws=/:\d+$/,Vo=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,$o=/^[a-zA-Z]:/;function ii(i){return(i||"").toString().replace(Ko,"")}var ni=[["#","hash"],["?","query"],function(e,t){return Me(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Bs={hash:1,query:1};function Js(i){var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e={};var t=e.location||{};i=i||t;var n={},s=typeof i,r;if(i.protocol==="blob:")n=new Ee(unescape(i.pathname),{});else if(s==="string"){n=new Ee(i,{});for(r in Bs)delete n[r]}else if(s==="object"){for(r in i)r in Bs||(n[r]=i[r]);n.slashes===void 0&&(n.slashes=Bo.test(i.href))}return n}function Me(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}function Hs(i,e){i=ii(i),i=i.replace($s,""),e=e||{};var t=Vo.exec(i),n=t[1]?t[1].toLowerCase():"",s=!!t[2],r=!!t[3],a=0,o;return s?r?(o=t[2]+t[3]+t[4],a=t[2].length+t[3].length):(o=t[2]+t[4],a=t[2].length):r?(o=t[3]+t[4],a=t[3].length):o=t[4],n==="file:"?a>=2&&(o=o.slice(2)):Me(n)?o=t[4]:n?s&&(o=o.slice(2)):a>=2&&Me(e.protocol)&&(o=t[4]),{protocol:n,slashes:s||Me(n),slashesCount:a,rest:o}}function Wo(i,e){if(i==="")return e;for(var t=(e||"/").split("/").slice(0,-1).concat(i.split("/")),n=t.length,s=t[n-1],r=!1,a=0;n--;)t[n]==="."?t.splice(n,1):t[n]===".."?(t.splice(n,1),a++):a&&(n===0&&(r=!0),t.splice(n,1),a--);return r&&t.unshift(""),(s==="."||s==="..")&&t.push(""),t.join("/")}function Ee(i,e,t){if(i=ii(i),i=i.replace($s,""),!(this instanceof Ee))return new Ee(i,e,t);var n,s,r,a,o,u,c=ni.slice(),d=typeof e,l=this,p=0;for(d!=="object"&&d!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=Zt.parse),e=Js(e),s=Hs(i||"",e),n=!s.protocol&&!s.slashes,l.slashes=s.slashes||n&&e.slashes,l.protocol=s.protocol||e.protocol||"",i=s.rest,(s.protocol==="file:"&&(s.slashesCount!==2||$o.test(i))||!s.slashes&&(s.protocol||s.slashesCount<2||!Me(l.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p<c.length;p++){if(a=c[p],typeof a=="function"){i=a(i,l);continue}r=a[0],u=a[1],r!==r?l[u]=i:typeof r=="string"?(o=r==="@"?i.lastIndexOf(r):i.indexOf(r),~o&&(typeof a[2]=="number"?(l[u]=i.slice(0,o),i=i.slice(o+a[2])):(l[u]=i.slice(o),i=i.slice(0,o)))):(o=r.exec(i))&&(l[u]=o[1],i=i.slice(0,o.index)),l[u]=l[u]||n&&a[3]&&e[u]||"",a[4]&&(l[u]=l[u].toLowerCase())}t&&(l.query=t(l.query)),n&&e.slashes&&l.pathname.charAt(0)!=="/"&&(l.pathname!==""||e.pathname!=="")&&(l.pathname=Wo(l.pathname,e.pathname)),l.pathname.charAt(0)!=="/"&&Me(l.protocol)&&(l.pathname="/"+l.pathname),Vs(l.port,l.protocol)||(l.host=l.hostname,l.port=""),l.username=l.password="",l.auth&&(o=l.auth.indexOf(":"),~o?(l.username=l.auth.slice(0,o),l.username=encodeURIComponent(decodeURIComponent(l.username)),l.password=l.auth.slice(o+1),l.password=encodeURIComponent(decodeURIComponent(l.password))):l.username=encodeURIComponent(decodeURIComponent(l.auth)),l.auth=l.password?l.username+":"+l.password:l.username),l.origin=l.protocol!=="file:"&&Me(l.protocol)&&l.host?l.protocol+"//"+l.host:"null",l.href=l.toString()}function Jo(i,e,t){var n=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||Zt.parse)(e)),n[i]=e;break;case"port":n[i]=e,Vs(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[i]="");break;case"hostname":n[i]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[i]=e,Ws.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!t;break;case"pathname":case"hash":if(e){var s=i==="pathname"?"/":"#";n[i]=e.charAt(0)!==s?s+e:e}else n[i]=e;break;case"username":case"password":n[i]=encodeURIComponent(e);break;case"auth":var r=e.indexOf(":");~r?(n.username=e.slice(0,r),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(r+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<ni.length;a++){var o=ni[a];o[4]&&(n[o[1]]=n[o[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Me(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function Ho(i){(!i||typeof i!="function")&&(i=Zt.stringify);var e,t=this,n=t.host,s=t.protocol;s&&s.charAt(s.length-1)!==":"&&(s+=":");var r=s+(t.protocol&&t.slashes||Me(t.protocol)?"//":"");return t.username?(r+=t.username,t.password&&(r+=":"+t.password),r+="@"):t.password?(r+=":"+t.password,r+="@"):t.protocol!=="file:"&&Me(t.protocol)&&!n&&t.pathname!=="/"&&(r+="@"),(n[n.length-1]===":"||Ws.test(t.hostname)&&!t.port)&&(n+=":"),r+=n+t.pathname,e=typeof t.query=="object"?i(t.query):t.query,e&&(r+=e.charAt(0)!=="?"?"?"+e:e),t.hash&&(r+=t.hash),r}Ee.prototype={set:Jo,toString:Ho};Ee.extractProtocol=Hs;Ee.location=Js;Ee.trimLeft=ii;Ee.qs=Zt;Gs.exports=Ee});var si=E(st=>{"use strict";var Go=st&&st.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(st,"__esModule",{value:!0});st.URLExt=void 0;var Yo=Xt(),Qt=Go(Ys()),Xs;(function(i){function e(c){if(typeof document!="undefined"&&document){let d=document.createElement("a");return d.href=c,d}return(0,Qt.default)(c)}i.parse=e;function t(c){return(0,Qt.default)(c).hostname}i.getHostName=t;function n(c){return c&&e(c).toString()}i.normalize=n;function s(...c){let d=(0,Qt.default)(c[0],{}),l=d.protocol===""&&d.slashes;l&&(d=(0,Qt.default)(c[0],"https:"+c[0]));let p=`${l?"":d.protocol}${d.slashes?"//":""}${d.auth}${d.auth?"@":""}${d.host}`,v=Yo.posix.join(`${p&&d.pathname[0]!=="/"?"/":""}${d.pathname}`,...c.slice(1));return`${p}${v==="."?"":v}`}i.join=s;function r(c){return s(...c.split("/").map(encodeURIComponent))}i.encodeParts=r;function a(c){let d=Object.keys(c).filter(l=>l.length>0);return d.length?"?"+d.map(l=>{let p=encodeURIComponent(String(c[l]));return l+(p?"="+p:"")}).join("&"):""}i.objectToQueryString=a;function o(c){return c.replace(/^\?/,"").split("&").reduce((d,l)=>{let[p,v]=l.split("=");return p.length>0&&(d[p]=decodeURIComponent(v||"")),d},{})}i.queryStringToObject=o;function u(c,d=!1){let{protocol:l}=e(c);return(!l||c.toLowerCase().indexOf(l)!==0)&&(d?c.indexOf("//")!==0:c.indexOf("/")!==0)}i.isLocal=u})(Xs||(st.URLExt=Xs={}))});var Zs=E((exports,module)=>{"use strict";var __importDefault=exports&&exports.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(exports,"__esModule",{value:!0});exports.PageConfig=void 0;var coreutils_1=te(),minimist_1=__importDefault(qs()),url_1=si(),PageConfig;(function(PageConfig){function getOption(name){if(configData)return configData[name]||getBodyData(name);configData=Object.create(null);let found=!1;if(typeof document!="undefined"&&document){let i=document.getElementById("jupyter-config-data");i&&(configData=JSON.parse(i.textContent||""),found=!0)}if(!found&&typeof process!="undefined"&&process.argv)try{let cli=(0,minimist_1.default)(process.argv.slice(2)),path=Xt(),fullPath="";"jupyter-config-data"in cli?fullPath=path.resolve(cli["jupyter-config-data"]):"JUPYTER_CONFIG_DATA"in process.env&&(fullPath=path.resolve(process.env.JUPYTER_CONFIG_DATA)),fullPath&&(configData=eval("require")(fullPath))}catch(i){console.error(i)}if(!coreutils_1.JSONExt.isObject(configData))configData=Object.create(null);else for(let i in configData)typeof configData[i]!="string"&&(configData[i]=JSON.stringify(configData[i]));return configData[name]||getBodyData(name)}PageConfig.getOption=getOption;function setOption(i,e){let t=getOption(i);return configData[i]=e,t}PageConfig.setOption=setOption;function getBaseUrl(){return url_1.URLExt.normalize(getOption("baseUrl")||"/")}PageConfig.getBaseUrl=getBaseUrl;function getTreeUrl(){return url_1.URLExt.join(getBaseUrl(),getOption("treeUrl"))}PageConfig.getTreeUrl=getTreeUrl;function getShareUrl(){return url_1.URLExt.normalize(getOption("shareUrl")||getBaseUrl())}PageConfig.getShareUrl=getShareUrl;function getTreeShareUrl(){return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(),getOption("treeUrl")))}PageConfig.getTreeShareUrl=getTreeShareUrl;function getUrl(i){var e,t,n,s;let r=i.toShare?getShareUrl():getBaseUrl(),a=(e=i.mode)!==null&&e!==void 0?e:getOption("mode"),o=(t=i.workspace)!==null&&t!==void 0?t:getOption("workspace"),u=a==="single-document"?"doc":"lab";r=url_1.URLExt.join(r,u),o!==PageConfig.defaultWorkspace&&(r=url_1.URLExt.join(r,"workspaces",encodeURIComponent((n=getOption("workspace"))!==null&&n!==void 0?n:PageConfig.defaultWorkspace)));let c=(s=i.treePath)!==null&&s!==void 0?s:getOption("treePath");return c&&(r=url_1.URLExt.join(r,"tree",url_1.URLExt.encodeParts(c))),r}PageConfig.getUrl=getUrl,PageConfig.defaultWorkspace="default";function getWsUrl(i){let e=getOption("wsUrl");if(!e){if(i=i?url_1.URLExt.normalize(i):getBaseUrl(),i.indexOf("http")!==0)return"";e="ws"+i.slice(4)}return url_1.URLExt.normalize(e)}PageConfig.getWsUrl=getWsUrl;function getNBConvertURL({path:i,format:e,download:t}){let n=url_1.URLExt.encodeParts(i),s=url_1.URLExt.join(getBaseUrl(),"nbconvert",e,n);return t?s+"?download=true":s}PageConfig.getNBConvertURL=getNBConvertURL;function getToken(){return getOption("token")||getBodyData("jupyterApiToken")}PageConfig.getToken=getToken;function getNotebookVersion(){let i=getOption("notebookVersion");return i===""?[0,0,0]:JSON.parse(i)}PageConfig.getNotebookVersion=getNotebookVersion;let configData=null;function getBodyData(i){if(typeof document=="undefined"||!document.body)return"";let e=document.body.dataset[i];return typeof e=="undefined"?"":decodeURIComponent(e)}let Extension;(function(i){function e(s){try{let r=getOption(s);if(r)return JSON.parse(r)}catch(r){console.warn(`Unable to parse ${s}.`,r)}return[]}i.deferred=e("deferredExtensions"),i.disabled=e("disabledExtensions");function t(s){let r=s.indexOf(":"),a="";return r!==-1&&(a=s.slice(0,r)),i.deferred.some(o=>o===s||a&&o===a)}i.isDeferred=t;function n(s){let r=s.indexOf(":"),a="";return r!==-1&&(a=s.slice(0,r)),i.disabled.some(o=>o===s||a&&o===a)}i.isDisabled=n})(Extension=PageConfig.Extension||(PageConfig.Extension={}))})(PageConfig||(exports.PageConfig=PageConfig={}))});var er=E(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.PathExt=void 0;var Be=Xt(),Qs;(function(i){function e(...l){let p=Be.posix.join(...l);return p==="."?"":d(p)}i.join=e;function t(...l){let p=Be.posix.join(...l);return p==="."?"":p}i.joinWithLeadingSlash=t;function n(l,p){return Be.posix.basename(l,p)}i.basename=n;function s(l){let p=d(Be.posix.dirname(l));return p==="."?"":p}i.dirname=s;function r(l){return Be.posix.extname(l)}i.extname=r;function a(l){return l===""?"":d(Be.posix.normalize(l))}i.normalize=a;function o(...l){return d(Be.posix.resolve(...l))}i.resolve=o;function u(l,p){return d(Be.posix.relative(l,p))}i.relative=u;function c(l){return l.length>0&&l.indexOf(".")!==0&&(l=`.${l}`),l}i.normalizeExtension=c;function d(l){return l.indexOf("/")===0&&(l=l.slice(1)),l}i.removeSlash=d})(Qs||(en.PathExt=Qs={}))});var tr=E(ri=>{"use strict";Object.defineProperty(ri,"__esModule",{value:!0});ri.signalToPromise=Zo;var Xo=te();function Zo(i,e){let t=new Xo.PromiseDelegate;function n(){i.disconnect(s)}function s(r,a){n(),t.resolve([r,a])}return i.connect(s),(e!=null?e:0)>0&&setTimeout(()=>{n(),t.reject(`Signal not emitted within ${e} ms.`)},e),t.promise}});var ir=E(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.Text=void 0;var nr;(function(i){let e=2>1;function t(a,o){if(e)return a;let u=a;for(let c=0;c+1<o.length&&c<a;c++){let d=o.charCodeAt(c);if(d>=55296&&d<=56319){let l=o.charCodeAt(c+1);l>=56320&&l<=57343&&(u--,c++)}}return u}i.jsIndexToCharIndex=t;function n(a,o){if(e)return a;let u=a;for(let c=0;c+1<o.length&&c<u;c++){let d=o.charCodeAt(c);if(d>=55296&&d<=56319){let l=o.charCodeAt(c+1);l>=56320&&l<=57343&&(u++,c++)}}return u}i.charIndexToJsIndex=n;function s(a,o=!1){return a.replace(/^(\w)|[\s-_:]+(\w)/g,function(u,c,d){return d?d.toUpperCase():o?c.toUpperCase():c.toLowerCase()})}i.camelCase=s;function r(a){return(a||"").toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}i.titleCase=r})(nr||(tn.Text=nr={}))});var rr=E(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.Time=void 0;var Qo=[{name:"years",milliseconds:365*24*60*60*1e3},{name:"months",milliseconds:30*24*60*60*1e3},{name:"days",milliseconds:24*60*60*1e3},{name:"hours",milliseconds:60*60*1e3},{name:"minutes",milliseconds:60*1e3},{name:"seconds",milliseconds:1e3}],sr;(function(i){function e(n,s="long"){let r=document.documentElement.lang||"en",a=new Intl.RelativeTimeFormat(r,{numeric:"auto",style:s}),o=new Date(n).getTime()-Date.now();for(let u of Qo){let c=Math.ceil(o/u.milliseconds);if(c!==0)return a.format(c,u.name)}return a.format(0,"seconds")}i.formatHuman=e;function t(n){let s=document.documentElement.lang||"en";return new Intl.DateTimeFormat(s,{dateStyle:"short",timeStyle:"short"}).format(new Date(n))}i.format=t})(sr||(nn.Time=sr={}))});var G=E(ae=>{"use strict";var el=ae&&ae.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Re=ae&&ae.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&el(e,i,t)};Object.defineProperty(ae,"__esModule",{value:!0});Re(Ps(),ae);Re(Es(),ae);Re(Rs(),ae);Re(Os(),ae);Re(Zs(),ae);Re(er(),ae);Re(tr(),ae);Re(ir(),ae);Re(rr(),ae);Re(si(),ae)});var rt=E(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.supportedKernelWebSocketProtocols=void 0;B.createMessage=nl;B.isStreamMsg=il;B.isDisplayDataMsg=sl;B.isUpdateDisplayDataMsg=rl;B.isExecuteInputMsg=al;B.isExecuteResultMsg=ol;B.isErrorMsg=ll;B.isStatusMsg=cl;B.isClearOutputMsg=dl;B.isDebugEventMsg=ul;B.isCommOpenMsg=pl;B.isCommCloseMsg=hl;B.isCommMsgMsg=fl;B.isInfoRequestMsg=ml;B.isExecuteReplyMsg=gl;B.isDebugRequestMsg=_l;B.isDebugReplyMsg=vl;B.isInputRequestMsg=yl;B.isInputReplyMsg=wl;var tl=te();function nl(i){var e,t,n,s,r,a;return{buffers:(e=i.buffers)!==null&&e!==void 0?e:[],channel:i.channel,content:i.content,header:{date:new Date().toISOString(),msg_id:(t=i.msgId)!==null&&t!==void 0?t:tl.UUID.uuid4(),msg_type:i.msgType,session:i.session,username:(n=i.username)!==null&&n!==void 0?n:"",subshell_id:(s=i.subshellId)!==null&&s!==void 0?s:null,version:"5.2"},metadata:(r=i.metadata)!==null&&r!==void 0?r:{},parent_header:(a=i.parentHeader)!==null&&a!==void 0?a:{}}}function il(i){return i.header.msg_type==="stream"}function sl(i){return i.header.msg_type==="display_data"}function rl(i){return i.header.msg_type==="update_display_data"}function al(i){return i.header.msg_type==="execute_input"}function ol(i){return i.header.msg_type==="execute_result"}function ll(i){return i.header.msg_type==="error"}function cl(i){return i.header.msg_type==="status"}function dl(i){return i.header.msg_type==="clear_output"}function ul(i){return i.header.msg_type==="debug_event"}function pl(i){return i.header.msg_type==="comm_open"}function hl(i){return i.header.msg_type==="comm_close"}function fl(i){return i.header.msg_type==="comm_msg"}function ml(i){return i.header.msg_type==="kernel_info_request"}function gl(i){return i.header.msg_type==="execute_reply"}function _l(i){return i.header.msg_type==="debug_request"}function vl(i){return i.header.msg_type==="debug_reply"}function yl(i){return i.header.msg_type==="input_request"}function wl(i){return i.header.msg_type==="input_reply"}var ar;(function(i){i.v1KernelWebsocketJupyterOrg="v1.kernel.websocket.jupyter.org"})(ar||(B.supportedKernelWebSocketProtocols=ar={}))});var lr=E(Ie=>{"use strict";var bl=Ie&&Ie.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Sl=Ie&&Ie.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),xl=Ie&&Ie.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&bl(e,i,t);return Sl(e,i),e};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.serialize=Cl;Ie.deserialize=kl;var or=xl(rt());function Cl(i,e=""){switch(e){case or.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return at.serializeV1KernelWebsocketJupyterOrg(i);default:return at.serializeDefault(i)}}function kl(i,e=""){switch(e){case or.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return at.deserializeV1KernelWebsocketJupyterOrg(i);default:return at.deserializeDefault(i)}}var at;(function(i){function e(o){let u,c=new DataView(o),d=Number(c.getBigUint64(0,!0)),l=[];for(let x=0;x<d;x++)l.push(Number(c.getBigUint64(8*(x+1),!0)));let p=new TextDecoder("utf8"),v=p.decode(o.slice(l[0],l[1])),_=JSON.parse(p.decode(o.slice(l[1],l[2]))),I=JSON.parse(p.decode(o.slice(l[2],l[3]))),P=JSON.parse(p.decode(o.slice(l[3],l[4]))),D=JSON.parse(p.decode(o.slice(l[4],l[5]))),T=[];for(let x=5;x<l.length-1;x++)T.push(new DataView(o.slice(l[x],l[x+1])));return u={channel:v,header:_,parent_header:I,metadata:P,content:D,buffers:T},u}i.deserializeV1KernelWebsocketJupyterOrg=e;function t(o){let u=JSON.stringify(o.header),c=o.parent_header==null?"{}":JSON.stringify(o.parent_header),d=JSON.stringify(o.metadata),l=JSON.stringify(o.content),p=o.buffers!==void 0?o.buffers:[],v=5+p.length+1,_=[];_.push(8*(1+v)),_.push(o.channel.length+_[_.length-1]);let I=new TextEncoder,P=I.encode(o.channel),D=I.encode(u),T=I.encode(c),x=I.encode(d),w=I.encode(l),R=new Uint8Array(P.length+D.length+T.length+x.length+w.length);R.set(P),R.set(D,P.length),R.set(T,P.length+D.length),R.set(x,P.length+D.length+T.length),R.set(w,P.length+D.length+T.length+x.length);for(let h of[D.length,T.length,x.length,w.length])_.push(h+_[_.length-1]);let A=0;for(let h of p){let y=h.byteLength;_.push(y+_[_.length-1]),A+=y}let q=new Uint8Array(8*(1+v)+R.byteLength+A),j=new ArrayBuffer(8),U=new DataView(j);U.setBigUint64(0,BigInt(v),!0),q.set(new Uint8Array(j),0);for(let h=0;h<_.length;h++)U.setBigUint64(0,BigInt(_[h]),!0),q.set(new Uint8Array(j),8*(h+1));q.set(R,_[0]);for(let h=0;h<p.length;h++){let y=p[h];q.set(new Uint8Array(ArrayBuffer.isView(y)?y.buffer:y),_[5+h])}return q.buffer}i.serializeV1KernelWebsocketJupyterOrg=t;function n(o){let u;return typeof o=="string"?u=JSON.parse(o):u=r(o),u}i.deserializeDefault=n;function s(o){var u;let c;return!((u=o.buffers)===null||u===void 0)&&u.length?c=a(o):c=JSON.stringify(o),c}i.serializeDefault=s;function r(o){let u=new DataView(o),c=u.getUint32(0),d=[];if(c<2)throw new Error("Invalid incoming Kernel Message");for(let v=1;v<=c;v++)d.push(u.getUint32(v*4));let l=new Uint8Array(o.slice(d[0],d[1])),p=JSON.parse(new TextDecoder("utf8").decode(l));p.buffers=[];for(let v=1;v<c;v++){let _=d[v],I=d[v+1]||o.byteLength;p.buffers.push(new DataView(o.slice(_,I)))}return p}function a(o){let u=[],c=[],d=new TextEncoder,l=[];o.buffers!==void 0&&(l=o.buffers,delete o.buffers);let p=d.encode(JSON.stringify(o));c.push(p.buffer);for(let P=0;P<l.length;P++){let D=l[P];c.push(ArrayBuffer.isView(D)?D.buffer:D)}let v=c.length;u.push(4*(v+1));for(let P=0;P+1<c.length;P++)u.push(u[u.length-1]+c[P].byteLength);let _=new Uint8Array(u[u.length-1]+c[c.length-1].byteLength),I=new DataView(_.buffer);I.setUint32(0,v);for(let P=0;P<u.length;P++)I.setUint32(4*(P+1),u[P]);for(let P=0;P<c.length;P++)_.set(new Uint8Array(c[P]),u[P]);return _.buffer}})(at||(at={}))});var cr=E(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.default=WebSocket});var de=E(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.ServerConnection=void 0;var Ve=G(),dr=lr(),oi;typeof window=="undefined"?oi=cr():oi=WebSocket;var li;(function(i){function e(r){return sn.makeSettings(r)}i.makeSettings=e;function t(r,a,o){return sn.handleRequest(r,a,o)}i.makeRequest=t;class n extends Error{static async create(a){try{let o=await a.json(),{message:u,traceback:c}=o;return c&&console.error(c),new n(a,u!=null?u:n._defaultMessage(a),c!=null?c:"")}catch(o){return console.debug(o),new n(a)}}constructor(a,o=n._defaultMessage(a),u=""){super(o),this.response=a,this.traceback=u}static _defaultMessage(a){return`Invalid response: ${a.status} ${a.statusText}`}}i.ResponseError=n;class s extends TypeError{constructor(a){super(a.message),this.stack=a.stack}}i.NetworkError=s})(li||(rn.ServerConnection=li={}));var sn;(function(i){function e(s={}){var r;let a=Ve.PageConfig.getBaseUrl(),o=Ve.PageConfig.getWsUrl(),u=Ve.URLExt.normalize(s.baseUrl)||a,c=s.wsUrl;!c&&u===a&&(c=o),!c&&u.indexOf("http")===0&&(c="ws"+u.slice(4)),c=c!=null?c:o;let d=Ve.PageConfig.getOption("appendToken").toLowerCase(),l;return d===""?l=typeof window=="undefined"||typeof process!="undefined"&&((r=process==null?void 0:process.env)===null||r===void 0?void 0:r.JEST_WORKER_ID)!==void 0||Ve.URLExt.getHostName(a)!==Ve.URLExt.getHostName(c):l=d==="true",{init:{cache:"no-store",credentials:"same-origin"},fetch,Headers,Request,WebSocket:oi,token:Ve.PageConfig.getToken(),appUrl:Ve.PageConfig.getOption("appUrl"),appendToken:l,serializer:{serialize:dr.serialize,deserialize:dr.deserialize},...s,baseUrl:u,wsUrl:c}}i.makeSettings=e;function t(s,r,a){var o;if(s.indexOf(a.baseUrl)!==0)throw new Error("Can only be used for notebook server requests");((o=r.cache)!==null&&o!==void 0?o:a.init.cache)==="no-store"&&(s+=(/\?/.test(s)?"&":"?")+new Date().getTime());let c=new a.Request(s,{...a.init,...r}),d=!1;if(a.token&&(d=!0,c.headers.append("Authorization",`token ${a.token}`)),typeof document!="undefined"){let l=n("_xsrf");l!==void 0&&(d=!0,c.headers.append("X-XSRFToken",l))}return!c.headers.has("Content-Type")&&d&&c.headers.set("Content-Type","application/json"),a.fetch.call(null,c).catch(l=>{throw new li.NetworkError(l)})}i.handleRequest=t;function n(s){let r="";try{r=document.cookie}catch{return}let a=r.match("\\b"+s+"=([^;]*)\\b");return a==null?void 0:a[1]}})(sn||(sn={}))});var Ze=E(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.BaseManager=void 0;var ur=X(),Pl=de(),ci=class{constructor(e){var t;this._isDisposed=!1,this._disposed=new ur.Signal(this),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Pl.ServerConnection.makeSettings()}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}get isActive(){return!0}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(void 0),ur.Signal.clearData(this))}};an.BaseManager=ci});var hr=E($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.ConfigWithDefaults=$e.ConfigSection=$e.ConfigSectionManager=void 0;var Ml=G(),ot=Le(),El="api/config",di=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ot.ServerConnection.makeSettings()}async create(e){let t=new on({...e,serverSettings:this.serverSettings});return await t.load(),t}};$e.ConfigSectionManager=di;var pr;(function(i){async function e(s){if(!t){let a=new on(s);return await a.load(),a}return await t.create(s)}i.create=e;let t;function n(s){if(t)throw new Error("ConfigSectionManager already set. If you would like to create a config section, use the `IConfigSectionManager` token in a plugin.");t=s}i._setConfigSectionManager=n})(pr||($e.ConfigSection=pr={}));var on=class{constructor(e){var t;this._url="unknown";let n=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ot.ServerConnection.makeSettings();this._url=Ml.URLExt.join(n.baseUrl,El,encodeURIComponent(e.name))}get data(){return this._data}async load(){let e=await ot.ServerConnection.makeRequest(this._url,{},this.serverSettings);if(e.status!==200)throw await ot.ServerConnection.ResponseError.create(e);this._data=await e.json()}async update(e){this._data={...this._data,...e};let t={method:"PATCH",body:JSON.stringify(e)},n=await ot.ServerConnection.makeRequest(this._url,t,this.serverSettings);if(n.status!==200)throw await ot.ServerConnection.ResponseError.create(n);return this._data=await n.json(),this._data}},ui=class{constructor(e){var t,n;this._className="",this._section=e.section,this._defaults=(t=e.defaults)!==null&&t!==void 0?t:{},this._className=(n=e.className)!==null&&n!==void 0?n:""}get(e){let t=this._classData();return e in t?t[e]:this._defaults[e]}set(e,t){let n={};if(n[e]=t,this._className){let s={};return s[this._className]=n,this._section.update(s)}else return this._section.update(n)}_classData(){let e=this._section.data;return this._className&&this._className in e?e[this._className]:e}};$e.ConfigWithDefaults=ui});var fr=E(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.ConnectionStatus=void 0;var pi=class{constructor(){this.isConnected=!0}};ln.ConnectionStatus=pi});var dn=E((cn,mr)=>{(function(i,e){typeof cn=="object"&&typeof mr!="undefined"?e(cn,X()):typeof define=="function"&&define.amd?define(["exports","@lumino/signaling"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_disposable={},i.lumino_signaling))})(cn,function(i,e){"use strict";class t{constructor(o){this._fn=o}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let o=this._fn;this._fn=null,o()}}class n extends t{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}}class s{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(o=>{o.dispose()}),this._items.clear())}contains(o){return this._items.has(o)}add(o){this._items.add(o)}remove(o){this._items.delete(o)}clear(){this._items.clear()}}(function(a){function o(u){let c=new a;for(let d of u)c.add(d);return c}a.from=o})(s||(s={}));class r extends s{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}}(function(a){function o(u){let c=new a;for(let d of u)c.add(d);return c}a.from=o})(r||(r={})),i.DisposableDelegate=t,i.DisposableSet=s,i.ObservableDisposableDelegate=n,i.ObservableDisposableSet=r})});var ft=E(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.validateProperty=Rl;function Rl(i,e,t,n=[]){if(!i.hasOwnProperty(e))throw Error(`Missing property '${e}'`);let s=i[e];if(t!==void 0){let r=!0;switch(t){case"array":r=Array.isArray(s);break;case"object":r=typeof s!="undefined";break;default:r=typeof s===t}if(!r)throw new Error(`Property '${e}' is not of type '${t}'`);if(n.length>0){let a=!0;switch(t){case"string":case"number":case"boolean":a=n.includes(s);break;default:a=n.findIndex(o=>o===s)>=0;break}if(!a)throw new Error(`Property '${e}' is not one of the valid values ${JSON.stringify(n)}`)}}}});var gr=E(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.validateContentsModel=Il;un.validateCheckpointModel=Ol;var Oe=ft();function Il(i){(0,Oe.validateProperty)(i,"name","string"),(0,Oe.validateProperty)(i,"path","string"),(0,Oe.validateProperty)(i,"type","string"),(0,Oe.validateProperty)(i,"created","string"),(0,Oe.validateProperty)(i,"last_modified","string"),(0,Oe.validateProperty)(i,"mimetype","object"),(0,Oe.validateProperty)(i,"content","object"),(0,Oe.validateProperty)(i,"format","object")}function Ol(i){(0,Oe.validateProperty)(i,"id","string"),(0,Oe.validateProperty)(i,"last_modified","string")}});var _i=E(oe=>{"use strict";var Dl=oe&&oe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),jl=oe&&oe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Tl=oe&&oe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Dl(e,i,t);return jl(e,i),e};Object.defineProperty(oe,"__esModule",{value:!0});oe.RestContentProvider=oe.Drive=oe.ContentsManager=oe.Contents=void 0;var ue=G(),ql=dn(),mt=X(),$=Le(),ze=Tl(gr()),Ul="api/contents",Al="files",_r;(function(i){function e(n){ze.validateContentsModel(n)}i.validateContentsModel=e;function t(n){ze.validateCheckpointModel(n)}i.validateCheckpointModel=t})(_r||(oe.Contents=_r={}));var fi=class{constructor(e={}){var t,n;this._isDisposed=!1,this._additionalDrives=new Map,this._fileChanged=new mt.Signal(this);let s=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:$.ServerConnection.makeSettings();this._defaultDrive=(n=e.defaultDrive)!==null&&n!==void 0?n:new pn({serverSettings:s}),this._defaultDrive.fileChanged.connect(this._onFileChanged,this)}get defaultDrive(){return this._defaultDrive}get fileChanged(){return this._fileChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,mt.Signal.clearData(this))}addDrive(e){this._additionalDrives.set(e.name,e),e.fileChanged.connect(this._onFileChanged,this)}getSharedModelFactory(e,t){var n,s;let[r]=this._driveForPath(e),a=(n=r.contentProviderRegistry)===null||n===void 0?void 0:n.getProvider(t==null?void 0:t.contentProviderId);return a!=null&&a.sharedModelFactory?a.sharedModelFactory:(s=r.sharedModelFactory)!==null&&s!==void 0?s:null}localPath(e){let t=e.split("/"),n=t[0].split(":");return n.length===1||!this._additionalDrives.has(n[0])?ue.PathExt.removeSlash(e):ue.PathExt.join(n.slice(1).join(":"),...t.slice(1))}normalize(e){let t=e.split(":");return t.length===1?ue.PathExt.normalize(e):`${t[0]}:${ue.PathExt.normalize(t.slice(1).join(":"))}`}resolvePath(e,t){let n=this.driveName(e),s=this.localPath(e),r=ue.PathExt.resolve("/",s,t);return n?`${n}:${r}`:r}driveName(e){let n=e.split("/")[0].split(":");return n.length===1?"":this._additionalDrives.has(n[0])?n[0]:""}get(e,t){let[n,s]=this._driveForPath(e);return n.get(s,t).then(r=>{let a=[];if(r.type==="directory"&&r.content){for(let o of r.content)a.push({...o,path:this._toGlobalPath(n,o.path)});return{...r,path:this._toGlobalPath(n,s),content:a,serverPath:r.path}}else return{...r,path:this._toGlobalPath(n,s),serverPath:r.path}})}getDownloadUrl(e){let[t,n]=this._driveForPath(e);return t.getDownloadUrl(n)}newUntitled(e={}){if(e.path){let t=this.normalize(e.path),[n,s]=this._driveForPath(t);return n.newUntitled({...e,path:s}).then(r=>({...r,path:ue.PathExt.join(t,r.name),serverPath:r.path}))}else return this._defaultDrive.newUntitled(e)}delete(e){let[t,n]=this._driveForPath(e);return t.delete(n)}rename(e,t){let[n,s]=this._driveForPath(e),[r,a]=this._driveForPath(t);if(n!==r)throw Error("ContentsManager: renaming files must occur within a Drive");return n.rename(s,a).then(o=>({...o,path:this._toGlobalPath(n,a),serverPath:o.path}))}save(e,t={}){let n=this.normalize(e),[s,r]=this._driveForPath(e);return s.save(r,{...t,path:r}).then(a=>({...a,path:n,serverPath:a.path}))}copy(e,t){let[n,s]=this._driveForPath(e),[r,a]=this._driveForPath(t);if(n===r)return n.copy(s,a).then(o=>({...o,path:this._toGlobalPath(n,o.path),serverPath:o.path}));throw Error("Copying files between drives is not currently implemented")}createCheckpoint(e){let[t,n]=this._driveForPath(e);return t.createCheckpoint(n)}listCheckpoints(e){let[t,n]=this._driveForPath(e);return t.listCheckpoints(n)}restoreCheckpoint(e,t){let[n,s]=this._driveForPath(e);return n.restoreCheckpoint(s,t)}deleteCheckpoint(e,t){let[n,s]=this._driveForPath(e);return n.deleteCheckpoint(s,t)}_toGlobalPath(e,t){return e===this._defaultDrive?ue.PathExt.removeSlash(t):`${e.name}:${ue.PathExt.removeSlash(t)}`}_driveForPath(e){let t=this.driveName(e),n=this.localPath(e);return t?[this._additionalDrives.get(t),n]:[this._defaultDrive,n]}_onFileChanged(e,t){var n,s;if(e===this._defaultDrive)this._fileChanged.emit(t);else{let r=null,a=null;!((n=t.newValue)===null||n===void 0)&&n.path&&(r={...t.newValue,path:this._toGlobalPath(e,t.newValue.path)}),!((s=t.oldValue)===null||s===void 0)&&s.path&&(a={...t.oldValue,path:this._toGlobalPath(e,t.oldValue.path)}),this._fileChanged.emit({type:t.type,newValue:r,oldValue:a})}}};oe.ContentsManager=fi;var pn=class{constructor(e={}){var t,n,s;this._isDisposed=!1,this._fileChanged=new mt.Signal(this),this.name=(t=e.name)!==null&&t!==void 0?t:"Default",this._apiEndpoint=(n=e.apiEndpoint)!==null&&n!==void 0?n:Ul,this.serverSettings=(s=e.serverSettings)!==null&&s!==void 0?s:$.ServerConnection.makeSettings();let r=new hn({apiEndpoint:this._apiEndpoint,serverSettings:this.serverSettings});this.contentProviderRegistry=new gi({defaultProvider:r}),this.contentProviderRegistry.fileChanged.connect((a,o)=>{this._fileChanged.emit(o)})}get fileChanged(){return this._fileChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,mt.Signal.clearData(this))}async get(e,t){return this.contentProviderRegistry.getProvider(t==null?void 0:t.contentProviderId).get(e,t)}getDownloadUrl(e){let t=this.serverSettings.baseUrl,n=ue.URLExt.join(t,Al,ue.URLExt.encodeParts(e)),s="";try{s=document.cookie}catch{}let r=s.match("\\b_xsrf=([^;]*)\\b");if(r){let a=new URL(n);a.searchParams.append("_xsrf",r[1]),n=a.toString()}return Promise.resolve(n)}async newUntitled(e={}){var t;let n="{}";e&&(e.ext&&(e.ext=mi.normalizeExtension(e.ext)),n=JSON.stringify(e));let s=this.serverSettings,r=this._getUrl((t=e.path)!==null&&t!==void 0?t:""),a={method:"POST",body:n},o=await $.ServerConnection.makeRequest(r,a,s);if(o.status!==201)throw await $.ServerConnection.ResponseError.create(o);let u=await o.json();return ze.validateContentsModel(u),this._fileChanged.emit({type:"new",oldValue:null,newValue:u}),u}async delete(e){let t=this._getUrl(e),n=this.serverSettings,s={method:"DELETE"},r=await $.ServerConnection.makeRequest(t,s,n);if(r.status!==204)throw await $.ServerConnection.ResponseError.create(r);this._fileChanged.emit({type:"delete",oldValue:{path:e},newValue:null})}async rename(e,t){let n=this.serverSettings,s=this._getUrl(e),r={method:"PATCH",body:JSON.stringify({path:t})},a=await $.ServerConnection.makeRequest(s,r,n);if(a.status!==200)throw await $.ServerConnection.ResponseError.create(a);let o=await a.json();return ze.validateContentsModel(o),this._fileChanged.emit({type:"rename",oldValue:{path:e},newValue:o}),o}async save(e,t={}){let s=await this.contentProviderRegistry.getProvider(t==null?void 0:t.contentProviderId).save(e,t);return this._fileChanged.emit({type:"save",oldValue:null,newValue:s}),s}async copy(e,t){let n=this.serverSettings,s=this._getUrl(t),r={method:"POST",body:JSON.stringify({copy_from:e})},a=await $.ServerConnection.makeRequest(s,r,n);if(a.status!==201)throw await $.ServerConnection.ResponseError.create(a);let o=await a.json();return ze.validateContentsModel(o),this._fileChanged.emit({type:"new",oldValue:null,newValue:o}),o}async createCheckpoint(e){let t=this._getUrl(e,"checkpoints"),n={method:"POST"},s=await $.ServerConnection.makeRequest(t,n,this.serverSettings);if(s.status!==201)throw await $.ServerConnection.ResponseError.create(s);let r=await s.json();return ze.validateCheckpointModel(r),r}async listCheckpoints(e){let t=this._getUrl(e,"checkpoints"),n=await $.ServerConnection.makeRequest(t,{},this.serverSettings);if(n.status!==200)throw await $.ServerConnection.ResponseError.create(n);let s=await n.json();if(!Array.isArray(s))throw new Error("Invalid Checkpoint list");for(let r=0;r<s.length;r++)ze.validateCheckpointModel(s[r]);return s}async restoreCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"POST"},r=await $.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await $.ServerConnection.ResponseError.create(r)}async deleteCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"DELETE"},r=await $.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await $.ServerConnection.ResponseError.create(r)}_getUrl(...e){let t=e.map(s=>ue.URLExt.encodeParts(s)),n=this.serverSettings.baseUrl;return ue.URLExt.join(n,this._apiEndpoint,...t)}};oe.Drive=pn;var mi;(function(i){function e(t){return t.length>0&&t.indexOf(".")!==0&&(t=`.${t}`),t}i.normalizeExtension=e})(mi||(mi={}));var gi=class{constructor(e){this._providers=new Map,this._fileChanged=new mt.Signal(this),this.register("default",e.defaultProvider),this._defaultProvider=e.defaultProvider}register(e,t){if(this._providers.has(e))throw Error(`Provider with ${e} identifier was already registered on this drive`);this._providers.set(e,t);let n=(s,r)=>{this._fileChanged.emit(r)};return t.fileChanged&&t.fileChanged.connect(n),new ql.DisposableDelegate(()=>{t.fileChanged&&t.fileChanged.disconnect(n),this._providers.has(e)&&this._providers.delete(e)})}getProvider(e){if(!e)return this._defaultProvider;let t=this._providers.get(e);if(!t)throw Error(`Provider ${e} is not registered`);return t}get fileChanged(){return this._fileChanged}},hn=class{constructor(e){this._options=e}async get(e,t){let n=this._getUrl(e);if(t){t.type==="notebook"&&delete t.format;let o=t.content?"1":"0",u=t.hash?"1":"0",c={...t,content:o,hash:u};n+=ue.URLExt.objectToQueryString(c)}let s=this._options.serverSettings,r=await $.ServerConnection.makeRequest(n,{},s);if(r.status!==200)throw await $.ServerConnection.ResponseError.create(r);let a=await r.json();return ze.validateContentsModel(a),a}async save(e,t={}){let n=this._options.serverSettings,s=this._getUrl(e),r={method:"PUT",body:JSON.stringify(t)},a=await $.ServerConnection.makeRequest(s,r,n);if(a.status!==200&&a.status!==201)throw await $.ServerConnection.ResponseError.create(a);let o=await a.json();return ze.validateContentsModel(o),o}_getUrl(...e){let t=e.map(s=>ue.URLExt.encodeParts(s)),n=this._options.serverSettings.baseUrl;return ue.URLExt.join(n,this._options.apiEndpoint,...t)}};oe.RestContentProvider=hn});var Qe=E((fn,vr)=>{(function(i,e){typeof fn=="object"&&typeof vr!="undefined"?e(fn,te(),X()):typeof define=="function"&&define.amd?define(["exports","@lumino/coreutils","@lumino/signaling"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_polling={},i.lumino_coreutils,i.lumino_signaling))})(fn,function(i,e,t){"use strict";class n{constructor(c){var d;this._disposed=new t.Signal(this),this._lingered=0,this._tick=new e.PromiseDelegate,this._ticked=new t.Signal(this),this._factory=c.factory,this._linger=(d=c.linger)!==null&&d!==void 0?d:s.DEFAULT_LINGER,this._standby=c.standby||s.DEFAULT_STANDBY,this._state={...s.DEFAULT_STATE,timestamp:new Date().getTime()};let l=c.frequency||{},p=Math.max(l.interval||0,l.max||0,s.DEFAULT_FREQUENCY.max);this.frequency={...s.DEFAULT_FREQUENCY,...l,max:p},this.name=c.name||s.DEFAULT_NAME,(!("auto"in c)||c.auto)&&setTimeout(()=>this.start())}get disposed(){return this._disposed}get frequency(){return this._frequency}set frequency(c){if(this.isDisposed||e.JSONExt.deepEqual(c,this.frequency||{}))return;let{backoff:d,interval:l,max:p}=c;if(l=Math.round(l),p=Math.round(p),typeof d=="number"&&d<1)throw new Error("Poll backoff growth factor must be at least 1");if((l<0||l>p)&&l!==n.NEVER)throw new Error("Poll interval must be between 0 and max");if(p>n.MAX_INTERVAL&&p!==n.NEVER)throw new Error(`Max interval must be less than ${n.MAX_INTERVAL}`);this._frequency={backoff:d,interval:l,max:p}}get isDisposed(){return this.state.phase==="disposed"}get standby(){return this._standby}set standby(c){this.isDisposed||this.standby===c||(this._standby=c)}get state(){return this._state}get tick(){return this._tick.promise}get ticked(){return this._ticked}async*[Symbol.asyncIterator](){for(;!this.isDisposed;)yield this.state,await this.tick.catch(()=>{})}dispose(){this.isDisposed||(this._state={...s.DISPOSED_STATE,timestamp:new Date().getTime()},this._tick.promise.catch(c=>{}),this._tick.reject(new Error(`Poll (${this.name}) is disposed.`)),this._disposed.emit(void 0),t.Signal.clearData(this))}refresh(){return this.schedule({cancel:({phase:c})=>c==="refreshed",interval:n.IMMEDIATE,phase:"refreshed"})}async schedule(c={}){if(this.isDisposed||c.cancel&&c.cancel(this.state))return;let d=this._tick,l=new e.PromiseDelegate,p={interval:this.frequency.interval,payload:null,phase:"standby",timestamp:new Date().getTime(),...c};if(this._state=p,this._tick=l,clearTimeout(this._timeout),this._ticked.emit(this.state),d.resolve(this),await d.promise,p.interval===n.NEVER){this._timeout=void 0;return}let v=()=>{this.isDisposed||this.tick!==l.promise||this._execute()};this._timeout=setTimeout(v,p.interval)}start(){return this.schedule({cancel:({phase:c})=>c!=="constructed"&&c!=="standby"&&c!=="stopped",interval:n.IMMEDIATE,phase:"started"})}stop(){return this.schedule({cancel:({phase:c})=>c==="stopped",interval:n.NEVER,phase:"stopped"})}get hidden(){return s.hidden}_execute(){let c=typeof this.standby=="function"?this.standby():this.standby;if(c==="never"?c=!1:c==="when-hidden"&&(this.hidden?c=++this._lingered>this._linger:(this._lingered=0,c=!1)),c){this.schedule();return}let d=this.tick;this._factory(this.state).then(l=>{this.isDisposed||this.tick!==d||this.schedule({payload:l,phase:this.state.phase==="rejected"?"reconnected":"resolved"})}).catch(l=>{this.isDisposed||this.tick!==d||this.schedule({interval:s.sleep(this.frequency,this.state),payload:l,phase:"rejected"})})}}(function(u){u.IMMEDIATE=0,u.MAX_INTERVAL=2147483647,u.NEVER=1/0})(n||(n={}));var s;(function(u){u.DEFAULT_BACKOFF=3,u.DEFAULT_FREQUENCY={backoff:!0,interval:1e3,max:30*1e3},u.DEFAULT_LINGER=1,u.DEFAULT_NAME="unknown",u.DEFAULT_STANDBY="when-hidden",u.DEFAULT_STATE={interval:n.NEVER,payload:null,phase:"constructed",timestamp:new Date(0).getTime()},u.DISPOSED_STATE={interval:n.NEVER,payload:null,phase:"disposed",timestamp:new Date(0).getTime()};function c(l,p){let{backoff:v,interval:_,max:I}=l;if(_===n.NEVER)return _;let P=v===!0?u.DEFAULT_BACKOFF:v===!1?1:v,D=d(_,p.interval*P);return Math.min(I,D)}u.sleep=c,u.hidden=typeof document=="undefined"?!1:(document.addEventListener("visibilitychange",()=>{u.hidden=document.visibilityState==="hidden"}),document.addEventListener("pagehide",()=>{u.hidden=document.visibilityState==="hidden"}),document.visibilityState==="hidden");function d(l,p){return l=Math.ceil(l),p=Math.floor(p),Math.floor(Math.random()*(p-l+1))+l}})(s||(s={}));class r{constructor(c,d=500){this.args=void 0,this.payload=null,this.limit=d,this.poll=new n({auto:!1,factory:async()=>{let{args:l}=this;return this.args=void 0,c(...l)},frequency:{backoff:!1,interval:n.NEVER,max:n.NEVER},standby:"never"}),this.payload=new e.PromiseDelegate,this.poll.ticked.connect((l,p)=>{let{payload:v}=this;if(p.phase==="resolved"){this.payload=new e.PromiseDelegate,v.resolve(p.payload);return}if(p.phase==="rejected"||p.phase==="stopped"){this.payload=new e.PromiseDelegate,v.promise.catch(_=>{}),v.reject(p.payload);return}},this)}get isDisposed(){return this.payload===null}dispose(){this.isDisposed||(this.args=void 0,this.payload=null,this.poll.dispose())}async stop(){return this.poll.stop()}}class a extends r{invoke(...c){return this.args=c,this.poll.schedule({interval:this.limit,phase:"invoked"}),this.payload.promise}}class o extends r{constructor(c,d){super(c,typeof d=="number"?d:d&&d.limit),this._trailing=!1,typeof d!="number"&&d&&d.edge==="trailing"&&(this._trailing=!0),this._interval=this._trailing?this.limit:n.IMMEDIATE}invoke(...c){let d=this.poll.state.phase!=="invoked";return(d||this._trailing)&&(this.args=c),d&&this.poll.schedule({interval:this._interval,phase:"invoked"}),this.payload.promise}}i.Debouncer=a,i.Poll=n,i.RateLimiter=r,i.Throttler=o})});var yi=E(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.EventManager=void 0;var yr=G(),Nl=Qe(),wr=X(),br=de(),Sr="api/events",vi=class{constructor(e={}){var t;this._socket=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:br.ServerConnection.makeSettings(),this._poll=new Nl.Poll({factory:()=>this._subscribe()}),this._stream=new wr.Stream(this),this._poll.start()}get isDisposed(){return this._poll.isDisposed}get stream(){return this._stream}dispose(){if(this.isDisposed)return;this._poll.dispose();let e=this._socket;e&&(this._socket=null,e.onopen=()=>{},e.onerror=()=>{},e.onmessage=()=>{},e.onclose=()=>{},e.close()),wr.Signal.clearData(this),this._stream.stop()}async emit(e){let{serverSettings:t}=this,{baseUrl:n}=t,{makeRequest:s,ResponseError:r}=br.ServerConnection,a=yr.URLExt.join(n,Sr),o={body:JSON.stringify(e),method:"POST"},u=await s(a,o,t);if(u.status!==204)throw new r(u)}_subscribe(){return new Promise((e,t)=>{if(this.isDisposed)return;let{appendToken:n,token:s,WebSocket:r,wsUrl:a}=this.serverSettings,o=yr.URLExt.join(a,Sr,"subscribe");n&&s!==""&&(o+=`?token=${encodeURIComponent(s)}`);let u=this._socket=new r(o),c=this._stream;u.onclose=()=>t(new Error("EventManager socket closed")),u.onmessage=d=>d.data&&c.emit(JSON.parse(d.data))})}};mn.EventManager=vi});var Cr=E(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0})});var gn=E(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.validateMessage=Fl;gt.validateModel=Pr;gt.validateModels=Bl;var et=ft(),kr=["username","version","session","msg_id","msg_type"],Ll={stream:{name:"string",text:"string"},display_data:{data:"object",metadata:"object"},execute_input:{code:"string",execution_count:"number"},execute_result:{execution_count:"number",data:"object",metadata:"object"},error:{ename:"string",evalue:"string",traceback:"object"},status:{execution_state:["string",["starting","idle","busy","restarting","dead"]]},clear_output:{wait:"boolean"},comm_open:{comm_id:"string",target_name:"string",data:"object"},comm_msg:{comm_id:"string",data:"object"},comm_close:{comm_id:"string"},shutdown_reply:{restart:"boolean"}};function zl(i){for(let e=0;e<kr.length;e++)(0,et.validateProperty)(i,kr[e],"string")}function Fl(i){(0,et.validateProperty)(i,"metadata","object"),(0,et.validateProperty)(i,"content","object"),(0,et.validateProperty)(i,"channel","string"),zl(i.header),i.channel==="iopub"&&Kl(i)}function Kl(i){if(i.channel==="iopub"){let e=Ll[i.header.msg_type];if(e===void 0)return;let t=Object.keys(e),n=i.content;for(let s=0;s<t.length;s++){let r=e[t[s]];Array.isArray(r)||(r=[r]),(0,et.validateProperty)(n,t[s],...r)}}}function Pr(i){(0,et.validateProperty)(i,"name","string"),(0,et.validateProperty)(i,"id","string")}function Bl(i){if(!Array.isArray(i))throw new Error("Invalid kernel list");i.forEach(e=>Pr(e))}});var vn=E(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.KernelAPIClient=ne.KERNEL_SERVICE_URL=void 0;ne.listRunning=Mr;ne.startNew=Er;ne.restartKernel=Rr;ne.interruptKernel=Ir;ne.shutdownKernel=Or;ne.getKernelModel=Dr;var Z=de(),lt=G(),_n=gn();ne.KERNEL_SERVICE_URL="api/kernels";async function Mr(i=Z.ServerConnection.makeSettings()){let e=lt.URLExt.join(i.baseUrl,ne.KERNEL_SERVICE_URL),t=await Z.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Z.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,_n.validateModels)(n),n}async function Er(i={},e=Z.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await Z.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await Z.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,_n.validateModel)(r),r}async function Rr(i,e=Z.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i),"restart"),n={method:"POST"},s=await Z.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await Z.ServerConnection.ResponseError.create(s);let r=await s.json();(0,_n.validateModel)(r)}async function Ir(i,e=Z.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i),"interrupt"),n={method:"POST"},s=await Z.ServerConnection.makeRequest(t,n,e);if(s.status!==204)throw await Z.ServerConnection.ResponseError.create(s)}async function Or(i,e=Z.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i)),n={method:"DELETE"},s=await Z.ServerConnection.makeRequest(t,n,e);if(s.status===404){let r=`The kernel "${i}" does not exist on the server`;console.warn(r)}else if(s.status!==204)throw await Z.ServerConnection.ResponseError.create(s)}async function Dr(i,e=Z.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i)),n=await Z.ServerConnection.makeRequest(t,{},e);if(n.status===404)return;if(n.status!==200)throw await Z.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,_n.validateModel)(s),s}var wi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Z.ServerConnection.makeSettings()}async listRunning(){return Mr(this.serverSettings)}async getModel(e){return Dr(e,this.serverSettings)}async startNew(e={}){return Er(e,this.serverSettings)}async restart(e){return Rr(e,this.serverSettings)}async interrupt(e){return Ir(e,this.serverSettings)}async shutdown(e){return Or(e,this.serverSettings)}};ne.KernelAPIClient=wi});var jr=E(De=>{"use strict";var Vl=De&&De.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),$l=De&&De.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Wl=De&&De.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Vl(e,i,t);return $l(e,i),e};Object.defineProperty(De,"__esModule",{value:!0});De.CommHandler=void 0;var Jl=dn(),yn=Wl(rt()),bi=class extends Jl.DisposableDelegate{constructor(e,t,n,s){super(s),this._target="",this._id="",this._id=t,this._target=e,this._kernel=n}get commId(){return this._id}get targetName(){return this._target}get onClose(){return this._onClose}set onClose(e){this._onClose=e}get onMsg(){return this._onMsg}set onMsg(e){this._onMsg=e}open(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot open");let s=yn.createMessage({msgType:"comm_open",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._kernel.subshellId,content:{comm_id:this._id,target_name:this._target,data:e!=null?e:{}},metadata:t,buffers:n});return this._kernel.sendShellMessage(s,!1,!0)}send(e,t,n=[],s=!0){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot send");let r=yn.createMessage({msgType:"comm_msg",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._kernel.subshellId,content:{comm_id:this._id,data:e},metadata:t,buffers:n});return this._kernel.sendShellMessage(r,!1,s)}close(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot close");let s=yn.createMessage({msgType:"comm_close",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._kernel.subshellId,content:{comm_id:this._id,data:e!=null?e:{}},metadata:t,buffers:n}),r=this._kernel.sendShellMessage(s,!1,!0),a=this._onClose;if(a){let o=yn.createMessage({msgType:"comm_close",channel:"iopub",username:this._kernel.username,session:this._kernel.clientId,content:{comm_id:this._id,data:e!=null?e:{}},metadata:t,buffers:n});a(o)}return this.dispose(),r}};De.CommHandler=bi});var qr=E(_e=>{"use strict";var Hl=_e&&_e.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Gl=_e&&_e.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Yl=_e&&_e.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Hl(e,i,t);return Gl(e,i),e};Object.defineProperty(_e,"__esModule",{value:!0});_e.KernelShellFutureHandler=_e.KernelControlFutureHandler=_e.KernelFutureHandler=void 0;var Tr=te(),Xl=dn(),Zl=Yl(rt()),_t=class extends Xl.DisposableDelegate{constructor(e,t,n,s,r){super(e),this._status=0,this._stdin=ie.noOp,this._iopub=ie.noOp,this._reply=ie.noOp,this._done=new Tr.PromiseDelegate,this._hooks=new ie.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(ie.KernelFutureFlag.GotReply),this._disposeOnDone=s,this._kernel=r}get msg(){return this._msg}get done(){return this._done.promise}get onReply(){return this._reply}set onReply(e){this._reply=e}get onIOPub(){return this._iopub}set onIOPub(e){this._iopub=e}get onStdin(){return this._stdin}set onStdin(e){this._stdin=e}registerMessageHook(e){if(this.isDisposed)throw new Error("Kernel future is disposed");this._hooks.add(e)}removeMessageHook(e){this.isDisposed||this._hooks.remove(e)}sendInputReply(e,t){this._kernel.sendInputReply(e,t)}dispose(){this._stdin=ie.noOp,this._iopub=ie.noOp,this._reply=ie.noOp,this._hooks=null,this._testFlag(ie.KernelFutureFlag.IsDone)||(this._done.promise.catch(()=>{}),this._done.reject(new Error(`Canceled future for ${this.msg.header.msg_type} message before replies were done`))),super.dispose()}async handleMsg(e){switch(e.channel){case"control":case"shell":e.channel===this.msg.channel&&e.parent_header.msg_id===this.msg.header.msg_id&&await this._handleReply(e);break;case"stdin":await this._handleStdin(e);break;case"iopub":await this._handleIOPub(e);break;default:break}}async _handleReply(e){let t=this._reply;t&&await t(e),this._replyMsg=e,this._setFlag(ie.KernelFutureFlag.GotReply),this._testFlag(ie.KernelFutureFlag.GotIdle)&&this._handleDone()}async _handleStdin(e){this._kernel.hasPendingInput=!0;let t=this._stdin;t&&await t(e)}async _handleIOPub(e){let t=await this._hooks.process(e),n=this._iopub;t&&n&&await n(e),Zl.isStatusMsg(e)&&e.content.execution_state==="idle"&&(this._setFlag(ie.KernelFutureFlag.GotIdle),this._testFlag(ie.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(ie.KernelFutureFlag.IsDone)||(this._setFlag(ie.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return(this._status&e)!==0}_setFlag(e){this._status|=e}};_e.KernelFutureHandler=_t;var Si=class extends _t{};_e.KernelControlFutureHandler=Si;var xi=class extends _t{};_e.KernelShellFutureHandler=xi;var ie;(function(i){i.noOp=()=>{};let e=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;class t{constructor(){this._hooks=[]}add(r){this.remove(r),this._hooks.push(r)}remove(r){let a=this._hooks.indexOf(r);a>=0&&(this._hooks[a]=null,this._scheduleCompact())}async process(r){await this._processing;let a=new Tr.PromiseDelegate;this._processing=a.promise;let o;for(let u=this._hooks.length-1;u>=0;u--){let c=this._hooks[u];if(c!==null){try{o=await c(r)}catch(d){o=!0,console.error(d)}if(o===!1)return a.resolve(void 0),!1}}return a.resolve(void 0),!0}_scheduleCompact(){this._compactScheduled||(this._compactScheduled=!0,e(()=>{this._processing=this._processing.then(()=>{this._compactScheduled=!1,this._compact()})}))}_compact(){let r=0;for(let a=0,o=this._hooks.length;a<o;a++){let u=this._hooks[a];this._hooks[a]===null?r++:this._hooks[a-r]=u}this._hooks.length-=r}}i.HookList=t;let n;(function(s){s[s.GotReply=1]="GotReply",s[s.GotIdle=2]="GotIdle",s[s.IsDone=4]="IsDone",s[s.DisposeOnDone=8]="DisposeOnDone"})(n=i.KernelFutureFlag||(i.KernelFutureFlag={}))})(ie||(ie={}))});var Ar=E(Ur=>{"use strict";Object.defineProperty(Ur,"__esModule",{value:!0})});var Lr=E(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.validateSpecModel=Nr;wn.validateSpecModels=Ql;var tt=ft();function Nr(i){let e=i.spec;if(!e)throw new Error("Invalid kernel spec");(0,tt.validateProperty)(i,"name","string"),(0,tt.validateProperty)(i,"resources","object"),(0,tt.validateProperty)(e,"language","string"),(0,tt.validateProperty)(e,"display_name","string"),(0,tt.validateProperty)(e,"argv","array");let t=null;e.hasOwnProperty("metadata")&&((0,tt.validateProperty)(e,"metadata","object"),t=e.metadata);let n=null;return e.hasOwnProperty("env")&&((0,tt.validateProperty)(e,"env","object"),n=e.env),{name:i.name,resources:i.resources,language:e.language,display_name:e.display_name,argv:e.argv,metadata:t,env:n}}function Ql(i){if(!i.hasOwnProperty("kernelspecs"))throw new Error("No kernelspecs found");let e=Object.keys(i.kernelspecs),t=Object.create(null),n=i.default;for(let s=0;s<e.length;s++){let r=i.kernelspecs[e[s]];try{t[e[s]]=Nr(r)}catch{console.warn(`Removing errant kernel spec: ${e[s]}`)}}if(e=Object.keys(t),!e.length)throw new Error("No valid kernelspecs found");return(!n||typeof n!="string"||!(n in t))&&(n=e[0],console.warn(`Default kernel not found, using '${e[0]}'`)),{default:n,kernelspecs:t}}});var Pi=E(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.getSpecs=ic;var Ci=de(),ec=Lr(),tc=G(),nc="api/kernelspecs";async function ic(i=Ci.ServerConnection.makeSettings()){let e=tc.URLExt.join(i.baseUrl,nc),t=await Ci.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Ci.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,ec.validateSpecModels)(n)}});var Fr=E(je=>{"use strict";var sc=je&&je.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),rc=je&&je.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ac=je&&je.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&sc(e,i,t);return rc(e,i),e};Object.defineProperty(je,"__esModule",{value:!0});je.KernelSpecManager=void 0;var oc=te(),lc=Qe(),zr=X(),cc=ac(Pi()),dc=Ze(),Mi=class extends dc.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._connectionFailure=new zr.Signal(this),this._specs=null,this._specsChanged=new zr.Signal(this),this._ready=Promise.all([this.requestSpecs()]).then(n=>{}).catch(n=>{}).then(()=>{this.isDisposed||(this._isReady=!0)}),this._pollSpecs=new lc.Poll({auto:!1,factory:()=>this.requestSpecs(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:KernelSpecManager#specs",standby:(t=e.standby)!==null&&t!==void 0?t:"when-hidden"}),this.ready.then(()=>{this._pollSpecs.start()})}get isReady(){return this._isReady}get ready(){return this._ready}get specs(){return this._specs}get specsChanged(){return this._specsChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshSpecs(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestSpecs(){let e=await cc.getSpecs(this.serverSettings);this.isDisposed||oc.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}};je.KernelSpecManager=Mi});var bn=E(pe=>{"use strict";var Kr=pe&&pe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),uc=pe&&pe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Br=pe&&pe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Kr(e,i,t);return uc(e,i),e},pc=pe&&pe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Kr(e,i,t)};Object.defineProperty(pe,"__esModule",{value:!0});pe.KernelSpecAPI=pe.KernelSpec=void 0;var hc=Br(Ar());pe.KernelSpec=hc;var fc=Br(Pi());pe.KernelSpecAPI=fc;pc(Fr(),pe)});var Ri=E(Te=>{"use strict";var mc=Te&&Te.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),gc=Te&&Te.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Gr=Te&&Te.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&mc(e,i,t);return gc(e,i),e};Object.defineProperty(Te,"__esModule",{value:!0});Te.KernelConnection=void 0;var Vr=G(),We=te(),Je=X(),$r=Le(),Wr=jr(),se=Gr(rt()),Jr=qr(),_c=Gr(gn()),vc=bn(),Hr=vn(),yc=3e3,ct="_RESTARTING_",wc="",Ei=class i{constructor(e){var t,n,s,r,a,o;this._createSocket=(u=!0)=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let c=this.serverSettings,d=Vr.URLExt.join(c.wsUrl,Hr.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),l=d.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug(`Starting WebSocket: ${l}`);let p=Vr.URLExt.join(d,"channels?session_id="+encodeURIComponent(this._clientId)),v=c.token;c.appendToken&&v!==""&&(p=p+`&token=${encodeURIComponent(v)}`);let _=u?this._supportedProtocols:[];this._ws=new c.WebSocket(p,_),this._ws.binaryType="arraybuffer";let I=!1,P=async T=>{var x,w;if(!this._isDisposed){this._reason="",this._model=void 0;try{let R=await this._kernelAPIClient.getModel(this._id);this._model=R,(R==null?void 0:R.execution_state)==="dead"?this._updateStatus("dead"):this._onWSClose(T)}catch(R){if(R instanceof $r.ServerConnection.NetworkError||((x=R.response)===null||x===void 0?void 0:x.status)===503||((w=R.response)===null||w===void 0?void 0:w.status)===424){let A=we.getRandomIntInclusive(10,30)*1e3;setTimeout(P,A,T)}else this._reason="Kernel died unexpectedly",this._updateStatus("dead")}}},D=async T=>{I||(I=!0,await P(T))};this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=D,this._ws.onerror=D},this._onWSOpen=u=>{if(this._ws.protocol!==""&&!this._supportedProtocols.includes(this._ws.protocol))throw console.log("Server selected unknown kernel wire protocol:",this._ws.protocol),this._updateStatus("dead"),new Error(`Unknown kernel wire protocol: ${this._ws.protocol}`);this._selectedProtocol=this._ws.protocol,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose,this._updateConnectionStatus("connected")},this._onWSMessage=u=>{let c;try{c=this.serverSettings.serializer.deserialize(u.data,this._ws.protocol),_c.validateMessage(c)}catch(d){throw d.message=`Kernel message validation error: ${d.message}`,d}this._kernelSession=c.header.session,this._msgChain=this._msgChain.then(()=>this._handleMessage(c)).catch(d=>{d.message.startsWith("Canceled future for ")&&console.error(d)}),this._anyMessage.emit({msg:c,direction:"recv"})},this._onWSClose=u=>{this.isDisposed||this._reconnect()},this._id="",this._name="",this._status="unknown",this._connectionStatus="connecting",this._kernelSession="",this._isDisposed=!1,this._ws=null,this._username="",this._reconnectLimit=7,this._reconnectAttempt=0,this._reconnectTimeout=null,this._supportedProtocols=Object.values(se.supportedKernelWebSocketProtocols),this._selectedProtocol="",this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new We.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new Je.Signal(this),this._connectionStatusChanged=new Je.Signal(this),this._disposed=new Je.Signal(this),this._iopubMessage=new Je.Signal(this),this._anyMessage=new Je.Signal(this),this._pendingInput=new Je.Signal(this),this._unhandledMessage=new Je.Signal(this),this._displayIdToParentIds=new Map,this._msgIdToDisplayIds=new Map,this._msgChain=Promise.resolve(),this._hasPendingInput=!1,this._reason="",this._noOp=()=>{},this._supportsSubshells=!1,this._name=e.model.name,this._id=e.model.id,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:$r.ServerConnection.makeSettings(),this._kernelAPIClient=(n=e.kernelAPIClient)!==null&&n!==void 0?n:new Hr.KernelAPIClient({serverSettings:this.serverSettings}),this._clientId=(s=e.clientId)!==null&&s!==void 0?s:We.UUID.uuid4(),this._username=(r=e.username)!==null&&r!==void 0?r:"",this.handleComms=(a=e.handleComms)!==null&&a!==void 0?a:!0,this._subshellId=(o=e.subshellId)!==null&&o!==void 0?o:null,this._createSocket()}get disposed(){return this._disposed}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get model(){return this._model||{id:this.id,name:this.name,reason:this._reason}}get anyMessage(){return this._anyMessage}get pendingInput(){return this._pendingInput}get id(){return this._id}get name(){return this._name}get username(){return this._username}get clientId(){return this._clientId}get subshellId(){return this._subshellId}set subshellId(e){this._subshellId=e}get status(){return this._status}get connectionStatus(){return this._connectionStatus}get isDisposed(){return this._isDisposed}get info(){return this._info.promise}get spec(){return this._specPromise?this._specPromise:(this._specPromise=vc.KernelSpecAPI.getSpecs(this.serverSettings).then(e=>e.kernelspecs[this._name]),this._specPromise)}get supportsSubshells(){return this._supportsSubshells}clone(e={}){return new i({model:this.model,username:this.username,serverSettings:this.serverSettings,handleComms:!1,kernelAPIClient:this._kernelAPIClient,...e})}dispose(){if(this.isDisposed)return;let e=()=>{this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearKernelState(),this._pendingMessages=[],this._clearSocket(),Je.Signal.clearData(this)};if(this._subshellId!==null){let t=this.requestDeleteSubshell({subshell_id:this._subshellId},!0);t.onReply=n=>{e()}}else e()}sendShellMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Jr.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Jr.KernelControlFutureHandler,e,t,n)}_sendKernelShellControl(e,t,n=!1,s=!0){this._sendMessage(t),this._anyMessage.emit({msg:t,direction:"send"});let r=new e(()=>{let a=t.header.msg_id;this._futures.delete(a);let o=this._msgIdToDisplayIds.get(a);o&&(o.forEach(u=>{let c=this._displayIdToParentIds.get(u);if(c){let d=c.indexOf(a);if(d===-1)return;c.length===1?this._displayIdToParentIds.delete(u):(c.splice(d,1),this._displayIdToParentIds.set(u,c))}}),this._msgIdToDisplayIds.delete(a))},t,n,s,this);return this._futures.set(t.header.msg_id,r),r}_sendMessage(e,t=!0){if(this.status==="dead")throw new Error("Kernel is dead");if((this._kernelSession===wc||this._kernelSession===ct)&&se.isInfoRequestMsg(e))if(this.connectionStatus==="connected"){this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));return}else throw new Error("Could not send message: status is not connected");if(t&&this._pendingMessages.length>0){this._pendingMessages.push(e);return}if(this.connectionStatus==="connected"&&this._kernelSession!==ct)this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));else if(t)this._pendingMessages.push(e);else throw new Error("Could not send message")}async interrupt(){if(this.hasPendingInput=!1,this.status==="dead")throw new Error("Kernel is dead");return this._kernelAPIClient.interrupt(this.id)}async restart(){if(this.status==="dead")throw new Error("Kernel is dead");this._updateStatus("restarting"),this._clearKernelState(),this._kernelSession=ct,await this._kernelAPIClient.restart(this.id),await this.reconnect(),this.hasPendingInput=!1}reconnect(){this._errorIfDisposed();let e=new We.PromiseDelegate,t=(n,s)=>{s==="connected"?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):s==="disconnected"&&(e.reject(new Error("Kernel connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}async shutdown(){this.status!=="dead"&&await this._kernelAPIClient.shutdown(this.id),this.handleShutdown()}handleShutdown(){this._updateStatus("dead"),this.dispose()}async requestKernelInfo(){let e=se.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{}}),t;try{t=await we.handleShellMessage(this,e)}catch(s){if(this.isDisposed)return;throw s}if(this._errorIfDisposed(),!t)return;if(t.content.status===void 0&&(t.content.status="ok"),t.content.status!=="ok")return this._info.reject("Kernel info reply errored"),t;this._info.resolve(t.content),this._kernelSession=t.header.session;let n=t.content.supported_features;return this._supportsSubshells=n!==void 0&&n.includes("kernel subshells"),t}requestComplete(e){let t=se.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return we.handleShellMessage(this,t)}requestInspect(e){let t=se.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return we.handleShellMessage(this,t)}requestHistory(e){let t=se.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return we.handleShellMessage(this,t)}requestExecute(e,t=!0,n){let s={silent:!1,store_history:!0,user_expressions:{},allow_stdin:!0,stop_on_error:!1},r=se.createMessage({msgType:"execute_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{...s,...e},metadata:n});return this.sendShellMessage(r,!0,t)}requestDebug(e,t=!0){let n=se.createMessage({msgType:"debug_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestCreateSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"create_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestDeleteSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"delete_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestListSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"list_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestIsComplete(e){let t=se.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return we.handleShellMessage(this,t)}requestCommInfo(e){let t=se.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return we.handleShellMessage(this,t)}sendInputReply(e,t){let n=se.createMessage({msgType:"input_reply",channel:"stdin",username:this._username,session:this._clientId,content:e});n.parent_header=t,this._sendMessage(n),this._anyMessage.emit({msg:n,direction:"send"}),this.hasPendingInput=!1}createComm(e,t=We.UUID.uuid4()){if(!this.handleComms)throw new Error("Comms are disabled on this kernel connection");if(this._comms.has(t))throw new Error("Comm is already created");let n=new Wr.CommHandler(e,t,this,()=>{this._unregisterComm(t)});return this._comms.set(t,n),n}hasComm(e){return this._comms.has(e)}registerCommTarget(e,t){this.handleComms&&(this._targetRegistry[e]=t)}removeCommTarget(e,t){this.handleComms&&!this.isDisposed&&this._targetRegistry[e]===t&&delete this._targetRegistry[e]}registerMessageHook(e,t){var n;let s=(n=this._futures)===null||n===void 0?void 0:n.get(e);s&&s.registerMessageHook(t)}removeMessageHook(e,t){var n;let s=(n=this._futures)===null||n===void 0?void 0:n.get(e);s&&s.removeMessageHook(t)}removeInputGuard(){this.hasPendingInput=!1}async _handleDisplayId(e,t){var n,s;let r=t.parent_header.msg_id,a=this._displayIdToParentIds.get(e);if(a){let u={header:We.JSONExt.deepCopy(t.header),parent_header:We.JSONExt.deepCopy(t.parent_header),metadata:We.JSONExt.deepCopy(t.metadata),content:We.JSONExt.deepCopy(t.content),channel:t.channel,buffers:t.buffers?t.buffers.slice():[]};u.header.msg_type="update_display_data",await Promise.all(a.map(async c=>{let d=this._futures&&this._futures.get(c);d&&await d.handleMsg(u)}))}if(t.header.msg_type==="update_display_data")return!0;a=(n=this._displayIdToParentIds.get(e))!==null&&n!==void 0?n:[],a.indexOf(r)===-1&&a.push(r),this._displayIdToParentIds.set(e,a);let o=(s=this._msgIdToDisplayIds.get(r))!==null&&s!==void 0?s:[];return o.indexOf(r)===-1&&o.push(r),this._msgIdToDisplayIds.set(r,o),!1}_clearSocket(){this._ws!==null&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}_updateStatus(e){this._status===e||this._status==="dead"||(this._status=e,we.logKernelStatus(this),this._statusChanged.emit(e),e==="dead"&&this.dispose())}_sendPending(){for(;this.connectionStatus==="connected"&&this._kernelSession!==ct&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}_clearKernelState(){this._kernelSession="",this._pendingMessages=[],this._futures.forEach(e=>{e.dispose()}),this._comms.forEach(e=>{e.dispose()}),this._msgChain=Promise.resolve(),this._futures=new Map,this._comms=new Map,this._displayIdToParentIds.clear(),this._msgIdToDisplayIds.clear()}_assertCurrentMessage(e){if(this._errorIfDisposed(),e.header.session!==this._kernelSession)throw new Error(`Canceling handling of old message: ${e.header.msg_type}`)}async _handleCommOpen(e){this._assertCurrentMessage(e);let t=e.content,n=new Wr.CommHandler(t.target_name,t.comm_id,this,()=>{this._unregisterComm(t.comm_id)});this._comms.set(t.comm_id,n);try{await(await we.loadObject(t.target_name,t.target_module,this._targetRegistry))(n,e)}catch(s){throw n.close(),console.error("Exception opening new comm"),s}}async _handleCommClose(e){this._assertCurrentMessage(e);let t=e.content,n=this._comms.get(t.comm_id);if(!n){console.error("Comm not found for comm id "+t.comm_id);return}this._unregisterComm(n.commId);let s=n.onClose;s&&await s(e),n.dispose()}async _handleCommMsg(e){this._assertCurrentMessage(e);let t=e.content,n=this._comms.get(t.comm_id);if(!n)return;let s=n.onMsg;s&&await s(e)}_unregisterComm(e){this._comms.delete(e)}_updateConnectionStatus(e){if(this._connectionStatus!==e){if(this._connectionStatus=e,e!=="connecting"&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),this.status!=="dead")if(e==="connected"){let t=this._kernelSession===ct,n=this.requestKernelInfo(),s=!1,r=()=>{s||(s=!0,t&&this._kernelSession===ct&&(this._kernelSession=""),clearTimeout(a),this._pendingMessages.length>0&&this._sendPending())};n.then(r);let a=setTimeout(r,yc)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let s=!1;if(e.parent_header&&e.channel==="iopub"&&(se.isDisplayDataMsg(e)||se.isUpdateDisplayDataMsg(e)||se.isExecuteResultMsg(e))){let a=((t=e.content.transient)!==null&&t!==void 0?t:{}).display_id;a&&(s=await this._handleDisplayId(a,e),this._assertCurrentMessage(e))}if(!s&&e.parent_header){let r=e.parent_header,a=(n=this._futures)===null||n===void 0?void 0:n.get(r.msg_id);if(a)await a.handleMsg(e),this._assertCurrentMessage(e);else{let o=r.session===this.clientId;e.channel!=="iopub"&&o&&this._unhandledMessage.emit(e)}}if(e.channel==="iopub"){switch(e.header.msg_type){case"status":{let r=e.content.execution_state;r==="restarting"&&Promise.resolve().then(async()=>{this._updateStatus("autorestarting"),this._clearKernelState(),await this.reconnect()}),this._updateStatus(r);break}case"comm_open":this.handleComms&&await this._handleCommOpen(e);break;case"comm_msg":this.handleComms&&await this._handleCommMsg(e);break;case"comm_close":this.handleComms&&await this._handleCommClose(e);break;default:break}this.isDisposed||(this._assertCurrentMessage(e),this._iopubMessage.emit(e))}}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");let e=we.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.warn(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`);let t=this._selectedProtocol!=="";this._reconnectTimeout=setTimeout(this._createSocket,e,t),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_errorIfDisposed(){if(this.isDisposed)throw new Error("Kernel connection is disposed")}get hasPendingInput(){return this._hasPendingInput}set hasPendingInput(e){this._hasPendingInput=e,this._pendingInput.emit(e)}};Te.KernelConnection=Ei;var we;(function(i){function e(r){switch(r.status){case"idle":case"busy":case"unknown":return;default:console.debug(`Kernel: ${r.status} (${r.id})`);break}}i.logKernelStatus=e;async function t(r,a){return r.sendShellMessage(a,!0).done}i.handleShellMessage=t;function n(r,a,o){return new Promise((u,c)=>{if(a){if(typeof requirejs=="undefined")throw new Error("requirejs not found");requirejs([a],d=>{if(d[r]===void 0){let l=`Object '${r}' not found in module '${a}'`;c(new Error(l))}else u(d[r])},c)}else o!=null&&o[r]?u(o[r]):c(new Error(`Object '${r}' not found in registry`))})}i.loadObject=n;function s(r,a){return r=Math.ceil(r),a=Math.floor(a),Math.floor(Math.random()*(a-r+1))+r}i.getRandomIntInclusive=s})(we||(we={}))});var Xr=E(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.KernelManager=void 0;var bc=Qe(),Yr=X(),Sc=Le(),xc=Ze(),Cc=vn(),kc=Ri(),vt=class extends xc.BaseManager{constructor(e={}){var t,n;super(e),this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new Yr.Signal(this),this._connectionFailure=new Yr.Signal(this),this._kernelAPIClient=(t=e.kernelAPIClient)!==null&&t!==void 0?t:new Cc.KernelAPIClient({serverSettings:this.serverSettings}),this._pollModels=new bc.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:KernelManager#models",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._kernelConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){var t;let{id:n}=e.model,s=(t=e.handleComms)!==null&&t!==void 0?t:!0;if(e.handleComms===void 0){for(let a of this._kernelConnections)if(a.id===n&&a.handleComms){s=!1;break}}let r=new kc.KernelConnection({handleComms:s,...e,serverSettings:this.serverSettings,kernelAPIClient:this._kernelAPIClient});return this._onStarted(r),this._models.has(n)||this.refreshRunning().catch(()=>{}),r}running(){return this._models.values()}get runningCount(){return this._models.size}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={},t={}){let n=await this._kernelAPIClient.startNew(e);return this.connectTo({...t,model:n})}async shutdown(e){await this._kernelAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>this._kernelAPIClient.shutdown(e))),await this.refreshRunning()}async findById(e){return this._models.has(e)?this._models.get(e):(await this.refreshRunning(),this._models.get(e))}async requestRunning(){var e,t;let n;try{n=await this._kernelAPIClient.listRunning()}catch(s){throw(s instanceof Sc.ServerConnection.NetworkError||((e=s.response)===null||e===void 0?void 0:e.status)===503||((t=s.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(s),s}this.isDisposed||this._models.size===n.length&&n.every(s=>{let r=this._models.get(s.id);return r?r.connections===s.connections&&r.execution_state===s.execution_state&&r.last_activity===s.last_activity&&r.name===s.name&&r.reason===s.reason&&r.traceback===s.traceback:!1})||(this._models=new Map(n.map(s=>[s.id,s])),this._kernelConnections.forEach(s=>{this._models.has(s.id)||s.handleShutdown()}),this._runningChanged.emit(n))}_onStarted(e){this._kernelConnections.add(e),e.statusChanged.connect(this._onStatusChanged,this),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._kernelConnections.delete(e),this.refreshRunning().catch(()=>{})}_onStatusChanged(e,t){t==="dead"&&this.refreshRunning().catch(()=>{})}};yt.KernelManager=vt;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}async startNew(n={},s={}){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}connectTo(n){throw new Error("Not implemented in no-op Kernel Manager")}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}get ready(){return this.parentReady.then(()=>this._readyPromise)}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(vt||(yt.KernelManager=vt={}))});var Oi=E(Q=>{"use strict";var Zr=Q&&Q.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Pc=Q&&Q.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Ii=Q&&Q.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Zr(e,i,t);return Pc(e,i),e},Mc=Q&&Q.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Zr(e,i,t)};Object.defineProperty(Q,"__esModule",{value:!0});Q.KernelConnection=Q.KernelAPI=Q.KernelMessage=Q.Kernel=void 0;var Ec=Ii(Cr());Q.Kernel=Ec;var Rc=Ii(rt());Q.KernelMessage=Rc;var Ic=Ii(vn());Q.KernelAPI=Ic;var Oc=Ri();Object.defineProperty(Q,"KernelConnection",{enumerable:!0,get:function(){return Oc.KernelConnection}});Mc(Xr(),Q)});var Qr=E(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.BuildManager=void 0;var Di=G(),He=de(),Dc="api/build",ji=class{constructor(e={}){var t;this._url="",this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:He.ServerConnection.makeSettings();let{baseUrl:n,appUrl:s}=this.serverSettings;this._url=Di.URLExt.join(n,s,Dc)}get isAvailable(){return Di.PageConfig.getOption("buildAvailable").toLowerCase()==="true"}get shouldCheck(){return Di.PageConfig.getOption("buildCheck").toLowerCase()==="true"}getStatus(){let{_url:e,serverSettings:t}=this;return He.ServerConnection.makeRequest(e,{},t).then(s=>{if(s.status!==200)throw new He.ServerConnection.ResponseError(s);return s.json()}).then(s=>{if(typeof s.status!="string")throw new Error("Invalid data");if(typeof s.message!="string")throw new Error("Invalid data");return s})}build(){let{_url:e,serverSettings:t}=this,n={method:"POST"};return He.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status===400)throw new He.ServerConnection.ResponseError(r,"Build aborted");if(r.status!==200){let a=`Build failed with ${r.status}.
3
+ `);else{u=new t(c);let v=d.indexOf(i.CODE_BLOCK_MARKER),_=d.lastIndexOf(i.CODE_BLOCK_MARKER);v!==_&&(u.code=d.substring(v+i.CODE_BLOCK_MARKER.length,_),u.endLine=c,o.push(u),u=null)}}return o}i.findMarkdownCodeBlocks=s})(Os||(Yt.MarkdownCodeBlocks=Os={}))});var As=E((Jd,qs)=>{"use strict";function Ao(i,e){var t=i;e.slice(0,-1).forEach(function(s){t=t[s]||{}});var n=e[e.length-1];return n in t}function js(i){return typeof i=="number"||/^0x[0-9a-f]+$/i.test(i)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(i)}function Ts(i,e){return e==="constructor"&&typeof i[e]=="function"||e==="__proto__"}qs.exports=function(i,e){e||(e={});var t={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(t.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?t.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(w){t.bools[w]=!0});var n={};function s(w){return n[w].some(function(R){return t.bools[R]})}Object.keys(e.alias||{}).forEach(function(w){n[w]=[].concat(e.alias[w]),n[w].forEach(function(R){n[R]=[w].concat(n[w].filter(function(U){return R!==U}))})}),[].concat(e.string).filter(Boolean).forEach(function(w){t.strings[w]=!0,n[w]&&[].concat(n[w]).forEach(function(R){t.strings[R]=!0})});var r=e.default||{},a={_:[]};function o(w,R){return t.allBools&&/^--[^=]+$/.test(R)||t.strings[w]||t.bools[w]||n[w]}function u(w,R,U){for(var T=w,j=0;j<R.length-1;j++){var A=R[j];if(Ts(T,A))return;T[A]===void 0&&(T[A]={}),(T[A]===Object.prototype||T[A]===Number.prototype||T[A]===String.prototype)&&(T[A]={}),T[A]===Array.prototype&&(T[A]=[]),T=T[A]}var h=R[R.length-1];Ts(T,h)||((T===Object.prototype||T===Number.prototype||T===String.prototype)&&(T={}),T===Array.prototype&&(T=[]),T[h]===void 0||t.bools[h]||typeof T[h]=="boolean"?T[h]=U:Array.isArray(T[h])?T[h].push(U):T[h]=[T[h],U])}function c(w,R,U){if(!(U&&t.unknownFn&&!o(w,U)&&t.unknownFn(U)===!1)){var T=!t.strings[w]&&js(R)?Number(R):R;u(a,w.split("."),T),(n[w]||[]).forEach(function(j){u(a,j.split("."),T)})}}Object.keys(t.bools).forEach(function(w){c(w,r[w]===void 0?!1:r[w])});var d=[];i.indexOf("--")!==-1&&(d=i.slice(i.indexOf("--")+1),i=i.slice(0,i.indexOf("--")));for(var l=0;l<i.length;l++){var p=i[l],v,_;if(/^--.+=/.test(p)){var I=p.match(/^--([^=]+)=([\s\S]*)$/);v=I[1];var P=I[2];t.bools[v]&&(P=P!=="false"),c(v,P,p)}else if(/^--no-.+/.test(p))v=p.match(/^--no-(.+)/)[1],c(v,!1,p);else if(/^--.+/.test(p))v=p.match(/^--(.+)/)[1],_=i[l+1],_!==void 0&&!/^(-|--)[^-]/.test(_)&&!t.bools[v]&&!t.allBools&&(!n[v]||!s(v))?(c(v,_,p),l+=1):/^(true|false)$/.test(_)?(c(v,_==="true",p),l+=1):c(v,t.strings[v]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var D=p.slice(1,-1).split(""),q=!1,x=0;x<D.length;x++){if(_=p.slice(x+2),_==="-"){c(D[x],_,p);continue}if(/[A-Za-z]/.test(D[x])&&_[0]==="="){c(D[x],_.slice(1),p),q=!0;break}if(/[A-Za-z]/.test(D[x])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(_)){c(D[x],_,p),q=!0;break}if(D[x+1]&&D[x+1].match(/\W/)){c(D[x],p.slice(x+2),p),q=!0;break}else c(D[x],t.strings[D[x]]?"":!0,p)}v=p.slice(-1)[0],!q&&v!=="-"&&(i[l+1]&&!/^(-|--)[^-]/.test(i[l+1])&&!t.bools[v]&&(!n[v]||!s(v))?(c(v,i[l+1],p),l+=1):i[l+1]&&/^(true|false)$/.test(i[l+1])?(c(v,i[l+1]==="true",p),l+=1):c(v,t.strings[v]?"":!0,p))}else if((!t.unknownFn||t.unknownFn(p)!==!1)&&a._.push(t.strings._||!js(p)?p:Number(p)),e.stopEarly){a._.push.apply(a._,i.slice(l+1));break}}return Object.keys(r).forEach(function(w){Ao(a,w.split("."))||(u(a,w.split("."),r[w]),(n[w]||[]).forEach(function(R){u(a,R.split("."),r[w])}))}),e["--"]?a["--"]=d.slice():d.forEach(function(w){a._.push(w)}),a}});var Xt=E((Hd,Ns)=>{"use strict";function Me(i){if(typeof i!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(i))}function Us(i,e){for(var t="",n=0,s=-1,r=0,a,o=0;o<=i.length;++o){if(o<i.length)a=i.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||r===1))if(s!==o-1&&r===2){if(t.length<2||n!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var u=t.lastIndexOf("/");if(u!==t.length-1){u===-1?(t="",n=0):(t=t.slice(0,u),n=t.length-1-t.lastIndexOf("/")),s=o,r=0;continue}}else if(t.length===2||t.length===1){t="",n=0,s=o,r=0;continue}}e&&(t.length>0?t+="/..":t="..",n=2)}else t.length>0?t+="/"+i.slice(s+1,o):t=i.slice(s+1,o),n=o-s-1;s=o,r=0}else a===46&&r!==-1?++r:r=-1}return t}function Uo(i,e){var t=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+n:t+i+n:n}var nt={resolve:function(){for(var e="",t=!1,n,s=arguments.length-1;s>=-1&&!t;s--){var r;s>=0?r=arguments[s]:(n===void 0&&(n=process.cwd()),r=n),Me(r),r.length!==0&&(e=r+"/"+e,t=r.charCodeAt(0)===47)}return e=Us(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(Me(e),e.length===0)return".";var t=e.charCodeAt(0)===47,n=e.charCodeAt(e.length-1)===47;return e=Us(e,!t),e.length===0&&!t&&(e="."),e.length>0&&n&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return Me(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var n=arguments[t];Me(n),n.length>0&&(e===void 0?e=n:e+="/"+n)}return e===void 0?".":nt.normalize(e)},relative:function(e,t){if(Me(e),Me(t),e===t||(e=nt.resolve(e),t=nt.resolve(t),e===t))return"";for(var n=1;n<e.length&&e.charCodeAt(n)===47;++n);for(var s=e.length,r=s-n,a=1;a<t.length&&t.charCodeAt(a)===47;++a);for(var o=t.length,u=o-a,c=r<u?r:u,d=-1,l=0;l<=c;++l){if(l===c){if(u>c){if(t.charCodeAt(a+l)===47)return t.slice(a+l+1);if(l===0)return t.slice(a+l)}else r>c&&(e.charCodeAt(n+l)===47?d=l:l===0&&(d=0));break}var p=e.charCodeAt(n+l),v=t.charCodeAt(a+l);if(p!==v)break;p===47&&(d=l)}var _="";for(l=n+d+1;l<=s;++l)(l===s||e.charCodeAt(l)===47)&&(_.length===0?_+="..":_+="/..");return _.length>0?_+t.slice(a+d):(a+=d,t.charCodeAt(a)===47&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(Me(e),e.length===0)return".";for(var t=e.charCodeAt(0),n=t===47,s=-1,r=!0,a=e.length-1;a>=1;--a)if(t=e.charCodeAt(a),t===47){if(!r){s=a;break}}else r=!1;return s===-1?n?"/":".":n&&s===1?"//":e.slice(0,s)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Me(e);var n=0,s=-1,r=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var o=t.length-1,u=-1;for(a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(c===47){if(!r){n=a+1;break}}else u===-1&&(r=!1,u=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(s=a):(o=-1,s=u))}return n===s?s=u:s===-1&&(s=e.length),e.slice(n,s)}else{for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!r){n=a+1;break}}else s===-1&&(r=!1,s=a+1);return s===-1?"":e.slice(n,s)}},extname:function(e){Me(e);for(var t=-1,n=0,s=-1,r=!0,a=0,o=e.length-1;o>=0;--o){var u=e.charCodeAt(o);if(u===47){if(!r){n=o+1;break}continue}s===-1&&(r=!1,s=o+1),u===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||s===-1||a===0||a===1&&t===s-1&&t===n+1?"":e.slice(t,s)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return Uo("/",e)},parse:function(e){Me(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var n=e.charCodeAt(0),s=n===47,r;s?(t.root="/",r=1):r=0;for(var a=-1,o=0,u=-1,c=!0,d=e.length-1,l=0;d>=r;--d){if(n=e.charCodeAt(d),n===47){if(!c){o=d+1;break}continue}u===-1&&(c=!1,u=d+1),n===46?a===-1?a=d:l!==1&&(l=1):a!==-1&&(l=-1)}return a===-1||u===-1||l===0||l===1&&a===u-1&&a===o+1?u!==-1&&(o===0&&s?t.base=t.name=e.slice(1,u):t.base=t.name=e.slice(o,u)):(o===0&&s?(t.name=e.slice(1,a),t.base=e.slice(1,u)):(t.name=e.slice(o,a),t.base=e.slice(o,u)),t.ext=e.slice(a,u)),o>0?t.dir=e.slice(0,o-1):s&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};nt.posix=nt;Ns.exports=nt});var Ls=E((Gd,zs)=>{"use strict";zs.exports=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var Bs=E(ii=>{"use strict";var No=Object.prototype.hasOwnProperty,zo;function Fs(i){try{return decodeURIComponent(i.replace(/\+/g," "))}catch{return null}}function Ks(i){try{return encodeURIComponent(i)}catch{return null}}function Lo(i){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},n;n=e.exec(i);){var s=Fs(n[1]),r=Fs(n[2]);s===null||r===null||s in t||(t[s]=r)}return t}function Fo(i,e){e=e||"";var t=[],n,s;typeof e!="string"&&(e="?");for(s in i)if(No.call(i,s)){if(n=i[s],!n&&(n===null||n===zo||isNaN(n))&&(n=""),s=Ks(s),n=Ks(n),s===null||n===null)continue;t.push(s+"="+n)}return t.length?e+t.join("&"):""}ii.stringify=Fo;ii.parse=Lo});var Xs=E((Xd,Ys)=>{"use strict";var $s=Ls(),Zt=Bs(),Ko=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Ws=/[\n\r\t]/g,Bo=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,Js=/:\d+$/,Vo=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,$o=/^[a-zA-Z]:/;function ri(i){return(i||"").toString().replace(Ko,"")}var si=[["#","hash"],["?","query"],function(e,t){return Ee(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],Vs={hash:1,query:1};function Hs(i){var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e={};var t=e.location||{};i=i||t;var n={},s=typeof i,r;if(i.protocol==="blob:")n=new Ie(unescape(i.pathname),{});else if(s==="string"){n=new Ie(i,{});for(r in Vs)delete n[r]}else if(s==="object"){for(r in i)r in Vs||(n[r]=i[r]);n.slashes===void 0&&(n.slashes=Bo.test(i.href))}return n}function Ee(i){return i==="file:"||i==="ftp:"||i==="http:"||i==="https:"||i==="ws:"||i==="wss:"}function Gs(i,e){i=ri(i),i=i.replace(Ws,""),e=e||{};var t=Vo.exec(i),n=t[1]?t[1].toLowerCase():"",s=!!t[2],r=!!t[3],a=0,o;return s?r?(o=t[2]+t[3]+t[4],a=t[2].length+t[3].length):(o=t[2]+t[4],a=t[2].length):r?(o=t[3]+t[4],a=t[3].length):o=t[4],n==="file:"?a>=2&&(o=o.slice(2)):Ee(n)?o=t[4]:n?s&&(o=o.slice(2)):a>=2&&Ee(e.protocol)&&(o=t[4]),{protocol:n,slashes:s||Ee(n),slashesCount:a,rest:o}}function Wo(i,e){if(i==="")return e;for(var t=(e||"/").split("/").slice(0,-1).concat(i.split("/")),n=t.length,s=t[n-1],r=!1,a=0;n--;)t[n]==="."?t.splice(n,1):t[n]===".."?(t.splice(n,1),a++):a&&(n===0&&(r=!0),t.splice(n,1),a--);return r&&t.unshift(""),(s==="."||s==="..")&&t.push(""),t.join("/")}function Ie(i,e,t){if(i=ri(i),i=i.replace(Ws,""),!(this instanceof Ie))return new Ie(i,e,t);var n,s,r,a,o,u,c=si.slice(),d=typeof e,l=this,p=0;for(d!=="object"&&d!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=Zt.parse),e=Hs(e),s=Gs(i||"",e),n=!s.protocol&&!s.slashes,l.slashes=s.slashes||n&&e.slashes,l.protocol=s.protocol||e.protocol||"",i=s.rest,(s.protocol==="file:"&&(s.slashesCount!==2||$o.test(i))||!s.slashes&&(s.protocol||s.slashesCount<2||!Ee(l.protocol)))&&(c[3]=[/(.*)/,"pathname"]);p<c.length;p++){if(a=c[p],typeof a=="function"){i=a(i,l);continue}r=a[0],u=a[1],r!==r?l[u]=i:typeof r=="string"?(o=r==="@"?i.lastIndexOf(r):i.indexOf(r),~o&&(typeof a[2]=="number"?(l[u]=i.slice(0,o),i=i.slice(o+a[2])):(l[u]=i.slice(o),i=i.slice(0,o)))):(o=r.exec(i))&&(l[u]=o[1],i=i.slice(0,o.index)),l[u]=l[u]||n&&a[3]&&e[u]||"",a[4]&&(l[u]=l[u].toLowerCase())}t&&(l.query=t(l.query)),n&&e.slashes&&l.pathname.charAt(0)!=="/"&&(l.pathname!==""||e.pathname!=="")&&(l.pathname=Wo(l.pathname,e.pathname)),l.pathname.charAt(0)!=="/"&&Ee(l.protocol)&&(l.pathname="/"+l.pathname),$s(l.port,l.protocol)||(l.host=l.hostname,l.port=""),l.username=l.password="",l.auth&&(o=l.auth.indexOf(":"),~o?(l.username=l.auth.slice(0,o),l.username=encodeURIComponent(decodeURIComponent(l.username)),l.password=l.auth.slice(o+1),l.password=encodeURIComponent(decodeURIComponent(l.password))):l.username=encodeURIComponent(decodeURIComponent(l.auth)),l.auth=l.password?l.username+":"+l.password:l.username),l.origin=l.protocol!=="file:"&&Ee(l.protocol)&&l.host?l.protocol+"//"+l.host:"null",l.href=l.toString()}function Jo(i,e,t){var n=this;switch(i){case"query":typeof e=="string"&&e.length&&(e=(t||Zt.parse)(e)),n[i]=e;break;case"port":n[i]=e,$s(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[i]="");break;case"hostname":n[i]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[i]=e,Js.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!t;break;case"pathname":case"hash":if(e){var s=i==="pathname"?"/":"#";n[i]=e.charAt(0)!==s?s+e:e}else n[i]=e;break;case"username":case"password":n[i]=encodeURIComponent(e);break;case"auth":var r=e.indexOf(":");~r?(n.username=e.slice(0,r),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(r+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var a=0;a<si.length;a++){var o=si[a];o[4]&&(n[o[1]]=n[o[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&Ee(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function Ho(i){(!i||typeof i!="function")&&(i=Zt.stringify);var e,t=this,n=t.host,s=t.protocol;s&&s.charAt(s.length-1)!==":"&&(s+=":");var r=s+(t.protocol&&t.slashes||Ee(t.protocol)?"//":"");return t.username?(r+=t.username,t.password&&(r+=":"+t.password),r+="@"):t.password?(r+=":"+t.password,r+="@"):t.protocol!=="file:"&&Ee(t.protocol)&&!n&&t.pathname!=="/"&&(r+="@"),(n[n.length-1]===":"||Js.test(t.hostname)&&!t.port)&&(n+=":"),r+=n+t.pathname,e=typeof t.query=="object"?i(t.query):t.query,e&&(r+=e.charAt(0)!=="?"?"?"+e:e),t.hash&&(r+=t.hash),r}Ie.prototype={set:Jo,toString:Ho};Ie.extractProtocol=Gs;Ie.location=Hs;Ie.trimLeft=ri;Ie.qs=Zt;Ys.exports=Ie});var ai=E(it=>{"use strict";var Go=it&&it.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(it,"__esModule",{value:!0});it.URLExt=void 0;var Yo=Xt(),Qt=Go(Xs()),Zs;(function(i){function e(c){if(typeof document!="undefined"&&document){let d=document.createElement("a");return d.href=c,d}return(0,Qt.default)(c)}i.parse=e;function t(c){return(0,Qt.default)(c).hostname}i.getHostName=t;function n(c){return c&&e(c).toString()}i.normalize=n;function s(...c){let d=(0,Qt.default)(c[0],{}),l=d.protocol===""&&d.slashes;l&&(d=(0,Qt.default)(c[0],"https:"+c[0]));let p=`${l?"":d.protocol}${d.slashes?"//":""}${d.auth}${d.auth?"@":""}${d.host}`,v=Yo.posix.join(`${p&&d.pathname[0]!=="/"?"/":""}${d.pathname}`,...c.slice(1));return`${p}${v==="."?"":v}`}i.join=s;function r(c){return s(...c.split("/").map(encodeURIComponent))}i.encodeParts=r;function a(c){let d=Object.keys(c).filter(l=>l.length>0);return d.length?"?"+d.map(l=>{let p=encodeURIComponent(String(c[l]));return l+(p?"="+p:"")}).join("&"):""}i.objectToQueryString=a;function o(c){return c.replace(/^\?/,"").split("&").reduce((d,l)=>{let[p,v]=l.split("=");return p.length>0&&(d[p]=decodeURIComponent(v||"")),d},{})}i.queryStringToObject=o;function u(c,d=!1){let{protocol:l}=e(c);return(!l||c.toLowerCase().indexOf(l)!==0)&&(d?c.indexOf("//")!==0:c.indexOf("/")!==0)}i.isLocal=u})(Zs||(it.URLExt=Zs={}))});var Qs=E((exports,module)=>{"use strict";var __importDefault=exports&&exports.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(exports,"__esModule",{value:!0});exports.PageConfig=void 0;var coreutils_1=te(),minimist_1=__importDefault(As()),url_1=ai(),PageConfig;(function(PageConfig){function getOption(name){if(configData)return configData[name]||getBodyData(name);configData=Object.create(null);let found=!1;if(typeof document!="undefined"&&document){let i=document.getElementById("jupyter-config-data");i&&(configData=JSON.parse(i.textContent||""),found=!0)}if(!found&&typeof process!="undefined"&&process.argv)try{let cli=(0,minimist_1.default)(process.argv.slice(2)),path=Xt(),fullPath="";"jupyter-config-data"in cli?fullPath=path.resolve(cli["jupyter-config-data"]):"JUPYTER_CONFIG_DATA"in process.env&&(fullPath=path.resolve(process.env.JUPYTER_CONFIG_DATA)),fullPath&&(configData=eval("require")(fullPath))}catch(i){console.error(i)}if(!coreutils_1.JSONExt.isObject(configData))configData=Object.create(null);else for(let i in configData)typeof configData[i]!="string"&&(configData[i]=JSON.stringify(configData[i]));return configData[name]||getBodyData(name)}PageConfig.getOption=getOption;function setOption(i,e){let t=getOption(i);return configData[i]=e,t}PageConfig.setOption=setOption;function getBaseUrl(){return url_1.URLExt.normalize(getOption("baseUrl")||"/")}PageConfig.getBaseUrl=getBaseUrl;function getTreeUrl(){return url_1.URLExt.join(getBaseUrl(),getOption("treeUrl"))}PageConfig.getTreeUrl=getTreeUrl;function getShareUrl(){return url_1.URLExt.normalize(getOption("shareUrl")||getBaseUrl())}PageConfig.getShareUrl=getShareUrl;function getTreeShareUrl(){return url_1.URLExt.normalize(url_1.URLExt.join(getShareUrl(),getOption("treeUrl")))}PageConfig.getTreeShareUrl=getTreeShareUrl;function getUrl(i){var e,t,n,s;let r=i.toShare?getShareUrl():getBaseUrl(),a=(e=i.mode)!==null&&e!==void 0?e:getOption("mode"),o=(t=i.workspace)!==null&&t!==void 0?t:getOption("workspace"),u=a==="single-document"?"doc":"lab";r=url_1.URLExt.join(r,u),o!==PageConfig.defaultWorkspace&&(r=url_1.URLExt.join(r,"workspaces",encodeURIComponent((n=getOption("workspace"))!==null&&n!==void 0?n:PageConfig.defaultWorkspace)));let c=(s=i.treePath)!==null&&s!==void 0?s:getOption("treePath");return c&&(r=url_1.URLExt.join(r,"tree",url_1.URLExt.encodeParts(c))),r}PageConfig.getUrl=getUrl,PageConfig.defaultWorkspace="default";function getWsUrl(i){let e=getOption("wsUrl");if(!e){if(i=i?url_1.URLExt.normalize(i):getBaseUrl(),i.indexOf("http")!==0)return"";e="ws"+i.slice(4)}return url_1.URLExt.normalize(e)}PageConfig.getWsUrl=getWsUrl;function getNBConvertURL({path:i,format:e,download:t}){let n=url_1.URLExt.encodeParts(i),s=url_1.URLExt.join(getBaseUrl(),"nbconvert",e,n);return t?s+"?download=true":s}PageConfig.getNBConvertURL=getNBConvertURL;function getToken(){return getOption("token")||getBodyData("jupyterApiToken")}PageConfig.getToken=getToken;function getNotebookVersion(){let i=getOption("notebookVersion");return i===""?[0,0,0]:JSON.parse(i)}PageConfig.getNotebookVersion=getNotebookVersion;let configData=null;function getBodyData(i){if(typeof document=="undefined"||!document.body)return"";let e=document.body.dataset[i];return typeof e=="undefined"?"":decodeURIComponent(e)}let Extension;(function(i){function e(s){try{let r=getOption(s);if(r)return JSON.parse(r)}catch(r){console.warn(`Unable to parse ${s}.`,r)}return[]}i.deferred=e("deferredExtensions"),i.disabled=e("disabledExtensions");function t(s){let r=s.indexOf(":"),a="";return r!==-1&&(a=s.slice(0,r)),i.deferred.some(o=>o===s||a&&o===a)}i.isDeferred=t;function n(s){let r=s.indexOf(":"),a="";return r!==-1&&(a=s.slice(0,r)),i.disabled.some(o=>o===s||a&&o===a)}i.isDisabled=n})(Extension=PageConfig.Extension||(PageConfig.Extension={}))})(PageConfig||(exports.PageConfig=PageConfig={}))});var tr=E(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.PathExt=void 0;var Ke=Xt(),er;(function(i){function e(...l){let p=Ke.posix.join(...l);return p==="."?"":d(p)}i.join=e;function t(...l){let p=Ke.posix.join(...l);return p==="."?"":p}i.joinWithLeadingSlash=t;function n(l,p){return Ke.posix.basename(l,p)}i.basename=n;function s(l){let p=d(Ke.posix.dirname(l));return p==="."?"":p}i.dirname=s;function r(l){return Ke.posix.extname(l)}i.extname=r;function a(l){return l===""?"":d(Ke.posix.normalize(l))}i.normalize=a;function o(...l){return d(Ke.posix.resolve(...l))}i.resolve=o;function u(l,p){return d(Ke.posix.relative(l,p))}i.relative=u;function c(l){return l.length>0&&l.indexOf(".")!==0&&(l=`.${l}`),l}i.normalizeExtension=c;function d(l){return l.indexOf("/")===0&&(l=l.slice(1)),l}i.removeSlash=d})(er||(en.PathExt=er={}))});var nr=E(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.signalToPromise=Zo;var Xo=te();function Zo(i,e){let t=new Xo.PromiseDelegate;function n(){i.disconnect(s)}function s(r,a){n(),t.resolve([r,a])}return i.connect(s),(e!=null?e:0)>0&&setTimeout(()=>{n(),t.reject(`Signal not emitted within ${e} ms.`)},e),t.promise}});var sr=E(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.Text=void 0;var ir;(function(i){let e=2>1;function t(a,o){if(e)return a;let u=a;for(let c=0;c+1<o.length&&c<a;c++){let d=o.charCodeAt(c);if(d>=55296&&d<=56319){let l=o.charCodeAt(c+1);l>=56320&&l<=57343&&(u--,c++)}}return u}i.jsIndexToCharIndex=t;function n(a,o){if(e)return a;let u=a;for(let c=0;c+1<o.length&&c<u;c++){let d=o.charCodeAt(c);if(d>=55296&&d<=56319){let l=o.charCodeAt(c+1);l>=56320&&l<=57343&&(u++,c++)}}return u}i.charIndexToJsIndex=n;function s(a,o=!1){return a.replace(/^(\w)|[\s-_:]+(\w)/g,function(u,c,d){return d?d.toUpperCase():o?c.toUpperCase():c.toLowerCase()})}i.camelCase=s;function r(a){return(a||"").toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}i.titleCase=r})(ir||(tn.Text=ir={}))});var ar=E(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.Time=void 0;var Qo=[{name:"years",milliseconds:365*24*60*60*1e3},{name:"months",milliseconds:30*24*60*60*1e3},{name:"days",milliseconds:24*60*60*1e3},{name:"hours",milliseconds:60*60*1e3},{name:"minutes",milliseconds:60*1e3},{name:"seconds",milliseconds:1e3}],rr;(function(i){function e(n,s="long"){let r=document.documentElement.lang||"en",a=new Intl.RelativeTimeFormat(r,{numeric:"auto",style:s}),o=new Date(n).getTime()-Date.now();for(let u of Qo){let c=Math.ceil(o/u.milliseconds);if(c!==0)return a.format(c,u.name)}return a.format(0,"seconds")}i.formatHuman=e;function t(n){let s=document.documentElement.lang||"en";return new Intl.DateTimeFormat(s,{dateStyle:"short",timeStyle:"short"}).format(new Date(n))}i.format=t})(rr||(nn.Time=rr={}))});var Y=E(ae=>{"use strict";var el=ae&&ae.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Re=ae&&ae.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&el(e,i,t)};Object.defineProperty(ae,"__esModule",{value:!0});Re(Ms(),ae);Re(Is(),ae);Re(Rs(),ae);Re(Ds(),ae);Re(Qs(),ae);Re(tr(),ae);Re(nr(),ae);Re(sr(),ae);Re(ar(),ae);Re(ai(),ae)});var st=E(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.supportedKernelWebSocketProtocols=void 0;B.createMessage=nl;B.isStreamMsg=il;B.isDisplayDataMsg=sl;B.isUpdateDisplayDataMsg=rl;B.isExecuteInputMsg=al;B.isExecuteResultMsg=ol;B.isErrorMsg=ll;B.isStatusMsg=cl;B.isClearOutputMsg=dl;B.isDebugEventMsg=ul;B.isCommOpenMsg=pl;B.isCommCloseMsg=hl;B.isCommMsgMsg=fl;B.isInfoRequestMsg=ml;B.isExecuteReplyMsg=gl;B.isDebugRequestMsg=_l;B.isDebugReplyMsg=vl;B.isInputRequestMsg=yl;B.isInputReplyMsg=wl;var tl=te();function nl(i){var e,t,n,s,r,a;return{buffers:(e=i.buffers)!==null&&e!==void 0?e:[],channel:i.channel,content:i.content,header:{date:new Date().toISOString(),msg_id:(t=i.msgId)!==null&&t!==void 0?t:tl.UUID.uuid4(),msg_type:i.msgType,session:i.session,username:(n=i.username)!==null&&n!==void 0?n:"",subshell_id:(s=i.subshellId)!==null&&s!==void 0?s:null,version:"5.2"},metadata:(r=i.metadata)!==null&&r!==void 0?r:{},parent_header:(a=i.parentHeader)!==null&&a!==void 0?a:{}}}function il(i){return i.header.msg_type==="stream"}function sl(i){return i.header.msg_type==="display_data"}function rl(i){return i.header.msg_type==="update_display_data"}function al(i){return i.header.msg_type==="execute_input"}function ol(i){return i.header.msg_type==="execute_result"}function ll(i){return i.header.msg_type==="error"}function cl(i){return i.header.msg_type==="status"}function dl(i){return i.header.msg_type==="clear_output"}function ul(i){return i.header.msg_type==="debug_event"}function pl(i){return i.header.msg_type==="comm_open"}function hl(i){return i.header.msg_type==="comm_close"}function fl(i){return i.header.msg_type==="comm_msg"}function ml(i){return i.header.msg_type==="kernel_info_request"}function gl(i){return i.header.msg_type==="execute_reply"}function _l(i){return i.header.msg_type==="debug_request"}function vl(i){return i.header.msg_type==="debug_reply"}function yl(i){return i.header.msg_type==="input_request"}function wl(i){return i.header.msg_type==="input_reply"}var or;(function(i){i.v1KernelWebsocketJupyterOrg="v1.kernel.websocket.jupyter.org"})(or||(B.supportedKernelWebSocketProtocols=or={}))});var cr=E(Oe=>{"use strict";var bl=Oe&&Oe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Sl=Oe&&Oe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),xl=Oe&&Oe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&bl(e,i,t);return Sl(e,i),e};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.serialize=Cl;Oe.deserialize=kl;var lr=xl(st());function Cl(i,e=""){switch(e){case lr.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return rt.serializeV1KernelWebsocketJupyterOrg(i);default:return rt.serializeDefault(i)}}function kl(i,e=""){switch(e){case lr.supportedKernelWebSocketProtocols.v1KernelWebsocketJupyterOrg:return rt.deserializeV1KernelWebsocketJupyterOrg(i);default:return rt.deserializeDefault(i)}}var rt;(function(i){function e(o){let u,c=new DataView(o),d=Number(c.getBigUint64(0,!0)),l=[];for(let x=0;x<d;x++)l.push(Number(c.getBigUint64(8*(x+1),!0)));let p=new TextDecoder("utf8"),v=p.decode(o.slice(l[0],l[1])),_=JSON.parse(p.decode(o.slice(l[1],l[2]))),I=JSON.parse(p.decode(o.slice(l[2],l[3]))),P=JSON.parse(p.decode(o.slice(l[3],l[4]))),D=JSON.parse(p.decode(o.slice(l[4],l[5]))),q=[];for(let x=5;x<l.length-1;x++)q.push(new DataView(o.slice(l[x],l[x+1])));return u={channel:v,header:_,parent_header:I,metadata:P,content:D,buffers:q},u}i.deserializeV1KernelWebsocketJupyterOrg=e;function t(o){let u=JSON.stringify(o.header),c=o.parent_header==null?"{}":JSON.stringify(o.parent_header),d=JSON.stringify(o.metadata),l=JSON.stringify(o.content),p=o.buffers!==void 0?o.buffers:[],v=5+p.length+1,_=[];_.push(8*(1+v)),_.push(o.channel.length+_[_.length-1]);let I=new TextEncoder,P=I.encode(o.channel),D=I.encode(u),q=I.encode(c),x=I.encode(d),w=I.encode(l),R=new Uint8Array(P.length+D.length+q.length+x.length+w.length);R.set(P),R.set(D,P.length),R.set(q,P.length+D.length),R.set(x,P.length+D.length+q.length),R.set(w,P.length+D.length+q.length+x.length);for(let h of[D.length,q.length,x.length,w.length])_.push(h+_[_.length-1]);let U=0;for(let h of p){let y=h.byteLength;_.push(y+_[_.length-1]),U+=y}let T=new Uint8Array(8*(1+v)+R.byteLength+U),j=new ArrayBuffer(8),A=new DataView(j);A.setBigUint64(0,BigInt(v),!0),T.set(new Uint8Array(j),0);for(let h=0;h<_.length;h++)A.setBigUint64(0,BigInt(_[h]),!0),T.set(new Uint8Array(j),8*(h+1));T.set(R,_[0]);for(let h=0;h<p.length;h++){let y=p[h];T.set(new Uint8Array(ArrayBuffer.isView(y)?y.buffer:y),_[5+h])}return T.buffer}i.serializeV1KernelWebsocketJupyterOrg=t;function n(o){let u;return typeof o=="string"?u=JSON.parse(o):u=r(o),u}i.deserializeDefault=n;function s(o){var u;let c;return!((u=o.buffers)===null||u===void 0)&&u.length?c=a(o):c=JSON.stringify(o),c}i.serializeDefault=s;function r(o){let u=new DataView(o),c=u.getUint32(0),d=[];if(c<2)throw new Error("Invalid incoming Kernel Message");for(let v=1;v<=c;v++)d.push(u.getUint32(v*4));let l=new Uint8Array(o.slice(d[0],d[1])),p=JSON.parse(new TextDecoder("utf8").decode(l));p.buffers=[];for(let v=1;v<c;v++){let _=d[v],I=d[v+1]||o.byteLength;p.buffers.push(new DataView(o.slice(_,I)))}return p}function a(o){let u=[],c=[],d=new TextEncoder,l=[];o.buffers!==void 0&&(l=o.buffers,delete o.buffers);let p=d.encode(JSON.stringify(o));c.push(p.buffer);for(let P=0;P<l.length;P++){let D=l[P];c.push(ArrayBuffer.isView(D)?D.buffer:D)}let v=c.length;u.push(4*(v+1));for(let P=0;P+1<c.length;P++)u.push(u[u.length-1]+c[P].byteLength);let _=new Uint8Array(u[u.length-1]+c[c.length-1].byteLength),I=new DataView(_.buffer);I.setUint32(0,v);for(let P=0;P<u.length;P++)I.setUint32(4*(P+1),u[P]);for(let P=0;P<c.length;P++)_.set(new Uint8Array(c[P]),u[P]);return _.buffer}})(rt||(rt={}))});var dr=E(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.default=WebSocket});var de=E(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.ServerConnection=void 0;var Be=Y(),ur=cr(),ci;typeof window=="undefined"?ci=dr():ci=WebSocket;var di;(function(i){function e(r){return sn.makeSettings(r)}i.makeSettings=e;function t(r,a,o){return sn.handleRequest(r,a,o)}i.makeRequest=t;class n extends Error{static async create(a){try{let o=await a.json(),{message:u,traceback:c}=o;return c&&console.error(c),new n(a,u!=null?u:n._defaultMessage(a),c!=null?c:"")}catch(o){return console.debug(o),new n(a)}}constructor(a,o=n._defaultMessage(a),u=""){super(o),this.response=a,this.traceback=u}static _defaultMessage(a){return`Invalid response: ${a.status} ${a.statusText}`}}i.ResponseError=n;class s extends TypeError{constructor(a){super(a.message),this.stack=a.stack}}i.NetworkError=s})(di||(rn.ServerConnection=di={}));var sn;(function(i){function e(s={}){var r;let a=Be.PageConfig.getBaseUrl(),o=Be.PageConfig.getWsUrl(),u=Be.URLExt.normalize(s.baseUrl)||a,c=s.wsUrl;!c&&u===a&&(c=o),!c&&u.indexOf("http")===0&&(c="ws"+u.slice(4)),c=c!=null?c:o;let d=Be.PageConfig.getOption("appendToken").toLowerCase(),l;return d===""?l=typeof window=="undefined"||typeof process!="undefined"&&((r=process==null?void 0:process.env)===null||r===void 0?void 0:r.JEST_WORKER_ID)!==void 0||Be.URLExt.getHostName(a)!==Be.URLExt.getHostName(c):l=d==="true",{init:{cache:"no-store",credentials:"same-origin"},fetch,Headers,Request,WebSocket:ci,token:Be.PageConfig.getToken(),appUrl:Be.PageConfig.getOption("appUrl"),appendToken:l,serializer:{serialize:ur.serialize,deserialize:ur.deserialize},...s,baseUrl:u,wsUrl:c}}i.makeSettings=e;function t(s,r,a){var o;if(s.indexOf(a.baseUrl)!==0)throw new Error("Can only be used for notebook server requests");((o=r.cache)!==null&&o!==void 0?o:a.init.cache)==="no-store"&&(s+=(/\?/.test(s)?"&":"?")+new Date().getTime());let c=new a.Request(s,{...a.init,...r}),d=!1;if(a.token&&(d=!0,c.headers.append("Authorization",`token ${a.token}`)),typeof document!="undefined"){let l=n("_xsrf");l!==void 0&&(d=!0,c.headers.append("X-XSRFToken",l))}return!c.headers.has("Content-Type")&&d&&c.headers.set("Content-Type","application/json"),a.fetch.call(null,c).catch(l=>{throw new di.NetworkError(l)})}i.handleRequest=t;function n(s){let r="";try{r=document.cookie}catch{return}let a=r.match("\\b"+s+"=([^;]*)\\b");return a==null?void 0:a[1]}})(sn||(sn={}))});var Ye=E(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.BaseManager=void 0;var pr=Z(),Pl=de(),ui=class{constructor(e){var t;this._isDisposed=!1,this._disposed=new pr.Signal(this),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Pl.ServerConnection.makeSettings()}get disposed(){return this._disposed}get isDisposed(){return this._isDisposed}get isActive(){return!0}dispose(){this.isDisposed||(this._isDisposed=!0,this._disposed.emit(void 0),pr.Signal.clearData(this))}};an.BaseManager=ui});var fr=E(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ConfigWithDefaults=Ve.ConfigSection=Ve.ConfigSectionManager=void 0;var Ml=Y(),at=Ne(),El="api/config",pi=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:at.ServerConnection.makeSettings()}async create(e){let t=new on({...e,serverSettings:this.serverSettings});return await t.load(),t}};Ve.ConfigSectionManager=pi;var hr;(function(i){async function e(s){if(!t){let a=new on(s);return await a.load(),a}return await t.create(s)}i.create=e;let t;function n(s){if(t)throw new Error("ConfigSectionManager already set. If you would like to create a config section, use the `IConfigSectionManager` token in a plugin.");t=s}i._setConfigSectionManager=n})(hr||(Ve.ConfigSection=hr={}));var on=class{constructor(e){var t;this._url="unknown";let n=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:at.ServerConnection.makeSettings();this._url=Ml.URLExt.join(n.baseUrl,El,encodeURIComponent(e.name))}get data(){return this._data}async load(){let e=await at.ServerConnection.makeRequest(this._url,{},this.serverSettings);if(e.status!==200)throw await at.ServerConnection.ResponseError.create(e);this._data=await e.json()}async update(e){this._data={...this._data,...e};let t={method:"PATCH",body:JSON.stringify(e)},n=await at.ServerConnection.makeRequest(this._url,t,this.serverSettings);if(n.status!==200)throw await at.ServerConnection.ResponseError.create(n);return this._data=await n.json(),this._data}},hi=class{constructor(e){var t,n;this._className="",this._section=e.section,this._defaults=(t=e.defaults)!==null&&t!==void 0?t:{},this._className=(n=e.className)!==null&&n!==void 0?n:""}get(e){let t=this._classData();return e in t?t[e]:this._defaults[e]}set(e,t){let n={};if(n[e]=t,this._className){let s={};return s[this._className]=n,this._section.update(s)}else return this._section.update(n)}_classData(){let e=this._section.data;return this._className&&this._className in e?e[this._className]:e}};Ve.ConfigWithDefaults=hi});var mr=E(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.ConnectionStatus=void 0;var fi=class{constructor(){this.isConnected=!0}};ln.ConnectionStatus=fi});var dn=E((cn,gr)=>{(function(i,e){typeof cn=="object"&&typeof gr!="undefined"?e(cn,Z()):typeof define=="function"&&define.amd?define(["exports","@lumino/signaling"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_disposable={},i.lumino_signaling))})(cn,function(i,e){"use strict";class t{constructor(o){this._fn=o}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let o=this._fn;this._fn=null,o()}}class n extends t{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}}class s{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(o=>{o.dispose()}),this._items.clear())}contains(o){return this._items.has(o)}add(o){this._items.add(o)}remove(o){this._items.delete(o)}clear(){this._items.clear()}}(function(a){function o(u){let c=new a;for(let d of u)c.add(d);return c}a.from=o})(s||(s={}));class r extends s{constructor(){super(...arguments),this._disposed=new e.Signal(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),e.Signal.clearData(this))}}(function(a){function o(u){let c=new a;for(let d of u)c.add(d);return c}a.from=o})(r||(r={})),i.DisposableDelegate=t,i.DisposableSet=s,i.ObservableDisposableDelegate=n,i.ObservableDisposableSet=r})});var ht=E(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.validateProperty=Il;function Il(i,e,t,n=[]){if(!i.hasOwnProperty(e))throw Error(`Missing property '${e}'`);let s=i[e];if(t!==void 0){let r=!0;switch(t){case"array":r=Array.isArray(s);break;case"object":r=typeof s!="undefined";break;default:r=typeof s===t}if(!r)throw new Error(`Property '${e}' is not of type '${t}'`);if(n.length>0){let a=!0;switch(t){case"string":case"number":case"boolean":a=n.includes(s);break;default:a=n.findIndex(o=>o===s)>=0;break}if(!a)throw new Error(`Property '${e}' is not one of the valid values ${JSON.stringify(n)}`)}}}});var _r=E(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.validateContentsModel=Rl;un.validateCheckpointModel=Ol;var De=ht();function Rl(i){(0,De.validateProperty)(i,"name","string"),(0,De.validateProperty)(i,"path","string"),(0,De.validateProperty)(i,"type","string"),(0,De.validateProperty)(i,"created","string"),(0,De.validateProperty)(i,"last_modified","string"),(0,De.validateProperty)(i,"mimetype","object"),(0,De.validateProperty)(i,"content","object"),(0,De.validateProperty)(i,"format","object")}function Ol(i){(0,De.validateProperty)(i,"id","string"),(0,De.validateProperty)(i,"last_modified","string")}});var yi=E(oe=>{"use strict";var Dl=oe&&oe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),jl=oe&&oe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Tl=oe&&oe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Dl(e,i,t);return jl(e,i),e};Object.defineProperty(oe,"__esModule",{value:!0});oe.RestContentProvider=oe.Drive=oe.ContentsManager=oe.Contents=void 0;var ue=Y(),ql=dn(),ft=Z(),$=Ne(),ze=Tl(_r()),Al="api/contents",Ul="files",vr;(function(i){function e(n){ze.validateContentsModel(n)}i.validateContentsModel=e;function t(n){ze.validateCheckpointModel(n)}i.validateCheckpointModel=t})(vr||(oe.Contents=vr={}));var gi=class{constructor(e={}){var t,n;this._isDisposed=!1,this._additionalDrives=new Map,this._fileChanged=new ft.Signal(this);let s=this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:$.ServerConnection.makeSettings();this._defaultDrive=(n=e.defaultDrive)!==null&&n!==void 0?n:new pn({serverSettings:s}),this._defaultDrive.fileChanged.connect(this._onFileChanged,this)}get defaultDrive(){return this._defaultDrive}get fileChanged(){return this._fileChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,ft.Signal.clearData(this))}addDrive(e){this._additionalDrives.set(e.name,e),e.fileChanged.connect(this._onFileChanged,this)}getSharedModelFactory(e,t){var n,s;let[r]=this._driveForPath(e),a=(n=r.contentProviderRegistry)===null||n===void 0?void 0:n.getProvider(t==null?void 0:t.contentProviderId);return a!=null&&a.sharedModelFactory?a.sharedModelFactory:(s=r.sharedModelFactory)!==null&&s!==void 0?s:null}localPath(e){let t=e.split("/"),n=t[0].split(":");return n.length===1||!this._additionalDrives.has(n[0])?ue.PathExt.removeSlash(e):ue.PathExt.join(n.slice(1).join(":"),...t.slice(1))}normalize(e){let t=e.split(":");return t.length===1?ue.PathExt.normalize(e):`${t[0]}:${ue.PathExt.normalize(t.slice(1).join(":"))}`}resolvePath(e,t){let n=this.driveName(e),s=this.localPath(e),r=ue.PathExt.resolve("/",s,t);return n?`${n}:${r}`:r}driveName(e){let n=e.split("/")[0].split(":");return n.length===1?"":this._additionalDrives.has(n[0])?n[0]:""}get(e,t){let[n,s]=this._driveForPath(e);return n.get(s,t).then(r=>{let a=[];if(r.type==="directory"&&r.content){for(let o of r.content)a.push({...o,path:this._toGlobalPath(n,o.path)});return{...r,path:this._toGlobalPath(n,s),content:a,serverPath:r.path}}else return{...r,path:this._toGlobalPath(n,s),serverPath:r.path}})}getDownloadUrl(e){let[t,n]=this._driveForPath(e);return t.getDownloadUrl(n)}newUntitled(e={}){if(e.path){let t=this.normalize(e.path),[n,s]=this._driveForPath(t);return n.newUntitled({...e,path:s}).then(r=>({...r,path:ue.PathExt.join(t,r.name),serverPath:r.path}))}else return this._defaultDrive.newUntitled(e)}delete(e){let[t,n]=this._driveForPath(e);return t.delete(n)}rename(e,t){let[n,s]=this._driveForPath(e),[r,a]=this._driveForPath(t);if(n!==r)throw Error("ContentsManager: renaming files must occur within a Drive");return n.rename(s,a).then(o=>({...o,path:this._toGlobalPath(n,a),serverPath:o.path}))}save(e,t={}){let n=this.normalize(e),[s,r]=this._driveForPath(e);return s.save(r,{...t,path:r}).then(a=>({...a,path:n,serverPath:a.path}))}copy(e,t){let[n,s]=this._driveForPath(e),[r,a]=this._driveForPath(t);if(n===r)return n.copy(s,a).then(o=>({...o,path:this._toGlobalPath(n,o.path),serverPath:o.path}));throw Error("Copying files between drives is not currently implemented")}createCheckpoint(e){let[t,n]=this._driveForPath(e);return t.createCheckpoint(n)}listCheckpoints(e){let[t,n]=this._driveForPath(e);return t.listCheckpoints(n)}restoreCheckpoint(e,t){let[n,s]=this._driveForPath(e);return n.restoreCheckpoint(s,t)}deleteCheckpoint(e,t){let[n,s]=this._driveForPath(e);return n.deleteCheckpoint(s,t)}_toGlobalPath(e,t){return e===this._defaultDrive?ue.PathExt.removeSlash(t):`${e.name}:${ue.PathExt.removeSlash(t)}`}_driveForPath(e){let t=this.driveName(e),n=this.localPath(e);return t?[this._additionalDrives.get(t),n]:[this._defaultDrive,n]}_onFileChanged(e,t){var n,s;if(e===this._defaultDrive)this._fileChanged.emit(t);else{let r=null,a=null;!((n=t.newValue)===null||n===void 0)&&n.path&&(r={...t.newValue,path:this._toGlobalPath(e,t.newValue.path)}),!((s=t.oldValue)===null||s===void 0)&&s.path&&(a={...t.oldValue,path:this._toGlobalPath(e,t.oldValue.path)}),this._fileChanged.emit({type:t.type,newValue:r,oldValue:a})}}};oe.ContentsManager=gi;var pn=class{constructor(e={}){var t,n,s;this._isDisposed=!1,this._fileChanged=new ft.Signal(this),this.name=(t=e.name)!==null&&t!==void 0?t:"Default",this._apiEndpoint=(n=e.apiEndpoint)!==null&&n!==void 0?n:Al,this.serverSettings=(s=e.serverSettings)!==null&&s!==void 0?s:$.ServerConnection.makeSettings();let r=new hn({apiEndpoint:this._apiEndpoint,serverSettings:this.serverSettings});this.contentProviderRegistry=new vi({defaultProvider:r}),this.contentProviderRegistry.fileChanged.connect((a,o)=>{this._fileChanged.emit(o)})}get fileChanged(){return this._fileChanged}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,ft.Signal.clearData(this))}async get(e,t){return this.contentProviderRegistry.getProvider(t==null?void 0:t.contentProviderId).get(e,t)}getDownloadUrl(e){let t=this.serverSettings.baseUrl,n=ue.URLExt.join(t,Ul,ue.URLExt.encodeParts(e)),s="";try{s=document.cookie}catch{}let r=s.match("\\b_xsrf=([^;]*)\\b");if(r){let a=new URL(n);a.searchParams.append("_xsrf",r[1]),n=a.toString()}return Promise.resolve(n)}async newUntitled(e={}){var t;let n="{}";e&&(e.ext&&(e.ext=_i.normalizeExtension(e.ext)),n=JSON.stringify(e));let s=this.serverSettings,r=this._getUrl((t=e.path)!==null&&t!==void 0?t:""),a={method:"POST",body:n},o=await $.ServerConnection.makeRequest(r,a,s);if(o.status!==201)throw await $.ServerConnection.ResponseError.create(o);let u=await o.json();return ze.validateContentsModel(u),this._fileChanged.emit({type:"new",oldValue:null,newValue:u}),u}async delete(e){let t=this._getUrl(e),n=this.serverSettings,s={method:"DELETE"},r=await $.ServerConnection.makeRequest(t,s,n);if(r.status!==204)throw await $.ServerConnection.ResponseError.create(r);this._fileChanged.emit({type:"delete",oldValue:{path:e},newValue:null})}async rename(e,t){let n=this.serverSettings,s=this._getUrl(e),r={method:"PATCH",body:JSON.stringify({path:t})},a=await $.ServerConnection.makeRequest(s,r,n);if(a.status!==200)throw await $.ServerConnection.ResponseError.create(a);let o=await a.json();return ze.validateContentsModel(o),this._fileChanged.emit({type:"rename",oldValue:{path:e},newValue:o}),o}async save(e,t={}){let s=await this.contentProviderRegistry.getProvider(t==null?void 0:t.contentProviderId).save(e,t);return this._fileChanged.emit({type:"save",oldValue:null,newValue:s}),s}async copy(e,t){let n=this.serverSettings,s=this._getUrl(t),r={method:"POST",body:JSON.stringify({copy_from:e})},a=await $.ServerConnection.makeRequest(s,r,n);if(a.status!==201)throw await $.ServerConnection.ResponseError.create(a);let o=await a.json();return ze.validateContentsModel(o),this._fileChanged.emit({type:"new",oldValue:null,newValue:o}),o}async createCheckpoint(e){let t=this._getUrl(e,"checkpoints"),n={method:"POST"},s=await $.ServerConnection.makeRequest(t,n,this.serverSettings);if(s.status!==201)throw await $.ServerConnection.ResponseError.create(s);let r=await s.json();return ze.validateCheckpointModel(r),r}async listCheckpoints(e){let t=this._getUrl(e,"checkpoints"),n=await $.ServerConnection.makeRequest(t,{},this.serverSettings);if(n.status!==200)throw await $.ServerConnection.ResponseError.create(n);let s=await n.json();if(!Array.isArray(s))throw new Error("Invalid Checkpoint list");for(let r=0;r<s.length;r++)ze.validateCheckpointModel(s[r]);return s}async restoreCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"POST"},r=await $.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await $.ServerConnection.ResponseError.create(r)}async deleteCheckpoint(e,t){let n=this._getUrl(e,"checkpoints",t),s={method:"DELETE"},r=await $.ServerConnection.makeRequest(n,s,this.serverSettings);if(r.status!==204)throw await $.ServerConnection.ResponseError.create(r)}_getUrl(...e){let t=e.map(s=>ue.URLExt.encodeParts(s)),n=this.serverSettings.baseUrl;return ue.URLExt.join(n,this._apiEndpoint,...t)}};oe.Drive=pn;var _i;(function(i){function e(t){return t.length>0&&t.indexOf(".")!==0&&(t=`.${t}`),t}i.normalizeExtension=e})(_i||(_i={}));var vi=class{constructor(e){this._providers=new Map,this._fileChanged=new ft.Signal(this),this.register("default",e.defaultProvider),this._defaultProvider=e.defaultProvider}register(e,t){if(this._providers.has(e))throw Error(`Provider with ${e} identifier was already registered on this drive`);this._providers.set(e,t);let n=(s,r)=>{this._fileChanged.emit(r)};return t.fileChanged&&t.fileChanged.connect(n),new ql.DisposableDelegate(()=>{t.fileChanged&&t.fileChanged.disconnect(n),this._providers.has(e)&&this._providers.delete(e)})}getProvider(e){if(!e)return this._defaultProvider;let t=this._providers.get(e);if(!t)throw Error(`Provider ${e} is not registered`);return t}get fileChanged(){return this._fileChanged}},hn=class{constructor(e){this._options=e}async get(e,t){let n=this._getUrl(e);if(t){t.type==="notebook"&&delete t.format;let o=t.content?"1":"0",u=t.hash?"1":"0",c={...t,content:o,hash:u};n+=ue.URLExt.objectToQueryString(c)}let s=this._options.serverSettings,r=await $.ServerConnection.makeRequest(n,{},s);if(r.status!==200)throw await $.ServerConnection.ResponseError.create(r);let a=await r.json();return ze.validateContentsModel(a),a}async save(e,t={}){let n=this._options.serverSettings,s=this._getUrl(e),r={method:"PUT",body:JSON.stringify(t)},a=await $.ServerConnection.makeRequest(s,r,n);if(a.status!==200&&a.status!==201)throw await $.ServerConnection.ResponseError.create(a);let o=await a.json();return ze.validateContentsModel(o),o}_getUrl(...e){let t=e.map(s=>ue.URLExt.encodeParts(s)),n=this._options.serverSettings.baseUrl;return ue.URLExt.join(n,this._options.apiEndpoint,...t)}};oe.RestContentProvider=hn});var Xe=E((fn,yr)=>{(function(i,e){typeof fn=="object"&&typeof yr!="undefined"?e(fn,te(),Z()):typeof define=="function"&&define.amd?define(["exports","@lumino/coreutils","@lumino/signaling"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_polling={},i.lumino_coreutils,i.lumino_signaling))})(fn,function(i,e,t){"use strict";class n{constructor(c){var d;this._disposed=new t.Signal(this),this._lingered=0,this._tick=new e.PromiseDelegate,this._ticked=new t.Signal(this),this._factory=c.factory,this._linger=(d=c.linger)!==null&&d!==void 0?d:s.DEFAULT_LINGER,this._standby=c.standby||s.DEFAULT_STANDBY,this._state={...s.DEFAULT_STATE,timestamp:new Date().getTime()};let l=c.frequency||{},p=Math.max(l.interval||0,l.max||0,s.DEFAULT_FREQUENCY.max);this.frequency={...s.DEFAULT_FREQUENCY,...l,max:p},this.name=c.name||s.DEFAULT_NAME,(!("auto"in c)||c.auto)&&setTimeout(()=>this.start())}get disposed(){return this._disposed}get frequency(){return this._frequency}set frequency(c){if(this.isDisposed||e.JSONExt.deepEqual(c,this.frequency||{}))return;let{backoff:d,interval:l,max:p}=c;if(l=Math.round(l),p=Math.round(p),typeof d=="number"&&d<1)throw new Error("Poll backoff growth factor must be at least 1");if((l<0||l>p)&&l!==n.NEVER)throw new Error("Poll interval must be between 0 and max");if(p>n.MAX_INTERVAL&&p!==n.NEVER)throw new Error(`Max interval must be less than ${n.MAX_INTERVAL}`);this._frequency={backoff:d,interval:l,max:p}}get isDisposed(){return this.state.phase==="disposed"}get standby(){return this._standby}set standby(c){this.isDisposed||this.standby===c||(this._standby=c)}get state(){return this._state}get tick(){return this._tick.promise}get ticked(){return this._ticked}async*[Symbol.asyncIterator](){for(;!this.isDisposed;)yield this.state,await this.tick.catch(()=>{})}dispose(){this.isDisposed||(this._state={...s.DISPOSED_STATE,timestamp:new Date().getTime()},this._tick.promise.catch(c=>{}),this._tick.reject(new Error(`Poll (${this.name}) is disposed.`)),this._disposed.emit(void 0),t.Signal.clearData(this))}refresh(){return this.schedule({cancel:({phase:c})=>c==="refreshed",interval:n.IMMEDIATE,phase:"refreshed"})}async schedule(c={}){if(this.isDisposed||c.cancel&&c.cancel(this.state))return;let d=this._tick,l=new e.PromiseDelegate,p={interval:this.frequency.interval,payload:null,phase:"standby",timestamp:new Date().getTime(),...c};if(this._state=p,this._tick=l,clearTimeout(this._timeout),this._ticked.emit(this.state),d.resolve(this),await d.promise,p.interval===n.NEVER){this._timeout=void 0;return}let v=()=>{this.isDisposed||this.tick!==l.promise||this._execute()};this._timeout=setTimeout(v,p.interval)}start(){return this.schedule({cancel:({phase:c})=>c!=="constructed"&&c!=="standby"&&c!=="stopped",interval:n.IMMEDIATE,phase:"started"})}stop(){return this.schedule({cancel:({phase:c})=>c==="stopped",interval:n.NEVER,phase:"stopped"})}get hidden(){return s.hidden}_execute(){let c=typeof this.standby=="function"?this.standby():this.standby;if(c==="never"?c=!1:c==="when-hidden"&&(this.hidden?c=++this._lingered>this._linger:(this._lingered=0,c=!1)),c){this.schedule();return}let d=this.tick;this._factory(this.state).then(l=>{this.isDisposed||this.tick!==d||this.schedule({payload:l,phase:this.state.phase==="rejected"?"reconnected":"resolved"})}).catch(l=>{this.isDisposed||this.tick!==d||this.schedule({interval:s.sleep(this.frequency,this.state),payload:l,phase:"rejected"})})}}(function(u){u.IMMEDIATE=0,u.MAX_INTERVAL=2147483647,u.NEVER=1/0})(n||(n={}));var s;(function(u){u.DEFAULT_BACKOFF=3,u.DEFAULT_FREQUENCY={backoff:!0,interval:1e3,max:30*1e3},u.DEFAULT_LINGER=1,u.DEFAULT_NAME="unknown",u.DEFAULT_STANDBY="when-hidden",u.DEFAULT_STATE={interval:n.NEVER,payload:null,phase:"constructed",timestamp:new Date(0).getTime()},u.DISPOSED_STATE={interval:n.NEVER,payload:null,phase:"disposed",timestamp:new Date(0).getTime()};function c(l,p){let{backoff:v,interval:_,max:I}=l;if(_===n.NEVER)return _;let P=v===!0?u.DEFAULT_BACKOFF:v===!1?1:v,D=d(_,p.interval*P);return Math.min(I,D)}u.sleep=c,u.hidden=typeof document=="undefined"?!1:(document.addEventListener("visibilitychange",()=>{u.hidden=document.visibilityState==="hidden"}),document.addEventListener("pagehide",()=>{u.hidden=document.visibilityState==="hidden"}),document.visibilityState==="hidden");function d(l,p){return l=Math.ceil(l),p=Math.floor(p),Math.floor(Math.random()*(p-l+1))+l}})(s||(s={}));class r{constructor(c,d=500){this.args=void 0,this.payload=null,this.limit=d,this.poll=new n({auto:!1,factory:async()=>{let{args:l}=this;return this.args=void 0,c(...l)},frequency:{backoff:!1,interval:n.NEVER,max:n.NEVER},standby:"never"}),this.payload=new e.PromiseDelegate,this.poll.ticked.connect((l,p)=>{let{payload:v}=this;if(p.phase==="resolved"){this.payload=new e.PromiseDelegate,v.resolve(p.payload);return}if(p.phase==="rejected"||p.phase==="stopped"){this.payload=new e.PromiseDelegate,v.promise.catch(_=>{}),v.reject(p.payload);return}},this)}get isDisposed(){return this.payload===null}dispose(){this.isDisposed||(this.args=void 0,this.payload=null,this.poll.dispose())}async stop(){return this.poll.stop()}}class a extends r{invoke(...c){return this.args=c,this.poll.schedule({interval:this.limit,phase:"invoked"}),this.payload.promise}}class o extends r{constructor(c,d){super(c,typeof d=="number"?d:d&&d.limit),this._trailing=!1,typeof d!="number"&&d&&d.edge==="trailing"&&(this._trailing=!0),this._interval=this._trailing?this.limit:n.IMMEDIATE}invoke(...c){let d=this.poll.state.phase!=="invoked";return(d||this._trailing)&&(this.args=c),d&&this.poll.schedule({interval:this._interval,phase:"invoked"}),this.payload.promise}}i.Debouncer=a,i.Poll=n,i.RateLimiter=r,i.Throttler=o})});var bi=E(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.EventManager=void 0;var wr=Y(),Nl=Xe(),br=Z(),Sr=de(),xr="api/events",wi=class{constructor(e={}){var t;this._socket=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Sr.ServerConnection.makeSettings(),this._poll=new Nl.Poll({factory:()=>this._subscribe()}),this._stream=new br.Stream(this),this._poll.start()}get isDisposed(){return this._poll.isDisposed}get stream(){return this._stream}dispose(){if(this.isDisposed)return;this._poll.dispose();let e=this._socket;e&&(this._socket=null,e.onopen=()=>{},e.onerror=()=>{},e.onmessage=()=>{},e.onclose=()=>{},e.close()),br.Signal.clearData(this),this._stream.stop()}async emit(e){let{serverSettings:t}=this,{baseUrl:n}=t,{makeRequest:s,ResponseError:r}=Sr.ServerConnection,a=wr.URLExt.join(n,xr),o={body:JSON.stringify(e),method:"POST"},u=await s(a,o,t);if(u.status!==204)throw new r(u)}_subscribe(){return new Promise((e,t)=>{if(this.isDisposed)return;let{appendToken:n,token:s,WebSocket:r,wsUrl:a}=this.serverSettings,o=wr.URLExt.join(a,xr,"subscribe");n&&s!==""&&(o+=`?token=${encodeURIComponent(s)}`);let u=this._socket=new r(o),c=this._stream;u.onclose=()=>t(new Error("EventManager socket closed")),u.onmessage=d=>d.data&&c.emit(JSON.parse(d.data))})}};mn.EventManager=wi});var Si=E(be=>{"use strict";var zl=be&&be.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Ll=be&&be.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Fl=be&&be.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&zl(e,i,t);return Ll(e,i),e};Object.defineProperty(be,"__esModule",{value:!0});be.CommHandler=be.CommsOverSubshells=void 0;var Kl=te(),Bl=dn(),gn=Fl(st()),ot;(function(i){i.Disabled="disabled",i.PerComm="perComm",i.PerCommTarget="perCommTarget"})(ot||(be.CommsOverSubshells=ot={}));var _n=class i extends Bl.DisposableDelegate{constructor(e,t,n,s,r){super(s),this._subshellStarted=new Kl.PromiseDelegate,this._subshellId=null,this._target="",this._id="",this._id=t,this._target=e,this._kernel=n,this._kernel.statusChanged.connect(()=>{this._kernel.status==="restarting"&&this._cleanSubshells()}),this.commsOverSubshells=r!=null?r:ot.PerCommTarget}get commId(){return this._id}get targetName(){return this._target}get subshellId(){return this._subshellId}get subshellStarted(){return this._subshellStarted.promise}get commsOverSubshells(){return this._commsOverSubshells}set commsOverSubshells(e){this._commsOverSubshells=e,this._commsOverSubshells===ot.Disabled?this._maybeCloseSubshell():this._maybeStartSubshell()}get onClose(){return this._onClose}set onClose(e){this._onClose=e}get onMsg(){return this._onMsg}set onMsg(e){this._onMsg=e}open(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot open");let s=gn.createMessage({msgType:"comm_open",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,target_name:this._target,data:e!=null?e:{}},metadata:t,buffers:n});return this._kernel.sendShellMessage(s,!1,!0)}send(e,t,n=[],s=!0){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot send");let r=gn.createMessage({msgType:"comm_msg",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,data:e},metadata:t,buffers:n});return this._kernel.sendShellMessage(r,!1,s)}close(e,t,n=[]){if(this.isDisposed||this._kernel.isDisposed)throw new Error("Cannot close");let s=gn.createMessage({msgType:"comm_close",channel:"shell",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,data:e!=null?e:{}},metadata:t,buffers:n}),r=this._kernel.sendShellMessage(s,!1,!0),a=this._onClose;if(a){let o=gn.createMessage({msgType:"comm_close",channel:"iopub",username:this._kernel.username,session:this._kernel.clientId,subshellId:this._subshellId||this._kernel.subshellId,content:{comm_id:this._id,data:e!=null?e:{}},metadata:t,buffers:n});a(o)}return this.dispose(),r}dispose(){this._maybeCloseSubshell(),super.dispose()}_cleanSubshells(){i._commTargetSubShellsId={}}async _maybeStartSubshell(){if(await this._kernel.info,!!this._kernel.supportsSubshells){if(this._commsOverSubshells===ot.PerComm){let e=await this._kernel.requestCreateSubshell({}).done;this._subshellId=e.content.subshell_id,this._subshellStarted.resolve();return}i._commTargetSubShellsId[this._target]?(this._subshellId=await i._commTargetSubShellsId[this._target],this._subshellStarted.resolve()):(i._commTargetSubShellsId[this._target]=this._kernel.requestCreateSubshell({}).done.then(e=>(this._subshellId=e.content.subshell_id,this._subshellId)),await i._commTargetSubShellsId[this._target],this._subshellStarted.resolve())}}_maybeCloseSubshell(){if(this._commsOverSubshells!==ot.PerComm){this._subshellId=null;return}this._subshellId&&this._kernel.status!=="dead"&&this._kernel.requestDeleteSubshell({subshell_id:this._subshellId},!0),this._subshellId=null}};be.CommHandler=_n;_n._commTargetSubShellsId={}});var kr=E(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0})});var vn=E(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.validateMessage=Wl;mt.validateModel=Mr;mt.validateModels=Hl;var Ze=ht(),Pr=["username","version","session","msg_id","msg_type"],Vl={stream:{name:"string",text:"string"},display_data:{data:"object",metadata:"object"},execute_input:{code:"string",execution_count:"number"},execute_result:{execution_count:"number",data:"object",metadata:"object"},error:{ename:"string",evalue:"string",traceback:"object"},status:{execution_state:["string",["starting","idle","busy","restarting","dead"]]},clear_output:{wait:"boolean"},comm_open:{comm_id:"string",target_name:"string",data:"object"},comm_msg:{comm_id:"string",data:"object"},comm_close:{comm_id:"string"},shutdown_reply:{restart:"boolean"}};function $l(i){for(let e=0;e<Pr.length;e++)(0,Ze.validateProperty)(i,Pr[e],"string")}function Wl(i){(0,Ze.validateProperty)(i,"metadata","object"),(0,Ze.validateProperty)(i,"content","object"),(0,Ze.validateProperty)(i,"channel","string"),$l(i.header),i.channel==="iopub"&&Jl(i)}function Jl(i){if(i.channel==="iopub"){let e=Vl[i.header.msg_type];if(e===void 0)return;let t=Object.keys(e),n=i.content;for(let s=0;s<t.length;s++){let r=e[t[s]];Array.isArray(r)||(r=[r]),(0,Ze.validateProperty)(n,t[s],...r)}}}function Mr(i){(0,Ze.validateProperty)(i,"name","string"),(0,Ze.validateProperty)(i,"id","string")}function Hl(i){if(!Array.isArray(i))throw new Error("Invalid kernel list");i.forEach(e=>Mr(e))}});var wn=E(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.KernelAPIClient=ne.KERNEL_SERVICE_URL=void 0;ne.listRunning=Er;ne.startNew=Ir;ne.restartKernel=Rr;ne.interruptKernel=Or;ne.shutdownKernel=Dr;ne.getKernelModel=jr;var Q=de(),lt=Y(),yn=vn();ne.KERNEL_SERVICE_URL="api/kernels";async function Er(i=Q.ServerConnection.makeSettings()){let e=lt.URLExt.join(i.baseUrl,ne.KERNEL_SERVICE_URL),t=await Q.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Q.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,yn.validateModels)(n),n}async function Ir(i={},e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await Q.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,yn.validateModel)(r),r}async function Rr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i),"restart"),n={method:"POST"},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await Q.ServerConnection.ResponseError.create(s);let r=await s.json();(0,yn.validateModel)(r)}async function Or(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i),"interrupt"),n={method:"POST"},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status!==204)throw await Q.ServerConnection.ResponseError.create(s)}async function Dr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i)),n={method:"DELETE"},s=await Q.ServerConnection.makeRequest(t,n,e);if(s.status===404){let r=`The kernel "${i}" does not exist on the server`;console.warn(r)}else if(s.status!==204)throw await Q.ServerConnection.ResponseError.create(s)}async function jr(i,e=Q.ServerConnection.makeSettings()){let t=lt.URLExt.join(e.baseUrl,ne.KERNEL_SERVICE_URL,encodeURIComponent(i)),n=await Q.ServerConnection.makeRequest(t,{},e);if(n.status===404)return;if(n.status!==200)throw await Q.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,yn.validateModel)(s),s}var xi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Q.ServerConnection.makeSettings()}async listRunning(){return Er(this.serverSettings)}async getModel(e){return jr(e,this.serverSettings)}async startNew(e={}){return Ir(e,this.serverSettings)}async restart(e){return Rr(e,this.serverSettings)}async interrupt(e){return Or(e,this.serverSettings)}async shutdown(e){return Dr(e,this.serverSettings)}};ne.KernelAPIClient=xi});var qr=E(_e=>{"use strict";var Gl=_e&&_e.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Yl=_e&&_e.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Xl=_e&&_e.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Gl(e,i,t);return Yl(e,i),e};Object.defineProperty(_e,"__esModule",{value:!0});_e.KernelShellFutureHandler=_e.KernelControlFutureHandler=_e.KernelFutureHandler=void 0;var Tr=te(),Zl=dn(),Ql=Xl(st()),gt=class extends Zl.DisposableDelegate{constructor(e,t,n,s,r){super(e),this._status=0,this._stdin=ie.noOp,this._iopub=ie.noOp,this._reply=ie.noOp,this._done=new Tr.PromiseDelegate,this._hooks=new ie.HookList,this._disposeOnDone=!0,this._msg=t,n||this._setFlag(ie.KernelFutureFlag.GotReply),this._disposeOnDone=s,this._kernel=r}get msg(){return this._msg}get done(){return this._done.promise}get onReply(){return this._reply}set onReply(e){this._reply=e}get onIOPub(){return this._iopub}set onIOPub(e){this._iopub=e}get onStdin(){return this._stdin}set onStdin(e){this._stdin=e}registerMessageHook(e){if(this.isDisposed)throw new Error("Kernel future is disposed");this._hooks.add(e)}removeMessageHook(e){this.isDisposed||this._hooks.remove(e)}sendInputReply(e,t){this._kernel.sendInputReply(e,t)}dispose(){this._stdin=ie.noOp,this._iopub=ie.noOp,this._reply=ie.noOp,this._hooks=null,this._testFlag(ie.KernelFutureFlag.IsDone)||(this._done.promise.catch(()=>{}),this._done.reject(new Error(`Canceled future for ${this.msg.header.msg_type} message before replies were done`))),super.dispose()}async handleMsg(e){switch(e.channel){case"control":case"shell":e.channel===this.msg.channel&&e.parent_header.msg_id===this.msg.header.msg_id&&await this._handleReply(e);break;case"stdin":await this._handleStdin(e);break;case"iopub":await this._handleIOPub(e);break;default:break}}async _handleReply(e){let t=this._reply;t&&await t(e),this._replyMsg=e,this._setFlag(ie.KernelFutureFlag.GotReply),this._testFlag(ie.KernelFutureFlag.GotIdle)&&this._handleDone()}async _handleStdin(e){this._kernel.hasPendingInput=!0;let t=this._stdin;t&&await t(e)}async _handleIOPub(e){let t=await this._hooks.process(e),n=this._iopub;t&&n&&await n(e),Ql.isStatusMsg(e)&&e.content.execution_state==="idle"&&(this._setFlag(ie.KernelFutureFlag.GotIdle),this._testFlag(ie.KernelFutureFlag.GotReply)&&this._handleDone())}_handleDone(){this._testFlag(ie.KernelFutureFlag.IsDone)||(this._setFlag(ie.KernelFutureFlag.IsDone),this._done.resolve(this._replyMsg),this._disposeOnDone&&this.dispose())}_testFlag(e){return(this._status&e)!==0}_setFlag(e){this._status|=e}};_e.KernelFutureHandler=gt;var Ci=class extends gt{};_e.KernelControlFutureHandler=Ci;var ki=class extends gt{};_e.KernelShellFutureHandler=ki;var ie;(function(i){i.noOp=()=>{};let e=typeof requestAnimationFrame=="function"?requestAnimationFrame:setImmediate;class t{constructor(){this._hooks=[]}add(r){this.remove(r),this._hooks.push(r)}remove(r){let a=this._hooks.indexOf(r);a>=0&&(this._hooks[a]=null,this._scheduleCompact())}async process(r){await this._processing;let a=new Tr.PromiseDelegate;this._processing=a.promise;let o;for(let u=this._hooks.length-1;u>=0;u--){let c=this._hooks[u];if(c!==null){try{o=await c(r)}catch(d){o=!0,console.error(d)}if(o===!1)return a.resolve(void 0),!1}}return a.resolve(void 0),!0}_scheduleCompact(){this._compactScheduled||(this._compactScheduled=!0,e(()=>{this._processing=this._processing.then(()=>{this._compactScheduled=!1,this._compact()})}))}_compact(){let r=0;for(let a=0,o=this._hooks.length;a<o;a++){let u=this._hooks[a];this._hooks[a]===null?r++:this._hooks[a-r]=u}this._hooks.length-=r}}i.HookList=t;let n;(function(s){s[s.GotReply=1]="GotReply",s[s.GotIdle=2]="GotIdle",s[s.IsDone=4]="IsDone",s[s.DisposeOnDone=8]="DisposeOnDone"})(n=i.KernelFutureFlag||(i.KernelFutureFlag={}))})(ie||(ie={}))});var Ur=E(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.validateSpecModel=Ar;bn.validateSpecModels=ec;var Qe=ht();function Ar(i){let e=i.spec;if(!e)throw new Error("Invalid kernel spec");(0,Qe.validateProperty)(i,"name","string"),(0,Qe.validateProperty)(i,"resources","object"),(0,Qe.validateProperty)(e,"language","string"),(0,Qe.validateProperty)(e,"display_name","string"),(0,Qe.validateProperty)(e,"argv","array");let t=null;e.hasOwnProperty("metadata")&&((0,Qe.validateProperty)(e,"metadata","object"),t=e.metadata);let n=null;return e.hasOwnProperty("env")&&((0,Qe.validateProperty)(e,"env","object"),n=e.env),{name:i.name,resources:i.resources,language:e.language,display_name:e.display_name,argv:e.argv,metadata:t,env:n}}function ec(i){if(!i.hasOwnProperty("kernelspecs"))throw new Error("No kernelspecs found");let e=Object.keys(i.kernelspecs),t=Object.create(null),n=i.default;for(let s=0;s<e.length;s++){let r=i.kernelspecs[e[s]];try{t[e[s]]=Ar(r)}catch{console.warn(`Removing errant kernel spec: ${e[s]}`)}}if(e=Object.keys(t),!e.length)throw new Error("No valid kernelspecs found");return(!n||typeof n!="string"||!(n in t))&&(n=e[0],console.warn(`Default kernel not found, using '${e[0]}'`)),{default:n,kernelspecs:t}}});var vt=E(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.KernelSpecAPIClient=void 0;_t.getSpecs=Nr;var Sn=de(),tc=Ur(),nc=Y(),ic="api/kernelspecs";async function Nr(i=Sn.ServerConnection.makeSettings()){let e=nc.URLExt.join(i.baseUrl,ic),t=await Sn.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Sn.ServerConnection.ResponseError.create(t);let n=await t.json();return(0,tc.validateSpecModels)(n)}var Pi=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Sn.ServerConnection.makeSettings()}async get(){return Nr(this.serverSettings)}};_t.KernelSpecAPIClient=Pi});var Ei=E(je=>{"use strict";var sc=je&&je.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),rc=je&&je.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Br=je&&je.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&sc(e,i,t);return rc(e,i),e};Object.defineProperty(je,"__esModule",{value:!0});je.KernelConnection=void 0;var zr=Y(),$e=te(),We=Z(),yt=Ne(),Lr=Si(),se=Br(st()),Fr=qr(),ac=Br(vn()),Kr=wn(),oc=vt(),lc=3e3,ct="_RESTARTING_",cc="",Mi=class i{constructor(e){var t,n,s,r,a,o,u,c;this._createSocket=(d=!0)=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let l=this.serverSettings,p=zr.URLExt.join(l.wsUrl,Kr.KERNEL_SERVICE_URL,encodeURIComponent(this._id)),v=p.replace(/^((?:\w+:)?\/\/)(?:[^@\/]+@)/,"$1");console.debug(`Starting WebSocket: ${v}`);let _=zr.URLExt.join(p,"channels?session_id="+encodeURIComponent(this._clientId)),I=l.token;l.appendToken&&I!==""&&(_=_+`&token=${encodeURIComponent(I)}`);let P=d?this._supportedProtocols:[];this._ws=new l.WebSocket(_,P),this._ws.binaryType="arraybuffer";let D=!1,q=async w=>{var R,U;if(!this._isDisposed){this._reason="",this._model=void 0;try{let T=await this._kernelAPIClient.getModel(this._id);this._model=T,(T==null?void 0:T.execution_state)==="dead"?this._updateStatus("dead"):this._onWSClose(w)}catch(T){if(T instanceof yt.ServerConnection.NetworkError||((R=T.response)===null||R===void 0?void 0:R.status)===503||((U=T.response)===null||U===void 0?void 0:U.status)===424){let j=Se.getRandomIntInclusive(10,30)*1e3;setTimeout(q,j,w)}else this._reason="Kernel died unexpectedly",this._updateStatus("dead")}}},x=async w=>{D||(D=!0,await q(w))};this._ws.onmessage=this._onWSMessage,this._ws.onopen=this._onWSOpen,this._ws.onclose=x,this._ws.onerror=x},this._onWSOpen=d=>{if(this._ws.protocol!==""&&!this._supportedProtocols.includes(this._ws.protocol))throw console.log("Server selected unknown kernel wire protocol:",this._ws.protocol),this._updateStatus("dead"),new Error(`Unknown kernel wire protocol: ${this._ws.protocol}`);this._selectedProtocol=this._ws.protocol,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose,this._updateConnectionStatus("connected")},this._onWSMessage=d=>{let l;try{l=this.serverSettings.serializer.deserialize(d.data,this._ws.protocol),ac.validateMessage(l)}catch(p){throw p.message=`Kernel message validation error: ${p.message}`,p}this._kernelSession=l.header.session,this._msgChain=this._msgChain.then(()=>this._handleMessage(l)).catch(p=>{p.message.startsWith("Canceled future for ")&&console.error(p)}),this._anyMessage.emit({msg:l,direction:"recv"})},this._onWSClose=d=>{this.isDisposed||this._reconnect()},this._id="",this._name="",this._status="unknown",this._connectionStatus="connecting",this._kernelSession="",this._isDisposed=!1,this._ws=null,this._username="",this._reconnectLimit=7,this._reconnectAttempt=0,this._reconnectTimeout=null,this._supportedProtocols=Object.values(se.supportedKernelWebSocketProtocols),this._selectedProtocol="",this._commsOverSubshells=yt.CommsOverSubshells.PerCommTarget,this._futures=new Map,this._comms=new Map,this._targetRegistry=Object.create(null),this._info=new $e.PromiseDelegate,this._pendingMessages=[],this._statusChanged=new We.Signal(this),this._connectionStatusChanged=new We.Signal(this),this._disposed=new We.Signal(this),this._iopubMessage=new We.Signal(this),this._anyMessage=new We.Signal(this),this._pendingInput=new We.Signal(this),this._unhandledMessage=new We.Signal(this),this._displayIdToParentIds=new Map,this._msgIdToDisplayIds=new Map,this._msgChain=Promise.resolve(),this._hasPendingInput=!1,this._reason="",this._noOp=()=>{},this._supportsSubshells=!1,this._name=e.model.name,this._id=e.model.id,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:yt.ServerConnection.makeSettings(),this._kernelAPIClient=(n=e.kernelAPIClient)!==null&&n!==void 0?n:new Kr.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(s=e.kernelSpecAPIClient)!==null&&s!==void 0?s:new oc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._clientId=(r=e.clientId)!==null&&r!==void 0?r:$e.UUID.uuid4(),this._username=(a=e.username)!==null&&a!==void 0?a:"",this.handleComms=(o=e.handleComms)!==null&&o!==void 0?o:!0,this._commsOverSubshells=(u=e.commsOverSubshells)!==null&&u!==void 0?u:yt.CommsOverSubshells.PerCommTarget,this._subshellId=(c=e.subshellId)!==null&&c!==void 0?c:null,this._createSocket()}get disposed(){return this._disposed}get commsOverSubshells(){return this._commsOverSubshells}set commsOverSubshells(e){this._commsOverSubshells=e;for(let[t,n]of this._comms)n.commsOverSubshells=e}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get model(){return this._model||{id:this.id,name:this.name,reason:this._reason}}get anyMessage(){return this._anyMessage}get pendingInput(){return this._pendingInput}get id(){return this._id}get name(){return this._name}get username(){return this._username}get clientId(){return this._clientId}get subshellId(){return this._subshellId}set subshellId(e){this._subshellId=e}get status(){return this._status}get connectionStatus(){return this._connectionStatus}get isDisposed(){return this._isDisposed}get info(){return this._info.promise}get spec(){return this._specPromise?this._specPromise:(this._specPromise=this._kernelSpecAPIClient.get().then(e=>e.kernelspecs[this._name]),this._specPromise)}get supportsSubshells(){return this._supportsSubshells}clone(e={}){return new i({model:this.model,username:this.username,serverSettings:this.serverSettings,handleComms:!1,kernelAPIClient:this._kernelAPIClient,commsOverSubshells:yt.CommsOverSubshells.Disabled,...e})}dispose(){if(this.isDisposed)return;let e=()=>{this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearKernelState(),this._pendingMessages=[],this._clearSocket(),We.Signal.clearData(this)};if(this._subshellId!==null){let t=this.requestDeleteSubshell({subshell_id:this._subshellId},!0);t.onReply=n=>{e()}}else e()}sendShellMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Fr.KernelShellFutureHandler,e,t,n)}sendControlMessage(e,t=!1,n=!0){return this._sendKernelShellControl(Fr.KernelControlFutureHandler,e,t,n)}_sendKernelShellControl(e,t,n=!1,s=!0){this._sendMessage(t),this._anyMessage.emit({msg:t,direction:"send"});let r=new e(()=>{let a=t.header.msg_id;this._futures.delete(a);let o=this._msgIdToDisplayIds.get(a);o&&(o.forEach(u=>{let c=this._displayIdToParentIds.get(u);if(c){let d=c.indexOf(a);if(d===-1)return;c.length===1?this._displayIdToParentIds.delete(u):(c.splice(d,1),this._displayIdToParentIds.set(u,c))}}),this._msgIdToDisplayIds.delete(a))},t,n,s,this);return this._futures.set(t.header.msg_id,r),r}_sendMessage(e,t=!0){if(this.status==="dead")throw new Error("Kernel is dead");if((this._kernelSession===cc||this._kernelSession===ct)&&se.isInfoRequestMsg(e))if(this.connectionStatus==="connected"){this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));return}else throw new Error("Could not send message: status is not connected");if(t&&this._pendingMessages.length>0){this._pendingMessages.push(e);return}if(this.connectionStatus==="connected"&&this._kernelSession!==ct)this._ws.send(this.serverSettings.serializer.serialize(e,this._ws.protocol));else if(t)this._pendingMessages.push(e);else throw new Error("Could not send message")}async interrupt(){if(this.hasPendingInput=!1,this.status==="dead")throw new Error("Kernel is dead");return this._kernelAPIClient.interrupt(this.id)}async restart(){if(this.status==="dead")throw new Error("Kernel is dead");this._updateStatus("restarting"),this._clearKernelState(),this._kernelSession=ct,await this._kernelAPIClient.restart(this.id),await this.reconnect(),this.hasPendingInput=!1}reconnect(){this._errorIfDisposed();let e=new $e.PromiseDelegate,t=(n,s)=>{s==="connected"?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):s==="disconnected"&&(e.reject(new Error("Kernel connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}async shutdown(){this.status!=="dead"&&await this._kernelAPIClient.shutdown(this.id),this.handleShutdown()}handleShutdown(){this._updateStatus("dead"),this.dispose()}async requestKernelInfo(){let e=se.createMessage({msgType:"kernel_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{}}),t;try{t=await Se.handleShellMessage(this,e)}catch(s){if(this.isDisposed)return;throw s}if(this._errorIfDisposed(),!t)return;if(t.content.status===void 0&&(t.content.status="ok"),t.content.status!=="ok")return this._info.reject("Kernel info reply errored"),t;this._info.resolve(t.content),this._kernelSession=t.header.session;let n=t.content.supported_features;return this._supportsSubshells=n!==void 0&&n.includes("kernel subshells"),t}requestComplete(e){let t=se.createMessage({msgType:"complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestInspect(e){let t=se.createMessage({msgType:"inspect_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestHistory(e){let t=se.createMessage({msgType:"history_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestExecute(e,t=!0,n){let s={silent:!1,store_history:!0,user_expressions:{},allow_stdin:!0,stop_on_error:!1},r=se.createMessage({msgType:"execute_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:{...s,...e},metadata:n});return this.sendShellMessage(r,!0,t)}requestDebug(e,t=!0){let n=se.createMessage({msgType:"debug_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestCreateSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"create_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestDeleteSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"delete_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestListSubshell(e,t=!0){if(!this.supportsSubshells)throw new Error("Kernel subshells are not supported");let n=se.createMessage({msgType:"list_subshell_request",channel:"control",username:this._username,session:this._clientId,content:e});return this.sendControlMessage(n,!0,t)}requestIsComplete(e){let t=se.createMessage({msgType:"is_complete_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}requestCommInfo(e){let t=se.createMessage({msgType:"comm_info_request",channel:"shell",username:this._username,session:this._clientId,subshellId:this._subshellId,content:e});return Se.handleShellMessage(this,t)}sendInputReply(e,t){let n=se.createMessage({msgType:"input_reply",channel:"stdin",username:this._username,session:this._clientId,content:e});n.parent_header=t,this._sendMessage(n),this._anyMessage.emit({msg:n,direction:"send"}),this.hasPendingInput=!1}createComm(e,t=$e.UUID.uuid4()){if(!this.handleComms)throw new Error("Comms are disabled on this kernel connection");if(this._comms.has(t))throw new Error("Comm is already created");let n=new Lr.CommHandler(e,t,this,()=>{this._unregisterComm(t)},this._commsOverSubshells);return this._comms.set(t,n),n}hasComm(e){return this._comms.has(e)}registerCommTarget(e,t){this.handleComms&&(this._targetRegistry[e]=t)}removeCommTarget(e,t){this.handleComms&&!this.isDisposed&&this._targetRegistry[e]===t&&delete this._targetRegistry[e]}registerMessageHook(e,t){var n;let s=(n=this._futures)===null||n===void 0?void 0:n.get(e);s&&s.registerMessageHook(t)}removeMessageHook(e,t){var n;let s=(n=this._futures)===null||n===void 0?void 0:n.get(e);s&&s.removeMessageHook(t)}removeInputGuard(){this.hasPendingInput=!1}async _handleDisplayId(e,t){var n,s;let r=t.parent_header.msg_id,a=this._displayIdToParentIds.get(e);if(a){let u={header:$e.JSONExt.deepCopy(t.header),parent_header:$e.JSONExt.deepCopy(t.parent_header),metadata:$e.JSONExt.deepCopy(t.metadata),content:$e.JSONExt.deepCopy(t.content),channel:t.channel,buffers:t.buffers?t.buffers.slice():[]};u.header.msg_type="update_display_data",await Promise.all(a.map(async c=>{let d=this._futures&&this._futures.get(c);d&&await d.handleMsg(u)}))}if(t.header.msg_type==="update_display_data")return!0;a=(n=this._displayIdToParentIds.get(e))!==null&&n!==void 0?n:[],a.indexOf(r)===-1&&a.push(r),this._displayIdToParentIds.set(e,a);let o=(s=this._msgIdToDisplayIds.get(r))!==null&&s!==void 0?s:[];return o.indexOf(r)===-1&&o.push(r),this._msgIdToDisplayIds.set(r,o),!1}_clearSocket(){this._ws!==null&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}_updateStatus(e){this._status===e||this._status==="dead"||(this._status=e,Se.logKernelStatus(this),this._statusChanged.emit(e),e==="dead"&&this.dispose())}_sendPending(){for(;this.connectionStatus==="connected"&&this._kernelSession!==ct&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}_clearKernelState(){this._kernelSession="",this._pendingMessages=[],this._futures.forEach(e=>{e.dispose()}),this._comms.forEach(e=>{e.dispose()}),this._msgChain=Promise.resolve(),this._futures=new Map,this._comms=new Map,this._displayIdToParentIds.clear(),this._msgIdToDisplayIds.clear()}_assertCurrentMessage(e){if(this._errorIfDisposed(),e.header.session!==this._kernelSession)throw new Error(`Canceling handling of old message: ${e.header.msg_type}`)}async _handleCommOpen(e){this._assertCurrentMessage(e);let t=e.content,n=new Lr.CommHandler(t.target_name,t.comm_id,this,()=>{this._unregisterComm(t.comm_id)},this.commsOverSubshells);this._comms.set(t.comm_id,n);try{await(await Se.loadObject(t.target_name,t.target_module,this._targetRegistry))(n,e)}catch(s){throw n.close(),console.error("Exception opening new comm"),s}}async _handleCommClose(e){this._assertCurrentMessage(e);let t=e.content,n=this._comms.get(t.comm_id);if(!n){console.error("Comm not found for comm id "+t.comm_id);return}this._unregisterComm(n.commId);let s=n.onClose;s&&await s(e),n.dispose()}async _handleCommMsg(e){this._assertCurrentMessage(e);let t=e.content,n=this._comms.get(t.comm_id);if(!n)return;let s=n.onMsg;s&&await s(e)}_unregisterComm(e){this._comms.delete(e)}_updateConnectionStatus(e){if(this._connectionStatus!==e){if(this._connectionStatus=e,e!=="connecting"&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),this.status!=="dead")if(e==="connected"){let t=this._kernelSession===ct,n=this.requestKernelInfo(),s=!1,r=()=>{s||(s=!0,t&&this._kernelSession===ct&&(this._kernelSession=""),clearTimeout(a),this._pendingMessages.length>0&&this._sendPending())};n.then(r);let a=setTimeout(r,lc)}else this._updateStatus("unknown");this._connectionStatusChanged.emit(e)}}async _handleMessage(e){var t,n;let s=!1;if(e.parent_header&&e.channel==="iopub"&&(se.isDisplayDataMsg(e)||se.isUpdateDisplayDataMsg(e)||se.isExecuteResultMsg(e))){let a=((t=e.content.transient)!==null&&t!==void 0?t:{}).display_id;a&&(s=await this._handleDisplayId(a,e),this._assertCurrentMessage(e))}if(!s&&e.parent_header){let r=e.parent_header,a=(n=this._futures)===null||n===void 0?void 0:n.get(r.msg_id);if(a)await a.handleMsg(e),this._assertCurrentMessage(e);else{let o=r.session===this.clientId;e.channel!=="iopub"&&o&&this._unhandledMessage.emit(e)}}if(e.channel==="iopub"){switch(e.header.msg_type){case"status":{let r=e.content.execution_state;r==="restarting"&&Promise.resolve().then(async()=>{this._updateStatus("autorestarting"),this._clearKernelState(),await this.reconnect()}),this._updateStatus(r);break}case"comm_open":this.handleComms&&await this._handleCommOpen(e);break;case"comm_msg":this.handleComms&&await this._handleCommMsg(e);break;case"comm_close":this.handleComms&&await this._handleCommClose(e);break;default:break}this.isDisposed||(this._assertCurrentMessage(e),this._iopubMessage.emit(e))}}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");let e=Se.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.warn(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`);let t=this._selectedProtocol!=="";this._reconnectTimeout=setTimeout(this._createSocket,e,t),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_errorIfDisposed(){if(this.isDisposed)throw new Error("Kernel connection is disposed")}get hasPendingInput(){return this._hasPendingInput}set hasPendingInput(e){this._hasPendingInput=e,this._pendingInput.emit(e)}};je.KernelConnection=Mi;var Se;(function(i){function e(r){switch(r.status){case"idle":case"busy":case"unknown":return;default:console.debug(`Kernel: ${r.status} (${r.id})`);break}}i.logKernelStatus=e;async function t(r,a){return r.sendShellMessage(a,!0).done}i.handleShellMessage=t;function n(r,a,o){return new Promise((u,c)=>{if(a){if(typeof requirejs=="undefined")throw new Error("requirejs not found");requirejs([a],d=>{if(d[r]===void 0){let l=`Object '${r}' not found in module '${a}'`;c(new Error(l))}else u(d[r])},c)}else o!=null&&o[r]?u(o[r]):c(new Error(`Object '${r}' not found in registry`))})}i.loadObject=n;function s(r,a){return r=Math.ceil(r),a=Math.floor(a),Math.floor(Math.random()*(a-r+1))+r}i.getRandomIntInclusive=s})(Se||(Se={}))});var Wr=E(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.KernelManager=void 0;var dc=Xe(),Vr=Z(),$r=Ne(),uc=Ye(),pc=wn(),hc=Ei(),fc=vt(),wt=class extends uc.BaseManager{constructor(e={}){var t,n,s;super(e),this._commsOverSubshells=$r.CommsOverSubshells.PerCommTarget,this._isReady=!1,this._kernelConnections=new Set,this._models=new Map,this._runningChanged=new Vr.Signal(this),this._connectionFailure=new Vr.Signal(this),this._kernelAPIClient=(t=e.kernelAPIClient)!==null&&t!==void 0?t:new pc.KernelAPIClient({serverSettings:this.serverSettings}),this._kernelSpecAPIClient=(n=e.kernelSpecAPIClient)!==null&&n!==void 0?n:new fc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._pollModels=new dc.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:KernelManager#models",standby:(s=e.standby)!==null&&s!==void 0?s:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._kernelConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){var t;let{id:n}=e.model,s=(t=e.handleComms)!==null&&t!==void 0?t:!0;if(e.handleComms===void 0){for(let a of this._kernelConnections)if(a.id===n&&a.handleComms){s=!1;break}}e.commsOverSubshells=this._commsOverSubshells;let r=new hc.KernelConnection({handleComms:s,...e,serverSettings:this.serverSettings,kernelAPIClient:this._kernelAPIClient,kernelSpecAPIClient:this._kernelSpecAPIClient});return this._onStarted(r),this._models.has(n)||this.refreshRunning().catch(()=>{}),r}running(){return this._models.values()}get runningCount(){return this._models.size}get commsOverSubshells(){return this._commsOverSubshells}set commsOverSubshells(e){this._commsOverSubshells=e;for(let t of this._kernelConnections)t.commsOverSubshells=e}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={},t={}){let n=await this._kernelAPIClient.startNew(e);return this.connectTo({...t,model:n})}async shutdown(e){await this._kernelAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>this._kernelAPIClient.shutdown(e))),await this.refreshRunning()}async findById(e){return this._models.has(e)?this._models.get(e):(await this.refreshRunning(),this._models.get(e))}async requestRunning(){var e,t;let n;try{n=await this._kernelAPIClient.listRunning()}catch(s){throw(s instanceof $r.ServerConnection.NetworkError||((e=s.response)===null||e===void 0?void 0:e.status)===503||((t=s.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(s),s}this.isDisposed||this._models.size===n.length&&n.every(s=>{let r=this._models.get(s.id);return r?r.connections===s.connections&&r.execution_state===s.execution_state&&r.last_activity===s.last_activity&&r.name===s.name&&r.reason===s.reason&&r.traceback===s.traceback:!1})||(this._models=new Map(n.map(s=>[s.id,s])),this._kernelConnections.forEach(s=>{this._models.has(s.id)||s.handleShutdown()}),this._runningChanged.emit(n))}_onStarted(e){this._kernelConnections.add(e),e.statusChanged.connect(this._onStatusChanged,this),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._kernelConnections.delete(e),this.refreshRunning().catch(()=>{})}_onStatusChanged(e,t){t==="dead"&&this.refreshRunning().catch(()=>{})}};bt.KernelManager=wt;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}async startNew(n={},s={}){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}connectTo(n){throw new Error("Not implemented in no-op Kernel Manager")}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Kernel Manager"))}get ready(){return this.parentReady.then(()=>this._readyPromise)}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(wt||(bt.KernelManager=wt={}))});var Ri=E(J=>{"use strict";var Jr=J&&J.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),mc=J&&J.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Ii=J&&J.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Jr(e,i,t);return mc(e,i),e},gc=J&&J.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Jr(e,i,t)};Object.defineProperty(J,"__esModule",{value:!0});J.CommsOverSubshells=J.KernelConnection=J.KernelAPI=J.KernelMessage=J.Kernel=void 0;var _c=Si();Object.defineProperty(J,"CommsOverSubshells",{enumerable:!0,get:function(){return _c.CommsOverSubshells}});var vc=Ii(kr());J.Kernel=vc;var yc=Ii(st());J.KernelMessage=yc;var wc=Ii(wn());J.KernelAPI=wc;var bc=Ei();Object.defineProperty(J,"KernelConnection",{enumerable:!0,get:function(){return bc.KernelConnection}});gc(Wr(),J)});var Gr=E(Hr=>{"use strict";Object.defineProperty(Hr,"__esModule",{value:!0})});var Xr=E(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.KernelSpecManager=void 0;var Sc=te(),xc=Xe(),Yr=Z(),Cc=Ye(),kc=vt(),Oi=class extends Cc.BaseManager{constructor(e={}){var t,n;super(e),this._isReady=!1,this._connectionFailure=new Yr.Signal(this),this._specs=null,this._specsChanged=new Yr.Signal(this),this._kernelSpecAPIClient=(t=e.kernelSpecAPIClient)!==null&&t!==void 0?t:new kc.KernelSpecAPIClient({serverSettings:this.serverSettings}),this._ready=Promise.all([this.requestSpecs()]).then(s=>{}).catch(s=>{}).then(()=>{this.isDisposed||(this._isReady=!0)}),this._pollSpecs=new xc.Poll({auto:!1,factory:()=>this.requestSpecs(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:KernelSpecManager#specs",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this.ready.then(()=>{this._pollSpecs.start()})}get isReady(){return this._isReady}get ready(){return this._ready}get specs(){return this._specs}get specsChanged(){return this._specsChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshSpecs(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestSpecs(){let e=await this._kernelSpecAPIClient.get();this.isDisposed||Sc.JSONExt.deepEqual(e,this._specs)||(this._specs=e,this._specsChanged.emit(e))}};xn.KernelSpecManager=Oi});var Di=E(pe=>{"use strict";var Zr=pe&&pe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Pc=pe&&pe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Qr=pe&&pe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Zr(e,i,t);return Pc(e,i),e},Mc=pe&&pe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Zr(e,i,t)};Object.defineProperty(pe,"__esModule",{value:!0});pe.KernelSpecAPI=pe.KernelSpec=void 0;var Ec=Qr(Gr());pe.KernelSpec=Ec;var Ic=Qr(vt());pe.KernelSpecAPI=Ic;Mc(Xr(),pe)});var ea=E(Cn=>{"use strict";Object.defineProperty(Cn,"__esModule",{value:!0});Cn.BuildManager=void 0;var ji=Y(),Je=de(),Rc="api/build",Ti=class{constructor(e={}){var t;this._url="",this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Je.ServerConnection.makeSettings();let{baseUrl:n,appUrl:s}=this.serverSettings;this._url=ji.URLExt.join(n,s,Rc)}get isAvailable(){return ji.PageConfig.getOption("buildAvailable").toLowerCase()==="true"}get shouldCheck(){return ji.PageConfig.getOption("buildCheck").toLowerCase()==="true"}getStatus(){let{_url:e,serverSettings:t}=this;return Je.ServerConnection.makeRequest(e,{},t).then(s=>{if(s.status!==200)throw new Je.ServerConnection.ResponseError(s);return s.json()}).then(s=>{if(typeof s.status!="string")throw new Error("Invalid data");if(typeof s.message!="string")throw new Error("Invalid data");return s})}build(){let{_url:e,serverSettings:t}=this,n={method:"POST"};return Je.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status===400)throw new Je.ServerConnection.ResponseError(r,"Build aborted");if(r.status!==200){let a=`Build failed with ${r.status}.
4
4
 
5
5
  If you are experiencing the build failure after installing an extension (or trying to include previously installed extension after updating JupyterLab) please check the extension repository for new installation instructions as many extensions migrated to the prebuilt extensions system which no longer requires rebuilding JupyterLab (but uses a different installation procedure, typically involving a package manager such as 'pip' or 'conda').
6
6
 
7
- If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.`;throw new He.ServerConnection.ResponseError(r,a)}})}cancel(){let{_url:e,serverSettings:t}=this,n={method:"DELETE"};return He.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status!==204)throw new He.ServerConnection.ResponseError(r)})}};Sn.BuildManager=ji});var Ui=E(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.NbConvertManager=void 0;var jc=G(),Ti=de(),Tc=te(),qc="api/nbconvert",qi=class{constructor(e={}){var t;this._exportFormats=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ti.ServerConnection.makeSettings()}async fetchExportFormats(){this._requestingFormats=new Tc.PromiseDelegate,this._exportFormats=null;let e=this.serverSettings.baseUrl,t=jc.URLExt.join(e,qc),{serverSettings:n}=this,s=await Ti.ServerConnection.makeRequest(t,{},n);if(s.status!==200)throw await Ti.ServerConnection.ResponseError.create(s);let r=await s.json(),a={};return Object.keys(r).forEach(function(u){let c=r[u].output_mimetype;a[u]={output_mimetype:c}}),this._exportFormats=a,this._requestingFormats.resolve(a),a}async getExportFormats(e=!0){return this._requestingFormats?this._requestingFormats.promise:e||!this._exportFormats?await this.fetchExportFormats():this._exportFormats}};xn.NbConvertManager=qi});var ta=E(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0})});var ia=E(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.validateModel=na;bt.updateLegacySessionModel=Ac;bt.validateModels=Nc;var Uc=gn(),wt=ft();function na(i){(0,wt.validateProperty)(i,"id","string"),(0,wt.validateProperty)(i,"type","string"),(0,wt.validateProperty)(i,"name","string"),(0,wt.validateProperty)(i,"path","string"),(0,wt.validateProperty)(i,"kernel","object"),(0,Uc.validateModel)(i.kernel)}function Ac(i){i.path===void 0&&i.notebook!==void 0&&(i.path=i.notebook.path,i.type="notebook",i.name="")}function Nc(i){if(!Array.isArray(i))throw new Error("Invalid session list");i.forEach(e=>na(e))}});var Pn=E(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.SessionAPIClient=he.SESSION_SERVICE_URL=void 0;he.listRunning=sa;he.getSessionUrl=kn;he.shutdownSession=ra;he.getSessionModel=aa;he.startSession=oa;he.updateSession=la;var re=de(),Cn=G(),Ge=ia();he.SESSION_SERVICE_URL="api/sessions";async function sa(i=re.ServerConnection.makeSettings()){let e=Cn.URLExt.join(i.baseUrl,he.SESSION_SERVICE_URL),t=await re.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await re.ServerConnection.ResponseError.create(t);let n=await t.json();if(!Array.isArray(n))throw new Error("Invalid Session list");return n.forEach(s=>{(0,Ge.updateLegacySessionModel)(s),(0,Ge.validateModel)(s)}),n}function kn(i,e){let t=Cn.URLExt.join(i,he.SESSION_SERVICE_URL),n=Cn.URLExt.join(t,e);if(!n.startsWith(t))throw new Error("Can only be used for services requests");return n}async function ra(i,e=re.ServerConnection.makeSettings()){var t;let n=kn(e.baseUrl,i),s={method:"DELETE"},r=await re.ServerConnection.makeRequest(n,s,e);if(r.status===404){let o=(t=(await r.json()).message)!==null&&t!==void 0?t:`The session "${i}"" does not exist on the server`;console.warn(o)}else{if(r.status===410)throw new re.ServerConnection.ResponseError(r,"The kernel was deleted but the session was not");if(r.status!==204)throw await re.ServerConnection.ResponseError.create(r)}}async function aa(i,e=re.ServerConnection.makeSettings()){let t=kn(e.baseUrl,i),n=await re.ServerConnection.makeRequest(t,{},e);if(n.status!==200)throw await re.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,Ge.updateLegacySessionModel)(s),(0,Ge.validateModel)(s),s}async function oa(i,e=re.ServerConnection.makeSettings()){let t=Cn.URLExt.join(e.baseUrl,he.SESSION_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await re.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await re.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,Ge.updateLegacySessionModel)(r),(0,Ge.validateModel)(r),r}async function la(i,e=re.ServerConnection.makeSettings()){let t=kn(e.baseUrl,i.id),n={method:"PATCH",body:JSON.stringify(i)},s=await re.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await re.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,Ge.updateLegacySessionModel)(r),(0,Ge.validateModel)(r),r}var Ai=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:re.ServerConnection.makeSettings()}async listRunning(){return sa(this.serverSettings)}async getModel(e){return aa(e,this.serverSettings)}async startNew(e){return oa(e,this.serverSettings)}async shutdown(e){return ra(e,this.serverSettings)}async update(e){return la(e,this.serverSettings)}};he.SessionAPIClient=Ai});var ca=E(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.SessionConnection=void 0;var qe=X(),Lc=Le(),zc=te(),Fc=Pn(),Ni=class{constructor(e){var t,n,s,r,a;this._id="",this._path="",this._name="",this._type="",this._kernel=null,this._isDisposed=!1,this._disposed=new qe.Signal(this),this._kernelChanged=new qe.Signal(this),this._statusChanged=new qe.Signal(this),this._connectionStatusChanged=new qe.Signal(this),this._pendingInput=new qe.Signal(this),this._iopubMessage=new qe.Signal(this),this._unhandledMessage=new qe.Signal(this),this._anyMessage=new qe.Signal(this),this._propertyChanged=new qe.Signal(this),this._id=e.model.id,this._name=e.model.name,this._path=e.model.path,this._type=e.model.type,this._username=(t=e.username)!==null&&t!==void 0?t:"",this._clientId=(n=e.clientId)!==null&&n!==void 0?n:zc.UUID.uuid4(),this._connectToKernel=e.connectToKernel,this._kernelConnectionOptions=(s=e.kernelConnectionOptions)!==null&&s!==void 0?s:{},this.serverSettings=(r=e.serverSettings)!==null&&r!==void 0?r:Lc.ServerConnection.makeSettings(),this._sessionAPIClient=(a=e.sessionAPIClient)!==null&&a!==void 0?a:new Fc.SessionAPIClient({serverSettings:this.serverSettings}),this.setupKernel(e.model.kernel)}get disposed(){return this._disposed}get kernelChanged(){return this._kernelChanged}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get pendingInput(){return this._pendingInput}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get anyMessage(){return this._anyMessage}get propertyChanged(){return this._propertyChanged}get id(){return this._id}get kernel(){return this._kernel}get path(){return this._path}get type(){return this._type}get name(){return this._name}get model(){return{id:this.id,kernel:this.kernel&&{id:this.kernel.id,name:this.kernel.name},path:this._path,type:this._type,name:this._name}}get isDisposed(){return this._isDisposed}update(e){let t=this.model;if(this._path=e.path,this._name=e.name,this._type=e.type,this._kernel===null&&e.kernel!==null||this._kernel!==null&&e.kernel===null||this._kernel!==null&&e.kernel!==null&&this._kernel.id!==e.kernel.id){this._kernel!==null&&this._kernel.dispose();let n=this._kernel||null;this.setupKernel(e.kernel);let s=this._kernel||null;this._kernelChanged.emit({name:"kernel",oldValue:n,newValue:s})}this._handleModelChange(t)}dispose(){if(!this.isDisposed){if(this._isDisposed=!0,this._disposed.emit(),this._kernel){this._kernel.dispose();let e=this._kernel;this._kernel=null;let t=this._kernel;this._kernelChanged.emit({name:"kernel",oldValue:e,newValue:t})}qe.Signal.clearData(this)}}async setPath(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({path:e})}async setName(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({name:e})}async setType(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({type:e})}async changeKernel(e){if(this.isDisposed)throw new Error("Session is disposed");return await this._patch({kernel:e}),this.kernel}async shutdown(){if(this.isDisposed)throw new Error("Session is disposed");await this._sessionAPIClient.shutdown(this.id),this.dispose()}setupKernel(e){if(e===null){this._kernel=null;return}let t=this._connectToKernel({...this._kernelConnectionOptions,model:e,username:this._username,clientId:this._clientId,serverSettings:this.serverSettings});this._kernel=t,t.statusChanged.connect(this.onKernelStatus,this),t.connectionStatusChanged.connect(this.onKernelConnectionStatus,this),t.pendingInput.connect(this.onPendingInput,this),t.unhandledMessage.connect(this.onUnhandledMessage,this),t.iopubMessage.connect(this.onIOPubMessage,this),t.anyMessage.connect(this.onAnyMessage,this)}onKernelStatus(e,t){this._statusChanged.emit(t)}onKernelConnectionStatus(e,t){this._connectionStatusChanged.emit(t)}onPendingInput(e,t){this._pendingInput.emit(t)}onIOPubMessage(e,t){this._iopubMessage.emit(t)}onUnhandledMessage(e,t){this._unhandledMessage.emit(t)}onAnyMessage(e,t){this._anyMessage.emit(t)}async _patch(e){let t=await this._sessionAPIClient.update({...e,id:this._id});return this.update(t),t}_handleModelChange(e){e.name!==this._name&&this._propertyChanged.emit("name"),e.type!==this._type&&this._propertyChanged.emit("type"),e.path!==this._path&&this._propertyChanged.emit("path")}};Mn.SessionConnection=Ni});var ua=E(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.SessionManager=void 0;var Kc=Qe(),da=X(),Bc=de(),Vc=Ze(),$c=ca(),Wc=Pn(),St=class extends Vc.BaseManager{constructor(e){var t,n;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new da.Signal(this),this._connectionFailure=new da.Signal(this),this._connectToKernel=s=>this._kernelManager.connectTo(s),this._kernelManager=e.kernelManager,this._sessionAPIClient=(t=e.sessionAPIClient)!==null&&t!==void 0?t:new Wc.SessionAPIClient({serverSettings:e.serverSettings}),this._pollModels=new Kc.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:SessionManager#models",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._kernelManager.isActive&&await this._kernelManager.ready,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._sessionConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){let t=new $c.SessionConnection({...e,connectToKernel:this._connectToKernel,serverSettings:this.serverSettings,sessionAPIClient:this._sessionAPIClient});return this._onStarted(t),this._models.has(e.model.id)||this.refreshRunning().catch(()=>{}),t}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e,t={}){let n=await this._sessionAPIClient.startNew(e);return await this.refreshRunning(),this.connectTo({...t,model:n})}async shutdown(e){await this._sessionAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>this._sessionAPIClient.shutdown(e))),await this.refreshRunning()}async stopIfNeeded(e){try{let n=(await this._sessionAPIClient.listRunning()).filter(s=>s.path===e);if(n.length===1){let s=n[0].id;await this.shutdown(s)}}catch{}}async findById(e){return this._models.has(e)?this._models.get(e):(await this.refreshRunning(),this._models.get(e))}async findByPath(e){for(let t of this._models.values())if(t.path===e)return t;await this.refreshRunning();for(let t of this._models.values())if(t.path===e)return t}async requestRunning(){var e,t;let n;try{n=await this._sessionAPIClient.listRunning()}catch(s){throw(s instanceof Bc.ServerConnection.NetworkError||((e=s.response)===null||e===void 0?void 0:e.status)===503||((t=s.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(s),s}this.isDisposed||this._models.size===n.length&&n.every(s=>{var r,a,o,u;let c=this._models.get(s.id);return c?((r=c.kernel)===null||r===void 0?void 0:r.id)===((a=s.kernel)===null||a===void 0?void 0:a.id)&&((o=c.kernel)===null||o===void 0?void 0:o.name)===((u=s.kernel)===null||u===void 0?void 0:u.name)&&c.name===s.name&&c.path===s.path&&c.type===s.type:!1})||(this._models=new Map(n.map(s=>[s.id,s])),this._sessionConnections.forEach(s=>{this._models.has(s.id)?s.update(this._models.get(s.id)):s.dispose()}),this._runningChanged.emit(n))}_onStarted(e){this._sessionConnections.add(e),e.disposed.connect(this._onDisposed,this),e.propertyChanged.connect(this._onChanged,this),e.kernelChanged.connect(this._onChanged,this)}_onDisposed(e){this._sessionConnections.delete(e),this.refreshRunning().catch(()=>{})}_onChanged(){this.refreshRunning().catch(()=>{})}};xt.SessionManager=St;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}async startNew(n,s={}){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}connectTo(n){throw Error("Not implemented in no-op Session Manager")}get ready(){return this.parentReady.then(()=>this._readyPromise)}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(St||(xt.SessionManager=St={}))});var Li=E(fe=>{"use strict";var pa=fe&&fe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Jc=fe&&fe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),ha=fe&&fe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&pa(e,i,t);return Jc(e,i),e},Hc=fe&&fe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&pa(e,i,t)};Object.defineProperty(fe,"__esModule",{value:!0});fe.SessionAPI=fe.Session=void 0;var Gc=ha(ta());fe.Session=Gc;var Yc=ha(Pn());fe.SessionAPI=Yc;Hc(ua(),fe)});var fa=E(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.DataConnector=void 0;var zi=class{async list(e){throw new Error("DataConnector#list method has not been implemented.")}async remove(e){throw new Error("DataConnector#remove method has not been implemented.")}async save(e,t){throw new Error("DataConnector#save method has not been implemented.")}};En.DataConnector=zi});var ga=E(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0})});var va=E((Rn,_a)=>{(function(i,e){typeof Rn=="object"&&typeof _a!="undefined"?e(Rn):typeof define=="function"&&define.amd?define(["exports"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_properties={}))})(Rn,function(i){"use strict";class e{constructor(s){this._pid=t.nextPID(),this.name=s.name,this._create=s.create,this._coerce=s.coerce||null,this._compare=s.compare||null,this._changed=s.changed||null}get(s){let r,a=t.ensureMap(s);return this._pid in a?r=a[this._pid]:r=a[this._pid]=this._createValue(s),r}set(s,r){let a,o=t.ensureMap(s);this._pid in o?a=o[this._pid]:a=o[this._pid]=this._createValue(s);let u=this._coerceValue(s,r);this._maybeNotify(s,a,o[this._pid]=u)}coerce(s){let r,a=t.ensureMap(s);this._pid in a?r=a[this._pid]:r=a[this._pid]=this._createValue(s);let o=this._coerceValue(s,r);this._maybeNotify(s,r,a[this._pid]=o)}_createValue(s){let r=this._create;return r(s)}_coerceValue(s,r){let a=this._coerce;return a?a(s,r):r}_compareValue(s,r){let a=this._compare;return a?a(s,r):s===r}_maybeNotify(s,r,a){let o=this._changed;o&&!this._compareValue(r,a)&&o(s,r,a)}}(function(n){function s(r){t.ownerData.delete(r)}n.clearData=s})(e||(e={}));var t;(function(n){n.ownerData=new WeakMap,n.nextPID=(()=>{let r=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${r++}`})();function s(r){let a=n.ownerData.get(r);return a||(a=Object.create(null),n.ownerData.set(r,a),a)}n.ensureMap=s})(t||(t={})),i.AttachedProperty=e})});var wa=E(On=>{"use strict";Object.defineProperty(On,"__esModule",{value:!0});On.RestorablePool=void 0;var Xc=te(),ya=va(),In=X(),Fi=class{constructor(e){this._added=new In.Signal(this),this._current=null,this._currentChanged=new In.Signal(this),this._hasRestored=!1,this._isDisposed=!1,this._objects=new Set,this._restore=null,this._restored=new Xc.PromiseDelegate,this._updated=new In.Signal(this),this.namespace=e.namespace}get added(){return this._added}get current(){return this._current}set current(e){this._current!==e&&e!==null&&this._objects.has(e)&&(this._current=e,this._currentChanged.emit(this._current))}get currentChanged(){return this._currentChanged}get isDisposed(){return this._isDisposed}get restored(){return this._restored.promise}get size(){return this._objects.size}get updated(){return this._updated}async add(e){var t,n;if(e.isDisposed){let s="A disposed object cannot be added.";throw console.warn(s,e),new Error(s)}if(this._objects.has(e)){let s="This object already exists in the pool.";throw console.warn(s,e),new Error(s)}if(this._objects.add(e),e.disposed.connect(this._onInstanceDisposed,this),!Ue.injectedProperty.get(e)){if(this._restore){let{connector:s}=this._restore,r=this._restore.name(e);if(r){let a=`${this.namespace}:${r}`,o=(n=(t=this._restore).args)===null||n===void 0?void 0:n.call(t,e);Ue.nameProperty.set(e,a),await s.save(a,{data:o})}}this._added.emit(e)}}dispose(){this.isDisposed||(this._current=null,this._isDisposed=!0,this._objects.clear(),In.Signal.clearData(this))}find(e){let t=this._objects.values();for(let n of t)if(e(n))return n}forEach(e){this._objects.forEach(e)}filter(e){let t=[];return this.forEach(n=>{e(n)&&t.push(n)}),t}inject(e){return Ue.injectedProperty.set(e,!0),this.add(e)}has(e){return this._objects.has(e)}async restore(e){if(this._hasRestored)throw new Error("This pool has already been restored.");this._hasRestored=!0;let{command:t,connector:n,registry:s,when:r}=e,a=this.namespace,o=r?[n.list(a)].concat(r):[n.list(a)];this._restore=e;let[u]=await Promise.all(o),c=await Promise.all(u.ids.map(async(d,l)=>{let p=u.values[l],v=p&&p.data;return v===void 0?n.remove(d):s.execute(t,v).catch(()=>n.remove(d))}));return this._restored.resolve(),c}async save(e){var t,n;let s=Ue.injectedProperty.get(e);if(!this._restore||!this.has(e)||s)return;let{connector:r}=this._restore,a=this._restore.name(e),o=Ue.nameProperty.get(e),u=a?`${this.namespace}:${a}`:"";if(o&&o!==u&&await r.remove(o),Ue.nameProperty.set(e,u),u){let c=(n=(t=this._restore).args)===null||n===void 0?void 0:n.call(t,e);await r.save(u,{data:c})}o!==u&&this._updated.emit(e)}_onInstanceDisposed(e){if(this._objects.delete(e),e===this._current&&(this._current=null,this._currentChanged.emit(this._current)),Ue.injectedProperty.get(e)||!this._restore)return;let{connector:t}=this._restore,n=Ue.nameProperty.get(e);n&&t.remove(n)}};On.RestorablePool=Fi;var Ue;(function(i){i.injectedProperty=new ya.AttachedProperty({name:"injected",create:()=>!1}),i.nameProperty=new ya.AttachedProperty({name:"name",create:()=>""})})(Ue||(Ue={}))});var ba=E(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.StateDB=void 0;var Zc=X(),Ct=class i{constructor(e={}){this._changed=new Zc.Signal(this);let{connector:t,transform:n}=e;this._connector=t||new i.Connector,n?this._ready=n.then(s=>{let{contents:r,type:a}=s;switch(a){case"cancel":return;case"clear":return this._clear();case"merge":return this._merge(r||{});case"overwrite":return this._overwrite(r||{});default:return}}):this._ready=Promise.resolve(void 0)}get changed(){return this._changed}async clear(){await this._ready,await this._clear()}async fetch(e){return await this._ready,this._fetch(e)}async list(e){return await this._ready,this._list(e)}async remove(e){await this._ready,await this._remove(e),this._changed.emit({id:e,type:"remove"})}async save(e,t){await this._ready,await this._save(e,t),this._changed.emit({id:e,type:"save"})}async toJSON(){await this._ready;let{ids:e,values:t}=await this._list();return t.reduce((n,s,r)=>(n[e[r]]=s,n),{})}async _clear(){await Promise.all((await this._list()).ids.map(e=>this._remove(e)))}async _fetch(e){let t=await this._connector.fetch(e);if(t)return JSON.parse(t).v}async _list(e=""){let{ids:t,values:n}=await this._connector.list(e);return{ids:t,values:n.map(s=>JSON.parse(s).v)}}async _merge(e){await Promise.all(Object.keys(e).map(t=>e[t]&&this._save(t,e[t])))}async _overwrite(e){await this._clear(),await this._merge(e)}async _remove(e){return this._connector.remove(e)}async _save(e,t){return this._connector.save(e,JSON.stringify({v:t}))}};kt.StateDB=Ct;(function(i){class e{constructor(){this._storage={}}async fetch(n){return this._storage[n]}async list(n=""){return Object.keys(this._storage).reduce((s,r)=>((n===""||n===r.split(":")[0])&&(s.ids.push(r),s.values.push(this._storage[r])),s),{ids:[],values:[]})}async remove(n){delete this._storage[n]}async save(n,s){this._storage[n]=s}}i.Connector=e})(Ct||(kt.StateDB=Ct={}))});var Sa=E(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.IStateDB=void 0;var Qc=te();Dn.IStateDB=new Qc.Token("@jupyterlab/coreutils:IStateDB",`A service for the JupyterLab state database.
7
+ If you specifically intended to install a source extension, please run 'jupyter lab build' on the server for full output.`;throw new Je.ServerConnection.ResponseError(r,a)}})}cancel(){let{_url:e,serverSettings:t}=this,n={method:"DELETE"};return Je.ServerConnection.makeRequest(e,n,t).then(r=>{if(r.status!==204)throw new Je.ServerConnection.ResponseError(r)})}};Cn.BuildManager=Ti});var Ui=E(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.NbConvertManager=void 0;var Oc=Y(),qi=de(),Dc=te(),jc="api/nbconvert",Ai=class{constructor(e={}){var t;this._exportFormats=null,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:qi.ServerConnection.makeSettings()}async fetchExportFormats(){this._requestingFormats=new Dc.PromiseDelegate,this._exportFormats=null;let e=this.serverSettings.baseUrl,t=Oc.URLExt.join(e,jc),{serverSettings:n}=this,s=await qi.ServerConnection.makeRequest(t,{},n);if(s.status!==200)throw await qi.ServerConnection.ResponseError.create(s);let r=await s.json(),a={};return Object.keys(r).forEach(function(u){let c=r[u].output_mimetype;a[u]={output_mimetype:c}}),this._exportFormats=a,this._requestingFormats.resolve(a),a}async getExportFormats(e=!0){return this._requestingFormats?this._requestingFormats.promise:e||!this._exportFormats?await this.fetchExportFormats():this._exportFormats}};kn.NbConvertManager=Ai});var na=E(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0})});var sa=E(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.validateModel=ia;xt.updateLegacySessionModel=qc;xt.validateModels=Ac;var Tc=vn(),St=ht();function ia(i){(0,St.validateProperty)(i,"id","string"),(0,St.validateProperty)(i,"type","string"),(0,St.validateProperty)(i,"name","string"),(0,St.validateProperty)(i,"path","string"),(0,St.validateProperty)(i,"kernel","object"),(0,Tc.validateModel)(i.kernel)}function qc(i){i.path===void 0&&i.notebook!==void 0&&(i.path=i.notebook.path,i.type="notebook",i.name="")}function Ac(i){if(!Array.isArray(i))throw new Error("Invalid session list");i.forEach(e=>ia(e))}});var En=E(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.SessionAPIClient=he.SESSION_SERVICE_URL=void 0;he.listRunning=ra;he.getSessionUrl=Mn;he.shutdownSession=aa;he.getSessionModel=oa;he.startSession=la;he.updateSession=ca;var re=de(),Pn=Y(),He=sa();he.SESSION_SERVICE_URL="api/sessions";async function ra(i=re.ServerConnection.makeSettings()){let e=Pn.URLExt.join(i.baseUrl,he.SESSION_SERVICE_URL),t=await re.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await re.ServerConnection.ResponseError.create(t);let n=await t.json();if(!Array.isArray(n))throw new Error("Invalid Session list");return n.forEach(s=>{(0,He.updateLegacySessionModel)(s),(0,He.validateModel)(s)}),n}function Mn(i,e){let t=Pn.URLExt.join(i,he.SESSION_SERVICE_URL),n=Pn.URLExt.join(t,e);if(!n.startsWith(t))throw new Error("Can only be used for services requests");return n}async function aa(i,e=re.ServerConnection.makeSettings()){var t;let n=Mn(e.baseUrl,i),s={method:"DELETE"},r=await re.ServerConnection.makeRequest(n,s,e);if(r.status===404){let o=(t=(await r.json()).message)!==null&&t!==void 0?t:`The session "${i}"" does not exist on the server`;console.warn(o)}else{if(r.status===410)throw new re.ServerConnection.ResponseError(r,"The kernel was deleted but the session was not");if(r.status!==204)throw await re.ServerConnection.ResponseError.create(r)}}async function oa(i,e=re.ServerConnection.makeSettings()){let t=Mn(e.baseUrl,i),n=await re.ServerConnection.makeRequest(t,{},e);if(n.status!==200)throw await re.ServerConnection.ResponseError.create(n);let s=await n.json();return(0,He.updateLegacySessionModel)(s),(0,He.validateModel)(s),s}async function la(i,e=re.ServerConnection.makeSettings()){let t=Pn.URLExt.join(e.baseUrl,he.SESSION_SERVICE_URL),n={method:"POST",body:JSON.stringify(i)},s=await re.ServerConnection.makeRequest(t,n,e);if(s.status!==201)throw await re.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,He.updateLegacySessionModel)(r),(0,He.validateModel)(r),r}async function ca(i,e=re.ServerConnection.makeSettings()){let t=Mn(e.baseUrl,i.id),n={method:"PATCH",body:JSON.stringify(i)},s=await re.ServerConnection.makeRequest(t,n,e);if(s.status!==200)throw await re.ServerConnection.ResponseError.create(s);let r=await s.json();return(0,He.updateLegacySessionModel)(r),(0,He.validateModel)(r),r}var Ni=class{constructor(e){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:re.ServerConnection.makeSettings()}async listRunning(){return ra(this.serverSettings)}async getModel(e){return oa(e,this.serverSettings)}async startNew(e){return la(e,this.serverSettings)}async shutdown(e){return aa(e,this.serverSettings)}async update(e){return ca(e,this.serverSettings)}};he.SessionAPIClient=Ni});var da=E(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.SessionConnection=void 0;var Te=Z(),Uc=Ne(),Nc=te(),zc=En(),zi=class{constructor(e){var t,n,s,r,a;this._id="",this._path="",this._name="",this._type="",this._kernel=null,this._isDisposed=!1,this._disposed=new Te.Signal(this),this._kernelChanged=new Te.Signal(this),this._statusChanged=new Te.Signal(this),this._connectionStatusChanged=new Te.Signal(this),this._pendingInput=new Te.Signal(this),this._iopubMessage=new Te.Signal(this),this._unhandledMessage=new Te.Signal(this),this._anyMessage=new Te.Signal(this),this._propertyChanged=new Te.Signal(this),this._id=e.model.id,this._name=e.model.name,this._path=e.model.path,this._type=e.model.type,this._username=(t=e.username)!==null&&t!==void 0?t:"",this._clientId=(n=e.clientId)!==null&&n!==void 0?n:Nc.UUID.uuid4(),this._connectToKernel=e.connectToKernel,this._kernelConnectionOptions=(s=e.kernelConnectionOptions)!==null&&s!==void 0?s:{},this.serverSettings=(r=e.serverSettings)!==null&&r!==void 0?r:Uc.ServerConnection.makeSettings(),this._sessionAPIClient=(a=e.sessionAPIClient)!==null&&a!==void 0?a:new zc.SessionAPIClient({serverSettings:this.serverSettings}),this.setupKernel(e.model.kernel)}get disposed(){return this._disposed}get kernelChanged(){return this._kernelChanged}get statusChanged(){return this._statusChanged}get connectionStatusChanged(){return this._connectionStatusChanged}get pendingInput(){return this._pendingInput}get iopubMessage(){return this._iopubMessage}get unhandledMessage(){return this._unhandledMessage}get anyMessage(){return this._anyMessage}get propertyChanged(){return this._propertyChanged}get id(){return this._id}get kernel(){return this._kernel}get path(){return this._path}get type(){return this._type}get name(){return this._name}get model(){return{id:this.id,kernel:this.kernel&&{id:this.kernel.id,name:this.kernel.name},path:this._path,type:this._type,name:this._name}}get isDisposed(){return this._isDisposed}update(e){let t=this.model;if(this._path=e.path,this._name=e.name,this._type=e.type,this._kernel===null&&e.kernel!==null||this._kernel!==null&&e.kernel===null||this._kernel!==null&&e.kernel!==null&&this._kernel.id!==e.kernel.id){this._kernel!==null&&this._kernel.dispose();let n=this._kernel||null;this.setupKernel(e.kernel);let s=this._kernel||null;this._kernelChanged.emit({name:"kernel",oldValue:n,newValue:s})}this._handleModelChange(t)}dispose(){if(!this.isDisposed){if(this._isDisposed=!0,this._disposed.emit(),this._kernel){this._kernel.dispose();let e=this._kernel;this._kernel=null;let t=this._kernel;this._kernelChanged.emit({name:"kernel",oldValue:e,newValue:t})}Te.Signal.clearData(this)}}async setPath(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({path:e})}async setName(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({name:e})}async setType(e){if(this.isDisposed)throw new Error("Session is disposed");await this._patch({type:e})}async changeKernel(e){if(this.isDisposed)throw new Error("Session is disposed");return await this._patch({kernel:e}),this.kernel}async shutdown(){if(this.isDisposed)throw new Error("Session is disposed");await this._sessionAPIClient.shutdown(this.id),this.dispose()}setupKernel(e){if(e===null){this._kernel=null;return}let t=this._connectToKernel({...this._kernelConnectionOptions,model:e,username:this._username,clientId:this._clientId,serverSettings:this.serverSettings});this._kernel=t,t.statusChanged.connect(this.onKernelStatus,this),t.connectionStatusChanged.connect(this.onKernelConnectionStatus,this),t.pendingInput.connect(this.onPendingInput,this),t.unhandledMessage.connect(this.onUnhandledMessage,this),t.iopubMessage.connect(this.onIOPubMessage,this),t.anyMessage.connect(this.onAnyMessage,this)}onKernelStatus(e,t){this._statusChanged.emit(t)}onKernelConnectionStatus(e,t){this._connectionStatusChanged.emit(t)}onPendingInput(e,t){this._pendingInput.emit(t)}onIOPubMessage(e,t){this._iopubMessage.emit(t)}onUnhandledMessage(e,t){this._unhandledMessage.emit(t)}onAnyMessage(e,t){this._anyMessage.emit(t)}async _patch(e){let t=await this._sessionAPIClient.update({...e,id:this._id});return this.update(t),t}_handleModelChange(e){e.name!==this._name&&this._propertyChanged.emit("name"),e.type!==this._type&&this._propertyChanged.emit("type"),e.path!==this._path&&this._propertyChanged.emit("path")}};In.SessionConnection=zi});var pa=E(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.SessionManager=void 0;var Lc=Xe(),ua=Z(),Fc=de(),Kc=Ye(),Bc=da(),Vc=En(),Ct=class extends Kc.BaseManager{constructor(e){var t,n;super(e),this._isReady=!1,this._sessionConnections=new Set,this._models=new Map,this._runningChanged=new ua.Signal(this),this._connectionFailure=new ua.Signal(this),this._connectToKernel=s=>this._kernelManager.connectTo(s),this._kernelManager=e.kernelManager,this._sessionAPIClient=(t=e.sessionAPIClient)!==null&&t!==void 0?t:new Vc.SessionAPIClient({serverSettings:e.serverSettings}),this._pollModels=new Lc.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:SessionManager#models",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._kernelManager.isActive&&await this._kernelManager.ready,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._models.clear(),this._sessionConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}connectTo(e){let t=new Bc.SessionConnection({...e,connectToKernel:this._connectToKernel,serverSettings:this.serverSettings,sessionAPIClient:this._sessionAPIClient});return this._onStarted(t),this._models.has(e.model.id)||this.refreshRunning().catch(()=>{}),t}running(){return this._models.values()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e,t={}){let n=await this._sessionAPIClient.startNew(e);return await this.refreshRunning(),this.connectTo({...t,model:n})}async shutdown(e){await this._sessionAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all([...this._models.keys()].map(e=>this._sessionAPIClient.shutdown(e))),await this.refreshRunning()}async stopIfNeeded(e){try{let n=(await this._sessionAPIClient.listRunning()).filter(s=>s.path===e);if(n.length===1){let s=n[0].id;await this.shutdown(s)}}catch{}}async findById(e){return this._models.has(e)?this._models.get(e):(await this.refreshRunning(),this._models.get(e))}async findByPath(e){for(let t of this._models.values())if(t.path===e)return t;await this.refreshRunning();for(let t of this._models.values())if(t.path===e)return t}async requestRunning(){var e,t;let n;try{n=await this._sessionAPIClient.listRunning()}catch(s){throw(s instanceof Fc.ServerConnection.NetworkError||((e=s.response)===null||e===void 0?void 0:e.status)===503||((t=s.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(s),s}this.isDisposed||this._models.size===n.length&&n.every(s=>{var r,a,o,u;let c=this._models.get(s.id);return c?((r=c.kernel)===null||r===void 0?void 0:r.id)===((a=s.kernel)===null||a===void 0?void 0:a.id)&&((o=c.kernel)===null||o===void 0?void 0:o.name)===((u=s.kernel)===null||u===void 0?void 0:u.name)&&c.name===s.name&&c.path===s.path&&c.type===s.type:!1})||(this._models=new Map(n.map(s=>[s.id,s])),this._sessionConnections.forEach(s=>{this._models.has(s.id)?s.update(this._models.get(s.id)):s.dispose()}),this._runningChanged.emit(n))}_onStarted(e){this._sessionConnections.add(e),e.disposed.connect(this._onDisposed,this),e.propertyChanged.connect(this._onChanged,this),e.kernelChanged.connect(this._onChanged,this)}_onDisposed(e){this._sessionConnections.delete(e),this.refreshRunning().catch(()=>{})}_onChanged(){this.refreshRunning().catch(()=>{})}};kt.SessionManager=Ct;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}async startNew(n,s={}){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}connectTo(n){throw Error("Not implemented in no-op Session Manager")}get ready(){return this.parentReady.then(()=>this._readyPromise)}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Session Manager"))}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(Ct||(kt.SessionManager=Ct={}))});var Li=E(fe=>{"use strict";var ha=fe&&fe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),$c=fe&&fe.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),fa=fe&&fe.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&ha(e,i,t);return $c(e,i),e},Wc=fe&&fe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ha(e,i,t)};Object.defineProperty(fe,"__esModule",{value:!0});fe.SessionAPI=fe.Session=void 0;var Jc=fa(na());fe.Session=Jc;var Hc=fa(En());fe.SessionAPI=Hc;Wc(pa(),fe)});var ma=E(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.DataConnector=void 0;var Fi=class{async list(e){throw new Error("DataConnector#list method has not been implemented.")}async remove(e){throw new Error("DataConnector#remove method has not been implemented.")}async save(e,t){throw new Error("DataConnector#save method has not been implemented.")}};Rn.DataConnector=Fi});var _a=E(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0})});var ya=E((On,va)=>{(function(i,e){typeof On=="object"&&typeof va!="undefined"?e(On):typeof define=="function"&&define.amd?define(["exports"],e):(i=typeof globalThis!="undefined"?globalThis:i||self,e(i.lumino_properties={}))})(On,function(i){"use strict";class e{constructor(s){this._pid=t.nextPID(),this.name=s.name,this._create=s.create,this._coerce=s.coerce||null,this._compare=s.compare||null,this._changed=s.changed||null}get(s){let r,a=t.ensureMap(s);return this._pid in a?r=a[this._pid]:r=a[this._pid]=this._createValue(s),r}set(s,r){let a,o=t.ensureMap(s);this._pid in o?a=o[this._pid]:a=o[this._pid]=this._createValue(s);let u=this._coerceValue(s,r);this._maybeNotify(s,a,o[this._pid]=u)}coerce(s){let r,a=t.ensureMap(s);this._pid in a?r=a[this._pid]:r=a[this._pid]=this._createValue(s);let o=this._coerceValue(s,r);this._maybeNotify(s,r,a[this._pid]=o)}_createValue(s){let r=this._create;return r(s)}_coerceValue(s,r){let a=this._coerce;return a?a(s,r):r}_compareValue(s,r){let a=this._compare;return a?a(s,r):s===r}_maybeNotify(s,r,a){let o=this._changed;o&&!this._compareValue(r,a)&&o(s,r,a)}}(function(n){function s(r){t.ownerData.delete(r)}n.clearData=s})(e||(e={}));var t;(function(n){n.ownerData=new WeakMap,n.nextPID=(()=>{let r=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${r++}`})();function s(r){let a=n.ownerData.get(r);return a||(a=Object.create(null),n.ownerData.set(r,a),a)}n.ensureMap=s})(t||(t={})),i.AttachedProperty=e})});var ba=E(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.RestorablePool=void 0;var Gc=te(),wa=ya(),Dn=Z(),Ki=class{constructor(e){this._added=new Dn.Signal(this),this._current=null,this._currentChanged=new Dn.Signal(this),this._hasRestored=!1,this._isDisposed=!1,this._objects=new Set,this._restore=null,this._restored=new Gc.PromiseDelegate,this._updated=new Dn.Signal(this),this.namespace=e.namespace}get added(){return this._added}get current(){return this._current}set current(e){this._current!==e&&e!==null&&this._objects.has(e)&&(this._current=e,this._currentChanged.emit(this._current))}get currentChanged(){return this._currentChanged}get isDisposed(){return this._isDisposed}get restored(){return this._restored.promise}get size(){return this._objects.size}get updated(){return this._updated}async add(e){var t,n;if(e.isDisposed){let s="A disposed object cannot be added.";throw console.warn(s,e),new Error(s)}if(this._objects.has(e)){let s="This object already exists in the pool.";throw console.warn(s,e),new Error(s)}if(this._objects.add(e),e.disposed.connect(this._onInstanceDisposed,this),!qe.injectedProperty.get(e)){if(this._restore){let{connector:s}=this._restore,r=this._restore.name(e);if(r){let a=`${this.namespace}:${r}`,o=(n=(t=this._restore).args)===null||n===void 0?void 0:n.call(t,e);qe.nameProperty.set(e,a),await s.save(a,{data:o})}}this._added.emit(e)}}dispose(){this.isDisposed||(this._current=null,this._isDisposed=!0,this._objects.clear(),Dn.Signal.clearData(this))}find(e){let t=this._objects.values();for(let n of t)if(e(n))return n}forEach(e){this._objects.forEach(e)}filter(e){let t=[];return this.forEach(n=>{e(n)&&t.push(n)}),t}inject(e){return qe.injectedProperty.set(e,!0),this.add(e)}has(e){return this._objects.has(e)}async restore(e){if(this._hasRestored)throw new Error("This pool has already been restored.");this._hasRestored=!0;let{command:t,connector:n,registry:s,when:r}=e,a=this.namespace,o=r?[n.list(a)].concat(r):[n.list(a)];this._restore=e;let[u]=await Promise.all(o),c=await Promise.all(u.ids.map(async(d,l)=>{let p=u.values[l],v=p&&p.data;return v===void 0?n.remove(d):s.execute(t,v).catch(()=>n.remove(d))}));return this._restored.resolve(),c}async save(e){var t,n;let s=qe.injectedProperty.get(e);if(!this._restore||!this.has(e)||s)return;let{connector:r}=this._restore,a=this._restore.name(e),o=qe.nameProperty.get(e),u=a?`${this.namespace}:${a}`:"";if(o&&o!==u&&await r.remove(o),qe.nameProperty.set(e,u),u){let c=(n=(t=this._restore).args)===null||n===void 0?void 0:n.call(t,e);await r.save(u,{data:c})}o!==u&&this._updated.emit(e)}_onInstanceDisposed(e){if(this._objects.delete(e),e===this._current&&(this._current=null,this._currentChanged.emit(this._current)),qe.injectedProperty.get(e)||!this._restore)return;let{connector:t}=this._restore,n=qe.nameProperty.get(e);n&&t.remove(n)}};jn.RestorablePool=Ki;var qe;(function(i){i.injectedProperty=new wa.AttachedProperty({name:"injected",create:()=>!1}),i.nameProperty=new wa.AttachedProperty({name:"name",create:()=>""})})(qe||(qe={}))});var Sa=E(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.StateDB=void 0;var Yc=Z(),Pt=class i{constructor(e={}){this._changed=new Yc.Signal(this);let{connector:t,transform:n}=e;this._connector=t||new i.Connector,n?this._ready=n.then(s=>{let{contents:r,type:a}=s;switch(a){case"cancel":return;case"clear":return this._clear();case"merge":return this._merge(r||{});case"overwrite":return this._overwrite(r||{});default:return}}):this._ready=Promise.resolve(void 0)}get changed(){return this._changed}async clear(){await this._ready,await this._clear()}async fetch(e){return await this._ready,this._fetch(e)}async list(e){return await this._ready,this._list(e)}async remove(e){await this._ready,await this._remove(e),this._changed.emit({id:e,type:"remove"})}async save(e,t){await this._ready,await this._save(e,t),this._changed.emit({id:e,type:"save"})}async toJSON(){await this._ready;let{ids:e,values:t}=await this._list();return t.reduce((n,s,r)=>(n[e[r]]=s,n),{})}async _clear(){await Promise.all((await this._list()).ids.map(e=>this._remove(e)))}async _fetch(e){let t=await this._connector.fetch(e);if(t)return JSON.parse(t).v}async _list(e=""){let{ids:t,values:n}=await this._connector.list(e);return{ids:t,values:n.map(s=>JSON.parse(s).v)}}async _merge(e){await Promise.all(Object.keys(e).map(t=>e[t]&&this._save(t,e[t])))}async _overwrite(e){await this._clear(),await this._merge(e)}async _remove(e){return this._connector.remove(e)}async _save(e,t){return this._connector.save(e,JSON.stringify({v:t}))}};Mt.StateDB=Pt;(function(i){class e{constructor(){this._storage={}}async fetch(n){return this._storage[n]}async list(n=""){return Object.keys(this._storage).reduce((s,r)=>((n===""||n===r.split(":")[0])&&(s.ids.push(r),s.values.push(this._storage[r])),s),{ids:[],values:[]})}async remove(n){delete this._storage[n]}async save(n,s){this._storage[n]=s}}i.Connector=e})(Pt||(Mt.StateDB=Pt={}))});var xa=E(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.IStateDB=void 0;var Xc=te();Tn.IStateDB=new Xc.Token("@jupyterlab/coreutils:IStateDB",`A service for the JupyterLab state database.
8
8
  Use this if you want to store data that will persist across page loads.
9
- See "state database" for more information.`)});var Ki=E(xe=>{"use strict";var ed=xe&&xe.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Pt=xe&&xe.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ed(e,i,t)};Object.defineProperty(xe,"__esModule",{value:!0});Pt(fa(),xe);Pt(ga(),xe);Pt(wa(),xe);Pt(ba(),xe);Pt(Sa(),xe)});var $i=E(Tn=>{"use strict";Object.defineProperty(Tn,"__esModule",{value:!0});Tn.SettingManager=void 0;var Bi=G(),td=Ki(),jn=de(),nd="api/settings",Vi=class extends td.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:jn.ServerConnection.makeSettings()}async fetch(e){if(!e)throw new Error("Plugin `id` parameter is required for settings fetch.");let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=jn.ServerConnection,o=n+s,u=Mt.url(o,e),c=await r(u,{},t);if(c.status!==200)throw await a.create(c);return c.json()}async list(e){var t,n,s,r;let{serverSettings:a}=this,{baseUrl:o,appUrl:u}=a,{makeRequest:c,ResponseError:d}=jn.ServerConnection,l=o+u,p=Mt.url(l,"",e==="ids"),v=await c(p,{},a);if(v.status!==200)throw new d(v);let _=await v.json(),I=(n=(t=_==null?void 0:_.settings)===null||t===void 0?void 0:t.map(D=>D.id))!==null&&n!==void 0?n:[],P=[];return e||(P=(r=(s=_==null?void 0:_.settings)===null||s===void 0?void 0:s.map(D=>(D.data={composite:{},user:{}},D)))!==null&&r!==void 0?r:[]),{ids:I,values:P}}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=jn.ServerConnection,u=s+r,c=Mt.url(u,e),d={body:JSON.stringify({raw:t}),method:"PUT"},l=await a(c,d,n);if(l.status!==204)throw new o(l)}};Tn.SettingManager=Vi;var Mt;(function(i){function e(t,n,s){let r=s?Bi.URLExt.objectToQueryString({ids_only:!0}):"",a=Bi.URLExt.join(t,nd),o=Bi.URLExt.join(a,n);if(!o.startsWith(a))throw new Error("Can only be used for workspaces requests");return`${o}${r}`}i.url=e})(Mt||(Mt={}))});var It=E(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.TERMINAL_SERVICE_URL=void 0;Ce.isAvailable=xa;Ce.startNew=id;Ce.listRunning=sd;Ce.shutdownTerminal=rd;var Et=G(),Fe=de();Ce.TERMINAL_SERVICE_URL="api/terminals";function xa(){return String(Et.PageConfig.getOption("terminalsAvailable")).toLowerCase()==="true"}async function id(i=Fe.ServerConnection.makeSettings(),e,t){Rt.errorIfNotAvailable();let n=Et.URLExt.join(i.baseUrl,Ce.TERMINAL_SERVICE_URL),s={method:"POST",body:JSON.stringify({name:e,cwd:t})},r=await Fe.ServerConnection.makeRequest(n,s,i);if(r.status!==200)throw await Fe.ServerConnection.ResponseError.create(r);return await r.json()}async function sd(i=Fe.ServerConnection.makeSettings()){Rt.errorIfNotAvailable();let e=Et.URLExt.join(i.baseUrl,Ce.TERMINAL_SERVICE_URL),t=await Fe.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Fe.ServerConnection.ResponseError.create(t);let n=await t.json();if(!Array.isArray(n))throw new Error("Invalid terminal list");return n}async function rd(i,e=Fe.ServerConnection.makeSettings()){var t;Rt.errorIfNotAvailable();let n=Et.URLExt.join(e.baseUrl,Ce.TERMINAL_SERVICE_URL),s=Et.URLExt.join(n,i);if(!s.startsWith(n))throw new Error("Can only be used for terminal requests");let r={method:"DELETE"},a=await Fe.ServerConnection.makeRequest(s,r,e);if(a.status===404){let u=(t=(await a.json()).message)!==null&&t!==void 0?t:`The terminal session "${i}"" does not exist on the server`;console.warn(u)}else if(a.status!==204)throw await Fe.ServerConnection.ResponseError.create(a)}var Rt;(function(i){function e(){if(!xa())throw new Error("Terminals Unavailable")}i.errorIfNotAvailable=e})(Rt||(Rt={}))});var Ca=E(qn=>{"use strict";Object.defineProperty(qn,"__esModule",{value:!0});qn.isAvailable=void 0;var ad=It();Object.defineProperty(qn,"isAvailable",{enumerable:!0,get:function(){return ad.isAvailable}})});var Ma=E(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.TerminalConnection=void 0;var ka=G(),od=te(),Un=X(),ld=Le(),Pa=It(),Wi=class i{constructor(e){var t;this._createSocket=()=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let n=this._name,s=this.serverSettings,r=ka.URLExt.join(s.wsUrl,"terminals","websocket",encodeURIComponent(n)),a=s.token;s.appendToken&&a!==""&&(r=r+`?token=${encodeURIComponent(a)}`),this._ws=new s.WebSocket(r),this._ws.onmessage=this._onWSMessage,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose},this._onWSMessage=n=>{if(this._isDisposed)return;let s=JSON.parse(n.data);if(s[0]==="disconnect"&&this.dispose(),this._connectionStatus==="connecting"){s[0]==="setup"&&this._updateConnectionStatus("connected");return}this._messageReceived.emit({type:s[0],content:s.slice(1)})},this._onWSClose=n=>{console.warn(`Terminal websocket closed: ${n.code}`),this.isDisposed||this._reconnect()},this._connectionStatus="connecting",this._connectionStatusChanged=new Un.Signal(this),this._isDisposed=!1,this._disposed=new Un.Signal(this),this._messageReceived=new Un.Signal(this),this._reconnectTimeout=null,this._ws=null,this._noOp=()=>{},this._reconnectLimit=7,this._reconnectAttempt=0,this._pendingMessages=[],this._name=e.model.name,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:ld.ServerConnection.makeSettings(),this._createSocket()}get disposed(){return this._disposed}get messageReceived(){return this._messageReceived}get name(){return this._name}get model(){return{name:this._name}}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearSocket(),Un.Signal.clearData(this))}send(e){this._sendMessage(e)}_sendMessage(e,t=!0){if(!(this._isDisposed||!e.content))if(this.connectionStatus==="connected"&&this._ws){let n=[e.type,...e.content];this._ws.send(JSON.stringify(n))}else if(t)this._pendingMessages.push(e);else throw new Error(`Could not send message: ${JSON.stringify(e)}`)}_sendPending(){for(;this.connectionStatus==="connected"&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}reconnect(){this._errorIfDisposed();let e=new od.PromiseDelegate,t=(n,s)=>{s==="connected"?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):s==="disconnected"&&(e.reject(new Error("Terminal connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");let e=Ji.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.error(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`),this._reconnectTimeout=setTimeout(this._createSocket,e),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_clearSocket(){this._ws!==null&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}async shutdown(){await(0,Pa.shutdownTerminal)(this.name,this.serverSettings),this.dispose()}clone(){return new i(this)}_updateConnectionStatus(e){this._connectionStatus!==e&&(this._connectionStatus=e,e!=="connecting"&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),e==="connected"&&this._sendPending(),this._connectionStatusChanged.emit(e))}_errorIfDisposed(){if(this.isDisposed)throw new Error("Terminal connection is disposed")}get connectionStatusChanged(){return this._connectionStatusChanged}get connectionStatus(){return this._connectionStatus}};An.TerminalConnection=Wi;var Ji;(function(i){function e(n,s){return ka.URLExt.join(n,Pa.TERMINAL_SERVICE_URL,encodeURIComponent(s))}i.getTermUrl=e;function t(n,s){return n=Math.ceil(n),s=Math.floor(s),Math.floor(Math.random()*(s-n+1))+n}i.getRandomIntInclusive=t})(Ji||(Ji={}))});var Ra=E(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.TerminalManager=void 0;var cd=Qe(),Ea=X(),dd=Le(),ud=Ze(),Ot=It(),pd=Ma(),Dt=class extends ud.BaseManager{constructor(e={}){var t;if(super(e),this._isReady=!1,this._names=[],this._terminalConnections=new Set,this._runningChanged=new Ea.Signal(this),this._connectionFailure=new Ea.Signal(this),!this.isAvailable()){this._ready=Promise.reject("Terminals unavailable"),this._ready.catch(n=>{});return}this._pollModels=new cd.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:TerminalManager#models",standby:(t=e.standby)!==null&&t!==void 0?t:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._names.length=0,this._terminalConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}isAvailable(){return(0,Ot.isAvailable)()}connectTo(e){let t=new pd.TerminalConnection({...e,serverSettings:this.serverSettings});return this._onStarted(t),this._names.includes(e.model.name)||this.refreshRunning().catch(()=>{}),t}running(){return this._models[Symbol.iterator]()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e){let t=await(0,Ot.startNew)(this.serverSettings,e==null?void 0:e.name,e==null?void 0:e.cwd);return await this.refreshRunning(),this.connectTo({model:t})}async shutdown(e){await(0,Ot.shutdownTerminal)(e,this.serverSettings),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all(this._names.map(e=>(0,Ot.shutdownTerminal)(e,this.serverSettings))),await this.refreshRunning()}async requestRunning(){var e,t;let n;try{n=await(0,Ot.listRunning)(this.serverSettings)}catch(r){throw(r instanceof dd.ServerConnection.NetworkError||((e=r.response)===null||e===void 0?void 0:e.status)===503||((t=r.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(r),r}if(this.isDisposed)return;let s=n.map(({name:r})=>r).sort();s!==this._names&&(this._names=s,this._terminalConnections.forEach(r=>{s.includes(r.name)||r.dispose()}),this._runningChanged.emit(this._models))}_onStarted(e){this._terminalConnections.add(e),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._terminalConnections.delete(e),this.refreshRunning().catch(()=>{})}get _models(){return this._names.map(e=>({name:e}))}};jt.TerminalManager=Dt;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}get ready(){return this.parentReady.then(()=>this._readyPromise)}async startNew(n){return Promise.reject(new Error("Not implemented in no-op Terminal Manager"))}connectTo(n){throw Error("Not implemented in no-op Terminal Manager")}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Terminal Manager"))}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(Dt||(jt.TerminalManager=Dt={}))});var Hi=E(me=>{"use strict";var Ia=me&&me.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),hd=me&&me.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Oa=me&&me.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Ia(e,i,t);return hd(e,i),e},fd=me&&me.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ia(e,i,t)};Object.defineProperty(me,"__esModule",{value:!0});me.TerminalAPI=me.Terminal=void 0;var md=Oa(Ca());me.Terminal=md;var gd=Oa(It());me.TerminalAPI=gd;fd(Ra(),me)});var Zi=E(Nn=>{"use strict";Object.defineProperty(Nn,"__esModule",{value:!0});Nn.UserManager=void 0;var _d=G(),vd=te(),yd=Qe(),Da=X(),wd=de(),bd=Ze(),Sd="api/me",Gi="@jupyterlab/services:UserManager#user",Yi=class extends bd.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._userChanged=new Da.Signal(this),this._connectionFailure=new Da.Signal(this),this._ready=this.requestUser().then(()=>{this.isDisposed||(this._isReady=!0)}).catch(n=>new Promise(()=>{})),this._pollSpecs=new yd.Poll({auto:!1,factory:()=>this.requestUser(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:Gi,standby:(t=e.standby)!==null&&t!==void 0?t:"when-hidden"}),this.ready.then(()=>{this._pollSpecs.start()})}get isReady(){return this._isReady}get ready(){return this._ready}get identity(){return this._identity}get permissions(){return this._permissions}get userChanged(){return this._userChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshUser(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestUser(){if(this.isDisposed)return;let{baseUrl:e}=this.serverSettings,{makeRequest:t,ResponseError:n}=wd.ServerConnection,s=_d.URLExt.join(e,Sd),r=await t(s,{},this.serverSettings);if(r.status!==200)throw await n.create(r);let a={identity:this._identity,permissions:this._permissions},o=await r.json(),u=o.identity,{localStorage:c}=window,d=c.getItem(Gi);if(d&&(!u.initials||!u.color)){let l=JSON.parse(d);u.initials=u.initials||l.initials||u.name.substring(0,1),u.color=u.color||l.color||Xi.getRandomColor()}vd.JSONExt.deepEqual(o,a)||(this._identity=u,this._permissions=o.permissions,c.setItem(Gi,JSON.stringify(u)),this._userChanged.emit(o))}};Nn.UserManager=Yi;var Xi;(function(i){let e=["var(--jp-collaborator-color1)","var(--jp-collaborator-color2)","var(--jp-collaborator-color3)","var(--jp-collaborator-color4)","var(--jp-collaborator-color5)","var(--jp-collaborator-color6)","var(--jp-collaborator-color7)"];i.getRandomColor=()=>e[Math.floor(Math.random()*e.length)]})(Xi||(Xi={}))});var es=E(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.WorkspaceManager=void 0;var ja=G(),xd=Ki(),Tt=de(),Cd="api/workspaces",Qi=class extends xd.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Tt.ServerConnection.makeSettings()}async fetch(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=Tt.ServerConnection,o=n+s,u=dt.url(o,e),c=await r(u,{},t);if(c.status!==200)throw await a.create(c);return c.json()}async list(){let{serverSettings:e}=this,{baseUrl:t,appUrl:n}=e,{makeRequest:s,ResponseError:r}=Tt.ServerConnection,a=t+n,o=dt.url(a,""),u=await s(o,{},e);if(u.status!==200)throw await r.create(u);return(await u.json()).workspaces}async remove(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=Tt.ServerConnection,o=n+s,u=dt.url(o,e),d=await r(u,{method:"DELETE"},t);if(d.status!==204)throw await a.create(d)}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=Tt.ServerConnection,u=s+r,c=dt.url(u,e),d={body:JSON.stringify(t),method:"PUT"},l=await a(c,d,n);if(l.status!==204)throw await o.create(l)}};Ln.WorkspaceManager=Qi;var dt;(function(i){function e(t,n){let s=ja.URLExt.join(t,Cd),r=ja.URLExt.join(s,n);if(!r.startsWith(s))throw new Error("Can only be used for workspaces requests");return r}i.url=e})(dt||(dt={}))});var qa=E(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.ServiceManager=void 0;var Ta=X(),kd=Qr(),Pd=_i(),Md=yi(),Ed=Oi(),Rd=bn(),Id=Ui(),Od=de(),Dd=Li(),jd=$i(),Td=Hi(),qd=Zi(),Ud=es(),ts=class{constructor(e={}){var t,n;this._isDisposed=!1,this._connectionFailure=new Ta.Signal(this),this._isReady=!1;let s=e.defaultDrive,r=(t=e.serverSettings)!==null&&t!==void 0?t:Od.ServerConnection.makeSettings(),a=(n=e.standby)!==null&&n!==void 0?n:"when-hidden",o={defaultDrive:s,serverSettings:r,standby:a};this.serverSettings=r,this.contents=e.contents||new Pd.ContentsManager(o),this.events=e.events||new Md.EventManager(o),this.kernels=e.kernels||new Ed.KernelManager(o),this.sessions=e.sessions||new Dd.SessionManager({...o,kernelManager:this.kernels}),this.settings=e.settings||new jd.SettingManager(o),this.terminals=e.terminals||new Td.TerminalManager(o),this.builder=e.builder||new kd.BuildManager(o),this.workspaces=e.workspaces||new Ud.WorkspaceManager(o),this.nbconvert=e.nbconvert||new Id.NbConvertManager(o),this.kernelspecs=e.kernelspecs||new Rd.KernelSpecManager(o),this.user=e.user||new qd.UserManager(o),this.kernelspecs.connectionFailure.connect(this._onConnectionFailure,this),this.sessions.connectionFailure.connect(this._onConnectionFailure,this),this.terminals.connectionFailure.connect(this._onConnectionFailure,this);let u=[this.sessions.ready,this.kernelspecs.ready];this.terminals.isAvailable()&&u.push(this.terminals.ready),this._readyPromise=Promise.all(u).then(()=>{this._isReady=!0})}get connectionFailure(){return this._connectionFailure}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,Ta.Signal.clearData(this),this.contents.dispose(),this.events.dispose(),this.sessions.dispose(),this.terminals.dispose())}get isReady(){return this._isReady}get ready(){return this._readyPromise}_onConnectionFailure(e,t){this._connectionFailure.emit(t)}};zn.ServiceManager=ts});var Ua=E(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.IWorkspaceManager=L.IUserManager=L.ITerminalManager=L.IServiceManager=L.ISettingManager=L.ISessionManager=L.IServerSettings=L.INbConvertManager=L.IKernelSpecManager=L.IKernelManager=L.IEventManager=L.IDefaultDrive=L.IContentsManager=L.IConfigSectionManager=L.IConnectionStatus=void 0;var ge=te();L.IConnectionStatus=new ge.Token("@jupyterlab/application:IConnectionStatus","A service providing the application connection status.");L.IConfigSectionManager=new ge.Token("@jupyterlab/services:IConfigSectionManager","A service providing the config section manager.");L.IContentsManager=new ge.Token("@jupyterlab/services:IContentsManager","The contents manager token.");L.IDefaultDrive=new ge.Token("@jupyterlab/services:IDefaultDrive","The default drive for the contents manager.");L.IEventManager=new ge.Token("@jupyterlab/services:IEventManager","The event manager token.");L.IKernelManager=new ge.Token("@jupyterlab/services:IKernelManager","The kernel manager token.");L.IKernelSpecManager=new ge.Token("@jupyterlab/services:IKernelSpecManager","The kernel spec manager token.");L.INbConvertManager=new ge.Token("@jupyterlab/services:INbConvertManager","The nbconvert manager token.");L.IServerSettings=new ge.Token("@jupyterlab/services:IServerSettings","The server settings for the application.");L.ISessionManager=new ge.Token("@jupyterlab/services:ISessionManager","The session manager token.");L.ISettingManager=new ge.Token("@jupyterlab/services:ISettingManager","The setting manager token.");L.IServiceManager=new ge.Token("@jupyterlab/services:IServiceManager","The service manager for the application.");L.ITerminalManager=new ge.Token("@jupyterlab/services:ITerminalManager","The terminal manager token.");L.IUserManager=new ge.Token("@jupyterlab/services:IUserManager","The user manager token.");L.IWorkspaceManager=new ge.Token("@jupyterlab/services:IWorkspaceManager","The workspace manager token.")});var Le=E(W=>{"use strict";var Ad=W&&W.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),le=W&&W.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Ad(e,i,t)};Object.defineProperty(W,"__esModule",{value:!0});le(Ze(),W);le(hr(),W);le(fr(),W);le(_i(),W);le(yi(),W);le(Oi(),W);le(bn(),W);le(qa(),W);le(de(),W);le(Li(),W);le($i(),W);le(Hi(),W);le(Ua(),W);le(Zi(),W);le(es(),W);le(Ui(),W)});var Na=E((tp,Aa)=>{"use strict";function Fn(){this._types=Object.create(null),this._extensions=Object.create(null);for(let i=0;i<arguments.length;i++)this.define(arguments[i]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}Fn.prototype.define=function(i,e){for(let t in i){let n=i[t].map(function(s){return s.toLowerCase()});t=t.toLowerCase();for(let s=0;s<n.length;s++){let r=n[s];if(r[0]!=="*"){if(!e&&r in this._types)throw new Error('Attempt to change mapping for "'+r+'" extension from "'+this._types[r]+'" to "'+t+'". Pass `force=true` to allow this, otherwise remove "'+r+'" from the list of extensions for "'+t+'".');this._types[r]=t}}if(e||!this._extensions[t]){let s=n[0];this._extensions[t]=s[0]!=="*"?s:s.substr(1)}}};Fn.prototype.getType=function(i){i=String(i);let e=i.replace(/^.*[/\\]/,"").toLowerCase(),t=e.replace(/^.*\./,"").toLowerCase(),n=e.length<i.length;return(t.length<e.length-1||!n)&&this._types[t]||null};Fn.prototype.getExtension=function(i){return i=/^\s*([^;\s]*)/.test(i)&&RegExp.$1,i&&this._extensions[i.toLowerCase()]||null};Aa.exports=Fn});var za=E((np,La)=>{La.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}});var Ka=E((ip,Fa)=>{Fa.exports={"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.sap.vds":["vds"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]}});var Va=E((sp,Ba)=>{"use strict";var Nd=Na();Ba.exports=new Nd(za(),Ka())});var $a,Wa,Ja,ve,Ae,Ld,ns=Ye(()=>{$a=Ne(G()),Wa=Ne(te()),Ja=Ne(Va());(function(i){i.JSON="application/json",i.PLAIN_TEXT="text/plain",i.OCTET_STREAM="octet/stream"})(ve||(ve={}));(function(i){let e=JSON.parse($a.PageConfig.getOption("fileTypes")||"{}");function t(s,r=null){s=s.toLowerCase();for(let a of Object.values(e))for(let o of a.extensions||[])if(o===s&&a.mimeTypes&&a.mimeTypes.length)return a.mimeTypes[0];return Ja.default.getType(s)||r||ve.OCTET_STREAM}i.getType=t;function n(s,r){s=s.toLowerCase();for(let a of Object.values(e))if(a.fileFormat===r){for(let o of a.extensions||[])if(o===s)return!0}return!1}i.hasFormat=n})(Ae||(Ae={}));Ld=new Wa.Token("@jupyterlite/contents:IBroadcastChannelWrapper")});var Ke,Ya,be,Xa,ss,Ha,Za,Ga,qt,is,rs,Kn,Qa=Ye(()=>{Ke=Ne(G()),Ya=Ne(Le()),be=Ne(G()),Xa=Ne(te()),ss=Ne(X());ns();Ha="JupyterLite Storage",Za="BrowserStorage",Ga=5,qt=new TextEncoder,is=new TextDecoder("utf-8"),rs=class{constructor(e){var t;this.reduceBytesToString=(n,s)=>n+String.fromCharCode(s),this._serverContents=new Map,this._isDisposed=!1,this._fileChanged=new ss.Signal(this),this._storageName=Ha,this._storageDrivers=null,this._localforage=e.localforage,this._storageName=e.storageName||Ha,this._storageDrivers=e.storageDrivers||null,this._serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ya.ServerConnection.makeSettings(),this._ready=new Xa.PromiseDelegate,this.initialize().catch(console.warn)}dispose(){this.isDisposed||(this._isDisposed=!0,ss.Signal.clearData(this))}get isDisposed(){return this._isDisposed}get name(){return Za}get serverSettings(){return this._serverSettings}get fileChanged(){return this._fileChanged}async getDownloadUrl(e){throw new Error("Method not implemented.")}async initialize(){await this.initStorage(),this._ready.resolve(void 0)}async initStorage(){this._storage=this.createDefaultStorage(),this._counters=this.createDefaultCounters(),this._checkpoints=this.createDefaultCheckpoints()}get ready(){return this._ready.promise}get storage(){return this.ready.then(()=>this._storage)}get counters(){return this.ready.then(()=>this._counters)}get checkpoints(){return this.ready.then(()=>this._checkpoints)}get defaultStorageOptions(){let e=this._storageDrivers&&this._storageDrivers.length?this._storageDrivers:null;return{version:1,name:this._storageName,...e?{driver:e}:{}}}createDefaultStorage(){return this._localforage.createInstance({description:"Offline Storage for Notebooks and Files",storeName:"files",...this.defaultStorageOptions})}createDefaultCounters(){return this._localforage.createInstance({description:"Store the current file suffix counters",storeName:"counters",...this.defaultStorageOptions})}createDefaultCheckpoints(){return this._localforage.createInstance({description:"Offline Storage for Checkpoints",storeName:"checkpoints",...this.defaultStorageOptions})}async newUntitled(e){var t,n,s;let r=(t=e==null?void 0:e.path)!==null&&t!==void 0?t:"",a=(n=e==null?void 0:e.type)!==null&&n!==void 0?n:"notebook",o=new Date().toISOString(),u=be.PathExt.dirname(r),c=be.PathExt.basename(r),d=be.PathExt.extname(r),l=await this.get(u),p="";r&&!d&&l?(u=`${r}/`,p=""):u&&c?(u=`${u}/`,p=c):(u="",p=r);let v;switch(a){case"directory":{p=`Untitled Folder${await this._incrementCounter("directory")||""}`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:"",content:null,size:0,writable:!0,type:"directory"};break}case"notebook":{let I=await this._incrementCounter("notebook");p=p||`Untitled${I||""}.ipynb`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:ve.JSON,content:Kn.EMPTY_NB,size:qt.encode(JSON.stringify(Kn.EMPTY_NB)).length,writable:!0,type:"notebook"};break}default:{let I=(s=e==null?void 0:e.ext)!==null&&s!==void 0?s:".txt";I.startsWith(".")||(I=`.${I}`);let P=await this._incrementCounter("file"),D=Ae.getType(I)||ve.OCTET_STREAM,T;Ae.hasFormat(I,"text")||D.indexOf("text")!==-1?T="text":I.indexOf("json")!==-1||I.indexOf("ipynb")!==-1?T="json":T="base64",p=p||`untitled${P||""}${I}`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:T,mimetype:D,content:"",size:0,writable:!0,type:"file"};break}}let _=v.path;return await(await this.storage).setItem(_,v),this._fileChanged.emit({type:"new",oldValue:null,newValue:v}),v}async copy(e,t){let n=be.PathExt.basename(e);for(t=t===""?"":`${be.PathExt.removeSlash(t)}/`;await this.get(`${t}${n}`,{content:!0});){let a=be.PathExt.extname(n);n=`${n.replace(a,"")} (copy)${a}`}let s=`${t}${n}`,r=await this.get(e,{content:!0});if(!r)throw Error(`Could not find file with path ${e}`);return r={...r,name:n,path:s},await(await this.storage).setItem(s,r),this._fileChanged.emit({type:"new",oldValue:null,newValue:r}),r}async get(e,t){if(e=decodeURIComponent(e.replace(/^\//,"")),e===""){let o=await this._getFolder(e);if(o===null)throw Error(`Could not find file with path ${e}`);return o}let n=await this.storage,s=await n.getItem(e),r=await this._getServerContents(e,t),a=s||r;if(!a)throw Error(`Could not find content with path ${e}`);if(!(t!=null&&t.content))return{size:0,...a,content:null};if(a.type==="directory"){let o=new Map;await n.iterate((d,l)=>{l===`${e}/${d.name}`&&o.set(d.name,d)});let u=r?r.content:Array.from((await this._getServerDirectory(e)).values());for(let d of u)o.has(d.name)||o.set(d.name,d);let c=[...o.values()];return{name:be.PathExt.basename(e),path:e,last_modified:a.last_modified,created:a.created,format:"json",mimetype:ve.JSON,content:c,size:0,writable:!0,type:"directory"}}return a}async rename(e,t){let n=decodeURIComponent(e),s=await this.get(n,{content:!0});if(!s)throw Error(`Could not find file with path ${n}`);let r=new Date().toISOString(),a=be.PathExt.basename(t),o={...s,name:a,path:t,last_modified:r},u=await this.storage;if(await u.setItem(t,o),await u.removeItem(n),await(await this.checkpoints).removeItem(n),s.type==="directory"){let c;for(c of s.content)await this.rename(Ke.URLExt.join(e,c.name),Ke.URLExt.join(t,c.name))}return this._fileChanged.emit({type:"rename",oldValue:{path:e},newValue:o}),o}async save(e,t={}){var n;e=decodeURIComponent(e);let s=be.PathExt.extname((n=t.name)!==null&&n!==void 0?n:""),r=t.chunk,a=r?r>1||r===-1:!1,o=await this.get(e,{content:a});if(o||(o=await this.newUntitled({path:e,ext:s,type:"file"})),!o)throw Error(`Could not find file with path ${e}`);let u=o.content,c=new Date().toISOString();if(o={...o,...t,last_modified:c},t.content&&t.format==="base64"){let d=r?r===-1:!0,l=this._handleUploadChunk(t.content,u,a);if(s===".ipynb"){let p=d?JSON.parse(is.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"notebook",size:l.length}}else if(Ae.hasFormat(s,"json")){let p=d?JSON.parse(is.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"file",size:l.length}}else if(Ae.hasFormat(s,"text")){let p=d?is.decode(this._binaryStringToBytes(l)):l;o={...o,content:p,format:"text",type:"file",size:l.length}}else{let p=d?btoa(l):l;o={...o,content:p,format:"base64",type:"file",size:l.length}}}if(o.content)switch(t.format){case"json":{o={...o,size:qt.encode(JSON.stringify(o.content)).length};break}case"text":{o={...o,size:qt.encode(o.content).length};break}case"base64":break;default:{o={...o,size:0};break}}else o={...o,size:0};return await(await this.storage).setItem(e,o),this._fileChanged.emit({type:"save",oldValue:null,newValue:o}),o}async delete(e){e=decodeURIComponent(e);let t=`${e}/`,n=(await(await this.storage).keys()).filter(s=>s===e||s.startsWith(t));await Promise.all(n.map(this.forgetPath,this)),this._fileChanged.emit({type:"delete",oldValue:{path:e},newValue:null})}async forgetPath(e){await Promise.all([(await this.storage).removeItem(e),(await this.checkpoints).removeItem(e)])}async createCheckpoint(e){var t;let n=await this.checkpoints;e=decodeURIComponent(e);let s=await this.get(e,{content:!0});if(!s)throw Error(`Could not find file with path ${e}`);let r=((t=await n.getItem(e))!==null&&t!==void 0?t:[]).filter(Boolean);return r.push(s),r.length>Ga&&r.splice(0,r.length-Ga),await n.setItem(e,r),{id:`${r.length-1}`,last_modified:s.last_modified}}async listCheckpoints(e){return(await(await this.checkpoints).getItem(e)||[]).filter(Boolean).map(this.normalizeCheckpoint,this)}normalizeCheckpoint(e,t){return{id:t.toString(),last_modified:e.last_modified}}async restoreCheckpoint(e,t){e=decodeURIComponent(e);let n=await(await this.checkpoints).getItem(e)||[],s=parseInt(t),r=n[s];await(await this.storage).setItem(e,r)}async deleteCheckpoint(e,t){e=decodeURIComponent(e);let n=await(await this.checkpoints).getItem(e)||[],s=parseInt(t);n.splice(s,1),await(await this.checkpoints).setItem(e,n)}_handleUploadChunk(e,t,n){let s=atob(e);return n?t+s:s}_binaryStringToBytes(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}async _getFolder(e){let t=new Map;await(await this.storage).iterate((s,r)=>{r.includes("/")||t.set(s.path,s)});for(let s of(await this._getServerDirectory(e)).values())t.has(s.path)||t.set(s.path,s);return e&&t.size===0?null:{name:"",path:e,last_modified:new Date(0).toISOString(),created:new Date(0).toISOString(),format:"json",mimetype:ve.JSON,content:Array.from(t.values()),size:0,writable:!0,type:"directory"}}async _getServerContents(e,t){let n=be.PathExt.basename(e),r=(await this._getServerDirectory(Ke.URLExt.join(e,".."))).get(n);if(!r)return null;if(r=r||{name:n,path:e,last_modified:new Date(0).toISOString(),created:new Date(0).toISOString(),format:"text",mimetype:ve.PLAIN_TEXT,type:"file",writable:!0,size:0,content:""},t!=null&&t.content)if(r.type==="directory"){let a=await this._getServerDirectory(e);r={...r,content:Array.from(a.values())}}else{let a=Ke.URLExt.join(Ke.PageConfig.getBaseUrl(),"files",e),o=await fetch(a);if(!o.ok)return null;let u=r.mimetype||o.headers.get("Content-Type"),c=be.PathExt.extname(n);if(r.type==="notebook"||Ae.hasFormat(c,"json")||(u==null?void 0:u.indexOf("json"))!==-1||e.match(/\.(ipynb|[^/]*json[^/]*)$/)){let d=await o.text();r={...r,content:JSON.parse(d),format:"json",mimetype:r.mimetype||ve.JSON,size:qt.encode(d).length}}else if(Ae.hasFormat(c,"text")||u.indexOf("text")!==-1){let d=await o.text();r={...r,content:d,format:"text",mimetype:u||ve.PLAIN_TEXT,size:qt.encode(d).length}}else{let d=await o.arrayBuffer(),l=new Uint8Array(d);r={...r,content:btoa(l.reduce(this.reduceBytesToString,"")),format:"base64",mimetype:u||ve.OCTET_STREAM,size:l.length}}}return r}async _getServerDirectory(e){let t=this._serverContents.get(e)||new Map;if(!this._serverContents.has(e)){let n=Ke.URLExt.join(Ke.PageConfig.getBaseUrl(),"api/contents",e,"all.json");try{let s=await fetch(n),r=JSON.parse(await s.text());for(let a of r.content)t.set(a.name,a)}catch(s){console.warn(`don't worry, about ${s}... nothing's broken. If there had been a
10
- file at ${n}, you might see some more files.`)}this._serverContents.set(e,t)}return t}async _incrementCounter(e){var t;let n=await this.counters,r=((t=await n.getItem(e))!==null&&t!==void 0?t:-1)+1;return await n.setItem(e,r),r}};(function(i){i.EMPTY_NB={metadata:{orig_nbformat:4},nbformat_minor:5,nbformat:4,cells:[]}})(Kn||(Kn={}))});function as(i){return"node"in i}var Ut,eo,to,no,os=Ye(()=>{Ut=16895,eo=33206,to=1,no=2});var so,ls,Wn,zd,Fd,io,Bn,Vn,$n,ut,At,Jn=Ye(()=>{os();so=":",ls="/api/drive.v1",Wn=4096,zd=new TextEncoder,Fd=new TextDecoder("utf-8"),io={0:!1,1:!0,2:!0,64:!0,65:!0,66:!0,129:!0,193:!0,514:!0,577:!0,578:!0,705:!0,706:!0,1024:!0,1025:!0,1026:!0,1089:!0,1090:!0,1153:!0,1154:!0,1217:!0,1218:!0,4096:!0,4098:!0},Bn=class{constructor(e){this.fs=e}open(e){let t=this.fs.realPath(e.node);this.fs.FS.isFile(e.node.mode)&&(e.file=this.fs.API.get(t))}close(e){if(!this.fs.FS.isFile(e.node.mode)||!e.file)return;let t=this.fs.realPath(e.node),n=e.flags,s=typeof n=="string"?parseInt(n,10):n;s&=8191;let r=!0;s in io&&(r=io[s]),r&&this.fs.API.put(t,e.file),e.file=void 0}read(e,t,n,s,r){if(s<=0||e.file===void 0||r>=(e.file.data.length||0))return 0;let a=Math.min(e.file.data.length-r,s);return t.set(e.file.data.subarray(r,r+a),n),a}write(e,t,n,s,r){var a;if(s<=0||e.file===void 0)return 0;if(e.node.timestamp=Date.now(),r+s>(((a=e.file)===null||a===void 0?void 0:a.data.length)||0)){let o=e.file.data?e.file.data:new Uint8Array;e.file.data=new Uint8Array(r+s),e.file.data.set(o)}return e.file.data.set(t.subarray(n,n+s),r),s}llseek(e,t,n){let s=t;if(n===1)s+=e.position;else if(n===2&&this.fs.FS.isFile(e.node.mode))if(e.file!==void 0)s+=e.file.data.length;else throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);if(s<0)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);return s}},Vn=class{constructor(e){this.fs=e}node(e){return as(e)?e.node:e}getattr(e){let t=this.node(e);return{...this.fs.API.getattr(this.fs.realPath(t)),mode:t.mode,ino:t.id}}setattr(e,t){let n=this.node(e);for(let[s,r]of Object.entries(t))switch(s){case"mode":n.mode=r;break;case"timestamp":n.timestamp=r;break;case"size":{let a=r,o=this.fs.realPath(n);if(this.fs.FS.isFile(n.mode)&&a>=0){let u=this.fs.API.get(o),c=u.data?u.data:new Uint8Array;a!==c.length&&(a<c.length?u.data=u.data.slice(0,a):(u.data=new Uint8Array(a),u.data.set(c)),this.fs.API.put(o,u))}else console.warn("setattr size of",a,"on",n,"not yet implemented");break}default:console.warn("setattr",s,"of",r,"on",n,"not yet implemented");break}}lookup(e,t){let n=this.node(e),s=this.fs.PATH.join2(this.fs.realPath(n),t),r=this.fs.API.lookup(s);if(!r.ok)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT);return this.fs.createNode(n,t,r.mode,0)}mknod(e,t,n,s){let r=this.node(e),a=this.fs.PATH.join2(this.fs.realPath(r),t);return this.fs.API.mknod(a,n),this.fs.createNode(r,t,n,s)}rename(e,t,n){let s=this.node(e),r=this.node(t);this.fs.API.rename(s.parent?this.fs.PATH.join2(this.fs.realPath(s.parent),s.name):s.name,this.fs.PATH.join2(this.fs.realPath(r),n)),s.name=n,s.parent=r}unlink(e,t){this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(e)),t))}rmdir(e,t){this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(e)),t))}readdir(e){return this.fs.API.readdir(this.fs.realPath(this.node(e)))}symlink(e,t,n){throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)}readlink(e){throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)}},$n=class{constructor(e,t,n,s){this._driveName=e,this._mountpoint=t,this.FS=n,this.ERRNO_CODES=s}lookup(e){return this.request({method:"lookup",path:this.normalizePath(e)})}getmode(e){return this.request({method:"getmode",path:this.normalizePath(e)})}mknod(e,t){return this.request({method:"mknod",path:this.normalizePath(e),data:{mode:t}})}rename(e,t){return this.request({method:"rename",path:this.normalizePath(e),data:{newPath:this.normalizePath(t)}})}readdir(e){let t=this.request({method:"readdir",path:this.normalizePath(e)});return t.push("."),t.push(".."),t}rmdir(e){return this.request({method:"rmdir",path:this.normalizePath(e)})}get(e){let t=this.request({method:"get",path:this.normalizePath(e)});if(!t)throw new this.FS.ErrnoError(this.ERRNO_CODES.ENOENT);let n=t.content,s=t.format;switch(s){case"json":case"text":return{data:zd.encode(n),format:s};case"base64":{let r=atob(n),a=r.length,o=new Uint8Array(a);for(let u=0;u<a;u++)o[u]=r.charCodeAt(u);return{data:o,format:s}}default:throw new this.FS.ErrnoError(this.ERRNO_CODES.ENOENT)}}put(e,t){switch(t.format){case"json":case"text":return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:Fd.decode(t.data)}});case"base64":{let n="";for(let s=0;s<t.data.byteLength;s++)n+=String.fromCharCode(t.data[s]);return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:btoa(n)}})}}}getattr(e){let t=this.request({method:"getattr",path:this.normalizePath(e)});return t.atime&&(t.atime=new Date(t.atime)),t.mtime&&(t.mtime=new Date(t.mtime)),t.ctime&&(t.ctime=new Date(t.ctime)),t.size=t.size||0,t}normalizePath(e){return e.startsWith(this._mountpoint)&&(e=e.slice(this._mountpoint.length)),this._driveName&&(e=`${this._driveName}${so}${e}`),e}},ut=class extends $n{constructor(e,t,n,s,r){super(t,n,s,r),this._baseUrl=e}request(e){let t=new XMLHttpRequest;t.open("POST",encodeURI(this.endpoint),!1);try{t.send(JSON.stringify(e))}catch(n){console.error(n)}if(t.status>=400)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return JSON.parse(t.responseText)}get endpoint(){return`${this._baseUrl}api/drive`}},At=class{constructor(e){this.FS=e.FS,this.PATH=e.PATH,this.ERRNO_CODES=e.ERRNO_CODES,this.API=this.createAPI(e),this.driveName=e.driveName,this.node_ops=new Vn(this),this.stream_ops=new Bn(this)}createAPI(e){return new ut(e.baseUrl,e.driveName,e.mountpoint,e.FS,e.ERRNO_CODES)}mount(e){return this.createNode(null,e.mountpoint,16895,0)}createNode(e,t,n,s){let r=this.FS;if(!r.isDir(n)&&!r.isFile(n))throw new r.ErrnoError(this.ERRNO_CODES.EINVAL);let a=r.createNode(e,t,n,s);return a.node_ops=this.node_ops,a.stream_ops=this.stream_ops,a}getMode(e){return this.API.getmode(e)}realPath(e){let t=[],n=e;for(t.push(n.name);n.parent!==n;)n=n.parent,t.push(n.name);return t.reverse(),this.PATH.join.apply(null,t)}}});var cs,Nt,ds=Ye(()=>{cs=Ne(G());Jn();Nt=class{constructor(e){this.contentsManager=e.contentsManager}async processDriveRequest(e){switch(e.method){case"readdir":return this.readdir(e);case"rmdir":return this.rmdir(e);case"rename":return this.rename(e);case"getmode":return this.getmode(e);case"lookup":return this.lookup(e);case"mknod":return this.mknod(e);case"getattr":return this.getattr(e);case"get":return this.get(e);case"put":return this.put(e)}throw`Drive request ${e.method} does not exist.`}async readdir(e){let t=await this.contentsManager.get(e.path,{content:!0}),n=[];return t.type==="directory"&&t.content&&(n=t.content.map(s=>s.name)),n}async rmdir(e){return await this.contentsManager.delete(e.path),null}async rename(e){return await this.contentsManager.rename(e.path,e.data.newPath),null}async getmode(e){let t=await this.contentsManager.get(e.path),n;return t.type==="directory"?n=16895:n=33206,n}async lookup(e){let t;try{t={ok:!0,mode:(await this.contentsManager.get(e.path)).type==="directory"?16895:33206}}catch{t={ok:!1}}return t}async mknod(e){let t=await this.contentsManager.newUntitled({path:cs.PathExt.dirname(e.path),type:e.data.mode===16895?"directory":"file",ext:cs.PathExt.extname(e.path)});return await this.contentsManager.rename(t.path,e.path),null}async getattr(e){let t=await this.contentsManager.get(e.path),n=new Date(0).toISOString();return{dev:1,nlink:1,uid:0,gid:0,rdev:0,size:t.size||0,blksize:Wn,blocks:Math.ceil(t.size||0/Wn),atime:t.last_modified||n,mtime:t.last_modified||n,ctime:t.created||n,timestamp:0}}async get(e){let t=await this.contentsManager.get(e.path,{content:!0}),n;return t.type!=="directory"&&(n={content:t.format==="json"?JSON.stringify(t.content):t.content,format:t.format}),n}async put(e){return await this.contentsManager.save(e.path,{content:e.data.format==="json"?JSON.parse(e.data.data):e.data.data,type:"file",format:e.data.format}),null}}});var us,ro=Ye(()=>{Jn();ds();us=class{constructor(e){this.isDisposed=!1,this._onMessage=async t=>{if(!this._channel)return;let n=t.data;if((n==null?void 0:n.receiver)!=="broadcast.ts")return;let r=await this._driveContentsProcessor.processDriveRequest(n);this._channel.postMessage(r)},this._channel=null,this._enabled=!1,this._contents=e.contents,this._driveContentsProcessor=new Nt({contentsManager:this._contents})}get enabled(){return this._enabled}enable(){if(this._channel){console.warn("BroadcastChannel already created and enabled");return}this._channel=new BroadcastChannel(ls),this._channel.addEventListener("message",this._onMessage),this._enabled=!0}disable(){this._channel&&(this._channel.removeEventListener("message",this._onMessage),this._channel=null),this._enabled=!1}dispose(){this.isDisposed||(this.disable(),this.isDisposed=!0)}}});var ao={};wo(ao,{BLOCK_SIZE:()=>Wn,BroadcastChannelWrapper:()=>us,BrowserStorageDrive:()=>rs,ContentsAPI:()=>$n,DIR_MODE:()=>Ut,DRIVE_API_PATH:()=>ls,DRIVE_NAME:()=>Za,DRIVE_SEPARATOR:()=>so,DriveContentsProcessor:()=>Nt,DriveFS:()=>At,DriveFSEmscriptenNodeOps:()=>Vn,DriveFSEmscriptenStreamOps:()=>Bn,FILE:()=>Ae,FILE_MODE:()=>eo,IBroadcastChannelWrapper:()=>Ld,MIME:()=>ve,SEEK_CUR:()=>to,SEEK_END:()=>no,ServiceWorkerContentsAPI:()=>ut,instanceOfStream:()=>as});var ps=Ye(()=>{Qa();Jn();ns();ro();os();ds()});var gs=Symbol("Comlink.proxy"),So=Symbol("Comlink.endpoint"),xo=Symbol("Comlink.releaseProxy"),Yn=Symbol("Comlink.finalizer"),zt=Symbol("Comlink.thrown"),_s=i=>typeof i=="object"&&i!==null||typeof i=="function",Co={canHandle:i=>_s(i)&&i[gs],serialize(i){let{port1:e,port2:t}=new MessageChannel;return Vt(i,e),[t,[t]]},deserialize(i){return i.start(),Eo(i)}},ko={canHandle:i=>_s(i)&&zt in i,serialize({value:i}){let e;return i instanceof Error?e={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:e={isError:!1,value:i},[e,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},vs=new Map([["proxy",Co],["throw",ko]]);function Po(i,e){for(let t of i)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function Vt(i,e=globalThis,t=["*"]){e.addEventListener("message",function n(s){if(!s||!s.data)return;if(!Po(t,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}let{id:r,type:a,path:o}=Object.assign({path:[]},s.data),u=(s.data.argumentList||[]).map(Xe),c;try{let d=o.slice(0,-1).reduce((p,v)=>p[v],i),l=o.reduce((p,v)=>p[v],i);switch(a){case"GET":c=l;break;case"SET":d[o.slice(-1)[0]]=Xe(s.data.value),c=!0;break;case"APPLY":c=l.apply(d,u);break;case"CONSTRUCT":{let p=new l(...u);c=jo(p)}break;case"ENDPOINT":{let{port1:p,port2:v}=new MessageChannel;Vt(i,v),c=Do(p,[p])}break;case"RELEASE":c=void 0;break;default:return}}catch(d){c={value:d,[zt]:0}}Promise.resolve(c).catch(d=>({value:d,[zt]:0})).then(d=>{let[l,p]=Bt(d);e.postMessage(Object.assign(Object.assign({},l),{id:r}),p),a==="RELEASE"&&(e.removeEventListener("message",n),ys(e),Yn in i&&typeof i[Yn]=="function"&&i[Yn]())}).catch(d=>{let[l,p]=Bt({value:new TypeError("Unserializable return value"),[zt]:0});e.postMessage(Object.assign(Object.assign({},l),{id:r}),p)})}),e.start&&e.start()}function Mo(i){return i.constructor.name==="MessagePort"}function ys(i){Mo(i)&&i.close()}function Eo(i,e){let t=new Map;return i.addEventListener("message",function(s){let{data:r}=s;if(!r||!r.id)return;let a=t.get(r.id);if(a)try{a(r)}finally{t.delete(r.id)}}),Xn(i,t,[],e)}function Lt(i){if(i)throw new Error("Proxy has been released and is not useable")}function ws(i){return nt(i,new Map,{type:"RELEASE"}).then(()=>{ys(i)})}var Ft=new WeakMap,Kt="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{let e=(Ft.get(i)||0)-1;Ft.set(i,e),e===0&&ws(i)});function Ro(i,e){let t=(Ft.get(e)||0)+1;Ft.set(e,t),Kt&&Kt.register(i,e,i)}function Io(i){Kt&&Kt.unregister(i)}function Xn(i,e,t=[],n=function(){}){let s=!1,r=new Proxy(n,{get(a,o){if(Lt(s),o===xo)return()=>{Io(r),ws(i),e.clear(),s=!0};if(o==="then"){if(t.length===0)return{then:()=>r};let u=nt(i,e,{type:"GET",path:t.map(c=>c.toString())}).then(Xe);return u.then.bind(u)}return Xn(i,e,[...t,o])},set(a,o,u){Lt(s);let[c,d]=Bt(u);return nt(i,e,{type:"SET",path:[...t,o].map(l=>l.toString()),value:c},d).then(Xe)},apply(a,o,u){Lt(s);let c=t[t.length-1];if(c===So)return nt(i,e,{type:"ENDPOINT"}).then(Xe);if(c==="bind")return Xn(i,e,t.slice(0,-1));let[d,l]=ms(u);return nt(i,e,{type:"APPLY",path:t.map(p=>p.toString()),argumentList:d},l).then(Xe)},construct(a,o){Lt(s);let[u,c]=ms(o);return nt(i,e,{type:"CONSTRUCT",path:t.map(d=>d.toString()),argumentList:u},c).then(Xe)}});return Ro(r,i),r}function Oo(i){return Array.prototype.concat.apply([],i)}function ms(i){let e=i.map(Bt);return[e.map(t=>t[0]),Oo(e.map(t=>t[1]))]}var bs=new WeakMap;function Do(i,e){return bs.set(i,e),i}function jo(i){return Object.assign(i,{[gs]:!0})}function Bt(i){for(let[e,t]of vs)if(t.canHandle(i)){let[n,s]=t.serialize(i);return[{type:"HANDLER",name:e,value:n},s]}return[{type:"RAW",value:i},bs.get(i)||[]]}function Xe(i){switch(i.type){case"HANDLER":return vs.get(i.name).deserialize(i.value);case"RAW":return i.value}}function nt(i,e,t,n){return new Promise(s=>{let r=To();e.set(r,s),i.start&&i.start(),i.postMessage(Object.assign({id:r},t),n)})}function To(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}ps();var Hn=class{constructor(){this._options=null;this._initializer=null;this._pyodide=null;this._localPath="";this._driveName="";this._driveFS=null;this._sendWorkerMessage=()=>{};this._initialized=new Promise((e,t)=>{this._initializer={resolve:e,reject:t}})}async initialize(e){var t;if(this._options=e,e.location.includes(":")){let n=e.location.split(":");this._driveName=n[0],this._localPath=n[1]}else this._driveName="",this._localPath=e.location;await this.initRuntime(e),await this.initFilesystem(e),await this.initPackageManager(e),await this.initKernel(e),await this.initGlobals(e),(t=this._initializer)==null||t.resolve()}async initRuntime(e){let{pyodideUrl:t,indexUrl:n}=e,s;t.endsWith(".mjs")?s=(await import(t)).loadPyodide:(importScripts(t),s=self.loadPyodide),this._pyodide=await s({indexURL:n,...e.loadPyodideOptions})}async initPackageManager(e){if(!this._options)throw new Error("Uninitialized");let{pipliteWheelUrl:t,disablePyPIFallback:n,pipliteUrls:s,loadPyodideOptions:r}=this._options,a=(r||{}).packages||[];a.includes("micropip")||await this._pyodide.loadPackage(["micropip"]),a.includes("piplite")||await this._pyodide.runPythonAsync(`
9
+ See "state database" for more information.`)});var Bi=E(ke=>{"use strict";var Zc=ke&&ke.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),Et=ke&&ke.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Zc(e,i,t)};Object.defineProperty(ke,"__esModule",{value:!0});Et(ma(),ke);Et(_a(),ke);Et(ba(),ke);Et(Sa(),ke);Et(xa(),ke)});var Wi=E(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.SettingManager=void 0;var Vi=Y(),Qc=Bi(),qn=de(),ed="api/settings",$i=class extends Qc.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:qn.ServerConnection.makeSettings()}async fetch(e){if(!e)throw new Error("Plugin `id` parameter is required for settings fetch.");let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=qn.ServerConnection,o=n+s,u=It.url(o,e),c=await r(u,{},t);if(c.status!==200)throw await a.create(c);return c.json()}async list(e){var t,n,s,r;let{serverSettings:a}=this,{baseUrl:o,appUrl:u}=a,{makeRequest:c,ResponseError:d}=qn.ServerConnection,l=o+u,p=It.url(l,"",e==="ids"),v=await c(p,{},a);if(v.status!==200)throw new d(v);let _=await v.json(),I=(n=(t=_==null?void 0:_.settings)===null||t===void 0?void 0:t.map(D=>D.id))!==null&&n!==void 0?n:[],P=[];return e||(P=(r=(s=_==null?void 0:_.settings)===null||s===void 0?void 0:s.map(D=>(D.data={composite:{},user:{}},D)))!==null&&r!==void 0?r:[]),{ids:I,values:P}}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=qn.ServerConnection,u=s+r,c=It.url(u,e),d={body:JSON.stringify({raw:t}),method:"PUT"},l=await a(c,d,n);if(l.status!==204)throw new o(l)}};An.SettingManager=$i;var It;(function(i){function e(t,n,s){let r=s?Vi.URLExt.objectToQueryString({ids_only:!0}):"",a=Vi.URLExt.join(t,ed),o=Vi.URLExt.join(a,n);if(!o.startsWith(a))throw new Error("Can only be used for workspaces requests");return`${o}${r}`}i.url=e})(It||(It={}))});var Dt=E(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.TerminalAPIClient=ve.TERMINAL_SERVICE_URL=void 0;ve.isAvailable=Hi;ve.startNew=Ca;ve.listRunning=ka;ve.shutdownTerminal=Pa;var Rt=Y(),Ae=de();ve.TERMINAL_SERVICE_URL="api/terminals";function Hi(){return String(Rt.PageConfig.getOption("terminalsAvailable")).toLowerCase()==="true"}async function Ca(i=Ae.ServerConnection.makeSettings(),e,t){Ot.errorIfNotAvailable();let n=Rt.URLExt.join(i.baseUrl,ve.TERMINAL_SERVICE_URL),s={method:"POST",body:JSON.stringify({name:e,cwd:t})},r=await Ae.ServerConnection.makeRequest(n,s,i);if(r.status!==200)throw await Ae.ServerConnection.ResponseError.create(r);return await r.json()}async function ka(i=Ae.ServerConnection.makeSettings()){Ot.errorIfNotAvailable();let e=Rt.URLExt.join(i.baseUrl,ve.TERMINAL_SERVICE_URL),t=await Ae.ServerConnection.makeRequest(e,{},i);if(t.status!==200)throw await Ae.ServerConnection.ResponseError.create(t);let n=await t.json();if(!Array.isArray(n))throw new Error("Invalid terminal list");return n}async function Pa(i,e=Ae.ServerConnection.makeSettings()){var t;Ot.errorIfNotAvailable();let n=Rt.URLExt.join(e.baseUrl,ve.TERMINAL_SERVICE_URL),s=Rt.URLExt.join(n,i);if(!s.startsWith(n))throw new Error("Can only be used for terminal requests");let r={method:"DELETE"},a=await Ae.ServerConnection.makeRequest(s,r,e);if(a.status===404){let u=(t=(await a.json()).message)!==null&&t!==void 0?t:`The terminal session "${i}"" does not exist on the server`;console.warn(u)}else if(a.status!==204)throw await Ae.ServerConnection.ResponseError.create(a)}var Ji=class{constructor(e={}){var t;this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ae.ServerConnection.makeSettings()}get isAvailable(){return Hi()}async startNew(e={}){let{name:t,cwd:n}=e;return Ca(this.serverSettings,t,n)}async listRunning(){return ka(this.serverSettings)}async shutdown(e){return Pa(e,this.serverSettings)}};ve.TerminalAPIClient=Ji;var Ot;(function(i){function e(){if(!Hi())throw new Error("Terminals Unavailable")}i.errorIfNotAvailable=e})(Ot||(Ot={}))});var Ma=E(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.isAvailable=void 0;var td=Dt();Object.defineProperty(Un,"isAvailable",{enumerable:!0,get:function(){return td.isAvailable}})});var Ea=E(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.TerminalConnection=void 0;var nd=Y(),id=te(),Nn=Z(),sd=Ne(),rd=Dt(),Gi=class i{constructor(e){var t,n;this._createSocket=()=>{this._errorIfDisposed(),this._clearSocket(),this._updateConnectionStatus("connecting");let s=this._name,r=this.serverSettings,a=nd.URLExt.join(r.wsUrl,"terminals","websocket",encodeURIComponent(s)),o=r.token;r.appendToken&&o!==""&&(a=a+`?token=${encodeURIComponent(o)}`),this._ws=new r.WebSocket(a),this._ws.onmessage=this._onWSMessage,this._ws.onclose=this._onWSClose,this._ws.onerror=this._onWSClose},this._onWSMessage=s=>{if(this._isDisposed)return;let r=JSON.parse(s.data);if(r[0]==="disconnect"&&this.dispose(),this._connectionStatus==="connecting"){r[0]==="setup"&&this._updateConnectionStatus("connected");return}this._messageReceived.emit({type:r[0],content:r.slice(1)})},this._onWSClose=s=>{console.warn(`Terminal websocket closed: ${s.code}`),this.isDisposed||this._reconnect()},this._connectionStatus="connecting",this._connectionStatusChanged=new Nn.Signal(this),this._isDisposed=!1,this._disposed=new Nn.Signal(this),this._messageReceived=new Nn.Signal(this),this._reconnectTimeout=null,this._ws=null,this._noOp=()=>{},this._reconnectLimit=7,this._reconnectAttempt=0,this._pendingMessages=[],this._name=e.model.name,this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:sd.ServerConnection.makeSettings(),this._terminalAPIClient=(n=e.terminalAPIClient)!==null&&n!==void 0?n:new rd.TerminalAPIClient({serverSettings:this.serverSettings}),this._createSocket()}get disposed(){return this._disposed}get messageReceived(){return this._messageReceived}get name(){return this._name}get model(){return{name:this._name}}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._disposed.emit(),this._updateConnectionStatus("disconnected"),this._clearSocket(),Nn.Signal.clearData(this))}send(e){this._sendMessage(e)}_sendMessage(e,t=!0){if(!(this._isDisposed||!e.content))if(this.connectionStatus==="connected"&&this._ws){let n=[e.type,...e.content];this._ws.send(JSON.stringify(n))}else if(t)this._pendingMessages.push(e);else throw new Error(`Could not send message: ${JSON.stringify(e)}`)}_sendPending(){for(;this.connectionStatus==="connected"&&this._pendingMessages.length>0;)this._sendMessage(this._pendingMessages[0],!1),this._pendingMessages.shift()}reconnect(){this._errorIfDisposed();let e=new id.PromiseDelegate,t=(n,s)=>{s==="connected"?(e.resolve(),this.connectionStatusChanged.disconnect(t,this)):s==="disconnected"&&(e.reject(new Error("Terminal connection disconnected")),this.connectionStatusChanged.disconnect(t,this))};return this.connectionStatusChanged.connect(t,this),this._reconnectAttempt=0,this._reconnect(),e.promise}_reconnect(){if(this._errorIfDisposed(),clearTimeout(this._reconnectTimeout),this._reconnectAttempt<this._reconnectLimit){this._updateConnectionStatus("connecting");let e=Yi.getRandomIntInclusive(0,1e3*(Math.pow(2,this._reconnectAttempt)-1));console.error(`Connection lost, reconnecting in ${Math.floor(e/1e3)} seconds.`),this._reconnectTimeout=setTimeout(this._createSocket,e),this._reconnectAttempt+=1}else this._updateConnectionStatus("disconnected");this._clearSocket()}_clearSocket(){this._ws!==null&&(this._ws.onopen=this._noOp,this._ws.onclose=this._noOp,this._ws.onerror=this._noOp,this._ws.onmessage=this._noOp,this._ws.close(),this._ws=null)}async shutdown(){await this._terminalAPIClient.shutdown(this.name),this.dispose()}clone(){return new i({model:this.model,serverSettings:this.serverSettings,terminalAPIClient:this._terminalAPIClient})}_updateConnectionStatus(e){this._connectionStatus!==e&&(this._connectionStatus=e,e!=="connecting"&&(this._reconnectAttempt=0,clearTimeout(this._reconnectTimeout)),e==="connected"&&this._sendPending(),this._connectionStatusChanged.emit(e))}_errorIfDisposed(){if(this.isDisposed)throw new Error("Terminal connection is disposed")}get connectionStatusChanged(){return this._connectionStatusChanged}get connectionStatus(){return this._connectionStatus}};zn.TerminalConnection=Gi;var Yi;(function(i){function e(t,n){return t=Math.ceil(t),n=Math.floor(n),Math.floor(Math.random()*(n-t+1))+t}i.getRandomIntInclusive=e})(Yi||(Yi={}))});var Ra=E(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.TerminalManager=void 0;var ad=Xe(),Ia=Z(),od=Ne(),ld=Ye(),cd=Dt(),dd=Ea(),jt=class extends ld.BaseManager{constructor(e={}){var t,n;if(super(e),this._isReady=!1,this._names=[],this._terminalConnections=new Set,this._runningChanged=new Ia.Signal(this),this._connectionFailure=new Ia.Signal(this),this._terminalAPIClient=(t=e.terminalAPIClient)!==null&&t!==void 0?t:new cd.TerminalAPIClient({serverSettings:this.serverSettings}),!this.isAvailable()){this._ready=Promise.reject("Terminals unavailable"),this._ready.catch(s=>{});return}this._pollModels=new ad.Poll({auto:!1,factory:()=>this.requestRunning(),frequency:{interval:10*1e3,backoff:!0,max:300*1e3},name:"@jupyterlab/services:TerminalManager#models",standby:(n=e.standby)!==null&&n!==void 0?n:"when-hidden"}),this._ready=(async()=>{await this._pollModels.start(),await this._pollModels.tick,this._isReady=!0})()}get isReady(){return this._isReady}get ready(){return this._ready}get runningChanged(){return this._runningChanged}get connectionFailure(){return this._connectionFailure}dispose(){this.isDisposed||(this._names.length=0,this._terminalConnections.forEach(e=>e.dispose()),this._pollModels.dispose(),super.dispose())}isAvailable(){return this._terminalAPIClient.isAvailable}connectTo(e){let t=new dd.TerminalConnection({...e,serverSettings:this.serverSettings,terminalAPIClient:this._terminalAPIClient});return this._onStarted(t),this._names.includes(e.model.name)||this.refreshRunning().catch(()=>{}),t}running(){return this._models[Symbol.iterator]()}async refreshRunning(){await this._pollModels.refresh(),await this._pollModels.tick}async startNew(e={}){let{name:t,cwd:n}=e,s=await this._terminalAPIClient.startNew({name:t,cwd:n});return await this.refreshRunning(),this.connectTo({model:s})}async shutdown(e){await this._terminalAPIClient.shutdown(e),await this.refreshRunning()}async shutdownAll(){await this.refreshRunning(),await Promise.all(this._names.map(e=>this._terminalAPIClient.shutdown(e))),await this.refreshRunning()}async requestRunning(){var e,t;let n;try{n=await this._terminalAPIClient.listRunning()}catch(r){throw(r instanceof od.ServerConnection.NetworkError||((e=r.response)===null||e===void 0?void 0:e.status)===503||((t=r.response)===null||t===void 0?void 0:t.status)===424)&&this._connectionFailure.emit(r),r}if(this.isDisposed)return;let s=n.map(({name:r})=>r).sort();s!==this._names&&(this._names=s,this._terminalConnections.forEach(r=>{s.includes(r.name)||r.dispose()}),this._runningChanged.emit(this._models))}_onStarted(e){this._terminalConnections.add(e),e.disposed.connect(this._onDisposed,this)}_onDisposed(e){this._terminalConnections.delete(e),this.refreshRunning().catch(()=>{})}get _models(){return this._names.map(e=>({name:e}))}};Tt.TerminalManager=jt;(function(i){class e extends i{constructor(){super(...arguments),this._readyPromise=new Promise(()=>{})}get isActive(){return!1}get parentReady(){return super.ready}get ready(){return this.parentReady.then(()=>this._readyPromise)}async startNew(n){return Promise.reject(new Error("Not implemented in no-op Terminal Manager"))}connectTo(n){throw Error("Not implemented in no-op Terminal Manager")}async shutdown(n){return Promise.reject(new Error("Not implemented in no-op Terminal Manager"))}async requestRunning(){return Promise.resolve()}}i.NoopManager=e})(jt||(Tt.TerminalManager=jt={}))});var Xi=E(me=>{"use strict";var Oa=me&&me.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),ud=me&&me.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e})}:function(i,e){i.default=e}),Da=me&&me.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&Oa(e,i,t);return ud(e,i),e},pd=me&&me.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Oa(e,i,t)};Object.defineProperty(me,"__esModule",{value:!0});me.TerminalAPI=me.Terminal=void 0;var hd=Da(Ma());me.Terminal=hd;var fd=Da(Dt());me.TerminalAPI=fd;pd(Ra(),me)});var ts=E(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.UserManager=void 0;var md=Y(),gd=te(),_d=Xe(),ja=Z(),vd=de(),yd=Ye(),wd="api/me",Zi="@jupyterlab/services:UserManager#user",Qi=class extends yd.BaseManager{constructor(e={}){var t;super(e),this._isReady=!1,this._userChanged=new ja.Signal(this),this._connectionFailure=new ja.Signal(this),this._ready=this.requestUser().then(()=>{this.isDisposed||(this._isReady=!0)}).catch(n=>new Promise(()=>{})),this._pollSpecs=new _d.Poll({auto:!1,factory:()=>this.requestUser(),frequency:{interval:61*1e3,backoff:!0,max:300*1e3},name:Zi,standby:(t=e.standby)!==null&&t!==void 0?t:"when-hidden"}),this.ready.then(()=>{this._pollSpecs.start()})}get isReady(){return this._isReady}get ready(){return this._ready}get identity(){return this._identity}get permissions(){return this._permissions}get userChanged(){return this._userChanged}get connectionFailure(){return this._connectionFailure}dispose(){this._pollSpecs.dispose(),super.dispose()}async refreshUser(){await this._pollSpecs.refresh(),await this._pollSpecs.tick}async requestUser(){if(this.isDisposed)return;let{baseUrl:e}=this.serverSettings,{makeRequest:t,ResponseError:n}=vd.ServerConnection,s=md.URLExt.join(e,wd),r=await t(s,{},this.serverSettings);if(r.status!==200)throw await n.create(r);let a={identity:this._identity,permissions:this._permissions},o=await r.json(),u=o.identity,{localStorage:c}=window,d=c.getItem(Zi);if(d&&(!u.initials||!u.color)){let l=JSON.parse(d);u.initials=u.initials||l.initials||u.name.substring(0,1),u.color=u.color||l.color||es.getRandomColor()}gd.JSONExt.deepEqual(o,a)||(this._identity=u,this._permissions=o.permissions,c.setItem(Zi,JSON.stringify(u)),this._userChanged.emit(o))}};Ln.UserManager=Qi;var es;(function(i){let e=["var(--jp-collaborator-color1)","var(--jp-collaborator-color2)","var(--jp-collaborator-color3)","var(--jp-collaborator-color4)","var(--jp-collaborator-color5)","var(--jp-collaborator-color6)","var(--jp-collaborator-color7)"];i.getRandomColor=()=>e[Math.floor(Math.random()*e.length)]})(es||(es={}))});var is=E(Fn=>{"use strict";Object.defineProperty(Fn,"__esModule",{value:!0});Fn.WorkspaceManager=void 0;var Ta=Y(),bd=Bi(),qt=de(),Sd="api/workspaces",ns=class extends bd.DataConnector{constructor(e={}){var t;super(),this.serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:qt.ServerConnection.makeSettings()}async fetch(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=qt.ServerConnection,o=n+s,u=dt.url(o,e),c=await r(u,{},t);if(c.status!==200)throw await a.create(c);return c.json()}async list(){let{serverSettings:e}=this,{baseUrl:t,appUrl:n}=e,{makeRequest:s,ResponseError:r}=qt.ServerConnection,a=t+n,o=dt.url(a,""),u=await s(o,{},e);if(u.status!==200)throw await r.create(u);return(await u.json()).workspaces}async remove(e){let{serverSettings:t}=this,{baseUrl:n,appUrl:s}=t,{makeRequest:r,ResponseError:a}=qt.ServerConnection,o=n+s,u=dt.url(o,e),d=await r(u,{method:"DELETE"},t);if(d.status!==204)throw await a.create(d)}async save(e,t){let{serverSettings:n}=this,{baseUrl:s,appUrl:r}=n,{makeRequest:a,ResponseError:o}=qt.ServerConnection,u=s+r,c=dt.url(u,e),d={body:JSON.stringify(t),method:"PUT"},l=await a(c,d,n);if(l.status!==204)throw await o.create(l)}};Fn.WorkspaceManager=ns;var dt;(function(i){function e(t,n){let s=Ta.URLExt.join(t,Sd),r=Ta.URLExt.join(s,n);if(!r.startsWith(s))throw new Error("Can only be used for workspaces requests");return r}i.url=e})(dt||(dt={}))});var Aa=E(Kn=>{"use strict";Object.defineProperty(Kn,"__esModule",{value:!0});Kn.ServiceManager=void 0;var qa=Z(),xd=ea(),Cd=yi(),kd=bi(),Pd=Ri(),Md=Di(),Ed=Ui(),Id=de(),Rd=Li(),Od=Wi(),Dd=Xi(),jd=ts(),Td=is(),ss=class{constructor(e={}){var t,n;this._isDisposed=!1,this._connectionFailure=new qa.Signal(this),this._isReady=!1;let s=e.defaultDrive,r=(t=e.serverSettings)!==null&&t!==void 0?t:Id.ServerConnection.makeSettings(),a=(n=e.standby)!==null&&n!==void 0?n:"when-hidden",o={defaultDrive:s,serverSettings:r,standby:a};this.serverSettings=r,this.contents=e.contents||new Cd.ContentsManager(o),this.events=e.events||new kd.EventManager(o),this.kernels=e.kernels||new Pd.KernelManager(o),this.sessions=e.sessions||new Rd.SessionManager({...o,kernelManager:this.kernels}),this.settings=e.settings||new Od.SettingManager(o),this.terminals=e.terminals||new Dd.TerminalManager(o),this.builder=e.builder||new xd.BuildManager(o),this.workspaces=e.workspaces||new Td.WorkspaceManager(o),this.nbconvert=e.nbconvert||new Ed.NbConvertManager(o),this.kernelspecs=e.kernelspecs||new Md.KernelSpecManager(o),this.user=e.user||new jd.UserManager(o),this.kernelspecs.connectionFailure.connect(this._onConnectionFailure,this),this.sessions.connectionFailure.connect(this._onConnectionFailure,this),this.terminals.connectionFailure.connect(this._onConnectionFailure,this);let u=[this.sessions.ready,this.kernelspecs.ready];this.terminals.isAvailable()&&u.push(this.terminals.ready),this._readyPromise=Promise.all(u).then(()=>{this._isReady=!0})}get connectionFailure(){return this._connectionFailure}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,qa.Signal.clearData(this),this.contents.dispose(),this.events.dispose(),this.sessions.dispose(),this.terminals.dispose())}get isReady(){return this._isReady}get ready(){return this._readyPromise}_onConnectionFailure(e,t){this._connectionFailure.emit(t)}};Kn.ServiceManager=ss});var Ua=E(z=>{"use strict";Object.defineProperty(z,"__esModule",{value:!0});z.IWorkspaceManager=z.IUserManager=z.ITerminalManager=z.IServiceManager=z.ISettingManager=z.ISessionManager=z.IServerSettings=z.INbConvertManager=z.IKernelSpecManager=z.IKernelManager=z.IEventManager=z.IDefaultDrive=z.IContentsManager=z.IConfigSectionManager=z.IConnectionStatus=void 0;var ge=te();z.IConnectionStatus=new ge.Token("@jupyterlab/application:IConnectionStatus","A service providing the application connection status.");z.IConfigSectionManager=new ge.Token("@jupyterlab/services:IConfigSectionManager","A service providing the config section manager.");z.IContentsManager=new ge.Token("@jupyterlab/services:IContentsManager","The contents manager token.");z.IDefaultDrive=new ge.Token("@jupyterlab/services:IDefaultDrive","The default drive for the contents manager.");z.IEventManager=new ge.Token("@jupyterlab/services:IEventManager","The event manager token.");z.IKernelManager=new ge.Token("@jupyterlab/services:IKernelManager","The kernel manager token.");z.IKernelSpecManager=new ge.Token("@jupyterlab/services:IKernelSpecManager","The kernel spec manager token.");z.INbConvertManager=new ge.Token("@jupyterlab/services:INbConvertManager","The nbconvert manager token.");z.IServerSettings=new ge.Token("@jupyterlab/services:IServerSettings","The server settings for the application.");z.ISessionManager=new ge.Token("@jupyterlab/services:ISessionManager","The session manager token.");z.ISettingManager=new ge.Token("@jupyterlab/services:ISettingManager","The setting manager token.");z.IServiceManager=new ge.Token("@jupyterlab/services:IServiceManager","The service manager for the application.");z.ITerminalManager=new ge.Token("@jupyterlab/services:ITerminalManager","The terminal manager token.");z.IUserManager=new ge.Token("@jupyterlab/services:IUserManager","The user manager token.");z.IWorkspaceManager=new ge.Token("@jupyterlab/services:IWorkspaceManager","The workspace manager token.")});var Ne=E(W=>{"use strict";var qd=W&&W.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var s=Object.getOwnPropertyDescriptor(e,t);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,s)}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t]}),le=W&&W.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&qd(e,i,t)};Object.defineProperty(W,"__esModule",{value:!0});le(Ye(),W);le(fr(),W);le(mr(),W);le(yi(),W);le(bi(),W);le(Ri(),W);le(Di(),W);le(Aa(),W);le(de(),W);le(Li(),W);le(Wi(),W);le(Xi(),W);le(Ua(),W);le(ts(),W);le(is(),W);le(Ui(),W)});var za=E((Qu,Na)=>{"use strict";function Bn(){this._types=Object.create(null),this._extensions=Object.create(null);for(let i=0;i<arguments.length;i++)this.define(arguments[i]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}Bn.prototype.define=function(i,e){for(let t in i){let n=i[t].map(function(s){return s.toLowerCase()});t=t.toLowerCase();for(let s=0;s<n.length;s++){let r=n[s];if(r[0]!=="*"){if(!e&&r in this._types)throw new Error('Attempt to change mapping for "'+r+'" extension from "'+this._types[r]+'" to "'+t+'". Pass `force=true` to allow this, otherwise remove "'+r+'" from the list of extensions for "'+t+'".');this._types[r]=t}}if(e||!this._extensions[t]){let s=n[0];this._extensions[t]=s[0]!=="*"?s:s.substr(1)}}};Bn.prototype.getType=function(i){i=String(i);let e=i.replace(/^.*[/\\]/,"").toLowerCase(),t=e.replace(/^.*\./,"").toLowerCase(),n=e.length<i.length;return(t.length<e.length-1||!n)&&this._types[t]||null};Bn.prototype.getExtension=function(i){return i=/^\s*([^;\s]*)/.test(i)&&RegExp.$1,i&&this._extensions[i.toLowerCase()]||null};Na.exports=Bn});var Fa=E((ep,La)=>{La.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}});var Ba=E((tp,Ka)=>{Ka.exports={"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.sap.vds":["vds"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]}});var $a=E((np,Va)=>{"use strict";var Ad=za();Va.exports=new Ad(Fa(),Ba())});var Wa,Ja,ye,Ue,rs=et(()=>{Wa=Fe(Y()),Ja=Fe($a());(function(i){i.JSON="application/json",i.PLAIN_TEXT="text/plain",i.OCTET_STREAM="octet/stream"})(ye||(ye={}));(function(i){let e=JSON.parse(Wa.PageConfig.getOption("fileTypes")||"{}");function t(s,r=null){s=s.toLowerCase();for(let a of Object.values(e))for(let o of a.extensions||[])if(o===s&&a.mimeTypes&&a.mimeTypes.length)return a.mimeTypes[0];return Ja.default.getType(s)||r||ye.OCTET_STREAM}i.getType=t;function n(s,r){s=s.toLowerCase();for(let a of Object.values(e))if(a.fileFormat===r){for(let o of a.extensions||[])if(o===s)return!0}return!1}i.hasFormat=n})(Ue||(Ue={}))});var Le,Ya,xe,Xa,os,Ha,Za,Ga,At,as,ls,Vn,Qa=et(()=>{Le=Fe(Y()),Ya=Fe(Ne()),xe=Fe(Y()),Xa=Fe(te()),os=Fe(Z());rs();Ha="JupyterLite Storage",Za="BrowserStorage",Ga=5,At=new TextEncoder,as=new TextDecoder("utf-8"),ls=class{constructor(e){var t;this.reduceBytesToString=(n,s)=>n+String.fromCharCode(s),this._serverContents=new Map,this._isDisposed=!1,this._fileChanged=new os.Signal(this),this._storageName=Ha,this._storageDrivers=null,this._localforage=e.localforage,this._storageName=e.storageName||Ha,this._storageDrivers=e.storageDrivers||null,this._serverSettings=(t=e.serverSettings)!==null&&t!==void 0?t:Ya.ServerConnection.makeSettings(),this._ready=new Xa.PromiseDelegate,this.initialize().catch(console.warn)}dispose(){this.isDisposed||(this._isDisposed=!0,os.Signal.clearData(this))}get isDisposed(){return this._isDisposed}get name(){return Za}get serverSettings(){return this._serverSettings}get fileChanged(){return this._fileChanged}async getDownloadUrl(e){throw new Error("Method not implemented.")}async initialize(){await this.initStorage(),this._ready.resolve(void 0)}async initStorage(){this._storage=this.createDefaultStorage(),this._counters=this.createDefaultCounters(),this._checkpoints=this.createDefaultCheckpoints()}get ready(){return this._ready.promise}get storage(){return this.ready.then(()=>this._storage)}get counters(){return this.ready.then(()=>this._counters)}get checkpoints(){return this.ready.then(()=>this._checkpoints)}get defaultStorageOptions(){let e=this._storageDrivers&&this._storageDrivers.length?this._storageDrivers:null;return{version:1,name:this._storageName,...e?{driver:e}:{}}}createDefaultStorage(){return this._localforage.createInstance({description:"Offline Storage for Notebooks and Files",storeName:"files",...this.defaultStorageOptions})}createDefaultCounters(){return this._localforage.createInstance({description:"Store the current file suffix counters",storeName:"counters",...this.defaultStorageOptions})}createDefaultCheckpoints(){return this._localforage.createInstance({description:"Offline Storage for Checkpoints",storeName:"checkpoints",...this.defaultStorageOptions})}async newUntitled(e){var t,n,s;let r=(t=e==null?void 0:e.path)!==null&&t!==void 0?t:"",a=(n=e==null?void 0:e.type)!==null&&n!==void 0?n:"notebook",o=new Date().toISOString(),u=xe.PathExt.dirname(r),c=xe.PathExt.basename(r),d=xe.PathExt.extname(r),l=await this.get(u).catch(()=>null),p="";r&&!d&&l?(u=`${r}/`,p=""):u&&c?(u=`${u}/`,p=c):(u="",p=r);let v;switch(a){case"directory":{p=`Untitled Folder${await this._incrementCounter("directory")||""}`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:"",content:null,size:0,writable:!0,type:"directory"};break}case"notebook":{let I=await this._incrementCounter("notebook");p=p||`Untitled${I||""}.ipynb`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:"json",mimetype:ye.JSON,content:Vn.EMPTY_NB,size:At.encode(JSON.stringify(Vn.EMPTY_NB)).length,writable:!0,type:"notebook"};break}default:{let I=(s=e==null?void 0:e.ext)!==null&&s!==void 0?s:".txt";I.startsWith(".")||(I=`.${I}`);let P=await this._incrementCounter("file"),D=Ue.getType(I)||ye.OCTET_STREAM,q;Ue.hasFormat(I,"text")||D.indexOf("text")!==-1?q="text":I.indexOf("json")!==-1||I.indexOf("ipynb")!==-1?q="json":q="base64",p=p||`untitled${P||""}${I}`,v={name:p,path:`${u}${p}`,last_modified:o,created:o,format:q,mimetype:D,content:"",size:0,writable:!0,type:"file"};break}}let _=v.path;return await(await this.storage).setItem(_,v),this._fileChanged.emit({type:"new",oldValue:null,newValue:v}),v}async copy(e,t){let n=xe.PathExt.basename(e);for(t=t===""?"":`${xe.PathExt.removeSlash(t)}/`;await this.get(`${t}${n}`,{content:!0}).then(()=>!0).catch(()=>!1);){let a=xe.PathExt.extname(n);n=`${n.replace(a,"")} (copy)${a}`}let s=`${t}${n}`,r=await this.get(e,{content:!0}).catch(()=>null);if(!r)throw Error(`Could not find file with path ${e}`);return r={...r,name:n,path:s},await(await this.storage).setItem(s,r),this._fileChanged.emit({type:"new",oldValue:null,newValue:r}),r}async get(e,t){if(e=decodeURIComponent(e.replace(/^\//,"")),e===""){let o=await this._getFolder(e);if(o===null)throw Error(`Could not find file with path ${e}`);return o}let n=await this.storage,s=await n.getItem(e),r=await this._getServerContents(e,t),a=s||r;if(!a)throw Error(`Could not find content with path ${e}`);if(!(t!=null&&t.content))return{size:0,...a,content:null};if(a.type==="directory"){let o=new Map;await n.iterate((d,l)=>{l===`${e}/${d.name}`&&o.set(d.name,d)});let u=r?r.content:Array.from((await this._getServerDirectory(e)).values());for(let d of u)o.has(d.name)||o.set(d.name,d);let c=[...o.values()];return{name:xe.PathExt.basename(e),path:e,last_modified:a.last_modified,created:a.created,format:"json",mimetype:ye.JSON,content:c,size:0,writable:!0,type:"directory"}}return a}async rename(e,t){let n=decodeURIComponent(e),s=await this.get(n,{content:!0}).catch(()=>null);if(!s)throw Error(`Could not find file with path ${n}`);let r=new Date().toISOString(),a=xe.PathExt.basename(t),o={...s,name:a,path:t,last_modified:r},u=await this.storage;if(await u.setItem(t,o),await u.removeItem(n),await(await this.checkpoints).removeItem(n),s.type==="directory"){let c;for(c of s.content)await this.rename(Le.URLExt.join(e,c.name),Le.URLExt.join(t,c.name))}return this._fileChanged.emit({type:"rename",oldValue:{path:e},newValue:o}),o}async save(e,t={}){var n;e=decodeURIComponent(e);let s=xe.PathExt.extname((n=t.name)!==null&&n!==void 0?n:""),r=t.chunk,a=r?r>1||r===-1:!1,o=await this.get(e,{content:a}).catch(()=>null);if(o||(o=await this.newUntitled({path:e,ext:s,type:"file"})),!o)throw Error(`Could not find file with path ${e}`);let u=o.content,c=new Date().toISOString();if(o={...o,...t,last_modified:c},t.content&&t.format==="base64"){let d=r?r===-1:!0,l=this._handleUploadChunk(t.content,u,a);if(s===".ipynb"){let p=d?JSON.parse(as.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"notebook",size:l.length}}else if(Ue.hasFormat(s,"json")){let p=d?JSON.parse(as.decode(this._binaryStringToBytes(l))):l;o={...o,content:p,format:"json",type:"file",size:l.length}}else if(Ue.hasFormat(s,"text")){let p=d?as.decode(this._binaryStringToBytes(l)):l;o={...o,content:p,format:"text",type:"file",size:l.length}}else{let p=d?btoa(l):l;o={...o,content:p,format:"base64",type:"file",size:l.length}}}if(o.content)switch(t.format){case"json":{o={...o,size:At.encode(JSON.stringify(o.content)).length};break}case"text":{o={...o,size:At.encode(o.content).length};break}case"base64":break;default:{o={...o,size:0};break}}else o={...o,size:0};return await(await this.storage).setItem(e,o),this._fileChanged.emit({type:"save",oldValue:null,newValue:o}),o}async delete(e){e=decodeURIComponent(e);let t=`${e}/`,n=(await(await this.storage).keys()).filter(s=>s===e||s.startsWith(t));await Promise.all(n.map(this.forgetPath,this)),this._fileChanged.emit({type:"delete",oldValue:{path:e},newValue:null})}async forgetPath(e){await Promise.all([(await this.storage).removeItem(e),(await this.checkpoints).removeItem(e)])}async createCheckpoint(e){var t;let n=await this.checkpoints;e=decodeURIComponent(e);let s=await this.get(e,{content:!0}).catch(()=>null);if(!s)throw Error(`Could not find file with path ${e}`);let r=((t=await n.getItem(e))!==null&&t!==void 0?t:[]).filter(Boolean);return r.push(s),r.length>Ga&&r.splice(0,r.length-Ga),await n.setItem(e,r),{id:`${r.length-1}`,last_modified:s.last_modified}}async listCheckpoints(e){return(await(await this.checkpoints).getItem(e)||[]).filter(Boolean).map(this.normalizeCheckpoint,this)}normalizeCheckpoint(e,t){return{id:t.toString(),last_modified:e.last_modified}}async restoreCheckpoint(e,t){e=decodeURIComponent(e);let n=await(await this.checkpoints).getItem(e)||[],s=parseInt(t),r=n[s];await(await this.storage).setItem(e,r)}async deleteCheckpoint(e,t){e=decodeURIComponent(e);let n=await(await this.checkpoints).getItem(e)||[],s=parseInt(t);n.splice(s,1),await(await this.checkpoints).setItem(e,n)}_handleUploadChunk(e,t,n){let s=atob(e);return n?t+s:s}_binaryStringToBytes(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}async _getFolder(e){let t=new Map;await(await this.storage).iterate((s,r)=>{r.includes("/")||t.set(s.path,s)});for(let s of(await this._getServerDirectory(e)).values())t.has(s.path)||t.set(s.path,s);return e&&t.size===0?null:{name:"",path:e,last_modified:new Date(0).toISOString(),created:new Date(0).toISOString(),format:"json",mimetype:ye.JSON,content:Array.from(t.values()),size:0,writable:!0,type:"directory"}}async _getServerContents(e,t){let n=xe.PathExt.basename(e),r=(await this._getServerDirectory(Le.URLExt.join(e,".."))).get(n);if(!r)return null;if(r=r||{name:n,path:e,last_modified:new Date(0).toISOString(),created:new Date(0).toISOString(),format:"text",mimetype:ye.PLAIN_TEXT,type:"file",writable:!0,size:0,content:""},t!=null&&t.content)if(r.type==="directory"){let a=await this._getServerDirectory(e);r={...r,content:Array.from(a.values())}}else{let a=Le.URLExt.join(Le.PageConfig.getBaseUrl(),"files",e),o=await fetch(a);if(!o.ok)return null;let u=r.mimetype||o.headers.get("Content-Type"),c=xe.PathExt.extname(n);if(r.type==="notebook"||Ue.hasFormat(c,"json")||(u==null?void 0:u.indexOf("json"))!==-1||e.match(/\.(ipynb|[^/]*json[^/]*)$/)){let d=await o.text();r={...r,content:JSON.parse(d),format:"json",mimetype:r.mimetype||ye.JSON,size:At.encode(d).length}}else if(Ue.hasFormat(c,"text")||u.indexOf("text")!==-1){let d=await o.text();r={...r,content:d,format:"text",mimetype:u||ye.PLAIN_TEXT,size:At.encode(d).length}}else{let d=await o.arrayBuffer(),l=new Uint8Array(d);r={...r,content:btoa(l.reduce(this.reduceBytesToString,"")),format:"base64",mimetype:u||ye.OCTET_STREAM,size:l.length}}}return r}async _getServerDirectory(e){let t=this._serverContents.get(e)||new Map;if(!this._serverContents.has(e)){let n=Le.URLExt.join(Le.PageConfig.getBaseUrl(),"api/contents",e,"all.json");try{let s=await fetch(n),r=JSON.parse(await s.text());for(let a of r.content)t.set(a.name,a)}catch(s){console.warn(`don't worry, about ${s}... nothing's broken. If there had been a
10
+ file at ${n}, you might see some more files.`)}this._serverContents.set(e,t)}return t}async _incrementCounter(e){var t;let n=await this.counters,r=((t=await n.getItem(e))!==null&&t!==void 0?t:-1)+1;return await n.setItem(e,r),r}};(function(i){i.EMPTY_NB={metadata:{orig_nbformat:4},nbformat_minor:5,nbformat:4,cells:[]}})(Vn||(Vn={}))});function cs(i){return"node"in i}var Ut,eo,to,no,ds=et(()=>{Ut=16895,eo=33206,to=1,no=2});var so,Ud,Gn,Nd,zd,io,$n,Wn,Jn,Hn,Nt,us=et(()=>{ds();so=":",Ud="/api/drive.v1",Gn=4096,Nd=new TextEncoder,zd=new TextDecoder("utf-8"),io={0:!1,1:!0,2:!0,64:!0,65:!0,66:!0,129:!0,193:!0,514:!0,577:!0,578:!0,705:!0,706:!0,1024:!0,1025:!0,1026:!0,1089:!0,1090:!0,1153:!0,1154:!0,1217:!0,1218:!0,4096:!0,4098:!0},$n=class{constructor(e){this.fs=e}open(e){let t=this.fs.realPath(e.node);this.fs.FS.isFile(e.node.mode)&&(e.file=this.fs.API.get(t))}close(e){if(!this.fs.FS.isFile(e.node.mode)||!e.file)return;let t=this.fs.realPath(e.node),n=e.flags,s=typeof n=="string"?parseInt(n,10):n;s&=8191;let r=!0;s in io&&(r=io[s]),r&&this.fs.API.put(t,e.file),e.file=void 0}read(e,t,n,s,r){if(s<=0||e.file===void 0||r>=(e.file.data.length||0))return 0;let a=Math.min(e.file.data.length-r,s);return t.set(e.file.data.subarray(r,r+a),n),a}write(e,t,n,s,r){var a;if(s<=0||e.file===void 0)return 0;if(e.node.timestamp=Date.now(),r+s>(((a=e.file)===null||a===void 0?void 0:a.data.length)||0)){let o=e.file.data?e.file.data:new Uint8Array;e.file.data=new Uint8Array(r+s),e.file.data.set(o)}return e.file.data.set(t.subarray(n,n+s),r),s}llseek(e,t,n){let s=t;if(n===1)s+=e.position;else if(n===2&&this.fs.FS.isFile(e.node.mode))if(e.file!==void 0)s+=e.file.data.length;else throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);if(s<0)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);return s}},Wn=class{constructor(e){this.fs=e}node(e){return cs(e)?e.node:e}getattr(e){let t=this.node(e);return{...this.fs.API.getattr(this.fs.realPath(t)),mode:t.mode,ino:t.id}}setattr(e,t){let n=this.node(e);for(let[s,r]of Object.entries(t))switch(s){case"mode":n.mode=r;break;case"timestamp":n.timestamp=r;break;case"size":{let a=r,o=this.fs.realPath(n);if(this.fs.FS.isFile(n.mode)&&a>=0){let u=this.fs.API.get(o),c=u.data?u.data:new Uint8Array;a!==c.length&&(a<c.length?u.data=u.data.slice(0,a):(u.data=new Uint8Array(a),u.data.set(c)),this.fs.API.put(o,u))}else console.warn("setattr size of",a,"on",n,"not yet implemented");break}default:console.warn("setattr",s,"of",r,"on",n,"not yet implemented");break}}lookup(e,t){let n=this.node(e),s=this.fs.PATH.join2(this.fs.realPath(n),t),r=this.fs.API.lookup(s);if(!r.ok)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.ENOENT);return this.fs.createNode(n,t,r.mode,0)}mknod(e,t,n,s){let r=this.node(e),a=this.fs.PATH.join2(this.fs.realPath(r),t);return this.fs.API.mknod(a,n),this.fs.createNode(r,t,n,s)}rename(e,t,n){let s=this.node(e),r=this.node(t);this.fs.API.rename(s.parent?this.fs.PATH.join2(this.fs.realPath(s.parent),s.name):s.name,this.fs.PATH.join2(this.fs.realPath(r),n)),s.name=n,s.parent=r}unlink(e,t){this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(e)),t))}rmdir(e,t){this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(this.node(e)),t))}readdir(e){return this.fs.API.readdir(this.fs.realPath(this.node(e)))}symlink(e,t,n){throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)}readlink(e){throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)}},Jn=class{constructor(e){this._driveName=e.driveName,this._mountpoint=e.mountpoint,this.FS=e.FS,this.ERRNO_CODES=e.ERRNO_CODES}lookup(e){return this.request({method:"lookup",path:this.normalizePath(e)})}getmode(e){return this.request({method:"getmode",path:this.normalizePath(e)})}mknod(e,t){return this.request({method:"mknod",path:this.normalizePath(e),data:{mode:t}})}rename(e,t){return this.request({method:"rename",path:this.normalizePath(e),data:{newPath:this.normalizePath(t)}})}readdir(e){let t=this.request({method:"readdir",path:this.normalizePath(e)});return t.push("."),t.push(".."),t}rmdir(e){return this.request({method:"rmdir",path:this.normalizePath(e)})}get(e){let t=this.request({method:"get",path:this.normalizePath(e)});if(!t)throw new this.FS.ErrnoError(this.ERRNO_CODES.ENOENT);let n=t.content,s=t.format;switch(s){case"json":case"text":return{data:Nd.encode(n),format:s};case"base64":{let r=atob(n),a=r.length,o=new Uint8Array(a);for(let u=0;u<a;u++)o[u]=r.charCodeAt(u);return{data:o,format:s}}default:throw new this.FS.ErrnoError(this.ERRNO_CODES.ENOENT)}}put(e,t){switch(t.format){case"json":case"text":return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:zd.decode(t.data)}});case"base64":{let n="";for(let s=0;s<t.data.byteLength;s++)n+=String.fromCharCode(t.data[s]);return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:btoa(n)}})}}}getattr(e){let t=this.request({method:"getattr",path:this.normalizePath(e)});return t.atime&&(t.atime=new Date(t.atime)),t.mtime&&(t.mtime=new Date(t.mtime)),t.ctime&&(t.ctime=new Date(t.ctime)),t.size=t.size||0,t}normalizePath(e){return e.startsWith(this._mountpoint)&&(e=e.slice(this._mountpoint.length)),this._driveName&&(e=`${this._driveName}${so}${e}`),e}},Hn=class extends Jn{constructor(e){super(e),this._baseUrl=e.baseUrl,this._browsingContextId=e.browsingContextId||""}request(e){let t=new XMLHttpRequest;t.open("POST",encodeURI(this.endpoint),!1);let n={data:e,browsingContextId:this._browsingContextId};try{t.send(JSON.stringify(n))}catch(s){console.error(s)}if(t.status>=400)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return JSON.parse(t.responseText)}get endpoint(){return`${this._baseUrl}api/drive`}},Nt=class{constructor(e){this.FS=e.FS,this.PATH=e.PATH,this.ERRNO_CODES=e.ERRNO_CODES,this.API=this.createAPI(e),this.driveName=e.driveName,this.node_ops=new Wn(this),this.stream_ops=new $n(this)}createAPI(e){if(!e.browsingContextId||!e.baseUrl)throw new Error("Cannot create service-worker API without current browsingContextId");return new Hn(e)}mount(e){return this.createNode(null,e.mountpoint,16895,0)}createNode(e,t,n,s){let r=this.FS;if(!r.isDir(n)&&!r.isFile(n))throw new r.ErrnoError(this.ERRNO_CODES.EINVAL);let a=r.createNode(e,t,n,s);return a.node_ops=this.node_ops,a.stream_ops=this.stream_ops,a}getMode(e){return this.API.getmode(e)}realPath(e){let t=[],n=e;for(t.push(n.name);n.parent!==n;)n=n.parent,t.push(n.name);return t.reverse(),this.PATH.join.apply(null,t)}}});var ps,hs,ro=et(()=>{ps=Fe(Y());us();hs=class{constructor(e){this.contentsManager=e.contentsManager}async processDriveRequest(e){switch(e.method){case"readdir":return this.readdir(e);case"rmdir":return this.rmdir(e);case"rename":return this.rename(e);case"getmode":return this.getmode(e);case"lookup":return this.lookup(e);case"mknod":return this.mknod(e);case"getattr":return this.getattr(e);case"get":return this.get(e);case"put":return this.put(e)}throw`Drive request ${e.method} does not exist.`}async readdir(e){let t=await this.contentsManager.get(e.path,{content:!0}),n=[];return t.type==="directory"&&t.content&&(n=t.content.map(s=>s.name)),n}async rmdir(e){return await this.contentsManager.delete(e.path),null}async rename(e){return await this.contentsManager.rename(e.path,e.data.newPath),null}async getmode(e){let t=await this.contentsManager.get(e.path),n;return t.type==="directory"?n=16895:n=33206,n}async lookup(e){let t;try{t={ok:!0,mode:(await this.contentsManager.get(e.path)).type==="directory"?16895:33206}}catch{t={ok:!1}}return t}async mknod(e){let t=await this.contentsManager.newUntitled({path:ps.PathExt.dirname(e.path),type:e.data.mode===16895?"directory":"file",ext:ps.PathExt.extname(e.path)});return await this.contentsManager.rename(t.path,e.path),null}async getattr(e){let t=await this.contentsManager.get(e.path),n=new Date(0).toISOString();return{dev:1,nlink:1,uid:0,gid:0,rdev:0,size:t.size||0,blksize:Gn,blocks:Math.ceil(t.size||0/Gn),atime:t.last_modified||n,mtime:t.last_modified||n,ctime:t.created||n,timestamp:0}}async get(e){let t=await this.contentsManager.get(e.path,{content:!0}),n;return t.type!=="directory"&&(n={content:t.format==="json"?JSON.stringify(t.content):t.content,format:t.format}),n}async put(e){return await this.contentsManager.save(e.path,{content:e.data.format==="json"?JSON.parse(e.data.data):e.data.data,type:"file",format:e.data.format}),null}}});var ao={};wo(ao,{BLOCK_SIZE:()=>Gn,BrowserStorageDrive:()=>ls,ContentsAPI:()=>Jn,DIR_MODE:()=>Ut,DRIVE_API_PATH:()=>Ud,DRIVE_NAME:()=>Za,DRIVE_SEPARATOR:()=>so,DriveContentsProcessor:()=>hs,DriveFS:()=>Nt,DriveFSEmscriptenNodeOps:()=>Wn,DriveFSEmscriptenStreamOps:()=>$n,FILE:()=>Ue,FILE_MODE:()=>eo,MIME:()=>ye,SEEK_CUR:()=>to,SEEK_END:()=>no,ServiceWorkerContentsAPI:()=>Hn,instanceOfStream:()=>cs});var fs=et(()=>{Qa();us();rs();ds();ro()});var _s=Symbol("Comlink.proxy"),So=Symbol("Comlink.endpoint"),xo=Symbol("Comlink.releaseProxy"),Zn=Symbol("Comlink.finalizer"),Lt=Symbol("Comlink.thrown"),vs=i=>typeof i=="object"&&i!==null||typeof i=="function",Co={canHandle:i=>vs(i)&&i[_s],serialize(i){let{port1:e,port2:t}=new MessageChannel;return Vt(i,e),[t,[t]]},deserialize(i){return i.start(),Eo(i)}},ko={canHandle:i=>vs(i)&&Lt in i,serialize({value:i}){let e;return i instanceof Error?e={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:e={isError:!1,value:i},[e,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},ys=new Map([["proxy",Co],["throw",ko]]);function Po(i,e){for(let t of i)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function Vt(i,e=globalThis,t=["*"]){e.addEventListener("message",function n(s){if(!s||!s.data)return;if(!Po(t,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}let{id:r,type:a,path:o}=Object.assign({path:[]},s.data),u=(s.data.argumentList||[]).map(Ge),c;try{let d=o.slice(0,-1).reduce((p,v)=>p[v],i),l=o.reduce((p,v)=>p[v],i);switch(a){case"GET":c=l;break;case"SET":d[o.slice(-1)[0]]=Ge(s.data.value),c=!0;break;case"APPLY":c=l.apply(d,u);break;case"CONSTRUCT":{let p=new l(...u);c=jo(p)}break;case"ENDPOINT":{let{port1:p,port2:v}=new MessageChannel;Vt(i,v),c=Do(p,[p])}break;case"RELEASE":c=void 0;break;default:return}}catch(d){c={value:d,[Lt]:0}}Promise.resolve(c).catch(d=>({value:d,[Lt]:0})).then(d=>{let[l,p]=Bt(d);e.postMessage(Object.assign(Object.assign({},l),{id:r}),p),a==="RELEASE"&&(e.removeEventListener("message",n),ws(e),Zn in i&&typeof i[Zn]=="function"&&i[Zn]())}).catch(d=>{let[l,p]=Bt({value:new TypeError("Unserializable return value"),[Lt]:0});e.postMessage(Object.assign(Object.assign({},l),{id:r}),p)})}),e.start&&e.start()}function Mo(i){return i.constructor.name==="MessagePort"}function ws(i){Mo(i)&&i.close()}function Eo(i,e){let t=new Map;return i.addEventListener("message",function(s){let{data:r}=s;if(!r||!r.id)return;let a=t.get(r.id);if(a)try{a(r)}finally{t.delete(r.id)}}),Qn(i,t,[],e)}function zt(i){if(i)throw new Error("Proxy has been released and is not useable")}function bs(i){return tt(i,new Map,{type:"RELEASE"}).then(()=>{ws(i)})}var Ft=new WeakMap,Kt="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{let e=(Ft.get(i)||0)-1;Ft.set(i,e),e===0&&bs(i)});function Io(i,e){let t=(Ft.get(e)||0)+1;Ft.set(e,t),Kt&&Kt.register(i,e,i)}function Ro(i){Kt&&Kt.unregister(i)}function Qn(i,e,t=[],n=function(){}){let s=!1,r=new Proxy(n,{get(a,o){if(zt(s),o===xo)return()=>{Ro(r),bs(i),e.clear(),s=!0};if(o==="then"){if(t.length===0)return{then:()=>r};let u=tt(i,e,{type:"GET",path:t.map(c=>c.toString())}).then(Ge);return u.then.bind(u)}return Qn(i,e,[...t,o])},set(a,o,u){zt(s);let[c,d]=Bt(u);return tt(i,e,{type:"SET",path:[...t,o].map(l=>l.toString()),value:c},d).then(Ge)},apply(a,o,u){zt(s);let c=t[t.length-1];if(c===So)return tt(i,e,{type:"ENDPOINT"}).then(Ge);if(c==="bind")return Qn(i,e,t.slice(0,-1));let[d,l]=gs(u);return tt(i,e,{type:"APPLY",path:t.map(p=>p.toString()),argumentList:d},l).then(Ge)},construct(a,o){zt(s);let[u,c]=gs(o);return tt(i,e,{type:"CONSTRUCT",path:t.map(d=>d.toString()),argumentList:u},c).then(Ge)}});return Io(r,i),r}function Oo(i){return Array.prototype.concat.apply([],i)}function gs(i){let e=i.map(Bt);return[e.map(t=>t[0]),Oo(e.map(t=>t[1]))]}var Ss=new WeakMap;function Do(i,e){return Ss.set(i,e),i}function jo(i){return Object.assign(i,{[_s]:!0})}function Bt(i){for(let[e,t]of ys)if(t.canHandle(i)){let[n,s]=t.serialize(i);return[{type:"HANDLER",name:e,value:n},s]}return[{type:"RAW",value:i},Ss.get(i)||[]]}function Ge(i){switch(i.type){case"HANDLER":return ys.get(i.name).deserialize(i.value);case"RAW":return i.value}}function tt(i,e,t,n){return new Promise(s=>{let r=To();e.set(r,s),i.start&&i.start(),i.postMessage(Object.assign({id:r},t),n)})}function To(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}fs();var Yn=class{constructor(){this._options=null;this._initializer=null;this._pyodide=null;this._localPath="";this._driveName="";this._driveFS=null;this._sendWorkerMessage=()=>{};this._initialized=new Promise((e,t)=>{this._initializer={resolve:e,reject:t}})}async initialize(e){var t;if(this._options=e,e.location.includes(":")){let n=e.location.split(":");this._driveName=n[0],this._localPath=n[1]}else this._driveName="",this._localPath=e.location;await this.initRuntime(e),await this.initFilesystem(e),await this.initPackageManager(e),await this.initKernel(e),await this.initGlobals(e),(t=this._initializer)==null||t.resolve()}async initRuntime(e){let{pyodideUrl:t,indexUrl:n}=e,s;t.endsWith(".mjs")?s=(await import(t)).loadPyodide:(importScripts(t),s=self.loadPyodide),this._pyodide=await s({indexURL:n,...e.loadPyodideOptions})}async initPackageManager(e){if(!this._options)throw new Error("Uninitialized");let{pipliteWheelUrl:t,disablePyPIFallback:n,pipliteUrls:s,loadPyodideOptions:r}=this._options,a=(r||{}).packages||[];a.includes("micropip")||await this._pyodide.loadPackage(["micropip"]),a.includes("piplite")||await this._pyodide.runPythonAsync(`
11
11
  import micropip
12
12
  await micropip.install('${t}', keep_going=True)
13
13
  `),await this._pyodide.runPythonAsync(`
@@ -15,7 +15,7 @@ var mo=Object.create;var Gn=Object.defineProperty;var go=Object.getOwnPropertyDe
15
15
  piplite.piplite._PIPLITE_DISABLE_PYPI = ${n?"True":"False"}
16
16
  piplite.piplite._PIPLITE_URLS = ${JSON.stringify(s)}
17
17
  `)}async initKernel(e){let t=(e.loadPyodideOptions||{}).packages||[],n=["ssl","sqlite3","ipykernel","comm","pyodide_kernel","jedi","ipython"],s=[];for(let r of n)t.includes(r)||s.push(`await piplite.install('${r}', keep_going=True)`);s.push("import pyodide_kernel"),e.mountDrive&&this._localPath&&s.push("import os",`os.chdir("${this._localPath}")`),await this._pyodide.runPythonAsync(s.join(`
18
- `))}async initGlobals(e){let{globals:t}=this._pyodide;this._kernel=t.get("pyodide_kernel").kernel_instance.copy(),this._stdout_stream=t.get("pyodide_kernel").stdout_stream.copy(),this._stderr_stream=t.get("pyodide_kernel").stderr_stream.copy(),this._interpreter=this._kernel.interpreter.copy(),this._interpreter.send_comm=this.sendComm.bind(this)}async initFilesystem(e){if(e.mountDrive){let t="/drive",{FS:n,PATH:s,ERRNO_CODES:r}=this._pyodide,{baseUrl:a}=e,{DriveFS:o}=await Promise.resolve().then(()=>(ps(),ao)),u=new o({FS:n,PATH:s,ERRNO_CODES:r,baseUrl:a,driveName:this._driveName,mountpoint:t});n.mkdirTree(t),n.mount(u,{},t),n.chdir(t),this._driveFS=u}}mapToObject(e){let t=e instanceof Array?[]:{};return e.forEach((n,s)=>{t[s]=n instanceof Map||n instanceof Array?this.mapToObject(n):n}),t}formatResult(e){if(!(e instanceof this._pyodide.ffi.PyProxy))return e;let t=e.toJs();return this.mapToObject(t)}registerCallback(e){this._sendWorkerMessage=e}async setup(e){await this._initialized,this._kernel._parent_header=this._pyodide.toPy(e)}async execute(e,t){await this.setup(t);let n=(l,p,v)=>{let _={execution_count:l,data:this.formatResult(p),metadata:this.formatResult(v)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"execute_result"})},s=(l,p,v)=>{let _={ename:l,evalue:p,traceback:v};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"execute_error"})},r=l=>{let p={wait:this.formatResult(l)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:p,type:"clear_output"})},a=(l,p,v)=>{let _={data:this.formatResult(l),metadata:this.formatResult(p),transient:this.formatResult(v)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"display_data"})},o=(l,p,v)=>{let _={data:this.formatResult(l),metadata:this.formatResult(p),transient:this.formatResult(v)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"update_display_data"})},u=(l,p)=>{let v={name:this.formatResult(l),text:this.formatResult(p)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:v,type:"stream"})};this._stdout_stream.publish_stream_callback=u,this._stderr_stream.publish_stream_callback=u,this._interpreter.display_pub.clear_output_callback=r,this._interpreter.display_pub.display_data_callback=a,this._interpreter.display_pub.update_display_data_callback=o,this._interpreter.displayhook.publish_execution_result=n,this._interpreter.input=this.input.bind(this),this._interpreter.getpass=this.getpass.bind(this);let c=await this._kernel.run(e.code),d=this.formatResult(c);return d.status==="error"&&s(d.ename,d.evalue,d.traceback),d}async complete(e,t){await this.setup(t);let n=this._kernel.complete(e.code,e.cursor_pos);return this.formatResult(n)}async inspect(e,t){await this.setup(t);let n=this._kernel.inspect(e.code,e.cursor_pos,e.detail_level);return this.formatResult(n)}async isComplete(e,t){await this.setup(t);let n=this._kernel.is_complete(e.code);return this.formatResult(n)}async commInfo(e,t){await this.setup(t);let n=this._kernel.comm_info(e.target_name);return{comms:this.formatResult(n),status:"ok"}}async commOpen(e,t){await this.setup(t);let n=this._kernel.comm_manager.comm_open(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(n)}async commMsg(e,t){await this.setup(t);let n=this._kernel.comm_manager.comm_msg(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(n)}async commClose(e,t){await this.setup(t);let n=this._kernel.comm_manager.comm_close(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(n)}async inputReply(e,t){await this.setup(t),this._resolveInputReply(e)}async sendInputRequest(e,t){let n={prompt:e,password:t};this._sendWorkerMessage({type:"input_request",parentHeader:this.formatResult(this._kernel._parent_header).header,content:n})}async getpass(e){return e=typeof e=="undefined"?"":e,await this.sendInputRequest(e,!0),(await new Promise(s=>{this._resolveInputReply=s})).value}async input(e){return e=typeof e=="undefined"?"":e,await this.sendInputRequest(e,!1),(await new Promise(s=>{this._resolveInputReply=s})).value}async sendComm(e,t,n,s,r){this._sendWorkerMessage({type:e,content:this.formatResult(t),metadata:this.formatResult(n),ident:this.formatResult(s),buffers:this.formatResult(r),parentHeader:this.formatResult(this._kernel._parent_header).header})}};var hs=class extends At{createAPI(e){return new ut(e.baseUrl,e.driveName,e.mountpoint,e.FS,e.ERRNO_CODES)}},fs=class extends Hn{constructor(){super(),this._sendWorkerMessage=e=>{postMessage({_kernelMessage:e})}}async initFilesystem(e){if(e.mountDrive){let t="/drive",{FS:n,PATH:s,ERRNO_CODES:r}=this._pyodide,{baseUrl:a}=e,o=new hs({FS:n,PATH:s,ERRNO_CODES:r,baseUrl:a,driveName:this._driveName,mountpoint:t});n.mkdirTree(t),n.mount(o,{},t),n.chdir(t),this._driveFS=o}}},Kd=new fs;Vt(Kd);export{fs as PyodideComlinkKernel};
18
+ `))}async initGlobals(e){let{globals:t}=this._pyodide;this._kernel=t.get("pyodide_kernel").kernel_instance.copy(),this._stdout_stream=t.get("pyodide_kernel").stdout_stream.copy(),this._stderr_stream=t.get("pyodide_kernel").stderr_stream.copy(),this._interpreter=this._kernel.interpreter.copy(),this._interpreter.send_comm=this.sendComm.bind(this)}async initFilesystem(e){if(e.mountDrive){let t="/drive",{FS:n,PATH:s,ERRNO_CODES:r}=this._pyodide,{baseUrl:a}=e,{DriveFS:o}=await Promise.resolve().then(()=>(fs(),ao)),u=new o({FS:n,PATH:s,ERRNO_CODES:r,baseUrl:a,driveName:this._driveName,mountpoint:t,browsingContextId:this._browsingContextId});n.mkdirTree(t),n.mount(u,{},t),n.chdir(t),this._driveFS=u}}mapToObject(e){let t=e instanceof Array?[]:{};return e.forEach((n,s)=>{t[s]=n instanceof Map||n instanceof Array?this.mapToObject(n):n}),t}formatResult(e){if(!(e instanceof this._pyodide.ffi.PyProxy))return e;let t=e.toJs();return this.mapToObject(t)}registerCallback(e){this._sendWorkerMessage=e}async setup(e){await this._initialized,this._kernel._parent_header=this._pyodide.toPy(e)}async execute(e,t){await this.setup(t);let n=(l,p,v)=>{let _={execution_count:l,data:this.formatResult(p),metadata:this.formatResult(v)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"execute_result"})},s=(l,p,v)=>{let _={ename:l,evalue:p,traceback:v};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"execute_error"})},r=l=>{let p={wait:this.formatResult(l)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:p,type:"clear_output"})},a=(l,p,v)=>{let _={data:this.formatResult(l),metadata:this.formatResult(p),transient:this.formatResult(v)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"display_data"})},o=(l,p,v)=>{let _={data:this.formatResult(l),metadata:this.formatResult(p),transient:this.formatResult(v)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:_,type:"update_display_data"})},u=(l,p)=>{let v={name:this.formatResult(l),text:this.formatResult(p)};this._sendWorkerMessage({parentHeader:this.formatResult(this._kernel._parent_header).header,bundle:v,type:"stream"})};this._stdout_stream.publish_stream_callback=u,this._stderr_stream.publish_stream_callback=u,this._interpreter.display_pub.clear_output_callback=r,this._interpreter.display_pub.display_data_callback=a,this._interpreter.display_pub.update_display_data_callback=o,this._interpreter.displayhook.publish_execution_result=n,this._interpreter.input=this.input.bind(this),this._interpreter.getpass=this.getpass.bind(this);let c=await this._kernel.run(e.code),d=this.formatResult(c);return d.status==="error"&&s(d.ename,d.evalue,d.traceback),d}async complete(e,t){await this.setup(t);let n=this._kernel.complete(e.code,e.cursor_pos);return this.formatResult(n)}async inspect(e,t){await this.setup(t);let n=this._kernel.inspect(e.code,e.cursor_pos,e.detail_level);return this.formatResult(n)}async isComplete(e,t){await this.setup(t);let n=this._kernel.is_complete(e.code);return this.formatResult(n)}async commInfo(e,t){await this.setup(t);let n=this._kernel.comm_info(e.target_name);return{comms:this.formatResult(n),status:"ok"}}async commOpen(e,t){await this.setup(t);let n=this._kernel.comm_manager.comm_open(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(n)}async commMsg(e,t){await this.setup(t);let n=this._kernel.comm_manager.comm_msg(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(n)}async commClose(e,t){await this.setup(t);let n=this._kernel.comm_manager.comm_close(this._pyodide.toPy(null),this._pyodide.toPy(null),this._pyodide.toPy(e));return this.formatResult(n)}async inputReply(e,t){await this.setup(t),this._resolveInputReply(e)}async sendInputRequest(e,t){let n={prompt:e,password:t};this._sendWorkerMessage({type:"input_request",parentHeader:this.formatResult(this._kernel._parent_header).header,content:n})}async getpass(e){return e=typeof e=="undefined"?"":e,await this.sendInputRequest(e,!0),(await new Promise(s=>{this._resolveInputReply=s})).value}async input(e){return e=typeof e=="undefined"?"":e,await this.sendInputRequest(e,!1),(await new Promise(s=>{this._resolveInputReply=s})).value}async sendComm(e,t,n,s,r){this._sendWorkerMessage({type:e,content:this.formatResult(t),metadata:this.formatResult(n),ident:this.formatResult(s),buffers:this.formatResult(r),parentHeader:this.formatResult(this._kernel._parent_header).header})}};var ms=class extends Yn{constructor(){super(),this._sendWorkerMessage=e=>{postMessage({_kernelMessage:e})}}async initFilesystem(e){if(e.mountDrive){let t="/drive",{FS:n,PATH:s,ERRNO_CODES:r}=this._pyodide,{baseUrl:a,browsingContextId:o}=e,u=new Nt({FS:n,PATH:s,ERRNO_CODES:r,baseUrl:a,driveName:this._driveName,mountpoint:t,browsingContextId:o});n.mkdirTree(t),n.mount(u,{},t),n.chdir(t),this._driveFS=u}}},Ld=new ms;Vt(Ld);export{ms as PyodideComlinkKernel};
19
19
  /*! Bundled license information:
20
20
 
21
21
  comlink/dist/esm/comlink.mjs: